Why did my answer being deleted cost 25 points?

Question: My Stack Overflow answer had one upvote and one downvote (and was accepted as the One True Answer), so I would expect to lose 23 points if the answer were deleted. However, I lost 25 points for the deletion. Why?
Comment: Was it the accepted answer?  That's another 15 points.
Comment: Can you add a screenshot? We (non-moderators) can't see deleted posts on your reputation history
Comment: @Servy:  It was the accepted answer.  I have added the screenshot.
Answer: Because it also had the accepted checkmark, which disappears when the answer gets deleted.
The easiest way to find that out is to look at the post timeline and see that the last accept event was on your answer.
Comment: @wallyk I think you're confused by the downvote. That downvote was *just cast* about 30 minutes before the post was deleted. So before the deletion occurred, you had gained 25 reputation and lost 2, for a net gain of 23 that had to be reversed with the deletion. If the downvote had occurred, say, 7 days ago, then that -2 event wouldn't be there and you'd only see the -23 for today.
Comment: Even so, wouldn't that still mean that the question was worth 23 rep, not 25?
Comment: @StephenTG That's what the deletion event says... Originally he has +1 +accept for 25, then he got a downvote for -2, then the post was removed and removed the 23 that was left. There's no problem here.
Comment: @wallyk Yes, *today* your net loss for that question is -25, but that *doesn't* mean the deletion itself caused a loss of 25. The downvote and deletion are *separate* events. Continuing my example, if that downvote had occurred 7 days ago, your net loss for today would only be -13 rather than -15.
Comment: @animuson Not being mods, we can't see that information on another's profile; we're forced to live with the information the OP included in his question here, and he said 25 (meaning he's clearly mistaken, but we can't prove that, only you can).
Comment: @wallyk You did lose 25 points, but 2 were from a downvote, and 23 were from the deletion, so *the deletion* only removed *23* points.
Comment: @animuson The problem is that the OP said he lost 25 points, not 23 points.  He should have lost just 23 points.
Comment: Ok. I couldn't see the deletion event, so I assumed it said -25, as the question implies
Comment: @Servy In his reputation history I see -23 on the removal event and a -2 for a downvote.
Comment: @Servy:  Maybe I am misreading the history, but it looks like I lost 25 points.
Comment: @animuson:  I see that I got 10 points for another question.  And I am guessing that `-15` beside `today` means that I lost a total of 15 so far today.  So doesn't that mean that the question being deleted cost 25 points?  Total for the question?
Answer: Your rep log indicates that you lost 23 point for the deletion, not 25. The other 2 lost rep are from the downvote.
We can tabulate this out by summing the answer's pre-deletion reputation events:
<code>+10 upvote
+15 accept
- 2 downvote
------------
+23 pre-deletion worth
</code>
When the answer was deleted, you lost the total value of the question's reputational worth to you, which was 23 rep.
To put it another way:

Suppose I gave you 25 dollars.
The next day, I need money to buy my lunch, so I say, "Sorry, can I just get 2 of those dollars back from you?"
The day thereafter, I realize I meant to give those 25 dollars to someone else entirely, so I say, "Terribly sorry, but please give all of that money back. That shouldn't have gone to you at all."

When I take back the money, I'm certainly not going to ask for the full $25 back, because you already gave me $2 of it the day before. Thus, on the final day, you give me $23, but your net loss (counting from the first day) was $25, including the other $2.
Answer:
1 Upvote = +10
1 Downvote = -2
1 Accepted Answer = +15

When you add the upvote and the accepted answer, you get +25.
When you subtract the downvote, you get +23
When your accepted answer gets deleted, it cancels out the net gain you've achieved.  Therefore, it shows up as -23.  If you had 2 downvotes, it would have shown up as -21.  See?


As a man sows, so shall he reap

Question: Are there any cooler/better-matched/modern phrases to express that you have to recover your own fault or make up your own mistakes by yourself?
I found the phrase in title by search, but I guess the meaning is slightly different.
Comment: The phrase is generally taken to mean that a person must face the consequences of his or her actions; there is no implication of 'recovering fault'.
Answer: We often say "clean up your own mess" to convey that the author of a bad situation has a duty to correct it, and not expect others to do it for him or her.
Answer: In common, modern parlance, you will hear you reap what you sow. Another common expression equivalent in meaning is simply (all) actions have consequences.
You reap what you sow per the ODE means "you eventually have to face up to the consequences of your actions", not that you have to recover on your own or whatever.
Comment: People say "what goes around, comes around".
Answer: The modern version of this phrase is "what comes around goes around", karma would be a synonym, and of course the phrase itself comes from the Bible.

As a man sows, so shall he reap


Increase verbosity of running rsync process?

Question: I'm running 'rsync -a -i /foo /bar'. Every now and then I would like to know what exactly rsync is doing at the moment without having the -v output all the time. Is it possible to increase the verbosity of running processes e.g. by sending a kill signal?
Comment: Type ps afux|grep rsync Get the process ID (second field), then strace -e trace=file -p PID And type Ctrl-C when you want to quit.
Comment: Good answers in this http://askubuntu.com/questions/323775/monitor-watch-running-rsync-process question
Answer: I use rsync -v --stats --progress
Answer: I would redirect the output in a file and then tail -f to see the output when desired:
rsync -a /foo /bar >/tmp/rsync.log 2>&1

when needed:
tail -f /tmp/rsync.log

Comment: That's what I do right now ;-) But I was hoping there is something like the 'kill -USR1' for 'dd'
Answer: In addition of -i, you can use --progress for more verbosity in sending data.
for example:
rsync -ai --progress .....

If need more and more the better way is logging it as @Marc M said above.
Answer: The rsync documentation does not describe such behaviour, nor is there a (proper or de-facto) standard signal to send to a process in order to modify its verbosity.
However thanks to the incremental nature of rsync you should be able to abort a running rsync with Ctrl+C and re-run it with '-v' and not lose much time as a consequence.
Comment: Thanks pablomme. Ctrl+C and re-run is not an option for me because I'm syncing to a slow davfs mount.


How did Khadijah support Muhammad with her political power and influence?

Question: Khadijah is known for being Mecca's most powerful women. How did she use her political power and influence to support Muhammad so he could preach?
Comment: Salam and welcome to Islam SE the Q&A site about Islam. Please consider to take some time to learn more about our site and model by taking our 2 min. [tour] and checking our [help].
Comment: What is your source for saying Khadija had any political or any kind of power or influence to support Muhammad? The only known support was her wealth and beside her lineage!
Answer: I would not call it political power as the brother has already rightly pointed out in his comment, but it was not only wealth and noble lineage either. Her whole character supported the Message of Islam. She did not only give her wealth to the Prophet for him to be free from earning a living and to preach the message but she herself took care of the believers by providing them with food, shelter, money and moral support. Giving support to the poor, the widows, the orphans, the sick and the disabled was part of her personality and not influenced by the Prophet, as she did this even before her marriage.
As we know,  Khadijah was a very successful business woman and even though the Arab society at that time looked down upon women and treated them more like cattle than human beings, she was highly respected so  that the Meccans called her Ameerat-Quraysh ("Princess of Quraysh"), al-Tahira ("The Pure One") and Khadija Al-Kubra (Khadija "the Great"). Why was she called "The Pure One" if not for her impeccable character and flawless behaviour.

Khadija was the image of the perfect soul. Muhammad Mustafa found only
  four perfect women in the entire human race. Out of these four, the
  last two belong to the same house; they are Khadija, the mother, and
  Fatima, her daughter.

https://www.al-islam.org/khadijatul-kubra-sayyid-ali-asghar-razwy

She was the first person to testify "La illaha illallah, Muhammadun Rasoolullah" to the truth of the Holy Prophet.  And in the years which followed, she was a source of comfort and consolation to the Holy Prophet in his struggle to spread the message and to change the society they were living in completely.

She was, for him, a psychological "shield" against the trauma of the constantly escalating violence of the Quraysh.

Ibid.

For 25 years she was the only wife of the Prophet, which is quite astonishing when we take into account that the Prophet took several wifes after her. This fact shows the deep and loving relationship both found in their marriage. Khadija was the perfect wife always supporting her husband and his mission. She exchanged her life of ease and comfort willingly to a life of austerity, when she suffered the same hardships as the other believers under the economical siege of the Quraish for three years. More than that, she showed her quality as a true "Mother of the believers", when she put their interests over her own by making sure that they had shelter, water  and food.

The support that Khadija gave to the Muslim community in Makka, was
  indispensable for the survival of Islam. Her support to the Muslim
  community guaranteed its survival when it was in a state of blockade.
  In this sense, she was a maker of history -the history of Islam.

Ibid.

The Prophet always maintained his special relationship to Khadijah even after she had died.
In al-Bukhari, vol.3 we find the following ahadith :

Ayishah said:   "I never envied any woman as much as I envied
  Khadijah. The Holy Prophet always remembered her. Whenever any sheep
  or goat was slaughtered, the choicest parts were sent to Khadijah's
  relatives and friends. I used to say, 'It appears that Khadijah was
  the only woman in the world.' Hearing this, the Holy Prophet was very
  much annoyed and said: 'Khadijah had many virtues, which others do not
  have. "'   She also said:   "Once the Holy Prophet remembered her and
  I said, 'How long will you go on remembering a woman so old that she
  had no teeth in her mouth? Allah has given you a woman better than her
  (meaning herself).' The Holy Prophet was so angry that the hair of his
  head was raised. He said: 'By Allah, I do not have better than
  Khadijah. She believed in me when others were steeped into infidelity.
  She testified to my truth when others rejected my claim. She helped me
  with her wealth when others deprived me. And Allah gave me children by
  her." 'Ayishah says that from then on she decided not to say any
  unkind word about Khadijah.
Comment: Would be helpful to give the reason for downvoting this answer.


Does contrast affect dynamic range?

Question: Does modifying the contrast of an image change the dynamic range of a photograph?
Does it make it better quality?
Answer: Depends on what you are referring to.
Increasing the contrast using an image editor software means making the darks darker and the brights brighter, and decreasing means the other way around. Increasing the contrast will cause loss of details since you won't be able to distinguish one tone from another as well as you could before you made them darker or brighter, and decreasing might give you more details, depending on your camera's or film's dynamic range and some other factors (I'll explain it later). On the other hand, increasing the contrast might make your images more vivid, whereas decreasing it might make them more dull:

On the image above, the middle one is the original, the left one is with decreased contrast (notice how it is more dull) and the one in the right has increased contrast (more vivid). You can clearly see a loss in detail on the one in the right, with increased contrast, whereas there really isn't any gain in details in the one in the left. Why? For two reasons:

Dynamic Range
I used a cheap film to take that picture, it does not have a good dynamic range, i.e. there wasn't much of a difference between the darkest and the brightest tones to start with. The same is usually valid to cheap digital cameras.

The editing process (most important!)
I edited that picture with an image editing software, after it was already processed and developed, which is the equivalent of editing a JPEG instead of a RAW if you shoot digital. What you are doing is editing what was somehow already edited by the lab guy or by the camera's software, it's like trying to change the colors of a painting that was already painted.

On the other hand, if your camera / film has a good dynamic range and you do your magic while developing the film or if you edit RAW, you can gain a lot of details by decreasing the contrast and messing around with some other lightning settings - the dynamic range is set by your camera/film, but you can mess around with it, paying the price for it, which is loss/gain in details for gain/loss in vivid tones. I can't develop the picture again, but I edited only certain areas of it to simulate it:

You can clearly see in the sky and buildings (brighter tones) that I gained a lot of details by decreasing the contrast and messing with some other lightning settings.
Answer: Dynamic range of an image (as opposed to an image sensor) is simply the ratio between the brightest and darkest pixel values. An image of fixed bit depth thus has a fixed maximum dynamic range.
Increasing contrast will increase the dynamic range but only up to the maximum possible given the bit depth.
Whether or not increasing contrast will improve an image depends on many factors. More contrast will make an image bolder, more striking, but too much contrast can destroy an image and leave it looking distinctly "unreal". A low contrast image will invoke different feelings and there are times when this is more appropriate.
Here's an image which I decided looked better with a lower overall contrast:

First rough edit.

Final version.
Comment: But even in that final version, there are pure blacks (RGB=0,0,0) and a few highlights that are close-ish to pure white, so does the high contrast version really have more dynamic range?  Or just more local contrast? Technically I guess it does, since it does push the whites a bit whiter at least?
Comment: @MikeW the high contrast version probably has marginally greater dynamic range, that's why I said increasing contrast only increases dynamic range up to a point (where clipping of the highlights occurs).
Answer:
Does modifying the contrast of an image change the dynamic range of a
  photograph?

No.

Does it make it better quality?

Yes (sort of), if the original image was underexposed or overexposed or the subject has a bland coloration.
Explanation
To understand the issue, let's imagine we have a very simple monochrome 4-bit camera. This camera's sensors can only store gray-scale images with each pixel having a value between 0-15. You have 16 levels of gray and that's it.
What happens when we increase the contrast of an image with this camera?
Let's say some of the pixels in our image have the following values:
8, 9, 9, 11, 10, 10, 12, 12, 12, 5, 5
A  B  C   D   E   F   G   H   I  J  K   <-- pixel labels

When we increase contrast we spread these values out. So, first we must choose a center point, say 10. Then, every pixel that is lower than ten gets decreased and higher than 10 gets increased. So our new image might look like this:
6, 8, 8, 12, 10, 10, 14, 14, 14, 1, 1
A  B  C   D   E   F   G   H   I  J  K   <-- pixel labels

So, the 10 stays the same, but the other values spread out. The benefit of this is that if the difference between 9 and 10 was hard to see in the original print, then now it is more visible since 9 has been converted to 8. So, the difference between pixels C and E, or D and E is greater and easier to see.
For this reason if you have image in which all the values are close together, details can become easier to see in the print.
Notice that you can lose information when you adjust the contrast. For example, let's say you have values of 0 and 1 in your image and the 1's all get changed to 0. Then pixels that were originally different levels of gray are now the same. So, if your original 4-bit image had all its values, say, in the 8-12 level range, then you are safe increasing the contrast. But if your recorded values include all possibilities 0 to 15, then you will lose detail when you increase the contrast.
So, you potentially lose detail, but you make the detail that remains easier to see.
Nowadays, people often talk about dynamic range as the difference between the lightest and darkest areas of the image, and have invented the term "tonal range" to mean the number of discrete measurable values. However, for a photographer the tonal range is the key sensor quality metric, so when we talk about "dynamic range", it is better to think of it as the ability to discriminate between different levels of hue, saturation and brightness. So, while that does include the difference between blacks and whites, it is a lot more than that. Roughly speaking, the dynamic range (or tonal range) is equivalent to the different possible levels of the pixels. So, for example, an 8-bit sensor will usually produce images with greater dynamic range than an 4-bit sensor, other things being equal.
Note that increasing contrast does not increase the dynamic range of an image because you are not increasing the ability to discriminate between different gray levels in the original image. So, in the example above, we change all the 9's to 8's, but that means all the 9's are now gone. In other words, lets say our original image had only 3 different levels: 9, 10, and 11. If we change those to 8, 10, and 12, we still only have 3 different levels. Now, imagine we took the same picture with a more sensitive camera and it gave values: 8, 9, 10, 11, 12. So, we see this camera has 5 different levels, so it has greater dynamic range.
Answer: I think you're looking for a short answer here.
Increasing contrast makes the lights lighter and the darks darker. (Expansion)
Reducing it bring everything closer together in brightness. (Compression)
If you're asking if it can bring back detail that was lost while taking the photo, no.
Can it make some details that are too dark or light more visible, yes but it's a poor way to do as it makes everything look pretty flat if done with a simple slider.

Does contrast affect dynamic range?


Migrating my Blogger site to CraftCMS

Question: Has anyone migrated a Blogger site to CraftCMS? I'd like to migrate comments and posts. What is the best way to go about this? Could I import my site to Wordpress and then to Craft?
Answer: I migrated a Blogger site by writing a Craft plugin to parse Blogger's XML and save images, posts, and categories into the Craft setup established with the client. The challenge with Craft is that last part: you're the one deciding how things will work, the CMS doesn't come with opinions about how your blog posts will be constructed or organized.
You can use the Feed Me or Sprout Import plugins to migrate your Blogger data, but you'll still need to set up your blog in Craft and decide how to map the Blogger data to your Craft install.
Comments are another animal. It may be easiest to move them to Disqus. I've not used this comment plugin, but expect it would be solid.
Comment: Agree 100%. Having migrated a WordPress blog to Craft, I also found that the difficult bit was structuring the blog in Craft and deciding how to map the data in.

Migrating my Blogger site to CraftCMS


How do I add grounding to my old electrical wiring?

Question: This old house is (50's) is wired with cloth covered 12/2 Romex with no ground and all metal boxes. Can I just run a 12 ga or 14 ga solid wire between boxes and then to the ground bus of my service panel or do I have to replace all the wiring with new Romex?
Answer: The rules on retrofitting grounds were greatly relaxed with the 2014 electrical code (NEC 2014). Yes, now you can simply run bare or green wire between all your electrical boxes and back to the panel.
The ground wires can follow any feasible route, they don't need to travel with the conductors.
The ground wire must go back to the same panel as the conductors come out of (that's relevant if you have more than one panel).
The ground wires MUST be thick enough (generally as thick as the conductors) and can be thicker -- for instance a 12 AWG ground wire is not acceptable for a 10 AWG/30A dryer circuit, but it is acceptable for a 14 AWG/15A outlet circuit.
Here's the whopper: Multiple circuits can share grounds. You don't have to home-run the ground all the way back to the panel, you need only reach another grounded point whose pathway is thick enough.  So you can daisy-chain your grounds from box to box, as long as all the circuits you are grounding come out of the same panel.  Or, your 10 or 6 AWG ground to your range or dryer can be a "backbone" providing grounds to many other receptacles.
All ground splices must be done with the same rules as any other splices: inside a junction box or using some sort of splice listed for use outside of a box.
For details,  see the National Electric Code, NFPA 70 (2014) Article 250 — Grounding and Bonding.  (NFPA now offers free access online to its codes and standards.)
Comment: " Or, your 10 or 6 AWG ground to your range or dryer can be a "backbone" providing grounds to many other receptacles. " is that always true, or only if the range or dryer has a separate ground and neutral?
Comment: @Jasen On regular dryers there are only 2 possibilities: it has neutral only; or it has neutral + ground separated.  Cases of neutral-only (3-wire) cannot be used to retrofit ground since it isn't ground at all.
Answer: The relevant code section may be 250.130 with more detail in 250.130(C) on simply adding a ground wire to two prong outlets. I found this in the draft code here
https://www.nfpa.org/assets/files/aboutthecodes/70/70-a2013-ropdraft.pdf
I'm assuming that it's the same in the final code. The gist of it is this:
(C)  Nongrounding  Receptacle  Replacement  or  Branch Circuit  Extensions.
The  equipment  grounding  conductor of a grounding-type receptacle or a branch-circuit extension shall be permitted to be connected to any of the following:
(1)  Any  accessible  point  on  the  grounding  electrode  system as described in 250.50
(2)  Any  accessible  point  on  the  grounding  electrode  conductor
(3)  The  equipment  grounding  terminal  bar  within  the  en-closure  where  the  branch  circuit  for  the  receptacle  or branch circuit originates
(4)  To  an  equipment  grounding  conductor  that  is  part  of another  branch  circuit  that  originates  from  the  enclosure  where  the  branch  circuit  for  the  receptacle  or branch circuit originates[ROP 5–209]
(5)  For grounded systems, the grounded service conductor within the service equipment enclosure
(6)  For  ungrounded  systems,  the  grounding  terminal  bar within the service equipment enclosure
Answer: I believe that it MAY be code-accepted to retrofit a grounding conductor as you describe. It would need to follow the same path as the existing wire. Check with your LOCAL electrical inspector before taking that on faith, though. Depending just how ungrounded your system is, you may also need to install a ground rod (or two, or three) so that your service panel ground bus is actually tied to ground.
Considering what will have to be done to retrofit this wire, I believe that the sensible approach is new wiring (if you were going to rip things that far apart), or GFCI's and the old wiring with code-approved labeling noting the lack of ground on those circuits (if you were not going to rip things that far apart).
Comment: It wasn't when you wrote this.  It is now.  NEC 2014 relaxed the rules, making it fairly easy to retrofit grounds.  Grounds don't need to be in the same cable or even follow the same route as conductors, and multiple circuits can even share grounds so long as they all originate from the same sub-panel.
Comment: Sounds like you should write an answer, @Harper


Morning Netilat Yadayim - Rabbinic or Biblical?

Question: Though there's a reference for morning netilat yadayim within the Zohar, is it a rabbinic decree, or a Torah based mitzwot for ALL Yisrael outside of the kohenim?
Comment: Rambam says morning netilat yadayim is a nice reminder: Kohanim working in the Temple washed up before "clocking in", so we start our days reminding ourselves that we have holy work to do. Which would very, very clearly be a derabanan.
Comment: The bracha on netilas yedayim in morning is not for removing ruaach raah . It is for either touching an uncovered part during sleep ,or that you are considered like a new creation .(Rosh ,Rashba)
Comment: @sam I'm referring to the washing, not the bracha
Answer: Netilath yadayim in the morning as a preparation for prayer is derabanan (rabbinic). The Talmudic source for it is the statement of R. Yohanan (and R. Yohanan as cited by R. Hiyya b. Abba) in Berakhoth 14b-15a:

אמר רבי יוחנן הרוצה שיקבל עליו עול מלכות שמים שלמה יפנה ויטול ידיו
ויניח תפילין ויקרא ק"ש ויתפלל וזו היא מלכות שמים שלמה א"ר חייא בר אבא
א"ר יוחנן כל הנפנה ונוטל ידיו ומניח תפילין וקורא ק"ש ומתפלל מעלה עליו
הכתוב כאלו בנה מזבח והקריב עליו קרבן דכתיב (תהלים כו ו): "ארחץ בנקיון
כפי ואסובבה את מזבחך ה'"
R. Yohanan said: If one desires to accept upon himself the yoke
of the kingdom of heaven in the most complete manner, he should
consult nature and wash his hands and put on tefillin and recite the
Shema' and say the tefillah: this is the complete acknowledgment of
the kingdom of heaven. R. Hiyya b. Abba said in the name of R.
Yohanan: If one consults nature and washes his hands and puts on
tefillin and recites the Shema' and says the tefillah, Scripture
accounts it to him as if he had built an altar and offered a sacrifice
upon it, as it is written, I will wash my hands in innocence and I
will compass Thine altar, O Lord.

He specifies that this practice, as performed alongside other miswoth has the effect of cultivating acceptance upon ones self of the yoke of heaven in the most complete manner.
Insofar as our source for the practice is R. Yohanan, the practice is rabbinic. This is confirmed in many other sources. For example, the Rambam explicitly states (H. Berakhoth 6:2):

כל הנוטל ידיו--בין לאכילה, בין לקרית שמע, בין לתפילה--מברך בתחילה, אשר
קידשנו במצוותיו וציוונו על נטילת ידיים:  שזו מצות חכמים היא
שנצטווינו בתורה לשמוע מהן, שנאמר "על פי התורה אשר יורוך" (דברים
יז,יא).
Whenever a person washes his hands - whether before eating, before the
recitation of the Shema', or before prayer - he should recite the
following blessing beforehand: "[Blessed are You...] who sanctified us
with His commandments and commanded us concerning the washing of
hands." This is a Rabbinic miswah that we have been commanded by
the Torah to follow, as [Deuteronomy 17:11] states: "[Do not stray...]
from all the laws that they direct you."
Comment: How does your conclusion follow from this source? Would you also conclude that shema and tefillin are d'rabbanan?
Comment: I don't understand the reasoning
Comment: @magicker72 is going to the bathroom a miswa d'oraitha? The source of qeriath shem'a and tefillin are the Torah, the source of washing before prayer is the statement of R. Yohanan. I've edited the answer to hopefully make that clearer.
Comment: I'm specifically referring to morning washing, in regards to Ruach ra'ah being present on one's hands.
Comment: @MikayahYisrael washing immediately upon arising, simply shifts the obligatory washing prior to tefillah to its earliest point. Shifting it to the earlier point facilitates the ability to satisfy the Zohar's expressed concern, though the originating source of the washing remains the same.
Answer: Mishneh Torah, Brachos, chapter 11; halacha 3:

"Similarly, with regard to all the Rabbinic mitzvot - both the mitzvot
that the Rabbis established as obligations - e.g., reading the
megillah, lighting Shabbat candles, and lighting Chanukah candles -
and the mitzvot that are not obligations - e.g., an eruv or washing
hands - one should recite a blessing before performing them, [praising
God] "who has sanctified us with Your commandments and commanded
us….""

It's clear from this paragraph that washing one's hands is rabbinical in nature.
Answer: Ramban (Nachmanides) writes in his commentary on the pasuk "You shall be holy":

It is with reference to these and similar matters that this general commandment [Ye shall be holy] is concerned, after He had enumerated all individual deeds which are strictly forbidden, so that cleanliness of hands and body, are also included in this precept, just like the Rabbis have said: "And ye shall sanctify yourselves.10 This refers to the washing of hands before meals. And be ye holy. This refers to the washing of hands after meals [before the reciting of grace]. For I am holy — this alludes to the spiced oil" [with which they used to rub their hands after a meal]. For although these [washings and perfuming of the hands] are commandments of Rabbinic origin, yet Scripture's main intention is to warn us of such matters, that we should be [physically] clean and [ritually] pure, and separated from the common people who soil themselves with luxuries and unseemly things.

However, see the Gemara in Chullin 105a:

§ Having mentioned the manner of washing hands during a meal, the Gemara discusses another matter concerning washing hands. Rav Idi bar Avin says that Rav Yitzḥak bar Ashyan says: The first waters, i.e., washing of the hands before eating bread, are a mitzva by rabbinic law, but the final waters, washing of the hands upon conclusion of the meal and before reciting Grace after Meals, are an obligation, a more stringent requirement.


Load per deflection of springs

Question: I am working on a project using springs. What is the maximum load per deflection of springs available in market?
Comment: Your question lacks context. Why do you want maximum load per deflection, which corresponds to stiffness? Stiffness is very high for solid bodies, which is the limit of a spring with almost infinite stiffness.
Comment: Anything you want. There are many companies that make custom designed springs. Spring stiffness values like 10 tons/inch are standard parts - you could go much higher than that if you need it.
Comment: @alephzero  What could be the range of cost for such a spring with 10 tons per inch
Comment: @Pranav Google is your friend. And this question is unanswerable, unless you tell us whether you want a 10-tons-per-inch spring that is 1 inch long or 10 feet long!
Answer: There is no sensible answer to this. Springs are designed to have a relatively high deflection relative to their  to ultimate strength. Once you want very stiff springs you can just use solid bars of steel.
The trick with spring design is to end up with a product which has a specific set of properties and it is possible to make arbitrarily stiff or light springs. What may be more difficult is combining a desired stiffness and capacity with a particular set of dimensions and lifetime.
Equally any answer may also depend on what you define as the difference between a spring and a structure as all solid materials are essentially springs for a given load range.
Comment: The building I'm working in right now has a bunch of huge hollowish steel beams going underneath the street to support the large open hall below.  The steel beams act like springs, and they aren't tuned yet.  I work above the street and any time a truck drives by the whole office oscillates a noticeable amount; feels like inches but I'm not actually sure.  My point being, buildings definitely can behave like springs considering I can feel the harmonic motion.

Load per deflection of springs


MySQL show all grants

Question: I have over 100 system and admin users in my db server. Does anyone know how to show their grants by running a single query? Thank you very much.
Answer: No need to run a query - just input
SHOW GRANTS;

If you have sufficient privileges, you should get all their privileges.
A bit more fine-grained is the following query
mysql> SELECT grantee, table_catalog, table_schema, privilege_type, is_grantable
 FROM schema_privileges;

This way, you can do it by user, &c. BTW, you have to run this from the information_schema. This information
This page should also be of use.
Using the mysql schema, you can issue the query
mysql> SELECT Host, Db, User, Table_name, Column_name, Column_priv FROM columns_
priv;

From this page.
Comment: is there a way up to the table and column level?
Comment: Check out my query using the `mysql` schema.
Answer: If you have Percona Toolkit installed, you can use the pt-show-grants to print all MySQL grants.
pt-show-grants [OPTIONS] [DSN]
pt-show-grants  shows grants (user privileges) from a MySQL server.
Refer to the Documentation for available options.

MySQL show all grants


iPad Air sold online as new: how can I be certain?

Question: I purchased an iPad Air 1, online from a reputable "group discount" website. Though the site sells certified refurbished and used Apple products, this product clearly stated "brand new". It arrived in the shrink wrapped Apple box and once opened,looked legitimately packaged new. I'm skeptible by nature, however felt questionable when noticed there was no manual or earbuds included. There was a new Apple charger in the box. Additionally,it arrived 100 % charged. (?) I recall having to charge every wireless purchase ever made!
  I'm not technically challenged, familiar to older iPads,and have purchased many Apple products in the past. However, they have always included an Apple manual,ear buds and it required to be fully charged. I had no problem registering the pad or assigning a password,however I want to be certain what I purchased is as advertised; Brand new and in perfect working condition. The product has a 30 day, no question, return policy and a one year Apple warrantee. Can anyone confirm how their iPad air appeared apon opening, what was included, did it require charging, and how can I scan it for prior use or refurburshing?
Answer: My iPad Air did not include earbuds - I don't think any iPad model has even included earbuds.
As far as I can remember, every iPad I have bought from Apple has been received ready to turn on. If not 100% charged, then 80% charged or similar.
iPads do not come with a big manual at all. There's a little booklet with a few "cards" that explain the buttons on the iPad - that's really all.
So all in all, none of those observations should lead you to conclude that your iPad was not new when you purchased it.
To be sure, I would go to the Apple Support site and check your warranty status with your serial number.


REITs - Traditional Account or Roth

Question: When investing in REITs there are tax advantages in putting the investment in a retirement account.  Is it better to put a REITs in a Traditional IRA or a Roth IRA considering overall growth and tax implications?
Comment: If you are young, it almost always pays to put investments in a ROTH.
Comment: @PeteBelford: What does age have to do with it? Only tax rate now vs. tax rate in the future matters.
Comment: @PeteBelford It's capitalized like "Roth", not "ROTH". Not an acronym. Another pet peeve of mine, but not as high on my list as loan "principle". Forgive me: I've done copyediting in the past and am a stickler for these things. :)
Comment: @ChrisW.Rea I have the same pet peeve.  Named for the Senator from Delaware for 30 years, William Roth.
Answer: You should make the Traditional vs. Roth IRA decision before you think about which investments go in them. And before making that decision, make sure you can deduct Traditional IRA contributions by looking over the IRS guidelines. Basically, if you don't have a 401(k) or similar plan at work, or your income is low enough, you can deduct. If not, go with the Roth. If you could do either, the general rule is if you believe your income tax rate is higher now than it will be in retirement, use the Traditional IRA. If you believe your income tax rate will be higher in retirement than now (keeping in mind the possibility of future tax increases), use the Roth IRA. A rule of thumb, which I'm stealing from somebody, is if you're in the 15% federal bracket now, probably go with Roth, 28% go with Traditional, and 25% is a toss-up.
If you have cash sitting around in both a Traditional and Roth IRA and you are deciding which to invest in REITs with, that's a different question with a less clear-cut answer. This page seems to suggest that it's better to hold tax-inefficient investments like REITs in tax-deferred (i.e. Traditional IRA) over tax-free (i.e. Roth IRA) accounts, although I can't get a decisive answer on why that is, if it really is the case. They are probably about equivalent.
Comment: I think the bogleheads article is not precisely relevant to the situation you spell out in your second paragraph:  where you already have the cash sitting in the IRAs.  If the cash is already in the Roth, then you've already paid taxes on it, so you should try to make as much taxable income as possible on it (because you never have to pay that tax).
Comment: It is the latter, I have money in a traditional IRA (rollover) and a Roth IRA and can't decide where to put the REIT asset allocation.   Also thanks for the page link --
Comment: @dg99 What situation would the Bogleheads article be addressing then?
Answer: You should invest in BOTH --- reason is you can control your income when you retire.  You take money out just enough from the standard IRA so you stay in the lowest tax bracket.  Any additional money you need after that then comes out of the ROTH acct.  You get the tax savings now and keep your taxes low when retired
Comment: +1 and a welcome to Money.SE. Any thoughts on how the REIT investment plays into this?

REITs - Traditional Account or Roth


How to design a fifo coupon distribution system

Question: I have an app written in java and using mysql as DB. I need to create a coupon distributed system where I have 100 coupons stored in DB and the first 100 customers who login should get those coupons. With a single server its pretty straight forward I think, but how do I implement this where my application server has multiple load balanced instances with the login service? To be more specific my problem is that at a given time 1000s of users may be trying to login, so how do I maintain FIFO order?
Answer: There are two ways to approach requirements like this:

Try to find a real distributed solution, which will involve distributed transactions and nontrivial patterns like two-phase commit or the saga pattern.

Solve the distribution in a centralized manner, by providing a single, dedicated service running on one isolated instance which does the accounting.

The second approach does not stop the main part of the system still working in a distributed fashion. For a small number like 100 coupons, I would definitely prefer it, since the isolated service is unlikely to become a bottleneck.
If I had several millions of coupons to distribute, or the distribution of each coupon creates a lot of heavy load, then I would start to think about the first approach. Note the first approach might need to implement a centralized service as well, but extended this design by some mechanics which distributes batches of coupons to the login service instances, return them back when they were not requested within a certain time frame, or some other complex distribution algorithm.
Note in a distributed system, each of the load balanced instances of the login service might have each own clock with slight differences in what the current time is. So if one tries to use those different clocks to decide what "First In" means, this will necessarily end up in collisions. A central service is probably the easiest way resolve this.
Comment: How would saga help with procuring the coupon from DB? In a single instance service I can use something like semaphores to procure a coupon from db. What kind of transaction would a saga pattern make?
Comment: @devJoshi: with a single instance service, you may implement a semaphore on your own, or you use a transactional DB in the service which already solves the concurrency issues. I mentioned the Saga pattern as a general approach for solving comparable distributed transactional requirements, it may not necessarily be required here.


Razer Synapse Not Recognizing Chroma Devices

Question: I recently purchased a Razer BlackWidow Chroma RGB keyboard. It worked fine for a while using the Razer Synapse software to change the lighting effects and macros, but now whenever I launch Synapse with the keyboard plugged in, the software just says, "To get started, please connect a Razer Synapse enabled device". I have tried unplugging and plugging back in the keyboard, updating the software, and rebooting the (Windows 10 64 bit) system and it still doesn't work. The keyboard still works fine as a keyboard, but the Synapse software is required to use lots of its other functionality.
Comment: Have you contacted Razer for technical support?
Comment: Try what the people from [Tom's Hardware](http://www.tomshardware.com/answers/id-1616630/razer-blackwidow-synapse-problem.html) have tried. By how many posts there are, this seems to be a common problem. (Not surprised, it's Razer)
Answer: Once you have Synapse already installed, go to your task manager and end any Razer Synapse related processes. Make sure to check the background processes also.
When you've done this, unplug your keyboard from your computer, then re-launch Synapse. Once you're greeted with the menu saying to connect a Razer device, plug your keyboard back into your computer and it should recognize it.
if that doesn't work you can Go to control panel- device manager- search for your razer device which might be under controllers or under unidentified usb device. right click and click uninstall. if that doesnt work right click - uninstall and click remove drivers also. then restart your computer , open razer synapse, connect your device and wait for synapse to detect it.


surface area using cylindrical coordinates

Question: I'm going a little crazy to be able to figure this out. I have the surface given by the $z = xy$ plane inside the cylinder $x^2+ y^2=1$.
When I do the integral by Cartesian coordinates and then converting to polar.
$$
A = \int\int\sqrt{1 + (\partial z/\partial x)^2 + (\partial z/\partial y )^2}\,dx \, dy .
$$
EDIT:
$$
A = \int_0^{2\pi}\int_0^1\sqrt{1 +  \rho  ^2}\,\rho d\rho d\theta .
$$
$$
A =  \frac{2\pi}{3}(2 \sqrt{2} - 1).
$$
When I try to solve it by cylindrical coordinates I do not get the same result. How could i get it using cylindrical coordinates
?
Answer: Hint: $\quad dxdy=\rho d\rho d\theta$.


How do I write a story in which no one can understand each other?

Question: I have this story I want to write where there's different species that each speak their own different language, but none of them can understand each other at all.
Then the main character comes and starts gradually learning to understand each different language.
I have no idea how to go about it
Comment: Questions thar are narrowly focused on writing a specific story tend to get closed since any answers wouldn't  likely be useful to others. Consider focusing your question on aspects of pre-writing or story development that are currently giving you difficulty. Or whatever specific aspect of the art of storytelling you are struggling with.
Comment: Does the reader understand all these different languages, so you need to distinguish them in the text?  Or does the reader have the POV of the main character, so learns the languages along with that character?
Comment: Watch the scf-fi movie Enemy Mine ;)
Answer: You write about lack of understanding the same way you write about everything else: you give examples of it and explain it:

"Can I have another piece of cake?"
"Here's an apple."
Heather felt her mother never understood what she said.

As for how to write the acquisition of a foreign language specifically, this has been asked and answered multiple times on this site, for example in How do I write a character learning a foreign language? A good example for how this can be done effectively in a novel, is Shogun by James Clavell. Maybe read the beginning of it, where the protagonist learns Japanese.
Answer: Starting off here, I'm not a professional writer. I do love the concept of characters who don't understand each other! They could definitely communicate through gestures, pointing and miming and the like. It would be realistic for some of the characters to know some basic words from each other's languages, like how a lot of people know a little bit of Spanish, but don't speak it.
As for the main character picking up bits of the languages, you could just write it as "character one said something that character two recognised as meaning: hi."
again, I'm not a professional writer, just trying to give some tips.
Comment: Welcome to Writing.SE! You don't need to be a professional writer to contribute here, so no need to worry about that!
Answer: I would advise to analyze scenes from books or movies that deal with a similar problem. From the top of my head, I think of the old Stargate movie from the 90s. The protagonist meets a new, strange culture on an alien planet and tries to establish a form of communication with them. He meets this girl and they start to establish a common vocabulary, word by word - chicken, fire, house, their names. The more time they spend together the more intimate they become. It's pretty much how you would learn a foreign language the hard way (without books, teachers, translators, internet).
Try to start from there and let your characters interact with each other. Maybe some of them are not willing to be a teacher or have no patience with slow learners. What kind of teacher would you be? What kind of student?
Comment: One famous example is the Star Trek: TNG episode [Darmok](https://memory-alpha.fandom.com/wiki/Darmok_(episode)).


How to color status bar and navigation bar

Question: I really like that my status bar and navigation bar have the same colour with a running software without rooting, because I don't like black navigation bar, is there any way? If it's impossible without rooting, how about through accessibility service?
My smartphone: Huawei Ascend G7- L11
Please reply
Yours truly
Comment: As far as I can remember, there's an app that can change status bar color without root (from Settings->Accessibility permission), but I don't think you can change nav bar's color without rooting.
Comment: Tanks for your answer, what is its name
Answer: You can use this app to set the color of status bar through Accessibility Service :Color Status Bar
(Note: This app runs in background to enable the color.
And, this app will work only on devices running Android 5 or above..)
But to change the color of navigation bar, you need root access.
If your device is rooted, do the following to change navbar color:

Install Xposed Framework and Xposed Installer app.
Install "GravityBox" module (varies for different Android versions) and reboot.
Open GravityBox app, goto Navigation Bar Tweaks
Under Colors section, Enable Navbar Colors and set your desired color.
Comment: Thanks a lot but my android version is 4.4.4 Kitkat, is there any ship like that or ifs there any other way
Comment: Oh, is your phone rooted? Only then it's possible


RCD wiring with heating cable

Question:
Hi,
I want to use the heating tape (constant wattage) and I was told that I should use RCD for the safety. I am new to RCD so I wanted to double-check if this is a correct way to wire the RCD with the power supply and the heating cable.
Your help will be greatly appreciated.
Thank you.
Comment: Is there any other slot in the RCD for connecting the earth wire to it?
Comment: I think it doesn't have earth wire slot.  this is the one i'm looking at ( https://uk.rs-online.com/web/p/rcds/8929485/)
Answer: Note: You haven't mentioned your jurisdiction, but it is quite likely that you might need qualified/authorized electrician to perform electrical installation changes according to the Code.
That being said, yes, in your picture you connected RCD correctly.
RCD (also called GFCI or FID elsewhere in the world) is residual current device, which means it will measure the difference in current coming in from Live side and going out to Neutral side. If that current is bigger than its sensitivity (30mA in your case), it will break the connection. Single phase RCDs (as your in the picture) do not have ground connection (just 4 connections: Live in, Live out, Neutral in, Neutral out). See failure modes below on why.
Also note that "63A" marking on RCD is not any measure of its protection, it is simply maximum current rating that is capable of operating on. If you go over that, you will destroy your RCD (which you do not want).
Please note that you also need appropriately sized overcurrent circuit breaker (MCB) in addition to RCD (or get combined RCD/MCB in one package, sometimes called RCBO). For example, if your heating cable is 1000W, you would install 6A MCB (as that is first MCB size above 1000/240). If it is 2000W you would get 10A etc. In your picture, you would preferably connect it on L input before RCD.
You also need to monthly check your RCD by pressing "Test" button (yellow in your example) and verify that is tripping the RCD.
For those interested in details, let's see failure modes of your heating cable:

there could be very damaged isolation between L and N wires in it, causing very high short circuit currents, in which case almost any MCB will trip immediately due to its electomagnetic component. RCD would not help here, as all current coming in from L is going out thorough N.
there could be slightly damaged isolation between L and N wires in it, causing higher (but not extremely high) currents, in which case your MCB (if appropriately sized) will trip after some time (seconds to even minutes!) due to its thermal bimetal component. There could also be arcing involved is such case, where additional device called AFCI might help. RCD would not help here, as all current coming in from L is going out thorough N.
there could be damaged isolation between L and protective Ground mesh. In this case, current will go to protective ground cable. In this case, RCD will trip on very small current (0.03A leakage) as not all current that entered via L exited via N. If you did not have RCD, MCB would trip only if the isolation is totally gone (not on partial damage), and then only if grounding in your object was low-impedance (which may or may not be the case). Otherwise the damaged area would overheat, leading to fire hazard or melting isolation (and thus leading to other error modes).
there could be damaged isolation on L  is such a way that is exposed but does not touch the protective Ground mesh (for example if mesh was stripped during bad installation). In that case, if you did not have RCD, and you touched the exposed L, you could die, as the current would flow from L, through your body, to ground on which you stand (especially if it was for example in bathroom, and you were wet), causing cardiac arrest. With RCD, the current also would start to flow through your body, but RCD would detect that not all current has returned via N and would trip in the matter of milliseconds, thus saving your life.
Answer: No no no, you can't directly feed a branch circuit load off the pictured 63A breaker!
A breaker that size would be appropriate to feed a subpanel (e.g small secondary consumer unit), and inside that, you could have regular breakers of appropriate size (13A or 16A) to feed to the heating tape.  Every circuit thus fed would inherit the RCD protection from the pictured breaker.
It is normal in Europe to put the RCD on "the whole house" or a significant fraction of it. So 63A is a perfectly normal size for a 30ma rated RCD.  The purpose of the RCD is reduce house fires by catching partial-short ground faults, and also providing limited protection to humans against severe shocks.   This contrasts with American practice to put one 15-20A RCD (GFCI) per branch circuit, and the RCD is much more sensitive at 5 to 8 milliamps.   The primary purpose of that RCD is to protect humans from shocks of modest severity.  (A shock that stuns, also kills if it has knock-on effects of falling, drowning etc.)
So if you are powering a modest amount of heat tape (<2500 watts) and your primary purpose in RCD is due to an elevated risk of electrical shock, you may want to opt for a branch-circuit-sized 6ma RCD.
Comment: Hello, Thank you very much for your help. If I'm understanding it correctly, the 63A 30ma RCD is not sensitive enough to use for safety purpose, right? So I would need to get a 6ma RCD if I want to wire it as I described in the picture. I'm in the UK and the supplier that I'm looking at (RS component) doesn't sell 6ma RCD.. I was wondering RCDO would be a better and safer choice? such as 6 kA 25 A RCBO (with the trip sensitivity of 30mA)?  Thank you.
Comment: Yes, that would be better, but I am concerned that 25A is still a rather large breaker rating for a heating tape.  Does the tape's documentation have anything to say about circuit breaker size?
Comment: Generally, personnel protection RCDs in IECland are have IdeltaN ratings of 10mA (vs 6mA on UL943 Class A)
Comment: unfortunately, the heat cable's manual does not have any information about the circuit breaker size. I found '1P 10 kA 10 A RCBO, Trip Sensitivity 30mA', would 10A small enough? I will also email the heat cable's supplier to ask if they have recommending circuit breaker size.
Comment: @Tquestions can you get one with an IdeltaN (trip sensitivity) of 10mA vs 30mA?
Comment: I could do that, however the cost is much more expensive.. But, if it's much safer, then I can ask my supervisor to purchase 10mA one (i'm working on a project).  I just want to double-check that, smaller IdeltaN and smaller breaker rating (ex, 6A, 10A) would be safer than the opposite, right?  Thank you very much for your help.
Comment: 30mA is generally considered adequate for supplementary personal protection, unless it's an especially high risk area - primary school or kindergarten, or a patient treatment area.

RCD wiring with heating cable


Need Help with Python in Blender Game Engine

Question: I'm new to python code I usually use logic bricks in blender code. I wanted to use python more in my games and I need help in a bit of code. I want it to say that once I collide with an object it will come up with text saying Game Over or Wrong way, etc. Does anyone know how to do this?
Answer: Okay,
I'll give you an example of what you could do.
Add the collision sensor as you normally would, the way you want it, but named "Collision" and set to true pulse triggering, and connect that to a python controller with your script (eg. "Text.py"). You also need a text object, named "Text", with a Game Text Property.
Collision Sensor -----> Python Controller

Then, inside the script (eg. "Text.py"), type the following:
from bge import logic

cont = logic.getCurrentController()
own = cont.owner
sce = logic.getCurrentScene()

collision = own.sensors["Collision"]
text = sce.objects["Text"]

if collision.positive:
    text["Text"] = "Wrong Way!"
else:
    text["Text"] = ""

Tell me if you need any more help.
Answer: Since you are more comfortable using the logic bricks, and this can easily be done with logic bricks, I will use logic bricks.
The Collision sensor is what does it all. I have a "end game plane" with the collision sensor set to only collide with the player's material (you could also use a game property).

When a collision is detected it adds a overlay scene, where I have the text. It also Suspends the main scene (stopping the game play), the two Filter actuators just make the screen turn grey scale and blurred.
Here is my fully working demo. Arrow keys drive the player (cube). Have a look at the HUD scene to see the text and camera.
Blend File


How are zombie processes handled when the parent dies?

Question: Which technique does the Unix system use to remove zombie processes whose parent has terminated?
Comment: This SE is better suited if ask only a single question in a post or restrict yourself to questions concerning the same issue. Second show some research effort rather then just copying your homework assignment. For instance: ow do you know that there are only or at least 3 ways?....
Comment: I am studying actually and these are revision questions, separate ones so I dont think they are related. I can't find the answer anywhere
Answer: When a process's parent dies, init (process 1) adopts the process. It will then reap adopted precesses that are or become zombies.
Reaping is normally done by the parent, as the parent needs to know when the child dies. It also has to stop the pid of the child being reused, until the parent knows, so that the parent does not signal the wrong process (signals the correct pid, but the pid now belongs to a new process.). In the reaping process the parent should forget about the child.
Answer: If a process terminates,and that process has children in the zombie state,the parents process ID of all the zombie children is set to 1(the init process) which will inherit the children and clean them up(i.e., init will wait for them,which removes the zombie).


Extending LatinIME

Question: I want to extend android's default IME, LatinIME. I cloned LatinIME's Android 2.1 tag from here, but there are some issues with the code.
For example in the class CandidateView the variable mScrollX is used, which is part of View, the extended class. But turns out that with the public SDK, that variable is private so it can't be used by children classes.
What I found in Google to be the solution to this is to change the use of mScrollX for the public getters of View, but the code also sets that variable and there are no setters available.
Another issue is that com.android.internal.R is used, which also isn't public available.
How am I supposed to extend LatinIME? Has anyone tried to do something like this?
Answer: Use this:
int scrollX = getScrollX();

Extending LatinIME


Replace linux system over SSH

Question: I have a lot of linux systems running in places where I can only access them over SSH, the problem is that I need to write over the system harddrive on those systems to update them. I wonder about the best way to do this?
Comment: There's not a lot of detail in your question. You might find that the amount of work people put into their answers corresponds to the amount of work you put into describing your problem.
Answer: I would suggest creating a 2. Partition, install everything chrooted to this Partition and configure Grub to try to boot the new system on startup, I would also configure a Fail over so that Grub only tires to boot the new system the next time, and then again boots the old system if it fails and you reboot again. When everything is running fine configure Grub to boot the new system by default, and you can erease the old one. After all is done you can recombine the Partions if you like, but it might be smart to keep them around just in case you are doing something like this again.
Comment: how will Ola accomplish this over SSH?
Comment: Well I don't see anything you can't do via SSH, partition creation can bedone via fdisk ie, I don't know from the top of my head wether it can shrik Partitions but there is a way to do this. Configuring Grub is just a Textfile, and issue a reboot command is not a problem, as well as installing a System in a chroot. I guess the only problem would be a 2. reboot if the new system fails to boot, but even a really simple host offers some way to reboot the server.
Comment: I was thinking about something like this, I was also wondering if I could make a ramdisk and chroot to that one and work from there so I don't have to reboot in between only after the work is done. But I don't know if this is possible.
Answer: This Debian-centric howto should be helpful, if not exactly what you need.
Answer: There are ways with some kickstart trickery, but it shouldn't really be done. Someone has to have physical access to the machine, why can't they do it?
Comment: This might have nontrivial costs for a VPS, depending on the plan.
Comment: The reason to do this is costs, as I mentioned above I have a lot of these systems (>300) and they are part of a bigger machine and not easy accessible so it will take time to get physical access to all of them. So if I spend 1 week scripting an automated update over ssh I will save a lot of time.

Replace linux system over SSH


Python SSH vs SSL?

Question: I read the What is the difference between SSL vs SSH? Which is more secure? , and it mentions there is the possibility they can be affected by similar attacks.   Now that the heartbleed thing is out, is the ssh used in python through Paramiko affected by this?
Answer: The Hearbleed security bug (CVE-2014-0160) affects only specific versions of OpenSSL, and nothing else.
From OpenSSL Security Advisory [07 Apr 2014], on OpenSSL's web site:

Only 1.0.1 and 1.0.2-beta releases of OpenSSL are affected including
  1.0.1f and 1.0.2-beta1.

So, to answer your question: It depends on whether OpenSSL is used on your system, and which version is currently installed.
If you notice your system is vulnerable, the recommendation is to:

Patch the OpenSSL component as soon as possible;
Renew the X.509 certificate that's used by OpenSSL;
Change (or enforce changing) the passwords of all accounts on the system.

To mitigate the risks associated with the Heartbleed bug, all of the above steps are necessary, and must be executed in the correct order.

Python SSH vs SSL?


optimal search algorithm for finding parameters and thresholds

Question: I have the following problem:
There are $n$ variables $x_i$, $i=1...n$, each can take integer values from 1 to $m$. For every set of values I can run a test which has a binary outcome ('Pass' or 'Fail'), and it is known that the test outcome only depends on a value of a single variable being larger than some threshold. That is, the outcome is 'Pass' if $x_k \ge c$ and 'Fail' if $x_k < c$.
My goal is to find $k$ and $c$ (i.e. which variable is causing the failure and what is the threshold).
My thinking so far is as follows: if I know $k$ and only need to find $c$, than I can do a binary search and find the threshold in $\log_2 m$ steps. If I know $c$ and don't know $k$, I can similarly find it in $\log_2 n$ steps (by setting half of the variables to a value above the threshold and the other half to a value below, thus excluding half of the possibilities, etc.).
I can also first find $c$ in a similar way using a binary search, each time setting all the variables to the same value, and afterwards find $k$ as before. This will take a total of $\log_2 m + \log_2 n = \log_2 nm$ steps.
It seems however that this might not be the optimal approach. So my question is: Is there an algorithm that can find the answer in less than $\log_2 nm$ steps ?
(also, if someone has a suggestion for improving the title of this question, that would be welcome)
Answer: No, it's not possible to use fewer steps than that.  Each test gives you one bit of information about the solution.  There are $nm$ possible solutions, so you need $\lg(nm)$ bits of information to uniquely identify the solution -- which means you need at least $\lg(nm)$ tests.


Backtest with mid-quotes?

Question: I have built a trading strategy and also a backtest. The backtest has been a lot of work. I was using mid-prices throughout. It's based on candles, so I make trading decisions at the end of each bar. Recently I changed it to use the bid and ask. So for example to decide if a trade was stopped out I now use the bid/ask high or low (depending if I'm long or short) of the previous bar, rather than the mid high/low. Now, I'm getting much worse test results. It's possible that due to complicating the backtest code i have introduced bugs. I am wondering if others are backtesting based on mid rates, and then do a forward test as the main stop/go flag. Intuitively I am thinking that I don't want to have too much code in the backtest to keep it simple, then do most testing in the forward test. But on the other hand I don't want a useless backtest since I intend to use it to develop new trading strategies quickly. Have others implemented full stop loss management in their backtests, or is this over complicating it? Have you made simplifications such as using mid-rates rather than bid/ask everywhere?
Comment: yes,  but, for the time frames you're using, it will matter. When you say, bid-ask , you mea that you sell at  bid and buy at ask ?  That seems more reasonable to me. You also need to add in some transaction cost number ( for slippage, brokerage etc ).  Someone with experience in intraday equities, said that 10 bps for round trip is reasonable. Not sure for currency. Also, you need to approximate how much you can buy in the time you have. You can use the U-shaped volume distribution along with some average trading volume to approximate that. The whole backtest is an approximation in fact.
Comment: I don't know if I can help anyway but what is your average holding period ? In other words, are you buying and selling intraday ? It sounds like that is the case but I wanted to confirm for me and others who may not be sure either.
Comment: I am looking at several different timeframes at the minute. 1m, 5m, 15m, 1H and 4H ... so yes, all intraday. I should add this is all theoretical at the minute, I am building the algo but I have not placed a single live trade through it because I want to have a solid backtesting capability in place first.
Comment: I'm only looking at EUR/USD by the way.
Comment: @markleeds Reading between the lines, are you saying that above a certain timeframe, it does not matter if using mid or bid/ask? Which timeframe?
Answer: I once did a backtest of a very interesting strategy that involved frequently (every few days) trading credit default swaps. If I assumed that I could execute at mid, then the strategy made decent returns. However if I assumed 5 bps bid-ask spread (i.e. only 2.5 bps above and below the mid - somewhat optimistic), then the strategy lost money.
My advice to you is to look at both what your strategy would do if you could execute at mid, and also what it would do if you included the bid-ask spreads that you observe now, or have history for. Further, a stress-test assuming much wider bid-ask is always a good practice.
Comment: Thank you for taking the time to comment. I have observed same thing as you. I would to build my backtest using bid/ask if I can, because its closer to the Production siutation when I put the algo live. So i hopefully reduce my chance of a surprise.

Backtest with mid-quotes?


I want to initialize any 3 qubit state in Qiskit

Question: The state of interest is (1/sqrt(2))|000> + (1/sqrt(2))|111>. How do I initialize this state in Qiskit ?
I know if I plot a histogram it will have 50% probability for |000> and 50% probability for |111>. I have no idea how to evolve it with gates yet, but I will be content with simply initializing it for now.
Thank you.
Will be happy if I also get bonus code for statevector_simulator, unitary_simulator, counts and plot_histogram
Answer:
Initialize 3 qubits in 0 state: 000

Apply Hadamard (H) to the first one: 000 -> 000+100

Apply CNOT between first and second: 000+100 -> 000+110

Apply CNOT between first (or second) and third: 000+110 -> 000+111
Answer: The circuit you are trying to create is something like this:

You can do this in Qiskit as follow:
from qiskit import QuantumCircuit
GHZ_qc = QuantumCircuit(3)
GHZ_qc.h(0)
[GHZ_qc.cx(i,i+1) for i in range(2)]
GHZ_qc.draw()

Out[1]:
     ┌───┐
q_0: ┤ H ├──■───────
     └───┘┌─┴─┐
q_1: ─────┤ X ├──■──
          └───┘┌─┴─┐
q_2: ──────────┤ X ├
               └───┘

Answer: Here's the direct way.
Make a size 8 vector (because it's 2^3qubits) filled with the corresponding amplitudes, going from |000>, |001> .. |110>, |111>. Since in ghz case only |000> and |111> share the total amplitude, fill only those.
ghz = [1/sqrt(2), 0, 0, 0, 0, 0, 0, 1/sqrt(2)]
qc = QuantumCircuit(3)
qc.initialize(ghz)
You can also initialize a subset of qubits by adding a (list of) qubit(s) parameter. Of course, the supplied vector size will have to match.
Enjoy :)


Projective Normality - Equivalent Condition

Question: This is problem II.5.14(d) in Hartshorne - I have done parts (a) - (c). The question is this.
A scheme is called normal if all its local rings are integrally closed integral domains, and a subscheme of $\mathbb{P}^r_A$ is projectively normal if its homogeneous coordinate ring is an integrally closed domain.
The question is to show that such a subscheme is projectively normal if and only if it is normal, and for every $n \geq 0$, the natural map $\Gamma(\mathbb{P}^r, \mathcal{O}_{\mathbb{P}^r}(n)) \to \Gamma(X, \mathcal{O}_X(n))$ is surjective. I'm having trouble specifically with the 'normal + surjection $\implies$ projectively normal' direction.
I am told this is a corollary to part (a) of the problem, which says that if $X$ is a connected normal closed subscheme of $\mathbb{P}^r_k$, then the ring $S' = \bigoplus_{n \geq 0} \Gamma(X, \mathcal{O}_X(n))$ is the integral closure of $S$. The only thing that stands out to me is that I can put these surjections together to get a surjection onto $S'$. But I need to show $S$ is integrally closed, and I appear to be stuck. Can anyone point me in the right direction?
Answer: This wasn't hard - I'm just dumb. Sticking these maps together like I thought, we have a map $$\bigoplus_{n \geq 0} \Gamma (\mathbb{P}^r, \mathcal{O}_{\mathbb{P}^r}(n)) \to \bigoplus_{n \geq 0} \Gamma(X, \mathcal{O}_X(n))$$
And this map is surjective onto $S \subseteq S'$, from the definition of $S$. Yet this map is surjective, and the summand on the right is $S'$. So if the image is $S$ and the whole ring is $S'$, they're equal.


Resistor power ratings

Question: Fuses, circuit breakers, transistors, ect... are all rated in amps. Why are resistors rated in watts instead of amps? Does their breakdown/failure include more than just heat?
Comment: Pragmatically, the manufacturers do not want to provide individualized Ampere ratings for each resistor in a series. So they use power ratings. This allows them to say that the power rating is 0.25W (or whatever) and then just list all the available values in one table.
Comment: Transistors, zener diodes, are also rated in watts
Answer: Resistors commonly fail when asked to dissipate too much power - the permissible power is given in Watts.  The power dissipated in a resistor is determined by its resistance, and the currrent through it, or the voltage across it.
Resistors do also have a maximum voltage rating, which is independent of the resistor value.  All resistors of a given style (size and construction) will have the same power and voltage ratings.
I don't think I've seen a maximum current rating for a resistor.
Comment: Actually I think I just reasoned through my own confusion. In my previous comment I used 2 different resistors and I realized that was incorrect that I should have posed the question using a single resistor. But with a fixed resistance value you cant arbitrarily select both voltage and current.
Comment: My train of thought was on high power transmission lines that use very high voltage and lower current to deliver the same amount of wattage long distances with less joule heating. If a resistors failure mode is due to heat then shouldn't the same principle apply? So would a 10Kohm 1W resistor fail just as soon with 100V and 10mA as a 1ohm 1W resistor would with 1V and 1A even though the later should heat up more?
Answer: A power rating on a resistor already specifies the current and voltage ratings on it as well. We know that P = I*V = I^2*R = V^2/R. From a power rating, we can derive the voltage and current limits.
The failure mode of resistors is primarily due to heat. The resistivity of materials is dependent on temperature and the thermal stress due to excessive temperatures and deform or destroy the structure or packaging of the resistor.
Something like a fuse is rated in amps because the purpose is for it to fail open at a specified current.
Answer: Resistors are rated by power because all of a given series of resistor (same length, diameter, material) will have the same power rating (same maximum temperature and thermal resistance to the surrounding air). So, a given series of resistors will have dozens of different resistance values, but all will have the same power rating.
If resistors were rated by current, then every single resistor part number would have a different rating, and the current ratings would be all over the map. For instance, this resistor kit has 20 different resistance values, all with the same power rating (1/4 watt):

If resistors were rated by current then each resistance value would have its own current rating. Much more confusing.

Resistor power ratings


Longer LK4 Pro moving to corner mid print

Question: My printer is the Longer LK4 Pro, and I just got it 2 days ago. When I started to print some objects, on a certain layer, the printer would stop and move to the far right corner of my bed. What can I do to fix this?
Comment: Hi, welcome to 3DPrinting.SE! Is it instructed to do so? Have you checked the G-code file? Do you know what layer? What layer is it printing, e.g. a very small one, is it happening with all prints? Please add more context to the question, otherwise it will be difficult to troubleshoot.
Answer: It's possible that the slicer is using a minimum cooling time per layer and the corner is set as its home coordinates.  In the settings of your printer you can set the home coordinates and in the slicer you can reduce/remove the time between layers.


What is the difference between identification, calibration and estimation?

Question: In fitting theoretical models to data, what is the difference between identification, calibration and estimation?
Answer: Identification and estimation are often used interchangeably (at least that's my observation from attending conferences and reading papers) but according to econometric literature there is a subtle difference.
For example, in the John Stachurski "A Primer in Econometric Theory" the identification is a process of finding out if the parameters are identifiable and identifiability is defined as

"Identifiability means that the parameter vector associated with the unknown distribution can eventually be distinguished from the data."

I will omit all the other formalism that follows but in essence we can say that parameter is identified if the map from the parameter space to the space of probability distributions of observables can be inverted.
The estimation is actually the process of calculating what the actual parameter $\hat{\beta}$ is.
When it comes to calibration in forecasting it is the comparison of model estimates to actual data with an aim to improve the model fit.
In macroeconomics it is a strategy for finding numerical values for the parameters of artificial economic worlds. A model is calibrated when its parameters are quantified from casual empiricism or unrelated economic studies or are chosen to guarantee that the model mimics some particular feature of the historical data. In other fields it might have different uses as well.
Comment: @BeckBatucada thats pretty much what I meant by the definition used in macro, if you think that this wording improves the answer I can change it.
Comment: I guess if you add something along these lines, I can accept your answer.

Calibration  is  a  strategy  for  finding  numerical  values  for the parameters of artificial economic worlds. A model is calibrated when its parameters are quantified from casual empiricism or unrelated economic studies or are chosen to guarantee that the model mimics some particular feature of the historical data.
Answer: I agree with 1muflon1, but allow me to add some more nuance.
Identification and calibration can be meant to express a subset of estimation. Any identified coefficient is also an estimate, but not vice-versa.
An identified estimate is any estimate that fulfills certain conditions that make it the true number we want.
For example, any coefficients from (estimating) an OLS regression are estimates. However, a coefficient from an OLS model that fulfills all the OLS assumptions for an unbiased consistent estimate (e.g. no relationship between the error terms and the independent variable) is an identified estimate. Only such a model "achieves identification" or allows authors to state "we identify the effect".
Calibration is relevant when data is used to quantify a theoretical model. There are different ways to do it and hence different potential meanings behind the term.
If you want to produce real-world relevant numbers based on a model (theory) you will need to input certain numbers called "parameters." Inputting those numbers is what it means to say we "calibrate the model by ...". This is what all calibration meanings have in common.
How those numbers are estimated is a different story. Ideally these parameters would also be "identified". Sometimes researchers will calibrate by using parameters from the literature or an identified regression model.
More often calibration is done by trying out different values for the parameters until the model achieves predictions with the least deviation from the data or reproduces some other empirical features. I believe this is the meaning of calibration that is most commonly used in the context of the OP.
Comment: Great addition +1
Comment: "Identification and calibration can be meant to express a subset of estimation" is clearly not true. Identification is a statement about a (parametric) model, with respect to the parameter---the injectivity of the mapping from parameter space to distribution of data . Estimation is concerned with mappings from data to parameter space, i.e. estimators.
Comment: @Michael, that is why i say it CAN be meant that. While not strictly true, my personal experience is that a large number of economists use these terms in this fashion. The fact is the statement "we identify x" also implies in practice that the authors "estimate a coefficient for x" (but the reverse is not true).  This seems to be what the OP is confused about. Granted this response and question is more about linguistics/jargon than economic/ statistical science.
Comment: Identification in econometrics, and identification in applied micro clearly mean different things.
Answer: Identification = uniqueness of parameter value given data, estimation and calibration = finding parameter value with error and with no error according to some criterion that expresses the quality of the match between model outcomes and their data counterpart, all takes place for a particular model and data
Comment: Calibration means that you run your model using certain parameter values obtained from the real world and see the performance against the observed data. Estimation is the calculation of those parameters' values based on the observed data (and the analysis of how acceptable the value fitting is).


Will a bulb glow brighter if voltage is increased but current remains the same?

Question: I understand that increasing voltage increases the energy given to each coulomb in the circuit, so in theory more energy given to a bulb should make a bulb glow brighter. But also if voltage is constant and resistance decreases, then current increases so that means that the bulb glows brighter too because more coulombs are flowing through it per second. But what happens if voltage and resistance are increased proportionately so that current remains the same? More energy is supplied to each coulomb so it should make the bulb grow brighter right? Or have I made some error?
Comment: The bulb with get brighter. Power is equal to $V^2/R$, so if you increase V and R at the same rate then power will increase. Note that with real incandescent light bulbs the resistance of the filament increases a lot from the bulb's "off" state to its "on" stage due to the fact that the resistance depends on temperature.
Answer: Without changing the characteristics of the light bulb, it's not possible to change the voltage if you want the current to stay the same. When the voltage is increased, the current through the bulb has to increase as well, because of Ohm's law: $I=V/R$ which means that if $V$ increases, so does $I$.
If you want the current to stay the same when the voltage increases, you need to insert additional resistance in series with the bulb's filament. That additional resistor will show a voltage drop of $V_1=I*R_1$, which is exactly the increase in applied voltage, and the voltage over the bulb will still be the same as the original. This extra resistor now dissipates the additional power.
If this extra resistor is part of the bulb's filament (so we now have a different bulb), then that extra power will make the bulb brighter, because $P=V*I$.
Answer: If you are comparing two voltages with identical currents, you cannot be talking about the same bulb in both cases. This means that you are comparing two different bulbs, and there is no way to tell which will be brighter, since different bulbs can be designed for different luminous efficacy, which is light per unit power. For instance, a bulb can be designed with a longer filament and operated at a lower temperature and produce less light, but last longer since the filament is run cooler.
If you are comparing two bulbs with similar efficacy, then the bulb run at the higher voltage will be brighter due to its greater power dissipation.
Comment: Sorry, no (or, not necessarily). Power may be greater, but that does not meant the filament is hotter and putting out more light. If you're talking about the same bulb in both cases, equal current implies equal voltage, so power is the same. Since you're saying different voltage for the same power this means different bulbs. Different filaments will not produce the same light for the same power, so you just can't tell which lamp will be brighter.
Comment: Thanks for your answer but I already thought of an answer: P=VI. At the same current, power out will be greater, so the bulb glows brighter.
Comment: @Airdish It may be more intuitive to write P=V I(V) . Current is a function of voltage for the device. That function is roughly I(V)=kV. So P=kV^2 . That's true for all memoryless (resistive) devices. You could come up with a device that let's you control it's current for any input voltage (say a variable resistor). In that case all you can say is the consumed power is P= VI, but you cannot take further conclusions as luminosity or such.
Answer: When voltage is increased , according to $P=VI$ power will increase. Consequently the bulb will glow brighter.
Answer: Yes, It will get brighter up to a point of failure, but no standard bulb can do that. Your question framed the conditions as 'If voltage and resistance are increased proportionately keeping current constant'. The intensity of light produced from a given bulb comes the resistance  built into the bulb. Each bulb has a maximum voltage potential that it can utilize or withstand from that design, but its resistance is fixed.
Answer: Distance if the distance stays the same then yeah but if not than no.
and a different type of connector
Adding a resistor
 The current depend from where are you measuring it, it will be some different throughout the circuit.
As well
An electric current is a flow of electric charge. In electric circuits this charge is often carried by moving electrons in a wire. It can also be carried by ions in an electrolyte, or by both ions and electrons such as in a plasma.
Nop Nop the current through what!! the wir ? light?
It really different on the type of the light some are programmed to stay the same or don't you lot of voltage they putt gas so it will not use as much energy as it produce light and heat. So
Answer is the light will blow up! if the voltage is high and it depends how much you're adding.
No the next Einstein.


Hypercharge of the complex Higgs doublet

Question: I was wondering how one can see that the hypercharge of the complex Higgs doublet is $Y=\frac{1}{2}$.
Complex Higgs doublet.
$$
\Phi(x) = \begin{pmatrix}\ \Phi^{+}(x)\\ \Phi^{0}(x) \end{pmatrix}
$$
Lagrangian density:
$$
L = \frac{1}{2}\partial_{\mu}\Phi^{\dagger}\partial_{\mu}\Phi + \frac{m^2}{2}\vert{\Phi(x)}\vert^2 + \frac{\lambda}{4!}\vert{\Phi(x)}\vert^4
$$
There is now a local $U(1)_Y$ symmetry called hypercharge, given by $\Phi'(x) = e^{-i\tfrac{1}{2}\varphi}\Phi(x)$. But how is the hypercharged deduced? I would really ask more specific questions, but I dont really get it and I am learning this stuff just for me, because I am interested how it works.
Comment: The $SU(2)_L \times U(1)_Y$  is a (local) gauge symmetry, not a global symmetry. Use the formula $Q= T_3 + \frac{Y}{2}$ to obtain the hypercharge. Here $Q$ is the electric charge and $T_3$ is the eigenvalue of the $SU(2)$ $T_3$ generator ($\frac{1}{2}$ for the first member of the doublet and $-\frac{1}{2}$ for the second member of the doublet ). Your doublet is not "correct" because you have a different value of $Y$ for the two members of the doublet. You have to choose, for instance $(\Phi_+,\Phi_0)$, corresponding to  $Y = 1$  or $(\Phi_0,\Phi_-)$,  corresponding to  $Y = -1$
Comment: thanks for the remarks. I see that with $T_3 = \tfrac{1}{2}\sigma^3$ the eigenvalues are $\tfrac{1}{2}, -\tfrac{1}{2}$. Using this one gets Q=1 for $\Phi^{+}$ and Q = 0 for  $\Phi^{0}$ with Y = 1. But why is there written $\tfrac{1}{2}$ and $-\tfrac{1}{2}$ ?
Comment: Sorry, I don't understand clearly your question...
Comment: is there a convention where one uses $Y_{\Phi}=\tfrac{1}{2}$ and $Y_{\tilde{\Phi}}=-\tfrac{1}{2}$? becuase that is what is written in my notes...
Comment: OK. I think some authors describe the hypercharge by $Q= T_3+Y$ instead of $Q= T_3 + \frac{Y}{2}$. So you have to check the definition in your notes...
Answer: The hypercharge of a doublet cannot be "deduced". When one builds a gauge theory, the first step is to define the particle content of your theory and to postulate the representation of all particle multiplets. In particular, if the gauge group is abelian, then we have to assign numbers usually called charges.
So, I reformulate your question: Why do we choose the hypercharge of the Higgs doublet to be $Y=1$? The idea is that we want to respect the Gell-Mann–Nishijima formula $Y=2(Q-T_3)$. Since we know the charges and the values of $T_3=\pm 1/2$ for the doublet, it is straightforward to find that $Y=1$.
There are several ways to see why the formula $Y=2(Q-T_3)$ must be respected:

One possibility is to compute the commutator of the generators $Q$ and $T_i$. You will notice that $[Q,T_i]=[T_3,T_i]\neq0$, but $[Q-T_3,T_i]=0$. This means that the global symmetries $SU(2)$ and $U(1)_{\rm em}$ cannot be simultaneously satisfied, but we can define the hypercharge $Y$ as new Abelian symmetry.
Other possibility is to try to assign Abelian charges for the
fermionic multiplets of the Standard Model (knowing that the charge
must be the same for all members of a multiplet). You will conclude that $Y=2(Q-T_3)$ is the only possible choice up to a multiplicative
constant.


Is there a way to call/invoke a (private) Java function in an app?

Question: Is there some tool that can be used in ADB shell or something similar (without root possibly) that can invoke a function in the app, while it is running?
Answer: Rooted device
On rooted devices private function in apps can be called quite easily (in most cases) using a tool like Frida. Frida is like a mixture of a "scriptable debugger" and Xposed framework with the difference that you don't have to deal with low-level code like regular debuggers and the disadvantage of Xposed that when changing your scripting code you don't have to reboot the whole phone.
Frida allows to write JavaScript code that is executed within the app and you also have an interactive shell for finding or creating class instances, calling functions and so on. Frida is like a Swiss-Army-Knife for reverse-engineering and third party app debugging.
Unrooted device
On an unrooted device and an app that is a regular release app (not a debug build) you can't invoke a function within the app without modifying the app.
For example you could try to decompile the app using apktool, modify the Smali code to execute the function e.g. if a certain UI button is pressed and recompile and resign the app with a new certificate. But be aware that Smali is a very low-level language - so even if you are familiar with Java and Android development modifying Smali code will be challenging
Comment: If you resign an app, it won't install without fully removing the app, including the app files. Or is there some way to keep them, for I would like to preserve these files.
Comment: @hiddenhospitalresearch That is correct, you have to delete app data. If you install the app via adb you can use `adb install -r ` which will delete app data. If the app allows backup via adb you can try to backup the app data using `adb backup ` (check .ab file size afterwards success = file size is larger than 1KB) and after replacing the app restore the backup data.


CUDA: Synchronize global memory writing & reading with compute capability 1.1

Question: Well, found the solution on nVidia forums (https://devtalk.nvidia.com/default/topic/458062/atomicadd-float-float-atomicmul-float-float-/).
Thanks.
Comment: As you have Compute 1.1 GPU, you can serialize simultaneous writes to the same memory location by using atomic operations.
Comment: CUDA programming guide 3.1 - B.11.1.1:

_The floating-point version of atomicAdd() is only supported by devices of compute capability 2.0._
Comment: @eg141840 sgar91 didn't say you should use atomicAdd, he said atomic operations (_hint_ any atomic operation can be implemented based on atomicCAS() _hint_)
Answer: Firstly, this code is a mess of repetitive garble that'd make debugging quite painful. Work out which sub-expressions are redundant and separate them into different variables, so that your code becomes more legible. Otherwise, it makes about as much sense to ask for help regarding this code as it'd make to ask for help winning the lottery. Nobody's going to bother reading your code because it's an eyesore.
Get a single-threaded solution running. Use a profiler to determine which parts of this code would be best exposed to parallelisation, otherwise your optimisation is just guesswork which you can't put in measurable terms. I would guess that once you have the single-threaded solution running, you might get fairly good performance from running that same solution, in parallel, on each core, on an independant range of values so there's virtually no need for synchronisation.
Answer: Serialization can be achieved by using Atomic Functions.
Compute Capability 1.1 does not support atomicAdd() for floating point numbers but any atomic operation can be implemented based on atomicCAS() (Compare And Swap).


Open emacs in Dired mode

Question: I would like to open emacs in dired mode . files and folders should be organised in most recent file first order. Moreover I would like to highlight the Org files for easy selection. Is this possible?
Answer: If you provide a directory on the command-line, it opens in dired mode.  For example
emacs .

...will open the current directory in dired mode.
The variable `dired-listing-switches' contains the switches sent to the ls command.  So adding
(setq dired-listing-switches "-lart")

to your startup config (or customizing it) should do what you want.
You can mark org files with dired-mark-files-regexp as follows:
emacs -Q . --eval '(dired-mark-files-regexp "\\.org$")' &

Open emacs in Dired mode


Not eating dinner, benefits and detriments?

Question: Google turns up conflicting result for this and that's why I though it best to ask it here. I was told by a friend that not eating dinner will help in losing weight. But then someone else said that that was not true; she said that it will make you weak because you sleep on empty stomach which might be harmful to your health in the long run. I wonder if any of these myths are true.
Answer: Not eating dinner helps you lose weight in one way: it reduces your total daily calorie intake. But that does not mean that its a good idea.
If you are in a caloric deficit, you WILL lose weight, but the way in which you reach the deficit also matters.
What and when you eat triggers various hormonal responses, and some of them can support healthy fat loss, others can prevent it. For example, high insulin levels make it hard for your body to burn fat. The topic is vast, but going to sleep hungry isnt necessairly a good signal to the body's metabolism.
Also, if you have been working out, most of the regeneration takes place duringg sleep. You want to have enough nutrients, like proteins, for your body to best use the regeneration time.
So, to sum it up, you SHOULD eat dinner, but make a smart choice of what to eat. It should be high in protein, low in fat and sugar. Farm cheese could be a good choice, for example.
Comment: I would also add that once you go under a certain amount of calorie intake you risk losing muscle along with the fat, which isnot at all what you want. That's one of many reasons why it's important to pair healthy eating with exercise.


WordPress hosted on AWS EC2

Question: I have a client who has a WordPress site on AWS. I'm wondering if I update WordPress core and plugins do I need to create a new AMI based on the current instance, create a new launch configuration using the new instance for the auto-scaling group? Do I then delete the old instance? I've tried reading the AWS documentation but it's not clear to me. Any help appreciated!
Answer: This type of question isn't accepted on WordPress's Stack Exchange. Please check the Accepted Topics. Below is some information for you.
If the client's WordPress site is running on an Amazon EC2 instance, then you don't need to do anything. WordPress Core, Plugin, and Themes can be updated from the WordPress Admin Dashboard without having to do anything with the instance.
But if the client's site was deployed using Amazon RDS and Elastic Beanstalk for high availability, then you will have to deploy WordPress on another instance of Elastic Beanstalk by first backing up your original WordPress site. The steps can be found at Deploying a High-Availability WordPress Website with an External Amazon RDS Database to Elastic Beanstalk
If you want to move to a new Instance of EC2 for some reason and set up WordPress on it, then I would recommend that you follow Digital Ocean's Guide for Installing WordPress on Ubuntu 18.04 after you have created the EC2 instance and SSH-ed into it. You can find the guide for various other linux versions on that page as well.
If you want it to be in such a way that everything is automatically set up for you, then you should Launch WordPress with OpenLiteSpeed on AWS. The marketplace has the script build and will launch everything for you. You just need to point your domain name to the IP you get for the instance, open the site, follow WordPress 1 minute setup (First User Setup. You don't have to add database information.), then export whatever you want. Updates to WordPress Core, Plugins, and Themes happen from the WordPress Admin Dashboard.
Comment: Thank you, @Anteraez
Comment: @nancyolson531 I hope the answer helps you. If you have questions regarding AWS, you can ask them on [Super User](https://superuser.com/questions/tagged/amazon-web-services?tab=Newest). Check [this answer](https://meta.stackexchange.com/a/141944/634157) to know which questions regarding AWS should be asked where.
Comment: Thank you again! I appreciate you pointing me in the right direction!
Answer: When upgrading WordPress core or updating WordPress themes and plugins from the WordPress dashboard, you do not have to make any changes to the EC2 instance.
However, before performing upgrades on the EC2 server, I would recommend you to take a full backup of your WordPress files and database, as you may start to run into issues when upgrading PHP for example.
To host a WordPress website on AWS, you can follow this guide on how to create a WordPress website on AWS EC2 on Ubuntu 18.04 using a LAMP stack (Linux, Apache, MySQL, PHP)

WordPress hosted on AWS EC2