Sunday, March 30, 2014

Powerbook G4

A few weeks ago, a colleague approached me in the hallway, and asked if the
rumors were true. She had heard that I was a collector of vintage computers and
associated paraphernalia. I couldn't deny this, of course, but added that
nowadays, I am somewhat more selective when it comes to taking on old stuff. She
explained that she had an old clamshell iBook G3 and a another Apple laptop that
was a bit more recent, neither of which were seeing any use. I declined the
iBook, since they're not only bulky but also in my opinion quite ugly. I was
fascinated by the other machine though, and said that I was interested in it.

A couple of weeks later, the same colleague said that she had the machine in her
office. I got sufficiently excited to leave my tea brewing while I went with her
to have a look at the mysterious laptop. Upon seeing it, I quickly recognized it
as a 12" PowerBook G4. It was in excellent condition, and I immediately said
that I'd be happy to take it off her hands. By the time I got back to my tea,
the brew had turned bitter. My latest acquisition, however, was sweet enough
to keep my mind preoccupied while I swallowed down the vile liquid.

What's so special about this machine, then? First of all, the size. With a 12"
screen, it's quite handy to carry around. While it is on the heavy side, it's
easy to squeeze into a briefcase or small drawer. Secondly, it's built on the
venerable PowerPC architecture and thus belongs to one of the last generations
of truly different Macs. It may seem like nitpicking, but to me it has symbolic
value. Every time I see the discreet font printed below the screen and read the
letters "G4", I'm reminded of a decade when Apple was struggling for its very
survival, in a time before the iPhone or even iPod, when Windows had conquered
so much of the operating system market that Microsoft was trying to satiate its
appetite by devouring all competing web browsers as well. It wasn't obvious then
that Windows had reached the height of its success and that it would go downhill
from there on. Apple provided niche products for hardcore customers who
willingly sacrificed compatibility and economy simply because they were
dedicated to their brand. As a person who bought a Saab even after the
bankruptcy, I can sympathize with that mentality. At that time, though, I still
hadn't used a Mac, simply because I couldn't afford one and didn't know any
people with discarded ones. I frequently rummaged through bins of electronic
waste and occasionally found some useful stuff. Once I even found a fully
functional PC, which I later used as a server for a year. But not a single Apple
product.

I remember being in a waiting room once, probably in the early 2000s. I think it
was at a dentist's office or some other healthcare related facility. As usual,
there were thumbed magazines strewn around. I noticed an issue of a glossy Mac
magazine and started browsing it.  The well-composed, impeccably lit pictures of neatly
designed Macs were almost intimidating to my eyes, being accustomed to the drab
grey PC of the 1990s. I dreamed for a moment, then I put it down again, knowing
that I would never be able to afford one.

So, as I sit now, typing this on the Powerbook G4, I can't help but feeling that
the sensation of resting my hands on the aluminum casing, or listening to the
gong sound as I boot it up, marks the fulfillment of an old dream. Unlike the
dreadful clamshell iBooks and their even worse-looking iMac counterparts, this
Powerbook is still pretty to look at. It's proportionate, and the faux-metal
painted keyboard matches the all-aluminum casing perfectly. It may be heavy,
but it's worth it every time I feel that cold aluminum when I pick it up. After
using it for a while, it instead gets warm and cozy.

The 1.33Ghz processor, for all its G4 mystique, is no longer the powerhouse it
once was. The 512 MB of RAM isn't exactly impressive either. Apple has long
since moved on and the last Mac OS X version I can install is 10.5 (Leopard).
Thankfully, there's always Linux. The good people who develop Debian have
maintained support for PowerPC-based machines, even G4s like this one. So, the
first thing I did was format the hard drive, and install Debian 7. Since the
Powerbook has limited hardware assets, by modern standards, I chose not to
include a graphical user interface. That means that the Powerbook boots up to a
text console. This is more than fine as far as I'm concerned. I set up the wifi,
so that it connects automatically to my wireless network at home. Then I
installed a few useful programs, such as Git and Vim. I even included a few
console games: Nethack and Greed.

Since it was broad daylight, I chose a black-on-white color scheme for this Vim session.
















I've already done some work on my thesis on the Powerbook. It's perfect for
sitting down in a comfortable chair in front of the fireplace, and it fits perfectly
in my antique drawer just next to the favorite chair. Not only is this machine
compatible with my current writing workflow, more importantly, it lets me do
it in style. In that sense it's analogous to my antique chairs and tables. Like the
furniture, it deserved a better fate than ending up in a heap of trash.

Thursday, January 2, 2014

Memories of a Compaq Contura

It was the summer of 2005. During the summer break from the university, I spent most of June, July and August in my old hometown, working at my uncle's place. He owns a small plot of forested land, and it had been ravaged by a storm that past winter. Most of the toppled trees had already been stripped of their branches, so the only thing that remained was to haul the logs onto the trailer that was hooked up to an old 1950s tractor, then drive them to the sawing station, haul them off the trailer and onto the sawing rack, cut them up into boards, then stack the boards so that they could dry without getting warped. My uncle has a severe chronic back injury since quite a few years back, so most of the manual labor was up to me. I really enjoyed the work, putting my back into it until my muscles ached, soaked in sweat, inhaling the smell of freshly cut lumber with every deep breath. We'd take long lunch breaks at my grandparents' place, wolfing down generous servings of my grandmother's delicious cooking. Afterwards, I'd make some coffee and relax in the worn leather couch. A couple of hours was just enough to recover from a morning of hard work.

The question was: what to do with those daily hours of rest? I slept well at night back in those days, so no need to nap. Naturally, I decided to undertake yet another time-consuming and ultimately pointless computer project. I didn't have much money to spend, but I managed to find a cheap old laptop at an online auction site. It was a Compaq Contura 430C from 1995. The amount I paid for it was roughly equal to the cost of having the machine shipped to me, a total of around 300 SEK (about $40 at the time) if I recall correctly. It was surprisingly heavy, but pretty compact in terms of size. The screen was tiny, with a maximum resolution of 640x480. The Contura 430C had a 100Mhz 486DX processor. To most people, that means nothing. To me, it brought back nostalgic memories of my old 33Mhz 486SX, my very first computer. Back in those days, I dreamed of a 486DX4 processor, but couldn't afford such luxuries, or even find one. In addition to that powerhouse of a processor, the Contura had 8MB of RAM and a 540 MB hard drive. My machine came equipped with a worn-out battery and a floppy disk drive, with Windows 95 installed. I remembered Windows 95 very well from my youth and wasn't very interested in reliving those particular memories: flashbacks of blue screens, crashes and lag.

Compaq Contura 430C. Image courtesy of Tim Holtan (www.tholt.com/comptop.html).
So, I decided to put Linux on the Contura. By then, I had a fair bit of experience with Fedora Core (as it was called back then) and FreeSCO. Eventually, after a bit of research, I downloaded an old version of Slackware and began the painstaking procedure of installing it using floppy disks. The old 1.44 MB disks were pretty and I miss the feeling of one snapping in place in its drive, but they were also a major pain when you had software spread out on a dozen or more disks. Inevitably, one disk, probably one of the last three or so, would suffer a hardware failure of some sort, spewing out corrupt data. Naturally, this happened to me. Growing up with an underpowered 486 had prepared me well, I knew that persistence was the only solution. After a few hours, I had Slackware up and running on the Contura. Since the hardware of the machine was so limited, I skipped the GUI altogether, relying solely on a command-line console. 

Once I had a basic system up and running, I started to experiment and tinker with all sorts of things, from MySQL databases to typing up text documents in Vim. It was a powerful testament to the flexibility of Linux and the hidden potential of an old discarded laptop. As soon as I had eaten my lunch, I'd immediately immerse myself in that laptop and stay glued to the screen until my uncle decided it was time to get back to work. When the summer was over, I brought the Contura with me to Lund. I spent a few weeks staying at a friend's place, sleeping on his couch. The Contura was the perfect companion, enabling me to tinker with Linux even while living out of my backpack. Shortly thereafter, I moved into a dorm and found myself absorbed in this brand new world and the people in it. The Contura spent more and more time gathering dust. Eventually, it ended up in my basement storage. At some point, probably a few moves later, I threw it away.

Today I regret that decision. I wish I still had that machine, just to look at it, touch its keyboard, boot it up and hear that humble BIOS beep after completing its RAM check. Like my dear grandparents, it's nothing more than a memory now. Unlike them, it's something I could have kept at my side for as long as I wanted. It could have been a physical link to those summer days of years past, but it got lost somehow, like all those phone calls I never got around to and all those postcards I never sent. I'll never forget it.

Friday, November 1, 2013

Book Review: Steven Levy's "Hackers - Heroes of the Computer Revolution", 25th Anniversary Edition

I knew of this title before I read it, having seen it referenced quite a few times over the years. I just never got around to reading until now. It was truly fascinating to read about the rise of the hackers, starting with a bunch of model railroad enthusiasts at MIT, proceeding with the socially progressive agenda of the California hardware hackers of the 1970s, ending with the videogame creators of the early 1980s.

The first half of the book is, in my opinion, absolutely brilliant. It portrays these manic young men in an affectionate but not uncritical manner, painting a picture of isolation and brilliance in the late 1950s. It's an appropriate tribute to the tenacity and creativity of these proto-hackers, who managed to wrest control over the development of computers from the megalithic IBM, which had long since gone into a state of stagnation that impeded technological progress in this vital field. They broke with IBM doctrine and started a revolution that had a lasting impact. Reading about the subculture that formed in the AI Lab at MIT is fascinating to me both as a political scientist and computer geek.


One of the most memorable machines mentioned by Levy, the Flexowriter, which he describes as "a typewriter converted for tank warfare", a lovely contraption that makes coding sound like machine-gunning.

The next part, about the computer scene of the late sixties and early seventies on the East Coast was in some ways even more interesting. I had no idea that the socially progressive ideas to such an extent permeated certain key figures there, including a bizarre pioneer project involving a public terminal for information exchange. As the story progresses, it becomes almost sad to read about how some of these driven and intelligent people cling to their original ideas even as they become more and more obsolescent. When big money starts to come into play, ideals become more and more diluted.

The final part, focusing on a few software companies that heralded the videogame boom of the 1980s, most notably Sierra On-Line (originally On-Line Systems), is interesting in its own way but does not strike me as an obvious continuation of the original narration. The development of UNIX and the struggle between developers, users and corporations is a fascinating mirror of the late 1950s, but it goes almost entirely without mention. While the drama surrounding the fates of the videogame hackers makes for an interesting read, it does sacrifice some of the core elements of the story in favor of even more colorful personalities.

The 25th anniversary edition does include a few appendices that make up for the original omissions, including a section on the incomparable Richard M. Stallman, a curious genius who stood up for the original hacker ideals even in the darkest hour of software capitalism. Even though he remains a bitter and resentful sentinel, always battling for the freedom of software even against those who could be his allies, the success of Linux, open source and new licenses such as Creative Commons, are to a significant part attributable to his tireless efforts.

The fact that this book was written by a journalist makes it a more enjoyable, if somewhat less technically gratifying, read than some other computer history books covering this time period. While it obviously caters to computer geeks, one doesn't have to be a programmer to follow the story and enjoy it. I'll admit that I had a hard time putting this one down until I'd finished it. Recommended to anyone with an interest in the general aspects of computer history and development, not the least because it had a historical impact of its own following the release of the first edition in 1984. The influence of the political backdrop, from the most intense days of the Cold War to the Flower Power-movement, makes it relevant even to political scientists like myself.

Swedish readers can get the book here: http://www.adlibris.com/se/bok/hackers-9781449388393


Thursday, October 17, 2013

The Wonderful World of Vim

When did I first come into contact with vim? I can't remember exactly, but I suspect that it was back when I was taking my first steps into the world of Linux, probably around ten years ago. I recall finding myself at a command-line prompt and in need of editing a text file, probably a configuration file of some sort. I had edited text files in a command-line environment before, back in the days of DOS. That was straightforward enough. I did a bit of googling and found that one could use the command "vi" followed by the name of the file. So I did that. Then I got stuck. Literally, I couldn't do a single thing. Cursing, I was able to learn that one had to press "i" on the keyboard to be able to actually type into the file. Then I had to press the Escape key followed by ":wq" (minus the quotation marks) to save the file and quit that uninviting program. This was enough to cover my needs for years afterward, since I only used vim as a last resort. I was annoyed at the bizarre complexity involved with even the most simple operations and the complete absence of any menus or other visual clues. At the same time, I knew that there were a lot of people who claimed that vim was incredibly complex and useful, and defended it to the point of fanaticism. As time went by, I picked up a few neat tricks and started to enjoy vim sessions a little. Then it started to dawn on me that vim was actually quite brilliant, albeit demanding. It wasn't terribly useful in my everyday life, except for when I was tinkering with my Linux servers (and there were periods of my life when I almost compulsively would turn every old decrepit computer I could get my hands on into a server, then run it mercilessly until the aging hardware fell apart). Then I discovered a way to write pretty much everything in plain text files, thanks to LaTeX (a topic I will cover in more detail in a future blog entry). This of course meant that I could use any text editor I liked. That's when I remembered vim. A few months later, I'm more interested in vim than ever and today this book arrived:

"Practical Vim: Edit Text at the Speed of Thought" by Drew Neil. He also has a bunch of helpful short video tutorials over at http://vimcasts.org. 
I could barely stop myself from diving into it immediately. As soon as my son fell asleep, I started to devour the pages. If someone had told me ten years ago that I would love reading a guidebook for a command-line text editor, I probably wouldn't have believed it. But, I have to admit, I've become a great admirer of vim. 

So, what's the story behind this humble piece of software? The original vi was developed by a guy named Bill Joy for machines running Unix, back in 1976. Vi continued to evolve over the years until another guy, this one named Brian Molenaar, released vim (Vi IMproved) in 1991. Vim is, in simplified terms, an extended version of vi. Today, vim is in version 7.4, but still no more than a few megabytes in size. It's available for numerous operating systems, including Mac OS X, Windows and Linux. While vim continues to evolve, it still has that austere design:

So, what's so great about vim? There's of course the aesthetic dimension: I can decide on a color scheme and a font, and then I won't have to bother with a single menu of any sort. The interface is extremely minimalistic, which I love. Then there's the economic dimension: vim is completely free. Unlike the apps you see on you Android phone, that doesn't mean that you'll be pestered by ads or have to surrender your e-mail address. It's free and open-source, so just download it and enjoy, no strings attached. In addition, it's small and doesn't demand much in terms of processor power, RAM or disk space, so you can easily use it on an old computer. I could probably get it up and running on a 486 using a minimal Linux installation. Most importantly, there's the work-flow dimension: vim is a very sophisticated tool for editing text. I'm not going to say it's easy to learn, but it can be incredibly rewarding in ways that no word processor can rival. 

The screen you see if you open vim without specifying a file. 
I'm a political scientist, not a programmer. I work with large chunks of text, and I spend a lot of time tinkering with them: deleting, modifying, adding, etc. Vim takes this to perfection, and you never have to touch the mouse. You don't even have to move your hands from their original resting place on the keyboard, every command you can possibly need is only a few letters away. The most fundamental aspect of vim that enables this is the modal editing. While most word processors and graphical text editors are always in the same mode, using vim you will constantly switch between at least two, and sometimes three different modes. The first mode is "normal" mode. It enables you to, for example, navigate the text and delete parts of it. But in order to type anything, you have to enter "insert" mode, which makes the keys respond differently. The lettered keys used for commands in normal mode will then correspond to the actual letters printed on them instead. Finally, there's "visual" mode, which enables you to select parts of the text. There are a few other modes, but these three are the most important ones. 

If you're using Mac OS X or Linux, you will probably already have vim installed. To try it out, just open the Terminal (in Mac OS X, it's in the Tools folder in Applications) and type "vim". The best way to get started is to instead type "vimtutor" in the Terminal, this will open an interactive tutor that guides you through the most basic vim commands. For a more complete experience, I recommend that you download MacVim from the http://www.vim.org website.
Instead of clicking and highlighting in the text, you move the cursor around. Either one character/line at a time by using the h, j, k and l keys (you can also use the arrow keys, but the point in using hjkl is that you don't have to move your hands away from their starting position). However, moving the cursor inside long paragraphs in files that cover the equivalent of dozens of printed pages isn't very effective, but vim has a lot of other ways of moving around. Using the w and b keys, you can skip back or forward one word at a time. Using "(" and ")" you can skip one sentence at a time and using "{" and "}" you can move an entire paragraph at a time. Or, you can type the letter f, followed by a character, to skip forward directly to that character on the same line. Or, type / followed by a word to skip ahead to that word. Replace the / with a "?" to skip backward. Then I can type "n" to skip to the next matching word. This is just scratching on the surface, there are commands for deleting, copying or changing a specified number of words, lines, sentences, you name it. Commands for moving around within the text can be combined with commands for editing it in a myriad of ways, creating almost infinite flexibility. Then there's the arguably most clever command of them all, press "." to repeat the previous change. If that's not enough, there are plenty of plugins you can add. Or create your own macros. In vim, creating macros is as easy as typing two letters, then the commands you want in your macro, then another letter to stop recording the macro. You can then invoke the macro by pressing two different keys.

This is what one of my chapters looks like in vim. The code included in the text (i.e. the colored text) enables LaTeX to use this text, along with several other files, to produce a PDF file, complete with a glossary and auto-generated bibliography. The color scheme, textwidth, line numbering, etc., can be adjusted to fit personal preferences.

For me, it's like playing the piano. Not that I can play the piano, but at least that's how I picture it in my head. When I get a nice flow going while working at the command-line, my hands are flying across the keyboard, every thought is almost instantly translated into commands and text, the resulting feedback comes instantaneously. I'm not that good at vim yet, but I know that in time, being that fast is a realistic goal. Like playing the piano, it's all about practice. Fortunately, you can practice while working. 

Vim is optimized, honed and perfected for touch typists. If you can't touch type, then vim is probably not going to save you any time (it could still make for a nice-looking alternative for people on a budget though). Learning vim, just like the command-line in general, is like learning a language. There are no visual clues to provide immediate help. You have to go through the process of learning the words, or in this case, commands. At first, you'll have to think about each command, just like you have to build a sentence in your head when you're struggling to speak an unfamiliar language. With practice, the commands come as naturally as words when you speak. Thoughts enter directly onto the screen, limited only by the speed of fingers. Once you get into that flow, when the commands have become embedded in your subconscious, the feeling of doing something as mundane as editing text can be as sweet as playing music. 


Saturday, October 12, 2013

Powerbook G3 "Wallstreet"

When I grew up, Macs were the ultimate computer mystery to me. In waiting rooms where glossy magazines were on display, I occasionally found an issue of MacWorld and stared at the hypnotic designs bearing Apple's logo. This was the 1990s, before the iPhones and even iPods, a time when Apple was struggling for its very survival. Macintosh computers, as they were often still called back then, were as far as I knew intended for connaisseurs, people working in graphic design and possibly authors. I had never even though of getting one. To someone who had just started to get acquainted with PCs and Windows, the Apple computers were as alien as they were fascinating. The prohibitive cost of getting one ruled them out, I was still stuck with my 486, constantly trying to find new ways to squeeze more out of that old workhorse.

Many years later, I had discovered Linux and tinkered with more PCs than I could possibly remember. The PC hardware had become very familiar, and I had often gone to electronic waste bins to dig up old computers and scavenge all the working parts I could find. Having worked so many hours with the cheap and common components and standards, I started to feel an attraction to the high-end stuff I only knew by name, things bearing designations like SCSI and Firewire. The Macs still had a completely different type of processor back in those days, called PowerPC. The PowerPC processors were based on RISC technology, which in turn was even more mysterious, the stuff of supercomputers and high-powered servers. That was something very different from the Intel-based processors I knew so well. I decided that I had to have one.

Finally, in 2007, I bought my very first Mac in an online auction. It was a Powerbook G3 "Wallstreet" from 1998 (the Powerbooks in the G3 series have different codenames to distinguish the models. Kanga was the first, followed by Wallstreet I, Wallstreet II, Bronze Keyboard and finally Pismo). It was cheap and it looked gorgeous in the pictures. A 233 Mhz G3 (PowerPC 750) processor, 64 MB of RAM and a 4GB hard drive. When it arrived in the mail, the imbecile seller had wrapped in nothing more than brown paper. I gasped in horror as I took the parcel in my hands. How could anyone treat a computer with such negligence? I carried my prize home with gentle hands, assuring it that it had would henceforth be taken care of with more affection. I was almost trembling with excitement as I plugged it in. Hours later, I was overcome with disappointment. The machine I had bought had several serious hardware defects. Unwilling to part with my Powerbook so soon, I decided to fix it.
I still think that the combination of rubber and plastic, separated by gentle curves, along with the subtle roundness of the case, is one of the best-looking laptop designs of all time.
There's something about how the display curves inward that just feel perfect, it's like it stretches out to embrace one's eyes. The splash of color in the Apple logo makes for a nice contrast while the exquisite font used for the designation is just perfect.
 The months that followed were probably the demanding computer repair I have ever undertook. Had it been any other machine, I would have discarded it after a week. But not this one. It was too beautiful in its black case, with the gorgeous font for the model designation and the amazingly inviting keyboard. Painstakingly diagnosing all the things that had to be fixed, I concluded that the hard drive was on the verge of giving up (and that parts of the operating system was corrupt), that the built-in Ethernet port was completely ruined, and that the CD-ROM drive only worked intermittently (as I recall, about 10-20% of all attempts to boot from the drive worked). In addition, the display cable was damaged, leading to an annoying flickering across the whole screen at certain angles.
The flickering screen today.
The numerous dents and marks on the bottom bear witness to the wear this machine has seen.
 I first bought a new hard drive and installed it. Efforts to find a new display cable turned out nothing. Then I had managed to get a hold of a CD with Mac OS 8 on it. It took a long time just to get the machine to boot from the disc due to the faulty CD-ROM. But I did it, patiently trying to get it to read the disc, rebooting over and over again. Then I had a working operating system, and I rejoiced. I bought an Ethernet adapter in PC Card format, but it didn't work. After doing more research, I could conclude that it was incompatible with my particular Mac. I tried to get a new CD-ROM but it was difficult to find that kind of old hardware. When I finally did locate a DVD-ROM drive for Powerbook G3s and bought it, I again noticed that it was incompatible with my Wallstreet I (it would have worked with any of the later models of the Powerbook G3). Not being one to give up, I still managed to install a few games on the machine, upgrade to Mac OS 9, and get WordPerfect and MS Office 2001 to run on it. That's when I could actually start to use it.
View from the side showing the CD-ROM drive and fan exhaust.
The hardware design has several clever aspects, in typical Apple fashion. For example, the CD-ROM drive can be replaced with an extra battery. Of course I had to get one of those. I even bought a white single-button ADB mouse for it.  I was a student at the time, and I proudly brought my Powerbook G3 to group working sessions in cafés. To everyone else, it was archaic, dented and unwieldy. To me, it was the most beautiful computer in the whole world. And it worked, thanks to my untiring efforts. The keyboard was so smooth, each key being perfectly rounded. I liked my Powerbook so much that I bought a new processor for it, a 250 Mhz version with L2 cache and 128 MB of RAM, something that promised to boost performance noticeably. I installed the hardware upgrade and was happier than ever. A few days later, the processor broke down mysteriously, forcing me to go back to the old one. Little did I know that this was only the first backlash. A few weeks later, the whole machine started to act up. A couple of months later, I could no longer boot it up. Faced with the daunting prospect of once again having to struggle with that dysfunctional CD-ROM drive, that had only gotten worse with time, I decided that enough was enough. The Powerbook G3 went into long-term storage.
This is all I get from this machine these days.
View of the rear, with the port cover open, showing the printed reset instructions (a nice touch) and the archaic ADB port.
Close-up of the font and Apple logo.
The touchpad and single button, from an era when Apple stubbornly refused to have more than one button on any mouse.
The rounded keys of one of my all-time favorite keyboards.
The extra battery drive I bought, which for a time extended the battery time considerably.
When I dug the machine up from storage to take a few pictures, I was almost tempted to try to fix it. But then I remembered the pain of having to work with its obsolete "Old World ROM" that makes it excruciatingly difficult to boot anything but Mac OS 7/8/9 discs. So, I won't fix it. But I can't throw it away either, it means too much to me for that. So after this post, it goes back to long-term storage. Maybe some day in the future I'll have time to spare and the determination required to get it up and running again. Still, we had a good run and I'll never forget the short months when I was the proud owner of a beautiful matte black Powerbook G3.

Monday, October 7, 2013

The command-line vs. my work e-mails

I think most of us can relate to the frustration you can feel when your inbox at work gets flooded. Obviously, some e-mails are important, while others are little more than a nuisance. Then there are a bunch of e-mails that are somewhat interesting, but you want to save them for later reading. One solution to this mess is to create folders for your e-mails, on the server. Then you can sort them into categories and put them in folders, allowing you to deal with more urgent stuff first. If you have to do this manually, it kind of defeats the whole purpose, so you'll want an automatic filter that does it for you, in accordance with rules that are tailored to your specific needs. Any decent e-mail client should support that (while I noticed that Apple Mail tends to be very buggy when it comes to filtering, Mozilla Thunderbird works just fine).

So far so good, but then you might find yourself in my situation. I use three different computers, one Android phone and one Android tablet to access my e-mails. Setting up and maintaining all the filters I need on these five platforms is a daunting task. Consequently, I want all my filters to be run on the server instead of on these five machines. When I access my e-mails, they're already filtered and ready, making everything so much easier.

Now, I could create server-side rules using the webmail interface my employer provides. But I won't. Because, as I have already stated in a previous post, I consider form to be more important that function. And there's no form like the command-line. So, I decided to use my Linux server (it runs on an old decrepit laptop at the moment) to handle the task for me. After some quick googling, I found the very nice "imapfilter" program, which I installed on my server. Being a command-line application, it reads the settings and filter rules from a configuration file, which you edit manually. I skimmed through a few sample configuration files that I also found by googling, and it didn't take more than a few minutes to create a set of rules that covers my current needs.

This may look complicated, but all you have to do is copy a template from someone and then adapt it to your needs. It's really not hard at all, stuff like mark_seen or move_messages are pretty self-explanatory. I had no idea how this syntax worked before, I just looked at the samples and copied relevant parts of them. Most of my rules simply move e-mails to the appropriate folder. Then there's one rule that marks unimportant e-mails as read, and then moves them to the trash folder. By the way, this is not my actual configuration file, as you may have figured out.

When I run it from the command-line in verbose mode (i.e., I instruct it to tell me what it's doing by simply adding "-v" to the command), it spews out a lovely amount of capital-lettered computer-speak. As much as I love watching that, it has to run automatically without my input, so I used the very handy application "crontab" that comes pre-installed on pretty much every Linux and Unix system I've ever tried. Now it runs automatically every ten minutes (I can set the interval to be exactly what I want, but ten minutes works for now) and when I check my e-mails on my phone or any of my computers, everything is already sorted into the appropriate folders or deleted. Wonderful, and very stylish.

The sheer amount of feedback from this application is wonderful, and the capital letters gives a most appealing old-school vibe. The numbers added to each line is a big plus, making it look even more like something out of a 1980s movie. [some lines have been partially censored for reasons related to privacy and paranoia]

Tuesday, October 1, 2013

Language vs. Visualization

I've already outlined the aesthetical and nostalgic reasons for using a command-line. But, there's more to it. On an abstract level, I like to think of the command-line and the graphical user interface (i.e. what most people use without reflecting on it) as a language-visualization dichotomy. I love languages. Not that I'm particularly good at them, I've only ever grown somewhat comfortable with two (Swedish and English). My French is abysmal and while I can read a bit of German, I couldn't put together a grammatically acceptable phrase if my life depended on it. That doesn't prevent me from thoroughly enjoying all these languages. While I read 19th century English literature, say, Oscar Wilde's "The Picture of Dorian Gray", I marvel at the exquisite polish of every single sentence. When I pick up Strindberg's "Röda Rummet", I read and re-read the pages over and over again, just to taste the words over and over again in my mind. Well-crafted prose is a vice for me.

Now, when it comes to visualizations, things get a bit more complicated for me. I enjoy visual art, colors, shapes and designs as much as anyone (probably more than most, actually). I can visualize some things in my head, such as blueprints, but I often find myself unable to describe a route, even one that I've driven dozens of times. I just can't replay the memories that I should have. I'm able to find my way, but only by actually seeing the places again. In a similar manner, I find it very difficult to visualize people's faces. I'll recognize them when I see them, but that's all. I could probably never give an accurate description of a person I'd only seen briefly.

What does this have to do with command-lines and graphical user interfaces? For me personally, it means that I prefer the flawless precision of language over the annoyance of having to remember visual details by repeating them over and over again. If I use the command-line, I will type up a command, include the appropriate parameters, hit Enter and be done with it. It usually takes a few seconds, at most. When I use anything with a GUI, I usually have to navigate through menus, and frequently memorize more or less bizarre symbols that are somehow thought to be self-explanatory. Whenever I try to use Microsoft's abominable Office 2007, I usually end up with a boiling rage inside me within minutes, frantically clicking. To me, neither the menus nor the icons make any sense. I'm not particularly interested in learning them, any more than I am interested in learning anything else I perceive as being stupid and counter-intuitive. The worst part of it all is having to submit to interacting with something so inelegant and hideous.

The command-line, on the other hand, is like speaking a familiar language with an old friend over a glass of wine. I know exactly how to pronounce the sentences, and the computer responds immediately. If I do make a mistake, I usually get a response that politely informs me of my mistake and provides me with a few clues to correct it. Learning the commands is like learning words, you don't even have to know the grammar. A few hundred words down the road, you'll be able to do the most amazing things, and it always feel so simple. Most importantly, it has an air of elegance to it.

Perhaps you're thinking that this is still a moot point, because you're not a UNIX or Linux freak and consequently you don't think you have a command-line anyway. But that's where you're mistaken. I won't go into details about the Windows command-line, simply because I detest it, but Mac OS X has lovely UNIX-based interface called "Terminal", look in Utilities in the Applications folder. It's installed by default on every Mac OS X machine.

I'll provide you with my favorite command of all time to get you started: "shutdown". Note that you need to have admin privileges to execute this command. If you don't know what that is, you can just try it. If it works, you have those privileges, otherwise it will protest. If you type the following in your Terminal:

sudo shutdown -h now

You'll be prompted for your password, then the computer will shut down promptly. Now, the beauty of this command is in its parameters. If you replace "-h" with "-r", it will reboot ("h" is for "halt", "r" is for "reboot"). And instead of "now", you can delay the shutdown/reboot by a specified number of minutes. So for example:

sudo shutdown -h +15

Will shut down your computers after fifteen minutes. Just replace "15" with the number of your choosing. Or you could type the exact time, if you like:

sudo shutdown -h 21:00

The shutdown command help can be accessed by typing "--help" after the command instead of using the parameters described by me, good to know in case you forget the exact syntax. The same applies to most other commands, by the way.


So when is this useful? Perhaps you're using a program that takes a long time to execute and you want to go to sleep (for example downloading, encoding or the like). Perhaps you want the computer to stay on while you're getting ready to leave for a social function, in case you need to check something you've forgotten, but you don't want the hassle of having to shut down the machine later when you might be in a rush. Whatever your reason, this is a very useful command and quite easy to remember, I'd say.

That's really all there is to it. Learning words. The parameters are often identical or at least similar. The words are usually self-explanatory (as is evident in the above example). Start to talk to your computer instead of haphazardly prodding it with a mouse. You'll be surprised at how easy it actually is. And most importantly, how elegant.