I bought a rooted LG g2 phone on ebay should I be worried?

Question: As the title says. I bought a new lg g2 from eBay. After playing around with it for about 2 weeks I noticed that it is rooted and has a Chinese superuser app installed. I heard a while ago that some phones bought from eBay had viruses on it so I am wondering for what other purpose would the phone come rooted other than to install certain programs that I wouldn't notice. Also, is there a way to unroot it and remove all rooted permissions that might have been added without having to delete all data on my phone? Thank you.
Answer: You didn't write in which area you live, and from which eBay domain/seller location you've bought the device. But assuming you're not living in China, I'd be worried. Not for the device being rooted in general – but a Chinese superuser app sounds pretty suspicious.
Now other answers suggested unrooting and wiping. But I'm afraid that might not be enough: Once rooted, the "rooter" could have installed other malicious apps as system apps (see: system-apps and its tag-wiki for an explanation). Neither unrooting nor wiping (or performing a factory-reset) would remove those. So to really be on the safe side:

Get yourself a fresh ROM image to flash (see: Where can I find stock or custom ROMs for my Android device?) This can be either a "stock ROM" (the official one from LG in your case), or – as the device is already rooted – any custom ROM (the latter having the advantage of being more up-to-date in most cases).
If you decided for a custom ROM, this might require a custom recovery (see: recovery-mode and its tag-wiki for details). Check whether that's already installed (boot into recovery, and see if the "title line" reads something with <3e> (which indicates the stock recovery), or some other name like "ClockworkMod" or "TWRP"/"TeamWin Recovery" – which are the two major custom recoveries). If not, do so.
Flash the new ROM. This should basically overwrite everything except for user-data and cache.
From the recovery menu, chose to "wipe" /data, /cache, and (if offered) also Dalvik-Cache. That should remove all remaining stuff from the device.
Optionally: Deal with your SD card, if there was any inserted. Malware could have placed something there, so best is to format this as well.

Now you should have "wiped off" all potential evil from the device – as far as you can do so yourself. The only remaining part is the radio-firmware; but I doubt anyone would have tampered with that. If you want to be "absolutely sure", check above link for a radio image as well, which you optimally should flash before the other parts.
Comment: I'd say because of "news" like this: [Xiaomi Phones Secretly Sending Users' Sensitive Data to Chinese Servers](http://thehackernews.com/2014/08/xiaomi-phones-secretly-sending-users.html). I know, it sounds like prejudice – not meant it that way. But still, it always raises suspicions.
Comment: Thank you for your guide. I will definitely follow these steps.
Comment: Good luck, elsa! If any questions arise during that process, you're welcome to consult us again!
Comment: I said wipe by formatting the system folder. Thus, the phone stays without operative system at all. There is absolutely no chance to left any software installed. Did you try sometime to format that folder? I did and when booting the device stays on the first screen (usually the brand screen at the very begin)
Comment: @joaquin I don't agree, for reasons pointed out above. A real evil guy could have placed something in the radio image, on the `/boot` / `/recovery` partitions, on SD card, or somewhere else. While maybe "unusual", it's not impossible – and was found in the past in all of the mentioned places (yes, including radio – though in that case it was the manufacturer himself placing "evil things"; but who knows who did it here? After all we know, it could be a "China clone" instead of a genuine device.)
Comment: Well, I think you are right. But why we are bad thinking about Chinese people? I'm losing part of the big story
Comment: @Izzy Stack Exchange gives a lot of ideas... LOL, thanks for the data!
Comment: Definitely. SE is always my first address when looking for (computer-related) information. It never let me down :) Enjoy your stay!
Answer: You could try supersu from play store to unroot your phone. If you are afraid of viruses after this you can use standard antivirus to scan whole phone(without root there is not much to be afraid of viruses) to be sure you can do factory reset what will delete your files but you can backup them with various programs.
You should always do factory reset/wipe after purchasing used phone (especially if rooted)
Read more info from http://www.xda-developers.com/
Answer: There are some risks of buying  rooted phone as it might contain some malware.
Before unrooting please create a backup of your data.
First you can do a factory reset or in case if does not work you can install third party apps from Google play store.
Here are some apps
OTA Rootkeeper
 , Root Uninstaller
Answer: I wouldn't unroot it. I'd just install a custom recovery and from there I'd format system, data, external sd folders. I'd clean all the caches and I'd install a fresh new copy of cyanogenmod. Then, the phone would run nicely and without absolutely any risk at all.


HTML to PDF for Azure app_service or functions

Question: I'm looking for the best component to generate HTML to PDF either through an app_service or a function hosted in Azure. We have a large volume of PDFs to generate, on average 2000 per days but this number increases month on month. Therefore we are looking for the best combination based on performance and capability to design our PDFs that provides an acceptable look and feel. Finally each file size is always between 30 and 80 kB
Answer: Syncfusion Essential PDF supports converting HTML to PDF and can be deployed to Azure
<code>        //Initialize HTML to PDF converter
        HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
        WebKitConverterSettings webKitSettings = new WebKitConverterSettings();

        //Assign WebKit settings to the converter
        htmlConverter.ConverterSettings = webKitSettings;

        //Convert url to pdf
        PdfDocument document = htmlConverter.Convert(url);

        //Save the document.
        document.Save("Sample.pdf");
        document.Close();
</code>
The whole suite of controls is available for free (commercial applications also) through the community license program if you qualify (less than 1 million US Dollars in revenue). The community license is the full product with no limitations or watermarks.
Note: I work for Syncfusion.


Is it morally excusable for poor people to buy pirated copies of books?

Question: In the light of development theories that show how the poor are doomed to remain poor under the status quo, is it morally correct for poor people to buy pirated copies of books? Original books cost around triple the price of the pirated one. If yes, how would one define 'poor'?
Comment: If you can afford to buy pirated copies, you can afford to buy *used* books or go find one at your local public library. It's important to maintain your morals despite being poor. "Poor, but proud." Beyond that, most books that are copyright-protected aren't worth the paper they're written on, and they're just a burden on the environment, making scammers rich. There are free websites with extensive libraries of old books (including some of the best texts ever published), where poor people can read to our hearts' content.
Comment: i think people have a right to education (and health) over and above property rights. you could narrow the question down by asking about a specific framework (marxist, kantian, etc.)
Comment: I'd think that buying pirated copies would be the worst of all evils given the choice to download free pirated copies exists as well.
Comment: i would use the word 'permissible' rather than 'excusable'. anyone who thinks that people who pirate books should be punished by god or the state is just an imbecile, imo
Comment: We can't define 'poor' with the given data, 'Triple the price of the pirated one'.  3, 30, 300 are 1, 10, 100 tripled respectively. How could we define poor in terms of these numbers? (I mean a poor man pays $1 instead of $3.  Another man pays $10 instead of $30.  And yet another man $100 instead of $300.)  It is difficult to define poor on the basis of affordability like this.
Comment: What kind of ethical framework would you like answers from?
Answer: I would argue that it is never morally correct to steal. I think Kant's categorical imperative exemplifies the reasoning behind this belief. He says,  "Act only in accordance with that maxim through which you can at the same time will that it become a universal law." By this he means (please correct me if I am wrong) that you should live according to those ideas which, if everyone adopted and implemented, would improve the general quality of life for society.
My point is, if everyone stole because they were poor (no money) then this would degrade trust among people, and society would breakdown. This idea may breakdown is extreme circumstances such as violent dictatorship, but I think its generally a good rule to follow.
Comment: This answer is missing something.  If you purchase *pirated copies* of books, what are you *stealing*?
Comment: I should say, downloading a pirated book is not explicit theft. It would not technically be stealing, but it would make you complicit in the theft. I think if we took this to its logical conclusion and assumed a world where all books were free or, discounted because they would be pirated anyway, it would disincentive people to write books. Most people who work in publishing are trying to make a living. In a world where people offer their labor in exchange for money, and services we cannot rely on altruism as the source of goods and services. Downloading a pirated incentives other to steal
Comment: There are more subtleties here.  Stealing is deprivation.  Nobody is deprived a *book*; the publisher may be deprived a sale; the author is typically already out of the picture.  But it's not necessarily a loss, and even if it were we allow this to some degree (e.g. First sale doctine).  Also in this case, nothing is free... the pirate is *selling* the book (which to me sounds worse); we essentially have a publisher and a pirate competing for sales.  Debating this, though, isn't the point; I'm looking for you to improve your answer... you just jumped straight to stealing in this answer.
Answer: According to a consequentialist ethics, more poor people would have access to knowledge. Therefore pirated copies of books would be acceptable once this practice promotes diffusion of things commonly enjoyed by rich people.
Comment: Spelling grammar corrected. Anyways +1
Answer: if you use pirated copies you are infringing on people's rights. Infringing on people's rights is wrong. And being poor does not change the logic.
Comment: @christo183 You don't think infringing on people's rights being wrong is a completely uncontroversial opinion or at least widely accepted? It sounds like you're being a little unreasonable.
Comment: This does not provide an answer to the question. Once you have sufficient [reputation](https://philosophy.stackexchange.com/help/whats-reputation) you will be able to [comment on any post](https://philosophy.stackexchange.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/low-quality-posts/30577)
Comment: Even when the "other people" are billionaire 0-tax multinational corporations? (If you can't answer in comments you can still edit the post)
Comment: @Rusi the logic does not change, so
Comment: Consider how you would answer a similar question like: If persons A and B both buy pirated copies of the same book. Person A, being poor, did so in order to be able to continue their studies. The wealthy person B merely needed to complete an unused library. Which person should pay a greater penalty?
Comment: @christo183 how about now?
Comment: "Infringing on people's rights is wrong": Says who? According to which tradition? _References_ help to bolster your argument as well as provide the reader with further reading opportunities. Each premise should be referenced unless it is completely uncontroversial, and each step should be explained unless patently obvious.
Comment: @Cell Which "rights"? Which legal or ethical system? This kind of information and an argument structured in that context would _add to our understanding_. As it stands the post as value only as an opinion based on the broadest assumptions... Also some would say that human rights are "inherently controversial": https://www.jstor.org/stable/1410575?seq=1#page_scan_tab_contents
Comment: @christo183 I can't answer that for Emcamp Inline. But out of curiosity do you have any examples in western culture of when it's ok to "infinge on people's rights" of any form? Just to show how it can be controversial.
Comment: You seriously asking @cell ? Our entire world order is based on "countries" based on "borders". And a border is that wondrous line where if you stand and shoot in one direction you are a patriot-hero And in the other you are a murderer-criminal. IOW "country" = "institutionaly sanctioned human right violation"
Comment: Just to be clear my views are more nuanced than the above comment (may) suggest. Trump and Hillary both lie. One is comical. The other genocidal.
Comment: @Rusi Yeah, I'm serious. I just want one example.
Comment: @Cell It is the existence of a particular right that can be controversial, just compare the bills of rights of various states. Once a right is established, in a particular jurisdiction, it is normally widely accepted as something that shouldn't be infringed upon and may even acquire the status of an ethical good. In the context of the answer details such as the jurisdiction and the particular right(s) in question, could have added value and elevated it beyond the semblance of pure opinion.
Answer:
Is it morally excusable for poor people to buy pirated copies of
  books?

It depends on several factors.
I believe your question is whether it is morally excusable; not what should the poor to purchase an important book. If it were so, there are several possibilities according to the situation. Here the person who exploites is comparatively/morally worse than the buyer. So I treat your question this way....
Though poor people's purchase of pirated copies is excusable if it is for a good purpose, selling is not so excusable if the pirated-copy-sellers are making big profit from the pirated ones.  Sometimes very rich people may be buying from them.
Another thing is, you say that the original book costs triple the price of the pirated one.  That means the actual production cost is very less.  So the authors are cheating people and this should be brought to light and make them humble to the society (only if the profit is by looting people).
Again, if the book is a vulgar one, the pirated-copy-seller is helping to propagate bad or wrong ideas.  This is wrong indeed. If so, it is not excusable.  They should be given the same punishment given to the authors.  On the contrary, if it is a good book that leads people to become good,  IMO, it is a praiseworthy deed.
There would be so many reasons behind every man's poverty.  Among them the rules/laws of the past or present govt would be there.  Most often it is man-made rules / laws that make people poor or rich.  It is not because of our own effort we become rich.  Actually if we ponder over the great work of nature we would never shove the poor and downtrodden in disdain. Basically as they are human beings, the poor also have equal rights to live on this earth.
Suppose 'A' conceive an idea and writes all the things for a book and B, C & D make effort to make it into printed form and E, the seller.  Don't forget that through a book the writer is trying to spread a good idea.  It must never be bad.  A printed book is for the idea; not as a material. Even if B, C, D & E are not there, some other agency would do it for A...if the content is good. If A's objective is just spreading his good ideas, we cannot deny it if it is through pirated-copy-sellers.  That is why I said it is praiseworthy.  (You should connect this to the above para to get the apt meaning.)
My protest is against exploitation; not against making profit.
If the question were as I mentioned first, my answer would be different; without changing the above sentence.
Victor Hugo had said the same thing in his novel, https://en.wikipedia.org/wiki/Les_Mis%C3%A9rables
"Blessed are the merciful." This can't be wrong especially in this case.

how would one define 'poor'?

Let me ask a counter question.
Suppose a poor seller is selling something at moderate price.   Two men (one poor and the other rich) approaches (not at the same time) for buying the thing from him. Who would you treat as poor......The poor man who readily buys the thing from that poor seller without bargaining?  OR The rich man who buys after bargaining with that poor seller?   Economics will certainly say that the first man indeed is poor.   But the seller wouldn't say so.  Can't we call those misers who behaves like this, poor? .... at least in some occasions?


18 month old sleep issues

Question: I realise this is a time for sleep 'regression' normally. But this seems like something different.
My almost 18 month old's father and I separated in September 2016.
We have a biaotaiton schedule set and my son sleeps home with me primarily with one or 2 overnights with dad, depending on the week.
Dad says he pretty much always sleeps all night long til about 7:30/8 a.m. when he is with him.
For the last month my son wakes up wabyong bottles multiple times a night and then around 4 or 5 wakes up and cries and cries till I pick him up.
It is exhausting and frustrating.
Sometimes I just lay him in bed with me, get another bottle...whatever I can to get some rest.
I'm beyond frustrated about this.
Why is it that he sleeps totally fine at dads and not home with me.
Answer:
"wabyong bottles"

Is that a typo? You can edit your post to reflect answers or to make corrections. Welcome to Parenting SE.
IF you are certain that your ex is telling the truth or not just able to sleep through the noise, then my best guess is that your little boy is having trouble with the changes to routine. I am thinking that regardless of whether your ex is being truthful, the little guy is protesting the change.
He may have some separation anxiety. You are the primary caregiver and your little guy doesn't have the words to express his concerns.
LINK
LINK
It's normal but distressing, and might be exacerbated by your situation. There's quite a bit of literature out there and your child's doctor may have some information.

18 month old sleep issues


Bank maturity mismach

Question: So my question is about maturity mismatch and what is the appropriate method to calculate it. I have seen some simplified examples in academic books but, when I tried to approach it in a holdings bank, I could not really find a solution. Do I do a duration gap analysis? Cause for example in the balance sheet I am looking, the liabilities are less 1 year, between 1 and 5 years, and more than 5 years. Do I just look for the short term A-L ? Can you suggest me to an approach?
Answer: There's two things of interest: interest rate risk, and liquidity risk.
For liquidity risk, you could compare short-term liabilities to short-term assets. This would be just a ratio. The long-term buckets (1-5) and (5+) aren't going to add much information. Banks are in the business of rolling over 1-5 year term deposits, so that bucket will always be big. And since bank loans are often amortising, while the deposits have a bullet maturity, the mismatch between a 5-year deposit (bank liability) and a 10-year loan (bank asset) is much smaller than the maturity date suggests. This is why I would just look at ratios with the mid-long buckets merged.
For interest rate risk, the duration gap is what matters (plus interest rate shock simulations; see below). (Although I write duration, that is just habit. Technically, you need something like a DV01: how much money is gained/lost on a 1 basis point rise in yields? This can be inferred from an estimated duration.)
A part of the question is unclear - you are looking at a financial report of a real world bank? There might be a memo item buried in the notes on the financial statement that gives the exact mismatch. The bank and the regulators know what the mismatch is, it is unclear whether that is public information. Since it is sensitive commercial information, it is highly possible that the net duration information is not public. (I obviously do not know.)
You could try approximating the duration for each bucket of assets and liabilities, and then add them up. The problem is that this answer could easily be wildly incorrect, and the exercise is probably a waste of time.

It ignores the optionality of mortgages (for a US bank). So straight duration is somewhat misleading, you also need to look at large shifts in the yield curve (which is another standard stress test applied by regulators and the bank's risk management.)
A bank can own or issue long-term floating debt. So even if the maturity is 10 years, the duration is at money market length.
It ignores the fact that banks use interest rate derivatives (swaps) to hedge their duration risk.

If you dig into the regulator's documentation (obviously depends on the bank's jurisdiction), they should publish the risk limits for interest rates that they allow. Obviously, the bank's internal models will give a number within the limits, as even the most incompetent regulator would notice a deviation. It may be that the bank has some exotic interest rate risk that does not show up on those stress tests, but you would never know by looking at public information anyway.
Comment: Dear @BrianRomanchuk, Thank you for your answer.  What i am trying to do is a "simple" approach to a real bank.  I have the balance sheet of the bank, trying to find in a simple way the mismatch. From my research duration gap analysis is a common approach.(?) However, it has 3 different brackets and i dont really find a way to assume(?) the exact duration per bracket. Furthermore, my result would be a gap in $ or time? Thank you  for your time
Comment: You need to read the notes to the financial statements. That is where the information would be buried. Just knowing the dollar amount of 5-10 year debt tells you next to nothing about its duration. You can guess, but there's no reason for any guess to be correct. And although I write "duration" out of habit, it's the DV01 you need. Anyway, why do you care? Regulators watch interest rate risk like a hawk, and it's the easiest risk to measure. Sure, there's a lot of people running around screaming about maturity mismatches, but bank regulations have changed since the 1970s.
Comment: Thanks again for your insightful help. I am attending a class in banking and i would really like to dig into it more. So the tutor advised me to chek the maturity mismatch in a real bank. Checking the 3 brackets, i though that duration gap analysis would help me, but as i stated there are no duration per asset so i can not find mismatch between A-L. So i would like to make an educated guess. Something else, you talk about maturity mismatch and interest rate risk as very different things. But is the second a result of the first?  Once again thank you.

Bank maturity mismach


Why is the film titled 'Frances Ha'?

Question: Why is the film titled 'Frances Ha'? Is there some symbolism to it? Sure, we see that she has to abbreviate her name to get her label to fit into the mailbox of her new apartment. But this scene occurs right at the end of the storyline rather than the beginning. What does this signify?
Answer: Here's an article with an interview with the film's director Noah Baumbach. His first feature-length film, "Kicking and Screaming" shares a title with a Will Ferrell movie that he's not overly fond of.  There is a Jessica Lange film already named "Frances" and he didn't want his film to be confused with it.

Was that annoying when that movie came out with the same title?
  Yeah. It was very annoying. The same year, "Crash" came out, too -- or right around there -- I imagined David Cronenberg was annoyed as well. I mean, actually, that was something that I was very conscious about because an obvious title for our movie was "Frances." And there's a very good movie with Jessica Lange called "Frances" about Frances Farmer. It kind of pushed Greta and me to get more inventive with the title and, ultimately, I think to come up with a kind of great ending for the movie. So, I wish the filmmakers of "Kicking & Screaming" had maybe done similar -- [laughs] worked a little harder to figure it out.
Answer: In addition to the above answer, the title is also obviously a play on words:
'Frances Ha' could be pronounced as Francesca, which is the common development of Frances. The character is Happy-Go-lucky, naive and largely oblivious to the political, 'daddy-funded' mechanics of the dance world she works in, but perseveres regardless.
The 'Ha' could be seen as a play on her name, and an triumphal refusal to give in.
Answer: When she folds the label, she defines and claims her adult identity. She has her own apartment, she appreciates her relationships but she isn't defined by them, she has work and an artistic identity. She owns herself, and she defines herself independently. She isn't her friend's Frances, or her parent's last name, or undateable. She's Frances Ha. It's the culmination of her search for a self, she's finally embracing her character as is.
Answer: I see it as code for "Frances Undatable", due to use of the phrase "Ha Ha" in the movie after a character says that

Why is the film titled 'Frances Ha'?


Rough engine sound at 30-60 mph on a 2012 Toyota Camry

Question: I have a 2012 Camry, 4 cyl, whose engine has a random rough sound on a light acceleration, between 30 and 60 mph. It's very brief, but seems to be getting worse and more frequent. It doesn't happen when using cruise control or at speeds above 60. It is an automatic with manual option. I use a high grade gasoline and change the oil on it on a regular basis. Any ideas as to what this could possibly be?? I realize it could be a broad range of issues, but trying the process of elimination. Any help is greatly appreciated. Thanks
Comment: Do you mean "misfire under light acceleration"?
Comment: If you are going to tackle this yourself, then start by collecting some obd2 live data.  Record when it runs well, and then compare it to when it doesn't while paying special attention to the fuel trims.  If you don't want to go this route, then I suggest bring it to a good shop since so many DIY no-code diagnostics, or "the parts cannon", often costs much more than a professional diagnostic.
Answer: When you are accellerating, you are no longer idling. Can you describe more of what is happening when you are accellerating? Is the car shaking or does it feel like the car is loosing power.
If it's shaking, you have an axle problem. You may want to replace your EGR valve and/or clean your throttle body.  Need more detailed info on what is exactly going on.


Wu dialect children's learning materials

Question: Are there any good resources for teaching our child Wu dialect. I'm looking for games / music / toys that have spoken songs or dialog so he can listen. He is 19 months and we have been speaking English, Mandarin and Wu with him but I think Wu has the least resources to support his education.
Comment: I think the best learning material is you. And by the way, Wu dialect is quite different. It is really hard to find official learning material. I have one book to describe the dialect in my city. But it is only suitable in my city because no other Wu dialect cities using the word in this book.
Answer: Wu music in bilibili:

吴语乐坛
吴语微信平台

dialog:

真纪

Wu in forvo


When and why do we need wave packets in quantum mechanics?

Question: The idea of a wave packet is that you superimpose a lot of plane waves to create a localized free electron. But when and why is this useful?
It seems that wave packets are often used to derive transport equations inside solids. But in principle the true electronic wavefunctions given by Blochs theorem are perfectly valid solutions to the Schrodinger equation and are even normalizeable. So why do we ever bother to talk about wavepackets and what is the physical reason for using these?
Comment: Sometimes, without wave packets you cannot integrate by parts.
Answer: You don't "use" wave packets. They simply arise due to uncertainty.
If you have a single wave of known frequency, then it is the same everywhere.
If you combine two waves of slightly different frequency, you get a "beat" effect, due to alternate cancellation and reinforcement.
If you combine many waves of slightly different frequencies, the waves almost always cancel, but they do occasionally reinforce, but these reinforcements come further and further apart.
If you combine infinitely many waves having a distribution of frequencies, you get only one region of reinforcement, and that is called a "particle" or "wave packet".
If you are uncertain of the frequency (which you are) then you can think of it as a distribution of frequencies, and there you are.
Comment: Ah, the elusive thin line between physics and mathematics... What I meant is that I have the feeling that OPs question is "why do you *need* wave packets", not "how do you *generate* them/how are they formed"; your answer seems to address the latter question though. Of course, I might be wrong.
Comment: @AccidentalFourierTransform: If you (accidentally :) take a fourier transform of a photon (like with a [*lens*](https://en.wikipedia.org/wiki/Fourier_optics#The_plane_wave_spectrum:_the_foundation_of_Fourier_optics)), then you see the distribution, right? If that's physical or mathematical I guess I don't know.
Comment: This addresses the *mathematical* origin of wave packets. It seems to me that OP is asking about their *physical* origin.
Comment: Yes I am more interested in the physical origin.
Comment: Has anyone ever physical described the wave packet or an origin?
Answer: You seem to be unaware of the whole field of particle physics, with its enormous number of scattering experiments which studied have led to the standard model of particle physics. This is based on quantum field theory which works with creation and annihilation operators on plane wave wave functions of the appropriate equations ( dirac for fermions for example).
Plane waves are not a good model for an incoming electron beam or the positron beam coming to meet it , as plane waves go from +infinity to -infinity and the two beams would have a very small probability of meeting within the experimental area, which experimentally is not the case.
Usually one is taught the Feynman diagrams for the interaction, i.e. point particles meeting at vertices, but one needs,  a consistent quantum mechanical model since the commutator relations will give a volume in momentum and space for the elementary particles. This is treated with the wavepacket formalism, see for example in this online QFT book at page 49 equations 5.6 and 5.7, where in order to describe a real particle a wave packet is defined.

So wave packets are a  necessary conceptual mathematical tool to bring into consistency creation and annihilation operators operating on plane wave solutions, and the quantum mechanical modeling of particles within the QFT framework.


My username changed, but I didn't do it?

Question: My username was previously "NetherGranite", but I came back to the Mathematics Stack Exchange to find that it was replaced with a generic "user____". Trying to change it results in a prompt saying that one can only change their username every so many days. Should I take steps to secure my account? If so, what are those steps?
Comment: You should ask this on [Mathematics Meta](https://math.meta.stackexchange.com/) instead
Comment: Did you create a new account by any chance? Because then you could be looking at the result of a merge.
Comment: Raise a custom flag on one of your own posts, and ask the mod to take a look, and if possible revert back to your previous name.
Answer: When you edited your profile to change your profile picture and copied it to all sites back on December 12, for some reason the Mathematics site thought you had changed your display name to blank and it triggered a reset to the default display name on that site. I've changed it back to your actual display name.


Windows minecraft on Ubuntu

Question: I've got a Minecraft version for Windows, which runs with an .exe file. I've tried to make it run with java directly and it didn't an Ubuntu message appears "Fatal: Read Error: Could not read or parse the JNLP file" (Show more details), when I tried with Wine, a Wine message appears "No JVM could be found on your system. Please define EXE4J_JAVA_HOME to point to an installed 32-bit JDK or JRE or download a JRE from www.java.com
Is there a way I can make it run? It's all because I cannot make the mods work on my Minecraft's Linux version
Thanks.
Answer: It should be possible to install a windows version of Java in wine, not sure if winetricks supplies it. This is according to an answer here which further refers to winehq - java
You can try this and see if it fixes your issue
Answer: This is what I found:
How do we install Java in Wine?
But I don't have any problems with mods on my linux machine so I'm wondering if there could be another problem. Do you have Forge or ModLoader installed? I would make sure the JDK is fully up to date on the linux machine, Forge updated, Minecraft updated, etc.
The minecraft EXE is a relatively new development and everything ran off of the same .jar file previously; there really isn't a difference in the program, I believe it's something to do with your software or OS.

Windows minecraft on Ubuntu


Total / Lifetime Sales on Magento Dashboard is incorrect

Question: After updating from Magento 1.2 to 1.4 I noticed that the Lifetime Sales amount was incorrect (other sales reports are fine). Even after making a fake order the Lifetime Sales didn't change. I tried refreshing statistics but nothing happened. Searching the web for this problem turned up a lot of people with the same issue but no solutions. Any suggestions?
Comment: You'll need to be more specific about what is wrong. Is the total 0? Is your test order not changing the total? Is the total miscalculating special prices? How do you actually know the total is wrong?
Comment: I know the total is wrong because I know how much the total was before updating. The total is not 0. The test order was added after changing the state to Processing. See my own answer below.
Answer: The fake order was added to Lifetime Sales after changing the state from Pending to Processing (or Shipped). Therefore my guess is that Magento changed the way it calculates Lifetime Sales and doesn't take Pending orders into account (any more). Any other small differences are due to the fact that Taxes and Shipping are not included in Lifetime Sales.


Unable to edit custom block without administrator permissions

Question: I created a content type "landingpage" and a user role "editor". I enabled layout builder for this content type and enabled the option to overwrite the the layout for individual pages.
As Admin I can easily add custom blocks to the layout and afterwards I*m able to edit those blocks oder delete them.
As Editor, however, though I a am able to add custom blocks, I neither can edit my own blocks nor am I able to remove them.
I granted the editor role following permissions:

Admin blocks
Custom block: Manage display
Content - Landing page: Configure layout overrides for content that the user can edit.
Create and edit custom blocks
Manage Layout Builder Modal

Im using Drupal 8.9.14
Has anyone an idea to solve my problem?
Answer: To edit the blocks in layout builder, the user needs to have permission to use contextual links.


simulation with SINR

Question: I have a DS-CDMA system and the chip width is fixed but every user have a different spreading code length. I want to have a simulation of signal to interference noise ratio (SINR) VS. bit error rate (BER). If I assumed that SINR is given like -25:0 dB. How can I calculate noise power (it is thermal noise)  and the interference power?
Answer: The SINR characteristics of a DSSS Multiuser Communication are very difficult to approximate theoretically.

For the Downlink at least, it is easy enough to characterize it with lesser parameters, but still difficult to obtain any particular derivation. It depends heavily upon the Spreading Sequences(their auto-correlations and cross-correlations), symbols of the interfering users(their average Energy) and so on. As a very decent approximation, $SINR$ is usually computed using random spreading sequences assumption. According to Andreas Goldsmith's textbook "Wireless Communications", for a $K$-user system with $N$ chips per symbol, the $SINR$(assuming Random signal transmissions for every user, again a probabilistic assumption) is given by $SINR = (\frac{N_{o}}{E_{s}}+\frac{K-1}{G})^{-1}$ where $G=N$ approximately.
For the Uplink it is even more a difficult task to analyze this. If all users' signals are received with the same power($AWGN$), it can be shown that for those Asynchronous users assuming Random Spreading codes with $N$ Chips per symbol, random start times and random carrier phases, $SINR = (\frac{K-1}{3N}+\frac{N_{0}}{E_{s}})^{-1}$.

For simple simulations, usually people assume that the $SINR$ can be calculated as, $SINR = \frac{E_{s}}{N_{0}+\sum_{i=1}^{K-1}\frac{E_{si}}{G}}$ where G is the processing gain which can be roughly taken to be as $K$. This factor of $G$ applies if the codes are perfectly orthogonal and its approximation to $N$ is usually justified assuming the properties of Spreading codes.
In all the above formulae, $N_{0}$ is the Noise Power which is equal to $2*\sigma^{2}$
for 2-Dimensional Signalling and $E_{s}$ is the average Received Energy of the signal. You can refer to Goldsmith if you to learn any further on the math behind it all. Now you can straight away plugin your numerical value on the LHS of the expressions that are stated above and you can go about calculating the Thermal Noise Power since you know the Received Powers $E_{s}$ for every user's signal. And all these formulae are for $AWGN$ conditions. The difficulty comes from the fact that Interferers cannot be approximated as Random Gaussian Noise.
Comment: thanks for your response. Let me say we have 2 groups of users, first with processing gain PG_1 and second PG_2. There is 5 users of group 1 and 5 of group 2. If I want SINR to be the x-axis of my graph how I should do that? All the time there is 9 interfering users to the desired user. How I should calculate noise power (since it is the only changing power)?
Comment: The noise power would be different for both the groups of users I guess because their processing gains are different. If you assume all the 9 users are transmitting with the same power, or even if their powers are different, plug in the PG for them as you divide the interfering signal power of the respective users. That should be fine I guess.

simulation with SINR


Where is the story that James (the 'brother') shared one-half of his inheritance with Jesus?

Question: The story is, I believe, apocryphal; but the "brothers of Jesus, sons of Joseph" rejected sharing their inheritance with Jesus and James, a follower of Jesus and leader of the early church (per Acts), stated that he (James) would share one-half of his inheritance with Jesus.
Comment: @Bye I disagree. The "extra biblical" texts, as you call them, have always been on-topic as part of Christian history, which has also always been on-topic. Further, the question is asking where this story is, assuming it exists, not if the story is true, which would then make it a Truth question.
Comment: Welcome to the site. We are glad you decided to participate. This is surely apocryphal (or you might mean Gnostic). There is only one reference to "Jesus' brothers" and it is disputed that it means literal, biological brother. Such a thing as dividing an inheritance would give the matter no doubt at all. I hope to see you post again soon.
Comment: Your question appears to be extra biblical, and as such becomes a truth question. It does not reflect any Denominational or primary Christian belief, and therefore I have voted to close your question. It could possibly reworded to ask if any Christian denomination adhere to such a belief, but as is is not a good fit for the site.
Answer: This story is preserved in Menologion of the Holy Tradition,

When Joseph, after returning from Egypt, began to divide his land among his children born of his first wife,1 he also wished to give a portion to the Lord Jesus Who was born supernaturally and without corruption of the all-pure Virgin Mary, and Who was then but a little child. But three of Joseph's sons did not wish Christ to have a share, as He was born of another mother; only the fourth son, St. James, accepted Him as co-owner of his own portion, and hence was afterwards called the "Brother of God."
St. Dimitri of Rostov, Menologion, trans. Isaac E. Lambertsen, The Lives of the Holy Apostles, Holy Apostles Convent: Buena Vista, CO, 1988, p. 223-4.

1 "Salome, daughter of Haggai, the son of Barachiah, a brother of Saint Zacharias, the father of the holy Prophet John the Forerunner of the Lord." St. Dimitri of Rostov, Menologion, 223.
Answer: The story presupposes that Joseph had sons, so we can probably exclude the Western church in our search for the source.  Catholic tradition came to hold Jerome's 'cousins' theory of Jesus' relation to James and his siblings, none of them children of Joseph.
The story further suggests that James was Joseph's eldest son; as primogenitor he would have received a double-share of the inheritance and so able to share half with Jesus.  This excludes the Helvidian view – that Jesus was the eldest of Joseph and Mary's children – and instead points to the Epiphanian view, held by the Eastern Orthodox churches, that James etal were children of Joseph by a marriage prior to Mary, and so older than Jesus.
Since the Eastern Orthodox tradition is more likely to have preserved this story, our search for its specific source might focus there.


Assassins Creed 3 invisible coach bug

Question: I have a very annoying bug where coach is always invisible, in cut-scenes and in general. The level of stupidity is really annoying as people literally sit in the air and horses pull them. Not only that, I can't seem to leap in in some missions where hiding is required. Anyway to fix this?
Answer: You will have to wait for ubisoft to release a patch, sadly you cannot "fix" this yourself.
Comment: I've been playing AC3 on the PC the last week or so and I've not had this bug. Is it isolated to certain PC setups? Do you have a source to confirm that this needs to be patched by Ubisoft?
Comment: I applied 6 patches or so in a row. I suspect this may has to do something with v-sync off(as many game adjust their time clock to frames as well causes some physics problems like in Skyrim). I have no time to test it right now.

Assassins Creed 3 invisible coach bug


What does a defrag actually do?

Question: What does a defrag do really? Does it put the files that execute in sequence closer together?
Answer: Actually it puts all the different parts of ONE file together, so if that particular file is needed, the harddisk doesn't have to move its arm (which is the real performance-breaker here) that much to gather all the bits of the file. ==> hence, better perfomance (although it's not always noticable).
Note that this only applies to hard disks with platters and movable parts. For SSD's this is no problem, as it takes the same time to fetch any data independent from where it's located on the disk. Defragging SSD's is actually a bad idea as they have a limited number of times they can be written to on each 'sector' (I don't think 'sector' is the right term here, but you know what I mean I hope).
Comment: Not only is it not a problem for SSD's but defragging them is actually a bad idea due to their limits.
Comment: Indeed I'll update my answer.
Answer: It depends on the defragmentation program.
At a minimum it will aim to put the clusters for a single file or directory into a contiguous sequence, providing that there is space available to do this.
It may also sequence files and directories according to usage profiles, if it collects these.
It may not be able to move some files (certain open and system files typically).
The reason for defragmenting is that random reads are considerably slower than reading a continuous sequence of blocks/clusters off the disk. However, not all file systems or operating systems have the same requirements for (separate) defragmentation programs.
Comment: Defragmentation also usually groups the free space on the disk into clumps that are as big as possible. This helps to prevent newly-created files from being fragmented in the first place and allows them to be written out faster.
Answer: Defragging can do two things:

Ensures all the pieces of a file are located in a continuous part of the hard drive. Most files are split into smaller "fragments"  that are stuck wherever there is space. At first they will be stored continuously, but gaps/incontinuities will be created when files are deleted/modified. If a file is continuously stored, then it can be read faster.
Optimize the location on the harddrive (spinning harddrives only.) Hard drives are composed of spinning disk-shaped platters. The outside spins faster, so the harddrive will perform better when writing/reading near the outside of these platters because more data will be passing under the read/write head for a given time period.

Also, I'd like to add something about defragging SSD's:

Defragging an SSD
Long ago I promised to post on why
  defragging an SSD is still relevant
  and necessary.  It's true that with an
  SSD there are no physical platters
  that have to spin into place and no
  read/write arms that have to move
  wildly across the surface of a disk.
  For this reason, it seems like
  defragging is a waste of time.  You
  could also argue that since SSDs
  eventually wear out, you should not
  waste rewrite cycles on something as
  simple as defragging your disk.
One of the facts about NAND flash
  memory technology used in SSDs is that
  writing data takes much longer than
  reading data.  When a file is erased,
  much like standard hard disk
  technology, only the directory
  information is erased and the data
  cells are marked "usable" again.  The
  data itself is still intact until
  something new overwrites it.
This means that if the memory space is
  in use with a "deleted" file, it must
  first be erased before it can be
  reprogrammed.  If the free space is
  fragmented, a new file must be broken
  into several small write commands
  instead of one larger write command.
  This will cause a performance decrease
  for SSDs because write speed is slow,
  especially for small block write
  transfers.  Yes, cache memory helps
  mask this performance issue, but no
  matter what the technology, one long
  write command is always better than
  multiple short write commands.
Net, defrag your disk regularly if you
  want maximum performance.

source: Inside the Box Lenovo blog
Comment: You also can't control *where* data is placed on most SSDs, due to the wear leveling algorithms.  While it may be possible to overcome these algorithms with the use of special software, most "off-the-shelf" software won't cut it.
Comment: This guy you quote is wrong.  The SSD internally combines several writes to different logical blocks into a single flash write.  Like reads, random writes are just as fast as sequential on an SSD.
Comment: You can achieve what this guy describes by just reading all the data multiple times.  This will allow the SSD itself to determine if they file should be moved.  Tools like `SpinRite 6` ran at the correct settings can be used to accomplish this.
Answer: Hardware
As others have mentioned, it ensures that files are stored in contiguously numbered allocation units.
On spinning media like hard-drives, this provides faster access to the data since the platter does not have to spin more and the heads do not have to thrash back and forth. On SSDs, this has no performance benefit.
Data Recovery
One thing of note about defragmentation is that by putting files in consecutive allocation units, data-recovery becomes easier and more likely to succeed. When you accidentally delete a file, have a drive crash, or are hit by a virus, fragmented files are much less likely to succeed.
This is because if the file is split into multiple pieces that are scattered all over the drive, then it becomes difficult (often impossible) to figure out which parts go where and belong to which files. This is even more problematic with larger drives containing more files. To successfully recover a fragmented file, you need to know where each part of it is and the order of them, but if you had that, you wouldn't be needing to recover it.
If files are not fragmented, then all you have to do is to find the beginning of the file and either know the size, or know how to detect the end (e.g., by knowing the format of the file, or detecting when a new file begins).
One way to help with data recovery is to use a file-system that is more tolerant of corruption and contains better backup and recovery functions such as NTFS over FAT32. Unfortunately, no file-system is perfect and even the best ones are still subject to data loss and require data-recovery now and then.
Recommendations
With a hard-drive, ensuring that the disk is defragmented (e.g., having it scheduled to automatically defrag whenever the system is idle—which becomes less and less of a task as it cleans things up) helps improve your chances of recovering lost files. Since SSDs are not suited to being defragmented, you will need to weigh the risks and benefits of defragging and either wear out the drive, make regular backups, or store critical data on a hard-drive.
Answer: Defragmenting a drive can do a couple of different things.  Typically the defrag process looks for files which have been broken up into chunks for whatever reason.  Many cases this occurs from reading and writing to a drive over time. The defrag program assembles all of the fragments and then find a spot on the disk where that entire file will fit.  In some cases it ends up being a but of a shell game to move things around making places for all the largest files.
Now something to be said about putting all of these files together concerns the typical "seek" time of the Read/Write head on the disk.  Every time you have to move the read/write head somewhere else on the disk you typically incur a delay of a number of milliseconds.  When reading a file that is all in one location, the read/write head does not have to move very far at all to continue reading the file.  This is much faster than going to another spot entirely on the disk.  In some cases defragmentation can be done to optimize the operating system by placing the system files accessed most frequently closer to the "landing zone" for the read/right head when it is not performing any reads/writes.  This can in many cases speed things up quite a bit.
I have not seen a defrag tool out there which has the ability to keep statistics on the number of times a file has been accessed, but if there was, it could stack the disk first with the most frequently accessed files.
Answer: Your file system will sometimes put parts of a file in different locations on the disk. When accessing this file later, it takes longer because it has to go to each of those locations to access the file. That is called fragmentation. Basically, you have fragments of your files in different places on the disk.
When you defragment the disk, you are rearranging the files on the disk so that as many files as possible are stored in their entirety.
Answer: It depends on the file system, the defragmenter, and the HDD/SSD.
Most files will be consolidated into one block each. That's the minimum requirement and definition of "defragmenter".
More advanced defragmenters will move directories first (since they are, on a per-megabyte average, accessed more frequently than ordinary files), followed by files accessed recently. Files which have not been accessed for a long time (typically 90 days) are sometimes actively placed closer to the end, to allow for shorter seeks for files which do get accessed.
NTFs seems to fragment only slightly less than FAT but to degrade more slowly if it is. Some of the important file are not at the front of the partition but near the middle, obviously to cut the worst case access time in half. Not sure about it, though.
The "seek" times on SSDs are minimal, on the order of microseconds. You're looking at the wrong places if you defrag SSDs for seeks. (An intelligent SSD controller could merely update WHERE the data are moved, rather than moving them, each time it detects the "read old data + wite same data + TRIM old data" pattern, economizing on both write cycles AND defrag runtime. Not sure if any controller does that yet.)
On a second thought, yes, SSDs distribute writes across chips on purpose, because that's how they are faster, and heavy fragmentation might slow the write patterns by making the writes LESS scattered. That might be a factor to consider if it's true.
Always, and regularly, do your backups. If you defrag disks for ease of data recovery, YOU'RE DOING IT WRONG!

What does a defrag actually do?


Windshield fluid in coolant reservoir by accident

Question: Accidentally, I put about 1/4 gallon of windshield fluid into the coolant tank. Then I drove it for about 5 kilometers, with the outside temperature of -3F/-19C. The windshield fluid light was still on, so when I opened the hood, I realized the mistake.
What do you guys suggest? Definitely, I will clean up the overflow coolant tank, and put some antifreeze in it. But, do I need to flush the radiator or not?
Comment: Welcome to Motor Vehicle Maintenance & Repair! What is the year/make/model/engine of the vehicle in question?
Answer: I don't have experience with this, but in my opinion you should drain and refill it. Looks like somebody on Quora made the same mistake as you already. It would probably depend on the specific chemistry of your antifreeze and washer fluid, but it does seem like there are valid concerns of damaged seals and hoses, as well as degraded engine cooling. Certain radiators and blocks can also be finicky and corrode from certain chemicals. Ultimately, you shouldn't put anything in your cooling system other than proper engine coolants and distilled water.
That being said, since you mentioned it was very cold when you drove, and you only drove for 5 km (though, this will still depend on the speed you were driving at) I'd probably guess that your engine never got to temperature and therefore you didn't have any coolant circulating. So I don't think you'll have to worry about any damage for now. Depending on how comfortable you are with flushing your coolant, it may still be a good idea to do it.
Comment: If this is the overflow, just draining the overflow would solve the issue with no need to do a flush. You *really* need to know the year/make/model/engine of the vehicle in question before you can answer this question with the best recourse.
Comment: @Pᴀᴜʟsᴛᴇʀ2 That's true... I was just trying to provide the conservative approach. He did technically drive it a bit. So actually uh... what do I do now? I don't have anything to improve my answer to make it more accurate, and there are no other answers. Do I just... delete my answer?
Comment: No ... but if the OP does provide updates, please update your answer. Your answer is not a bad answer, it just could use some updates if the OP comes through for us.
Comment: I drove it at 40-50 km/h, & I am hoping that the coolant did not circulate. It was Camry 2005. Thank you.


Can I subsitute grapefruit for either lemon or orange in baking

Question: I want to bake a cake but i don`t have either an orange or a lemon. I have grapefruit. Can I use it?
Comment: That is quite broad - what kind of cake, what part of the fruit are you planning to use... ? Please [edit] your question with more details! Also, take the [tour] and browse our [help] to learn more.
Answer: I'm sure you could but I don't think you'd be happy with the results.
A quick breakdown of the amount of sugar and citric acid (gives the acid tang to citrus fruits) to grapefruit, orange and lemon juices per 100 grams (roughly 100 ml).

Grapefruit has 7-8 g. sugar and 2.5 g citric acid.
Orange has 8-9 g. sugar and 0.9-1.7 g citric acid.
Lemon has 2.5 g sugar and 4.5-5 g    citric acid.

Please don't ask me to provide references as I soon discovered that no one site (or even 3 or 4) has the needed information together in one place. I had to search through multiple sites and calculate the differences on amounts given with different units used (ml vs oz).
Comparing these differences, you might think grapefruit could be substituted for oranges if you added more sugar. What makes grapefruit unsuitable though is its bitterness. Grapefruit contains Naringin, the compound which gives it the bitter taste. In fact, naringin is the reason why people who take certain medications, especially some cardiac meds, need to avoid grapefruit or its juice as it can interfere with the liver's metabolism of these drugs.
But getting back to the suitability of using grapefruit, if you're prepared to adjust sugar and you don't mind grapefruit's bitterness,  it's worth trying. Best check, too, with anyone else who plans on eating the dessert.
What works for me is to buy lemons on sale if they're good - heavy and juicy - grate all the rind, then juice the lemons and freeze them. Grated rind freezes very well and doesn't lose any flavour either. It makes it so much more convenient for me when I want to cook with lemons. I do the same with oranges, especially the rind. I also keep citric acid in my pantry as I use it often when I cook. It can be used with oranges to make a delightful orange meringue pie as regular oranges lack enough tang.
Comment: In practice swapping between lemons and oranges is more forgiving than the data above would suggest. Many cake recipes just use equal volumes of juice when giving an orange variation on a lemon cake (and the zest of one fruit). The bitterness of grapefruit could be an issue. I'd look for a grapefruit cake recipe and see if it adds a pinch of salt. I never add salt to sweet foods but might make an exception for grapefruit.
Comment: I agree the difference with a recipe using either lemons or oranges are easier to swap unless one wants the particular tang of lemons if a strong flavour is wanted. But the OP did ask about grapefruit. It's funny that I really enjoy many bitter foods (I'm snacking on some karela right now - a food my son calls puke-cumbersome as it's VERY bitter). But I find grapefruit's bitterness unpleasant. Salt is supposed to alleviate its bitterness though I've never tried it.
Comment: I hadn't thought about freezing the zest - brilliant idea.  I too keep citric acid in the cupboard (it's also a great cleaner!)
Comment: Funny as I figured any cook already knew that. ;)
Comment: I live on a boat with limited freezer/fridge capabilities, and it's been so long since I had a large freezer that I had forgotten a lot of storage stuff like that.  I tend to use my small freezer abilities for high value items (and ice for G&T).  However a small package of zest won't really take up any room.
Comment: Exactly! I can grate 6 lemons and the rind takes up no more space than a thick letter envelope.
Answer: I happen to be one who really enjoys the taste of grapefruit, and yes, I grew up enjoying them with salt to counter the bitterness.  If you like the taste, it does work.  If you do not like the taste, well, salt is a flavor enhancer so you are making a taste you do not like to begin with stronger, not going to work in my experience.
There are some things that grapefruit can substitute with, for instance in drinks.  If you enjoy grapefruit, then a grapefruit margarita can be very refreshing without being overly sweet for instance.  But, baking is a different beast.  Jude correctly points at the acid and sugar differences, and just the difference in taste is enough to put many recipes off, but for an experiment, try it, you might like it.  I would not have high hopes though.  And even as one who enjoys grapefruit, I find the zest way to bitter to even consider it as a substitute.  I would have another concern though, that being actual chemical reactions.
Many medicines carry interaction warnings with grapefruit due to levels of flavonoid and furanocoumarin compounds they contain.  These chemicals inhibit some enzyme reactions causing some medicines to increase or decrease their actions.  I am not a chemist, so I am only speculating, but I would also think there is a real chance that using grapefruit would effect the chemistry of your baking if more than a small amount was use.  Not likely harmful at all, but it could very well cause a flop product.


What do people mean by injuries that occur when you are lifting weights?

Question: I am trying to include some extra stretching in my workout routine so I was looking at some Youtube videos and blog articles about it. However, a lot of people say you must do stretching in order to avoid "injuries". I am confused about what do people actually mean by injuries in those resources. Are they referring to avoiding sore muscles you tend to get after gym or actual injuries, such as dropping a heavy barbell on your foot?
Answer: I would have to see the videos in question, but I suspect that most of the time they are talking about stretching to increase the range of motion. For the vast majority of the general public, this isn't going to be a problem as "normal" day to day flexibility should be more than sufficient for basic fitness and lifting routines.
If, however, you have pre-existing deficiencies in your range of motion, or previous injuries then stretching may help you complete the exercise safely. There is no real way to assess this, however, without a visual examination by someone (such as a physical trainer) that can diagnose that sort of thing.
Stretching has been studied somewhat off and on, and to date, there are no definitive studies that say yes or no, stretching prevents injuries.
Comment: I agree that stretching has been subject to fashion and trends but I'm not sure I would say that most people have sufficient mobility to do "good" weight training. Stretching and mobility, especially to get rid of imbalances is something not many people do enough of, myself included...
Answer: "Injury" in the context of weightlifting typically refers to repetitive strain injuries. Lifting heavy weights is meant to stress the muscles, but too much stress (high weight or not enough recovery) can cause a muscle to tear. Heavy weights also strain the tendons and joints. You could encounter knee pain due to an overused patellar tendon, or shoulder pain due to undertrained muscles not being able to stabilize the joint under heavy loads. Poor form also causes injuries. Failure to maintain a neutral spine can cause the discs in the spine to squeeze out from between the vertebrae causing various pains.
Stretching is an attempt to prevent injuries caused by poor form, when joints can't move into the proper position for a lift. If the joints can't move because of other issues, like the brain having gotten into the habit of not using the muscle that is supposed to extend that joint, then stretching won't help.
Answer: A lot of people are saying otherwise too. The important distinction is the difference between flexibility and mobility. People think flexibility is important, but it is actually inferior to mobility.
I would recommend you to look at Kelly Starrett's videos and talks; also he has a very good book about mobility which is called Becoming a Supple Leopard.
Lastly, it is never a good idea to stretch cold muscles. If you want to do stretching, please do a light warmup before hand, and choose dynamic stretching over static stretching.
Overall, the most important thing is doing full range of motions, without using any momentum in your training.
Comment: Great great answer, Kelly Starrett is THE authority as far as I'm concerned on the topic of mobility (VERY important, more even than the actual work out) and technique


Why can I edit on main but not on meta?

Question: On main, I can click on the "edit" link on a post to propose an edit.  On meta, it's not a link -- just text.  Why are the privileges different?  Or is this a bug?
Comment: Hey Monica! I think this link would prove useful to you: http://meta.stackexchange.com/q/87890/165582
Comment: Oh thanks @Aarthi!  That answers my question.  I can't vote to close this as a cross-site duplicate, but I think it's useful to keep this breadcrumb here.  Hmm.  If you post that as an answer I can accept it. :-)
Comment: Copy the answer here and accept it yourself? :D
Comment: @Aarthi, I considered that, but isn't there a two-day delay on self-accepts?  I was hoping to resolve the question.
Comment: Ha, ok. There, I fixed it!
Answer: Per this meta post:

Mostly because the per-site metas are generally low traffic -- some of them count daily visits in the dozens.
That means the moderators will have to do the work, since the 10k site users are the only ones that can even see this queue. And on many sites, like say Bicycles -- there are exactly zero users at this rep level, even after many months.
https://bicycles.stackexchange.com/users?tab=reputation&filter=all
(highest rep on Bicycles as of the time I am writing is 5.6k)
We were uncomfortable adding Yet Another Queue for Moderators to Look At across every site in the network.

Short version: it's status-bydesign because metas tend to not need a lot of edits in general.

Why can I edit on main but not on meta?


Google analytics: disengaged users

Question: Can I set up google analytics to track a number of unique users who completely disengage (don't visit the site at all) on a 90 days period?
Comment: I am confused. Google Analytics is specifically designed to track visitors of your site- How are you expecting it to track non-users who never visit your site??
Comment: Just wanted to set up tracking for anyone who's never visited the site in the past 90 days but who HAS visited before (and therefore is in our database). I basically want to put something in place in order to track disengagement over time.
Comment: I am not a GA expert at all. It would be a good tip if someone has an answer for you!! One up-vote just for that! If you have not done so already, check out Piwik. It is free and one of the very best user performance trackers.
Comment: This is more or less was the cohort analyses report does (measuring drop-offs), so you might want to look at that to see if this is already sufficient.
Answer: There is a dropoff analysis report in Google Analytics which you can use but as with all other GA reports it is anonymous. The GA terms actually state that it is a violation to attempt to identify users based on GA records which are meant to be anonymous. The best way to do this and still stay compliant would be to setup a last accessed field in your database for each user and each time they log into the site add the datestamp. Then you can simply run a scheduled task regularly to run a query and get a list of users who haven't accessed the site in over 90 days and then you can do whatever you need to with the data, this would be completely compliant with GA.

Google analytics: disengaged users


"Awaiting AE decision" has lasted for nearly four months. What should I do?

Question: The status of my manuscript is "Awaiting AE decision", and it has lasted for nearly four months.
I have sent two pieces of mail to AE to inquire of the status, but I have not received any reply.
What does this situation mean? What should I do?
..While, I am still waiting, no reply.
Comment: Contact the editor!
Comment: @Aditya: Should I contact the Editor in Chief? I have contacted the associate editor twice, but I did not receive any reply.
Comment: In some journals there is a senior editor who oversees different areas; othrers simply have an editor in chief who oversees everything. Depending on the journal contact one of these to check the status of your paper.
Comment: You may wish to clarify in your post the entire timeline of your submission. E.g., is this an initial submission? What is the total amount of time since your initial submission? On some systems, the status of a manuscript is not necessarily indicative of where it is in the system.
Comment: The initial version of this manuscript was submitted last year. It has gone through two rounds of peer reviews. The last version was resubmitted on May this year. I have sent a mail to EIC two days ago.  He has informed the AE. Now, the only thing I can do is wait.
Answer: It could mean they're overworked or disorganized. Four months seems substantial.  Maybe you could try a phone call.
Comment: Right, so now you propose to try emailing the editor in chief.  Sure.  Make it short and polite.  Ex. subject=status report of (paper)? // "I'm concerned about my (date) submission, which was confirmed on (date).  I have not had any news about it since.(date).  I have written to (name) on (date) and (date), but have not heard back from him/her..  Can you tell me what sort of time frame to keep in mind as I am awaiting news of my submission?  Thank you very much.  Sincerely, (full name)  *It's an example, you don't have to stick to this phrasing or structure.*
Comment: Thank you for your opinion.
Since I am not a native English speaker, I am afraid that I can not explain the whole things clearly through the phone.
Maybe I should contact the editor in chief by e-mail and cc to AE. But I am not sure whether it is polite. This paper really means a lot to me.
Comment: A polite email inquiry can't do any harm.  (I thought you had already tried email, sorry.)
Comment: I have sent two mails to the AE. But I did not receive any reply.
Comment: I have sent a mail to the EIC. Now, all I can do is crossing my fingers.
Answer: Four months seems unreasonable. Either the AE is on leave or having a holiday trip with family or health issues. Anything is possible. However, it is the responsibility of the Editor-in-Chief to deal with such delays.
I would email (a final reminder email) to EIC, AEs and journal support staff regarding this and wait for a week to hear from them back on my email. If still, they are not responding, I will email them saying that "I am withdrawing the paper from your esteemed journal. Thank you for your earlier consideration."
Please note that there is no bottom by clicking which you can withdraw the paper. So, be careful about it and try to make it as transparent as possible that you are withdrawing the paper because of the valid reason. Don't be greedy that if the paper is accepted after your mail, if at-all it gets accepted, you will go with acceptance. No, you can't. You should stick with your decision of withdrawl.
Comment: This paper really means a lot to me. I do not think I have the courage to withdraw it. I have sent a mail to EIC two days ago. Hope it would be helpful.
Comment: Actually, I have spent five months and one year to deal with this paper.
Comment: Then you should wait and watch.
Comment: Yeah. Hope this paper could be accepted. Thank you for your help!


Does Marvel Comics have any superheroes/villains from the American Civil War?

Question: I was just wondering if Marvel Comics has had any superheroes or villains whose origins begin  around the period of the American Civil War. Also, as a corollary I'd like to know if any of them survive today.
Comment: in wolverine, hes in the civil war i believe. im not sure if this follows his comic book origins or not.
Comment: This isn't very clear. Do you mean whose origins began in the civil war, who were involved in the civil war in some way or merely those that have been alive long enough that they were around in 1865?
Comment: I changed it to make it clearer. From around and/or were involved. Mainly I mean from the time period but I would be curious if there were any Union or Confederate soldiers who were confirmed mutants.
Answer: Given the nature of immortality in the Marvel Universe, there were plenty of beings with superhuman vitality and immortality which might have been active during the Civil War period. When reviewed, most of the stories in the Marvel Universe has those groups lying low during periods of extreme human violence, such as the Civil War. See: ClanDestine

Of Marvel's most famous long-lived mutants, Wolverine most likely would have missed the Civil War by a decade; he was believed to have been born around 1887. Nathaniel Essex (Mister Sinister) was born in 1859 and Apocalypse were two long-lived human mutants who were active and stories exist of their exploits during the period of the Civil War.

Wolverine's (James "Logan" Howlett) date of birth is not precisely known but estimated to have been between 1886 and 1897, just missing the Civil War period.

Nathaniel Essex was a biologist born in 1859 and transformed into a metahuman being by Apocalypse.

Apocalypse (En Saben Nur) was born over 5,000 years ago in the Jordanian city of Aqaba.

One of Apocalypse's self-proclaimed "Final Horsemen" Famine (Jeb Lee) was from the Civil War era, and made his first appearance in the Marvel Universe in Uncanny X-Force Vol 1 #3 (2010). He was stolen by Apocalypse from the time-stream and locked away as a failsafe weapon. During the Civil War he was a spy and assassin who penetrated enemy lines pretending to be a drummer. His mutant power manifested when his family was killed and he could kill anyone who heard him play his drum. (Discovered by @Wang, added only for completeness; Good find!)

There is one Human character who was known to be active during the mid 1800s: The Ghost Rider:

Ghost Rider (aka Phantom Rider) - Born during the mid 1800s, Carter Slade was a schoolteacher who was nearly murdered after a group of cattle ranchers pretended to be Indians and tried to kill families whose land they wanted to take over. He would take on the identity of a masked "Ghost Rider" seeking justice. Carter would eventually die and pass his spiritual essence and powers to his descendants.

More exotic immortals whose stories are partially told but weren't known to have participated directly in the Civil War:

Exodus (Bennet du Paris - Earth-616) An early mutant born in the 12th century whose immortality and vast psionic powers lead him to believe the ultimate fate of humanity was to be replaced by mutants like himself. Lead a group of immortal mutants who called themselves the Externals.

Selene Gallio, an immortal sorceress that survived the fall and sinking of Atlantis over 17,000 years ago. She has been active on and off in the Marvel Universe since that time.

Annihilus - the insect overlord would have been alive during the time of the Civil War but would not have had access to Earth during that time. He would break through to Earth when Reed Richards built a portal into the Negative Zone.

Other metahumans groups whose activity during this period might include:

The Inhumans, a subgroup of Humanity altered by the Kree to express metahuman abilities when exposed to select mutagens have a civilization over 10,000 years old.

The Eternals, an offshoot of Homo Sapiens altered by the Celestials, having incredible superhuman abilities including near-immortality, energy manipulation, psychic abilities and superhuman strength. This would also include the Deviants, another related subgroup of Humanity.

Atlantis and Lemuria are both ancient advanced underwater civilizations in the Marvel Universe.
Comment: Thor and the Asgardians?
Comment: The Asgardians were around but Thor was in Asgard and had limited contact with Midgard. He doesn't get banished to Midgard until the 60s when he is forced to share a body with Donald Blake.
Comment: It doesn't sound like there's any evidence that any of these people were actually involved in the civil war in any way.
Comment: @DCShannon, I think I said that very thing. I chose to list people who have been known to have lived extremely long lives or possess some degree of immortality so that people might not spend even more time suggesting characters who have had long lives but were not mentioned. With my extensive knowledge of the Marvel Universe, I chose to review well-known characters or groups whose members COULD have been available but as far as the canon Marvel Universe has revealed have NOT done so. Nothing stops Marvel from retroactively adding said characters to later stories.
Comment: It doesn't explicitly say that anywhere in the answer. The whole time I was reading it, I was waiting for the one that was actually involved. I don't object to including ones that people might think were there, I just think you should start out by explicitly answering the question with a no.
Comment: Second sentence: "When reviewed, most of the stories in the Marvel Universe has those groups lying low during periods of extreme human violence, such as the Civil War."

I leave it open-ended because as soon as we say assuredly NO, Marvel will release a comic that says YES. So I answer as best I am able given the nature of comic universes and retcons.

Nor does the question imply they were IN the Civil War only that they be from the period: "Marvel Comics has had any superheroes or villains whose origins begin around the period of the American Civil War."
Answer: Jeb Lee (a.k.a Famine) of Apocalypse's Final Horsemen during the Apocalypse Solution was a confederate spy whose Civil War activities caused a tragic event in his life that activated his mutant bio-auditory cancer powers. Jeb Lee would then roam battlefields playing a drum and killing masses of people. Apocalypse then plucks him out of time to serve as a Famine for his Final Horsemen stable.
Comment: Upvoted. This was a good find. Well done.
Answer: Deadpool fought against the ghost of Abraham Lincoln in Deadpool Volume 3 Issue 4 (January 2013). During that story line, he was fighting all of the Presidents back to George Washington (with the help of Ben Franklin.
Due to the magic that brought their spirits back to this world, they were all villains.
Comment: *Sigh*, only Deadpool.
Comment: But their origins were modern day, having been raised by the necromancer. I don't see this as counting.
Comment: Yeah, *when* did this happen?
Comment: [Deadpool #4 January 2013](http://marvel.com/news/comics/19702/deadpool_-_presidential_primaries_lincoln)


Library to count number of objects in image?

Question: I'm reading a paper on counting cells, humans, etc. Is there an off-the-shelf library for Python/Theano or TensorFlow I could use?
Answer: I think the OP was asking for a specific library for Theano or TensorFlow that provides off-the-shelf functionality for object identification.
I would look first into scikit image, an image processing library for Python in the Scipy/Numpy stack. It has all sorts of edge detectors, blob detectors, shape identifications, color separations... Look at their gallery of examples.
Btw, counting humans in a crowd may not be so trivial to automate...
Comment: You are correct that I am asking for a library. Thanks for your suggestion. Taking a look now...
Answer: Yes, there are libraries for TensorFlow and Theano.
Theano Library:  An extensive tutorial for the Theano library is also available online.
TensorFlow library: An in-depth official tutorial of TensorFlow.  (Highly recommend, if you're going with TensorFlow)
In addition, I would also like to suggest you to have a look at this question regarding open source Python deep learning libraries.
Answer: To see what you can do considering the size(area) of objects, the android app PHOTO COUNT do the job using opencv 3.1 library.
Answer: Not sure I understand the question...  TensorFlow is OpenSourced, here is a tutorial
To import the TensorFlow library, all you need to do is:
import tensorflow as tf


Is "vegetable tanned full grain leather" plant-based or animal-based?

Question: Just saw on Amazon a product with vegetable tanned leather. Is vegetable tanned leather plant-based or animal-based? If it is animal-based, so that I will not buy it, because I am against animal slaughter.
Comment: `vegetable tanned leather` implies that the leather was tanned by using vegetable derivatives ... it makes no difference how animal skin is tanned ... it is still animal skin
Answer: It's animal-based.
As @jsotola said in the comments, "vegetable tanned leather" means animal hide tanned with plant substances rather than with, for instance, chromium sulphate.  "Vegetable-tanned leather", in other words, rather than "tanned vegetable leather"
There are, in fact, some very successful vegan leather substitutes available now, some made from plant materials and some from plastics.  Leather substitutes seem to have come on a lot in the last few years.  There are still some on sale that are really not much good, but, for instance, I have a very good pair of ankle boots from Will's Vegan Shoes that really are indistinguishable from leather (in breathability as well as looks) and were still going after a couple of years' hard wear.  From the rather unclear explanation given on their website, I think those are an example of a plant-based one rather than a petrochemical one:

Created with Italian vegan leather made with plants using bio oil sourced from organic cereal crops grown in Northern Europe in a carbon neutral process.

As far as I know, however, none of these require any process that could be described as "tanning", so, if you see the word "tanning" on a leather product, like the backpack you asked about, that in itself indicates that it's ordinary animal leather.
Comment: The way I understand your quote, that vegan leather is plant based in the same way that a PET bottle is plant based - the plants were processed into oil and the oil into plastics. The difference is just that the plant-to-oil step was done in a factory instead of through geological processes.
Comment: Thinking about it, you may be right, could be vegetable oil made into plastic.  I can't find it now, but I'm sure I remember the website saying something about "microfibre" before, which sounds polymerish.  In which case there'd still be some advantages renewability-wise over making it from fossil oil, if they're doing the biofuel production right, but chemically the result would be made of plastic.  Works, anyway, whatever it is.


Risks of using unecrypted cookies

Question: I am in the process of making a curated news website and I'm wondering about the safety/security of using unencrypted cookies to store basic user information (first name and zipcode). What are the security risks of using unencrypted (plain text) cookies to store this information, and what about for more sensitive information (ex. email, password, or even credit card number)? Can other websites view the cookies my site creates?
Comment: Storing the credit card info on the client would be an explicit violation of PCI guidelines...
Comment: ...and there is never ever a valid reason to store a password in a cookie. If you feel the need to do that, you are doing it wrong.
Answer:
What are the security risks of using unencrypted (plain text) cookies
  to store this information, and what about for more sensitive
  information (ex. email, password, or even credit card number)?

There are many ways you are putting user data at risk. Few of think listed below.

There are many browser extensions that spy on user and their data. You are making their job easy.
The cookies can be obtained by sniffing. This reveals sensitive information to the attacker. (Of course this can be prevented by  setting secure flag on cookie and using https when visiting the site).
The crash dumps of programs (browsers) may contain this sensitive data of the user and potentially leak them.
Users may use public computers in internet cafe or kiosks. So, next user using that computer can see what I have done. Probably these cookies as well.
Also, as mentioned by @Matthew, users can easily tamper with these cookies using a cookie editor extension, and see how the application behaves. (Let's say I changed the firstname in cookie to another person's, does this give me access to their account?)

Can other websites view the cookies my site creates?

Given the major browsers like Firefox, Chrome, this case will be considered a critical security bug. So, as long your users use a good browser your are good to go.
Answer: Firstly, the cookie is stored in plain-text on the end user's device.  Secondly, it could be manipulated.  Why would you be storing this in a cookie rather than the session's data?  Anything stored in a cookie (especially plain-text) that you rely on can be tampered with.
With regards to the other sites, maybe.  The domain attribute can restrict who can see it, but that relies on the browser to honor it and no other vulnerability to be exploited.
Comment: @owlswipe: if the problem you are trying to solve is how to persist data which you currently store on your server then fix that problem instead of creating new ones.
Comment: I'm storing the user's zip code in a cookie rather than in session data so they don't have to type it in every time the quit their browser (which deletes session data). Is there something I'm missing? — So you're saying that cookies are fine for basic info but not for sensitive info because of potential browser bugs.
Comment: Your session is managed by a cookie, too.  Session ID management is an entirely different animal and best left to proven techniques... ASPSessionID (for .Net apps) is a common cookie you'll see set around for this very reason.  Let the server manage data you care about.

Risks of using unecrypted cookies


Why was Yitzhak "laughing" with his wife openly?

Question: Rashi on Bereshis 26:8 indicates that Avimelech saw Yitzhak sleeping with his wife.
A) Why were they having relations during the daytime?
B) Why were they having relations in a way that others could see?
Comment: Because when time progressed he thought the danger passed also.
Answer:
A) Why were they having relations during the daytime?

Where do you see that it says anything about daytime?

B) Why were they having relations in a way that others could see?

The  שפתי חכמים answers your question.
He says that it's  impossible to say that they would have relations where people could see them.
Rather, by Yitzchak closing the window while being secluded with Rivka, it was obvious  to Avimelech that they were going to do something very intimate.
He says that וישקף always means understanding and not physically seeing.

דלא תימא שראהו ממש משמש, דחלילה לצדיק כמוהו להניח חלון פתוח, אלא שסגר החלון ומכח זה הבין אבימלך, וזהו וישקף ר"ל השגחה והבנה, בעד החלון ר"ל כנגד החלון, כמו כל בעד שבמקרא.

The verse thus reads:
וַיַּשְׁקֵ֗ף אֲבִימֶ֙לֶךְ֙ מֶ֣לֶךְ פְּלִשְׁתִּ֔ים בְּעַ֖ד הַֽחַלּ֑וֹן
Avimelech contemplated was was going on behind the closed window
וַיַּ֗רְא וְהִנֵּ֤ה יִצְחָק֙ מְצַחֵ֔ק אֵ֖ת רִבְקָ֥ה אִשְׁתּֽוֹ
and he understood that Yitzchok was being intimate with Rivka [who must therefore be] his wife.

Alternatley you may prefer the answer of the אור החיים - but I have diffuculty understanding it - and thus will refrain from translating it.

מצחק את רבקה. פי' מעשה חיבה הנעשית בין איש לאשתו ולדברי האומר (ב''ר פס''ד) מצחק משמש מטתו אולי שהיה באחד מהדרכים שמותר אפי' ביום כמו שתאמר לרפואה וכמו שכתב רמב''ם (הלכות דעות פ' ד') או כמעשה שהובא בש''ם (כתובות סה) דביתהו דאביי דגלית וכו' ואזל רבא וכו' כי הצדיקים יחושו לדומה דדומה דכיעור לבל יכשלו בו:
Comment: I think the Or HaChayim is saying he saw them snuggling/holding hands/etc. about which presumably one need not be as careful about regarding absolute privacy as actual intercourse.
Comment: How can we understand this sifsei chachomim? That pasuk says Yitzchak was there many days, was this the first time he was intimate with his wife? Why was Avimelech suddenly so interested in contemplating Yitzchak's window? How could he know and thereby accuse Yitzchak of being intimate with Rivka, shouldn't he first have confirmed his suspicions? even with his reading, isn't the windown Avimelech's not Yitzchak's?
Comment: @user6641 - see Rashi that the Sifsei Chachomim is refering to: כי ארכו. אמר, מעתה אין לי לדאוג, מאחר שלא אנסוה עד  עכשיו, ולא נזהר להיות נשמר
Comment: As a remote Tirutz this might work, but then you have to explain every "וַיַּ֗רְא וְהִנֵּ֤ה" in the Torah figuratively.
Answer: The book Lev Eliyahu by Rabbi Elyah Lopian zt'l comments there that the "looking in the window" there is referring not to a window but to sorcery.
i.e. he saw through some kind of sorcery, crystal ball, etc.
Comment: the zohar on bechukosai talks about this. see verse 12 http://www.yeshshem.com/zohar-bechukotai-section-2.htm "Abimelech, king of the Philistines, looked out at a window" (Gen. 26:8). It says here, "out at a window," and elsewhere, "The mother of Sisera looked out at the window" (Shoftim 5:28). AS THE FORMER VERSE PERTAINS TO WITCHCRAFT, SO DOES THE LATTER ABOUT ABIMELECH PERTAIN TO WITCHCRAFT.
Comment: See also Zohar 1:140b.
Answer: The Tur al HaTorah says we must assume this happened during the day otherwise how could Avimelech have seen into a dark room. He explains this behavior with the idea that a Talmid Chacham can cover himself and have relations during the day. This is similar to the Or HaChaim who quotes the gemara in ksuvos 65a where we find this behavior as a means to stave off the yeitzer haraa, not simply giving in to desire.
Another point as far as how he actually saw them is made in the Medrash HaGadol. Avimelech was a perverted rasha and always kept an eye out to peep on them. Apparently one time he got what he wanted. This idea is further strengthened in the seffer Shaarei Aharon (from where I am quoting these answers) by pointing out Targum on the word Chalon is 'charka' which Targum uses exclusively as a type of spying or viewing window, not a regular window for light or air. With this point he answers how Yitzchok could have behaved indecently, and of course Yitzchok was careful to be tznius from the regular neighbors windows, but Avimelech's peeping window was unexpected.


Sharepoint 2010 to 2013 upgrade problem

Question: We ran into the problem when upgrading SharePoint portal with custom solution from 2010 to 2013 version using database attach procedure.
Problem is that after mounting content database to SharePoint 2013, we got a number of javascript errors and also people editors on custom forms do not work anymore.
Both problems we describe below have connection with strange controls id's.
We have tried installing our custom solution to new web application and created new site collection with new content DB and it did not produce any of those errors. Problem occured only in web application when we updated SP2010 content database to 2013 version.
Problem 1:
Javascript error is present in 2010 mode (before updating site collection to 2013 mode) and after updating the site collection to 2013 mode.
When we have default v4.master page applied, javascript errors occur: SCRIPT1010:Expected identifier, SCRIPT5009: "_spNavigateHierarchy is undefined".

Looking deeper into problem, we found out that error occurs due to missing form id in _spNavigateHierarcy function:

Page source reveals that form id of page is not standard »aspnetform« but strange control id:

We found out that if we remove TreeViewAndDataSource delegate control from master page, javascript errors disappear, but that is not solution for the problem.
Problem2:
People picker OK button is disabled even if browsed user is selected on people selection popup. Editor cannot click on OK button and add user to selection:

Problem is that input id of button is wrong. Expected id of OK button in entityeditor.js javascript file is: g_OKButtonID="ctl00_PlaceHolderDialogButtonSection_btnOk";.

Button is initially disabled on page load. OK button should be enabled on user selection, but it cannot be due to missing/wrong control ID (different control ID as in javascript).
Update procedure we used:
a) Create new Sharepoint 2013 web application in classic autentication mode:
New-SPWebApplication -name "WebAppMigration" -Port 80 -ApplicationPool "MigrationAppPool" -ApplicationPoolAccount (Get-SPManagedAccount "DOMAIN\username")

b) Install custom solutions in 2010 compatibility mode:
Add-SPSolution -LiteralPath "C:\WSP\Solution.wsp"

Install-SPSolution -Identity Solution.wsp -GACDeployment  -CompatibilityLevel 14 –Force

c)  Add safe controls in web.config
d)  Create new database on SQL Server and add farm account with db_owner and db_securityAdmin rights.
e)  Restore Sharepoint 2010 content database into created database
f)  Test content database:
Test-SPContentDatabase -Name "contentdatabase" -WebApplication "webapplicationurl"

g)  Mount content database:
Mount-SPContentDatabase -Name " contentdatabase " -DatabaseServer "databaseserver" -WebApplication "webapplicationurl"

h)  Uninstall custom solutions:
Uninstall-SPSolution -Identity Solution.wsp
Remove-SPSolution -Identity Solution.wsp

i)  Install custom solution in 2013 compatibility mode:
Add-SPSolution -LiteralPath "C:\WSP\Solution.wsp"

Install-SPSolution -Identity Solution.wsp -GACDeployment  -Force

j)  Upgrade site collection
k)  Convert application into claims:
Convert-SPWebApplication -Identity " webapplicationurl " –From Legacy -To Claims -RetainPermissions

Answer: We did not find source of the problem, but our solution was to generate web control ID's in .NET v2 mode:
<configuration>
    <system.web>
        <pages clientIDMode="AutoID" />

Now controls have right prefix "ctl00_".
Source: .NET 4 prefixing changes.

Sharepoint 2010 to 2013 upgrade problem


Efficiently finding overlap between many date ranges

Question: How can I efficiently find overlapping dates between many date ranges?
I have a pandas dataframe containing information on the daily warehouse stock of many products. There are only records for those dates where stock actually changed.
import pandas as pd
df = pd.DataFrame({'product': ['a', 'a', 'a', 'b', 'b', 'b'],
                  'stock': [10, 0, 10, 5, 0, 5],
                  'date': ['2016-01-01', '2016-01-05', '2016-01-15',
                          '2016-01-01', '2016-01-10', '2016-01-20']})
df['date'] = pd.to_datetime(df['date'])
Out[4]:
        date product  stock
0 2016-01-01       a     10
1 2016-01-05       a      0
2 2016-01-15       a     10
3 2016-01-01       b      5
4 2016-01-10       b      0
5 2016-01-20       b      5

From this data I want to identify the number of days where stock of all products was 0. In the example this would be 5 days (from 2016-01-10 to 2016-01-14).
I initially tried resampling the date to create one record for every day and then comparing day by day. This works but it creates a very large dataframe, that I can hardly keep in Memory, because my data contains many dates where stock does not change.
Is there a more memory-efficient way to calculate overlaps other than creating a record for every date and comparing day by day?
Maybe I can somehow create a period representation for the time range implicit in every records and then compare all periods for all products?
Another option could be to first subset only those time periods where a product has zero stock (relatively few) and then apply the resampling only on that subset of the data.
What other, more efficient ways are there?
Comment: Do yo want to find overlap between many date ranges or identify dates where stock of all products was 0?
Comment: I want to know the number of dates where stock was 0 for all products. In the example I want to find out that there were 5 days where stock for a and b was zero (2016-01-10 to 2016-01-14).
Comment: I suggest you to edit the question accordingly. The title seems to assume that you already have several date ranges and just want to know hot to find the overlap, which is not the case.
Answer: You can pivot the table using the dates as index and the products as columns, then fill nan's with previous values, convert to daily frequency and look for rows with 0's in all columns.
ptable = (df.pivot(index='date', columns='product', values='stock')
          .fillna(method='ffill').asfreq('D', method='ffill'))
cond = ptable.apply(lambda x: (x == 0).all(), axis='columns')
print(ptable.index[cond])

DatetimeIndex(['2016-01-10', '2016-01-11', '2016-01-12', '2016-01-13',
               '2016-01-14'],
              dtype='datetime64[ns]', name=u'date', freq='D')

Answer: Here try this, I know its not the prettiest of codes but according to all the data provided here this should work:
from datetime import timedelta
import pandas as pd

df = pd.DataFrame({'product': ['a', 'a', 'a', 'b', 'b', 'b'],
                   'stock': [10, 0, 10, 5, 0, 5],
                   'date': ['2016-01-01', '2016-01-05', '2016-01-15',
                            '2016-01-01', '2016-01-10', '2016-01-20']})
df['date'] = pd.to_datetime(df['date'])
df = df.sort('date', ascending=True)
no_stock_dates = []
product_stock = {}
in_flag = False
begin = df['date'][0]
for index, row in df.iterrows():
    current = row['date']
    product_stock[row['product']] = row['stock']
    if current > begin:
        if sum(product_stock.values()) == 0 and not in_flag:
            in_flag = True
            begin = row['date']
        if sum(product_stock.values()) != 0 and in_flag:
            in_flag = False
            no_stock_dates.append((begin, current-timedelta(days=1)))

print no_stock_dates

This code should run at O(n*k) where n is the number of lines, and k is the number of product categories.