Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Matts (1087)

Matts
  (email not shown publicly)

I work for MessageLabs [messagelabs.com] in Toronto, ON, Canada. I write spam filters, MTA software, high performance network software, string matching algorithms, and other cool stuff mostly in Perl and C.

Journal of Matts (1087)

Tuesday January 26, 2010
05:31 AM

ah, dreams...

I just woke from a dream where it was rjbs' birthday and we got him an onion cake. Only the person who made the cake misunderstood, and instead of a cake shaped like an onion he cooked it WITH onions in it.

Bizarro.

Monday January 25, 2010
06:23 PM

Time::Piece test failures on Win32

Can someone with Time::Piece test failures on Win32 please contact me offlist? I have a proposed patch I'd like to test, but no Win32 perl to test it on.

Monday January 04, 2010
05:13 PM

Warning compiling perl stuff on Snow Leopard

I've searched but can't find any reference to this...

Compiling IO::KQueue on Snow Leopard I get the following warning:

KQueue.xs: In function 'XS_IO__KQueue_kevent':
KQueue.xs:71: warning: format not a string literal and no format arguments

Yet that line is just:

    Newxz(ke, max_events, struct kevent);

Which seems to me pretty standard perl, and no format strings involved (though Newxz expands quite a few macros).

Monday June 01, 2009
07:05 PM

Early Komodo Edit review

Recently I started using Komodo Edit (the free version of Komodo IDE). This is an early review, of having used it for my work for about a week, which isn't really enough to know whether I'll be sticking with it, but it's a good start. I started to get a bit tired of the limitations of TextMate - an editor I like, and paid for, but the v2 which they keep hinting at seems to never be coming, and it has some short-falls which I find very annoying.

ActiveState actually asked me to do a review of Komodo IDE a while ago and I never got around to it, so I never got a free license key from them. Maybe they'll read this ;-)

This review is of using it on my MacBook (non-pro) 2.4Ghz, 4GB Ram.

The Good
========

Generally it has everything I'm looking for:

- all documents in tabs
- mostly the right keystrokes for everything (i.e. it's not VI or Emacs, though I believe it has vi emulation for the die-hards) - I only had to fix Cmd-[ and Cmd-] for indent/deindent.
- open over scp/sftp.
- syntax highlighting seems to just work (haven't found any flaws yet, though Perl can be tricky that way!).
- shows line numbers, folds, etc in a nice way
- autoindent mostly works well
- macros in Javascript/Python make it VERY flexible
- "show current file changes" (before you save) is an AWESOME feature, and loads them into the proper "diff" window
- macros even allow you to access that diff window, so writing some macros to access our version control system (AccuRev - don't ask!) was relatively straightforward for a non-Javascript coder like myself
- macro output looks like it'll be easy enough to write a Prove/Test.pm runner

The Missing
===========

There are always things missing in editors, usually things I've experienced elsewhere that I'd love to see replicated:

- I *love* textmate's ability to re-indent code when I paste it in, at the correct current level.
- I wish open over sftp would allow me to open a whole directory (i.e. treat it like a temporary project)
- I wish I could open a directory instead of have to create a project.
- I wish tabs would double over instead of flow off the side (as an option) as I tend to keep a lot of files open
- I wish the project pane would highlight the current file/tab instead of the last file I double clicked on
- Documentation of the macro stuff is a bit weak, though the forums are good for help on this (I haven't posted, but the search has helped a lot, and most posts seem to get a reply).

The Buggy/Broken Bits
=====================

- There's sometimes an oddness with macros - sometimes I edit them and the edits don't "take" - restarting fixes this.
- Can be a TINY bit slow. I'm on a fast mac, so I suspect this would be much worse on my G4 laptop.
- The find options seem a bit odd to me - there's multiple locations for "find" - in the toolbar and in a separate window, be nice if it were unified and accessible with Cmd-F
- Open over sftp seemed a bit fragile and has hung on me once

Overall though, I like it. I'm not really sure what Komodo IDE could add over and above this, I suspect it'll just come with a lot of cool plugins and macros that do clever things...

I'll maybe post more on this if I keep using it.

Thursday April 09, 2009
12:57 PM

Perl on LLVM

There was recently some talk on p5p about getting perl up and running on the LLVM. This was following the recent excitement from the Python crowd about the Unladen Swallow project, and less so, the MacRuby Experimental Branch.

So following that post I decided to see how easy/hard it was to get to the first stage - getting perl compiled and running with clang, the llvm gcc-like compiler.

It wasn't too hard (a lot of compiling). After I got everything running I first ran perlbench, which looked reasonably promising:

                         gcc    llvm
                         ---    ----
arith/mixed              100      86
arith/trig               100      86
array/copy               100     101
array/foreach            100      92
array/index              100      93
array/pop                100      96
array/shift              100      95
array/sort-num           100      89
array/sort               100     101
call/0arg                100     102
call/1arg                100      89
call/2arg                100      75
call/9arg                100      89
call/empty               100      87
call/fib                 100      90
call/method              100      98
call/wantarray           100      89
hash/copy                100      95
hash/each                100      94
hash/foreach-sort        100      97
hash/foreach             100      91
hash/get                 100      91
hash/set                 100      89
loop/for-c               100      86
loop/for-range-const     100     111
loop/for-range           100     116
loop/getline             100      96
loop/while-my            100      94
loop/while               100      96
re/const                 100      86
re/w                     100      89
startup/fewmod           100      95
startup/lotsofsub        100      93
startup/noprog           100     101
string/base64            100      89
string/htmlparser        100      92
string/index-const       100      81
string/index-var         100     108
string/ipol              100     103
string/tr                100      86
 
AVERAGE                  100      93

So next step was to try some more real-world code. I took 41k non-spam mails and ran SpamAssassin on them (using the mass-check tool), with no network tests enabled, and a HTML::Parser also compiled with LLVM (and gcc, in the gcc instance).

Results of the timings:

GCC:
 
real    40m56.599s
user    64m44.586s
sys    0m59.644s
 
LLVM:
 
real    45m38.831s
user    71m14.218s
sys    1m20.882s

So rather less promising.

Still, an interesting start - see the original link for information on where it needs to go from here. I think this might have a lot of mileage if the actual internals were ported to LLVM style code. If someone is interested in picking up this project, and maybe being paid for it, please get in touch.

Monday January 19, 2009
10:10 AM

Dakar

Just want to publicly say congratulations to my brother-in-law Quin for coming fourth overall in this year's grueling Dakar rally. An amazing achievement for a non-factory team.

Monday November 03, 2008
03:39 PM

Perl Unsafe Signals

This is just to document (and place in google) how to do unsafe signals in recent perls without loading a non-core library to do it:

    use POSIX qw(SIGALRM);
    my $timeout = 30;
    my $sigset = POSIX::SigSet->new(SIGALRM);
    my $action = POSIX::SigAction->new(
        sub {
            # re-install alarm in case we were in an internal eval{} block
            alarm($timeout);
            die "timeout working on: " . (caller(1))[1] . "\n";
        },
        $sigset,
        &POSIX::SA_NODEFER, # turns off safe signals
    );
    POSIX::sigaction(SIGALRM, $action);
    my $prev_alarm = alarm($timeout);
 
    eval {
        # long running code here
    };
    my $err = $@;
    alarm($prev_alarm);
    if ($err) {
        if ($err !~ /timeout working on:/) {
            die $err; # propogate this error
        }
        # process the timeout
    }

This is written for alarms, which TBH is probably where you really need it, since the regexp engine can get its knickers in a twist and not fire your alarm until the heat death of the universe, but the code will work for other types of signals too.

And yes, I know there are modules on CPAN for this, such as the excellent and very simple Perl::Unsafe::Signals, but sometimes another module isn't an option. I also know the code is a bit flawed in that the second installation of the alarm doesn't do the right thing (it should install at as $timeout - (time - $start_time)), so feel free to fix it yourself.

Monday August 25, 2008
11:23 AM

Dear lazyweb

How do you get your iPhone 3G wallpaper onto the "Home" or "Applications" screen? There's a screenshot of this on the iphonefaq web site, but my "Wallpaper" just seems to apply to the iPhone "lock" page.

Monday June 09, 2008
12:49 PM

Maybe found an email client...

I'm currently testing GyazMail. It's a little slow at pulling the messages from the IMAP server, but apart from that appears to do everything I want, and my desktop is no longer grinding along at snails pace.

Sunday June 08, 2008
09:24 AM

Trying Thunderbird (on Mac) again...

I hate mail clients. Really there's no good one I've found yet.

Yesterday I got sick of Mail.app spinning disk for no good reason whatsoever. Yes OK, so I have an IMAP system with several gigs of mail in it, but pine copes just fine with it. When Mail.app is chugging I can run fs_usage and see that it's just a blur of "Mail" entries.

So first I tried Opera Mail. That's OK-ish, but it's so integrated with the browser that it doesn't obey your default browser setting for links, and had a number of other weaknesses that I couldn't live with (like it didn't like hierarchical folders in IMAP).

Then I thought I'd give Thunderbird another go. I actually use this as my PC mail client when I'm forced to use Windows, so I figured I'd give it a go.

My mail client has to be able to do a few things that I've become used to:

1) Sort threads by most-recent-arrival. This is absolutely critical - why would I want a new mail arriving to be attached to a thread WAY up in my scrolly view? Now ThreadBubble promises some of this, but it requires you sort by Date and not arrival time - which is utterly broken since so many systems produce incorrect dates on mails, that when I enabled it there were a bunch of completely out of order threads at the bottom of my subject pane. Plus it didn't seem to entirely work. For what it's worth, the feature I want is a more than 3 year old bug in Thunderbird, and not even due for 3.0a1.

Oh, and if it could do Mail.app's method of grouping by thread but just showing in arrival order that would be bliss (alpine now offers this).

2) Integration with iCal and calendar invites from my windows-using colleagues.

3) Cope with going offline without nagging. Due to my VPN/Firewall situation at work, things regularly disconnect, so it needs to cope with that without nagging. This is currently a showstopper with me for thunderbird.

4) Good fast search. For some bizarre reason Mail.app's Tiger version removed the "Subject or Sender" search. Now you have to choose which you want. That's simply not efficient. Thunderbird's is nice. But their full text search isn't fast. Integration with Spotlight would be good, but the support for doing that in Thunderbird is buggy, apparently.

5) Nice drag and drop UI - this makes it easier for me to drag missed spam into the right folders (they are categorised into "regular spam", "foreign" and "nigerian", so having to type these folder names every time (a-la pine) is a pain.

6) Support for a mixed proxy environment. I have two accounts, one requires a SOCKS5 proxy (that can go up and down all the time) the other doesn't require a proxy.