One topic which was covered in university, but which I never understood, is how a spinning top "magically" resists the force of gravity. The conservation of energy explanations make sense, but I don't believe that they provide as much insight as a mechanical explanation would.

The hyperphysics link Cedric provided looks similar to a diagram that I saw in my physics textbook. This diagram illustrates precession nicely, but doesn't explain why the top doesn't fall. Since the angular acceleration is always tangential, I would expect that the top should spiral outwards until it falls to the ground. However, the diagram seems to indicate that the top should be precessing in a circle, not a spiral. Another reason I am not satisfied with this explanation is that the calculation is apparently limited to situations where: "the spin angular velocity $\omega$ is much greater than the precession angular velocity $\omega_P$". The calculation gives no explanation of why this is not the case.


Question: Reverse a month name to month number conversion
Answer: You should just be able to replace:

for(var j=0;j&lt;months.length;j++){
    if(date[1]==months[j]){
         date[1]=months.indexOf(months[j])+1;
     }                      
} 
if(date[1]&lt;10){
    date[1]='0'+date[1];
}           


with:

date[1] = months[parseInt(date[1],10)-1];


The parseInt will take your string 01 through 12 and give you the integral value, then you subtract one to get the index and look up the equivalent month name (I guess, though I'm not familiar with that specific language).

In other words, the final code would be:

var date = f.task_end_date.value.split("/");
var months = ['Sau', 'Vas', 'Kov', 'Bal', 'Geg', 'Bir','Lie', 'Rgp', 'Rgs', 'Spa', 'Lap', 'Grd'];
date[1] = months[parseInt(date[1],10)-1];
var formattedDate = date[0] + date[1] + date[2];




You can also avoid parseInt() if you wish since Javascript will treat a string as a number (via the ToNumber operation) when you subtract one:

date[1] = months[date[1]-1];


It probably won't reduce the actual work being done since the conversion from string to numeric has to be done whether explicit or implicit (it may even be slower since the implicit conversion has to handle the possibility of hex values but it's unlikely to matter a lot either way).

So, if you value succinctness of code, it's certainly an option. I prefer the explicit version myself but you may have other priorities.