Why did the light bulb burned shortly after being replaced?

Question: So the marker light bulb next to the high beam was dead on my 2008 Jetta. I figured out the replacement and the mechanic I know replaced both sides with new bulbs.
The light came on when I tested by turning on the dashboard/marker lights without starting the car so I was relieved it was fixed.
Then, I started the car and the bulb at the same spot died again. Agh.
I went through the fuses and none of them seemed broken.
I might have been extremely unlucky with the bulb that it worked for only once or the bulb socket might be faulty.
What else could be the issue?
Comment: Sounds like a faulty bulb, but do check for poor, corroded or loose connections.
Comment: If it's an incandescent bulb you can test it using a 9 bolt battery and a couple of wires.
Comment: Are you sure the original bulb had blown?  Maybe there is just a bad connection.  Worth checking the new bulb before you replace it.
Answer: I wouldn't assume the bulb is burnt out, I'd test it in another car or using a 9 volt battery unless you can visually verify it's blown. If it has indeed blown that fast then it could be a manufacturing defect, and I'd try another. If that blows too then you must have too much juice on the circuit, not enough to blow the fuse but enough to burn out a bulb, which is unlikely but can be verified with a multimeter.
If the bulb is okay the problem probably lies with the electrical connection somewhere. One common problem is corrosion on the socket connection itself, you can often see it as a patina. This can be scraped off or cleaned with contact cleaner, I've also used a dremel to polish it off as well.
Other common issues are contacts getting slightly bent, issues in wiring harnesses, pinched wires. These require continuity testing and some patience, but can be worked out by home mechanics.
Comment: Thank you for your input. I'll pay attention to those and hopefully figure it out this time.


Mindfulness question

Question: When practicing mindfulness and labelling for example if I'm making my bed can I note "making bed" or of I'm driving note "driving" or is it meant to be more specific? Because a lot of the time I can't think what it is I'm doing. Seems to be too many things at once so I end up thinking too hard about what I'm doing kind of thing.
Answer: I quote from "Chapter Six: Daily Life" of Yuttadhammo Bhikkhu's online book "How to Meditate":

Once one has put aside activities that interfere with clarity of mind,
  one can begin to incorporate meditative awareness into ordinary life.
  There are two ways in which one can meditate on ordinary experience,
  and they should be practiced together, as follows.
The first method is to focus one's attention on the body, since it is
  the most clearly evident aspect of experience. As in formal
  meditation, the body is always available for observation, and thus
  serves as a convenient means of creating clear awareness of reality in
  daily life. Since the body is generally in one of four postures –
  walking, standing, sitting, or lying down, one can simply become aware
  of one's posture as a meditation object to bring about clarity of
  mind.
When walking, for example, one can note either "walking, walking,
  walking, walking" or "left, right, left, right" as one moves each
  foot. When standing still, one can focus on the standing position and
  note "standing, standing"; when sitting, "sitting, sitting" and when
  lying down, "lying, lying". In this way, one can develop clarity of
  mind at any time even when not practicing formal meditation.
Further, one can apply the same technique to any small movement of the
  body – for instance when bending or stretching the limbs, one can note
  "bending" or "stretching". When moving the limbs, "moving". When
  turning, "turning", and so on. Every activity can become a meditation
  practice in this way; when brushing one's teeth, "brushing"; when
  chewing or swallowing food, "chewing, chewing", "swallowing,
  swallowing" and so on.
When cooking, cleaning, exercising, showering, changing clothes, even
  on the toilet, one can be mindful of the movements of the body
  involved, creating clear awareness of reality at all times. This is
  the first method by which one can and should incorporate the
  meditation practice directly into ordinary life.
The second method is the acknowledgement of the senses – seeing,
  hearing, smelling, tasting and feeling. Ordinary sensory experience
  tends to give rise to either liking or disliking; it therefore becomes
  a cause for addiction or aversion and ultimately suffering when it is
  not in line with one's partialities. In order to keep the mind clear
  and impartial, one should always try to create clear awareness at the
  moment of sensory experience, rather than allowing the mind to judge
  the experience according to its habitual tendencies. When seeing,
  therefore, one should know it simply as seeing, reminding oneself
  "seeing, seeing".
When hearing a sound, one should likewise note "hearing, hearing".
  When smelling pleasant or unpleasant odours, "smelling, smelling".
  When tasting food or drink, instead of becoming addicted to or
  repulsed by the taste, one should note "tasting, tasting". When
  feelings arise in the body, hot or cold, hard or soft, and so on, one
  should note "feeling, feeling" or "hot", "cold", and so on.
Practicing in this way, one will be able to receive the full spectrum
  of experience without compartmentalizing reality into categories of
  "good", "bad", "me", "mine", "us", "them", and so on. As a result,
  true peace, happiness and freedom from suffering is possible at all
  times, in all situations. Once one understands the true nature of
  reality, the mind will cease to react to the objects of the sense as
  other than what they truly are and be free from all addiction and
  aversion, just as a flying bird is free from any need for a perch on
  which to cling.
This then is a basic guide to practice meditation in daily life,
  incorporating the meditation practice directly into one's life even
  when not formally meditating. Beyond these two methods, one can also
  apply any of the objects discussed in the first chapter – pain,
  thoughts, or the emotions. The techniques discussed in this chapter
  should be thought of as an additional means of making the meditation
  practice a continuous experience whereby one is learning about oneself
  and about reality at all times.
Answer: When we read about Buddhism in books, we may hear an idea, such as "mindfulness", but because we don't know how it works, we may start doing something without really understanding what we're doing and why. All beginners are prone to this, I did this too. Everyone goes through this.
The goal of mindfulness is not to become super-mega-aware. Paying deliberate attention to things will not give you mental superpowers. The goal of mindfulness is to change one's sloppy habits that are connected with weak, negative, lustful, aggressive, egoistic, self-beating, and other pathological mindstates. So basically, the idea of mindfulness is, instead of acting impulsively like an untrained puppy,  we try to pay attention to what we are doing and act like the Buddha, with wisdom and grace - including physical, verbal, and mental acts. That's the point.
Now, sometimes labeling is taught as part of meditation. Here is why. When teachers explain meditation to beginner-level students, they start with something very simple. For example they say, "try counting your breaths on fingers and see how long you can go without getting distracted". Or they would say, "try labeling things that happen in your subjective experience". Stuff like that.
It does not mean that counting breath or labeling stuff is meditation. It is just the simplest way for teachers to turn the student's direction into phenomenological mode - so they can start looking at their experience as subjective experience, and not at its objective content.
The purpose of meditation is the same as the purpose of Buddhist practice in general (SN 49.1):

non-arising of evil, unskillful qualities that have not yet arisen.
abandonment of evil, unskillful qualities that have arisen.
arising of skillful qualities that have not yet arisen.
maintenance, non-confusion, increase, plenitude, development, & culmination of skillful qualities that have arisen.

On beginner level we should focus on removing the coarse "unskillful qualities" and generating coarse "skillful qualities" using coarse methods, and as we get better we proceed to more and more subtle stuff.
So in the very-very beginning you can start with simple tricks like counting breath and labeling things. But as soon as you got the point, you should move to "real" meditation, which is what I quoted above.
No need to label things. Just notice your state of mind. Notice your thoughts and emotions and try to see which of them are "skillful" (good, healthy, useful) and which are "unskillful" (useless, sick, pathological). Practice like this for a while, stopping the bad and generating the good.
Then on next level, look at these very thoughts that are looking at your thoughts and are deciding whether they are good or bad. See which of these second-level thoughts are healthy and which are sick. Fix whatever is wrong.
Keep going up like this as it gets more and more subtle. Then at some point very-very far down the road all unhealthy mindstates are solved and the only issue that's left is this habit of categorizing mindstates as good vs. bad and constantly trying to improve it. Then you abandon even this habit, and since everything else is solved already, that's how you reach Nirvana. This is the proper gradual approach to meditation. Same exact approach applies to your practice in post-meditation and to mindfulness.
No need to try and notice everything and label everything. That's impossible. Focus on whatever is the biggest (most obvious, most coarse) problem at any given time. Solve them one at a time.
Comment: But again, ıf anyone has a doubt about the method he or she mustn't use it. You have certainly good intentions because you think that this method can lead people to the wrong direction(conceptualisation). I am not really fan of any methods and I think that at some point we must learn the "being" rather than doing". These were just an opinion of a person who lives in a complete Non-Spiritual environment but has the desire to be a monk in a Buddhist country in the future :) Have a nice afternoon(or evening) there :)
Comment: Labeling things is just a reminder. When you label things or what you are doing, your attention directly and naturally goes to the thing that you label. For example you say "walking" attention directly goes to the feet and the movement of walking. If the attention doesn't go there then you can easily train yourself to develop that habit. There is actually an Arahant who teaches this method so this method certainly effective and works. But what the meditation teachers generally doesn't say is that at some point you must completely let go of any methods and stop the effort mode in mindfulness
Comment: But the meditator generally doesn't reach that level quickly unless the meditator is doing intensive meditation for long periods of time. So I think labeling can be very helpful for everyone until they reach to that advanced level.
Comment: In my opinion, labeling is very dangerous when you practice it for too long. It fixates your mind on the simplistic concepts, instead of paying full attention to the (ineffable) real experience in all its infinite nuances and complexity. If you understand that it's only a reminder, that's fine. But people take it too seriously as this guy who asked the question, and try to label everything. Then they start asking, how specific should the labels be? See what I mean? It leads one down the wrong path of conceptual proliferation.
Comment: I think the only way to understand the "spiritual" things is to experience it.  I started my path after reading Eckhart Tolle's books and I didn't use labeling for many years.  And it helped me a lot. Then I used labeling and did meditation for long periods of time and did mindfulness practise in daily life with labeling that also helped me a lot. I respect everyone's opinion in this subject but I think experience is the only way to understand the root of the spiritual things. But I think that If anyone has a doubt about it then he/she musn't use it.
Comment: I think the main problem in mindfulness is that people do daily meditation for half an hour or an hour or even many hours, but then completely go to the ordinary way of living. The modern life's requirements also leads people to this negligence but people can at least do mini meditations when they find free time in their daily life. Or just being mindful when they are walking to the shop, driving the car or washing the hand can make a big difference. If anyone isn't doing these things no matter what methods they are using the positive results will not come very soon.
Comment: Even Eckhart Tolle said: "When you teach children, don't tell them 'it's a tree' - tell them 'this is *called* a tree'. Make sure they don't lose reality behind concepts".
Answer: The specified topic "making bed", is for checking the current situation of the practitioner. The practitioner specifies the current situation to analysis it and to look for the proper solutions that matched with the topic.
What are the proper solutions for the making bed practitioner?

Realize the current situation, making bed, state.
Finish the making bed event in time.
Realize the schedule of events.
Concentrate the breath to avoid the unwholesome events, out of the necessary and wholesome event on the schedule.

When the practitioner practices the above analysis proficiently, whole processes above are going to run automatically in time without any conflict.
Above is just the example event and solutions. The practitioner can find more solution in  The path of purification Chapter 1,2,3,4, and 8, MN. MahāsatipaṭṭhānaSutta's Commentary.
If the practitioner doesn't want to use so much time to study the text above, the attained-jhāna Tipiṭaka Memorizer teacher, who is Ariya, is required because he can make the specific course syllabus for each practitioner in his head. By this way, the practitioner doesn't study the Pāli by himself.
Answer: I think it is better to use simple and short words. Like doing, eating, swallowing, walking, sitting, seeing, hearing, tasting, drinking, feeling, driving, putting, holding, making, pain, joy, calm etc.. If you forget to note time to time, or have confusion of what you're doing, or what to call to what you're doing that's a very normal thing and don't think that something is wrong in the practise. Noting is an effective technique of mindfulness that keep you move forward quickly.
Like Andrei Volkov mentioned in another topic, mindfulness will become spontaneous when you move forward in the Buddhist path. https://buddhism.stackexchange.com/a/26254
There are many gifts in keeping the mindfulness practise with effort and skillness. One of that gifts is spontaneity. So the mindfulness techniques(which are tools) that we use to get that gift can be different. But they all lead us to the same place.
Answer: You keep claiming that mindfulness has something to do with labeling. That's incorrect.
Even though you don't like the suttas, here is quote from a sutta showing what sati and sampajana means:

"And how, bhikkhus, is a bhikkhu mindful? Here, bhikkhus, a bhikkhu
  dwells contemplating the body in the body … feelings in feelings …
  mind in mind … phenomena in phenomena, ardent, clearly comprehending,
  mindful, having removed covetousness and displeasure in regard to the
  world. It is in this way, bhikkhus, that a bhikkhu is mindful.
"And how, bhikkhus, does a bhikkhu exercise clear comprehension? Here,
  bhikkhus, for a bhikkhu feelings are understood as they arise,
  understood as they remain present, understood as they pass away.
  Thoughts are understood as they arise, understood as they remain
  present, understood as they pass away. Perceptions are understood as
  they arise, understood as they remain present, understood as they pass
  away. It is in this way, bhikkhus, that a bhikkhu exercises clear
  comprehension.
  https://suttacentral.net/sn47.35/en/bodhi

if you do something else than that, you are not good at sati sampjana.
Comment: Removed harsh language, on another user's request.
Comment: The Buddhist practices that I have learnt which are in alignment with Mahasi Sayadaws teachings, Thai forest, and also western teachers such as Joseph Goldstein, Jack kornfield etc all teach labelling/noting. So not sure why you're claiming it to be incorrect. I'm not here to argue about who's right and who's wrong. Just how to do what I'm doing already better. There are many sects amongst modern religions all claiming different things and all claiming only their way is correct. I prefer to follow my intuition and what resonates with me and that is what I'm continuing to do.

Mindfulness question


If hydrogen bonds are chemical bonds, and these bonds are broken when water changes phases, why doesn't this classify as a "chemical" change?

Question: This is more of a terminology question. How are phase changes considered a physical property, not a chemical property when hydrogen bonds break. A chemical property can only be observed during a chemical change. Aren't hydrogen bonds a type of chemical bond, and those bonds are being broken during a phase change from ice to liquid water, for example. I understand that no intramolecular bonds are being broken. Water molecules remain intact. But we teach that a chemical bond has to break during a chemical change, but phase changes are considered to be physical.
Comment: The distinction between chemical and physical changes exists only in our heads.
Comment: Possible duplicate of [Ripping apart plastic: is this a chemical or physical change?](https://chemistry.stackexchange.com/questions/31299/ripping-apart-plastic-is-this-a-chemical-or-physical-change)
Comment: The question there makes use of a different example ("ripping a plastic sheet") but the answers to it should address most of your issues too... since your question (as I interpret it) is basically "Are physical and chemical changes sharply defined?". Cheers!
Comment: @Jan Ah, but the physical-chemical change classification taught at school represent a false dichotomy (I don't have an issue with the type of bonding *per se*). But now that I've re-read the question I linked (and its answers), I realized that the answers to ron *sensei*'s question don't make much of a case in this regard (i.e- dispelling the notion of rigid physical-chemical change classification). I stand corrected, accordingly I've withdrawn my close vote. Thanks for the pointer O:)
Comment: I respectfully disagree with @paracetamol because the other question focusses on breaking covalent bonds which we should all agree are sufficiently different from hydrogen bonds.
Comment: This would apply to metal as well.  I see the  textbook classification of chemical vs physical not overly simplified but having somehow a deeper meaning. At least a physical process never alters the minimal formula of an element/compound
Answer: You must realize that the line between physical and chemical properties is very thin. Most bonds work via the same principle, which has mostly to do with electronegativity. When looked at in reactions it has probably also to do with the according entropy and enthalpy change. Hydrogenbonds are basically bonds based on electronegative attraction between two atoms (which is a simplified few of the reality). A phase change basically when a certain energy point has been reached: since heating op a substance is equal to giving it more kinetic energy (since heat is the same as the movement of individual atoms or molecules). When you reach a certain heat there is too much kinetic energy to form hydrogenbonds the same way it as it did before it changed phase. You probably can agree that molecules or atoms moving quickly is an obvious physical property. When you look at great detail to how hydrogenbonds work, it has something in common with many other way of two objects attracting each other (for example: the formula for the gravitional force between to large heavenly bodies, is very similar to the formula for the electrical force between an electron and a nucleus).
In simple: Many of these chemical properties seem very physical when you look at them in detail. So saying that a certain property should actually be chemical because the changing of this property seems to correspond with the changing of chemical bonds, is not a realistic claim looking at how "physical"/physic based these "chemical" bonds are.
Answer: First let's clear up a misconception in the OP's Question: Water molecules remain intact. - NO!!! This is absolutely wrong. Water is sort of an odd solvent because the "molecules" are not absolutely fixed.
If pure $\ce{D2O}$  is mixed with pure $\ce{^1H2O}$, then you get $\ce{D^1HO}$ which shows that the hydrogen oxygen bond is very liable. So a hydrogen bond can easily be transformed to one of the two covalent O-H bonds by having one of the original O-H covalent bonds become a hydrogen bond. So water is a vast network of hydrogen and covalent bonds which is forever changing.
We could consider $\ce{D2O}$ and $\ce{^1H2O}$ as different compounds since they have different freezing points and different boiling points. But the point here was to somehow label the hydrogen atoms in water. In pure $\ce{^1H2O}$ the hydrogen-oxygen bond is still very liable.
Now to the overall question. The point is that most pure substances will solidify if made cold enough. Warm the substance beyond its melting point and most turn into a liquid. Heat the liquid hot enough and the liquid boils. Furthermore thermodynamics dictates that it takes a certain amount of heat to convert a certain mass of the solid at the melting point to a liquid. Also it takes a certain amount of heat to convert the liquid to a vapor at the boiling point. That is the conceptual framework upon which thermodynamics is based.
There is some acknowledgement of how various forms of bonding effect the phase transitions. For instance consider sodium chloride. The bonding energy of one $\ce{Na^+}$ ion in the solid isn't between the one $\ce{Na^+}$ ion and one other $\ce{Cl^-}$ ion but between the attraction of the $\ce{Na^+}$ ion to all the $\ce{Cl^-}$ ions and the repulsion of all the other $\ce{Na^+}$ ions. The overall factor is called the Madelung constant.
Comment: But this is an effect of water being a protic solvent. Water is also able to protonate substances with which it does not undergo hydrogen bonds such as sulphides or carbanions. Indeed, with a sufficient acidity of the corresponding alpha protons of a ketone, these can be deuterated in $\ce{D2O}$ — does that mean water hydrogen bonds to the carbon?
Answer: Suppose you heat carbon in an atmosphere of carbon dioxide.  They react; carbon monoxide is formed in the gas phase.  Cool the gas and the reaction, which is endothermic for formation of the carbon monoxide, reverses; you redeposit carbon (possibly on cooler parts of the furnace in industrial settings).
Suppose you put sugar into water and heat it up.  The sugar dissolves, and more dissolves as you heat the system.  Let it cool; the dissolution of the sugar, which is endothermic, tends to reverse and solid sugar reappears.
What is, empirically, the difference between these two processes?  "Chemical reaction" versus "physical change" is a blurred distinction.
Comment: The original post referred to phase change of a pure substance. With mixtures the situation may be different, I suspect. Otherwise why do we say that the sugar 'dissolves' - rather than 'melts' -  in water?


How do I keep oak trees from sprouting?

Question: I have a lot of nice sized oak trees. I have pin, black, and chestnut. Every once in a while one of them puts out sprouts all over the trunk and starts looking like a green pillar. How do  I keep that from happening?
Comment: Can you please post a photo or two that clearly shows the "sprouts" you wish to remove. Also take a look here: [Cutting large tree roots](http://gardening.stackexchange.com/questions/1294/cutting-large-tree-roots/1296#1296) & be sure to read the comments below that answer -- discussion on "sucker" roots/basal shoots (aka suckers)...
Comment: It is trunk sprouts.
Comment: These sound more like the little shoots that a lot of trees occasionally put out from their trunks. Naturally they usually get broken off, damaged, eaten, etc. Just clipping them off or rubbing them off works - but I don't know if that is wise if there are lots like it sounds like there are in this case. It might be that the tree is doing it as a response to a bigger problem - crown damage, perhaps?
Answer: Unfortunately, there is nothing you can do to prevent them from growing sprouts. Oak trees occasionally propagate in the wild through root sprouts and that's what these are (discounting when it's a fallen acorn that has sprouted). Since these sprouts are connected to the main tree through the roots, using any form of chemical to "burn" them will easily kill the tree. You could however, keep them in check by trimming them often or digging them out.
This page has some good info on oak sprouts:

One of the basic, and most successful, methods of mother nature's propagation of the live oak are these root sprouts. In their native environment single live oak trees are seldom found. Rather they are congregated in groups of trees called copses. Perhaps a squirrel planted the original acorn from which this copse emerged and the ensuing tree sent up many oak sprouts. Of that many some succumbed to the browsing of domestic and wild animals such as cattle and deer which find them very tasty, and some didn't make it for other reasons. Those that survived became the copse, all connected to a common root system.

Being interconnected through roots also has its disadvantages because diseases can propagate through the entire group easily.
They also recommend planting jasmine and trimming the sprouts when they outgrow the jasmine. Another suggestion is to plant grass such as St. Augustine or Zoysia and mow the sprouts along with the grass.

So really the answer is that we just have to learn to live with them. How you do this is a personal preference. Some plant Asian Jasmine in the same area because of its similar leaf appearance and periodically cut off the oak sprouts as they grow taller than the ground cover. Some thin out the canopy of the trees, allowing more sunlight to filter down to the ground enabling St. Augustine or Zoysia grass to grow. Then the offending oak sprouts growing in the grass are frequently mowed off. I have also seen them used as a ground cover just by keeping them mowed
Comment: Do you have a reference for your claim about oaks and sprouting as a primary means of propagation? I know it is true of live oaks but not so much of others, although many coppice. Also, I don't think the question is about root sprouts.
Comment: you can easily kill an oak tree? With what?
Answer: Oak runners can be stopped by stripping off the leaves; check them weekly and rub off any new sprouts. It takes a few months, longer for Red Oak than Live Oak. Do not cut them, because they will come back thicker. If you notice in nature you do not find many trees with sprouts. That is because deer, goats, cattle etc. eat the new sprouts. Once the sprouts become brittle, break them off.

How do I keep oak trees from sprouting?


Bumping old questions

Question: What are the rules/guidelines for bumping old questions? (old as in 1 year or more) What is usually the maximum time before a question is considered too old to bump?
Comment: There is no "too old to bump." Yet pointless bumping and flooding the frontpage with numerous bumps close in time are discouraged.
Comment: My rule: do not bump more that 3 stale questions per day.
Comment: @Anonymous Yes, though those actions should always carry an intention beyond "I want to bump this question"
Comment: @ShubhamKumar if you *want* to give it visibility place a bounty. If not, I do not understand the question.
Comment: Instead of just bumping the question and hoping that somehow this will lead to a different outcome than the previous time, try to improve the question as well as you can. The question will then naturally be bumped, *and* it will have a better chance of receiving an answer (or at least comments).
Comment: See [How much bumping is too much?](http://meta.math.stackexchange.com/questions/5068/how-much-bumping-is-too-much) and [other posts linked there](http://meta.math.stackexchange.com/questions/linked/5068).
Comment: How to bump an old question which is unanswered?
Comment: Doesn't editing or answering an old question bump it?
Answer: Bumping of a Question, old or not, does not of itself signify anything constructive, re the mission of Math.SE.  Bumping occurs as a side-effect of editing or answering a Question and serves the purpose of bringing these changes to the Community's attention.
If an Edit or Answer is worthwhile, even for an older Question, then the bumping that occurs is generally unobjectionable, certainly a secondary concern at best.  Thus the age of the affected Question is at best a tertiary concern.
Comment: @GEdgar:  A Question may have "no activity for a year" affecting its front page appearance, yet still receive views and votes, factors more directly connected to the value of edits. Certainly some edits are less  valuable than others, and some users object to even important [link-rot](http://meta.math.stackexchange.com/questions/3476/questions-with-broken-links) fixes to systematic problems when many older Questions are affected.  So I will agree to disagree, my position being that the age of a Question for a worthwhile edit is of tertiary importance.
Comment: `Bumping occurs as a side-effect of editing or answering` FWIW it can also occur due to the [Community background process](http://math.stackexchange.com/users/-1/community): "*Randomly poke old unanswered questions every hour so they get some attention*". P.S. Or maybe "no *accepted or upvoted* answers", seeing that [Lengths of the sides of a triangle: sufficient and necessary condition?](http://math.stackexchange.com/questions/1051376/lengths-of-the-sides-of-a-triangle-sufficient-and-necessary-condition) was just bumped to the active page by *Community*, even though it had a posted answer.
Comment: @dxiv:  I'm aware of the Community bumps.  I'm glad you pointed it out; since the Question and its Answer were both reasonable and had zero votes, I upvoted both.  Unanswered here perhaps includes Questions with no upvoted or accepted Answer.  Mention of Community bumps did not find a place in my narrative since they are independent of user action.
Comment: I disagree.  Making a minor edit (adding a tag, fixing a spelling mistake,...) is OK, even desirable, for a question still on the front page.  But not for a question that has had no activity for a year.
Answer: The Community process will occasionally bump random questions without any activity triggering it. That tells me that bumping old questions is indeed desirable, as long as it doesn't affect too many in too short a time. And I'd rather see a post bumped because it got improved than just bumped with no improvement.
So if you want to answer a question or improve a post, I'd say go ahead, improve our site with valuable content. If the questions you process are similar in nature (e.g. because you're going over a given tag listing, or all posts of a given author, or deliberately searching for some common misspelling or dead links or something like that), make sure to limit your bumps so that they don't come to dominate the front page. Perhaps check there is only one or two of them in the list at any given time?
If, on the other hand, you don't intend to substantially improve the post, but only edit it for the sake of bumping the question, then I'd rather not see that tool being abused. If you want to draw attention, offer a bounty. Or hope for luck and wait for the Community process to bump it.
Comment: The auto-bump occurs for questions which have no upvoted answers and have a positive (non-negative?) score. Namely, questions that as far as the system is concerned are unanswered.

Bumping old questions


Can we find two mutually orthogonal diagonal latin squares of orders $4$ and $8$?

Question: Can we find two mutually orthogonal diagonal latin squares of orders $4$ and $8$? A diagonal Latin square is a Latin square of order $n$ where the symbols $1$ thru $n$ fil both the forward diagonal and the back diagonal? It'd be great if you could show me the actual MOLS as well as the methodology.
Comment: I added an 8x8 example to my answer.
Answer: This may also be of interest.  From the two 4x4 squares given in a previous answer, two 8x8 squares can be grown.
If we transpose the symbols thus;

The two squares are different only by the chosen symbols the cells contain.
a) Place the two latin squares side by side to give a rectangle.
b) Then swap rows 2 and 4 with the transposed rows 2 and 4 to give;

c) Then take the resulting rectangle from b) and copy it backwards below the rectangle resulting from b).
Then we get;

The same process may be performed again and again from the resulting squares, swapping each even numbered rows.
Answer: $$\matrix{1&3&4&2\cr4&2&1&3\cr2&4&3&1\cr3&1&2&4\cr}\qquad\matrix{2&3&1&4\cr4&1&3&2\cr3&2&4&1\cr1&4&2&3\cr}$$
Answer: Let $F$ be a field of 8 elements (this would work for 4 as well).  It is a standard fact that for non-zero
elements $\alpha\in F$, the formula $L_\alpha(x,y)=x+\alpha y$ produces a latin square. Furthermore, $L_\alpha$ and $L_{\alpha'}$ are MOLS, if $\alpha\neq\alpha'$. The diagonal
consists of the elements $L(x,x)$, but to get a specific back-diagonal we need to use
a specific ordering. The following will work. Start placing elements of $F$ into
a linearly ordered list. We append elements to both ends of the list as follows. When we put a new element $x$ to become the first entry, we immediately follow up by putting $1+x=1-x$ to the
end of the list. We then use this ordering for both rows and columns. If we do it this way, the other diagonal consists of elements $L(x,1+x)$.
So the main diagonal of $L_\alpha$ has the elements $L_\alpha(x,x)=(\alpha+1)x$. This list contains all the elements of $F$, iff $\alpha+1\neq0$, in other words, iff $\alpha\neq1$.
The other diagonal of $L_\alpha$ has the elements $L_\alpha(x,1+x)=\alpha+(\alpha+1)x$.
These are also all distinct, iff $\alpha\neq1$.
Therefore we get two MOLS with all the entries occuring on both diagonals by selecting two distinct non-zero and non-1 values for $\alpha$, and by using an ordering of the
field elements of a given type. As the field contains either 4 or 8 elements, there are
at least two choices for $\alpha$ remaining, so we succeed.

Let us give an example of a pair of $8\times8$ MOLS. We start by constructing the field of 8 elements. To that end I declare $\alpha$ to be a root of the primitive polynomial $x^3+x+1\in \mathbb{F}_2[x]$. Then we have $\alpha^3=\alpha+1$, $\alpha^4=\alpha^2+\alpha$,
$\alpha^5=\alpha^2+\alpha+1$, $\alpha^6=\alpha^2+1$ (and, of course, $\alpha^7=1$).
An ordering of the type describe above would then be $x_0=0$, $x_1=\alpha$, $x_2=\alpha^2$,
$x_3=\alpha^4$, $x_4=x_3+1=\alpha^5$, $x_5=x_2+1=\alpha^6$, $x_6=x_1+1=\alpha^3$, $x_7=x_0+1=1$.
The latin square $L_{\alpha}(i,j)=x_i+\alpha x_j, 0\le i,j\le 7,$ then has the entries (the version lists entries as
elements of $\mathbb{F}_8$, in the latter version I replaced these with their subscripts from the chosen ordering):
$$
L_{\alpha}=\pmatrix{
0&\alpha^2&\alpha^3&\alpha^5&\alpha^6&1&\alpha^4&\alpha\cr
\alpha&\alpha^4&1&\alpha^6&\alpha^5&\alpha^3&\alpha^2&0\cr
\alpha^2&0&\alpha^5&\alpha^3&1&\alpha^6&\alpha&\alpha^4\cr
\alpha^4&\alpha&\alpha^6&1&\alpha^3&\alpha^5&0&\alpha^2\cr
\alpha^5&\alpha^3&\alpha^2&0&\alpha&\alpha^4&1&\alpha^6\cr
\alpha^6&1&\alpha^4&\alpha&0&\alpha^2&\alpha^3&\alpha^5\cr
\alpha^3&\alpha^5&0&\alpha^2&\alpha^4&\alpha&\alpha^6&1\cr
1&\alpha^6&\alpha&\alpha^4&\alpha^2&0&\alpha^5&\alpha^3\cr},
$$
or
$$
L_{\alpha}=\pmatrix{
0&2&6&4&5&7&3&1\cr
1&3&7&5&4&6&2&0\cr
2&0&4&6&7&5&1&3\cr
3&1&5&7&6&4&0&2\cr
4&6&2&0&1&3&7&5\cr
5&7&3&1&0&2&6&4\cr
6&4&0&2&3&1&5&7\cr
7&5&1&3&2&0&4&6\cr}.
$$
Similarly we get that
$$
L_{\alpha+1}=\pmatrix{
0&3&4&7&1&2&5&6\cr
1&2&5&6&0&3&4&7\cr
2&1&6&5&3&0&7&4\cr
3&0&7&4&2&1&6&5\cr
4&7&0&3&5&6&1&2\cr
5&6&1&2&4&7&0&3\cr
6&5&2&1&7&4&3&0\cr
7&4&3&0&6&5&2&1\cr}.
$$
The general theory tells us that $L_\alpha$ and $L_{\alpha+1}$ are MOLS. We observe
that, in accordance with the earlier part of the solution, they both have the required extra property. We also observe that the two MOLS share the same set of columns. This is built in to the method of construction.
Comment: Alternatively we could arrange the other diagonal to have entries $L(x,\gamma-x)=L(x,\gamma+x)$ for any non-zero "pairwise sum $\gamma\in F$". Also note that this is specific to characteristic two. In other characteristics we might place zero in the middle and pair up $x$ and $-x$.


Is dust extinction/reddening caused by Rayleigh scattering or some other physics phenomenon (or both)?

Question: I know from Rayleigh scattering that in the atmosphere redder photons are scattered less than bluer photons by the particles that both make up and are floating around in the atmosphere.  This is why the sky is blue and sunsets are red.  My question is, is the physics behind Rayleigh scattering (which, according to wikipedia, is due to the electric polarizability of the molecules) the same physics behind dust extinction? Additionally, is it the only physics in play or is there additional physics that causes the phenomenon?
Comment: Are you talking about the Earth's atmosphere, or interstellar/intergalactic extinction?
Comment: I am talking about interstellar/intergalactic extinction.
Comment: Ok, I''ll try to arrange for an answer in a while
Answer: In an astronomical context, Rayleigh scattering does not take a huge place.
The extinction is mostly due to absorption and scattering, from gas and dust. Its effect is to diminish the flux from the source (that is, a change in magnitude). Please, take care this depends on the observed wavelength!
For simplicity, we can assume the extinction factor $Q_{ext}$ as:
$Q_{ext} = Q_{scattering} + Q_{absorption}$
Where $Q_{scattering}$ is in turn composed of many elements.
As the OP above said, blue light generally suffers of higher extinction than other frequencies, so causing reddened observed light. This is due to the cross-section dependence on the frequency: if the light has a wavelength that is comparable to the size of the grain dusts (high frequency), it is more effectively absorbed, while in the opposite case it can pass through undisturbed.
This is the reason why obscured fields are observed in radio (in our galaxy, especially) or in infrared (extragalactic).
So, the answer to you question, in space is: Rayleigh scattering is not the most responsible of the extinction/reddening, you have to invoke absorption/scattering by dust and gas.
For comparison, here some explanatory numbers about the extinction efficiency in different contests:
$Extinction \sim\lambda^{-1}$
$Thomson \sim\lambda^0$
$Rayleigh \sim\lambda^{-4}$
You basically would need impressive amount of gas to account for the extinction just by Rayleigh scattering.
Instead, Mie scattering is more important in this context. Here a figure to quickly grab the concept (from here):

And here a very popular plot about extinction versus frequency from here:

Of course, if you observe from ground, you should take care of Rayleigh scattering as well.
Other references:
Lecture 1
Lecture 2
Answer: Rayleigh scattering is one kind of elastic scattering. Besides other kinds of scattering, absorption contributes to extinction.
Absorption is dependent of the chemical composition of the dust or gas. But generally blue light is easier absorbed than red light, hence the reddening (not to be confused with red-shift!)


Do you ever use Frequency Shifter plugins and how

Question: Do you ever use frequency shifter plugins and how??
Answer: I'd recently used the GRM tools FreqShift plugin to create a monster scream. The final sound was a mix of FreqShift, PitchAccum, SoundToys Crystallizer & some reverb. The "meat" of the sound was achieved using FreqShift though. It's great fun to use on voices or animals to create zombie or creature-ish textures.
You can listen to it here:
http://soundcloud.com/ntkeep/the-scream-before-after
The scream was layered under a mirror shattering so it was meant to sound a bit broken/granulated.
Comment: Oh my goodness Varun, that sounds AMAZING!


Is there any data available on user demographics of Philosophy Stack-Exchange?

Question: I recently read this article regarding the demographics of Reddit users.  It would be interesting to see similar data for this forum.  Particularly it would be insightful to see data on: location, age, gender, politics and religion.  If I recall correctly, no demographic information is asked of users upon signing up, so it may be the case that there is no such reliable source for such data.
Answer: As far as I am aware, such data is not collected or stored (as you already mentioned). You can see what data Stack Exchange has of you by submitting a request. Here are some things that may give you some interesting insights, especially if you want to work through the data yourself:

Religion: you may be able to get some coarse results by figuring out what users have (active) account on the Christianity, Hinduism, Islam, Mi Yodeya, ... sister sites. I suppose the SE data explorer can give that kind of information.
Location: you may be able to infer some rough time zone details by checking when users are active. You could also check the domain names of home pages in user profiles or the existence of profiles on sister sites for other languages.
Background: this post contains a (presumably incomplete / outdated) list of users with an academic background in philosophy.
Age: users should be 13 years old (or 16 in the EU). However, this is not actively enforced.


Secondhand ECU recoding

Question: I have a Passat 1.6 blue motion 2014 and the car has suddenly becomes immobile when trying to start and responds with many warning lights,on occasions it does start and run but not for long.I have taken it to a garage and they identified a faulty water damaged ECU and am looking at options currently.Re-cloning could cost all 8-900 GBP with mechanics time.I have investigated second hand and it would be substantially cheaper but with some risks.One supplier has confirmed that he can supply a secondhand ECU with the identical part number of my faulty ECU so on that basis does it still need to be wiped and reprogrammed?
Answer: Unfortunately there's still going to be some re-coding needed. You can't just straight swap the ECU in from another car.
Sadly water ingress into the ECU was/is depressingly common on this model of Passat and leads to just the sorts of symptoms you describe.
Since you mention GBP I'm guessing you're UK based - I've heard good things about the services from ecutesting (no affiliation) who can offer rebuilds. Obviously it means you'd be without the car for a few days but it would avoid the need to re-code and could save you a bunch of cash.

Secondhand ECU recoding


Metamask is not defined when it's connected to local network

Question: I have Metamask connected to the local Ganache network, but I am getting the "No web3? You should consider trying MetaMask!" message, so apparently Metamask isn't being used. How would I get it to use Metamask?
Comment: "when it's connected to local network" Are you implying that `web3` _is_ defined when you're connected to another network?
Comment: web3 is undefined when it's currently connected to the local 7545 network.
Comment: Again, are you implying that it _is_ defined when connected to a _different_ network?
Comment: I don't know if it's defined when it's connected to a different network. I am deploying my smart contracts on this local 7545 network and I would like Metamask to work when it's connected to it. Metamask being defined when it's connected to a different network doesn't solve my issue with this current network.
Comment: But it changes the question you're asking. If you asked someone "Why doesn't my car start when it's cold outside?" they wouldn't consider options like "there's no battery in it," because that would equally be a problem in warm weather.
Comment: If your question is just "Why is `web3` not defined when using MetaMask," my guess would be that you're checking too early. When is the code snippet you took a screenshot of executed? Try moving it to `window.onload` (or `$(function () { ... })` if using jQuery).
Comment: I am running this in a node server.js file. It doesn't have the window object.
Comment: MetaMask is a browser plugin, so it has no impact on code running outside of the browser.
Comment: Thank you. Would you just run all the smart contract calls in the frontend code? I am using ReactJS for the frontend.
Comment: Generally, yes. It's the user of the app that should be making the contract call, so you need to make it from the client (where they have MetaMask running with their private key).
Answer: Are you running your 'html' file as 'http://' or 'file://' ? Because, this won't work in file:// method.
Just verified it locally. I've ganache running on HTTP://127.0.0.1:8545 and used node js (app.js) and index.html files.
index.html

app.js
const express = require('express')
const app = express()
var path = require('path');

// viewed at http://localhost:8080
app.get('/', function(req, res) {
    res.sendFile(path.join(__dirname + '/index.html'));
});
app.listen(3000, () => console.log('Example app listening on port 3000!'));

Open Node js..
C:\Users\mk\Desktop>node app.js
Example app listening on port 3000!

And the console output was like this...
Not allowed to load local resource: file:///D:/TestEth/capestoneEthILP/html/js/web3.js
(index):6 found web3?
(index):1 Error in event handler for (unknown): TypeError: Cannot read property 'state' of null
    at CSRecorder.onQueryStateCompleted (chrome-extension://cplklnmnlbnpmjogncfgfijoopmnlemp/content_scripts/recorder.js:106:18)
inpage.js:9 MetaMask: web3 will be deprecated in the near future in favor of the ethereumProvider
https://github.com/MetaMask/faq/blob/master/detecting_metamask.md#web3-deprecation
get @ inpage.js:9
(anonymous) @ VM82:1
ContentLoader.js:28 failed to get content script

Comment: It's running on http. That's not the issue.
Answer: Resolved:
Metamask doesn't only works within the browser, so include all the contract calling logic in the frontend code.
Answer provided by smarx in the comments


Animation advice please (sliding pipes with handles)

Question: Hi this is my first post.  I've been learning Blender 2.8 for about a month with the aim of creating some simple, stylized animations for a medical device.
The device (see picture) consists of two nested barrels, one partially inside the other.  Flexible handles connect them and, when pushed together (red arrows) cause the inner barrel to slide out of the outer barrel (blue arrows).  When the handles are released, the barrels resume their initial position.
I've been exploring ways to animate this motion but with no success so far.  I'm not even sure if I should be using IK, or bendy bones or whatever.
Could someone point me in the right direction please?
Many thanks,
Andrew
Answer: Shapekeys
Would consider using shapekeys for the handles.   With two shapekeys fully flexed and fully straight.
For example sake have made the rest of the mesh into shapekeys, however could use hooks or constraints to move cylinders, but what matters here is getting the handle flex.
To open close handle is now only a matter of adjusting flex shape value.

Model a curve in the shape of full flex out.  I've used a simple 2 point bezier here
For example sake add the default cube, adjust the dimensions to
better suit.
To this add an array modifier, set to fit the  curve, and then a
curve modifier using same.  May need to tweak the curve scale, and / or cube scale, slightly to make sure it's a nice fit, ie how the last one fits the curve

We now have the flexed strap.

Apply the array modifier, to make it one mesh instead of an array of
items, and then apply the curve modifier as a shapekey  You will
notice the base shapekey is a flat line made up of how many of our
unit items fit the curve.
In edit mode moved the strap up, then adding a mirror modifier on y (top view in examples)
axis will give two handles.
In edit mode with Basis shape key selected, Add the two cylinders,
and adjust there position to match there attached ends. Change to
bent shapekey and do same.

Very quickly mashed together result from default cube and cylinders only.
Locating the pins.
Before I consine file to the ether, added this re using flexible bands to locate other objects

To locate pins that go thru the start and end element of strap
Select top and bottom face of where the pin goes thru and create and assign a vertex group for each end.
Added a pin object (mirrored in y same as flex). A copy location constraint on the pin to the flex, to the vertex group locates it.  This can be exended for the pistons.
Answer: It should work this way:

Create 2 armatures, A and B, and create a bezier curve with 3 vertices that follows the armature B's arc.
Parent both bones a2 and a3 to bone a1 in Keep Offset mode.
In Pose mode, give a2 a Limit Location constraint / Local Space mode, with only the Y axis unchecked, so that this bone can only move on its Y axis.
Hook each vertex of the curve to the 3 corresponding bones of the armature A: Select the armature, switch to Pose mode, select a1, then shift select the curve, then switch to Edit mode, select the bottom vertex of the curve and press  ctrl H > Hook to Selected Bone. Do the same for the other curve vertices. Now the curve follows the bones of armature A.
Select the armature B, switch to Pose mode, select b4, give it a Spline IK constraint, choose the bezier as Target and a Chain Length of 4. Now the bones follow the curve.
When you move a2, the armature B should stretch. Use a3 to adjust the curve shape.
Comment: Is this relation between curve and armature treated well by Blender (meaning curve is hooked and IK'ed with the same armature) or it will rise cyclic dependecy error?
Comment: No, the relation is not treated well and it will indeed throw dependency error. The way to correctly setup this is described here: https://blender.stackexchange.com/a/35442/7777. Furthermore the bones in spline IK solver are broken in Blender. Skewed and just bad. I don't remember anymore what needed to be done to them to fix this, probably turn off copy rotation from parent, then put rotation constraints on them and blend the twist and rotation from 1st bone to the last one. I ended writing my own spline engine in python, because this setup is garbage.
Comment: Bendy bones are a little better but not without issues either.
Comment: Ok so I've revised my solution and it should work  ;)


Would diesel (Jet A) cause less pollution than other fuels?

Question: Has any research been done on pollution from a aircraft using diesel (Jet A) vs other standard aircraft fuels? Is there a push to use diesel fuels in GA as a viable alternative and if so why or why not? (Ignoring the consideration of the non-availability of Jet A at most GA airports.) Would diesel-powered GA aircraft be considered the "future of green GA flying" or are other technologies such as electric propulsion more likely?
Comment: Yes, there has been a "push" to move GA aircraft to diesel powerplants, and some aircraft are equipped with it. There is also a "push" to develop an alternative to 100LL, moving to a completely lead-free fuel.
Comment: Welcome to aviation.SE! There are quite a lot of questions on this site already about fuel types, electric engines, batteries, solar power etc. that you might want to check out. [This one](http://aviation.stackexchange.com/q/15928/62) in particular is basically the same as your question and it was closed because it's simply too speculative. (And as an aside, outside North America it's often a lot easier to find Jet A than avgas.)
Comment: Are you asking about diesel type fuels, or diesel cycle reciprocating engines? Turbines generally burn fuel more completely since they run lean, whereas many gasoline engines are run rich with less complete combustion. Many GA aircraft are turbine equipped anyway.
Comment: Jet A is not diesel.  Jet A is kerosene.  Diesel is heavier than kerosene.
Answer: This is a good question which does not have an entirely straightforward answer as the different types of pollution produced and their effects on the environment are still being studied. Also, I know of no actual studies of aero diesel versus avgas versus unleaded avgas pollution in different types of aero engines to base a conclusion off of. I will draw some parallels with auto engines and fuels as they are similar in many ways.
Comparing the efficiency and pollution of a modern aero-diesel engine to the archaic avgas engine technology in most light airplanes is not really a fair comparison because modern aero-diesel engines have computerized electronic fuel injection, and often computerized variable pitch propellers which combine to create the best efficiency for the phase of flight. Old engine technology has no electronically controlled fuel injection (often no fuel injection at all), and often they don't have the gauges installed to inform the pilot how best to lean the engine. A better comparison would be a modern aero-diesel to a modern avgas engine with similar levels of technology, that's something I'd like to see.
There are many different types of pollution, and the different types of engines produce differing amounts. I will list the major types:

CO2: If you look at it from a CO2 perspective then auto diesels are less polluting than auto gasoline engines, which is why in many places across the world people have been moving to diesel. Governments (many in Europe) have in some cases taxes diesel less to make it more attractive. Whether aero-diesel engines produce less CO2 than a comparable technology avgas engines is not certain, as I said I've seen no actual data. Aero-diesel engines are heavier than avgas engines because they are partly made of steel, but they don't need magnetos which saves some weight, but then they are turbocharged which takes weight. Looking at the auto comparison I'd say aero diesels are probably better on CO2
NOx compounds: Nitrogen oxides are linked to asthma and breathing disorders, and diesel engines produce more of these than gasoline engines
Sulphur compounds: These are also linked to asthma and breathing disorders. Jet fuel has higher sulphur content than diesel fuel, and much higher than gasoline/avgas. Sulphur compounds may actually be helping to cool the planet though, as they help form clouds (acidic clouds) which reflect sunlight back into space
Fine Particulate Matter (FPM): particulates are a biggie from an environmental and health perspective these days. Particulates are linked to asthma and breathing disorders, and there is some evidence that black carbon particulates are heating the planet and causing glacier melt at an accelerated rate as they absorb heat. Diesels produce much more particulates than gasoline engines do

There is growing scientific evidence that the health and environmental costs of particulates, nitrogens and sulphur compounds of diesel outweigh the benefits of lower CO2 levels. I know in the UK the government is thinking about a U-turn on their stance on diesels, and many people are looking at going back to gasoline engines.
The biggest polluter with avgas is the lead though, in the form of Tetra Ethyl Lead (TEL) which is extremely toxic and very expensive to deal with. Unfortunately, without the lead avgas engines can rip themselves apart because of detonation at high density altitudes. This is an edge case to be honest, most light aircraft will never be in that situation, but it is potentially deadly in enough cases that you can't just get the lead out (pun intended). The lead makes avgas much more expensive than Jet fuel, which is one of the drivers behind aero-diesel; it's cost, not environmental benefits which make it attractive.
Comment: Regarding CO2, diesels are _definitely_ better, because they have lower consumption and the carbon content by weight is almost the same in both fuels(~0.5% more for diesel fuel, but the consumption is ~30% lower). And vast majority of the carbon ends up as CO2.
Comment: "Governments (many in Europe) have in some cases taxes diesel less to make it more attractive.": No longer true. The approved highway toll in Germany is going to be higher for diesel compared to similarly old gasoline engine.
Comment: Exactly my point @JanHudec, towards the end of my response I state just that.
Comment: Thanks for the great detailed responses!   But is it safe to say that there is fundamentally no molecular difference in auto diesel vs aero-diesl so you should be able to point to parallels in discharge in byproducts characteristics barring the apples to apples study you indicated would be needed.  Also as Jane commented I understand Europe is doing a complete about-face on diesel as they have found out that this diesel  tax incentive is actually having the reverse effects on what it was intended for in reducing pollutants and greenhouse effect by promoting more diesels on the road.
Comment: There is a difference between auto diesel and aero diesel (jet fuel). Here's a good question about it. http://aviation.stackexchange.com/questions/12184/what-are-the-differences-between-fuel-types-comparing-with-vehicles/12188
Comment: Thanks GdD! I had read this artificial before posting my question, thus my comment about no Molecular difference only purity obtained during refining. Thus would this purity of Jet-A make if more non-polluting, my assumption would be no to any marginal difference. Also, Autos have filters to filter out diesel particulates which I presume aircraft don't have.
Comment: Autos don't have to filter particulates @DanL, if they did it wouldn't be so much of an issue. Jet fuel tends to have more sulphur than diesel, especially the ultra low sulphur diesel sold in Europe.


Supporting multiple social sign-in methods

Question: I have performed a number of searches on this topic and found some related questions however none of which provided a clear picture of the best practice for developing a sign-in system on a site that relys on 3rd party server-side OAuth.
We have opted not to offer a traditional member sign-in method, allowing users to log in to the site via Facebook or Twitter (we may choose to offer further support for other networks at a later date).
We are keen to provide a seemless user experience for both new and returning users and would appreciate some advice & best practice from anyone who has successfully done this in the past.
The initial plan was as follows
- When a user signs in via Facebook we require them to provide a username which will be used throughout the site
- When a user signed in via Twitter we use their Twitter name as our username
This approach has an obvious flaw. What if a Twitter user signs in only to find that their username is being used by another member who chose it via signing in with Facebook?
This is unacceptable user experience therefore we need to re-think.
New approach
Currently our new approach is upon initial sign-in to present the user with a form to provide the remaining required information
For Twitter sign-ins:
 - Display name. Pre-populated with Twitter username if available or suffixed with 0,1,2,3 etc..
 - Email address. This will be confirmed via a verification email to complete the sign-up process.
For Facebook sign-ins:
 - Display name. Pre-populated with Facebook Display name if supplied & available or suffixed with 0,1,2,3 etc..
 - Email address. Pre-populated from Facebook account, no need to verify unless they decide to use a different email address, in which can the process will be the same as above.
It would be great to hear your thoughts on this matter.
Answer: I think second style is the simple one  and user can feel  less burden .
my vote for second only .He can pushed to login in the that same page and felt free.
hey ! just post weather which style you decided at the end ..because  I need to know the result of this $100 question :))


token based login in salesforce

Question: In custom object i have credential of another org contain username and password , login button as quick action too , i have issue that username and password is visible in url
so its not good so i tried to go through the token based login salesforce ?
as access_token which is generated by client id and client security ,created a connected app for postman to access
used this and get access code to use  in postman ,
tried to login salesforce using access token  which i get by send  oauth2 get request in postman and got instance url and signature and access token by using access token i tried like this
<code>http://[instance].salesforce.com/secur/frontdoor.jsp?sid=[access token]
</code>
open new tab and try to login by the above link.
it  redirect to login page of salesforce and ask again username and pass  for it
Comment: You can use oAuth authentication to login
Answer: Make sure you have the connected App with scope as web / full added so that it gets redirected with the access_token you are using

token based login in salesforce


Is it legal to smoke weed in Czech Republic?

Question: I know that buying and selling marijuana in Prague is illegal. As I were there in October 2012 I haven't seen any coffee-shops, but I have seen a lot of people smoking weed in bars or on the streets, even on the Charles Bridge. Is it legal to possess and smoke weed or just tolerated?
Answer: I have found some information on city-pilot.cz:

There is a partial decriminalisation of drugs in the Czech Republic –
  However, beware: decriminalisation does not equal legalisation!
  Possession of drugs for one's own use is not punishable, that is, you
  will not go to prison, however, the possession of drugs is also judged
  as an offence. What does this mean? If the Police catch you smoking a
  joint, for example, or discover other drugs on you, they will probably
  confiscate them and you will face a possible penalty of up to 15,000
  CZK (approx. 600 EUR).
      Possession of the following quantities of drugs is not a criminal act:

15 grams of Marijuana
5  grams of Hashish
1.5  grams of Heroin
2  grams of Pervitin
1  gram of Cocaine
4  pills or capsules of Ecstasy
5  pills, papers or crystals of LSD
40  halucinogenous mushrooms

There is also information on the site that says that growing 5 plants of Marijuana for personal use is permitted in the Czech Republic. It seems to be true, because there are 2 shops in Prague that are selling seeds and equipment.
I found another website that is selling marijuana seeds. They say that they are shipping only to countries where having marijuana seeds is legal:

United Kingdom
Czech Republic
Belgium
Comment: Growing harijuana is not really permitted; but selling seeds and other equipment is not forbidden. Also, I recommend sticking to 10 grams rather than 15 grams, the boundary is not well-defined and you don't want to get into troubles.
Answer: The Czech police website has a good overview of the current legal situation, albeit only in Czech.

Selling marijuana for whatever amount of money or services is a criminal offence, punishable for one to five years in prison:

§ 187
  Nedovolená výroba a držení omamných a psychotropních látek a jedů
(1) Kdo neoprávněně vyrobí, doveze, vyveze, proveze, nabízí, zprostředkuje, prodá nebo jinak jinému opatří nebo pro jiného přechovává omamnou nebo psychotropní látku, přípravek obsahující omamnou nebo psychotropní látku, prekursor nebo jed, bude potrestán odnětím svobody na jeden rok až pět let.

Buying marijuana isn't a specific criminal or civil offense, however it obviously leads to possession.
Possession of marijuana is a civil offense, as long as the quantity of the drug is for personal consumption. If one is found to be in violation of this law, they may be fined by up to 15000CZK (~550EUR). However it's rare for the police to care about this particular misdemeanor, so most drug users are ignored.

(1) Přestupku se dopustí ten, kdo
j) neoprávněně přechovává v malém množství pro svoji potřebu omamnou nebo psychotropní látku
(2) Za přestupek podle odstavce 1 písm. a) až d) lze uložit pokutu do 3 000 Kč, za přestupek podle odstavce 1 písm. e) a f) pokutu do 5 000 Kč a zákaz činnosti do 1 roku, za přestupek podle odstavce 1 písm. g) až i) pokutu od 25 000 Kč do 50 000 Kč a zákaz činnosti od 1 do 2 let a za přestupek podle odstavce 1 písm. j) a k) pokutu do 15 000 Kč

What quantity of marijuana is considered to be for personal consumption is not strictly defined, however the Supreme Court has recommended 10 grams to be used as a cut-off.
Smoking marijuana isn't defined as a separate offence, however it's obviously impossible without possessing a certain quantity. Likewise there's no separate offence for being intoxicated from marijuana.
Growing marijuana is also illegal. Keeping up to 5 plants is a civil offense (punishable by a fine of up to 15000CZK) or a criminal offense if more than 5 plants are grown:

Konopí lze pěstovat i doma, ale pouze do obsahu THC 0,3%, což je uvedeno v zákoně č. 167/1998 Sb. o návykových látkách a jedná se o tzv. technické konopí. Pokud z něj následně budu vyrábět drogu marihuana, nejedná se zcela jistě o tzv. technické konopí s obsahem účinné látky THC do 0,3% a tudíž se jedná buď o přestupek podle § 30 odst. 1 písm. k) zák. č. 200/1990 Sb. o přestupcích, přičemž za malé množství se považuje rozsah do pěti rostlin. Šest a více rostlin pěstovaných s obsahem THC vyšším než 0,3% je považováno za trestný čin podle § 285 trestního zákoníku č. 40/2009 Sb. A to platí pro jakékoliv pěstování, tedy i pro léčebné účely, pokud nejsem držitelem udělené licence Ministerstvem zdravotnictví ČR. Výroba návykové látky je trestným činem podle § 283 tr. zákoníku, bez ohledu na množství vyráběné drogy.

Medical marijuana has been legal since 2015, however prescriptions from other countries are not valid. The conditions of getting a prescription from a local doctor are much stricter than in places like California, so it's not something feasible for a tourist.
Comment: @bdsl civil = punishable by fines only, like parking violations. criminal = potential jail time
Comment: What is the distinction between civil and criminal here? As I understand the terms in an English context it is only possible to be fined for criminal offences. Other people can sue me for civil wrongs but the state won't issue fines for them.
Answer: Small Amounts are legal. Transport and cultivation are decriminalized. It is still illegal to sell it though. The legal amount for possession is up to 15 grams.
Comment: Do you have a reference for your claim?
Comment: "Decriminalized" != Legal. Marijuana is decriminalized in many jurisdictions in the US, but still illegal - in most of those it is a **violation** punishable by a small fine, similar to, for instance, drinking in public, or jaywalking. You've used the two terms interchangeably however, so this answer is not helpful.
Comment: Smoking in the streets is just tolerated, you could potentially be charged with a misdemeanor.
Comment: what about smoking on the street? legal or just tolerated?
Comment: I think the main thing is that legal != legal, that term has at least two common meanings in English, namely "explicitly allowed in statutes" and "not punished by the legal system". It could be expressed more carefully but terminological quibbles aside, I find the answer useful.


How do I get my pc to add my AV receiver to it so I can use it for sound ouput?

Question: How do I get my pc to add my AV receiver to it so I can use it for sound ouput? I am trying to get sound from my pc that is connected to my av receiver. Do I need to load a driver or something? I have AV receiver and my pc in connected to it using HDMI and AV receiver to TV HDMI. I am not getting sound out of my PC to my AV receiver but video is getting to TV.
Comment: To the OP. You need to be specific about what AV equipment you have and how you intend to attach it to your machine. if you are speaking of the sound>out to the AV you would want to include RCA jacks? Stereo?
Comment: I've updated my question.
Comment: Do you have sound via headphones / external speakers?
Answer: Does the TV support sound? Check if you can get sound out with the TV disconnected from the AV Receiver.
While my setup is a bit different (Computer:HDMI --> AV Reciever:HDMI --> TV:DVI) I've learned that the EDID the PC saw was that of the TV. As the TV had DVI and not HDMI, the PC didn't think sound was supported and only sent video. Thanks to the drivers not having an override function (nVidia, Windows) I had to create a custom cable between the AV and TV that blocked the EDID of the TV. Thus the EDID of the AV was instead sent to the Computer and I got my sound and video.
(The cable was a 6" HDMI with its data lines cut :P its a good SONY AV reciever, so the computer still allows HDCP playback! but YMMV)


When to use conoscere, other than saying you know someone

Question: I was always taught to use sapere to say that I know something and conoscere to say that I know someone. However, I get the feeling that this is just a heuristic for new speakers, and I'm wondering if there's a more correct/thorough rule for when to use conoscere instead of sapere. I'm specifically wondering about instances other than references to people, such as, "Yes, I know Janet."
Comment: The statement "Yes, I know Janet" could mean either 'I am aware of that fact, Janet' or 'I am acquainted with Janet'. https://www.collinsdictionary.com/dictionary/english/know
Comment: If I were saying "I am aware of the fact, Janet", I would need to add a comma before Janet. I hope that the context is clear enough.
Answer: Though they both translate "to know" in English "sapere" and "conoscere" are not always interchangeable. See the following extract for details:

Sapere and conoscere are a couple of Italian verbs that are often missed or interchanged. Many think they can be used indifferently, but it is not the case.
Yes, in English and some other languages there is just one verb which happens to be to know.
Instead, in  Italian sapere and conoscere are used with different meanings and describe a different idea, thus, it goes without saying that they are not interchangeable.
CONOSCERE:
Conoscere is used with people, places or things and its meaning is to be familiar or acquainted with a person, a place, a thing, a situation or an event. In short, it is possible to say that conoscere is followed just by nouns. You will never see conoscere faith another verb (which instead, is likely to happen with sapere).

Conosco la geografia italiana molto bene. (I know very well Italian geography)
Conosci il nuovo ragazzo francese al corso di italiano? (Do you know the new French guy at the Italian course)
Conosciamo molto bene la città di Lucca, è incantevole! (We know Lucca very well …)

SAPERE:
Sapere means to be aware of something, and especially in the questions is often used to ask for a piece of information.

Non lo so (I don't know)
Scusi, sa dove si trova la stazione? (Excuse me, do you know where is the station?)
Sappiamo che è stato trovato un gatto nel vostro giardino (We know that a cat was found in your garden)

To put it in another way, sapere is used when we find out something by our mental faculties, while conoscere is used when we find out something or someone by our physical faculties.
SAPERE AS A MODAL VERB:
SAPERE is also used as a modal verb when it is accompanied by an infinitive verb. In this case, it is used to say that you know HOW to do something, that you have an ability or a skill.

So parlare molto bene italiano, ma non so cucinare per niente!
Sai suonare la chitarra?

(Source: italianpills.com)


What are the best ways to measure end user web site performance?

Question: I know of a couple tools to measure end user web site performance and I'm wondering what else is out there. The two major ones I know of are yslow and Google's page speed.
Answer: AOL's WebPageTest
Comment: Yeah, I just found this the other day in another answer here.  Awesome resource.  Especially like the video option! +1
Comment: This tool is okay but it has one major bug - it counts EVERY image in the stylesheet, even if the image is not used on a page. This is a known issue but they're doing a major rewrite so it may be a while before it's fixed.
Comment: Also, last time I used it it added 20+ seconds loading time for the Facebook like button!
Answer: Google has another tool within Google Webmaster tools.  Go to your site within Webmaster Tools, click on Labs, and then Site Performance.  This will show you what Google believes to be your sites overall performance and average load time.  It will also list suggestions on what pages are slowing you down.  The tool is relatively new and as such isn't great.
Microsoft provides a tool within the SEO Toolkit that is now included in IIS7.  When you do a Website Analysis of your site it will tell you how long it took to load each page.
Answer: Zoompf & MSFast/MySpace's Performance Tracker are two other notable free web performance analysis & optimization tools
Answer: What I've gotten in the habit of doing is loading up firebug, which measures every file loading to the ms, and then jumping on a proxy like Tor.  Then I can see in real time which files are taking too long to load in say Germany or Australia.  Usually at throttled speeds not much faster than dial up.
I'm sure the other serveces mentioned are great but this is a real world way to do it.
Answer: Octagate's Site Timer provides a graphical view of the load time if you want a web site, or you can get similar statistics with Chrome and Opera's developer tools.
Answer: gtmetrix.com is similar to webpagetest.org, but another option as well.
Comment: +1 Good one, I use gtmetrix for my testing. It really does a good job.
Answer: There's a very good metric that never fails for when we tweak (or sometimes un-tweak) our highly successful website. If the pages are even 0.5 of a second slower, sales drop by up to 30%. Sounds crazy, but it's true. When I remember to enable GZip compression and minify our JS/CSS and switched to sprites our sales went up.
Comment: this does not answer the question.


Having some trouble installing node package manager

Question: I installed node.js with these commands:
<code>$ sudo git clone --depth 1 https://github.com/joyent/node.git
$ cd node
$ export JOBS=2
$ sudo mkdir ~/local
$ sudo ./configure --prefix=$HOME/local/node
$ sudo make
$ sudo make install
$ export PATH=$HOME/local/node/bin:$PATH
</code>
It executed without error. Not sure how to confirm that node.js is actually installed though.
I then tried to install node package manager with the following commands:
<code>$ sudo git clone http://github.com/isaacs/npm.git
$ cd npm
$ sudo make install
</code>
The last command had a lot of output but the last few lines were:

make[1]: Entering directory `/var/www/node/npm'
node cli.js install https://github.com/isaacs/ronnjs/tarball/master
bash: node: command not found
make[1]: *** [node_modules/ronn] Error 127
make[1]: Leaving directory `/var/www/node/npm'
make: *** [man/man3/author.3] Error 2

npm does not get installed, but the directory is there. Not sure what I need to do?
Answer: On ubuntu your path is not copied into the sudo context. For last command try:
<code>$ sudo env PATH=$HOME/local/node/bin:$PATH make install
</code>


How to slow down a typography effect in after effects?

Question: I'm using Adobe After Effects 2014 and I have got a royalty-free template of a typography effect. And it's really fast, I want to increase the duration of the effect(when the text is in focus in the video so I can give it a bit more reading time) without distorting it by like slowing the whole video down. How can I do that?
Comment: you need to include more information. is it keyframed? is it using an animator? is it using expressions?
Answer: Assuming that it is a template applied to a text layer in a comp, select the text layer and press "u" to reveal any keyframes on that layer.  Drag the keyframes out to the duration you need.
If the comp isn't long enough, press Command K to reveal the comp settings, extend the duration.  Extend the duration of the text layer by dragging the end of it further to the right.


Document image vanishing point detection and evaluation

Question: It is a natural idea to substitute our scanner with mobile phone, and perform OCR with the phone at the same time. If this can come true, two problems must be tackled: one is related to document image binarization, and the other is related to geometric distortion correction. Among all the distortions, projective distortion is most common, and in order to correct this kind of distortion usually the horizontal vanishing point and vertical vanishing point must be identified. There are many different ways to obtain the vanishing points, and different methods can lead to different vanishing points. Then my question is given several candidate vanishing points (horizontal vanishing points, for example) how can we select the best one? Of course we can get the projective transform model based on each vanishing point, and then correct the distorted image. Visual evaluation the corrected image can tell which vanishing point is better. But could I find the best vanishing point just before the correction? Thanks!
Answer: why use OCR techniques that are sensitive to vanishing points?
projective distortion just skews the letters- right?  So, why not just model those expected skews into the OCR templates for each letter?  Also, the nearby letters would skew similarly, so you could probably use correlated parallel lines among neighboring letters to estimate the amount of local/global skew (and avoid dealing with VPs).
also, I assume you mean the phone will take a pic of the document, so don't you also have to worry about the paper not being flat and having curve linear distortions too, which seems to me would completely confound, and supersede any vanishing point issue you are worried about.
Answer: Maybe I'll carry the discussion to another level, but I disagree with the fact that you need to explicitly correct for perspective distortions or even binarize the image. Many state-of-the-art techniques, which are based on deep learning, are rather successful in performing correction-free OCR. These are generally termed "end-to-end" OCR. They already outperform their processing-based counterparts with a significant margin. A quick google search yields:

https://www.robots.ox.ac.uk/~vgg/publications/2016/Jaderberg16/jaderberg16.pdf
http://www.whuang.org/papers/phe2016_aaai.pdf
https://crypto.stanford.edu/~dwu4/papers/HonorThesis.pdf
https://arxiv.org/abs/1603.03101
https://arxiv.org/abs/1511.06841
https://arxiv.org/pdf/1604.03286.pdf


Find a point on a line segment, located at a distance $d$ from one endpoint

Question: Given points $A$ and $C$ in the plane, how do I find the point $B$ on the line segment between $A$ and $C$ that is located at a distance $d$ from $A$?
Example:
$$A = (0,3), \qquad  C = (3,0), \qquad d=1$$
Comment: Definitely not algebraic geometry. Or multivariable calculus for that matter.
Comment: Could you be more specific? On a side note, I need to implement this in code.
Answer: You could use a parametrization:
Given $A=(a_1, a_2)$ and $B=(b_1,b_2)$, the a parametrization of the line segment $AB$
from $A$ to $B$ is
$$
\eqalign{
x(t) &= a_1 + (b_1-a_1)t\cr
y(t) &= a_2 +(b_2-a_2)t
}\ \ ;\ \ \ \ 0\le t\le1.
$$
With this parametrization, $t_d\cdot100\%$ of the line segment is traced out as $t$ increases from $t=0$ to $t=t_d$.
So,
if you want the coordinates of the point $C$ on the line segment whose distance from  $A$ is $d$, first compute the ratio of $d$ to the length of $AB$ and set this equal to $t_d$:
$$
t_d={d\over \sqrt{(a_1-b_1)^2+(a_2-b_2)^2 }}.
$$
Then evaluate the coordinates of $C=(x_C,y_C)$ as $C=\bigl( x(t_d), y(t_d)  \bigr)$.
That is, the coordinates of $C$ are
$$
\eqalign
{
x_C&=a_1+{d(b_1-a_1)\over \sqrt{(a_1-b_1)^2+(a_2-b_2)^2 }}\cr
y_C&=a_2+{d(b_2-a_2)\over \sqrt{(a_1-b_1)^2+(a_2-b_2)^2 }}.\cr
}
$$
Answer: The following is a very useful fact.  The points in the interval from $(a,b)$ to $(c,d)$ are precisely the points $(x,y)$ such that
$$x=(1-t)a+ tc,\qquad y=(1-t)b+td,\tag{$\ast$}$$
where $t$ ranges over the interval from $0$ to $1$.  Moreover, this point $(x,y)$ divides the interval from $(a,b)$ to $(c,d)$ in the ratio $t:1-t$.  To put it another way, the distance from $(a,b)$ to $(x,y)$ is $t$ times the distance from $(a,b)$ to $(c,d)$.
We will use $(\ast)$, with $(a,b)=(0,3)$ and $(c,d)=(3,0)$.
The distance from $(0,3)$ to $(3,0)$ is $\sqrt{18}$, or more simply $3\sqrt{2}$. If $B$ is to be at distance $d$ from $A$, we want $t:1 =d:3\sqrt{2}$.
So $t=\dfrac{d}{3\sqrt{2}}$. Finally, use this value of $t$ in $(\ast)$ to find the coordinates $(x,y)$ of $B$.
Answer: The direction from $\rm A$ to $\rm C$ is parallel to the displacement $\rm \vec{w}=\overline{AC}$. Normalizing (dividing through by the magnitude of the displacement), the direction (as a unit vector) is exactly
$$\rm \vec{v} = \frac{\vec{w}}{\|\vec{w}\|}.$$
Now if $\rm \vec{u}=\overline{AB}$ is parallel to $\rm \vec{v}$ and has magnitude $\rm d$, and $\rm \vec{B}=\vec{A}+\vec{u}$, then...

In your example, the displacement from A to C is $\rm \vec{C}-\vec{A}=(3,-3)$. Normalizing,
$$\rm \vec{v}=\frac{(3,-3)}{\sqrt{3^2+(-3)^2}}=\left(\frac{1}{\sqrt{2}},-\frac{1}{\sqrt{2}}\right).$$
Multiplying this by d and tacking it onto A, we have
$$\rm \vec{C}=\vec{A}+1\left(\frac{1}{\sqrt{2}},-\frac{1}{\sqrt{2}}\right)=\left(\frac{1}{\sqrt{2}},3-\frac{1}{\sqrt{2}}\right).$$
Comment: Ok, thank you very much.


What makes columnar databases suitable for data science?

Question: What are some of the advantages of columnar data-stores which make them more suitable for data science and analytics?
Answer: A column-oriented database (=columnar data-store) stores the data of a table column by column on the disk, while a row-oriented database stores the data of a table row by row.
There are two main advantages of using a column-oriented database in comparison
with a row-oriented database. The first advantage relates to the amount of data one's
need to read in case we perform an operation on just a few features. Consider a simple
query:
SELECT correlation(feature2, feature5)
FROM records

A traditional executor would read the entire table (i.e. all the features):

Instead, using our column-based approach we just have to read the columns
which are interested in:

The second advantage, which is also very important for large databases, is that column-based storage allows better compression, since the data in
one specific column is indeed homogeneous than across all the columns.
The main drawback of a column-oriented approach is that manipulating (lookup, update or delete) an entire given row is inefficient. However the situation should
occur rarely in databases for analytics ("warehousing"),
which means most operations are read-only, rarely read many attributes in the same
table and writes are only appends.
Some RDMS offer a column-oriented storage engine option. For example, PostgreSQL
has natively no option to store tables in a column-based fashion, but Greenplum has
created a closed-source one (DBMS2, 2009). Interestingly, Greenplum is also behind
the open-source library for scalable in-database analytics, MADlib (Hellerstein et al.,
2012), which is no coincidence. More recently, CitusDB, a startup working on high speed, analytic database, released their own open-source columnar store extension for
PostgreSQL, CSTORE (Miller, 2014). Google's system for large scale machine learning
Sibyl also uses column-oriented data format (Chandra et al., 2010). This trend
reflects the growing interest around column-oriented storage for large-scale analytics.
Stonebraker et al. (2005) further discuss the advantages of column-oriented DBMS.
Two concrete use cases: How are most datasets for large-scale machine learning stored?
(most of the answer comes from Appendix C of: BeatDB: An end-to-end approach to unveil saliencies from massive signal data sets. Franck Dernoncourt, S.M, thesis, MIT Dept of EECS)
Comment: That is an awesome answer.  Beautifully explained.  Thank you.
Comment: This is a very well written response, and the diagrams are very helpful. The references are also appreciated.
Comment: Now consider k-means clustering or SVM with columnar layout...
Answer: It depends on what you do.
Column stores have two key benefits:

whole columns can be skipped
run-length compression works better on columns (for certain data types; in particular with few distinct values)

However they also have drawbacks:

many algorithms will need all columns, and only record at a time (e.g. k-means) or may even need to compute a pairwise distance matrix
compression techniques only work well on sparse data types and factors, but not well on double-valued continuous data
appends on column stores are expensive, so it is not ideal for streaming / changing data

Columnar storage is really popular for OLAP aka "stupid analytics" (Michael Stonebraker) and of course for preprocessing where you may indeed be interested in discarding whole columns (but you would need to have structured data first - you don't store JSONs in columnar format). Because the columnar layout is really nice for e.g. counting how many apples you have sold last week.
For much of the scientific / data science use cases, array databases appear to be the way to go (plus, of course, unstructured input data). E.g. SciDB and RasDaMan.
In many cases (e.g. deep learning), matrixes and arrays are the data types you need, not columns. MapReduce etc. can still be useful in preprocessing, of course. Maybe even column data (but array database usually support a column-like compression, too).
Answer: I haven't used a columnar database, but I've used an open source columnar file format called Parquet, and I think the benefits are probably the same -- faster processing of data when you only need to query a small subset of a large number of columns. I had a query running on about 50 terabytes of Avro files (a row oriented file format) with 673 columns that took about an hour and a half on a 140 node Hadoop cluster. With Parquet, the same query took about 22 minutes because I only needed 5 columns.
If you had a small number of columns or were using a large proportion of your columns, I don't think a columnar database would make much of a difference vs a row oriented one because you would still have to basically scan all of your data. I believe columnar databases store columns separately whereas row oriented databases store rows separately. Your query will be faster any time you're able to read less data from disk.
This link explains more of the details.
Answer: Note: This is my question, and I'm really thankful for the wonderful answers here, which helped me grasp the concept.
So, I would explain the concept the way which I have understood:
Generally, the data in the databases are stored in the memory in the following formats:
Consider this datum:
           X1         X2
1   0.7091409 -1.4061361
2  -1.1334614 -0.1973846
3   2.3343391 -0.4385071

In a relational row-based store, it is stored like this:
1, 0.7091409, -1.4061361, 2, -1.1334614, -0.1973846, 3, 2.3343391, -0.4385071

in the form of rows.
In the columnar store, it would be stored like this:
1, 2, 3, 0.7091409 ,-1.1334614, 2.3343391, -1.4061361, -0.1973846, -0.4385071

in the form of columns.
So, what does this mean?
This means that insertion(and updating) and deletions are fast in the row-based column store as it is just removal of the last few values or the first few values.  However, it is not the case in columnar stores as the value in each block store needs to be removed.
However, when there is the need for columnar aggregates and operations, the columnar stores have an edge over their row-based counterparts, as they are stored column-wise, and as a result, accessing individual columns is very easy.


Graph homomorphisms vs. graph minors

Question: I'm new to the concept of graph minors, and they feel very much like homomorphisms to me. Initially I thought to myself, "why do graph theorists call a homomorphic graph a minor?" Of course, then I learned that there's a different concept of homomorphic graphs. So my question: is there nonetheless a relationship between these concepts? Does "$H$ is a minor of $G$" imply "$G$ is homomorphic into $H$?" I'm guessing the other direction is false; if so can somebody give a counterexample? Thank you!
Answer: Minors and homomorphisms are unrelated. Here are some examples to think about. There is a graph homomorphism from any bipartite graph to any non-discrete graph (any graph with an edge). Any cycle $C_n$ is a minor of any bigger cycle $C_m$ ($m\geq n$), but there is no homomorphism from a cycle of odd order to a cycle of even order.
In particular, $C_4$ is a minor of $C_5$, but there is no homomorphism from $C_5$ to $C_4$.
Comment: Ah, thanks! Those examples make it clear that there's a substantial difference here.
Answer: Well, you are curios about the most must difficult questions in graph theory.
There is no easy connection. But there are some connections known and establishing more connection will make big research progress.
A good nontrivial example is a slight extension of the four color theorem:
If $G$ has no $K_5$ as minor then it admits a homomorphism to $K_4$.
Also see the two operations are very similar:
to get a minor you pick a pair of adjacent vertices and identify them. The you may repeat this again in the new graph and again...
to get a homomorphic image you pick a pair of non-adjacent vertices and you identify them, and may repeat...
Hope this helps

Graph homomorphisms vs. graph minors


How can you decompile a smart contract?

Question: On the blockchain I can inspect the code of a contract, and see the EVM opcodes. Is there a way to decompile this and convert it back to (Solidity) source code?
Comment: how can you see the EVM opcodes?
Answer: Compilation back to the original source code is impossible because all variable names, type names and even function names are removed. It might be technically possible to arrive at some source code that is similar to the original source code but that is very complicated, especially when the optimizer was used during compilation. I don't know of any tools that do more than converting bytecode to opcodes.
Since contracts can access their own code and thus (ab)use the code for storing data, it is not always clear whether some part of the code is actually used as code or only as mere data and whether it makes sense to try and decompile it. It is computationally undecidable whether some piece of the code is reachable or not.
Note that there is no dedicated area to store creation-time fixed data (like lookup tables, etc). Apart from the code of the contract, it would also be possible to store the data in storage, but that would be way more expensive, so putting such data in the code is actually a common thing.
Comment: @euri10 Creators can provide the source code, and by building it with the same version of the compiler, you can verify it compiles to the same bytecode. Some blockchain explorers, like ether.camp, provide this functionality built-in.
Comment: so if i look for instance at this contract https://etherchain.org/account/0x121d30ecf48b11edd651249a3a110f48d42ba710#codeDisasm which claims to be a 50/50 coinflip here (https://medium.com/@kpcb_edge/our-thoughts-on-ethereum-continued-3e7383c63779#.p1dmc5dmx) : is there a way to be sure it does effectively what it says he does ? how people can send money to contracts if they can't 'read' the code ?
Comment: Great info. Just to clarify general reachability is undecidable but many if not most practical specific reachability problems are decidable. Consider that linters will point out unused functions.
Answer: There is a project Porosity now https://github.com/comaeio/porosity
It's also integrated into Quorum toolchain https://www.coindesk.com/first-ethereum-decompiler-launches-jp-morgan-quorum-integration/
Comment: JEB Decompiler provides good results, it is a pro tool (not free) but they have a downloadable demo here https://www.pnfsoftware.com/blog/ethereum-smart-contract-decompiler/
Comment: I have tried this tool. Its not stable as of yet.https://github.com/comaeio/porosity/issues/30
Comment: @MarcelFalliere That's an interesting tool.  Thanks.
Answer: it is impossible to return back to the solidity code. you could just decode the Bytecode into opcodes.
look at this exemple : https://etherscan.io/opcode-tool?a=0x9e1b57fc92eba6434251a8458811c32690f32c45
Comment: but the problem should not be considered done when you finished at opcodes. what post author wanted is source code.
Answer: In general as other users commented it is not possible to get back the original source code in practice. In theory, however, both compiled and source applications should produce exactly the same output (i.e. have the same semantics) so it should be possible to get a program in source code representation that does exactly the same thing as the bytecode. People have mentioned other decompilers such as Porosity. There are also decompilers (to an intermediate representation) called Mythril, EthIR and Vandal. As a user in  2018, the most complete decompiler available is https://www.contract-library.com. It's not a stand alone tool, but can decompile most of the contracts that are currently on the Ethereum mainnet and other testnets.
And this is the contract Badr Bellaj suggested:
https://contract-library.com/contracts/Ethereum/0x9e1b57fc92eba6434251a8458811c32690f32c45
As you can see, even some of the function names are inferred automatically, based on the knowledge it acquired when trying to understand past contracts. Overall, decompilers for Ethereum are currently not designed to have their output optimized for human consumption, however they are optimized for consumption by other machines (algorithms) that can find security vulnerabilities.
Comment: I don't think Mythil does any decompilation. It can _disassemble_ code and show a tree-like control-flow graph (it doesn't detect loops in this graph), but I think that is far from what a decompiler does.
Comment: That is correct. I was including any tool that raises the level of abstraction. In this case both Mythril and Vandal do that to varying degrees but do not present a source-level view of the code.
Answer: List of Modern Tools (2022 and beyond)

Etherscan's Bytecode to Opcode Disassembler.
EtherVM's Online Solidity Decompiler.
Answer: This isn't a full answer, but describes an approach for which one might write a decompiler to Solidity that may be better than many of the existing decompilers.
It draws on experience in a Python decompiler I developed and maintain.
chriseth's excellent accepted answer describes the general case, and assumes you want decompilation to work in all situations over all of the code.
But many times this might not be the situation. Here are some scenarios where you may be able to do better than in the general case:

Suppose the code I want to decompile is a variant of code for which I do have the source code available. (This is also mentioned in Neville Grech's answer.) Maybe the bytecode/ewasm was generated from an older or newer version of source I do have. Here, I can draw on the fact that many of the variable names and their types I already do know, it is just that there may be some slight differences in the code. Even if a variable "err" in the source code I have is changed to "error" in the lost source code that was used in compilation, as long as the types are the same, it's not so bad to use variable name "err" even though it was "error". It is likely to give a more helpful name than an arbitrarily-fabricated name.
solc prior to the yul-based optimization does stack optimization and some local optimization but not the more disruptive kinds of "global" optimization. Even with optimization it may be possible to pattern match sequences of operation to obtain larger structures like assert and require. In Python I use a J. Earley parser which is cool because it allows grammars to be given in an ambiguous way. That is, a sequence of opcodes might match a grammar, several different high level constructs. But that's okay, because that is in fact the nature of the game. In decompilation you should not expect to get something that is exactly the source (although that can happen). Instead you should get something that is equivalent.

If additionally you happen to know the solc version that was used in compilation and/or the optimization level, that can further help to narrrow patterns that could possibly be emitted and hence shorten the grammar and make it less ambiguous. If the solc version is before 0.5 or so range you know that yul optimization is not a thing.
I am sure in solc there is boilerplate code all over the place. For example at beginning of contracts. That code can be matched. There is boilerplate code that solc uses to see if index in a dynamic array is acceptable. If this pattern of code is unique, then we might be able to infer that there is a dynamic array in use. Simlarly code that issues a "new" might fall into pattern-matching recognition.
Note: why do I write that you match on opcodes and not instructions (i.e. opcode and operand pair)? This is because if you are doing pattern matching you want to abstract a little bit; using the opcode for the instruction does that. In those cases where operand information should be included, what is done in the Python decompiler is that the opcode changes to reflect this additional piece of abstraction. There is nothing that dictates that you have to match on existing EVM opcodes. You can make up new opcodes, insert opcodes that might indicate control structure boundary or change some opcode names to assist in pattern matching.

Sometimes you are not interested in decompiling all of the code, just a piece of it.
Answer: I found Solidity decompiler here https://www.ethervm.io/decompile

How can you decompile a smart contract?