Get Electricity Usage Analytics Like The Utility Companies

Ever wanted to track how much electricity a device at home is using over time? Here is a nice DIY for doing just that. It does require a bit of soldering but not much.

Bitbucket brightens my day from the github pricing gloom

I’ve been using github for a while now and honestly, it rocks. It really beats the heck out of the dinosaur, svn. However, the pricing for private repos on github is just something I had a hard time justifying. I have been running my own svn server for quite a while and it does not create additional cost to me. Plus, I can have unlimited number of private repos and of course because I can, I do. So in order to switch to github and shutdown my svn server, I would have to pay $50/month since I have more than 20 projects.

Alas, I have found what I’m looking for. Bitbucket. It is also git, although you can use mercurial too, but I just prefer git. It has all the niceties of github like integrated issue tracking, ease of collaboration, and of course all the good stuff of git. But the pricing is very different. They take the route that if you don’t have many contributors to a project, then it is too small charge. So they allow you to have private repos for free up to 5 users. After that, you need to start paying. That makes a lot more sense to me since after that, you are definitely running a legitimate business and should pull your weight. Before that, they are considered play projects or incubator projects. Oh, and you can have unlimited number of free private projects.

Time to say goodbye to my svn server.

Laravel, another php framework to explore

Laravel is a framework in the same class as Codeigniter. However, at first glance it implements a couple of annoying missing features I’ve waited a longtime for CI to add but have yet to do it: full unit-testing and ORM. For ORM, there have been many third party addons/sparks that would add the functionality but not from base install. Unit testing is a much bigger problem in CI. There is no good way to integrate php-unit or simpletest to test your code. So we are left trying to unit test with the joke implementation of unit testing library from CI.

I’m hoping Laravel will prove to be as amazing as what people have been raving about in the blogsphere. Can’t wait to give it a shot.

Ubuntu 12.04 LTS Beta Is Out

There are supposed to be many changes in the upcoming release of Ubuntu desktop. One notable UI change is HUD (Head-Up Display) where you can type a menu command to get to an application’s functionality without navigation through the menu system. It is useful for users who are experienced with an application and know what they want to get to without menu, sub-menu, sub-sub-menu, etc.

I will need to do a VirtualBox install to play around soon.

How To Keep An Android Service Running

How to keep an Android service running? This is kind of a trick question as the best practice is to not keep an Android service running. If you need to have something done continuously by your app via a service, the service should be started by an AlarmManager at a regular interval and kills itself after the task is done. The reason for this is that a long running service on Android is up to the OS to determine priority and in some cases would stop running. By using this methodology, you are treading lightly since the service does not stay in memory.

Here is some sample code.

Service implementation

public class HeartBeat extends Service {

	public IBinder onBind(Intent arg0) {
		// TODO Auto-generated method stub
		return null;

	public void onStart(Intent i, int startId) {;

	public Runnable beat = new Runnable() {

		public void run() {
                    // Do something

The AlarmManager that starts it.

			Intent iHeartBeatService = new Intent(this, HeartBeat.class);
			PendingIntent piHeartBeatService = PendingIntent.getService(this, 0, iHeartBeatService, PendingIntent.FLAG_UPDATE_CURRENT);
			AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
			alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), 1000, piHeartBeatService);

Now the heartbeat service will start every second and do something and kill itself.