jmcnamara's Journal jmcnamara'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-25T02:05:26+00:00 pudge Technology hourly 1 1970-01-01T00:00+00:00 jmcnamara's Journal Toggle between if/endif in Vim with % Dera Lazyweb, <p> In vi/vim is it possible to match if/endif in a non-standard language so you can toggle between them using %? I know that this feature is usually reserved for parentheses and braces but this particular language doesn't use them. </p><p> I can see, from reading around, that you can set regions via ":syntax region" but I'm not sure if that applies to this case. </p><p> I am not a vi user. I'm asking mainly for a colleague. </p><p> John.<br> --</p> jmcnamara 2009-09-04T11:15:58+00:00 journal Pod to Textile for Wikis on Github As a mentioned <a href="">recently</a> I added Pod to Textile support to Pod::Simple::Wiki. It is now up on <a href="">CPAN</a>. <p> This lets you to convert a Pod document to Textile markup as follows:</p><blockquote><div><p> <tt>pod2wiki --style=textile &gt;</tt></p></div> </blockquote><p>Which makes it easy to add a github wiki page like <a href="">this</a>. </p><p> John.<br> --</p> jmcnamara 2009-08-29T22:15:40+00:00 journal Installing Snow Leopard <p> I installed Snow Leopard and everything went okay. As usual the first thing that I do on an OS is to check the perl version:</p><blockquote><div><p> <tt>$ perl -v<br> <br>This is perl, v5.10.0 built for darwin-thread-multi-2level</tt></p></div> </blockquote><p>Good start. </p><p> A few things that didn't work straight away were Apache (dav_svn_module was the culprit, probably the wrong version), make (I needed to install the developer tools separately) and Adblock in Safari (only works in the 32 version). </p><p> Apart from that everything looks good. </p><p> John.<br> --</p> jmcnamara 2009-08-29T08:58:35+00:00 journal Spreadsheet::ParseExcel on github <p> I've moved Spreadsheet::ParseExcel to github: <a href=""></a> </p><p> It had previously been on Google Code but I didn't find it conducive to collaboration. Hopefully github will be better. I already like the clean look and feel. </p><p> One of the default options on github is to have a wiki page which I thought would be useful for the Pod documentation if it were converted to the Textile format. Then I thought "I have a module for that", <a href="">Pod::Simple::Wiki</a>. </p><p> So I imported Pod::Simple::Wiki to github, cloned it, followed <a href=""> my own instructions</a>, and within a hour I had a <a href="">pod2wiki</a> Textile converter (with tests). </p><p> Here are example pages for <a href="">Spreadsheet::ParseExcel</a> and <a href="">Pod::Simple::Wiki</a> itself. I'll upload it to CPAN once I make a few more changes to the docs and to link handling. </p><p> John.<br> --</p> jmcnamara 2009-08-28T11:07:41+00:00 journal Data::Dumper + Perltidy I use Data::Dumper a lot when debugging applications that return complex data structures. However I'm not always happy with the pretty printing that Data::Dumper provides and I often find myself copying he structure into Emacs and running perltidy against it. <p> As such I thought that it would be nice to have a Data::Dumper::Perltidy module that would do both steps in one go. I didn't find such a module on CPAN so I wrote <a href="">one</a>. </p><p> John.<br> --</p> jmcnamara 2009-01-30T10:37:22+00:00 journal Perl and the Art of Motorcycle Navigation <p> A lot of people use <a href="">Spreadsheet::WriteExcel</a> I think. At least I get a lot of emails related to it. At the same time I don't generally get an insight into what people use the module for. There are some obvious tasks that I can imagine such as invoices or inventories or balance sheets and the email addresses of the correspondents suggest a heavy usage among financial companies. The occasional example Excel file that I receive isn't usually very exciting, not least of all when viewed in a hex editor. As such Spreadsheet::WriteExcel is used for the mundane reporting we all have to do occasionally. (Apart from me that is. In the eight years with my current company I've only used Spreadsheet::WriteExcel once and that was in the last six months. So much for eating your own dogfood). </p><p> That's why I was blown away when Rick Lavigne contacted me to say he was using Spreadsheet::WriteExcel to produce Tulip Diagram roll charts for motorcycle navigation. If you don't know what that is, and I certainly didn't, have a look at Rick's website <a href=""></a> where it is all explained in detail. In particular the quality of the <a href="">finished worksheets</a> really impressed me. </p><p> In fact it impressed me so much that I felt obliged to help Rick out. He had written to ask if a document properties feature was planned. It was on the TODO list but with a low priority so I moved it up the list and <a href="">implemented it</a>. There probably aren't many advantages to running your own Open Source project but at least you can set your own priorities. </p><p> John.<br> --</p> jmcnamara 2009-01-21T00:25:02+00:00 journal Roadmap for Spreadsheet::ParseExcel <p> I've added a <a href="">Roadmap for Spreadsheet::ParseExcel</a> on the Spreadsheet::ParseExcel Google Group. </p><p> John.<br> --</p> jmcnamara 2008-10-31T07:00:23+00:00 journal Taking over maintenance of Spreadsheet::ParseExcel <p>I've taken over the maintenance of Spreadsheet::ParseExcel from G&#225;bor Szab&#243;.</p><p>I didn't want to because I barely get enough time to maintain/extend Spreadsheet::WriteExcel. However, G&#225;bor is very busy with other projects and ParseExcel needs to be kept ticking over since it is so widely used and ultimately I'm probably the best person to deal with the Excel internals that are at the heart of the module.</p><p>Initially I plan to clean up the documentation, add more working examples and deal with the more egregious bugs. I may try to clean up and document the internals as well so that someone else can take over maintenance and so that patches are more consistent. It will also give me a chance to get ParseExcel and WriteExcel working better together.</p><p>Anyway, I've set up a Google Group for discussions relating to the module:</p><p> &nbsp; &nbsp; &nbsp; &nbsp;</p><p>Feel free to join, post, chat if you are interested.</p><p>John.<br>--</p> jmcnamara 2008-10-27T19:20:02+00:00 journal Somebody bet on the bay Yesterday I swam the <a href=";ie=UTF8&amp;t=h&amp;msa=0&amp;msid=103034189951300099202.000454bd7384e79763fec&amp;ll=52.68887,-9.652519&amp;spn=0.035534,0.077248&amp;z=14">Kilkee Bay Swim</a>. <p> It is about 1300m and I did it in about 45 minutes. It was the first time I'd swam it and I'd hoped to do it under 40 miunutes but I went a bit off course. Swimming in the open(ish) sea isn't quite like doing the same distance in a pool.<nobr> <wbr></nobr>:-) </p><p> The overall winner gets the The Richard Harris Memorial Trophy in memory of the <a href="">actor</a> who initiated the competition in his youth. </p><p> John.<br> --</p> jmcnamara 2008-08-18T18:29:12+00:00 journal Microsoft Takes Additional Steps Back in February Microsoft released the <a href="">Microsoft Office Binary File Formats</a> with much fanfare. <p> In the case of the Excel file format, which I am <a href="">interested in</a>, the February specs offered little information over what was already in the public domain (for loose definitions of public). </p><p> Then less than a month ago, to much less or perhaps no fanfare, Microsoft released a second round of file format specifications, the June specs: "<a href="">Microsoft Takes Additional Steps in Implementing Interoperability Principles</a>". Surprisingly these were much more detailed. The newer Excel specification, for example, is 1100 pages as compared to 350 pages in the previous one although the information is much more complete than a mere page count indicates. It is also cross-linked within itself and with supporting documents and all in all it feels more like a real specification than the February doc. </p><p> Which is great. As Joel Spolsky <a href="">pointed out</a>, in relation to the first round of docs, having a spec doesn't mean that it is easy to deal with these particular file formats. However, having such a detailed document certainly helps. </p><p> Which leads to the question, why didn't Microsoft release the detailed specs in the first place. </p><p> Anyway, since this is a Perl blog I should add by way of technical content that although Perl is often seen as a good text processing language it is also very flexible at processing binary data thanks to the pack()/unpack() functions. And binary data processing in Perl is much more portable than C solutions which suffer from more loosely defined data sizes and differently padded structs. </p><p> John.<br> --</p> jmcnamara 2008-07-28T22:38:13+00:00 journal Muxtape <p> I make a <a href="">Muxtape</a>. </p><p> I'd like to make others mixes to express different themes but you can't currently do that without setting up another account. So I'll leave it like that for now and redo it some other time. </p><p> John.<br> --</p> jmcnamara 2008-07-22T21:01:56+00:00 journal Joel Spolsky on the Microsoft Office file formats Specs <p> Joel Spolsky has an article up call <a href="">Why are the Microsoft Office file formats so complicated? (And some workarounds)</a>. </p><blockquote><div><p>"Last week, Microsoft published the binary file formats for Office. These formats appear to be almost completely insane. The Excel 97-2003 file format is a 349 page PDF file.<nobr> <wbr></nobr>... <br> <br> If you started reading these documents with the hope of spending a weekend writing some spiffy code that imports Word documents into your blog system, or creates Excel-formatted spreadsheets with your personal finance data, the complexity and length of the spec probably cured you of that desire pretty darn quickly".</p></div> </blockquote><p> Indeed. </p><p> Also worth reading in his recent journal is <a href="">TripIt is Awesome</a>. TripIt is in fact awesome. Possibly teh. </p><p> John.<br> --</p> jmcnamara 2008-02-20T09:45:17+00:00 journal Grant McLennan RIP <p> <i> "On Saturday 6th May 2006, legendary Australian singer-songwriter and member of The Go-Betweens Grant McLennan died in his sleep at his home in Brisbane". </i> </p><p> The Go-Betweens were my favourite band and I was very sad to hear that <a href="">Grant McLennan</a>, one half of the singer-songwriter team, had passed away. </p><p> I acknowledged Grant in the dedication of my masters thesis and I quoted him in an early version of Spreadsheet::WriteExcel and in the <a href="">current version</a> of Spreadsheet::WriteExcelXML. </p><p> Over 10 years ago on one of my first webpages I wrote: "If Lou Reed had been two people, had grown up in Australia and had been able to write a better love-song, he would have been the Go-Betweens". </p><p> Bye-bye Grant. </p> jmcnamara 2006-05-09T02:07:55+00:00 journal Perlmonks' 500,000th node <p> The <a href="">500,000th</a> node was posted on <a href="">Perlmonks</a> yesterday. </p><p> By way of comparison comp.lang.perl.misc has had approximately 550,000 posts since May 1995 based on the data <a href="">here</a>. </p><p> Using the same data I created some charts that show the <a href="">number of monthly posts on clpm and Perlmonks</a> and the <a href="">total number of posts</a>. </p><p> These results aren't exact. For instance only about 90% of the nodes on Perlmonks are actual questions or answers.The rest are administration or home nodes. Also I don't know if the figures reported by Google Groups for clpm are accurate. </p><p> Nevertheless, the data is interesting. It shows that clpm's peak was in July 1999 (about the time that I started hanging out there but I doubt that has anything to do with its decline). It also shows that currently Perlmonks is getting about 8,500 posts a month in comparison to 2,500 on clpm. </p> jmcnamara 2005-10-15T01:13:51+00:00 journal 4000 Year Old Noodles <p> <a href="">4,000 Year Old Noodles Found in China</a>. They might go well with some <a href="">thousand year old eggs</a>. </p><p> Either way, I guess this proves that Macro Polo didn't bring pasta to China. </p> jmcnamara 2005-10-14T14:20:34+00:00 journal Rainy Seasoning I'm back from my two week trip to <a href="">Guatemala</a>. I was mostly working but I did get to see <a href="">Antigua Guatemala</a>. Unfortunately, I didn't have time to travel to <a href="">Tikal</a>. <p> It was rainy season there so some of the more spectacular views of nearby volcanoes were obscured. The rainy season lasts from May to October, which while long, is shorter than Ireland's January to December. </p><p> The preferred means of security in Guatemala City seemed to be to have someone with a pump action shotgun stand outside your premises. </p><p> In transit at Houston I met Larry Wall and his wife. Time for that <a href="">picture</a> again. </p><p> Downtown Houston is eerily quiet on a Sunday morning.</p> jmcnamara 2005-08-29T15:39:42+00:00 journal So. Central America <p> I go to Guatemala. For work. For two weeks. </p> jmcnamara 2005-08-12T10:34:25+00:00 journal Bingo 21 After many years of peregrination we have bought and moved into a house in <a href="">Ballyneety</a>. <p> It is new and spacious and ours.</p> jmcnamara 2005-07-15T01:01:43+00:00 journal Mini Me I ordered a Mac Mini which arrived today. <p> The last Macintosh I bought was about twelve years ago. I don't remember the model but it had a 40Mb hard drive (which will give you an idea of the era). I bought it for my (not then) wife to write her PhD thesis. </p><p> I've wanted to get my hands on OSX for a while so that I could respond to bugs from Apple users and also just to play around with. </p><p> So, let's see what all the fuss is about. </p><p> John.<br> --</p> jmcnamara 2005-05-24T01:07:30+00:00 journal Pod2wiki A trickle of people have started to use <a href="">Pod::Simple::Wiki</a>. <p> <a href="">Sam Tregar</a> sent a patch for TWiki and <a href="">Tony Sidaway</a> sent one for Wikipedia (<a href="">example</a>). </p><p> One of the strange(r) things about parsing Pod (even with the help of Pod::Simple) is the bizarre little ecosystem that can exist in <tt>=over, =back</tt> regions. See the relevant section of <a href="">perlpodspec</a> for the gory details. The <i>plain</i> part of that part of Pod could be plainer. </p><p> Maybe Perl6 or Kwid will fix this.</p> jmcnamara 2005-04-01T23:31:03+00:00 journal make what I mean I was aware that <tt>make</tt> has implicit rules and that if you have a simple C program without a makefile, you can still do the following:<blockquote><div><p> <tt>$ make hello<br>cc&nbsp; &nbsp; &nbsp;hello.c&nbsp; &nbsp;-o hello</tt></p></div> </blockquote><p>And you end up with an executable. </p><p> However, I was surprised when I tried the following for a yacc grammar (again there is no makefile):</p><blockquote><div><p> <tt>$ make foo<br>yacc&nbsp; foo.y<br>mv -f foo.c<br>cc&nbsp; &nbsp; &nbsp;foo.c&nbsp; &nbsp;-o foo</tt></p></div> </blockquote><p>Handy. </p><p> Also, in relation to Yacc, here is a footnote from the O'Reilly <a href="">Lex &amp; Yacc</a> book:</p><blockquote><div><p>Yacc's use of dot to show where you are in the rule can get confusing if you have rules with dots in them. Some versions of yacc use an underscore rather than a dot, which can be equally confusing if you have rules with underscores in them.</p></div> </blockquote><p> I have a feeling that you could keep going on like this.</p> jmcnamara 2005-02-23T11:27:51+00:00 journal Doogle (for Father Ted fans) <a href="">Doogle</a>, the feckin' search engine of Ireland. jmcnamara 2005-02-15T08:59:30+00:00 journal Uncrossing the Rubicon <p>To be updated.</p> jmcnamara 2005-01-04T01:13:32+00:00 journal Shareef does like it. Rock al Cashbah. I heard <a href="">this</a> today on my cockpit radio blare. <p> Rachid Taha. You know it's not kosher.</p> jmcnamara 2004-11-22T23:53:55+00:00 journal Dinner with Larry Well not quite with Larry. He was at the next table with his family. <p> I dined with Dave Cross, Casey West and some of the Italian Perl mongers. But we chatted afterwards and I even got a <a href="">photo</a>. </p><p> This was after the <a href="">Italian Code Jam</a>. It was a great day. I really enjoyed Larry's talk which (I think) was entitled "What I have learned in my 50 years" although it had at least 10 other titles as well (including The Perl of Perl). It went on a windy path through ballistics, computer science, Perl culture and Lord of the Rings (eagles were Tolkien's exception handlers) to a destination of Perl 6. </p><p> I have been luke warm on Perl 6 up to now but the new syntax and functionality look great. </p><p> Needless to say he was asked the million LOC question; When will Perl 6 be out. Larry's answer paraphrased: alpha code next summer hopefully. </p> jmcnamara 2004-10-10T23:11:28+00:00 journal Perl and Excel I've uploaded the slides for the <a href="">Perl and Excel</a> talk that I did at <a href="">YAPC::Eu</a>. <p> There was a little time before the talk so as a diversion I asked people to run the following one-liner from the first slide:</p><blockquote><div><p> <tt>perl -MCPAN -e 'install jmcnamara &amp; _ x ord $<nobr> <wbr></nobr>;' | tail -1</tt></p></div> </blockquote><p>Try it! You'll need to have configured and it will probably take a little while the first time it runs. The explanation is <a href="">here</a>.</p> jmcnamara 2004-09-21T22:37:09+00:00 journal YAPC::Eu I'm at <a href="">YAPC::Eu</a>. And I'll be talking in a little while. <p> If you are here and you read this, say hello.</p> jmcnamara 2004-09-15T13:25:18+00:00 journal Abhaile I am going back to Ireland for 10 days. In amongst that time I'm going up to Belfact for <a href="">YAPC::Eu</a>. I'm even doing a <a href="">talk</a> this time. <p> If you are there I'll see you in the bar.</p> jmcnamara 2004-09-09T12:34:28+00:00 journal Bellinis White peaches are in season here in Italy. Which means that it is <a href="">Bellini</a> time! <p> Che bellino. </p> jmcnamara 2004-08-24T22:51:23+00:00 journal Charts in Spreadsheet::WriteExcel A first look at charting with Spreadsheet::WriteExcel.<blockquote><div><p> <tt>#!/usr/bin/perl -w<br> <br>use strict;<br>use Spreadsheet::WriteExcel;<br> <br>my $workbook&nbsp; = Spreadsheet::WriteExcel-&gt;new("demo02.xls");<br>my $worksheet = $workbook-&gt;add_worksheet();<br>my $chart&nbsp; &nbsp; &nbsp;= $workbook-&gt;add_chart_ext('chart200.bin', 'Chart1');<br> <br>$chart-&gt;activate();<br> <br>$worksheet-&gt;store_formula('=Sheet1!A1');<br>$ worksheet-&gt;set_column('A:A', 20);<br> <br>$workbook-&gt;add_format(color =&gt; 1);<br>$workbook-&gt;add_format(color =&gt; 2, bold =&gt; 1);<br>$workbook-&gt;add_format(color =&gt; 3);<br> <br>my @data = (<br> <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ['',&nbsp; &nbsp;275],<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ['',&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;99],<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ['',&nbsp; &nbsp; &nbsp; &nbsp; 269],<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ['',&nbsp; &nbsp; &nbsp; &nbsp;724],<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ['',&nbsp; &nbsp; &nbsp;1410],<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ['',&nbsp; &nbsp; 447],<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ['',&nbsp; &nbsp; &nbsp; 884],<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ['',&nbsp; &nbsp; 1925],<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ['',&nbsp; 112],<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ['',&nbsp; &nbsp;3945],<br>&nbsp; &nbsp; &nbsp; &nbsp; );<br> <br>$worksheet-&gt;write_col('A1', \@data);<br> <br>__END__</tt></p></div> </blockquote><p> And the <a href="">result</a>. Hurrah! </p><p> The chart was produced in Excel with some spurious data, extracted from Excel and then added to a Spreadsheet::WriteExcel file with new input data. </p><p> For now this is hackery and a little fragile but it is promising and surprising satisfying.</p> jmcnamara 2004-08-20T23:01:19+00:00 journal