Archive for the 'Open Source' Category

Pope and Bacon a dangerous combo

Saturday, October 27th, 2007

After meeting Ubuntu zealots Alan Pope and Jono Bacon at Fosscamp this morning, I made the mistake of leaving my laptop screen unlocked within the range of these two dangerous characters while I went to the bathroom. What’s worse, I left a terminal window with a root prompt open on the desktop. (I don’t remember why– I think I was installing some software earlier.) When I got back, this so-called “Pope” had blown up the font size on my terminal window and added “rm -rf /” at the root prompt.

It was good for a laugh. Unfortunately, I didn’t have the poise to take a screenshot.

Later, it was revealed that the Bacon, not Pope, was the instigator, or so says Pope.

Note for the non-haX0rs in the audience (I guess that’s you, mom): “rm -rf /” is a command that recursively deletes all files in your filesystem. Incidentally, I did once execute that command on an OS X server that I was maintaining a few years ago. I needed to reinstall OS X for some reason, so I tried executing the legendary command. It was pretty sweet– various programs on the desktop crashed, services disappeared, and the machine was eventually rendered unbootable.

Anyway, I won’t make the mistake of leaving my laptop unprotected when Bacon is on this side of the Atlantic.

One other interesting note from Fosscamp– I talked to Ubuntu Linux founder Mark Shuttleworth for a few minutes after one of the morning sessions; he mentioned that the Dell Linux machines that I was so excited about a few months ago were actually Dell’s idea. I had assumed that the whole Dell Ideastorm business was more of a marketing exercise, while Dell and Canonical had actually been planning Dell PCs with Linux for a while. I guess I was wrong.

Extracting files from a directory tree

Saturday, October 6th, 2007

Mr. Ben Polito has recently beating his drum to the tune that I am a repressed mechanical engineer who needs to release his inner software engineer.

Normally, I am too busy with preparations for the arrival of the Hard Times to spend time busting the myths spread by a sailor in the dark, but a recent problem I ran into at work gave me pause. The first version of our corporate wiki, a tweaked version of mediawiki, left a hierarchy of a few hundred directories sprinkled with around 1600 files. These files were attachments to the old wiki, and while most of them were transferred to the new wiki, some were not.

I thought to myself, “Ah! I bet I could write a little Python function that recursed through the directories, copying out the files and calling itself for each subsequent subdirectory!” This was Friday night around 10, after a day spent writing PLC code for work. It was at this moment that I thought, “Perhaps Mr. Polito has a point.”

To that end, I present Pylito.

Python on the Gumstix Verdex

Sunday, July 22nd, 2007

Being both a Python zealot and an embedded systems zealot, I’ve been looking for an embedded system that I can program in Python. Most of the embedded code I write professionally I write in C. Having learned Python a few years ago, I’m finding C increasingly painful, approximately in proportion to my facility with Python.

Thus far, it seems that the Gumstix Verdex may be the answer I’ve been seeking. The Verdex is an embedded Linux board, about 1 inch by 3 inches, based around Marvell’s (previously, Intel’s) XScale PXA270, common in PDAs and cellphones. It uses around 1 W of power in its quiescent state (not suspended, but not at full processor load either).

I was able to compile a new binary image including the Linux kernel, various utilities, and Python 2.4.2 and upload it to the Verdex using the Gumstix’s console-vx serial interface board. (I seem to have hosed the ethernet interface at the same time, but I’ll worry about that later.)

The ultimate goal (well, for now) was to test on an embedded processor Pysolar, the Python sun-tracking code I’ve been writing. The Verdex I have, the XL6P, runs at 600 MHz. The Pysolar test suite executed in around 1.2 seconds. On my desktop Linux machine, the same test suite executes in 0.012 s. The fact that the times vary by a factor of precisely 100 makes me a little suspicious, but it doesn’t seem impossible that a desktop could beat an embedded computer by 100x.

OOXML is not fully documented by ECMA 376

Sunday, July 8th, 2007

Comment sent to Massachusetts about their bone-headed inclusion of ECMA 376 (OOXML) in their latest draft of the Enterprise Technical Reference Model:

Hello,

I’m a long-term resident of Massachusetts; I run an engineering firm in Waltham. I have no affiliation with any company that produces any document format.

I have two objections to the inclusion of Microsoft’s ECMA 376 in ETRM 4.0:

1. As a citizen, I don’t want to buy a certain vendor’s software to read government documents.

2. As a technical professional in a competitive market, I don’t want to pay the overhead of upgrading the de facto standard Microsoft Office every 3 years for no good reason.

ITD had the right idea with its choice of ISO 26300 (ODF) as a single, open standard for government documents.

In the engineering work that I do, we need to maintain two sets of tools– one in metric units and one in English units. The choice of two standards for the same function provides nothing but inefficiency. ITD should not introduce similar inefficiency into government document formats.

It is predictable that no other vendors will implement ECMA 376 well enough to guarantee document fidelity across platforms. To see why, consider this excerpt from page 1379 of ECMA 376:

“If this compatibility setting is turned on:
<w:compat>
<w:autoSpaceLikeWord95 />
</w:compat>
Then applications should mimic the behavior of Microsoft Word 95 when determining the space between those characters, as needed.”

No explanation of “the behavior of Microsoft Word 95″ is given. How might a competing vendor determine all the rules that Word 95 uses for character spacing? Type all possible sequences of characters in all fonts on a computer borrowed from the Computer History Museum, and then analyze the results?

This sort of incomplete specification, found throughout ECMA 376, will mean that nobody other than Microsoft will be able to implement ECMA 376 completely. While ECMA 376 is nominally open, in my judgment, it is so incomplete as to be effectively proprietary. In the language of ITD, ECMA 376 is publicly available, but not fully documented. The predictable result of ECMA 376 adoption will be a series of buggy import functions in competing software, while Microsoft Office remains the government-supported standard.

The same cannot be said for ODF. Many competing products that implement ODF already exist; I’ve been using them for all my personal documents for several years. I understand the objection that the switch to ODF from Microsoft’s closed formats will be painful, but it’s a better choice than upgrading to the next Microsoft format every three years for eternity.

I request that Massachusetts return to its innovative idea of choosing a single, open standard for government documents; I believe that ODF is the best choice for that standard.

Thanks for your consideration,
Brandon Stafford
Cambridge, MA

Finally booting pre-installed Linux on an OEM PC

Sunday, June 3rd, 2007

The Dell XPS 410n that I ordered on May 24th arrived this Saturday. After 10 years of using Linux, I was finally able to order a prebuilt computer from a major OEM without paying anyone for an operating system that I would delete shortly after unboxing. Instead of devoting half of Saturday afternoon to installing Linux, I had a working Linux system 19 minutes after opening the box. I think I probably spent more time picking a desktop background from Flickr than configuring the machine.

Finally booting pre-installed Linux on an OEM PC

I didn’t spend any time installing the DVD drive into the case or washing thermal grease off my hands. I opened the case briefly to take a picture, but I don’t even know how many PCI slots I have. I can feel the freedom of blissful ignorance returning.

I half-expected Dell to screw up Ubuntu somehow– add idiotic icons to the desktop (offers to connect me to the internets, shortcuts to crippled versions of photo editing software, or similar). I’m happy to report that they seem to have gotten it right. The Ubuntu they delivered is difficult for me to distinguish from the Ubuntu I’ve been installing for the past few years. Synaptic is set up to use the ubuntu.com repositories. Compiz is disabled by default. The boot process seems faster, but that may be the new hardware. The 2.6.20-15 kernel was installed; Synaptic installed 2.6.20-16 during the first update.

Ubuntu wasn’t perfect– it did fail to identify my HP f2105 monitor’s maximum resolution of 1680 x 1050, and there was no way that a normal human would have been able to fix it. (I executed sudo dpkg-reconfigure -phigh xserver-xorg and selected the correct resolution to fix it.) Also, the option to enable the restricted Nvidia driver doesn’t work, but I haven’t gone beyond the normal-human level of effort yet.

(Update: after running a Synaptic update, I could enable the restricted Nvidia driver and turn on Compiz– no geek-level intervention necessary.)

Overall, I’m delighted with what Dell and the wealthy gentleman from Canonical have done. For me, 2007 is the year of the Linux on the desktop. I offer my sincere congratulations and thanks to the Ubuntu folks at Canonical and Dell.

Fixing X11 no more

Wednesday, May 30th, 2007

Last week, after building my own computers to run Linux for about 10 years, I ordered a computer from Dell with Ubuntu Linux pre-installed. Don’t get me wrong– I have enjoyed at least 80% of the hacking, crashing X11 repeatedly, trying to disable X11, giving up and using the terminal window at 640 x 480, crashing X11 repeatedly, and so on. In the last 2 or 3 years, Linux has become solid enough that I rarely need to perform tasks akin to surgery. With tested hardware from Dell, instead of hardware randomly selected from different (non-Belkin) vendors, I’m betting that I may not need to edit xorg.conf at all!

As I prepare to enter the realm of normal people, the realm of adults who buy computers to get work done, who don’t know about lolcats or frist psot, HTTP redirection or ARP cache poisoning, SSH or even RSS, it’s time for me to pass on what I sincerely hope will become useless tips.

When your GUI goes crazy, the screen starts cycling on and off, or just searching for inputs eternally:

1. Use Ctrl-Alt-Backspace to stop the X server and drop to a command prompt. Then you can try looking at /etc/X11/xorg.conf to see what’s wrong and restart X using the command startx.

2. Enable sshd as soon as you can, so that something goes horribly wrong, you can still ssh into the machine and execute commands.

3. Use Ctrl-Alt-F2 (or higher F-keys) to cycle to additional terminal windows if, as was generally the case, X is screwed up.

Those three tricks have kept me going for tens, or maybe even hundreds, of hours of debugging.

So, maybe I’ll need these skills again when the hard times come and production of new computers grinds to a halt, but until then, I’m turning my attention to higher level tasks, like implementing a sun-tracking algorithm in Python.

Exavault rsync script

Monday, May 28th, 2007

The company I work for recently started using a service called Exavault to back up our data. We have a server running Linux that logs into our NAS using ssh every night and rsyncs the data with a local directory. It also dumps our mediawiki database (well, used to– we’re using Socialtext now) and subversion repository.

All of this data gets synchronized with Exavault’s machines in Dublin, California.

This has been running with no known problems for about six months. Below are the bash scripts I wrote to do the synchronization.

#!/bin/bash
LOGFILE=/var/log/GME_backup/GME_backups.log
echo "Syncing chemp to Exavault, starting $(date +%FT%T)" >> $LOGFILE
echo "Dumping wiki database" >> $LOGFILE
mv /home/brandon/wiki_backup/wiki_dump /home/brandon/wiki_backup/wiki_dump.old
mysqldump --user=root --password=****** greenmountain > /home/brandon/wiki_backup/wiki_dump
rm /home/brandon/wiki_backup/wiki_dump.old
echo "Dumped wiki database" >> $LOGFILE
echo "Dumping Subversion repository" >> $LOGFILE
mv /home/brandon/svn_backup/svn_dump /home/brandon/svn_backup/svn_dump.old
svnadmin dump /home/brandon/svn/NCL2 > /home/brandon/svn_backup/svn_dump
rm -r /home/brandon/svn_backup/svn_dump.old
echo "Dumped Subversion repository" >> $LOGFILE
echo "Backing up files from Q, SVN, and wiki" >> $LOGFILE
rsync -av --exclude-from=no_backup.txt --progress /home/brandon/Q_backup/ greenmountain@greenmountain.exavault.com:backup-test/ >> $LOGFILE
rsync -av --exclude-from=no_backup.txt --progress /home/brandon/svn_backup/ greenmountain@greenmountain.exavault.com:backup-svn/ >> $LOGFILE
rsync -av --exclude-from=no_backup.txt --progress /home/brandon/wiki_backup/ greenmountain@greenmountain.exavault.com:backup-wikidb/ >> $LOGFILE
rsync -av --exclude-from=no_backup.txt --progress /var/www/wiki/ greenmountain@greenmountain.exavault.com:backup-wiki/ >> $LOGFILE
echo "Finished at $(date +%FT%T)" >> $LOGFILE
echo "----------------***-------------------" >> $LOGFILE

The other script:

#!/bin/bash
LOGFILE=/var/log/GME_backup/GME_backups.log
echo "Syncing Q to Chemp, starting $(date +%FT%T)" >> $LOGFILE
rsync -a --exclude-from=no_backup.txt --progress root@192.168.2.4:/raid/WeatherPhenom/  /home/brandon/Q_backup/ >> $LOGFILE
echo "Finished at $(date +%FT%T)" >> $LOGFILE
echo "---------------------------------" >> $LOGFILE

Barcamp Boston 2

Monday, March 19th, 2007

My favorite quote from the weekend: “I’m just a recreational paranoid.”

Thanks to everyone who represented on behalf of geek power (if that’s even possible).

Deval Patrick appoints Microsoft lobbyist to technology working group

Tuesday, December 5th, 2006

I voted for Deval Patrick for governor of the fine commonwealth, er, state that I live in; I was disappointed to see that he appointed the Microsoft Regional Director for Public Affairs, Brian Burke, to his technology working group. It’s disappointing because Mr. Burke will likely attempt to overturn a great technology decision made by requiring that the state adopt OpenDocument format (recently published as an ISO standard) as its preferred format by January 1, 2007. This would mean that my government would no longer be paying so much for Microsoft Office when cheaper alternatives, such as OpenOffice, exist. It’s true that OpenOffice has its flaws, but as a daily user of Microsoft’s lovely office suite, I can verify that Microsoft Office does as well. (Why, for example, when I search Outlook’s inbox, does it return results from my oldest email first?)
The working group has a public meeting at 7 pm on Monday, December 11, 2006.

Building my own secure mail, file, and web server

Wednesday, March 29th, 2006

After multiple complaints from an irritating associate of mine, I am building a secure server for my various secure computing needs. The complaints have focused on the fact that I have a Gmail account. While I generally agree that allowing a company to host all of my personal email, where it can be indexed, queried, and sold to various individuals and companies around the world, is a bad idea, so far, the worst side effect has been all the Google ads for Dallas real estate. Like I think Kennedy’s really dead!

All the same, I’ve been thinking it would be fun to buy a rackmount server, install OpenBSD, apache, qmail, roundcube, and sshd. I’ll install my public key in sshd so my remote logins and file transfers would be encrypted. I’ll generate an SSL certificate to encrypt the roundcube exchanges. The machine will be colocated at the InterNAP datacenter in Somerville, if I get a reasonably good deal on rack space. Then I just have to guard against physical intrusions into the server and convince everyone who emails me to use GPG, and maybe I’ll finally drop back off the CIA’s radar.

Maybe an encrypted filesystem will be necessary as well. I realize that the US government could just subpoena the bejesus out of me, but at least then I’d know what they were getting. (In reality, this will never occur; I’m just preparing for the day when I actually have something useful to encrypt.)
Comments about the security holes I’m missing are welcome from those who are not the irritating associate.