Wednesday, August 17, 2011

Mini Speed Breaker

The idea behind speed breaker is breaking the speed. The effectiveness of speed breaker drops with visibility. It is useless if driver cannot see it. In fact it can do more harm instead of providing safety.

Twist is, use a mini speed breaker before the actual speed breaker to give indication to the driver for the coming speed breaker. It is better than painting speed breakers or putting up boards because it doesn't needs  visibility for communication.  Basically if you hit a mini speed breaker, just reduce your speed as a big one will follow. 

Tuesday, July 12, 2011

Optimizing time in getting off the plane

Two cases:  With or without check-in baggage?
  • Get your hand baggage as soon as possible and stand in the line.
  • This will take around 5 minutes.
  • Get into the bus, but make sure you take the seat close to the gate or preferably stand
  • Get out of the bus and go out (no check-in baggage) 
  • Get out of the bus and wait for baggage to arrive. 
  • Usually baggage will come first if you were the last one to check-in the flight (FILO).
  • Wait for baggage 
When getting out of the landing airport is decided by when you arrive at the departure airport, then why do people continue to fight for being first to get out of the plane. 


Tuesday, May 24, 2011

Why Low Scoring IPL Matches Last Long

IPL makes money via advertisements in the match.  If the match finishes in 10 overs instead of 20, it means loss of revenue. It seems like  no matter what, both "strategic timeouts" have to happen in any match. I am not aware of any match in which a team won before the "strategic timeout" irrespective of the required runs.

Sometimes I wonder if sports is a form of Reality TV.

Tuesday, May 10, 2011

Named Queries in Relational Databases

Databases don't provide a way to create named queries with runtime arguments.  Yes we have views but most databases are accessed via programming languages where we need to construct the SQL query. We do have the Prepared statements but again they are programming language constructs and not named database level constructs.

Benefits:
1) No need to parse queries. They are callable by name.
2) Prevents SQL injection attacks because of not parsing.
3) Easy integration with programming languages.  db.execute("myQuery", arg1, arg2,...)

4) Instead of trying to optimize every SQL query, every time, database will have the list of the most important queries it needs to answer. This allows databases to save time by pre-planning the execution in the short run and in the long run, databases can optimize the layout of files or creating of indexes automatically to optimize the access pattern.
5) Easy to change db logic. As long as the query returns the same fields (may be more), you can easily change the actual query logic without changing application code.

Their is a lot in the name.