puffpio [dot] com

puffpio [dot] com

David Pio  //  software developer, technology geek, gadget whore, motorsports junkie, video game nerd, partner engineer at Facebook

Aug 26 / 11:21pm

Android and Google made me smile today

Today I had to goto my wife's friend's house to pick up some stuff. I looked at his contact info on my phone and I had his email address and phone number but I didn't have his street address. However, I know that I once used Google Maps to look up his address so onto Google Maps I went. I inputted his city and the autocomplete suggested the full address I had typed in months earlier *sweet*.
So now I needed to get that address into my phone. I know that Android phones auto-sync with Google Contacts, so I opened up my contacts list in Gmail only to discover that he wasn't in there. I looked back at his contact info on my phone and realized that the info came from the Facebook integration, kinda cool.  Back in Google Contacts, I proceeded to add him into my contacts, I started typing his name and the autocomplete suggested his email address since I had emailed him before *nice*.
Finally I added his phone number and address into the contact. I turned back to my phone - which was showing his contact details from earlier - with the intention to manually refresh my contacts to pick up the new info, but it was already there! His contact info which was displayed autorefreshed and had his address in it and showing on my screen *nice*.
So that part made my smile today. The tipping point was that when the address auto synced to my phone, I did not have to manually refresh the display of contact info, it just changed automatically.
Filed under  //  android   autocomplete   contacts   google  
Jan 20 / 3:35pm

Google Language Tools and Romanization

Drop_shadow_107090

Since when did Google Language Tools offer Romanization of some non-English languages? Awesome.

Filed under  //  google   google language tools   romanization  
Jan 19 / 1:26pm

Proxying script requests through Google Closure Compiler

Since Google's Closure Compiler also comes in a public web API flavor (and one that doesn't require a key!) I set about writing some code to proxy all incoming javascript requests through it.

I used an ASP.Net MVC implementation where calls to the route (e.g. "/script/myscript.js") would look for the uncompressed javascript file, and if it exists it will dispatch the Closure Compiler and return that result.

I cache the results in ASP.Net's global cache so I can look there first, and if my web farm uses a distributed/shared cache, they all benefit.  Additionally, I added a file Cache Dependency so that if the script file ever gets updated, the minified version will be automatically evicted from the cache and regenerated when accessed next.

Next I added a routine in Global.asax.cs Application_Start method to iterate through all Javascript files in my website and send them through the Closure Compiler meat grinder so they are all preloaded into the cache.  Since this can be quite time consuming, spinning it off into it's own thread keeps the web site from starting too slowly.

 

The end result is that whenever my website is started or recycled, it will grab all the JavaScript files, send them out to Google Closure Compiler's public API, and then cache the results.  Whenever a script file is modified it will evict the minified version from the cache and be regenerated the next time the script is requested.

Filed under  //  google   google closure compiler   proxy