How does this negative voltage rail work?

Question: Rod Elliot has a dual bench power supply project on his web site (project 223, see schematic below).  I'm trying to understand his method for adding a low voltage negative rail without using an additional secondary winding.  My questions are -   What is the purpose of C2, C3 in series with the secondary winding and the second bridge rectifier creating the negative rail?  Would this circuit work without them?  Finally, does this circuit work because the negative voltage rail is only being used at small voltage and small current, or would a similar circuit work for a symmetric split rail supply?

Project 223 Dual Power Supply Elliot Sound Products
Answer: I haven't searched for Rod Elliot's article (and you didn't provide a link) but the design looks very like it has been taken directly from the LM317 datasheet.
The LM317 ajusts the Vout to 1.25 V above the voltage on ADJ. That means that with a single-rail supply the variable voltage output can only go down to 1.25 V. If you want to be able to adjust to 0 V then you need to somehow be able to pull ADJ down to -1.25 V.

What is the purpose of R1, R2, C2, C3 in series with the secondary winding and the second bridge rectifier creating the negative rail?

The resistors, R1 and R2, give some current limiting and this may have been added to limit current into Zener D10. More on this later. C2 and C3 provide isolation between the positive and negative rail rectifiers.

Would this circuit work without them?

No. Imagine they're left out. Now look what happens when the top of the secondary winding goes positive:

Figure 1. If R1, R2, C2 and C3 are omitted the secondary will be short-circuited.

What is the purpose of D10?

D10 is a simple voltage regulator to limit the voltage into U2 to -15 V. Power dissipation in D10 is limited by R1 and R2.

Finally, does this circuit work because the negative voltage rail is only being used at small voltage and small current, or would a similar circuit work for a symmetric split rail supply?

This circuit is specifically designed to overcome a limitation of the LM317. It could provide a larger (more negative) voltage but the power out will be limited by R1, R2, C2 and C3. Very often this is enough when the current required by the negative rail is modest in relation to the positive rail.
Comment: "I added the link".
Answer: In this particular circuit, the LM317 used has a minimum output voltage of 1.2 V. A negative rail is used to bring the regulated voltage below that, so the output can get all the way down to 0 V.
The purpose of C2/3 is to support a DC shift to the lower rail's bridge rectifier, while still transmitting AC.
The positive rail is the 'power' rail. The negative rail is only used for biassing and control, so has been designed accordingly, for very low current. Regardless of C2/3, R1 and R2 are limiting the current to the negative rail, as part of the D10 shunt pre-regulator.
If you want a dual power rail supply, then omit R1/2 and D10, and increase C2/3 until they pass enough current. You can get 1000 uF, even 10000 uF caps. However, most people designing a dual rail output supply would use a centre-tapped secondary on their transformer. It barely changes the cost of a transformer, and big electrolytics can get expensive. The only reason you might go the big cap route for high current is if you already had the transformer, and didn't want to buy a new one.
You could also use the same technique to make a low current 'super-voltage' rail above the positive power rail, for instance for biassing NPN emitter follower power pass devices right up to the top rail.
Answer: R1, R2, C2, and C3 are used to decouple the two bridge circuits so that they are "almost" independent. Yes they need to be there or else the two bridge circuits are shorted. D10 is a 15 volt zener for regulating/clamping the negative rail to -15V WRT -Ve.
The purpose of this secondary bridge is to create a "below ground" (-Ve in this case) reference. The reason for this complication is so that the power supply can be adjusted all the way from the max output down to zero and everything in between. Without it, U1 can't regulate voltages between Max and +1.25V - The regulator tries to maintain +1.25 between "Vout" and "ADJ". Therefore, a bias circuit is required to extent the regulation range to cover voltages between 0V and +1.25V.
This circuit is designed for an adjustable single positive voltage output. It is much different than a symmetric split rail supply - The "negative" supply has much lower current capacity and only serves the purpose of a negative (below -Ve) voltage reference.


Export and Import MongoDB?

Question: I come from a bash and mysql environment.  I'm trying to get use to mongodb. I see there are different ways to export and import mongodbs.  Does anyone know the bash and mongodb equivalent of
bash> mysqldump -u username -p -h localhost mydatabase> mydatabase.sql

bash> mysql -u username -p -h localhost;

mysql> create database mynewdatabase; grant all privileges on mynewdatabase.* to 'username'@'localhost' identified by 'mypass'; exit;

bash> mysql -u username -p -h localhost mynewdatabase < mydatabase.sql

Answer: Look at mongodump and mongorestore here in this tutorial in the documentation for backup and restore tools

Export and Import MongoDB?


What's the term for fallaciously including an assumption in a question?

Question: For example, if I ask someone "What does it feel like to be a gay Christian?" I'm suggesting that the person to whom I'm asking is gay and Christian, neither of which may be true.
Answer: "Plurium interrogationum"

the rhetorical trick of asking a question that cannot be answered without admitting a presupposition that may be false, as "have you stopped beating your wife?"

from Wikipedia plurium interrogationum (Latin, "of many questions") is a question that has a presupposition that is complex. The presupposition is a proposition that is presumed to be acceptable to the respondent when the question is asked. The respondent becomes committed to this proposition when he gives any direct answer. The presupposition is called "complex" because it is a conjunctive proposition, a disjunctive proposition, or a conditional proposition. It could also be another type of proposition that contains some logical connective in a way that makes it have several parts that are component propositions.[1]

A "double-barreled question" expresses, perhaps even better, what you are asking. When you include "gay" and "Christian" in the same question, you are touching on more than one issue.

It is committed when someone asks a question that touches upon more than one issue, yet allows only for one answer.
This fallacy can be also confused with petitio principii, begging the question,which offers a premise no more plausible than, and often just a restatement of, the conclusion.
Comment: double-barrelled
Comment: @Mari-LouA  traveled/travelled, barreled/barrelled, gamboled/gambolled AmE/BrE.
Comment: But it *looks* wrong! :)
Comment: Not double-barreled. The term is a ***double-bind*** http://nlp-mentor.com/double-bind/
Comment: @chaslyfromUK  It looks like there is more than one term. I've provided a link to "double barreled".
Answer: Loaded Question

A loaded question or complex question fallacy is a question which contains a controversial or unjustified assumption (e.g., a presumption of guilt)

The classic is, "when did you stop beating your wife?"
For what it's worth, the word loaded by itself is gaining a broader meaning which can also include less explicit assumptions, and instead mean there is bias included in the question. Bias which one has to be careful not to tacitly accept in the answer.
loaded -

(of statements or questions) charged with associative significance and often meant to mislead or influence
Answer: A false premise is an incorrect proposition that forms the basis of an argument or syllogism. Since the premise (proposition, or assumption) is not correct, the conclusion drawn may be in error. However, the logical validity of an argument is a function of its internal consistency, not the truth value of its premises.
False premise - Wikipedia, the free encyclopedia
https://en.wikipedia.org/wiki/False_premise
Answer: A complex question fallacy or loaded question is a question which contains a controversial or unjustified assumption (e.g., a presumption of guilt).
http://nlpnotes.com/presuppositions-complex-question-fallacy/
EDIT
Oops - I've just spotted that stevesliva has mentioned this term.


Why was a rating system instituted?

Question: I personally find there are more negatives than positives in playing rated games and in fact have stopped playing them for that reason.  I feel they detract from the enjoyment of the game, making the pursuit of the almighty point its main purpose rather than trying to create something esthetically pleasing at the possible risk of losing. When I played rated games, my sole purpose became to avoid losing and having my rating drop, changing the way I played. Why was it decided to have such a system in the first place?  Wasn't playing the game for it's own enjoyment and mental challenge sufficient motivation?
Answer: Why do runners take the time when they run a Marathon?
Tournament chess is a sport. It is about competition and improvement. Both is furthered by a way to compare results.
Nobody is forced to play chess competitively, but for those who like to, the rating system is definitely very useful.
Answer: A rating system has many advantages:

Ensure that you play against opponents of similar ability, especially in tournaments and/or leagues. Most people enjoy a challenge most when it is hard but not impossible.
When you do happen to play against someone of far stronger ability, most rating systems make provision by not penalising you too much when you lose (and similarly not benefiting you too much when you beat a much weaker opponent). I find this encourages me to enter tournaments in a higher category when I'm up for a challenge, because I know that mediocre results won't necessarily destroy my rating.
Provides an objective measure of improvement. I find it interesting to see how my rating changes over time, and obviously I feel very satisfied if it increases after hard work.

As for negatives, I can't think of many:

no rating system is perfect, and there is always a bit of dispute about how much they reflect actual playing ability. This is not really a problem as most players know that their rating is really just an approximation rather than the absolute indisputable measure of their strength.
I know some players "manage" their rating, often losing games to prevent it from going too high, so that they can play in lower-graded sections of tournaments. I don't care much for these people, and fortunately there are not many of them. As an interesting note here, the opposite also happens - strong players sometimes refuse to play in tournaments if there are not many players of similar strength. For example, Nakamura stopped playing in the US Championship for a number of years because he believed playing against weaker opponents would have a detrimental affect on his rating (he wants to stay in the 2800 club you see). Luckily for us chess fans he seems to have gotten over this particular affliction because he played this year and won.

Try not to take ratings too seriously - it serves its purpose well enough.
Answer: The rating system is a means of ranking players. The question you are asking therefore is really about the motivation behind ranking players; apart from the usual reasons (which country has the best players, who is the best player, etc.), national federations need some criteria to decide which players to send to international tournaments (say the olympiad).
While it is possible to select players that win the national championship (and this is common practice for many countries), it is unfair to have an entire national team composed of players selected from a single tournament (where attendance may not have been possible for some who have been performing well throughout the year, and when there is a large pool of players and not enough rounds, the rankings of runners-up are not very convincing); a ranking system is needed as another decision criteria, at least for the playoffs.
Rankings are an integral part of any competitive game or sport; the big question now is how effective the current rating system is, in the sense of how it reflects on players strength.
As for playing in tournaments, if whether a game is rated or not affects your approach to the current game, resulting in you trying harder "not to lose", perhaps it shows that indeed rating systems encourage you to play better.

Why was a rating system instituted?


Wok slides around in ring

Question: I have a round bottom wok with a metal handle. When placed in the wok ring, the wok slides down to the handle side due to the weight. The ring is reversible, however it slides on either side. This is so annoying. Is there a fix for this?
Comment: Did the ring come with the wok?
Comment: No. they were not. The wok was given to me from a closing restaurant. The ring was from another wok set.
Comment: I'm not a wok expert so I won't put this as an answer. My instinct would be to modify the inside of the ring so that there are small protrusions that stick out and grip the sides. The problem with that is if it doesn't work you've ruined your wok ring. However, there may be better answers. It could be that the wok is designed to work with a specific ring.
Comment: Yes I agree. I am hoping that there may be someone with some experience in solving this issue. In an Asian kitchen, this wok  would mostly likely sit lower in the a ring or the stove itself accepts the wok in its top. With our traditional stoves, we need a ring or some custom devise. If all else fails, I will have to give up this wok for a new flat bottom wok.
Comment: The wok ring that came with my stove does that.  It's better to just do without in my case, as my wok has a slightly flattened bottom (but the big burner is also pretty rubbish with a wok as the flame ring is too wide).
Answer: yes there is a fix…just add food to the wok.  In most cases the added weight of the food will balance the weight of the handle.  I don't really find the position an issue, it just means that the handle gets a bit hotter than the other side.  I always have a dry towel to handle the metal wok handle while cooking.
It doesn't affect the food, as when you start to use the wok you will lift the handle and it will be level.  Another option is just to use a Cantonese style wok with the double ears, they don't have the lopsided handle on one side, so it doesn't have the problem.
Alternatively, if it really bothers you, you can rest the wok handle on another pan or pot so that it sits properly in the wok ring.  The other pot or pan will be off to the left side if you use that hand for the wok, or vise versa if you are using your right hand.  But usually just adding your food will be enough to correct it.

Wok slides around in ring


Normal Distribution Curve

Question: I understand that if a graph is close to the shape of a bell shape (and the mean tends to zero, and the SD is close to 1), then we can say it is normally distributed. Visually inspecting a normal curve can be subjective as well. How should I confirm if the residuals of the curve below is normally or approximately normally distributed? I am using this judgment to as a pre-determination of ANOVA assumptions.
Comment: "if a graph is close to the shape of a bell shape (and the mean tends to zero, and the SD is close to 1), then we can say it is normally distributed" -- (i) the mean and standard deviation are irrelevant to whether or not it's normally distributed; (ii) many things that are  very much *not* normal may look more or less bell-shaped, so merely looking bell shaped is not a means to assert normality; (iii) that doesn't look at all bell-shaped anyway; it's clearly bimodal. What's your response? (iv) are those residuals from the actual model you want to assess the assumptions of?
Comment: Can you give some context, why do you need an approximate normal distribution?  How to judge the approximation depends on purpose.
Comment: I am inspecting my data to ensure that they do not violate the assumptions for conducting an ANOVA and a Regression Analysis
Comment: Consider trying to identify the two groups that seem to have accounted for two distributions here.  You might conduct a separate analysis on each group.
Comment: What do you mean by two groups? Why do you say it is bimodal? I see the term "conservative approach" is used. If the normality test says that the distribution is not normal, how should I proceed to conduct the ANOVA and Regression, apart from reporting that the sample is not normally distributed?
Comment: There can exist a factor variable you're missing that would divide the individuals in your histogram in two groups and in these groups, you would have a normal distribution (observe how your histogram does have 2 bell-shaped patterns, one centered at around -0.8 and the other 0.8).
Answer: As you said, visually inspecting is really subjective, but in your example, the histogram indicates two modes and the part with the most theoretical probability density (near 0) has too few points, so you have a strong "intuitive evidence" that a normal distribution assumption might not be appropriate.
Another (also subjective) form of inspecting normality is by looking at the Q-Q Plot. On the other hand, you can use a Normality Test to decide if you consider the normality assumption is valid with only the significance level as a subjective factor.
Keep in mind that, as commented, you should understand and considerate the consequences of your normality assumption, like what parts of your analysis can be invalid because of it.

Normal Distribution Curve


close form solution needed for following integration

Question: I wan to solve integration of following form $$\int  xe^{-ax^m-bx^2}dx$$where $a>0,b>0,m>2$. I have looked into Gradeshteyn book but i have not found anything relevant to this. Actually, I need some expression for the integral when the integral limits are from $0$ to $\infty$. Your help will be highly appreciated. Thanks in advance.
Answer: A closed-form antiderivative does not seem to exist in general.
For the integral from $0$ to $\infty$, start with the change of variables
$x = t^{1/m}$, which makes it
$$ \dfrac{1}{m} \int_0^\infty t^{-1+2/m} e^{-at} e^{-b t^{2/m}}\; dt$$
Expand out $\exp(-b t^{2/m})$ as a power series and integrate term-by-term.
I get
$$ \sum_{k=0}^\infty {\frac { \left( -1 \right) ^{k}{b}^{k}}{k!\; m}
\Gamma \left( 2\,{\frac {k+1}{m}} \right) {a}^{-2\,{\frac {k+1}{m}}}}
$$
For each integer $m > 2$, it seems this can be written in terms of hypergeometric functions.
Answer: Concerning the antiderivative, I do not think you any expression would be found as soon as $m>2$ (even for integer values of $m$.
If we consider the definite integral $$I_m=\int_0^\infty  x\,e^{-ax^m-bx^2}\,dx$$ a CAS seems to produce some nice monsters $$I_3=\frac{9 b^2 \, _2F_2\left(1,\frac{3}{2};\frac{4}{3},\frac{5}{3};-\frac{4 b^3}{27
   a^2}\right)-4 \sqrt[3]{3} \pi  a^{2/3} e^{-\frac{2 b^3}{27 a^2}}
   \left(\sqrt[3]{3} b \text{Bi}\left(\frac{b^2}{3 \sqrt[3]{3} a^{4/3}}\right)-3
   a^{2/3} \text{Bi}'\left(\frac{b^2}{3 \sqrt[3]{3} a^{4/3}}\right)\right)}{54 a^2}$$ where appear hypergeometric function, Airy function and derivative.$$I_4=\frac{\sqrt{\pi } e^{\frac{b^2}{4 a}} \text{erfc}\left(\frac{b}{2
   \sqrt{a}}\right)}{4 \sqrt{a}}$$ For $m=5$ and above, appear awful linear combinations of hypergeometric functions. For $m=6$, a "simple" one which seems to be $$I_6=\frac{\frac{3 b^3 \, _1F_2\left(1;\frac{4}{3},\frac{5}{3};-\frac{b^3}{27
   a}\right)}{a}+4\ 3^{2/3} \pi  \left(\frac{b^{3/2}}{\sqrt{a}}\right)^{2/3}
   \text{Bi}\left(-\frac{\left(\frac{b^{3/2}}{\sqrt{a}}\right)^{2/3}}{\sqrt[3]{3}}\right)}{36 b}$$
So, I do not think that there is any hope for closed form and infinte series would nedd to be considered.
I stop here since, while I was typing, came Robert Israel's solution.


Communicating with mining pools

Question: if I designed my own ASIC machine, what is the easiest way to connect it with the mining pool? I was searching but couldn't find any pool that has an API to communicate.
Answer: Mining pools use protocols such as Stratum to communicate.
However, I'd find it unusual to implement this in firmware or in an ASIC. I'd expect the ASICs to be dedicated to hashing and have pool communication handled by a supervisory computer. But I've not designed ASICs or mining systems so maybe my intuition here is weak.
Comment: yes that what i am meant, i will build asci machine and then use a computer to handles these asic machines. I have looked for stratum, explored their website too, but couldnt find any documentation of api, or some paltform  where I can find some help. Neither do i find any documentation on pool websites like which protocol are they using etc. where can i find such documents, regards

Communicating with mining pools


Round-off error and exponential function

Question: Trying to understand why the exponential function e^x is sensitive to round-off error.
Googled a ton, did not find a clear answer for me.
Please recommend some readings/videos.
Comment: One reason is surely how fast the function changes: for a point $(x+h, e^{x+h})$, the instantaneous gradient is $\lim_{h \to 0} \frac{e^{x+h}-e^x}{h} = e^x$, so the error from rounding increases exponentially.
Comment: Thanks, this is helpful!
Answer: Imagine you're trying to calculate $e^x$ for some $x$, but you round off $x$ to some other number $y$ and compute $e^y$ instead.  Sensitivity comes down to trying to understand the following question.
If your error in the input is small, is the error in your output also small?
In other words, if $y$ is close to $x$, does that mean $e^y$ is close to $e^x$?
In order to nail this down, we need to nail down a definition of "close".  When talking about rounding errors, a natural thing to look at is relative error (percentagewise error).  For example, suppose that you round up and $y$ ends up being $1$ percent larger than $x$.  We can express this as $y=1.01x$, or as $\frac{y}{x}=1.01$.  What sort of error does this lead to in the exponential?  The ratio between our answer and the correct answer is
$$\frac{e^y}{e^x}=\frac{e^{1.01 x}}{e^x}=e^{1.01x-0.01x}=e^{0.01x}.$$
And here we see the problem: If $x$ is at all large, this ratio can be much larger than $1.01$.  Even if $x$ is, say, $10$, the error in the output is already about $10$ times larger than the $1$ percent error in our input.  This magnification of error is what is being referred to by sensitivity.
Comment: The derivative is particularly relevant when you're considering additive error (measuring error by the difference between your answer and the correct answer instead of the ratio).  The idea is that if we have a function $f(x)$ and instead of inputting $x$ we input $x+h$ for some small $h$, then the definition of derivative means we have $$f(x+h) \approx f(x) + h f'(x).$$  So the additive error $h$ got magnified by a factor of $f'(x)$, meaning you may have problems if $f'(x)$ can be large.
Comment: many thanks, I wish books were as good as you are in your explanations!
Comment: one more q. How the derivative of exponential function e^x predict it's roundoff error? The derivative is the same, e^x. I am confused here.


Sending Bitmap data over winsock? Winapi

Question: I am tring to send a screenshot of a desktop over winsock.
As such, there are four tasks:
<code>Save bitmap to buffer
Write data across wire using a socket
Read data from wire using a socket
Load a bitmap from a buffer
</code>
I have saved the bitmap to a char array using GetDIBits.
Writing the data to the server, I have done but I have questions.
For writing data over from server to the client, do I need to use only 1 recv() call (I am using TCP), or do i need to split it up into multiple parts? Ive read that TCP is stream concept and that I wouldnt have to worry about packets because that is abstracted for me?
How would I go about loading the information from GetDIBits into a bitmap and displaying it on the main window?
I am guessing I have to use SetDIBits, but into which device contexts do i use?
The Server screenshot capturer is here:
<code> HDC handle_ScreenDC = GetDC(NULL);
HDC handle_MemoryDC = CreateCompatibleDC(handle_ScreenDC);
BITMAP bitmap;

int x = GetDeviceCaps(handle_ScreenDC, HORZRES);
int y = GetDeviceCaps(handle_ScreenDC, VERTRES);

HBITMAP handle_Bitmap = CreateCompatibleBitmap(handle_ScreenDC, x, y);
SelectObject(handle_MemoryDC, handle_Bitmap);

BitBlt(handle_MemoryDC, 0, 0, x, y, handle_ScreenDC, 0, 0, SRCCOPY);

GetObject(handle_Bitmap, sizeof(BITMAP), &bitmap);

BITMAPFILEHEADER bmfHeader;
BITMAPINFOHEADER bi;

bi.biSize = sizeof(BITMAPINFOHEADER);
bi.biWidth = bitmap.bmWidth;
bi.biHeight = bitmap.bmHeight;
bi.biPlanes = 1;
bi.biBitCount = 16;
bi.biCompression = BI_RGB;
bi.biSizeImage = 0;
bi.biXPelsPerMeter = 0;
bi.biYPelsPerMeter = 0;
bi.biClrUsed = 0;
bi.biClrImportant = 0;
//std::cout<< bitmap.bmWidth;
DWORD dwBmpSize =((bitmap.bmWidth * bi.biBitCount + 5) / 32) * 4 * bitmap.bmHeight;
//int i = bitmap.bmWidth;
//DWORD dwBmpSize = 99;

HANDLE hDIB = GlobalAlloc(GHND, dwBmpSize);

char* bufptr = (char *)GlobalLock(hDIB);

GetDIBits(handle_ScreenDC, handle_Bitmap, 0, (UINT)bitmap.bmHeight, bufptr, (BITMAPINFO *)&bi, DIB_RGB_COLORS);

send(clientsock, bufptr , GlobalSize((char *)GlobalLock(hDIB)), 0);
/*Do i need to packetize/split it up? Or 1 send() is good for the matching Recv on the client?*/
/*I am assuming i must send bi structure over winsock also correct?*/
</code>
And The receiveing client code:
<code>        case WM_PAINT:{

        //Im a Gdi beginner so I dont have a clue what im doing here as far as blitting the recved bits, this is just some stuff i tried myself before asking for help

        PAINTSTRUCT paintstruct;

        HDC handle_WindowDC = BeginPaint(hwnd, &paintstruct);

        handle_MemoryDC = CreateCompatibleDC(handle_WindowDC);

        handle_Bitmap = CreateCompatibleBitmap(handle_WindowDC, 640, 360);

         std::cout << SetDIBits(handle_MemoryDC, handle_Bitmap, 0, bi.biHeight, buffer, (BITMAPINFO *)&bi, DIB_RGB_COLORS);

        SelectObject(handle_MemoryDC, handle_Bitmap);

        StretchBlt(handle_WindowDC, 50, 50, 640, 360, handle_MemoryDC, 0, 0, x, y, SRCCOPY);

        EndPaint(hwnd, &paintstruct);

    }
</code>
Answer: Sockets do have limited buffer sizes at both ends, typically around 4000 bytes.  So if you dump a large block of data (like a full screendump) in one call to a non-blocking send, you will likely get errors, and you will need to manage your own buffers, calling multiple sends.  However, if you are using non-blocking socket, you should be OK, as send() will simply block until all the data is sent.
On the receiving side, it is a similar case - a blocking receive can just keep waiting until it has the full data size that you asked for, but a non-blocking receive will return with whatever data is available at that time, which will result in the data filtering through bit by bit, and you will need to reassemble the data from multiple recv() calls.
I have heard of issues with sending really large blocks of data in one hit, so if you are sending 5 megabytes of data in one hit, be aware there might be other issues coming into play as well.


How to get more than one uart interface

Question: Ok, I have one uart interface (TXD GPIO 14, RXD GPIO 15). I want at least one more uart interface.
Possible solutions:

Bit banging:
Use two unrelated spare GPIOs. I understand that timing is a problem on a standard linux. Would it be reliable with very low baudrate?
Switching:
RPI decides when to talk to which device. Using e.g. CD4066BC.
spi to 2 x uart bridge:
Didn't find a suitable part (availability, price, dil package)
usb to uart:
Expensive

Are there other options? I'm inclined to switching, if it can be done. What would you advise?
Comment: related: ["PiGPIO Library Example for Bit-Banging a UART"](http://raspberrypi.stackexchange.com/questions/27488/pigpio-library-example-for-bit-banging-a-uart)
Answer: A USB UART, such as FTDI, isn't really expensive. All your other options sound like they will cost you more in parts and time than the ~$13 it might cost you, and be unreliable or slow. Just go for the fast and trouble-free option, such as:
http://www.dfrobot.com/index.php?route=product/product&product_id=147#.UOamLG-sh8E
Sparkfun sells one too. In fact, maybe you can just pull one out of some old USB device or buy one from a junk store that doesn't know what it does.
I messed with an SPI to UART adapter for an Arduino project, there was no existing library so I wrote my own. In the end it worked ok, but if I could have just dropped in a $15 part I would have. In fact given the time it cost me I should have just got a mega with 4 serial ports.
Alternatively if you want lots of serial ports you could look at RS485 serial, which is similar to 232 (though not compatible), which supports multi-drop, ie several interfaces over the one line.
Comment: This is also easies option from software point of view. FTDI has Linux driver support out of the box. All other option will require painstaking driver work.
Comment: The cp2102 is my favorite usb uart chip. A quick amazon search reveals them for $6.99 (edit actually $1.50) with a cable included! Can't beat that!
Answer: The Raspberry Pi 4 supports up to 4 UART interfaces now that need to be enabled by means of an device tree overlay. You can find how to do this and which Pins are used here for now:
https://www.raspberrypi.org/forums/viewtopic.php?t=244827
The RPi foundation is still preparing the documentation for this.
Answer: I found what you are looking for: an I2C/SPI slave to UART/IrDA/GPIO bridge.
They come in single and dual version (so 1 or 2 extra UARTs). They (NXP) also (for the other side in case needed) have I2C/SPI master to UART/IrDA/GPIO bridges.
More information can be found about these chips here and the master counterpart.
Maxim also has chips that do the exact same thing.
Comment: Here's the relevant datasheet: http://www.nxp.com/documents/data_sheet/SC16IS752_SC16IS762.pdf?
Comment: Good info, but the NXP links give HTTP 403 here.
Answer: If you decide to skip adding extra hardware and just go the bit-banging route, this isn't as difficult as some picture it.
First off, your communication thread must go realtime:
#include<sched.h>

struct sched_param param;
param.sched_priority = sched_get_priority_max(SCHED_FIFO);
if( sched_setscheduler( 0, SCHED_FIFO, &param ) == -1 )
{
        perror("sched_setscheduler");
        return -1;
}

From now on, your thread will not be pre-empted for 950ms out of each second*, unless it returns control willingly (through sched_yield(), or usleep()) in timely manner, which will not make it pre-empted ever. With 850MHz CPU your bit-banging loop will be running idle most of the time even at fastest speeds.
Now unfortunately the requirement to return control from time to time means while your thread is sleeping, whatever your "opposing party" sends, would be lost forever. But for that purpose you could use transmission control. Either allocate some more GPIO for CTS line which you pull down before yielding and back up upon restoring control:
  bcm2835_gpio_write(CTS_PIN, LOW);
  usleep(10);
  bcm2835_gpio_write(CTS_PIN, HIGH);

or (IMHO preferably) use XON/XOFF transmission control - send the XOFF character over RS232 before sleeping, XON after you resume operation. The default ASCII codes for these are '\x13' for XOFF/"stop sending" and '\x11' for XON/"resume sending".
Of course your remote device must obey these. If it doesn't, some data will be lost.
Answer: USB to UART bridges are cheap and readily available, but have really lousy timing characteristics.  Newark sells an "Embedded Pi" board which has an STM32F ARM processor that you can write bare-metal code on.  That chip has three UARTs on it, and I think they can go pretty fast; if you were to use one to communicate with the Raspberry Pi that would leave two available for other purposes.  Disclaimer: I've bought one of these boards, but have as yet simply used the Raspberry Pi itself to handle by I/O needs directly.
If you want lots of slower UARTs, the STM32F on the Embedded Pi board could probably handle a fair number, especially if you're willing to write some Arm assembly language.  If there are two groups of 16 I/O pins available on a single board it might be possible to have 16 simultaneous software UARTs all working at once at a pretty decent baud rate (have a periodic interrupt at 3x or 5x the baud rate which stores 16-bit latched values from the receive port to a buffer, and outputs 16-bit precomputed values from a buffer to the transmit port; if you do this, then provided the average servicing time for the software UARTs isn't too great, it won't matter if there is an occasional worst-case hit (e.g. all sixteen ports receiving a byte simultaneously).
This approach can actually work out remarkably efficiently for receiving, since the "common case" code doesn't even have to look at individual UARTs.  Suppose that you're sampling data at 5x, and the last 47 bytes of the buffer are duplicated immediately preceding it.  Assuming data is written to the buffer in ascending order, you can then check whether any byte has been fully received on any of the 16 channels by simply saying:
bytes_ready = (armed_flag & data[rxptr] & ~data[rxptr-47] & ~data[rxptr-46] & ~data[rxptr-45] & ~data[rx_ptr-44]);

If bytes_ready is zero, no data has been received.  Otherwise, if e.g. bit 2 of bytes_ready is set, that means that a received data byte may be found in bit 2 of data[rx_ptr-40], data[rx_ptr-35], data[rx_ptr-30], etc.  Once one grabs the data, clear bit 2 of armed_flag and arrange for it to get re-set after about 44 samples.
This approach will require a bit of work on those samples where a byte of data is fully received (and potentially a lot of work if all 16 channels have a byte of data arrive at once) but on most samples the amount of work will be very slight.  If one had 64 I/O pins, one could handle up to 32 UARTs using this approach without adding any extra work to the "common" case.
Answer: A microcontroller like a Picaxe could take serial data in on one pin and output serial data on a certain pin appropriately. This would effectively give you more serial outputs if you were prepared to have to tell the Picaxe which pin to output on. It could also do the same, but in reverse, so it could receive serial data from multiple devices and send it to the Raspberry Pi.
Another option could be to make connected devices require a qualifier. This means that Device 1 would have to receive the data 'd1', for example before it will listen to further data on the serial line. Device 2 could have 'd2' as its qualifier. This would mean that to say 'hello' to Device 1, you'd just have to send 'd1hello' on the UART line.
Picaxes are fairly cheap, you can get them over at http://www.techsupplies.co.uk/ and they come in numerous sizes with different numbers of pins and so on.
Answer: If the communication to the several UART slave devices does not need to occur in parallel, you could share the one available UART port between them.
You could use transistors to enable only the RxD/TxD connections to the device you currently wish to talk to. These transistors can be controlled by other Raspberry Pi GPIO pins.
Answer: I had the same problem. I need connect to 2-4 GSM modules and I found hardware solution: http://www.instructables.com/id/SPI-to-4-x-UART-Bridge-MULTIUART/
This solution are base on PIC24FJ64GA306. You can replace PIC with Atmel mcu, but You must create new PCB :)
Answer: I'm using SC16IS752 IC which is SPI to 2xUART converter. It works well with Raspbian Stretch.
It is a bit more expensive than FTDI chip, but there are two uarts and I don't have to use precious USB port.
Answer: For any projects in which USB UART is not an option, additional UARTs must be implemented through the GPIO pins, and using a lower-powered Raspberry Pi (e.g., Pi Zero) other than the version 4, which is now equipped with 4 serials, adding extra serial interfaces could be done by using soft_uart. The module can convert any two of the digital pins into a soft serial interface (e.g., /dev/ttySOFT0).
Because UART is software-based, the communication needs to be undertaken in a low baud rate. Although the README suggests it to be 4800. I found a value lower and equal to 2400 is relatively stable.
Installing this requires compiling the module from source, it is suggested that user update Raspbian up to date and install kernel headers by
apt-get install raspberrypi-kernel-headers

to ensure the kernel version matches with the header version.
Answer: Another solution is to move up to a PI4 apparently you can enable multiple uart pins on that one (did it myself)
You can google the info up, it is mostly a config setting to enable the additional uart pins.
https://www.raspberrypi.org/forums/viewtopic.php?t=244827
This explains it.
Apparently the new gpio pins in the pi4 basically allow to add 3 additional uart ports via the config.txt, for further details on how to set it up, check the link.
Comment: For a good answer you should explain how to setup it otherwise you risk to get downvotes.

How to get more than one uart interface


Additional Data is not being imported into produces (full imports and focus additional data imports)

Question: FIRSTLY I should note that all product data is importing correctly except the additional_attributes column.
I've been struggling for the past few hours with getting additional data imported into my products. I have succeeded in importing products into Magento however none of my custom additional data is being imported. I've looked on this forum and other places for guidance and tried a multitude of solutions including importing data with only the product sku and additional data however this hasn't been successful.
The additional attributes work as intended, values can be inputted in the additional attributes under the product and the persist after a reload and are stored in the database. However when attempting to load the min from a CSV it is unsuccessful.
I've tried to export and import an existing product (deleting the exported product before importing) without making a single change to the CSV file but this is still failing to import the additional data.
Would appreciate any potential solutions or guidance to fix this issue as I have a CSV of over 1000 products that need to be imported and I don't want to have to fill out the custom data for every single product.
Example data:
<code>sku,additional_attributes
TN9BIXJY,JMP_CROWN_NUMBER=MB394
</code>
Upon reviewing both System.log and Debug.log there is no signs of any errors occurring during the import.
Answer: For anyone else with similar issues, seems that capitalization in attribute names doesn't work for importing. Lowercase and special characters (_) seem to work fine though.


Do all the orbits of planets in the Solar system fit in a (imaginary) cone?

Question: So that all the elliptic orbits can be seen as slices from the cone while the sun is a shared focus.
Comment: Given an ellipse with eccentricity $e$ and semi-major axis $a$ and a cone with aperture angle $\alpha$, there always exists a way to slice the cone such that the section is the ellipse. So the answer is trivially yes, if I interpret the question correctly
Comment: Is the question whether each of hte planetary orbits fit into an imaginary cone of its own, or whether all of the planetary orbits fit into one single imaginary cone?
Answer: Almost, but each orbit corresponds to its own imaginary cone. Planets have different inclinations and directions of the plane.
The link between the angular momentum and energy of the planet and the size of the cone is somewhat involved but beautiful; see Greg Egan's explanation of Dandelin spheres.
Answer: Yes and no.
What you seem to really asking is about the idea that the four types of orbits a body can have (circular, elliptical, parabolic, and hyperbolic) are also conic sections. In an ideal case where you use Newtonian physics and have just a single planet and single star, yes you'll get those conic sections. However, the planets in our solar system do not follow orbits which are perfect conic sections for a few reasons.

Our solar system has several planets in it, all of which are affecting the orbit of the others. While the Sun is the predominant factor in any planet's orbital parameters, the other planets have non-zero, measurable effects. For the Earth, the perturbations from other planets (primarily Jupiter and Saturn) is described by the Milankovitch cycles which are measured variabilities of the Earth's orbital parameters. What this means is that, at a fine scale, the Earth's orbit (as well as the other planets) is not a perfect, closed ellipse and does vary slightly from a conic section.
Newtonian physics is great for most scenarios, but in some cases, General Relativity starts applying. A specific example is Mercury. Mercury's orbit is greatly perturbed by the other planets, as described in point (1), however there are additional relativistic effects that cause Mercury to have an unclosed orbit. This effect is usually called the perihelion precession of Mercury and results in an orbit that differs quite significantly from a standard conic section.


Field can not be filtered in SOQL query call

Question: Here is my SOQL code for finding records to update but it is generating a compiler error like "field 'Chatter_Monitor_Policy_Keyword__c' can not be filtered in query call". Why can't I filter by this field?
string abc = obj[0].Chatter_Monitor_Policy_Keyword__c;
string s ='%'+ abc + '%';
List<Chatter_Monitor_Policy__c> records = [SELECT Id, Chatter_Monitor_Policy_Keyword__c from Chatter_Monitor_Policy__c where Chatter_Monitor_Policy_Keyword__c Like:s and CreatedById =: UserInfo.getUserId()];
if(records.size()!=null)
{
  for(Integer i=0; i<records.size(); i++)
  {
    records[0].Chatter_Monitor_Policy_Keyword__c = s;
    update records[0];
  }
}

Answer: Textarea field types are filterable, but it needs to be done in the QueryResult
Quote from SOAP API page

Textarea Field Type
Textarea fields contain text that can be longer
  than 4000 bytes. Unlike string fields, textarea fields cannot be
  specified in the WHERE clause of a queryString of a query() call. To
  filter records on this field, you must do so while processing records
  in the QueryResult. For fields with this restriction, its filterable
  field in the Field type (described in the fields property of the
  DescribeSObjectResult) is false.

So get the query results into a queryresult object, and filter over each of the returned objects.
Comment: Great find but do you have any examples on how to use QueryResult? I can't seem to find any examples on that link ...
Answer: As indicated in the attached screenshot, check the "filterable" acces property of field in schema browser (Force.com IDE etc). This property indicates whether the field is filterable (true) or not (false). If true, then this field can be specified in the WHERE clause of a query string in a query() call. More details here : http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_describesobjects_describesobjectresult.htm
Comment: Thanks. This was blocking me. You can also view the Schema in the Force Explorer AIR app if you don't want to use the Force.com IDE.
Answer: If Chatter_Monitor_Policy_Keyword__c is a text area then you can't filter by it, though if it truly is a keyword (or short list of keywords) then it should just be a text field which you will be able to filter by.
Can you confirm what type of field you are using? If it is a text area then I'd suggest changing it to a text field if possible.
If you absolutely can't change the field type, then you're probably limited to selecting all of the records and performing the search in code — to do this you'll likely need to leverage a batch apex class to process the data volumes involved.
Comment: @KishanTrambadiya You need to make it something **other** than a text area!
Comment: @KishanTrambadiya - well you can't filter on it then
Comment: yes Chatter_Monitor_Policy_Keyword__c is text area
Comment: That's your answer then — unfortunately you can't filter by text area fields in SOQL!
Comment: Then what is the exactly solution for that???
Comment: aah the problem is resolved here in the mean time, I was trying to figure out the answer :) SE rocks !
Comment: @KishanTrambadiya - does it really need to be a TextArea? Can you make it a Text field instead?
Comment: @KishanTrambadiya Text and TextArea are two different field types. You can filter on Text; you cannot filter on TextArea. Changing `Chatter_Monitor_Policy_Keyword__c ` to a Text field will allow you to filter on it.
Comment: @metadaddy - i cant make it text field...
Comment: @metadaddy - i asked question as i want any other alternative instead of this.
Comment: @KishanTrambadiya As metadaddy has mentioned with textarea we cant filter, if you need to filter you need to use textfield.
Answer: This is an old thread but I hope my SOSL solution can help others. Actually, we can use SOSL as a workaround to turn Textarea field types into filterable/searchable field. See code sample below
String fieldValue = 'somevalue';
String fieldName = 'MyTextAreaField__c';
String query =  = 'FIND {"'+ fieldValue + '"}  RETURNING ' +
                  ' YourCustomObject__c (id, ' + fieldName + ' ) LIMIT 2000';
List<List<SObject>> searchList = Search.query(query);//Return List of SObject list
system.debug('Search result: ' + searchList[0]);//Get search result
if(searchList[0].size() > 0) {
   //You can cast your result and return other fields if needed
   List<YourCustomObject__c > objSearchResultsList = (List<YourCustomObject__c >) searchList[0];
   system.debug(fieldName +' with "' + objSearchResultsList[0].get(fieldName) + '" found. ');
 }

If your search result has record, the sample output will be:
Search result: (YourCustomObject__c:{Id=aeb02000000000LXXX, MyTextAreaField__c=somevalue})
MyTextAreaField__c with "somevalue" found.


Super Mario Maker startup

Question: My son is getting Super Mario Maker for Christmas.  He has plenty of experience with the Mario side-scrollers.  Will he be able to put the disc in and go, or does the game require any initial setup?  I know that you can download levels from other players, but does it also come with some "factory-installed" levels?
Comment: If you have questions along the way don't hesitate to ask me again!
Answer: No initial set-up is actually required, once you put the disc in you have 3 choices.

Go on "adventure mode" which makes you play random levels depending on the difficulty you pick. This is found by clicking on 100 Mario Challenge. (Click play)
Start creating a level with the items you get by default. This can be found by clicking make, and not play.
Play levels online. Which can be found by clicking on Courses. (Click play)
Comment: No mention of the 10 Mario Challenge, which is solely levels made by Nintendo?
Answer: Note that there have been some free updates to Super Mario Maker since it's launch, which will require downloading and installing, and you might be unable to use the online modes until you do so. This should not prevent you from playing the game offline, however.
In terms of offline content, there is of course the level editor, which the game gives a tutorial on the first time you play. Additionally, there is the 10 Mario Challenge, in which you play through 8 courses created by Nintendo designers. There are a few dozen such courses, and after completing a course it becomes available to play around with in the level editor.
Comment: The updates happen automatically, this is not initial set-up therefore it was not very useful to point out. All updates needed for the game take no more than 20 minutes.

Super Mario Maker startup


Is applying sindoor compulsory after marriage?

Question: Is applying sindoor after marriage mandatory or just a choice? Do Hindu scripture say anything about applying sindoor after marriage?
Comment: Neccessary or not, it depends on reason of using it. If the reason is valid enough to use then we have to use it else ignore. So your actual question should be like: Why women use sindhoor after marriage?
Comment: Related: [Why Hindus wear red tilak and sandal wood tilak on foreheads?](https://hinduism.stackexchange.com/q/163/1049)
Comment: one simple reason if you're not very religious - is to easily declare to the world that you're a married woman, so that other men treat you with respect and distance. If people didn't know whether you were married just by looking at your face, they could behave inappropriately.
Answer: The book Dharma Bindu quotes Veda Vyasa as follows:

Vyasa Maharshi gave the instructions as follows:
Haridraamkumkumamchaiva sindhuram kajjalam tathaa, Kurpaanakam
  cha taambolam mangalaabharanam shubham| Kesha samskaara kabari
  kara karnaad bhushanam, Bhartur aayushyami -cchanti dooshayenna
  Pativrataa| Praatah kaaletu yaa naari dadyaadarghyam
  vivasvate, Sapta janmaani vaidhavyaam saa naari naiva pashyati|
..................
Those women who are interested in the longevity of their husbands
  should not to ignore the high significance of turmeric powder,
  kumkuma, eyetex, vastra, jewellery like ear studs, bangles, necklaces
  etc. As at the early mornings, women offering Arghya or water for
  worshipping Surya Deva would avoiod widow hood for seven births ahead!

So, scriptures definitely talk about the importance that Sindhoor or Kumkuma has in a married Hindu woman's life.


Lubuntu minimal install?

Question: I have a computer that only accepts CD's, can't boot from USB at all, and I have a bunch of 600MB CD's. The Lubuntu install image is closer than many, at 700MB, but not quite close enough to be able to burn it. I don't want to start from a server install as it doesn't have wireless (it's a desktop) and I'm sending it to someone after installation so they need to be able to, as novice computer users, autonomously set up the thing. I need it to install with the full GUI but none of the normally included programs, like the mail client, music players, that kind of thing since they can install all of that on site with direction once it's connected to ethernet and they open the browser. Any ideas how I can install Lubuntu on this thing from an image that will fit on a CD?
Comment: I added an update with a link to the Lubuntu "Alternate" install for resource strapped pcs and the iso is small enough to burn to a 600mB CD.
Comment: Also,If you don't have network access, Debian has full installation disk sets available. http://cdimage.debian.org/debian-cd/7.8.0/i386/iso-cd/ There are multiple disks and the installer has the option to change disks to install more packages. You should only need the first disk or two to do the initial installation if you don't feel like downloading the whole set, it isn't necessary. You will have to manually edit /etc/apt/sources.list after install to use apt-get online or you can just install apps from the disk set. The largest is 650mB so not quite sure if it'll fit on 600 though.
Answer: Instead of using CD's you could try network-boot the machine on the minimal ISO (if Lubuntu comes with netboot stuff)
I would then install Lubuntu to the desktop, followed by rebooting to the desktop hard drive and running
sudo apt-get install lubuntu-core

You may need to modify /etc/apt/sources.list to a non local server and then run
sudo apt-get update

You may also want to use
sudo apt-get install lubuntu-core --no-install-recommends

However I have not tried this.
Comment: I don't have network access on the machine
Comment: If you have a spare router, 3 or 4 Ethernet cables and a existing machine you're happy to act as the netboot server, it should work. You'll just make a non internet connected LAN network
Answer: Yep, you can use the mini.iso instead. It's like 32mb total and it does an install similar to tasksel like Debian or Ubuntu server where you can choose what to install and it will install it. This also allows the option to not install all the bloat you normally get with a desktop install.
BTW, I do not believe you should install any of the "live" desktops listed. I believe those are not for installation purposes.
https://help.ubuntu.com/community/Installation/MinimalCD
I believe 14.04 installs a minimal command line environment first, then reboot and type
tasksel

14.10 and newer have a better interface that lets you choose the desktop or apps to install right away. Just choose command line install or graphical install (I think they are actually the same).
NOTE: because of a bug in tasksel, DO NOT use tasksel to uninstall packages. ONLY use tasksel to install.

UPDATE
I think I found what you are looking for, it's called "alternate install" for Lubuntu and it's for pcs that can't handle the full Lubuntu version and or need to install using a CD rather than a DVD or a USB. The iso is 617mB, however, when you burn the iso to disk it should fit within 600 because the 617 includes reserved space, title of the file, etc ...
http://cdimages.ubuntu.com/lubuntu/releases/trusty/release/lubuntu-14.04-alternate-i386.iso
Also, other processor versions (for older processors) are available at the Lubuntu/Alternate_ISO wiki.
Finally, if you don't have more than 700mB of RAM, you should select the installer from the first boot menu and do not select the installer from the "try Lubuntu" interface as the "try Lubuntu" option uses 200mB RAM to run the desktop.
Comment: right but I'd really like to have a full install already set up, minus some of the programs that put the ISO over 600MB, as the user isn't as computer savvy as most could assume but outside of internet I don't have any way to reach them. I can't talk to them now nor until they have firefox open and are signed into their account
Comment: If I were to do a network install they'd have to do it, and I don't think they're comfortable enough with the command line to do that
Comment: I found a 750MB CD but it would still be nice to know how to in the future...
Comment: @sbergeron if they install >=14.10 (14.10+) using the mini.iso, I do not believe there is any commandline involved (even if you choose the command-line install) 14.10 and newer use a GUI. The only tricky part is that you have to use the spacebar to select your desktop. Follow the defaults and everything goes good. All you have to do is scroll down the list and select "lubuntu desktop" and press enter, then accept defaults after that; it's pretty easy. Personally, I prefer the cli interface but the GUI isn't bad. Like I said, it's alot like the red white and blue debian installer.
Answer: I suppose the machine has USB. Then it's possible to boot from Ultimate Boot CD and run Plop Boot manager from it to boot from the usb stick. (other boot managers on UBCD but Plop was the one I got working)
Comment: Yes, I had a laptop that had no boot option for usb but this worked. A pc has got to be very old not to have usb at all and as long as f.ex Plop can see the usb it can boot it. This works on many machines with no bios usb boot option.
Comment: Unfortunately, this was done on an old enough machine that it didn't support booting from USB. Thanks for the help, though :)
Comment: The OP expressively states "can't boot from USB at all" .
Answer: I found an alternate method that works...I created a grub rescue CD and then used that to chain load a LiveUSB stick, but at the same time I'd still really like to know how I could custom make an install image without some of the included software suite...all of it being possible to obtain from the ubuntu software center.
Comment: Ubuntu Customization Kit should do it.
Answer: There are some bigger CDs out there(700MB+). If you are able to buy them, try it out and get yourself a live CD, with the normal install. I, myself, have a 12 year old PC that runs Windows XP and I installed the normal installation, works perfectely. If you're really afraid that full/desktop won't work, try out the alternate, as @mchid said. I think 15.04's .iso is too big for a CD, so I think 13.04 or similar will suffice.

Lubuntu minimal install?


What is the best way to insulate block walls?

Question: I am building a block building for a slaughterhouse and I was thinking about filling the block with sand for insulation. My goal is to be able to keep the rooms as cool as possible was wondering if sand would be a good idea thanks.
Answer: Sand could be an acceptable material for heat storage but still not as good as water. Sand has heat capacity of 0.83 kJ/kgK, but with density of 1600 kg/m3. Water has heat capacity of 4.19 kJ/kgK, but with density of 1000 kg/m3. Thus, one liter of sand stores 1.32 kJ, but one liter of water stores 4.19 kJ (per Kelvin). One area where sand excels is if you have the ability to heat it to above the boiling point of water (such as by using power plant waste heat). If you can't then water would be more ideal for heat storage.
As for insulation, sand has heat conductivity of 0.25 W/mK. Polystyrene foam has 0.03 W/mK thermal conductivity. So you can see sand is nowhere close to real insulators.
My advice is to use water if you want to store heat, and use real insulators if you want to prevent heat transfer. If you want to use both, use both water for storage and real insulators for preventing heat transfer. Don't try to cheap out and use sand, because it's a very bad material for either use.


What are shapefiles, layer files, and databases and what are their relationships?

Question: What exactly is a shapefile in ArcGIS, and how is it related to a database or a layer file. What are the differences between these 3 things?
Answer: A shapefile is a simple, nontopological format for storing the geometric location and attribute information of geographic features. Geographic features in a shapefile can be represented by points, lines, or polygons (areas). The workspace containing shapefiles may also contain dBASE tables, which can store additional attributes that can be joined to a shapefile's features. It is worth noting that shapefiles have no relation to databases, rather when shapefile features are added to a database they are transformed into database rows, which have no direct relationship to the source feature.
In comparison to a shapefile, a layer file is a just a link\reference to actual data, such as a shapefile, feature class, etc. It is not actual data because it does not store the data's attributes or geometry. A layer file primarily stores the symbology for a feature and other layer properties related to what is seen when the data is viewed in a GIS application.
A database is where you can store the collections of data that the GIS software can pull from to recall information stored within it when needed. Databases often have various ways to retrieve information stored within them.
Comment: Since this is a place where folks get tripped up, I'd recommend that you mention that shapefiles have no relation to databases, and that when shapefile features are added to a database they are transformed into database rows, which have no practical relationship to the source feature.
Comment: @RandomUser The technical white paper for the data structure of a shapefile was published by ESRI in 1998 (making it open-source domain), which is why QGIS and many other open-source GIS platforms can decipher them (as opposed to GDBs and feature classes, which are still proprietary). Everything you need to know about shapefiles! Here's the link: https://www.esri.com/library/whitepapers/pdfs/shapefile.pdf
Comment: Since there may be a "practical" relationship (based on attribute keys), I'm going to tweak that to "direct".


Command to send public key to remote host

Question: I remember there is a command to send public key to the remote host that I want. I want to use that feature to send one of my public keys to the other host. How can I do that?
Answer: You are looking for ssh-copy-id.  All this command does is create .ssh and .ssh/authorized_keys and set their permissions appropriately if they don't exist.  Then it appends your public key to the end of .ssh/authorized_keys.
Comment: Great. Just run `ssh-copy-id root@server`.
Answer: You might be looking for this command:
cat ~/.ssh/id_rsa.pub | ssh user@hostname 'cat >> .ssh/authorized_keys'

It appends your public key to the servers authorized keys.
Source
Comment: This is more portable than the accepted answer, since not all systems (I'm looking at you, OS X) have `ssh-copy-id`. Although, personally, I'd modify it slightly to `cat ~/.ssh/id_rsa.pub | ssh user@hostname 'tee -a .ssh/authorized_keys'`, but that's just personal preference.
Comment: Looks like ssh-copy-id is part of MacOS Sierra, which is nice.
Answer: If your server is already set up to not accept password-based login, you might get a Permission denied (publickey) error.
This is another method to send the key, using netcat, so you don't have to authenticate.  It will only work over a local network, but you can use port forwarding to do this over the internet.
On the server:
$ nc -l 55555 >> ~/.ssh/authorized_keys

On the client (replace HOSTNAME with the hostname or IP of the server):
$ nc HOSTNAME 55555 < ~/.ssh/id_rsa.pub

You can replace 55555 with an open port of your choice.
source: chat over lan from linux to linux?

Appendix for total newbies: I don't think anyone's mentioned this yet, but if you get ERROR: failed to open ID file '/home/username/.pub': No such file, you need to generate a key first.  The Ubuntu help pages have a great guide on Generating RSA Keys.
Answer: In other answers there's no example for ssh-copy-id so here it is(first you need to generate the key)
ssh-copy-id user@url


Is messy or fast handwriting related to high IQ?

Question: Is there a study that proves that people with messy or fast handwriting have a high IQ?
Answer: Not that I know of. As far as I know, fast handwriting that ends up shortcut-y to the point of illegibility is mostly associated with amount of handwriting experience. Spend a few decades doing a lot of writing by hand and your handwriting will look like that.
And then there's dysgraphia, which I'm not aware of being correlated with intelligence either way.


Are photons ejected from atomic nuclei?

Question: I have heard that electrons absorb or eject photons when transitioning from one orbital to another. Is this correct? Can atomic nuclei eject photons?
Comment: Yes, gamma rays, but it's about physic not chemistry.
Comment: What about photons?
Comment: Well, you should know that gamma rays are photons
Answer:
I have heard that electrons absorb or eject photons when transitioning from one orbital to another. Is this correct?

Not exactly.  The atom as a whole emits or absorbs the photon.  There is no reason to single out the electron versus the nucleus in such transitions.

Can atomic nuclei eject photons?

Yes there are two ways a nucleus in particular (as opposed to an atom taken as a whole) can emit photons.
First, nuclei can exist in excited states. When an excited nucleus transitions to the ground state, a photon in the gamma or X-ray range of the electromagnetic spectrum is emitted.  Electrons do not have an analogous mechanism for emitting photons, because electrons are fundamental particles, while nuclei are not.
Second, if a nucleus has a nuclear spin (S), then in a magnetic field there will exist  2S + 1 quantized energy states of the nuclei.  Transitions of nuclei between these states emit or absorb photons, the energy of which depends upon the strength of the field, for example in the radio frequency range.  This is the basis of NMR and MRI.  The electron has an analogous mechanism for emitting photons, known as ESR or EPR.
Comment: At least in my area of physics/materials science, we consider gamma rays to come from nuclear transitions, and x-rays to come from electronic transitions (which is why the energy ranges overlap).
Comment: @JonCuster maybe I should say "high energy" or "KeV-MeV" instead of  "gamma or X-ray range".

Are photons ejected from atomic nuclei?


Why did Friendly Orderly not remove the implant himself?

Question: In Chapter Seven of Stranger Things 4, the Friendly Orderly character shows Eleven a small implanted device in his neck, just under the skin. El rips the item out with her telekinesis. Since this was such simple surgery, why didn't Friendly Orderly do it himself with a knife or another instrument? It would be painful, but not any more so than what El did. And as we see later in the episode, it was extremely important to him to have it out.
Answer: This very implant was not only used for tracking him but also to make him weak. He cannot use his powers due to that. It is called Soteria, who is a goddess of safety and salvation, deliverance, and preservation from harm in Greek mythology. It explains why he is weak and cannot use his powers. This is why he couldn't remove the implant.

Friendly Orderly: Here. Can you feel it? Your papa calls it Soteria. It weakens me. It tracks me.

From an article by Bustle(emphasis mine),

After Eleven slipped another orderly on the way to the infirmary, the pair rendezvoused and One explained the limitations of his powers. He explained that Brenner had implanted something called Soteria in his neck. "It weakens me. It tracks me." (Interestingly enough, Soteria is also the Greek goddess of safety, and deliverance and preservation from harm.) Because he'd helped her, Eleven then restored One's powers by using her own abilities to telekinetically remove the implant from his neck.

So, when Eleven removes it, he gets his power restored which he unleashes on the guards and almost everyone in the Hawkins lab. From the same article,

No longer inhibited, One unleashed his powers on the guards before revealing his 001 wrist tattoo to Eleven.
Comment: It's a given that it suppresses his power, but OP asks about simple surgery.
Comment: Yes, I meant using a knife or anything like that. It's clear that it suppressed his powers.
Comment: Ahh, okay. It wasn't clear at first. After watching the episodes again, it is not clear why he couldn't remove the implant. It looks like a plot-hole.
Comment: I tried not to have a spoiler because I know people don't like that around here, but was what I meant by the last sentence "extremely important to him to have it out". Thanks! Maybe backstage info will emerge eventually.
Comment: (Also why I called him Friendly Orderly and not other names ;)
Answer: The only somewhat plausible explanation would be that it was very important to him to win over Eleven as an ally. He kept back and made it look like he was relying on her. Her removing the device started to look like a stepping stone in them bonding.
I'll concede that still leaves a window where the Friendly Orderly should have been able and motivated to remove the device. So far we can only speculate. Maybe he was formerly far more heavily restrained and the device and his working as Orderly only came when Eleven was already there, at which point he decided that he wanted here as an ally.
Edit: TV Tropes has two theories that are very relevant (yet not perfect): Either the Friendly Orderly is Eleven's father. Then he would have waited long enough for her to be somewhat self-sufficient to take her with him (but then why not leave a few years earlier?). The other is that he is grooming her to have children with her (but then why not wait a little longer?). In both cases her beating Two could have been the signal for the Friendly Orderly to leave.
Comment: I also was thinking on this line...you may be right that it's the only plausible explanation.
Answer: Like a prison, I would think they'd keep sharp objects like knives and surgical instruments away from the kids and staff. I mean, can you imagine if one of them had access to a knife? Glass, scissors - I'm sure the place was secured ahead of time.
Answer: Much of this season didn't make sense, but here's my explanation...
Nobody had any idea how 1's powers worked, and they were entirely mental in nature.  So the implant didn't (couldn't) suppress them by some sort of magical physics that prevents Powers.  Instead, it is the interface to some sort of brain implant set to scramble mental functions whenever the pattern of activity looks "unusual".  It would be a little like a lie detector, if you believe in lie detectors.  If its design worked perfectly, any time our hero would think of using his powers, fondling spiders, or trying to escape himself, it would have some way to scramble and reset his thinking.  But his exhortation to 11 to use her powers was pretty much like his ordinary work in the lab, so it didn't flag it and reset his thoughts.


Unable to Create Power Apps Nested Galleries From Multiple Lists

Question: I have two SharePoint lists that are linked together through a lookup field. I am trying to visualize these two lists in a single PowerApps visual using a Nested Galleries approach, where Gallery 1 will contain the Domains, and then Gallery 2 will be nested and contain the specific Sub-Domains underneath their respective parent Domain.
I can get the data for both Domain list and Sub-Domain list to populate in the respective galleries; however, I am unable to properly filter the Sub-Domain gallery so it only displays the items that fall under the parent Domain. What I need is to create a filter in the Gallery2 Items which looks approximately something like this Gallery2 Items = Filter(SubDomainDataSource, Gallery1DomainItem = ThisItem.ParentDomainLookupField)
There are two problems that I am encountering which prevent me from filtering appropriately:

I don't know how to access the parent object in the nested gallery in order to compare against the current Domain item that acts as the parent
I don't have access to the lookup field in the SubDomain data source, it simply does not appear in Power Apps as an available field to reference. All other fields are available except for the lookup field, so even if I could access the parent object from #1 I cannot get access to the necessary key value in the child gallery in order to tie the data together.

Example of Lists:
List 1:

Domain

Dom1

Dom2

Dom3

List 2:

Sub-Domain
Parent Domain (lookup field to List 1)

SubDomA
Dom1

SubDomB
Dom1

SubDomC
Dom2

SubDomD
Dom2
Answer: In the second Gallery → Items Property → Set the formula like this :
Filter(Subdomains,ParentDomain.Value=Gallery1.Selected.Domain)

Here is my try :

Domains List :

Subdomains List

And here is the result :
https://gfycat.com/acrobaticshallowblacklab


Which elements or isotopes can be analyzed by Neutron activation analysis (NAA)?

Question: Some sources name only a handful, but that might refer to the use of optical film. Others state more than 70. I would like to know which elemets or isotopes can be detectet/imaged by NAA.
Answer: NAA depends on the capture of a neutron by a nucleus which results in the production of a heavier radioactive nucleus.  Many nuclei will become radioactive after capturing a single neutron. Some nuclei may require 2 or more extra neutrons before becoming radioactive.  The probability of producing a radioactive nucleus will depend on the nuclear neutron capture cross-section. The probability of a neutron being captured is small. If a nucleus requires 2 or more neutrons, the probability is even smaller.
When a radioactive nucleus is produced it will undergo gamma decay. By measuring the energy of the gamma ray and the half-life of the nucleus one can determine the nucleus that decayed and hence the element.
Some nuclei will have a neutron capture cross-section that is so small that measurements aren't sensitive enough to detect. Others require more than two neutron captures and hence production of these are too small to measure. And some produce radioactive nuclei which decay almost instantly. these require a different technique to measure the gamma rays and half lives. About 70% of elements can be measured using the normal methods of NAA. (Reference 1)
(1) Overview of Neutron Activation Analysis. University of Missouri Archaeometry Laboratory
http://archaeometry.missouri.edu/naa_overview.html


How does surface tension prevent a pin from sinking?

Question: Please explain simply how surface tension in water which as far as I understand is a force pulling the water molecules at the surface towards each other horizontally so how does that prevent a vertical gravitational force downwards , also the water molecules at the surface are forced downwards because the there is no water molecule on top to pull it so that should make it even more possible for things to sink like a pin or something. Why do people keep saying it's the surface tension keeping it from sinking like even the contact force makes more sense than surface tension.
Comment: Imagine walking on a stretched trampoline.
Answer: Surface tension is caused by the attraction of like molecules to each other (cohesion). Water has a higher surface tension than many other liquids because of a relatively high attraction of water molecules to each other due to the hydrogen bonds. A small lightweight object may not be heavy enough to push through the "skin" of the surface tension of water as it would have to push water molecules away from each other against their cohesive attraction to sink between them.
Answer: This is how surface tension is defined:

Surface Tension is the the force per unit length in the plane of the liquid surface, acting at right angles on either side of an imaginary line drawn in that surface.

According to the Wikipedia,

Surface tension is the tendency of liquid surfaces to shrink into the minimum surface area possible.

So, it's obvious that to acquire the minimum surface area possible, liquid molecules should have less space inbetween them. Water molecules have a special kind of bond inbetween them called the hydrogen bond which causes the water molecules to stay together. Due to this hydrogen bonding, water has a greater cohesive force i.e., a water molecule shows more attraction towards another water molecule rather than an iron molecule(of the needle).
An iron (or whatever the substance be) needle is indeed denser than water and hence will drown due to its weight. But this property of water keeps it from drowning.
So, when you place a needle on the water surface, the water molecules in contact with the needle feels that it's better to stay close to one another than to attach to a bloody needle, and they form a kind of skin as mentioned in the other answer. On the other hand, if you don't put the needle softly, it may pierce this skin of water molecules and drown.
Answer: There is an energetic cost to having a surface between two interfaces. Increasing the surface by $\Delta$ costs $\Delta W=\gamma \Delta A$, where $\gamma$ is the surface tension.  We can imagine displacing our floating needle downward a little bit by $\Delta h$. This will cause the potential energy to decrease by $-mg\Delta h^\dagger$, but the surface of the water gets larger, which increases the energy by $\gamma \Delta A$. For water, the surface tension is particularly high and it is possible for the increase in surface energy to overpower the energy gain by sinking the needle. In that case, the needle will float.
$\dagger$ Technically, $m$ is here the mass of the ball minus the mass of the displace volume of water.


In La Liga or the Premier League, can you contest a yellow card after the game and take it off?

Question: As the title suggest, anyone know if a yellow card can be contested in either La Liga or the English Premier League and taken off ? If they can, are there limits as to how many can be contested?
Comment: Are you talking about *any* yellow card or a 2nd yellow card?
Comment: Any yellow card. Just in general contesting it after the match even if the referee made a mistake during the game and gave a yellow.
Answer: At least in the Premier League, it's not possible. Back in 2000, a referee directly asked the FA to rescind a yellow card. He received no answer. This article might give a little more insight:
https://www.sports.legal/2017/12/yellow-card-suspensions-in-football-correct-me-if-im-wrong-but/


Is it possible to shut down an Ipod nano 6th generation?

Question: If yes, how?
If no, why such a decision?
Answer: According to Apple Support:

If the iPod nano is paused, and you
  press the Sleep/Wake button to turn
  off the screen, the following behavior
  will take place:

For 36 hours after pressing the Sleep/Wake button and turning off the
  screen, iPod nano is in Standby, and
  will quickly wake up when you press
  the Sleep/Wake button again.
After 36 hours in Standby with no activity, iPod nano will shut down
  automatically. Pressing the Sleep/Wake
  button after iPod nano is shut down
  will turn on iPod nano, and boot to
  the main Home screen.
  (Your iPod nano is considered paused if there is no music or FM radio playback, or an active pedometer session.)

Additional Information

A fully charged iPod nano provides up to 24 hours of music playback time.
Answer: Press all together in this order -Vol button, then Sleep button, then +Vol button and then hold (so your fingers should not let go of the -Vol when you press the Sleep button) until diagnostics screen, you'll see a teletype sorta menu select standby with the sleep button it will put the nano it sleep but wake up reset


varswap replication doubt

Question: I have a doubt regarding the varswap replication- I know the portfolio of options with proper weights is a static one, and that there is a dynamic position required in underlying. My confusion is whether this dynamic position in underlying relates to delta hedging of the options i.e. are you required to calculate net delta of your portfolio of options and hedge that? I think it somehow relates to delta hedging as we are finally able to capture difference between implied and realized vol, but cant get my head around it.
Answer: Well I've never actually traded a var swap but I see no answers so I'll give it a shot.  If you are short a var swap, your hedge is to buy options of all strikes.  In practice, you buy a ATM straddle and some otm puts of various strikes and some otm calls of various strikes.  Initially, this is close to delta neutral.  Suppose the payoff of the variance swap is calculated from daily observations of the underlying.  Then, you need to get back to delta neutral at the close of business on each day.  Thus, if the market has gone up, your portfolio of hedge options has gotten long the market (since it is long gamma), so you need to sell the market to get back to flat.  You do this every day.  At the end of the trade your hedging activity has realized the actual variance of the stock during the period, which was your goal.
Answer: Take a look at the following note which explains that indeed the dynamic position in the underlying is from delta hedging the options.
I actually still have to complete the note with showing that the aggregate delta of the options portfolio is $1/S_t$, but I have not had time yet.
F. Rolloos, Delta Hedging and Variance Swap Replication

varswap replication doubt


Which answer is correct?

Question: (Which/What/That/Things) we saw surprised us.
Which is the correct answer?
Comment: When asking about sentence variations, you must describe what you mean by that sentence, otherwise we're just guessing at which version matches what you want to say. Without your description of what you want to say, there may be more than one correct answer. Please edit the question to supply more context.
Answer: Both of the following are complete sentences.

What we saw surprised us.
Things we saw surprised us.

Neither "which" nor "that" will make a complete sentence.
Sentence 1 above, I feel, is most usual to say that something surprised you. Whether that thing is singular or plural.
If you want to specifically indicate that there were multiple things that surprised you, use sentence 2.
Answer: "What we saw surprised us," is correct, but you'd probably write "that which" instead of "what" for an exceedingly formal context.
"Things we saw surprised us," is also correct, but usually you would hear something like "the things," "some things," or "things that," since "things" is terribly vague without a touch more specification.
Answer: "What" and "things" are correct, if used correctly.
What we saw surprised us.
Th things we saw surprised us.

Which answer is correct?


ReSharper sluggishness

Question: I like ReSharper, but it is a total memory hog. It can quickly swell up and consume a half-gig of RAM without too much effort and bog down the IDE. Does anybody know of any way to configure it to be not as slow?
Answer: Turn off the on-the-fly compilation (which, unfortunately, is one of its best features)
Comment: Thanks - as you say, this is somewhat annoying given how important the on-the-fly is. Their 4.1 release seems even flakier. I would hope that a company all about clean code would be able to clean things up to run faster.
Comment: I think what is referred to here as on-the-fly compilation is the code analysis feature.  In 6.0 this is found under the code inspection section.
Comment: I found 4.1 to be even slower (particularly on solution load) than 4.0. Have since moved back to 4.0, primarily for that reason.
Comment: Yes definately turn off that Solution Wide processing. It's a hog.
Answer: The next release 4.5 is going to based around performance and memory footprint.
see Ilya Ryzhenkov's blog
Resharper 4.5 has been released
From my experience it is less of a memory hog, but i still can run out of memory.
Answer: I had an issue where it was taking upwards of 10 minutes to load a solution of 100+ projects.   Once loaded VS performance would be ok, though it would oddly flutter back and forth between ok and really bad.
The short answer:  Eliminating Resharper warnings seems to improve overall VS/R# performance.
The biggest problem ultimately was that we had a number of files of binary data (encrypted stuff) being included as embedded resources, which happened to have .xml extensions.  Resharper was trying really really hard to analyze those files.  Eventually it'd get through but would generate 100K+ errors in the process.  Changing the extension to one Resharper did not automatically analyze (.bin in this case) solved the problem.
We still have about 10 files which when they or a file they depend on is edited performance tanks for a while.  These files are the partial parts of a single class definition where each file averages 3000 LOC.  Yes, that's right, it's about a 30K line class.  It also happens to be rather poor code for other reasons, many of which Resharper flags making the right hand gutter bar practically a solid orange line.  Editing often causes Resharper to reanalyze the whole thing.  While that analysis runs, performance is noticeably affected.
I've come to the conclusion that the less errors/warnings there are for R# to identify, the better it performs.  My anecdotal evidence gathered while cleaning up/refactoring this project seems to support it.
A lot of folks complain of perf problems with Resharper.  If you have even a few big ugly code files with lots of Resharper warnings, then a little time spent cleaning that code up might yield better performance overall.  It has for us.
Answer: Not sure how big your solutions are, but I stopped using 4.5 for the same reasons I stopped using all previous versions, memory usage.
Code analysis and unit test support was the main reason I bought it, turning it off means the rationale for using it is gone.
Workstation has 4GB of memory, and I can easily kill it with ReSharper when running our end-to-end stack in debuggers.
Answer: You can look how much memory ReSharper use.
ReSharper -> General -> Show managed memory usege in status bar.
Answer: If you are working on large source files, Resharper does get sluggish (I'm working on version 5.0 at the time of writing this).
You can view the memory usage of Resharper by clicking on Resharper options -> General -> Show memory use in status bar.
When I first did this, I noticed Resharper had clocked up hundreds of megabytes of memory usage! However, the next step worked for me in (temporarily) fixing the slugishness:
Right click the memory usage, and select "Collect garbage" - this seemed to fix the slugishness for me straight away.
Answer: Regarding memory hogging - I've found that my VS2008 memory footprint grows every time I close one solution and open another. This is true even if I close a solution and re-open that same solution.
Comment: Normally I close the IDE, which is kind of annoying to have to do. Alternatively I turn off ReSharper.
Comment: @richard do you close the IDE or just the solution.  I'd recommend you close the IDE when changing solutions.  This stems from noticing in practice rather than any theory.
Answer: The new ReSharper 4.5 works a lot better than the previous 4.x releases. I would recommend you try that one.
Answer: In previous versions I had the same problem, when 4.0 came out these problems have seemed to have gone away. Now with 4.1 i do not feel the huge slow down i used to have. My IDE does not freeze up anymore.
have you tried upgrading ?
Comment: We upgraded and got even worse results. We're using Visual Studio 2008. We had to do a complete uninstall to go back to 4.0.
Answer: Try the 4.5 beta. 4.1 was killing my 2GB dev machine, but it's back to running incredibly smoothly with the beta. Others have had the opposite experience, though, so YMMV.
Answer: Yes, 4.5 works much better. My understanding is that 4.5 was to address the performance issues.
Answer: Me and my colleagues are also having huge performance issues with ReSharper, just now my ReSharper took 1.1GB of memory. Visual Studio slows down specially when writing JavaScript, it's unbearable. You can turn of the on the fly compilation, but it's the best feature it has...

edit: Everybody in this thread seems to have ReShaprper 4.x, my version is 6.0.

ReSharper sluggishness


Mobile data turns on automatically

Question: I am using Moto One power mobile and android version is 9.0 pie. I have two sim cards in my device, and one is used for data. The other one's data switches on automatically, and there is no active data pack on that sim; so it deducts from my main account balance. How can I stop that?
Answer: It has been fixed in the Feb patch Update,
just Go Settings -> About phone -> System updates -> Now update

Mobile data turns on automatically


Minify PHP in Visual Studio 2015

Question: Is there any way to minify (or remove comments) in PHP using Visual Studio 2015? I use PHP Tools and when i release php scripts to public server, i would like at least remove all comments from code. I know, is there way to remove comments with content menu, but i wish to have comments in my project and no comments (or minimal and unread code) in publish scripts (some like Bundler & Minifier tool, but for php). Thanks
Comment: In PHP comments are used also for programing eg. for dependency injection, so you shouldn't remove them if you are not sure what they are doing. If you wan't to hide your code on production server you can compile your code - check this:
http://stackoverflow.com/questions/1408417/can-you-compile-php-code
Comment: Why not use an IDE better suited to PHP such as NetBeans or PHPStorm?
Comment: Because i prefer c# language and php is 'homework'. I like Web Essentials and other web components in Visual Studio, long time ago i used Eclipse or NuSphere, but now i use few years only VS for work. I like publish in VS, because i mark only scripts (like js, css), with minify code, which will be publicate = less work to do.
Answer: There is basically no point in minifying Php since there is no performance gain in doing so. Although if you insist, there are a few ways to remove comments/whitespaces from source. (and these are not limited to just VisualStudio) -

Use Gulp.
Use Command line options: php -w file.php => generates file without comments & whitespaces. Equivalent to php_strip_whitespace()
Use Regular Expression in Find-Replace Function of your IDE. You can use the following inside Find FieldBox. (and keep Replace fieldbox empty)

//.* or /.
4. Use a Library/tool like Php-Minify

Hope that helps!
Answer: Why aren't you going to use online tool to do it?
There are many online tools you can use instead of VS 2015.
Here is one tool for you.
http://beta.phpformatter.com/
Hope it helps you and check this answer as solved if it helps you.
Thanks!
Comment: PS: Click the "Style" tab and check out the "Remove all comments".
Answer: You can check Comment Remover tool to remove all the comments from a file with a single button click. It also remove #regions and preserve XML Doc comments.
Comment: Thanks, i know how remove comments in editor, but i wish to know, how remove comments (or minifying code) with publishing all php files at once - to output directory.
Answer: I think there is no tool for visual studio to do this. But you may use external tools to do the job. It's a common task to do this in build system like jenkins. The build system e. g. is able to react on many version control events.
But I also think that you want to make php code unreadable (like compiling). There are only a few options to hide your php code to other people. You could use ionCube for encrypting php files. But then you have to make sure, that the ionCube extension is also installed on the public web server. Also, ionCube is currently not available for php 7.2, only up to 7.1. Another option is to compile php code using HipHop, a PHP to C++ compiler engine: https://de.wikipedia.org/wiki/HipHop

Minify PHP in Visual Studio 2015


javascript/php sorting plugin

Question: I have a set of thumbnails and I want to sort them by name, by rating and by newest added.
I've found Quicksand which I think is pretty good, but I need to know if there are some other scripts/plugins which does the same job.
Comment: What are you exactly looking for? You already have found a script, but you want to know whether there are others. The question is: why do you want to know this. What don't you like about Quicksand that you are looking for others?
Comment: What PeeHaa said. Just arbitrarily wanting some other options isn't really what the SE sites are for.
Comment: I'm asking because I want to add a filter by number of facebook likes for example... if this is possible
Answer: PHP is server part language, so you can do that with jQuery. Some demos for you.
http://james.padolsey.com/javascript/sorting-elements-with-jquery/
http://tablesorter.com/docs/#Demo
http://tinysort.sjeiti.com/
You could also search jquery sort via google.
Answer: I love datatables (see: http://datatables.net/) for sorting and filtering through rows in a table format - if you need to search for text, or between dates submitted, etc.
It is very simple to use, but it's only for data in table format, which may not be what you are looking for. It will automatically convert a designated html table with the proper format on the fly, which makes it server language agnostic and I have used it with everything from custom php to complex Drupal applications, and since this is such a simple way to get the job done, some team members of mine recently used it on a SharePoint project with the same ease.

javascript/php sorting plugin


Lost My sultan on gta online

Question: I found a sultan some time ago and had it in my garage for ages. After modding up loads of my other cars, I finally decided to mod my sultan. I don't think I insured it but, I'm sure I destroyed an uninsured car before. I either insured it and got it back, or got it back and insured it. Somehow it shows in my garage space as destroyed when I phone my mechanic, but it's not in my garage and Mors Mutual are always engaged when I phone them. How do I get it back, and then insure it?
Comment: No insurance, no new car. There's no way yo get it back without having insurance prior to the destruction. Feel free to get a new car, mod it up, and spend the pocket change for insurance this time.
Answer: If you don't have any insurance on a car, you will be unable to retrieve it. That is the reason they added insurance in GTA Online. Make sure the next time you find a car off the street, you insure it as soon as you take it to the mod shop, so that you don't lose it again.

Lost My sultan on gta online


Are the Cauchy-Riemann equations a necessary and sufficient condition for a function to be analytic?

Question: If we have a region R is $f(z)$ analytic in the region R if and only if it satisfy the Cauchy-Riemann equations for every point in R. If not what are the other conditions it must satisfy? Do we have to check that $f'(z)$ is continuous or is that given by the Cauchy-Riemann equations?
Answer: The standard result is that for functions $f$ of class $C^{1}$, $f$ is complex analytics iff $u,v$ satisfy the CR equations. There is however, a more powerful result: The Looman-Menchoff theorem allows us to replace $C^1$ above with $C^0=C$ (=the class of continuous functions).
Comment: +1, don't we need to assume that $f$ is essentially differentiable though--else how are we plugging $f$ into the Cauchy-Riemann equations--unless this is meant in some distributional sense.
Comment: So we are saying that the standard results states that if $f$ satisfies the CR and $f'$ is continuous in the region R then $f$ is analytic in that region. But in fact from the Looman-Menchoff theorem we can state that $f$ is analytic in the region R if  $f$ is continuous in the region R and satisfies the CR equations (and this is a necessary and sufficient condition?). Is this correct?
Comment: @AlexYoucis The existence of partial derivatives does not imply that a function is differentiable.  You do need to assume the partial derivatives exist (except perhaps on a countable set).
Comment: @RobertIsrael Thank you, I was being imprecise. I didn't meant that the total derivative exists, I meant that the individual partials exist. Regardless, whether we assume they exist off a countable set, or otherwise, it seems like literally continuity doesn't make sense. I suppose that 'and satisfies the Cauchy-Riemann equations' should mean that the partial derivatives exist, as well. I'm being slightly pedantic, but I just want to make sure I understand.


Steiner tree four points example

Question: I have been looking at the wikipedia page for steiner trees, and I don't quite understand their 4-point solution. If the four  vertices are arranged in a rectangle shape wouldn't there be only one steiner vertex required in the middle to create the shortest length graph? The solution shows two vertices S1 and S2, but it seems that it would be shorter if there was only one vertex S instead, in between S1 and S2 and all of the vertices A, B, C, and D connect to S.
Comment: There's an easy way to check: use a ruler :)
Answer: You are asking the question for Euclidean Steiner Trees. For Euclidean Steiner Tree problem one can show that "points added to the graph (Steiner points) must have a degree of three, and the three edges incident to such a point must form three 120 degree angles". That's why you need two steiner vertices instead of just one for 4 point solution. If you take just one extra point the degree will be 4 and angles also will not remain 120 degree.
To prove the property of Euclidean Steiner Trees take help of your favorite search engine. A good reference. See section 3.
Comment: From the wiki page, "Given N points in the plane, the goal is to connect them by lines of minimum total length in such a way that any two points may be interconnected by line segments either directly or via other points and line segments."

What I don't understand is how this is the *minimum* solution, because if I had just 1 steiner point at the center of the rectangle instead, with each of the initial vertices connecting directly to this point, then the total length would clearly be smaller than the length of the edges in the solution presented on the page.
Answer: Honestly, a ruler should be enough to convince you for this one case, though the difference may be quite small.
For the general 4-corners-of-a-tall-rectangle case, I suggest formulating an expression that computes the total distance of a 2-point Steiner tree in which the 4 points are the corners of a w by h rectangle, with w < h, and the two Steiner points are located x units either side of the vertical centre (and, of course, at the horizontal centre).  Plug in x = 0 (your single-point solution -- i.e. a single point is the same as 2 overlapping points), and plug in x = h/2 - sqrt(1/3)*w/2 (the displacement for the optimal 2-point solution), and compare them.  Even better, differentiate w.r.t. x and verify that the curve is 0 for the latter point.
Comment: Where are "the other two sides" used in the solution?  I'm not writing anything further until you *try it with a piece of paper and a ruler*.
Comment: I know what you're overlooking, but because you're wasting my time by not doing the obvious thing that would immediately tell you what it is, I'm not going to tell you.
Comment: If I draw two diagonals from A to D and from B to C, then the total length of these two diagonals is clearly smaller than the total length of the segments in the solution presented by virtue of the fact that any side of a triangle is always smaller than the sum of the other two sides.
Comment: What I mean is, suppose P was the center point of the rectangle ABCD. Consider the triangle formed by A, P, and S1, the length of AP is shorter than AS1 + S1P by the triangle property. I can make the same argument for each of the 4 corners to show that (AP + PD + BP + PC) < (AS1 + BS1 + S1S2 + S2C + S2D). In other words, using one steiner point P is shorter than using two different points S1 and S2.
Answer: It seemed that using one steiner point at the center would be shorter because of the triangle property but the mistake I was making was double-counting the middle segment S1S2 in calculating the length of the graph which led me to believe that it was longer than it actually was. This was my (faulty) logic:

suppose P was the center point of the rectangle ABCD. Consider the
  triangle formed by A, P, and S1, the length of AP is shorter than AS1
  + S1P by the triangle property. I can make the same argument for each of the 4 corners to show that (AP + PD + BP + PC) < (AS1 + BS1 + S1S2
  + S2C + S2D). In other words, using one steiner point P is shorter than using two different points S1 and S2.

Although it's true that AP is shorter than AS1 + S1P, using this argument on all 4 corners, I implicitly counted the middle segment more than once.
Comment: I'm glad that you have understood what went wrong.

Steiner tree four points example