php: laravel slow view render time when rendering javascript for highcharts

Question: I have a strange problem in a website that I'm building. On the page that has the problem I am using a few highcharts. Everything works fine, but the rendering time is much too long (about 5 seconds).
When I inspect it in chrome, I see something like this:

The 8 scripts for the highcharts are in the red box. It's clear that the problem is in there.
To render the scripts for the highcharts (javascript) , I created a controller and views. I use them in the template in this way:
{{ Html::script(url ('/highchart/gauge', [$humidityInside->sd_value , 'humidityInside', 'Luchtvochtigheid binnen','%',0,100,'#55BF3B','#DDDF0D','#DF5353'])) }}

and in the highchart controller I just send the variable to the view:
 public function gauge($value,$divname,$chartTitle,$suffix,$minValue,$maxValue,$colorMin,$colorMed,$colorMax)
        {
            return view('highchart.gauge')->with(compact('value' , 'divname','chartTitle','suffix','minValue','maxValue','colorMin','colorMed','colorMax'));
        }

The view then just renders the javascript, putting in the variables at the right place:
$(function () {

    var gaugeOptions = {

        chart: {
            type: 'solidgauge'
        },

        title: null,

        pane: {
            center: ['50%', '85%'],
            size: '140%',
            startAngle: -90,
            endAngle: 90,
            background: {
                backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || '#EEE',
                innerRadius: '60%',
                outerRadius: '100%',
                shape: 'arc'
            }
        },

        tooltip: {
            enabled: false
        },

        // the value axis
        yAxis: {
            stops: [
                [0.1, '{{ $colorMin }}'], // green
                [0.8, '{{ $colorMed }}'], // yellow
                [0.9, '{{ $colorMax }}'] // red
            ],
            lineWidth: 0,
            minorTickInterval: null,
            tickPixelInterval: 400,
            tickWidth: 0,
            title: {
                y: -70
            },
            labels: {
                y: 16
            }
        },

        plotOptions: {
            solidgauge: {
                dataLabels: {
                    y: 5,
                    borderWidth: 0,
                    useHTML: true
                }
            }
        }
    };

    $('#{{$divname}}').highcharts(Highcharts.merge(gaugeOptions, {
        yAxis: {
            min: {{ $minValue }},
            max: {{ $maxValue }},
            title: {
                text: '{{ $chartTitle }} '
            }
        },

        credits: {
            enabled: false
        },

        series: [{
            name: '{{ $chartTitle }}',
            data: [{{ $value}} ],
            dataLabels: {
                format: '
{y}
' +
                       '{{$suffix}}
'
            },
            tooltip: {
                valueSuffix: ' {{$suffix}}'
            }
        }]

    }));

});

As you can see in the image, the first script works quite ok, but the render time of every following script is going up for one or another reason. If I just render the script for one of the charts, it's working fine.
Any idea what's slowing me down?
Comment: What happens if you try to open the script from the browser directly? Does it take that long?
Comment: Also, exactly how much data is contained within `{{ $value }}`? To be perfectly honest, I'm not sure why you aren't just using an ajax call to load the data into js instead of using the server to generate a js file?
Comment: where are you getting the data from your controllers to pass it to the charts?
Answer: This is actually not a Laravel issue. Before I get into the slow load times, if you want to return a script, you need to set the correct headers.
This:
return view('highchart.gauge')->with(compact('value' , 'divname','chartTitle','suffix','minValue','maxValue','colorMin','colorMed','colorMax'));

Should be this:
return response(view('highchart.gauge')->with(compact('value' , 'divname','chartTitle','suffix','minValue','maxValue','colorMin','colorMed','colorMax')), 200, ['Content-Type' => 'application/javascript']);

Now to answer the slow load times, you are loading...12 scripts or so? In order to minimize load times, you should minimize the number of roundtrips / have fewer HTTP requests. Each browser has a max number of simultaneous HTTP connections per server, which is what your image is illustrating. It's simultaneously loading 2 (or so?) scripts at a time.
In addition to this, you are using Laravel to parse your scripts rather than just simply serving a javascript file. That's a lot of overhead. So what do you need to do?

Minimize HTTP requests.
If possible, just serve a file rather than having the server parse the script.

One way to minimize HTTP requests is to send all the variables at once and then return the concatenated view. In order to concatenate views, you can just use the period like you would with strings:
return response(view(...) . view(...), 200, ['Content-Type' => 'application/javascript']);

Another way, which I would recommend, would be to move your highchart script to your public directory. Then, in your blade file, just store the variables in a javascript array. Your highchart script can then loop through that and initialize the chart(s).
Answer: I had same issues, but after profiling my laravel application, I found that the issue is not highcharts but my queries to database were not optimzied, so I optimezed by avoiding to use Eloquent relationship or eager loading for heavy tables, You can also consider to use temporary tables,below is a sample of raw query in laravel.
public function countOutStanding()
{
    $count=  DB::select("SELECT count(1) as count FROM myTable");
    return array_shift($count)->count;
}


AI based Optimization

Question: I will start an optimization project in a bottlenecked bottling and filling line of a brewery. The goal is to produce the maximum number of cans and bottles of beer with minimum downtime and slowdowns. My managers want this project to be done with a combination of AI + Optimization, according to them, this artificial intelligence system should constantly update its decisions and plan according to the data coming from MES, IoT, ERP and dynamically optimize the process itself without leaving the optimization to planners and operators. I guess classical optimization and machine learning methods will not work here, but I can't think of any other method other than Reinforcement Learning. I am waiting for your recommendations.
Comment: Look at Sequential Decision Analytics by Warren Powell also. His modeling framework is uniquely suited to factory environments.
Answer: Before you can decide the solution for a problem, you need to have a good understanding of the problem.
When you understand the problem better, it is much easier to see which approaches can work and then weigh them against each other to find the one best suited.
Here is an approach you can use:
1. Formulate a clear problem description

What are the decisions you need to impact?
What are the constraints around them?
How often can you change decisions?
What is driving the data updates that require decisions to be changed?

2. Collect data

Do you have all the data needed?
What is the quality of the data?
Is there data available at the right time or do you need to predict some of it?
How often will data be updated?

3. Define requirements for solution method

Who will use the solution?
How big will the problem be?
How often will it need to run?
How will it be used? Should someone be able to overwrite decisions?

4. Evaluate solution methods
Come in with a fresh mind (including your managers). When you have a common understanding of the problem it is much easier to discuss the pros and cons. Then, you can decide if classical optimization and machine learning methods might be a better fit than, e.g., reinforcement learning.
5. Start small and be agile
Building a full system that continuously updates from various sources and directly makes changes is complicated. Consider how you can build a minimum version (proof-of-concept / Minimum-viable-product). This will also help you learn about the problem and the requirements for the solution. The biggest challenge is often around data collection and processing, so I wouldn't be too concerned about picking the "wrong" optimization method as it is easy to change when you have the data. It might make sense to start with something super simple (e.g. like a greedy heuristic), that is more similar to how the problem is being solved today. Then you have a baseline to improve from.
Good luck!
Answer: To add to @Michael Lindahl's answer one classic area of combination of ML/MO (Machine learning & mathematical optimization) is ML enumerates the functions for the objective while MO performs the mini/maximization or closes the gap with a target. ML may also help in identifying influencing parameters or their values, like feature engineering.
AI comes in handy when defining constraints - like based on rewards/low risk-
-what should be the RHS value for a constraint?
-does the constraint need to be binding?
-Are any of the constraints complementary to each other (Complementarity)

AI based Optimization


Cluster analysis in bounded data

Question: I have 261 vectors with 9 attributes. Each attributes contains numbers between 0 and 1. I am not sure what the most appropriate clustering method for this kind of data is. Initially, I used the K-means  algorithm but was reading about the drawbacks of K-means and found that K-means can fail when uniform data is used. This is explained in the following link. How to understand the drawbacks of K-means
So, my questions are: what would be the best way to do a cluster analysis on this kind of data or how can I deal with it?. Also, where could  I implement it (R, Python…)?
Comment: What do you mean `uniform data`? If data are uniform there is no (nonrandom) clusters in it. Or are you saying distribution inside clusters is uniform? What is the shape of the clusters then?
Comment: Maybe Alex is confusing bounded data with uniform data? Attributes being bounded between 0 and 1 will not cause k-means to fail.
Comment: Yes, sorry. I wanted to say bounded. I was just thinking in two attributes (and not in all nine) and a question arises, what if my observations are highly concentrated in a certain range of values, how I can be sure or what can do to get the best possible clusters.
Answer: There is no best way for cluster analysis. You may try different approaches and see which one gives you meaningful clusters.
I would start with visualizing the data:
261 points in 9 dimensions is not ideal for clustering. You should hope that your data has a lower intrinsic dimension. Use methods such as (kernel)-pca to map your data into 2 or 3-dimentions. If you see a cluster structure there, it is a good sign that your data have "cluster structure". Then you can continue on the data mapped to lower dimensional space.
You can also investigate combination of features. If non of the above methods works, then you chances decrease. You can try different clustering algorithms such as k-means, DBSCAN, METIS, kernel k-means and spectral clustering. But it is not easy to judge if the results of these methods are "meaningful".
For implementation, you can use either R, Python or matlab. All of these methods are already implemented in these languages, and you can simply google for it.

Cluster analysis in bounded data


What are the luxuries of Swarga Loka? And how Swarga Loka has been defined in the Vedas?

Question: Can some one fulfill his unsatisfied desires. And after enjoying in sawarg lok can one decide how he /she wants to reincarnate him/herself.reincarnation happens with our will or against our will.
Comment: There are too many questions.
Answer:
What are the luxuries of Swarga Loka? And how Swarga Loka has been defined in the Vedas?

It is a place of material happiness. Indra loka is part of Swarga loka. Vedavya's Yoga Bhashya (Vedavyasa's commentary on Patanjali's Yoga Sutras) describes the heavens. Here is the description for Swarga:

The inhabitants of the Mahendra (Maha Indra's loka) are the six divine
beings...all these have an irresistible will and are endued with the
eight mystic powers such as buoyancy and the rest. Their life span
extends to a kalpa. They rejoice in sexuality and are endowed with
bodies born without sexual intercourse. They have loving Apsaras for
their wives.

There are other pleasures too of course, like eating, drinking, music, etc.
The stay in Swarga is only temporary. Once all his punya has been experienced in swarga, he takes birth again on Earth according to his karma.
Comment: @DarkKnight The passage that I cited in my answer says this: "Their life span extends to a **kalpa.**" One kalpa (one day of BrahmA) is 4.32 billion years, or one thousand mahayugas..
Comment: Thanks but can you tell how many year can some live in heaven.


How to write a character as vulnerable yet capable?

Question: So I have a character who is often very vulnerable. She's easily scared, put down, and often fails at what she's trying to do. But there are a lot of times when she gets serious (particularly in battle, as it's a fantasy novel) and is a very capable fighter. However, the two characters seem so distant from each other, they often seem like different people. I want to lessen the gap, at least in my head, about the two sides of this character. Any thoughts?
Comment: I consider [Brienne of Tarth](https://gameofthrones.fandom.com/wiki/Brienne_of_Tarth) a perfect example of strong, but vulnerable character.
Answer: Vulnerability can be used to communicate capability and humanize your character.
Communicating capability isn't just about the character being a constant badass. You've probably seen a lot of bad action movies where the main character has zero personality besides being "tough," "awesome" and "badass," especially when it comes to female characters - the stereotype of them being reduced to just that one personality trait is well-known and widespread. Having your character just be super awesome and never vulnerable at all, with no internal monologue about what she's doing or how she feels, is essentially no better than having her be cowardly and passive, as either way the character is purely a one-dimensional cardboard cutout. It's harder to relate to somebody who never opens up to others, shows weakness, or talks about their feelings in real life, and the same applies in writing. You probably already know the trope of the "stoic hardass who doesn't like to show feelings."
Instead, consider the fact that most of your audience are humans. (Probably.) They are vulnerable, flawed and imperfect, just like your characters - they probably have a lot of fear, doubt and internal struggle in their daily lives. These things are what make a character relatable, but more than that, it's a character that can overcome these burdens who comes across as truly heroic.
What does that mean? It means that true courage and capability is not a lack of vulnerabilities, but rather the ability to overcome them when it matters. Your character isn't strong because she's able to totally ignore and block out her fear, and have zero vulnerability - rather, she's strong because she fights to overcome her inner demons and fears in a relatable way, and grow as a person by showing moments of vulnerability to others. If she's terrified in combat, she battles within herself to surmount that fear and fight anyway. If she's conflicted about having to confront an inner fear or phobia, she fights hard to do so and prove to herself she's strong enough. All of that is infinitely more relatable to your audience - and communicates far more strength and capability as a person - than just the character fighting with a constant aura of grim, stoic badassery and having nothing interesting to think about or say while doing so. I think this is the ideal way to write a character who is both vulnerable and capable, by having one side feed into the other. She is capable because she can overcome being vulnerable.
And this isn't even all to mention the most wonderful part of a capable, strong character showing moments of vulnerability, which is that one single, powerful moment of weakness and love showing through the cracks can be the best part of your book.
My favorite scene from "The Adventure of the Three Garridebs" shows as much:

"You're not hurt, Watson? For God's sake, say that you are not hurt!" It was worth a wound - it was worth many wounds - to know the depth of loyalty and love which lay behind that cold mask. The clear, hard eyes were dimmed for a moment, and the firm lips were shaking. For the one and only time I caught a glimpse of a great heart as well as of a great brain."
Answer: Vulnerability is a character trait, whereas battle prowess is the result of continued training.
The two are not mutually exclusive. It follows on the other hand that vulnerable characters are affected by the world around them rather than guiding events, they tend to be reactive, and oftentimes they just give up when there is an easy way out. In dire circumstances, the vulnerable may react, and win thanks to their training.
In "The Art of War" Sun Tzu states multiple time that pressing on desperate people will make them wade through hell. The statements are given without any comment on the subjects' character.
Some cherrypicked references:

Do not press a desperate foe too hard. -- Chapter 7: Maneuvering
On desperate ground, fight. -- Chapter 11: The Nine Situations
Soldiers when in desperate straits lose the sense of fear. -- Chapter 11: The Nine Situations
Place your army in deadly peril, and it will survive; -- Chapter 11: The Nine Situations

The only assumption at this point is that soldiers have been continually trained and will resort to their muscle memory if they need to save their life. In any other situation they may just do the bare minimum, or entirely avoid being involved.
Just be coherent and don't fall in the Mary Sue's trap of having a vulnerable character take decisions that would expose their weakness.
Answer: Rationalize it
Having a character who's vulnerable yet capable works because real people can be both those things. Pulling it off means that your character will be three dimensional, realistic. To get there, you have to understand why and how real people have facets like this, then pick what makes sense for your character.
There are a lot of different reasons out there. People who are typically shy can get carried away by their emotions, shedding their hesitancies in the moment. (The stereotypical example is women who get protective of children and animals.) On the flip side, sometimes trauma causes a person to withdraw in certain situations, and sometimes it swallows almost their entire life. Or even whenever she appears capable she's just an imposter, hiding her true feelings of fear. Or could it be that she really did work hard to find her one outlet, her one passion where she can escape her usual failures? You decide.
Include the rationalization
Having you understand the rationale only helps one person.
It's common enough to see complaints from audiences about "plot holes" despite the actions (or more often inaction) of the characters being explained by their personality traits. This often happens because the readers can't understand the perspective of the characters. Make sure your audience empathizes with your character instead of mentally (or physically) yelling at her for making poor decisions. Have your readers feel the judgmental gaze of the people who put her down, for example, so that they can understand and respect why she wouldn't talk to them, even when it would have saved everyone a lot of anguish down the road (a la classic misunderstanding).


content type "custom data"

Question: I have created a content type that has a "number of accepts" field. I want to add a button, "accept", to the content type. When a user clicks it, it will temporarily store their username and etc. Depending on the number of accepts field, the content type will display "1/10 Accepts" for example. How would I be able to do this and have the number of accepts displayed in realtime. thanks!!
Answer: You can create using hook_form_alter() and I get my button on the Add/Edit node form:
<code>$form['actions']['accept_and_adduser'] = array(
  '#type' => 'submit',
  '#value' => 'Save & Add a Lesson',
  '#name' => 'op',
  '#submit' => array('mymodule_node_form_submit'), /* NEED this */
  '#weight' => 1000
);
</code>
But, clicking the button doesn't seem to hit hook_node_submit() or hook_node_insert(). I'm assuming I'm missing a hook or something in the button creation...anyone have any ideas?
Then added this function:
<code>function mymodule_node_form_submit($form, &$form_state) {
  // Do stuff before saving the node, saving the data of users in some table and calculate it

  // Call this to save the node
  node_form_submit($form, $form_state);

  // Do stuff after saving the node
}
</code>

content type "custom data"


What's a common signifier for "pull down to see more"

Question: I have a mobile UI element, and I'd like to design it such that users can pull down on it to see more info about that element. Is there a common signifier that says "hey, pull me down"?
Answer: as everyone has said... the ubiquitous, traditional, and ever present down arrow near (usually to the RIGHT of) your default action/button/label text is customary, like so:

What I like to do, if I feel fancy, is have the drop-down arrow/button animate on a hover/touch, before the actual drag down.
So, for instance (although this is not the prettiest example... quick and dirty), you could have the arrow bounce up and down or animate in a downward direction, then reset back and the top, and continue the cycle as long as the user hovers/touches.
Then, once he/she drags down it then actually opens/drops-down your menu, option list, or whatever...
Answer: I think the standard icon is the down arrow. A quick Google image search of "down icon" reveals:

That said, I also found this for more of a "pull down" feel:
Answer: Generally a small downward arrow is the easiest and simplest way to signify that there is a hidden menu if you click there.
If you want it to be a pull and drag, have it so when you click the button, the menu starts to partially come down and out of it. If they keep dragging, it keeps going down.
If you hate arrows, you can always consider the one time pop up help box that says that instructs the user to drag specific menus.
Hope that helps.


What is the difference between payment for order flow and ECN rebates?

Question: In both payment for order flow and ECN rebates, one gets paid for providing liquidity. What is the difference between payment for order flow and ECN rebates? Are ECN rebates a type of payment for order flow?
Answer: Most ECN's makes money by charging a fee for each transaction.  This is a maker-taker fee arrangement where orders that  provide liquidity (non marketable limit orders) receive a rebate and those who take liquidity (market orders) pay a fee.
Payment For Order Flow is a payment received by a broker for directing orders to a particular market maker who in turn benefits from trading additional volume.
Answer: An ECN is just a matchmaker and does not take any positions. They make money from the difference between charging for taking liquidity and giving rebates for those who provide liquidity. That difference is an average of about $1 per 1000 shares. This is the Tinder of trading.
In a PFOF situation an intermediary buys shares from the market really fast (or already has them in stock) and sells them to the retail client. The client gets to the market maker instead of the exchanges by being directed there by the zero-comission broker.
The intermediary makes enough money off an order to pay themselves and the broker. The client gets 0 commision in turn.
This would be the equivalent of Amazon dropshipping: the best price is at the Chinese manufacturer, the market maker is the Amazon seller and the client who gets 0 commision is the Amazon buyer who gets free shipping.


Downloading with wget

Question: When I download anything by means of wget, how can I set the download directory? I mean just like while normally downloading something from web there's a prompt asking where to save. Is it possible to set the directory while downloading with wget?
Thanks in advance.
Answer: When you open the terminal, by default, you are in your home directory. If you wish to download with wget into some other directory, simply change directories to the desired location; for example:
cd ~/Downloads
wget http://blah/some_file

Or, another example:
cd ~/Desktop
wget http://blah/some_file

Answer: You can use -P option to download contents to a diiferent directory(no need to use cd).syntax:
wget -P <directory where you want to save> <url of the file>

eg:
wget -P /home/basil/Desktop http://icons.iconarchive.com/icons/treetog/junior/256/document-excel-icon.png

Comment: So is it wget -P /directory #link , like that?
Comment: Yes the command in the example provided will download 'document-excel-icon.png' to my desktop

Downloading with wget


PID Parameters effect while tuning

Question: We aways find lots of materials which explain various methods of tuning a PID controller. Also, it is not hard to find out what are those parameters. Once I've read that P and D parameters, in general, help the system to respond fast but may increase overshoot. And the I parameter should help steady state error but may lead the system to instability. My question is: are there general rules which will always be true when dealing with those parameters? Like "always when you increase X parameter will increase overshoot" or things like that. Or it will always depend on the system and I cannot say anything like that?
Comment: Yes. Have a look at the table under "manual editing" on the wikipedia page: http://en.wikipedia.org/wiki/PID_controller. You can always have a feel about the effects of those parameters by comparing them with real life situations, like driving a car. What happens when you react more (accelerate or brake) for the same distance that separates you from the car in front of you? Or its integral ("okay I really have to accelerate now, it's barely doing anything")? Or its derivative ("I'm catching up too quickly with that car")? It gives you a sense it depends on the plant as well (engine, brakes...)
Answer: In practice it is always beneficial to have some kind of model for your object. One useful mathematical model is transfer function. It is hard to get the ideal one but fortunately most of the objects can be approximate by first order inertia.
$$
G\left ( s \right ) = \frac{k}{Ts+1}\cdot e^{T_{0}\cdot s}
$$
Where k is gain, T is time of inertia and T0 is transport delay.
Here is some simple method System Identification Using Time Domain Data
Having such model you can simulate your object with different controller's loopback algorithm using Matlab or Simulink.
In most cases you are not allowed to experiment with the real system but if you can then try this: choose P action first, test the behaviour of the real object then correct it test again and so on. Then you can add I action, test the behaviour of the object then correct it test again and so on. Then you can add D action, test the behaviour of the object then correct it test again and so on. Remember D action is hard to control and it is not used so often as it may seem. If you want to have steady state error = 0 always include I action (it is obligatory to achieve error = 0 in practice).
Your general rules are right but the issue is not so easy. PID's parameters highly depends on the process you want to controll and stability of the system is a different story. Search for example for Hurwitz stability criterion.
Answer: It depends on the system.
Let's make an example and suppose your system is an integrator:
$$ P_1= \frac{1}{s}$$
and you're controlling it with a proportional controller
$$ C_1 = k_p.$$
Then, your closed-loop system behavior will be
$$ P_{CL1}= \frac{k_p}{s+k_p}. $$
In this case, the proportional gain \$ k_p \$ only determines the response time of your system. No overshoot possible, no steady-state error.
Let's consider something somewhat opposite. Take now a plant
$$ P_2= 1$$
and a merely integral controller
$$ C_2 = \frac{k_i}{s}.$$
The closed-loop behavior would here be:
$$ P_{CL2}= \frac{k_i}{s+k_i}, $$
where the integral \$ k_i \$ here plays the same exact role as the proportional gain was playing before.
Anyway, for a wide class of systems, the 'rules of thumb' you heard of apply. Some examples of what to expect you can find here.
Comment: It's an interesting point, but I don't think it answers the question. It's about rules of thumb for the effects of each parameter, for a given plant.
Comment: @MisterMystère What given plant? That's exactly what my answer tried to include. The actual answer to the question ends with the first line.

PID Parameters effect while tuning


Output Beamer notes to a separate PDF file?

Question: Is there a simple way to have Beamer output the presentation notes to a separate PDF file whenever compiling the presentation?  I know one way is to create two master files, one for the presentation and one for the notes, and compile them both every time, but I find this somewhat awkward.
Comment: Getting TeX to output more than one PDF is covered at this question: http://tex.stackexchange.com/q/5228/86.  Although it's possible, it's done by subverting the system (as bloodworks' solution does) and effectively calling a shell script to run `pdflatex` enough times.  For getting two outputs from *one* input, you can see some solutions at this question: http://tex.stackexchange.com/q/1423/86.  For example, my current lecture notes consist of *one* file and nearly 100 symlinks that produce the various versions when compiled.
Answer: There is an option called \setbeameroption{show only notes}
\documentclass{beamer}

%\setbeameroption{show notes}
\setbeameroption{show only notes}
\begin{document}
\frame{\frametitle{FIRST}
On slide
\note{Whatever}
}

\end{document}

Compile, copy the pdf (another name!), comment out  the second setbeameroption as well and compile again.
Sure you could write a makefile (depending on your OS), but if you don´t need the two files after every run it is much easier (or less to code) this way.
For the writing process i recommend to work with the show notes option on (remove %).
Edit
Here comes a one compilation (one click) solution. It makes use of \write18 so pdflatex needs the --shell-escape option.
\write18{./file.sh }

\documentclass{beamer}

\input{out.out}
\begin{document}
\frame{\frametitle{FIRST}
On slide one.
\note{Whatever you want}
}

\end{document}

While file.sh is
#! /bin/bash
echo  > out.out
pdflatex yourname
cp yourname.pdf nonotes.pdf
echo \\setbeameroption{show only notes} > out.out

this file must be executable with e.g.  chmod 777 file.sh an it must be in the same directory as the yourname.tex. This is of course bash so it will only work on unix-like systems.
Replace yourname with the actual name of your tex-file.
What does it do?  First pdflatex will call file.sh which executes pdflatex then copies the resulting pdf into nonotes.pdf. Afterwards it fills out.out with the show only notes option. write18 is finish and the parent pdflatex process will continue. But now that out.out is filled, the parent process will produce a pdf with that option on.
Comment: @marc-van-dongen I am looking for an *automated* way to generate both the presentation and notes. I am well aware of the "show only notes" option. What I want is to get that file without commenting, uncommenting, and renaming files manually.
Comment: @LittleBobbyTables did mac mention `show only notes`? As i said before a makefile could easily be written, when one would know which OS you´re using. Would a makefile work for you?
Comment: It's a hack if I ever saw one - I didn't know write18 does that - But I guess it's what I asked for. I ended up writing a makefile, but it's good to know there's a way around it.
Answer: I don't use master files. Instead I have a user-defined class that takes an option that determines the kind of presentation. If the option isn't provided, the class results in a beamer presentation. Otherwise, it uses the article class in combination with beamerarticle to get a handout version. In addition, it redefines some beamer commands which would otherwise provide output. For example, \frametitle and \framesubtitle.
If I want to generate the presentation, all I have to do is making sure the extra option isn't provided. If I want to provide the handouts then all I have to do is adding the extra option. This is a lot less work than having to implement multiple master files.
You can even take this idea further by providing the option at run time. This way you can let a script generate the presentation and the notes version.
The main idea is explained in more detail in Chapter 15 (Writing Classes and Packages) of LaTeX and Friends.


Can kali linux be hacked

Question: I'm just curious if new version of backtrack Kali be hacked like back-doored or crack user password like the windows or mac
Comment: Poster seems to be unclear on the actual meanings of the terms he's using...
Comment: Hey in this world every technical thing is hack-able
Answer: Yes, it can be hacked.  No OS (outside of some limited micro kernels) has proven perfect security.  It is theoretically possible to do, but nobody has done it and even then, there would be know way to know it is implemented after the proof without building it yourself from the individual circuits on up.  It's not possible to know if there are any active backdoors for sure since they could be subtle, even encryption could possibly (though unlikely) have a back door.
Outside of encryption, with physical access, any system can be read directly off the hard drive and configuration information can be replaced to simply change a user.  If encryption is used and the encryption itself isn't back doored (and is properly implemented) it should require the password to access even if there is a backdoor in the OS itself.  (The password should be a key piece of information for generating the actual decryption key.)
Comment: I agree. There is not such thing as a human-made invulnerable computing system.
Comment: Small nitpick, but there is some other software that is formally verified besides seL4 and INTEGRITY (assuming those are the ones you were talking about), such as miTLS and HTTP.sys of IIS.
Comment: @forest great point and a bad word choice on my part.  I meant os rather than software, though I suppose one can argue that any software running on an unproven os is not proven perfect security, but I guess that's similar to my hardware argument for seL4.

Can kali linux be hacked


given first fundamental form, what type of surface?

Question: In Pressley book I found problem: Find the first fundamental form and determine what kind of surface is patch $\sigma=\langle u-v,u+v,u^2+v^2\rangle$. It is easy to see that the first fundamental form is $(2+4u^2)du^2+8uv\,du\,dv+(2+4v^2)dv^2$. The answer from the book tells that the surface is paraboloid of revolution. But the surface of revolution of unit-speed curve $\gamma(u)$ around $z$-axis is $\sigma(u,v)=\langle u\cos v, u\sin v,\gamma(u)\rangle$ where $v$ is the angle of rotation.Then the first fundamental form for the surface of rotation is $2du^2+u^2dv^2$, which differs from the result above. Is there an algorithm how to assign unknown surfaces to the typical surfaces relying on the first fundamental form?
Answer: A surface $S$ admits many parametrizations/patches $\sigma : D \subset \mathbb{R}^{2}_{(u, v)} \to \mathbb{R}^{3}_{(x,y,z)}$  and in each paramatrization the first fundamental form will potentially take on a different appearance.  (Note that this exhibits one of the main features of differential geometry:  you are trying to study surfaces independently of the parametrization and must pay attention to how expressions/quantities change when one changes parametrizations (or coordinates).)
In particular, if your surface $S$ is a surface of revolution obtained by revolving a (unit-speed) profile curve $\gamma(u) = (f(u), 0, g(u))$ about the $z$-axis by an angle of $v$ then your parametrization/patch will be of the form
$$
\sigma(u, v) = \left\langle f(u)\cos v , f(u) \sin v, g(u)\right\rangle,
$$
with corresponding first fundamental form
$$
\mathrm{d}s^2 = \mathrm{d}u^2 + f(u)^2\mathrm{d}v^2.
$$
But the given parametrization of your surface $S$ is
$$
\sigma(u, v) = \left\langle u - v , u + v, u^2 + v^2\right\rangle
$$
is not the parametrization obtained by rotating a profile curve about an axis of revolution.
In this instance, the author probably intends that you recognize the surface $S$ as a paraboloid of revolution by noting the following algebraic relation of the component/coordinate functions of the parametrization:
\begin{align*}
x^2 + y^2 &= x(u, v)^2 + y(u, v)^2\\
&= (u - v)^2 + (u + v)^2\\
&= 2(u^2 + v^2)\\
&= 2z(u, v)\\
&= 2z.\\
\end{align*}
Thus, all points $P(x, y, z)$ on the surface patch satisfy $x^2 + y^2 = 2z$ and lie on the paraboloid of revolution given by the graph of the function $z = F(x, y) = \frac{1}{2}\left(x^2 + y^2\right)$.  (Recognizing this would also allow you to know parametrize your surface using Monge patch, in which case the first fundamental form would again change appearance.)
Comment: The direct substitution does provide the paraboloid. I hoped that it is possible to understand shapes relying on the 1st fundamental form only. You have explained: that's impossible. The negative answer is also an answer. Thank you very much!
Comment: Just a small arithmetic mistake that doesn't change the answer qualitatively: In the last display, we should have $(u - v)^2 + (u + v)^2 = 2 (u^2 + v^2)$.
Comment: @pabodu If you have a surface with first fundamental form $ds^2 =  \dot{f}^2\mathrm{d}u^2 + f^2 \mathrm{d}v^2$, then the surface admits a one parameter family of isometries $\psi_{t} : S \to S$ defined defined by $\psi_{t}(u, v) = (\bar{u}, \bar{v}) = (u, v + t)$.  The one parameter family of isometries is a property shared with surfaces of revolution, but this property would be shared by any surface with a first fundamental form of the form $\mathrm{d}s^2 = A(u)\mathrm{d}u^2 + B(u)\mathrm{d}v^2$, $A(u), B(u) > 0$.  (The same one parameter family of isometries would work again.) cont. . .
Comment: . . . but the one parameter family of isometries isn't going to be enough.  For example, you could have a surface like Enneper's surface, where the first fundamental form in the standard parametrization is $\mathrm{d}s^2 = (1 + u^2 + v^2)^{2}(\mathrm{d}u^2 + \mathrm{d}v^2)$.  The first fundamental form admits a one-parameter family of isometries $\psi_{t} : S \to S$ defined by $\psi_{t}\left(u, v\right) = \left( u\cos t - v\sin t , u\sin t + v \cos t\right)$, but Enneper's surface is not a surface of revolution.
Comment: However, the next question raises: since  the first fundamental form for rotating curve $\langle f(u),0,g(u)\rangle$ is $ds^2=\dot{f}^2du^2+f^2dv^2$, can we guarantee that all surfaces with that fundamental form are the surfaces of rotation? Are there any non-rotational surfaces with the same form $ds^2=\dot{f}^2du^2+f^2dv^2$ ?
Comment: Thanks, Travis.  Typos should now be fixed.
Comment: Off hand I do not know the conditions on when a first fundamental form    with a one parameter family of isometries can be realized as a surface of revolution in three-dimensional space.  I guess that this would amount to an intrinsic isometry also being realized extrinsically in an embedding.  I will give it some thought if I get a moment, but I suspect that the answer must be known.


How could i create a multi-threading system in a kernel?

Question: Im trying to figure out if there's an assembler instructions or a bios intruction to get multi-threading in a kernel. In the case that doesn't exist that, how could i set muti-threading in a kernel?
Answer: In a multiprocessing system the other cores of the CPU are initiated with boot code like UEFI or legacy bootloader just like the first core of the computer.
The CPU is manufactured to use a "core 0" as the first core of the system. After boot, the kernel needs to use the Local APIC of core 0 to send IPI ( interprocessor interrupts) to other cores to start them. As stated on osdev.org,

IPIs are sent through the BSP's LAPIC. Find the LAPIC base address from the MP tables or ACPI tables, then you can write 32-bit words to base + 0x300 and base + 0x310 to send IPIs. For a init IPI or startup IPI, you must first write the target LAPIC ID into bits 24-27 of base + 0x310. Then, for an init IPI, write 0x00004500 to base + 0x300. For a SIPI, write 0x00004600, ored with the page number at which you want to AP to start executing, to base + 0x300. For more information, see http://wiki.osdev.org/APIC#Local_APIC_registers.
Answer: That is a overall kernel design issue, not a single assembler instruction. BIOS is an (obsolete) piece of startup machinery for PCs, it had very little incidence on full-fledged kernels (after initializing stuff and stashing away some data for later use befor handing control to the kernel, that is). Such a kernel will have to use synchronization techniques to make sure no part of the code tramples on the work of another thread.
With today's multi-core chips, any non-toy kernel is forced to be multithreaded (running on just one core and making sure no other core can interfere is just too inefficient).


How can I squash commits in git?

Question: I want to simply squash a bunch of git commits that are no longer needed. I attempted to follow documentation from this site, but I ended up with git saying there is nothing to squash. I only have one branch, so I followed that section. Any ideas?
Answer: If I were doing it I'd use "rebase". Assuming you have your branch checked out, and that it is branched from master, do
git rebase -i master

This will allow you to modify the commits from master to your current branch. In your case,  replace pick with s (for squash) or f (for fixup, which is a squash that drops the commit message of the squashed commit). Save and exit (ZZ in Vim), and rebase will do its magic. Rebase is a more general solution as in the same operation you can remove, re-order, and reword commits.
The rebase settings will open in Vim, or whichever editor you set in the EDITOR environment variable. In Vim, navigate to start of the line with the commit you wish to squash (with arrow keys or mouse), cw to delete pick and enter insert mode, f for fixup or s for squash, then ZZ to save and exit.

As a side note, the link you gave suggests flatting your feature branch into a single commit. In my opinion this is an awful idea. Commits should represent a meaningful set of changes. A branch is the set of these changes that represents a feature. Squashing everything into one huge commit means it will be harder for other developers to follow your changes.
Comment: Ok, I will give it a try.  I am actually not using it for software development at all, but to track configuration files and other stuff in Linux.  I want a backup that only goes back so far, so in essence,  want to remove history greater than 30 days.  That is why I thought squashing it would be ideal as well as remove unnecessary space taken up by the revisions.
Comment: Ok, I think it worked this time, when I did -i, I was prompted to edit the commit messages and the rebase actually appeared to take place.  When I didn't do the -i earlier, none of the commits were actually squashed.
Comment: @Walter if you do need to compress git at all, I think git gc does that, which git does of its own accord anyway.
Comment: @Walter, squashing commits doesn't take up less space (or the space saved is negligible). Git may not be the right tool for what you want to do.
Comment: Yeah, it isn't designed for that, but I like it better than other available tools.

How can I squash commits in git?


Bayesian Logistic Regression (Informative Priors)

Question: I recently read in a paper comparing the Full Bayesian approach to the Empirical Bayes the following : "the FB method can accom-
modate distributions such as the hierarchical Poisson-Gamma distribution and the Poisson-LogNormal distribution" (Persaud et al., 2010)
Does this mean that performing Full Bayes with informative priors using logistic regression violates the Full Bayes assumptions? From what I have already seen in the forum and other books there are no extra assumptions compared to the frequentist logistic regression, is there something that I understood wrong?
Sorry if my question is not very clear I am really new in Bayesian statistics.
P.S. Any recommendations on books/papers regarding the application of Bayesian Logistic Regression with informative priors (potentialy using a "historical" dataset) are more than welcome!
Answer: Empirical Bayes is different to the "Fully Bayesian" solution, where (i.e. in empirical Bayes) you use the data to decide what parameters you want to use for your prior distribution.
There are additional assumptions in Bayesian logistic regression compared to the frequentist setting, namely that you decide on a prior for you model parameters. The effect of adding a prior on your regression coefficients is similar to that of penalised likelihood methods in a frequentist setting (ridge regression, etc.).
Comment: Thank you for your answer! Are there any restrictions regarding the prior distributions that can be used in a bayesian logistic regression?
Comment: It has to lead to a distribution over the parameters that actually is a probability distribution (the prior itself does not need to be one). Other that, some prior distributions are harder to work with than others, but in principle you can use any choice that leads to a probability distribution over your parameters.
Comment: Many thanks Simon. Do you have any papers/books to suggest on this topic ?


What was the point of the angels?

Question: In retrospect, what was the point of the angels at all? The goal of NERV and etc. was the Human Instrumentality Project. Why go through the effort of killing fifteen angels? And even if you could say they had to establish peace for the moment to go ahead with the project, that just makes the entire plot of the angels a waste. So what was the point?
Comment: This seems to be a lot of questions. Can you condense them down or split them up so you aren't asking this many questions in one post?
Answer: Note that, like many things in Evangelion, this answer would fall under the category of educated speculation.
The point of the Angels largely seems to be to drive other points of the plot. It seems that the plot of Instrumentality itself does not really need the Angels—and I think you're right in this respect. The Angels themselves are a Monster of the Week trope embodiment, but you'll notice that each one (except perhaps Matarael) has a large influence on the events of each episode (and often the whole series).
Consider Leliel, Arael, Armisael, and Kaworu. Each of these caused a great psychological trauma in the characters. Leliel was really the first to probe Shinji's mind and break him down to nothing; Arael and Armisael followed suit and brought forth even more trauma and, along with it, character development. Kaworu, the pinnacle of all of this, essentially brought Shinji to the verge of suicide, but then made his choices in The End of Evangelion all the more human and relatable.
The Angels also achieve one of Anno's goals of telling us that, well, humans are even worse. The fact that the Angels are actually just acting on instinct—the instinct to return to Lilith—and not actually destructive (with a couple exceptions) shows us that humans are really the strongest villains in the series. (A nice bit of grey area there.)
So, to answer your question: No, the Angels weren't strictly necessary. But the plot points they drove and the scenarios they created were critically important parts of the series.
Answer: The Angels NERV fought were the Children of Adam, who sort to instigate the Third Impact to reclaim earth back from the Children of Lilith, the Lilin (Humans).
NERV's goal all along was the preservation of humanity so stopping the Angels falls along their goals, the Human Instrumentality Project was SEELE's secret goal to force the evolution of man though creating their own Third Impact that they could control, because the Human Instrumentality Committee oversaw NERV it was also NERV's Secret Goal.
SEELE couldn't let Adam's children instigate the Third Impact because then they couldn't control it themselves so destroying the angels as they appeared was needed to ensure that SEELE's could execute their plans without interference.
Answer: In addition to the above two answers, Ner/Seele had to wait until they discovered the lost Lance of Longinus in the Antartic Ocean before they could begin Instrumentality. This did not occur until after the Angels began appearing, so they were obliged to battle at least some of them!
There was clearly some need to delay enacting Third Impact and Instrumentality until after the final Angel was dispatched, probably at the order of the Dead Sea Scrolls (which is never explained), otherwise Nerv/Seele would have simply commenced it as soon as they had the Lance (Adam, Lilith and Rei were already in their possession). For some reason, Instrumentality was only likely to work if there were no other Angels alive to prevent it.

What was the point of the angels?


Are API Gateways always necessary in a Microservice styled architecture?

Question: I have seen examples on the net where API gateway becomes the entry point for the client requests. Are API Gateways always necessary in a Microservice styled architecture ?
Answer: Short answer IMO: No.
A microservice might not even have an API. It could be a scheduled job processor for instance. It can be started, runs perhaps nightly and does some work. No API.
Suggested reading on Microservices (old but good): http://martinfowler.com/articles/microservices.html
Answer: No - it's not a prerequisite, even if you have a client app that consumes them - but imho it's a good idea.
Microservices architecture is really nothing new as far as concept. Break up your monolithic app into many components that can iterate quickly at their own pace of development.  Cloud native tooling and best practices have brought on this new notion of "microservices" with technology like containers and best practices like code as config.
For client consumption across a broad spectrum of client capabilities, microservices are more easily and practically managed with a gateway because the gateway is a piece of infrastructure that acts as a control point for QoS concerns such as security, throttling, caching, payload pagination, lightweight transformation, tracebacks through header injection, etc.
It's not necessary, but practically speaking if you have one already baked into your microservices development process as part of a cloud ready infrastructure - you address these things during development consideration and not in "big bang" fashion after the fact - a huge burden in the past for devop/ops folks to get their head around.  It's such a burden, that that's why we've started our own solution that marries microservices development integration with management under ones cloud native platform and have a market for it
Comment: thanks for comments. with an API gateway, how do i route clients to new version of a micorservice (no client update required, just internal changes to the service functionality)


How can I remember Starcraft 2 counters?

Question: The military units in SC2 almost all have counters (i.e. Thor counters Siege Tank). There are a lot of military units, so it makes it hard to remember all the counters. Is there an easy way to remember what counters what?
Comment: I don't believe there is an easy way to learn about a game and all it's little things like this aside from playing it a lot or doing research. Learning things like zealots counters zerglings and roaches counter zealots. Or that concussion shells is a must against most protoss units is something you learn as you play.
Comment: Look at the abilities/attacks description and think:)
Comment: @Sorean So, we can learn all these only thruogh practise, right?
Comment: There aren't exactly hard counters in Starcraft, but you can get a pretty good guess based on their basic properties. Marauders deal high single-target damage on a moderate cooldown and deal bonus damage to Armoured. This makes them amazing against units like Roaches and Stalkers, but relatively weaker to Zerglings and Hydralisks. Many times relative strength of units is dependent on terrain. Splash damage and range are both much more valuable in a choke than on a plain.
Answer: There is no substitute better than practice and research. These two are the best way to learn what units are generally better than others. I will provide you this link to learn about all the units and their abilities as listing everything would create far too large of an answer.
Certain units are always better than another, to use Sconibulus' example, a marauder is great versus a stalker, but does poorly to zerglings.
http://wiki.teamliquid.net/starcraft2/Units
Watching high level play and tournaments with good commentators will greatly expand your knowledge about gameplay and strategies as well. Again you can find a lot of information on upcoming tournaments from Team Liquid located on the far right of the menu.
http://wiki.teamliquid.net/starcraft2/Main_Page
Answer: You can only learn through practice, there are so many different situations that you can't just research it. You have to play and experience and discover for yourself what is good against what.
Some things to keep in mind are: Terrain, numbers, unit cost (resources as well as time), tech level of the unit, range, AOE damage, bonuses to x, (and many more)
Asking someone does x beat y, is not a good way to learn because of all these different scenarios. However if you have a replay which demonstrates the situation it's good to show it to someone and then maybe someone more experienced can help you understand what would've been a better counter in that case.
In order to learn yourself what counters what, you just have to try. Play games and lose, work out why you lost, was it because your units were countered by the enemy? If so what do you think would've been better? Next time you encounter the same situation try those units instead and see if it works.
We learn the most from losing, look through the replays of your losses to better understand what counters what and when it does (and doesnt).
Answer: You can go to Starcraft 2 official page
Where you can find unit detail infomation, strong against, weak against.
For example, zergling which strong against marauder, hydralist, Stalker and weak against hellion, colossus, baneling


Apache Ant as programming language

Question: Is Ant programming language? If yes, is it imperative or functional?
Answer: The question should rather be: If you wanted to do computation with Ant, could you do it? Let us restrict ourselves to something simple, like emulating a simplified command-line calculator. If you can do this, Ant certainly qualifies as a programming language, even if that was not the intention of the tool originally.
The perhaps simplest language we could define is "Huttons Razor", which consists of

Constants, like 5, 37, and so on, all Natural numbers (counted from 0)
A + operator, so we can write (37 + 5) + 15 + (42 + 0)

Not a useful language by any means, but a magnificent start, should you try to abuse Ant to do computation; if you can't even do the Razor, you probably can't do something more advanced. Do keep in mind though that other means of computation, like the lambda calculus, is vastly different from this though, so it may be that other paths are also viable. Note: I don't know if Ant can do this. I last looked at it in 2006 and decided to never look at it again.
Note that a language does not have to be Turing Complete to be a programming language. We have several, highly useful, programming languages out there which are not.

For non-Turing Complete useful languages:

Languages that only accept Total programs (i.e., programs that terminate). This is a necessity for many programming languages that are used as theorem provers: Coq, Agda, etc. Another example is the Simply Typed Lambda calculus (the simple typing makes it impossible to define the Y-combinator and get recursion).
Languages that are heavily domain specific. One example is Troll,
http://www.diku.dk/hjemmesider/ansatte/torbenm/Troll/
which is a language for describing dice rolls in tabletop and roleplaying games. The language does not seem to be TC, yet it is highly useful when designing new games as it can quickly calculate probability distributions of dice throw methods.
Comment: Thanks! Could you please provide examples of non Turing complete programming languages.
Comment: Bumped it with some more comments.
Comment: AFAIK Y-combinator can be defined in untyped lambda calculus, am I mistaken?
Comment: @Gabriel yes, the Y is definable in the untyped lambda calculus: `Y = λf·(λx·f (x x)) (λx·f (x x))`
Comment: @I GIVE CRAP ANSWERS: thanks, I overlooked the "simply typed" part
Answer: Nope, Ant is not a programming language. It is a build tool written in Java.
Comment: Even if it might not have been the intention, it may be you can abuse Ant and coerce it into doing calculation for you.
Answer: Yes, but only just.
I have had to actually program in ant. I work at a Java shop, and we use ant for its proper purpose, something like a makefile for Java, which it is in fact just the thing for. But we have useful things we wanted to do with it, and the ant script was the logical right place for the complexity in question.
(The official method to do arbitrary programming in ant is to write an extension in Java. The trouble with this is that it's not right there in the script you're looking at, and it requires that compilation step. So, writing in ant itself it was.)
ant is like an esoteric programming language whose conceit is that it's all correctly formed XML. Doing even quite basic things takes a few hours' thought of how to solve this one. You can hide some of the horror behind a macrodef.
You can mostly do stuff with just basic ant, but ant-contrib is needed if you want to preserve the precious dregs of your sanity. It includes slightly useful things like variables, arithmetic and flow control.
Hence my rule: never make your domain-specific language Turing-complete;
because once you can code in it, you will have to code in it.
ant programming is a skill I will not be listing on my CV.
Answer: Apache Ant is declarative domain specific language for describing the build process using XML. AFAIK basic constructs are not Turing complete, so I would not describe it as programming language. Of course, through execution of other programs you can achieve whatever those programs can.
Comment: @I GIVE CRAP ANSWERS: I like TC, because for me a programming language is a language that can be used to create any program (any algorithm). Other formal languages, executable/declarative, processable by computer make sense as well, but I prefer to call them domain specific languages, because without TC, they are constrained to certain specific domain of programs. (btw. awesome nick:))
Comment: Yes, it is usually a harsh restriction. In the case of a good termination checker though, it is amazing how many useful programs that can be written as total ones. (The nick is a little game most of the SO Erlang hangarounds use.. we all have silly names :)
Comment: I don't think Turing Completeness is a criteria for a language to be a programming language. Such a language might not be able to replace another TC language, but they can often be useful themselves.
Answer: Generally, a programming language is considered a formalism to describe algorithms. The turing machine is considered the most general mechanism to execute an algorithm.
Ant (without extension, such as Ant-Contrib) is not turing complete, because properties are immutable once a value is assigned to them. Every property must be named explicitly at least once throughout the script. Every ant script is finite, so the number of properties is finite and therefore the number of states is finite. Hence, ant is not turing complete.
Therefore, one cannot describe any algorithm in ant and thus ant is not a programming language.
Answer: Programming language?  I would have said Ant was a restricted scripting language for builds.  It's an XML-driven make.
If forced to choose, I would say it is not a functional language - it's closer in spirit to imperative/procedural.
Comment: A year later and this gets a downvote?  If you've felt such a step was necessary, please explain where you think this answer went awry.

Apache Ant as programming language


Reduce the required number of reopen votes to reopen a meta question to 3 instead of 5

Question:
Current state: currently, the required number of reopen votes to reopen a question is 3 on the main site and 5 on meta.
Proposal: reduce the required number of reopen votes to reopen a meta question to 3 instead of 5.
Reason: very few people look at meta questions.
Comment: This seems like a sensible proposal
Answer: Pros - Easier to reopen meta questions that have been closed. Likely to provoke more engagement on Meta if questions can be closed and opened more easily. As you say, there's relatively few active users on Meta, so getting a quorum of five is a very high barrier.
Cons - Many (all?) of the meta-questions that have been closed recently have been closed by a binding vote, so having a lower threshold of ordinary users wouldn't actually be that helpful. Might lead to bad questions being opened more easily.
In short, I can't see any likely downside and several probable upsides. I vote we try it, see how it works for six months and then revisit it. If it's been a disaster, we can always reverse it.


Will Daedalus have a Fiat payment gateway?

Question: I am a rookie at cryptocurrencies: I would like to know if Daedalus will have a Fiat payment gateway. Thank you very much in advance.
Comment: I would love for this to happen. It will go a very long way for adoption and ease of use.
Answer: There is nothing specific apart from the fact that in one of Charles' interviews (I cannot find it at the moment) he mentioned that after there are DEXs and other components it will be very easy to add additional functionalities including easier ways to pay and convert crypto for fiat and vise versa.
Charles also spoke in 2020 about adding the functionality which now is available to get the current price from CoinGecko.
Answer: I believe I've heard rumors for just this; although I'm not turning up anything now. However, according to this the Yoroi Chrome extension provides this functionality. But I wouldn't know, I don't use in-browser Yoroi.


Why Tesla Electric Cars Use Induction Motor?

Question: Most Electric cars these days      use  Brushless        DC Motors. However recently someone told  me that Tesla cars use Induction motor (AC) instead? Why is it so?  Are        DC Brushless      Motors feasible compared to Induction motor?
Comment: I disagree with your assertion that most electric cars use D.C. motors. Many **home-built** EVs use D.C. motors but commercially built EVs generally use AC motors. The Nissan Leaf, for example, uses a 3-phase AC motor.
Comment: The 3rd party change of the question to compare brushless DC motors is quite dubious - and invalidates Kevin's answer about brushed motors below.  Kind of a moot point as the linked duplicate accommodates either,  but edits which change the meaning of a question absent input from the asker and  in so doing invalidate previously applicable answers cannot be permitted.
Answer: Tesla does use induction motors where virtually all other electric car makers use permanent magnet synchronous motors. The two types work very similarly and there are advantages and disadvantages to both.
It is mainly historical that Tesla uses induction motors (as well the fact that Tesla invented the induction motor over 100 years ago). Teslas started life using motors and controllers from AC Propulsion that happen to use induction motors.
All motors are AC at some point (except for homopolar motors).  The differences are where the conversion from DC to AC occurs.
In a conventional DC motor the conversion is mechanical in the commutator.  It has the disadvantages of limited lifetime, sparking, efficiency and also is not as amenable to computer control.
When Induction motors or Permanent Magnet Synchronous Motors the conversion from DC to AC happens in an electronic inverter that gives a great deal of control over the speed, torque and regeneration in the car.


Control panel field name & instructions translations

Question: I've installed a Craft Pro site with 3 locales: Dutch, French & English, but the people who are going to input data will speak those languages too, so I need to translate the instructions field in the control panel (and, if possible, the field names too since most of the time that makes it clear enough).
Is this possible, and if it is: how?
Thanks!
Answer: If your main language site is dutch for example, you can do that using your own php files locale and naming them according the other locales languages, en.php, fr.php and put those files in craft/translations/ (a folder you must create yourself). Then you can translate in the array all your string (field name and instructions).
Have a check at the documentation:
Translating Static Text
Comment: Pro-tip: Use namespaces for your fields' translatable instructions – i.e. add a value like `"field.body.instructions"` to the actual instructions textarea, and then add something like `'field.body.instructions' => 'Awesome instructions',` to your static translation files. This works for field titles as well, although it can be a lot of work if you do it across the board :)
Comment: isn't there an easier way for craft 3?
Comment: I've tried adding a app.php static field translation file, but nothing happens...


Risks for health from non food grade stainless steel false bottom

Question: My set up is for electric BIAB (brew in a bag) so I use a false bottom.  The problem is that I don't know if the stainless steel I use is food grade or not.  Are there any great risks for my health? Should I replace it or not?
Comment: Which grade of stainless steel is it? 304, 316 etc..?
Answer: I've never heard of non-food-grade stainless steel. Some are more or less susceptible to corrosion than others, but as far as I know all stainless steels are food grade.

[...] stainless steel is a safe option when it
  comes to use with food and beverage, as there are no chemicals that
  can migrate into your food from these products.

From http://mightynest.com/blog/stainless-steel-all-about-food-grade-304-188-and-1810


DC motor induced emf in field winding

Question: In case of DC motor even if DC voltage is applied, due to commutator an AC current flows through armature ,then due to this changing current, does any voltage is induced across the field winding?
Thanks in advance
Answer: short answer
Of course, Mot. always produces BEMF with rising speed so current depends on the difference due to loading and inertial acceleration demand.
e.g. Vbemf( back EMF internally generated) for no-load speed minus V for loaded speed is what the motor coil sees.
When at max no load speed if no losses, ideally current = 0 but of course there are always some excitation current, eddy current loss and commutation losses at full speed with no-load condition.
The No-load speed is often a linear constant ratio with kV/RPM until these losses rise then reduces slightly in an efficient motor. Then speed reduces up to 20% with loading at max power if matched to load.
If torque is field current regulated then the voltage is high impedance, so usually current to ground increases magnetic coupling to increase current and thus torque and thus acceleration to some regulated speed with a tach.
If it uses a PM or permanent magnets, then there is no field winding.
Answer: Not really. Although the current through the armature windings is alternating, really rotating relative to the rotor's own frame of reference, the purpose of the commutator is to keep the flux generated by the armature at right angles to the main field, so relative to the field coils the flux isn't changing much (there's some high frequency ripple from commutation).
  The terminal voltage that the motor produces is the back emf generated in the armature windings, plus the resistive losses in the windings and the brushes. If it's a series field motor you can measure the terminal voltage and the voltage at the brushes to show this, the difference will be the resistive loss across the field windings.
  On a shunt field winding, the field current is determined solely by the resistance of the winding.

DC motor induced emf in field winding


How to override homepage content through plugin?

Question: Want to override index.twig content through a custom plugin. I want to create a plugin that appends some content on website homepage. How to Achieve this any reference will be helpful
Answer: You can inject HTML to the end of the body using View Events:
use craft\web\View;
use yii\base\Event;

Event::on(
    View::class,
    View::EVENT_END_BODY,
    function() { echo 'Foobar'; }
);

The output of this function will appear wherever the endBody() function is placed in the index.twig. The event will even work if the template doesn't contain this function, because Craft will dynamically insert it before the  end tag.
If you want to register CSS or JS assets, use the methods registerCssFile and registerJsFile on \Craft::$app->view instead. There's also a registerHtml method that achieves the same as the hook above.

While there are valid use-cases for injecting HTML, it's a terrible idea for most plugins. As a developer, I won't touch your plugin if it forcibly injects any code into my frontend template without letting me have a say in it. Instead, your plugin could expose a custom variable or function to Twig and allow me to call it myself. This way, I have control over if and where your injected content is placed. Just something to keep in mind as an alternative to the hooks above.
Comment: @DotSquares Yes, but you won't get a step-by-step guide with code to copy and paste here. Please read the documentation articles I linked and consider the caveat below the line. Then build your plugin as far as you can and if you hit specific problems, post it as a question.
Comment: We are trying to override the  website index.twig file considering it as home page. We are trying to craete a plugin that will add a layout to home page like some banner with content is it possible with this ?
Comment: Thanks for the reply but with this method it won't override the homepage code it will inject my code with users' code at the end of the body I want to create a 404 page kind of plugin that will show some text to non logged in users.
Comment: @DotSquares So do you want to overwrite the homepage or the 404 page? It sounds like you're going down the wrong rabbit hole. Maybe post post some more information in what you're trying to do with this plugin, I'm sure there is a better solution.
Comment: I am trying to create an under construction plugin if the user enables the maintenance mode in the plugin the homepage will show some maintenance template text to non-logged users. just like a 404 template page layout


return a pdf in browser from web service

Question: i am relative new in java development..
I want to create a web service (jax-ws)/web application that will receive some input and generate pdf, and then open the pdf in the browser. I manage to create the pdf (using itext) and open it in the broswer using servlet (with FileInputStream etc).
However i do not know, how to return the servlet from the web service.
What should I do, so when I call the web service to receive a pdf via the servlet ?
Answer: If you've returned PDF from servlet, it means your servlet sent PDF stream as output and probably set content type as "application/pdf". This works fine in the browser and this is the right way to do it.
However, you cannot easily invoke web service (no matter whether it is JAX-WS or any other stack) from the browser. Web service call requires POST and strictly defined SOAP content. You can, however, use AJAX to call web service, but that is a different story (also look at REST).
If you want to return binary data from web service (please keep in mind that web-services are for machines, not for humans using web browsers), you have two options: either serialize the binary data using base64 or use multipart HTTP response (MTOM standard, see for instance: http://www.mkyong.com/webservices/jax-ws/jax-ws-attachment-with-mtom).
Comment: Thank you very much for your answer. So in order to pass the pdf to the client and use web services, i have to "upload" the generated pdf, via a web service's method, using stream/byte arrray. Then convert this byte array to a string encoded to base64 (?), and return string as the return type of the web method ?
After that, the web service client (such as servlet), will retrieve the data, using the same logic that was used to upload the pdf the first place ?


Track number missing after iPhone upgrade to iOS 8.4

Question: Before the upgrade to IOS 8.4, when I was listening to music, it would have the track number at the top of the screen (i.e. "1 of 14") but with 8.4 I can't seem to find a way to put that back on, if it's even possible.  Any help/suggestions?
Answer: Apple has removed the track number feature from the Music app and it is not known if or when it will return.
Answer: When there are more than 15 new and excellent changes in the new music app and great upgrades still waiting, no one is caring for a option which shows track number.
The Apple Music doesn't have the track number feature because it can then update Albums with no remix tracks.
Every album has got some songs and they also add some remixed versions of the songs to the album itself.Some call them as Deluxe versions while some add them in original album as well.
In Apple music, at present doesn't allow the remixed tracks to be streamed ( maybe later ) So in order to not have a contradiction with the Track number, they removed the option.


Why is the $dx$ right next to the integral sign in QFT literature?

Question: I've noticed that in QFT literature, integrals are usually written as $\int \!dx ~f(x)$ instead of $\int f(x) dx$. Why?
Comment: $\int dx f$ looks like "the operator $\int dx$ acting on the function $f$", which is often a nice way to see things.
Comment: Related question on Math.SE: https://math.stackexchange.com/q/387572/11127 , https://math.stackexchange.com/q/1842911/11127 and links therein.
Answer: IMHO, the notation $\int_a^b\mathrm{d}x\,f(x)$ is much cleaner than $\int_a^b f(x)\,\mathrm{d}x$, because the integration variable ($x$) and its associated integral range $(\int_a^b$) are kept together. This is particularly important in lengthy and multi-dimensional integrals. Consider
$$
\Upsilon_{pq}(k)=
\int_0^\infty\mathrm{d}x
\int_0^{\beta(x)}\mathrm{d}y
\int_0^1\mathrm{d}t
\int_{-\infty}^0\mathrm{d}\eta
\int_{-\infty}^\infty\mathrm{d}\kappa\;\;
f(x,y,t)\;\mathrm{e}^{i[k_xx+k_yy]-\eta t}\;\Theta_{pq}(\kappa,\eta k)
$$
as opposed to
$$
\Upsilon_{pq}(k)=
\int_0^\infty
\int_0^{\beta(x)}
\int_0^1
\int_{-\infty}^0
\int_{-\infty}^\infty\;
f(x,y,t)\;\mathrm{e}^{i[k_xx+k_yy]-\eta t}\;\Theta_{pq}(\kappa,\eta k)\;\;
\mathrm{d}\kappa\,
\mathrm{d}\eta\,
\mathrm{d}t\,
\mathrm{d}y\,
\mathrm{d}x.
$$
Comment: Indeed particularly the second form is ambiguous as we could think the int...dy thing as a parenthesised expression or not, and then becomes unclear if the dx applies to the first or last integration sign.
Answer: It's not just QFT literature. Physicists, especially adult research physicists, find this notation sensible and popular – even though it may be more popular among particle physicists than elsewhere.
Formally, $dx\,f(x)$ is a product of two factors and $\int$ is a form of a sum. Because product is commutative, it doesn't hurt when the order is interchanged. The advantage of the $\int dx\,f(x)$ notation is that we immediately learn what we integrate over, what is the integration variable. Also, we're sure that we won't forget about the "simple thing", $dx$, at the end. The integrand may be pretty complicated in particle physics – but also elsewhere.
If this convention has something specific to do with particle physics, it's a cultural coincidence. It may be adopted – and it may be criticized – in any discipline of mathematics or natural science that uses integration.
Comment: You mean child research physicists don't use this notation?
Comment: Yup, among other things. They usually don't - it's thanks to the way how they get to the expertise. One simple has to be careful about the units at the beginning, not to get completely lost, and use some units close enough to everyday life. At least that's what the school systems and textbooks on more basic physics disciplines assume. That's why I am convinced that this slogan - which I have from an instructor in my undergraduate studies - is correct. Experienced physicists are much more likely to pick natural units or this non-basic-textbook ordering of integrals and other things.
Answer: Besides the reasons listed in Lubos Motl's answer, here is another reason for the $\int \!dx ~f(x)$ notation: By writing the integral sign $\int_a^b$ and $dx$ next to each other in multiple nested integrations, it becomes more easy to trace which limits belong to which integration. This becomes particularly handy when changing the orders of integration.
Secondly, let us mention Grassmann-odd Berezin integration. In that case $d\theta$ carries odd Grassmann parity itself, so moving its position in the integrand may induce a sign factor, so the issue is no longer purely notational and innocent. Unfortunately, there exist different sign conventions in the literature, so seeing the position of $d\theta$ in the integrand is no guarantee for the absolute sign convention of the integral. Berezin choose a sign convention such that integration $$\int \!d\theta~f(\theta)~=~\frac{\partial_Lf(\theta)}{\partial \theta}$$ and differentiation from left is the same operation.


Flag a question for migration to unlisted StackExchange site

Question: When I flag a question as more appropriate for another StackExchange site, I can only choose to move the question to ELL or meta.  Sometimes to question is more appropriate for workplace for StackOverflow.  Am I missing something?  Or is this something we can add?
Comment: Only the most common sites will get listed. It took *years* to get ELL on that list. If you think it should be migrated somewhere else, write a custom flag and a mod will consider it.
Comment: @jimm101 There are many reasons why migration paths are limited, not least of them that the best target is not always obvious, and low-quality questions should be closed rather than migrated. The past discussions on the lack (until fairly recently) of an ELL migration are informative.
Comment: Thanks, I was afraid that was the answer. :-(  I like the pre-formulated migration messages the OP will see, and the point-and-click movement.  It's strange, you'd think all the sites would be listed in a big blob underneath the popular ones.
Answer:
Only the most common sites will get listed. It took years to get ELL on that list. If you think it should be migrated somewhere else, write a custom flag and a mod will consider it. – curiousdannii Jan 11 at 23:48


Is every electron in the Universe in a different quantum state?

Question: Is every electron in the Universe in a different quantum state? Is this what the Pauli Exclusion Principle tells us?
Answer: The simple answer is yes, but as usual things are rather more complicated than a simple answer would suggest.
For example, if you take a free electron then it isn't quantised but has a continuous energy spectrum. This means you can't usefully talk about two free electrons being in the same quantum state. In principle two free electrons described by infinite plane waves (so perfectly defined momentum but completely delocalised) cannot have exactly the same momentum. However this is a physically unrealistic situation, and in practice two free electrons can have arbitrarily similar momenta.
Alternatively, consider the electrons in two separated hydrogen atoms. In principle the two atoms are described by a single wavefunction regardless of their separation, and the two electrons cannot be in the same state. In practice once the atoms are more than a handful of Bohr radii apart they can be treated as non-interacting and you now cannot usefully compare the states of the two electrons.
Answer: Note that usually electrons are somewhat localised, and that localisation is part of the quantum state. The Pauli principle is a consequence of the symmetrization postulate, that states that, for fermionic particles, the wavefunction must be antysymmetric if you exchange the coordinates of any two particles. A common example is that of two electrons in the same atom, with quantum numbers $n, \ell, m_\ell, s$ and $n', \ell', m_\ell', s'$. The antysymmetrized wavefunction is (assuming that the electrons don't interact): $$\Psi(\vec{x}_1, \vec{x}_2) = \frac{1}{\sqrt{2}}\left[\psi_{n\ell m_\ell s}(\vec{x}_1)\psi_{n'\ell' m_\ell' s'}(\vec{x}_2)-\psi_{n\ell m_\ell s}(\vec{x}_2)\psi_{n'\ell' m_\ell' s'}(\vec{x}_1)\right]$$
where $\psi_{n\ell m_\ell s}(\vec{x})$ is the wavefunction for one single electron in the atom. It's easy to check that if you set $n=n'$, $\ell = \ell'$, $m_\ell = m_\ell'$ and $s=s'$, you get $\Psi =0$, so you can't have a wave function for two electrons with the same quantum numbers.
The situation is different if you have electrons in two different atoms, one of them centered at $\vec{x}=0$ and the other centered at $\vec{x} = \vec{x}_0$. The wavefunction for this system is $$\Psi(x_1, x_2) = \frac{1}{\sqrt{2}}\left[\psi_{n\ell m_\ell s}(\vec{x}_1)\psi_{n'\ell' m_\ell' s'}(\vec{x}_2-\vec{x}_0)-\psi_{n\ell m_\ell s}(\vec{x}_2)\psi_{n'\ell' m_\ell' s'}(\vec{x}_1-\vec{x}_0)\right]$$
In general, this wavefunction won't be zero even when all the quantum numbers are the same for both electrons.

In principle, the Pauli principle applies to all electrons, as they are excitations of the same fermionic field. But in practice, it has little effect (or not effect at all) when you consider two particles that are far away.
Imagine that you have an electron with wavefunction $\psi(x)$ and other with wavefunction $\phi(x)$, and that both electrons aren't interacting. If you could distinguish both electrons, the colective wavefunction would be $$\chi(x_1, x_2) = \psi(x_1) \phi(x_2)$$ but since the electrons are indistinguishable, and the state must be antisymmetric in the coordinates of both particles, the correct wavefunction is $$\Phi(x_1, x_2) = \frac{1}{\sqrt{2}}\left[ \psi(x_1)\phi(x_2) - \psi(x_2)\phi(x_1)\right]$$
The wavefunctions of both electrons are localised in different regions of space $D_\psi$ and $D_\phi$: $$\psi(x) = 0 \textrm{ if }x\not\in D_\psi \qquad\qquad  \phi(x)=0 \textrm{ if } x \not\in D_\phi$$ If the distance between the electrons is large, $D_\psi \cap D_\phi = \emptyset$, and therefore their wavefunctions don't overlap.
We have a measurement device $A$ which operates only in region $D_\psi$ and another measurement device $B$ that operates in $D_\phi$. They have eienstates $a(x)$ and $b(x)$, respectively. As the operators are localised, the eigenstates will verify $$a(x) = 0 \textrm{ if }x\not\in D_\psi \qquad\qquad  b(x)=0 \textrm{ if } x \not\in D_\phi$$ The simultenous measurement must be symmetricla under the exchange of both particles, so the eigenstate will be $$\frac{1}{\sqrt{2}}\left[a(x_1) b(x_2) - a(x_2) b(x_1) \right]$$
We can calculate the expectation value of this measurement
$$\langle AB \rangle = \int \textrm{d}x_1 \textrm{d}x_2 \left[\frac{1}{\sqrt{2}}a^*(x_1) b^*(x_2) - \frac{1}{\sqrt{2}}a^*(x_2) b^*(x_1) \right]\left[\frac{1}{\sqrt{2}}\psi(x_1) \phi(x_2) - \frac{1}{\sqrt{2}}\psi(x_2) \phi(x_1) \right] = \int \textrm{d}x_1 a^*(x_1)\psi(x_1) \int\textrm{d}x_2 b^*(x_2) \phi(x_2)- \int \textrm{d}x_1 a^*(x_1)\phi(x_1)\int \textrm{d}x_2 b^*(x_2)\psi(x_2)$$
The first integral is called "direct" integral, and the second one "exchange" integral. In our setup of electrons and devices, the exchange integral vanishes because $a(x)$ is zero in all the places where $\phi(x)$ is not zero. $$\langle AB\rangle = \int \textrm{d}x_1 a^*(x_1)\psi(x_1) \int\textrm{d}x_2 b^*(x_2) \phi(x_2) $$ This is exactly what we'd obtain if the electrons were distinguishable and we measured $A$ in the $\psi$ electron and $B$ in the $\phi$ electron (i.e., the $\chi$ state). This is true for all observables $A$ and $B$, so if you want to measure an electron in your lab, you only have to "do nothing", $A = id$, with that electron in Pluto. You can simply forget about the electrons whose wavefunctions don't overlap with the electron that you are describing.
That's the important point: is the extent of the wavefunction what determines if the Pauli exclusion principle is important and whether two elecetrons can share their quantum numbers.
References: Chapter XIV (Systems of identical particles) of Quantum Mechanics by Cohen-Tannoudji, Diu & Lalöe
Answer:
Is every electron in the Universe in a different quantum state? Is this what the Pauli Exclusion Principle tells us?

No, it doesn't tell us that. Read the Wikipedia article:
"The Pauli exclusion principle is the quantum mechanical principle that states that two identical fermions (particles with half-integer spin) cannot occupy the same quantum state simultaneously. In the case of electrons, it can be stated as follows: it is impossible for two electrons of a poly-electron atom to have the same values of the four quantum numbers (n, ℓ, mℓ and ms). For two electrons residing in the same orbital, n, ℓ, and mℓ are the same, so ms must be different and the electrons have opposite spins".
Also read the history. The Pauli exclusion principle tells us that two electrons can't be in the same state in one atom. It's just the subatomic equivalent of two waves can ride over one another but two whirlpools cannot overlap.