Friday, August 30, 2013

[NoteToSelf] Installing mysql2 gem on Mac OS X

Simples, follow steps as below -

  1. Edit the file /usr/local/mysql/bin/mysql_config (user is root, so sudo it), and replace the lines 119-120 (defining cflags and cxxflags) as below -

  2. Install the mysql2 gem
  3. $ gem install mysql2
  4. Link the required mysql.h library
  5. $ sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
  6. No more steps. Thank you God and
Update - If the above tip doesn't work, look into mkmf.log file generated while building the native gem.

Wednesday, August 28, 2013

#OpenDataApps - Visualization of Percentage of Person Below Poverty Line by State

I am gearing up to participate in OpenDataApps challenge. Since the challenge is open to team participation, there could be no better place to find like minded individual than colleagues at ThoughtWorks. To generate some buzz and curiosity about the event, I did a quick visualization based on the official poverty line estimates in India using the data from website.

There are some straight forward observations one can make from the above choropleth. These are -
  1.  The big red patch running through the central India, or otherwise called the BIMARU states. Though the official definition includes Bihar, MP, Rajasthan and UP, but I feel Chattisgarh, Jharkhand and Orissa should also be included in this.
  2. The southern states like TN, Kerala and Goa are very well todo with less than 20% of population below poverty line.
  3. The other chunk of prosperity is in the Northern Indian states of J&K, HP, Punjab, Haryana, Uttarakhan and Delhi.
The visualization is in such a stark contrast of what I recently came to know of ancient India through John Keay's amazing book - India: A History. The BC era of ancient India was mainly concentrated around the Ganges in the present day states of UP, Bihar, Jharkhand, Orissa and WB.  Whereas these were once the thriving plains of human civilization, they are home to the masses of India who cannot afford the basic necessities of life.

OpenDataApps Challenge By NIC, NASSCOM and

#OpenDataApps challenge conducted by NIC in association with NASSCOM. The challenge is about using the data available on to build apps that would improve delivery of government services, promote government transparency, accountability and public participation and spur citizen engagement. More information can be found on the website or for a quick summary view the slideshare below -

Thursday, August 22, 2013

Review of HIS Multiview II DVI USB 2.0 Adapter HMV2-MAC-PC

I was looking to extend the number of display monitors connected to my Mac Pro. After a quick research I found a few YouTube videos on HIS Multiview II Adapter and how easy it is to configure. So I purchased the device on Amazon and asked one of my colleagues at ThoughtWorks to carry it back from US.

As per the YouTube videos, I proceeded to directly connect the device to a monitor. But disappointingly it didn't work out of the box. So I popped in the companion CD, but to my surprise it didn't work as well. The installer failed with error - This software could only run on Mac book with Intel on it. I have a Mac OS X 10.8.4 Lion with 2.6 GHz Intel Core i7. It is as Intel on Mac as it can get. Now I started to get a little worried, as with any product purchased from US and shipped it via friend to India, it wouldn't be easy to get a local support or return the product.

I still persisted and after quick Google search, I was taken to DisplayLink website for an updated driver for this device. Although the device is marketed by HIS, but I think the hardware and support is done by DisplayLink. Downloading the latest driver for Mac, I restarted the machine and Voila !!! it started to work.

I am happy since it was able to detect my additional monitor connected via USB without much fuss and then tested connecting additional monitor via Firewire. They all work superbly though there are some quality issue on the display connected with the HIS Adapter.

The monitor connected to HIS Adapter is not as smooth as the one connected with Firewire. The screen is a little grainy and colours are not that rich. Over it the screen flickers if I switch the spaces or go to Mac dashboard. Running movie on the connected display renders without noticeable flickers but again resolution is not that great. I think this is because this is a USB 2.0 device rather than USB 3.0.

The other annoying thing about the product is the companion pouch that comes along with it. Since most of the displays I use are VGA, so the DVI to VGA adapter is constantly going to be attached to the device. But the pouch is long enough to pack the device, but not with the adapter on. A little irritating since everytime I will have to unscrew the adapter from the device to pack and screw it back to use.

Overall I would give 2.5/5.0 stars to the product. Although because of the limitation I won't be using the connected monitor as my main monitor, but again I am happy that I can have an additional monitor connected to my laptop and remove the productivity barrier that I was facing.

Thursday, August 1, 2013

Open Finder Folder in iTerm Command Window

Recently I was struggling with finding a nifty tool for Finder window on Mac OS X that would allow me to directly open the selected folder in new iTerm tab. After doing a fair bit of Google search I came across this blog post that allows you to create a "Service" in Automator that gives you a contextual menu. Doing so many clicks to open up in iTerm takes away the productivity benefits that you get by creating the shortcut, so I was looking for a toolbar action to do the same.

The script solved the trickiest problem of opening up the tab, the rest was creating a scaffolding around it for it to be used as a toolbar action. For that I created a Automator Application with the following sequence -
1. Drag the "Get Selected Finder Items" as first action
2. Drag the "Run Applescript" as subsequent action
3. Replace the script with the following code

4. Save the application in ~/bin/Open in

Open in iTerm - Automator action sequences

5. Copy /Applications/
6. Navigate to ~/bin/Open in, rename AutomatorApplet.icns to AutomatorApplet.bak.icns and paste and rename iTerm.icns as AutomatorApplet.icns
7. Navigate to ~/bin folder, drag Open in to the toolbar

Congratulations !!! You are all set to use your context sensitive Open in iTerm toolbar action.

PS- You can download the application Open in iTerm from here.