Installing VMWare Player on Ubuntu 11.10 Oneiric x86 (32 bit)

I use a netbook for most of my day to day personal computing, an HP mini 311. While i think this netbook is the best ever, it does have one flaw. It comes with the ION chip, but the caveat is the CPU uses a 32 bit instruction set. This means obviously that i am restricted to 32 bit operating system installs. In the past this hasn’t really been much of an issue (i have owned this netbook for quite some time now). But recently 32 bit CPU’s are a bit of a rarity, and support for 32 bit appears to be waning, if not at least with respect to vmware.

I just finished setting a nice new ESXi 5.0.0 U1 server and wanted to start playing around with it. This is when things got complicated. VMWare offers an i386 installer for Player 4.0.2 but contrary to what you’d think, this installer is not supported on a 32 bit CPU. this installer is available for those who install i386 arch onto a 64 bit CPU. If you, like me, don’t have a 64 bit CPU then you have to live with 3.1.5 (VMware-Player-3.1.5-491717.i386.bundle at the time of posting, sorry i can’t find a live link). This installs as you would expect, by running sudo sh VMware-Player-3.1.5-491717.i386.bundle and following the GUI installer. You may remember from earlier vmware installs that you need to compile kernel modules in order for things to work “smooth” and this install is no different. Where this install differs is when you are using a 3.x linux kernel, such as the one that comes with Oneiric. For whatever reason, vmware assumes that nobody upgrades their linux kernel regularly and left us to patch the module sources ourselves. Fortunately, someone has done the heavy work for everyone already (my source for this info is here: http://ved-antani.com/2011/10/vmplayer-not-compiling-for-latest-linux-kernel/ ) so that you can quickly build the modules manually.

the instructions at the original source are not quite perfect, so here is what i did to compile my modules.
# you need to do this stuff as root
sudo su

# make a directory to build the modules and cd to it
mkdir /tmp/vmware-build
cd /tmp/vmware-build

# extra the module sources to our build directory
find /usr/lib/vmware/modules/source -name "*.tar" -exec tar xf '{}' \;

# get the patch archive and extract it
wget http://weltall.heliohost.org/wordpress/wp-content/uploads/2011/05/vmware2.6.39patchv3.tar.bz2
tar -xf vmware2.6.39patchv3.tar.bz2

# update the patch for 3.1.5 (it is designed for 3.1.4)
sed -i -e 's/plreqver=3\.1\.4/plreqver=3.1.5/' patch-modules_2.6.39.sh

# patch the source and start the build
./patch-modules_2.6.39.sh

# after the build is finished the modules will be installed

A Better ArrayAdapter Implementation (Android Development)

I have been doing some Android development these past few days and coming form C#/WPF land, I have noticed that there are a number of design flaws in the android architecture that I feel could be improved. The most annoying thing that I have run into involves the ArrayAdapter. I use lists a lot (as I’m sure others do to) and having a quick and easy adapter that is generic and extendable is very important. The built in ArrayAdapter has many flaws, the biggest are that you cannot access the backing list (EVER!) and filtering is completely broken. To solve this, most people just create their backing list outside of the adapter and pass it in, which is no big deal but completely unnecessary. And to solve the filtering issue, everyone basically just rewrites the filter themselves (ugh!). Because of the way filtering works, you must maintain two copies of your list. One copy contains all items, and the other the filtered items. Without having easy access to the backing list, the filtering ops start to become very inefficient (requirements of copying items back and forth). ArrayAdapter fixes this by doing it for you but only if your list is of String’s (WAT?).

So anyways, i got fed up with rewriting nearly all the ArrayAdapter code every time i wanted to have a custom adapter, i decided to just sack up and write a GOOD ArrayAdapter, which I am calling the DynamicArrayAdapter. This new adapter handles changes much more efficiently and MASSIVELY simplifies any customizations of the adapter. If you compare it with the original ArrayAdapter, you’ll see that it is not very different at all, but the differences MAKE THE DIFFERENCE. So here is some code: http://pastebin.com/4mxtEC5e

Here is a sample implementation (for a sample Bluetooth app I wrote): http://pastebin.com/Quwsgkbm

I fully expect to never use ArrayAdapter again.

My Thoughts on the New 0.05 BAC Limit Drunk Driving in Alberta

This has been on my mind for a while and I am hoping that my writing here can maybe change some minds or at least persuade some additional action on the part of law enforcement, legislators, the entertainment industry, and the taxi industry.

Recently, our province enacted Bill 26, which dropped the legal limit for consuming alcohol and driving your vehicle to 0.05 BAC, from the previous limit of 0.08 BAC. Proponents claim that the intent of this bill is not to criminalize the public who has a glass of wine with dinner, and furthermore (appear to) harshly criticize those who oppose such action by calling said people supporters of impaired drivers (ugh!). Let me first make it abundantly clear that I in no way support impaired driving. With that said, I cannot support the enactment of this bill either. I recognize the effort and the good intentions that went into this bill, but it has been pushed through for the sole purpose of this government to look like they are getting tough on impaired drivers. Now for some truths… Lowering the legal limit does not automatically make you tough on impaired drivers; it only makes it more common for a driver to be impaired. These are two very different statements, though they do look very similar on the surface. While statistics may show that “we are catching more impaired drivers” they do not show that more dangerously impaired drivers are being caught.

Let’s analyze this for a moment. By lowering the limit we are spreading our law enforcement thinner by having them cast a wider net to target more drivers. By doing this we are spending more time and resources on dealing with those who before would have been under the limit. Without proportionally increasing the number of resources to the statistical number of people who are now effectively driving impaired (lowering the limit by 0.03 includes a LOT more people in this problem) our law enforcement cannot spend the necessary time tracking down and removing those truly dangerous impaired drivers on the road. Now the proponents of this bill will say that everyone gets caught eventually, so it makes no difference, just more people get caught now. They are correct, partially. Everyone does get caught eventually, but that “eventually” time frame just widened. So if we have a statistical average number of impaired “road trips” before a death is involved, and a statistical average number of days before someone is eventually caught, then we also have a statistical average number of deaths per impaired driver. By widening that time frame we are actually increasing that number of deaths because more dangerous impaired drivers have more time to cause that statistical death. Don’t read too much into the statistics because statistics lie. But they do offer a window into real life data that is collected, the can inform us of trends and they can help us project. They cannot, however, tell us the future and guarantee results. So my very brief analysis above is just to help describe the logic that suggests that lowering the limit could have the opposite effect that is desired.

So you may ask if I don’t support this bill then what do I suggest we do instead. Well my suggestion is simple; the status quo was working but was improperly implemented. Let’s get something straight, the majority of people do not want to criminalize themselves intentionally. Some don’t care enough, but most would do the right thing if given the choice. The problem right now is that the choice is not very well defined. “Do I drive or do I cab?” The statement should really be worded as “My BAC is X, therefore I should Y.” Now it is no longer really a choice, all law abiding citizens follow the directive given, and those that don’t care enough do whatever they want and eventually get caught if they choose poorly too often. By increasing awareness at the individual level, citizens can now act responsibly with some contextual knowledge. Without that contextual knowledge, how can we expect everyone to make the right choice? If I ask you right now is the milk in your fridge expired? You can make an educated guess based on the last time you remember buying milk or looking at the expiry date, but without seeing that date in front of you can can’t make the right choice every time. Nobody wants to drink expired milk, so that’s why the date is included on the container. Without our BAC given to us prior to making our choice, we can never guarantee making the right choice every time. So how do we implement this notion? Well that is truly the most important question, how do we inform everyone at the individual level so that they can make an informed choice. We need a quick, simple, and cost effective way of informing people in the entertainment districts. It’s still a choice, so it should be optional, but easily available to those who want to be informed. I know that I would never step into a vehicle knowingly over the limit (even our new draconian limit). I have to imagine that others would feel the same, because who wants to voluntarily criminalize themselves? To implement this strategy some communication between law enforcement, legislators, and entertainment industry owners must begin. These three parties are those who can solve this problem in a reasonable manner.

Now that informed choice is solved, we need to solve the second half of the equation. When the answer to the choice is “I should not drive” then we need realistic alternatives. Catching a taxi from the Jasper Ave entertainment district to my home in Rutherford is absurdly expensive. A 5 to 10 minute cab ride in Edmonton, at night, with tip is approximately $20 to $25. The distance to my home is going to be around 40 minutes, and I would expect to shell out at least $60 and probably closer to $80 to get home. You want to talk about incentives to drive “impaired” this is the biggest of incentives. If someone has two beers over the course of 4 hours (what would be considered social drinking, NOT consuming to be impaired) then could EASILY be over the 0.05 limit. Do you think someone who was socially drinking would be interested in shelling out $80 to get home, not to mention another $80 to return and get the vehicle! Now I realize that a cab is not the only method of transportation, in fact I love public transit options and I think that the city made a wonderful choice when they proposed the late night transit service (too bad it keeps getting delayed). This certainly helps reduces the burden of cost but it isn’t feasible for the whole city only in concentrated entertainment districts. All this has me come to the conclusion that we require some more incentive to make the right choice. If you make the wrong choice (and you are caught making this wrong choice) then you are punished. But if you make the right choice, while you aren’t quite punished, you are still severely inconvenienced which almost feels like a punishment. I would love to see some positive incentives for those who make the right choice. We need cooperation between taxis, law enforcement, entertainment establishments, and maybe more to help subsidize the cost/burden of making the right choice. If those who are legally impaired have an incentive to make that right choice and maybe save someone’s life, then maybe providing that incentive will help solve this problem from a new angle.

Finally, I wanted to touch on the social media “problem” that is so viciously discussed these days. “Everyone who tweets a check stop is supporting drunk drivers and causing deaths!” I can’t stand it when people oversimplify the twitter issue. If you’ve ever been caught in a check stop line (I mean caught as in traffic wise) then you know that it sucks, a lot. You don’t complain because you know it’s for the good of the community but when you get home you silently complain that it took forever to get home because of the check stop. Now I know that tweeting check stop locations can be used by impaired drivers to circumvent their purpose, but let’s be truly honest here. Anyone who is dangerously impaired (not necessarily legally impaired) is probably not going to find out. This isn’t true for all cases, but in the general case the impaired driver is either not capable (not device to check for them), not motivated (doesn’t care enough to wade through all the anti check stop tweeting), not cognizant (remembering to check), or even not smart enough (to realize that there is in fact a check stop on the way home). When you consider this, really the only people who benefit from the check stop tweeting are people that probably aren’t of interest to the police anyway (or shouldn’t be because they aren’t actually impaired) thus making the check stop more efficient at finding those who are impaired. I would also like to bring up the fact that this was never a problem until the new legislation came into effect. People were more than happy with the 0.08 limit because that meant that 2 drinks over the course of your socializing period was almost certainly under the limit, and for those who were lighter weight one drink was still nothing to worry about. Now, even one drink may be too much. Two drinks is almost certainly over the limit for some. This dramatic shift in what is acceptable and what is not has clearly caused an outrage amongst those who enjoy socializing with a beer or glass of wine. The outrage has spawned a need determined by a few people to help keep the others informed. And I know that most people think that tweeting check stops is just as bad as driving impaired yourself, but I believe that it is a social mechanism to counter what many feel is an invalid restriction imposed on us. I know that in my own case two beers will almost certainly put me over the legal 0.05 limit. I used to enjoy going to the sports bar to watch hockey. I no longer engage in this activity because it is simply not worth the risk. It may sound stupid but I am what would be considered a light weight, my body weight hovers around 140 lbs. My body is very capable of processing two beers, and while by BAC might read 0.05 or 0.06, my impairment is very likely similar to someone else’s 0.03 or 0.04. BAC does not necessary imply impairment (though it is a very good indicator, there are variances). So while I am quite certainly not impaired, a road side test will probably disagree. I simply cannot afford to take such risks and therefore I no longer engage in social drinking without prior dedication of a ride home. The end result is that I far less frequent the sports bars to watch sports and socialize.

So to summarize I want to go over what I have suggested in this (rather long) post. I am suggesting that the new laws may in fact be causing more harm than good, in the form of too many resources wasted on those who are not truly impaired (or dangerously impaired at least). I am suggesting that we need to offer those who make the choices contextual information (what their current BAC is at) so that they can make the informed choice, and most likely the responsible choice. I am suggesting that we need to offer positive incentives to those who make the right choice, help make being responsible something people don’t have to think twice about. And finally, I am suggesting we stop caring so much about tweeting check stops because it simply isn’t informing as many dangerously impaired drivers as you think it might be. Remember dangerously impaired drivers are the people who are causing the majority (if not all) deaths. These are the people who making roads dangerous. These are the people that we don’t want on our roads. Let’s focus more energy on removing these people (either through law enforcement or the incentives I have suggested) and less energy on criminalizing law abiding citizens and clogging up our legal system. I want to make our streets just as safe as all of you Bill 26 proponents do, but we have to focus and target the bigger problems, and we just took a giant step in the wrong direction.

Next Page »