Building ChromiumOS (The Google OS)

I’ve been watching all of the hype about downloading and running the latest Google creation, ChromiumOS this week so yesterday I decided to take a stab at it myself. I did not however want to simply grab a VMWare image and run it. I’m a software engineer for Pete’s sake! I should build it myself. So how did it go? Read on.

System Preparation

First I upgraded my Ubuntu installation to the latest release (9.10 – karmic), which is actually the suggest/preferred build environment for ChromiumOS. Following that I checked the system requirements and made the appropriate adjustments. msttcorefonts did not show up in the Synaptic Package Manager so I just ran the following command and that did the trick:

freetype-dev was also not listed but I had libfreetype6-dev installed and figured that would cover it.

Next I installed version control clients Subversion and Git. I followed that up with installing the Google Chromium Depot Tools. This is basically a group of scripts that Google uses to managing syncing the code repositories and whatnot.

Obtaining the Code

Next I grabbed the code for the Chromium browser. This is actually optional and you can just download a binary instead, but since I’m going this route I figured I’d go all the way. You can follow the instructions here, which include download a huge tar ball that includes the code, extracting it and then syncing the code with the online repository. The first time I synced:

I received some warnings about third party libraries that were no longer a part of the client so I removed them as suggested. Then I remembered that there was a specific way to run the sync when building the OS so I reviewed the website and re-ran the sync (which I would have done anyway since I modified the code base by removing some directories):

So I ended up with the Chromium code base in /usr/local/chromium.

Next I needed to grab the ChromiumOS code, so I created a directory for that at /usr/local/chromiumos and grabbed the code like this:

Now obviously you wouldn’t be able to run the above as a normal user, you’d need to sudo right? I actually created the directory initially using sudo and then gave my local user ownership of the directory to complete the rest of the steps.

Now the code sync ran for about 10 minutes and then ended in errors. Uh oh… this isn’t looking good if I have errors in the check out phase. The error was:

After that it appeared to try and get an alternates list and recover but it was unable to do so. I figured since it was trying to recover then there might be a good chance that running it again would solve the problem. So I reran the sync and it got a little farther before it stopped with failures. Then on the third run it finally grabbed all of the code. I guess the third time really is the charm!

Building Chromium OS

The steps in the build process are all pretty straightforward and I didn’t have many problems. Initially if you are going to build the browser portion, you do that before building the OS. During this phase I actually ended up in an infinite loop. After going back to the docs I set the following environment variable:

and that fixed the problem.

Then the building… and building… and building… process took a looooonnnng time. Other than that it was pretty uneventful.

Running Chromium OS

Having gone all the way through I now had a VMWare image of the Google Chromium OS. Awesome! So how did it run? I’m not exactly sure. I was able to create a VM for it and attach the image and boot it up. After that I get the login screen. I put in my Google account login credentials and then…. nothing. I just get a blank blue screen with nothing on it and no activity. I’ll admit, it really is a nice shade of blue but generally I’d like a little more functionality in my operating system. Anyway, I guess I did something wrong or I am running it in some way that is incompatible. I’ll try to figure that one out and post the results as soon as I can.

Descriptive Enumerations In C#

I had the desire to create an enumeration in C# the other day and I wanted to be able to attach a description to each item in the enumeration. I did the searching on the internets and put together examples from several sources that I found. Here is an example that ties it all together in a Windows Console applicaton in C#.

Codefetch – Source Code Help and Examples

I’ve been a software engineer for over 10 years now and I’ll be the first to tell you that I can’t just pull any code snippet out of my… umm… brain. And there’s nothing wrong with that! The important thing is to be a good software engineer, a good problem solver; the rest is just semantics.

So the next time you need to know how to create a thread in C++ or how to parse an RSS feed in Python, why not take a look at It’s basically a search engine that lists programming languages that you select and then enter a keyword. The results list example code and help for topics that are match to your search. Pretty awesome! They also list easy links to books that you can purchase on the topic (which I’m sure helps to keep the lights on). You can also click directly on most of the programming languages listed to get to the main homepage for that given language.

How To Use Subversion Over SSH

The Problem

I recently had a problem. I am a software developer and as such I use source control. For this purpose I generally prefer Subversion. I have been keeping my source repositories on an external drive with the intention to back them up to another secure location periodically (yeah, that never happens). I looked into online subversion hosting, but it seems a bit pricey for my few meager projects. I have a web host, but they don’t host subversion repositories over HTTPS as I’ve used in other situations. What to do?

The Solution

Subversion over SSH to the rescue! I actually have shell access to my web host (I can login to the server via SSH) and doing some quick research I discovered that I can run Subversion through an SSH tunnel. Cool! So how might one set this up?

Setting Up The Server

Prerequisites for the server are that you can login to your server via ssh. Got that? Good. Now while logged into your (Linux) server make sure that subversion is installed using the following commands:

Can’t find them? Well, my host has them and they have great rates. You can check out 1and1 hosting here. Once you are sure that subversion is installed you just need to create your repository. I did it like this:

Now just note (or write down) the full path to your repository from the pwd command (print working directory) and your off to setup the client.

Setting Up The Client

There are two requirements for the client setup. First you should install subversion. If you just install a client (ie TortoiseSVN) you may be missing some required files so go ahead and install the real deal. The second requirement is an SSH client that can handle tunneling. If you’ve performed the server setup over SSH then chances are you already have this. I use cygwin with OpenSSH installed so this how-to will be based on that.

Just so you know, subversion does not support connecting to the svn+ssh protocol “out of the box”. If it did then I wouldn’t be writing this article! The actual steps are mostly taken care of in the installation of the two requirements. Now you just need to edit the subversion config file which can be found at %USERPROFILE%/Application Data/Subversion/config. Mine is actually under %USERPROFILE%/AppData/Roaming/Subversion/config for Windows Vista. Do a search in this file for the [tunnels] section. You will actually see a nice description of the svn+ssh protocol there which I highly suggest reading. After that add the following line:

If you installed cygwin in another location then use that instead. Make sure that you use forward slashes too as the backslashes act as escape characters and then you have to use double backslashes and it just looks ugly. Save and close the file and you should be good! Yeah, that was easy.

Testing The Connection

Now to see if it actually works. Open up a DOS prompt (if you’re using Windows). Try to query your subversion repository like so:

Now obviously use the values in that URL that make sense for your setup. If you don’t know how to do that then press the red box with the X in it at the top right corner of your web browser and then turn off your computer! 🙂 Hopefully all will go well. The client will try to authenticate with your USERNAME and prompt you for the password. Then it will connect and execute the appropriate svn client calls on your remote repository and tunnel the results back to you. Awesome!

Now if you want to kick it up a notch (as Emeril would say) then you can try integrating your new remote repository with a nice graphical client. I highly suggest TortoiseSVN as it integrates right into your Windows shell. You could also try using Subclipse or any others that you like.

Free Your Phone With OpenMoko

OpenMoko PhonesCell phones are for the most part proprietary in their platforms. Sure you can write J2ME applications for them. BlackBerry phones also have an API which you can utilize to write custom applications. It’s the actual operating system though that you really can’t get too. Don’t care? Well, then this review isn’t for you. However, if you like to slice and dice things and hack your way to hardware euphoria then read on. is building an open platform for cellular phones. Why? To support what they are calling ubiquitous computing. Ubiquitous computing means more than computing wherever you wander: It means knowing the locale, weaving seamlessly into the local fabric, and vanishing.

So how can you jump on the bandwagon and begin to help building the next open cellular platform? You’ll have to actually buy a Neo1973 phone (pictured above)… boo! Yeah, it would be nice to be able to get a software simulator so that you can poke around for free. Not only that but at the time of this writing they were sold out of the phones so you’d have to wait until they became available again.

The consumer hardware is reported to become available “by years end.” I certainly hope so. Why? Well, I’m not so sure I’ll be jumping on the OpenMoko bandwagon, but I fully support openness in technology and competition. Openness means that more people all over the world can participate and help to make better products. Competition means… cheaper for me! If you want to check out the hardware and software specs and see some more pictures of the new open phone (Neo1973) you can go here.

Coding In Minneapolis

Minneapolis Skyline

I am in Minneapolis, MN this week for business so I’m not sure how prolific my posting will be. So I thought I’d just drop in a quick note to say, “Happy Monday!” It’d be happier if I were back in my home office, but oh well. In the mean time you can check out a previous of mine relating to travel and work – Code On The Road? Work Portability Review. Have a great week!

Software Engineering – Can You Have It Good, Fast And Cheap?

Project TriangleAnyone who has been in software engineering can most likely recognize the old project triangle. The basic premise to this triangle is that in software engineering you may pick only two of the tips of this triangle.

  1. You can create software quickly and cheaply but it will suffer quality.
  2. You can have high quality quickly but it will be expensive.
  3. You can also high quality cheaply but it will take a long time.

Now I do not believe that these are absolutes, but the reality lies somewhere in the middle. As you pull on two of the points of the triangle the third draws closer to the center thus keeping the sum of the angles to 180° (remember high school geometry?).

There have been many good discussions on this topic include this one (Lean and the Project Triangle). I’ve also recently seen some discussion about adding a fourth point into the mix in articles such as this one (The Iron Stool). This article is basically saying the points in the original triangle correspond to Time, Resources and Functionality. He then adds the fourth point as Quality. Though on a very granular level of software engineering you can separate functionality and quality into two separate points I do not think that they should be for the spirit or intent of the project triangle. Instead I would say that functionality and quality would be on the same point as they are both “qualities” or “properties” of the software being built.

So what do you think about the project triangle? Have you even heard of this nonsense before? I’ll leave you with one of my favorite software engineering quotes from a very good friend of mine. He said, “if you want it real bad… you’ll get it real bad.”

Calling A Stored Procedure In Java With A Blob Field

Here is the situation. You are writing a program in Java. You need to access data in a Microsoft SQL Server via stored procedure and the data has an XML field. A what field? SQL Server 2005 introduces a new datatype for XML. It is essentially a blob field that you can perform XML operations on. For the Java program though, it doesn’t really care about that functionality and can just access it to write it out to a file (or process it inline).

JDBC Support

First off you are going to need to check your JDBC driver documentation thoroughly for which operations it supports. There also seems to be some variation in the actual implementation. For example, I tried used Microsoft’s own JDBC driver in my project but it caused a strange SQL Server error to be thrown when writing back to an XML field. I could not get around it (at least not in a timely fashion) so I switched to using the JTDS JDBC driver (go open-source!).

The Stored Procedure

Let us say that the stored procedure in SQL Server looks something like this:

Nothing major going on here, it just executes a SELECT statement against a table and returns four fields. The “LargeXMLField” column is the one we are looking at as a Blob (actually a Clob).

Writing The Code

The actual code to access the stored procedure should be nothing new and is not complicated at all. First we need to connect to the database in the standard fashion.

You will want to substitute real values in where the [host], [port] and [database] placeholders are in the database url.

Next we will use the CallableStatement object to execute the stored procedure.

So you see we use the proc.getMoreResults() to iterate through multiple ResultSet objects that may be returned from a stored procedure. We then call proc.getResultSet() to retrieve the ResultSet that has our data. We fetch our data field as a Clob object and use it’s getAsciiStream() method to get an input stream to read from. After that reading from the stream and writing out to another stream is a straightforward task.

Conditional Statements And Comparison Order – Part 2

In the original posting, Conditional Statements And Comparison Order, I brought up a coding style used by some software engineers that struck me as odd. The practice of placing a constant value first in a conditional comparison. For example:

Listing 1

I never liked the way this reads in code and put forth the question, “why?” Well, this week I finally received an answer to that question. Some developers use this style in order to prevent an accidental assignment within a conditional. So if you forgot one of the equals like this:

Listing 2

So instead of having a bug entrench itself into your code somewhere that it may be hard to trace, this would just cause a compiler error (or runtime error in the case of scripting languages).

Well, I still don’t like it. What do you think?

Pet Peeve – My Language Doesn’t Need That Feature!

I apologize ahead of time for this soap box, but I have just read the nth forum posting with a response like this. I have been a fairly flexible software engineer for the majority of my career and this means that I use many different programming languages. What language do you need? If I do not know it already I can get up to speed fairly rapidly. After all good engineering is good engineering; the rest is just semantics.

That said… when switching to a new language you occasionally need to know how to do something. For instance you are trying to find out how to create a switch statement or create enumerations or some other feature that you are used to in your native language. So inevitably you ask the masses via some programming forum. This is response I absolutely hate!

XYZ feature isn’t in my language because it’s not needed. An array will handle anything in the world that you ever wanted to do. Yada-yada-yada (translation – I’m superior).

Why would you even post something like that? It is NOT helpful to anyone but your own ego. If the requested feature is not in the language why not simply state that fact. Then if you wanted to actually go the extra mile you might suggest an alternative method for accomplishing the same thing. If you really wanted to be nice you could even include a snippet of code to demonstrate the solution. I have no comprehension of why anyone would want to belittle another human who is asking an honest question and seeking help. There is nothing noobish or wrong with that. They are simply looking to improve themselves, which we should all try to encourage.

Can’t we all just get along?