Adding Some Color

This may sound crazy, but the thing I miss the most about Gentoo is its nice, pretty out of the box terminal. I do a lot of work from a good old shell, no matter what the OS. Even on Windows, I often whip out cmd to do basic file management. It is just much quicker and more efficient.As with any environment you spend a lot of time in, it is nice if it is easy on the eyes. Today, I got utterly and truly sick of Ubuntu’s no-color prompt so I busted Daniel Robbins article “Prompt Magic” and built the following prompt:

PS1=”${debian_chroot:+($debian_chroot)}\e[34;1m\u\e[0;1m@\e[32;1m\h:\e[0;1m\w\e[32;1m \$ \[\e[0m\]”
  1. export PS1

The Debian chroot business is lifted from the default /etc/profile. This generates the following:

Imperfect, but much better.

We’ll be back, after this brief commercial message…

I think I have mentioned work on some websites, as opposed to super ultra mega cool compsci stuff. Well, one of them was relaunching http://www.saltmagazine.com/. I probably did the previous version six or seven years ago. While I was in programming, I had done no web programming–the site was poorly designed visually (now that was not entirely my fault) and all static HTML. Not even using Apache SSI, so the navigation had been copied and pasted to every page. That website had been one of my great shames. For this go around, we used a free template modified to show a SALT banner and ran it on top of the Drupal CMS with Ubercart and Authorize.net (die PayPal!). The off the shelf template isn’t as cool as I might like, but it doesn’t look cartoonish like the old one did. At any rate, it is nice to see an amateurish first attempt gone and replaced with a more professional approach.

Anyway, I am writing this post for a slightly different reason. My sister’s first novel (The Last Heir) is available for sale on the rechristened site along with three preview chapters. Read it, buy it. And now, back to Mad Computer Scientist…

A Century of Mad Computer Scientist

A century of posts that is. Not counting this little blogging equivalent of a “FIRST!!!” post, WordPress says I have 107 posts up. Considering the often overcrowded life and lack of time, this isn’t bad. I look forward to making another hundred. So,

ONE-HUNDRED-AND-EIGHT!!!!!

Notes on Building Bespin

Bespin is yet another cool project from Mozilla Labs. Ironically, Mozilla Labs seems to be geek through and through: they create stuff and it pretty much disappears. What software has come out of Mozilla Labs that really moved into mainstream use? Firefox does not count. It predates “the lab”. The idea of Bespin is that you do your code editing online. Cool. Especially for web programmers (which is how I spend the majority of my development time, of late), as it means that you can work on the fly, anywhere that you have an internet connection. That caveat is becoming a smaller and smaller one as of late. With the dawn of netbooks and easy to find WiFi, the idea of coding without an internet connection is becoming the harder sell.

You can already start using Bespin without the hassle of setting it up. Mozilla allows you to create an account and use their software as a service at http://bespin.mozilla.com/. This tends to make me uneasy and has the disadvantage of not allowing me access to the compilers and interpreters I love to play with. So, here is how you go about taking the latest source and running it yourself:

  1. Get the latest revision via Mercurial. Normally, I would suggest using a stable release, but in a package this young, no release is stable and the difference between release and head is much larger than usual. Use this command:hg clone http://hg.mozilla.org/labs/bespin/If you do not have, do not want, or cannot get Mercurial, navigate your browser (you do have that, don’t you?) to the URL above. Mercurial’s web interface will come up and you can simply download an archive (zip, gz, bzip2) of the latest revision.
  2. Bootstrap the setup. Bespin’s backend is written in Python and uses a fair number of Python libraries. The easiest way to get all the dependencies at their correct versions is to install the libraries into a virtual environment–which is basically all the bootstrapper is for. To do this, enter the directory you grabbed above and run the command:python bootstrap.py –no-site-packages
  3. Bespin uses some very specific versions of two libraries: Path and Paste. Development revisions, as of this writing. To install the correct version of Path, run this command:
    bin/pip install http://pypi.python.org/packages/source/p/path.py/path-2.2.zip
    
  4. Next, run:
    bin/pip install ext/Paste-1.7.3dev-r7791.tar.gz

    to install paste. The wiki is out of date here as it gives the default location has lib instead of ext.

  5. To build a package that you can run on a server, run:
    bin/paver dist
  6. This will spit out build/BespinServer.tar.gz; copy this file (if necessary) to your web server and unpack.
  7. Next, we need to configure Apache (at least, I assume we are using Apache; I am, but I would assume you could run this anywhere you could run it under IIS as there is an ISAPI filter for it, though I do not know how good it is).

Beyond this, I never got anything that worked. I installed the WSGI application, but got continuous complaints from it about missing files. I ran the development server out of the bespin source and it kind of worked, but I reached a couple of conclusions. Bespin is too finicky (dare I say buggy?) for anyone to really deploy outside of its creators and that I didn’t really want to deploy it. Ultimately, it felt like jEdit on the web. Now, jEdit is a fine editor, but I am too wired into the vi mindset to swap for a jEdit wannabe. At any rate, I can see some real potential here and I hope they do well. It’s just not for me. Finally, I am posting these notes to help anyone else who may want to give the whole thing a whirl.

Sources

Some thoughts on Linux Gaming

As my previous post may indicate, I’ve been interested in setting up a few games on my Linux box. As I have been reading articles and browsing around, it seems that many of the highest quality games are not in official repositories and require adding new repositories (like UFO:AI) or compiling from source (like FreeOrion). There aren’t many high quality games available for Linux, but it seems like the official repositories do not have many of them available by default. When gaming is frequently cited as a reason not to leave Windows, this seems crazy. Heck, I’ve been using Linux on the Desktop (usually in a dual boot environment) for a few years now and I didn’t know about many of these projects until fairly recently. What would the more newbie-ish users see? Well, they would fire up Synaptic or KPackageManager or graphical YaST, or something like that and see no decent games. A few card games, maybe. The kind of thing that ships with Windows by default. They would google games and see only stuff that runs under Windows. Distros that want to capture the desktop audience (I’m looking at you, Ubuntu and Fedora) need to get on the ball.

An Awesome Tool

I was having some issues with the ordinarily awesome KCacheGrind (it kept crashing, so I couldn’t do anything with it), so I decided to look for another profiling tool. I finally found and installed Webgrind (http://code.google.com/p/webgrind/) and I must say that it is excellent. It appears that, after installing, you must ensure that Xdebug spits out its profiling data with a certain naming convention, or Webgrind will fail to pick it up. This is actually kind of odd, since there is a configuration option in Webgrind which is supposed to tell it what the naming convention is going to be. I could really see Apache/MySQL/PHP/Bespin/Webgrind as being a really cool environment to set up for distributed coding. But, that is a discussion for another day.

Drupals, CMSes, and Thoughts

I have been setting up a couple of Drupal sites of late. Side work. The kind of thing that doesn’t write papers or change the world, but puts a little money in my wallet. For one of these, I have been working on a fairly deep customization of one aspect of Drupal (I haven’t decided whether I will write it up or not) and, in the process, I came across this blog entry: CMS battle: Drupal vs Joomla vs Custom Programming, on a blog named Paranoid Engineering (I sympathize with the title, if nothing else). The article itself was a fairly simple comparison of Drupal and Joomla which are, almost certainly, the biggest open source content management systems.

The table of features head to head is not terribly interesting. For the most part, the two have feature parity and, where they don’t, you can extend them. The first thing I found interesting were the author’s general opinions of the two:

“After test-driving them both I’ve came to these conclusions:

    • Joomla is bloated, Drupal is minimal
    • Drupal is easy to use and intuitive, Joomla is confusing

That was more than enough for a minimalist like me.”

Oddly enough, those were my thoughts exactly when I used them. I got a chance on a contracting gig a ways back to use Joomla and I found its hierarchy of concepts to be confusing. When confronted with something confusing, there are two possibilities:

  1. It is something knew, beyond my current knowledge and learning it will be an eye-opening experience that will teach me something, even if I don’t use it or don’t like it. At least, my mind will have been stretched.
  2. It is garbage

Unfortunately, I felt that Joomla, by and large, fell under #2. I did not feel that I learned some grand cosmic ideas once I got past that initial confusion. I believed that someone had erected a large number of unhelpful, artificial barriers. Drupal (which I learned later), divides content into blocks, which you can assemble on pages. That is it, in a nutshell. There was a lot more classification in Joomla.

Moreover, I definitely fall in the minimalist camp. I would rather take something small and build it up into what I need than take something large and try to strip it down to what it should be. I used to be a Gentooer (and, if I could take a few weeks to set up my machine, I might very well be again; at this season of life I simply do not have the time), but I found the initial time compiling inconvenient. So, I tried Sabayon. Well, Sabayon had the desktop and essential apps compiled, which meant that I could at least work while upgrading everything. The problem was that Sabayon had a lot more on it than I wanted, so I tried to take the fluff off–and I broke the machine. Badly. I was running Gentoo again soon after. The moral of the story being that it is easier to add on than take away. So again, I would tend to agree with the author.

One commentator also remarked that they did not like Drupal because:

“What keeps surprising me about Drupal, is that they still stick to an outdated procedural programming style. PHP is moving more and more to OOP. Trying to force a programming style on a platform that’s moving in a completely different direction is a weird choice to make.”

Personally, I think this is a little harsh on Drupal. According to Wikipedia, the Drupal project began in 2001. Also, by Wikipedia, PHP 4 was released in May 2000. However, most servers are not running the latest release of a language (don’t shoot the messenger, it’s true) so writing in PHP 3-isms in late 2000 and early 2001 seems quite reasonable and, while PHP 4 had some OOP in it, I can tell you that it is second rate and actually pretty lousy. Frankly, if I had to write PHP 4, I wouldn’t use its OOP. I know this because I have deployed code to servers running PHP 4 and had to backport the PHP 5 style classes. PHP 4 is just not a good environment for OOP, PHP 5 is okay and we’ll see how PHP 6 does. Once your code is heavily procedural, fully OOPifying it would be a rather non trivial amount of work, if not a rewrite. And, of course, Joel on Software tells us not to rewrite.

The comments were probably more educational for me than the post. The commentators mentioned a few alternatives to the usual Joomla/Drupal dichotomy. The three I noticed there were:

  1. Typo3
  2. SilverStripe
  3. Modx

Of the three, the only one I had heard of was Typo3, SilverStripe and Modx were new ones. Typo3 aims to be, in their own words, an enterprise level content management system. Modx, on the other hand, really caught my attention. It is not so much a CMS (although it has one) as it is a framework to build CMSes. The approach is interesting because with Drupal, Joomla, or Typo3 you take the base CMS and add a lot to it. You customize it. The idea of simply expediting a custom rolled solution certainly has some appeal over stack and restacking the blocks/modules/plug-ins/add-ons (or whatever the heck else they’re called). I didn’t spend much time looking at SilverStripe, but it does appear to be a very well polished CMS.

If all this sounds like a ramble, well, it is. It is a rambling exploration of a series of things I stumbled across. If anyone has any thoughts regarding the CMSes above or one that I have omitted, I’d love to hear about it/them.

QuickTip: Changing Linux Timezones

Run:
ln -sf /usr/share/zoneinfo/US/Mountain /etc/localtime

Assuming, of course that US mountain time is what you want. Substitute the right country and zone. I read a couple of people saying that you have to logout to see it. You may have to–I didn’t.

Running Smokin’ Guns on Ubuntu 9.04

I first read about Smokin’ Guns (http://smokin-guns.net) on one of several reviews of the state of Linux gaming.

First, download the binary zip. I found it easiest to go to the quake.fr mirror (http://www.quake3.fr/index.php?f_id_contenu=1150&f_id_type=) for the download as it is one of the few mirrors that does not require registration (die, FilePlanet!). Once you unpack the download, you will find that the Windows and Linux binaries are packaged together. You will need to run:

chmod +x smokinguns.x86

To make it executable. Once I did this, I got errors about OpenGL and OpenAL not being found, despite both being installed. The bottom post of the linked page gave the first part of the solution. You have to sym link the libraries to the ones that Smokin’ Guns expects. The commands from the post below are:

sudo apt-get install libopenal1
sudo ln -s /usr/lib/libGL.so.1 /usr/lib/libGL.so
sudo ln -s /usr/lib/libopenal.so.1 /usr/lib/libopenal.so.0

Once I did all this, the game would start, but no sound would come. Here were the relevant errors:

—— Initializing Sound ——
ALSA lib pulse.c:272:(pulse_connect) PulseAudio: Unable to connect: Connection refused

ALSA lib pulse.c:272:(pulse_connect) PulseAudio: Unable to connect: Connection refused

AL lib: alsa.c:344: Could not open playback device ‘default’: Connection refused
Failed to open OpenAL device.
Could not mmap dma buffer PROT_WRITE|PROT_READ
trying mmap PROT_WRITE (with associated better compatibility / less performance code)
/dev/dsp: Input/output error
Could not mmap /dev/dsp
Sound initialization failed.

A little bit of trial and error showed that the pulseaudio server needed to be installed. Ubuntu 9.04 ships with the client, but not the server (why, given that a number of apps apparently need it?). So, running

sudo apt-get install pulseaudio

solved the problem. Interestingly, this incidentally fixed another problem I was having. Playing Flash video (or games) in Firefox would lock up sound system wide until Firefox was killed. Once the pulseaudio server was installed, the problem went away.

I am going to give the game a shot (no pun intended) and see what I think of it. I just noticed that the game wasn’t quite click ‘n go for Linux users and wanted to make a note of my experiences.

Sources

I think I’m Developing a case of NIH

Oh, I’m catching Not-Invented-Here Syndrome and catching it badly. I’ve been using OpenGoo and thinking about how easy it would be to write a better version from scratch. I was considering moving my feed reading to a web based application (Gregarius), and begun thinking about how easy it would be to pick up some RSS tools and build my own. I’ve played with Bespin and been thinking that I could do better.

Yes, I know. It isn’t that easy. I also know that I haven’t got the time to maintain my own web office software, web development environment, and web based feed reader. It’s how Sourceforge earned its nickname Sourceforget.  But, you see, if I just busted out my tools it wouldn’t take that long…