Median of a set with even number of elements

Question: Consider the following sample of numbers:
9,18,11,14,15,17,10,69,11,13
Since there are 10 elements, the median of the set would be (13+14)/2 = 13.5
However, is it wrong to say that median is one of 13 or 14? Can you cite credible sources/authors who claim that 13 or 14 can be the median, i.e. n/2 or (n/2+1)th element can be the median?
Comment: Classically, the answer is anything that minimizes the L1 norm, as people explain here. If you want to make the answer *unique*, see [my answer](https://math.stackexchange.com/a/922147/4890) and [my question](https://math.stackexchange.com/q/848762/4890) and **[my comment](https://math.stackexchange.com/questions/848762/formulation-and-computation-of-the-unique-median-of-an-even-sized-list#comment1775238_849918)**.
Comment: The two middlemost values if the number of values is  even are naturally called _comedians_ (a remark due independently to Stephen Stigler and Roger Koenker). Taking their mean to be _the_ median is explained to non-mathematicians as a rule and to mathematicians as a convention, which as explained in answers, does occasionally bite.
Comment: @kjetil b halvorsen Thanks for the reference. The meaning is different, but the term is aprt/
Comment: @NickCox: See my answer at https://stats.stackexchange.com/a/165264/11887  for another use of comedian ...
Answer: Another way to define a sample median is as a minimizer of the sum of $\ell_1$ distances between a given quantity and each datapoint:
$$
m \in \mathcal{O}=\underset{x\in\mathbb{R}}{\textrm{argmin}} \sum_{i=1}^N |x_i - x|
$$
It is easy to see that if $N$ is even, the set of minimizers $\mathcal{O}$ is given by the closed interval $[x_{(\frac{N}{2})}, x_{(\frac{N}{2}+1)}] $ where $x_{(i)}$ gives the i'th order statistic.
From this perspective, the $\frac{N}{2}$ or $\frac{N}{2}+1$th value are just as valid as their midpoint, or any other convex combination thereof, as they will all have identical empirical loss.
Comment: Of course, this is Henry's answer in disguise, since the one is the solution to the other.
Comment: +1. For an intuitive explanation of this, see [Hanley et al., (2001, *The American Statistician*)](https://doi.org/10.1198/000313001750358482), discussed in [this thread](https://stats.stackexchange.com/q/355538/1352).
Answer: There are arguments to be made for multiple different definitions of empirical quantiles (including the empirical median). The go-to resource for this is Hyndman & Fan, 1996, "Sample Quantiles in Statistical Packages", The American Statistician. R implements all nine of their proposed possibilities, with type=7 being the default.
The R help page ?quantile also points us to this blog post: https://blogs.sas.com/content/iml/2017/05/24/definitions-sample-quantiles.html
Comment: None of the nine types gives 14 in this example, but types 1,3, and 4 all give 13.
Answer: If your definition of the median $m$ of a finite multiset of real numbers is that it has the property that half the values are at the median or below and half the values are at the median or above, i.e. (using $|\{\cdots\}|$ to mean the count of a set):
$$\Big|\{x_i:x_i \le m\}\Big| \ge \tfrac12 \Big|\{x_i\}\Big| \text{ and }  \Big|\{x_i:x_i \ge m\}\Big| \ge \tfrac12 \Big|\{x_i\}\Big|$$
then in your example, any $m$ from $13$ through to $14$ satisfies this condition, i.e. $m \in [13,14]$.  You might call the numbers in this interval the medians of the data.
The corresponding condition for the distribution of a random variable is $\mathbb P(X \le m) \ge \frac12 \text{ and } \mathbb P(X \ge m) \ge \frac12$ which may again produce an interval.
The advantage of using $13.5$ is that it is a single value in the middle of the interval.  But it has a disadvantage that monotonic transformations can then affect the median in an undesirable way: if you looked for the median of the cubes of your data, then any value in $[13^3,14^3]=[2197,2744]$ would satisfy the median condition; however, even though  $13.5^3=2460.375$ would be in that interval, the midpoint would be the higher $2470.5$.


Does the exact string theory $S$-matrix describe all physics there is?

Question: Suppose someone manages to evaluate the string theory $S$-matrix to all orders for any and all vertex operator insertions including non-perturbative contributions from world-sheet instantons and re-sum the whole series to obtain the exact non-perturbative string theory $S$-matrix for any combination of in- and out-states. Suppose further that the analytic result is compact, tractable, and easily amenable to numerical evaluations (say, some special function). Would such a result tell us "what string theory is"? Would it be enough in principle to answer all sensible questions about physics described by string theory? If not, what else is there we should care about?
Comment: Are you excluding cosmological questions? One must be clear that there are many different string S-matrices, which are linked by non-S-matrix operations, which involve turning on moduli and such, and infinite number of particles. So you shouldn't say "the" string S-matrix, but "the string S-matrix for a flat-version of our vacuum".
Comment: Ok, but this is a well known limitation of perturbative strings--- they only describe a finite number of particles in S-matrix, and have infrared divergences which need to be cured by using the string classical fields to define backgrounds. The equations of motion for the massless backgrounds are the second half of string theory, the more used half, and these allow you to change an infinite number of background particles, and go from one theory to another, like by changing the radion in a type II circle compactification. String theory is a half-S-matrix half-classical hybrid monster.
Comment: You can't describe electron electron scattering, as this is infrared divergent (you find the same infrared divergences in string theory--- you fix them by adding a soft classical changing background--- this is the dirty secret). You can't describe T-duality, as this is condensation of infinite number of zero mass particles. But you are absolutely right in your insistance that the S-matrix is complete for a given background, so I don't want to give fuel to string critics by saying "there's more than S-matrix", because it is more correct to say there isn't.
Comment: It's not enough because the S-matrix is for a finite number of particles--- it doesn't even describe what happens when you move a charged particle from one momentum to another, this involves infinite number of soft photons, let alone change moduli over a region where the cosmology changes.
Comment: Of course not, I asked about "all sensible questions about physics" which certainly includes cosmology, doesn't it? If you know the S-matrix "for any and all vertex operator insertions", as I supposed, that should allow for arbitrary moduli and geometries, no? If not, please explain why not.
Comment: Perhaps you have a point, that's what I'm trying to find out. But you are not giving a coherent argument. Changing the momentum of just one particle is not a physically allowed process. At least you'd have to construct a physically possible process described in terms of actual observables (--> presumably S-matrix elements?!) and use that to show that there is something more to be learned...
Comment: Perhaps you are right, but you haven't explained what type of physical process I cannot describe with my exact S-matrix. I am not looking for hand-waving and general wisdom but a verifiable argument and/or a concrete example.
Answer: Well, for starters, the scattering matrix picture of interactions does not include the dynamics of spacetime, it is instead assumed as a background space where everything happens
Even string theory is just classical general relativity in a more fair description such that it can be quantized in a way that gives finite results for measurable quantities: it assumes that string modes contribute to $T_{\mu \nu}$ and as such, produce a curvature. The curvature of coherent excitations of a closed string has been proved to be equivalent to a small perturbation of the metric (see this question for details) and this gives string theorists confidence that such excitations describe gravitons.
But the picture of space-time is still classical, and a proper nonperturbative formulation of quantum spacetime is a revolution that still has not happened. Until that happens, no scattering matrix description can hope to be complete
Comment: That's obviously not true as there are matrix operators for the graviton which perturb the metric and hence the spacetime. That's the whole point why people got excited about strings, they include quantum gravitons in a dynamic theory. In principle it should be possible to obtain any dynamic spacetime background by appropriate vertex insertions, no? If this is not the case then I would be interested in hearing a rational argument why not.
Answer: No, first because string theory is based in a number of approximations/assumptions and second because not every physical question can be answered assuming that processes take an infinite time and involve objects separated infinitely as is assumed in the S-matrix approach.
The S-matrix approach is excellent for particle physics, which deals with few particles (usually two or three) in a large mostly empty volume and only considers initial and final states of free particles. The S-matrix approach fails when you start to study many-body motion in condensed phases. This is the reason why chemists have developed other theories beyond the S-matrix formalism for the study of chemical reactions, for instance.
Comment: String theory is obviously not based on any approximation whatsoever. I did not ask what an S-matrix (in QFT) is usually used for. My question is conceptual and concerns string theory.
Comment: Evidently string theory is based in a number of approximations and this is why the string S-matrix fails to explain even the most elementary chemical reactions in condensed phases. Moreover, even in its supposed strong point (as 'candidate' for a quantum gravity theory) the string theory approach is based in a set of gross assumptions and this is why generalizations to string theory are under active research.


Inductance of a coil with a core

Question: Does inductance of a coil increase if we add a material with good magnetic permeability only because of its magnetization, or also because of changing the path of magnetic field lines?
Answer: We can say in a closed loop,
$$\Phi=LI$$
defines the inductance of the loop. Where $I$ is the current in the loop, $\Phi$ is the magnetic flux through the surface of the loop (the loop was closed, therefore acting as the boundary of an open surface), and $L$ is the inductance.
So for the inductance to maximize, we need to have the most magnetic field lines penetrating the surface of the loop, with the least current flowing along it.
What a core does is actually strengthening the field lines. So that we have a more $\Phi$ with the same current.
Which yields higher inductance.
I am not much good with your sentence "because of its magnetization, or also because of changing the path of magnetic field lines?". Adding a core to a coil changes the magnetic field both via field line pattern and magnitude.
The better saying would be just "adding a core increases the flux.", in my opinion.
Comment: This is why I asked a quation the way I did. I hoped for a Yes or No answer. I already know what you explained.
Comment: @MaDrung then the answer is yes. This is why a core twice the length of the coil has an even greater $L$ than a core with just the length of the coil. In case you have access, try to look into [Sensors, A Comprehensive Survey, Volume 5, Magnetic Sensors](http://eu.wiley.com/WileyCDA/WileyTitle/productCd-3527620583.html)
Comment: @MaDrung I implicitly answered yes. It's just like bringing some magnets inside the coil. The field pattern will obviously change.
Comment: I know it will change. But is the field pattern responsible for increase of inductance or does only magnetization because of material increase it? More material, more magnetization. That much is clear. But is inductance also affected by the change of path of magnetic field lines?
Comment: @MaDrung I think I got what you mean. Hmmm. Then, yes of course! but, to say whether it will increase or decrease, that is a difficult question to answer, because it totally depends on how the pattern has changed. And Because it is a VECTOR FIELD! if, instead, it was a number or a vector, it would be much easier to identify the increase and decrease regimes.... But, by the way, everything we want (to say whether the inductance will increase or decrease) is summarized in the concept of flux! I myself am convinced with "Higher the flux (not due to external sources), Higher the inductance."
Answer: The magnetic H Field is calculated via:
$\oint \vec{H}~d\vec{s} = I$
This means the H field is directly caused by the current I.
The inductance is dependent on the electric filed that the magnetic field induces.
According to Maxwell's equations:
$\text{rot}~\vec{E} = -\frac{d\vec{B}}{dt}$
This equation uses the B field which is bound to the H field through this equation:
$\vec{B} = \mu \vec{H}$.
In the simplest case $\mu$ is only a constant value.
Therefore inserting a material into the space, where the magnetic filed is in, scales the magnetic B field and therefore the induced E field and inductance.

Another approach is seeing the magnetic resistance of a system.
The resistance of a piece of material (metal) is:
$R_m = \frac{l}{\mu A}$, where l is the lenght and A is the area perpendicular to the magnetic flux.
The inductance of a coil wound around a medium with the resistance $R_m$ is:
$L = \frac{n^2}{R_m} = \frac{n^2\mu A}{l}$, assuming that all of the magnetic flux is inside the medium.
You can see the proportionality.

Materials with high permeability guide the magnetic flux, and therefore improve the coupling / inductance between coils.
This image shows the magnetic flux inside a transformer. You can see that most of the magnetic filed couples both coils together and therefore increases the coupling inductance.

Inductance of a coil with a core


Reinstall paid software from USC in Kubuntu

Question: I've bought Psychonauts via USC some time ago. I've switched to Kubuntu now and want to reinstall the game. Whats the best way to do so, without installing too many otherwise unnecessary packages?
Answer: Just re-install it - how ever that software is installed.
If it is a deb then all the dependencies can be automatically loaded via apt-get install.
Answer: Install Ubuntu Software Center (software-center package), as for now, paid apps can only be installed using it.


Where do I look to see which .NET framework version I'm targeting in VS 2005 in a C++/CLI project?

Question: EDIT: Sorry, forgot to mention this was a C++/CLI project.
Does it show it somewhere or does it just target one by default?
Also, can you change this in VS2005 or was this new to the later VS versions?
Answer: You are targeting the .NET Framework 2.0 runtime. This is the only supported one in Visual Studio 2005 and the setting cannot be changed.
Note that you can use the additional libraries from .NET 3.0 with Visual Studio 2005 if they are installed.
Visual Studio 2008 has been the first version of Visual Studio allowing to target multiple framework versions.
Answer: VS2005 doesn't support targeting, it is up to you to pick the assemblies you add as references wisely, your program will ask for the V2.0 CLR.
VS2008 supports choosing between 2.0, 3.0 and 3.5.  This is a simple trick, it just hides assemblies that are not available in an earlier version so you can't add them.  Your program will still ask for the V2.0 CLR, the CLR version for all three versions of the framework.
VS2010 targets the V4.0 CLR by default.  You can target earlier versions but there's a problem with that.  The build system was radically changed, switching to MSBuild instead of the legacy C/C++ builder.  You can only target an earlier version if you also have VS2008 installed on your machine.  Projects that you import from an earlier VS version require editing the .vcxproj file by hand to get them to target an earlier .NET version.  A fair amount of pain here, not sure what's in store for SP1.


How can I simulate a single car crash without ruining a vehicle?

Question: I'm filming a relatively low budget horror film with a few friends, so we don't have any fancy equipment for this. The shot is supposed to be a guy driving then suddenly swerving the car off the road, maybe into a tree or, even better, ending upside down. Is there a good looking way to do this?
Answer: If you can record at 5× the normal frame rate, using a 1/25th scale model car will look somewhat realistic.
Things that roll over or bounce, or even fall off a cliff, will appear correct.
Yes, it will still look fake and cheesy, but perhaps that's what you want.


Gimp 2.10.32 Toolbox Docking doesn't work on Windows 7

Question: I followed this tutorial on how to dock the toolbar options but it doesn't work for me on Windows 7. I'm using 2.10.32. Nothing happens when I drag the Tool Options into the Toolbox. I also cannot dock the Toobox on the left side. They all float around. How do I get them all docked automatically?
Answer: Do this.

From the main menu, go to Windows and select Single Window Mode, if not already selected.

From the main menu, go to Edit > Preferences

Expand the Interface options, and click on Window Management

Set Utility window in the Hint for docks and toolbox

Hit the Reset Saved Window Positions to Default Values

And finally: Quit and Restart GIMP.

Also note that if you accidentally detach an item from its dock, you need to click and drag the tab, not the Window itself. You should see the dock light up in blue, then you can drop it there.
Comment: `Tool options` can detach itself almost spontaneously. You can lock it down (click the `|<|` icon to the right of the tabs, and select `Lock tab to dock`).
Comment: awesome! thank you very much!
Comment: @HarryMcKenzie Excellent, glad it's fixed for you now!
Comment: @xenoid - yeah, forgot about that. Great idea. Lock it down!!!


MySQL Error: Duplicate Entry on indexing taxonomy structure with Search API

Question: Problem
I have a search index. I use a views page with this to create a search page and results for users.
I was forced to re-create my search index. I deleted the old one and I'm getting the following error when I attempt to index the new one after re-creating it.
(Technically I get 49 errors, one for each piece of content i'm trying to re-index)
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '632' for key 'PRIMARY'
I only get this error if I attempt to index the hierarchy of a particular taxonomy field.
It sounds like it's trying to re-generate the ID for my set of items, but even uninstalling and re-installing the module and re-creating everything doesn't clear the error.
Any ideas about what might be causing it? Or what I should look for in MySQL as I dig through tables?
Answer: I raised an issue in the Search API queue which then got patched. Forgot to post about it here. My bad.
https://www.drupal.org/node/2174163


Is it "#1 of a series" or "#1 in a series"?

Question: Am about to produce a series of videos on the same subject, but unrelated. Is it "#1 of a series" or "#1 in a series"? Or am I just over thinking this.
Comment: Do you intend to have "#1" read as "number 1" or "first"?
Comment: Neither. Just ditch the #1 and say *the first of/in a series*. @Catija, I can't really bring myself to read #1 as "first".
Comment: @PhilSweet I can't either... I asked because I agree that "first" is significantly better and I am having issues dealing with the #1.
Answer: You might be over-thinking it. That said, I think I prefer the "#1 in a series" more than "#1 of a series". I would be more likely to use "#1 of..." when followed by a specific number, such as: "#1 of 5", whereas I would be less likely to use "#1 in 5".
"#1 in...", using in followed by an abstract quantity/collective sounds better to me, but that may just be my subjective opinion. For example: "#1 in (a) line" compared to "#1 of (a) line" or "#1 in a collection" or "#1 of a collection".
Also, the of gives it the feeling that it is a ranking or score rather than a position in a series.


Particle like nature of electron in single-slit experiment

Question: For explaining the double slit experiment, many such as Jim Al Khalili (https://www.youtube.com/watch?v=A9tKncAdlHQ) start with an example of having one slit - the pattern on the screen is that which you expect from particle-like behaviour. When there are two slits the probability waves of two electrons interfere to create an interference pattern arising from their wave-like behaviour. Since particle like behaviour when observed is still a wave, just concentrated at one point probabilistically, since the electron is unobserved, why does a single-slit experiment not also show wave-like behaviour and spread out (like light would)?
Comment: Please see my answer and links here for single electron at at a time double slits https://physics.stackexchange.com/questions/720089/doesnt-particle-diffraction-prove-that-electron-beams-show-wave-like-properties/720144#720144 . single electrons have a dot (point like, particle like) footprint . see also https://en.wikipedia.org/wiki/Double-slit_experiment#Interference_of_individual_particles
Comment: This can still all be explained on a particle basis. When electrons are accelerated, especially through a slit they emit billions of coherent photons. The photon spread out from those points creating a pattern that directly affects the Trajectories of the electrons. The interference comes  from the two edges of the slit
Answer: An electron beam passing through a single slit  does spread out and forms diffraction  patterns.
Comment: @Jonathan _AN_ electron can only ever be located at one place at any given moment in time. What "spreads out" is the probability distribution function that tells you where to go looking for the electron. If you send thousands of electrons through the same slit with the same energy, the pattern becomes apparent as each of those different electrons ends up in a different place.
Comment: Thank you very much for your answer. Does it still do so for an electron? (I am asking as the Wikipedia page talks about light, and I could not understand quite a bit of it)
Answer: Because the video is wrong, and it's a huge problem on YouTube videos even by reputable people. You need 2 overlapping (sum-of-squares) diffraction patterns (hint: wave) when you have which-way information. When you lack that information, an interference pattern (square-of-sums) modulates the overlapping diffraction patterns.
If the single pattern is an isolated stripe, opening the second slit will also produce an isolated stripe, not because there is no wave behavior, but because the wavelength is too short to observe it.
In an MIT video, they actually do the experiment:
https://www.youtube.com/watch?v=x_0TWhJ1nh4


Latitudes and Longitudes in Atlas

Question: I have seen some Atlases and Maps where North or South or plus(+) for North or minus(-) for south is not mentioned/suffixed with the degrees of Latitudes in the graticules. Is it correct? How will a user find out whether she is looking at the map of an area in Northern Hemisphere or Southern Hemisphere. Similarly East and West are also not mentioned in many maps.
Answer: I think you would have to go by the directions that the latitude or longitude values are increasing. As long as the coordinate reference system being used is a easting, northing one, latitude values will increase upwards, in the map/page sense, in the northern hemisphere and downwards in the southern hemisphere. Similarly, longitude values will increase to the right in the easting hemisphere, and to the left in the western hemisphere.

Latitudes and Longitudes in Atlas


If i scale down parts of my UV unwrap, how can I make the rest utilize the new space?

Question: For example I have a building to unwrap, i use smart uv project and in the resulting uv map the UV Island for the roof is too large and I can scale it down. after scaling it down how can I make the rest fill up the newly created space? I tried using the "pin" option on the scaled down roof uv island, then clicked smart uv project again, but that doesn't work. Is there any way to automatically make it fill up the new space?
Thanks!
Answer: So you want to arrange UV islands within the UV space.

Select the UV islands you want to arrange
Go UV > Pack Islands
Done
Comment: Thank you, thats exactly the feature i was looking for and missed somehow!

However I have one issue with it: I don't know how to make it respect shared uv islands..
for example i have 4 wheels of a car i stack the uv islands on top of each other and when i pack the islands to use the new space they will be separated again. I also tried packing the islands with only one of the four wheels selected which absically works but it scales up the wheel island size and i don't know how to make the 3 others fit on top of it because they now have different scaling. i hope you understand what i mean.
Comment: Hello :). To perfectly match the wheel scale, you can use the Texel Density Checker addon. It is free and frankly invaluable for cases like these :).


jquery toggle effect resetting element width

Question: For some reason when i use the jquery toggle function with a speed option, the element width is animated at the same time (from 50% of the width to its full extent). I don't recall noticing it in previous version of jquery. Is there a way to make sure the toggle doesn't touch the width? The problem is that i have some floated content in the element, so when toggled , the floated layout is broken until the animation is completed.
Any ideas on how to fix this?
i am using the latest version of jquery : 1.3.2.
Comment: can you post your example code to a public URL using http://www.jsbin.com
Answer: If you just want to toggle along the vertical axis, take a look at the slideToggle function.


Can the smash ultimate gamecube controller be used on a gamecube?

Question: Just wondering because I have a gamecube with one controller, and I wanted to use the smash ultimate edition controller on my gamecube.
Answer: Yes the Wired Smash Ultimate Controller is just a regular GameCube controller intended to be used with a GameCube controller adapter on Switch or Wii U. There isn't anything different about it aside from the design and the fact that it is being currently manufactured. The wireless controller will not work, however, as that one is strictly a Switch controller.
Comment: @zxch. If this answer helped, consider [accepting it](https://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work).


What's the difference between というものではない、というものでもない and というわけがない?

Question: I often encounter these three forms, but I'm sure that they are not always interchangeable. Someone could explain me the difference and perhaps provide me some example too?
Answer: Apparently they are covered regularly in foreigners' grammar e.g. this or this. I assume you meant というわけではない for the third item.
All three can be translated mostly It is not that ....
Just one example:

謝ればいいというものではない : It is not that saying sorry is enough.
謝ればいいというものでもない : It is not really that saying sorry is enough.

The former sounds a bit stronger denial/disagreement for 'saying sorry is enough', somewhat suggesting something else must be done. The latter sounds softer, like saying sorry should not be enough, but maybe nothing else should be done either.
というわけではない/というわけでもない are mostly synonymous to というものではない/というものでもない, but like covered here, in a structure with preceding ~だからといって, というわけで{は,も}ない may be more frequent. (~だからといって~というもので{は,も}ない is possible).
===
わけない appears as form of ~わけがない, where が is omitted. Means it is impossible that....
Answer: For what i know, the first one mean "is not", the second one "Not even" and the third one "There is no reason". They should be used in different context


Trading stocks for foreign non-resident citizen

Question: I have a SSN and a US bank account I got when I worked in the US a couple of times with a J1 visa. And now I have a few dollars in the bank account I would like to invest. How is the best way to do it, considering I'm now a non-resident for more than 6 months (that was the condition for Wells Fargo trading account)?
Comment: I don't understand what you mean by "that was the condition for a Wells Fargo trading account". Could you clarify? Do you mean they won't allow you to trade, as you do not live in the U.S.?
Answer: Depending upon your home country, Interactive Brokers & E*Trade permit foreign account holders.
There is obviously more paperwork.
Interactive Brokers has branches worldwide with a presence on nearly every exchange, so it might actually be easier to set it up in your home country remotely to spare yourself paperwork.
Answer: The best way would be to move the money home and invest through your local broker. This way you avoid the double taxation issues, foreign withholding requirements and the necessity to file a tax return with the IRS to get refunds. Also, your local tax issues may be streamlined if you use a local broker (in many countries brokers withhold taxes at source and you don't need to do anything), while using an American broker will require you to also file a tax return in your home country.
If you still want to use an American broker - you'll probably need to open an account in person through branches of the broker companies (try Fidelity, ScotTrade, E*Trade, AmeriTrade, and such).
Answer: Don't quote me on this but it is my understanding that it is not allowed in either Canada or the US for brokerages to deal with customers outside their accreditation area.  But then I don't think 6 months away, that may not be permanent, and where you have not severed ties (witness this account) puts you outside their purview.
I would ask "what is the problem with moving the cash north and trading the US dollars from within a Cdn brokerage account??"
Comment: What makes you think the OP is in Canada?


Fastest way to create product variations in WooCommerce?

Question: I am looking into the fastest way for WooCommerce to generate 750+ product variations. My host with 450 variations took about 10 minutes, whereas currently, i'm running locally though it's now 18 minutes generating 1000. At the same time, I looked at my CPU speed and noticed there wasn't an as high demand for my CPU and was wondering why. I would figure if I hosted it locally I would be able to utilize my computer specifications. Is there any faster way to do this or am I doing something when hosting it locally?
Answer: this link will give a solution to your problem :
https://stackoverflow.com/questions/47518280/create-programmatically-a-woocommerce-product-variation-with-new-attribute-value
the above solution is based on creating product variation programmatically which may not be safe so I would recommend to follow tool provided by WooCommerce and create a duplicate copy of existing and similar products and just change as you needed.
From a defined variable product ID You will find bellow, a custom function that will add (create) a Product variation. The variable parent product needs to have set for it the needed attributes.
You will need to provide some information as:
the array of attributes/values
the Sku, prices and stock….
This data has to be stored in a formatted multi dimensional array (see an example at the end).
This function will check if the attributes values (term name) already exist and if not: - it create it for the product attribute - set it in the parent variable product.
The custom function code:
<code>/**
 * Create a product variation for a defined variable product ID.
 *
 * @since 3.0.0
 * @param int   $product_id | Post ID of the product parent variable product.
 * @param array $variation_data | The data to insert in the product.
 */

function create_product_variation( $product_id, $variation_data ){
    // Get the Variable product object (parent)
    $product = wc_get_product($product_id);

    $variation_post = array(
        'post_title'  => $product->get_title(),
        'post_name'   => 'product-'.$product_id.'-variation',
        'post_status' => 'publish',
        'post_parent' => $product_id,
        'post_type'   => 'product_variation',
        'guid'        => $product->get_permalink()
    );

    // Creating the product variation
    $variation_id = wp_insert_post( $variation_post );

    // Get an instance of the WC_Product_Variation object
    $variation = new WC_Product_Variation( $variation_id );

    // Iterating through the variations attributes
    foreach ($variation_data['attributes'] as $attribute => $term_name )
    {
        $taxonomy = 'pa_'.$attribute; // The attribute taxonomy

        // If taxonomy doesn't exists we create it (Thanks to Carl F. Corneil)
        if( ! taxonomy_exists( $taxonomy ) ){
            register_taxonomy(
                $taxonomy,
               'product_variation',
                array(
                    'hierarchical' => false,
                    'label' => ucfirst( $attribute ),
                    'query_var' => true,
                    'rewrite' => array( 'slug' => sanitize_title($attribute) ), // The base slug
                ),
            );
        }

        // Check if the Term name exist and if not we create it.
        if( ! term_exists( $term_name, $taxonomy ) )
            wp_insert_term( $term_name, $taxonomy ); // Create the term

        $term_slug = get_term_by('name', $term_name, $taxonomy )->slug; // Get the term slug

        // Get the post Terms names from the parent variable product.
        $post_term_names =  wp_get_post_terms( $product_id, $taxonomy, array('fields' => 'names') );

        // Check if the post term exist and if not we set it in the parent variable product.
        if( ! in_array( $term_name, $post_term_names ) )
            wp_set_post_terms( $product_id, $term_name, $taxonomy, true );

        // Set/save the attribute data in the product variation
        update_post_meta( $variation_id, 'attribute_'.$taxonomy, $term_slug );
    }

    ## Set/save all other data

    // SKU
    if( ! empty( $variation_data['sku'] ) )
        $variation->set_sku( $variation_data['sku'] );

    // Prices
    if( empty( $variation_data['sale_price'] ) ){
        $variation->set_price( $variation_data['regular_price'] );
    } else {
        $variation->set_price( $variation_data['sale_price'] );
        $variation->set_sale_price( $variation_data['sale_price'] );
    }
    $variation->set_regular_price( $variation_data['regular_price'] );

    // Stock
    if( ! empty($variation_data['stock_qty']) ){
        $variation->set_stock_quantity( $variation_data['stock_qty'] );
        $variation->set_manage_stock(true);
        $variation->set_stock_status('');
    } else {
        $variation->set_manage_stock(false);
    }

    $variation->set_weight(''); // weight (reseting)

    $variation->save(); // Save the data
}
</code>
Code goes in function.php file of your active child theme (or theme) or also in any plugin file.
Comment: Rather than posting a link to an external site, can you please outline the solution on here? Thanks!
Comment: I'm just trying to avoid duplicate answer which is already out there.


Sparrow over a SSH-tunnel

Question: Is it possible to use Sparrow over a SSH-tunnel since the imap and ssl ports are blocked at my work?
Answer: I think your basic strategy is correct, e.g.:
ssh -L 587:smtp.gmail.com:587 -L 993:imap.gmail.com:993 user@yourremotehost
should get you talking to Gmail via yourremote host.  Potential problems are if you do not run this as root (with sudo), you are not allowed to specify local ports below 1024 - so you can't use 587 or 993 as your local ports.  So, do something like this:
ssh -L 9587:smtp.gmail.com:587 -L 9993:imap.gmail.com:993 user@yourremotehost
...and configure Sparrow to talk to localhost on those high local port numbers instead of the defaults.
Again, you can debug by trying 'telnet localhost 9587' which should get you an SMTP prompt from Gmail.  If that works, you should feel confident that the SSH part is working, and concentrate on Sparrow configuration.
If you get it all working, an alternative to the commandline switches is to make a file called 'config' in your local .ssh directory that looks like this:
<code>Host yourremotehost
        LocalForward    9587    smtp.gmail.com:587
        LocalForward    9993    imap.gmail.com:993
</code>
Comment: Really strange. It doesn't work for me. Can anyone try the above if you got blocked by a firewall and can't use Sparrow.

Sparrow over a SSH-tunnel


ListInterpolation of a geopath list of lat/long without reformating?

Question: I have a list of lat/long pairs and would like to interpolate. Sending the list of lists of lat/long directly to the first form in the documentation as ListInterpolation[{f1,f2,..}] noting "The function values fi can be real or complex numbers, or arbitrary symbolic expressions." doesn't and cannot work as the structure of the argument looks identical to the 2nd form ListInterpolation [{{x1,f1}, ..}]. So now hard to restructure the list so that that {{i,{lat1,long1}},{i+1,{lat2,long2}},..} and I'm sure that'll work. But I don't understand well the use of Hold and other controls, so is there a way to tell ListInterpolation that the following should be treated in the 1st form instead of the second? For this instance, it is easy to wrap the lat/long in GeoPosition and then the list is of elements and with InterpolationOrder -> 1 it seems to work. However, the general question remains. How to instruct Mathematica to treat a structure one way when it also matches another?
Comment: The reason for interpolation is I wanted to find the closest approach to some other point. I was planning to use GeoDistance in a FindMinimum and figured a function made from line segments (order -1) of order - 2 interpolation would be the easiest way to form the "continuous" function so findmin would work over real numbers and the GeoDistance would be reasonably smooth.
Comment: Use `Interpolation[{{lat1,long1},{lat2,long2}, ....}]`
Answer: $Version

(* "13.2.1 for Mac OS X ARM (64-bit) (January 27, 2023)" *)

Clear["Global`*"]

SeedRandom[1234];

pts = RandomGeoPosition[
   Entity["Country", "UnitedStates"], 10][[1]]

(* {{45.8748, -68.5756}, {36.8119, -100.915}, {33.4359, -95.5268}, {47.2874, \
-97.6259}, {42.7483, -99.5294}, {35.3193, -97.3695}, {46.0988, -91.3056}, \
{38.3082, -121.194}, {47.0701, -117.238}, {34.4971, -104.295}} *)

Given a list of {lat, longs}, it is not clear why you need to interpolate them.
GeoListPlot[GeoPosition[SortBy[pts, Last]],
 Joined -> True]

GeoGraphics[{Red, AbsoluteThickness[2],
  GeoPath[GeoPosition /@ SortBy[pts, Last]]}]

GeoListPlot[GeoPosition[
  pts[[Most[FindShortestTour[pts][[2]]]]]],
 Joined -> True]

GeoGraphics[{Red, AbsoluteThickness[2],
  GeoPath[GeoPosition /@
    pts[[Most[FindShortestTour[pts][[2]]]]]]}]


Can I get the same solid compressed result from my meat press using cooked meats?

Question: I'd like to turn the small pieces of leftover cooked turkey in to sliced deli meat using my meat press. However all the recipes I've found involve raw meats. Without the cooking step using a meat press, will my mixture hold itself together after pressing? Or will it be a loose spreadable 'potted meat'? Also, I'm afraid cooking my cooked leftovers will make it overcooked and undesirable...
Answer: The chemical processes which bind chopped/minced raw meat during cooking do not happen when already-cooked meat is pressed, even if it is then reheated. If you add some concentrated aspic to the hot mixture, that may suffice to bind the pieces together once cooled, but it will not have the same consistency as meat that was raw when pressed and cooked.
Recooking cooked meat would not lead  to overcooking. The sort of overcooking you're thinking of is actually overheating. It doesn't relate to how long or how many times the meat is cooked.


Discrepancy in gas prices in ENS

Question: I'm a bit confused, I'm trying to buy a domain name in https://ens.domains/ and the price is extremely high for a domain name, it's about $150. Most of that price comes from gas fees. The confusing thing is that ens tells me the following
Estimated Total (Price + Gas). The gas price is based at 130 Gwei whereas in https://ethgasstation.info/ the gas price is 83. So it's 130 in ens and 83 in ethgasstation. Is that correct? Why ENS would consider a higher price for gas?
Also, is there a way to see in ENS how is that estimated total calculated?
Comment: i have this same confusion. anyone? seems like ens is three transactions total and it's adding those?
Answer: 8 mos. old, but in case someone still wonders the answer..
Different transactions use different amounts of gas. The 83 is just the base GWEI for ETH transfers, which are the most simple trips of transaction i believe.
Comment: The question refers to the quoted gas price, not the gas limit required for transaction execution.

Discrepancy in gas prices in ENS


Can I donate short-stock to charity?

Question: I have a short position that I have a significant profit on. Is it possible to donate this to charity the same way I might donate "appreciated stock", so as to avoid the short-term capital gains?
Comment: I'm not sure enough to post an answer, but I have to believe the answer is "no" because you don't "own" a short position.  It is essentially a loan. When you cover the short position, the tax is determined by how long you held the stock that you used to close the short position. (Often 0 days because you "buy to cover" specifically.) I'm assuming this is US because "short-term capital gains" sounds specific to the US tax code - I agree with Dheer though that it would be better for you to label the question explicitly.
Comment: could your edit the tags and add country. Tax rules vary from country to country
Comment: Why are you so worried about paying taxes on any profits you make from trading?
Comment: I agree with @Brick, and to state it another way, think of what sort of asset you possess. When you sell long, you give someone some money, and they give some stock in return, so the asset you possess is the stock, which you can donate, sell, gift, etc. When you sell short, you give someone some stock (that you borrowed) and they give you some money in return, so the asset you possess is the money, which you can donate, gift, buy something else with, etc. So you could donate the money you get selling short, but you'll still owe the shares you borrowed, so the position is still open.
Answer: No. There is no asset associated with your short position, so there's nothing to gift. The short position in the stock is purely a liability. When you note that you have a profit in the position, what you mean is that the cash you made when you shorted the stock is more than enough to cover the short position. The only asset in this picture, then, is the cash you made when you entered the short position.
Answer: With a short position you make your money (profit) when you buy the stocks back to close the position at a lower price than what you bought them at. As short selling is classed as speculation and not investing and you at no time own any actual assets, you cannot donate any short possition to charity.
If you did want to avoid paying tax on the profits you could donate the proceeds of the profits after closing the position and thus get a tax deduction equal to the profits you made.
But that raises a new and more important question, why are you trading in the first place if you are afraid to make profits in case you have to pay tax on those profits?
Comment: Are you sure about the tax consequences? I'm pretty sure it is a capital gain, with the term determined by how long you hold the shares you buy to cover the short, which will be less than a day, so it will be a short-term capital gain. While they're taxed at the same rate as ordinary income, they can be used to offset (or be offset by) other capital gains, which they couldn't be if ordinary income (all assuming US).

Can I donate short-stock to charity?


Creating struct like data structure in Java

Question: I am new to Java and I am trying to find out a way to store information like a struct in C.  Say for example I want to have a program hire employees.  It would take from the user a first name, last name, and id number and would store it.  The user could then view that information based off a condition (if the database had more than 1 employee for example).  Can any suggest the best way for doing this?
Comment: An `object` from a `class` holds all the data you want to pack together. And the methods that manage that data, too.
Answer: A struct in C just like a class in Java and much more powerful, because class in Java can contain method, and C++ does. You create a new class. For example :
   class Employee {
       private String name;
       private int code;

   // constructor
   public Employee(String name, int code) {
      this.name = name;
      this.code = code;
   }

       // getter
       public String getName() { return name; }
       public int getCode() { return code; }
       // setter

       public void setName(String name) { this.name = name; }
       public void setCode(int code) { this.code = code; }
    }

And when you want to create multi employees, create array just like in C:
Employee[] arr = new Employee[100];  // new stands for create an array object
arr[0] = new Employee("Peter", 100); // new stands for create an employee object
arr[1] = new Employee("Mary", 90);

Comment: I found a little mistake in setCode(). It should be "int Code" instead of "String code".
I want to edit but "Edits must be at least 6 characters"
Comment: If I create a new class for employee would I want to create array in the employee class or could I created it in a separate class?
Comment: @bardockyo you will create it in separate class. often, array of employee in class such as "Management".
Comment: I want to point out that a struct in c++ can also contain methods.
Answer: In Java 16 there are Records (JDK Enhancement Proposal 395):
public record Employee(String firstName, String lastName, String id) {
}

This comes with a canonical constructor, field accessors, hashCode(), equals() and toString() implementations.
Answer: I would create a public class with public fields and a default constructor, like this:
    public class Employee {
       public String name, last_name;

   // constructor
   public Employee() {
      this.name = "";
      this.last_name= "";
   }

    }

  ....
  //when using it
  Employee e = new Employee();
  e.name ="Joe";
  e.last_name = "Doe";

Answer: I have a big problem with structures not being supported in Java.   I am writing an Android app which receives data via Bluetooth from an embedded ARM based device (written in "C").  This data when received is a packed array of bytes which contains the contents of my embedded device's EEPROM.
In "C", C++, or "C#", I can simply "cast" this stream of bytes to a structure representing the EEPROM on the embedded device and programmatically use the members of the structure simply by referring to them.   In Java, I don't have this option and there's no good way to do it since Java (except for an obscure IBM version which supports packed classes) doesn't allow you to have "packed" classes where the class members are packed without headers and footers to each class member.
Comment: In java one there is DataInputStream and DataOutputStream. Or ByteBuffer which is more like struct.
Comment: This look like to something unsafe as depending of your compiler, os or processor the padding and optimization done as how the structure in represented in memory would not longer hold true.


configuring external block of IP addresses

Question: I have a business DSL through FairPoint. With it, I have a block of 5 IP addresses. I've done some googling and spoken with FP tech support. Perhaps someone that's more knowledgeable than I can provide some direction. I'm currently hosting my company's website on a Win2k3 server through FP's Westell modem and a Cyberoam router. My question is, what is the preferred or recommended configuration for setting up a Win2k8 server (or more) on one of the other IP addresses? Thanks.
Comment: Do you want the public IP address attached directly to the W2k8 machine, or are happy with having it NATted to the server?
Comment: Mark - I contacted a cyberoam guru and he pointed me to this link -  http://kb.cyberoam.com/default.asp?SID=⟪=1&id=1630 From this, I was able to use port forwarding to connect directly to my virtual server from the external IP address. This solved the problem for me. Not being a system guy, it appears that the terms in this KB article are generic enough to be used on most routers. Thanks.
Answer: Well, your first step is getting one of the IPs set on the box.  This would be done via the normal way of configuring a static IP on the machine (if you aren't sure on how to do this, you may want to reconsider exposing a windows machine directly the internet).
After that, go into the TCP/IP properties, and hit 'Advanced'.  You can then add as many IPs as you want using the list at the top.


How to set a window to display on every workspace on OS X?

Question: I have 2 screens and 4 workspaces. I'd like one screen (which displays only 1 window: a terminal) to be "pinned" and do not change when I switch workspaces (only windows on the other screen should change). Can I achieve that on OS X?
Answer: Right click it in the Dock > Options > Assign to... All Desktops.
Answer: For an app (like Touch Bar Simulator) that has a floating window without an icon in the Dock, you have to find the .app file and drag it to your Dock.
From there you can use the method that Tesujin mentioned to have it available on all workspaces by right clicking on app icon, Options, Assign To All Desktops.
Answer: I've been pulling my hair out over this one.
I recently changed to a new work computer and after getting most things set up how I like, that's been driving me crazy. There's a few dock features I rely heavily on and the biggest simple one is just setting Finder to appear on all desk tops.
Expected Behavior:
By assigning finder to all desktops, when I open finder (through spotlight, dock, tab_cmd switching etc) it will aways open my current finder windows on whatever monitor/space/desktop I open it on.
With this computer on Catalina 10.15.16. (same as my last) the feature doesn't work.
Actual behavior:
If I set finder to assign to a specific desktop, it works, and will only open on that desktop. e.g. I have two monitors, each with 4 desktops/spaces.
If I set it to desktop 4(desktop8 out of all of them) on monitor 2, opening finder will always bring me to a finder window on that desktop/space.
If I set it to all Desktops, with a finder window on desktop 8 (4th space on monitor 2) opening finder will bring the finder window to the front of any desktop on monitor 2. It used to carry this same behavior. i.e. I should be able to on monitor 1 (my laptop) open finder, and despite it last being used on desktop 8, it would appear on desktop 1 as well.
This is a small feature that always makes it easy to constantly drag and drop things in and out of my downloads folder.
It appears as if that no longer carries through with both monitors, leaving me to only use the feature on my second monitor and having to manually drag the window to the other monitor if I want it there.
Anyone experienced this or have any thoughts? I've tried the above solutions, several reboots and PRAM/SMC resets to no avail.


I'd like to know the name and a few details of a certain time-keeping structure in the human brain

Question: I once heard of this structure on the Discovery Science channel and have since forgotten the name. The details I remember about it were that it is the central time-keeping device for the brain located in the geographic center of the human brain. The DSC only mentioned it in passing to describe a person with an abnormality in this structure. Can someone post some reliable research links and a short description of it? I don't trust google much and am not good at using it, so thanks!
Answer: You are probably referring to the suprachiasmatic nucleus.
Note that, although this is the central clock, there are also so-called "peripheral clocks", for instance in the liver, pituitary and other organs that can finely tune rhythms in the organism.
You may also want to have a look at the Wikipedia page for circadian clock and references therein.
Comment: Suprachiasmatic Nucleus is a part of Hypothalamus, which might be an interesting read as well - hypothalamus is very important
Comment: okay thank you very much, that looks like what i was referring to. I also heard it was very very small, and the wikipedia article said 20k neurons and the size of a grain of rice. I'll remember circadian clock too!


Spindle stuck in upvc window lock

Question: I am trying to remove the spindle to replace the lock on my upvc window, but the spindle is jammed. I have tried wd40 and leverage but it won't budge. What else can be done?
Comment: Please add a picture of the stuck part.  Press *Edit* above to add one.
Answer: Is it a standard 'ESPAG' [square shaft] type?

It's not really leverage you need, it's a shock. Once the window mechanism is free to turn, then the hardware stop inside the handle itself will prevent any further leverage against the actual window mechanism… which is what you need. You're then just pushing self against self, not touching the spindle/socket interface, where it's stuck.
If the spindle has started to turn too far inside the locking mechanism, due to rounding, then a tap with a [soft or wooden] hammer should free it up - so long as you tap it the right way. As you can't see until you've cleared it which way that should be, just be careful; tap one way, then flip the handle & tap it the other. It ought to come free fairly easily.
The chances are it will be over-tightened in the same way as closing the window, rather than opening it. The stop in the handle mechanism only really works when opening, it doesn't come into play as much when closing. That gives you the opportunity to close the window [make sure not to let it lock] then tap the handle towards 'open'. You're not trying to actually open it this way, just free it up opposite to the normal way the most pressure is usually exerted.
If it's still fighting you, then you might need to set up some clamp mechanism to hold the actual window hardware still, whilst you shock the interface between the two. How you achieve this will depend on the exact window mechanism, which is less ubiquitous than the handle interface.
Just note you can't 'shock' it if you're working against the handle itself against either stop, open or closed. You have to work at an angle the stop isn't hampering your tap.

Spindle stuck in upvc window lock


What is the viewing order for CW's DC shared universe?

Question: As I understand it the following shows all take place in the same shared universe:

Arrow
Flash
Constantine
Vixen
Legends of Tomorrow
Supergirl (confirmed)
The Flash (1990)
Freedom Fighters: The Ray

And any others that arrive.
In what order should these shows be viewed? How do they fit together chronologically?
Comment: @ThaddeusHowze arrow, flash, and legends of tomorrow at least are intended to coincide together, as the 3 shows share cross over episodes that would make little sense watching out of order. however asking this question every few weeks when a new cross over happens is getting boring/excessive
Comment: related partial dupes: [In what order should I watch Flash and Arrow TV Shows?](http://scifi.stackexchange.com/q/89097/5184) and [Is Supergirl part of the same universe as The Flash and Arrow?](http://scifi.stackexchange.com/q/92161/5184)
Comment: I would vote to close them. This is the kind of thing I DON't think we should be engaged it. The viewing order of a series particularly ones where their continuity was never DESIGNED to be integrated is not a useful expenditure of anyone's energy. The shows don't include timestamps, datestamps or any form of relationship matrix, so if one is created it is OPINION-BASED at best because the shows were not created NOR written to be integrated in this fashion. They are NOT comics whose existence and integration are considered beforehand particularly due to their event-driven nature.
Comment: given that there are specifically timed crossovers between at least two of the shows, i see some value in a suggested order. vixen and LoT remain to be seen how much they integrate, and i haven't heard of any more cross with constantine. still, i'd rather see the flash/arrow answer improved and use that as the original since it's already so far along.
Comment: The other question (and all of it's answers) neither address nor attempt to address anything but Arrow and Flash. I can see closing *that* one as a dupe, but this one is far more inclusive *and* more up to date.
Comment: Related: [Suggested viewing order for complete DC Arrowverse to date?](https://movies.stackexchange.com/q/91704/49)
Comment: @phantom42 I still don't fully understand this site's dupe policy, but I don't think that they classify as dupes if they don't fully address this question.
Comment: You'll notice that I said *partial* dupes, and did not vote to close.
Comment: @phantom42 I did notice, just wondering about what the policy is.
Comment: However, I have left it open to let others have some say in whether we should be answering this opinion-based, list-oriented question. (See what I did there?)
Comment: I understand the shows share a common continuity since both Flash and Legends of Tomorrow were spun off of Arrow. But is there so much interconnectedness between the three shows there needs to be a continuity bible to ensure some maximum level of enjoyment due to timeline continuity? Honestly? I watch all three and don't see any particular need to reorder them mentally to enjoy them IN ANY WAY.
Answer: You only have to have a viewing order when there is a multi-part episode that spans a show.
There are multi-part crossovers that span multiple shows that won't make complete sense if you watch one but not the other:
Flash vs. Arrow/The Brave and the Bold

Part 1: The Flash Episode 1x08 "Flash vs. Arrow"
Part 2: Arrow Episode 3x08 "The Brave and the Bold"

Legends of Today/Legends of Yesterday

Part 1: The Flash Episode 2x08 "Legends of Today"
Part 2: Arrow Episode 4x08 "Legends of Yesterday"

"Heroes vs. Aliens"

Optional Prologue: Supergirl Episode 2x08 "Medusa"

This was advertised as part of the crossover event, but Cisco's attempts to create a dimensional breach to Supergirl's Earth is a C-plot that is repeated  in The Flash episode.

Part 1: The Flash Episode 3x08 "Invasion!"
Part 2: Arrow Episode 5x08 "Invasion!"
Part 3: DC's Legends of Tomorrow Episode 2x07 "Invasion!"

Star-Crossed/Duet

Part 1: Supergirl Episode 2x16 "Star-Crossed"
Part 2: The Flash Episode 3x17 "Duet"

"Crisis on Earth-X"

Part 1: Supergirl Episode 3x08 "Crisis on Earth-X, Part 1"
Part 2: Arrow Episode 6x08 "Crisis on Earth-X, Part 2"
Part 3: The Flash Episode 4x08 "Crisis on Earth-X, Part 3"
Part 4: DC's Legends of Tomorrow Episode 3x08 "Crisis on Earth-X, Part 4"

Unknown Crossover
Keeping in Sync with Seasons of the Major Shows Helps
It's common for the status quo of characters on one show to have an effect on another show. For that reason, it's highly recommended that you don't start a new season of a show until you are up to date on all other seasons for the shows up to that point.
For instance, Ray Palmer is introduced as a recurring character in Arrow Season 3 and is traveling through time in Legends of Tomorrow Season 1, taking place concurrently with Arrow Season 4.
Ray Palmer guest stars in The Flash Season 1, Episode 18. If you watch that before the character is introduced in Arrow Season 3, you won't know who Ray Palmer is. If you watch it during or after Legends of Tomorrow Season 1, you'll wonder why he is taking a break from time travel to help The Flash.
Here are the seasons of each show that were running concurrently:
2012-2013

Arrow Season 1

2013-2014

Arrow Season 2

2014-2015

Arrow Season 3
The Flash Season 1
(Optional) Constantine CW Site Season 1
(Optional) Vixen Cartoon Season 1

2015-2016

Arrow Season 4
The Flash Season 2
Legends of Tomorrow Season 1

Aired partially during the off-season of Arrow and The Flash
Takes place after Arrow 4x08 and The Flash 2x08

Supergirl Season 1
Vixen Cartoon Season 2

Although aired in late 2016, it takes place before Legends of Tomorrow begins. Really, you can just watch it at this point or later.

2016-2017

Arrow Season 5
The Flash Season 3
Legends of Tomorrow Season 2
Supergirl Season 2

2017-2018

Arrow Season 6
The Flash Season 4
Legends of Tomorrow Season 3
Supergirl Season 3
Black Lightning Season 1
Freedom Fighters: The Ray Cartoon Season 1

2018-2019

Arrow Season 7
The Flash Season 5
Legends of Tomorrow Season 4
Supergirl Season 4
Black Lightning Season 2

More detailed explanation
The shared universe between these shows is called the "Arrowverse" because Arrow was the first show in the series. Therefore, it's the proper place to start. All the series were released in chronological order (no prequel series).
While there are a lot of references between the two series, only a few of them are important crossovers. Fortunately, this means that you don't have to watch the shows in lock-step with when they originally aired. You can usually watch about half a season of one show before you reach a point that assumes you are caught up with another show.
The only major crossover points are as follows:

Flash Episode 1x08 and Arrow Episode 3x08 are two parters
Flash Episode 1x17 and 1x18 have many characters from Arrow in it
Arrow 4x05 includes Constantine
Flash Episode 4x08 and Arrow episode 4x08 are two parters, and start Legends of Tomorrow
Arrow 4x15 includes Vixen
Supergirl 1x18 includes Flash

Usually these crossovers reflect whatever the current state of the status quo on the other show is (e.g. how the Arrow is viewed by the police, how developed Barry's powers are, who the supporting cast is), so it's good to get caught up before watching them.
For a more thorough explanation of the crossover events, see Mike Edenfield's answer for In what order should I watch Flash and Arrow TV Shows?.
Here is a more exhaustive viewing order that highlights these main crossover points, accurate as of January 2016 (feel free to edit this if it is out of date):
Before The Flash

Arrow Season 1

No crossovers with other shows

Arrow Season 2

Includes a backdoor pilot to The Flash

Before the Arrow Season 3, Episode 8 and The Flash Season 1, Episode 8

Arrow Season 3, Episodes 1-7

Further develops supporting characters

The Flash Season 1, Episodes 1-7

Introduces Barry Allen as the Flash and meta-humans

The Flash's episode is first in the two-parter
Before Flash Episode 17 and 18

Arrow Season 3, Episodes 8-16

Further develops supporting characters that appear in this episode

The Flash Season 1, Episodes 8-16

Before Arrow Season 4 and The Flash Season 2

Arrow Season 3, Episodes 17-23

Status quo change in next season, occasionally referenced in The Flash

The Flash Season 1, Episodes 19-23

Status quo change in next season, occasionally referenced in Arrow

Before Arrow Season 4, Episode 5

Arrow Season 4, Episodes 1-4

Introduces new villain who is the reason for Constantine to join

Constantine

Develops the character, has no crossovers with the other shows

Before Legends of Tomorrow

Arrow Season 4, Episodes 5-7

Explores supporting characters who appear in Legends of Tomorrow

The Flash Season 2, Episodes 1-7

Explores supporting characters who appear in Legends of Tomorrow

The Flash Season 2, Episode 8

Part 1 of 2 kicking off Legends of Tomorrow

Arrow Season 4, Episode 8

Part 2 of 2 kicking off Legends of Tomorrow

Before Arrow Season 4 Episode 15

Arrow Season 4, Episodes 9-14
Vixen Season 1

Introduces the character

Before Supergirl Season 1 Episode 18

The Flash Season 2, Episode 17*

If anyone has any suggestions for this viewing order, I will be happy to hear it.
* Note that in the original broadcast, Supergirl 1x18 was aired before The Flash 2x17.
Comment: Nicely done. Cogent and concise.
Comment: Please update this list it has been a huge help in enjoying Arrowverse
Comment: Nice answer, +1. Anyways there is also a detailed question about [vixen too](http://scifi.stackexchange.com/questions/106258/where-does-vixen-sit-within-the-arrow-verse-timeline).
Comment: Are you able to update this to include the recent minor-crossovers and the Flash show from the 90's.
Comment: @ibid I haven't caught up on the latest episodes, and it will take a little while before I am caught up. If you want to edit my answer in the mean time, feel free.
Comment: @Thunderforge - Much better, though it's still missing the King Shark crossover on Flash and the Bug-Eyed Bandit crossover on Arrow.
Comment: @ibid Yeah, I probably should add those. However, those definitely seem like less important crossovers than the other ones. I'll have more time later today to make those changes.
Comment: @Thunderforge - No less important than last season's minor crossovers. Also, try putting some small mention of *The Flash (1990)*.
Comment: If you fully update this answer (more than just the major event crossovers) I'll through in a 250 point bounty.
Comment: @ibid Thanks for the offer! What does "fully updating" aside from the major event crossovers mean to you? Some crossovers aren't really that important despite some fan timelines (like the other answer) placing them at an exact moment (for instance, it doesn't really matter where you are in the second half of Season 4 Arrow when Diggle and Lyla show up in Season 2 Flash). I just want to make sure I understand what level you are looking for.
Comment: @Thunderforge - Mainly when "the status quo of characters on one show to have an effect on another show". As in, not an episode-to-episode line-up, but information about where you should be up to before each minor crossover. (in that example you should have at least seen the last episode where Lyla or Diggle had a relevant status quo change.) I'm looking for some information about all the crossovers, not *just* the big 'Episode Eight's of each season.
Comment: @Thunderforge - I'm upping my offer to 300.
Comment: @ibid I've added the major crossovers so far, but will take some more time in the next few days to update the reset.
Comment: @Thunderforge - Give me a ping whenever you finish.
Comment: Maybe you can answer [movies version too](https://movies.stackexchange.com/questions/91704/suggested-viewing-order-for-complete-dc-arrowverse-to-date)
Answer: On this page: http://www.imdb.com/list/ls074499769, someone compiled an extended view order, including Arrow, Flash, Vixen, Constantine, Supergirl, and Legends of Tomorrow.
I hope this is what you're looking for:
Arrow Seasons 1 & 2

Arrow Season 1 (1 - 23)
Arrow Season 2 (1 - 23)

Arrow Season 3 / The Flash Season 1 / Vixen Web Series

The Flash 1×01: Pilot
Arrow 3×01: The Calm
Arrow 3×02: Sara
The Flash 1×02: Fastest Man Alive
The Flash 1×03: Things You Can't Outrun
Arrow 3×03: Corto Maltese
The Flash 1×04: Going Rogue
Arrow 3×04: The Magician
Arrow 3×05: The Secret Origin of Felicity Smoak
The Flash 1×05: Plastique
Arrow 3×06: Guilty
The Flash 1×06: The Flash Is Born
Arrow 3×07: Draw Back Your Bow
The Flash 1×07: Power Outage
The Flash 1×08: Flash vs. Arrow
Arrow 3×08: The Brave and the Bold
The Flash 1×09: The Man in the Yellow Suit
Arrow 3×09: The Climb
The Flash 1×10: Revenge of the Rogues
Arrow 3×10: Left Behind
The Flash 1×11: The Sound and the Fury
Arrow 3×11: Midnight City
The Flash 1×12: Crazy for You
Arrow 3×12: Uprising
The Flash 1×13: The Nuclear Man
The Flash 1×14: Fallout
Arrow 3×13: Canaries
Arrow 3×14: The Return
Vixen Season 1 (1-6)
Arrow 3×15: Nanda Parbat
Arrow 3×16: The Offer
The Flash 1×15: Out of Time
The Flash 1×16: Rogue Time
The Flash 1×17: Tricksters
Arrow 3×17: Suicidal Tendencies
The Flash 1×18: All Star Team Up
Arrow 3×18: Public Enemy
Arrow 3×19: Broken Arrow
Arrow 3×20: The Fallen
The Flash 1×19: Who Is Harrison Wells?
The Flash 1×20: The Trap
The Flash 1×21: Grodd Lives
Arrow 3×21: Al Sah-him
Arrow 3×22: This Is Your Sword
The Flash 1×22: Rogue Air
Arrow 3×23: My Name Is Oliver Queen
The Flash 1×23: Fast Enough

Constantine Season 1

Constantine Season 1 (1 - 13)

Arrow Season 4 / The Flash Season 2 / Legends of Tomorrow Season 1 / Supergirl Season 1

Arrow 4×01: Green Arrow
The Flash 2×01: The Man Who Saved Central City
The Flash 2×02: Flash of Two Worlds
Arrow 4×02: The Candidate
The Flash 2×03: Family of Rogues
Arrow 4×03: Restoration
Arrow 4×04: Beyond Redemption
The Flash 2×04: The Fury of Firestorm
The Flash 2×05: The Darkness and the Light
Arrow 4×05: Haunted
Arrow 4×06: Lost Souls
The Flash 2×06: Enter Zoom
Arrow 4×07: Brotherhood
The Flash 2×07: Gorilla Warfare
The Flash 2×08: Legends of Today
Arrow 4×08: Legends of Yesterday
Arrow 4×09: Dark Waters
Arrow 4×10: Blood Debts
The Flash 2×09: Running to Stand Still
The Flash 2×10: Potential Energy
Legends of Tomorrow 1x01: Pilot, Part 1
Legends of Tomorrow 1x02: Pilot, Part 2
Legends of Tomorrow 1x03: Blood Ties
The Flash 2×11: The Reverse-Flash Returns
Arrow 4×11: A.W.O.L
The Flash 2x12: Fast Lane
Arrow 4×12: Unchained
Arrow 4×13: Sins of the Father
The Flash 2x13: Welcome to Earth-2
The Flash 2x14: Escape from Earth-2
The Flash 2x15: King Shark
Supergirl 1x1: Pilot
Supergirl 1x2: Stronger Together
Supergirl 1x3: Fight or Flight
Supergirl 1x5: How Does She Do It?
Supergirl 1x4: Livewire
Supergirl 1x6: Redfaced
Supergirl 1x7: Human for a Day
Supergirl 1x8: Hostile Takeover
Supergirl 1x9: Blood Bonds
Supergirl 1x10: Childish Things
Supergirl 1x11: Strange Visitor from Another Planet
Supergirl 1x12: Bizarro
Supergirl 1x13: For the Girl Who Has Everything
Supergirl 1x14: Truth, Justice and the American Way
Supergirl 1x15: Solitude
Supergirl 1x16: Falling
Supergirl 1x17: Manhunter
Legends of Tomorrow 1x04: White Knights
Legends of Tomorrow 1x05: Fail-Safe
Legends of Tomorrow 1x06: Star City 2046
Arrow 4×14: Code of Silence
Arrow 4×15: Taken
Legends of Tomorrow 1x07: Marooned
Legends of Tomorrow 1x08: Night of the Hawk
Comment: But do I *have* to watch Supergirl?...
Comment: @Joshua Supergirl is in a different universe, so the only connection is the occasional crossover episode. There's not continuous feedback between events in Supergirl and events in the other shows. So, no, not really.
Answer: In my opinion, its more fun to watch all the shows. I have not watched Constantine and Vixen, but I'm considering doing so. I am not sure Flash (1990) is related.
As was stated by another person, watching all shows helps you better understand what's happening with all the characters; however, as one of my professors told me, you don't HAVE to do anything. I advocate for at least watching the 3 mains. I watch the 4, as stated above. I like Arrow and the Flash. Also, I ship Oliver and Barry as besties. :) They need to make more Arrow/The Flash crossovers in my opinion.
Legends, is ok. I can understand not wanting to watch it. But is more fun compared to Arrow's darkness and Barry kind of starting to channel Oliver in The Flash season 2 and, admittedly more so the new Oliver, again now in season 3. Its Doctor Who in the DC verse. Fun facts: the Rip Hunter comics predate Doctor Who, and Rip Hunter is played by the same actor who played Rory.
Supergirl is, at times, very much a liberal setpiece. That is not always bad. As a female who likes superheroes, I very much like how they are trying to get rid of the fact that most female superheroes were written by men who were exercising some fantasy when making their costumes. Also, the fact that most female superheroes seemed to be made as a counter to a male superhero. It goes a little too far in the left-ward direction sometimes, but mostly, it goes just enough to make me happy. Also, it is one of the few recent shows I have seen with a female lead where they got rid of the love-triangle angle. That alone makes it awesome to me. The crossover episode with the Flash in Supergirl 1x18 was super adorable. And sure, it was kind of played off that Barry was used to make James jealous, but it could also be seen as someone who had been doing this a little longer offering advice, and also gave Barry and Kara a chance to play around with their powers.
If you decide to watch the 4, looking at the release orders is the best indicator. The timeline doesn't always seem to match up, but enough so you can keep up.
Comment: The 1990 Flash isn't related continuity-wise, but if you'd already seen it there's a [nice little surprise](https://78.media.tumblr.com/3d01a64eba496560e9e4e3e7e94c8996/tumblr_inline_omzu11jjx71rxmqx0_540.jpg) in the Season 2 finale.
Answer: Here's both a simplified watching order and a detailed timeline which breaks up episodes based on flashbacks/time travel/etc.
http://thetimelinesite.com/dc-cw-universe
The 1990 Flash TV Series isn't technically part of the same universe as the Arrowverse, but it's been heavily implied it occurs in an alternate universe, so far numerous versions of Earth have been shown on Flash, Earth-1 being the main universe Arrow, Flash, Legends of Tomorrow, Vixen and Constantine occur on, Earth-2, Earth-3 and a few others being alternate Earths shown on Flash, and Earth-38 is the universe Supergirl occurs in. Earth-X (presumably Earth-10) was also introduced in the recent Crisis on Earth-X crossover.
Presumably the 1990 Flash TV series occurs on an alternate Earth (just no official designation yet). There have been numerous callbacks and connections between the 1990 and 2014 Flash shows, from John Wesley Shipp playing Flash in the 1990 show and Flash's father in the 2014 show; the actors who played Tina McGee and Julio from the 1990 series both reprised those same roles in the 2014 series (presumably just the Earth-1 versions of those characters), as well as Mark Hamill's Trickster appearing in both versions of the show and his sidekick Prank recently reprising her role from the 1990 series.
Plus, in the 2014 show, when traveling through the Speed Force, Barry saw a glimpse of the 1990 show's Flash, cementing fact it does indeed take place within the same multiverse.
It's not essential viewing for the Arrowverse, but it does provide some interesting connections.
Comment: While interesting, you answer should _focus_ on the viewing order more than just providing a link. You should provide the information in the link here with the link as a citation (because links die and then your answer is meaningless). Secondly, while interesting the connections between the two don't really answer the question at hand.


Setting up "Send As" on Gmail to an outlook account gets "Missed upload deadline" error

Question: I was trying to set up "Send As" on gmail for my school account and even though I was certainly using the instructions on outlook, and the correct password and username I was getting "Missed upload deadline (9.9 sec)".
After some searching I found a popular answer that I should be pinging "smtp.office365.com" and be using the result. That did not work either. As I found the answer I will be posting it below but please add a better one by all means.
Answer: The solution in my case was to VPN to a location close to where my school was and then ping. It seems that outlook smtp is located close to where your account was opened, not where you are at the moment.
As my school was in Melbourne (while I am in Athens) before the VPN I was getting outlook.ms-acdc.office.com as the result of
ping smtp.office365.com
but when I VPNd to Melbourne I got outlook-au.office365.com which worked.
As I have lost a couple of hours doing that I am posting this here in the hope that it will help someone.
Answer: A app-specific password for your live account should fix the problem. Open:
https://account.live.com/proofs/manage/additional?mkt=en-US&refd=account.microsoft.com&refp=security
Click on "Create a new app password" in the "App passwords"-Section, copy&paste the generated password to Gmail.


JavaFX: Laying out Nodes in a Row

Question: Given following layout:

In some cases Field 2 (and the corresponding Labelabove) are invisible and Field 3 and Field 4 shall be moved left accordingly.
My first attempt was to place the elements in a Pane (as I did as well for the screenshot in this example) and recalculate the exact positions of all elements if one is set invisible. This solution is working but it needs lot of maintenance if the element, their sizes or order changes.
In the course of discussing another problem I got the idea to use a HBox to place the fields in it, which would give me auto-spacing.
But using a HBox does not do the trick, because:

As far as I see in a HBox the labels cannot be set above the elements.
If I set an element invisible the other elements won't move left.

Any ideas how to archive my desired behavior?
Answer: Put each Label with ComboBox/Label into VBox. Then add/remove them from HBox depending on your requirements. Another solution is to put everything into GridPane and add/remove columns.
Comment: If you prefer to use `setVisible()` instead of adding and removing the `VBox`, just bind the `VBox`'s `managedProperty()` to its `visibleProperty()`.
Answer: Making a Node invisible does not remove it from the layout. Removing a node from a parent layout is done by

removing a Node from the child list of the parent or
setting the managed property of the node to false.

Example showing/hiding a node using the managed property:
public static void toggleVisibility(Node node) {
    boolean newValue = !node.isVisible();
    node.setVisible(newValue);

    // invisible nodes should not be taken into account for HBox layout
    node.setManaged(newValue);
}

@Override
public void start(Stage primaryStage) {
    Rectangle rect1 = new Rectangle(100, 100, Color.RED.deriveColor(0, 1, 1, 0.5));
    Rectangle rect2 = new Rectangle(100, 100, Color.GREEN.deriveColor(0, 1, 1, 0.5));
    Rectangle rect3 = new Rectangle(100, 100, Color.BLUE.deriveColor(0, 1, 1, 0.5));
    HBox hbox = new HBox(rect1, rect2, rect3);

    Scene scene = new Scene(hbox);
    scene.setOnMouseClicked(evt -> {
        toggleVisibility(rect2);
    });

    primaryStage.setScene(scene);
    primaryStage.show();
}

JavaFX: Laying out Nodes in a Row


Why people lean right/left when turning left/right

Question: My dad was driving in a highway, when we leave the highway there is a banked road. When car turning right, my body is leaning to the left. I thought my body will lean to the center due to centripetal force. Why??
Answer: There is centripetal force on the free upper part of your body, only to the extent it is attached to the lower part of your body, which is attached to the seat by friction and by the lap part of your seat belt.  On the free upper part, there is centrifugal force which is caused by the inertia of the free upper part of your body tending to continue in a straight line as the car makes a turn to the right.  Thus, the upper part of your body tends to lean left as the car turns right.
If it weren't for the friction of the car seat and the lap part of the seat belt, your entire body would tend to slide left as the car turns right.  But your tether to the car causes you to seek the center of the arc being made by the car as it turns.  Likewise, the friction of the car's tires on the road allow it to seek the center of the arc it makes, and to avoid flying off the road.  Friction provides centripetal force, which overcomes the centrifugal force acting on the car and on you.
I'm assuming there is enough play in the upper part of the seat belt to allow you to lean somewhat toward the left.  If there were a sudden acceleration to the right, the seat belt probably would clinch and prevent you from leaning left.
Centrifugal force is sometimes called a fictitious force, as it exists only in a rotating (accelerating in the sense of change of direction) reference frame.  In an inertial reference frame free from acceleration, such as the world outside the car, centrifugal force doesn't exist.
Answer: Inertia.
Your body, like all mass, tries to stay where it is, according to Newton's first law. If the car turns right, your body tries to stay where it was, which is on the left.
Same reason when the car accelerates forwards, you are pushed back into your seat.
Answer: The source of the centripetal force that forces you to go around the turn is the friction between your seat and your thighs. Your upper body doesn't feel a force and so continues in the same direction. Your lower half is pulled out from under you by seat friction to the right, leaving you leaning to the left.


Acknowledge vs Noted

Question: I have a friend who is using "acknowledge" when someone asks him to confirm something. Usually I observe people using "Okay, noted." but I never see anyone using "Acknowledge". Therefore I want to check that it is okay to use "Acknowledge" instead of "Okay, noted." in response to an email?
Comment: (Just for fun) If your friend is a network admin/developer, saying _acknowledge_ in such a situation is not unusual!! :)

"In data networking, an **acknowledgement** (or acknowledgment) is a signal passed between communicating processes or computers to signify acknowledgement, or **receipt of response**, as part of a communications protocol". (Wikipedia)
Comment: @Eilia: I am aware of that, but I guess he is misusing this word, because somehow it looks not appropriate word when someone ask you to do an activity and then you say acknowledge! I prefer to get your idea because my mother language is not English.
Comment: @Eilia though in that case I would almost be less surprised to see simply "ACK" (or perhaps "SYN/ACK" if the respondent is feeling whimsical) :-P
Answer: There are two words in the lingo of aviation radio communication, "roger" and "wilco."  The first (named after the name of the letter "R" in the old radio alphabet) stands for "I received your transmission."  "Willco" is short for "I have received your transmission and will comply with your order."  When your friend replies to a message by saying "acknowledged," it sounds like he means "roger."  If that message is a request or a command, the sender is not only interested in hearing that the message has been received, but he also wants to know whether the request will be honored or the command obeyed.  "Roger" and "acknowledged" don't give that assurance.  To avoid confusion in that instance, your friend should find some locution that means wilco.
Comment: I agree. "Acknowledge" means "I have got your message" but it very much doesn't mean "I will do what you asked".
Answer: You could certainly use acknowledged. You need the past tense form.
"Acknowledge" in the present tense will look like a command to the person who receives the email, not as a response.
In general, I find if you only say this, it will sound a bit terse and could be taken as rude.
Generally, I prefer less formal responses like your example or "OK, got it", "Thanks, I'll make a note of that".
Comment: So it is not recommended?
Comment: @rima It's perfectly fine to use; you just have to make sure you use it in its past tense form, "acknowledge**d**".
Answer: Acknowledge

accept or admit the existence or truth of.
recognize the importance or quality of.

Note

notice or pay particular attention to (something).
record (something) in writing.

Source: Oxford Dictionaries
I use acknowledge a lot too :P.
When you acknowledge something, you understand the importance and the truth of the fact being told to you. It goes far beyond just understanding or noting the point. The word note doesn't have such a powerful connotation or impact attached to it. It more or less means mechanically(or mentally) jotting down what is told to you regardless of what its importance is.
Moreover, the word acknowledgement is more formal. "Okay, noted" is something you would use in colloquial English.
If the mail you're writing is a formal one, related to business or school or anything like that, you can say "I acknowledge the fact that..."
If you're writing to a friend or a relative, you can say "I've noted your point."
For ex: I completely acknowledge that this project is my own creation.
I acknowledge(you can use admit also) that ____ is my own son and that I shall be funding his undergraduate education. (Here, acknowledgement means that you are responsible for the fact you've stated.)
I understood the point that you were trying to get across. I've noted it.
Comment: well, the person using only one single word. I do agree with you if she write a sentence, acknowledge could be more formal. but when you want to reply a mail with a single word, which one is more popular?
Comment: What does she say? "Acknowledged."? Both will work, but "noted" would be better.
Answer: From the M-W, acknowledge means

to say that you accept or do not deny the truth or existence of (something)
to tell or show someone that something (such as a letter or message) has been received

E.g. He quickly acknowledges all of my e-mails when he receives them.
So, it's correct to say acknowledged when someone asking to confirm something, however it looks unusual.
Comment: No, acknowledging an email merely means confirming its arrival.  If you're asked to confirm something *in* the email, e.g., an appointment, acknowledging that you got the request to confirm the appointment does not confirm the appointment itself.
Answer: Acknowledgement is recognition of the fact(s) or points as stated. Unless a very legal issue, it should suffice as to be acted upon. Per the military reference, Wilco, is quite specific that the recipient of the communication 'will-comply' with the directive. In business an 'acknowledgment' should be a 'will-comply' and should simply be confirmed as such between the parties; however, if necessary for legal reasons then 'acknowledgement' only could be simply 'yes, I agree' but not necessarily that they shall act accordingly.

Acknowledge vs Noted


Open menu for special symbols (accents etc) by "hold and slide" in android keyboard

Question: I'm developing a soft keyboard for Android (respectively I'm trying ;)) and since I'm new to Android and Java it's not that easy.
The basic keyboard is working (thanks to examples in the web) and now I'm trying to create a sort of "popup" (with new buttons) which is evoked when you press and hold a button for a certain time (time should be open for customization). Then one should be able to drag the finger to the new buttons. For example: You hold e and then drag the finger to é etc.
My first attempt was to use something like:
<Key android:codes="101" android:keyLabel="e"
 android:popupKeyboard="@layout/popup"
 android:popupCharacters="eéè€"
/>

where popup.xml contains a seperate basic keyboard structure:
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
    android:keyWidth="10%p"
    android:horizontalGap="0px"
    android:verticalGap="0px"
    android:keyHeight="30px" />

But there are several disadvantages:

I don't know how to tweak the position and appearance of the popup
the finger has to be lifted in order to press a new button (weird behaviour)
the time the user has to wait until the popup appears seems to be fixed

How would you solve this problem? An invisible key-row (absolute position) which is set to visible once a button is touched for a certain time (monitored with motion events etc.) ?
Do you know any tutorials which give information on this "press-hold-drag-button"-concept in keyboards? A code example would be very helpful. I looked through the LatinIME git project but unfortunately it's very overwhelming :/
Answer: This is a very, very old question, but this may help someone else like me. I am browsing the Android source code to see how to make the alt-key popup:
 http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.0.1_r1/android/inputmethodservice/KeyboardView.java#KeyboardView.onLongPress%28android.inputmethodservice.Keyboard.Key%29


/tellraw with teleporting

Question: Is there a way to use the "selector" command with tellraw so that it displays a players name in chat and THEN teleports that player to a location? I know how to do each separately but I don't know how to do both using the previously selected player who was chosen to be teleported. Please help.
Comment: It is in the chat or a command block?
Comment: Why would you not want to do it separately? If you want both to be instantly after each other, just use a redstone stream.
Answer: To clarify Daniel's answer, you can assign a tag to a player when they click on a command in the chat using the following command in a tellraw command:
<code>/scoreboard players tag @p add command_clicked
</code>
Then, in a repeating command block chain, you can execute the following 3 commands in order:
<code>/say @a[tag=command_clicked]
/tp @a[tag=command_clicked] <destination>
/scoreboard players tag @a remove command_clicked
</code>
Answer: One way to selector is like the example below:
<code>/tellraw @a [{"selector":"@p","color":"dark_red"},{"text":" is now teleporting!","color":"red"}]
</code>
Then another one you could add if you want make execute <code>/execute</code> when they click:
<code>/execute @a[tag=command_clicked] ~ ~ ~ /tellraw {command}
</code>
And another one doing:
<code>/execute @a[tag=command_clicked] ~ ~ ~ /tp {command}
</code>
That might work, so like make tp a little bit more seconds tick like a redstone clock or maybe always active repeating and to make command blocks silent:
<code>/gamerule commandBlockOutput false
</code>
It helps to make it silent to easily do a bunch; Deathrun is an example. You click something and teleport; that's one example.

/tellraw with teleporting


Use UniqueIdentifier column type and [DatabaseGenerated(DatabaseGeneratedOption.Identity)] for model's key doesn't work in EF Code First

Question: This is my MVC model:
public class Link
{
    [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    public Guid ID { get; set; }

    [DisplayName("Shorted URL")]
    public string SURL { get; set; }

    [DisplayName("General Link")]
    public string OriginalURL { get; set; }

    [DisplayName("Click Count")]
    public int ClickCount { get; set; }
}

and this is LinkDBContext class:
public class LinkDBContext : DbContext
{
    public DbSet<Link> Links { get; set; }
}

when I want to add some data to database using this code:
    private string GetNewID(string url, string id)
    {
        LinkDBContext Links = new LinkDBContext();
        //id = "http://" + id;
        List<Link> link = Links.Links.Where(a => (a.OriginalURL == id && a.SURL == id)).ToList();
        if (link.Count == 0)
        {
            List<Link> LLinks = Links.Links.ToList<Link>();
            Link li = new Link();
            //li.ID = new Guid();
            li.ClickCount = 0;
            li.SURL = id;
            li.OriginalURL = url;
            Links.Links.Add(li);
            Links.SaveChanges();
            Links.Dispose();
            return id.ToString();
        }

        return GetNewID(url);
    }

I just get an exception that is: Cannot insert the value NULL into column 'ID', table 'GhiasiDB.dbo.Links'; column does not allow nulls. INSERT fails.The statement has been terminated.
what is the problem and how can I resolve it?

update
I changed the type of ID from Guid to int and when I tried again I got this exception from List<Link> LLinks = Links.Links.ToList<Link>(); of GetNewID method:The 'ID' property on 'Link' could not be set to a 'Guid' value. You must set this property to a non-null value of type 'Int32'.
and I don't know where did it come from. I changed all Guides to int!
Answer: If you allowed EF to generate the tables it would create the PK with a default value set to (newid()). You can set it manually if you designed the database first.
Comment: ID column is uniqeidentifire and it's PK but I still get exception!
Comment: @ahmadalishafiee Did you set the `Default Value or Binding` property of the `ID` column in your table to `(newid())`?
Answer: If the table already existed before adding [DatabaseGenerated(DatabaseGeneratedOption.Identity)], then remove the DbSet, run Update-Database, add the DbSet again, finally run another Update-Database.
At least that's what fixed it for me.
Comment: this is exactly the issue! THANKS!
Answer: I think that's because Guid and Identity are not compatible. How do you think to auto-increment Guid?
Maybe changing Id to int could help you
Answer: Guid is structure type i.e value type. You can not assign null to value type. If you want this than in that case you can use "?" after type in declaration.
  public Guid? ID { get; set; }

if this still does not help, try an int


About Central limit theorem

Question: We prove Central limit theorem with characteristic function. If we know the $X_i$ are independent but not identically distributed, is there any weaker condition which still yields the convergence to normal distribution?
Answer: For example, suppose $X_i$ are independent with $\mathbb E(X_i) = 0$, $\text{Var}(X_i) = \sigma_i^2$, and $$\lim_{n \to \infty} \frac{1}{\sigma(n)^3} \sum_{i=1}^n \mathbb E[|X_i|^3] = 0$$
where $$\sigma(n)^2 = \text{Var}\left(\sum_{i=1}^n X_i\right) = \sum_{i=1}^n \sigma_i^2$$  Then $\displaystyle \frac{1}{\sigma(n)} \sum_{i=1}^n X_i$ converges in distribution to a standard normal random variable.
Answer: Following Robert Israel's notation elsewhere in this thread, we set $0 = \mathbb{E}(X_i) = 0$, $\sigma_i^2 = \text{Var}(X_i)$, and $\sigma(n)^2 = \sum_{i=1}^n \sigma_i^2$.
Lindberg's Condition: For every $\epsilon > 0$,
$\lim_{n\to\infty} \frac{1}{\sigma(n)^2} \sum_{i=1}^n \mathbb{E}\left(X_i^2 1_{\{ |X_i| \ge \epsilon \sigma(n)\}}\right) \to 0$.
Lyapunov's condition: There exists $\delta > 0$ such that $\lim_{n\to \infty}\frac{1}{\sigma(n)^{2 + \delta}} \sum_{i=1}^n \mathbb{E} \left( |X_i|^{2 + \delta}\right) \to 0$.
The Lyapunov condition implies the Lindberg condition, and the Lindberg condition implies the conclusion of the central limit theorem, ie. that $\frac{\sum_{i=1}^n X_i}{\sigma(n)} \Rightarrow N(0,1)$, where $N(0,1)$ is the standard normal. (Robert Israel's answer presents the Lyapunov condition with $\delta = 1$).

About Central limit theorem


Can't uses keyboard in setup

Question: I'm trying to setup a LG LS665 and I can't put my internet password in or anything that requires text entry. I think i might have deleted the default lg keyboard. Anything i can do to fix it? Is it possible to install an apk from my pc without any interaction from my phone?
Answer: If you already have a Google account set up, and the device connected to the Internet, you can simply visit the Google Play Store using a browser on your PC, log in, find a keyboard app, and click the button to install it on your device (it will then be pushed).
As I somehow doubt that the requirements for that are met (or you wouldn't ask about setup), a second variant would be to download the .apk file of a keyboard app and use e.g. adb install to get it installed. Problem: for this you need to have usb-debugging enabled on the device. Not sure if you can achieve that.
Last resort would be to "flash" a keyboard app via a special update.zip in recovery. But that would require a custom recovery, and the update.zip must be created (there are posts on that here on this site as well). Some custom recoveries also offer ADB access (e.g. twrp has that built-in), so you could try the adb install approach with them. However, I cannot tell if there is any (or which) custom recovery available for your device.
Very last resort: flash the entire firmware again – the keyboard app should be part of it.

Can't uses keyboard in setup


Is there a way to fix the Invalid Session error?

Question: I've been watching videos on youtube of "how to fix minecraft error invalid session" but none of them can help me cause  I don't have them. Could anyone please help me fix this in an easy way? Or is there no way?
Comment: Can you tell us what problems you are having?
Answer: When you open the launcher, it connects to the login servers and generates a session ID in exchange for your user login details. Then, whenever you connect to a game server, the login server matches the last session ID it got when you logged in to your game's session ID. However, these session IDs are only for one use (hence "session"), so they expire after a certain amount of time.
To get a new session ID, simply close all instances of the game and the launcher, then start the launcher again.
I know restarting the launcher works, I have to do it occasionally. However the session ID explanation may be somewhat incorrect or out of date. Feel free to correct.
Answer: Invalid session can occur, when:

Your game from launcher is started too fast - before launcher could contact servers and get session ID from them. It is usually fast, but not instant. Usually you can see the button "Play offline", however that might not correspond sometimes (for example if you close the game and restart it too fast that the button don't have time to show properly)
You launched another launcher/same launcher second times and your original session got rewritten. OR somebody else uses your credentials and does that. If you suspect this, you should take actions to secure your account. Remember, that you are not allowed to trade nor give your credentials to anyone. If you launch game more times, only the latest will have the right Session ID.
You use some unofficial launcher, then you should use the official ones.
MC servers borked up... (you can check status of servers for example here)

Session ID is assigned when you launch the game, thus in most cases, restarting the game completely (for sure even with launcher) fixes the issue.