Have objects delivered in terms of code reuse?

Question: I have often heard it said that objects have not delivered in terms of code reuse. Do you agree? If you believe that they haven't, why not?
Comment: I've never heard anybody say that...
Comment: @the I don't believe I've actually *heard* anyone say it, but I have read it.
Comment: "Have objects delivered in terms of code reuse?" -> Only if you believed the OOP salespeople from back in the day (was that the 60s? I forget)
Comment: Re-usability is not the only advantage of OOP.
Comment: My answer to a similar question: http://programmers.stackexchange.com/questions/53521/what-exactly-is-oo-reuse/53566#53566
Answer: No, not necessarily.
Objects deliver better semantics, organization of code/functionality and, possibly, ease-of-use.
Well designed libraries deliver on the promise of code reuse, not objects per se.
Comment: Well, yes.  But have objects assisted library designers by providing them options that make their libraries easier to reuse?  I would argue they have, and therefore objects *have* delivered improved reuse.
Comment: @Jules I, too, like to debate just for the sake of debating. I wouldn't argue that objects have not made designing libraries easier. I'm arguing that proper use of your tools is what leads to proper results.
Answer: Honestly I'm not sure if "code reuse" is really what anyone is after (or at least, should be after). My philosophy is "software components", which means better maintainability through good interfaces and avoiding unnecessary coupling. "Code reuse" is one of the things that falls out of that sometimes -- unnecessarily duplicated code is a sign that you've organized things the wrong way and of course it's a pain to maintain.
To answer the question a little more directly, there's a collection of pretty good tools for avoiding repeating yourself: inheritance, traits, delegation, higher-order functions, etc. Of those, people tend to confuse inheritance with OO as a whole -- and they also tend to overuse it a bit, if you ask me. Maybe that's where some of the "OO sucks" vibe comes from: finding inheritance stuck where it has no natural right to be :)
Comment: Code reuse though is not a goal unto itself.  Reuse is another word for coupling.  As such, you must approach reuse carefully.  Seems a lot of developers forget this.  They want decoupled systems, but turn around and try to use an existing classes everywhere.
Comment: Code reuse is definitely something to aim for, when you can avoid sacrificing code quality
Answer: No, "objects" haven't made code re-use any easier or more common. The same concerns that prevent code from being re-used in a modular program (designing, testing and documenting a general-purpose API requires considerably more up-front effort than writing a one-off routine, and the jack of all trades may be the master of none - logic intended to be re-used may not be well optimized for the uses it is actually put towards) apply to OO programs, with the added concern that a poorly-designed object model can hamper the re-use of otherwise reusable code.
OO is a handy abstraction for a good many problems, but be wary of '80s-'90s hype: it doesn't magically solve the fundamental problems of our trade any more than it makes waffles for you while you sleep.
Answer: I don't expect ALL objects to be reused but we do have a lot of object that we reuse on many different projects.  We also have objects that just get reused on one project.  We often will consume the same business objects (or data transfer objects) as well as business logic objects from a Click-Once desktop app, a web app and a phone app all for the same project.
Where have you heard that OO doesn't deliver on reuse?  And what was the reasoning?  Perhaps the design of their objects forced them into that situation...
Comment: Various articles. And from personal experience, making an object reusable isn't very easy at all
Answer: Some Programmers will copy and paste in any language and style.
Really good programmers can avoid most copy and paste in nearly any language.
I find OO patterns tend to encourage reuse.  I've seen Java code that was written in a non-OO style (where the data was separated from the code due to crappy ORM) and the reuse was truly miserable--but in OO the same programmers did a better job at design (and reuse).
Also in cases where we use non-oo patterns or oo anti-patters such as setters/getters, switch statements, anonymous inner classes, huge functions and the like I've seen code reuse go down and boilerplate go up...significantly.
ps. I know people will have problems with the previous paragraph, so I'll explain a bit.
Setters and getters cause OO problems because they allow you to operate on the members of an object (an object should manipulate it's OWN members) This distributes the code that operates on your class throughout other classes requiring you to copy the functionality around the setter/getter.  This applies to Properties as well--just because Properties are easier doesn't make them "Good" in all situations.
The code in Anonymous inner classes can't be reused at all and people forget that many things (like listeners) can and should be full-fledged classes--this applies to closures as well!  If you have used an anonymous inner class to implement something like a listener, you are much more likely to just copy and paste your implementation than to extract the code into a method or it's own class and call it instead.  Closures can also improve reusability--just depends on how you use them.
In many cases the features available to you shape how you structure your code.  OO is even more powerful when it comes to helping you visualize all your code and how it interacts, but that's another question.
Answer: Objects have no more ability to deliver code reuse than a stairclimber or other fitness equipment can deliver weight loss. Developers have to be motivated to use tools properly.
Once software teams place a higher value on reusing tested code than they do on keeping all the details in their head, you'll see far more fine-grained objects and methods and hence more code reuse.
Answer: Yes
OOP gives you more ways to reuse code
No
there is no silver bullet
It Depends
on what you put into it, and what you expected in return!
Answer: Yes.  Good object oriented programming promotes separation of concerns, low coupling, high cohesion, and information hiding.  These things are all critical to reusable code.
I would argue that the main benefit of OOP is modularity and modifiability, rather than reuse, but that's another question.
Comment: I agree that objects make code nicer, but unfortunately such a large proportion of my objects aren't reusable. To often, making an object reusable means oversimplifying the situation
Comment: @casebase +1 However, I would say that making objects reusable means overcomplicating the situation (object).
Comment: @Fishtoaster: you might as well say that your car moving is a prerequisite to getting to work, and an incline driveway promotes that. It's technically true, but unlikely to make a difference outside of edge cases: if you need and want re-use, you'll get it, OO or no; if you don't, then having the prerequisites won't make it happen accidentally.
Comment: Not everything is going to be reusable.  Most things won't.  However, low coupling, information hiding, etc, are all prerequisites for reuse, and object promote that.
Comment: @Mr. C- I'm not sure I follow your point.  I was merely stating that the things OOP fosters (modularity, etc) make it easier to make things like libraries.  There are plenty of ways to make code reusable by separating concerns, etc- OOP is one, good method design is another, proper problem decomposition is another still.
Comment: @Fishtoaster: I don't disagree with you, I just think OO is a tiny, tiny factor in whether or not code is actually reused. If done right, it probably doesn't *hurt*...
Answer: Objects enable code re-sue but as such is not the most technique for that. I think code re-use is promoted through object related techniques such as inheritance, polymorphism, overloading, and templates.
Answer: Yes, they do, the ability to extend (inherit) from a super class cleary contributes to code re-use, I am not sure how anyone could argue otherwise. You can simply extend a class and override one method, while using the rest from the super class, if this isn't aiding in code re-use then I don't know what is
Answer: If it is have they delivered on their promise of code reuse so far?  Yes, if the programs written with OOP in mind apply design patterns wisely.  Otherwise, mostly no.  But looking at the popularity of large scale non trivial programs that Adobe systems, Google and the like write with C++ or Java or other OOP languages, I would say OOP has a long way to go before it phases out.  That time will be far better suited to ask this question and could help in providing ground work for a new paradigm.


Is baby talk helpful or detrimental?

Question: I have heard both that 'baby talking' in response to a child's babble is productive, and that 'baby talking' is counter-productive and can impede language development. Any thoughts?
Comment: Here's one downside to baby talk.  We had a 3 year old when we had our second baby.  Kids in the 2-4 year old range pick up on *everything*, so our 3 year old used exaggerated baby talk when talking to our baby.  It got annoying very quick, and a lot of people noticed how our 3 year old spoke to our baby.  That quickly decreased the amount we "baby-talked" to our baby - not for the sake of the baby (which your question is directed at), but for the sake of the older sibling...
Comment: It never occured to me to use baby talk towards my son -- I started speaking my normal language from the day he was born (in fact, even before he was born). I don't feel creative enough for baby talk and it made more sense to me to talk as I would to any older child. Real words, and short but complete sentences.
Comment: link to baby talk wikipedia article : http://en.wikipedia.org/wiki/Baby_talk
Answer: Baby talk, when used correctly is beneficial to speech development.

For infants not yet using speech at all, use exaggerated changes in pitch and tone to help them learn the rhythm of speech and the difference between tones of voice.  Make games of mimicking different sounds for one another (this helps your child learn phonemes in the language(s) spoken at home).
For little ones just beginning to string together syllables, you don't need the sing-song voice used with infants, but you should still over-emphasize changes in tone so they can easily catch on.  Meanwhile, don't use made-up words, but do vary your pitch -- remember, until your child starts to consistently use words to represent things or actions, he/she hasn't grasped what words are, and needs whatever you can do to make them interesting.
Once your child routinely uses words to influence their world ("more", "drink", "cookie", "please", "ride", "no"), it's time to speak in normal tones.  Now words have intrinsic value to your child, and there's no need for games.
Don't use made-up words or broken grammar at any point in your child's speech development ... if he/she is going to go to the effort of learning something, it may as well be useful rather than something to be later un-learned.
Do correct errors when they crop up, don't let them become habit.

Baby talk often becomes a problem because parents use made-up words, don't phase it out when the child begins to develop speech ability, or think that the errors in pronunciation, enunciation, or grammar their children make are cute and do not correct them.
Comment: I'd +2 this if I could. This mirrors exactly what we've heard from a handfull of doctors and speech pathologists. It's beneficial up to a point, then it becomes a detriment. (So technically, BOTH of the answers Orbit asks about are correct... they're incomplete in that they don't address the "when" part of the equation, which is where the confusion comes in.)
Comment: +1.  Believing that children have a small vocabulary so can't learn proper words for things is a self-fulfilling prophecy.  My walks with my son have, since he was two, included learning new and *correct* words for things.  Very specific words are very useful.  (E.g. differentiating sidewalk, curb, gutter, street, pavement, asphalt, cement, concrete.)  But it's even more the case with phrases and expressions: **With adults, it may be considered rude to correct someone's inarticulate speech if you could understand it.  With children, you're *directly hindering learning* if you *don't.***
Answer: There is some research to support baby talk for babies, at least:
http://www.cmu.edu/PR/releases05/050315_babytalk.html

Adults may feel silly when they talk to babies, but those babies will learn to speak sooner if adults talk to them like infants instead of like other adults, according to a study by Carnegie Mellon University Psychology Professor Erik Thiessen published in the March issue of the journal Infancy.
Most adults speak to infants using so-called infant-directed speech: short, simple sentences coupled with higher pitch and exaggerated intonation. Researchers have long known that babies prefer to be spoken to in this manner. But Thiessen's research has revealed that infant-directed speech also helps infants learn words more quickly than normal adult speech. In a series of experiments, he and his colleagues exposed 8-month-old infants to fluent speech made up of nonsense words. The researchers assessed whether, after listening to the fluent speech for less than two minutes, infants had been able to learn the words. The infants who were exposed to fluent speech with the exaggerated intonation contour characteristic of infant-directed speech learned to identify the words more quickly than infants who heard fluent speech spoken in a more monotone fashion.

PDF of the research study, "Infant-Directed Speech Facilitates
Word Segmentation"
Answer: I often say, "Baby talk is fine as long as baby doesn't talk!" Research indicates that baby talk with exaggerated intonation and facial expression is beneficial to infants and children with normal and delayed speech development. The key is to stay one step ahead of baby! In other words, model just one step above your child's level. If no babbling or words, use sing-song, repetitive utterances with exaggerated facial expression to keep the child's interest and allow the child to hear the rhythm and patterns of speech. Once the child is babbling, emphasize single easy to say words frequently. When the child is using single words, up your words to 2-3 word phrases to model for them where they will be moving to next. The challenge for us parents and caregivers is to keep moving and stay only one step ahead of baby!!!
Comment: +1 for staying one step ahead of the baby's skills. When you say *research indicates...* could you please add a link or a reference so it doesn't look like an empty phrase?
Comment: Here is a parent friendly resource that reports on the benefits of "motherese" or "baby talk". www.pbs.org/wnet/brain/episode2/babytalk/ I'm still learning the ropes. I will provide references in the future. :-)
Comment: Here is another maybe not so user friendly but very informative research! http://teechconsult.typepad.com/kids/2010/08/brain-research-on-the-importance-of-baby-talkmotherese.html There are many many others, but this gives you a good start on the subject.
Comment: You only need to provide references when you mention research. If it's personal experience then of course just state that instead. One more tip: You can click the *edit* link under your answer to update it.
Comment: @TorbenGB Thanks again for your help. I appreciate the tips!
Answer: My wife has banned me from doing "baby talk", and I tell you what - it's really, really, really hard to stop doing it. She doesn't even want me using a different tone of voice when I speak to our child.
I try my best, simply because she's the boss, but I have serious doubts about its impact, and even if it does have an impact, why do we care?
I'm sure most of our parents used baby talk with us, and (most) of us speak perfectly well.
Even if it does have detrimental effects to how quickly they learn language, why do we care? I think we're all far too focussed on giving our kids the biggest head start in life that we can simply because we "don't want them to get left behind".
But right now, the huge smile and giggles I can get out of my child is far, far more important to me than making sure that they can say big words sooner than the other kids. And if baby talk gets me those smiles, then so be it.
Answer: I know of no firm evidence indicating that baby talk is either helpful or detrimental in language development. From my own experience, however, I can say that infants learn from facial expressions and tone of voice as much as they do from words. They are learning these things long before they can imitate them.
Infants can detect differences in volume and tone earlier than they can discern words, especially when volume and tone are exaggerated (as in baby talk). I see no problem with it and have encountered no problems with it so far with my children.
However, baby talk is not the only form of communication we use with our children. While it gets the best reactions early on, we also talk to, sing to, and sign to our children at a very young age--younger than they can understand or mimic. As they grow older we adapt our communication to their maturity level, eventually cutting out the baby talk. This worked wonderfully for our first child, although it's too early to tell whether this is because of our method or whether we just got lucky with a bright kid!
Comment: +1 for "infants learn from facial expressions and tone of voice as much as they do from words."
Answer: Any positive interaction is productive.  I suppose if all a baby ever heard was baby-talk, there might be a problem.  But that's not the case.  Babies hear adults talk to each other, and they listen.
If you have fun and your baby has fun when you use baby talk, then do it.  They don't stay babies forever, so enjoy that time while you have it.

Is baby talk helpful or detrimental?


What is an algorithm to find a minimum vertex cover on a bipartite graph with weighted vertices?

Question: I know that for an unweighted bipartite graph, I can find the minimum vertex cover by first finding the maximum matching and turning it into a vertex cover using König's Theorem. Is there a modification one could use if the nodes are weighted?
Comment: Although the solution given by Shiva Kintali solves your problem, I'd just like to add a quick remark: König's theorem is all about cardinality. You could add weights, finding a min-cost maximum bipartite matching (there are algorithms for this with edge weights; easy to use node weights instead), but you'd still just get the min-cost minimum vertex cover – which might not be the min-cost vertex cover (i.e., that could consist of more nodes). A min-cost matching with no cardinality constraints/optimization would just be empty (for positive weights)…
Answer: The weighted vertex cover problem can be formulated as an Integer Program (see http://en.wikipedia.org/wiki/Vertex_cover). When the input graph is bipartite, the constraint matrix of this IP is totally unimodular. Hence this IP can be solved in polynomial time.
For more details of total unimodular matrices and the corresponding algorithms, see the excellent (three volume) book by Alexander Schrijver.
Comment: To be more precise the IP can be solved by simply solving the LP relaxation. Moreover, one can notice that the dual of the LP is a generalization of matching (with capacities corresponding to weights of the vertices in the vertex cover instance) and can be solved by reducing to maximum flow in the usual way.
Comment: @ChandraChekuri peudo-code of the max flow reduction can be found in Figure 4 in [Incremental Computation of Resource-Envelopes in Producer-Consumer Models](https://link.springer.com/chapter/10.1007/978-3-540-45193-8_45)


Please advice pop3 email collector

Question: I am looking for software that can collect emails from many (hundreds, thousands) mailboxes and store it in a local pop3 server. So that I can download all of them from the local pop3 using outlook express.
Thanks folks!
Answer: Could try using http://pyropus.ca/software/getmail/
Answer: I personally use fdm, simple to configure, quick and yet highly configurable
Answer: Fetchmail has been a defacto go-to program for this task for a long time. I've used it in many configurations and been pleased, esp to look back and see it still doing it still just doing it's job.
However something tells me that if you're logging into that many POP boxes and trying to funnel them all into outlook, You're doing it wrong.TM
What is your use case? Maybe the community can suggest a better architecture from the ground up.

Please advice pop3 email collector


Representing a Bell measurement on non adjacent qubits

Question: I have a state
$${|\psi\rangle} = s {\Bigl(|1\rangle_1|1\rangle_2-|0\rangle_1|0\rangle_2\Bigr)}\otimes{\Bigl(|0\rangle_3|1\rangle_4-|1\rangle_3|0\rangle_4\Bigr)}\otimes{\Bigl(|0\rangle_5|1\rangle_6-|1\rangle_5|0\rangle_6\Bigr)},$$
with the subindexes meaing the particle number (for some normalising factor $s$). How do we represent  a measurement of qubit 1 and 5 in the Bell basis, given that these two qubits are not adjacent?
Comment: Do you mean to ask how we would represent that measurement mathematically?
Comment: yes sir do you group them together and then what next?
Answer: The most direct way to do this using normal notation is to simply write the Bell projections using the same convention for subscripts:$\def\ket#1{\lvert#1\rangle}\def\bra#1{\langle#1\rvert}\def\idop{\mathbf 1}$
$$\begin{aligned}
 \bra{\Phi^+}_{1,5} \;&=\; \tfrac{1}{\sqrt 2}\Bigl(\,\bra{0}_1\bra{0}_5 \,+\, \bra{1}_1 \bra{1}_5\,\Bigr),
\\
 \bra{\Phi^-}_{1,5} \;&=\; \tfrac{1}{\sqrt 2}\Bigl(\,\bra{0}_1\bra{0}_5 \,-\, \bra{1}_1 \bra{1}_5\,\Bigr),
\\
 \bra{\Psi^+}_{1,5} \;&=\; \tfrac{1}{\sqrt 2}\Bigl(\,\bra{0}_1\bra{1}_5 \,+\, \bra{1}_1 \bra{0}_5\,\Bigr),
\\
 \bra{\Psi^-}_{1,5} \;&=\; \tfrac{1}{\sqrt 2}\Bigl(\,\bra{0}_1\bra{1}_5 \,-\, \bra{1}_1 \bra{0}_5\,\Bigr).
\end{aligned}$$
It might not be immediately obvious why it makes sense to just 'decorate a bra with subscripts'. The idea is that for any qubit which is not indicated in the subscripts, what we have in mind is that we take the tensor product with the identity. So, for example, we have
$$\begin{alignat}{2}
 \bra{0}_1\bra{0}_5  \;&:=\; &&\bra{0} \otimes \idop \otimes \idop \otimes \idop \otimes \bra{0} \otimes \idop,
\\[1ex]
 \bra{1}_1\bra{1}_5  \;&:=\; &&\bra{1} \otimes \idop \otimes \idop \otimes \idop \otimes \bra{1} \otimes \idop,
\\[1ex]
 \bra{\Phi^+}_{1,5} \;&:=\; \tfrac{1}{\sqrt 2}\Bigl(\,&&\bra{0} \otimes \idop \otimes \idop \otimes \idop \otimes \bra{0} \otimes \idop
\\[-1.5ex]&&&+ \bra{1} \otimes \idop \otimes \idop \otimes \idop \otimes \bra{1} \otimes \idop\,\Bigr),
\end{alignat}$$
and so on. The advantage of writing things this way with the subscripts is that if you decompose an operator such as $\bra{\Phi^+}$, $\bra{\Psi^-}$, and so forth as a sum of tensor products, you can then compose it with other operators without having to write all of the identity tensor factors, so long as you only compose together operators acting on the same tensor factor. For instance:
$$\begin{aligned}
\bra{\Phi^+}_{1,5} \ket{\psi}&
\\[1ex]
= \tfrac{1}{\sqrt2}\Bigl[&
\bra{0}_1\bra{0}_5\ket{\psi} + \bra{1}_1 \bra{1}_5 \ket{\psi} \Bigr]
\\[2ex]
= \tfrac{\textstyle s}{\sqrt2}\Bigl[&
\bra{0}_1\bra{0}_5 {\Bigl(|1\rangle_1|1\rangle_2-|0\rangle_1|0\rangle_2\Bigr)\Bigl(|0\rangle_3|1\rangle_4-|1\rangle_3|0\rangle_4\Bigr)\Bigl(|0\rangle_5|1\rangle_6-|1\rangle_5|0\rangle_6\Bigr)}
\\&+\bra{1}_1\bra{1}_5 {\Bigl(|1\rangle_1|1\rangle_2-|0\rangle_1|0\rangle_2\Bigr)\Bigl(|0\rangle_3|1\rangle_4-|1\rangle_3|0\rangle_4\Bigr)\Bigl(|0\rangle_5|1\rangle_6-|1\rangle_5|0\rangle_6\Bigr)}\Bigr]
\\[1ex]
= \tfrac{\textstyle s}{\sqrt2}\Bigl[&
 {\Bigl(\langle0|1\rangle_1|1\rangle_2-\langle0|0\rangle_1|0\rangle_2\Bigr)\Bigl(|0\rangle_3|1\rangle_4-|1\rangle_3|0\rangle_4\Bigr)\Bigl(\langle0|0\rangle_5|1\rangle_6-\langle0|1\rangle_5|0\rangle_6\Bigr)}
\\&+ {\Bigl(\langle1|1\rangle_1|1\rangle_2-\langle1|0\rangle_1|0\rangle_2\Bigr)\Bigl(|0\rangle_3|1\rangle_4-|1\rangle_3|0\rangle_4\Bigr)\Bigl(\langle1|0\rangle_5|1\rangle_6-\langle1|1\rangle_5|0\rangle_6\Bigr)}\Bigr]
\\[1ex]
= \tfrac{\textstyle s}{\sqrt2}\Bigl[&
 {-|0\rangle_2\Bigl(|0\rangle_3|1\rangle_4-|1\rangle_3|0\rangle_4\Bigr)|1\rangle_6}
 - {|1\rangle_2\Bigl(|0\rangle_3|1\rangle_4-|1\rangle_3|0\rangle_4\Bigr)|0\rangle_6}\Bigr]
\\[2ex]
= -\tfrac{\textstyle s}{\sqrt2}\Bigl(&
 {|0\rangle_2|1\rangle_6 + |1\rangle_2|0\rangle_6\Bigr)
\Bigl(|0\rangle_3|1\rangle_4-|1\rangle_3|0\rangle_4}\Bigr).
\end{aligned}$$
Three things about this answer:

This calculation has effectively removed qubits 1 and 5 from the state — we're basically describing a destructive measurement. If we wanted to describe a projective measurement which doesn't destroy the qubits involved, we'd have to take a tensor product with the state $\ket{\Phi^+}_{1,5}$. We can certainly write out what that superposition would look like, simply by expanding $\ket{\Phi^+}_{1,5} = \tfrac{1}{\sqrt 2}\bigl[ \ket{0}_1 \ket{0}_5 + \ket{1}_1 \ket{1}_5 \bigr]$, and including this in the description of the post-measurement state.
I've moved the tensor factors of qubits 2 and 6 so that they are adjacent. It's not difficult to see that they are in a tensor product with qubits 3 and 4, in any case, and it doesn't matter if we change the order given that we're using the subscripts to keep track of which qubit is which — just like listing some variables in different orders doesn't change what values those variables have. This allows us to see that after the measurement, the states of qubits 2 and 6 are in the state $\ket{\Psi^+}$ is the measurement result on qubits 1 and 5 was $\ket{\Phi^+}$ (and similar things will happen for the other possible outcomes of the measurement).
Notice that the normalisation is affected. We would normally chose $s$ so that the original vector had a norm of $1$, so for example $s = 1/2\sqrt{2}$. This new state has a leading factor of $s/\sqrt{2} = 1/4$, so it is not difficult to see that it is sub-normalised. Specifically, the vector here has norm $1/2$, which corresponds to the fact that a Bell measurement on qubits 1 and 5 will produce the state $\ket{\Phi^+}$ with probability $1/4 = (1/2)^2$.
Comment: when you are describing about the Bell projections shouldn't $|\Psi^+\rangle$ be $|\Phi^+\rangle$ ??
Comment: Typo fixed, thanks.
Comment: First of all,thanx for taking the pain and wiring out such a crystal clear answer. just adding to the 2nd point of your answer, that would also tell that qubits $3$ and $4$ are in state $|\Psi^-\rangle_{34}$
Comment: Sure, qubits 3 and 4 are in the state $\lvert \Psi^-\rangle$. Actually, they are to begin with as well; and as we are not doing anything to either of them, they remain in this state.
Comment: I have one doubt sir, why have you taken the $-$ sign outside, because if it is inside the first bracket, then it will correspond to a different bell state? How do we decide whether to leave that sign or not?
Comment: The sign (or any complex number with modulus 1, such as the imaginary unit) can be factored outside of the expression without changing the state which is being represented. These are called *global phases*, and you can verify with a little analysis that they can never affect the probabilities of any outcomes. The reason why I took the sign outside was purely to simplify the expression. (I regret that I don't have the time for extended discussion: best of luck in your reading!)
Comment: Sir if possible, I have read the article and understood the concept, which i would want to post as another question, but i have some doubt can you help me with those doubts? I will write each step that i understood and those in which i have problems.


What is the ideal cipher model?

Question:
What is the ideal cipher model?
What assumptions does it make about a block cipher?
How does it relate to assuming that my block cipher is a pseudo-random permutation (PRP)?
When is the ideal cipher model appropriate to use?
How do I tell whether a particular block cipher can reasonably be modelled using the ideal cipher model?
Comment: (Yes, I know the answer to the question, but since we don't have this documented on the site, I thought it might be a good reference to be able to point others to.)
Answer: When cryptographers create algorithms, they usually provide some argument that the algorithm is secure. They need to start the argument with some set of assumptions. For example, the in public-key cryptography, they may begin with the assumption that factoring large numbers is hard.
Many algorithms use use a block cipher as a building block. The arguments that these algorithms are secure need to make some (mathematical) assumption about the block cipher in question in order to get started. Normally, the assumption goes something like this: "If the encryption key is chosen at random, then an attacker who does not know the key cannot distinguish between the block cipher and a truly random permutation, even using a chosen-plaintext attack." (This is an informal statement of the pseudo-random permutation [PRP] assumption.)
But the PRP assumption isn't always applicable. Sometimes block ciphers are used in ways where the key is either not random or not secret (we'll see an example in a bit). In these cases, we need to make some other assumption about the block cipher's security properties.
What is the ideal cipher model?
This is where the ideal cipher model comes into play. In the ideal cipher model, we just pretend the block cipher is a random permutation for every key. Furthermore, we treat these permutations as independent. We assume that if an attacker wants to know what happens when a block is encrypted under a given key, he has to go to the work of computing it himself. He can't infer anything about the output by encrypting other blocks, or the same block under a different key.  (Exception: Given a fixed key, no two inputs will produce the same output. So the attacker can rule out that possibility, but that's it.)
Example: the Davies-Meyer Compression function. Some hash functions, such as MD5, SHA-1, and SHA-2, are examples of Merkle-Damgard constructions. Let's say we'd like to find an argument that Merkle-Damgard constructions are collision-resistant. They look like this (IV is a constant, and Hash is the output):

The function $f$ above is a compression function. Now, it's possible to show that if $f$ is secure, then so is the hash function. But we can go a bit deeper using the ideal cipher model. For MD5, SHA-1, and SHA-2, $f$ is built out of a block cipher $E$ using a so-called Davies-Meyer construction (each of these three hash functions uses a different block cipher):
$f(\mathrm{M}, H) = E_{M}(H) \oplus H,$
where $M$ is the message block and $H$ is other input (the chaining value). So $M$ is being used as the key, but if someone is trying to find a collision for MD5, then each message block $M$ is under his control. It is neither random nor secret. So we can't use the PRP assumption.
But we can model $E$ as an ideal cipher. Using this assumption, we can show, for example, that no one could find a collision for MD5 or SHA2 without doing an insane amount of work (or getting really, really, lucky).
But wait! We can find collisions for MD5! So what went wrong? Well, the ideal cipher model is just a heuristic. Block ciphers must be describable using simple algorithms --- we can't generate and store random tables listing every output under every key, these tables would be huge. This makes it inevitable that there's some mathematical relationship between different outputs and different keys.
When is it appropriate to use the ideal cipher model? Because the ideal cipher model is a heuristic way of modeling block ciphers, rather than an assumption that could plausibly be true in a technical sense, it should be avoided whenever possible. But sometimes, notably in hash functions that don't have a random secret key, it's our only option.
How do I tell when a block cipher can reasonably be modeled using the ideal cipher model? It's better to ask if the block cipher is being used in a way that requires the ideal cipher model (as opposed to a PRP assumption). Next, look at how the block cipher is being used. In MD5 and SHA1, SHA2, for example, the block cipher is buried inside of the compression function, and the attacker doesn't have complete control over the inputs to this function. Since the attacker is a couple steps removed from the actual block cipher, using the ideal cipher model becomes a bit more reasonable because it may be harder for the attacker to exploit the block cipher's weaknesses. Ultimately, the best test is the test of time.
That being said, certain common ways of constructing block ciphers have been proven to result in constructions that are indifferentiable from an ideal cipher... but these proofs make heuristic assumptions about the internals of the block cipher. So although these proofs are interesting from an academic perspective, it's not clear how much they contribute to trusting a real-world block cipher in the ideal cipher model.
Comment: >But anyone can compute MD5 --- there's no secret key involved, so the PRP assumption doesn't apply.

That isn't why the PRP assumption doesn't apply to MD5.
Comment: Actually I believe the message is considered the secret key in MD type hash functions
Comment: @RichieFrame It's true that if you use a Davies-Meyer compression function, the message bits get used as key bits in the block cipher. But the message bits certainly aren't secret when talking about collision resistance (and they aren't necessarily random, either).
Comment: @pg1989 MD5 uses a  Merkle–Damgård structure with a Davies-Meyer compression function. The compression function uses a block cipher. A natural question to ask is if we can prove MD5 is, e.g., collision resistant by starting with some assumption about the security of the block cipher. My point was that the PRP assumption won't help us out here, because the PRP definition assumes a random secret key, but the block cipher is being used in a mode of operation where the key bits are known to (in fact, chosen by) the attacker.
Answer: An Ideal Cipher with $k$-bit keys and a $b$-bit blocksize is a family of $2^k$ permutations on the set $\{0,1\}^b$ indexed by the set $\{0,1\}^k$, selected uniformly at random from the set of all such families of permutations.  See e.g. http://eprint.iacr.org/2005/210.pdf.
The IC model is primarily useful for proofs where you need to assume that the adversary can get no significant advantage merely by knowing --or even choosing-- the $k$-bit string $K$.  Or to put it another way, it is useful where you need a component that acts randomly and unpredictably even when the adversary knows/controls all the inputs.  To illustrate, consider DES (a decidely non-ideal cipher), which has the complementation property whereby $E_{K}(P) = E_{K^C}(P^C)$ with probability 1 ($X^C$ is the complement of $X$).  Contrast this with an Ideal Cipher, where $E_{K}(P)$ and $E_{K^C}(P^C)$ are both independently and uniformly random values that will equal each other only with probability $\frac{1}{2^b}$.
The IC model is not especially helpful when trying to prove the confidentiality of an actual blockcipher or cryptosystem (it's too strong of an assumption that no real cipher can ever hope to meet).  But it is (allegedly) useful for modeling other properties of blockciphers, like collision-resistance or pre-image resistance.
Answer: Partial answer for points 1 to 3...
The ideal cipher model describes a keyed permutation that approximates a random oracle, but with a fixed input size.
An ideal cipher with a block size $B$-bits and key size $N$-bits should exhibit the following properties:

Given any single key $K$, the distribution of ciphertexts for all $2^B$ plaintexts is statistically random
Given any single key $K$, there will be $2^N$ unique ciphertexts for all $2^B$ plaintexts
Given any single plaintext $P$, the probability of a possible ciphertext occurring should be $1/{2^N}$ for all $2^N$ keys, making the cipher behave like a random function with a fixed $P$
The workload for finding the matching plaintext or any statistical information about the plaintext from a given ciphertext for someone without knowledge of the key should be at least as hard as an exhaustive keys earch
The workload for finding the matching key from a given plaintext/ciphertext combination for someone without knowledge of the key should be at least as hard as an exhaustive keysearch

Given any single plaintext $P$, there are $2^N$ ciphertexts for all keys, and if $N=B$, all ciphertexts should NOT be distinct. The choice of ciphertext should model a random function. This may not make sense, but if they were distinct, the cipher would not approximate a random oracle. This can be shown using examples where $B$ is very small:
With a 2-bit block and 2-bit key, the following 2 tables are constructed of all possible inputs $P$ and outputs $C$ for all keys:
<code>    P0 P1 P2 P3
K0  2  0  3  1
K1  3  0  1  2
K2  1  2  3  0
K3  2  3  0  1

    P0 P1 P2 P3
K0  2  3  1  0
K1  3  1  0  2
K2  0  2  3  1
K3  1  0  2  3

    P0 P1 P2 P3
K0  2  0  3  1
K1  3  0  1  2
K2  1  2  3  0
K3  0  3  2  1
</code>
Table 1 exhibits the property where a plaintext will not encrypt to itself under any key.
Table 2 exhibits the property where a plaintext will have a unique ciphertext for each key.
Table 3 does not exhibit the property of table 1, nor does it exhibit the property of table 2.
In all tables, there are no equivalent keys, and there are no keys where $C=P$ for all values of $P$
In the 1st table, the probability of a 1 being the ciphertext for any key with $P1$ is 0.0.
In the 2nd table, the probability of a 1 being the ciphertext for $P0$ and $K3$ is 0.5 if the values for $K2$ and $K3$ are not yet determined, instead of the expected 0.25.
Therefore, property 3 cannot be met, as the cipher with a fixed $P$ no longer behaves like a random function. In practice the table 1 example may not be a bad thing to have, for obvious reasons.
The first 3 properties make an ideal cipher a pseudo-random permutation.
All block ciphers must exhibit property 2 in order for the ciphertext to be invertible back to plaintext
I do not believe I am well qualified to answer points 4 or 5, but the ideal cipher model is used to build cryptographic constructions around block ciphers that are believed to be secure, and then infer the security of the construction from the model using the key and block sizes of the cipher.
The only way to tell if a cipher behaves ideally is with brute force, and for large block and key sizes that is not currently possible.
This is in addition to the cipher itself being proven to be resistant to all known attacks with workloads at least as hard as exhaustive key search.
Even for small ciphers, say 12-bits with a 24-bit key, there would be 96 GiB of data required to hold all the outputs, and then the distributions would need to be tested for ideal randomness. 24-bit blocks and 48-bit keys would need 12 ZiB of data to analyze, which as far as I know is more than any one high density storage cluster on the planet is currently capable of holding.
The storage requirement in bits is $B*2^{N+B}$, and for key and block sizes of modern ciphers such as AES, would be at minimum $2^{263}$, and at maximum far exceeding the number of atoms in the universe.
Comment: The ideal cipher is an extension of the PRP model that makes the permutation keyed. If described as 2 columns for plaintext and permutation, the PRP model is has only 1 line from each plaintext to a randomly selected permutation. The ideal cipher model has a $N$ lines for each plaintext, with each line going to a randomly selected permutation. It makes the cipher a set of $N$ PRPs. I will update the answer if you consider that an acceptable improver of clarity.
Comment: Actually, what you describe is the PRP model, not the ideal cipher model.  The ideal cipher model is something different.  So, I'm afraid this answer is not correct.

What is the ideal cipher model?


How to measure the wavelengths of ultraviolet lines in the hydrogen spectrum?

Question: how to measure the wavelengths of ultraviolet radiation isn't it invisible?
it's possible to measure visible radiation but how to measure invisible radiation?
Answer: It's common to measure spectra in the non-visible region and UV or infra-red spectrometers are available off the shelf. Google for many, many manufacturers of the kit. Also see the Wikipedia articles on UV spectroscopy and infrared spectroscopy.
Typically UV and IR spectrometers will use a diffraction grating to disperse the light and a photomultiplier tube to detect the radiation.
Answer: Three different ways (at least).
1) Use a detector, like a photodiode or photomultiplier, which responds to UV by producing electrons when hit by photons even if those photons are not visible,
2) Use a detector, like a bolometer, which measures the temperature rise produced when UV energy is absorbed, or
3) Coat a visible-only detector with a phosphor which emits light when hit with UV, then detect the emitted visible light.


What is required of a mathematics referee?

Question: To review a paper that was submitted to a good journal, what am I required to do?  Must I understand everything presented in the paper? Must I check the details and verify each argument/proof? Or is it sufficient to check that the paper is generally well-written, contains no obvious mistakes, and is interesting?
Comment: Readers might be intersted in this very, very related question: https://academia.stackexchange.com/questions/131576/how-can-ones-career-as-a-reviewer-be-ended
Comment: You might be interested: https://academia.stackexchange.com/questions/122840/without-accessing-the-code-how-can-a-reviewer-confirm-if-the-simulation-results
Comment: Or this : https://academia.stackexchange.com/q/130944/72855 and basically, YES, you need to check the detail.
Answer: My experience as a both reviewer and author in pure math suggests the following:

there is no universal standard for refereeing (some referees check papers thoroughly, some are much more cavalier)
editors may have different expectations/desires of reviewers, depending on the situation and on the editor
the typical expectation is that you assess a paper from several aspects: importance of the paper (this includes factors such as usefulness of the results/methods and novelty), correctness, and presentation/clarity.
refereeing is a process, not a "yes/no" assessment
refereeing well takes a fair amount of time, and results in little personal recognition, but is important for the community

Based on your specific questions, here are my suggestions for how you might go about refereeing a paper:

First assess the results claimed in their general context.  If they do not seem interesting enough for the journal in question, or are clearly wrong, you can simply say that (preferably with more details) and recommend rejection.
Understand the general argument of the paper.  Read the introduction in detail, and then try to understand the main points of the paper.  (You might not read the rest of the paper in order, particularly for long papers.)  Assess the novelty and feasibility of this approach.
If all seems good so far, convince yourself of the correctness of the paper.  This might entail checking all details, or you might be convinced after only checking certain details.  While you should definitely assess the correctness of the result, ultimately the burden of correctness lies with the authors.  Of course it's great if you can check the paper completely, but in my experience most referees don't.  How much effort you put into this may also depend on the situation (e.g., for a completely novel approach with an amazing result, you probably want to put more effort into checking details).
Very often in this process, there will be things you don't understand.  There could be a couple of reasons for this: (i) you aren't an expert in the methods being used, (ii) the authors' explanations are lacking.  In both cases, you can simply ask the authors for more explanations or explicit citations of the results they are using.  It's not necessary to understand everything for a first report, but hopefully you will mostly understand the paper after a successful refereeing process, which may include several revisions.  However, if (i) is a very serious issue, you might consult with the editor.  E.g., if you can read though the details in Parts I and III but Part II is a complete mystery to you, the editor may find someone else to referee Part II.  (Possibly this is a conversation you could have when agreeing to referee the paper.)
In the above process, you'll likely come up with a list of questions/suggestions, both about the mathematics and the writing.  While you should of course include these, these are typically of secondary importance in the referee report (though sometimes if you have some really good suggestions, it can dramatically improve the paper).
Answer: The following is all highly dependent on the field being mathematics or something closely similar. It makes no claim about any other fields.
Sorry, but if that's all you do, then your reviewing career is likely to be short, ending (with that journal) the first time you approve a paper that is revealed to have an error that you should have caught but did not. That journal at least is unlikely to consider you in the future. If you have the same attitude generally then other journals will also drop you early.
In and attempt to avoid further misunderstanding, let me try to be more clear. In mathematics we really really like published material to be correct. But people do make mistakes. Reviewers serve as a bulwark against poor work that looks superficially good actually making it in to print. But unless you take the job very seriously, as mathematics, you are highly likely to miss errors that should be caught in the review process.
You are the last real guard against errors getting published. You may also be the first independent look at a paper other than the author(s). And the errors can be subtle. Errors also reflect on the reputation of the journal as well as the authors. That makes editors very unhappy. Editors want a stable of reviewers they can trust to get it right. That means, first, that you can assure them that papers are correct, to the best of your ability to determine. They also need some assurance that you actually have the ability to determine correctness and treat the job seriously.
So, if an editor sends you a paper and you treat the reviewing task casually (just "generally well written" and "no obvious mistakes") and you miss an error that should have been caught then that editor, and by extension, that journal, won't be well pleased and you are unlikely to be offered additional papers. Of course you are generally anonymous to everyone else, but when other editors, from different journals, give you a try and you also do the same, then your opportunities decline, journal by journal.
If you don't completely understand the paper and its arguments then you are probably not the best person to review the paper. In math, which is very balkanized, this can be a problem. It has been around a hundred years since any individual was able to understand all of mathematics. Editors will, therefore, try to send papers to people with the same specialty whenever possible. Mathematics is subtle and deep. Editors expect high standards both from authors and from reviewers.
The writing style and presentation are important, but not nearly on the same level as correctness. And even with diligence, errors do pass through the system and get published.
If a paper is so poorly written that even a field specialist can't follow it, then it needs a serious re-write at a minimum and it may be hiding serious errors.
I have had to turn down editors for papers outside my current interests as I felt that I was unable to verify the claims and all of the steps in the proofs. Neither was it fair to the authors to spend the time to come up to speed in the area covered by the paper as it would delay publication for too long. Best for everyone that I just stepped back and passed the job to someone more current in that field.
Comment: Comments are not for extended discussion; this conversation has been [moved to chat](https://chat.stackexchange.com/rooms/94772/discussion-on-answer-by-buffy-what-is-required-of-a-mathematics-referee).


If you toss an even number of coins, what is the probability of 50% head and 50% tail?

Question: If I toss an even number of coins, how can I calculate the probability to obtain head or tail?
This question is different from the other because I can fling the coin a different number of times but the number is always even.
What is the formula to compute the probability?
Answer: Assume you toss the coin $2n$ times, then the total number of possible results is $2^{2n}$. How many of those have the same number of heads and tails? You need $n$ heads and $n$ tails, so to count this you choose $n$ spots for heads and you put tails in all the other spots. This can be done in $\binom{2n}{n}$ ways.
In this way you get $$P(\textrm{"same number of heads and tails with $2n$ flips"})=\frac{\binom{2n}{n}}{2^{2n}}$$
EDIT:
If you use Stirling's Approximation, you can get the asymptotic behavior of the probability, as $\binom{2n}{n}\sim \frac{4^n}{\sqrt{\pi n}}$ you get
$$P(\textrm{"same number of heads and tails with $2n$ flips"})\sim \frac{1}{\sqrt{\pi n}}$$
Answer: We throw 2n coins, what is the probability we get n heads and n tails?
In how many ways could this happen? $\binom{2n}{n}=\frac{2n!}{n!^2}$
What is the total number of throws possible? $2^{2n}$
Since all ordered scenarios are equally likely then the probability?
$\dfrac{\binom{2n}{n}}{2^{2n}}$
Answer: For $2n$ coins it is
$${2n \choose n}{1\over 4^n}.$$
If you use Stirling's formula, it is asymptotic to $1\over \sqrt{\pi n}$.
Comment: Isn't there an extra factor of $\frac{1}{\sqrt{\pi}}$ in the asymptotic equivalent?
Answer: Probability of getting exactly $n$ heads fron $2n$ throws of fair coin = $\frac{(2n)!}{n!n!} 0.5^{2n}$
http://en.wikipedia.org/wiki/Binomial_distribution#Probability_mass_function
Answer: If the number of coins is $2n$, then the probability of flipping exactly half heads is $$2^{-2n}\binom{2n}{n},$$ where   $\binom{2n}{n} = \frac{(2n)!}{(n!)^2}$.


Should we admit "easily" answerable questions?

Question: A question about the spelling of an Italian word prompted me to think that perhaps we might want to limit questions whose answer can be quickly found just by looking up a word in a dictionary. I believe that in other SE sites one is encouraged to do some research, and perhaps even describe it, before resorting to asking their question. What about here?
Answer: Basic questions that call for no more than a dictionary lookup have no place on Stack Exchange. Stack Exchange is a questions and answers site, requiring people to put in effort into writing answers. This effort is wasted if it's duplicating the work put into making dictionaries.
This isn't really a matter of effort put into the question, but a matter of expectations on the content of answers. If a question calls for an answer that draws on multiple sources, requires a native's specific expertise, or has to be tailored to the question, then it's a good Stack Exchange question.
Typically, "what does this word mean?" is a bad question and should be closed to avoid wasting time on it and do avoid dragging the site down. On the other hand, "I don't understand this sentence, what does the word mean? The dictionary definition makes no sense in context." is exactly the kind of questions that Stack Exchange is for.
English Language & Usage had a "general reference" close reason for a long time, now replaced by

Questions that can be answered using commonly-available references are off-topic. A list of these references can be found here: List of general references

English Language Learners has the close reason

Basic questions on spelling, meaning or pronunciation are off-topic as they should be answered using a dictionary. See: Policy for questions that are entirely answerable with a dictionary

French Language has the close reason (after requesting a "general reference" reason before sites could have their own close reasons)

Please look up the meaning of words or expressions in a dictionary first. If you did so and found nothing satisfactory, mention that in your question. Do give context for where you heard or saw the word.
Answer: Italian is a very, very rich language, every word or spelling ha a history. We should definitely allow simple questions, and they should be answered thoroughly, not superficially.
In the example you cite, it is important to explain the origin of "d'accordo" and also the fact that "daccordo" is in common-enough use that it is acceptable, if rare. The last point, for example, was unknown to me, a native speaker, and the first point was probably most useful to the OP.
As you can see from the example, we can definitely make the Interet a better place even with easy questions as long as we don't simply scuff it off and answer "Search on Google".
Comment: What I mean is: if this site has to be useful to Italian learners, we should accept Italian-learning questions, which might be very simple for native Italians. However, I do agree that a modicum of effort is required. I think that requiring effort and requiring complexity are two different concepts.
Comment: In other SEs there is a more of a tendency to assume you have done, so to say, your homework, rather than lazily resort to SE. But unless there will be a flood of very elementary questions (remember that we are in a closed beta right now), it's fine for me to continue as we are doing now.
Comment: I agree with the distinction "requiring effort" vs. "requiring complexity": this is what I meant - perhaps not too clearly - by "easily answerable questions" which, in my mind, is different from "simple questions".
Answer: Questions about spelling are often not simply answerable with 'look up in a dictionary', because different dictionaries have different ideas.
I understand that the question about spelling is just an example and I can think of other 'simple questions' that could be closed as soon as they appear. Let's see how it goes, I wouldn't start closing questions too early, if they are on topic.
Answer: After casting a close vote on Past participle of the verb 'irrompere', I propose we disallow questions that can be resolved by looking at a vocabulary.
While I agree that some questions look easy answerable, when they really are not, some of them are actually easily answerable.
As any SE site, anything that doesn't show some research effort should be closed mercilessly. We are not here to conjugate verbs for you.
Comment: Why the downvotes? Wouldn't it be more useful to argue about what Gabriele wrote?
Answer: This is an example of a bad question. It barely uses the (English) word Italian, uses no Italian words, and is not in any way, shape or form, about the Italian language (culture maybe). Yet it has received two answers, but only one downvote (mine), cancelled by an upvote after nearly four days, and 75-80 views.
I am on about nine SE language sites (counting Italian), and have cast "only" nine downvotes across all nine sites. This question is easily in the worst ten (more like worst five), I've seen on all language sites. I'm surprised that the only downvote (so far) came from someone who probably downvotes "too little."
A number of questions in the thread are slightly better than this one. If I see a site that lets this question go,I would conclude that the others are acceptable, even though they're not. If the others are not, then perhaps this one should be closed and/or downvoted.
Here is one of those "slightly better" questions that at least uses Italian words or tries to. I would not downvote this myself, but would not disagree with someone who felt the other way.
Comment: What question? Is the link correct?
Comment: @DaG:The link has been corrected. Thanks so much for the "catch."
Comment: You are right: both are good examples of bad questions.

Should we admit “easily” answerable questions?


How do you get the current list item in JavaScript?

Question: There's all kinds of ECMAScript class library examples around but all of the ones I find show how to retrieve all list items (through SP.ClientContent) but how do you get the current list item? I'm trying to call some JavaScript through a custom ribbon button that's on the List display popup and pass the ID of the current item to a new URL.
Answer: These techniques are silly.
On every SharePoint page there's a javascript context variable:
 _spPageContextInfo
{
    webServerRelativeUrl : "/ProjectWeb",
    webLanguage : 1033,
    currentLanguage : 1033,
    webUIVersion : 4,
    pageListId : "{c1d7b89f-f07b-4e2e-b89c-76c315831d59}",
    pageItemId : 5,
    userId : 68,
    alertsEnabled : true,
    siteServerRelativeUrl : "/",
    allowSilverlightPrompt : "True"
}

So if you are on
/ProjectWeb/Pages/default.aspx
_spPageContextInfo.pageListId;   // list guid for Pages
_spPageContextInfo.pageItemId;   // ID for listitem

An example for versions page:
var options = {
    tite: "Versions",
    url: _spPageContextInfo.webServerRelativeUrl + "/_layouts/Versions.aspx?list="+ _spPageContextInfo.pageListId +"&ID="+ _spPageContextInfo.pageItemId,
    width: 800,
    height: 500,
};
SP.UI.ModalDialog.showModalDialog(options);

Comment: If you have customized the page with additional web parts, the aforementioned _spPageContextInfo might not carry the pageListId and pageItemId variables. In my case, I have customized EditForm.aspx to include other web parts (e.g. a list of related links corresponding to the item being edited). I suppose, until the user interacts with a specific web part, there can be no reason to assume a List or Item id and that is why it's omitted.
Comment: awesome. Why has no-one else been commenting on this on the web? Do you have a source for where you found this client side information?
Comment: Following on what @bkwdesign said, I've added additional webparts and I get `undefined` for the `pageItemId` value
Comment: While pageListId is available and populated, pageItemId is missing during debugging of SP 2013.
Answer: Looks like nobody really came up with the right answer. There are a lot of answers here but I eventually found what I was looking for.
Brage's answer is correct if I had a selection of items to work from. For this to work, you must enable item selection on the view and let the user select more than one item. SP.ListOperation.Selection will give you back a collection of list items which you can then display on a page or use as a dropdown or something.
Wouter's answer to use the query string works but it requires you to poke into the query string for the page and there's no native Javascript function to do that so you're parsing the window.location.href value. It's ugly but works although I haven't tried it with a modal dialog.
The real answer to get the currently selected item in a dialog is to use the URL tokens. The only "official" page that I found on MSDN that lists these is here:
http://msdn.microsoft.com/en-us/library/ms473643(v=office.12).aspx
(and that's a WSS 3.0 version page)
I couldn't find any page on the 2010 documentation with the list and the 2010 version of this page removes that section.
Others have blogged about it but it's somewhat obscure.
In any case, there are tokens you can use inside of your Elements.xml file as part of a CommandAction or UrlAction. So for example in my case I wrote:
<CommandUIHandler CommandAction="javascript:viewDialog({ItemId});"/>

Which would call this method in a JavaScript file I included in the solution:
function viewDialog(id) {
  var options = {
    url: "/sitename/Lists/ListName/ViewName.aspx?ID=" + id,
    width: 800,
    height: 600,
  };

  SP.UI.ModalDialog.showModalDialog(options);
}

This creates a modal dialog and displays the specific view I want filtered on the item id I pass in.
Thanks for the input everyone!
Comment: Good stuff Bil! One note is that the tokens only work if you put your script into an elements.xml file. Bit obvious, but hey :)
Comment: You can have the script in a separate file and pass the tokens to it. Writing up a blog post on this right now ;)
Comment: I couldnt get this to work. It seems that the token is never resolved inside the CommandUIHandler's CommandAction attribute. Instead i used SP.ListOperation.Selection.getSelectedItems()[0].id
Answer: I use the following code when I solve exactly what you are asking about.
I don't like having js code inside my xml, but haven't found any good ways to include it without having it on all pages.
This code triggers a modal dialog which is opened with the selcted docuemnt(s) and current list as parameters. It also enables the buttons only when some items are selected.
  <?xml version="1.0" encoding="utf-8"?>
        <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
          <CustomAction Id="AddDocument.Script"
           Location ="ScriptLink"
            ScriptBlock="function OpenAddDialog() {
            var ctx = SP.ClientContext.get_current();
            var items = SP.ListOperation.Selection.getSelectedItems(ctx);
            var myItems = '';
            var k;

            for (k in items)
            {
              myItems += '|' + items[k].id;
            }

            var options = SP.UI.$create_DialogOptions();
            options.url = '~site/_layouts/myPage.aspx?items='+myItems+ '&source=' + SP.ListOperation.Selection.getSelectedList();
            options.width = 1050;
            options.height = 600;
            //options.dialogReturnValueCallback = Function.createDelegate(null, CloseCallback);
            SP.UI.ModalDialog.showModalDialog(options);
            }

            function enableDisableButton() {
                return CountDictionary(SP.ListOperation.Selection.getSelectedItems()) > 0;
             }"/>
          <CustomAction Id="AddDocument" RegistrationType="List"
          RegistrationId="101" Location="CommandUI.Ribbon">
            <CommandUIExtension>
              <CommandUIDefinitions>
                <CommandUIDefinition Location="Ribbon.Documents.New.Controls._children">

                  <Button Id="Ribbon.Documents.New.Controls.AddDocument"
                  Alt="Add selected documents " Sequence="10"
                  Command="AddDocument" LabelText="Add document"
                  TemplateAlias="o2" />
                </CommandUIDefinition>
              </CommandUIDefinitions>
              <CommandUIHandlers>
                <CommandUIHandler Command="AddDocument"
                EnabledScript="javascript:enableDisableButton();"
                CommandAction="javascript:OpenAddDialog();" />
              </CommandUIHandlers>
            </CommandUIExtension>
          </CustomAction>
        </Elements>

Comment: No, this only gets you items if you select multiple items in the list. I'm looking for the current item that's shown in the DisplayForm.aspx popup when you click on an item. The .Selection property is null inside this dialog.
Comment: Sweet! `SP.ListOperation.Selection` is what we need here.
Answer: This may be too late for you, but i just had this same problem and did it as follows:
var ctx = SP.ClientContext.get_current();
var items = SP.ListOperation.Selection.getSelectedItems(ctx);
var i;
var thisID;
var count=CountDictionary(items);// was the key point that was missing from other examples i saw

for (i=0,i<count;i++)
{
  thisID=items[i].id;
  // code that needs thisID
}

Comment: Thanks. Didn't know about the CountDictionary call which can be useful if you need to know the number of items. In my example I posted you can just use for(k in items) to loop through everything returned from getSelectedItems(ctx)
Comment: typo in the for loop in code example.  Should be for (i=0;i<count;i++)
Answer: For every list form the ID of the selected item is in the query string where you can retrieve it using script. The ID parameter is used for the item. The List parameter for the list ID. This should facilitate you nicely.
Wouter
Comment: does that still work with showModalDialog() as it is an ajax request?
Comment: I think so yes. The modal dialog runs in an IFrame and scripts loaded into that IFrame will likely access that unique URL and not  the URL of the parent frame.
Comment: An example here: http://blog.pathtosharepoint.com/2009/01/18/item-id-in-display-and-edit-forms/
Answer: As @Bil mentions, ItemId can be retrieved using Url tokens. However, I would like to differ on this statement

Wouter's answer to use the query string works but it requires you to
  poke into the query string for the page and there's no native
  Javascript function to do that so you're parsing the
  window.location.href value.

I have tested below two native JavaScript functions in SP 2010 and SP 2013
and both of them are able to read query string values.
GetUrlKeyValue('ID')

JSRequest.EnsureSetup();
JSRequest.QueryString['ID']

Moreover, SP 2013 has an object named WPQ2FormCtx and it also holds the ID of the current item in the Display/Editform:
WPQ2FormCtx.ItemAttributes.Id

Comment: WPQ2FormCtx not exist in event item
Answer: This should be what you're looking for: http://johnliu.net/blog/2012/2/3/sharepoint-javascript-current-page-context-info.html
I almost pulled my hair out trying to figure this same thing out! But I finally found out about the current page context info.  Huge help!


Benefiting from work done by a non-observant Jew after Shabbat

Question: Observant Jews do not resume doing melacha after Shabbat until after Havdalah. But not all Jews do this. So may you benefit from work done by a non-observant Jew after Shabbat ends, even if he did not "end" Shabbat with Havdalah? Let's say, should you not call them on the phone on Saturday Night?
Comment: Are you asking about Reform (and presuming that Reform Jews won't do havdalah), or is that just an example and your question is really about benefiting from work done by someone who didn't do havdalah?  They're different questions.
Comment: @Aaliyah I allowed myself to edit the question to adjust Reform/Orthodox labels to non-observant/observant which appears to be what you meant to ask. As we all know there are observant Reform Jews and some Orthodox Jews who do not perform all mitzvot. Feel free to revert if you disagree
Comment: @JJLL by the time you light the havdala candle, you have said "Ata chonantanu" in the shmonei esrei of motsei shabat, which is actually the primary form of havdala
Comment: @MonicaCellio It's just an example to try to make the question more practical, just assuming that the typical Reform Jew doesn't do Havdallah to Orthdox standards. You could say secular Jew or any Jew who doesn't do Havdallah as well. It was just how I put the question together.
Comment: Forgive my ignorance but don't you light the havdala candle immediately before the service? Doesn't the act of lighting the candle signify the Sabbath has ended? Otherwise, wouldn't havdala service have to come before lighting the candle?
Comment: @JJLL http://judaism.stackexchange.com/q/13922/472
Comment: Related: http://judaism.stackexchange.com/questions/45100/biblical-vs-rabbinical-end-of-shabbat
Answer: The short answer is that this is allowed. There are two issues here

Is work forbidden before havdala?
Can you benefit from work done by a Jew after shabbat if he hasn't done havdala?

The answer to the first question is that indeed work is forbidden before havdala (see Mishna Brura 299:10), the Rema says one might be lenient for non full-fledged labor work but apparently the Magen Avraham disagrees. So for all practical purposes one has to say Barukh Hamavdil ben kodesh le hol before doing any work. See here for a related MY discussion
Now when you are calling someone who didn't make havdala, he is not transgressing a melacha (forbidden Shabbat work) of Shabbat because Shabbat has ended for him even if he didn't do havdala. He is "only" transgressing the interdiction of not doing work before hadvala. The Shmirat Shabat Kehilchata (59:8 in vol 3, p. 938) explicitly allows this

One is allowed to benefit when somebody who is not shomer mitzvot and does not make Havdalah performs, after Shabbat, an activity forbidden on Shabbat, e.g., traveling on a bus with a Jewish driver who did not make Havdalah

He brings an interesting idea to wish that person "Shavua tov" with the intent he might reply the same and so perhaps fulfill at least his basic obligation to make Havdala (i.e., acknowledging Shabbat has ended).
R Ari Enkin in Da'at v'din (p. 52) brings additional sources saying the same, e.g., Tzitz Eliezer 11:34, 14:34, Rivevot Ephraim 8:118:9
Remains the question whether you can "actively trigger" that interdiction by calling someone after shabbat when you know he hasn't done havdala. It might be a case of lifnei iver lo titen michshol ("do not put an obstacle in front of the blind"). However if there was such an interdiction, practically, an observant Jew couldn't interact with any non-observant Jew. The Shmirat Shabat Kehilchata is not disturbed by this as he allows delivering work to be done after Shabat by someone who did not make havdalah.


Are the characters for sleep and feel the same?

Question: I am learning Simplified Mandarin using Memrise. I just learned the character 觉, to feel. However, I'm pretty sure I learned earlier that 觉 meant to sleep. Is there a difference between the characters?
Comment: A dictionary could so easily answer this question...
Answer: Chinese characters can have multiple meanings and multiple pronunciations. You figure out the intended pronunciation and meaning based on the context. In the context 睡觉 (Shuìjiào,"go to sleep"), the pronunciation is jiào and the meaning is "(a period of) sleep". In the context 感觉 (Gǎnjué, "feeling"), the pronunciation is jué and it contributes the meaning "feel".
Comment: I want to add emphasis on the fact that these two 觉, are really two different words that so happens are written in the same way rather than one word that can have two meanings.
Comment: @Lex I'm not sure I understand what point you want to make here. Do you mean to compare 觉, which has two different pronunciations, each with a different meaning, with characters like 就 which have only one pronunciation in puthonghua but several meanings?
Answer: Looking at dictionaries, it seems that the most common meaning of 觉 is to feel or to sense, be aware, etc.
I have only found it related to sleep in the word 睡觉 which means to go to sleep/bed or to sleep, where the character 睡 itself means sleep.
So one can combine the two by assuming something like "to feel (a)sleep", or "to sense sleep", or instead to have your "senses/awareness (falling) asleep".
This makes some sense to me and helps me remember, hope it helps you remember too, but please do correct me if I'm wrong here (and judging from the comment by @Lex above saying that jiào et jué are two different words that happen to be written the same, I may very well be wrong).


Cables choices for tube TV

Question: I've got a Pentium 3 machine with a WinFast A340 (GeForce FX 5200) and it has an S-video, VGA and composite (yellow) video output. My TV has composite input and component (red, green, blue) input. The video card had an S-video to component adapter cable. I know there is certainly a difference between composite and component on LCD HDTVs, but on a tube TV, is there a significant difference in clarity between the two types of inputs?
Answer: While the difference between standard definition and high definition is pronounced, even on a tube TV (assuming that it supports HD as it supports component input), with your configuration, you will not be able to output at a resolution higher than 480p (640x480).
S-video is limited to 480p, and an adapter for it will simply upscale the image to 720p/1080p which may or may not increase the quality of the image, but, especially on a tube TV, could cause the image to appear slightly sharper and blockier.  Your desktop would still be stuck at 640x480, however.
The difference then, in your case, is effectively 480i vs 480p.  480p will have a slightly crisper look, but on a tube TV, the difference will not be as pronounced as the difference between 480i and 1080p.
Answer: Not really...
Tube TVs are typically SD (Standard Definition) which is 480i (640x480 interlaced).
There will be little or no difference between composite vs s-video because of the low quality resolution and inherent blurring effect of tube TVs. You could try buying higher quality cables (gold plated) but I wouldn't guarantee that you'd see a huge difference.
SD tube TVs just aren't very good when attached to a computer unless you're doing strictly video playback. Because you need a certain level of sharpness to read the fine details of a computer display (fonts, controls, etc).
Compared to HD, which starts at 720i (720x1280 interlaced) SD just looks cheap. Plus, the image on a flat panel plasma/lcd/oled TV is so much sharper because they don't suffer from the 'memory' effect of the phosphor used in SD TVs. HD need a much higher refresh rate (60hz+) to cut down on motion blur but they look much sharper. Think of the phosphor in a tube TV as being the same stuff in glow-in-the-dark stars (because it basically is). It slowly fades out until it is recharged by the RGB beams that draw the screen.
For more info on the differences between types of cables see this link.

Cables choices for tube TV


Can a dapp support metamask as well as other means for keystore?

Question: I am using Metamask for key storage in my dapp. My understanding is that the Metamask app injects a web3 object and handles all the signing functions where needed by itself. But Metamask currently provides support for chrome and firefox only (to my knowledge) and firefox plugin has some problems still (I get weird errors and plugin hangs up sometimes). I am not sure if there is android support either yet. So I want there to be alternative option to use either metamask or sign everything by asking user for key. I dont know how to the latter and if its possible to do both in same app.
Answer: If you follow the compatibility guidelines on developing for MetaMask, it's very likely that your dapp will also work correctly with MetaMask alternatives, such as Mist, Parity Browser, Toshi and SpaceSuit.
Asking users for a key is possible (EtherDelta give users this option, for example), but it's also a really bad habit to teach your users (EtherDelta got hacked a while back, and users who did this got their ether stolen).
An alternative is to make the interface to your smart contracts simple enough that calling the contracts directly (via something like MyEtherWallet, or Truffle console) is not too confusing.
Answer: Using metamask is just one way of doing it. You can also use MIST or any other wallet that supports web3. Though using metamask gets the job done quickly. If you can provide me some more detail of what exactly your app does then I can give you more specific solution.
Comment: I mean if I can easily do the signing process for the app without taking away the "decentraclized" mechanism. I am thinking about directly using [infura](https://infura.io/) instead of using metamask. I understand the usage of a deployed node that infura performs but the signing process is something I cant figure out. I dont want to store users' key.
Answer: This is what you need:
https://github.com/MetaMask/provider-engine
You could let the user with metamask still connect, OR let the user input private key theb inject this new web3 over.
I made mobile app and desktop app from a web app that use this code, work fluently.


How to funnel Valkyries into the base core?

Question: I tried using valkyries  with giants and hogs and wizards and my strategy is usually to remove some obstacles in front of wall using archers and wiz and then drop giants so they go to the wall directly where I want them to, using wall breakers I create an opening and giants goes in but now if I drop valks in front of that opening they do not go in!! Instead they start circling around base and die without gaining any useful resources? How can I get them in with giants. My king and queen are enough to circle around.
Comment: I have already written post http://gaming.stackexchange.com/questions/278137/can-we-use-funneling-while-using-gowipe/278308#278308
Answer: Army and Spell Composition
2 Jump spells, 2 Rage spells, a heal spell, an earthquake spell, 14 Giants, 8 wizards, 14 Valkyries, and 24 archers.
Strategy
Put a single archer to clear out any undefended buildings around the edges possible, one archer per building. Use 1 or 2 giants on either side of the target rush location. Use a wizard to clear out 2 buildings to the left of the left giant, and 2 to the right of the right giant, also, one per building between them. Put a jump as effectively as possible ((Don't worry if you fail once or twice, the game does that on its' own, and it takes some practice!)) over the target walls. Flood with the rest of your giants. After about 3-5 seconds, place down all but 2 of your Valkyries, and a rage spell just closer to the core than you placed the jump spell. If there is clan castle troops, Good! The Valkyries will head straight to them. Don't be afraid to use your second jump spell to get there! If you didn't use your second jump spell yet, however, place it so it slightly overlaps the first jump spell, assuming a pocket-style village. If at any time, there is a lot of splash defenses hitting, put down your heal spell so it covers the majority, if not all of your giants and Valkyries. Throw your king and queen in right behind your Valkyries. They'll help more in the core than in the cleanup, and don't use their abilities until they are being targeted by late level-2 inferno tower heat, or until they are flashing orange on their health bar. I will likely be about 20-45 seconds in.
This is all assuming you are trophy pushing, and can expend troops on raids like this often. If that is indeed, or even halfway the case, I suggest replacing your giants with 2 Golems, 2 Valkyries, and 4 archers. Or a wizard, your choice entirely.
This will nearly always guarantee a 2-star attack, however, do NOT under ANY circumstances attack a village with the inferno towers a wall and a square away from the core buildings, as they will chew though your troops, and you'll end up with a flat 49.
Thank supercell for not adding aggro in the last one!
Answer: This could be a good strategy:
Troops and spells used:
15 valkyries, 10 to 15 giants, 20 archers or 10 wizards, 4 to 6 wall breakers (you can also use GOwipe, remove some wizards and add valkyries), 1 rage spell, 1 heal spell and rest you could use earthquake or lighting spells (max).
How to use

drop your giants to those defences which are at the outside so that they are busy in killing those tanking troops.
In this time use archers or wizards to use them in funelling.
Then send in the wall breakers to blow those walls in groups of two.
Drop in the rage spells at the entrance. (Make sure that the giants are busy in their work).
Drop in the valkyries into the holes.
If you like you can use the heal spell to send them in with no problem.
Crack every thing which comes in your way with the earthquake and lighting spells.

And that is how you can use this method to funnel you valkyries.
Answer: TH9
20 valk, 12 wizards, and 6 Wallbreakers, 2 heal 2 rage 1 haste/skeleton.
METHOD 1: First I use the King to tank for 3 wizards and 6 wallbreaks to take out the circle of importance. Send one valk in to make sure it does go in, then go all out, and use wizards for extra damage, rage works really well for 2 star in Master->Champion
METHOD 2: If there is a queen or king or warden 3 tiles away from the wall, send all of your valks in. They get attracted by the hero. You might want to drop a rage/haste to make sure the king doesn't get out of the wall before the valks get in
Answer: 1 Golem(one in cc), 9 valks, 10 wiz, 1 hog, 4 wall brakers, 1 Jump, 2 Heal, 2 rage
Strategy: Place both golems and then put all wall brakers to make an opening, put wizards to take out the troops around the base. Then put heroes and valks they should go in the hole once they have taken everything around the center put a jump spell so they can enter the center.( Use the hog to take out the cc troops.) You can use the spells as you like I would focus mainly in the valks but you can do what makes you the most comfortable.
Comment: Hopefully it works


Finding a gold ring lost in the house

Question: How can I find a gold ring lost in my bedroom, kitchen, or living room? I've already read this question, but it seems that many of the answers given there wouldn't apply to a search inside. It was lost only yesterday, and I've managed to narrow down the prospective areas to just those three rooms.
Comment: honestly, if you have little kids tell them to find it. They think differently and may look where you didn't.
Comment: Well it was eaten by snakes. Or a magpie stole it.
Answer: A gold ring is, in effect, a tuned circuit. Though a metal detector would find lumps of any type of metal, such as nails in the wall, a grid dip meter (GDM), used by electronics and radio amateurs, or "hams, could identify a closed loop of a good conductor such as gold alloy.
Calibrate the GDM by comparison with another ring of close to the same diameter, and then scan each room from floor to bureau-top. You'll need to be within 30 cm or so, so if the ring's under a bed, take off the mattress to check underneath.
Answer: Here are few methods to find the ring.
This might look a bit complicated but this method helped me to find few small objects on floor.
Keep a torch in your hand and place your head on the floor in such a way that one of your eyes will be just above floor ( your sight should be almost parallel to the floor ). Close your other eye which is far from floor.
Then, turn on the flash light and focus it towards where you are looking. Again, even the torch light should be almost parallel to floor to minimize the light on floor. This makes sure that ring will be kind of obstacle to light from torch. If you do it right, the light should fall only on the ring and not on floor.
Now, you can easily find the ring as the ring will be reflecting little light due to torch light falling on it.
The above method works well if done on low lit or dark areas (You can do it at night or by closing all curtains and doors to reduce light in the room, etc.).

If you can't find it on floor, and want to search on other places like bed, couch, etc., you can try vacuuming to suck up ring or blow air to make it fall on floor and then search on floor again. Off-course, you can do this first but I think quicker method must be done first and searching floor will be quicker than looking at other places.
Comment: If using a vacuum cleaner, an appropriately-placed stocking may help avoid the mess of opening the vacuum cleaner once it picks up the ring.
Answer: Close the blinds & drapes, turn off all the electronics, wait until night, and use a very bright flashlight.
Answer: I think there is only one way that is pretty sure to work.  One by one, empty each room of every object. You'll need an empty room or a large clear area to stage removed objects.
An alternative to this, though less reliable is to picture each room as a grid.  Work methodically through the grid, lifting, opening, prying, whatever to clear that grid. This is what search parties do when looking for lost sailors, children, etc.
Comment: what if the ring is in or on of one of the objects you remove?
Comment: @miracle173 Continue by recursion. Take each object, empty it systematically ... . :P
Answer: Try making it all dark in the house and using a flashlight/torch you can also ask around to see if anyone has seen it also so you don't have to go up to someone who thought they had a cute ring and say "hey that's my ring" get the word out fast and search everyday till you find it
Answer: This may seem very silly but call for it. There have been studies that show calling for an inanimate object makes it easier to find.
Other than that do a fingertip search, work from one end of the search surface and then work in a methodical way. For cupboards and draws, once searched put a postit note on it so you can see what you have and havent searched.
Search everywhere, no matter how unlikely it is to be there. If you have searched every place it could be then it must be in a place it cant be.
Comment: When searching for the study, did you try calling for it? =P
Comment: [citation needed] :)
Comment: Please provide links to those studies!
Comment: http://www.psych.upenn.edu/~swingley/papers/lupyanSwingley_qjep11.pdf After all this time I've found it. It was mentioned in a scishow video which gives its sources. (Yes I did try calling for it)
Comment: I have not been able to find the study that i read about this in and i have spent over an hour looking. The effect is put down to you concentrating on the item more and therefore less likely to overlook it. I'm not a quack that thinks calling it effects it,i believe it effects you.
Answer: I've been able to find lost things using a pendulum and an accurate handmade map of the location (divining). Not everyone can do this, but a surprisingly large number find they can.
Comment: at what scale should this map be and how accurate?  should the pendulum have a pointy bottom or would a ball on a string work?
Comment: It doesn't really matter - its more a mental thing. The pendulum/ball should start to rotate as you near the item over the map. Obviously a tiny map isn't going to make it easy. Its about channelling your mind; some people can do it, some can't. The sort of people who break computers by touching them tend to be good at it.
Comment: If youre going to downvote me, it would be polite to say why? My method works for me and is widely enough documented to appear to work for other too.
Answer: Search everywhere but there no matter where you lost it! Its your own decision brave one! (sorry for dramatic consequences, just for fun) If it is outside or when you are at the door and checked your ring, its lost then, find only near your house
<code>               (*don't go far elsewhere if it is lost long ago!*)
</code>

Finding a gold ring lost in the house


Have any humans remained conscious after a Vulcan nerve pinch other than Khan Noonien Singh?

Question: In the film Star Trek Into Darkness (2013), Khan Noonien Singh notably remains conscious after the famous Vulcan nerve pinch.  In the Star Trek canon, have any other humans been able to achieve this?
Answer: Yes: Gary Seven.

It is debatable whether or not he truly qualifies human however, as his ancestors were abducted from Earth over 6000 years ago and bred or engineered by aliens to have a superior physical body.

KIRK: Bones, check the prisoner you'll find in security confinement. I want a medical analysis fast. Is he or isn't he human?
Captain's log, supplemental. A man in a twentieth century business suit. What is he? Not even Spock's Vulcan neck pinch could stop him. Without our phasers, he would have over powered all five of us. I find it difficult to believe the mysterious Mister Seven can be human, and yet, suppose he is?

In a later scene:

MCCOY: Well, I must admit the sensor readings seem too good. Human readings, yes, but not a single physical flaw. Totally perfect body.

Memory Alpha claims he is the only human to have withstood the effects of the nerve-pinch (presumably Khan is counted as "human augment" rather than a human), so I doubt a better example will be found. The answer to the question "has any normal human withstood the nerve-pinch" is almost certainly no.
Comment: The obvious followup question then is how do I protect myself from rogue Vulcans?  Neckguards?  lol  :-|
Comment: That was my bad in wording the original question poorly.  I meant "remain conscious" as opposed to "remain alive."
Comment: @NicoleSharp Go to hot topic and buy a jacket with too many spikes on the shoulders.
Comment: That didn't work out very well for this guy though: http://cdn1us.denofgeek.com/sites/denofgeekus/files/styles/main_wide/public/images/18954.jpg
Comment: @NicoleSharp That collar isn't covering any of the relevant nerves. The pinch targets the [trapezius](https://en.wikipedia.org/wiki/Trapezius_muscle) if I'm not mistaken.
Comment: https://scifi.stackexchange.com/questions/183389/
Answer: The secret service agent tailing McCoy in Star Trek III suffered no ill effects from McCoy's attempt at a nerve pinch:

McCoy was weak and delirious, and this scene was played for laughs with the implication that McCoy was performing the nerve pinch improperly.
However, an earlier scene -- the conversation between Kirk and McCoy in Spock's quarters aboard Enterprise -- established that Spock's katra was able to use McCoy to convey things that McCoy wouldn't otherwise have known.  It's at least possible, then, that McCoy "remembered" how to do a proper nerve pinch, and that the secret service agent had gear or combat conditioning to make him resistant.
Comment: @Bellatrix - I don't see that requirement in the OP's question or comments.  Even so, I addressed how McCoy could have been performing the nerve pinch correctly.  (We don't know that Spock performed the pinch correctly on Khan or Gary Seven, for that matter. He certainly knows how, but he may not have been able to get a good grip in those scenes.)
Comment: @EmsleyWyatt Yes that's the first thing one does as a government agent.
Comment: Like Mal in the Serenity movie, resisting The Agent's equivalent of the Nerve Pinch by virtue of not having the nerve concerned (or maybe too much scar tissue around it).
Comment: Perhaps the agent had that nerve cluster relocated.
Comment: It is a good point though.  I wonder if Section 31 could have developed a defense against the Vulcan nerve pinch?
Comment: The intent of the question was if anyone but Khan remained conscious after a *properly performed* Vulcan nerve pinch. This doesn't answer that - it just shows McCoy failed to do it correctly, not that the agent had the ability to resist the Vulcan nerve pinch.
Comment: I think than in this case is implied in the scene that the nerve pinch is not properly done.
Answer: What about Riker in TNG:Conspiracy. He resists for a good few seconds until Picard shoots the Vulcan, and then he's no worse for the wear.
Comment: Hi, welcome to SF&F.   This is a good start, but you could make this a much better answer if you could include a screen-cap of it, a quote from the script, or a reference any other source.
Comment: Even just one or two things from that list would be a great improvement!


what does きにするようにして mean?

Question: A friend wrote me: 余計 ありがと、 きにするようにして
I know first part is "Thank you so so much"
second part I understand the parts, but I can't put it together into a decent meaning.
きにする is to worry or care about something.
ようにする is to try to do something.
I guess して is here not meant as an imperative, but because this part should be before the "Thank you" part (sentence order is wrong, due to last part being added), but even then can't really figure it out.
Something like "Thank you, that you try to care for me"?
Comment: It's gibberish, at least,  in Japanese.
Comment: 「余計 ありがと、 きにするようにして」 sounds (and looks) quite odd. It wasn't written by a Japanese speaker, was it?
Comment: true. it was written by a Korean, who has N1-level though...
I thought it was just very colloquial, with the wrong order. it was a text message, so I thought it was like when you already said "Thank you" and then decide to add what exactly for. something you maybe say in spoken language, but wouldn't write. but my Japanese (especially speaking) is not that good, so I don't know :)
Comment: The reversed order isn't the problem. The use of 余計 is strange, and きにするようにして is unnatural. To say "Thank you {all the more / even more} for caring about me," I'd say 「気にしてくれて/気にかけてくれて、(なおのこと)ありがとう。」 or 「(なおのこと)ありがとう、気にしてくれて/気にかけてくれて。」
Answer: ~して can be used as the connective form of a verb in addition to being an imperative, so you're correct about it coming before the "Thank you" part.
However, ~ようにする can also mean "making it a point to do~".
To put it all together, I would translate 余計 ありがと、 きにするようにして as "Thank you so much for taking the time to care about me."
Comment: thank you! I didn't know about this meanins of ~ようにする. this makes sense now.

what does きにするようにして mean?


How can I increase the default zoom-in for Firefox?

Question:
Possible Duplicate:
Make Firefox automatically set zoom level for new webpages

Windows 7, Firefox 7.0.1
I want to increase the size of everything on the screen without changing the display resolution. For all other Windows items, I increase the size in Control Panel\Appearance and Personalization\Display. But for Firefox, how can I increase the display size within Firefox?
More specifically, I want to have the zoom-in level as one Ctrl++. It seems that such a zoom-in can be set to each website. How can I make one zoom-in level as default for all websites?
Answer: Use the Firefox addon Default FullZoom Level.
Comment: The link to the "Default FullZoom Level" addon is broken.


OCD and Netilat Yadayim

Question: If a person has OCD and tends to ritually wash their hands a thousand times because they feel they didn't do it right and they accidentally touch something wet in the sink after or have the worry they touched something ritually impure, do they have to rewash their hands (which may lead to rewashing a ton of times again)?
Comment: here is a relevant [shiur](https://www.yutorah.org/lectures/lecture.cfm/816916/Rabbi_Aryeh_Lebowitz/Ten_Minute_Halacha_-_OCD_in_Halacha#) from R Aryeh Lebowitz
Comment: If I understand what you're asking correctly, you're wondering whether the level of uncleanliness to obligate washing hands is objective or subjective, and since a person with OCD feels a need to wash more often than an average person, perhaps they should wash more often?
Answer: Anyone discussing OCD and halacha needs to find a qualified, competent rabbi in-person, as well as a mental-health professional.
Reviewing the laws of what actually poses a halachic problem for handwashing might help, depending on the level of one's problem. The entire practice today is a throwback to when ritual purity laws were applicable ... but this is a side discussion. If someone is really OCD, it's going to manifest itself in degrees far beyond what halacha requires.
Rabbi Elli Fischer blogs about Rabbi Asher Weiss' responsum #134 about someone with OCD who keeps repeating words of prayers, always worrying they didn't pronounce them right. (Rabbi Asher Weiss is the posek for a major Israeli hospital, so he understands the solution here is more than "say another piece of Tehilim.") He says if the doctors tell this person to never repeat a word from prayers, even if you think you mispronounced it, then listen to the doctors!
I would strongly assume the same applies in a hand-washing case.
Comment: I heard a story about someone with extremely severe ocd when saying shema, that the Chazon Ish told him that whenever he does not finish saying shema in less than **7 minutes**, then the next day he should skip Shema completely! This is shema which is min hatorah! but it takes the chazon ish to say something like that.
Comment: I believe the tshuva is [here](https://s113.podbean.com/pb/644551fd429667a1ad9c58972a5320f9/5b45f52f/data2/fs31/769564/uploads/show_63_Pesach-cleaning-or-OCD.pdf?pbss=a8eb3a56-ecd6-eb1a-82d4-9c043eaf0a13), p. 16 - see also many sources in English from 21-38 incl. a lengthy analysis of R Weiss' tshuva
Comment: The point is to differentiate personal chashash, from a chashash that is regarded as sofek by halacha. Next, safek itself is not always a relevant reason to wash again. Sofek is enendered by an event. Personal chashash is not relevant. Chachomim ruled what chashash are. In OCD there is no sofek and no halachik chashash.

OCD and Netilat Yadayim


can you take out the iPhone's sim card and use wifi outside of america?

Question: I'm traveling overseas and I wish I had a regular iPod touch so that I can just use WiFi to check emails without paying a roaming fee. I have an iPhone with an AT&T sim card. I was wondering if I could remove the sim card and turn it into an iPod touch without having to pay a roaming fee? Does the phone still know it belongs to me even without the sim card?
Comment: You can turn on WiFi when you are in airplane mode to be able to use a network connection.
Answer: gentmatt's answer is correct, however if you don't need to make phone calls at all you can also just turn on airplane mode. I have done this many times abroad. Turn on airplane mode in settings, then turn wifi back on. Your cellular signal stays off.
Comment: Never knew that, nice tip for disabling cellular.
Comment: I actually do this quite often in the US when I have a reliable wifi connection and 3G isn't letting go fast enough.
Answer: Yes.
You can use your iPhone's Wi-Fi without a SIM card, no matter where you are.
If you still want to be able to make calls, but avoid celluar data (data roaming) you can choose to disable just this feature.
You can get further information from Apple's support website at iPhone and iPad: Using cellular networks while in another country.

If you do not have an international data plan, turn off Cellular Data and/or Data Roaming to avoid data roaming charges:

iPhone: Tap Settings > General > Network
iPad: Tap Settings > Cellular Data

When data roaming and cellular data are off, you should not see a cellular-network indicator in the status bar.
Answer: Yes, you aren't able to text or talk though. Also, you will have the phone on Airplane mode so you don't get any roaming charges.But you are able to use camera and stuff, if you take it off airplane mode then you can connect to wifi.
Comment: did you read the answer from @Nate
Answer: The answer is Yes and No. Yes because WI-Fi can be used without SIM card where there is no authentication reqd. and NO because to use Wi-Fi at airports, railway stations you require  authentication where they send one time password(OTP) to start using the Wi-Fi services available.