text:
Q: How can I avoid my circles being on top of each other (CSS)? I am trying to make a board of a game but at the moment of modifying the screen the circles are on the other side, I would like to know how to avoid it without having to reduce the size of the circles
Use vuejs to make the loop
But once again you could do so

        .
        .
        .

I have tried to set maximums and minimums but I can not get it to work.
I have this
The problem

My CSS code
.wrapper {
        width: 100%;
        height: 500px;
        margin: 30px auto;
    }

    .circle-container {
        margin: 0;
        position: relative;
        width: 100%;
        height: 100%;

    }

    .circle {
        position: absolute;
        top: 50%;
        left: 50%;
        width: 50px;
        height: 50px;
        border-radius: 50%;
        opacity: 0.7;
    }

.circle:nth-child(1) {
        -webkit-transform: rotate(0deg) translateX(30vw);
        -moz-transform: rotate(0deg) translateX(30vw);
        -ms-transform: rotate(0deg) translateX(30vw);
        -o-transform: rotate(0deg) translateX(30vw);
        transform: rotate(0deg) translateX(30vw);
        background: #ff504f;
    }

    .circle:nth-child(2) {
        -webkit-transform: rotate(12deg) translateX(30vw);
        -moz-transform: rotate(12deg) translateX(30vw);
        -ms-transform: rotate(12deg) translateX(30vw);
        -o-transform: rotate(12deg) translateX(30vw);
        transform: rotate(12deg) translateX(30vw);
        background: yellowgreen;
    }

    .circle:nth-child(3) {
        -webkit-transform: rotate(24deg) translateX(30vw);
        -moz-transform: rotate(24deg) translateX(30vw);
        -ms-transform: rotate(24deg) translateX(30vw);
        -o-transform: rotate(24deg) translateX(30vw);
        transform: rotate(24deg) translateX(30vw);
        background: yellowgreen;
    }

.
.
.
.
30 times


text:
Q: Access site with domain name without editing hosts file or setting up DNS Im setting up multiple sites on IIS 10, using port 80.
This is only in a home env, not accessible from the outside.
I would like all devices to be able to access these sites with domain name,
without editing the hosts file or setting up DNS.
It seems possbible in apache
See here: https://webmasters.stackexchange.com/questions/111006/how-to-access-a-website-through-a-local-area-network-that-localhost-change-to-a
Can it be done in IIS?
Where do I read up on this?
Br

A: The only ways for a computer to know the mapping between a name and an IP address are DNS or local hosts files. What you want is not possibile.

Updated for completeness.
On Windows systems there are two additional ways to map names to IP addresses: a WINS server and the LMHOSTS.SAM file; these are mostly relics of old times when Windows networking didn't use DNS name resolution, but they still work.
A WINS server needs to be hosted by a Windows Server system, so you'd need a server to run it; I don't really think this would fit your needs.
The LMHOSTS.SAM file works like the HOSTS file, but with a different syntax; it's also located in the same place: C:\Windows\System32\drivers\etc.

A: Hi please check site binding and change domain name for each site in binding with port 80  in IIS configuration window.
dDonot forget to put domain names in host file in your computer.

A: Bind to a URL that ends with localtest.me and it will resolve to 127.0.0.1
As others have commented, this is because there is a public DNS that flags this - and all subdomains - to 127.0.0.1. This is useful since if you have a website you need hosting locally and yet have no access to the hosts file, you can just add this website binding in IIS for your site.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to use an insert...returning statement as a "table-like" query in jooq? I am writing a SQL query in the form of INSERT INTO ... RETURNING, and then want to aggregate the results.  This is possible with postgres:
DROP TABLE IF EXISTS __test;
CREATE TEMPORARY TABLE __test
(
    id    int  not null,
    value text not null
);

WITH things AS (
    INSERT INTO __test
        VALUES (1, 'foo'),
               (2, 'bar'),
               (2, 'baz')
        RETURNING *
)
SELECT id,
       array_agg(value)
FROM things
GROUP BY id;

Though I am struggling to find a way to do this with jooq, as an InsertResultStep does not implement Select, nor does it implement Table or TableLike interfaces.  Is there a canonical way to achieve this, or should I be looking for a workaround?
val insertQuery = DSL
     .insertInto(otherTable)
     .select(
         DSL.select(recordPkColumns)
         .from(recordTable)
         .crossJoin(permValues)
         .where(filter(command.command))
     )
     .onConflictDoNothing()
     .returning()

DSL.select()
    .from(insertQuery) // problem is here!

A: As of jOOQ 3.11 (and soon 3.12), this is not yet possible in jOOQ without resorting to plain SQL templating.
The relevant feature request is here: https://github.com/jOOQ/jOOQ/issues/4474


text:
Q: The translation map between elliptic curves is a rational map I want to see a reference or a prove that the following map is a rational map:
Let E be an elliptic curve,$P\in E$ and $T_p$ defined as
$T_p:E\rightarrow E,\text{ }T_P(Q)=P+Q$.
It is important that the prove based on the definition of rational maps. See here for example.
Thanks.

A: Since $+$ is a rational map $E \times E \to E$, and this map is the restriction of $+$ to $E \times \{P\}$, it is a rational map.


text:
Q: how do I customize equation index without losing/hiding it to some of my equations, I wish to add  a extra word within the index, without losing the main, automatic indexing. Something like:
aaa = aaa (1, word)
bbb = bbb (2)
ccc = ccc (3, otherword)

I know about \tag{---}, but if I use it, I stop/hide the main automatic index, don't I?

A: You can define a new macro, say \owntag, that takes the additional word as argument and does two things:

*

*increase the counter equation by one (so that you get an own number for this equation)

*call the \tag command with a concatenation "1, word" of the equation number and your tag

A minimal example would be:
\documentclass{article}

\usepackage{amsmath}

\newcommand{\owntag}[1]{\stepcounter{equation}\tag{\theequation, #1}}

\begin{document}

\begin{align}
    aaa = aaa \owntag{word} \\
    bbb = bbb \\
    ccc = ccc \owntag{otherword}
\end{align}

\end{document}

Using \label to reference the equations gives 1, word and 3, otherword, respectively. An extended version of the macro \owntag that allows for other ways of referencing is shown here.


text:
Q: No route matches {:action=>"edit", :controller=>"quiz_bs", :id=>nil} missing required keys: [:id] I'm trying to link to add an Edit Quiz link in my rails app, but am getting this error:
No route matches {:action=>"edit", :controller=>"quiz_bs", :id=>nil} missing required keys: [:id]

I have looked at similar posts (like this one) but their answers don't seem to solve the problem, even though they present similar situations.
The error is appearing for this line of my application.html.erb code:

    <% if @user.quiz_bs == nil %>
       <%= link_to "Body Structure Quiz", quiz_bs_path %>
    <% else %>
       <%= link_to "Body Structure Quiz ✓", edit_quiz_b_path(id: @user.quiz_bs) %>
    <% end %>

but the link will also be on my show users page:

Body Structure

  <% if @user.quiz_bs == nil %>

<%= link_to "Test Your Body Structure", new_quiz_b_path %>

  <% else %>

<%= @user.quiz_bs.bscode %>

<%= link_to "Retest Results", edit_quiz_b_path(id: @quiz_bs.id) %>

  <% end %>

Here is my quiz_bs_controller:
class QuizBsController < ApplicationController
before_action :require_sign_in

def show
  @quiz_bs = QuizBs.find(params[:id])
end

def new
  @quiz_bs = current_user.quiz_bs || current_user.build_quiz_bs
end

def create
  @quiz_bs = QuizBs.new

  @quiz_bs.bs01 = params[:quiz_bs][:bs01]
  @quiz_bs.bs02 = params[:quiz_bs][:bs02]
  @quiz_bs.bs03 = params[:quiz_bs][:bs03]
  @quiz_bs.bs04 = params[:quiz_bs][:bs04]
  @quiz_bs.bs05 = params[:quiz_bs][:bs05]
  @quiz_bs.bs06 = params[:quiz_bs][:bs06]

  @quiz_bs.user = current_user

if @quiz_bs.save
  flash[:notice] = "Quiz results saved successfully."
  redirect_to user_path(current_user)
else
  flash[:alert] = "Sorry, your quiz results failed to save."
  redirect_to welcome_index_path
end
end

def edit
@quiz_bs = QuizBs.find(params[:id])

@quiz_bs.assign_attributes(quiz_bs_params)

if @quiz_bs.save
  flash[:notice] = "Post was updated successfully."
  redirect_to user_path(current_user)
else
  flash.now[:alert] = "There was an error saving the post. Please try again."
  redirect_to welcome_index_path
end
end

def update
@quiz_bs = QuizBs.find(params[:id])

@quiz_bs.assign_attributes(quiz_bs_params)

if @quiz_bs.save
  flash[:notice] = "Post was updated successfully."
  redirect_to user_path(current_user)
else
  flash.now[:alert] = "There was an error saving the post. Please try again."
  redirect_to welcome_index_path
end
end

private
def quiz_bs_params
params.permit(:bs01, :bs02, :bs03, :bs04, :bs05, :bs06)
end

end

And the corresponding routes are:
        quiz_bs GET    /quiz_bs(.:format)             quiz_bs#index
                POST   /quiz_bs(.:format)             quiz_bs#create
     new_quiz_b GET    /quiz_bs/new(.:format)         quiz_bs#new
    edit_quiz_b GET    /quiz_bs/:id/edit(.:format)    quiz_bs#edit
         quiz_b GET    /quiz_bs/:id(.:format)         quiz_bs#show
                PATCH  /quiz_bs/:id(.:format)         quiz_bs#update
                PUT    /quiz_bs/:id(.:format)         quiz_bs#update

I would be so grateful for any help figuring out the problem here!

A: In application.html.erb, change to:

    <% if current_user.quiz_bs.nil? %>
       <%= link_to "Body Structure Quiz", quiz_bs_path %>
    <% else %>
       <%= link_to "Body Structure Quiz ✓", edit_quiz_b_path(current_user.quiz_bs) %>
    <% end %>

*

*We want to change @user to current_user, as this view is a template for the entire website.  There is no guarantee that @user will be a global variable in each and every controller (and that's probably not what you want here anyway).  Using the current_user method will always be available, and get you the logged in user.

*Note: the id: here is not necessary, the model passed will be used as the id.

In users/show.html.erb, change to:

Body Structure

  <% if @user.quiz_bs == nil %>

<%= link_to "Test Your Body Structure", new_quiz_b_path %>

  <% else %>

<%= @user.quiz_bs.bscode %>

<%= link_to "Retest Results", edit_quiz_b_path(@user.quiz_bs) %>

  <% end %>

*

*@quiz_b is a variable that you would not have defined in your users_controller like you do in the quiz_bs_controller. You are accessing @user.quiz_bs, so you want to link to that particular instance in your code.

The global @quiz_b only works on pages where you have defined this variable, which would be any page under the quiz_b routes.
Finally, in quiz_bs_controller:
def quiz_bs_params
  params.require(:quiz_bs).permit(:bs01, :bs02, :bs03, :bs04, :bs05, :bs06)
end

When using this method in conjunction with a form declared as:
<%= form_for @quiz_bs do |f| %>

You need to require :quiz_bs from your params in order to scope your parameters to the model being edited in the form; in this case, @quiz_bs. Otherwise, no variables will be found when you do update/create the quiz.

A: Here is your problem:
No route matches {:action=>"edit", :controller=>"quiz_bs", :id=>nil} missing required keys: [:id]

You have to pass the Edit action an ID, it's part of the routing structure.  In your routes output it even shows you this:
/quiz_bs/:id/edit

Without that id, the /:id/edit route is simply not going to work -- that is a Rails mechanism.
In your Gemfile:
group :development do
  gem 'pry-rails'
end

And:
bundle install

Then in your application.html.erb above that logic do:
<% binding.pry %>
<% if @user.quiz_bs == nil %>

<%= link_to "Test Your Body Structure", new_quiz_b_path %>

<% else %>

<%= @user.quiz_bs.bscode %>

<%= link_to "Retest Results", edit_quiz_b_path(id: @quiz_bs.id) %>

<% end %>

Now hit the page again.  Pry will cause a debug breakpoint that will allow you to evaluate the @user object in the terminal where your server is currently running.  My best advice to you is to learn to debug your own code -- this is a situation with a lot of context you can't quite provide without providing access to your app.


text:
Q: Correct working with Collections.synchronizedList I am not sure how to properly use the Collections.synchronizedList() implementation.
I have these two:
   public synchronized static List<CurrencyBox> getOrderList() {
        return Collections.synchronizedList(orderList);
    }

and
 public static List<CurrencyBox> getOrderList() {
        return Collections.synchronizedList(orderList);
    }

So as far as I understood, synchronizedList really returns the orderList and not a copy, correct?
So If I want to gurantee atomic operations, like add and remove, which of the implementation above is correct?
And does something maybe changes with Java9? Or is it still the way to go or have you any other suggestion?
Thank you

A: Without context it's a bit hard to tell, from the snippets provided neither give you guaranteed atomic operations.
The documentation states:

Returns a synchronized (thread-safe) list backed by the specified
  list. In order to guarantee serial access, it is critical that all
  access to the backing list is accomplished through the returned list.

So even if you synchronize the method the best you'll get is a guarantee that no two objects are creating the synchronized list at the same time.
You need to wrap the original orderList with Collections.synchronizedList to begin with and return the stored result of that each time.
private static List<CurrencyBox> orderList = Collections.synchronizedList(new ArrayList<CurrencyBox>());
public static List<CurrencyBox> getOrderList() {
    return orderList
}

A: A synchronized list only synchronized methods of this list.
It means a thread won't be able to modify the list while another thread is currently running a method from this list. The object is locked while processing method.
As an example, Let's say two threads run addAllon your list, with 2 different lists (A=A1,A2,A3, B=B1,B2,B3) as parameter.

*

*As the method is synchronized, you can be sure those lists won't be merged randomly like A1,B1,A2,A3,B2,B3

*You don't decide when a thread handover the process to the other thread so you can either get A1,A2,A3,B1,B2,B3 or B1,B2,B3,A1,A2,A3.
Credit : jhamon


text:
Q: Error with processAlgorithm I am preparing a procedure with QGIS that can also work as a python script both in the QGIS python console and in a standalone procedure. The procedure works in the QGIS graphical modeler but not in the QGIS python console. The line that generate the error is after #ERROR WITH NETX LINE
from qgis.core import QgsProcessing
from qgis.core import QgsProcessingAlgorithm
from qgis.core import QgsProcessingMultiStepFeedback
from qgis.core import QgsProcessingParameterVectorLayer
from qgis.core import QgsProcessingParameterFeatureSink
from qgis.core import QgsProcessingParameterVectorDestination
from qgis.core import QgsProcessingParameterDefinition
import processing

class Intsec(QgsProcessingAlgorithm):

    def initAlgorithm(self, config=None):
        param = QgsProcessingParameterVectorLayer('alfog', 'AL_FOG', types=[QgsProcessing.TypeVectorAnyGeometry], defaultValue=None)
        param.setFlags(param.flags() | QgsProcessingParameterDefinition.FlagAdvanced)
        self.addParameter(param)
        self.addParameter(QgsProcessingParameterFeatureSink('Aaaaaa', 'AAAAAA', type=QgsProcessing.TypeVectorAnyGeometry, createByDefault=True, defaultValue=None))
        self.addParameter(QgsProcessingParameterFeatureSink('Bbb', 'BBB', type=QgsProcessing.TypeVectorAnyGeometry, createByDefault=True, defaultValue=None))
        self.addParameter(QgsProcessingParameterFeatureSink('Ccc', 'CCC', type=QgsProcessing.TypeVectorAnyGeometry, createByDefault=True, defaultValue=None))
        self.addParameter(QgsProcessingParameterFeatureSink('Al_fogInt', 'AL_FOG INT', type=QgsProcessing.TypeVectorAnyGeometry, createByDefault=True, defaultValue='G:/R/Procedure/Fogli/Files Fogli/AL_FOG INT.shp'))
        self.addParameter(QgsProcessingParameterVectorDestination('Inyt', 'INYT', type=QgsProcessing.TypeVectorAnyGeometry, createByDefault=True, defaultValue=None))

  #ERROR WITH NETX LINE
  def processAlgorithm(self, parameters, context, model_feedback):
        # Use a multi-step feedback, so that individual child algorithm progress reports are adjusted for the
        # overall progress through the model
        feedback = QgsProcessingMultiStepFeedback(5, model_feedback)
        results = {}
        outputs = {}

        # Polygon self-intersection
        alg_params = {
            'ID': 'Nomefile',
            'POLYGONS': parameters['alfog'],
            'INTERSECT': parameters['Inyt']
        }
        outputs['PolygonSelfintersection'] = processing.run('saga:polygonselfintersection', alg_params, context=context, feedback=feedback, is_child_algorithm=True)
        results['Inyt'] = outputs['PolygonSelfintersection']['INTERSECT']

        feedback.setCurrentStep(1)
        if feedback.isCanceled():
            return {}

        # Extract by attribute
        alg_params = {
            'FIELD': 'OBJECTID',
            'INPUT': outputs['PolygonSelfintersection']['INTERSECT'],
            'OPERATOR': 0,
            'VALUE': '0',
            'OUTPUT': parameters['Aaaaaa']
        }
        outputs['ExtractByAttribute'] = processing.run('native:extractbyattribute', alg_params, context=context, feedback=feedback, is_child_algorithm=True)
        results['Aaaaaa'] = outputs['ExtractByAttribute']['OUTPUT']

        feedback.setCurrentStep(2)
        if feedback.isCanceled():
            return {}

        # Ripara geometrie
        alg_params = {
            'INPUT': outputs['ExtractByAttribute']['OUTPUT'],
            'OUTPUT': parameters['Bbb']
        }
        outputs['RiparaGeometrie'] = processing.run('native:fixgeometries', alg_params, context=context, feedback=feedback, is_child_algorithm=True)
        results['Bbb'] = outputs['RiparaGeometrie']['OUTPUT']

        feedback.setCurrentStep(3)
        if feedback.isCanceled():
            return {}

        # Aggiungi attributi della geometria
        alg_params = {
            'CALC_METHOD': 0,
            'INPUT': outputs['RiparaGeometrie']['OUTPUT'],
            'OUTPUT': parameters['Ccc']
        }
        outputs['AggiungiAttributiDellaGeometria'] = processing.run('qgis:exportaddgeometrycolumns', alg_params, context=context, feedback=feedback, is_child_algorithm=True)
        results['Ccc'] = outputs['AggiungiAttributiDellaGeometria']['OUTPUT']

        feedback.setCurrentStep(4)
        if feedback.isCanceled():
            return {}

        # Aggiungi attributi della geometria
        alg_params = {
            'CALC_METHOD': 2,
            'INPUT': outputs['AggiungiAttributiDellaGeometria']['OUTPUT'],
            'OUTPUT': parameters['Al_fogInt']
        }
        outputs['AggiungiAttributiDellaGeometria'] = processing.run('qgis:exportaddgeometrycolumns', alg_params, context=context, feedback=feedback, is_child_algorithm=True)
        results['Al_fogInt'] = outputs['AggiungiAttributiDellaGeometria']['OUTPUT']
        return results

    def name(self):
        return 'INTSEC'

    def displayName(self):
        return 'INTSEC'

    def group(self):
        return ''

    def groupId(self):
        return ''

    def createInstance(self):
        return Intsec()

The error message:
Traceback (most recent call last):
  File "C:\PROGRA~1\QGIS3~1.10\apps\Python37\lib\code.py", line 63, in runsource

    code = self.compile(source, filename, symbol)
  File "C:\PROGRA~1\QGIS3~1.10\apps\Python37\lib\codeop.py", line 168, in __call__
    return _maybe_compile(self.compiler, source, filename, symbol)
  File "C:\PROGRA~1\QGIS3~1.10\apps\Python37\lib\codeop.py", line 99, in _maybe_compile
    raise err1

  File "C:\PROGRA~1\QGIS3~1.10\apps\Python37\lib\codeop.py", line 87, in _maybe_compile
    code1 = compiler(source + "\n", filename, symbol)

  File "C:\PROGRA~1\QGIS3~1.10\apps\Python37\lib\codeop.py", line 133, in __call__
    codeob = compile(source, filename, symbol, self.flags, 1)
  File "<input>", line 10
    def processAlgorithm(self, parameters, context, model_feedback)
      ^
SyntaxError: invalid syntax

A: You can use this:
from qgis.core import QgsProcessing
from qgis.core import QgsProcessingAlgorithm
from qgis.core import QgsProcessingMultiStepFeedback
from qgis.core import QgsProcessingParameterVectorLayer
from qgis.core import QgsProcessingParameterFeatureSink
from qgis.core import QgsProcessingParameterVectorDestination
from qgis.core import QgsProcessingParameterDefinition
import processing

class Intsec(QgsProcessingAlgorithm):

    def initAlgorithm(self, config=None):
        param = QgsProcessingParameterVectorLayer('alfog', 'AL_FOG', types=[QgsProcessing.TypeVectorAnyGeometry], defaultValue=None)
        param.setFlags(param.flags() | QgsProcessingParameterDefinition.FlagAdvanced)
        self.addParameter(param)
        self.addParameter(QgsProcessingParameterFeatureSink('Aaaaaa', 'AAAAAA', type=QgsProcessing.TypeVectorAnyGeometry, createByDefault=True, defaultValue=None))
        self.addParameter(QgsProcessingParameterFeatureSink('Bbb', 'BBB', type=QgsProcessing.TypeVectorAnyGeometry, createByDefault=True, defaultValue=None))
        self.addParameter(QgsProcessingParameterFeatureSink('Ccc', 'CCC', type=QgsProcessing.TypeVectorAnyGeometry, createByDefault=True, defaultValue=None))
        self.addParameter(QgsProcessingParameterFeatureSink('Al_fogInt', 'AL_FOG INT', type=QgsProcessing.TypeVectorAnyGeometry, createByDefault=True, defaultValue='G:/R/Procedure/Fogli/Files Fogli/AL_FOG INT.shp'))
        self.addParameter(QgsProcessingParameterVectorDestination('Inyt', 'INYT', type=QgsProcessing.TypeVectorAnyGeometry, createByDefault=True, defaultValue=None))

    def processAlgorithm(self, parameters, context, model_feedback):
        # Use a multi-step feedback, so that individual child algorithm progress reports are adjusted for the
        # overall progress through the model
        feedback = QgsProcessingMultiStepFeedback(5, model_feedback)
        results = {}
        outputs = {}

        # Polygon self-intersection
        alg_params = {
            'ID': 'Nomefile',
            'POLYGONS': parameters['alfog'],
            'INTERSECT': parameters['Inyt']
        }
        outputs['PolygonSelfintersection'] = processing.run('saga:polygonselfintersection', alg_params, context=context, feedback=feedback, is_child_algorithm=True)
        results['Inyt'] = outputs['PolygonSelfintersection']['INTERSECT']

        feedback.setCurrentStep(1)
        if feedback.isCanceled():
            return {}

        # Extract by attribute
        alg_params = {
            'FIELD': 'OBJECTID',
            'INPUT': outputs['PolygonSelfintersection']['INTERSECT'],
            'OPERATOR': 0,
            'VALUE': '0',
            'OUTPUT': parameters['Aaaaaa']
        }
        outputs['ExtractByAttribute'] = processing.run('native:extractbyattribute', alg_params, context=context, feedback=feedback, is_child_algorithm=True)
        results['Aaaaaa'] = outputs['ExtractByAttribute']['OUTPUT']

        feedback.setCurrentStep(2)
        if feedback.isCanceled():
            return {}

        # Ripara geometrie
        alg_params = {
            'INPUT': outputs['ExtractByAttribute']['OUTPUT'],
            'OUTPUT': parameters['Bbb']
        }
        outputs['RiparaGeometrie'] = processing.run('native:fixgeometries', alg_params, context=context, feedback=feedback, is_child_algorithm=True)
        results['Bbb'] = outputs['RiparaGeometrie']['OUTPUT']

        feedback.setCurrentStep(3)
        if feedback.isCanceled():
            return {}

        # Aggiungi attributi della geometria
        alg_params = {
            'CALC_METHOD': 0,
            'INPUT': outputs['RiparaGeometrie']['OUTPUT'],
            'OUTPUT': parameters['Ccc']
        }
        outputs['AggiungiAttributiDellaGeometria'] = processing.run('qgis:exportaddgeometrycolumns', alg_params, context=context, feedback=feedback, is_child_algorithm=True)
        results['Ccc'] = outputs['AggiungiAttributiDellaGeometria']['OUTPUT']

        feedback.setCurrentStep(4)
        if feedback.isCanceled():
            return {}

        # Aggiungi attributi della geometria
        alg_params = {
            'CALC_METHOD': 2,
            'INPUT': outputs['AggiungiAttributiDellaGeometria']['OUTPUT'],
            'OUTPUT': parameters['Al_fogInt']
        }
        outputs['AggiungiAttributiDellaGeometria'] = processing.run('qgis:exportaddgeometrycolumns', alg_params, context=context, feedback=feedback, is_child_algorithm=True)
        results['Al_fogInt'] = outputs['AggiungiAttributiDellaGeometria']['OUTPUT']
        return results

    def name(self):
        return 'INTSEC'

    def displayName(self):
        return 'INTSEC'

    def group(self):
        return ''

    def groupId(self):
        return ''

    def createInstance(self):
        return Intsec()


text:
Q: Angular.js with Prerender I was trying to use Prerender locally on port 3000, but phantom.js sometimes crashes and the css links gaves me many 504 http errors. I don't know how to set the links, absolute or relative? but in both ways, gaves me the same error.
My app is running on port 8000, I've added this on html file:
<meta name="fragment" content="!">

I'm using the service like this, it's the right way?
http://localhost:3000/http://127.0.0.1:8000

A: The CSS links causing a 504 isn't a problem. Once you proxy the requests through your webserver, it will work fine.
The correct URL to access to force the request through your middleware to the Prerender server is http://127.0.0.1:8000?_escaped_fragment_=
The middleware will then make it's own request to http://localhost:3000/http://127.0.0.1:8000 and return the page through the middleware.
As for crashing, PhantomJS can crash randomly and you don't have to worry about that when using our hosted service :)


text:
Q: FormKey makes error that Null check operator used on a null value I'm making Instagram with Flutter and I'm adding a comment function under the feed item. However, when I push the comment submit button, the error "Null check operator used on a null value" comes out.
I'm using a formKey to check whether it's valid to submit or not. How can I use it properly and how can I fix this problem? Thank you!
class CommentInput extends StatefulWidget {
  const CommentInput({Key? key, required this.snapshot, required this.postId})
      : super(key: key);

  final snapshot;
  final postId;
  @override
  State<CommentInput> createState() => _CommentInputState();
}

class _CommentInputState extends State<CommentInput> {
  final _commentController = TextEditingController();
  final _formKey = GlobalKey<FormState>();

  @override
  void dispose() {
    super.dispose();
    _commentController.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Form(
      child: Container(
        height: 55.0,
        margin: const EdgeInsets.symmetric(horizontal: 8.0),
        child: Row(
          children: [
            Flexible(
              child: Padding(
                padding: const EdgeInsets.symmetric(horizontal: 12.0),
                child: TextFormField(
                  validator: (input) {
                    if (input == null) {
                      return "Please enter comment";
                    }
                  },
                  controller: _commentController,
                  decoration: const InputDecoration(
                    hintText: "Add a comment...",
                  ),
                ),
              ),
            ),
            GestureDetector(
              child: Container(
                margin: const EdgeInsets.only(right: 8.0),
                child: const Text('Post', style: TextStyle(color: Colors.blue)),
              ),
              onTap: () {
                final isValid = _formKey.currentState!.validate(); //Error Null check operator used on a null value
                if (isValid) {
                  _formKey.currentState!.save();
                  context.read<HomeData>().uploadComment(
                      widget.snapshot.uid,
                      widget.postId,
                      _commentController.text,
                      widget.snapshot.username,
                      widget.snapshot.photoUrl);
                }
              },
            )
          ],
        ),
      ),
    );
  }
}

A: Hey you haven't provide your from key to Form widget yet --
i have updated your code check it -
 @override
  Widget build(BuildContext context) {
    return Form(
      key:_formKey,
      child: Container(
        height: 55.0,
        margin: const EdgeInsets.symmetric(horizontal: 8.0),
        child: Row(
          children: [
            Flexible(
              child: Padding(
                padding: const EdgeInsets.symmetric(horizontal: 12.0),
                child: TextFormField(
                  validator: (input) {
                    if (input == null) {
                      return "Please enter comment";
                    }
                  },
                  controller: _commentController,
                  decoration: const InputDecoration(
                    hintText: "Add a comment...",
                  ),
                ),
              ),
            ),
            GestureDetector(
              child: Container(
                margin: const EdgeInsets.only(right: 8.0),
                child: const Text('Post', style: TextStyle(color: Colors.blue)),
              ),
              onTap: () {
                final isValid = _formKey.currentState!.validate(); //Error Null check operator used on a null value
                if (isValid) {
                  _formKey.currentState!.save();
                  context.read<HomeData>().uploadComment(
                      widget.snapshot.uid,
                      widget.postId,
                      _commentController.text,
                      widget.snapshot.username,
                      widget.snapshot.photoUrl);
                }
              },
            )
          ],
        ),
      ),
    );
  }


text:
Q: Store data available to multiple computers to be changed and rewritten I am trying to write a program that generates a specific serial number but it will be able to be accessed by multiple computers in different locations.
The serial number will look something like this:
(2 letters)AA(month)02(year)16(four numbers)0000
Full thing: AA02160000

The last 4 digits will increment by one every time the user clicks a button.
I need to be able to get that serial number from multiple computers in different locations not on the same network and edit it and rewrite it. I can't have any sort of overlap being a serial number and unique to a specific item. I also can't use a guid for the number otherwise it would be much easier.
What is the best way to do this in C#?
I have considered making a server for it but I was running into problems when trying to create directories to pull the number from because of the drive letter.
Can I access a website that is hosted on a computer in one location and have it grab that serial number and increment it and then place the new value on the website?
A bit of help here would be much appreciated.

A: *

*You could use the Google Docs (or SpreadSheets) and its api.
https://developers.google.com/drive/v3/web/quickstart/dotnet
But you will need access to Internet on all the computers

*Another way is to use UNC shared location in your local network for the file.

*Also you could create WCF service to update it and write/read the SN to a file (no need to set up db for it)


text:
Q: Reachability 2.0 in iPhone I am using Reachability v2.0 in my app.
I have a valid internet connection and able to browse google page in web browser.
 When i am trying to test the reachability status in my App, its always showing "Host is not Reachable".
    NSString *host = @"http://www.google.co.in";

    NSLog(@"host : %@", host);
    Reachability *hostReach = [Reachability reachabilityWithHostName:host];
    if([hostReach currentReachabilityStatus] == NotReachable) {
        NSLog(@"Host is not Reachable");
    } else {
        NSLog(@"Host is reachable");
    }

What is wrong in the above code ??

A: The problem is that the reachabilityWithHostname method is expecting a hostname, not a URL as you've defined.
You need to define the host as :-
NSString *host = @"www.google.co.in";

A: Try implementing this on any function that requires internet connection!
#import "testConnectionViewController.h"
#import "Reachability.h"

@implementation testConnectionViewController

- (void)doWeHasInternets{

  UIAlertView *errorView;
  Reachability *r = [Reachability reachabilityWithHostName:@"m.google.com"];
  NetworkStatus theInternets = [r currentReachabilityStatus];

  if(theInternets == NotReachable) {
    errorView = [[UIAlertView alloc]
                 initWithTitle: @"Network Error"
                 message: @"The internets are down, everyone run for your lives!"
                 delegate: self
                 cancelButtonTitle: @"Nooooooo!" otherButtonTitles: nil];
  }
  else
  {
    errorView = [[UIAlertView alloc]
                 initWithTitle: @"Whew!"
                 message: @"Relax, the internets are here."
                 delegate: self
                 cancelButtonTitle: @"Yay!" otherButtonTitles: nil];
  }

  [errorView show];
  [errorView autorelease];
}

@end


text:
Q: How to create folder in document library in Sharepoint using Adobe Flex3 i need to create a folder and subfolder dynamically in SharePoint list using Adobe Flex3. I haven't get much information in google to achieve this task.. Please help me on this.

A: You can use the SharePoint Web Services API. You can find documentation on the MSDN here.
For your specific request, in order to create a folder you need to use the UpdateListItems method, by passing it the following XML:
<Batch OnError="Continue" PreCalc="TRUE"
ListVersion="0"
ViewName="{EF2F5A21-0FD0-4654-84ED-112B4F5A48F8}">
   <Method ID="1" Cmd="New">
      <Field Name="ID">New</Field>
      <Field Name="FSObjType">1</Field>
      <Field Name="BaseName">Name</Field>
   </Method>
</Batch>

Refer to this page for other usage examples.


text:
Q: Garbage Collection Test Fails? I'm using a Dictionary with weak keys to test if an object has been garbage collected. When all references to the object outside of the dictionary are removed, I expect the dictionary to no longer be populated. It seems to work for an Object, but for a Sprite it indicates that the garbage collection hasn't taken place. Can anyone tell me what I am overlooking?
import flash.utils.Dictionary;

var dictionary:Dictionary=new Dictionary(true);
this.addEventListener(Event.ENTER_FRAME,collectionTest);
var sprite:Sprite=new Sprite();
dictionary[sprite]=true;
sprite=null;
trace(sprite);//traces null

function collectionTest(event:Event):void{
    var cleared:Boolean = true;
    for each (var key:* in dictionary) {
        cleared = false;
    }
    if (cleared) {
        trace("Collection Success.");
    } else {
        trace("Collection Failure");
    }
}

A: I would delete the key as a best practice:
dictionary[sprite] = null;
delete dictionary[sprite];

Note that weak keys indicates the key is eligible for garbage collection and is removed from the table when the object is collected.  It would be unlikely for Garbage Collection to occur immediately within your function.
Dictionary will never remove weak String keys from the table.
There are some known issues regarding methods as keys and AMF serialization.
You need to engage some memory allocation to trigger Garbage Collection.
Using your example, I created 1,500 Sprites and the key was removed within 4-frames:
Output:

null
  Collection Failure
  Collection Failure
  Collection Failure
  Collection Success.

Example code:
package
{
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.utils.Dictionary;

    public class Test extends Sprite
    {

        public var dictionary:Dictionary = new Dictionary(true);

        public function Test()
        {
            addEventListener(Event.ENTER_FRAME, collectionTest);
            var sprite:Sprite = new Sprite();
            dictionary[sprite] = true;
            sprite = null;
            trace(sprite); //traces null
        }

        protected function collectionTest(event:Event):void
        {
            var cleared:Boolean = true;
            for each (var key:* in dictionary)
            {
                cleared = false;
            }
            if (cleared)
                trace("Collection Success.");
            else
                trace("Collection Failure");

            for(var i:uint = 0; i < 500; i++)
            {
                new Sprite();
            }
        }
    }
}


text:
Q: Error: connection timeout - expressjs mongodb mongoose I'm new to express/node and web programming in general. What is the best way to deal with this error when mongoose's mongodb connection times out, this is how I connect:
mongoose.connect(config.mongoUrl);

const db = mongoose.connection;
db.on('error', console.error.bind(console, 'error connecting with mongodb database:'));
db.once('open', function() {
  console.log('connected to mongodb database');
});

This is the error when it times out while my server is running:
error connecting with mongodb database: Error: connection timeout
    at Db. (C:\Users\Sean\OneDrive\webpages\000\lasttry\node_modules\mongoose\lib\drivers\node-mongodb-native\connection.js:169:17)
    at emitTwo (events.js:106:13)
    at Db.emit (events.js:191:7)
    at Server.listener (C:\Users\Sean\OneDrive\webpages\000\lasttry\node_modules\mongodb\lib\db.js:1798:14)
    at emitOne (events.js:96:13)
    at Server.emit (events.js:188:7)
    at Server. (C:\Users\Sean\OneDrive\webpages\000\lasttry\node_modules\mongodb\lib\server.js:274:14)
    at emitOne (events.js:96:13)
    at Server.emit (events.js:188:7)
    at Pool. (C:\Users\Sean\OneDrive\webpages\000\lasttry\node_modules\mongodb-core\lib\topologies\server.js:335:12)
    at emitOne (events.js:96:13)
    at Pool.emit (events.js:188:7)
    at Connection. (C:\Users\Sean\OneDrive\webpages\000\lasttry\node_modules\mongodb-core\lib\connection\pool.js:270:12)
    at Connection.g (events.js:291:16)
    at emitTwo (events.js:106:13)
    at Connection.emit (events.js:191:7)

A: How about on disconnect just reconnect to mongo. See below:
mongoose.connect(config.mongoUrl);

var db = mongoose.connection;
db.on('error', console.error.bind(console, 'error connecting with mongodb database:'));

db.once('open', function() {
  console.log('connected to mongodb database');
});

db.on('disconnected', function () {
   //Reconnect on timeout
   mongoose.connect(config.mongoUrl);
   db = mongoose.connection;
});

You can also set a timeout value on the connection.
mongoose.connect(url, { server: { socketOptions: { connectTimeoutMS: 1000 }}}, function(err) { ... });

Also, make sure that mongo is still running on your machine. A connection timeout could mean mongo isn't running.
Reference: Another stack overflow question

A: *

*Check mongod is running.
typing mongo in shell.

*Add connectTimeoutMS=300000 paramter for you uri.
uri looks like mongodb://localhost/collectionName?connectTimeoutMS=300000


text:
Q: Android: control behaviour of homescreen rotation Is there any way I can achieve the desired behaviour on rotation of the device, as illustrated in the following sketch (the wavy thing is a widget).  Most likely this is something that would be controlled by the launcher, rather than controlled programmatically from any one app -- if so, is there any launcher that allows this?
Basically the reason I'm asking is because I want the widget to behave as illustrated (the widget is what I'm coding), even when the user's device is set to rotate the home screen on device rotation.  Basically the only way I can see this working is if the grid layout is fixed relative to the physical screen, with the app icons just rotating within their box, and the widgets either updating their content for the new layout, or just keeping the previous content (so that the content rotates with the screen).
For updating of widget content, is there any way of detecting screen home screen rotation programmatically (different to screen rotation, since the home screen may not rotate)?  This is relevant to me even for the "what I get" scenario, because the aspect ratio of the widget seems to change when the home screen is rotated, and I need to detect this and update the widget content to fit better.

dfdd

A: Use:
1. layout-sw480dp
2. layout-sw600dp
3. layout-sw720dp

A: You are unlikely to find a solution for this as the home screen (launcher) varies wildly in implementation.  Many launchers don't support landscape orientation, and expecting the launcher to accommodate a widget which can expand in two different directions is simply asking too much of them.
For the launchers which do support landscape orientation, the widget should be repositioned for free without effort on your part.  You may wish to detect which orientation the widget is in (such as via getResources().getConfiguration().orientation) when your provider is choosing a layout, setting up views etc, but that's about it.


text:
Q: querying multiple tables order by time in tables Actually I am stuck in middle of some mysql code. Can anyone suggest a simple question. I have 6-10 (multiple) tables in a database all having different data means not related to each other.
There is no relation between tables, but have posted time inserted in each of the columns of all the tables. All I want is query all the tables sorted by timed column.
Eg:
table1:
recipename | cook | timetocook | dated (auto posted time - php time())
-----------+------+------------+------
abc        | def  |        100 | 10
zxy        | orp  |        102 | 16

table2:
bookname | author | dated (auto posted time - php time())
---------+--------+------
ab       | cd     | 11
ef       | nm     | 14

As you can see there is no relation between the table (I have read about joins), I want to show data one by one according to the posted time asc to desc.
like this:
abc  def  100  10
ab   cd   11
ef   nm   14
zxy  orp  102  16

So any help...to achieve this ???

A: SELECT recipename, cook, timetocook, dated
FROM table1
UNION
SELECT bookname, author, dated, NULL
FROM table2
ORDER BY dated

You have to add NULL value to make sure the column counts is the same the order tables.


text:
Q: Remove white space below image In Firefox only my video thumbnails are displaying mysterious 2-3 pixels of white space between the bottom of my image and its border (see below).
I've tried everything I can think of in Firebug with no luck.
How can I remove this white space?

A: Had this prob, found perfect solution elsewhere if you dont want you use block just add
img { vertical-align: top }

A: You're seeing the space for descenders (the bits that hang off the bottom of 'y' and 'p') because img is an inline element by default.  This removes the gap:
.youtube-thumb img { display: block; }

A: .youtube-thumb img {display:block;} or .youtube-thumb img {float:left;}

A: If you would like to preserve the image as inline you can put vertical-align: top or vertical-align: bottom on it. By default it is aligned on the baseline hence the few pixels beneath it.

A: I've set up a JSFiddle to test several different solutions to this problem.  Based on the [vague] criteria of

1) Maximum flexibility
2) No weird behavior

The accepted answer here of
img { display: block; }

which is recommended by a lot of people (such as in this excellent article), actually ranks fourth.
1st, 2nd, and 3rd place are all a toss-up between these three solutions:
1) The solution given by @Dave Kok and @Hasan Gursoy:
img { vertical-align: top; } /* or bottom */

pros:

*

*All display values work on both the parent and img.

*No very strange behavior; any siblings of the img fall where you'd expect them to.

*Very efficient.

cons:

*

*In the [perfectly valid] case of both the parent and img having `display: inline`, the value of this property can determine the position of the img's parent (a bit strange).

2) Setting font-size: 0; on the parent element:
.parent {
    font-size: 0;
    vertical-align: top;
}
.parent > * {
    font-size: 16px;
    vertical-align: top;
}

Since this one [kind of] requires vertical-align: top on the img, this is basically an extension of the 1st solution.
pros:

*

*All display values work on both the parent and img.

*No very strange behavior; any siblings of the img fall where you'd expect them to.

*Fixes the inline whitespace problem for any siblings of the img.

*Although this still moves the position of the parent in the case of the parent and img both having `display: inline`, at least you can't see the parent anymore.

cons:

*

*Less efficient code.

*This assumes "correct" markup; if the img has text node siblings, they won't show up.

3) Setting line-height: 0 on the parent element:
.parent {
    line-height: 0;
    vertical-align: top;
}
.parent > * {
    line-height: 1.15;
    vertical-align: top;
}

Similar to the 2nd solution in that, to make it fully flexible, it basically becomes an extension of the 1st.
pros:

*

*Behaves like the first two solutions on all display combinations except when the parent and img have `display: inline`.

cons:

*

*Less efficient code.

*In the case of both the parent and img having `display: inline`, we get all sorts of crazy.  (Maybe playing with the `line-height` property isn't the best idea...)

So there you have it.  I hope this helps some poor soul.

A: You can use code below if you don't want to modify block mode:
img{vertical-align:text-bottom}

Or you can use following as Stuart suggests:
img{vertical-align:bottom}

A: I found this question and none of the solutions here worked for me.  I found another solution that got rid of the gaps below images in Chrome.  I had to add line-height:0; to the img selector in my CSS and the gaps below images went away.
Crazy that this problem persists in browsers in 2013.

A: Give the height of the div .youtube-thumb the height of the image. That should set the problem in Firefox browser.
.youtube-thumb{ height: 106px }

A: As stated before, the image is treated as text, so the bottom is to accommodate for those pesky: "p,q,y,g,j"; the easiest solution is to assign the img display:block; in your css.
But this does inhibit the standard image behavior of flowing with the text. To keep that behavior and eliminate the space. I recommend wrapping the image with something like this.


text:
Q: Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline." When I try to connect to soundcloud using below code:
// Create the request.
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"https://soundcloud.com/api"] cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:10.0];

// Create url connection and fire request
NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:request delegate:self];

While I get below error:
Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline." UserInfo={NSUnderlyingError=0x14cfccae0 {Error Domain=kCFErrorDomainCFNetwork Code=-1009 "The Internet connection appears to be offline." UserInfo={NSErrorFailingURLStringKey=https://soundcloud.com/api, NSErrorFailingURLKey=https://soundcloud.com/api, kCFStreamErrorCodeKey=50, kCFStreamErrorDomainKey=1, NSLocalizedDescription=The Internet connection appears to be offline.}}, NSErrorFailingURLStringKey=https://soundcloud.com/api, NSErrorFailingURLKey=https://soundcloud.com/api, kCFStreamErrorDomainKey=1, kCFStreamErrorCodeKey=50, NSLocalizedDescription=The Internet connection appears to be offline.}

The Key is: I am running it on my iPhone, the network is 4G. The code is actually working well when I am using other network through Wifi.

A: i found the solution its because you set timeoutInterval:10.0
in
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"https://soundcloud.com/api"] cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:10.0];

and response didn't get within this time, so all you need to exceed this time or you can also remove this interval

A: The reason is the 4G network turned off for the app on my iPhone, not sure when and why I did it though.

A: Got the error removed by updating my MacOS...


text:
Q: Grafana import API will not return a proper dashboard ID (in response)after importing a new dashboard using API While importing the dashboard, API is not returning proper dashboard ID.
For all the dashboard ID it provides id as 0
If I check the dashboard using Chrome Devtools > Network tab, I'm able to get some id (in increment order).
What Grafana version are you using?
5.2.0-beta3 (previously using 5.1.4)
What datasource are you using?
InfluxDB
What OS are you running grafana on?
Windows 10 Pro
What did you do?
Imported the dashboard using Grafana API
What was the expected result?
Should be able to import the dashboard and as response it should return a dashboard ID
What happened instead?
Able to import the dashboard but not getting proper dashboard ID. For all dashboard it gives ID=0
import requests
url='http://admin:admin@localhost:3000/api/dashboards/import'
data='''{
  "dashboard": {}
  "folderId": 8,
  "overwrite": false
}'''
headers={"Content-Type": 'application/json'}
response = requests.post(url, data=data,headers=headers)
print(response)
print(response.status_code)
print (response.text)

Response
Response [200]
200
{
    "pluginId": "",
    "title": "Template dfsad",
    "imported": true,
    "importedUri": "db/template-dfsad",
    "importedUrl": "/d/uid1098/template-dfsad",
    "slug": "",
    "dashboardId": 0,
    "folderId": 8,
    "importedRevision": 1,
    "revision": 1,
    "description": "",
    "path": "",
    "removed": false
}


text:
Q: how do I translate this javascript code how can I change this code to change my email address.
Thank You for your time reading my request.
Anis

All images copyright :copyright: 2007–2018

A: For those playing at home: double-encoded.
ckcxo49=['%61%6e%69%73%70',['%63%6f%6d','%69%63%6c%6f%75%64'].reverse().join('.')].join('@');kcjxq43='Anis Panjwani';document.write(kcjxq43.link('mai'+'lto:'+ckcxo49));

Unreversed:
anisp com icloud

Come on: it's just url-encoded. Show some initiative.


text:
Q: CAN 2.0 BUS protocol Can any body help me to know how the identifiers are assigned in CAN bus protocol? what does these identifiers tell? For example what is the meaning of this ASCII identifier '152407439'?
Actually, I have CAN data and there are continuous identifiers but I am unable to decode them. Can someone please help me to decode them?
Thanks in advance


text:
Q: Cannot read property '$$state' of undefined error after AngularJS version upgrade I've been working with AngularJS to upgrade our project's version from 1.2.16 to 1.6.4. Since we are using bower as package manager, I've updated the necessary parts of bower.json as below:
{
"name": "takademi",
"version": "0.0.0",
"dependencies": {
  "angular": "1.6.4",
  "json3": "~3.3.1",
  "es5-shim": "~3.1.0",
  "angular-cookies": "1.6.4",
  "angular-sanitize": "1.6.4",
  "angular-animate": "1.6.4",
  "angular-route": "1.6.4",
  "angular-bindonce": "~0.3.1",
  "restangular": "~1.4.0",
  "angular-base64": "~2.0.2",
  "lodash": "~2.4.1"
},
"devDependencies": {
"angular-mocks": "1.2.16",
"angular-scenario": "1.2.16"
},
"appPath": "app"
}

After this update, I ran the project. Now I am able to see angular's version as 1.6.4 but I got below error:
*** process.env.ENV is not defined, assuming 'prod' env
t @ bundle.js:4776
angular.js:14525 TypeError: Cannot read property '$$state' of undefined
    at then (angular.js:16799)
    at addPromiseLikeThing (angular-busy.js:67)
    at angular-busy.js:22
    at Object.forEach (angular.js:403)
    at Object.tracker.reset (angular-busy.js:18)
    at angular-busy.js:175
    at $watchCollectionAction (angular.js:17859)
    at Scope.$digest (angular.js:17999)
    at Scope.$apply (angular.js:18269)
    at done (angular.js:12387)
(anonymous) @ angular.js:14525
getMarketPlace Failed to load resource: the server responded with a status of 401 (Unauthorized)
angular.js:14525 Possibly unhandled rejection: {"data":{"status":401,"module":0,"code":1000,"message":"AUTHENTICATION_REQUIRED","develo    perMessage":null,"moreInfo":null},"status":401,"config": {"method":"GET","transformRequest":[null],"transformResponse":[null],"jsonpCallbackParam":"callback","params":{"v":967},"headers":{"Accept":"application/json, text/plain, */*"},"url":"/portal/rest/market-place/getMarketPlace"},"statusText":"Unauthorized"}
(anonymous) @ angular.js:14525
(anonymous) @ angular.js:11008
processChecks @ angular.js:16860
$digest @ angular.js:17971
$apply @ angular.js:18269
done @ angular.js:12387
completeRequest @ angular.js:12613
requestLoaded @ angular.js:12541

As far as I understood, it simply states that my newly upgraded AngularJS 1.6.4 file doesn't support $$state keyword usage in it. Instead of showing files that we've developed, the error comes from Angular's own file.
Here is the function that chrome browser navigates me to show the error - 16799th line of angular.js:
  function Promise() {
this.$$state = { status: 0 };
  }

  extend(Promise.prototype, {
    then: function(onFulfilled, onRejected, progressBack) {
      if (isUndefined(onFulfilled) && isUndefined(onRejected) && isUndefined(progressBack)) {
        return this;
      }
      var result = new Promise();

      this.$$state.pending = this.$$state.pending || [];
      this.$$state.pending.push([result, onFulfilled, onRejected, progressBack]);
      if (this.$$state.status > 0) scheduleProcessQueue(this.$$state);

      return result;
    },

    'catch': function(callback) {
      return this.then(null, callback);
    },

    'finally': function(callback, progressBack) {
      return this.then(function(value) {
        return handleCallback(value, resolve, callback);
      }, function(error) {
        return handleCallback(error, reject, callback);
      }, progressBack);
    }
  });

I've made a search in SO and Google it a little bit, but I couldn't find any related posts or explanations to my problem. Most of the answers are related to Ruby, or react:
angular showing TypeError: Cannot read property 'state' of undefined
Uncaught TypeError: Cannot read property 'state' of undefined
react: uncaught TypeError: Cannot read property 'state' of undefined
Since I am not aware of the whole features of AngularJS and bower, those answers aren't clear for me.
Can you guys give me a hand on this?
Thanks in advance!

A: The angular-busy module is not created by the AngularJS team. The function addPromiseLikeThing looks suspicious and is the last thing executed before entering the $q library where it blows up. Faking the $q library with a 'promiseLike' object is likely the cause of the error.
In addition AngularJS V1.6 changes the way rejections are handled. The error message:

angular.js:14525 Possibly unhandled rejection: {"data":{"status":401,

is a result of those changes.
For more information, see AngularJS Developer Guide - Migrating to V1.6 ($q)


text:
Q: SQL query: insert values into polygon where features of the polygon intersects another polygon I'm very new to sql so I apologize in advance for my very dummy question...
I'm looking for a way to insert into a table A some values stored in another table B only for the features of table A that intersects features of table B.
I tried this:
insert into schema.table_A(columnKJ1)
select "columnPO4" from schema.table_B
WHERE table_A.geom.STintersects(table_B.geom) = 1

but I get this error message: cross-database references are not implemented
What is the right way to do that please ?

A: You're not allowed to reference table_A in the insert inside the select. The query needs to work stand-alone.
The following should work (untested):
insert into schema.table_A(columnKJ1)
select "columnPO4"
from schema.table_B
join schema.table_A on st_intersects(table_a.geom, table_B.geom);


text:
Q: Generate encrypted IIS app pool identity password using IISWASOnlyAesProvider I'd like to generate an encrypted password using the algorithm used in IIS.
The encrypted value looks like this (in applicationHost.config):
<applicationPools>
    <add name="MyAppPool">
        <processModel identityType="SpecificUser" userName="TestUser"
password="[enc:IISWASOnlyAesProvider:N8mr4dLU6PnMW5xlmCWg6914cKePgeU0fTbxew
ZppiwyTLmBQh0mZnFywQO78pQY:enc]" />
    </add>
</applicationPools>

Reference: http://technet.microsoft.com/en-us/library/dd163536.aspx
I see the machine keys are stored here:
C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys

Reference: http://www.asprangers.com/post/2012/05/03/MachineKeys-on-IIS-7x-Inside-Out.aspx
I'd like to write some c# to do this but i'm not a cryptography expert... Can I use something like the code in the accepted SO answer below using the clear text password and key from machine keys to generate the encrypted password as shown above?
Using AES encryption in C#

A: Why are you trying to generate one like IIS, is it to store it in IIS configuration? If so the configuration API's should do that for you automatically, you can use Microsoft.Web.Administration.ServerManager for that, such as:
    using(ServerManager serverManager = new ServerManager()) {
        Configuration config = serverManager.GetApplicationHostConfiguration();

        ConfigurationSection sitesSection = config.GetSection("system.applicationHost/sites");

        ConfigurationElement virtualDirectoryDefaultsElement = sitesSection.GetChildElement("virtualDirectoryDefaults");
        virtualDirectoryDefaultsElement["password"] = @"asd";

        serverManager.CommitChanges();
    }


text:
Q: How to check for a function's existence in a cocos2d-x class? I have lots of nodes from CCNode subclasses and some of them have the function ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent).
Now my question is if it's possible to check if they own this particular function with SFINAE.
I tried to make it work with the help of that thread: Is it possible to write a template to check for a function's existence? but I can't.
Here's what I have:
template <typename T>
class hasMethodCCTouchBegan
{
    typedef char yes;
    typedef long no;

    template <typename C> static yes test( decltype(&C::ccTouchBegan) ) ;
    template <typename C> static no test(...);

public:
    enum { value = sizeof(test<T>(0)) == sizeof(yes) };
};

Honestly I have no clue what to do.

A: template<class C>
decltype(&C::ccTouchBegan, std::true_type())
methodHelper(int);

template<class C>
std::false_type
methodHelper(...);

template<class C>
struct hasMethodCCTouchBegan : decltype(methodHelper<C>(0))
{
};

This won't work if ccTouchBegan is overloaded. If you want to test whether ccTouchBegan can be called with certain arguments then you can change &C::ccTouchBegan to std::declval<C>().ccTouchBegan(std::declval<CCTouch*>(), std::declval<CCEvent*>()).

A: I personally use (in C++11):
#include <cstdint>

#define DEFINE_HAS_SIGNATURE(traitsName, funcName, signature)               \
    template <typename U>                                                   \
    class traitsName                                                        \
    {                                                                       \
    private:                                                                \
        template<typename T, T> struct helper;                              \
        template<typename T>                                                \
        static std::uint8_t check(helper<signature, &funcName>*);           \
        template<typename T> static std::uint16_t check(...);               \
    public:                                                                 \
        static                                                              \
        constexpr bool value = sizeof(check<U>(0)) == sizeof(std::uint8_t); \
    }

// Create your traits:
DEFINE_HAS_SIGNATURE(has_ccTouchBegan, T::ccTouchBegan, bool (T::*)(CCTouch *, CCEvent *));


text:
Q: Fatal error: Call to a member function setEmailValue() on boolean in
Fatal error: Call to a member function setEmailValue() on boolean in
  /home/babyesse/public_html/app/code/core/Mage/Customer/controllers/AccountController.php
  on line 703

hi am getting this error when the customer are trying to reset their password in magento ver Magento ver. 1.9.0.1
basically it will not event redirect them to the reset account form...
below is the line 703 in the AccountController.php
i followed the error path and can't figure out what is wrong there
public function forgotPasswordAction()
{
    $this->loadLayout();

    $this->getLayout()->getBlock('forgotPassword')->setEmailValue(
        $this->_getSession()->getForgottenEmail()
    );
    $this->_getSession()->unsForgottenEmail();

    $this->_initLayoutMessages('customer/session');
    $this->renderLayout();
}

i am new to magento please help how can i fix it ?

A: Please check in your customer.xml file for "customer_account_forgotpassword".
<customer_account_forgotpassword translate="label">
        <label>Customer Forgot Password Form</label>
        <remove name="right"/>
        <remove name="left"/>

        <reference name="head">
            <action method="setTitle" translate="title" module="customer"><title>Forgot Your Password</title></action>
        </reference>
        <reference name="root">
            <action method="setTemplate"><template>page/1column.phtml</template></action>
            <action method="setHeaderTitle" translate="title" module="customer"><title>Password forgotten</title></action>
        </reference>
        <reference name="content">
            <!--<block type="core/template" name="forgotPassword" template="customer/form/forgotpassword.phtml"/>-->
            <block type="customer/account_forgotpassword" name="forgotPassword" template="customer/form/forgotpassword.phtml" />
        </reference>
    </customer_account_forgotpassword>

A: File: app/design/frontend/Project/theme-name/Magento_Customer/layout/customer_account_forgotpassword.xml
I just renamed name="forgotPassword" to name="forgotPasswords" and it worked:
<referenceContainer name="header.container">
        <block class="Magento\Customer\Block\Account\Forgotpassword" name="forgotPasswords" template="Magento_Customer::form/forgotpassword.phtml">
            <container name="form.additional.info" as="form_additional_info"/>
        </block>
    </referenceContainer>


text:
Q: Delete the nullable object key if its value is not 'true' practice In Angular, if my interface has a nullable boolean property that, as a system developer and maintainer, I know only makes sense when it is set to 'true', is it bad practice to completely remove the object key when its value is anything other than 'true'?
Just to save some browser memory and eventually database space, as the object is being saved there in the form of a JSON string.
interface A { id?: boolean, key: string }

obj: A = { id: false, key: 'Name' }

if (!obj.id) { delete obj.id; }

A: Generally speaking, it's not a good practice to remove object keys from an object or modify it's structure during run time, as it'll lead to confusing and unexpected scenarios if you ever use code that assumes the presence of that key.
The amount of space and memory allocation you'll save by doing this is negligible even at scale and is what would be considered preemptive optimization, which is widely criticized in the Software field and is generally considered a bad thing to do.
The amount of optimization you would receive by doing this, would be taken away from the fact that you now have to write additional logic around the fact that sometimes that object key no longer exists.


text:
Q: I want to do web scraping of this url ->" https://www.youtube.com/@PW-Foundation/videos" I used BeautifulSoup and request libraries but I am getting confused on how to use find_all() to extract url, thumbnail, title, number of views and time of posting of first five videos of the given URL.
from bs4 import BeautifulSoup
import requests
url="https://www.youtube.com/@PW-Foundation/videos"
content=requests.get(url)
soup=BeautifulSoup(content.text,'html.parser')
soup.find_all('div', {"class":"yt-simple-endpoint inline-block style-scope ytd-thumbnail"})

#I tried this but it returns me an empty list.

A: Youtube wants you to accepts cookies before letting you access the page, and automatically redirects you to another page, therefore the HTML you are looking for isn't collected. Since it is a redirection it is not 'behind' the prompt. You can check for yourself by printing the first soup you get.
You could use a bot to 'click' on the accept button, for example with selenium.
PS: after that make sure to check if what you are looking for really exists (I didn't find it)


text:
Q: Should sensitive data be encrypted through both script and database means? I don't know too much about encryption, but is there any benefit to encrypting the already encrypted, lets say passwords? I am aware of salts, but before this is done, does it matter or not?

A: Encryption is 2-way thing, when hashing is 1-way. You can decrypt encrypted sting, while you can't revert hash.
One simple, but good example is using md5 hash + salt: MD5('password' + 'random_string') - no matter PHP or MySQL you use - result is the same. So what you have here - is hash of 'passwordrandom_string', which can be unlikely matched using a dictionaries.
So every time you check the password you do:
if (md5($password . 'random_string') == $hash_from_db)

Updated: but if you really concerned about security (this usually needs to be done only if your application works with very sensitive data), and say more - you have crazy paranoia and insanity about it: there are a lot of hashing methods over the Internet. Find something with random salt (so every password can have almost unlimited amount of hashes), make few changes, combine it with other hashing algorithm - problem solved.
One thing you should know - sometimes the slower hashing works - the better. That means if you somehow have a rat-hole in login-attempts counter this will really slow down bruteforce process.
One example you can take a look on - bcrypt (it uses Java for hashing). Not saying you should use it, just an example of what you should look for.

A: This question has some relevant discussion on the topic. There are cases in which it would be a bad idea and could potentially weaken the encryption as pointed out in the linked thread, so you wouldn't want to do this unless you're really sure of what you're getting into.
The fundamental basis for encryption is that it's easier to encrypt (polynomial time) than it is to decrypt (non-polynomial time). The only way encryption breaks is if either/both of the following is true:

*

*There's a vulnerability in your encryption scheme which decreases the gap between the polynomial time it take you to encrypt and the non-polynomial time you expect it to take an attacker to decrypt.

*Someone has sufficient computational resources to decrypt your data (in non-polynomial time).

It sounds like there are cases where double encryption could actually make issue #1 more probable, so that's dangerous. But issue #2 seems like the bigger one to me. The idea is that an attacker with sufficient computational resources will be able to decrypt my data -- an act which implies that they're willing/able to invest orders of magnitude more computational resources to decrypt my data than I was in encrypting it.
If we accept on fiat that an attacker has the vast computational resources required to decrypt my data, the thought that they could have 2x that many resources doesn't seem unreasonable at all, to me.
And realize also that if you're using the same key, then there's really no added security whatsoever -- once they crack one, they've cracked them both. Potentially there could be value in using two different encryption techniques with two different keys to encrypt something in order to protect against issue #1 popping up for either encryption scheme, but that's surely debatable.

A: You do get some benefits from encrypting twice using different keys. For instance, a file encrypted with weaker ciper and subsequently encrypted again with a stronger cipher and key strength will be harder to break than just having the weak cipher alone. The analogy is putting a flimsy lock box inside of a bank's vault. But, in general, you're better of encrypting with a strong cipher than encrypting twice with a weak cipher.
There are also some instances where it is appropriate for something to be encrypted twice, such as when you cross multiple trust barriers. For instance, you might encrypt your files before sending them to a cloud provider (who you may not trust). If the cloud provider needs to send files to another offsite backup company (who the cloud provide may not trust), they might encrypt it again.
That said, for passwords, you are probably better off with using a strong hash (e.g. sha1) alongside a salt for storing passwords.

A: It depends on what you mean by encryption. If you're actually encrypting information on the database using for example Microsoft's SQL Server encryption engine, then yes it does matter. You should not rely on database level encryption as it's not really secure. The key is still stored on the machine and only prevents naive attackers who do not seek out that key along with the database.
Generally, databases also support exporting data in plaintext when the database is encrypted. This means that if an attacker gets into the system, they can just do that. If they only have the hard drives (external drive is stolen), then it saves you.
Passwords should be hashed in your application and then sent to a database, generally. It's considered secure to generate a 64 byte salt and then use SHA-512(salt || password) where || denotes binary concatenation. Don't use randomized ASCII text for salts and stick with secure random number generators such as /dev/urandom or Microsoft's CryptGenRandom. This makes it so attackers cannot store pre-computed lists of hashes for reverse lookups of common passwords.
If you want to prevent the stolen backup drive scenario you need to also make sure you are backing up your database, keeping encryption on, and storing the keys in a secure environment away from the encrypted database. We call this "separating the lock from the key". Since this doesn't help you in the situation where your database is exported, you also want to do hashing as I mentioned earlier. Hashing in addition to encryption will make it so that 1.) Attackers can't get at other less sensitive information such as names and addresses and 2.) Attackers can't even begin to attempt recovery of passwords or other credentials.
The bottom line is that it depends on your threat model.

A: Yes. It does matter. Storing sensitive data anywhere in plaintext goes beyond bad practice. It's dangerous. Even the standard md5 hash is considered "broken" now, and shouldn't be used on its own without salting it, and perhaps using other hashing combinations in tandem with it. Just to shake things up.
$salt = 'Yh%Gg^!&ud$*';
$encryption = md5(sha1($salt.md5(md5($salt.$_POST['pwd']))));
$query = mysql_query("SELECT * FROM users WHERE name=$uname AND pass=$encryption");

Not exactly the most secure, but if anybody gets their hands on the table information, they won't be able to crack it without knowing the salt and hashing combination.
Ultimately, you need to make an educated decision based on the sensitivity of the data. If you're storing user passwords of any kind, even YOU shouldn't know what they are.


text:
Q: My navigation bar is bigger on one page and smaller on another I will attach 2 different web page codes that i used to create my website also i just want to know why one of my pages has a normal sized nav bar and why the other page has a bigger sized nav bar.
And yes i used https://www.w3schools.com to help me with making the website
This is with the normal sized navbar: https://pastebin.com/gacWNhbK
<!DOCTYPE html>

<title>Information About Lithuania</title>

Home Page

Tourist Destinations

Famous Places

Historical Sites

Information About Lithuania

Lithuania, officially the Republic of Lithuania, is a country in the Baltic region of Europe.

Lithuania is considered to be one of the Baltic states.

The country is situated along the southeastern shore of the Baltic Sea, to the east of Sweden and Denmark.

Language and Alphabet

Only two Baltic languages have survived to modern times, and Lithuanian is one of them (Latvian is the other).

Although they seem similar in some aspects, they are not mutually intelligible.

Much of the population of Lithuania speaks Russian, but visitors should refrain

from using it unless it's absolutely needed - Lithuanians would rather hear someone attempt their language.

The Lithuanians also don't mind practicing their English. German or Polish may help in some areas.

Lithuanian language uses the Latin alphabet with some additional letters and modifications.

Religion

The majority religion of Lithuania is Roman Catholic at 79% of the population.

 Other ethnicities have brought their religion with them,

 such as the Russians with Eastern Orthodoxy and the Tatars with Islam.

©Copyright&copy Web Design 2019-2020 -All Rights Reserved.

<input type="button" name="b1" value="Back to Login Page" onclick="location.href='index.html'">
<input type="button" name="b2" value="Next page" onclick="location.href='touristdestinations.html'">

This is with the oversized narbar which i dont know how to fix: https://pastebin.com/0m22xWbA
<!DOCTYPE html>

<meta name="viewport" content="width=device-width, initial-scale=1">

<title>Tourist Destinations In Lithuania</title>

<meta name="viewport" content="width=device-width, initial-scale=1">

Home Page

Tourist Destinations

Famous Places

Historical Sites

Tourist Destinations In Lithuania

Lit

Vilnius

Vilnius, Lithuania's capital, is known for its baroque architecture, seen especially in its medieval Old Town.

 But the buildings lining this district's partially cobblestoned streets reflect diverse styles and eras, from the neoclassical Vilnius Cathedral to Gothic St. Anne's Church.

 The 16th-century Gate of Dawn, containing a shrine with a sacred Virgin Mary icon, once guarded an entrance to the original city.

1 / 3

Image of Vilnius (1)

2 / 3

Image of Vilnius (2)

3 / 3

Image of Vilnius (3)

Trakai Castle

Trakai is a lake resort and historically important city that sits close to Vilnius and makes a nice day trip if you are looking to get out of town.

Trakai dates from the 13th century and is also the home of the Trakai Historical National Park that dates from 1991.

 One of the main sights in the city is the Island Castle which is also the host of the Trakai Castle Festival and the entire town is surrounded by pretty water.

 In the wider Trakai region there are some 200 lakes to enjoy during the warmer months.

A Link to the Trakai Castle

The Devil's Museum

The Devil's Museum is found in Kaunas and as you would expect from the name it has a huge collection of art work that depict images of the devil, witches, and a range of other wicked mythological creatures.

You will find over 3,000 different pieces here and visitors can even donate items to the collection.

There are a huge range of works here that use different materials such as ceramics, textiles, and paintings and you can even find other interesting items like pebbles that feature images of the devil.

Ginuciai Water Mill

Nestled close to Ignalina is the Ginuciai Water Mill which dates from the 19th century and still straddles the waters that travel down to scenic Lake Linkmenas.

In the days of old it would have been used to make flour and produce electricity although now it is a museum that also has a hotel attached.

It is famous for being the only remaining wooden mill in Lithuania and you can still see all of its traditional machinery such as water wheels and mill stones.

©Copyright&copy Web Design 2019-2020 -All Rights Reserved.
€
™

<button onclick="goBack()">Go Back</button>

<input type="button" name="b1" value="Next page" onclick="location.href='famousplaces.html'">
<button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>

Just as a reminder i do not take any of this work as my own since i used W3Schools to help.
Hope someone can help me.

A: In second code you assign font-size: 20px; in body that affect your nav bar and make it big.
Just add font-size:14px; in li a css.

<!DOCTYPE html>

<meta name="viewport" content="width=device-width, initial-scale=1">

<title>Tourist Destinations In Lithuania</title>

<meta name="viewport" content="width=device-width, initial-scale=1">

Home Page

Tourist Destinations

Famous Places

Historical Sites

Tourist Destinations In Lithuania

Lit

Vilnius

Vilnius, Lithuania's capital, is known for its baroque architecture, seen especially in its medieval Old Town.

 But the buildings lining this district's partially cobblestoned streets reflect diverse styles and eras, from the neoclassical Vilnius Cathedral to Gothic St. Anne's Church.

 The 16th-century Gate of Dawn, containing a shrine with a sacred Virgin Mary icon, once guarded an entrance to the original city.

1 / 3

Image of Vilnius (1)

2 / 3

Image of Vilnius (2)

3 / 3

Image of Vilnius (3)

Trakai Castle

Trakai is a lake resort and historically important city that sits close to Vilnius and makes a nice day trip if you are looking to get out of town.

Trakai dates from the 13th century and is also the home of the Trakai Historical National Park that dates from 1991.

 One of the main sights in the city is the Island Castle which is also the host of the Trakai Castle Festival and the entire town is surrounded by pretty water.

 In the wider Trakai region there are some 200 lakes to enjoy during the warmer months.

A Link to the Trakai Castle

The Devil's Museum

The Devil's Museum is found in Kaunas and as you would expect from the name it has a huge collection of art work that depict images of the devil, witches, and a range of other wicked mythological creatures.

You will find over 3,000 different pieces here and visitors can even donate items to the collection.

There are a huge range of works here that use different materials such as ceramics, textiles, and paintings and you can even find other interesting items like pebbles that feature images of the devil.

Ginuciai Water Mill

Nestled close to Ignalina is the Ginuciai Water Mill which dates from the 19th century and still straddles the waters that travel down to scenic Lake Linkmenas.

In the days of old it would have been used to make flour and produce electricity although now it is a museum that also has a hotel attached.

It is famous for being the only remaining wooden mill in Lithuania and you can still see all of its traditional machinery such as water wheels and mill stones.

©Copyright&copy Web Design 2019-2020 -All Rights Reserved.
€
™

<button onclick="goBack()">Go Back</button>

<input type="button" name="b1" value="Next page" onclick="location.href='famousplaces.html'">
<button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>


text:
Q: How can I get argmaxed torch tensor excluding certain index? I wonder if I can get torch.argmax of my input excluding certain index.
For example,
target = torch.tensor([1,2])
input = torch.tensor([[0.1,0.5,0.2,0.2], [0.1,0.5,0.1,0.3]])

I want to get the maximum value in input excluding the index on the target, so that the result would be
output = torch.tensor([[0.2],[0.5]])

A: You can try this

*

*Set negative infy to the target indices in temp tensor

*Then use torch.max or torch.argmax
tmp_input = input.clone()
tmp_input[range(len(input)), target] = float("-Inf")

torch.max(tmp_input, dim=1).values
tensor([0.2000, 0.5000])

torch.max(tmp_input, dim=1).indices
tensor([3, 1])

torch.argmax(tmp_input, dim=1)
tensor([3, 1])

A: input[target[0]-1,target[1]-1] = -1 # or use -inf
#-1 is added for python indexing style
output  = torch.max(input,dim = 1)


text:
Q: Rest API working well from Postman doesn't work from Salesforce I am beginner to REST APIs. I had a REST api used to login into some third party application. When used from Postman extension of Chrome it works well. However throws some generic error when used from Salesforce execute anonymous:
Httprequest request = new HttpRequest();
Http http = new Http();
request.setMethod('POST');
request.setEndpoint('http://someendpoint.com/service');
request.setTimeout(120000);
String jsonString='{"login":"serviceusername","password":"passwordtologin","clientname":"101","clientappid":"202","clientappkey":"303"}';
request.setBody(jsonString);
System.debug('====='+request.getbody());
//Making call to external REST API
HttpResponse response = http.send(request);
System.debug('====='+response.getbody());

The only thing that I followed before using this api was including endpoint in remote site setting.I keep getting a generic response error saying invalid appkey/clientname. The reason I am saying its generic is because error remains same even when I use invalid username password.  Am I missing something ?
Postman Screenshot:

A: I would use the generate code button in postman, select the cUrl type. Take a look at the headers it generates on the working Postman version (the parameters with the -H) and add them to your apex using the setHeader method.
Something like:
http.setHeader('content-type','application/Json');


text:
Q: How to cache image and scale it correctly? I am currently using SDWebimage and calling it like so, not sure if it is caching or how I can check it? Also, how do I scale it accordingly without it looking stretched. The picture is originally 512 x 512 and I want to scale it down. I saw this post was not sure if I should be using this method? Resize UICollectionView cells after image inside has been downloaded
    //setting up each cell
    -(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView
                     cellForItemAtIndexPath:(NSIndexPath *)indexPath
    {
        CollectionGridCell *myCell = [collectionView
                                        dequeueReusableCellWithReuseIdentifier:@"GridCell"
                                        forIndexPath:indexPath];

        long row = [indexPath row];

           NSURL *baseUrl = [NSURL URLWithString:@"http://example.com/"];

    NSString *imageItemName = [homeImages objectAtIndex:row];
    NSURL *url = [NSURL URLWithString:imageItemName relativeToURL:baseUrl];

   // NSURL *url = /* prepare a url... see note below */
    [myCell.homeImage setImageWithURL:url
                     placeholderImage:[UIImage imageNamed:@"menuButton.png"]
                            completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType) {
                                // inspect cacheType here to make sure it's cached as you want it
                               myCell.homeImage.image = [self resizeImage:image newSize:CGSizeMake(75,75)];

                            }];

    return myCell;

}

- (UIImage *)resizeImage:(UIImage*)image newSize:(CGSize)newSize {
    CGRect newRect = CGRectIntegral(CGRectMake(0, 0, newSize.width, newSize.height));
    CGImageRef imageRef = image.CGImage;

    UIGraphicsBeginImageContextWithOptions(newSize, NO, 0);
    CGContextRef context = UIGraphicsGetCurrentContext();

    // Set the quality level to use when rescaling
    CGContextSetInterpolationQuality(context, kCGInterpolationHigh);
    CGAffineTransform flipVertical = CGAffineTransformMake(1, 0, 0, -1, 0, newSize.height);

    CGContextConcatCTM(context, flipVertical);
    // Draw into the context; this scales the image
    CGContextDrawImage(context, newRect, imageRef);

    // Get the resized image from the context and a UIImage
    CGImageRef newImageRef = CGBitmapContextCreateImage(context);
    UIImage *newImage = [UIImage imageWithCGImage:newImageRef];

    CGImageRelease(newImageRef);
    UIGraphicsEndImageContext();

    return newImage;
}

A: SDWebImage docs says it caches automatically.  As for scaling, there's plenty of net code like this around.  The trick is integrating it with SDWebImage.  Fortunately, it provides a completion block:
NSURL *url = /* prepare a url... see note below */
[myCell.homeImage setImageWithURL:url
               placeholderImage:[UIImage imageNamed:@"menuButton.png"]
                      completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType) {
    // inspect cacheType here to make sure it's cached as you want it
    myCell.homeImage.image = [self scaleImage:image toSize:CGSizeMake(75,75)];
}];

A simple scale would look something like this (not tested):
- (UIImage *)scale:(UIImage *)image toSize:(CGSize)size {
    UIGraphicsBeginImageContextWithOptions(size, NO, 0.0);
    [image drawInRect:CGRectMake(0, 0, size.width, size.height)];
    UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return newImage;
}

Incidentally, I notice that you use generic string manipulation to build the URL.  You'd be better off using the specialized methods on string as follows:
// this can be defined outside cellForRowAtIndexPath
NSURL *baseUrl = [NSURL urlWithString:@"http://example.com/"];

NSString *imageItemName = [homeImages objectAtIndex:row];
NSURL *url = [NSURL URLWithString:imageItemName relativeToURL:baseURL];


text:
Q: How do you approach this? Statistics and probability question On average, the number of traffic accidents in a city is 1 per day. What is the average number of days one needs to wait until the third time that no accident occurs in a day?
Not sure how to proceed with this question, I feel it has something to do with exponential distribution, but I'm not sure how to use it to derive the average/expected value cause it seems like I'm lacking some information.
Edit:
The options are MCQ, and the answer was 3e.
I have no idea how it was derived. I have tried finding the probability of 0 accidents happening in a day using poison distribution. Since they want period of days to wait for the event of having 3 days of no accident, I would assume exponential would also be involved, but I don't know how to link those up to get the average.
Another edit: This isn't a homework question, just a question from a quiz, results are out and I'm confused on how this answer is derived. The lecturer did not give any working.


text:
Q: Properties of the Discrete Logarithm Problem I am self-studying Hoffstein's An Introduction to Mathematical Cryptography, and this is problem 2.3 (p. 107-08).

Let $p$ be a prime and $g$ an element in $\mathbb{F}_p^*$ with order $r$.
(a) Suppose that $x=a$ and $x=b$ are both integer solutions to the equation $g^x \equiv h \pmod{p}$. Prove that $a\equiv b \pmod{p-1}$.
(b) Prove that $\log_g(h_1h_2)\equiv \log_g(h_1)+\log_g(h_2) \pmod{r}$ for all $h_1,h_2 \in \mathbb{F}_p^*$ such that $g^x \equiv h_1 \pmod{p}$ and $g^x \equiv h_2 \pmod{p}$ have integer solutions.
(c) Prove that $\log_g (h^n) \equiv n \log_g(h) \pmod{r}$ for all $h \in \mathbb{F}_p^*$ such that $g^x \equiv h \pmod{p}$ has an integer solution and $n \in \mathbb{Z}$.

My attempt: Feedback highly appreciated
(a) The way to think of a primitive root is that $g$ is a generator in $\pmod{p}$ if and only if the function $f(x) \equiv g^x  \pmod{p}$ is a bijection over the domain $\mathbb{F}_p^*=\{1,2,\dots, p-1\}$. Thus our question comes down to prove:
$$g^{p-1} \equiv 1 \pmod{p}$$
which is exceedingly convenient as it is covered by Fermat's Little Theorem.
Now, since $g$ is a primitive root it follows that if $a \not b$ and $a \in \mathbb{F}_p^*$ then $b=a+(p-1)k$ (for some $k \in \mathbb{Z}$). We have $g^{b}\equiv g^{a+(p-1)k} \pmod{p} \equiv g^{a}\left(g^{p-1} \right)^k \pmod{p} \equiv g^{a}$.  which is the same as $a \equiv b \pmod{p-1} $.
(b) For the next problem
We have that $g^{\log_g (h_1)+\log_g (h_2)} \pmod{p} \equiv g^{\log_g (h_1)}g^{\log_g (h_2)} \pmod{p} \equiv h_1\cdot h_2$
(c) We use the technique of mathematical induction. It is eminently clear that this is true for the base case $k=1$. Let us thus assume that the result holds for all $k$ up to $k=n-1$. We now show that this implies that it also holds for $k=n$. We have that:
\begin{align*}
g^{\log_g (h^{n})} &=g^{\log_g (h^{(n-1)+1})}  \\
&=g^{\log_g(h^{n-1}h)} \\
&=g^{\log_g(h^{n-1})}g^{\log_g(h)} \tag{$\log_g(h_1h_2)\equiv \log_g(h_1)+\log_g(h_2)$} \\
&=g^{(n-1)\log_g(h)}g^{\log_g(h)} \tag{Induction Assumption} \\
&=g^{n\log_g(h)} \tag{Addition Property of Exponential}
\end{align*}
which means that it holds for the induction step as well. This completes the proof.

A: Yes, the given proof is correct if you are given that $g$ is a generator.
However the question does not require (or assume) that $g$ is a generator, but merely that $g$ is some element of order $r$. The largest effect this has on your proof is in your part (a).
For a generic $g$ of order $r$, you are trying to show that necessarily $r \mid (p-1)$. If $r$ does not divide $(p-1)$ then $p-1 = qr + R$ for some remainder $R$ satisfying $0 < R < r$. Then
$$ g^{p-1} = g^{qr} g^R \equiv 1 \cdot g^R \pmod{p}.$$
By Fermat's Little Theorem, we know that $g^{p-1} \equiv 1 \bmod p$, so we see that
$$ g^R \equiv 1 \pmod p.$$
But this contradicts the fact that $r$ is the order of $g$, as $R < r$. This is a contradiction, and so $r \mid (p-1)$.

As an aside, this is a corollary of Lagrange's Theorem, viewing $\mathbb{F}_p^\times$ as a group --- then $r = \# \langle g \rangle {\big|} \# \mathbb{F}_p^\times = p-1$.

Your work for (b) and (c) adapt naturally to a completed part (a).


text:
Q: How to perform pdf report generation in loopback4 Is PDF report generation is possible in Loppback4?? Is there any code for the PDF report generation in Loopback4??

A: LB4 doesn't have a built-in pdf generator. However, you can use any js/ts library to resolve that like using jsPDF, puppeteer, etc.


text:
Q: Random image on Revolution Slider I have 5 possible images for the header of my WP home page.
But I display only one image.
I use revolution Slider to display it (nice text effects ...).
I would like to display randomly one of theses 5 images.
Is that possible ?
I can't find, either on Revolution Slider website, either on any forum how to display one single random image with Revolution Slider. I only found a script to randomize the order of multiple slides.
Thanx for your help.
M

A: I found a solution, it works with Revolution Slider 6.
I wrote that in the custom JS editor associated with Slider Revolution :
const totalSlides = jQuery('rs-slide').size();
const randomIndex = Math.floor(Math.random() * totalSlides);
for (let i = 0 ; i < totalSlides ; i++) {
    if (i !== randomIndex) {
      revapi1.revremoveslide(i);
    }
}


text:
Q: In Skype, can I use a camera installed on another computer? I have two laptops: one has a camera but it is too slow to make a video call; another if fast enough but its camera is broken.
How can I make Skype on the fast one to use the camera from the other one?
I can connect them by remote desktop or SSH.
I think local resources sharing in Remote Desktop is not a solution because I need to be on the fast one, so it should have access to the remote camera, not vice versa. Anyway, when I remote from the slow one, the camera does not appear among sharable resources,


text:
Q: Expressing symmetric function in power-sum basis I am trying to prove the following identity
\begin{equation}
\prod_{i=1}^{m}(1-x_{i}z)^{-u}\prod_{j=1}^{n}(1-y_{i}z)^{-v} \prod_{i=1}^{m}\prod_{j=1}^{n}(1-(x_i +y_j)z)^{-w}\\ = \sum_{\lambda, \mu}c_{\lambda, \mu, \nu, \eta}(u,v,w)\frac{s_{\lambda}({\bf{x}})s_{\mu}({\bf{y}})}{h_{\lambda}h_{\mu}}z^{\mid \mu \mid+ \mid \lambda \mid} \tag{*}\label{star}
\end{equation}
where
$$ c_{\lambda, \mu, \nu, \eta}(u,v,w)= \sum_{\nu\subset \lambda, \,\eta\subset\mu\\ \lvert \nu\rvert= \lvert \eta \rvert} c_{\lambda, \mu}^{\nu, \eta}d_{\nu, \eta}P_{\lambda / \nu , \mu / \eta}(u,v,w,m,n)$$
where $ c_{\lambda, \mu}^{\nu, \eta}\in \mathbb{Q}$ and $ d_{\nu, \eta}\in \mathbb{Q}[w]$ is a monic polynomial of degree $\lvert \nu \rvert$ and
$$ P_{\lambda / \nu , \mu / \eta}= \prod_{(i,j)\in \lambda / \nu}(u+nw +j-i)\prod_{(i,j)\in \mu / \eta}(v+mw+j-i)$$, $h_{\lambda}$ denoting the hook length.
For the case $m=n=1$ we can prove this formula, but in general I can't see the proof. Initially I am trying the following approach, as the LHS of \eqref{star} has an explicit form and we know
$$ \ln\Big(\prod_{i\geq 1}\frac{1}{1-x_i z}\Big) = \sum_{n\geq 1}p_n ({\bf{x}})\frac{z^n}{n}$$
where ${\mathbf{x}}:= (x_1, x_2, \dotsc)$, where $p_{n}({\mathbf{x}})$ denotes the power symmetric basis.
We express the LHS in the power symmetric basis and evaluating to $x_i = 0 $ for $i> m $ and $y_j =0$ for $j> n$.
Similarly we can write
$$ \ln\Bigl(\prod_{i\geq 1}\prod_{j\geq 1}\frac{1}{1-(x_i +y_j) z}\Bigr) = \sum_{j\geq 1} \sum_{n\geq 1}p_n ({\mathbf{x}}+y_j)\frac{z^n}{n}
$$
where ${\mathbf{x}}+y_j = (x_1 + y_j , x_2 +y_j,\dotsc)$
in power symmetric basis.
Now for the RHS we can we write it as a power symmetric basis? Cauchy identity comes to mind but this expression is more general. Any idea will be really helpful.

A: This is not an answer in full, I was hoping if this initiate some more discussion. My idea is to write both sides in a power symmetric basis and show the equality comparing the general coefficient.
So we have the Cauchy identities,
$$\sum_{\lambda}s_{\lambda}({\bf{x}})s_{\lambda}({\bf{y}})   =\exp\left(\sum_{k\geq 1} \frac{p_{k}({\bf{x}})}{k} p_{k}({\bf{y}})\right) $$
Now if we do specialisation replacing $y_j= s$  we have
$$\sum_{\lambda}s_{\lambda}({\bf{x}})s_{\lambda}(s,s,s,\ldots)   =\exp\left(\sum_{k\geq 1} \frac{p_{k}({\bf{x}})}{k} p_{k}(s,s,\ldots)\right)
$$
By the product content formula
we have
$$\sum_{\lambda}s_{\lambda}({\bf{x}})\prod_{(i,j)\in \lambda}\frac{(z+i-j)}{h_{\lambda}((i,j))}   =\exp\left(\sum_{k\geq 1} \frac{p_{k}({\bf{x}})}{k} m z^k\right)\tag{*}  $$
Similarly we can have
$$\sum_{\mu}s_{\mu}({\bf{y}})\prod_{(i,j)\in \lambda}\frac{(z+i-j)}{h_{\mu}((i,j))}   =\exp\left(\sum_{k\geq 1} \frac{p_{k}({\bf{y}})}{k} n z^k\right)\tag{**}  $$
Product of $*$ and $**$ gives expression close to the expression of RHS in power symmetric basis but it does not encaptulate the expression containing the shift $p_{k}({\bf{x+y}})$.


text:
Q: Functions with returns 'table' has no begin...end? If I ever add 'Begin' after 'As' It says incorrect syntax. It works just fine If I'm trying to return one value though.
Instead I should add 'return' after 'as' and open brackets ()
Why is that?
With one value as returns, I can do it fine:
 CREATE FUNCTION MATHEE(@A int,@B int)
 returns int
 as
 begin
    DECLARE @C int

    SET @C = @A + @B

 return @C
 end

With table as returns, I cant:
   CREATE FUNCTION TOP_USERSs(@number int,@bob varchar(20))
RETURNS TABLE
AS
BEGIN

RETURN SELECT agent from Agents where agent = @bob and prime > @number
END

It says :

Incorrect syntax near 'BEGIN'.

It works fine using brackets and without begin..end though:
CREATE FUNCTION TOP_USERSs(@number int,@bob varchar(20))
RETURNS TABLE
AS
RETURN
(
 SELECT agent from Agents where agent = @bob and prime > @number
)

A: RETURNS TABLE creates an inline table-valued function. It supposed to have a single select wrapped in return as its body:
CREATE FUNCTION TOP_USERSs(@number int,@bob varchar(20))
returns table
as return (
    select ...
);

If you want the begin-end syntax, that is a multi-statement table-valued function, and you will then need to declare the table it returns:
CREATE FUNCTION TOP_USERSs(@number int,@bob varchar(20))
returns @result table (agent varchar(10) not null)
as
begin
    insert into @result (agent) ... ;
    ...
    return;
end;

A: RETURNS TABLE in an Inline User-Defined Function & these do not have function bodies

There is no function_body delimited by BEGIN and END.

For example if you added set @number += 1 before the RETURN this would also fail to parse.

A: You can declare fields of Return table as following code:
CREATE FUNCTION TOP_USERSs(@number int,@bob varchar(20))
RETURNS @Result TABLE ( Agent varchar(20) )
AS
BEGIN
    Insert into @Result
    SELECT agent from Agents where agent = @bob and prime > @number

    RETURN
END

A: Per the documentation, there are two kinds of table-valued function, with different syntaxes:

-- Transact-SQL Inline Table-Valued Function Syntax
CREATE [ OR ALTER ] FUNCTION [ schema_name. ] function_name
( [ { @parameter_name [ AS ] [ type_schema_name. ] parameter_data_type
    [ = default ] [ READONLY ] }
    [ ,...n ]
  ]
)
RETURNS TABLE
    [ WITH <function_option> [ ,...n ] ]
    [ AS ]
    RETURN [ ( ] select_stmt [ ) ]
[ ; ]

This is an inline TVF. As the syntax shows, it can include solely a RETURN followed by a SELECT. Nothing more, nothing less.

-- Transact-SQL Multi-Statement Table-Valued Function Syntax
CREATE [ OR ALTER ] FUNCTION [ schema_name. ] function_name
( [ { @parameter_name [ AS ] [ type_schema_name. ] parameter_data_type
    [ = default ] [READONLY] }
    [ ,...n ]
  ]
)
RETURNS @return_variable TABLE <table_type_definition>
    [ WITH <function_option> [ ,...n ] ]
    [ AS ]
    BEGIN
        function_body
        RETURN
    END
[ ; ]

This is a multi-statement TVF. As the name suggests, you can include multiple statements in the definition. But note that you must specify the schema of the returned table as part of the function definitions.