Archive for May, 2007

A day without X

Monday, May 21st, 2007

Would you be able to survive one full day without using the X server? Linux offers us a wide assortment of CLI based tools which use curses and/or framebuffer for functional user interfaces. There is no reason why you shouldn’t be able look up stuff online, read your email, look at pictures, watch movies and listen to music as you are trying to configure X.

I was inspired by this post on Motho ke motho ka botho and decided to compile a list of useful command line applications myself. I will break them down into categories so that we can cover all the bases. If I’m missing something, or if I omitted some cool applications please let me know.

Web Browsing

The biggest problem in living without X is web browsing. You will be limited to text browsers, which generally do not support CSS and do not play nice with AJAX. The good news is, that most of the AJAX heavy web-pages now have mobile versions which are surprisingly text-browser friendly.

There are quite a few text browsers out there but I will recommend one:

Elinks [elinks.or.cz]

Why elinks? Because it supports both frames and tables, displays nice colorful output, and works great with mouse. Of course you can also use Lynx, Links, or w3m but in my experience elinks beats all of them hands down. Here is how my page looks in Elinks:

Screenshot of Elinks

There also seems to be a framebuffer browser out there called Zen but it is a bit unstable no longer in active development.

Email

If you are a gmail user like me, you are in luck. Google has a javascript-less version of their interface which actually works beautifully in elinks:

Gmail in Elinks

Neat, eh? For everything else there is Mutt:

Mutt [mutt.org]

Mutt

I previously covered Mutt several times, showing you how to set it up for IMAP and how to send out emails without full blown sendmail or exim setup just using basic SSMTP. There is also Pine which is a damn fine mail client too - if you can deal with editing your messages in pico.

Chat

Chatting without X is pretty easy. It depends on what you are into though. For example, if you are a GTalk user I can recommend the excellent Freetalk which I covered before:

Freetalk [gnu.org/software/freetalk]

Freetalk

If you are on AIM, then naim will probably be the tool for you:

Naim [naim.n.ml.org]

Naim

Naim is a little bit funky but once you get used to it just works. It also supports ICQ and IRC protocols. Of course if you want full blown IRC support, there is probably no better client than irssi:

IRSSI [irssi.org]

IRSSI

It is a bare bones but full featured client. I don’t use irc that much, so I can’t tell you how good it is, but it seems perfectly functional - especially if you are a hard core irc junky.

Reading RSS

If you are like me, you subscribe to way to many RSS feeds. Unfortunately neither Google Reader nor Bloglines works in elinks (or for that matter any text based browser) so we have to rely on local clients if we want to survive without X. I recommend raggle:

Raggle [raggle.org]

Raggle

Raggle has a clean and intuitive interface, is fast and takes up almost no memory. Perfect for a day without X. Go ahead, import your OPML file using a command line switch, and give it a go. You can also try Newsbeuter.

Btw, that feed list in the screenshot is the default set you get after installation. My feed list is way bigger. ;P

File Management

When you are not browsing, chatting, reading feed or writing emails you probably move around files on your hard drive. Midnight Commander will make this task easier with the classic Norton Commander like interface:

Midnight Commander [ibiblio.org/mc]

Midnight Commander

You young whipper-snappers probably have no clue what Norton Commander was - but I grew up on it. Whenever I use MC I feel nostalgic for the good old days.

Viewing Images

So let’s say you are living your one day without X and someone sends you an awesome picture. For example it might be a picture of a cat with a caption (ZOMG! Invisible bike!). Or maybe it’s one of those demotivational posters. Hell, it can even be some dancing bunnies!

So what do you do? You open it with a framebuffer image viewer like zgv of course:

ZGV [svgalib.org/rus/zgv]

I have no screenshot for this one because you can’t run it in X, but I can confirm it works. So you will never be without your cat macros!

Watching Video

Sure Luke, but how do I watch my p0rnz you ask? I haven’t personally tested it, but it seems that both Mplayer and VLC are capable of framebuffer output. How well do they actually work in that mode - beats me. Maybe at some point I will test them out, but at this point I don’t have any solid recommendations beyond that.

Text Editing

If you use Linux, you should already have a near religious attachment to a text editor that can be used without X. There are essentially 4 kinds of Linux users: vim/vi users, emacs users, users who can use both editors, but neither of them well, and n00bs. And guess what - if you think that you don’t fit in any of these categories, you are a n00b. Personally - I use both, but I’m more familiar with vim than anything else. Here are my recommendations:

VIM [vim.org]
Emacs [gnu.org/software/emacs]

Playing Music

The fact that you are not running X should not prevent you from listening to your favorite t00nz. Cplay is a lightweight audio player that is perfect for our X-less day:

Cplay [mask.tf.hut.fi/~flu/cplay/]

Cplay

If you struggling with it, there is an awesome overview of cplay here.

Btw, you can always control your audio volume with alsamixer (if you have ALSA, and you probably do - you have alsamixer installed).

P2P

Luke! I has no Toonz! How I get some without X?

Well, it’s easy my friend. You can do it with rtorrent1:

RTorrent [libtorrent.rakshasa.no]

RTorrent

It’s yet another nifty curses application with negligible memory footprint. RTorrent can easily compete with the windows based uTorrent for size and memory. Unfortunately it is somewhat counter intuitive using Emacs like key bindings. The learning curve is a bit steep, so here is a nice primer to get you started.

Window Management

Yes, you heard me right - window management. The fact that we are not using X does not mean that we can’t have windows. Twin is a nifty curses app which will open sub-terminals inside a curses environment:

Twin [twin.sourceforge.net]

Twin

Twin actually stands for Textmode Window Environment which is exactly what it is. As you can see from the screenshot, it will allow you to have elinks, mutt, raggle and essentially any other application I mentioned here today open on the same tty. How awesome is that? It removes one of the very annoying issues that we face when working without X - the inability to have multiple “windows” open on the same screen-space at the same time.

Will I actually attempt to survive a day without X? Maybe I will at some point. And if I do, I will definitely blog about it, and tell you about my experience. But it won’t be today because I actually have some relatively time sensitive work to do. )

Maybe we can all try this together? Let’s set a date (preferably on the weekend so we don’t struggle at work) and let’s try to survive a day without X. Let’s make it an annual linux geek holiday or something. mrgreen

1 - I neither endorse nor condone downloading music. If you are downloading legally, then more power to you. If you are sharing without permission - make sure you don’t get caught.

Note:

If you want to translate this text, please go ahead as long as you give me credit and link back to this post. This work is published under Creative Commons, Non-commercial, Share-alike license.


Creative Commons License

This work is licensed under a
Creative Commons Attribution-Noncommercial-Share Alike 3.0 License
.
Update 05/22/2007 10:10:11 AM

Y HALO THAR Digg users! Thrilled to have ya here. mrgreen

Instiki - and Instant Wiki

Sunday, May 20th, 2007

Recently I discovered Instiki - a quick and not-so-dirty way of running a wiki without much setup. For example, to run MadiaWiki (the original Wiki package, used by Wikipedia) you need to have a functional web server, a supported database and PHP installed on your machine. With Instiki - you just need Ruby. It serves pages using WebRick and uses SQLite to store data, making it a perfect personal wiki for jotting down notes.

Would I use it for high traffic production wiki? Not really. For what it’s worth don’t think that WebRick and SQLite offer a scalable solution. I would go with MediaWiki for that. But I found that Instiki works great if you just want to have a personal local wiki on your machine.

When I tried it on Windows, it ran out of the box. On Dapper (Ubuntu) I had to download the sqlite module for ruby via apt as they don’t seem to be included in the base ruby package:

apt-get install libsqlite3-ruby1.8

I really like this app - it is small, self contained, and full featured. I played around with several personal wiki’s that are out there, but Instiki is the best one I have seen.

Graduated

Saturday, May 19th, 2007

I am officially graduated. I will post some pictures from the convocation and commencement when I manage to extract them from my relatives. Seriously, back in the day when we still used film, it would usually take few days to get pictures back. Whoever took them would just drop them off to be developed, ordered double prints and we had them back in less than a week. Now, getting pictures from someone is like pulling teeth.

Also, I would like to say that PHD comics is frightningly accurate sometimes:

Reading the Thesis
comic © phdcommics.com

This has happened to me in the past. More than once. Hell, I would venture a guess that half the people from my department wouldn’t know what the fuck I was doing just from the title. P

Twitter is useless to me.

Friday, May 18th, 2007

Every time I try to post something on Twitter lately I see this:

Twitter Down

Either that, or an internal server error. I have been twittering less and less in the last month or two - but at this point I hardly use it anymore. Every time I get around to post something it is down. I have an account on Jaiku that I hardly ever use. Maybe I should switch to that?

Anyone knows what the hell is going on with twitter lately? I know they were getting hammered hard with traffic, but for some time there seemed like they got the hand of it, and worked out how to load balance and cache everything.

I’m really interested in Twitter because it is a great case study in using Ruby to handle a high traffic social network. It seems that they are slipping now - I’m curious to see if this is because of problems scaling up Ruby on Rails, or is it something completely unrelated to the language and platform of their choice.

On Config Files

Thursday, May 17th, 2007

There are two ways to write configuration files. There is the simple way used by nearly all linux/unix apps, and most Java developers:

#this is a config file
key1 = value1
key2 = value2
key3 = value3 #comments can go here

Then there is the crazy XML way that seems to be the preferred .NET method:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="key1" value="value1" />
<add key="key2" value="value2" />
<add key="key3" value="value3" />
<!-- comments are not fun at all -->
</appSettings>
</configuration>

I don’t know about you, but personally I think the first format is clear, concise, easy to read, easy to edit, and easy to document with inline comments. The second one is none of the above.

Both are easy to parse - especially since you will rarely need to do it by hand, as most environments provide classes that will do this for you. Maybe I’m old school but I think that simplicity of the non-xml config outweighs any potential benefit of using the xml markup.

At the end of the day most configuration files are just simple lists of key and value pairs. You don’t need XML’s tree structure to represent that. Very rarely do these pairs need to be ordered in a specific type of hierarchy that would warrant the use of XML.

For me, using xml for your config files is just meaningless overhead. Same information could be stored in a simple delimited text file. Of course if your platform has a built in support for XML config files, then that’s probably what you should use. But given a choice, without platform support for either format I would always pick simple text over XML.

How about you? Do you believe in XML config files?