Monday, December 31, 2007

XO Laptop On Its Way

While high on Vicodin after my knee surgery, I disobeyed the post-surgery advice that said not to make any big decisions and I purchased an XO Laptop through the Give One Get One program. I really should have written about this sooner, because now it's too late for me to talk anyone else into doing it with me. The program ended December 31st. I think I was feeling a bit guilty about spending the money, especially while under a pain-killer induced haze. I'm not usually that irresponsible! The more I learn about the laptop, though, the more the guilt is replaced with excitement. This is one freaking cool computer. The video of Ivan Krstic impressed me the most. Custom ASICs, extreme power management, and serious security (and he's from Croatia, where I lived for two years. Bok, Ivan!), what more could a geek want?

Because I didn't order at the beginning of the G1G1 program I knew my laptop wouldn't be arriving in time for Christmas, but I was hoping maybe it'd come in time for my birthday (which is the day after Christmas...). Now that's it's almost January, the suspense is killing me, when will it arrive? I searched around a bit and found this great bit of advice, and called FedEx today. My package from Brightstar is scheduled to arrive this week (they actually told me which day, but in case you are planning on hiding in the bushes at my house and intercepting it, I'm not telling)! Now I'm really excited. I have to keep reminding myself to tone down my expectations a little. It is geared for kids and education, not movie watching and game playing, after all. I figure that as long as I can read my email with it on a road trip, it'll be worthwhile. I'll feel warm and fuzzy about the child in Cambodia (or wherever) who gets one too.

Sunday, December 30, 2007

Lego Digital Designer

My boys got some Legos for Christmas (of course!), and my 7-year old brought me the brochure that came with his set and said, "Dad, go to legoshop.com!" I obliged and he, my three-year old, and I had fun looking at the expensive Death Star and Millenium Falcon sets for a while. Then we poked around some more and discovered the Lego Digital Designer, which is a very cool program. It basically let's you build with Legos on your computer in 3D--kind of a little Lego CAD program. Finding pieces is much easier than digging through the big pile on the floor. You can rotate views, zoom in and out, and play to your heats content. You can also take screenshots of your designs, print them out, or even send your designs to Lego and they'll box up all the pieces needed for it and sell the kit to you. Genius!

It gives you some base models you can use to get started. My boys liked starting with those and they had a lot of fun just discovering the pieces that were available and how they fit together. This expands their collection a lot, and Mom doesn't have to worry about our one-year old finding small pieces on the floor to eat. Here's a screenshot of one of their creations:

You gotta love the disembodied heads.

The widoze software (there was a Mac version too) runs under wine on my two Gutsy Gibbon boxes (one for each boy, luckily). The fast Core 2 Duo machine seems to have no problems with it, but it locks up the old Celeron machine at frustrating times. Overall, It's really fun to play with. I'll probably have to install it on my laptop too so I don't have to fight my boys for time to play.

Friday, December 21, 2007

My c-x c-s Muscles Are Getting Tired.

I've used some of the online office apps a bit, such as Google Docs, and I really like that you don't have to continually save your work. They take care of that for you. The blogger web interface that I'm using to type this entry does the same thing. A few people I work with are big Microsoft One Note fans, and it doesn't even have a save button.

I believe it's time for emacs to save my files for me. I have a c-x c-s twitch that I'd like to get rid of. I hunted around a bit, thinking that I couldn't have been the first emacs user to think of this, but I didn't have much luck. It turns out that Emacs does save your work for you automatically, but it's not quite what I'm looking for. It saves to separate back up files that you have to use special commands to recover information from, and it still bugs you about saving whenever you do things like compile or exit. Of course I want to save my work!

Is there really no good auto-save feature for emacs?

Saturday, December 15, 2007

Resize a QEMU/KVM Windows Disk Image

After playing with kvm and qemu during my knee surgery recovery, I got hooked. I have a working windoze XP install running under kvm on my Core 2 Duo, Ubuntu Gutsy Gibbon box, and it flies. It almost, almost feels like native speed (I also got help here and here). It's great. Except, not being a regular windoze user, I'd lost track of how much space a windoze installation (and all the service packs and security updates) needs. When I created my original hard drive image file I made it 6 GB, which, it turns out, is too small. I didn't want to just create a new disk image and re-install, it took a lot of work to get this image up to it's full 6 GB glory.

I hunted and found some instructions for resizing qcow (qemu copy-on-write) disk images, but they just didn't work for me. Once I converted from qcow (qcow2 actually) to raw, windoze wouldn't boot on the raw image. Gparted didn't show any partitioned drive space either. Then I remembered I'd always wanted to try clonezilla. Perfect. After downloading the bootable clonezilla iso, and the bootable gparted iso, I went to work like so:

First, create a new, bigger drive image (Don't worry, it will start really small and grow as you use the space):

qemu-img create -f qcow2 windoze.qcow2 100G

Next, boot up windoze with this new second hard drive (this also shows some of the extra options I use to get sound and stuff, as well as wrapping it all in aoss so I can hear the annoying windoze boot-up sounds):

aoss kvm -soundhw all -cdrom /dev/cdrom -localtime -m 512 -hda original-windoze.img -hdb windoze.qcow2

I don't know if that was needed, but a "Found New Hardware" bubble came up and I felt good that the second hard drive seemed to have been found.

Next, boot from the clonezilla CD image:

aoss kvm -soundhw all -cdrom ~/downloads/clonezilla-live-1.0.3-21.iso -localtime -m 512 -hda original-windoze.img -hdb windoze.qcow2 -boot d

Then you go through the clonezilla wizard to clone the one hard drive to the other. This was very straightforward. I went away for a few hours and when I came back it was done. I'm not sure how long it took.

I think I booted windows again at this point with just the new windoze.qcow2 image to make sure it worked, and it did. Amazing.

Then I booted gparted to grow the partition to be the full size of the disk:

aoss kvm -soundhw all -cdrom ~/downloads/gparted-livecd-0.3.4-10.iso -localtime -m 512 -boot d windoze.qcow2 

Gparted was very simple to use and it grew the ntfs partition to the full 100 GB in about 2 seconds. One more reboot back into windows and I had my new, larger virtual hard drive all working. Pretty sweet.

Saturday, December 8, 2007

Next Big Language--UML?

I took a class at work called, "Real-Time Software Design with UML 2.0." The instructor seemed to think that it was destined to be the Next Big Language. I have my doubts.

When I design with code, I can type it very quickly and even somewhat sloppily into a code editor. The editor will then take care of formatting it all nicely, indenting, spacing, presenting with an nice font, colorizing the various code constructs, and so forth. I just have to get the ideas expressed and the tool takes care of most of the formatting for me. Even more, it's saved in a simple text format that is universal. Any text editor on any operating system will understand it. Once I've written the code, I then have a compiler and/or linter that will tell me if I've left off any key constructs, made any syntax mistakes, or any of a number of common logical errors. Basically, with the good tool support that is out there, I can write code as fast or faster than I can dream it up.

With UML, from what I can gather, it seems like you get none of that. You either draw on paper or a whiteboard which obviously makes the formatting a manual process. At least a whiteboard is easier to erase and redraw something than paper, but I'm still very slow at drawing stuff out, and I find myself either spending too much time making sure my boxes and lines are neat and nice, or I end up with an incredibly messy drawing. With Visio or other diagramming tools, you get nice straight lines, but you still get to worry about the niggly things like where to place your bubbles and boxes, how to arrange your arrows. Should it flow from left to right or top to bottom or just have a spaghetti mess of boxes and arrows all over the place? Not to mention there is nothing to verify that you are using proper UML syntax, and that you haven't left anything basic to a coherent design out. I find that having to think about all these details distracts me from the actual design work. Then, once you've painstakingly drawn it all out in one tool, you are stuck with that tool. Want to share your design with someone else? Sure, you can print it (did you draw it so that it fits nicely on letter size sheets of paper?), or export it to a PDF, but if someone else wants to edit the diagrams, they need to use the same tool you did. Let's not even mention collaborative design editing and revision control.

Despite all this, Glennan Carnie from Feabhas told a very convincing story this week. I came into this course very skeptical, and for the most part he had an answer for all of my concerns. And pretty good answers too. In a short, intense, week-long course it's hard to evaluate whether everything he says is really practical and useful in the real world, but the way he tells it I'm at a point where I'd be willing to give it a try...I mean, have a go at it (did I mention Glen is British?).

This course was not at all what I expected. Glennan freely pointed out all the flaws, idiosyncrasies, and shortcomings of the UML standard, other UML proponents, and even his own lecture slides. He made sure to point out more than once that UML is no silver bullet and that design is still difficult to get right. Instead of presenting UML in glowing worshipful tones, he presented it as a useful tool that can help you systematically design an entire object oriented software system. A tool which can be used to design first at a high level, ignoring implementation details, and then which can be used to refine the design down in a number of steps all the way to the nitty-gritty details of deciding how big a message queue is needed to communicate between two threads, and what the format of the message should be. It's very impressive.

Still, I wonder how it would work to go from an ideal solution to the heavily constrained designs that are needed for my work. Low-level ASIC driver stuff would be an interesting case-study. Too bad we didn't have more time with him to get into some of our own stuff like that.

Course description.