2004-03-18 16:41

Why isn't this in the kernel?

The nth module for iptables.

This nifty gadget lets you match the nth packet to a rule.

What for? Well, suppose you have two links, and have implemented split access as per the LARTC

According to the same LARTC, you can implement per-route load balancing by creating a multipath route.

That works well... as long as the traffic originates on the firewall itself (say, using a Squid).

If the traffic comes from a SNATd subnet, it breaks, because you SNAT (or MASQ) it to one of your external IPs, and then it's routed only through that link, for obvious reasons [1]

You can route based on original source IP, so you can tell half the boxes to go left, and the other half to go right.

And then if the client boxes are used unevenly, your balancing sucks.

So, what's the solution? Match every second state NEW packet over each link.

Since iptables's MASQ or SNAT will make the state ESTABLISHED,RELATED packets follow the leader, each connection alternatively routes left or right.

While not 100% right (you can be unlucky and redirect all long connections on the same link), it is much better than the simple alternatives, and much simpler than the better alternatives.

But hey, nth is only on patchomatic. And Red Hat's (Fedora's) kernel makes patchomatic go nuts.

So it's custom-kernel-compiling time, and I hate doing that. Really, this patch seems simple. Why is it not in?

[1] If you routed it through the other, your ISP would reject the packets, because the origin IP is foreign to him.

2004-03-15 15:14

Accuracy in reporting

If it wasn´t so pathetic, it may be funnier.

A while ago, a glacier collapsed. This is a periodical event, and a huge tourist attraction. Huge slabs of ice crashing down, and you can watch it from a safe distance.


Now, here comes the reporting.

The BBC:

A massive pond builds up behind the wall of snow before getting too heavy for the ice to hold and smashing down into the sea below.

Hmmm... well, that´s a lake. But what the heck, the ocean is only a few hundred kilometers away. Over the Andes, crossing Chile.

WISTV (whatever that is):

No one hurt when portion of Argentinean glacier collapses

Noone has ever been hurt by this. Everyone knew it was collapsing, to be hurt you would have to get on a boat and cross a very very cold lake, too. And be the stupidest man on earth, since there were huge chunks of ice falling every few minutes since two days ago.

Hell, there´s park rangers and it´s forbidden to approach the glacier from the water!

Oh, and it´s not an ice shelf.

But anyway, if you want to see at least the video, it´s really cool :-) It´s in this page, but I can´t link it: VIDEO

2004-03-14 11:49

Getting paid for writing

I have decided I don´t suck at writing technical articles. I am not all that great, but I don´t suck.

And I am quick, too.

So, I have decided I would like to get paid. I tried sending email to [email protected] (they claim to pay for content) but have not gotten even a "no thanks" response. Maybe they are slowish ;-)

Anyone knows any other sources of income for someone who can write decent short technical articles?

I think I will contact LinuxWorld and Linux Journal, but they are a bit too ... high level. You know. Real magazines ;-)

I only mean for this to pay a few bucks, it´s not what I intend on living from ;-)

In the meantime, I will continue writing one or two articles a week, anyway!

2004-03-13 10:58

Personal Backups with rdiff-backup

Here's a little article about backing up your own personal data safely.

I wrote it because it seems this kind of solutions are not very well known.

While not a real, serious backup strategy, it's pretty safe, as long as the system still lives, you can recover your data.

2004-03-11 19:04

Electronic reading materials

I recently recovered a Palm m100, because my calendar was getting out of hand.

So, besides using it as a glorified alarm clock, what could I do with it?

Oh, sure, some lame games exist (remember this is an old model, black and white, almost no sound, low resolution, very little memory), but...

Well, I have had for a long time the habit of reading project Gutemberg's books. I even wrote a program to read them on my PC (Uqbar, link at the left).

But the main problem is, of course, that the places where I do most of my reading (bars, clients' offices while waiting for stuff to install, trains, waiting rooms) usually lack computers I can use.

So, I decided to try using the Palm for that.

Of course, I am not being original, since a bazillion people had the same idea.

Therefore, I went and got myself some of the software people recommended for reading Palmdoc documents, and some stuff to create them.

I tried: Iambic Reader, CSpotRun, and a couple of others, and had a nasty surprise, because all of them, when I jumped to a distant place in the book, did one of the following:

  • Crash
  • Corrupt the text

So, I gave up hope on Palmdoc (although it's nice that KWord can export to it!), and looked harder.

Then I found Weasel Reader. Not only does it work great (it only lacks an option to add a margin, sometimes lighting makes the edge of the screen hard to read), but the format it uses compresses texts more than palmdoc!

So, how's this going:

  • The screen is small, but that's not too bad, it is about the same as reading a newspaper column.
  • Smooth scrolling doesn't work. Maybe my palm is too old/slow/bad, but it doesn work well.
  • Page-rolling autoscroll does work. The top of the screen is automatically replaced with the next page line-at-a-time.
  • Manual page-scrolling works best. Since you only have to tap the screen or press a button it's not annoying at all.
  • It doesn't hurt my eyes. Since it's not even backlit, it requires good ambient light, but it's not bad at all.
  • It has decent capacity. I can stick up to 3MB of text, along with all the programs I use, in a 2MB device. 3MB of text is a lot of text.

So, I am pretty happy with the result.

2004-03-08 11:51

Goats and cars

There's a problem often used to show the unintuitive nature of probability, which has become very well known.

In that problem a contestant in a gameshow has to choose between three doors (A,B,C), on one there is a car, on the other two are goats.

After the contestant chooses, the host opens another door and shows a goat.

Then, the host offers the contestant the chance to switch his closed door for the other closed door.

Should he switch?

The intuitive answer is "it doesn't matter", because there's two doors and one car, so it's a 50-50 chance.

But the real answer is that it does matter, because it's a 33-67 chance!

While it's simple to show this to be the case to a statistically-educated dude, it's somewhat harder for a layman.

In fact, I think most explanations suck.

Here's my shot at it:

If you were offered the chance to switch between your closed door and the other two closed doors, would you take it?

The intuitive answer to that is of course, yes, because it's 67-33 for the car to be on the other two doors.

Now, regardless of where the car is, can the host open one of those two doors and show a goat? Of course, yes.

So, would you feel your odds went down because the host showed one of your two closed doors had a goat behind it? No, because he could always do that, and you know there was (at least) one goat there!

So, what difference does it make if one door is open or not?

I don't expect this to convince anyone, really, but just in case, I have a python implementation of this problem (goatcar.py :-) if anyone wants it, if empiricism can convince you ;-)

2004-03-06 21:57

Refactoring and modularizing

I need to do it, that is.

I am hacking the restructured text editor out of Notty, so it can be used in other places.

The bad news, of course, is that because I didn´t do it at the beginning, the current implementation is like an inkblot running through the rest of the code, tainting everything, which is hard to remove.

After that, I have to do the same thing with the "tree-thing-that-drags-drops-and-knows-how-to-save-itself" (TM), and I will have three rather powerful widgets (PyTextBrowser is the third: a QTextBrowser that does HTTP and images, you can get that one already).

Maybe I should turn these into some sort of package, too.

2004-03-02 16:35


It isn't so much, but it's a lot to me :-)

Thanks to all the readers!

Contents © 2000-2019 Roberto Alsina