johanvdb's Journal johanvdb'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:23:58+00:00 pudge Technology hourly 1 1970-01-01T00:00+00:00 johanvdb's Journal Perl and robots ... <p>At last I could force myself to get that old 486 from the attic - my first gateway - to serve a new purpose<nobr> <wbr></nobr>...</p><p>If all goes fine, I'll be setting up a PXE environment (via a netboot disk, as the BIOS is too old and the network card is ISA) next week, so i can comfortably boot a new kernel onto the box.</p><p>My intent is to get RTAI (RealTime linux) working on the box and see if I can do something with the Perl bindings for LXRT. My goal is to control a hobby servo with a signal generated from Perl<nobr> <wbr></nobr>...</p><p>I'm not sure if this is possible, or even desirable, but i want to get my feet wet on RT linux!</p><p>On the hardware spectrum of things, I've updated my site about robots to include my latest contraption. Killerbee is the name of a nano sumo robot I build, which normally would compete at <a href="">robolympics</a> if it was finished in time. Deadline to finish it would have been last monday as it needed to be shipped from Belgium to the US also<nobr> <wbr></nobr>... a pitty i did not make it in time. Anyhow, here's the Killerbee site:<br><a href=""></a></p><p>johan</p> johanvdb 2004-03-20T01:03:01+00:00 journal Mobile blogging from a Palm ... <p>At last<nobr> <wbr></nobr>... I've put my mobile blogging app, mo:Blog, to the test on <a href=";prodID=55746">Palmgear<nobr> <wbr></nobr></a>...</p><p>This is a major deviation from Perl software development, but if I knew the use.perl API, I would surely put it in there<nobr> <wbr></nobr>... so i can feel good about having some linkage to Perl<nobr> <wbr></nobr>;-)</p><p>Johan</p> johanvdb 2004-03-09T12:18:45+00:00 journal Komodo, vs. KDevelop, vs. Eclipse ... <p>I wonder which IDE is the best to develop Perl projects<nobr> <wbr></nobr>...</p><p>I've been working with eclipse lately, spitting out some java code, and I have to say I'm pretty amazed. It has these wonderfull search mechanisms, it can provide you automatically with the 'import' statements, integrated debugger, unit tests<nobr> <wbr></nobr>... and it is free. Now, I just found out about the existence of <a href="">e.p.i.c</a> (Perl support for eclipse)</p><p>On the other hand, KDevelop seems to support Perl as well, but I do not know how far this goes.</p><p>I also know about the existence of Komodo, and which seems to sport a whole bunch of features<nobr> <wbr></nobr>...<br>but that is commercially available and a bit above my budget.</p><p>My Perl development setup is just vim, occasionally spiced up with 'perl -d', on a 80 char wide console. A bit archaic, but it serves me well.</p><p>However, i noticed that I have to walk alot through code finding class names, methods when a project gets rather big. If I could have a java/eclipse like behavior for Perl<nobr> <wbr></nobr>... that would be an interesting feat<nobr> <wbr></nobr>...</p><p>I'm off testing epic now<nobr> <wbr></nobr>...</p><p>So, anybody here who has found the panacea of Perl IDEs?</p><p>Johan</p> johanvdb 2004-03-04T13:09:27+00:00 journal Give up e-mail address ... <p>I think I need to give up my main email address after 6 years. Why? SPAM! I get 400+ spam messages a day, and thanks to spamassassin I can manage that quite well<nobr> <wbr></nobr>...</p><p>But now, spam has entered a new phase<nobr> <wbr></nobr>... I get a lot of bounced and rejected mail from mail that got sent with my email address. These mails seem to contain virusses and who knows what else<nobr> <wbr></nobr>...</p><p>This all started one week ago<nobr> <wbr></nobr>... maybe I'll let the storm pass by, but I think it is better to bounce all spam mail for a short period, including the bounced ones<nobr> <wbr></nobr>...</p><p>If this does not help, I'll need to shut down my old email address<nobr> <wbr></nobr>...</p><p>Does this phenomenon sounds familiar to anybody? I wonder if I would shut it down for a month, that I would get back to the old - 5 messages a day - state<nobr> <wbr></nobr>...</p><p>johan</p> johanvdb 2004-03-02T21:41:40+00:00 journal Multithreading maddness .... <p>Oooh boy<nobr> <wbr></nobr>... I've been working on a SMS gateway some time now - which I intend to open up to the public in early february - but I bounce against a wall for the moment.</p><p>The problem<nobr> <wbr></nobr>... concurrent access to a database (sqlite). I looked into the DBD::SQLite code and it does implement the CLONE method. I wonder<nobr> <wbr></nobr>... what else can I do to get this DB multithreaded?</p><p>For the moment I have 3 types of threads. An incoming SMS handler, some request handling threads and an embedded webserver thread for the web based UI. All three use the DBD::SQLite via Class::DBI to store application data. All went fine until I added a table to communicate status from the components to the UI. My first implementation did not use a DB for this, but classes could subscribe themselves to a singleton status object and the UI thread could query the singleton, which would delegate the status method to all registered objects<nobr> <wbr></nobr>... but<nobr> <wbr></nobr>... that does not work, as 'complex' variables can not be shared in Perl threads. So I reverted to a database in which objects 'put' status information in a timely fashion<nobr> <wbr></nobr>... not as clean as the subscribe/query principle, but at least it should work.</p><p>Well<nobr> <wbr></nobr>... my plan is to look into DBD::SQLite and try to get it multi threaded<nobr> <wbr></nobr>...</p><p>And<nobr> <wbr></nobr>... in the end<nobr> <wbr></nobr>... I wonder if Perl is fit to develop this type of applications in, with this type of application architecture (multi threaded). I deem it too javaesque<nobr> <wbr></nobr>... I better could have used POE or use forking. I'm not sure if it will fit POE, but it surely will fit a forking strategy and it should not take too much time to do so<nobr> <wbr></nobr>...</p><p>Johan</p> johanvdb 2004-01-26T11:13:43+00:00 journal Perl herds electric sheep An article at O'Reilly talks about an upcoming presentation about a collaborative effort to breed <a href="">electric sheep</a>.<p> These electric sheep are bred using a screen-saver like application, just like SETI@home.</p><p> The electric sheep are fractal like images, but they do actually evolve from a rudimentary form of DNA. </p><p> So far, so good, but the real fun thing is that the server code is written in Perl! </p><p> On the <a href=";menu=code">electric sheep site</a>, we can read the next comment: <br> <code> "The server version 2.3 source code tarball contains 3900 lines of multi-threaded perl. The flame library, the expat XML parser, and the mjpegtools mpeg2 encoder must be installed separately." </code> </p><p><nobr> <wbr></nobr>... 3900 lines of multi-threaded Perl<nobr> <wbr></nobr>... </p><p> WONDERFULL! </p><p> Johan</p> johanvdb 2003-12-23T15:53:14+00:00 journal YAPC::Flanders ... <p>Anyone interested in a YAPC::Flanders or a "perlworkshop-flanders"?</p><p>Johan</p> johanvdb 2003-12-17T12:40:02+00:00 journal Wall-Mart sells crap ... <p>Nothing to do with Perl<nobr> <wbr></nobr>... and probably just something I want to get out of my heart<nobr> <wbr></nobr>...</p><p>Anyhow<nobr> <wbr></nobr>... during a business trip to Boston I had a brief window to do some shopping. High on my shopping list was an RC plane from I wanted to buy for me and my nephew.</p><p>I grabbed two RC planes (SkyRangers), paid for them and went back to the hotel. The day after, at my hotel room I checked the goods and to my astonishment one of them was already used. Probably somebody at wall-mart - probably personell - had been playing with it until it was beyond repairs and quietly changed it with a new one in the store.</p><p>A pity, I did not have the change to go back to the place-delict, the Wall-Mart in Framingham, MA, otherwise I would have gone back and made my point clear.</p><p>Now, I had to travel back with one broken RC plane, which I payed 30$ for!</p><p>Well, first impressions count they say, and this was my first trip to the US. One thing I learned, never thrust a store in the US, especially not Wall-Mart!</p><p>I send them an email, complaining about the matter, but why should they bother? They never answered<nobr> <wbr></nobr>...</p><p>Johan</p> johanvdb 2003-12-01T17:27:35+00:00 journal Cross platform bogus <p>I wonder why everybody thinks Java is a cross-platform language? Ok, you can fairly easily write win32 apps and run them on a *nix system<nobr> <wbr></nobr>.... as long as you have a processor that is supported by a VM. Seems that a lot of processors have bad JVM support. PowerPC, XScale are among these. So where is the portability?</p><p>As long as you have a C compiler that is ANSI compliant, it seems that that gives the best portability you can get. As long as this C compiler compiles Perl, you are a doing fine<nobr> <wbr></nobr>...</p><p>I wonder which are the most exotic platforms Perl has been used on? Any change on getting some field-stories about this?</p><p> &nbsp;</p> johanvdb 2003-11-24T10:41:15+00:00 journal ActiveState Perl <p>I just looked at the activestate website to see the status of activestate Perl. The <a href="">Changelog</a> entries told me that either Perl is getting more stable, demanding fewer releases, or that ActiveState Perl begins to lag behind<nobr> <wbr></nobr>...</p><p>This is the release frequence of ActiveState Perl:<br>2000: 13<br>2001: 5<br>2002: 3<br>2003: 2</p><p>With only a total of 3 5.8.x releases<nobr> <wbr></nobr>...</p><p>I really hope Sophos keeps the ActiveState Perl product alive!</p><p>Johan</p> johanvdb 2003-11-07T13:55:37+00:00 journal i++ fails ( ... java bashing ) <p>I did not make it to YAPC::Europe::2003<nobr> <wbr></nobr>... that is a bit of a sad thing, but hey, my daugther got sick on thursday evening - nothing serious , though - so my wife was very happy having me around. So I guess that not going to YAPC was rather a good thing!</p><p>Anyhow<nobr> <wbr></nobr>... I'm a bit annoyed with java, although i need to do *stuff* with it for my day job. The last week I've been busy using aspects (AspectJ, to do some code coverage profiling on file system access. Anyhow, I was a bit thorn away by the fact that the next piece of code does not work:</p><p>Integer i = new Integer(5);<br>i++;</p><p>This does not work, neither has the Integer object an add, substract or Integer.doSomethingUsefull() method. Curious not, that a language which was originally targetted to embedded systems has so much trouble getting its primitive types in order. I need to have an integer object, because I needed top keep a hash (HashMap), linking a name to a counter (${$key}++)<nobr> <wbr></nobr>.... it expects an Object as its key and value paremeter in the put method (HashMap.put(key, value)). Anyhow, a colleague told me he uses an array with one element for this. A straight int type will not work, as it is a primitive integer type and no Integer object.</p><p>Johan</p> johanvdb 2003-08-08T00:22:28+00:00 journal To YAP::Europe::2003 or not? <p>I'm having a dilemma here<nobr> <wbr></nobr>... I've taken 3 days holiday to go to YAPC::Europe::2003, which starts tomorrow, but I'm reluctant going. I suppose this is because of not wanting to part my wife and daughter. I know it is a bit mellow, but my daughter, 5 months old, really changed my look onto the world.</p><p>Anyway, who can give me a few good reasons to go to YAPC::Europe? It is only a 3 hours drive for me, so that should be fine anyhow<nobr> <wbr></nobr>...</p><p>Johan</p> johanvdb 2003-07-22T20:41:07+00:00 journal Class::DBI or Alzabo ... dilemma <p>I need to write database components for a medium complexity database, I'm talking about a 30 tables here, with a lot of foreign keys<nobr> <wbr></nobr>...</p><p>The problem being that I don't have time to do it by hand - and also because I'm too lazy to write 30 database classes - so I'm looking for an OO database wrapper. Choice seems to be abundant, tangram, class::dbi, alzabo,<nobr> <wbr></nobr>...</p><p>Skimming the docs of those I think I need to settle on Class::DBI or Alzabo. I'm not sure which one will fit my needs<nobr> <wbr></nobr>... so I'm experimenting with both of them<nobr> <wbr></nobr>...</p> johanvdb 2003-07-17T09:15:05+00:00 journal <p>it has been a long time since I wrote something here<nobr> <wbr></nobr>... it probably has to do with the birth of my daughter<nobr> <wbr></nobr>;-)</p><p>Anyhow, I wonder if any bonzos are going to YAPC::Europe 2003 and what hotel they have booked.</p><p>If anybody from Belgium wants a lift to YAPC::Europe, i still have some place left in the car<nobr> <wbr></nobr>...</p><p>Johan</p> johanvdb 2003-07-11T14:20:14+00:00 journal the automatron <p>I just made the reflection that in all projects I've done I always found some use for Perl. Although quite a few projects were completely written in Perl I also seem to have grown the tendency to find *some* usage for Perl in other types of projects.</p><p>For PalmOS programming, I've written a script to automate the generation of skeleton code. I also use Perl to generate some of the content for my palm apps.</p><p>For my embedded development, it was a bit hard at first to find a usage for Perl. But the inevitable happened<nobr> <wbr></nobr>... when developing a wireless application - RF temperature logger - I wrote the server portion in Perl.</p><p>Even at my day-job I'm Perling away - if I have the chance - again, using Perl to automate stuff. (for the moment stuff means visualizing test data ).</p><p>So<nobr> <wbr></nobr>... for me Perl is the ultimate automatron, a tool to automate everything.</p><p>Johan</p> johanvdb 2003-04-24T12:27:16+00:00 journal 3 new books on my shelf <p>I've bought three books today:<br>* Designed Embedded Hardware, ora<br>* Learning the bash shell 2nd edition, ora<br>* LINUX SERVER HACKS, ora</p><p>What do we learn from this:<br>1) O'Reilly is appealing<br>2) O'Reilly is dominant on my book shelf<br>3) LSH probably deserves a top 10 place in my book rank<br>4) Hmmm, if they all were from Micro$oft, I probably would think different<nobr> <wbr></nobr>;-)</p> johanvdb 2003-04-08T23:19:35+00:00 journal PalmOS and Perl <p>Last week I released a module to generate a Palm PDB from an XML description. Now, I've just put a module on CPAN that does the opposite, it creates an XML description from a Palm PDB. This XML::Generator::Pdb module generates SAX events from a PDB and can be plugged into a SAX pipeline to do something usefull...</p><p><a href="">It</a> should hit CPAN soon.</p> johanvdb 2003-04-06T21:39:37+00:00 journal Perl glues embedded and Internet ... <p>Yesterday I was browsing one of my backup HDs to look for an old project I want to take back up, when I noticed two small Perl thingies I did last year. I had completely forgotten about them<nobr> <wbr></nobr>;-)</p><p>One of the projects - <a href="">Dyns::Client </a>- was a perl module to perform an DNS update for you know, one of those web applications that provide you with a dynamic DNS update if you have a DSL or cable connection that regularly changes IP addresses<nobr> <wbr></nobr>... The difference with this is that is being run by a very good <a href="">friend of mine</a> and hence deserves some extra attention!</p><p>The other project - <a href="">dynsudp</a> - is a proxy for dynamic DNS updates, written to be used from an embedded webserver (specifically for siteplayer - This device has DHCP and webserver on board, but can only send a UDP request. So it is impossible to do a HTTP request from the device to the outside world. So I build a daemon - based on Net::Server - that would accept a UDP request containing the necessary information to do a dynamic DNS update on I'm not sure if it has any use in the real world, but I really like the project, because it combines a lot of disciplines<nobr> <wbr></nobr>...</p><p>Both projects should have hit CPAN by now<nobr> <wbr></nobr>...</p><p>Regards,<br>Johan</p> johanvdb 2003-04-03T10:59:46+00:00 journal Perl and PalmOS <p>I just posted a new module (XML::Handler::Pdb) to CPAN which is a SAX handler to generate a PalmOS database from an XML description.</p><p>If I find the time I would like to write the counterpart also, XML::Generator::Pdb, a SAX event generator that takes a PDB and generates SAX events.</p><p>Anyway, this module was written during the sleepless nights that my baby causes me. I really admire the mums, as they seem to be better baby-stress resistant then their male counterparts.</p><p>The module should appear <a href="">here</a> anytime now<nobr> <wbr></nobr>...</p> johanvdb 2003-04-01T00:57:33+00:00 journal TPJ &amp; 101 articles <p>I read the TPJ from march this weekend and it carried a good collection of articles this time. The article about fractal images and music was very amusing. The articles about high performance computing in Perl (Moshe Bar) and how to minimize structural code (Simon Cozens) are really very interesting. It is a pity that the magazine is not any bigger, the articles are of a good standard, but are all way too short...</p><p>An advertisement in the new TPJ pointed to a collection of 101 articles about Perl. You could buy them for 10$. The articles come from various sources (TPJ, web review, web techniques,<nobr> <wbr></nobr>...). I bought the article series, but I've to say it is a bit a disappointement<nobr> <wbr></nobr>... although the articles are very good and are worth a place in your Perl-doc collection. The point is that only the text of the articles is included, no images at all<nobr> <wbr></nobr>...</p><p>Johan</p> johanvdb 2003-03-17T11:55:53+00:00 journal A brand new life! <p>At last<nobr> <wbr></nobr>... after 9 months of waiting me and my wife Evy got their first baby. A healthy daighter of 3.410kg, 49cm, she is named Milla<nobr> <wbr></nobr>...<br>This is the best thing that ever happened to me<nobr> <wbr></nobr>... I'm a happy guy!</p><p>Let us hope we can keep it that way<nobr> <wbr></nobr>... I'm still a bit shaky about the troubles I had with a module on CPAN, which I was not-so-kindly asked to remove from the entire Internet<nobr> <wbr></nobr>... (<a href=";tid=156">;tid=156</a>) Anyway<nobr> <wbr></nobr>... I've written a text about it, but I'm reluctant publishing it, maybe it can trigger some unwanted action<nobr> <wbr></nobr>...<br>Back to the Perl side of things, I hope that the 0.161 release of GSM::SMS is solid enough<nobr> <wbr></nobr>... It passes all the tests and works for me on Win32 and Linux. Ooh, I've soo much hunger to start writing an OSS Multi Media Messaging project<nobr> <wbr></nobr>... I've found an openmms thingy (<a href=""></a>), it is written in Perl, as the authors have talked about it at the latest YAPC (<a href=""></a>, search for mms)<nobr> <wbr></nobr>... but I guess they don't intend opening the code to the public<nobr> <wbr></nobr>...</p><p>Is there anyone who has all the specs of MMS?</p><p>Johan</p> johanvdb 2003-02-25T23:06:58+00:00 journal New stuff on the horizon ... <p>At last, I got the new <a href="">GSM::SMS</a> release ready. Now it has support for Win32 and some other goodies like Flash SMS - messages that pop up directly on the mobile's screen.</p><p>I also have a holiday and I hope I can find the time to finish-up some of my ideas - RF link for one of my robots, making WWW::***** (note: post-edited this, some will know why<nobr> <wbr></nobr>...) a bit better and some other stuff<nobr> <wbr></nobr>...</p><p>But first, I'm going to cook for my family<nobr> <wbr></nobr>...</p><p>Aha, a nice x-mas gift from, WebGUI 5.0 is released! That seems fun<nobr> <wbr></nobr>... need to upgrade my server.</p><p>Johan</p> johanvdb 2002-12-24T12:19:29+00:00 journal Tempus fugit <p>I've been successfull in building the hardware for my wireless module that will power the data transmission between one of my autonomous robots and the main server. The first databits have been sucessfully send. My previous hardware design performed very bad, but the new design is really performant. So<nobr> <wbr></nobr>... what has this to do with Perl? Well, the server application is being written in Perl. I hope to have a page up soon on which I can talk about my new efforts in autonomous robots<nobr> <wbr></nobr>... a preliminary version can be found at <a href=""></a>.</p><p>Signing off,<br>Johan</p> johanvdb 2002-12-05T23:53:29+00:00 journal Perl threads getting slower? <p>I recently got absorbed by threads in Perl. Why? Well, because I'm working on a product - <a href="">iSMS</a> - that I hope to be of use to some with some money to spend, otherwise it'll go OSS as is its predesessor. Anyway<nobr> <wbr></nobr>... I want to use threads instead of the fork() or IO multiplexing via select().</p><p>So I set off reading about and experimenting with the new Perl threading implementation. A search on Google for some 'prior art' on Perl threads gave me <a href="">the following site</a> that compares threading in different languages.</p><p>I just compiled 5.6.1 with -Duse5005threads and checked the Thread implementation with the threads implementation in 5.8.0, sorta<nobr> <wbr></nobr>...</p><p>The following 'apps' were used:</p><p>---------------- Thread</p><p>#!/opt/perl561t/bin/perl</p><p>use strict;<br>use Thread qw(cond_wait cond_signal);</p><p>my $count = 0;<br>my $data = 0;<br>my $produced = 0;<br>my $consumed = 0;</p><p>sub consumer {<br> &nbsp; &nbsp; &nbsp; &nbsp; my $n = shift;<br> &nbsp; &nbsp; &nbsp; &nbsp; while (1) {<br> &nbsp; &nbsp; &nbsp; &nbsp; lock($count);<br> &nbsp; &nbsp; &nbsp; &nbsp; cond_wait($count) while ($count == 0);<br> &nbsp; &nbsp; &nbsp; &nbsp; my $i = $data;<br> &nbsp; &nbsp; &nbsp; &nbsp; $count = 0;<br> &nbsp; &nbsp; &nbsp; &nbsp; $consumed++;<br> &nbsp; &nbsp; &nbsp; &nbsp; last if ($i == $n);<br> &nbsp; &nbsp; &nbsp; &nbsp; cond_signal($count);<br> &nbsp; &nbsp; &nbsp; &nbsp; }<br>}</p><p>sub producer {<br> &nbsp; &nbsp; &nbsp; &nbsp; my $n = shift;<br> &nbsp; &nbsp; &nbsp; &nbsp; for (my $i=1; $inew(\&amp;producer, $n);<br> &nbsp; &nbsp; &nbsp; &nbsp; my $c = Thread-&gt;new(\&amp;consumer, $n);<br> &nbsp; &nbsp; &nbsp; &nbsp; $p-&gt;join;<br> &nbsp; &nbsp; &nbsp; &nbsp; $c-&gt;join;<br> &nbsp; &nbsp; &nbsp; &nbsp; print "$produced $consumed\n";<br>}</p><p>main;</p><p>---------------- threads</p><p>#!/opt/perl58/bin/perl</p><p>use strict;<br>use threads;<br>use threads::shared;</p><p>my $count : shared = 0;<br>my $data : shared = 0;<br>my $produced<nobr> <wbr></nobr>:shared = 0;<br>my $consumed : shared = 0;</p><p>sub consumer {<br> &nbsp; &nbsp; &nbsp; &nbsp; my $n = shift;<br> &nbsp; &nbsp; &nbsp; &nbsp; while (1) {<br> &nbsp; &nbsp; &nbsp; &nbsp; lock($count);<br> &nbsp; &nbsp; &nbsp; &nbsp; cond_wait($count) while ($count == 0);<br> &nbsp; &nbsp; &nbsp; &nbsp; my $i = $data;<br> &nbsp; &nbsp; &nbsp; &nbsp; $count = 0;<br> &nbsp; &nbsp; &nbsp; &nbsp; $consumed++;<br> &nbsp; &nbsp; &nbsp; &nbsp; last if ($i == $n);<br> &nbsp; &nbsp; &nbsp; &nbsp; cond_signal($count);<br> &nbsp; &nbsp; &nbsp; &nbsp; }<br>}</p><p>sub producer {<br> &nbsp; &nbsp; &nbsp; &nbsp; my $n = shift;<br> &nbsp; &nbsp; &nbsp; &nbsp; for (my $i=1; $inew(\&amp;producer, $n);<br> &nbsp; &nbsp; &nbsp; &nbsp; my $c = threads-&gt;new(\&amp;consumer, $n);<br> &nbsp; &nbsp; &nbsp; &nbsp; $p-&gt;join;<br> &nbsp; &nbsp; &nbsp; &nbsp; $c-&gt;join;<br> &nbsp; &nbsp; &nbsp; &nbsp; print "$produced $consumed\n";<br>}</p><p>main;</p><p>---------------------------------------</p><p>I got the following test-bench results and was a bit astonished</p><p>&gt; time<nobr> <wbr></nobr>./ 100000<br>100000 100000</p><p>real 0m10.287s<br>user 0m5.360s<br>sys 0m4.930s</p><p>&gt; time<nobr> <wbr></nobr>./ 100000<br>100000 100000</p><p>real 0m15.660s<br>user 0m11.780s<br>sys 0m3.880s</p><p>Subsequent runs give the same result<nobr> <wbr></nobr>... ithreads are 50% slower than the 5005 threading model.<br>I've done a multithreading daemon in Perl 5.5(something) around 2000 to 2001 and found it rather stable enough for production capabilities<nobr> <wbr></nobr>... although all advisory texts show me otherwise...</p><p>Anyway<nobr> <wbr></nobr>... I guess this result has to do with the fact that ithreads don't share data by default. So an extra copy (clone) of variables can be the cause. Again<nobr> <wbr></nobr>... speed has been traided for ease-of-use (and thread safety).</p><p>Hummm<nobr> <wbr></nobr>... bad news<nobr> <wbr></nobr>...</p><p>Anyway<nobr> <wbr></nobr>... no hard feelings<nobr> <wbr></nobr>... if I can get the expected performance<nobr> <wbr></nobr>... no harm is done anyway.</p><p>For the curious - and now I assume other people are actually reading this weblog - I'm using threading in my *product* in the following way<nobr> <wbr></nobr>...</p><p>First a boss/worker kind of thingy, in which incoming requests - handled by the boss - are passed to a worker which will handle the request. This way we get a better response time...</p><p>Secondly a thread is launched at application start that implements a HTTP daemon. This daemon is used for configuration of the application. This thread implements an embedded web server used for handling the configuration<nobr> <wbr></nobr>...</p><p>Aha<nobr> <wbr></nobr>... and as a last treat something I've been working on lately also - patterns in Perl. I was just skimming the new google news site for Perl news and found a rather intrigueing article a bout a guy who is trying to get his 'Patterns in Perl' book published<nobr> <wbr></nobr>... It's a rather sad post, but the good thing is his work on patterns in perl. He deserves a publisher if you ask me<nobr> <wbr></nobr>... even if it only was for hist effort (can't comment on the book quality though<nobr> <wbr></nobr>... had no time to read it). The post can be found on:<br><a href=""></a></p><p>We'll we are at it, you can also look at another PIP initiative: <a href=""></a></p><p>Regards,<br>Johan</p> johanvdb 2002-11-19T01:20:13+00:00 journal Perl, PVR and SAX <p>Recently I read an <a href="">article</a> on that really showed the strength of using SAX and family.</p><p>This got me going and experimenting with custom SAX event handlers and generators.</p><p>Now, the place I work is full of &#252;bergeeks - in the positive sense of the word - a few of them are building there own Personal Video Recorder and introduced me into a special XML format, called <a href="">XmlTV</a>. This format is used to describe TV program listings, like channel, hour and show that is on the telly.</p><p>Their favourite system, <a href="">freevo</a>, seems to be build with Python - and that is a pity off course. It should have been build in Perl. Looking at CPAN, we find a lot of modules that would aide in the development of such a thingy<nobr> <wbr></nobr>... SDL for the graphics (no no, no browser here please ), handling of XMMS and MP3 files and off course LWP HTML::TreeBuilder and the XML modules for <a href="">scraping</a> usefull information for TV addicts from the web.</p><p>Well, all this led to me developing a <a href="">thingy that can generate this XMLTV</a> format - theoretically from any source - in Perl (*** note: I put it offline, sometimes it is too dangerous to write perl modules ***). And I've build it as a SAX event generator, so you can plug it in into any application you want (?) if you prefer to work with XML stuff, that is.</p><p>I'm also toying around with Perl 5.8.0 recently and especially with the threading capabilities of Perl 5.8.0. I've written the classic Producer/Consumer application. And that got me wondering about the differences between the threading model in Perl and Java. I don't now how, but the low level threading support in Perl seems a bit too low-level for some stuff.<br>having read a book on Java threading (shame on me), I really would like the following constructs in Perl:</p><p> &nbsp; &nbsp; sub do_stuff : Synchronized {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Wait;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $do_stuff_var++;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NotifyAll;<br> &nbsp; &nbsp; }</p><p>and<nobr> <wbr></nobr>...<br> &nbsp; &nbsp; # critical code section<br> &nbsp; &nbsp; synchronized {<br> &nbsp; &nbsp; &nbsp; &nbsp; do_critical_stuff;<br> &nbsp; &nbsp; &nbsp; &nbsp; more_critical_stuff;<br> &nbsp; &nbsp; }<nobr> <wbr></nobr>...</p><p>Let's see what we can do in this area<nobr> <wbr></nobr>... more soon.</p> johanvdb 2002-10-31T09:16:34+00:00 journal Infected by the WWW::* virus ... <p>I read a post on about WWW::Gazetteer and thought it was a pretty slick idea.</p><p>Then I remembered I wrote a Palm app that allows me to grab program listings from a site that hosts tvguides (note: I don't want to speak about this anymore) and store them on my Palm. Off course, the grabbing is done with Perl and the harvester runs in a nice Perl/Tk app.</p><p>Anyway<nobr> <wbr></nobr>... with all those nice packages in the WWW::* namespaces I felt I also had to contribute. I CPANified the web mining part of channel0 and put it on the CPAN under *** completely gone ****</p><p>Aha<nobr> <wbr></nobr>... and now my daily job involves java development also, I can say java is a laborous language to develop in. Why do I need to write all the getters and setters? Please give me AUTOLOAD functionality or a Class::MethodMaker equivalent! And what about HERE docs?</p><p>Anyway<nobr> <wbr></nobr>... a <a href="">good read why a certain person prefers Perl before java</a> can save the day!</p> johanvdb 2002-10-17T21:45:47+00:00 journal REST when tired of SOAP and XML-RPC <p>Webservices<nobr> <wbr></nobr>... who needs them anyway? I just received my copy of <a href="">The New Architect</a> and it had an article about webservices and if they can work economically. Microsoft has put a big bet on web services, elaborating on Dave Winers XML-RPC protocol. A protocol that, nota-bene, has been developed for weblog interoperability. Now, for one thing XML-RPC is easy to understand, not bloated and usefull. SOAP on the other hand is bloated has a Signal To Npoise ratio of almost 0 (S/N = [payload bytes]/[markup bytes] = ratio of payload to markup), but has one big advantage. It has caught on by the big public, and I guess this has something to do with the ease to be able to make use of SOAP.<br>As a user of a SOAP API, you just have to fire up your IDE and point it to the WSDL file, describing the SOAP API for the web service you are going to use. After that, you can automagically call the API, like:<br>$soap-&gt;cost_of_book($ISBN);<br>And all this has been tauted in popular IT magazines<nobr> <wbr></nobr>...</p><p>Anyway, SOAP has a lot of problems and one of them being that it is just not a standard protocol. It is an application protocol layered on top of another application protocol (HTTP).</p><p>In the past I've written up web scrapers for a multitude of services, and I was doing a primitive form of web services. Tim O'Reilly looks at this as using the URL as a sort of command line. He coined up the term 'URLline interface' at Emerging technologies <a href="">keynote speech</a>.</p><p>I always have had a guts feeling that SOAP is too bloated. I love XML-RPC, because it is lean and mean and the most important feature for me was the fact that on the server a method was called with the correct parameters filled in and on the client I just invoked a method call that would automagically be resolved on the server side.</p><p>Last week I came across a new concept - <a href="">REST</a> - that stands for REpresentational State Transfer. It describes the standard HTTP protocol as good enough - and even better - to implement web services. It compares HTTP and the URL as something that mimics the openess of the UNIX platform. On UNIX you can pipe output from one app to the input of the other. Building complex stuff with simple application that each perform an atomic unit of work.</p><p>Anyway, I'm going to spend some time this week to read up on the ideas of REST. Maybe it will give me a clearer idea if investing time in SOAP is worthwile<nobr> <wbr></nobr>...</p><p>Johan</p> johanvdb 2002-10-13T19:27:44+00:00 journal Perl is better than java! One reason why. <p>When developing in Perl, yesterday evening, I noticed something that favours Perl to java. When running my application, I did the following:<br>perl -I<nobr> <wbr></nobr>./lib -MMyApp -emain</p><p>This is similar to java:<br>java -cp<nobr> <wbr></nobr>./lib com.stupidcompany.myapp.MyApp<br>(Calls the magical main method on MyApp class)</p><p>So far, so good! When I finish up my application in Perl, I can install it in the 'site_perl' directory of installed modules (using ExtUtils::MakeMaker - cross platform and standard), and then I can do:<br>perl -MMyApp -emain</p><p>Java, on the opposite, does not has a notion of a central class/package repository on a local machine. Instead, java app vendors deliver a long list of<nobr> <wbr></nobr>.jar files and such that you must include in your CLASSPATH environment variable<nobr> <wbr></nobr>... in the end, you have to type up a zillion classpath entries to get a stupid app running. (Everyone who has toyed -what else can you do in java? - with XML in java knows about the classpath hell).<br>java -cp "~/javalibs/a.jar;b.jar;c.jar;... ad infinitum" com.stupidcompany.magicmain.MagicMain</p><p>Perl is good, it provides me with a central repository for my modules!</p><p>Regards,<br>Johan</p> johanvdb 2002-10-11T12:18:46+00:00 journal About configurating modules ... Some thought about the configuration of GSM::SMS<nobr> <wbr></nobr>...<p> I got a very good tip, yesterday, from barries, author of XML::SAX::Machines on how to be able to do module configuration.</p><p> On a linux box, most config files are<nobr> <wbr></nobr>/etc, and this is just fine. When using Perl, you can argue to put a config in<nobr> <wbr></nobr>/etc or to use a module (.pm file) to store configuration stuff.</p><p> Now I settled on using a module for storing the configuration stuff. So now I'm able to do:<br> <code>perl -MGSM::SMS::Config -esetup</code> <br> and the command line based configuration manager will pop up. The same code gets invoked when running:<br> <code>perl Makefile.PL</code> </p><p> In a nutshell it works like this:</p><blockquote><div><p> <tt>use Config;<br>use File::Spec;<br> <br>...<br>my $file = File::Spec-&gt;catfile( $Config{'installsitelib'}, "GSM", "SMS", "Config", ""<br>);<br>open F, "&gt;$file";<br>print F $config;<br>close F;</tt></p></div> </blockquote><p> The clever thing is using <b>Config</b> to find the install dir and <b>File::Spec</b> to have a platform independent way of creating a path to the pm file. </p><p> Ah yes, I don not use Term::ReadLine anymore, but reverted to <code>ExtUtils::MakeMaker::prompt</code>. </p><p> Johan</p> johanvdb 2002-10-02T09:24:59+00:00 journal Some lessons in life ... <ul> <li>Never speak at the same time Damian Conway has a key note speech at a conference<nobr> <wbr></nobr>... (YAPC::Europe::2002)</li> <li>Never use Term::ReadLine in your Makefile.PL script, but use ExtUtils::MakeMaker::prompt</li> <li>It is never too late to start posting on</li> </ul><p> I learned these the hardway<nobr> <wbr></nobr>... actually it was rather soft and hence nice lessons in life.<br> Did I mention this is my first use.perl post? Now I did.<br> I'm going to a makeshift party this evening, organised by my former employer (, which has been bought by PwC which has been bought by IBM<nobr> <wbr></nobr>... and which is now totally defunct<nobr> <wbr></nobr>;-)</p> johanvdb 2002-09-27T16:55:29+00:00 journal