Laptop returns, cpufreq actually works

My Dad’s really awesome sometimes. In a previous post, I talked about how my laptop’s screen cracked due to a friend’s drunken behavior. Well, my Dad did me a favor and swapped the old HD out of my broken laptop and put it into the new one I got. So now I’m running Linux as if nothing broke.

Here’s another crazy thing… I thought my laptop didn’t have cpu frequency scaling support, but I was actually wrong. It’s just that I didn’t have all the kernel modules I needed loaded. It turns out I can scale the CPU on this laptop from 400mhz up to its max of 1.7Ghz! This is awesome because power consumption goes way down, laptop stays cooler, etc.

Plus, someone wrote an excellent piece of software to do this scaling automatically depending on load and remaining battery power. Temperature readings still come in as 0 degrees celsius, but I decided temp readouts are unnecessary anyway. The BIOS does a good job managing the fan. Yay new laptop! Back to work on my paper.

gob2: Building GObjects easily in C

I’ve been playing with a preprocessor called gob2, which I only recently discovered. I found it because I actually had the same exact idea as the author. I was reading the Gnome 2 Developer’s Guide, and realized that although GObjects are nice and handy when they are already coded (as in all the widgets in GTK), they are actually a pain in the ass to write from scratch. Tons of boilerplate code, tons of macros you need to code to keep yourself sane.

So, I thought, what if some code produced all this boilerplate code for me? Someone already had the idea. It’s called GOB (or gob2), the GObject builder. Check it out.

What’s so nice about it is that it tries to have the feel of Java or C#. So, check out this definition of a new GtkWidget which counts the number of clicks it receives. If you run gob2 gtk-button.gob, it will produce gtk-button.{c,h} with all the proper GObject boilerplate code you’ve come to expect coding by hand.

Much nicer than doing that from scratch.

What’s strange is that more GTK+ developers aren’t using this. On the gob2 mailing list, the author claims it is used in gnome-vfs, but doesn’t it seem like it should be used by a lot of developers? (Granted, it’s not as nice as using gtkmm/C++ I guess, but there are still people declaring objects in C out there).

On stupidity and drunken behavior

So, night before last I came home and hung out with some friends. We were a bit drunk, my roommate and Sak were fooling around and Sak slipped and fell on my bed. Problem was, my laptop was right underneath him, and so the LCD screen cracked. Bad, bad situation. Turns out repairing it would be more $$$ than the amount I paid for it in the first place, so I’m not really sure what to do on that front.

It’s a shame… I really was getting used to that laptop. I mean, I’ll probably just re-purchase the same one, but I dunno what’s gonna happen exactly.

In other news, I was playing with Glade 3 earlier today and decided that it really needs some work done on it. I would love to hack that project a bit if I had time. I mean, if someone can produce something like Gambas for Linux, then some sort of RAD tool for GTK is possible. I know the two aren’t really comparable (Glade uses libglade to dynamically load the GUI from XML files, Gambas is a “better VB”, i.e. a full environment), and that a lot of developers scoff at RAD tools for GTK, but I don’t think properly designed RAD tools are about “dumbing down UI design.” I think they are really about making UIs easier to design quickly, so that you can spend more time on the code that does stuff.

Also, I was checking out Mainsoft, with their product MainWin for J2EE. Interesting approach. They take Microsoft IL code and compile it to Java Bytecode. This means that for now, while Microsoft doesn’t support platforms other than Windows for .NET, you can actually convert take a .NET project and make it run in the JVM. I wonder if it works…

Linux innovations I recently discovered

I have to say, I wasn’t expecting to like the Linux laptop experience that much, but I was just playing with the synaptics driver written for XFree86/Xorg, and I can’t believe how much careful work has been put into it. The authors have a truly well-designed driver here. Let me give a quick resume:

  • Non-linear acceleration. This means that you can define a minspeed and a max speed for your mouse cursor, and also define an acceleration ratio for how quickly it goes between those two speeds. This allows you to have a slow moving cursor when you want to make fine movements (i.e. in the GIMP or when positioning an insert cursor), and still allows you to get across the screen by moving your finger quickly across the pad.
  • Fully working palm detection, so that when you are typing, you can still rest part of your hand on the trackpad and not move the cursor.
  • Support for all sorts of tapping. This is the one I love most. I can tap the pad for single click, double-tap for double-click, and double-tap and drag for selection and/or drag and drop. Additionally, one can tap with two fingers (middle and index, for example) for middle-click and tap the bottom-right-hand corner for right-click. Alternatively to the two-fingered middle-click, one can tap the top-right corner.
  • Support for vertical scroll on right side of trackpad. A great feature that allows you to slide your finger down the right side of your trackpad to achieve vertical scroll up or down.

Conclusion: you can do all your mousing from the pad, without even using the clicking buttons. It’s extremely intuitive, fast, and accurate. I’m impressed.

The other innovation I discovered was the taglist plugin for vim, which, when combined with exuberant-ctags, makes for quick source file browsing. Very handy for these OS class labs I’m working on, where the source files tend to be pretty big and involve lots of routines you didn’t code.

wifi detector bash script

I didn’t really like any of the wifi-related tools out there for switching networks, so I scratched an itch and coded my own. Read more if you’re interested in obtaining an easy-to-configure bash script that requires iwconfig, ifstate tools, zenity and dhcpcd, and can easily allow you to set an array of prioritized wireless networks which are scanned and joined if found. After you establish your connection, dhcpcd is called to negotiate your IP address. It works quite nicely, and allows me to move from network to network and only have to click a button to enable my wifi access. Check it out (code inside)…

Getting Linux to run on an Averatec 3250 Notebook

It may have taken me a few hours and some lost hair, but I finally got Linux running (and running well) on my Averatec 3225 Notebook last night.

Kernel support is there for everything in 2.6.8.1, but the two major causes of problems are the Wifi chipset (RaLink’s 2500) and the built-in video (VIA’s S3/Unichrome chipset).

To find out how to get this stuff working decently well, read on.

Paradox of Choice

This article on OSNews elicited a response. Here it is:

Horrible to get these issues confused. A standard says: “there’s one way to do X because without a single way of doing X, the benefits of system Y would be useless or unavailable to most users and/or developers.” A lack of choice says: “There’s only one way to do X… just cause.”

So, yes, HTML, CSS, these are standards. Are they suboptimal? Maybe. But if there were 65 different markup languages/style sheet specifications out there, the web would be useless. So a standard was necessary.

That’s why good standards tend to last a long time. Other ones tend to get phased out. For example, HTML is a standard, but XHTML (some might argue) is a better standard, which may be phasing HTML out (in the long term). ASCII was a standard for a long time. UTF-8/Unicode is now considered a better standard, and is phasing ASCII out.

There’s no paradox in saying, “I want to have the choice to use emacs, vim, or gedit, but I also want there to be only one encoding for text files so that I can send those files to my friends or cut and paste their content into other programs.” Again, if there were no text encoding standard, then computer systems as a whole would more or less break down as there would be no application interoperability.

So please be clear on these definitions! I don’t think UNIX developers want to “have it both ways.” I think they are being completely sane about this. Edit: Think about it: what better way to increase the power of choice than to enforce good standards? We want choice in applications, but standards among them!

Trusted computing

Some scary stuff going on in the discussions at Slashdot today over Microsoft’s “Trusted Computing” initiative.

quote (Two Slashdot posters):

They [Microsoft] have already made the deals w/ Phoenix to make a MSFT certified BIOS that will enable them to not boot �insecure� OSs [read: Linux]. They are in talks to get the RIAA to support a format to make CDs unreadable in machines other than those running Windows (I presume this would include insecure versions of Windows as well). They are working to get the MPAA to agree to allow them to distribute movie materials via WMP which will likely lead to DVDs �protected� with MSFT products…

Sure, you can run all the free software in the world on your OpenBIOS computer. You will not be able to watch media, listen to media, surf the net, etc, because everything will require a “trusted” computer.

Yeah, it’s paranoid, yeah it’s probably [it seems] unlikely, but this is where we are headed whether we like it or not.


Mbox de-duper patched

I wrote a quick patch for the mbox-dedup.pl script I found online awhile ago. Basically, the author wrote a script that takes an mbox and creates a new mbox with all duplicate messages removed. I have to deal with duplicate e-mails constantly due to some weird incompatibility between Evolution and my Argosoft Mail Server (Windows), which I’ll have to figure out some day soon.

This script is just a temporary solution. I modified it so it now creates three files: $f.bak, a backup of your old mbox; $f, your new, dupe-free mailbox; and $f.dup, which is a mailbox which ONLY contains messages detected as duplicate. You can probably get rid of f.bak and keep f.dup around in case there were any mistakes in duplicate detection (which is what I’m doing). How annoying through. Anyway, if this bothers you, download the script, but use at your own risk.

Good article on programmer productivity

Read it here. It encourages programmers taking breaks to think about the bigger issues and reduce code bloat.

I understand now why programmers end up so conflicted. They have to work to meet deadlines, but often problems could be solved much more elegantly if there were extra time.

If I ever did run a software development company, one of the rules would be that everyone runs Workrave, a great free tool that forces you to take breaks from your computer every once in awhile. Not only does this reduce your chance of RSI/Carpal Tunnel, but it also provides a way for you to sit back and think about a problem in the abstract, rather than code your way through it.

I know deadlines are a reality. But in a perfect world, programming projects would be done “when they’re done.”