Skip to content

Blog

Don't underestimate the power of xargs

I know this sounds lame, but I have never really needed it until now. I've recently been really busy with a new job taking up my working hours, and some renovation on our home taking up my time off, so I haven't been keeping on top of spam mail.

I run postfix as my MTA and have that apply spamc and anomy sanitizer to incoming mail before piping the mail into cyrus imapd. I use IMAP for mail as I could be using any of a number of different machines here to check my mail. This makes training the spam filter a little difficult, so I have a simple training-by-filing setup:

I have INBOX.junk, INBOX.junk.ham and INBOX.junk.spam. The first of these collects spam recognized by spamc during delivery. The user will then copy mail from junk into junk.ham if is was a false positive, or copy mail from INBOX into junk.spam if it wasn't recognized as spam.

Periodically, I run a script to train based on the contents of the ham and spam folders. Now, the problem I had was that I'd left way too much spam hanging around in the spam folder (the script doesn't do any pruning), and so it was failing due to the excessive number of command line arguments.

So, the moral of the story is: always use xargs for maintenance scripts, even if you don't think you'll need it.

The Meatrix

I was chatting to Davey just now about how I used to enjoy Rowntrees (now owned by Nestle) Fruit Pastilles before I became a vegetarian (they're off limits now, since they contain gelatin), when I remembered this funny but sobering bit of flash.

SubEthaEdit

SubEthaEdit in action I had the pleasure of using SubEthaEdit today. Both myself and George needed to edit some text at the same time (literally!) and he mentioned that it was a shame that I didn't have a Mac, because we could use SubEthaEdit if I did. Well, as it turns out, I do have a Mac hanging around here.

I was a bit sceptical at first; I don't particular like Mac, even though OSX is not too bad. But, WOW, SubEthaEdit just works. I can see George typing stuff and his changes are in a different pastel colour from mine. What a great tool.

Now, why don't we have this tool for platforms other than OSX? Looking at their site, the SubEthaEdit people seem particularly elitist about it being Mac-only and they don't want to OpenSource it (fair enough).

It's tempting to start another one of my world-domination attempts by writing my own version of this app using, say, wxWidgets.

New domain, new blog

I'm gradually moving things over to my new domain and new blog. This one will still hang around to keep links working; eventually I'll move the content over and set up redirects so that I don't need to keep two separate things up and running.

The new blog is something I put together myself without really reading any blogging specs, so it might have a few teething troubles, althought it's not doing anything too complex.

Linux on Windows

[Update: You can now find the source code for this on bitbucket]

Call me crazy, but I've wanted to run a linux binary natively under windows for a while now; kinda like wine, but in reverse.

Well, the other day I was browsing through the MSDN docs (as you do) and discovered that it is possible to install a "vectored" exception handler. A quick bit of test code later, and I discovered that I can trap "int 0x80" instructions using this technique--those are used by linux binaries to initiate syscalls.

A couple of days hacking later, and I have a very small linux kernel emulation environment; it's split into two parts--low.dll (the kernel code) and low.exe (the bootstrap). The usage is quite simple; from your command prompt, run the linux binary of choice by prefixing the command line with "low.exe":

low.exe linuxsmallapp one two three four

The code from the named linux binary is loaded (low.dll includes an ELF loader) and bootstraps the process by faking an execve() syscall. When the syscall returns, the code resumes execution inside the loaded module. The code is running natively on your processor; and syscalls happen in userspace (just like the binary) although they run under a separate stack inside the win32 exception handler code. So, this is almost like kernel space.

What I have now is good enough to run my simple hello world application. It doesn't yet handle dynamic elf executables--they need to be statically linked. Thanks to Tal Peer, I have a collection of statically compiled coreutils from gentoo; they start up fine, but die somewhere in the stdio part of libc. I'm trying to track down the problem.

If anyone has any insight into why this might be (maybe windows is doing stuff for software interrupt number 128? before it calls my exception handler?), I'd like to hear it :-)

[Update] If you're interested in playing with it, please don't expect to acheive much at this stage. You can download it here.

A PHP Application Installer

After looking at jBlog and a number of other PHP applications, I realized that they are all trying to do the same things during installation, some more competent than others.

Sooo... why isn't there a tool, like InstallShield or MSI as seen on win32, for packaging and managing the tricky installation and initial configuration of PHP (web) applications?

Well, I'm working on one now :-)

Yet another blog

I've finally succumbed to setting up a blog.Considering my already massively busy schedule, only time will tell if this leads anywhere...

This is part of an excercise in writing a (perhaps the definitive) PHP based blogger. Hopefully, Jannis won't be too annoyed at the posse of PHP developers that seem have taken over his project.