Compiling Vowpal Wabbit on Centos

Vowpal Wabbit is an awesome machine learning tool using which you can build logistic regression models online. While building it on a Centos flavor of Linux, I ran in to a lot of issues, and I wanted to highlight the steps needed to be able to build it successfully on Ubuntu. The documentation of Vowpal Wabbit includes great instructions on how to get it installed on Debian Linux but not so much for Centos:

  • If you don’t have boost libraries installed, then on Ubuntu, you need to get them via “yum install boost-devel” and “yum install boost”.
  • Then in the vowpal wabbit directory, run “./configure”
  • run “make”
  • run “make intall”
  • If you see errors like “undefined reference to pthread_create” while doing “make”, then add the following line to your file: LDFLAGS='-lpthread'
  • That’s it!
Good luck building your machine learning models using Vowpal Wabbit.
Posted in Uncategorized | Tagged , , , | Leave a comment

2012 in review

The stats helper monkeys prepared a 2012 annual report for this blog.

Here’s an excerpt:

The new Boeing 787 Dreamliner can carry about 250 passengers. This blog was viewed about 1,500 times in 2012. If it were a Dreamliner, it would take about 6 trips to carry that many people.

Click here to see the complete report.

Posted in Uncategorized | Leave a comment

Android network connectivity fallback

Didn’t realize that Android only has one network connection active at any given time. So if you keep your WiFi turned on all the time, and for some reason, your WiFi connection is spotty, then Android may not really fall back to 3G. For instance, my WiFi connection at a hotel during my recent trip to Hawaii, was renewed every day. And this hotel WiFi managing system would essentially redirect all HTTP requests to its own portal to ask users to login. Now note that my WiFi connection was good – Android’s network utilities showed WiFi as available as well as connected – and hence, majority of the apps on my phone remained unable to even fallback to 3G given that HTTP requests over WiFi were really failing. 

Posted in Uncategorized | Tagged , , , , | Leave a comment

Android App Gotchas that trip you up

So I’ve decided to keep a growing list of Android gotchas that have killed my time & patience unnecessarily. Hope someone reading this can avoid these.

  • Broadcast Receiver: So if you want to use Broadcast Receiver to receive your alarms and then in the onReceive you want to do some work, e.g. save some stuff over in SharedPreferences. Good luck with that. 3 days and I have had no luck. My SharedPreferences just don’t get updated. Tried to do this inside onReceive completely. I didn’t want to start a new Service, since that would require getting a WakeLock. And if you already have an app in the store, then setting a Wake Lock will require getting users to manually grant you that permission; which means that the app can’t really be updated automatically.
  • If you add or even remove permissions from your app, then Google would mark the app to be upgraded manually, ie forget about automatic upgrades from your users.
  • Google Play store seems to schedule upgrades at midnight. So if you push a new update to your app that’s already in the store, new users will get the new version, but the older versions may have to wait almost 1 day to be upgraded.
  • An app once declared free, remains free for its lifetime, ie by Google Play Store’s ToS, you can’t convert it to a paid app later.
Posted in Uncategorized | Tagged , , , , , , , , | Leave a comment

Android – How to disable softkeyboard in an EditText box while still have the flashing cursor

Android has a pretty unfriendly design where the soft keyboard appears in any editable EditText of an activity as soon as you enter that activity. I wanted a design such that the cursor inside the textbox is still flashing, however, I didn’t want the soft keyboard (which in my opinion, hides the entire UI, making it ugly). Moreover, the user should be the one deciding whether to enter something in the textbox and not the software.

Well, to achieve this, required a combination of a hack (courtesy: StackOverflow, and StackOverflow) as well as some meddling around:

In onCreate() of the activity where you have the edittext box:

protected void onCreate(Bundle savedInstanceState) {

mAmountText = (EditText) findViewById(;

// This will disable the Soft Keyboard from appearing by default

// Provide focus to the Amount box (since it is the top edittext box inside RelativeLayout)


In your layout file (call it note_edit.xml):

<?xml version=”1.0″ encoding=”utf-8″?>




Posted in Uncategorized | Leave a comment

Installing Centos VMware image on Windows using Player 2.5

Ok, I had a much nicer experience installing Centos 5 image using VMware player 2.0.5 a year ago than I have had using VMware player 2.5. What a nightmare. No wonder why *nix systems and alike have been relegated to only the geek world. Who has patience to sit down for for multiple hours trying to figure out how to install a software, all that time while waiting impatiently to get over that cliff on to the things more interesting.

I will recreate the steps for everyone who wants to install Centos or another unix image on their windows host.

First, note that you can not load an ISO from VMware player at all as it only loads a virtual image in the VMX format. Moreover, since VMware player is free software, it doesn’t allow anyone to create a virtual image from ISO to VMDX either. So the only alternative is to build your own VMX. Follow the instructions in this great post here:

In summary, the steps as outlined in the blog above ask you to (1) first create a VMware SCSI hard disk image (.vmdk format), which you can download from the same site; (2) then download an example vmx configuration file which you then edit to provide pointer to the hard disk image as well as pointer to the Linux ISO image that you want to install; (3) then you finally open the vmx config file using player; (4) Finally, as you go through the installation process, you may be asked to provide location of additional ISO images, e.g. if you only provided location of first 1 of 7 image, then you will be asked to provide location of 2 of 7, 3 of 7 and so on. I have the entire vmx config file below:

.encoding = “windows-1252”
displayName = “Linux 2.6.x Host”
guestOS = “other26xlinux”

memsize = “512”
scsi0:0.fileName = “10G.vmdk”
ide1:0.fileName = “CentOS-5.5-i386-bin-1of7.iso”

config.version = “8”
virtualHW.version = “4”

MemAllowAutoScaleDown = “FALSE”
MemTrimRate = “-1”

uuid.location = “56 4d e4 3b 5a 83 d1 a9-fe 71 f0 c2 4e 20 b0 7e”
uuid.bios = “56 4d e4 3b 5a 83 d1 a9-fe 71 f0 c2 4e 20 b0 7e”

uuid.action = “create”
checkpoint.vmState = “”

ethernet0.present = “TRUE”
ethernet0.connectionType = “nat”
ethernet0.addressType = “generated”
ethernet0.generatedAddress = “00:0c:29:20:b0:7e”
ethernet0.generatedAddressOffset = “0”

usb.present = “TRUE”
sound.present = “FALSE”

scsi0.present = “TRUE”
scsi0.virtualdev = “lsilogic”
scsi0:0.present = “TRUE”
scsi0:0.deviceType = “disk”
scsi0:0.mode = “persistent”
scsi0:0.redo = “”
scsi0:0.writeThrough = “FALSE”
scsi0:0.startConnected = “FALSE”

scsi0:1.present = “FALSE”
floppy0.present = “FALSE”
ide0:0.present = “FALSE”
ide0:1.present = “FALSE”
ide1:1.present = “FALSE”

ide1:0.present = “TRUE”
ide1:0.deviceType = “cdrom-image”
ide1:0.autodetect = “FALSE”
ide1:0.startConnected = “TRUE”

extendedConfigFile = “template.vmxf”

virtualHW.productCompatibility = “hosted”
tools.upgrade.policy = “manual”

vmotion.checkpointFBSize = “16777216”

tools.syncTime = “FALSE” = “FALSE”
usb.autoConnect.device0 = “path:1/4/6 autoclean:1”

Note that VMware player 2.0.5 used to come bundled with VMware Tools while they stripped it out of player 2.5. And of course, there is no documentation about this. The only thing I could find is some information on installing Operating System specific Packages (OSP) for ESX server. The only other information I found is by some folks who suggest installing the VMware player 2.0 and extracting the VMware Tools ISO from it, and then using it with the player 2.5. However, this is a catch 22, as you can not really install player 2.0 if you already have 2.5 installed. If anyone finds a solution for this let me know in the comments section.

Next, I wanted to make a linux version that is bootable via USB. Centos has instructions on how to achieve this.

Most of the steps there worked for me, except that it is important to reboot the VMware linux guest after you have formatted the USB drive.

Posted in Linux, Uncategorized | Tagged , , , , | Leave a comment

Can we still turn on Egypt’s Internet access?

Purportedly, Egyptian government seems to have implemented a Kill Switch on their citizens’ internet access at 12:30 am local time on Jan 27th.

This was done at multiple levels (DNS, BGP, firewalling) in order to ensure that demonstrators and protesters are unable to communicate with each other inside Egypt as well as with others outside Egypt.

1) Domain resolution: DNS servers used by Egyptian ISPs were brought down, so users can not resolve domain names and convert them to IP-addresses.

2) Inter-domain routing: Egyptian ISPs were instructed to withdraw all the BGP routes that they advertise to the rest of the Internet, so now ISPs outside Egypt have no way of reaching Egypian ISPs’ IP-addresses. So even those users who are able to resolve domain names to IP-addresses or those who are using a server’s IP-address to directly connect to the server, would be thwarted by the lack of routing. More details on this here. There are reports that at least one of the Tier-1 ISPs in Egypt, namely Noor is still announcing BGP routes.

3) Application layer filtering: At the same time, they seem to be filtering out all traffic headed from within Egypt to social networks such as Facebook, Twitter, etc. So this takes care of cases where even if someone was able to connect to Facebook’s IP-address directly and by some miracle had routing enabled between his ISP and the rest of the Internet, the connection would be filtered at the application level!!

So how can someone inside Egypt still access the Internet? Or for that matter, how can citizens of any country rally around and forge together a solution to access the Internet when their government shuts it down?

The Most likely solution revolves around some form of a peer-to-peer internet routing, and likely involves using the anonymizing ToR routing in some fashion. However, would that really work?

Suppose users inside Egypt set up ToR routers on their machines, and when they have to post messages on Facebook or Twitter, they route their connections through other ToR routers – so their IP packets will always have as destination the IP-address of another ToR router and not necessarily Facebook or Twitter. However, these packets will need at least one network link to be working, one which connects Egypt to the rest of the Internet (in this case that will have to be Noor).  But can this still work?

Most likely not. At best it will be a best-effort service, one prone to lots of long latencies and TCP resets. The reason being that currently onion routing is not optimized to look for the best route out of a country. In other words, a lot of IP packets will get lost because they may not even know how to reach Noor.

Clearly, what is needed is a disruption tolerant routing at the application layer, so that ToR routers (which essentially make an application layer overlay on top of actual IP routing) should be able to obtain information from IP routing layer and figure out quickly that there is only one way out of the country.

Posted in Uncategorized | Leave a comment