Another Blog

Mostly about computers, generally Linux-related

Wow… xmonad does it again!

I’ve been happily using xmonad for a while now. It’s a tiling window manager written in Haskell. To me it’s a huge boost in productivity and it has helped me rediscover the fun of using a computer. Although I’ve initially tried it simply because it was written in Haskell (I was a happy wmii user then) , I now dread every single moment of using a different window manager.

Above all, xmonad is incredibly flexible. This comes from the huge extension library it has. It can tile windows in a myriad of ways, and even float them in unexpected manners. It has per-workspace configuration, so I can have 9 or more workspaces, each with different layout algorithms. I greatly appreciate a program which has allowed me thus far to go through 4 “patterns of usage”. To be more specific, I’ve gone through:

  • The “tall” default configuration. This keeps my “main” (master) window occupying 70% of the screen, and the other windows stacked to the right of the screen. The proportion occupied by the master is adjustable (see screenshot) and so is the number of masters. This is a lot more flexible than it sounds — I can have 4 equal xterms in a few keystrokes, by setting the number of masters to two and the split point at the half of the screen.
  • Three columns. I have tried this briefly for my widescreen laptop, before realising I rarely need to view 3 different source files at once. I’ve also realised I’m greedy with my non-xterm windows, so I prefer Firefox or Evolution to grab the entire width of my screen, which is what brought me to the next iteration.
  • Tabbed windows. I’ve whole-heartedly returned to my first tiling experience (with Ion3) and used Tall and Tabbed exclusively up till, well, today. The general pattern was to stuff a lot of related windows into a single tabbed workspace if I only needed to see one of them at a time. This worked wonders, but I’ve long wanted an extension to it, cue a few hours spent reading and tweaking today. I’m not delusional — I don’t consider my work so important and difficult that I needed to change the perfectly fine configuration I had; changing it was just a lot of fun. If I realise I’ve made a mistake, I’ll just use darcs to change back to my old config.
  • Tall-Tabbed Combo. Today I’ve added a new layout mode to my configuration, partly inspired by David Roundy’s sample. It splits the screen in two, similarly to Tall, and each half of the screen contains tabbed windows. This enables me, for example, to keep half a screen containing a few documents which I can cycle through, and the other half containing code which I clumsily write. I can easily move windows from one half to the other, bar a few hours of getting use to the commands. Of course, “half” is a generic term, since I can resize the two chunks to any proportion. This uses the excellent Layout.Combo and Layout.WindowNavigation extensions, in addition to Layout.Tabbed, Layout.NoBorders, and Layout.PerWorkspace, which I had previously been using.

So, to sum up another probably tl;dr post, xmonad rocks because:

  • I’m immensely productive with it.
  • It’s fun to both configure an use.
  • It’s alive. When I first started using xmonad (which was, mind you, not at its very beginning), many of the extensions I use or have used in the past didn’t even exist.

If you feel like giving it a try, be aware that you need some knowledge of Haskell if you want a custom configuration, but I’m more than happy to help with what limited knowledge I have. A much better place to go if you have a little background is #xmonad on FreeNode.

December 22, 2008 Posted by | functional programming, haskell, linux, school | 2 Comments

A coward, that’s what I am!

Yes, it’s true… and here’s why. A while ago I saw NixOS on Reddit and I’ve been eager to try it ever since. Various things got in the way and I’ve just discovered that I’m a goddamn coward.

But first: a little about NixOS, from someone who hasn’t used it much, only read a little about it: NixOS is a Linux distribution centered on the Nix package manager. It’s closer to functional programming in a way which I (hope I) largely understand, but with which I will not bore you. The novelty is that packages are specified in a complete and unique manner (Firefox with FTP support is different from Firefox without FTP support), so that you’ll never run into a problem such as emerge failing because, even though you have program X, it’s not compiled with feature Y.

Furthermore, if you screw up your configuration (and who doesn’t), NixOS “remembers” your previous configs and shows them in Grub. You can boot into a previous kernel or a previous configuration alltogether. And a nice thing (which I am completely new to, hence I will just mention it) is that Nix (the package manager) can handle both source and binaries transparently. If it’s the way I understand it, the difference between mozilla-firefox and mozilla-firefox-bin won’t be the name, but whether you use a binary “channel” or not.

Finally, along with trying NixOS (which, by God, I will. I will get myself out of this numbness), I want to go x64. Numerous people (OK, two, but two I trust, not just strangers :) ) have suggested that there is a visible speed difference. I have not tried this before for fear of incompatible software.

Previously I was never afraid to potentially trash my whole computer and try a new distro, or even a new OS. Now I’ve been finding excuses for months. Among the most popular ones, which I invoke to myself daily:

  • I don’t have the time. Well, right now I’m not going to school, only taking the occasional exam. Even though exams have been far from simple (darn electronics), I should have made time to install NixOS.
  • I’ve installed it in VMWare, so I can play with it whenever I want. That is so damn far from the truth. The VM is just rotting away somewhere and the whole fun of being stranded without X or network access has been taken away from me.
  • I’m lurking their list and everything there is way beyond me. That may be true, but how the hell else would I find out more if I don’t use it?
  • They don’t have an out-of-the-box solution for PPPoE. I can help them test one, but no, I’m too much of a coward.
  • NixOS uses a very non-standard way to configure (basically, there’s a single configuration file, all the /etc/* things are built from it) and I’m afraid I’ll lose the little skill I have. But on the other hand, being able to handle myself in Linux isn’t about knowing where various config files are, it’s about being able to find information (usually on the Internet).
  • NixOS doesn’t have a lot of packages. Between compiling manually and (eventually) writing my own Nix expressions, this is a very stupid excuse.
  • I’ll ruin my homework-writing environment. This is no longer true, since I won’t have any more homework until October (OK, so I’ll be doing an internship with Freescale in the summer [very, very excited about that], but hopefully I won’t “bring my work home with me”).
  • I’ll miss Gentoo. This is also marginally true, but there’s nothing stopping me from contributing code to make NixOS tools better (I’m not saying they’re bad, I’ve only used them a few times).
  • I want to read the papers on the site first. This one is actually valid, because there are many things I still don’t get about the distro. But, again, reading a PDF can also be done in NixOS.

Now, NixOS has XMonad and other tools I use daily (I haven’t checked MPD, but that’s not really a life-or-death issue), so moving will be smooth — if only I can give myself the initial kick in the nuts.

I was going to rant about school, but I’ll probably do this in a different post — one post, one topic.

June 26, 2008 Posted by | linux, personal | , | 1 Comment

PPPoE, the Router, Wireless Internet, and TTL

Most dorms from the complex I live in have switched to PPPoE; better means of monitoring us I heard, but I won’t bring it up seriously. Of course, the network administrator in my dorm refused to switch, for fear he’d lose (perceived?) control. Quality started to drop, culminating with up to a second ping reply and a quarter lost packets. People screamed everywhere, and I myself was not happy — cormyr had just arrived and there I was without a source of up-to-date packages. Just so you can picture it, the Gentoo mirror I am using is (to my knowledge) literally less than a kilometer away, in the Rectorat building of University ‘Politehnica’ of Bucharest, a place I can see from my window. From there, I downloaded with less than 30 kilobytes per second.

Away from this near uprise, a few dorms distance, I was helping Roxi install Gentoo. She had switched to PPPoE, which caused a total of nearly 4 hours of tinkering with the connection. The live CD contained a script whch helped, but when the install was complete, we were stranded; luckily, she dual booted to XP, so we could search for solutions, download packages, and use a memory stick to transfer to Gentoo. Finally having got things working, I admit I never would have thought of the remedy by myself: the PPPoE interface had to manually be set to MTU 1492. We also had great trouble setting the routes, but that was really something we could handle.

Meanwhile, finally giving in to the increasingly furious dorm-mates, our admin finally made the switch to PPPoE. “Hah, I’ve been through this already”, I thought, but boy, was I wrong. To top things off, that exact same day I got a wireless router, so me and my roommates can use our laptops around our room. Two problems, one of which was completely new, the other only mildly and largely unsuccessfully previously tackled.

First, I sloppily got my connection working. Sloppily, because for the next few days I constantly forgot to set my routes right, which always caused great confusion. After that, I realsied I probably didn’t need that, because I wanted to connect tot the Internet through my new router. Which thankfully knew PPPoE. But again, things were far from over.

Packets get to us with TTL=1; it’s a pointless measure in my view, but it seems to be common practice in the complex where I live. The D-Link DI-524 (with which I am utterly dissatisfied) has an option called “Do not change TTL value”, but it apparently doesn’t work. It connected fine via PPPoE, I pinged Google via its HTTP interface, but this is where things ended. The solution (a cludge, if you ask me) was to connect to router to my desktop (newguy) and use that as a router that sets TTL via iptables. So I have newguy acting as a router for a wireless router. At least I have wireless, but only while newguy is on.

Bottom line is that, between paranoid admins and cheap, non-OpenWRT-supported hardware, we have another glorious bundle of wires and newguy has another glorious bunch of scripts which I only marginally understand.

March 15, 2008 Posted by | linux | Leave a comment

Rise of Cormyr (Not Without Its Problems)

I long kept silent, but not because life has been uneventful. A few separate posts will describe the past events, because I don’t like long reads.

I bought a laptop, a Dell Inspiron 1520, whose exact specs I am too lazy to post. It’s a Core 2 Duo at 2.2 GHz, 2 GiB of RAM and 120 GB hard drive. It’s quite similar to my desktop machine in this respect. Choosing a name was a bit difficult, and I eventually came up with Cormyr, just because I like how that sounds. Explaining to people why I called it that and what it originally is has led to many weird looks, but that I expected. What I did not expect is everything else.

I installed Windows XP on cormyr, which worked wonders. Half a day of installing drivers and everything was… well… Windows. After a largely uneventful Gentoo install, I realised that Windows had pretty much locked itself out of the bootloader: it had created a very strange partitioning scheme (on a nearly pristine drive at that time, so no whining about fdisk having done it). Cue reinstall, with Gentoo being the first OS I installed, along with a hopefully sane partition scheme. It was then that I also decided to drop the Dell Media Direct partition, which wasn’t working properly.

Gentoo was again fun, with ACPI tricks from both the official website and the Gentoo Wiki, and a short Haskell program I wrote to feed sensors and battery data into dzen2, for use with xmonad. The widescreen is really a pleasure when coding, along with xmonad’s ThreeCol layout. But horrors — between my being a newbie and incomplete support for my wireless card, I couldn’t get wireless to work (more on that in the next post). I tried without any success for almost a week, then decided to install XP beside Gentoo; surprise, the machine won’t boot off the XP CD.

With great angst I reached for Vista, which not only works pretty fine for a Windows (but is completely retarded UI-wise), but also saw almost all my hardware properly. This time around, driver installation took less than an hour and I could finally have my wireless. I am typing this on Cormyr, while in bed.

Bottom line, if anyone is looking for an opinion on Dell, I say go for it! Most of the problems I had were software related. The build is strong, both on the outside and intimately. Though a bit on the heavy side, the looks are to my liking: not exotic, but finely cut. The keyboard is absolutely awesome, and I’ve even learnt how to use a touchpad; I rarely connect the mouse.

A special praise to the 9-cell battery: although I first thought the thing sticking out the back of my laptop was hideous, it’s truly a blessing. After two hours of light Java coding this morning, statistics under Gentoo (a minimal build, I admit), showed 67% of the battery. The same stats go as high as 7 hours with a full battery, and compiling TeTeX and dependencies left the battery a whopping 80% full.

Bottom line, I’m happy with cormyr, a bit frustrated with Linux for not having drivers for my wireless card, but Vista usually means wireless, which means SSH into a Linux shell if need be.

Note: I realise this is not a comprehensive review, nor is it intended to be.

March 14, 2008 Posted by | linux, personal, vista | Leave a comment

User-Mode Linux — my choice for virtualization

AddThis Social Bookmark Button
I decided to finally learn how to properly use a virtualization method which is not VM Ware. I looked into Xen, User-mode Linux, and OpenVZ.

OpenVZ failed from the start, in that it had a single kernel for both host and guest. Because I intend to fool around (?) with the kernel, that was inadequate — I want to use a virtual environment exactly because I don’t want to screw up my whole setup when I experiment with kernel configuration and patches. Still, I am sure OpenVZ is not without its merits, it just didn’t serve my purpose.

Xen seemed an adequate choice, but required a whole empty-tree re-emerge. I started on it, but things (including kdm) stopped working after I emerged expat-2. The so name had changed, so I spent half a day recompiling various packages and using elinks to work my way through the instructions on the Gentoo forums. After this (which in fact had nothing to do with Xen), I proceeded to compile a kernel for Dom0. This proved so darn difficult for me (strange defaults), that I temporarily put Xen on hold until after I learn some more about the kernel. However, I must admit that Xen appealed to me the most, both in the way it handles guests and in that it can use Intel’s VT.

Of all these, User-mode Linux was the first I tried, and the one I am sticking with for now. It only runs linux and can’t use the Intel Virtualization Thingy, hence it is far inferior to Xen, but it also serves a different purpose. So I am sticking with dual-booting Vista for games momentarily.

After a few plain stupid mistakes, I got UML to work, started three machines and proceeded to build a bridge between the tap devices on my host. Much to my surprise, while experimenting with automating bridge creation, I noticed that networking between the three virtual instances (IPs 192.168.0.[1-3]) works without creating a bridge. It’s somewhat of a mystery to me why this happens, but then again I am short of clueless about networking.

Now I have three virtual linux instances (started on demand, of course) running the same kernel, with possibilities to expand to any number of such machines, study networking on them, change kernel configurations, perhaps even try a virtual cluster. Memory usage never jumped higher than 250 MiB, with Firefox, Thunderbird, Pidgin, KTorrent, and the three UML instances running at the same time. Of course, the latter were idle, but I am overall very satisfied with performance. It’s not like I’ll stress test my virtual environments — I will only play with them occasionally.

September 2, 2007 Posted by | linux, virtualization | 3 Comments

Yes, it can get even more retarded

So I bought a new computer, installed Vista (legally) on in, and, after a few days of playing games, I decided to go back to Gentoo. Install went fine mostly, but then I got to the real creamy part about dual-booting Linux and Windows Vista.

Much to my surprise, and yours I am sure, M$ found yet another way of being retarded about OS design. Vista installs its bootloader *on a separate partition*, without letting you know. So, when I configured grub to boot vista off the partition I had installed it to, it was a no-go. A little googling around sorted the problem, but still… this makes you wonder, what’ll they think of next? And what’s more: is this on purpose or is someone really stupid enough to forget to specifically notify people of the change? I bet it’s the former.

Don’t get me wrong, I usually set up a separate /boot parition, but Windows Vista used the other NTFS partition, which I had created for storage. I am now seriously thinking of switching the vista bootloader to the partition on which the OS is installed, to be rid of this irregularity.

July 6, 2007 Posted by | linux, vista | 4 Comments

Common Lisp

Instead of studying for exams and the like (of which I seem to have quite a lot), I found Practical Common Lisp [1] and decided to read at least part of it. This is similar to having read part of Advanced Python Programming last year before the exams. This apparent lack of concentration is actually a shift in focus to a language with a whole new discipline and approach. C still remains the language with which I have most in common, but functional programming is worth knowing, therefore I am planning a Lisp, Scheme and Haskell frenzy this summer.

I am also interested (but alas lack the time) in User Mode Linux. This will hopefully give me the opportunity to practice compiling the kernel, modifying it, and also “playing network” with multiple computers, complete with firewalls, NAT and the works.


May 29, 2007 Posted by | functional programming, linux | Leave a comment

Window Managers

I am so damn happy with Ion3, but I browsed recent emails on the mailing list recently and it looks like the maintainer is acting like a jerk. However, it was worth reading, because a post lead me to dwm.

dwm stands for Dynamic Window Manager and is written only in C (no scripting of any kind — not sure I like that though). Configuration is made before compilation, via C preprocessor directives; I am not quite sure as to whether this presents any advantage. Anyway, the attitude on the website stinks of 1337 from a mile on, so I thought I should give it a shot — maybe it actually is as good as they advertise it, though I seriously doubt it. My first thought of it was that it had ignorantly few keystrokes defined, compared to Ion3, which is also minimalism embodied. I’ll update my description if I find time to play with dwm, which I should this weekend.

I also came across TinyWM, which is only 58 lines of C code, though probably not usable. An interesting exercise though.

I’m tired as hell from school and Priest’s Revolution is abusing my eardrums. I love Fridays.

March 9, 2007 Posted by | linux | Leave a comment