Archive for the ‘Computing’ Category

Samba over PPTP considered harmful

Saturday, January 3rd, 2009

If you’re seeing poor performance and/or random flakiness accessing a Samba server over PPTP, especially when transferring large amounts of data, you should seriously consider getting rid of PPTP altogether and trying something like OpenVPN if at all possible.

The TCP retransmission problems caused by stacking TCP have been known for years, but being the lazy person I am, and being quite satisfied with the convenience and ubiquity of PPTP aka “Windows VPN”, I never seriously looked into the kinds of problems it causes. I figured that the ease of use would be worth a 10% to 20% performance hit. And the random disconnects and long Windows Explorer freezes - well, that’s just Windows, isn’t it? It’s probably a bug in the Windows TCP stack… or an incompatibility in smbd… or an ARP issue…

But that’s not really what happens. What actually happens is an almost complete meltdown of the link. The TCP adaptive algorithms work against eachother in a kind of negative feedback loop and eventually the signal drowns in noise, reducing the effective capacity on 2 Mbit link to less than 100 Kbit with spectacularly bad latency. The latency causes massive packet queue buildup, causing timeouts and excessive delays which in turn trigger bugs and frozen applications.

Things continue to get worse until the TCP adaptive algorithms eventually run out of wriggle room and the system settles at a kind of dismal minimum. Looking at this stuff as it happens using Wireshark is like watching a cokehead trying to staunch a nosebleed by snorting more coke: funny then sad.

So forget about fiddling with mtu and proxyarp trying to improve Samba performance over PPTP. It’s the kind of game where even if you win, you lose.

Hiding posts in WordPress

Tuesday, December 30th, 2008

Sometimes I want WordPress posts to be easily accessible, but not advertised in public. When I have a story to share with my mother, I just want to send her the direct link - but I don’t want the post to appear on the home page or be reachable via navigation links or feeds.

WordPress has functionality to allow posts to be ‘Private’ or ‘Protected’, but both of these require passwords or logins. This is more than I want to subject my mother to.

So I have created a patch to WordPress 2.7, which adds functionality to hide certain categories and all the posts in those categories. This patch does the following:

  • Allows you to set the ‘hidden’ flag on any category in the Admin GUI.
  • Hides any hidden categories from the category list in the sidebar.
  • Hides ‘previous’ and ‘next’ links to a post in a hidden category (when viewing a single post).
  • Hides the post from the RSS2 feed.
  • Hides the post from your front page (minor theme modification required).

Download the patch here (17KB)

Applying the patch

First, make a backup. This patch is provided in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

If you are applying this patch to an existing WordPress installation, you will need to make a minor database modification:

ALTER TABLE wp_terms ADD COLUMN flags VARCHAR(100) DEFAULT '';

Next, apply the patch. This example assumes the patch is located in your home directory (~).

user@host:~$ cd /path/to/wordpress
user@host:/path/to/wordpress$ patch -p1 < ~/wp2.7-hidden-categories.diff

Finally, change your blog template. Locate the beginning of The Loop and add the line in bold:

<?php while (have_posts()) : the_post(); ?>
<?php if ( is_hidden_category() ) continue; ?>

That’s it! You can now go into the admin GUI and set any category to ‘hidden’ via Posts > Categories.

Alternatives

Would like this functionality but don’t want to patch your WordPress? Have a look at the following plugins:

These are easier to install but do not hide previous/next post links and do not hide the categories from the category listing in the sidebar. I believe this is impossible within the current plugin architecture (but please let me know if I’m mistaken).

My first computer

Friday, December 19th, 2008

CanonV20 3

This is an image of my first computer, the Canon V-20, an MSX 1 compatible. My father bought it for me in 1988 or thereabouts, at a Dutch discount store called Kwantum. It came with a small, fosforescent green Philips screen.

Near the top of the machine, to the right of the Canon logo, it had a cartridge slot that you could use to play games. Basically you rammed the cartridges straight into the motherboard. Sometimes it required quite a bit of force. You could hear the printed circuit boards grind and gnash as they joined.

We played lots of Konami games. Nemesis, Hyper Sports, Yie Ar Kung-Fu.

The cartridges were expensive. Later on I got a tape recorder. There were lots of cheap bargain bin games on tape. They took ages to load and often you would have to load them 2 or 3 times before they would work right. The tape recorder wasn’t very good.

At some point the tape recorder started eating tapes. One of the tapes became so tangled up inside the recorder that I had to cut it up to get it out. My father tried splicing the tape back together with transparent duct tape, but of course the game never ran again.