Hat Problem/Hamming Codes

Question: I've been reading about how hamming codes are used to 'solve' the Hat Problem, and I understand how it 'assigns' one person to be the speaker, and how that speaker knows the answer. Everything I read says that it worked $1-\frac1{2^n}$ times, but what I don't understand is why it fails where it does. Apparently there's one case where every person guesses wrong, but I can't figure out which case that is, or (more importantly) why. Anyone care to explain?
Comment: I don't recall off the top of my head whether it answers your question, but there's a nice discussion of the Hat Problem in connection with linear codes in the book Protecting Information: From Classical Error Correction to Quantum Cryptography by Susan Loepp and William K. Wootters.
Answer: Well, I wouldn't say there's just one case where they lose, but it depends on how you count cases. Remember, the idea is that the number of people is of the form $2^n - 1$. Accordingly, if we take a case to be an ordered assignment of colors, then there are $2^{2^n - 1}$ different cases. The fraction of these in which the prisoners is win is $(2^n - 1)/2^n$, but the denominator here isn't the number of cases, on this method of counting them; there's more than one case in which they lose.
Anyway, the way it works is that in a Hamming code, some cases (specifically, $2^{2^n - 1 - n}$ of them) are picked as "well-formed" such that for every case A, there is a unique well-formed case B such that the number of color changes between A and B is at most 1.
So, suppose the prisoners use the strategy "Consider both possible cases compatible with the information available to you. If one of them is well-formed (they won't both be), then guess in accordance with the other one. Otherwise, in the case where neither of them is well-formed, you should refrain from guessing". What will the outcome be?
What happens is that, in those cases which are well-formed, every prisoner guesses wrong, since every prisoner will take the first branch of the above strategy. On the other hand, in those cases which aren't well-formed, there is a unique prisoner who goes down the first branch and guesses correctly, while every other prisoner goes down the second branch and refrains.
Accordingly, the number of cases in which the prisoners lose is the number of well-formed cases; that is, $2^{2^n - 1 - n}$. So the fraction of cases in which the prisoners lose is $2^{2^n - 1 - n}/2^{2^n - 1} = 1/2^n$. Like I said, though, this isn't just one case (if we identify cases with ordered assignments of colors).
(Incidentally, if you'd like to know how to actually construct a Hamming code, you can take the well-formed cases to be those with the property that, for every $i$, there are an even number of black hats at positions whose $i$th bit is 1 (using position numbering starting at 1). It should be straightforward to verify that this has all the properties mentioned above)
Answer: So I looked at Loepp and Wootters and it does seem to answer your question.  Here's roughly how the argument goes.
Strategy During the strategy session prior to the game the players agree on some binary [$n,n-r$] Hamming code C and a check matrix H for C.  The players also number themselves 1 through n.  The agree on the convention that 0 represents blue and 1 represents red and the convention that the vector $\bar{v}\in \mathbb{Z}^{n}_{2}$ represents the correct description of the way the hats are distributed.  So, for example, suppose $n=3$ and the distribution is that the first two people have red and the third has blue.  In this case $\bar{v}=(110)$.  After the game begins the $i$th person will knows all of the entries of $\bar{v}$ $except$ for the $i$th entry.  This person then forms two possible vectors for $\bar{v}$, e.g. $\bar{v}_{0}$ if that person has on a blue hat and $\bar{v}_{1}$ if that person has on a red hat.  The $i$th person then does the following:
If $H\bar{v}^{T}_{0} \ne \bar{0}$ and $H\bar{v}^{T}_{1} \ne \bar{0}$ he/she passes.
If $H\bar{v}^{T}_{0} = \bar{0}$ and $H\bar{v}^{T}_{1} \ne \bar{0}$ he/she guesses red.
If $H\bar{v}^{T}_{0} \ne \bar{0}$ and $H\bar{v}^{T}_{1} = \bar{0}$ he/she guesses blue.
The case where $H\bar{v}^{T}_{0} = \bar{0}$ and $H\bar{v}^{T}_{1} = \bar{0}$ never occurs.
[Note: $\bar{v}^{T}$ is the transpose of $\bar{v}$.]
Winning and losing  If they use this strategy the team wins whenever $H\bar{v}^{T}\ne 0$ and they lose whenever $H\bar{v}^{T} = 0$.  The probability that the team will win turns out to be $\frac{n}{n+1}$.
Comment: Thank you! I wasn't able to find that. I was looking for a general, 'quick check' description.
Sridhar Ramesh: Yes, I was caught up a bit much on it just being one way it fails. I guess it kills a bit of the novelty seeing it that way, but thank you for the clarification.
Comment: @Jon: I'm glad it seemed to have helped.

Hat Problem/Hamming Codes


Is using first person in academic/technical essays always bad?

Question: For as long as I can remember, my teachers have taught me never to use first person in an essay.  Yet, some of the examples we read in classes, or older writings we have to annotate, are written in first person.  So what is the actual rule here?  Why is using first person in essays considered unacceptable?
Comment: Are you sure that your teachers haven't confused *first person* and *first person singular?*
Comment: I removed [technical-writing] because it is specifically about creating documentation, not essays (even though the term is used for essays outside of Writing.SE).
Answer: This depends on your style guide and potentially your teacher/school/boss/etc.'s guidelines. If your teacher (for example) says to avoid using the first person you may be able to negotiate to change their position, but ultimately they are the ones evaluating your work so you need to follow their rules.
None of the three major American style guides forbids using first person.

This is what the APA Blog has to say about the first person:

I am often asked why APA Style prohibits the use of I or we. I love this question, because the answer is always a pleasant surprise: I or we is perfectly acceptable in APA Style! In fact, the Publication Manual actually recommends using first person, when appropriate, to avoid ambiguity.

(Another APA blog post also addresses this issue.)

According to a Q&A on the CMOS website, the CMOS says this:

Please see CMOS 5.220, s.v. I; me: "When you need the first person, use it. It's not immodest to use it; it's superstitious not to."

Another Q&A on their site says:

Avoiding the first person used to be considered proper, but now it's considered very formal, if not old-fashioned. It's not a question of correctness, however; both styles are correct. If you feel strongly that the first person is out of place in your work, don't use it.

MLA, on their webpage, says:

Let the first-person singular be, instead, a tool that you take out when you think it's needed and that you leave in the toolbox when you think it's not.
Comment: Everyone seem to forget that [_we_ is also first person](https://www.ef-australia.com.au/english-resources/english-grammar/pronouns/)!
Answer: My recommendation is to use first-person pronouns only for attribution. If you do something original, such as a thesis or other research, it makes sense to use "we" for things you did with your supervisor, or "I" for what you managed on your own. It's important to examiners/reviewers to know what is one, what is the other and what is instead due to previous academics, and to be confident of your non-plagiaristic honesty on that front. Laurel's answer shows a number of style guides for such writing gives similar advice.
If your essay contains nothing original, such as when you give an overview of the arguments for and against philosophers' views on an issue, the fact you wrote the essay is immaterial, and you should effectively be as anonymous as a Wikipedia article's author(s). Although you don't go into detail about where you read an author using "I", my best guess is it was when they made a case for something of their own.
Comment: The second paragraph hints at a reason that is grammatical. The I verb clauses on sentences are redundant with a single author and ambiguous if there are coauthors.
Comment: @DanD Well, *I* can be necessary when contrasting with what third parties did, thought etc., while "first-person" pronouns include both *I* and *we*, and you'll sometimes need these with co-authors.
Answer: Like with so many other issues of style, it depends on your audience.
For a school essay, your audience is your teacher.  So write the essay your teacher wants, no matter if it's okay to do it another way elsewhere.
If you submit an essay or article for publication, the audience is the publisher, and you should follow its rules.  A publisher curates for a larger audience and will have rules and expectations for authors that fit those needs.
Some academic essays need to be in first person.  Imagine a college application essay written in 3rd person.  I'm sure people have done it.  I wouldn't advise it.  If you're writing an essay to read out loud at a conference or other presentation, and it's about your work, you also need to use first person or it's just weird and confusing.
Figure out your audience and adjust your writing accordingly.
Comment: Oy vey.  Talk about the wrong lessons to take away from high school.  And ugh that their schools didn't have counselors to help with this stuff.
Comment: I had a number of classmates in college who wrote their college application essays in the 3rd person. While I don't know exactly what the issue was, the effectiveness of the technique was suggested by the fact that they were all going to the public college I was going to, which did not have a college application essay. I think there were a few people I met at my school who had said they'd used the first person on their application essays, so it clearly wasn't the only factor. But it was apparently a common practice among those who applied to prestigious schools and didn't get accepted.
Comment: @EdGrimm Back in my day, college application essays were always things like "what is something that defines my character?" or "why I want to go to your school".  I even once got "what animal would I be and why?"  Writing anything like that in 3rd person would be completely nuts, IMHO.  But maybe they got some questions where the topic could be in 3rd person?  Or something that could go either way?
Comment: For all of the ones I even vaguely remember, the people who wrote them thought they were nuts to write in the third person, but did so anyway due to having learned in high school to always write in the third person.
Answer: The restrictions on 1st person (singular or plural) does depend on:

The genre of writing
The style guide being followed
The opinion of the teacher/instructor/advisor/publisher/editor
The context within the paper

Genre of Writing
Generally speaking, it is research writing that tends to favor not using 1st person. The reason for this is that research ought to be objective, not subjective, and too many inexperienced students (i.e. college undergraduates or younger, though even some graduates) doing research writing tend to write opinion, rather than properly researched and documented facts. So for these types of students, it is often safest for a teacher to say avoid 1st person. This helps force the student not to be thinking about what they "believe," but rather what they can "prove" via their research.
Style Guides
Style guides vary on what is allowed, but generally have some similar ideas. For instance, The Concise Rules of APA, 6th edition (2010) states for an appropriate use of 1st person (bold added):

Innappropriately or illogically attributing action in an effort to be objective can be misleading. ... To avoid ambiguity, use a personal pronoun rather than the third person when describing steps taken in your experiment.  Correct:    We reviewed the literature.  Incorrect:    The authors reviewed the literature. (sec. 1.09, pp. 19-20)

But then further clarifies use (bold added):

For clarity, restrict your use of we to refer only to yourself and your coauthors (use I if you are the sole author of the paper). Broader uses of we may leave your readers wondering to whom you are referring. (sec. 1.09, p. 20)

So in short, don't include in a "we" (1) the readers, (2) other people in the field of study who did not author the paper with you.
Similarly, A Manual for Writers of Research Papers, Theses, and Dissertations, 9th edition (2018), which tends to follow The Chicago Manual of Style in a lot of respects, says the following about avoiding 1st person (bold added):

Most instructors and editors do agree that two uses of I should be avoided:

Insecure writers begin too many sentences with I think or I believe (or their equivalent, In my opinion). Readers assume that you think and believe what you write, so you don't have to say you do.
Inexperienced writers too often narrate their research: First I consulted ..., then I examined ..., and so on. Reader care less about the story of your research than about its results. (sec. 11.1.7, p. 120)

And then later notes two more with respect to the 1st person plural as well:

But many instructors and editors object to other uses of we:

the royal we used to refer reflexively to the writer
the all-purpose we that refers to people in general (sec. 11.1.7, p. 121)

Between the above inappropriate uses, the manual notes some positive uses:

The first person is appropriate on two occasions ...

An occasional introductory I (or we) believe can soften the dogmatic edge of a statement ... The trick is not to hedge so often that you sound uncertain or so rarely that you sound smug.
... when it's the subject of a verb naming an action unique to you as the writer of your argument. Verbs referring to such actions typically appear in introductions (I will show/argue/prove/claim that X) and in conclusions (I have demonstrated/concluded that Y). Since only you can show, prove, or claim what's in your argument, only you can say so with I. ... On the other hand, researchers rarely use the first person for an action that others must repeat to replicate their research. Those words include divide, measure, weigh, examine, and so on. ... Those same principles apply to we, if you're one of two or more authors. (sec. 11.1.7, pp. 120-121)

Authority's Opinion
Style guides give some "allowance," but whoever an author is writing for has ultimate say on what precisely is allowed. This is generally noted in the style guides as well.
For instance, the second bullet point in the preceding quote about "appropriate" uses would not be a valid use by a number of people in authority who believe such metadiscourse (or signposting) that gives a discussion of what the author "will do" in the paper is bad writing for a couple of reasons: (1) regarding whether an author "proves" the point or not is up to the reader, whether the author believes it was proven or not; (2) what the author is showing, arguing, claiming, etc., should be evident within good writing without it being explicitly stated.
The point, however, is that the one the author is writing for (whether a class or a publication) determines the appropriate uses of 1st person; the author just needs to follow the rules laid down.
Context within the Paper
This relates directly to the caveats noted in the style guide section above, and also relates to the authority's acceptance or not. Some places in a paper may be appropriate to use 1st person, other places not. If an author is giving a personal illustration, it would be appropriate; but in a research paper, a personal illustration is generally not often used (since it cannot be verified; it is subjective). So whether or not it is allowed in a particular place will no doubt depend much on the context within the paper itself.
Answer: I will try to convey the request and explanation of one of my professors. He specifically asked me to change generic speaking to 1st person singular.
(His) explanation:

It is OK to use generic speaking or 3rd person if you talk about
  something that is generally known, or it was published / researched by
  somebody else. But if you describe your own work, it is confusing to
  use anything else than 1st person singular.

It was very reasonable (and very awkward - to learn to take responsibility and credit for my own work), but it became my own thinking meanwhile.
Answer: It depends on what your goal is. If your essay is supposed to say something about the world in general, you should maybe avoid the first person, because that could make it seem as if your essay's conclusions are based on a sample size of one, which would detract from its validity.
On the other hand, if you want to share something you personally accomplished, or discovered, or witnessed, then using the first person could add validity to your essay, because hey, you were there, right?


Is Quickbitcoins.net gone with all money?

Question: Site is down, google finds no new address. Can find nothingness on bitcoin forums, but Gregor not brightest crayon, perhaps doesn't know how to search.
Answer: The site was shut down in November and the former operator claims to no longer be involved with the service.
That operator is now attempting to raise funds for a new venture, Ziggap.
QuickBitcoins didn't take deposits.  They were a service used to buy coins for immediate delivery or for selling coins with immediate cash-out.
If you are owed bitcoins or funds from a cash-out transaction, the operator at the time would still be responsible for that liability, regardless of whatever disclaimer is provided about now "no longer having any relationship" with the service.


Reading ALOS PALSAR data using gdal

Question: I have downloaded ALOS-1 PALSAR level 1.0 data from data archive  from Alaska Satellite Facility. After unzipping files ,I am getting image files,Leader Files,Trailer File and Volume File. All the files have extension of .0__A. I am trying to open the Image file(IMG) through gdal.Open and ReadAsArray() function but gdal is not able to open the data.
How can I visualise the data?
I am using gdal 2.0.0.
Answer: Recent release of GDAL has included Drivers for opening ALOS PALSAR. You can try that once. Also, you can open only VOL******.0_A files.

Reading ALOS PALSAR data using gdal


How can we prevent the Media Bias?

Question: How can we prevent the Media Bias? I think it's a signifcant issue our world is facing today
Comment: It might help if you clarified what you mean by bias. Accuracy? Agenda? Favoring the other guy?
Comment: It was difficult for me to choose just one reason to close this. Too Broad, Opinion-Based, and Off-Topic.
Comment: Hi, jdmtj, welcome to Worldbuilding Stack Exchange. Can you explain how your question is about worldbuilding, as opposed to the real world?
Comment: @ErinThursby I'm going with off-topic.
Comment: I want to preempt people who might vote to close this question. It is a broad question, yes, so I thought about voting to close. But I think it is also a good world-building question with relevance to near-term sci-fi. I think it should stay open.
Comment: Opinion based? No. He asked for a procedural mechanism for preventing bias. Off topic? I cited David Brin in my answer, but there are other whole sci-fi and fantasy novels these days oriented around media interactions and hypothetical media constructs. It is very critical part of world building for any post-Singularity story.
Comment: Also, could you provide any credible source of information to back your claim?
Comment: @SRM Opinion-based, sure, there are lots of different opinions one could have as far as bias prevention. There was nothing procedural in the question at all--no research behind it, nothing. Off-topic: it's framed with "it's a significant issue our world is facing today" rather than specific to a built world. If he'd said "in a world where are media is filtered through the human brain" or something, I would deem it world building.
Comment: @SRM Also, not a single word was said regarding sci-fi from the poster. For all we know they are setting their world in the 1920s. And there are not steam-punk rockets. I could go on and on about the advent of so-called "yellow journalism" and the way the industry self-policed (and didn't). How this is handled very much depends on the world, the tech level and cultural factors. Without those, it's a shot in the dark. He said "facing today" so I would have to assume it's not sci-fi or any other era, but modern day, and in our world. The poster DID say "our world."
Comment: It's also opinion-based because defining bias is opinion-based.
Comment: Alright. I'll accept the critique of the question.
Answer: Can we define Media Bias in a way which, itself, is not biased?  It's a surprisingly tricky concept.  If I am reading a scientific journal, I expect it to be peer reviewed to bias the articles towards those which are worth reading.
Bias, of course, implies that there is a correct version of reporting.  We measure media bias by comparing against this correct version, but what is correct?  One of the phrases most quoted is "just report the news," which sounds brilliant, until you realize just how much news there is.  If we reported "all the news," each newspaper would be a billion pages thick.  And that's not even counting the Sunday edition.  We expect a filter to be applied to the news.  That's one of the things we pay the media for.  We want them to help us identify what is important, so that we don't have to.
So, from a world building perspective (which is the valid perspective on this question for this site), if one is building a story about media bias, its worth noting that the bias is actually desired.  A story which seeks to erase media bias will have to deal with this paradoxical problem.
And remember, history goes to the victor.
Answer: A StackExchange style reputation system for news reports. The system of managing privileges based on points has worked very well. I've been looking at what it would take to make a news site out of the SE platform. It doesn't work cleanly as it stands, but i think something like it (with some Slashdot.org metamoderation) is the future.
For relevant example in science fiction, read David Brin's "Existence" novel.
Note that Reddit is a good start on this but personally I don't think it has the right community self-management setup.
Comment: Note: many systems work when everyone is volunteering their time but fail when paychecks are on the line.
Comment: True.  That's one of the aspects I've been thinking about.
Comment: you also have a problem that lots of followings could swamp upvote an inaccurate but politically favorable statement. Stack Exchange is partially shielded by just not being interesting to such people. I mean modern media is often social media these days which is already based on popularity.
Answer: At the risk of seeming mathematically pedantic, I think that the variance in the media is a bigger problem -- the large (and IMHO widening) spreading out of what's trustable vs. what is not.  Yes, there's more and more data, but much of it more noise than signal.  I think Neil Stephenson termed it "the Bullshyte problem" in his novel Anathem.  Mis/Dis-information isn't new, but the internet and social media give "Bullshyters" great leverage.
Comment: worse popularity algorithms can actually favor disinformation, people tend to like things that support their world view not challenge it.

How can we prevent the Media Bias?


Executing a SQL script stored as a resource

Question: I would like to store lengthy .sql scripts in my solution and execute them programmatically. I've already figured out how to execute a string containing my sql script but I haven't figured out how to read the string from a file that would be stored in the solution (under a /Scripts subfolder for example).
Comment: There is a well detailed answer about embedded resource in a duplicate question  https://stackoverflow.com/questions/23301964/ef-6-code-first-with-custom-stored-procedure/39673550#39673550
Answer: Add the SQL files to your project then create a new resource file. Open up the SQL file and select 'Files' from the top-left drop down (default is Strings). Then hit add resource and navigate to/select the SQL file. This allows you to get SQL from the resource file without losing your type-safety like so:

The above is the process in Visual Studio 2010. I also wrote about this on my blog.
Comment: For parameters, see my answer. [QueryFirst](https://marketplace.visualstudio.com/items?itemName=bbsimonbb.QueryFirst) will detect parameters used in your SQL, retrieve their type from the DB, declare them as local variables in a special comments section so you can test-run your query in the editor window, then generate the parameter loading code. Your parameters pop out as typed input arguments to the generated Execute() methods. (Execute, ExecuteScalar, GetOne). The right way becomes the easiest way, and the wrong way (concatenation) becomes impossible :-)
Comment: Know this is an old post. Looks very neat, but how do you go about adding parameters to the script ?
Comment: You should be able to use `string.Format` for this.
Comment: Add to resrouces, and set file to Resources, in code write the NAMESPACE.Properties.Resources.ScriptDB.ToString()
Answer: First, edit the .sql file's properties so that it will be embedded as a resource.
Then use code similar to the following to retrieve the script:
string commandText;
Assembly thisAssembly = Assembly.GetExecutingAssembly();
using (Stream s = thisAssembly.GetManifestResourceStream(
      "{project default namespace}.{path in project}.{filename}.sql"))
{
   using (StreamReader sr = new StreamReader(s))
   {
      commandText = sr.ReadToEnd();
   }
}

Comment: @Will - In a SQL CLR Project there seems to be no way to add a strongly typed resource file.
Comment: @Will resources are a poor solution too, imho. There doesn't seem to be a way to modify the generated XML comments, and summaries like *Looks up a localized string similar to create table dbo.Foo ( ...* are hardly useful.
Answer: Use QueryFirst. You put your sql in .sql template provided by the tool. Behind the scenes, QueryFirst compiles it as a resource and wires up the call to retrieve it at runtime. You only need to worry about calling Execute() on the generated wrapper class, and your results are accessible via generated POCOs. End to end type safety. Never have to remember a column name or datatype, plus the considerable advantages of having your sql where god intended... in a .sql file.
disclaimer: I wrote QueryFirst
Comment: Reader passing by, admire the absolutely incredible bias of stackoverflow against tools. Q. How do I do x? A. Here are some lines of code you can copy and paste. (accolades) A. Here is a free open-source tool I wrote that does exactly that. (downvotes)
Answer: Add file to Resources, and set file to Resource, in code write:
String SQLCommand = NAMESPACE.Properties.Resources.ScriptDB.ToString()


faster alternative to cp -a

Question: For a simple transfer of /home to another disk i use cp -a that seems to me an  extremely slow way. Should like know a more efficient way to complete the task. I have /home mounted as logical volume, but the target disk is not an LVM system
Comment: If `cp` is slow, other methods would be slow too. Unless it's not file-oriented copying
Comment: Try to diagnose your bottleneck, that depends on your particular setup. You may want to try the `noatime` mount option to reduce unnecessary writes, specially to source file system.
Answer: Try tar, pax, cpio, with something buffering.
(cd /home && bsdtar cf - .) |
  pv -trab -B 500M |
  (cd /dest && bsdtar xpSf -)

I suggest bsdtar instead of tar because at least on some Linux distributions tar is GNU tar which contrary to bsdtar (from libarchive) doesn't handle preserving extended attributes or ACLs or linux attributes.
pv will buffer up to 500M of data so can better accommodate fluctuations in reading and writing speeds on the two file systems (though in reality, you'll probably have a disk slower that the other and the OS' write back mechanism will do that buffering as well so it will probably not make much difference). Older versions of pv don't support -a (for average speed reporting), you can use pv -B 200M alone there.
In any case, those will not have the limitation of cp, that does the reads and the writes sequentially. Here we've got two tar working concurrently, so one can read one FS while the other one is busy waiting for the other FS to finish writing.
For ext4 and  if you're copying onto a partition that is at least as large as the source, see also clone2fs which works like ntfsclone, that is copies the allocated blocks only and  sequentially, so on rotational storage is probably going to be the most efficient.
partclone generalises that to a few different file systems.
Now a few things to take into consideration when cloning a file system.
Cloning would be copying all the directories, files and their contents... and everything else. Now the everything else varies from file system to file systems. Even if we only consider the common features of traditional Unix file systems, we have to consider:

links: symbolic links and hard links. Sometimes, we'll have to consider what to do with absolute symlinks or  symlinks that point out of the file system/directory to clone
last modification, access and change times: only the first two can be copied using filesystem API (cp, tar, rsync...)
sparseness: you've got that 2TB sparse file which is a VM disk image that only takes 3GB of disk space, the rest being sparse, doing a naive copy would fill up the destination drive.

Then if you consider ext4 and most Linux file systems, you'll have to consider:

ACLs and other extended attributes (like the ones used for SELinux)
Linux attributes like immutable or append-only flags

Not all tools support all of those, or when they do, you have to enable it explicitly like the --sparse, --acls... options of rsync, tar... And when copying onto a different filesystems, you have to consider the case where they don't support the same feature set.
You may also have to consider attributes of the file system themselves like the UUID, the reserved space for root, the fsck frequency, the journalling behavior, format of directories...
Then there are more complex file systems, where you can't really copy the data by copying files. Consider for example zfs or btrfs when you can take snapshots of subvolumes and branch them off... Those would have their own dedicated tools to copy data.
The byte to byte copy of the block device (or at least of the allocated blocks when possible) is often the safest if you want to make sure that you copy everything. But beware of the UUID clash problem, and that implies you're copying onto something larger (though you could resize a snapshot copy of the source before copying).
Comment: GNU tar has the `--acls` option, to store the ACLs into the archive. And I'd be surprised if an alien (of sorts) tool like `bsdtar` handles it better than the (essentially) native one...
Comment: Using GNU tools might be a political choice, but it is the default choice nevertheless. And as they are _much_ more popular than the alternatives, there also is more developer (and other) manpower behind them.
Comment: @vonbrand. Your tar must have been patched for that (I think RedHat has a patch for GNU tar for ACLs), because the latest version of GNU tar doesn't support such an option. There exist a number of implementations of `tar` for Linux (`star`, `bsdtar`, `tar`), I'm not aware that GNU tar is any better than the others. The choice for GNU tools is generally more political than technical (see for instance `bash`).
Comment: thanks, the next time i will use pv and tar rather then cp
Comment: @StéphaneChazelas Currently GNU tar [does support `--acls`](https://www.gnu.org/software/tar/manual/tar.html#SEC42)
Answer: I recommend rsync, for example:
rsync -av --progress --stats dest orig

Or, to transfer with compression:
rsync -avz --progress --stats dest orig

Comment: `rsync` is mostly efficient is you already partially have the source data available on the destination volume because it will only transfer missing/changed data. I would not use it for a fast "first copy".
Comment: `rsync` is generally a lot slower than `cp` or `tar|tar`
Comment: Thanks for this information :)

but i never compared these two...
Comment: [A look at rsync performance - LWN.net](http://lwn.net/Articles/400489/)
Comment: I wouldn't trust that article too much.  I use rsync quite frequently and regular copy at 130-170 MB/sec.

faster alternative to cp -a


how to select rows which are mapped to a single record in a one to many relationship?

Question: I have two tables, consumer and user. Consumer table has a foreign key for user table,say user_id mapped to user id in user table.
There are some rows in consumer table which have one to one mapping with user table while some rows are mapped to same user id in user table.
I want to select only those rows from consumer table where more than one record is mapped to a same user id.
Answer: Unless you are needing to return data that is in the user table you don't really need to involve it in your query. In that case you could implement a query such as
SELECT c.user_ID, c.col1, c.col2
FROM consumer c
GROUP BY c.user_ID, c.col1, c.col2
HAVING COUNT(c.user_ID) > 1

Were you to need a result set including results from both tables I would use a query similar to the one Marco suggests.
SELECT c.user_ID, c.col1, c.col2, h.col1, h.col2
FROM consumer c
INNER JOIN user_table u
      ON c.user_ID = u.user_ID
GROUP BY c.user_ID, c.col1, c.col2, h.col1, h.col2
HAVING COUNT(c.user_ID) > 1

Answer: Try something like:
select   user.userid, count(*)
from     user inner join consumer on user.user_id=consumer.user_id
group by user.user_id
having   count(*)=1;


iTunes movie store only shows 100?

Question: It iTunes Store I can search by name, release date or best sellers.  No matter which method I chose I can only see the first 100 titles. For example, if I sort by name I get titles starting with a number and then the letter
Comment: If you want to elaborate more on the actual problem you are trying to solve here or perhaps explain what device and OS is searching the store, we can be more specific in helping you out.
Answer: I believe this is intentional on Apple's part. The reasons for this are:

reduce server load with smaller queries
reduce time to download results to the end user
prevent scraping the web site for store data (which is against the T&C)
simpler code on the user end not having to present hundreds of results on one page

iTunes movie store only shows 100?


What is P99 latency?

Question: What does P99 latency represent? I keep hearing about this in discussions about an application's performance but couldn't find a resource online that would talk about this.
Comment: Organize all your data points from lowest to highest, from left to right. Gather the lowest (leftmost) 99% of the data points, and discard the remaining 1% to the right. The highest value in this gathered group (the right-most value in this left group) is the P99 value.
Answer: It's 99th percentile. It means that 99% of the requests should be faster than given latency. In other words only 1% of the requests are allowed to be slower.
Comment: Only 1% of requests are **expected** to be slower.
Comment: Besides, it is a straightforward answer and has links to the definition, I prefer the @kanagavelu-sugumar answer, which gives an example and also explains why the P99 will be better than p95 in a context. Just remember to consider the context.
Answer: Imagine that you are collecting performance data of your service and the below table is the collection of results (the latency values are fictional to illustrate the idea).
Latency    Number of requests
1s         5
2s         5
3s         10
4s         40
5s         20
6s         15
7s         4
8s         1

The P99 latency of your service is 7s.  Only 1% of the requests take longer than that.  So, if you can decrease the P99 latency of your service, you increase its performance.
Comment: Found this as more practical example :)
Comment: How/why did we select 7 here ?
Comment: I like this example! It's easier to understand.
Comment: @ShahbazZaidi You take all your requests and discard 99% of the bottom ones. In this example above, we discard all requests with latency from 1s to 7s.
Comment: @ShahbazZaidi If I understand ThePavolC's explanation correctly, it's _close_ but not quite right: If we discard the bottom 99% (_including_ `7s`), then we'd be left with `8s` but that is NOT the 99th percentile! Instead, I would explain it the other way around: Sort the requests in ascending order and discard the top/largest 1%. The largest remaining value is the 99th percentile. Here, there are 100 requests so the "top 1%" corresponds to the 1 largest request (the one that took `8s`). When we get rid of that, the max remaining value is `7s`, which is the correct 99th percentile.
Comment: Source: My explanation above is based off of [this](https://stackoverflow.com/questions/38781499/what-does-90th-95th-99th-pct-matrices-means-in-dashboard-report-of-jmeter/45467589#45467589) answer
Answer: We can explain it through an analogy, if 100 students are running a race then 99 students should complete the race in "latency" time.
Comment: `Should` not `will`.
Comment: It's the time that the student who came in 99th crossed the line.
Comment: Also, <= 'latency time'
Comment: I love this analogy.
Comment: @Tyler Lui Then half a student should complete the race in "latency" time
Comment: What if there are only 50 students?
Comment: The modal verb being used is likely confusing the answer a bit. The percentile ranking of the latency of a given set of requests is the measurement of requests that have already occurred 100% (that is all of them) in the past. If your p99 value is 1 ms, that means that 99% of the sample that was taken to come up with the ranking had a latency of 1 ms or less. There is no could, would, or will. That whole nomenclature is used to argue ideas about the past and how likely the prediction of their future performance is true. @AaronS said it best with should.
Answer: Lets take an example from here
Request latency:
    min: 0.1
    max: 7.2
    median: 0.2
    p95: 0.5
    p99: 1.3

So we can say, 99 percent of web requests, the average latency found was 1.3ms (milli seconds/microseconds depends on your system latency measures configured).
Like @tranmq said, if we decrease the P99 latency of the service, we can increase its performance.
And it is also worth noting the p95, since may be few requests makes p99 to be more costlier than p95 e.g.) initial requests that builds cache, class objects warm up, threads init, etc.
So p95 may be cutting out those 5% worst case scenarios. Still out of that 5%, we dont know percentile of real noise cases Vs worst case inputs.
Finally; we can have roughly 1% noise in our measurements (like network congestions, outages, service degradations), so the p99 latency is a good representative of practically the worst case. And, almost always, our goal is to reduce the p99 latency.
Answer: Explaining P99 it through an analogy:
If 100 horses are running in a race, 99 horses should complete the race in less than or equal to "latency" time. Only 1 horse is allowed to finish the race in time higher than "latency" time.
That means if P99 is 10ms, 99 percentile requests should have latency less than or equal to 10ms.
Answer: If p99 value is 1ms, it means, 99 out of 100 requests take less than 1ms, and 1 request take about 1 or more than 1ms.
Answer: P99 is a latency measure.
In very simple words, P99 latency represents a threshold of application performance where 99 percent of requests/tasks/operations complete in time below that threshold (99 percentile).
For example, if out of 100 requests to an application, 99 complete within 4ms, then P99 latency of that application is 4ms. In other words, only 1 request is allowed to complete in more than 4ms.
Also, if 95 requests to that application complete within 3ms, the P95 latency of that application is 3ms. And only 5 requests are allowed to (or should) take more than 3 ms to complete.
And if 90 percent requests complete within 2ms, the P90 latency is 2ms with only 10 requests allowed to take more than 2ms to complete.
From above you can guess that P90 and P95 are two other latency measures along with P99.
Answer: To put it simply, imagine you have an API with a contract stating that it must respond within 10 milliseconds (ms) to callers. Over the course of an hour, you've received various requests from different consumers:
Consumer A made 10 requests at 10:00 am with responses taking 5ms each.
Consumer B sent 2 requests at 10:05 am, each with a 5ms response.
At 10:07 am, Consumer B submitted 20 requests, each taking 7ms to respond.
Again at 10:07 am, Consumer B had 20 more requests with 7ms responses.
At 10:20 am, Consumer B requested 20 times, with responses taking 11ms.
Consumer B made 30 requests at 10:15 am, with responses at 12ms.
At 10:30 am, Consumer B submitted 20 requests, and each took 10ms.
Finally, at 10:43 am, Consumer B had 40 requests, with 9ms responses.
If we sort these response times in ascending order, the second-highest response time is 11ms, which exceeds the agreed 10ms. This value, known as P99, indicates that 99% of responses were below or equal to 11ms. Since P99 is above the agreed response time, we should also check P95, which examines if 95% of all requests breach the agreed response time. If they do, we must also look into P90. By continuously monitoring these metrics (P90, P95, and P99), the Operations team can swiftly identify issues in the service or infrastructure and take corrective action.

What is P99 latency?


Servlet : What exactly the use of context.getRealPath(" ");

Question: As i know it returns the application path? But what exactly the use of it.
Answer: In many environments the application user is not allowed to read any files outside of the deployment directory.   This is mostly done for security purposes - for example if someone hacks your application they won't be able to read a passwords file.
And in professionally managed environments developers often don't have a say in which directory the application will be placed.
So if you need to read a file like properties, images, certificates, etc. you can place it in the application directory (or .war file) and use getRealPath("") to get the path you need to load.
As an alternative you can place the external files on the classpath but there are sometimes issues with this.  For large files most app servers will try to load the entire file into memory and cache it if it is on the classpath.
Answer: The getRealPath() gives the absolute path (on the file system) leading to a file specified in the parameters of the call. It returns the path in the format specific to the OS.
The getContextPath() on the other hand returns the URI or the relative path to the resource.
Answer: As far as I remember, I've used it to save images or other data files, since it allows you to see where your application is deployed at the moment. For example, Eclipse and Tomcat will create a temporary folder that's buried deep somewhere within your Eclipse profile and deploy the app there.
Answer: This is a real path in file system.
From javadoc:
The real path returned will be in a form appropriate to the computer and operating system on which the servlet container is running, including the proper path separators. This method returns null if the servlet container cannot translate the virtual path to a real path for any reason (such as when the content is being made available from a .war archive).
I think it is very clear. Why do we need this? Sometimes web applications perform some manipulation in file system. For example read stuff from files, write files etc. This API allows you to access the place where your JSPs and other stuff is really stored.


How to custom message validator with Laravel

Question: I am making an API that allows users to input some information like email, phone number, address ...
But if users input wrong phone nums, the validate error is
{
  "message": "The given data was invalid.",
  "errors": {
    "phone": [
      "The phone has already been taken."
    ]
  }
}

As you can see the message returns is
"message": "The given data was invalid."

. But the message I expect is The phone has already been taken. How can I custom the message as I expect? With an email validator, the message is the same but the key is email. The message I expect is
"message": "The ... has already been taken. "

I'm using laravel 8 and validate in Request
Example a function rules()
    public function rules()
    {
        return [
            'profile_img' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg|max:' . config('filesystems.max_upload_size'),
            'name' => 'nullable|min:3',
            'phone' => [
                'required',
                'numeric',
                new UpdatePhoneRule(User::TYPE_CLIENT),
            ],
            'email' => [
                'nullable',
                'email',
                new UpdateEmailRule(User::TYPE_CLIENT),
            ]
        ];
    }

Thanks
Answer: On the Request php file you can use this function failedValidation() and pass in a Validator. This way you can alter or customize the response if validation fails.
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Contracts\Validation\Validator;

    protected function failedValidation(Validator $validator) {
        throw new HttpResponseException(response()->json(['status'=>'failed',
                                                    'message'=>'unprocessable entity',
                                                    'errors'=>$validator->errors()->all()], 422));
    }

Sample response is here..
{
"status": "failed",
"message": "unprocessable entity",
"errors": [
    "The name must be a string.",
    "One or more users is required"
 ]
}

As you can see the message is changed now you can do whatever you want on the response message.
Also you can try this
$validator->errors()->messages()[keyname]

Answer: You have to use unique in your validation
$this->validate(
    $request,
    [
        'email'             => 'required|unique:your_model_names',
        'phone'             => 'required|unique:your_model_names'
    ],
    [
        'email.required'    => 'Please Provide Your Email Address For Better Communication, Thank You.',
        'email.unique'      => 'Sorry, This Email Address Is Already Used By Another User. Please Try With Different One, Thank You.',
        'phone.required' => 'Your custom message',
        'phone.unique'      => 'The phone has already been taken'
    ]
);

Comment: thank you, but it's not the result I expect. many thanks
Answer: You can do this in the lang file: resources/lang/en/validation.php. If all you want to do is change, for example, the message for a unique rule on an email field across the entire app you can do:
/*
|--------------------------------------------------------------------------
| Custom Validation Language Lines
|--------------------------------------------------------------------------
|
| Here you may specify custom validation messages for attributes using the
| convention "attribute.rule" to name the lines. This makes it quick to
| specify a specific custom language line for a given attribute rule.
|
*/

'custom' => [
    'attribute-name' => [
        'rule-name' => 'custom-message',
    ],
    'email' => [
        'unique' => 'This email is already registered...etc',
    ]
],


How to add different applications to a same CDF

Question: Let say I have a multiple small application utilities, how can I add them to a same CDF with a table of content (or navigation panel) on the left of the CDF, and if I want to open one application, I only need to scroll down to the application navigator on the left, click, and the application run ? (Similar to what appears in this youtube video: https://www.youtube.com/watch?v=XEbo-QAIWqc)
Answer: One way to have many different small applications in the same file is to have multiple Manipulates. For instance, a file with two cells:
<code>Manipulate[Plot[Sin[f x], {x, -3, 3}], {f, 1, 10}]

Manipulate[Plot[Cos[g x], {x, -3, 3}], {g, 1, 10}]
</code>
and then saved as CDF works fine. You can hide/view the different manipulates by double clicking on the brackets on the right hand side of the cells. There are also little triangles to the left of the word Manipulate that open/close the displays.


How to determine where syslog messages are coming from?

Question: I took over a Fedora server where the /var/log folder keeps growing to over 100gb of data and some of the logs are old.  I think some of them are logs being sent from our Firewall but how do I determine where all the messages are coming from?
Answer: Generally speaking, 100gb of logs in /var/log indicates that logrotate was either not implemented or misconfigured or broken for some reason. Logs in /var/log are subject to policies defined in configuration of logrotate. I would first look whether it is installed (it should be by default on many distros) and how exactly configured in configuration file - most commonly /etc/logrotate.conf.
Second problem is generation of so many log data. If firewall / iptables-netfilter is suspected search for --log-prefix in output of iptables -L -n. Take action accordingly.
Your problem may be long time present but never escalated, speaking from my personal experience.


What is the biggest change in votes following a recount?

Question: In Michigan, a Republican in a local election went from barely losing to winning clearly after picking up ~1200 votes in a recount.  That seems like a lot to me, which got me wondering.  What is the most a vote has changed as a result of a recount?
Comment: @Ryan_L [the article](https://www.wxyz.com/news/error-in-election-results-reveals-losing-candidate-as-actual-winner-in-rochester-hills) mentions the following statement from an Oakland County Clerk: *"This is proof that our process of checks and balances works. A methodical canvass is an essential tool to ensure an accurate count and precise results."* I don't know what that "methodical canvass" is, but I think it could be an interesting new question.
Comment: Was there actually a recount in that example? The current article doesn't use the term, and the Breitbart article only mentioned it in a quote of the winner (then thinking he lost) saying he wouldn't seek a recount.
Comment: @JJJ I don't know how else they would have caught the mistake.  There must have been some kind of debugging process following the election or the erroneous result would have stood.
Comment: You seem to mean change in absolute number of votes, not pecentage.
Comment: @KeithMcClary I think both are interesting.
Answer: Ballotpedia has an article on Noteworthy recounts in the United States.  For 2000-2015, they cite a report from FairVote:

From 2000 to 2015, there were 27 recounts in [4,687] statewide races across the country. Of those 27, there were three that resulted in a change of the election result. The average vote shift across all 27 recounts was 282 votes, which accounted for 0.019 percent of the vote in those races

That page also has a section on "Notable recounts" from a few different years (including the 2000 Bush/Gore recount).  The biggest swing they have listed is the 2018 Florida Senate race, where the Republican challenger's vote lead decreased from ~15,000 votes to ~10,000 votes after both machine and hand recounts.  Notably, this change in votes is larger than that of the three races where the result actually changed, because they were all closer than this to begin with.
It's certainly possible that there have been larger recount swings before 2000, or in single-district races which FairVote didn't look at, but it's unlikely that anything smaller than a state-wide election had a vote shift larger than that 5000 vote Senate one, simply because of the smaller number of votes involved.


FieldCollection/PLUpload - Recurring error when uploading images on PROD - "No file by that name exists"

Question: TL;DR Pantheon's distributed file system can't handle modules that refer to the temp file system across multiple requests, which messes up the Plupload module. What alternatives are there?
The error occurs when users upload images to the site using PLUpload, and it only occurs in the LIVE environment.  Our discussions with pantheon support indicate that this is likely something to do with our code not playing nicely with the load balancing in the live environment.  At this point though, we're pretty stumped on how to proceed.  I was hoping someone here may have encountered it and could provide some insight on how to proceed.
In case the screenshots do not share correctly, I have included a link to a google doc
Here's an example of the error message.

Some notes:

We uploaded 5 images here.  2 were rejected as you see in the pink
notification below.  The number of failed images appears to be
entirely random - sometimes all will work.  Sometimes just 1,
sometimes none.
We have tried changing the path
from temporary:// to public:// - this error appears to occur
regardless of where the temp space is pointed. Only occurs in the
live environment due to the load balancing in use with our hosting provider
Cloud-based hosting, so we do not have access to make changes to the load balancer.

Steps we've taken:

Insert watchdog in file.inc where we see this error
Enable dblog and try to reproduce the error you see above.
Identify the failure point in the debug log.  Here's what we see:

Watchdog is showing that the file in question does not exist
We check the SFTP, and it's definitely there.

In our discussions with the hosting provider, here's what we learned:

This is likely a fringe case that the load balancer doesn't have the ability to handle.
It sounds like the module is making a number of requests with the assumption that they can share a tmp directory.
and this comment:

Do you know if the PLUpload file issues multiple HTTP requests (via AJAX maybe?) when doing the uploads? If so, it may be that it's assuming that the temporary filesystem is shared between all requests.
This is a common flaw in a lot of contributed modules or plugins: they assume that there's only one place the code is executing, and that the "temp" filesystem space is available consistently across N requests.
This isn't what temporary filesystems are really for, but in a legacy single machine architecture it will rarely cause failures. Once you are distributed that assumption will fail quite reliably.

Now for the part that has us stumped:

It seems that PLupload might not be our best approach.  If we want to get it to work, we'd have to figure out how it's handling temporary file requests.
Our site was originally built with PLupload and Field Collection working together.  I'm curious if there's other modules we can look into that will allow us to get the functionality of both within the confines of the hosting environment.
Comment: TL;DR Pantheon's distributed file system can't handle modules that refer to the temp file system across multiple requests, which messes up the Plupload module. What alternatives are there?
Comment: Thought that summary would be useful, I'm sure many people won't bother to read the whole thing on a Friday, well written though it is!
Answer: This is a note for people who face this problem. Maybe it can help them.
I had this error on a project. I see that it occurs on a plupload widget with a limit of file number set to 1. I replaced this field by a classic upload and the problem gone.


im getting confused in persentage question of probability..

Question: a group consists of equal number of men and women of this group 20% of men and 50% of the women are unemployed. if a person is selected at random from this group the probability of the selected person being employed is .........
In this problem , lets take eg. 50 men and 50 women. Out of which 10 men are unemployed and 25 women unemployed..so probability of unemployed men is 1/10 and unemployed women is 1/2 .. but after that..i dont understand how to calculate the probability of selected person is employed . My ans is not coming correct
Comment: Your selected person is either male or female, each with probability $\frac 12$.  These cases are mutually exclusive.  Hence the answer you want is $\frac 12 \times .8+\frac 12 \times .5$.
Answer: Another way of saying this:
Given that the person you picked is male, the probability of them being employed is $0.8$.
Given that the person you picked is female, the probability of them being employed is $0.5$.
The probability of the person you pick being male is $0.5$.  Same thing for female.
So the probability is
$$P = P(\text{male})P(\text{employed, given male}) + P(\text{female})P(\text{employed, given female}) \\ = 0.5 \cdot 0.8 + 0.5 \cdot 0.5 = 0.65.$$
Answer: The answer is:
P(guy|employed) = P(man).P(employed|male) + P(woman).P(employed|woman) = (0.5).(0.8) + (0.5).(0.5)


Part identification (single part)

Question: I'd be grateful if someone could help me identify this part. It's from the Lego Power Functions Ideas book, which has a gallery of required parts, but without part numbers.
Comment: Why does it say you need zero of that part?
Comment: The photo is from the 2nd book in a set of two by Yoshihito Isogawa. The appendix lists all the parts required for the models in each book, and the required quantity. It also states (in brackets) how many of each part is required for the models in the sister book. I cropped this out unintentionally from the photo.
Answer: It is 4281515: Bionicle Eye.
Appears in 22 sets according to Brickset.
Comment: Thank you! Been trying to find this for days.
Comment: Glad I could help. I've been sorting through Chima stuff recently so recognised it.

Part identification (single part)


Problem with high reputation requirements for tag wiki edits?

Question: Has something odd happened to the "tag wiki" reputation limit?  Having just ticked over 5000, I looked at my reputation page and saw that I had 50% of the rep to get moderator tools, and 25% of the rep required to edit tag wikis.  Mouseover says that now requires 20000 reputation, but I vaguely recall it needing 2000 when last I looked.  Has an extra zero crept into a config file anywhere?
Comment: I don't know if that's a mistake or not but I can approve edits to tag-wikis, maybe it's just a double check system... makes sense to have two sets of eyes on those anyway.
Comment: If it's 20K to make unapproved edits and everything else subject to approvals like for 1-rep users editing that kinda makes sense
Answer: It is 20k to make unapproved edits, as noted by voretaq7.
All other edits must be voted and approved.
Comment: Thanks, Jeff; is that a recent change, or am I just losing my memory?
Comment: shouldn't this be marked status-bydesign?


Associated tables being fully parsed when referred to with an 'Include' statement using Entity Framework

Question: I'm having problems with Includes when pulling data out of the entity framework. I posted a very similar question yesterday here, which has the same sample I'm about to use. I'm using Entity Framework v4.0.
I have the following simple model, a table containing list of Page Forms (~200). Each form has one or more Fields (~4000 total), and each field has may have some Parameters (~16000 total).

I use the following code to pull data out:
EntityConnection myConnection = new EntityConnection("name=myModel");

if(conn.State != ConnectionState.Open) {
    conn.Open();
}
ObjectContext context = new ObjectContext("name=myModel");
context.ContextOptions.LazyLoadingEnabled = false;

ObjectQuery<PageForm> myObjectSet = context.CreateObjectSet<PageForm>()
                                           .Include("FormFields.FormFieldParameters");

IQueryable<PageForm> myFilteredObjectSet = myObjectSet.Where(c => c.FormID == 1);

List<PageForm> myReturnValue = myFilteredObjectSet.toList();

Which generates the following sql query
SELECT
[Project1].[FormID] AS [FormID],
[Project1].[FormName] AS [FormName],
[Project1].[C2] AS [C1],
[Project1].[FormID1] AS [FormID1],
[Project1].[FieldID] AS [FieldID],
[Project1].[FieldName] AS [FieldName],
[Project1].[C1] AS [C2],
[Project1].[FieldParamID] AS [FieldParamID],
[Project1].[Value] AS [Value],
[Project1].[FieldID1] AS [FieldID1]
FROM (
    SELECT
    [Extent1].[FormID] AS [FormID],
    [Extent1].[FormName] AS [FormName],
    [Join1].[FieldID] AS [FieldID],
    [Join1].[FieldName] AS [FieldName],
    [Join1].[FormID] AS [FormID1],
    [Join1].[FieldParamID] AS [FieldParamID],
    [Join1].[Value] AS [Value],
    [Join1].[FieldID1] AS [FieldID1],
    CASE WHEN ([Join1].[FieldID] IS NULL) THEN CAST(NULL AS int) WHEN ([Join1].[FieldParamID] IS NULL) THEN CAST(NULL AS int) ELSE 1 END AS [C1],
    CASE WHEN ([Join1].[FieldID] IS NULL) THEN CAST(NULL AS int) ELSE 1 END AS [C2]
    FROM  [dbo].[PageForm] AS [Extent1]
    LEFT OUTER JOIN (
        SELECT
        [Extent2].[FieldID] AS [FieldID],
        [Extent2].[FieldName] AS [FieldName],
        [Extent2].[FormID] AS [FormID],
        [Extent3].[FieldParamID] AS [FieldParamID],
        [Extent3].[Value] AS [Value],
        [Extent3].[FieldID] AS [FieldID1]
        FROM  [dbo].[FormField] AS [Extent2]
        LEFT OUTER JOIN [dbo].[FormFieldParameter] AS [Extent3] ON [Extent2].[FieldID] = [Extent3].[FieldID]
    ) AS [Join1] ON [Extent1].[FormID] = [Join1].[FormID]
    WHERE 1 = [Extent1].[FormID]
) AS [Project1]
ORDER BY [Project1].[FormID] ASC, [Project1].[C2] ASC, [Project1].[FieldID] ASC, [Project1].[C1] ASC

Now I'm interested in this part of the query:
LEFT OUTER JOIN (
    SELECT
    /**/
    FROM  [dbo].[FormField] AS [Extent2]
    LEFT OUTER JOIN [dbo].[FormFieldParameter] AS [Extent3] ON [Extent2].[FieldID] = [Extent3].[FieldID]
) AS [Join1] ON [Extent1].[FormID] = [Join1].[FormID]

This seems to query the entire FormField and FormFieldParameter tables, with no filtering applied. So, what I think is happening, is that using .Include("FormField.FormFieldParameter") is akin to saying - "And return all data from these tables in the resulting query". What I really want is "Return only the data from these tables which relates to the filtered PageForm table".
Is there a way to do this? Sorry if this question sounds too simple, or similar to my previous question, but I'm really having trouble getting my head around the internals of Entity Framework.
EDIT 1:
If I change the above sample to the following which includes a where clause, then the query is orders of magnitude faster (roughly 10x faster).
LEFT OUTER JOIN (
    SELECT
    /**/
    FROM  [dbo].[FormField] AS [Extent2]
    LEFT OUTER JOIN [dbo].[FormFieldParameter] AS [Extent3] ON [Extent2].[FieldID] = [Extent3].[FieldID]
    WHERE 1 = [Extent2].[FormID]
) AS [Join1] ON [Extent1].[FormID] = [Join1].[FormID]

EDIT 2:
Some more information. I've figured out that If i add some funky filtering to the initial query, I can force a much more efficient query to be ran.
IQueryable<PageForm> myFilteredObjectSet = myObjectSet
                                          .Where(c => c.FormID == 1)
                                          .Where(a => a.FormFields
                                                       .Where(c => c.FormFieldParameters
                                                                    .Any(d => d.FieldID == c.FieldID))
                                                       .Any(b => b.FormID == 1)
                                           );

This causes the query to filter correctly, and runs much faster. However, I'm certain this isn't the best way go about this, as the nested Where/Any statements very quickly become a nightmare to deal with when you have more than a handful of Includes. There must be a better way?
Comment: That workaround doesn't eager load your relations. Even if you add Include it will still not filter includes because that [feature is not supported](http://data.uservoice.com/forums/72025-entity-framework-feature-suggestions/suggestions/1015345-allow-filtering-for-include-extension-method).
Comment: It appears to be eagerly loading everything ok for me, and the sql profiler I have running only shows a single call being made - which is when I call `.ToList()` on the Queryable object.
Answer: The filtering is applied - your query contains WHERE 1 = [Extent1].[FormID]. It really loads only date you have requested. The query engine in the database will evaluate your query correctly and it will use some optimization techniques to filter records efficiently.
Comment: I'm sorry, but I'm sure this is not correct. If I manually update the query to include an inner where clause, the query runs much faster. I'll update my question to show this.
Comment: Well, it now becomes completely different question because your former question was about returning wrong data and new question is about different performance. Yes EF queries may have much worse performance but the only workaround is not using Linq and EF and writing your own SQL queries.
Comment: I think you misunderstand - the data that I'm getting back in exactly as expected, in both situations. The issue is that the query generated is selecting from the entire 'FormField' table, when it should only be selected from the table where `FormID == 1`. I know there is an overhead in using EF, but this is such a large performance hit, that I am sure I must be doing something wrong.
Comment: See my question for a workaround, which works, but is ugly as sin. I'm sure there must be a better way of doing this.
Comment: Unfortunately you are not doing anything wrong. You can try to use .NET 4.5 - there can be some performance improvements, report it to [MS Connect](http://connect.microsoft.com/) as a bug, report it to [Data UserVoice](http://data.uservoice.com/forums/72025-ado-net-entity-framework-ef-feature-suggestions) as request for improvement or open design discussion on [EF CodePlex](http://entityframework.codeplex.com/). You can also download EF source code from codeplex and try to fix it yourselves.


Is there a standard video logo size? When could a 1500px png logo 300 ppi size be possibly needed?

Question: Is there a standard video logo size? When could a 1500px png logo 300 ppi size be possibly needed?
Comment: PPI/DPI have nothing to do with video. All that matters is the image size in pixels. It depends on how big you want the image to be, or what you need to do with it. Also note that video editing is generally off-topic here.
Comment: Also worth mentioning that a 1500px image is still a 1500px image regardless of the ppi/dpi setting.  A 1500px image at 72 ppi is exactly the same as a 1500px image at 300 ppi.  If you don't understand why, check out [The Myth of DPI](http://www.rideau-info.com/photos/mythdpi.html) - an old but still very useful article.
Comment: @joojaa already said it pretty much everything, but man, this seems suuuper vague. You need it when you need it. There aren't any standard sizes unless it's a very specific use case. The size can depend on how it's used too. **My first question would be, do you have this in a vector format?** In which case the size wouldn't matter.
Comment: @Joonas yeah they probably want to animate the logo anyway so they need to break ot up anyway.
Answer: First lets talk about the PPI/DPI thing. Its entirely irrelevant for the context of video production. It literally never comes to play.
Second a full hd aka 1080p image is 1920 x 1080 pixels in size so ideally youd have a version of the logo thats designed exactly for those pixel dimensions, with whitespace and all. But 4k consumer (4k UHD) devices are 3840 × 2160 pixels, and cinema (DCI 4k) devices are 4096 × 2160. Not to talk about 8k stuff.
So for any modern video producer a 1500 pixel logo seems a bit low resolution indeed. But why they wouldnt use the vector files beats me?
So to directly answer the question:

When could a 1500px png logo 300 ppi size be possibly needed?

Every time they need a full screen logo. So pretty much at the start of each video.
Answer: You are not thinking in the correct context.
A video has a specific pixel resolution if you want to specifically target an optimum display.
For example FullHD has specific dimensions of 1920x1080px. So, define your logo on how it should be using a canvas of that specific size. It does not matter the pixel size. That pixel size is how you want it to be.

Is there a standard video logo size

Thank god no. Why would anyone want a standardized look on a logo on a video? Make the logo any size you need or want.
But something to take into account is that some video edition programs can use either a vector logo file or a raster one.
If you want to have a logo on a higher resolution screen, make it bigger than the one needed for HD, so you do not see a pixelation or use a vector version and define whatever size during editing.


Why low error indicates better model when only one feature is used?

Question: In this lecture, starting from first minute, there is an example of features for housing application. Let's say number of features is 1. I understand why lowest error indicates better model, but why lowest error indicates a better model in this case?  A feature is just a number, so if for example #bedrroms=1 and #bathrooms=1, so the RSS value should be the same when I use #bedrroms feature or #bathrooms feature, right? And if those features have different values, I'll get different RSS values.  But, does this mean that the lowest is better? I hope I explained myself well.
Answer:
A feature is just a number, so if for example $\#bedrroms=1$ and
  $\#bathrooms=1$, so the RSS value should be the same when I use #bedrroms feature or #bathrooms feature, right?

A feature can be of various types, but for the two that you mentioned let's assume they are integers. We consider instances, i.e. data points, that have a certain feature value associated to it.
For example, we have an instance from our data set of house prices, and an instance has the feature values $\#bedrooms=1$ and $\#bathrooms=1$. If we were to only consider this one instance for training our model, you are right in expecting that selecting any one of them will result in the same RSS.  However, we're not just considering one instance, but many, and in most cases they have different values for different features.
In the example of the housing prices data set, we have many different houses that have different number of bed- and bathrooms, among other features, as well as a target value associated to it that we want to predict using a regression model, for example the price per m². The 'best' feature is not one with the lowest value, but rather one that helps most in predicting the target value based on it.


Will turning on bitlocker erase existing data the encrypted partition?

Question: I've got a 700GB external disk.  Can i safely turn on bitlocker without erasing any data?
Answer: Yes, you should be able to enable bitlocker without losing your data. It would still be a good idea to backup the data before you start the encryption process.
Do Not unplug the drive while the initial encryption is being done without pressing the "Pause" button.
Comment: Agree. I hate the chore of backing up data when i don't have matching disk space!  But gotta be done.
Answer: Drive encryption programs do not erase the data on volumes they have been turned on on. They will encrypt all the data, which can take some time depending on the type of encryption, the amount of data to be encrypted, the speed of the drive and system, and many other factors. But unless there is a catastrophic failure during the encryption process, your data will not be deleted during this process.
That said, if an encryption process fails catastrophically (I have not yet observed such an occurrence myself, the chances are VERY remote), you're less likely to be able to recover the data than if an unencrypted drive experiences a similar problem. This is simply the nature of encryption. But the chances of this are extremely remote and so should not generally be considered a reason not to encrypt.


How does Worldviz Vizard compares to Panda3D and Pygame?

Question: Is anybody familiar with Worldviz-Vizard's 3D engine for python? How does it compare to Panda3D? I have a feeling that it might be easier to learn but far more limited. They only support python 2.4 which also makes me not want to try it.
Comment: Good god, look at those prices! I haven't heard of Worldviz before now, so won't formally answer. I endorse Panda3D wholeheartedly.
Comment: That is exactly what made me come and ask. Either these guys have something awesome to charge almost 10,000 or they are crazy.
Comment: There are a few different options for licensing. The full dev one is expensive, but not unreasonable and it's not your only option.
Answer: Been using Vizard for various VR and AR development for about 3 yrs now - it's NOT unity - i.e. a web enabled game engine (excellent though it is) - what Vizard provides is a highly optimized OpenGL engine, wrapped in user friendly python scripting environment BUT on top of this you get the ability to seamlessly distribute your simulations over a cluster or a network. Vizard keeps all things completely synched - invisible to the user. Connects to pretty much all known VR tracking equipment and display periphals and standard gaming equipment is also supported (Wiimote & Kinnect). Native support for frame sequential, side-by-side and anaglyph stereo, spatial sound engine and the ability to extend it with C and C++ plugins or GLSL shaders.
Didn't actually mean to write that much and I don't want to come across as a Vizard evangelist, it is not perfect, BUT comparing it to Panda3D, Unity or other game engines I feel is an unfair comparison - not like-for-like :o)
Answer: I've never heard of Worldviz Vizard or Panda3D but it seems to me like you would have to reinvent the wheel to use Pygame for 3D.
Another Option:Unity.
I'm not terribly experienced with this either but I heard it's good.
Answer: I only used Vizard, and that for one small project.
It was easy to use, well documented, and had a good set of examples.


Persistent SSH port forward without public keys

Question: Problem
I haven't found a solution to run an SSH port forward in a reliable and persistent fashion, when the server you are connecting to does not support public-key authentication.
Question
What is the most reasonable way to keep a persistent SSH port forward alive when a password is required?  Taking into account security and reliability (I realise it is not ideal). I'm happy for it to need a password on start (i.e. not persistent over server reboots, this should prevent an actual script from having a plaintext password), but I need it to be reliable over disconnections.
Motiviation
The server I wish to connect to is behind a series of firewalls, and I am using local SSH port forwarding to expose a web-server to the public Internet. I am currently using standard port forwarding, but getting 'broken pipe' errors every few days and I want it to auto-restart the connection on these types of failures.
Attempts

I have tried to use AutoSSH but it seems to assume you have public-key authentication. I have not been successful in getting it work with some kind of password authentication.

I have tried using sshpass, but then I've been unsuccessful at getting the port forwarding to work with this. I think it might be getting confused by the welcome message the SSH server gives.

Why can't I enable public-key authentication?
It has been setup by design by IT to require a password, for policy reasons. I do not have root access to the server and cannot change it. I'd like to use public-key authentication, but I am stuck with what I have.
Ideas

Maybe using something like expect, and building my own script solution, but it doesn't sound great.
Answer: The author of the question provided the following work-around solution:

Update - Work-around solution
This isn't really a solution to the given question, but it did solve my original problem. I ended up using a reverse proxy instead of a local proxy, this allowed me to use public keys and autossh.
<code>autossh -M 20000 -nNT -R *:80:localhost:80 firstname.lastname@example.com
</code>


Should I convert some of my money into US dollars now when the rate is low?

Question: If I think the Canadian dollar is quote low, and I have a bank account in US dollars, would you suggest that I put a few thousands of CAD in that account?
Answer: No.
Suppose you have 100 Canadian dollars and the exchange rate is 2 CAD = 1 USD.  You use your 100 CAD to purchase 50 USD (in your bank account that is in USD).  Some time later the Canadian dollar grows stronger, so that now 1 CAD = 1 USD.  If you now withdraw your 50 USD and get Canadian dollars, you will receive 50 CAD.  You have lost half your money.
If you want to make money on currency exchange rates (which is a risky plan), you should buy the currency that is cheap (i.e., "weak").  If, say, oil is very cheap, you don't make money by selling oil; you buy it and sell it later when the price goes up.  Likewise, if the Canadian dollar isn't worth much and the US dollar is, you should buy Canadian dollars, not US dollars, hoping to sell them later when the exchange rate is more favorable.  See also this similar question.
Comment: Of course, "cheap" is relative to expectations, which may be wrong. And C$ have already come up to much closer to par with US$; it's very hard to be sure whether we're now high, low, or about right and which direction things might go from here, or when. If you don't understand what drives exchange rates (I know I don't!) betting on them is probably a bad idea


why speed is not directly proportional to torque in dc machine?

Question: I have a conceptual doubt about torque-speed relation in a DC motors. It's probably a gap in my thinking but I'm posting this question anyway.
As per me "in case of dc machine we see that the armature rotates because of the developed torque.so from the physical point of view it leads that if armature gets more torque then it will rotate at high speed; i.e. speed directly proportional to torque."
BUT why the reverse thing happens????? why speed is inverse proportional to torque....?/?
pls, explain physically......
Comment: Speed is not inversely proportional to torque.
Comment: \$T = \frac{V_a - k_t \omega_a}{R_a}k_t\$, where \$k_t\$ is the motor torque constant, \$\omega_a\$ is the armature speed, \$V_a\$ is the applied armature voltage, and \$R_a\$ is the armature resistance.  Yes, torque goes up with decreasing speed if you're applying a constant voltage (which is not always the case), but it is not an inverse proportional relationship.
Comment: @TimWescott Isn't it? DC machines put out more torque at lower speeds than higher speeds, rather than the most torque at high speeds and the least torque at low speeds.
Comment: @Toor DC machines CAN put out higher torque at lower speeds, but they can also put out low torque at low speeds, so there is not an inverse relationship between speed and torque unless the requirement is to maintain constant shaft power.
Comment: Please keep in mind the person asking the question and the likely context of his question. I think it's pretty clear he is referring to only a single line (aka voltage) on a torque-speed curve, whereas you are referring to every possible line on a torque speed curve. If you want to explain an answer to him on a level that he is obviously not going to get, you might as well vote to delete his question.
Answer: All of this applies to permanent magnet DC brushed motors -- different kinds of motors behave differently.  Be warned.

Speed is not proportional to torque.  Rotational acceleration is proportional to torque over moment of inertia, though: \$\alpha = \frac{T}{J}\$, where \$\alpha\$ is acceleration in \$\frac{\mathrm{radians}}{\mathrm{sec}^2}\$, \$T\$ is torque in N-m/s, and \$J\$ is moment of inertia in \$\frac{\mathrm{kg}}{\mathrm{m^2}}\$.
Armature current is a function of the motor's back EMF, the applied voltage, and the armature resistance: \$i_a = \frac{V_a - E_{back}}{R_a}k_t\$, where \$i_a\$ is the armature current, \$R_a\$ is the armature resistance, \$V_a\$ is the applied armature voltage, and \$E_{back}\$ is the back EMF
Back EMF is a function of the motor's speed: \$E_{back} = \omega_a k_t\$, where \$\omega_a\$ is the armature speed and \$k_t\$ is the motor's torque constant.
Torque is a function of the motor's armature current: \$T_a = i_a k_t\$

If you put that all together, you'll find that a DC motor with a constant voltage on it will "try" to spin up to a speed proportional to the applied voltage, and that its torque (and current) will be proportional to how much slower it is than that ideal unloaded speed.
A DC motor that's driven with a constant current will behave differently than one driven with a constant voltage -- and it's fairly common in servo applications to drive a motor with a current command, rather than a voltage command.  But it'll still follow the equations above.
Comment: Good answer with just enough math to make sense. So torque can be an 'instantaneous' value and a 'integral' value, assuming current control, which is how I control my cooling fans. Due to starting currents and mechanical inertia the PID loops need all 3 elements so the motor does not stall or surge.
Answer:
in case of dc machine we see that the armature rotates because of the developed torque. So from the physical point of view it leads that if armature gets more torque then it will rotate at high speed.

I do not see how the first part leads into the second part at all.
You must remember two things:

the faster the motor spins, the more back-EMF (a type of voltage) is produced.
more current flowing through the motor windings means a stronger magnetic field which means more torque

The speed a motor spins at is the speed where the back EMF perfectly cancels out the power supply voltage. If you apply load torque to the motor to slow it down, the BEMF generated is reduced so there is an excess in supply voltage which pushes more current into the motor. The amount of current pushed into the motor produces an extra voltage drop across the motor's internal resistance. The current stops increasing when this resistive voltage drop plus the new, reduced BEMF equal the power supply voltage so that everything balances out again.
More load torque->slower speed->less BEMF->more current->more output torque (which you would need to spin the higher load torque to begin with).
Therefore, for a given supply voltage, you get more torque at low speeds and less torque at high speeds.
Comment: "The speed a motor spins at is the speed where the back EMF perfectly cancels out the power supply voltage."  Nope.  The speed a motor spins is the speed where the current generates enough torque to balance applied torque on the armature *including internal losses*.  That's why motors need some current to spin, even unloaded, and don't go quite as fast as their torque constants would imply (because the speed constant in radians per second per volt is exactly equal, including units, to the reciprocal of the torque constant in Newton-meters per amp -- I love dimensional analysis).
Comment: I'm trying to keep it simple here. I am under the impression that the OP is going to get really confused if we start talking about the motor as anything more than a BEMF generator and a resistor. I wouldn't even mention internal resistance if I thought I could get away with just saying that the increase in current produces another voltage drop inside the motor separate from the BEMF.
Comment: The OP needs to find a web page or a book on DC motors (specifically, DC *permanent magnet* motors, because wound-field motors have a whole extra set of behaviors) and study hard.
Answer: The answers are excellent but if you want a simplified understanding, consider this.
For PMDC motors, Torque is proportional to current to charge the electromagnetic field.
RPM is proportional to the applied voltage above stiction starting voltage with no load.
The drop in RPM as load increases causes current to rise since the RPM drops the internally generated BEMF drops and the difference with the applied voltage draws more current or I= ΔV/DCR,  motor coil DCR (Ohms).

Accelerate is just Newton's 2nd Law applied to rotational acceleration. \$a=F/m\$
For Field induced motors the field current also controls torque from the BEMF voltage it creates and thus the difference internal voltage, which has various configurations of series and shunt wound motors.


How do you calculate molar specific heat?

Question: I know how to calculate the specific heat, but not molar specific heat. What is molar specific heat and how do you calculate it?
Answer: Specific heat has the units of $\mathrm{J/(K\cdot kg)}$.
Molar specific heat is in units of $\mathrm{J/(K\cdot mol)}$, and is the amount of heat needed (in joules) to raise the temperature of $1$ mole of something, by $1$ kelvin (assuming no phase changes).
So, the conversion factor you need, from dimension analysis, will have unit $\pu{kg/mol}$.
$\pu{kg/mol}$ is the SI unit for molar mass.
Multiply the specific heat by the molar mass to get the molar specific heat.
For example, the molar mass of water is $\approx \pu{0.018 kg/mol}$.
The specific heat of water is $\approx 4186\ \mathrm{J/(K\cdot kg)}$.
So the molar specific heat of water is $4186\ \mathrm{J/(K\cdot kg)} \times \pu{0.018 kg/mol} \approx 75\ \mathrm{J/(K\cdot mol)}$
Comment: In this case, exactly what is this "molar specific heat" that we obtain in the end? At constant volume/pressure?


Does it make sense to install SSDs on server?

Question: I want to build a server hosting about 2TB+ data. Of course SSD is out of the picture in terms of the data drive. My question is: Is there any benefit to use SSDs as the boot drive? I plan to put 16G memory on it. I think most of the time the services should be loaded in memory and the server should rarely require rebooting. In this case, does it make sense to get SSD or just get a RAID1 with two SATA drives?
Comment: Optimizing the boot disk probably isn't worth it if you don't plan to reboot several times per day. Spend the $$ on more ram and avoid the fragility of current SSD's.
Comment: Just go with a pair of 15k SAS drives in RAID-1 for the system drive. (Pretty standard in the hosting industry)
Answer: I don't think so, not at this time. They're expensive, it's a relatively new technology that's not without its own problems; Jeff Atwood has an interesting blog post about the advantages and disadvantages of using them.
Given your intended use case the need for an SSD seems even smaller. You normally see huge benefits when booting and when opening up apps, but on a data server with a lot of RAM that rarely gets rebooted there's no point in spending the extra money.
Comment: Jeff's talking about consumer grade SSDs. If you use consumer SSDs, you get what you pay for! There were also early problems with the X25-M's that may account for the failures mentioned there. We've deployed several hundred X25-Ms as OS disks in server systems since 2009 and have had a very low number of failures (single digit). We've deployed similar numbers of the Intel X25-e and had a similarly low number of failures. I don't dispute that Jeff and his friend have seen problems, I'm just giving you a broader set of data.
Comment: In that post, Jeff reiterates what I've heard many times. That the failure rate of SSD's is very high. I wouldn't trust that on a server when you can get similar performance from noisy power-hungry disks since it's gonna be locked in a server room anyhow.
Comment: My other comment notwithstanding, I generally agree that without other mitigating reasons such as power or physical space, SSDs for boot drives on servers just don't make sense. I use them because I don't want to waste a spinning disk slot on the OS disk - we can put the SSDs elsewhere in the chassis.
Answer: It depends on the kind of server, but generally speaking, yes, it should be a good idea.
SSD drives are best for read-only data, which is usually what servers are as opposed to workstations. So it has that going for it.
Also, the faster a file can be served, the better the server will be, and since SSD drivers are supposed to be faster, it has that going for it as well.
Finally, SSD drives usually use less power, make less noise, and generate less heat, so the server will require less electricity and cooling (which are the banes of server-rooms the world over), so it has that going for it too.
That said, again it depends on the specifics of your server and case-usage (eg, 16GB sounds good, but will the files be cached in RAM or have to be fetched from disk anyway?), as well as the actual drives in question. Overall however, yes, most servers are generally better off with SSD drives.
Comment: +1 good summary. one of the pro's is good random/parallel read performance as measured in the [uFLIP paper](http://arxiv.org/ftp/arxiv/papers/0909/0909.1780.pdf)
Answer: With this situation, an SSD boot drive will probably only improve boot time, once everything is started and in RAM (you have 16GB) it won't make any difference. Maybe if you kept a 10GB+ database on it it might help, but probably better to spend the money on more magnetic drives (possibly for redundancy).
Comment: I attended an Intel conference about a week ago; the Intel rep shied away from recommending SSDs for databases, at least at this point in time.
Comment: Yeah, I think particularly if your DB has a high amount of writes (iirc reads dont "wear" the SSD as much/at all), and performance with small blocks can be less than stellar.
Comment: @alex: There are plenty of companies who will sell very expensive SSD solutions designed for databases *and* they guarantee the results. Some people have been able to replace *30* servers with one. It's like going from disks to memcached.
Comment: @Zan totally agree with you. Not all "sales-man" know how to implement all the possible solutions.
Answer: I think that's a good idea.  The SSD promises greater reliability (especially important for laptops) and improved performance (no relative track-to-track seek time concerns), both of which are wonderful advantages when dealing with server problems.
Do keep in mind, however, that SSD is still very new and not immune to failures of its own.  You should research the types of problems people are experiencing with different brands and models of SSD drives before going down this path.
Answer: Depends on the server usage, from what you describe probably not worth it.  Where SSD's come into thier own is servers with high I/O usage like virtual server hosts.
Stick about 10 virtual machines on a server with standard drives and then compare it to one with SSD's.  Get all 10 VM's doing something and watch the SSD based server fly while the old magnectic drive one has stalling VM's as they wait for thier turn to read/write to the HD's.
Back to your original question though, why are you worried about the boot time?  Are you planning on regulary rebooting the server?  I have servers that haven't been rebooted for about 3 years which I would have thought would be reasonably normal for stable machines that just do the job they were supposed to do.
Answer: That's a bad idea. SSD drives give you insane iops, and that's why you pay for them: to hold data that's accessed most frequently in a random fashion. A database on a set of SSD drives can outperform (especially for read-intensive scenarios) a very expensive storage system.
Operating system boots, then practically all executables that are used are kept in RAM, everything unused is put to swap. If you plan for heavy swap use (bad idea) you could put your swap on SSD, but I'd rather use a HDD and put the difference into RAM.
Answer: I think it doesn't worth it most of the time.
But if you've got big computing requirements with big files (say Dailymotion / YouTube encoding videos) the read/write speed is probably important.
If your applications are doing a lot of reading, even small files, it can really boost up the performance. However, if you cache the most served data in RAM (See memcached daemon) this is not an issue anymore.


What is the most optimal machine learning model/algorithm to create a hangman solver?

Question: Want to create a hangman solver, So what is the best ml algorithm (lstm,reinforcement learning, or etc) to use?
Do suggest any other optimal technique if you know?
Comment: Hi @jucikater, welcome to the site. If you find the answers to your question useful, please consider upvoting them (once you have enough reputation). Also, please consider accepting one (with the tick mark ✓ next to it) if you consider it correct or, alternatively, please describe in a comment why you consider it incorrect or not clear enough.
Answer: As is often the case, training a machine learning from scratch would be very inefficient here, and you could achieve excellent results with much simpler methods.
The hangman problem breaks down to a few steps:

Start with a list of all eligible words (you can find the Scrabble dictionary online, which is a good start) and filter to keep only words of length $n$. This list isn't too long.

Decide on your next letter.

A simple way to to this is find the most common eligible word (there are lots of data sets that provide this) and pick any letter from this.
A better way would be to figure out the most likely letter directly. I provide an algorithm for this below.

Provide your guess, and update your list of eligable words accordingly.

Code Example
# Hangman
import numpy as np
import pandas as pd
import string

# Data from https://www.kaggle.com/datasets/rtatman/english-word-frequency?select=unigram_freq.csv
all_words = pd.read_csv('unigram_freq.csv').set_index('word')
all_words.index = all_words.index.map(str) # Ensure everything is a string
all_words['length'] = all_words.index.map(len)

target_n = 5
words = all_words[all_words['length'] == target_n].sort_values('count', ascending = False)

# Most likely letter, marginalising across words
letters = list(string.ascii_lowercase)
possibilities = np.zeros((target_n, len(letters)))

for i in range(target_n):
    for j, letter in enumerate(letters):
        # Get all eligable words with letter `letter` in position `i`
        letter_pos_words = words[words.index.map(lambda w: w[i] == letter)]
        possibilities[i, j] = letter_pos_words['count'].sum()

guess_position, guess_letter_index = (v[0] for v in np.where(possibilities == possibilities.max()))
guess_letter = letters[guess_letter_index]
print('Guess: "%s" in position %i' % (guess_letter, guess_position)) # NB - Position 0 is the first letter
## Guess: "s" in position 4

You can also visualise how these letter probabilities look:
import seaborn as sb
import matplotlib.pyplot as plt
viz_df = pd.DataFrame(possibilities, columns = letters)
fig, ax = plt.subplots(figsize = (9,8))
sb.heatmap(viz_df.T, cmap = 'jet', ax=ax)
plt.show()

Comment: Thanks, this was my initial approach but wanted to train the model on set of words and use the trained model to guess each letter step by step on a completely disjoint set of words, so I was asking for a ML solution which is much better compared to this on unseen data.
Comment: Yes, but that's an extremely inefficient approach. There aren't that many words, we have frequency data on them all, and the target in Hangman is always a dictionary word, so "unseen data" isn't a concept that makes any sense here.
Comment: There's an adage that the most important skill in ML is knowing when NOT to use ML.
Answer: If you limit the model to propose letters and not entire words (which theoretically does not change the solution), you can just find the longest word in your alphabet, say $N$, and all the possible letters in a word, which usually are less than $35$, and create a state which is $N\times25$, add an additional $30$ dimensional vector to represent the already proposed letters, and a $10$ dimensional vector for the remaining lives, and use a NN to map it to a policy using RL with any Actor critic method, like A2C, PPO, TRPO, ACER, Rainbow and so on
Since you have a fixed size input ($N+35+30+10$) you can just use a FFNN with like 3/4 layers with an output-size of $30$ and you are good to go, and the architecture becomes close to irrelevant (you might still want to find the optimal number of layers and neurons, as in RL it has been shown that it's a very important aspect)
Answer: You can train a character-level masked language model. Like BERT, but with the following traits:

The token vocabulary of the model would be the characters that are allowed in the words (e.g. lowercase Latin script letters) plus special tokens like [MASK].
The input sequence would be a sequence of characters forming a word. Some characters would be replaced by a special token [MASK].
The expected output would be the same as the input sequence but without any masked tokens.
The loss would be the categorical cross-entropy between the actual model output and the expected output.


IDE for Salesforce developers

Question: Hii iam learning salesforce Which IDE is mostly used by Salesforce Developers in real time especially in India?
Comment: Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question.
Answer: You can use Force.com IDE or aside.io
Answer: You can also use MavensMate with SublimeText3 Editor. It is also very useful.
Answer: I don't think we have any India specific IDE available or if we need one.
There are many IDE available which you can use. Most famous are Force.com IDE (Eclipse) and Mavensmate. Many also use the Salesforce Developer console and code editor for work. You can use any one of them.
There is a good blog where you can check in detail
List of IDE available for Salesforce coding
Salesforce also in process of release SalesforceDX. Which is in pilot and we might use it in future.

IDE for Salesforce developers