Freitag, März 30, 2007

The Greatest Dilemma of Mankind

Due to my "Excellent" karma rating on Slashdot, I often find myself with modpoints to burn (literally; I usually don't bother spending them until the day they are set to expire). This morning I encountered a situation I really don't care to be in, but frequently am. What the hell am I talking about? I'm referring to posts wherein a user has attempted to say something funny and failed. Rather than be ignored, this user is sometimes (as in today's case) unfairly marked as offtopic, flamebait, troll, or redundant. It's not that what he/she said accurately falls into one of these categories. If their post was OT, flamebait, trolling, or redundant, then I would ignore it and move on. The problem is namely that their post is fine, it's just not funny. And as in real life when I'm faced with someone who tries to tell a joke but fails miserably, I'm left with the task of making a quick decision whether or not to pretend to laugh. So here I am, staring at this shitty post marked Troll that is 1) not offensive to anybody in the least; 2) completely on-topic; and, sadly, 3) that I don't find funny even in an extremely liberal definition of the word. Shall I bump it up to Funny out of pity to give this poor bastard a break on his karma, even though I don't find it funny at all? Or should I do what I always do: moderate comments based on their value to me rather than as a way of balancing out the moderations of others. It's just a tech news website, after all. A tech news website filled with liberals complaining Slashdot is too full of conservatives, conservatives complaining Slashdot is too full of liberals, Libertarian Party members complaining about everyone, Linux enthusiasts complaining about Microsoft, Windows enthusiasts bitching that every article is anti-Microsoft, and so on. Oh, and 99% of them are Americans and when your English-as-a-second-language post contains a couple of typos, they jump on your spelling and completely avoid arguing the topic. How dare someone outside the United States want to discuss technology? Did they not read this article? Nobody messes with lucky #7, bitches!

Mittwoch, März 28, 2007

Speaking of Windows

Today I decided to try out qemu and install Windows 98. Here's a screengrab of me putting that hideous beast in a 1gb disk image from the comfort of KDE and FBSD 6.2. For a 833mhz machine, I notice surprisingly no performance dive from using the two simultaneously. Plus when those blue screens of death inevitably appear, I can just close out the emulator window and "reboot" in a couple seconds.

Samstag, März 24, 2007

Wine Testing (Don't Forget to Spit)

I've had to do some job-related learning of the Windows API lately, and while my experiences in that could fill a canyon, it has also lead me to rekindle a long-dead curiosity in the WINE Project. I began my studying by leaving the safe, loving arms of FreeBSD for an XP Pro box with a free edition of Visual C++ Express. I had heard plenty of complaints in the past about the WinAPI, but put them down to lazy Windows programmers not wanting to get their hands dirty. The truth is, the Windows API deserves complainers. It's ugly, illegible, and confusing. If your idea of GUI programming is a clean, object-oriented Qt interface, do yourself a favour and never take a look at a WNDCLASS. The fact that it's called a class is about as close as it comes to object-orientation.

Perhaps I'm being too harsh. After all, the API of Windows specifies not only GUI components, but everything about the operating system. If the FreeBSD kernel, XServer, and KDE were all combined into one disgusting, disorganised, and nonsensical blob, it would be just as painful to program. Fortunately, nobody in the *nix world is insane enough to try something like that. They also avoid wherever possible giving data types confusing and unnecessary names in all-uppercase letters. What's an HINSTANCE? It's a handle. Theoretically naming shit like this is supposed to save you time and prevent errors. It's not a 4-byte int, it's a 4-byte int redefined as a handle instance. Therefore it must be safer. Right. You know what? If you're using functions without reading the API documentation, your code probably isn't preventing any errors or saving any time anyway. And the time it takes to look in that function documentation and see what that integer represents takes all of 1 second.

Nevertheless, I progressed. Despite the fact that Visual C++ Express Edition totally lacks MFC support, which makes it pretty much useless for maintaining existing programs of any decent size that aren't crazy enough to use the Windows API directly, it was all right. But I kept asking myself, "Do I have to use this?" Every hour I spent in XP wondering if the computer would become nonresponsive at any moment or trying to calculate how many emails my undoubtedly bot-infected PC was spewing into the tubes, I could've been doing something cool and interesting in my beloved 6.2-RELEASE baby. After a total of 8 hours using Visual C++, I just said "Fuck it, there has to be a better way," and went back to the BSD box. I installed WINE, which I hadn't done since perhaps late 2005 when I toyed with it for awhile, and discovered the Winelib tools.

I'm not naive. At least not in this matter. I realise WINE isn't a perfect platform for Windows API programming; in fact, I found many a Google site shouting at curious inquirers not to try learning win32 in a WINE environment. You'd have to be crazy, they said. Well, perhaps I am...Perhaps I am.

If you're unfamiliar with the Windows API, a good starting point on the Internet is this site: http://www.relisoft.com/win32/index.htm. It contains a few tutorials that are easy enough to follow. Where they get interesting, for me at least, is in their usage as conformance tests for WINE and Winelib's toolset. So without much further ado, I begin with Test #1 (on the tutorial site this program is called "Winnie"). What follows is basically a lazy and shameless copy and paste of the README I wrote for that archive:


This is a "book testing" approach to Wine conformance using a
website rather than a standard book. I've had to modify the
files slightly, but nothing syntactic. The proper way to test
whether this works under WINE is to perform the following commands
in the directory of the source:

winemaker --lower-uppercase .
make

If it compiles, you know at least your WINE installation (0.9.33)
can get as far as mine. Now copy the resulting output (for me
this file is called winnie.exe.so) to somewhere in the WINE
base directory and call it. For example, on my system it would
look like this:

cp winnie.exe.so ~/.wine/drive_c/winnie.exe
wine "c:\winnie"

If all went well, you should now see a boring white window with
a friendly titlebar.


The source for this test can be found here: http://drlight.multics.org/winetests/winnie_winetest.tar.gz

And here's a screenshot of this exciting, do-nothing application!

Here's a screenshot of this exciting, do-nothing application!

Freitag, März 02, 2007

KDE 4 Fever

OK, not really fever, but for some reason I've become obsessed with the next release. I read dot.kde.org news every morning and look for any glimmer of a screenshot showing more than a broken 3.x build. Along the same topic, I have finally gotten my 3.5.x the way I like it. I went through a lot of themes, icon sets, and configurations before I came to a system I feel completely comfortable with. Now all I have to do is install KDE 4 sometime this autumn or winter and completely destroy all my old settings to make way for the revamped features. Here is a screen capture I am particularly proud of (note the gigantic MacOS inspired icons suitable for old people and folks with glasses like myself: