Monday, April 9, 2012

Yahoo! Mojito - The Ultimate MVC Framework for Web Apps

Probably. Well, I feel it at least as of date.

More often than not, the web application developers end up in doing the following:
  1. Create a server side logic of the application with all code in PHP, Java, Python, Ruby, C# and what not languages
  2. Choose amazing server side frameworks like CodeIgniter, Struts / JSF, Django, RoR, ASP.Net MVC and what not amazing (MVC or otherwise) frameworks
  3. Create a client side view of the application using HTML / JavaScript / CSS for web, Java for Android, Objective C for iOS etc
  4. Create a middleware for client-server transaction, typically using JSON / XML as content format and serializers and deserializers on either sides in corresponding language (server / client sides)
The issues that typically arise are:
  1. Ensure that the server and client sides of the middleware are always in sync in terms of their contracts
  2. Ensure that the end-points are correctly defined and both the sides are kept in sync
  3. Ensure that the end-points are correctly registered in web.xml, web.config, routes.rb, appropriate Python / PHP files etc
  4. Ensure that if multiple requests are fired to the server to retrieve data, you manage the responses appropriately (this is relatively easier because of jQuery / YUI structures)
I am pretty confident, there are a lot more problems pertaining to client <=> server interaction and state maintenance but these are some of the important ones. I'd love to hear about more crucial issues...

Wouldn't it be great if it would be possible to answer "YES" for the following...
  1. Can I just do a MyModel.getData(myCallbackFunction) and don't worry if the piece of code is called on the server or the client?
  2. Can I just call a business operation doWork and don't worry if it needs data which may have to be retrieved from the server or the client?
  3. Can I just call an operation doWork and don't worry if it actually gets called on the client or the server?
Well, that's where - and for lot more reasons - Yahoo! Mojito framework comes into picture.

It seems I just can't wait to write about it... one piece at a time. btw, my enhancements to Mojito are available at Github at https://github.com/gvaish/mojito

Sunday, April 8, 2012

Speed of Light - in Vedas

[This article is reproduction of an exciting content found elsewhere.]

Speed of light in Rigveda: (Originally from http://on.fb.me/IpQAF2, a long commentary at http://bit.ly/I55raN)

Ancient Vedic science “Nimisharda” is a phrase used in Indian languages of Sanskrit origin while referring to something that happens/moves instantly, similar to the ‘blink of an eye’. Nimisharda means half of a Nimesa, (Ardha is half).

In Sanskrit ‘Nimisha’ means ‘blink of an eye’ and Nimisharda implies within the blink of an eye. This phrase is commonly used to refer to instantaneous events.

Below is the mathematical calculations of a research done by S S De and P V Vartak on the speed of light calculated using the Rigvedic hymns and commentaries on them.

The fourth verse of the Rigvedic hymn 1:50 (50th hymn in book 1 of rigveda) is as follows:

तरणिर्विश्वदर्शतो जयोतिष्क्र्दसि सूर्य | विश्वमा भासिरोचनम |
taraNir vishvadarshato jyotishkrdasi surya | vishvamaa bhaasirochanam ||

which means:
“Swift and all beautiful art thou, O Surya (Surya=Sun), maker of the light, Illumining all the radiant realm.”

Commenting on this verse in his Rigvedic commentary, Sayana who was a minister in the court of Bukka of the great Vijayanagar Empire of Karnataka in South India (in early 14th century) says:
" tatha ca smaryate yojananam. sahasre dve dve sate dve ca yojane ekena nimishardhena kramaman." which means “It is remembered here that Sun (light) traverses 2,202 yojanas in half a nimisha”

NOTE: Nimisharda= half of a nimisha.


In the vedas Yojana is a unit of distance and Nimisha is a unit of time.

Unit of Time: Nimesa.
The Moksha dharma parva of Shanti Parva in Mahabharata describes Nimisha as follows: 15 Nimisha = 1 Kastha.

30 Kashta = 1 Kala,
30.3 Kala = 1 Muhurta,
30 Muhurtas = 1 Diva-Ratri (Day-Night),
We know Day-Night is 24 hours So we get 24 hours = 30 x 30.3 x 30 x 15 nimisha, in other words 409050 nimisha.

We know 1 hour = 60 x 60 = 3600 seconds.
So 24 hours = 24 x 3600 seconds = 409050 nimisha.
409050 nimesa = 86,400 seconds,
1 nimesa = 0.2112 seconds (This is a recursive decimal! Wink of an eye=.2112 seconds!).
1/2 nimesa = 0.1056 seconds.

Unit of Distance:
Yojana Yojana is defined in Chapter 6 of Book 1 of the ancient vedic text “Vishnu Purana” as follows:-
10 ParamAnus = 1 Parasúkshma,
10 Parasúkshmas = 1 Trasarenu,
10 Trasarenus = 1 Mahírajas (particle of dust),
10 Mahírajas= 1 Bálágra (hair’s point),
10 Bálágra = 1 Likhsha,
10 Likhsha= 1 Yuka,
10 Yukas = 1 Yavodara (heart of barley),
10 Yavodaras = 1 Yava (barley grain of middle size),
10 Yava = 1 Angula (1.89 cm or approx 3/4 inch),
6 fingers = 1 Pada (the breadth of it),
2 Padas = 1 Vitasti (span),
2 Vitasti = 1 Hasta (cubit),
4 Hastas = a Dhanu,
1 Danda, or paurusa (a man’s height),
or 2 Nárikás = 6 feet,
2000 Dhanus = 1 Gavyuti (distance to which a cow’s call or lowing can be heard) = 12000 feet 4 Gavyutis = 1 Yojana = 9.09 miles

Calculation: So now we can calculate what is the value of the speed of light in modern units based on the value given as 2202 Yojanas in 1/2 Nimesa = 2202 x 9.09 miles per 0.1056 seconds = 20016.18 miles per 0.1056 seconds = 189547 miles per second !!

As per the modern science speed of light is 186000 miles per second ! And so I without the slightest doubt attribute the slight difference between the two values to our error in accurately translating from Vedic units to SI/CGS units. Note that we have approximated 1 Angula as exactly 3/4 inch. While the approximation is true, the Angula is not exactly 3/4 inch.