<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" 
   xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" 
   xmlns:html="http://www.w3.org/1999/html" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/">
<channel>
   <title>Parsed Participle</title>
   <link>http://www.parsedparticiple.org/blog</link>
   <description>Faiz's Web Journal</description>
   <language>en</language>
   <copyright>Copyright 2007 Faiz Kazi</copyright>
   <ttl>60</ttl>
   <pubDate>Sun, 08 Mar 2009 20:20 GMT</pubDate>
   <managingEditor>faiz@parsedparticiple.org</managingEditor>
   <generator>PyBlosxom http://pyblosxom.sourceforge.net/ 1.4.2 8/16/2007</generator>
<item>
   <title>Founder of NYU Computer Science passes away at 79</title>
   <guid isPermaLink="false">programming/jack_schwartz</guid>
   <link>http://www.parsedparticiple.org/blog/programming/jack_schwartz.html</link>
   <description><![CDATA[
<a href="http://en.wikipedia.org/wiki/Jack_Schwartz">Jacob Schwartz</a>,
the founder of the
<a href="http://en.wikipedia.org/wiki/Courant_Institute_of_Mathematical_Sciences">Courant Institute's</a>
<a href="http://cs.nyu.edu">Computer Science Department</a>, and designer of the 
<a href="http://www.setl-lang.org/wiki/index.php/Main_Page">SETL</a> programming language
<a href="http://www.nytimes.com/2009/03/04/science/04schwartz.html?_r=1">passed away last week</a>.
He was behind the NYU <a href="http://en.wikipedia.org/wiki/Ultracomputer">Ultracomputer</a>
project.
<p>
<a href="http://en.wikipedia.org/wiki/SETL">SETL</a> is incidentally one of the languages we
will be studying as part of the 'Honors Programming Languages' 
<a href="http://www.cs.nyu.edu/courses/spring09/G22.3110-001/index.html">course</a>.
SETL is said to have indirectly influenced Python. It is based on Set Theory and
allows very succinct list-comprehension-like one-liners. At the start of the course
(in January), we were told that it was decided to drop Python in SETL's favor 
since SETL would be more 'fun'.
</p>


]]></description>
   <category domain="http://www.parsedparticiple.org/blog"></category>
   <pubDate>Sun, 08 Mar 2009 20:20 GMT</pubDate>
</item>
<item>
   <title>Discovering xmonad</title>
   <guid isPermaLink="false">programming/xmonad</guid>
   <link>http://www.parsedparticiple.org/blog/programming/xmonad.html</link>
   <description><![CDATA[
<p>As someone who has maintained his set of 'dotfiles' faithfully 
for a few years now, window-manager choice and configuration
has been of great importance.  I used <a href="http://www.fvwm.org/">FVWM</a>
for a few years, finally switching to 
<a href="http://sawfish.wikia.com/wiki/Main_Page">Sawfish</a> somewhere
in 2005.  My sawfish configuration mimics what I had set up in
my fvwm days rather closely, and sporadic periods of messing
around with settings have been the only (enjoyable) disruption
to my otherwise very productive computing life (as far as 
my Desktop environment is concerned).
</p>
<p>I switched to Sawfish simply because it's scripting
language, librep is a Lisp - one that I  had been spending
many commuting <a href="/zaurus">Zaurus</a> hours on.  Life has been very good
with this the way it is.</p>
<p>Until I read 
<a href="http://lambda-the-ultimate.org/node/2932">yesterday's LTU article</a>
a post that talks about side-effects in imperative languages
that cause closures to capture variables in less-than-desirable
ways. It was not the actual post itself, but a link to
a series, with one interesting post featuring a tour of
Haskell and a rather fabulous example to use as a 
working demo program: <a href="http://xmonad.org/tour.html">XMonad</a>,
a really good window manager written in and extensible 
in Haskell:</p>
<ul>
  <li>Windows are automatically tiled</li>
  <li>Mouseless</li>
  <li>Configurable (even in real time), using Haskell</li>
</ul>
<p>
I'm tempted to try it; given todays large displays, arranging
windows with your mouse just feels silly.
</p>
<h3>Imperative-style Iterations and closures don't mix well</h3>
The undesirable form of variable capture that
<a href="http://www.research.microsoft.com/%7Eemeijer/">Erik Meijer</a>
<a href="http://research.microsoft.com/~emeijer/Blog/LookClosure.html">describes</a>
is, I think, a lot to do with supporting closures in languages where C-style
iteration is still relatively a norm. The 
<code>for (i = 0; i&lt;10; i++){ /*..*/ }</code> lets you
use the <code>i</code> as a block scope variable
while it remains a part of the <em>mechanism of the iteration</em>.
It's easy to reproduce this in Perl (the language which is
many things to many people), if you use the C iteration idiom:
<pre class="code">
my @arr = ();
for (my $i = 4; $i &lt; 7; $i++) {
    push @arr, sub {
        return $i;
    };
}

for (my $i = 4; $i &lt; @arr; $i++) {
    my $f = $arr[$i];
    print $f-&gt;(), "\n";
}
</pre>
But the idiomatic way does away with this problem;
and things are better now that we don't have to
get distracted by the iteration mechanism:
<code>map</code> and <code>grep</code> where one can: 
<pre class="code">
my @arr = map {
    my $i = $_;
    sub {
        return $i;
    }
} (4..7);

print $_-&gt;(), "\n" foreach @arr;
</pre>
Javascript may not have map/grep, but for Functional-style iterations,
libraries do a great job of providing such utilities. Prototype.js
comes to mind.
<pre class="code">
var delayedActions = [4,5,6,7].map(function (n) {
    return function (i) {
        return i;
    };
});
</pre>
In fact this is where these closure-ish APIs shine - they
overcome Javascript's problem (i.e., variables only have function scope)
by expressing loops functionally.


]]></description>
   <category domain="http://www.parsedparticiple.org/blog"></category>
   <pubDate>Wed, 13 Aug 2008 16:27 GMT</pubDate>
</item>
<item>
   <title>OpenJDK in Debian/Unstable</title>
   <guid isPermaLink="false">programming/openjdk</guid>
   <link>http://www.parsedparticiple.org/blog/programming/openjdk.html</link>
   <description><![CDATA[
I don't routinely need to write Java code these days,
but it still feels good to know that the JDK is now
available as Free Software in Debian:
<pre class="code">
$ apt-get install openjdk-6-jdk openjdk-6-source
# and then...
$ which java
/usr/bin/java
$ java -version
java version "1.6.0_0"
OpenJDK  Runtime Environment (build 1.6.0_0-b11)
OpenJDK 64-Bit Server VM (build 1.6.0_0-b11, mixed mode)
</pre>
I don't use Java much (but that could have been because
of it's non-free pain), and have so far managed 
with <a href="http://gcc.gnu.org/java/">GCJ</a> surprisingly
well. However, having the official Sun JDK as packaged, 
Free software is really good.


]]></description>
   <category domain="http://www.parsedparticiple.org/blog"></category>
   <pubDate>Tue, 12 Aug 2008 16:12 GMT</pubDate>
</item>
<item>
   <title>Lisp's 50th Birthday Celebrations</title>
   <guid isPermaLink="false">programming/lisp-50th</guid>
   <link>http://www.parsedparticiple.org/blog/programming/lisp-50th.html</link>
   <description><![CDATA[
The <a href="http://en.wikipedia.org/wiki/LISP#History">second oldest programming language still in widespread use</a> is celebrating it's 
<a href="http://www.franz.com/services/conferences_seminars/lisp_50th-birthday.lhtml">50th birthday</a> this year.
<p>
John McCarthy will be giving a talk about the history of Lisp,
at <a href="http://www.oopsla.org/oopsla2008/">OOPSLA 2008</a> 
(The ACM SIGPLAN Conference on Object Oriented Programming, Systems, Languages, and Applications), an event that I was already wishing I could attend.
Is this the 'official' celebration, I wonder?  Object-Oriented
Programming owes a lot to Lisp, but then isn't Lisp so much more
than just OO?
</p>
<p>M.J.D (the author of <em>Higher Order Perl</em>) is apparently
one of the keynote speakers.  I'm beginning to wish I can still
make it somehow.</p>


]]></description>
   <category domain="http://www.parsedparticiple.org/blog"></category>
   <pubDate>Sat, 12 Jul 2008 13:10 GMT</pubDate>
</item>
<item>
   <title>YAPC::Asia 2008</title>
   <guid isPermaLink="false">programming/yapc-asia-2008</guid>
   <link>http://www.parsedparticiple.org/blog/programming/yapc-asia-2008.html</link>
   <description><![CDATA[

YAPC::Asia (<a href="http://en.wikipedia.org/wiki/YAPC">
<u>Y</u>et <u>A</u>nother <u>P</u>erl <u>C</u>onference</a>, Asia)
took place in Tokyo (where it has always been held since 2006)
from May 14<sup>th</sup> through 16<sup>th</sup>.
<p>
I had missed the last conferences (in 2007, I was in Hiroshima
working on yet another impossible-deadline project, which
was memorable because it involved adventures in Javascript;
in <a href="http://files.thilosophy.com/2006/03/29/#yapc_asia_1">2006</a>, 
tickets were sold out too early), so this time I took no
chances and bought my tickets well in advance (before
my sabbatical even started).
</p>
<p>I even submitted a few talk proposals, out of which
a <a href="/slides/yapc-asia-2008/poerl.slidy_ja.html">
talk about multiprocessing/concurrency </a>
(entitled: "From POE To Erlang") was accepted for the
'advanced' track: There were <em>three</em> halls/tracks
in all, and the scheduling and organization was really
excellent: My talk on POE (The 
<a href="http://poe.perl.org">Perl Object Environment</a>)
was followed by a talk on 
<a href="http://www.slideshare.net/kan/xircd-yapcasia2008/">XIRCD</a>,
which involved some POE code so that there
seemed to be some continuity.
</p>
<p>This was also the first time in some 5 years 
since I actually spoke to a live audience
(if you exclude the odd presentation I sometimes
make at work, in broken Japanese), since I
live and work in Japan. The talk went OK, but
suffered a hurried, insufficient preparation.
Making slides isn't as easy as I remember. I was
out of practice. A <em>second</em> talk was
also accepted, not for the actual conference
tracks, but for the arrival party, on the 14<sup>th</sup>.
Surprisingly enough, a Javascript talk; turns
out that YAPC::Asia and the Perl community
in general is very Javascript friendly.
<a href="/slides/yapc-asia-2008/little.slidy_ja.html">
This Talk </a>
('The Little Javascripter / Higher-Order Javascript') 
did not go too well at all; I ran out of time
half-way through my slides (which I feared
were not really complete). It turned out to
be an expensive trial run, but a good learning
experience. 
</p>
<p>But I hope the main talk made up for it. Special
thanks to <a href="http://use.perl.org/~ishigaki/journal/">Ishigaki-san</a>
for the translations. POE really has been amazingly
useful to me in the last few months, and I thought
that talking about it would be a nice way to
introduce Erlang to the Camel-folks. A lot were
already in the know though; one lightning talk
was on exactly the same topic (a POE and Erlang
success story in Amazon), and while some people
made strange faces at the Prologesque syntax, a
couple of Erlang fans were nodding excitedly.
</p>
<h3>The Camel Folks</h3>
<p>The great thing about YAPC is that you get
to meet so many people. They say that this was
the biggest YAPC yet. Meeting Larry Wall early
on the morning of the arrival party day was
especially memorable: I had no idea he would be
showing up for the Tsukiji 7AM-sushi eating
expedition, so imagine my surprise when he
appeared out of nowhere and greeted me saying
"Hajimemashite! Larry desu. Yoroshiku!"
(I was probably the only person there that morning who he'd
not met before). He's as funny as I imagined:
When we arrived to find all the sushi restaurants
closed, he expressed some mild dismay that
his pun on the expression "shimatta!" had
gone unnoticed. <em>('Shimatta' is Japanese for 'closed',
as well as an expression for 'darn it!')</em></p>
<p>Me and Thilo got to meet him and Gloria Wall
again, when we bumped into them at lunch time
in Matsuya's.</p>
<p><a href="http://fsck.com">Jesse</a> was exactly like 
I imagined; bubbly and resourceful;
<a href="http://www.astray.com/">Leon Brocard</a> was
surprised (pleasantly bewildered?) to learn that I use
<code>Devel::ebug</code>, his replacement for the
original Perl debugger. I took the opportunity to
bounce off a couple of ideas I had (and a hack that
I'd made and had been using) on it. Jonathon Rockway's lightning talk
on <em>here documents</em> were pretty useful, and
Ingy's talks were the most fun. 
<a href="http://search.cpan.org/~ingy/pQuery/lib/pQuery.pm">pQuery</a>
is a great idea.
</p>
<p>The speakers were invited to <a href="http://www.dan.co.jp/~dankogai/">Dan Kogai</a>'s
(the Encode.pm guy!) house (now reknown for it's fabulous view)
for a weekend Hackathon; I couldn't 
make it but did show up for a few hours on Sunday
evening. I did not have anything planned to work
on, so I started messing with <em>Devel::ebug</em>
and (after the heads-up from Jesse's talk) <em>Carp::REPL</em>
as well. I was hoping to re-implement my multiplexer
hack (A way to allow Perl debugee processes to connect
to a debug server so that ebug clients can debug them)
without POE (which ought not to be a dependency for
something like a debugger, though it was tremendously
useful in prototyping the idea). Not much progress,
but great fun. These people are nice.
</p>

]]></description>
   <category domain="http://www.parsedparticiple.org/blog"></category>
   <pubDate>Sun, 18 May 2008 17:51 GMT</pubDate>
</item>
<item>
   <title>Screen Scraping in this Day And Age</title>
   <guid isPermaLink="false">programming/screen-scraping</guid>
   <link>http://www.parsedparticiple.org/blog/programming/screen-scraping.html</link>
   <description><![CDATA[
... of RSS, Web2.0 and whatnot. As much as I loved doing 
it back in old days, screen-scraping (parsing HTML off of
web pages with a lot of guesswork) was (and is) yucky. I
suppose I enjoyed it back then because I ended up learning
a bit of Awk, and later Perl.
<p>
But since I've found no good way to avoid missing concerts,
other than hope that there's a RSS feed with ticket/date
information for bands/artists that I don't want to miss,
I have to resort to such nonsense now and then:
<pre class="code">
use LWP::Simple 'get';
use HTML::TableExtract;
use Data::Dumper;

sub STATUS { 5 }  # The 5th column of table happens to be 'ticket status'

my $te = new HTML::TableExtract;
# slurp!
$te-&gt;parse(get '<a href="https://tickets.thepolice.com/">https://tickets.thepolice.com/</a>');

my ($table) = $te-&gt;tables;             # The first and only table in the 
                                       # page is a list of all gigs by city,
                                       # date, and ticket availability
my @tokyo_gigs = grep {                
                    grep /Tokyo/, @$_  # Rows with dates in Tokyo
                 } $table-&gt;rows;

# Look out for any changes; at this time, there are only 2 shows in Tokyo
die "Whoa! no gigs in Tokyo??"    unless @tokyo_gigs;
die "Whoa! *more* gigs in Tokyo??"    if @tokyo_gigs &gt; 2;
die "Whoa! only *one* gig in Tokyo??" if @tokyo_gigs == 1;

# ... and if their status is anything other than 'Coming Soon',
# then either tickets sales have begun, or... are already sold out!
print "Whoa! somethings up!\n", Dumper @tokyo_gigs 
    if grep { ! /coming soon/i  }
       map { $_-&gt;[STATUS] } @tokyo_gigs;

</pre>
</p>
<p>This is just so I don't miss 
<a href="/blog/music/the_police_2007_tour.html">The Police</a>
<a href="https://tickets.thepolice.com/"> live</a> at the Tokyo Dome,
scheduled in February, 2008.</p>

So having to screen-scrape may suck, but at least there's Perl.

<div class="update">
<strong>UPDATE:</strong><span class="datetime">Nov 21, 21:00 JST</span>:
Looks like it worked! Well, sort of. I put the script in my crontab
and this morning it sent me a mail with "Whoa! no gigs in Tokyo??" in the
body; and sure enough, it seems that the presale Tokyo tickets status
had changed - a link that said "Buy Tickets" is in it's place.
<br />(Of course, it's a totally different issue that the site in 
question <em>does not</em> seem to let one purchase tickets for the
Tokyo venues - how lame!  Well, at least I am early enough to buy
the 'general public' tickets on time.)
</div>

]]></description>
   <category domain="http://www.parsedparticiple.org/blog"></category>
   <pubDate>Mon, 19 Nov 2007 12:58 GMT</pubDate>
</item>
<item>
   <title>What if Keruac were a Hacker?</title>
   <guid isPermaLink="false">programming/beatnik</guid>
   <link>http://www.parsedparticiple.org/blog/programming/beatnik.html</link>
   <description><![CDATA[

I came across a programming language called 'Beatnik':
<a href="http://www.cliff.biffle.org/esoterica/beatnik.html">
http://www.cliff.biffle.org/esoterica/beatnik.html
</a>
<p>
I happened upon it while browsing CPAN, and found a module called 
<a href="http://search.cpan.org/~beatnik/Acme-Beatnik-0.02/Beatnik.pm">Acme::Beatnik</a>.




]]></description>
   <category domain="http://www.parsedparticiple.org/blog"></category>
   <pubDate>Thu, 08 Nov 2007 09:45 GMT</pubDate>
</item>
</channel>
</rss>

