The Gods Must be Crazy

November 30th, 2008

Okay, I know the Maori are from New Zealand and The Gods Must be Crazy was set in Africa, but I could not resist this fantastic oil of Hinepare.
I don’t speak Maori, do you? I understand, and appreciate, that one of Ubuntu’s strengths is its embracement of and support for the international community. Hell, Linux as we know it today wouldn’t exist if it wasn’t for developers, maintainers and support people from all over the planet.

Language Packs

With that said, I have a a bit of an ax to grind with Canonical. After first booting up my brand new Ubuntu 8.04 LTS (Hardy Heron) desktop/development server and logging in and starting the Gnome desktop, the Update Manager indicated I should upgrade some software. I was of course expecting this. What I wasn’t expecting was 500+ pairs of language packs—some I’d never even heard of. There are a number of reasons this annoyed me. For one, other than my native English and perhaps some languages I’m at least familiar with (Spanish, French, German, etc.) there was no need to waste CPU or my time, god only knows how much disk space, and, worst of all, I knew that in certain applications if you selected a menu (the Firefox spell checker came to mind) you’d end up with and option list from here to Auckland. So I spent the better part of half an hour unchecking all these language pack updates and ran the updater on the rest. That seemed reasonable, if a tad bit tedious.

But oh no, the next day Update Manager was back with a vengeance, once again suggesting I install all these language packs. This time I relented, but waited until just before bed to run the damn thing. I know what you’re thinking, I’ll get to that in a moment.

System -> Administration -> Language Support: My saving grace, or was it?

Language Support

Call me a n00b, but it wasn’t until after all of this and doing some research that I realized I could use the Language Support tool to disable all of these obscure (at least to me) languages. If you’re wondering why Maori is checked in the screenshot, well, a weak attempt at humor I suppose.

The Agony of the Desktop

Okay, now comes the really strange, and by far the most frustrating part. After all of this was said and done, at least in my mind, I wanted to move the new machine from its temporary digs to my office and add it to the network. This of course entailed shutting the server down, which I am loathe to do with any Unix-like machine. I would prefer the sucker to hum along nicely for a good long while barring any catastrophies like a power outage that lasts longer than a UPS. But it needed to be done, so move it I did. With everything ready to go, I booted it back up, got my Gnome login screen, and then nothing. Just a blank screen, save for the default butternut squash colored background. No menu panel, no Hardy Heron desktop background image, nothing. I sat there and stared at it, dumbfounded.

It Gets Stranger

Finally, after a bit a gray rectangle, that was obviously the beginnings of a window of some kind, appeared in the upper left corner of the screen. Only no window, just the metrics of one. I assumed this was X11 trying to tell me something, but what it was at first remained a mystery. So I tried C+A+B to restart the display manager—same thing. Then I tried C+A+F1, waited for a bit, then C+A+F7, and waited at the squash screen a little longer staring at the gray box. Finally, an error window appeared:

There was an error starting the GNOME Settings Daemon

WTF? Even stranger, after I dismissed this error dialog my panel icons mysteriously had changed, but after a few minutes, poof! They changed back. So, naturally, it was time to fire-up Firefox and visit good old Uncle Google. After searching and reading I found the page I was looking for and it made perfect sense in hindsight. I, of course, had shot myself in the foot when I was configuring my network interfaces.


Always, always, make sure you have the loopback (lo) configured properly and you can ping yourself. In /etc/network/interfaces:

# loopback interface

auto lo
iface lo inet loopback

In /etc/hosts/: localhost lo [hostname]

Where [hostname] makes you happy. Restart networking:

$ sudo /etc/init.d/networking restart

Ping yourself:

$ ping -c4 lo
PING localhost ( 56(84) bytes of data.
64 bytes from localhost ( icmp_seq=1 ttl=64 time=0.030 ms
64 bytes from localhost ( icmp_seq=2 ttl=64 time=0.027 ms
64 bytes from localhost ( icmp_seq=3 ttl=64 time=0.027 ms
64 bytes from localhost ( icmp_seq=4 ttl=64 time=0.028 ms

--- localhost ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 2997ms
rtt min/avg/max/mdev = 0.027/0.028/0.030/0.001 ms

Finally, restart the display manager aka Gnome desktop to make sure…problem solved. Phew!

Thanks Arun.

See Also

Linux , , , , , , , ,

Hardy Heron is Here

November 27th, 2008


Finally, a default Ubuntu desktop background that doesn’t suck.
The new Ubuntu desktop/development server just arrived (a week early I might add). I’ll be running Ubuntu 8.04 LTS (Hardy Heron) with a whole bunch of packages installed for local Web development. It’s about time I had a decent server.


After the prerequisite setting of the root password, creating a group and login for myself, and installing a few dot files to get comfortable, it’s time to install the ubiquitous stack—with a number of goodies thrown in:

$ sudo apt-get install\
  mysql-client\   # for C/Perl client interfaces

At this point, you might want to get yourself a coffee or something—that’s a lot of software to download, build and install. When complete, you will most likely need to make some changes to your config files: apache.conf, php.ini, my.cnf, etc.

If any of these packages complain about missing dependencies, try:

$ sudo apt-get build-dep [package]
$ sudo apt-get install [package]

You should probably consider changing the Apache/MySQL user/group daemons, and set the MySQL root password. Once you’re good to go, start the server:

$ sudo /usr/local/apache2/bin/apachectl start

And visit http://localhost/

If everything went well, you’ll get a welcome screen. I usually drop a little PHP script into docroot (normally /var/www/) to review settings and such:

<?php phpinfo(); ?>

If you’re planning on using the Xdebug profiler, you might want to check into Cachegrind and the various alternatives for viewing the output.

MySQL Toolkit

Speaking of goodies, Maatkit (formally MySQL Toolkit) includes:

And a whole lot more.

$ sudo apt-get install maatkit


You can’t write code without an editor. My personal favorite:

$ sudo apt-get install vim-gnome

Tweak it any way you like. Some good places for tips:

If you prefer an IDE over the command-line, then I recommend Eclipse. NetBeans is another choice, however Eclipse shines with PDT installed. Eclipse requires a JRE, as does OpenOffice (OOo) for some features. If you are having problems with the one already on the box, try installing the Sun JRE:

$ sudo apt-get install sun-java6-bin


QGit screenshot, how sweet is that?

Version Control

git Only fools still write software without maintaining their code in version control repositories.

$ sudo apt-get install subversion libapache2-svn
$ sudo apt-get install git-core git-svn

Git fans should be interested in QGit.

Other Development Tools

Depending on the complexity of your project(s), whether this server is being built for a single developer working on a brand new application, or perhaps it will be used for multiple projects, some already off the ground, with multiple developers, and so on, there are some other tools that are worth considering. Trac combines issue/bug tracking, a wiki, and an interface to Subversion. Bugzilla is another very popular alternative, and there are other choices.

mediawiki If you decide a bug tracker isn’t required at this juncture, don’t overlook the importance of documenting your work. There are all sorts of methods for doing this, but I’ve found that wikis are great tools, no matter what the size of the team.

Like Perl, Python is another great tool that excels at all sorts of things besides Web development, and many of the other tools listed here rely on it. Hardy Heron comes preloaded with Python 2.5. If you want to upgrade to 2.6, it’s a little tricky since, as of this writing, no Debian package exists for it. Why, I’m not sure. But you can build it from source. This article will help.

Productivity Applications

  • OpenOffice — word processing, spreadsheets, presentations, draw…
  • Gimp — who needs Photoshop? Or the price tag.
  • Inscape — who needs Illustrator? Ditto.
  • Pidgin (formerly Gaim) or Empathy — IM/chat clients.
  • Thunderbird — email client.

firebug There should be no need to mention Firefox. Or the wealth of addons that make Web development so much more rewarding than in years past.

The Price is Right

The price of hardware has steadily fallen over the past few decades, while throughput and the quality of software have been inversely meteoric.

Server Hardware

  • Pentium dual-core processor E2200 (1MB L2, 2.2GHz, 800FSB).
  • 2GB dual channel DDR2 SDRAM at 800MHz.
  • Intel Graphics Media Accelerator 3100 (this isn’t for gaming).
  • 250GB Serial ATA hard drive (7200RPM) with DataBurst cache.
  • 16x DVD/RW drive.
  • 10/100 Ethernet.
  • 7.1 Channel audio.
  • USB Keyboard/Optical mouse.

Price: $250. You heard me, but that’s without a monitor. I have a 22” FS that will do just nicely, thank you.


A downright embarrassment of riches. Which also contributes to the low cost of the hardware itself, since you aren’t paying all those commercial vendor licensing fees. I won’t name names. No I didn’t build the server myself—my hardware days are over.

Price: $free.

A special thanks and kudos goes out to the thousands of open-source developers, maintainers and supporters who work countless hours to bring us all this fantastic software. The Web, and our lives, wouldn’t be the same without them.

Life is good.

See Also

More of the above, as they roll in.

Apache, Linux, MySQL, PHP , , , , , , , ,

Cheat Sheets

November 25th, 2008


Dave Child’s Regular Expressions cheat cheet.
Dave Child loves Jack Daniels, but apparently they don’t love him.

Dave has got to be the king of high-quality cheat sheet designers, most of them created for Web developers. I recently discovered that due to pressure from the “fine” folks at Jack Daniel’s, he was forced to take down the domain—although they kindly agreed to redirect requests to his new domain, at least temporarily.

While in the process of updating my database so the links don’t eventually go stale on me, I got to thinking. Why not post a list of the best developer cheat sheets out there? If I overlooked any, by all means drop me a comment. Of course Dave is well-represented, but he certainly doesn’t cover every topic. You can also make suggestions and vote on ones that are in the works at his blog.

The reverse is also true. Dave has cheat sheets I don’t list. Why? Because I’m not terribly interested in ASP or World of Warcraft, for example. I personally think cheat sheets are handy: stick ’em on your office wall then you don’t have to reach for and thumb through that reference book, or get lost in a sea of unrelated Google search results. And although Dave isn’t the only person offering these resources, most of them come in one or more image formats (PNG, sometimes SVG) or PDF. Most cheat sheets are designed for printing, and many are in landscape format.

But this isn’t the only solution for quick reference material. There are plenty of online synopsis pages which you can bookmark, or even Firefox extensions for this sort of thing. DevBoi is one (an unfortunate name, I must say) that runs in your browser’s sidebar and offers reference material on HTML and XHTML, CSS, JavaScript and DOM, and has addon packages for PHP, XUL, RoR, and Prototype. What, no jQuery Martin?

Dave Child

G. Scott Olson

Jonathan Snook


I’m sure I’m missing some. Anyway, enjoy.

Apache, CSS, Extensions, JavaScript, MySQL, PHP, Programming , , , , , , , ,


November 24th, 2008

gearsmonkey Have you ever wished you could access Wikipedia from your laptop while on that 4-hour flight? Oops! No internet connection, you’re out of luck. Until recently.

If you have Google Gears installed and are running Firefox with the Greasemonkey extension you can tackle this challenge, and once you know the technique you can access almost any Web site offline. For Web applications that are designed to take advantage of this technology, you can even save data seamlessly to your local disk, and as soon as you’re back online it will sync with the remote server. This blog, built from WordPress, is already Google Gears enabled.

There are several steps involved in getting this to work. First, install Greasemonkey if you haven’t already. Next, install and enable Gears. Then install the Gearsmonkey script. It will utilize all three components of Gears:

  • LocalServer — capture URLs.
  • Database — store URLs and other data locally.
  • WorkerPool — run computationally heavy threads in the background.

Visit Wikipedia. The Gearsmonkey script will check to see if Gears is enabled and trigger the allow dialog if it hasn’t. It then inserts an iFrame and initialized Gears on it. The iFrame will contain a Cache Page link, once selected it captures the HTML and CSS of the Main Page and stores all URLs and static media content (images and so on) to the local Gears database. With FireBug installed, you can watch all this taking place in the console log.

Once you understand the technique, and study the code in the user-script, you can adapt it to capture any site on the Web for access while offline.


Extensions, Firefox, JavaScript , , , , ,

CSS Sprites: Performance and Productivity

November 24th, 2008

css_sprites Most Web designers by now are at least familiar with CSS Sprites, and most developers/managers are aware of the benefits of using them. If not, I will run down a little history of sprites and the technique used to take advantage of them on your site(s).


Does anyone recall the bad old days of DOS and the 640k memory limit due to 16-bit addressing? As applications grew in size and complexity (e.g. AutoCAD, which I used to teach), requiring more RAM, programmers used all sorts of tricks like stealing memory (UMA/EMS/XMS) that wasn’t being used by the video card and so forth. All very ugly. But older and embedded systems had even more restrictions on available memory. Video games for example. This is where sprites originated from, a method of compositing several images together that are then mapped onto the screen as the game is played.


With advances in hardware and more available memory, this quickly went by the wayside. Why now, some 20+ years later, are we seeing the same basic technique used on the Web? I’ll get to that in a minute after I explain how it works. Again, you combine many similar images, each usually of the same dimensions, into one composite or library. Then, by displaying only a portion of the image as a background using pixel width and height, with offsets, you get a sort of peephole effect: one icon from a set as in the example above.


Why does this improve the rendering time of a page? Simple. Instead of many HTTP requests for each image, the page makes one request and the browser caches the image. After that it’s trivial, and fast, to expose only the portion you want to display.


But how does productivity come into play? At least for me, I find it is much easier to work with one master set rather than worry about dozens or more tiny little images. If I need to add a new one I just tack it onto the end and calculate the offset to display it. Simple integer arithmetic.

See Also

CSS, Design , , , ,

WordPress and Unix File Permissions

November 22nd, 2008


Learn from the Unix Masters! (okay, I’m not a wizard but I know a thing or two).
For most users, between WordPress themes and plugins, you want permissions on files and directories under your install directory set correctly in order to do nice things like edit your stylesheets (Theme Editor) and save settings (various plugins).

It’s important to keep in mind the ownership of these files and folders (normally you) is not the same as the ownership of the process (your Web server) that attempts these file create/open/read/write operations as a sort of agent on your behalf. Typically, the easiest thing to do is be liberal and set the read+write permissions for owner, group and others (everyone) on files and read+write+execute on directories.

Why execute on directories? I’m not going to get into a long tutorial here on Unix file permissions, but I will provide some helpful links at the bottom of the post.

Now let’s say you wanted to take care of this in one fell swoop so you need never worry about seeing a notice from WordPress, rather than dealing with it piecemeal as you run across the problem. To do this you’ll need shell access to your server and two useful Unix commands: find and chmod (change file modes). In fact, we’re going to use them in conjunction.


The basic layout of the find command is:
find [start] [flags]
  • [start] — the directory to start searching from.
  • [flags] — any number of options to control what happens next.
Under Unix, just as in DOS/Windows, there are two special directories ‘.’ and ‘..’ which correspond to the current directory and its parent. So if you change (cd) into the root of your WordPress install directory and issue the command:
www/wp> find .

it will recursively list every directory and every file on up. Which isn’t very useful in itself, there are easier and better ways to do that. What we want to do is filter the results, and apply a command on each. That’s where the find flags come in. A really handy one is -type [arg]. In our case we want to use two arguments ‘f’ (regular file) and ‘d’ (directory). Try the latter to see what happens:

www/wp> find . -type d
And the same (or rather opposite) is true if you use the ‘f’ argument. Now what we want to do is apply the chmod command on each and every file or directory. To do that we add a second flag to find, -exec, followed be some funny looking arguments. The first one is the command, chmod of course, followed by the mode argument, followed by the placeholder ‘{}’ that represents the results of the find command, followed by a terminating semicolon which tells find just that, stop, I’m done with this execute string. One thing to watch out for here is the fact that a semicolon (and other special characters) have special meaning to the shell itself, so you will either have to backslash escape them or use single quotes around groups of them. We’ll use both techniques.

File and Directory Modes

For files we want read+write on owner, group and others (rw-rw-rw- or octal 666), and for directories we want read+write+execute on the same set (rwxrwxrwx or octal 777). Armed with everything we’ve learned so far, put it all together in two commands:
www/wp> find . -type d -exec chmod 777 '{}' \;
www/wp> find . -type f -exec chmod 666 '{}' \;
And just like that, no more messages from WordPress about not being able to create or update files.

Nice, eh?


However, this sort of approach has a downside—particularly if you’re on a shared host. If this is a concern, and it should be, you can learn a lot more about configuring WordPress at the database level, and file permissions, at How to Install WordPress Securely.

See Also

FreeBSD, Linux, WordPress , , , , ,

Testing Markdown

November 22nd, 2008

This is a link to my old blog.

PHP , ,

The Brave New World of Web Development

November 21st, 2008


Firebug running while I work on aligning floating right images.
firebug You gotta love Firebug!

Extensions, Firefox

Testing user-defined styles

November 21st, 2008

logo This post is simply to test how well it works to have an image float to the right. I have to tell you, it sure is nice to be able to edit the stylesheet directly from the admin area for this theme. You have to make sure the permissions on the folder are set liberally enough for it to work however.

Pretty sweet, no?

I don’t like that caption though, must remove it.


CSS, WordPress ,

Testing Highslide plugin

November 21st, 2008


Slick WordPress logo that looks like the hood ornament off an expensive sports car.

WordPress ,