Geekery

Staggering news

I’ve changed my main programming font from Bitstream Vera Sans Mono to Inconsolata.

The latter is slightly neater and more compact than the former, but I will always retain fond memories of Vera.

Geekery

Comments (0)

Permalink

Forgive me, Linode!

Recently I’ve opened a new account with Linode in anticipation of moving a server across to them. So far they’ve been pretty good. My current provider is Slicehost, who are also excellent and whose reliability has been utterly flawless — I have servers with ~500 days of uptime with them. I can recommend both services.

As a sort of quick test for Linode performance, I decided to run ab against the new server from my desktop here at home. I fire it up for the first run: 100 requests, 10 connections. It performs well. Next I jump to the next order of magnitude: 1000 requests, 100 connections. It times out.

In doing so it also kills off the SSH sessions I have logged into the Linode server.

After some experimentation, it becomes clear that the magic number of connections is 32. If I have 32 or more connections through ab, the connection locks up.

I opened a ticket with Linode and began trying to nut it out. I checked the iptables settings, the nginx settings, various kernel TCP/IP settings. All to no avail.

Today I tried out the 1000/100 test from another server I control and voila, it works fine. So it turns out that the limit on connections wasn’t at Linode’s end, it was at my ISP (iinet). They must have introduced this recently as I recall performing similar “sanity test” benchmarks on remote servers before.

Anyhow. The moral of the story is: I shouldn’t have thought unkind thoughts about Linode. It wasn’t their fault. However I offer as a suggestion that in future cases like these, they run ab from their side to eliminate ISP middlemen problems.

Geekery

Comments (0)

Permalink

NeoAxis: Some Whinging

One of my final semester units at UWA is Game Design & Multimedia. The engine used for this course is NeoAxis, which is a sort of franken-framework built in a lab out of parts of opensource code.

For instance, it uses the formidable OGRE for rendering.

There are two things (so far!) that bug me about NeoAxis.

The first thing is the documentation. It is pathetically incomplete. It is extremely annoying to be looking stuff up in the help file (only supplied in the useless CHM format), only to find a blank page. And even when you do find something more substantial, it’s apparently translated from Russian (really, I’m not kidding) and has a lovely Engrish feel to it. Naturally this is unhelpful.

The second, much smaller gripe, is the coding style. Ostensibly NeoAxis games are meant to be written in C#. However the sourcecode that we are basing our project on is riddled with C/C++ idioms. The most obvious of these is the if(!someFunction()) error_handler(); idiom, which is scattered liberally throughout the code. I guess try/catch was a bridge too far for most of the code.

Geekery

Comments (2)

Permalink

Fuggedaboudit

A much easier way to install LuaSQL, on Ubuntu at least, is to use aptitude. I wasn’t using aptitude because I didn’t see the driver for PostgreSQL in aptitude. But it’s there if I upgrade to a later version of Ubuntu.

So. Forget my last entry.

Geekery

Comments (0)

Permalink

LuaSQL is not installer-friendly.

Lua is a nifty little language that I am putting to work in a personal project. Unfortunately it is lacking in some departments — while it has a library distribution framework in LuaRocks, it doesn’t have momentum enough for this system to be comprehensive and up-to-date.

LuaSQL is a perfect example. This little library provides a very think DBI-style layer to talk to various databases. But it’s not available as a LuaRock.

Continue Reading »

Geekery

Comments (0)

Permalink

A fix for cat2email in WordPress 2.1 and above

Club Troppo, a site that I administer, relies on the cat2email plugin to post certain categories to interested users (there are lots). When I upgraded to WP 2.1, a lot of users began to complain that they were getting improperly formatted files. The headers would be something like this:

--===============2045766128707237696==
Content-type: text/html; charset="UTF-8"
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset="UTF-8"

Obviously problematic, as many email programs would then render HTML mails as plain text. Hilarity ensues.

Well first off, there’s a tiny bug in the cat2email code. It should put out ‘Content-Type’, not ‘Content-type’. Fix this and you get a different set of incorrect headers:

Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit

Hmm, still useless.

The culprit, it turns out, is WordPress. In 2.1 and 2.2, the wp_mail function was modified to use the PHPMailer class. If you crack open wp-includes/pluggable.php, you’ll see that the wp_mail function always forces conversion to plaintext. Pretty dodgy.

What it ought to do is check for custom headers and work with them. I’ve submitted a patch to the WordPress mob, and if you really need it, see below.

--- /Users/jacques/Downloads/wordpress/wp-includes/pluggable.php
+++ pluggable.php
@@ -187,7 +187,15 @@
$phpmailer->AddAddress("$to", "");
$phpmailer->Subject = $subject;
$phpmailer->Body = $message;
- $phpmailer->IsHTML(false);
+ if ( strstr( $headers, 'Content-Type: text/html' ) )
+ {
+ $phpmailer->IsHTML(true);
+ }
+ else
+ {
+ $phpmailer->IsHTML(false);
+ }
$phpmailer->IsMail(); // set mailer to use php mail()

do_action_ref_array(‘phpmailer_init’, array(&$phpmailer));

Update: Looks like a more robust fix is scheduled for WordPress 2.3.

Geekery

Comments (0)

Permalink

Uber Ubuntu Mailman Madness

A petty annoyance on Ubuntu is getting all the bits of mailman to talk to each other: the mailman software itself, and in my case Postfix as the MTA and Apache as the host server.

Putting aside my complete failure to properly RTFA on the Mailman-Postfix hookup, I found an interesting problem with the default install of Mailman: if you modify permissions to allow Apache to reach the relevant cgi-bin directories, parts of Mailman stop working. Modify it back using the included check_perms script and Apache stops working.

The solution is to add the Apache user (www-data) to the Mailman group (list). Then everything works.

Geekery

Comments (5)

Permalink

On a particular pecl failure

The symptoms are like so:

bash: ./configure: /bin/sh: bad interpreter: Permission denied

Which has nothing whatever to do with the root cause. The actual problem is that pecl downloads files to /tmp and does its work there. If /tmp is mounted as noexec, pecl will fail with errors like the one above.

Solution #1: Change the fstab for /tmp, removing the noexec option.
Solution #2: Working in another directory – such as /usr/src – manually perform the steps pecl automates. An example for xdebug is found here.

Geekery

Comments (0)

Permalink

Cats & Laser Mice Don’t Mix

Do you have a fancy laser mouse like I do? Isn’t it cool? Don’t all your friends admire it? I know mine do!

ginnie.jpgWondering why it’s acting funny? Cursor moving too fast or too slow? Cast an unfriendly glare at your cat, who even now may be snoozing nearby in a state of offensive cuteness. A single strand of her fur has stuck to the mouse eye and the stupid laser beam is confused.

Geekery

Comments (0)

Permalink

Note about CEAN Erlang

The CEAN distribution of Erlang is fairly useful for OS X dwellers like myself, but note that there is a small “gotcha” to be aware of. It doesn’t come with the c() function – ie the compiler – installed!

You need to enter cean:install(compiler). in the BEAM shell before you can load and execute .erl files.

Geekery

Comments (0)

Permalink