Matts's Journal http://use.perl.org/~Matts/journal/ Matts's use Perl Journal en-us use Perl; is Copyright 1998-2006, Chris Nandor. Stories, comments, journals, and other submissions posted on use Perl; are Copyright their respective owners. 2012-01-25T01:59:12+00:00 pudge pudge@perl.org Technology hourly 1 1970-01-01T00:00+00:00 Matts's Journal http://use.perl.org/images/topics/useperl.gif http://use.perl.org/~Matts/journal/ ah, dreams... http://use.perl.org/~Matts/journal/40130?from=rss <p>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.</p><p>Bizarro.</p> Matts 2010-01-26T10:31:17+00:00 journal Time::Piece test failures on Win32 http://use.perl.org/~Matts/journal/40129?from=rss <p>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.</p> Matts 2010-01-25T23:23:53+00:00 journal Warning compiling perl stuff on Snow Leopard http://use.perl.org/~Matts/journal/40075?from=rss <p>I've searched but can't find any reference to this...</p><p>Compiling IO::KQueue on Snow Leopard I get the following warning:</p><blockquote><div><p> <tt>KQueue.xs: In function 'XS_IO__KQueue_kevent':<br>KQueue.xs:71: warning: format not a string literal and no format arguments</tt></p></div> </blockquote><p>Yet that line is just:</p><blockquote><div><p> <tt>&nbsp; &nbsp; Newxz(ke, max_events, struct kevent);</tt></p></div> </blockquote><p>Which seems to me pretty standard perl, and no format strings involved (though Newxz expands quite a few macros).</p> Matts 2010-01-04T22:13:57+00:00 journal Early Komodo Edit review http://use.perl.org/~Matts/journal/39063?from=rss <p>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.</p><p>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<nobr> <wbr></nobr>;-)</p><p>This review is of using it on my MacBook (non-pro) 2.4Ghz, 4GB Ram.</p><p>The Good<br>========</p><p>Generally it has everything I'm looking for:</p><p>- all documents in tabs<br>- 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.<br>- open over scp/sftp.<br>- syntax highlighting seems to just work (haven't found any flaws yet, though Perl can be tricky that way!).<br>- shows line numbers, folds, etc in a nice way<br>- autoindent mostly works well<br>- macros in Javascript/Python make it VERY flexible<br>- "show current file changes" (before you save) is an AWESOME feature, and loads them into the proper "diff" window<br>- 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<br>- macro output looks like it'll be easy enough to write a Prove/Test.pm runner</p><p>The Missing<br>===========</p><p>There are always things missing in editors, usually things I've experienced elsewhere that I'd love to see replicated:</p><p>- I *love* textmate's ability to re-indent code when I paste it in, at the correct current level.<br>- I wish open over sftp would allow me to open a whole directory (i.e. treat it like a temporary project)<br>- I wish I could open a directory instead of have to create a project.<br>- 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<br>- I wish the project pane would highlight the current file/tab instead of the last file I double clicked on<br>- 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).</p><p>The Buggy/Broken Bits<br>=====================</p><p>- There's sometimes an oddness with macros - sometimes I edit them and the edits don't "take" - restarting fixes this.<br>- Can be a TINY bit slow. I'm on a fast mac, so I suspect this would be much worse on my G4 laptop.<br>- 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<br>- Open over sftp seemed a bit fragile and has hung on me once</p><p>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...</p><p>I'll maybe post more on this if I keep using it.</p> Matts 2009-06-02T00:05:35+00:00 journal Perl on LLVM http://use.perl.org/~Matts/journal/38786?from=rss <p>There was recently <a href="http://www.nntp.perl.org/group/perl.perl5.porters/2009/04/msg145425.html">some talk</a> on p5p about getting perl up and running on the <a href="http://llvm.org/">LLVM</a>. This was following the recent excitement from the Python crowd about the <a href="http://arstechnica.com/open-source/news/2009/03/google-launches-project-to-boost-python-performance-by-5x.ars">Unladen Swallow</a> project, and less so, the <a href="http://www.macruby.org/blog/2009/03/28/experimental-branch.html">MacRuby Experimental Branch</a>.</p><p>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.</p><p>It wasn't too hard (a lot of <a href="http://xkcd.com/303/">compiling</a>). After I got everything running I first ran perlbench, which looked reasonably promising:</p><blockquote><div><p> <tt>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;gcc&nbsp; &nbsp; llvm<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;---&nbsp; &nbsp; ----<br>arith/mixed&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 100&nbsp; &nbsp; &nbsp; 86<br>arith/trig&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;100&nbsp; &nbsp; &nbsp; 86<br>array/copy&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;100&nbsp; &nbsp; &nbsp;101<br>array/foreach&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 100&nbsp; &nbsp; &nbsp; 92<br>array/index&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 100&nbsp; &nbsp; &nbsp; 93<br>array/pop&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 100&nbsp; &nbsp; &nbsp; 96<br>array/shift&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 100&nbsp; &nbsp; &nbsp; 95<br>array/sort-num&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;100&nbsp; &nbsp; &nbsp; 89<br>array/sort&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;100&nbsp; &nbsp; &nbsp;101<br>call/0arg&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 100&nbsp; &nbsp; &nbsp;102<br>call/1arg&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 100&nbsp; &nbsp; &nbsp; 89<br>call/2arg&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 100&nbsp; &nbsp; &nbsp; 75<br>call/9arg&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 100&nbsp; &nbsp; &nbsp; 89<br>call/empty&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;100&nbsp; &nbsp; &nbsp; 87<br>call/fib&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;100&nbsp; &nbsp; &nbsp; 90<br>call/method&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 100&nbsp; &nbsp; &nbsp; 98<br>call/wantarray&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;100&nbsp; &nbsp; &nbsp; 89<br>hash/copy&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 100&nbsp; &nbsp; &nbsp; 95<br>hash/each&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 100&nbsp; &nbsp; &nbsp; 94<br>hash/foreach-sort&nbsp; &nbsp; &nbsp; &nbsp; 100&nbsp; &nbsp; &nbsp; 97<br>hash/foreach&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;100&nbsp; &nbsp; &nbsp; 91<br>hash/get&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;100&nbsp; &nbsp; &nbsp; 91<br>hash/set&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;100&nbsp; &nbsp; &nbsp; 89<br>loop/for-c&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;100&nbsp; &nbsp; &nbsp; 86<br>loop/for-range-const&nbsp; &nbsp; &nbsp;100&nbsp; &nbsp; &nbsp;111<br>loop/for-range&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;100&nbsp; &nbsp; &nbsp;116<br>loop/getline&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;100&nbsp; &nbsp; &nbsp; 96<br>loop/while-my&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 100&nbsp; &nbsp; &nbsp; 94<br>loop/while&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;100&nbsp; &nbsp; &nbsp; 96<br>re/const&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;100&nbsp; &nbsp; &nbsp; 86<br>re/w&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;100&nbsp; &nbsp; &nbsp; 89<br>startup/fewmod&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;100&nbsp; &nbsp; &nbsp; 95<br>startup/lotsofsub&nbsp; &nbsp; &nbsp; &nbsp; 100&nbsp; &nbsp; &nbsp; 93<br>startup/noprog&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;100&nbsp; &nbsp; &nbsp;101<br>string/base64&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 100&nbsp; &nbsp; &nbsp; 89<br>string/htmlparser&nbsp; &nbsp; &nbsp; &nbsp; 100&nbsp; &nbsp; &nbsp; 92<br>string/index-const&nbsp; &nbsp; &nbsp; &nbsp;100&nbsp; &nbsp; &nbsp; 81<br>string/index-var&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;100&nbsp; &nbsp; &nbsp;108<br>string/ipol&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 100&nbsp; &nbsp; &nbsp;103<br>string/tr&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 100&nbsp; &nbsp; &nbsp; 86<br> &nbsp; <br>AVERAGE&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 100&nbsp; &nbsp; &nbsp; 93</tt></p></div> </blockquote><p>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).</p><p>Results of the timings:</p><blockquote><div><p> <tt>GCC:<br> &nbsp; <br>real&nbsp; &nbsp; 40m56.599s<br>user&nbsp; &nbsp; 64m44.586s<br>sys&nbsp; &nbsp; 0m59.644s<br> &nbsp; <br>LLVM:<br> &nbsp; <br>real&nbsp; &nbsp; 45m38.831s<br>user&nbsp; &nbsp; 71m14.218s<br>sys&nbsp; &nbsp; 1m20.882s</tt></p></div> </blockquote><p>So rather less promising.</p><p>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.</p> Matts 2009-04-09T17:57:03+00:00 journal Dakar http://use.perl.org/~Matts/journal/38317?from=rss <p>Just want to publicly say congratulations to my brother-in-law Quin for coming <a href="http://www.automobilsport.com/dakar-2009-rally-quin-evans-yorkshire-driver-tollefsen-fourth-overall---39722.html">fourth overall</a> in this year's grueling Dakar rally. An amazing achievement for a non-factory team.</p> Matts 2009-01-19T15:10:00+00:00 journal Perl Unsafe Signals http://use.perl.org/~Matts/journal/37798?from=rss <p>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:</p><blockquote><div><p> <tt>&nbsp; &nbsp; use POSIX qw(SIGALRM);<br>&nbsp; &nbsp; my $timeout = 30;<br>&nbsp; &nbsp; my $sigset = POSIX::SigSet-&gt;new(SIGALRM);<br>&nbsp; &nbsp; my $action = POSIX::SigAction-&gt;new(<br>&nbsp; &nbsp; &nbsp; &nbsp; sub {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # re-install alarm in case we were in an internal eval{} block<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; alarm($timeout);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; die "timeout working on: " . (caller(1))[1] . "\n";<br>&nbsp; &nbsp; &nbsp; &nbsp; },<br>&nbsp; &nbsp; &nbsp; &nbsp; $sigset,<br>&nbsp; &nbsp; &nbsp; &nbsp; &amp;POSIX::SA_NODEFER, # turns off safe signals<br>&nbsp; &nbsp; );<br>&nbsp; &nbsp; POSIX::sigaction(SIGALRM, $action);<br>&nbsp; &nbsp; my $prev_alarm = alarm($timeout);<br> &nbsp; <br>&nbsp; &nbsp; eval {<br>&nbsp; &nbsp; &nbsp; &nbsp; # long running code here<br>&nbsp; &nbsp; };<br>&nbsp; &nbsp; my $err = $@;<br>&nbsp; &nbsp; alarm($prev_alarm);<br>&nbsp; &nbsp; if ($err) {<br>&nbsp; &nbsp; &nbsp; &nbsp; if ($err !~<nobr> <wbr></nobr>/timeout working on:/) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; die $err; # propogate this error<br>&nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; &nbsp; &nbsp; # process the timeout<br>&nbsp; &nbsp; }</tt></p></div> </blockquote><p>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.</p><p>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.</p> Matts 2008-11-03T20:39:10+00:00 journal Dear lazyweb http://use.perl.org/~Matts/journal/37269?from=rss <p>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.</p> Matts 2008-08-25T16:23:58+00:00 journal Maybe found an email client... http://use.perl.org/~Matts/journal/36632?from=rss <p>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.</p> Matts 2008-06-09T17:49:19+00:00 journal Trying Thunderbird (on Mac) again... http://use.perl.org/~Matts/journal/36623?from=rss <p>I hate mail clients. Really there's no good one I've found yet.</p><p>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.</p><p>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).</p><p>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.</p><p>My mail client has to be able to do a few things that I've become used to:</p><p>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 <a href="http://micropipes.com/code/threadbubble/">ThreadBubble</a> 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 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=262319">more than 3 year old bug</a> in Thunderbird, and not even due for 3.0a1.</p><p>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).</p><p>2) Integration with iCal and calendar invites from my windows-using colleagues.</p><p>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.</p><p>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.</p><p>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.</p><p>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.</p> Matts 2008-06-08T14:24:45+00:00 journal I'd do it... http://use.perl.org/~Matts/journal/36447?from=rss <p>If I were asked to speak at google I'd ask for this too:</p><p><div class="quote"><p>I simply ask Google to change a few lines of code, you know, couple of minor alterations, nothing truly significant. That way, he said, anytime anybody in the world Googles, &#8220;photography,&#8221; they get sent to my website.</p></div><p>From: <a href="http://www.joemcnally.com/blog/2008/05/16/google/">http://www.joemcnally.com/blog/2008/05/16/google/</a></p><p>Nothing much. Just a few lines of code. No speaker's fee.<nobr> <wbr></nobr>:-)</p> Matts 2008-05-17T02:59:46+00:00 journal Config file complication http://use.perl.org/~Matts/journal/36318?from=rss <p>Someone asked on IRC today what's a nice simple module to use for config files. Someone suggest YAML. Jeez, talk about not simple. And YAML is actually hard to write by hand. Someone else suggested XML with XML::Simple. Same thing - a large complex module and the config format isn't particularly user editable. No disrespect meant to those who suggested those things - I just think differently...</p><p>All you usually need is INI files. Here's a simple parser I often use:</p><blockquote><div><p> <tt>sub parse_config {<br>&nbsp; &nbsp; my ($self, $file) = @_;<br>&nbsp; &nbsp; open(my $fh, $file) || die "open($file): $!";<br>&nbsp; &nbsp; my @lines = &lt;$fh&gt;;<br>&nbsp; &nbsp; close $fh;<br>&nbsp; &nbsp; chomp(@lines);<br>&nbsp; &nbsp; my $config = $self-&gt;{config} = {};<br>&nbsp; &nbsp; my $section;<br>&nbsp; &nbsp; for (@lines) {<br>&nbsp; &nbsp; &nbsp; &nbsp; s/^\s*//;<br>&nbsp; &nbsp; &nbsp; &nbsp; s/\s*$//;<br>&nbsp; &nbsp; &nbsp; &nbsp; next unless<nobr> <wbr></nobr>/\S/;<br>&nbsp; &nbsp; &nbsp; &nbsp; next if<nobr> <wbr></nobr>/^#/;<br>&nbsp; &nbsp; &nbsp; &nbsp; if (/^ \[ (.*) \] $/x) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $section = $config-&gt;{uc$1} = {};<br>&nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; &nbsp; &nbsp; elsif (/^ (\w+) \s* = \s* (.*) $/x) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; die "key=value pair outside of a section" unless $section;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $section-&gt;{lc$1} = $2;<br>&nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; &nbsp; &nbsp; else {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; die "invalid line in $file: $_";<br>&nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; }<br>}</tt></p></div> </blockquote><p>It's nice and simple, requires no external modules or CPAN downloads, and works pretty well for most situations where simple config files are needed.</p> Matts 2008-05-02T18:59:51+00:00 journal Seed http://use.perl.org/~Matts/journal/36156?from=rss <p>For a test. Please ignore. <a href="mailto:mark@advancedambient.com">mark@advancedambient.com</a>.</p> Matts 2008-04-15T10:05:38+00:00 journal Fun with IMAP http://use.perl.org/~Matts/journal/35839?from=rss <p>So I've been playing with IMAP lately, processing a folder of emails to process. It has been kind of interesting (to say the least).</p><p>Those of you who follow my CPAN uploads know I created Net::IMAP::Simple::NB, which is a subclass of Net::IMAP::Simple but using non-blocking I/O. The idea for that originally was to create a webmail system for AxKit2, but it was also fun learning how IMAP works.</p><p>There are some really interesting corner issues in IMAP that surprise me. For example an IMAP server is expected to be able to parse MIME messages, and be able to provide different components of the body as requested. This seems odd to me as frankly this should be a client task - surely this slows IMAP servers down? Also when you ask for the body structure it maps it in a very odd manner - though perhaps its useful for clients - there seems to be a lot of structure data there that isn't useful. There are some other odd choices too, like dates are provided as "DD-MON-YYYY" rather than the more ISO compliant "YYYY-MM-DD" format, and email addresses are provided pre-parsed, which means if your IMAP server gets it wrong you're screwed (though I guess that isn't too common).</p><p>On the other hand there are some nice things too, like IMAP provides most of its data in an S-expressions-like format, which is quite easy to parse in perl. The RFC is also not as horrible as I had once thought, so decoding various things is reasonably easy. On the other hand, it seems Net::IMAP::Simple is a bit too simplistic, in that it doesn't parse the output formats properly, and honestly doesn't have enough methods in it (I've added 8 methods just for my one simple app).</p><p>I'll have to consider contacting the author about patches. Though I'm unsure right now if I want to have too much to do with it in the long term.</p> Matts 2008-03-05T03:44:15+00:00 journal Time::Piece 0.13 released http://use.perl.org/~Matts/journal/35819?from=rss <p>Some of you may know that Time::Piece became part of perl 5.10. Anyone one of the things discovered was that I accidentally dropped a BSD copyright off one of the XS functions. This is now added back in. I also added an add_months() and add_years() set of functions, to make date arithmetic a bit easier.</p><p>This was interesting seeing what happens with the edge-case dates. It seems that when you do 31st March + 1 month you end up with 1st May. This mirrors what other date libraries appear to do. I documented the gotcha.</p><p>Enjoy.</p> Matts 2008-03-02T20:24:10+00:00 journal Winter Creek http://use.perl.org/~Matts/journal/35573?from=rss <p> <a href="http://home.sergeant.org/D70/2008/02_Feb/03_Feb/DSC_8639_bw.jpg?format=raw;size=1024">Image</a></p><p> &nbsp; &nbsp; &nbsp; &nbsp; A small creek frozen over that I found on the drive home yesterday. The<br> &nbsp; &nbsp; &nbsp; &nbsp; utter silence while taking this photograph was perfect, broken by the<br> &nbsp; &nbsp; &nbsp; &nbsp; distant screech of an owl.</p><p><a href="http://blog.sergeant.org/view/2008-2-4_Winter_Creek">Original here</a></p> Matts 2008-02-04T14:50:17+00:00 journal Brrrrrr http://use.perl.org/~Matts/journal/35441?from=rss <p> <a href="http://home.sergeant.org/D70/2008/01_Jan/20_Jan/DSC_8472_bw.jpg?format=raw;size=800">Image</a></p><p> &nbsp; &nbsp; &nbsp; &nbsp; It's deathly cold out there, but I decided yesterday to wrap up warm<br> &nbsp; &nbsp; &nbsp; &nbsp; and get my ass out there to do some photography. It was worth it for<br> &nbsp; &nbsp; &nbsp; &nbsp; the results, but I sure couldn't hang around long.</p><p><a href="http://blog.sergeant.org/view/2008-1-21_Brrrrrr">Original here</a></p> Matts 2008-01-21T14:05:56+00:00 journal On feeling out of touch http://use.perl.org/~Matts/journal/35291?from=rss <p>I haven't done much web development now for 7 years. I did a large-ish project at work using AxKit (probably one of the highest traffic mod_perl applications in existance, doing about 200 million transactions/day) about 4 or 5 years ago, but I don't really count that as it didn't expand my knowledge of web technology in any way.</p><p>I keep reading about new web "stuff" - Rails, Django, Seaside, etc. None of it really interests me all that much because frankly the core of the web doesn't appear to have changed a whole lot to me - you do a request and you serve a response. But maybe I'm missing something.</p><p>Email stuff of course still interests me because it's my day job. What's fascinating about my day job is that it's entirely built around people breaking the system and doing "weird" things, and me having to fix stuff. The most recent example was spammers sending QP encoded emails with high bit characters. That broke my QP decoding routines, but it also is a 100% spam indicator.</p><p>So is what is actually new and interesting that I should be looking into right now to keep my skills honed? When the web was dying (i.e. around 2000) it was XML, and learning and working with that served me well. What is interesting now?</p> Matts 2008-01-05T02:52:58+00:00 journal Terrorists win? http://use.perl.org/~Matts/journal/35290?from=rss <p>So tomorrow was supposed to be the start of the <a href="http://www.dakar.com/">Dakar Rally</a>. My brother-in-law Quin Evans was supposed to be co-driving in the race with his friend <a href="http://www.nissan.co.za/inside_news.asp?s=1">Ivar Tollefsen</a>. A years preparation goes into the race.</p><p>Now the rally is <a href="http://www.debka.com/headline.php?hid=4908">cancelled</a> because Al-Qaeda were supposedly targetting the rally. I hate that. Giving in to terrorists is just the worst thing. But losing a brother in law would have been worse.</p> Matts 2008-01-05T00:28:54+00:00 journal Rails has peaked http://use.perl.org/~Matts/journal/35288?from=rss <p>I found <a href="http://bitworking.org/news/282/Tim-Bray-on-Ruby-on-Rails">this blog post</a> rather interesting. Though take it with a grain of salt obviously.</p> Matts 2008-01-04T17:49:05+00:00 journal Joke http://use.perl.org/~Matts/journal/35028?from=rss <p>What goes: Bump bump bump bump bump splash</p><p>Answer: Me falling down the basement stairs with 2 drinks in my hand.</p><p>Mother %^&amp;#$%@! did that ever hurt.</p> Matts 2007-12-02T14:41:09+00:00 journal Sand Grass http://use.perl.org/~Matts/journal/34964?from=rss <p> <a href="http://home.sergeant.org/D70/2007/10_Oct/30_Oct/DSC_7446_bw.jpg?format=raw;size=800">Image</a></p><p> &nbsp; &nbsp; &nbsp; &nbsp; Not much to say about this - shot at the same time as the previous pic.</p><p><a href="http://blog.sergeant.org/view/2007-11-24_Sand_Grass">Original here</a></p> Matts 2007-11-24T00:00:26+00:00 journal The Beach http://use.perl.org/~Matts/journal/34933?from=rss <p> <a href="http://home.sergeant.org/D70/2007/10_Oct/30_Oct/DSC_7441_bw.jpg?format=raw;size=800">Image</a></p><p> &nbsp; &nbsp; &nbsp; &nbsp; Shot at the beach in Kincardine, Ontario. This is mostly as-shot thanks<br> &nbsp; &nbsp; &nbsp; &nbsp; to my new Cokin filters (polarizer, ND-Grad, and ND filters used here).</p><p><a href="http://blog.sergeant.org/view/2007-11-19_The_Beach">Original here</a></p> Matts 2007-11-19T18:52:55+00:00 journal Cwd failing? http://use.perl.org/~Matts/journal/34492?from=rss <p>Has anyone seen cwd() failing on an extremely high load server? I don't really understand why it fails (only happens under extreme load), and wondered if anyone had any insight.</p> Matts 2007-09-20T15:42:48+00:00 journal DBD::SQLite 1.14 http://use.perl.org/~Matts/journal/34487?from=rss <p>After a long hiatus I've finally done a bit of hacking on DBD::SQLite. It's updated to the latest core sqlite, and applied a bunch of important patches from RT. I also added in the FTS code (edit: FTS is Full Text Search) - though I haven't tested that so if someone else can do that'd be awesome (if you can supply me with a working<nobr> <wbr></nobr>.t file for adding to the distro that'd be doubly awesome).</p><p>Enjoy.</p> Matts 2007-09-19T19:30:29+00:00 journal I made the front page of Slashdot... http://use.perl.org/~Matts/journal/34373?from=rss <p><a href="http://it.slashdot.org/article.pl?sid=07/09/07/122200">http://it.slashdot.org/article.pl?sid=07/09/07/122200</a></p><p>Cool.</p> Matts 2007-09-07T18:07:48+00:00 journal I sometimes wonder what I've contributed... http://use.perl.org/~Matts/journal/34164?from=rss <p>Being an open source geek is an interesting position to be in. You can hack on bizarre stuff that barely anyone uses (like <a href="http://search.cpan.org/~msergeant/Net-IMAP-Simple-NB-1.1/">Net::IMAP::Simple::NB</a>) or you can hack on stuff that people use but you rarely hear about (like <a href="http://search.cpan.org/~msergeant/CDB_File-0.95/">CDB_File</a>, which I didn't create but at least I maintain it).</p><p>But then there's the "other" stuff. The things you randomly hear about people installing as "essential" tools, like <a href="http://search.cpan.org/~msergeant/XML-XPath-1.13/">XML::XPath</a>, or more commonly lately <a href="http://search.cpan.org/~msergeant/DBD-SQLite-1.13/">DBD::SQLite</a>.</p><p>What's odd about DBD::SQLite is that it has now become a staple of so many tiny little applications (most recently I read about some hack of reddit that someone had done) that if it suddenly went away it would be like perl going away. And that both gives me a wonderful sense of joy (for helping those people) and a terrible sense of dread (because what if I got it wrong somehow?). Such is the way of free software I guess...</p> Matts 2007-08-21T02:20:58+00:00 journal I do plumbing http://use.perl.org/~Matts/journal/33885?from=rss <p>I feel like I really accomplished something today. I actually re-implemented some of the core features of SpamAssassin and made it about 8 times faster. BUT that's not what I'm proud of.</p><p>I plumbed.</p><p>I managed to accidentally wrench off a tap in my garage a couple of weeks ago, and so I had to re-plumb it back on. But being right up against a drywall it was a bit more complex - a case of cut the pipe, clean the pipe, put on new tap, solder it on, solder on half a joint on the other end, and finally solder the two pieces of pipe back together at the joint end.</p><p>Yes it leaked first time. But I realised my screw up - I had soldered it back together with the tap closed, so the air/steam pressure build-up blew the solder out of the join. It doesn't tell you not to do that in any of the instructions, but at least I felt like I learned something. And with plumbing, you learn FAST or you get wet.</p><p>So now I can add "basic plumbing" to my resum&#233;. Sweet.</p> Matts 2007-07-26T02:39:02+00:00 journal ANNOUNCE: DVD Spanner 1.0 http://use.perl.org/~Matts/journal/33824?from=rss <p><a href="http://photography.sergeant.org/dvdspanner/DVDSpanner.dmg">Download Here</a></p><p>Changes in this release:</p><p>* DVD Spanner now stores a searchable library of all archived files so that you can always find your files<br>* Minor cosmetic improvements<br>* Some bug fixes to how the display is updated</p> Matts 2007-07-17T00:45:44+00:00 journal DVD Spanner 1.0 beta http://use.perl.org/~Matts/journal/33804?from=rss <p><a href="http://www.sergeant.org/DVDSpanner-beta.dmg">Download here.</a></p><p>Adds a basic "library" feature which keeps track of all files you've burned. Useful to be able to find files that you've burned previously.</p> Matts 2007-07-14T18:16:12+00:00 journal