Could someone explain what is a potential?

Question: In many part of physics, me talk about potential (electrical potential, gravitation potential, elastic potential...). All those definition looks very different, and I would like to know how all those quantity are related. The mathematical definition of a potential is : $F$ is a potential if $F=\nabla f$ for some scalar field $f$. But I don't understand how I can relate this to all potential that exist in physic. Also, many people relate potential and energy, what doe it mean exactly? Because if a potential $U$ is something that can be written as a gradient, every integrable function (at least in $\mathbb R$) could be a gradient. So what the thing with these potential?
Comment: You got it the wrong way around. The potential in your equation is $f$, the scalar field. Capital $F$ is the related vector field (=typically the force).
Comment: Where did you get that definition of a potential? Most potentials are not vectors, but your definition gives a vector the the quantity F?  Maybe F is a field, and $f$ is the potential? Double check your source. (Magnetic fields have vector potentials.)
Comment: I try to make link between potentential and function that derive from a potential, but doesn't look the right way to make a link... @BillN
Comment: @Bill_N in steady state we also have magnetic *scalar* potential, a very useful concept
Comment: see  https://physics.stackexchange.com/q/397736/45664
Answer: I think the most general definition of a potential is some quantity which, when differentiated in a certain way, yields some other quantity which we're interested in.
Other answers have already given examples of potentials which, when differentiated with respect to position, yield a force (i.e. $\vec F = -\nabla U$, where the minus sign is just conventional).  Such objects are called potential energies, and are special because they contribute to the total energy of a system.
Other examples of potentials are the scalar and vector potentials $\phi$ and $\vec A$ from electromagnetism.  In electrostatics, we define $\phi$ such that $\vec E =-\nabla \phi$, and in electrodynamics we define $\vec B = \nabla \times \vec A$.  Again, we see that we obtain physical quantities (in this case $\vec E$ and $\vec B$) by differentiating the potentials ($\phi$ and $\vec A$).  Note that these potentials don't automatically correspond to energies - as it turns out $\phi$ can be interpreted as the electrostatic potential energy per unit charge (in electrostatics, at least), but the same is not true for $\vec A$.
We can also consider the thermodynamic potentials, which include the internal energy $U$, the Helmholtz potential $F$, the enthalpy $H$, and the Gibbs potential $G$.  Each of these can be interpreted as a kind of energy under certain conditions, but we refer to them as potentials because when we differentiate them with respect to different variables, we get other thermodynamic quantities like pressure, temperature, and volume:
$$ p = -\left(\frac{\partial U}{\partial V}\right)_{S,N} = - \left(\frac{\partial F}{\partial V}\right)_{T,N}$$
$$T = \left(\frac{\partial U}{\partial S}\right)_{V,N} = \left(\frac{\partial H}{\partial S}\right)_{p,N}$$
$$V = \left(\frac{\partial H}{\partial p}\right)_{S,N} = \left(\frac{\partial G}{\partial p}\right)_{T,N}$$
so on and so forth.
As a final example that has nothing to do with energy, consider the velocity potential $\Phi$ which is used when dealing with irrotational fluid flows.  The flow velocity $\vec u$ of the fluid is given by $\vec u = \nabla \Phi$; this can simplify the Navier-Stokes equations, and is analogous to the use of the magnetic scalar potential in magnetostatics.

You may be asking yourself why we ever use potentials rather than computing the quantities we're interested in directly; the answer is that often times, the math works out in such a way that the potentials are substantially easier to calculate.  For instance, potential energies are scalars while forces are vectors; the vector potential $\vec A$ obeys a simpler differential equation than $\vec B$ because the equations for the various components can be decoupled from one another; the thermodynamic potentials can be obtained from the partition function and various straightforward Legendre transformations.
Comment: Re. "a potential is some quantity which, when differentiated in a certain way, yields some other quantity which we're interested in." is 'quantity' too general? should it be 'field' instead?
Comment: also, is the term 'potential' always related to potential energy--or is it more general, re. your first sentence?
Comment: No to both questions.  Note that the thermodynamic potentials are functions of thermodynamic variables, not positions in physical space, and so they are not fields.  Though the vector potential (and magnetic scalar potential from magnetostatics) have no natural interpretation in terms of energy, I've added another example (the velocity potential from fluid dynamics) which is even further removed from the idea of potential energy.
Comment: I wouldn't say the minus sign is merely convention, it can make intuitive sense like a ball rolling down the hill. The minus sign conveys that an object tends to move so as to minimize it's potential.
Comment: @Triatticus The tendency to minimize the potential energy follows from the minus sign in our definition of potential energy.  One could throw this convention to the wind and define the potential energy to satisfy $\vec F = \nabla U$, which would lead to the total energy formula $E = T - U$ and a system which tends to maximize it's potential energy.  The minus sign is a very reasonable convention, but it's a convention.  Contrast that with the minus sign in Faraday's law, which would lead to genuinely different physics if dropped.
Answer: The most general definition of potential energy that exists is the following: potential energy is the energy associated with a particular configuration of objects. Electric potential energy is associated with a configuration of charges, gravitational potential energy is associated with a configuration of masses, and elastic potential is associated with a certain mass-spring configuration.
One extracts potential energy from a configuration by changing the positions (or other relevant attributes) of the objects in that configuration. For example, you can extract electric potential energy from a configuration of charges by moving repelling charges further away and moving attracting charges together. You can extract gravitational potential energy from a configuration of masses by moving the masses closer together. Similarly, you can extract elastic potential energy from a mass-spring configuration by moving the mass toward its equilibrium position. If you want to add potential energy to any of these configurations, then you simply do the opposite of the above.
To answer your final question, any differentiable function can, in principle, represent potential energy as a function of configuration. Whether that function describes a physical system that we've observed is a different story.
A potential in the sense of "gravitational potential" or "electric potential" is simply a scaled version of the potential energy. It's a function that describes the potential energy of a system as a function of configuration, divided by some quantity relating to one or more of the objects (for example, the gravitational potential is the gravitational potential energy divided by the mass of one of the objects, and the electric potential is the electric potential energy divided by the charge of one of the objects). It's simply a more convenient way of describing the potential energy of a system when you are constrained to vary (usually) only one of the objects' parameters. As such, it's still just a scaled form of the energy associated with a configuration, so the above reasoning still applies.
Comment: As I read the question, it's asking about potentials, not potential energy.
Comment: @ThePhoton A potential is just a scaled potential energy. All of the same reasoning applies.
Comment: @probably_someone i don't think that is true. do you have a source for that? or explanation?
Comment: @user45664 The edit should address this.
Comment: Much like the specific heat coefficient is the energy change per degree change *per unit mass*, as opposed the heat coefficient of an object which is energy change per degree change. One could say the potential is the *specific* potential energy. But that ignores the important point you make about configuration!
Comment: @probably_someone  so then the term "potential" is always tied to potential energy?  i thought it was more general--like a field that another field can be derived from, commonly by differentiation.
Answer: A scalar potential whose gradient is the force exists in many branches of physics, for example heat conduction, static magnetism, static electricity, etc. In all these cases the gradient (or negative gradient) of the potential field is the force that can "move" things from here to there.
For example, in static magnetism as described by Ampere's law (steady state case) $\textrm{curl}\textbf{H}=\textbf{J}$ in regions where the current is zero we also have $\textrm{curl}\textbf{H}=0$ hence a scalar $\psi$ such that at least in all singly connected domain we also have $\textbf{H}=\textrm{grad}\psi$. Note the restriction to singly connected domain, it would not be true for a domain containing a toroidal magnet but would still be true locally and when calculated locally the force field is gradient and this force can move things.
Another example is steady state temperature distribution calculated from Fourier's law. We have heat (internal energy and entropy) flow as being proportional to the spatial gradient of temperature. What moves is heat (internal energy + entropy) and the driving force behind that motion is the temperature variation between neighboring points.
Answer: Potential energy $U$ can be thought of as "stored".

Lift an object, and gravitational potential energy is stored (and released when it falls).
Put an electric charge next to another charge, and electric potential energy is stored (and released as the charge moves away/closer due to the repulsion/attraction).
Compress a spring, and elastic potential energy is stored (and released as it bounces back to original length).
Similar for magnetic, chemical and other potential energies.

In all cases we have a "thing" that wants to move. Be it a mass, an electric charge, a spring. When something moves, it can do work. So this "stored" potential energy has a potential to do work. That is usually the classic definition.
Potential energy tells us "how strongly" something wants to move. But note that it is not enough with a high potential energy; you also need a point with a lower potential energy. Otherwise the "thing" wouldn't want to move anyways. A book has no use of moving sideways on the shelf since all points on the shelf give the same potential energy - but it wants to fall because at the floor there is less potential energy. The system wants to release its potential energy. So only a potential energy difference is important.
This description counts for all sorts of potential energies.
What is a potential then? The same as potential energy, just per-quantity. Meaning, per mass, per charge, etc. An electric potential is electric potential energy per coulomb, a gravitational potential is *gravitational potential energy per kilogram** etc. (It doesn't make sense to say elastic potential energy per "quantity" - what would that quantity be? Elongation? This is not easily defined and I have never seen the term elastic potential used.)
Lastly, the equation you mention is indeed true. Force $F$ an potential energy $U$ is defined as:
$$F=\frac{dU}{dx}$$
And similarly, force per quantity would equal the differential potential. This formula simply says mathematically what we have described above: That the "thing" wants to move (it feels a force) towards the point of lower potential energy. If there are two point with different potential energies associated with them, then the "thing" feels a force towards the point of lower $U$.
Answer: Gradient fields have the convenient property of path invariance.  Any line integral taken within that field from point A to point B will have the same value, no matter how strange of a path you might take.
Quite often our laws of physics are well described via integration.  For example, in the case of studying planetary motion, we want to integrate a path of an object through a gravitational field.  This can be quite mathematically taxing.  Worse, you might not know exactly the path one takes through the field.
If your field happens to be a gradient field (as fields like gravitational fields are), then they are path invariant.  The energy I gain or lose going from point A to point B does not depend on the path I took, just the endpoints.  This means I can substitute a much easier to calculate path and arrive at the correct result.
When you have such a system, you have a potential.  If you pick a reference point (such as a global minimum or a global maximum), you can assign that a value of 0.  In mathematical terms, this just means adjusting the "C" that comes out of the integration to achieve the desired value.  Now you can determine the value of any other point in this space with respect to this zero.  This is your "potential."  This is how much energy you could gain if you moved from your current position to the reference.
In many cases, the interesting questions can be answered this way.  In fact, so many interesting questions can be answered this way that we tend to teach energy potentials first, and only fill in the mathematics of path invariance and gradients later.


Why does magnesium hydroxide solution solidify after passage of time?

Question: I have been trying to make a suspension of magnesium hydroxide in water. Around 40% magnesium hydroxide w/w. Initially it is fluid, but as time passes, it solidifies. What is causing this?
Comment: Gravity, time and cohesion. It is common process for all suspensions and happens in large spatial and time scale in nature.
Comment: Is your container open to the air?
Comment: @Poutnik, I can imagine it settling down, which I have seen in many suspensions, but never it creating a massive solid mass with no separate water layer
Comment: @Loong: yes. When I put it in a bottle, it still solidfies, but takes longer. Will a hydroxide get oxidised? What would be the oxidative product? Is this some sort of cross-linkage? I'd be grateful if you (or anyone) can point me to a book/reference explaining this.
Comment: @Maurice, thanks! That sounds logical. Will test the solidified mass for carbonate anion and see…
Comment: You could simply have lost enough water from evaporation to exceed the saturation index - note that $\ce{Mg(OH)_2}$ is sparingly soluble in water to begin with...
Answer: The solidification of a $40$ % suspension of $\ce{Mg(OH)2}$ in water is probably due to the action of $\ce{CO2}$ from the air, which reacts with $\ce{Mg(OH)2}$ producing $\ce{MgCO3}$ which is insoluble in water. Remember that $58~ g$ $\ce{Mg(OH)2}$ produces $84~ g$ $\ce{MgCO3}$ and $174~ g$ lansfordite $\ce{MgCO3⋅5H2O}$, as described in the Handbook of Chemistry and Physics. This is enough to absorb all the water from your suspension. Remember also that $\ce{Mg(OH)2}$ is practically insoluble in water : $0.9~ mg/L$.
Ref.: 1. Charles D. Hodgman, et al., Handbook of Chemistry and Physics, The Chemical Rubber Publishing Co. Cleveland, $1961$, p. $523$ and $600$.

Wikipedia. Lansfordite is a hydrated magnesium carbonate mineral with composition: $\ce{MgCO3·5H2O}$. Landsfordite was discovered in $1888$ in a coal mine in Lansford, Pennsylvania. It crystallizes in the monoclinic system (space group P21/c) and typically occurs as colorless to white prismatic crystals and stalactitic masses. It is a soft mineral, Mohs hardness of $2.5$, with a low specific gravity of $1.7$
Answer: Milk of magnesia (~8% Mg(OH)2 + additives) can be shaken to make a homogeneous dispersion that settles slowly - even without additives - over a period of hours. As the Mg(OH)2 settles and becomes more concentrated, it settles more slowly until after many hours or days, the dispersion settles to a somewhat stiff paste which can be tilted without flowing, but not strong enough to be called solid. A more concentrated dispersion made by stirring powder into water will settle in the same way, most probably into a thick paste with some supernatant water. More concentrated suspensions (or slurries), with additives, are available commercially up to 60% Ref 1). Just a little more than 60% Mg(OH)2 might not even be possible to be stirred into a homogeneous fluid.
Magnesium hydroxide has a layered crystal structure (like clays)

(green is Mg, red-gray is OH) in which hydroxyl groups are available for hydrogen bonding to water.
A more complete description of the experimental conditions would be helpful. For instance, how strong is the solid that forms? How much clear liquid appears above the solid phase (so that the actual concentration of Mg(OH)2 in the solid phase can be estimated)? While the formation of an apparent solid could be due to atmospheric CO2, this path seems unlikely in the closed bottle. Forty grams of Mg(OH)2 plus sixty grams of H2O would require thirty grams (15.3 L) to completely convert the Mg(OH)2 into Lansfordite (or maybe this happens only on the surface - but the closed bottle still poses a problem - where does the CO2 come from?).
Intense homogenization separates many layers, but they eventually come together again by gravitational settling, perhaps even reforming crystals. Magnesium hydroxide is prepared from seawater by precipitation with NaOH, over a period of settling for many hours; some new crystallization can be observed by x-ray diffraction (Ref 2).
I think the problem will go away if you restir the solid, breaking down any crystallization that might have helped stiffen the suspension. Or shake the (closed) bottle vigorously. These things happen.
Ref 1. https://www.thioguard.com/treatmentPlants_slurry.php
Ref 2. Marian Turek and Witold Gnot, Ind. Eng. Chem.Res. 1995, 34, 244-250


Aerobe or facultative anaerobe organism that metabolizes acetate?

Question: I'm assuming bacteria, but will take any suggestions.  Organism must survive primarily on the acetate (plus trace elements), but I can give/take electrons, if necessary.  Not interested in strict anaerobes.  I've tried Shewanella oneidensis, but have not succeeded in getting it to eat any acetate (just lactate).  Feel free to give journal refs.  Self-promotion won't be frowned upon if it's helpful.  :-)  Opportunity for joint pub, if successful.
Answer: You could try Paracoccus denitrificans.
Here is a study where acetate is used as the growth-limiting substrate: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.320.1692&rep=rep1&type=pdf
Here's the details of its version of acetate kinase: http://www.uniprot.org/uniprot/A1B9S8
I'd be happy to collaborate with you further on this.
Comment: This study: http://www.ncbi.nlm.nih.gov/pmc/articles/PMC182557/?page=1 has P. denitrificans at 1% v/v sodium acetate. I don't know how much higher it can go though.
Comment: Thanks for the info.  In this paper, the acetate is only 0.34% (v/v).  Do you know if P. denitrificans can handle higher concentration, say 1% to 3%?  (Many organisms are killed by acetate, hence pickling to preserve food.)  Or is 0.3% its limit?


How to read file contents in QML

Question: My app require reading contents from a file. Can you do it using QML alone? Or should I use C++ for it ?
Answer: I suppose the answer is no. QML doesn't provide any API to access local files. You can use it in combination with either javascript to or c++ in Qt. I suppose it depends on what you're trying to open and interpret because QML also will have limited support for parsing the data you read in.
A plain text file being read through javascript
File i/o in c++
Answer: You can read local text files using XMLHttpRequest in QML.  However, this lacks all of the features of XMLHttpRequest2 and some of the of version 1, which makes it impossible, as far as I can tell, to read in binary files.
To get around this, I wrote a C++ plugin for QML for reading files.  It still can't work with binary files directly, but it gives an option of reading them in base64 encoding.  I've released this code into the public domain, so do with it what you will.
Answer: There is built-in file I/O available for QML with the V-Play SDK FileUtils. It works cross-platform on desktop, iOS and Android.
It looks like this:
var documentsData = fileUtils.readFile("subfolder/file.json")

How to read file contents in QML


How to transfer money from one character to another character?

Question: I've got money in one online character account and I want to transfer that money to my other character. Is that possible?
Answer: No, not directly.
As always, there is a "workaround". You can challenge a friend to a match (arm wrestling preferred because it doesn't take long), bet 10k and let him win. So he gets the money from you. After that, you log onto the other character and do the same again, he bets 10k and lets you win.
Of course, it takes a while, but it's the only known way to me how you can transfer money.


Subordinate Clauses In OSV

Question: So, I'm working on my very first conlang, which happens to be OSV (object-subject-verb word order). But I seem to have run into something of a roadblock. How could I handle clauses such as, for example, 'the bird sings when the sun rises'? I'm considering adding some kind of marker or even creating some sort of word hierarchy, but I don't want to wind up with anything excessively complicated. Again, we're dealing with OSV here. Any advice for a struggling amateur here?
Comment: Note: "the bird [S] sings [V] when the sun [S] rises [V]" is already in OSV order!
In general, clauses like "when the sun rises" are called adverbial clauses, and their position is not fixed by the OSV type - you could put them at any position in the sentence. As for marking, note that there is also already a marker "when" present!
Answer: Adjuncts (which is "when the sun rises" here) can usually be placed anywhere in a sentence. Using another example with an object, the following are possible:

When the sun rises, a song the bird sings
A song when the sun rises the bird sings
A song the bird when the sun rises sings
A song the bird sings when the sun rises

They all sound a bit weird because English is not OSV, but are probably valid in a poetic context... Toki pona always puts temporal adjuncts at the front of a sentence. If you allow free variation, it's probably a good idea to impose a relative order (place before temporal before manner or similar), which is common in natural languages. But otherwise you have free reign -- it's your language!

Subordinate Clauses In OSV


How do I get my NPC back into the correct world?

Question: I joined my brother's world because we were trading, and while I was there, my Arms Dealer NPC spawned into his world. How can I get him back into my world?
Comment: Yes, but you did. So by being in his world, his world qualifys. The same rule applys to other NPCs that rely on player inventory, such as the Merchant.
Comment: NOTE- my brother do NOT have any type of gun. He just started the world.
Answer: NPCs are not generated based on character, they're generated based on world. It's not "your" Arms Dealer, it's the Arms Dealer for your brother's world, no matter who caused the conditions to be fulfilled. You can spawn an Arms Dealer (and any other NPC) in as many worlds as you want, as long as the world has sufficient housing and all conditions for the NPC spawning are fulfilled.
Comment: To amend,** NPCs are generated based off conditions met by both the world and the players**. But they are linked to that world, not to any particular player, regardless of who unlocked them.
Answer: Spawning NPCs into your world
Once the NPC conditions are met in a world, and there is a valid house for the NPC, the NPC will spawn in that world. To have the same NPC in another world, you need to ensure the conditions are met in that world, too.
Spawning the Arms Dealer
The Arms Dealer spawns, at random, when you have either a gun or bullets in your inventory. Having them in storage does not count, and some items do not qualify, so check the links for a list.
According to the Terraria Wikia,

The Arms Dealer may now spawn after defeating 50 Hellbats even if you do not have a gun in your inventory

Housing the Arms Dealer
Past that, you will want to ensure you have valid housing, for the Arms Dealer to move into. If all of this has been met, all you have to do is wait. Jump into your world, and play around for a bit, until you get the notification that "The Arms Dealer has arrived".
Still not working?
Here are some things to try, if it feels like you have waited for ages, and the Arms Dealer still hasn't shown up.

Ensure a different NPC has not moved into the house. Go into the housing menu, and select "show flags". An NPC flag will appear inside each house, displaying the NPC that lives there. If your house does not display a flag, it is free.
Ensure the house has met the basic housing requirements. Move inside, and select "test housing" from the housing menu. You will receive a confirmation message that the house is suitable to live in.
Ensure your gun/bullet is in your immediate inventory. It won't count
if they are in a chest, piggy bank, safe, or other storage device.
Ensure the gun you are holding is on this list. According to the Terraria Wikia, magic guns do not qualify.
Ensure the bullets you are holding are on this list. Not all items classified as ammunition count as being a bullet.
Answer: You should be able to spawn the Arms Dealer on your world, also. According to the wiki, the conditions require an empty house and at least one bullet-firing gun in your inventory (not in chests). Defeating 50 hellbats also allows the Arms Dealer to respawn, even without a gun in your inventory.


Organic reduction of alkene

Question: Can Wolff Kishner and Clemmensen Method be used to reduce alkyne or alkene. If so do they produce syn addition or anti addition product. ?
Answer: Zinc plus a proton source is known to reduce propiolates in THF Tet. Letts. 46 5613
Rieke Zinc has been reported to reduce alkynes to *cis-*alkenes Tet. Letts. 32 299
If you add catalytic Ni then Zn will reduce alkynes selectively to cis alkenes or trans alkenes depending on conditions 3 though this probably operates through Ni(O).
Zn/H+ does not reduce unactivated alkenes. Alkenes conjugated with an EWG may be reduced.
W-K reduction relies on the hydrazine adding to a ketone to form a hydrazone in the 1st step. Nothing comparable can occur with an alkene. However hydrazine can reduce alkenes under different conditions by Di-imide reduction review article.

Organic reduction of alkene


Erase back ground or change a shade of color to white in photoshop

Question: I recently painted a card and scanned it into my computer.  I want to be able to use it so I can print out more card with the design I hand created, but the background needs to be white or erased.  Im having trouble changing the beige shade of the card to white or at least do something to only keep the green and pink shades.  Does anyone have any suggestions or help on how to do this.  I am attaching the image below.  Thank you! Any ideas help!
Answer: Here is one approach:

Open your file in Photoshop
From the menu, Select/Color Range and you will see a screen like the one below
Click with the eyedropper on the card which will select most areas but not necessarily all
Holding the Shift key, click the eyedropper on other parts of the card
Make sure the options are set as shown in the image below
Click OK. Now you will have the painted areas selected
Press Ctrl-J to create a new layer with the selection
Turn off the layer below and you should see transparent background with your painting floating over it

You can now copy this new layer into a new document and save it with a new name in case you need to refer back to the scanned original. If you like, you can add a layer below your painting and fill it with white.
Comment: Thank you so much for the help! i have one more question.  Once i get the painted areas selected and press ctrl-j nothing happens.   I also don't know how to turn off the layer separate layers. what should i do?
Comment: Never mind! I was able to figure it out! Thank you so much for everything! I really appreciate it!
Answer: First go to the Channels panel and select the Blue channel by holding Ctrl/Cmd while clicking on the thumbnail in the channel panel:

You should see a marquee appear on the image.
Now on the Layers Panel click the icon at the bottom that looks like a black and white cookie:

That's for Adjustment Layers. Either Curves or Levels will work. I prefer Curves, so hit Curves
On the left side hit the eye dropper with the white liquid in it that looks like an eye dropper with white liquid in it:

Then click on the yellow.
The reason for the mask is to preserve as much of the color in the rest of the image as possible. If you want to preserve even more you could've duplicated the blue channel and then used Levels on that channel to darken it a bit before doing the curves adjustment on the entire image:

Can then move the White Point in a little to get rid of the remaining texture.
Comment: Thank you so much! I have one question.  When I select the blue channel it turns yellow and then I move over to layers.  On layers when I click the black and white cookie and then select curves all of the yellow disappears. What am I doing wrong?
Comment: @WarrenDavis it sounds like you're pressing the wrong button when selecting the blue channel. Don't hit the little eye. Hold down the shift and hit the thumbnail. I updated the answer with a screenshot for you.
Comment: okay thank you! what do you mean by a marquee will appear?  Also still when I click curves it goes back to the original color picture is that a problem?
Comment: @WarrenDavis marquee is the little dotted lines. The color of the image shouldn't change until you click the white dropper and select the yellow portion.
Comment: @WarrenDavis here's a quick tutorial for you, might need a minute to finish processing: https://www.youtube.com/watch?v=H8OyME4V8Pc&feature=youtu.be --- but really you need to play around with Photoshop a bit and learn some basics, don't be afraid of pressing buttons and seeing what happens
Comment: Okay!  Seriously thank you so much!  I finally figured it out!  You were a huge help!  Thank you for sacrificing your time for me, I really appreciate it!
Comment: @WarrenDavis please consider marking either my answer or Acekin's answer as correct then and upvoting one or both as well.


DS-160 Expiration Date

Question:
I have recently started to fill in the DS-160 for my visa application. However, while doing so, I can see an expiration date of 10.31.2022, means the form has
already been expired. Nonetheless, I have opened a new form and the date was the same as before. Can anyone share some insights on why it is happening?
Comment: We cannot see what you see. Please use the "Edit" button below your question, followed by the "Moon and Mountains" button above the text-entry box, to add a screen shot of what you're seeing. Before attaching the screen shot, obscure any personal or identifying information.
Answer: This is the "OMB number" expiration. OMB is an American governmental agency that evaluates government forms' suitability per the Paperwork Reduction Act. The OMB number is stamped on each form the government creates, and is valid for 3 years.
For DS-160, it apparently expired on October 31st, 2022. That means that the State Department needs to submit the current (or new) form for the OMB re-evaluation. They have done so, but the OMB hasn't processed the new form yet.
You can use the current form.

DS-160 Expiration Date


How to configure "Shorten command line" method for whole project in IntelliJ

Question: When I run tests I get the error "Command line is too long".
 It works if I set the "Shorten command line" method in the Run/Debug configuration to "JAR manifest" for the specific method or class, but how do I set it for the whole project or is there an IDE global setting for it?
Answer: Inside your  .idea folder, change workspace.xml file
Add
<property name="dynamic.classpath" value="true" />

to
  <component name="PropertiesComponent">
.
.
.
  </component>

Example
 <component name="PropertiesComponent">
    <property name="project.structure.last.edited" value="Project" />
    <property name="project.structure.proportion" value="0.0" />
    <property name="project.structure.side.proportion" value="0.0" />
    <property name="settings.editor.selected.configurable" value="preferences.pluginManager" />
    <property name="dynamic.classpath" value="true" />
  </component>

If you don't see one, feel free to add it yourself
 <component name="PropertiesComponent">
    <property name="dynamic.classpath" value="true" />
  </component>

Community edit: this solution does not seem to work in newer versions of IDE, the format of PropertiesComponent is different now. If that's your case, then this answer should work
Comment: This method works in the event that your version of intellij doesn't have the GUI method of setting this.  I'd like to point out, it may be the .idea/workspace.xml file OR .iws file.  If you don't have a .idea folder, search for an .iws file in your project.
Comment: This didn't work for me, although obviously working for others so not sure why
Comment: Thanks! It works for me in Android Studio 4.0
Comment: you can do this in .iml file as well if you cant find .iws file or /.idea directory
Answer: Intellij 2018.2.5
Run => Edit Configurations => Choose Node on the left hand side => expand Environment => Shorten Command line options => choose Classpath file or JAR manifest
Comment: This solution has to be set new every time you run a single test you haven't run before
Comment: You can set this on the template for the configuration type you are setting up and it will not need to be set for every new test/configuration.

See the accepted answer for details.
Comment: Yup! This worked like a charm for me for Android tests! Thank you!
Answer: You can set up a default way to shorten the command line and use it as a template for further configurations by changing the default JUnit Run/Debug Configuration template. Then all new Run/Debug configuration you create in project will use the same option.
Here is the related blog post about configurable command line shortener option.
Comment: The setting that worked for me is to select option "classpath file" on the dialog that comes up from clicking the link the error message. This is under the setting "Shorten command line".
Comment: It doesnt work anymore in the new version because the option got deleted. How to do it now?
Comment: select option "classpath file" works and I would suggest to include this option in the answer for newer version of IDE.
Comment: Hey @TymPollack I got that too and fixed it by going to Run -> Edit Configurations. In the Shorten Command Line section, I chose user-local option and it worked. Try it see if it works. I am on AS 4.2
Comment: In IJ version 2021, the "Shorten command line" option is hidden by default. To see it, choose "Modify options" -> check "Shorten command line".
Comment: @MrKumar i get:
'CommandLineWrapper' is ill-suited for launching apps on Java 9+.
If the run configuration uses "classpath file", please change it to "@argfile".
Otherwise, please contact support.
Answer: The latest 2020 build doesn't have the shorten command line option by default we need to add that option from the configuration.
Run > Edit Configurations > Select the corresponding run configuration and click on Modify options for adding the shorten command-line configuration to the UI.

Select the shorten command line option

Now choose jar manifest from the shorten command line option
Comment: I could not found nay solutions because all answer was a old version! This really help me! thanks a lot!
Comment: For the latest versions of IntelliJ, this works
Answer: Thanks to Rajesh Goel in Android Studio:
Run > Edit Configurations...

Select a test (better to select a parent test class) and set a Shorten command line: option to classpath file. Then OK (or Apply, OK).
Comment: Using the JAR manifest option in `shorten command line` worked for me.
Comment: When did an upgrade to Android Studio 4.2 I faced this same issue as @AndrewChelix mentioned "using the JAR manifest option" fixes the problem
Answer: If you use JDK version from 9+, you should select
Run > Edit Configurations... > Select JUnit template.
Then, select @argfile (Java 9+) as in the image below.

If you don't see the Shorten command line, then just clicking on Modify options menu as below, and select the Shorten command line

Please try it. Good luck friends.
Answer: Add <property name="dynamic.classpath" value="true" /> to the .idea/workspace.xml file under the <component name="PropertiesComponent"> tag. That worked for me.
Comment: +1. Setting to classpath file in shorten command line config does not seem to work on my end but this does.
Answer: Follow this steps and select "classpath.file" option from the dropdown list given in shorten command line category.
Comment: This is the better answer by far. No need to manually change config files. Thank you
Answer: In my case, the error was:
Error running 'MasterFileGenerator':
Command line is too long. Shorten command line for StagingFileGenerator or also for Application default configuration.

The solution was to switch to go to "Run/Debug Configurations" and switch from user-local default: none - java [options] className [args] to JAR manifest - java -cp classpath.jar className [args].
Answer: To have it persisted:

Open Intellj
ctrl+shift+n
Type workspace.xml
Find component name="PropertiesComponent" tag
a) in case there are list of properties, add

<property name="dynamic.classpath" value="true" />
b) in case there is keyToString json, add new line in the map:
"dynamic.classpath": "true"
(remember about comma in the upper line)

(optional) If you want to have this config enabled also in another project immediately, restart intellj
Answer: Idea 2022+
Run > Edit Configurations... > Edit configuration templates.. (ibottom left link in modal window) > choose your template > Modify options > Shorten command line


Android NDK error in strings.h, possibly due to error in size_t

Question: I'm having problems with building X11 for Android using the NDK.  I'm using the latest NDK with droid-wrapper.  I've updated droid-wrapper to work with most of the things I'm building, but it really just adds a bunch of compiler options.  I have it print out what options it's using below.  I've gotten pretty far, but I am running into this problem building some of the libraries:
<code> CC     AuDispose.lo
droid-debug(compile): /opt/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc -DHAVE_CONFIG_H -I. -I./include -I/home/rmason/androix/usr/include -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -fno-strict-aliasing -Wbad-function-cast -Wformat=2 -Wold-style-definition -Wdeclaration-after-statement -I/home/rmason/androix/usr/include -MT AuDispose.lo -MD -MP -MF .deps/AuDispose.Tpo -c AuDispose.c -fPIC -DPIC -o .libs/AuDispose.o -I/opt/android-ndk-r7/platforms/android-8/arch-arm/usr/include -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -DANDROID -DSK_RELEASE -DNDEBUG -UDEBUG -march=armv5te -mtune=xscale -msoft-float -mthumb-interwork -fpic -fno-exceptions -ffunction-sections -funwind-tables -fstack-protector -fmessage-length=0
In file included from /opt/android-ndk-r7/platforms/android-8/arch-arm/usr/include/stdlib.h:42,
             from AuDispose.c:34:
/opt/android-ndk-r7/platforms/android-8/arch-arm/usr/include/strings.h:47: error: expected declaration specifiers or '...' before numeric constant
/opt/android-ndk-r7/platforms/android-8/arch-arm/usr/include/strings.h:47: error:     conflicting types for 'memset'
AuDispose.c: In function 'XauDisposeAuth':
AuDispose.c:44: error: too many arguments to function 'memset'
make[1]: *** [AuDispose.lo] Error 1
make[1]: Leaving directory `/home/rmason/androix/lib/libXau'
make: *** [install] Error 2
</code>
I look at strings.h and line 47 is this:
<code>void     bzero(void *, size_t);
</code>
I've seen other people having trouble with this type of line because size_t is the wrong value.  Some have fixed it by replacing size_t with the kernel's definition.  My guess is that the order in which I'm including things is clobbering some definition that I really need.
Here's a little background if people like the whole story:
I'm trying to build Androix using a slightly modified droid-wrapper].  I made a script (in my github repo as androix-buildscript) to build the whole shebang.  It checks everything out and builds everything.  Right now I'm having the following results:

Success: util/macros
Success: proto/xproto
Success: lib/libxtrans
Success: xcb/proto
Success: xcb/pthread-stubs
Failure: lib/libXau # strings.h error
Failure: xcb/libxcb # missing Xau
Success: proto/xextproto
Success: proto/kbproto
Success: proto/inputproto
Failure: lib/libX11 # missing libxcb
Failure: lib/libxkbfile  # missing X11
Failure: app/xkbcomp # ./xkbparse.c... configure: error: cannot check for file existence when cross compiling make: * No rule to make target `install'.  Stop.
Success: xkeyboard-config
Success: mesa/drm
Success: proto/fixesproto
Success: proto/damageproto
Success: proto/xcmiscproto
Success: proto/bigreqsproto
Success: proto/compositeproto
Success: proto/recordproto
Success: proto/scrnsaverproto
Success: proto/resourceproto
Failure: freetype  # still working on figuring out what the best way of building this would be, TODO
Success: lib/libfontenc
Failure: lib/libXfont # missing fontsproto, TODO
Failure: lib/libXdmcp # similar problem to strings.h libXau problem
Failure: pixman # different looking problem with 'Elf32_auxv_t', but may be the same as the strings.h problem with size_t.  They are both DEFINE oriented problems.

Thanks for taking the time to check this out.  I'm really stumped.
Answer: I managed to finish the make by commenting the lines in strings.h that showed error. Also I used  memset in AuDispose.c instead of bzero.


What is the most effective way for a human to generate electricity using just their body?

Question: A human with the ability to control electricity with their mind (electrokinesis I think?) would need electricity to manipulate I'm assuming. So if they were caught off guard without any available electricity or a power source to manipulate, could they generate their own? For example: could they generate static electricity from rubbing their hair on their head or arms? And would it be possible to make enough electricity to use to power things or to use in combat?
Comment: FYI, one should edit the old question instead of deleting and reposting
Comment: It's hugely dependent on how the electrokinesis works. Does it just move electrons about that are already there; can it create from nothing? Or can it use an existing charge and somehow guide the path through which it is resolved?
Comment: Well I haven't decided exactly. I'm just imagining typical electricity powers. But no I would say he would need to have charge already and can't create it using his power and so has to use physical means like in my post
Answer: This is a Frame Challenge
I believe you're looking at this the wrong way. Remember, the goal isn't to be scientifically precise but to achieve suspension of disbelief. After all, we're dealing with a superhero, right? So think of it this way: The human body has no need to generate electricity — the world is swimming in electricity. Literally every atom in the entire universe has electrons in orbit. They come out of that orbit and move around due to electromagnetic forces or energy.
You see, electricity is the movement of electrons, but electrons move in accordance with the rules of electromagnetic energy. For example, if you move a magnetic field past a wire, the motion of that field stimulates the movement of electrons in that wire.
Why is this important?

Because the Earth's magnetosphere, the motion of air, the shift of ground charges, etc., provide a veritable soup of electrons floating around all around all the time. It's why lightning exists.

And if that weren't enough, humanity is generously pumping a breathtaking amount of EM energy into the biosphere.

Your superhero needn't draw a single electron from his/her own body. There's so much electricity in the world that it's a wonder we don't all walk around with our hair sticking up. But as a result, there are some cool side effects that you can take advantage of.

If your superhero is near power lines, the houses and commercial buildings brown- or black-out until he/she's done doing the voodoo they do.

Or if your superhero is near a cell tower, the phones drop out.

Or if your superhero is near combat... or in a mine or similar... radios stop working.

Or if you want to be a bit less dramatic (sometimes less is more!) then when your superhero is strutting majestically down the street (which superheros do, dontchaknow), the neon and LED lights along the street flicker with his/her passing. Cars dim-out and stutter until they've passed. Etc.
I think you can have a lot more fun with this if you don't worry about how the body can generate electricity and worry more about the sources of electricity that are already around you — literally everywhere.
Comment: Sorry for stupid question, but is EM electricity? They are connected, of course - wherever electricity flows, EM field is there, too, but they need to be converted from one to the other, and that's easier said than done...
Comment: @AcePL No, EM is related, but not electricity. But you are correct that when electricity flows, EM occurs. But the opposite is also true, when EM exists, electricity flows. In its simplest form, a *motor* and a *generator* are the same object: wound coils of copper with rotor and stator magnets. If you apply electricity, EM is created and the motor turns. If you twist the shaft, existing EM from the rotor magnets causes electricity to flow. That's the fun of my proposed solution, EM is everywhere, and where it is, there is electricity. (\*continued\*)
Comment: @AcePL So, what is EM energy? It's either magnetism when electricity is involved (e.g., generators and motors) or it's *photons.* Radio transmissions, visible light, the microwaves you use to cook food, that's all EM energy, and where it is, you can leverage it to get electricity.
Comment: That much is obvious, but what I meant was that if we're sticking to OP concept of electrokinesis we need electricity, not EM. One can be converted to the other, but that needs to be explicit. I do agree it's awesome idea, if it will be accepted, but it not exactly answer to the question. Should be, though, it is really great suggestion.
Comment: @AcePL The whole point of a Frame Challenge is to challenge the basic premise of the OP's question - not to stick with it. Frame challenges are an old tradition on this Stack, because sometimes the OP didn't think of an alternative that's worth investigating.
Answer: A dynamo or battery
Think back to anything you've done and uf it generated electric shocks. Likely you've had static discharge during your life, especially socks and carpet. At worst the shock might've put the most minor of burns on a nail or something. It's a nasty shock, but in combat with adrenaline you're unlikely to notice it as nasty at all. It is also not enough to power anything, so it's quite useless. Attacking open electronics is your best bet and even then very unreliable.
To improve electricity generation, get a hand cranked dynamo. I can only find some ok statistics about cycling and generating power, which is 100 watt for an average person cycling normally. Leg muscles are much stronger than arms and the 'circle' movement is much more natual for the legs, so I'm assuming 25 watt for hand cranking.
My research about tasers shows that the modern tasers have about 26 watts of power. Older models about 7 watts. With around 50000 volt and a low ampere you should be able to replicate these results. The dynamo must be able to crank that exact configuration or the electrokinetic should be able to adapt is on the fly. Tasers can definitely be lethal in different configurations.
This does give rise to the question why not batteries. They can hold a ton of potential power. They can give this as electricity gradually or with the right short-circuit you can get this in big bursts.
As your question seems to indicate no such things are available I would say you're out of luck. The best thing I can imagine is to impart some electrical impulses in the opponents nervous system or even high jack it all. You might not have the fine control of electricity to control his or her body, but certainly enough to disrupt them. Not just changing the impulses in the spine and brain for seizure like effects, but imagine changing the impulses at the big knot of nerves at the heart. A heart failure is then easy enough.
Comment: Are you saying you could use the electrokeinesis to control opponents nerves or brain interactions? Would that work?
Comment: An artifact from well before my time: a hand-cranked 3-bar generator to make the ringing voltage for an old-fashioned analog telephone.  (You can find many results on an image search, but they are from online sales so the links probably won't last).  One of these could overwhelm almost anyone's resolve long before the cranker has reached his limit.
Comment: @Mattna 'control' would be difficult. You need to either put your own electricity in the nerves or use the available electricity the moment a nerve fires. You might be able to re-route some and such, but full control is highly unlikely. There's too many neurons packed together with too many connections, firing too rapidly. To control someone at best you can stimulate brain area's, inducing some feelings or movement. If you worked with TENS you can know some direct movement is possible, but very hard to control anything beyond a jerky movement.
Comment: Yeah that would still be helpful. If they were using a gun or bow you could make them twitch and miss their shot. But then again I don't know if you could shock them at a long range.
Answer: Human body generates a lot of electricity... over time. Not in an instant, though.
For electrokinesis I see two options:

without any external source - make it that the person you want to can use it very precisely. Then a tiny electric charge form his body is shot towards the target, incapacitating it. Overload optical nerves, for example, to cause momentary blindness, or paralyze for a moment attacking Cerebellum, or disorient or disrupt bodily functions by concentrating on pons.

with external source - if someone is electrokinesis-capable, it would be great idea to take some sort of a capacitor everywhere and store some electricity in it. Lot of small ones, looking like jewellery or few big ones in a backpack. Capacitors can be built using crudest of tech (for example, allegedly, Ark of the Covenant, if built according to description in the Bible, is a rather big and nasty capacitor).


Transimpedance amplifier with biopotentials

Question: I have a PPG sensor to be specific the sensor is called " easy pulse finger sensor " which is a ( phototransisitor), can it be connected  to a transimpedance amplifier ( current to voltage converter)?!
Because the output of the sensor as i assumed will be a current, so i should amplify and convert it to voltage inorder to put it into bandpass filter
Comment: My question is how do i design a proper TIA suitable for my signal
Comment: Sure, you can connect it to a TIA. What's your question?
Answer: To read out a photo diode you can indeed very well use a TIA.
Wikipedia tells all the information you need to design a circuit.
Find a suitable operational amplifier with a low input referred noise (just search for low noise opamp).
The formula for the output voltage is simply:
$$\frac{V_{out}}{I_P} = -R_f$$
The output voltage is buffered by the amplifier so you can directly filter it in the way you want it.


Are there any known criteria for quadratic mapping from R^n to R^n being surjective?

Question: Let quadratic mapping be the function from $\mathbb{R}^n$ to $\mathbb{R}^n$, where each coordinate is a quadratic form of $n$ variables. Are there any known criteria for it being surjective? May somebody give relevant references too?
Comment: What is the connection with representation theory?
Comment: The problem is linked to representation theory via invariant theory.
Comment: Nice question. But the two posted `answers' are really very far from answers and -- in my opinion -- should be deleted.
Comment: Criterion in terms of what? Foe $n=2$, there is a classification; it may serve as a source for further guessing: Alex Degtyarev. Quadratic transformations Rp2 --> Rp2. In: Topology of Real Algebraic Varieties and Related Topics, Amer. Math. Soc. Transl. (2), 173 (1996), 61-73.
Comment: @AlexDegtyarev: Could you be so generous as to elaborate in the form of an answer. I am unclear why the pull-back is quadric, why I must hope for degeneration, and what is a `double' hyperplane?
Comment: I must admit that i don't believe your claim that quadratic maps are `almost never surjective'. They seem to as stable as "sets of open cones covering R^n". But, I am also unclear on whether or not we can expect a typical quadratic map $Q=(q_1, \ldots, q_n)$ to have the origin as an isolated solution to $Q=0$ or to have $d(\sum q_i^2)$ vanish only at the origin?
Comment: Sorry, my bad. Regarded as $Rp^n\to Rp^n$, your maps already are non-generic as needed. I remove my comment.
Answer: If $n=2$ the quadratic map $\mathbb{R}^2\to\mathbb{R}^2$ with $(x_1,x_2)\mapsto (x_1^2-x_2^2,2x_1x_2)$ is surjective. This follows because the map $\mathbb{C}\to\mathbb{C}$ with $z\mapsto z^2$ is surjective. Hence there exist
real quadratic maps $\mathbb{R}^{2m}\to\mathbb{R}^{2m}$ for all even values
of $n$. (Identify $\mathbb{R}^{2m}$ and $\mathbb{C}^m$ and consider $(z_1,\dots,z_m)\mapsto(z_1^2,\dots,z_m^2)$.) For $n=1$ a quadratic
map $\mathbb{R}\to\mathbb{R}$ is not surjective. The question can thus be rephrased:
for which values of $m\geq1$ is there a real quadratic surjective map $\mathbb{R}^{2m+1}\to\mathbb{R}^{2m+1}$?
Comment: This is a nice remark, but it does not settle the case of even dimension. The OP asks for a criterium...
Comment: y1 = 2 * x1 * x3; y2 = 2 * x2 * x3; y3 = x3^2 - x1^2 - x2^2. To see it is enough to write it in polar coordinates. For higher dimensions the situation is same yj = 2 * xj * xn; yn = xn^2 - squares of other variables
Comment: Still I am curious to know whether the map can be surjective for $n$ odd $\geq 3$?
Comment: @abx Are you asking if a surjective map exists for odd n >= 3 ?
Comment: Yes (a quadratic map).
Comment: @abx I suspect invertible quadratic map exist with constant det(jacobian) and explicit polynomial inverse.
Comment: It is easy to see that the surjective quadratic mappings exist in every dimension. For example in dimension 3 it is the following mapping:
Answer: Some comments.
Check this question and the comments.
A paper from the answer

Proposition 6. No algorithm is possible that, given a polynomial mapping
  $f : \mathbb{R}^n \to \mathbb{R}^n$ with computable coefficients, decides whether this mapping is
  surjective.

On the other hand another answer gives relatively efficient criterion
for deciding if the map is bijective over $\mathbb{Q}$ (this implies surjective).
Comment: Disagree with J. Martel, at least for me, joro's answer nice "sharing of knowledge" even if it does not precisely match the question
Comment: 1) Here the polynomial mapping is polynomial, but of quite a special form. Is the quoted proposition true even in this very particular class?
2) The OP means a map whose coordinates are *quadratic forms*, i.e. *homogeneous* polynomials of degree 2. If we allow linear terms then it is very easy to build examples of invertible maps.
Comment: The paper you quote has what I consider a misleading framing of the problem: Their map contains a computable number $a$ and the map will be surjective iff $a \neq 0$; there is no algorithm which takes a description of a computable number and determines whether it is zero. If you give your mapping $f$ in a more concrete manner (for example, with coefficients in $\mathbb{Q}$), then this will be computable by Tarski's Theorem http://mathworld.wolfram.com/TarskisTheorem.html .
Comment: @PietroMajer thanks, I see, misread the question.
Comment: @joro: in my opinion your `answer' needlessly clutters this particular question and deserves to be deleted.
Answer: I do not know the answer in general but, just for fun, I tried to analyze the small dimensions. The results call for an obvious conjecture. This may be known, but I haven't seen this in the literature.
A quadratic map (given by homogeneous quadratic forms)
$\varphi\colon\mathbb{R}^{n+1}\to\mathbb{R}^{n+1}$ is essentially the same as an
$n$-dimensional linear system $L_\varphi$ of quadrics in $\mathbb{R}\mathrm{p}^n$.
We also have the projectivization, which is a rational map
$\bar\varphi\colon\mathbb{R}\mathrm{p}^n\to\mathbb{R}\mathrm{p}^n$. For the sake
of simplicity, let us assume that $L_\varphi$ has no basepoints, so that
$\bar\varphi$ is regular (we do not need to blow up anything).
The first observation is that, assuming $n\ge1$, the original map $\varphi$ is
surjective if and only if so is $\bar\varphi$. Indeed, we can restrict/normalize
$\varphi$ to the unit spheres, and the key is the fact that the double covering
$S^n\to\mathbb{R}\mathrm{p}^n$ is nontrivial.
Here is the common approach to the description of the topology of $L_\varphi$
(after Dixon, Agrachev, etc.) The spectral variety is the set
$C\subset L_\varphi\cong\mathbb{R}\mathrm{p}^n$ of singular quadrics. Typically,
it is a hypersurface of degree $n+1$ (possibly nonreduced),
although in some very degenerate cases it may coincide with $L_\varphi$.
Passing from quadrics to quadratic forms (and normalizing), we
get a nontrivial double
covering $S^n\to L_\varphi$ and the pull-back $\tilde C\subset S^n$ of $C$. On
the complement $S^n\setminus\tilde C$ one has the index function, sending a
point to the negative inertia index of the corresponding nondegenerate quadratic form. It
takes values between $0$ and $n+1$, is symmetric in an appropriate sense, and has a lot of
other nice properties that I will skip here.

Theorem.
  A necessary condition for
  a quadratic map $\varphi$ to be surjective is that the index
  function $\iota\colon S^n\setminus\tilde C\to\mathbb{Z}$
  should not take value $0$. If $n\le2$ and $\varphi$ is generic, this
  condition is also sufficient.

Proof
The necessity follows from the fact that the members of $L_\varphi$ are the
pull-backs of hyperplanes in $\mathbb{R}\mathrm{p}^n$, and quadrics of
index $0$ are empty.
The case $n=0$ is trivial: $\varphi$ is never surjective and $\iota$
always takes value $0$.
The case $n=1$ is also easy. Indeed, there are two projective classes of
generic pencils, with the spectral curve $C\subset L_\varphi$ empty or not.
In the former case, $\varphi$ is surjective; in the latter case, it is not
and $\iota$ does take value $0$. (I can refer to my paper, but the fact is
trivial and well known.)
Let $n=2$. A point $p$ in the target $\mathbb{R}\mathrm{p}^n$ defines a
pencil $\ell\subset L_\varphi$, and the pull-back $\varphi^{-1}(p)$ is the
base locus of $\ell$. Generic pencils of plane conics admit a simple
projective classification (see my paper again); they are characterized by
their basepoints. The index function of
the only pencil with all four basepoints non-real does take value $0$; hence,
such pencils do not occur if $\iota>0$.
QED

Remark.
  Taking care of a few technicalities, I believe that the proof can be adjusted
  to non-generic linear systems. The big question is whether the sufficiency
  holds as well in higher dimensions.
Comment: In your case $n=1, 2$, which is the case $n=2,3$ in the original question, (1) would it be possible to reformulate your necessary and sufficient condition purely in terms of the original quadratic forms? (2) The example provided by @Glasby the quadratic forms $x_1^2-x_2^2$ ad $2x_1x_2$ are both of trivial inertia index, in the last paragraph before stating your theorem you are talking about the negative inertia index of which quadratic form? Thank you.
Comment: In a sense, it **is** in terms of the original forms, as they span the linear system. But otherwise the answer is "no", as you can always choose those forms very close to each other, so that they'll be equivalent algebraically. It's the system that matters! Concerning the example, do not mix inertia index (number of negative squares in the diagonal form) and signature: in the example, both indices are equal to 1. A binary form of index 0 is $x_1^2+x_2^2$.
Comment: Let me illustrate the case $n=1$. All binary forms form a plane $\mathbb{R}\mathrm{p}^2$, and the discriminant is a conic in this plane. A pencil is a line, and what matters is whether this line intersects the conic. Obviously, any line is spanned by two points **outside** the conic, and **separately** any such form is equivalent to $x_1^2-x_2^2$. Changing the coordinates in the target, you can always say that the other form is arbitrary close to the first one; it's the direction that matters!
Comment: I was thinking about an explanation why the example provided by Glasby works, based on your necessary and sufficient condition for $n=1$. Thank you anyway, also for your thoughtful answer.
Answer: I'll consider the question posed in Glasby's answer.   Take $n=3$ and $\pi(x,y,z)=( (x-1)^2 - y^2, 2(x-1)y, xz )$.  To  see that $(u,v,w)$ lies in the image, note that there is always at least one pair $(x_0,y_0)$ such that $((x_0-1)^2-y_0^2,2(x_0-1)y_0) = (u,v)$ and $x_0 \neq 0$.   To see this note that $(0,y_0) \mapsto (1-y_0^2,-2y_0)$ and $(2,-y_0) \mapsto (1-y_0^2,-2y_0)$.
Thus $\pi(x_0,y_0,w/x_0) = (u,v,w)$.
Thus there exist surjective quadratic maps for all $n \neq 1$.  This doesn't really answer the original request for a criterion though.
Comment: Just noticed that Rampant_mouse already answered this in a comment.
Answer: Similar questions were studied in the paper
A V Arutyunov, S E Zhukovskii, "Properties of real surjective quadratic mappings", SB MATH, 2016, 207 (9), DOI:10.1070/SM8611 .
In particular, for $n=3$ there are necessary and sufficient conditions for a quadratic mapping to be surjective. The paper is written in Russian. Probably it will be translated this year. If it is interesting, I can write a short summary.
Comment: I think it is interesting that you state the main results here, if you can.
Comment: Concerning quadratic mappings acting from $\mathbb{R}^3$ to $\mathbb{R}^3$ in the above mentioned paper it is proved that the following are equivalent: (i) quadratic mapping $Q$ is surjective; (ii) surjectivity of $Q$ is stable, i.e. any "close" to $Q$ quadratic mapping is surjective; (iii) $Q(x)\neq 0$ for each $x\neq 0$, and for each regular value $y$ of the mapping $Q$ the set $Q^{−1}(y)$ consists of 2 or 6 points.
Answer: A necessary condition is that if the mapping is $Q:x\mapsto(q_1(x),\cdots,q_n(x))$ where $x=(x_1,\cdots,x_n)\in\mathbb{R}^n$, then $q_1,\cdots,q_n$ are not simultaneously diagonalizable.
In fact if not after a change base, we may assume that $Q(x_1,\cdots,x_n)=A\begin{bmatrix}x_1^2\\ \vdots\\ x_n^2\end{bmatrix}$, where $A\in M_n(\mathbb{R})$. But this map is obviously not surjective.
Using above we get the following necessary and sufficient condition for the case $n=2$.

$Q=(q_1,q_2)$ is surjective iff $q_1$ and $q_2$ are both regular and not simultaneously diagonalizable.

(The example of Glasby manifests this).
Comment: I don't think your criterion is correct. In particular, $q_1, q_2$ regular and not simultaneously diagonalizable does not imply that either of $q_1, q_2$ are indefinite (which certainly is necessary!).
Comment: @J.Martel Thank you for your comment. It does imply! If $q_1$ and $q_2$ are both regular, and at least one of them is definite then they are simultaneously diagonalizable (see Greub, Linear Algebra, 1967, Third edition,  Ch. IX, p.256).


"Therefore I" or "I therefore"

Question: I would like to understand the nuances. What is the correct way to use:
"Therefore, I …"  or "I, therefore …"
Answer: Therefore - (adverb) "because of that", "for that reason".
Not a word I would use in ordinary conversation, but very useful in the written language.

"I, therefore, suggest that..." x "Therefore, I suggest that..."

Semantically speaking, I can see no difference between them. The former, however, seems to emphasize the subject.
Comment: Yes. It would sound pompous if not used to stress contrast with a suggestion by a previous speaker etc.
Answer: It's all about emphasis. When I say "Therefore, I ..." I automatically have a larger pause between 'therefore' and 'I'; whereas when I say "I, therefore ..." the pause is smaller between those two words.
"Therefore, I ..." can have more gravitas than "I, therefore ..." and can infer a level of authority, urgency or even aggression.

"Therefore I" or "I therefore"


Certificate not trusted error while accessing WCF with SSL security in IIS

Question: I am facing the following issue.
1 - I have deployed WCF service with SSL enabled on remote IIS machine and trying to use it from my web client.The problem is my browser is not allowing this service to be called.Before using my web client i have to hit the service url from my browser directly and then allow the certificate.
2- Got suggestion from somewhere to export the certificate on the machine where WCF is deployed and include that certificate file in Trusted certificates group on my machine.After I did that I got same problem when tried to access web service from web client.So I hit the service url from browser and got the same page which needs me to trust the certificate with a different message that "You attempted to reach 22.214.171.124(ip address of the WCF machine), but instead you actually reached a server identifying itself as "WMSvc-domain" where "WMSvc-domain" is the value of "Issued To" field in the certificate.
I hope I have made myself clear.Waiting for suggestions.Thank you.
Answer: WMSvc-machinename is the IIS Windows Management Service which runs by default on 8172/tcp and is used for remotely managing iis. When installed the default is to create a self-signed certificate.  That wouldn't trusted.  It could be replaced with a "proper" CA signed cert through the Management Service icon in IIS Manager.


DECIMAL value out of range

Question: I am trying to publish data from our SAS environment into a remote Hadoop/Hive database (as sequence files).  I'm performing basic tests by taking some source data from our business users and using a data step to write out to the Hadoop library.
I'm getting errors indicating that a value at row X is out of range.
For example:
ERROR: Value out of range for column BUY_RT1, type DECIMAL(5, 5). Disallowed value is: 0.

The source data has a numeric format of 6.5, and the actual value is .00000.
Why is .00000 out of range? Would the format for Hadoop need to be DECIMAL(6, 5)?
I get the same error when the value is 0.09:
ERROR: Value out of range for column INT_RT, type DECIMAL(5, 5). Disallowed value is: 0.09

Answer: You may need to check the actual values in SAS. If a numeric value in SAS has a format applied, you will see the formatted (possibly rounded) version of the numeric value wherever you output the value, but the underlying numeric may still have more significant digits that you're not seeing, due to the format.
For example, you say your source data has a format of 6.5 and the 'actual value' is 0.00000; are you sure that's the actual value? To check, you could try comparing the value to a literal 0, or putting the value to the SAS log with a different format like BEST32. (eg put BUY_RT1 best32.;).
If this is the problem, the solution is to properly round the source numeric values, rather than just applying a format.
Comment: I didn't even think about that.  I tried this and confirmed that the 0.00000 is actually "0" and the "0.09" is indeed "0.09".  I understand the first one, but the 0.09 is stumping me. I'll try properly rounding the values and see what happens. Thanks!

DECIMAL value out of range


Rapid acceleration and deceleration of Space X's BFR

Question: Given that momentum is the product of speed and weight (Velocity x Weight) would rapid deceleration or acceleration in weighless space, of Space X's BFR have an impact on its passengers. I ask because if it is to travel at 27000km/h most of its journey would be spent accelerating and decelerating very much limited by earthlike g forces as airliners do, therfore minimizing on the reduction of travel time. Would most of the braking and accelerating have to take place in space at zero gravity?
Comment: Please begin by figuring out how long it takes to accelerate to 27000 km/h at 1 G acceleration. 1 G = 9.8 m/s or 35.3 km/h. Each second, you are going 35km/h faster.
Answer: The factor here is mass, not weight - weight is the force produced by mass and the effect of gravity.
The same kinds of forces are produced by acceleration. In "weightless space" (zero gravity) a spacecraft accelerating at 1g (9.81 m/s2) will impose the same force on its occupants as earth's gravity.
For a high speed spacecraft, a lot of the time will be spent accelerating and decelerating to keep the force on the occupants within tolerable limits.
Comment: I never considered before that constant acceleration at 1g for half the journey and -1g for the remainder would give a 1g environment for the occupants. Unfortunately this would not be very efficient and regenerative braking would not be an option!


How do you describe the feelings of being caught in an act you have previously pulled off many times?

Question: Suppose you are planning a surprise party for someone. It was a thrilling adventure because you managed to do it under their nose, dodging their suspicious eyes many times. However, you were caught in the act while making a move.
How do you name that feeling of "getting caught"? It wasn't anger, frustration, embarrassment, joy, disappointment, excitement, or surprise. This is different from getting caught for doing something bad.
To explain it a bit more, it was a mixture of feeling funny with an outburst of laughter:

I could have got away if I had made the move a second earlier or later.

It is over.

What to do next?

How to explain away what I am doing? (Trying to come up with an excuse to get away with it)

Should I come clean?

The word would be used in a sentence as follows.

I was setting up Ryan's surprise party, but he was early that day. As he caught me red-handed, I felt _______.

Is there a word/idiom/phrase to describe this emotion?
Comment: I don't see why "disappointment" is not appropriate, you felt disappointment that the surprise party didn't go according to plan. To be "deflated" expresses the idea of a let down, of losing enthusiasm/excitement
Comment: Your balloon burst.
Answer: The word "chagrin" comes to mind.  An example would be:

Much to his chagrin, he got caught trying to snatch another cookie from the jar.


Is there a problem with women wearing red clothing?

Question: I've heard that red clothing is forbidden for women to wear because it's immodest.  Some recent psych research confirmed that men are more attracted to women in red.  So that means it's prohibited, right?
Comment: @HachamGabriel It just means we normal people can effectively act as if they don't.
Comment: Rav Musafi in his book Shivat Sion writes that the color red brings Dinim.
Comment: As I commented on Avraham's answer, all I can do is quote Chasam Sofer OC159 -- אין לי עסק בנסתרות.
Comment: Are you commenting to me?
Comment: I understand but it doesn't mean they don't exist.
Answer: I recall reading the study in question and it is significant in that the color red did not effect how the male perceived the female's other traits such as intelligence or kindness but only his, shall we say, interest in her. Although it is not clear based on this study whether this tendency is the result of biological factors, cultural factors, or both, it strongly suggests that the color red does have a certain effect even in contemporary society which may not be particularly welcome from the standpoint of tznius (modesty).
While others have noted that there are authorities who are lenient with respect to wearing the color red, it should be recognized that the Rema in Yoreh Deah (178:1) writes that: "Rather one should be distinct [from non-Jews] in his dress and in his other ways, but all of this isn't prohibited unless it is done by non-Jews for reasons of immodesty, for example they are accustomed to wearing red clothes" To this the Sifsei Cohen (Shach YD 178:3) adds, "since it is not the way of the modest to have red in their clothes" (transl. mine, sorry for any imperfection).
Rav Moshe Feinstein zt'l (Igros Moshe Y.D. 1:81) rules that red clothing do not constitute a transgression of the prohibition against chukkas hagoy (non-Jewish customs) in contemporary society but describes them as having a tinge of immodesty (pritzus) and there is no explicit (nor I believe implicit) licence given to wear them. Indeed he explicitly states that the among the clothing he mentioned as not being prohibited due to chukkas hagoy there are those which are prohibited do to immodesty. Insofar as he closes with the statement that such a consideration (immodesty without the problem of non-Jewish clothing) is not relevant to men, it would seem that red clothing would be at the forefront of types of "immodest" clothing he referred to (i.e. those conceivably worn by men).
According to Rav Wosner shlita the prohibition against wearing red is still applicable, and that one is obligated to educate older children to abstain from wearing red clothing ( Shevet HaLevi 6:24:2). According to  Rav Elyashiv shlita this prohibition is also in effect, albeit only with respect to bright red (I don't believe that there is a disagreement about this, nor that there are other colors which the prohibition does apply to). The Be'er Moshe 4:147:13 also applies the prohibition to contemporary times. It is related in the name of Rav Yaakov Kaminetzky zt'l that it is permitted to wear red but  it is preferable not to.
It would seem that according to Rav Shlomo Zalman Aurbach zt"l that red is prohibited, but that it is permitted when it is an incidental accent to the garment.
Since we see that, in fact, there appears even in contemporary times a statistically significance increase in less-than-modest association with the color red I'm inclined to believe one should not be quick to dismiss the explicit words of these  (and other) Gedolei haPoskim. I would add, however, that while the study may not have revealed any similar perception by women viewing men in red (though I don't believe it addressed that question)
Comment: Thank you for adding contemporary poskim.  Interestingly, of those you cite, the Israeli poskim are the ones who are categorically prohibiting, but not the American poskim.  "R' Moshe gives no license to wear them" -- I'd call it "he doesn't prohibit"; I'm not sure clothing needs to be licensed.  R' Moshe says red is "tinged by immodesty", which means it could be prohibited if "non-Jewish" (as it was 400 years ago).  He then concludes by warning that some clothing is "fully immodest" and prohibited irrespective of "Jewishness."  Do you read that as referring to red?
Comment: Yirmeyahu, you're describing this as a disagreement among rabbinic opinions; I don't see it.  Everyone agrees with the Shach, that red is flashier.  But "flashier" alone does not prohibit.   (See Rabbi Henkin's essay and my answer above; the Talmud didn't prohibit flashy.)  "Flashier" + "clearly non-Jewish as practiced today" prohibits.  In the Rama's world (Krakow late 1500s), red met both criteria and was prohibited.  In R' Moshe's (NY 1950s), it didn't meet the second criterion and was therefore permitted.  R' Moshe isn't disagreeing with the Rama, he's describing a different situation.
Comment: I fail to see how there is a difference between Israeli styles and US styles with regard to wearing red, other than that in Israel a HIGHER percentage of those who wear red would be Jewish.

If something is forbidden by the Poskim AND called immodest by them then I would suggest that yes you DO need license to wear such clothing, not that there isn't room to be lenient but it is a sheilah.
Comment: The comment about Israel was that occasionally you'll find different schools of thought in Halacha between American and Israeli poskim, that's all.  In the world of Halacha as I see it, if R' Moshe says something is not prohibited and no one in America says otherwise, then American Ashkenazim are on very strong footing to follow him.  (And yes, I use kli shlishi for tea on Shabbos.)  But I think you and I fundamentally disagree on how to handle differences between contemporary poskim, as well as how to read this particular responsum.  We'll have to agree to disagree,  Kol Tuv.
Comment: You didn't acknowledge opposing views nor establish that Rav Moshe permitted it. I can not say with certainty that Rav Moshe prohibits red clothing but he does not permit them, he only says they do not constitute Chukkas haGoy.
Comment: @Yirmeyahu Until there is a reason to believe something is Assur it is mutter. Do your have some other reason to believe red would be assur?
Comment: @Orion....you mean other than the poskim saying so explicitly?
Answer: There are traditional sources (e.g. the Talmud discusses shoelaces) that yes, red is flashier and perhaps more attractive.  That doesn't mean it's prohibited.
If you look up "red clothing" in the index to the Igrot Moshe, you'll find the following discussion by Rabbi Moshe Feinstein:
A style of clothing can be prohibited if it's just plain inappropriate.  Another way a style of clothing can be prohibited is if this is a "non-Jewish" style, i.e. Jewish women have abstained from wearing it until now, AND this style is somewhat flashier, for instance it's red.
Writing in 1953, Rabbi Feinstein feels that the latter point is moot, as he is not aware of any clearly "non-Jewish" clothing styles in America; most American clothing (provided it's appropriate) is also "American Jewish" clothing.
In "Contemporary Tzniut", Rabbi Yehuda Herzl Henkin argues that just because clothing is attractive doesn't make it prohibited.  See Rashi's commentary on Genesis 49:11: "And colorful clothing" is expressed by the word סוּתֹה, [a garment] a woman wears to entice [מְסִיתָה] a male to cast his eyes on her."  This description appears as part of a Biblical blessing, and we don't see it prohibited.
Comment: I'll bet this would be of interest to DovBear (http://dovbear.blogspot.com/2010/01/chazal-jewish-women-and-color-red.html). If we were public now, I'd definitely post a link to this answer in his comments.
Comment: "I'll bet this would be of interest to DovBear (dovbear.blogspot.com/2010/01/…). If we were public now, I'd definitely post a link to this answer in his comments. – Isaac Moses♦ Jan 19 '10 at 21:24"
Comment: @Isaac, reminder!
Comment: While saying red is flashier doesn't make it forbidden per se, there are sources which say it is as I have cited in my answer.

I'll try to look up R. Moshe Feinstein's psak, which I have read before, but as I recall it in no way indicates that a particular garment cannot come under the category of non-Jewish clothing due to  immodesty. In fact I believe he is just applying the very Rema where the Rema forbids red clothing! But, again, I need to double check.
Comment: If I understood R' Moshe's words correctly, he said that in a situation where the non-Jewish women wear read and the Jewish women don't, yes red would be a problem.  HOWEVER, as far as American clothing in the 1950s, he sees two categories of clothing: appropriate and inappropriate.  There was no in-between category of "somewhat flashy AND Jewish women clearly avoided it as a practice."
Comment: To re-prohibit red clothing, you'd have to argue that our world today is more like the Rama's and less like R' Moshe's, in that wearing red clothing would be a statement of trying to look non-Jewish.  While much has changed in 50 years, I don't believe that to be the case.
Comment: I'm still working through the piece but I think it is worth pointing out that 1) Rav Moshe (Igros Moshe YD 1:81) DID say that red doesn't come under the category of chukkas hagoy but 2) he says explicitly that some of the items he discussed are ossur even without being chukkas hagoy, and it is not clear to me at all that he does not include red in that category. I will update my own answer when I reach a little more clarity.
Comment: The source you bring from Rashi's commentary to the word "Suso" is especially weak. Rashi was simply translating a word and wasn't condoning the practice.
Comment: Your answer ignores many contemporary poskim who prohibit red even today and I do not believe it accurately presents Rav Moshe's opinion...all in all you make it sound like a non-issue to the extent that it could be taken as if your trying to pasken.
Comment: Barry -- re "suso" -- I'm quoting Rabbi Henkin (Tradition article; separate book; or Bnei Banim 3:26); would an "uncondoned practice" be used as a Biblical blessing?  You can disagree if you like.  Yirmeyahu -- I'm saying that in his responsum, R' Moshe does not categorically prohibit red.  If you can provide sources that contemporary poskim (who?) prohibit it (because of chukas hagoyim, or purely because of tznius?), please cite them in your own answer.
Comment: Oh I see you did add contemporary sources above.  Thank you.
Comment: @Seth For what?
Answer: The discussion above re: prohibition due to the ways of the non-Jews is one issue. However, "Tzenius" is not just about legal prohibitions. It is a "Midda Tova" and it is a lauded character trait among Jews. It was described by Bila'am in his praise for Israel, and Rashi mentions it as a "worthy practice" a few places (e.g. Sanhedrin end of seventh chapter), not rising to the level of a full Mitzva, but nevertheless a mitzva. The Sma"k (57) considers it a full mitzva. A verse in Tenach (Micha 6) is one of the sources for this as well:

וְהַצְנֵעַ לֶכֶת עִם אֱ-לֹהֶיךָ

Tzenius in this sense is the practice of not calling attention to oneself, but rather operating discreetly, and it applies to man and woman alike. For a woman, wearing red, or skirts with slits, or anything that draws a man's attention, would not be considered "tzniusdik" by this definition.
Comment: Agreed that tznius is a value that should guide wardrobe decisions.  The question here is what we categorically prohibit.
Answer: on a mystical level not only women but anyone is not not reccomended to wear red, it means dinim
Comment: As the Chasam Sofer wrote, I have no business dealing with the mystical; but see Proverbs 31:21, which some translate as "her whole household wears red wool." I also heard from Rabbi Berel Wein that the normal colors for a Jewish man in medieval France were red, maroon, or brown.
Comment: I do, Shivat Sion of HaRav Musafi Shelita.
Answer: Penine Halacha:

לגבי בגדים בצבע אדום, כתבו ה'בית-יוסף' והרמ"א בחלק יורה דעה סימן קע"ח בשם מהרי"ק (שורש פ"ח) שאין ללובשם, משום שזו דרכם של הגויים ללבוש בגדים אדומים. אולם מבאר המהרי"ק, שבעצם זה שהגויים התרגלו ללבוש בגד מסוים – עדיין אותו בגד לא נפסל לנו ללבישה, ורק אם אותו הבגד מבטא אמונה אלילית או פריצות, חל האיסור "וּבְחֻקֹּתֵיהֶם לֹא תֵלֵכוּ" (ויקרא יח, ג), שלא לנהוג כמנהגם. ומאחר שהצבע האדום מבטא יותר מכל הצבעים את הפריצות והגאווה, לכן יש איסור ללבוש בגדים אדומים, כפי שהגויים לובשים.
  יתכן שהסיבה לכך, שהצבע האדום נחשב אצל הגויים לצבע שמסמל את הפריצות, היא משום שזה הוא צבעו של הדם, וממילא גם צבעם של האיברים הפנימיים ושל המקומות האינטימיים שבגוף. ובלבישת בגד אדום רצו להבליט כלפי חוץ, בעזות ובפריצות, את הצדדים האינטימיים שמדרך הטבע הם מכוסים ומוסתרים. בנוסף לכך הצבע האדום רומז לרצח, לשפיכת דם (וזה צבעו של אֱדוֹם, ועיין רמב"ן ויקרא טז, ח).
אולם צריך לדעת שיש מהאחרונים אשר פסקו, שכיום אין איסור ללבוש בגדים
  אדומים, משום שלדעתם רק כאשר נהגו הגויים ללכת עם בגדים אדומים, חל
  האיסור לנהוג כמנהגם. אבל, מאחר שהיום אין מנהג מובהק של גויים ללכת
  בבגדים אדומים, ממילא אין בזה איסור, וכך פסק אחד מגדולי הפוסקים שחי
  לפני יותר ממאה שנה, הרב הגאון יצחק אלחנן מקובנא (עיין דרכי תשובה קע"ח
  ס"ק ט"ז).
לסיכום, לדעת רוב הפוסקים גם כיום יש איסור ללבוש בגדים אדומים. והאיסור
  הוא בתנאי שכל הבגד או רובו הבולט בצבע אדום, אבל בגד שרק מיעוטו צבוע
  באדום, מותר לדעת כל הפוסקים ללובשו, וכן בגד שצבעו לא ממש אדום, כגון
  ורוד או בורדו, מותר ללובשו. ויש פוסקים שמקילים בזמננו, ללבוש אפילו בגד
  אדום לגמרי, והרוצה להקל יש לה על מה לסמוך, ולכתחילה ראוי לנהוג כדעת
  רוב הפוסקים ולהחמיר.

If a clothe has only a little red on it is Mutar according to everyone and also a clothe which isn't really red like pink is Mutar. And nowadys there a Posekim that are Matir to wear and those who are Mekil have upon whom to rely.
Answer: Just adding some Talmudic sources around which most of this debate centers. In Berachot 20a, when discussing the amazing levels of self-sacrifice to be found in generations previous to them, the Gemara relates, "Rav Ada bar Ahava saw this non-Jewess that was wearing a carbalata in the market. He thought that she was a Daughter of Israel, [so] he arose and tore it from her. It became revealed that she was a non-Jewess, and they assessed [his requirement to compensate] it at 400 zuz. He said to her, 'What is your name?' She said to him, "Matun!" He said to her, 'Matun? Matun is worth 400 zuz!'" (Rashi explains this final pun in 2 ways. Either he's referring to Ma'atan, Aramaic for the number 200, so he's saying "Ma'atan plus Ma'atan is worth 400 zuz!"  Alternately, he's referring to metinut, the patient investigation he had not done, so he's saying "Patience? Learning patience is worth 400 zuz!")
Carbalata is the same word used for a rooster's comb. Rashi translates it in context as "the name of an expensive garment". The Aruch in his dictionary says, "A red article of clothes, like the comb of a rooster, for it is not the normal way of Daughters of Israel to clothe themselves with it, for it is pritzut (immodesty) and leads to sinful acts."
(Pritzut has a connotation of poretz geder, breaking through societal mores - hence, immodesty.)
So, carbalata is either an article of clothes that's red as a rooster's comb (Aruch), or one that helps you strut like a rooster (Rashi)...
At the very bottom of Sanhedrin 74a, the Talmud discusses the requirement to give your life in sanctification of G-d's Name. It states that if a) it is a time of anti-Judaic governmental decrees, or b) if it's a public demand to capitulate, "even on a mitzva kala ("light" mitzvah), one should allow himself to be killed rather than transgress.  The Talmud then asks "What is a mitzva kala?", to which it responds on the top of 74b, "Even to change the laces of sandals!"
Rashi explains, "...if it is the way of the idol worshipers to tie the laces so, and the way of Jews in a different way - for example, when there is a Judaic aspect to it, and it is the way of Israel to be modest people - even this change, when there is no mitzva but just a general custom, he should sanctify The Name before his Jewish peers..." Nothing about red, but a general mention of modesty. In Tosafot, Rabbeinu Tam opines that Jews wore white shoelaces while all others wore black. Again, no red. However, many other Rishonim & Acharonim do specifically reference red (see Hagahot Maimoniyot on Yesodei HaTorah 5:2).
For example, Kitzur Shulchan Aruch (Code of Jewish Law, Ganzfried) says in 3:2, "We don't walk in the statutes of the idol worshippers, nor do we imitate them, not in dress nor in hairstyles and similar things... He should not wear clothing that is specific to them for haughtiness...  As an example, this that the Talmud says (San. 74b) that it is prohibited for a Jew to imitate them even with shoelaces, for it was their way to tie like so & the way of Israel in a different way, OR (capitalization mine, RR) that their custom was to have red laces and those of Jews were black, for the color black demonstrates humility and humbleness and modesty, [so] it is prohibited for a Jew to change. And from this each person should learn, ACCORDING TO HIS TIME AND PLACE..."
So, KSA hedged his bets: He mentioned Rashi's "it was their way to tie like so", other Rishonim's red vs. black (which sounds like the effects of red & black are an OBJECTIVE reality), then says that it depends on the time and place (which sounds like immodesty is SUBJECTIVE).
Left open is our question: Is red objective while many (most?) other forms of immodesty are subjective, or are they ALL subjective?
Do colors still affect us? This study says it does, though we don't know how the results would change if these colors were worn by the other person rather than painted on the wall.
Parenthetically, an ex-TSA agent just admitted that they had special codes for attractive female passengers, with red & yellow clothes getting special mention. Just sayin'...
Comment: ... and Rabbi Moshe Feinstein made it clear that if the non-Jews wore red and the Jews clearly didn't, then an attempt to emulate them in such a flashy way would be problematic. He then wrote that the American clothing of the 1950s had no such "Jewish" vs "non-Jewish" distinction. Some clothing was inappropriate because it was simply inappropriate, but nothing "non-Jewish" per se.
Comment: ...so obviously he concluded that red isn't objectively immodest, like Rashi. I have no problem with that.
Answer: Yes.
There are two issues at hand here; chukot hagoyim and tzniut. There is only an issue of chukot hagoyim if it contains pritzut or is a practice unique to them(without it's reason being easily known). In this case, it is an issue of pritzut because their women wear it davka to attract attention. All of this applies specifically to bright red clothing made to make it's wearer be more attractive to men, regardless of the intention of the wearer. See Shulchan Aruch YD 188, Rama in seif א, and Shach 3.


Error filtering template: Invalid Document Element 'widget': Missing child element(s). Expected is one of ( label, description, containers ). Line: 4

Question: I am facing this issue at home page after click on reorder in my order at frontend.
Answer: The issue: One of your widget.xml files missing required child element(s), which causes this error:

Invalid Document Element 'widget': Missing child element(s). Expected is one of ( label, description, containers ). Line: 4

The widget requires label and description elements. You can read more from Magento official document https://developer.adobe.com/commerce/php/tutorials/frontend/create-custom-widget/
Solution:
You can detect which file has a problem by adding debug code in vendor/magento/framework/Config/Dom.php, inside validate method, after the following code:
if ($this->validationState->isValidationRequired()) {
    $errors = $this->validateDomDocument($this->dom, $schemaFileName, $this->errorFormat);

Add this code:
if (count($errors)) {
    var_dump($this->dom->textContent);
    die();
}

Clear cache and go to the page which has the error, you will see the text content of the widget file which has the problem. Copy some text to find in the whole project, and you will see the widget.xml file which causes the error.
Open the error file, go to line 4 (that line mentioned in the error message above), which is the widget that caused the error, and add label and description elements to that widget to resolve the issue.
Clear cache and see the result.
Once you resolve all errors, remove the debugging code in vendor/magento/framework/Config/Dom.php.