Monday, June 26, 2006

My debugger for C++/Linux finally went live this past weekend, at www.zero-bugs.com. Next, I will be testing it with the SUSE and Ubuntu distros.

The FreeBSD port requires quite a bit of work, because of the way multithreading is implemented in their kernel. I have stubbed out the support for FreeBSD in my debugger engine back in November, but the main focus has been Linux, and there is only one of me...

Also, following the development GNU C++ compiler and testing with the recent releases takes time, even with a suite of automated testing. Hopefully, now that I have an alpha release out, I will be getting feedback that will drive my testing / bug-fixing process; of course, "zero-bugs" is a dream :)

Last edit: Mon, Feb 19 2007
Wow! Time really flies like an arrow (and fruit flies like a peach).

Since the ZeroBugs debugger was first published on the internet, I have added crucial features such as Python scripting, tabbed code views, customizable hot keys, and have fixed ... er... more than zero bugs; went thru several Linux distros, and met some interesting people in the process.
Time goes by so fast when one is busy!

Saturday, May 13, 2006


Three weekends ago my friend Andrei Alexandrescu got married. The reason I am only writing about it now is that it took me so much to recover. That's how wild the party was.
The whimpy advocates of extreme programming have no idea what an extreme party the good ole C++ school can throw.

I can hardly wait to attend his speach on the 17th, at the Northwest C++ Users Group (see http://www.nwcpp.org/). I just want to see how married life changed him (for the better).

At his reception we met Eric Niebler, a badass contributor to BOOST (http://www.boost.org/) which whom we shared a table. I am not sure I want to sit next to him ever again. He is so intimidatingly smart that in order to not lose face I had to mention that my wife went to Princeton.

Anyway, we decided after a few beers that C# is to C++ what hip-hop is to jazz, and those punks that rap to .NET beats airwaved out of Redmond have no class whatsoever. We will invent a secret handshake to recognize eachother, and plan for keeping legacy C++ code in place, to preserve job security and world domination. Well, I resisted learning Java so far, and I'll see how well I do without cluttering my mind with C#. I think anyone who has not programmed in any other language but C# is a f***** moron ('member how back in the hayday we had an inflation of "HTML programmers"?)

I have been developping a debugger for C++ on Linux for the last three years or so, and it is close to being released now (see http://zero-bugs.com/). I am doing a lot of testing (and some tune-ups for the x86_64) it should be ready for download as soon as I get the license terms ok-ed by the lawyers...

So stay tuned and watch for the secret handshake.
And wait, I need to ask my wife to help me spell-check this post...

Saturday, January 07, 2006

As the title of this blog may suggest, one of my favorite pastimes is to sit around the house in my boxers and program my computers.

The next best is to surf the internet on the jøn (I have a wireless linux laptøp); but today I went for a change and took a magazine to the bathroom (to read). The said magazine is no other but the recently defunct C/C++ Users Journal.

I went (as usual) straight to my friend's Andrei Alexandrescu column, Generic<Programming>. Almost a page and a half into the article, I was relieved. Andrei is human, after all; he writes funny stuff every once in a while. Although I wonder if his great humor is always intentional. Let's take this paragraph, for example:

[...]the output pattern on an already-trained net involves quite expensive matrix multiplications and nonlinear math functions (such as exponentials) that aren't cheap.
Now let's assume that we have a problem in which input patterns tend to be quite repetitive[...]


This reading is almost as entertaining as this description of the Metacity window manager that I found online:

Metacity is a lightweight window manager written by Havoc Pennington from Red Hat. The first version was 2.3, which was released in 2001 .


Some people start counting with 0, some start at 1, some simply go with 2.3 That's okay, but remember:
the Lord spake, saying, 'First shalt thou take out the Holy Pin. Then, shalt thou count to three. No more. No less. Three shalt be the number thou shalt count, and the number of the counting shall be three.

The Holidays are over, Happy New Year and let's get back to werk :)

This week I have decided to give a make-over to my ancient Dell Inspiron 8000. I upgraded from RedHat 7.2 (yes, I know, I know...) to Fedora Core 4, and bought a Linksys WPC 54G v3 wireless card.

After downloading and installing ndiswrapper 1.7, I proceeded to configure the wireless connection.

The Windows NT driver that came with the card was installed properly by ndiswrapper, and the "iwlist scan" command promptly discovered my home network; then I tried using iwconfig to set the ESSID.

And I got into a problem here: iwconfig would report success, yet the SSID remained unchanged (off/any), and the address of the access point was all zeroed.

I tried setting the address point address by hand, no dice.

I googled the matter until 3 AM, when I decided to write my own C program for resetting the network ID on the card.

And, guess what? After running the code, the card auto-magically connected to my access point!
I have not tried using encryption yet. Our house is far enough from the street, and the closest neighbor is out of range for the Apple AirPort that we use... so no need to be paranoid.

Anyway, here's the program that made it all work:


/* -*- tab-width: 4; indent-tabs-mode: nil; -*-
vim: tabstop=4:softtabstop=4:expandtab:shiftwidth=4
*/
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <unistd.h>
#include <wireless.h>


static const char* default_dev[] = { "wlan0", NULL };


int main(int argc, const char* argv[])
{
int result = 0;
const char* device = NULL;

int s = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP);
if (s == -1)
{
fprintf(stderr, "socket: %s\n", strerror(errno));
result = -1;
}
else
{
struct iwreq req;

/* Reset the SSID for all devices given
as command line arguments; if no device
specified, reset the default device
*/
if (!(++argv, --argc))
{
argc = 1, argv = default_dev;
}

for (; argc; --argc, ++argv)
{
device = *argv;

/* init request structure */
memset(&req, 0, sizeof req);
strncpy(req.ifr_ifrn.ifrn_name,
device, sizeof req.ifr_ifrn.ifrn_name);

memset(&req.u.essid, 0, sizeof req.u.essid);

if (ioctl(s, SIOCSIWESSID, &req) < 0)
{
fprintf(stderr,
"ioctl: %s: %s\n", device, strerror(errno));

result = -2;
}
}

close(s);
}
return result;
}

After compiling it with the command
gcc -static essid.c -o /sbin/essid-reset ,
I have added to my system the following scripts:

/etc/sysconfig/network-scripts/ifcfg-wlan0

DEVICE=wlan0
BOOTPROTO=dhcp
ONBOOT=yes
TYPE=Ethernet

USERCTL=no
PEERDNS=yes
IPV6INIT=no


and:
/etc/init.d/wlan

#!/bin/sh

case "$action" in
start)
/sbin/essid-reset;;
stop)
ifdown wlan0;
rmmod ndiswrapper;;
esac