Posted: September 18th, 2011 | Author: naduism | Filed under: Uncategorized | 2 Comments »
Here are my 2 hacks at the Foursquare Hackathon
Accessible NYC is mashup which gives information about which Subways, Parks, Playgrounds, Restrooms (the usual Public places) around you are accessible (meaning accessible via wheelchairs). This was built using Foursquare, which has a wealth of data on places in the city and the NYC Gov data, which has information about which public places like parks, subways are accessible. It was a good challenge (need to make to more robust) trying to harmonize the NYC Gov data and the Foursquare Venues data.
Accessible NYC Demo
The second hack was more of a quick 2-hour effort, which was to be able to come home and talk to your computer and check into your house. Has been tested only Chrome (on Windows) and uses the HTML5 speech input feature and the Foursquare checkin API.
Talk In
Feedback from the people.
This was fun
Posted: September 11th, 2011 | Author: nramakrishnan | Filed under: technical | Tags: at, hackathon, hackdaytv, hacks, open captions | 12 Comments »
[Updated with the latest status of Open Captions project]
I started building Open Captions for the Hackday TV hackathon at General Assembly.
Open Captions gives the viewers, the ability to search and view closed captioned YouTube videos. While watching the video, the viewer can select individual words of the closed captions and then see an American Sign Language Representation of the word on the screen. The viewer can also jump back to the previous caption showed on the screen. Whenever, a word is selected, the video automatically pauses when the ASL is showed on the page. The working prototype can be seen on Open Captions
Currently the project is a work in progress, and is susceptible to fail at a few places. Please feel free to email feedback, ideas, suggestions about Open Captions.
The ASL representation is just one of the use cases of Open Captions. This can be linked with Google Translate to find out words in other languages (very useful for people for whom English is not the first language). This can also be linked with say Wikipedia and children can learn about a word or a place spoken about on TV.
This idea of selecting words from closed captions also works for videos from Universal Subtitles, an initiative which helps create closed captions for videos on the Internet. Open Captions example with Universal Subtitles
Reference
The ASL representations are being scraped from www.cats.gatech.edu, which has around 25000 words shown in ASL in 25000 web pages.
Posted: September 6th, 2011 | Author: naduism | Filed under: technical | Tags: arduino, hacks | Comments Off
Given my anti-social tendencies (read not logging on to Facebook for 3 months at a stretch), I decided that I needed a new friend.

My Friend Marvin
Marvin (the paranoid android) is built out of waste thermocol (that came with the packing of my monitor). It has a small red breadboard attached as it’s heart. The light on the heart glows green if there are more tweets with positive sentiment going around in the (All izz well) and glows red if there are more tweets with negative sentiments going around in the virtual world. (I took about a handful of words like “environment”, “plastic”, “global warming” etc. as the baseline hashtags to be analyzed for sentiments) More on the implementation of the Arduino controlling the LEDs can be found in the Project Cycles post here
My last Labor Day weekend project was drawing this, I am happy that the trend of doing something I love during the long weekend has continued.
Posted: September 5th, 2011 | Author: naduism | Filed under: Uncategorized | Tags: corruption, data-viz, india | 6 Comments »
This is an effort to compare and contrast the amount of money lost by the Government in various scams to that of the money exchanged when the country’s citizens take the shortcut or the easier path to get things done quickly, or in some cases where they are forced to pay bribes to Government officials.
Bribes exchanged in the Passport process
In Passport issuing process, there are couple of police verifications that are done. Basically, a policeman would come to your residential address and ensure that you are physically present there at the given address. Of course, that’s not always possible because say you are studying in a college in Chennai and your Passport has been applied at the Passport Office in Mumbai (because your parents stay there). So, the policeman might be happy to take a bribe to help you out in this situation. This might be the same with the “CBI verification process”. In other cases, sometimes citizens are required to pay extra “chaai-paani” so that the file is passed from the Police officer’s desk to the next Officer in the Passport Issual process.
As per this article, Pune issued 1.29lakh passports in 2010. Lets take an estimated figure of 15 lakh Indian passports total being issued in 2010. Assuming 75% of the people pay Rs. 100 each bribe for the police verification and the CBI verification. So the amount =
15 Lakhs * 0.75 * 200 = 2250 Lakhs = 22.5 Crores of money in bribes for issuing a passport. This amount is about 1/8th of the amount of money lost by the Exchequer in the Taj Corridor scam.
Driving offenses and bribes
Now lets take the case of driving offenses in India. According to this article, a total of 2,41,392 challans were issued in Haryana during 2010 while Rs 6,36,10,640 was recovered as fines. Now, assuming that 70% of the time challans were issued and the rest of the time, people got away paying a bribe. The loss to the Government ~= 2.725 crores in Haryana, extrapolate it to 10 major states of India, we will reach a ballpark figure of 30 crores – which is around 1/3 of the amount of money that the Exchequer lost because of the bungling of contract terms for setting up the Timing, Scoring and Results System during the Commonwealth Games 2010. (Source)
Bribes exchanged in the Registration process (land registration, birth & death certificates etc)
On the site ipaidabribe.com, under the registration category, the amount of bribe reported to have been paid is around 809 Lakhs of rupees. We can take say, 75% of that figure as the bribe paid per year (as it is spread around 1.5 years) and then extrapolate the amount of bribe paid in the entire country for registration. So 75% of 809 Lakhs and then say around 10 times for the entire country. Why 10 times? ipaidabribe.com is accessible to only to educated people with an internet connection to submit their grievances. So, 10 is a good (conservative) estimate for the entire country.
So, the ballpark amount paid in registration bribe per year is ~= 60.67 Crore rupees. That is around 70% of what was the loss to the Exchequer in the Kargil Casket Scam (around 85 crores).
Ticket-less travel
As per this article in the Financial Express, the Indian Railways loses around 1000 crore rupees in ticketless travel in a year. 1000 Crore is a huge number. To put it into perspective, it’s about twice as big as the Telgi Stamp paper scam.
It’s interesting to observe that the amount of money that is exchanged/lost in the bribing process or say taking short cuts to get our work done quickly, can at times compare to some of the pretty big scams in our country. Sidin Vadukut phrased it pretty well – “Anti Corruption begins at home”
References
- http://www.financialexpress.com/news/fine-on-1cr-ticketless-travellers-helps-rlys-rake-in-rs-399-cr/640191/1
- http://articles.timesofindia.indiatimes.com/2011-05-23/gurgaon/29574000_1_challans-road-accidents-gurgaon-traffic-police
- http://www.ndtv.com/article/india/cwg-scam-first-cbi-chargesheet-likely-today-kalmadi-may-figure-107065
Posted: September 2nd, 2011 | Author: nramakrishnan | Filed under: Uncategorized | Tags: javascript, technical | Comments Off
It has taken me time to fully understand the concept of closures in JavaScript. Here is an example of code that I rewrote so that we can use closures and get the thing to work the way we actually want it to.
The situation:
We have a set of buttons and we have to attach on-click handlers to them. These handlers should be called with parameters that are button dependent i.e., the innerHTML of the text box next to that particular button or say we need some attribute of the button (data-value, or some custom attribute).
We want to attach a function inviteUserToGroup with the specific parameters as event handlers to all the buttons.
So we initially wrote :
//add event handlers to invite buttons
var inviteBtns = $$('.inviteBtn'); //Prototype to get an array of elements with this class name
var len = inviteBtns.length;
var i;
var groupIdForUser;
var detailsForUserInGroupName;
for(i=0;i<len;i++){
groupId = $('groupIdForUser'+i).innerHTML;
details = $('detailsForUserInGroupName'+i).innerHTML;
//Protoype syntax to attach event handlers
//Event.observe(element,event,handler)
Event.observe(inviteBtns[i],'click',function(){
inviteUserToGroup(groupId,i,details);});
}
function inviteUserToGroup(a,b,c,d){ doSomething();}
So, we attach inviteUserToGroup method with the parameters. Since we enclosed the handler as a function, one can assume that due to the scope of the function, it should work fine and the event handler will be called with the correct parameters. That doesn’t work that way. All the event handlers get called with the value of i = len. You thought closures would work here, but it does not.
So what do you do? Create a real closure. The following code does that
/* DOES NOT WORK
Event.observe(inviteBtns[i],'click',function(){
inviteUserToGroup(groupId,i,details);});
*/
Event.observe(inviteBtns[i],'click',
(function(gId,i,dtls){
return function(){
inviteUserToGroup(gId,i,dtls);
}
})(groupId,i,details)));
So what is happening?
1) Create an immediate anonymous function which takes in the parameters that you want in your handler.
2) In the anonymous function return the actual function with parameters that you want to call. In this case we return inviteUserToGroup() with the parameters.
The important point to understand is that, the immediate function will execute and hence have the current values of groupId, details and i, which are passed to it. Due to the closure, the inner function (which is returned) has access to these values even after anonymous function has completed execution. So, inviteUserToGroup is attached to each button with the correct parameters.
For completion, another way of doing this is
Event.observe(inviteBtns[i],'click',
'inviteUserToGroup('+groupId+','+i+',\''+details)');});
Not recommended by many people as this uses the eval function to evaluate the JavaScript inside the quotes.
Is there a better (maybe more legible) way of doing this? Let me know!