﻿<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title>nLeyten</title>
	<updated>2008-07-03T23:19:16Z</updated>
	<id>http://nleyten.com/atom.aspx</id>
	<link rel="self" href="http://nleyten.com/atom.aspx" />
	<link rel="alternate" href="http://nleyten.com" />
	<generator uri="http://app.onlinequickblog.com/" version="2.0">Quick Blog</generator>
	<entry>
		<title>Use Ocaml, save the world</title>
		<link rel="alternate" href="http://nleyten.com/2008/05/23/use-ocaml-save-the-world.aspx" />
		<id>tag:nleyten.com,2008-05-23:77aecf8b-220e-45c9-89cc-7e02168ac497</id>
		<author>
			<name>Dario Teixeira</name>
		</author>
		<category term="Energy Crisis" />
		<category term="Peak Oil" />
		<category term="ocaml" />
		<updated>2008-05-23T18:50:39Z</updated>
		<published>2008-05-23T18:47:00Z</published>
		<content type="html"><![CDATA[<br>

<p> <i>(Note: this post is written in a tongue-in-cheek
manner;  take it too seriously at your own peril).
</i> </p>

<p> Since this blog is syndicated in the Ocamlcore
Planet, readers may be wondering about the implications
for our favourite language of the coming energy crisis <a href="http://nleyten.com/2008/05/23/peak-oil-revisited.aspx">I
just wrote about</a>.  And in general, just how
well are different computer languages adapted to an
energy-constrained economy? </p>

<p> There are two different factors to consider: a) how
efficient is the language at converting CPU cycles into
useful work, and b) how efficient is the language at
converting programmer time into useful programmes. </p>

<p> The importance of the first factor should be
self-evident.  If not, note that computers consume
an increasing percentage of our energy, and that data
centres all over the world also require a significant
amount of power.  Moreover, there is a wide disparity
in the amount of time different languages require to
complete the same task.  This difference boils down to
different approaches to programme execution (compiled
languages tend to be more efficient than interpreted ones)
and the quality of the code generated by compilers.  The <a href="http://shootout.alioth.debian.org/">Computer Language
Shootout</a>, though not without its flaws, provides <a href="http://shootout.alioth.debian.org/debian/benchmark.php?test=all&amp;lang=all">some
ballpark figures</a> on the efficiency of different
languages. As you can see, Ocaml fares very well on the
existing benchmarks. </p>

<p> The second factor, though it may not be obvious at
first sight, may indeed be even more relevant to this
discussion.  Programmer time requires energy not only
to sustain the <i>Homo sapiens</i> specimen that does
the programming, but also because programming is to a
large extent done in front of an energy-hungry computer.
Therefore, by making the programmer more productive,
a computer language can result in significant energy
savings. </p>

<p> Measuring language productivity is a difficult
task.  Nevertheless, I would like to posit that the
availability of a strong static type checker such
as Ocaml's — one that catches most common
mistakes at compile-time — is a plus in this
regard.  Even more so if we consider runtime errors
as a loss of productivity.  Another good proxy for
language productivity is indicated by the terseness of
its programmes.  Again, the Computer Language Shootout <a href="http://shootout.alioth.debian.org/debian/benchmark.php?test=all&amp;lang=all&amp;calc=Calculate&amp;xfullcpu=0&amp;xmem=0&amp;xloc=1">may
be of assistance</a>. </p>

<p> So, how well does Ocaml fare when these two
factors are taken into account?  Very well, I am pleased
to say.  In fact, using some reasonable parametrisation, <a href="http://shootout.alioth.debian.org/debian/benchmark.php?test=all&amp;lang=all&amp;calc=Calculate&amp;xfullcpu=1&amp;xmem=0&amp;xloc=5&amp;binarytrees=1&amp;chameneosredux=1&amp;fannkuch=1&amp;fasta=1&amp;knucleotide=1&amp;mandelbrot=1&amp;nbody=1&amp;nsieve=1&amp;nsievebits=1&amp;partialsums=1&amp;pidigits=1&amp;recursive=1&amp;regexdna=1&amp;revcomp=1&amp;spectralnorm=1&amp;hello=0&amp;sumcol=1&amp;threadring=1">the
results</a> of the Shootout show Ocaml as the top rated
language.  We can therefore conclude that Ocaml will
also have a role to play in saving civilisation from an
energy crisis.  </p>
]]></content>
	</entry>
	<entry>
		<title>Peak Oil revisited</title>
		<link rel="alternate" href="http://nleyten.com/2008/05/23/peak-oil-revisited.aspx" />
		<id>tag:nleyten.com,2008-05-23:33b718cc-ca76-427e-a405-918522a9aaa7</id>
		<author>
			<name>Dario Teixeira</name>
		</author>
		<category term="Peak Oil" />
		<category term="sustainability" />
		<updated>2008-05-23T15:14:28Z</updated>
		<published>2008-05-23T15:07:00Z</published>
		<content type="html"><![CDATA[<br>

<p> More than a year ago <a href="http://nleyten.com/2007/03/18/ohmygodwereallnotgonnadie.aspx">I
posted here my ramblings</a> on the possibility of world
oil production being at, or close to, its peak.  At the
time, the topic of "Peak Oil" was still rather obscure,
and there were still many advocating that the world's
production capacity could continue to grow for decades
to come.  They were the ones saying that the price would
soon drop down to $20 or $30 a barrel.  Needless to say,
since then events have precipitated, and just last week
the price of oil jumped above the psychological barrier
(for computer scientists, anyway!) of $127 a barrel (127
being of course the largest integer quantity that can be
expressed with only 7 bits).  It seems like a perfect time
to revisit and update those predictions. </p>

<p> On the whole, I have nothing to detract from what I
wrote 14 months ago.  I may have been overly optimistic
in some areas (more on that below) and events seem to be
happening faster than what I expected, but I still expect
the picture to remain more-or-less the same.  While I may
be now slightly less optimistic about our prospects for
the coming couple of decades, overall I still think that
the transition away from fossil fuels will occur without
the catastrophic collapse of civilisation presaged by
those with an inclination for doom. </p>

<p> Note, however, that these are far from
being cornucopian predictions.  If reality
scares you, perhaps you should be visiting <a href="http://www.disney.com/">this site</a> instead. </p>

<h2>Is the peak real and happening now?</h2>

<p> In other words, how can we be sure the rise in prices
reflects a real constraint on the production side instead
of just speculation and/or conscious throttling on the
part of exporting nations in order to drive up revenue?
Moreover, even if the constraints are real, couldn't
this just be a temporary situation caused by a past
underestimation of the current demand needs (bear in mind
the huge rise in demand in the past few years by China and
others), and that everything will be resolved as soon as
production catches up? </p>

<p> Well, regardless of the actual numbers, we should
reflect anyway on the utter and complete absurdity of
having these crucial statistics about the wealth of the
world economy be dependent on whims and state secrets
of despotic regimes (Saudi Arabia, for one).  This is a
shortsightedness for which we could pay very dearly. </p>

<p> In any case, what leads me to believe we are now on
the peak's "bumpy" plateau is the following: </p>

<ul>

<li> Discoveries peaked in the 60s and despite all
technological advancements, have been declining ever since.
Recent discoveries (despite all the media attention they
get) are pathetic in comparison to the fields discovered
decades ago, and are typically made off-shore in very
deep waters (read expensive, dangerous, and desperate
locations).  This fact alone shows that oil production is
bound to peak sooner or later, though of course does not
prove it is actually occurring now. </li>

<li> The number of countries past their peak keeps
increasing.  Three well-known recent examples are Mexico,
Norway and the United Kingdom.  The latter went in less
than a decade from being a major exporter to a net importer
of oil; as for Mexico, predictions are that in less than
ten years it will cease exports altogether (bad news
for the US, which imports a huge amount of oil from its
southern neighbour). </li>

<li> The two big exporters, Saudi Arabia and Russia, seem
unable to increase their production.  Many argue they may
also be close to peaking. </li>

<li> There are indeed a couple of <a href="http://en.wikipedia.org/wiki/Oil_megaprojects">oil
megaprojects</a> coming online in the next couple
of years, but afterwards the situation seems dire.
We seem to be now in what has been called a <a href="http://www.theoildrum.com/node/2757">"Peak Lite"</a>
scenario.  This means that even though the absolute peak
may not yet have been reached, the oil industry is starting
to show the symptoms of a post-peak situation.  Namely,
production is unable to keep up with demand, leading to
a significant increase in prices. </li>

<li> Currently, world production sits <a href="http://europe.theoildrum.com/node/4018">at about 87
million barrels per day</a>.  If you take into account the
new projects coming online, and the rates of depletion
in existing fields, it is possible that this number may
yet increase slightly within the next couple of years.
However, I very much doubt it will ever reach 90 mbpd.
Couple this with the ongoing increase in demand and the
Export Land Model (more on that below), and I would bet
against oil ever going below $100 a barrel (barring a
major global recession, of course). </li>

</ul>

<h2>Aggravating circumstances</h2>

<ul>

<li> I didn't factor in the so-called <a href="http://en.wikipedia.org/wiki/Export_Land_Model">"Export
Land Model" (ELM)</a>, but in retrospect I should have.
In short, because the internal demand for oil in the
big exporting countries is increasing at a fast pace,
the amount of oil available for export decreases at
a much faster rate than what could be expected from
depletion alone.  This means that once past the peak, the
decline in oil available for export may be much steeper
than anticipated.  In other words, the transition away
from fossil fuels could feel more like shock therapy than
a smooth ride. </li>

<li> Society is still by and large in denial.  Moreover,
most people (including politicians and journalists)
are completely clueless about basic principles of
thermodynamics and the orders of magnitude involved in
energy discussions.  To give you a concrete example that
illustrates most people's complete detachment from the
workings of the physical world, some weeks ago a leading
Portuguese news magazine published a vision of society
in 15 years time;  they talked of "cars running on wind
power", and showed a picture of a tiny wind turbine on
top of a futuristic-looking car!  It would almost be funny
if the consequences of this kind of thinking were not so
tragic. </li>

<li> <a href="http://en.wikipedia.org/wiki/EROEI">Energy
Return on Energy Invested (EROEI)</a> is a problem
that goes beyond oil.   Not only do fossil fuels offer
relatively cheap and very dense energy, but you get a huge
return for each unit of energy you invest in extracting
them.  In the early days of the oil industry, when
extraction was as simple as digging a hole in the backyard,
EROEI was as high as 100:1.  Today, because drilling at
huge depths and off-shore is quite energy-intensive, the
EROEI for oil has decreased to 20:1 or 15:1.  And note
that for renewables and nuclear, the EROEI is even
much lower than that.  (As a side note, take heed that
scholars have pointed out that a decrease in EROEI was a
contributing factor in the decline of the Roman empire.
<a href="http://bloggingheads.tv/diavlogs/11143">One of the
most interesting interviews</a> I've listened to recently
addresses this issue: it features Thomas Homer-Dixon
discussing his latest book, "The Upside of Down"; I very
strongly recommend listening to it). </li>

</ul>

<h2>Consequences for industry, commerce, and tourism</h2>

I won't repeat what I wrote last year.  I merely wish to
emphasise a few points that I find most relevant:

<ul>

<li> Locality will become much more important.
With transportation costs rising significantly, many
current assumptions will no longer be valid.  This will
have impacts on industry (suddenly it won't make as much
sense to produce cheap plastic toys in China), agriculture
(such as importing out-of-season fruit half-way across
the globe), and of course, tourism.  I think you can
find countless other examples where the assumption that
transportation costs are near zero have shaped our economy.
</li>

<li> The airline industry as we know it is seriously
screwed.  Note however that "screwed" is not the same as
"doomed to extinction" like many are quick to predict.
Fares are still ludicrously cheap by historical standards,
and even if five years from now they are 3-4 times higher,
there will still be a sizable amount of air travel
going on.  Nevertheless, air travel will take a serious
hit from the effects of Peak Oil, and I reiterate that
current plans for expanding and building new airports will
look very foolish in less than ten years time.

<p> In addition, the travel industry will undoubtedly
adapt and many of its facets will look fairly different
in 10 or 15 years from now.  Part of the adaptations will
be purely technological (as an example, consider that <a href="http://en.wikipedia.org/wiki/Turboprop">turboprop</a>
planes are more fuel efficient than jets), others will come
from purely a business choice (the "no frills" concept will
go away, because in a context of much higher fares due
to fuel costs, the cost of frills will be proportionally
tiny, thus giving an advantage to companies that do
provide them), and others may stem from a rethinking
of the very concept of travel.  Consider for example
the possibilities offered by the eventual return of the
airship (as in the "Hindenburg", hopefully minus the fire
and oh-the-humanity).  Presently, the "getting there" part
of air travelling consists of just the ordeal of having to
sit in a confined space for hours on end.  What if instead
the holiday trip were to start the moment you stepped on
a comfortable and spacious airship?  It wouldn't matter
so much if a trip took a couple of days instead of a few
hours. </p> </li>

<li> I doubt that economy will fare well
during the first 5-10 years of the transition.
The scenario I find most likely is a return of the <a href="http://en.wikipedia.org/wiki/Stagflation">stagflation</a>
that plagued the 1970s.  However, note that the economy
doing badly for an extended period of time is not the same
as catastrophic economic collapse.  Last time I checked,
there were no zombie hordes roaming the streets during the
1970s (though they would explain the whole <i>Disco</i>
phenomenon).  </li>

</ul>

<h2>Winners and losers</h2>

<p> In the grand scope of things we'll all be losers.
Even if somehow an energy-rich country were able to
isolate itself from the events on the rest of the world,
it would still lose simply because the misfortune of any
single country reflects the moral collective failure of
all humanity. </p>

<p> With the above caveat in mind, some countries are
without a doubt better prepared than others to face
an energy crisis.  Here's my take on some noteworthy
examples: </p>

<ul>

<li> I stick to my previous observation that China will
suffer serious growing pains.  I realise that the consensus
among many is that this will be "the century of China",
but I beg to differ.  On the short term, the rise in oil
prices will impact its status as the "world's factory"
(note that its export-based economy is dependent on the
assumption that transport costs are negligible).  On the
longer term, China faces a serious sustainability crisis.
The challenges of the energy crisis will combine with
the effects of climate change, soil erosion, and aquifer
depletion.  Bear in mind that this a country that needs
to feed 1.3 billion people.</li>

<li> The picture for India is similar to that of China,
though India's environmental problems are not yet quite
as severe.  On the other hand, there is the further
complication that India's population time bomb is far from
being under control. </li>

<li> Most of the developing world is in serious trouble.
Note, however, that the energy crisis is only one small
part of the problems faced: climate change, environmental
degradation, and — the elephant in the room —
overpopulation.  Many countries are indeed just disasters
waiting to happen (Haiti comes immediately to mind;
it's just one hurricane away from catastrophe).  Also,
I wouldn't be surprised to see Somalia-style collapses of
individual states. </li>

<li> Countries rich in resources and with fairly low
population densities are likely to fare relatively well.
Brazil and Canada come to mind.  Note, however, that I
would not include Australia in that list.  Though rich
in energy resources, Australia is bound to face problems
stemming mainly from the degradation of its very fragile
environment and the effects of climate change. </li>

<li> Europe as a whole should fare relatively well,
though there are of course stark differences in the
degree of preparedness of different countries.  France,
thanks to its reliance on nuclear power, extensive train
network, and ongoing projects to build and expand tram
and light rail lines is an example to follow.  The United
Kingdom, on the other hand, will be a victim of years
of neglect in its public transit system (particularly
railways), and its electric power production capacity.
In short, problems stemming from what has been termed <a href="http://www.eurotrib.com/story/2008/4/7/23343/79841">"The
Anglo Disease"</a>. </li>

<li> As it currently stands, the United States is very
badly prepared for an energy crisis.  I would really,
really, like to think that Americans will soon wake up
and put their ingenuity to work.  They would embark
on a "Manhattan plan" for fuel alternatives, abandon
the suburbia experiment, and redesign their cities in a
public-transit and walk-friendly manner.  A friend of mine
likes to remind me of a quote by Churchill, who said that
"You can always count on Americans to do the right thing
— after they've tried everything else".

<p> Unfortunately, recent history does not bode well for
the type of reaction we can expect from the US.  And note
that I'm not just referring to the invasion of Iraq
(is there still anyone who maintains the illusion that
its purpose was not to take control of the sizable Iraqi
reserves?).  No, that is simply a reflection of the path
Americans chose to take in the 1980 election.  Back then,
they were given the choice between a candidate aware of
the future energy crisis and who advocated some near-term
sacrifices to move their economy away from fossil fuels
(that candidate was Jimmy Carter), and a candidate who
instead told the Americans to screw conservation, that it
was "morning in America", and that it felt much better to
simply bury their heads in the sand and not to worry about
the future.  The latter candidate was Ronald Reagan, who
has you might recall won by a landslide victory.  (On a
related note, it is disheartening to see Hillary Clinton
— otherwise the most intellectually capable of all
three major candidates — follow the short-sighted
and populist gimmick proposed by McCain of dropping the
gas tax for the holidays). </p>

<p> Note, however, that I wouldn't be so quick to dismiss
the US entirely.  It's a huge country, rich in resources
(one can sometimes forget that even though it is well
past its peak, the US is still the third largest producer
of oil in the world), a major agricultural exporter, and
with a population density that is sufficiently low to make
the country sustainable in the long term. </p>

<p> In a sense, the biggest challenges the US faces are a
crooked political system, and a blind faith on capitalism
and the invisible hand of the markets.  The biggest danger
for the US (and the rest of the world) is that the energy
crisis is successfully exploited by the usual ensemble
of populist and extremist politicians.  Despite this, I
reckon that Americans will eventually do the right thing
— they've been trying everything else up till now,
after all. </p>

<p> (A brief note on populism: the energy crisis we're
facing is in large part a consequence of past populist
and short-sighted policies; it is somewhat ironic
and definitely discouraging to note that the very same
populism that got us into trouble in the first place is
the one that typically profits the most from situations
of crisis). </p> </li>

</ul>

<h2>In the short term</h2>

<p> Though there may be indeed a speculative component
to the current price and therefore some ease up won't be
surprising, I very much doubt oil ever again get below $100
(again, barring a major recession). </p>

<p> OPEC will have their annual meeting in September.
If any, the increases in production announced will be small
and insufficient to meet the rise in demand.  A couple of
months later, the International Energy Agency (the watchdog
organisation over matters of energy) is scheduled to issue
a report concerning oil reserves.  I expect their current
rosy predictions that production could grow all the way to
2030 to be revised.  This is likely to be the moment that
"Peak Oil" and "Energy Crisis" enter the mainstream media.
Hopefully not to long afterwards, the true nature of the
problem — that these are just aspects of a much
broader "Sustainability Crisis" — will become the
focus of society's concerns. </p>
]]></content>
	</entry>
	<entry>
		<title>Oh, the humanity!</title>
		<link rel="alternate" href="http://nleyten.com/2008/04/24/oh-the-humanity.aspx" />
		<id>tag:nleyten.com,2008-04-24:49078793-4168-4599-bf41-2435856bd7da</id>
		<author>
			<name>Dario Teixeira</name>
		</author>
		<category term="ocaml" />
		<updated>2008-04-24T23:56:57Z</updated>
		<published>2008-04-24T23:55:00Z</published>
		<content type="html"><![CDATA[<br>

<p>

<a
href="http://caml.inria.fr/pub/docs/manual-ocaml/manual006.html#htoc37">Labelled</a>
and <a
href="http://caml.inria.fr/pub/docs/manual-ocaml/manual006.html#htoc38">optional</a>
arguments, and <a
href="http://caml.inria.fr/pub/docs/manual-ocaml/manual006.html#htoc41">polymorphic
variants</a> rank among Ocaml's most interesting features.
They can lead, however, to some pretty funky error
messages.  Here's one example:

</p>

<pre>
File "main.ml", line 160, characters 38-44:
Error: This expression has type
         (unit, unit,
          [ `Attached of
              [ `Internal of ([&lt; `Coservice | `Service ] as 'a) * [ `Get ] ]
              Eliom_services.a_s ],
          [&lt; Eliom_services.suff ] as 'b, 'c, unit, [ `Registrable ])
         Eliom_services.service -&gt;
         (Eliom_sessions.server_params -&gt;
          ('d, Litiom_blocks.out_t) Litiom_blocks.t -&gt;
          Eliom_predefmod.Xhtml.page Lwt.t) -&gt;
         (unit, unit,
          [ `Attached of
              [ `Internal of [&lt; `Coservice | `Service ] * [ `Get ] ]
              Eliom_services.a_s ],
          [&lt; Eliom_services.suff ] as 'e, 'f, unit, [ `Registrable ])
         Eliom_services.service -&gt;
         (Eliom_sessions.server_params -&gt;
          ('g, Litiom_blocks.out_t) Litiom_blocks.t -&gt;
          Eliom_predefmod.Xhtml.page Lwt.t) -&gt;
         carry:unit -&gt;
         Eliom_sessions.server_params -&gt;
         (unit, int,
          [&gt; `Attached of
               [&gt; `Internal of [&gt; `Coservice ] * [&gt; `Post ] ]
               Eliom_services.a_s ],
          'e, 'f, [ `One of int ] Eliom_parameters.param_name,
          [&gt; `Registrable ])
         Eliom_services.service
       but is here used with type
         (unit, unit,
          [ `Attached of [ `Internal of 'a * [ `Get ] ] Eliom_services.a_s ],
          'b, 'c, unit, [ `Registrable ])
         Eliom_services.service -&gt;
         (Eliom_sessions.server_params -&gt;
          ('d, Litiom_blocks.out_t) Litiom_blocks.t -&gt;
          Eliom_predefmod.Xhtml.page Lwt.t) -&gt;
         carry:unit -&gt;
         Eliom_sessions.server_params -&gt;
         (unit, 'h, [&lt; Eliom_services.post_service_kind ],
          [&lt; Eliom_services.suff ], 'i,
          [&lt; int Eliom_parameters.setoneopt ] Eliom_parameters.param_name,
          [&lt; Eliom_services.registrable ])
         Eliom_services.service
</pre>

<p>

Obvious, isn't? <img src="http://nleyten.com/emoticons/wink.png" border="0" />

</p>
]]></content>
	</entry>
	<entry>
		<title>Simple benchmarks on the Ocsigen server</title>
		<link rel="alternate" href="http://nleyten.com/2008/04/21/simple-benchmarks-on-the-ocsigen-server.aspx" />
		<id>tag:nleyten.com,2008-04-21:9eec0a69-f989-4241-8868-88174dfe2171</id>
		<author>
			<name>Dario Teixeira</name>
		</author>
		<category term="ocaml" />
		<category term="eliom" />
		<category term="ocsigen" />
		<updated>2008-04-21T15:44:50Z</updated>
		<published>2008-04-21T14:24:00Z</published>
		<content type="html"><![CDATA[<br>

<p>

I have looked for a web
framework shootout similar to the one that exists for <a href="http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&amp;lang=all&amp;calc=Calculate&amp;xfullcpu=1&amp;xmem=0&amp;xloc=1&amp;binarytrees=1&amp;chameneosredux=1&amp;fannkuch=1&amp;fasta=1&amp;knucleotide=1&amp;mandelbrot=1&amp;meteor=1&amp;nbody=1&amp;nsieve=1&amp;nsievebits=1&amp;partialsums=1&amp;pidigits=1&amp;recursive=1&amp;regexdna=1&amp;revcomp=1&amp;spectralnorm=1&amp;hello=1&amp;sumcol=1&amp;threadring=0">computer
languages</a>.  Sure, performance is hardly the deciding
factor when choosing a web framework, and benchmarks don't
say anything about features, robustness, and security.
Note, however, that the same can be said about programming
languages in general and that does not prevent people
from using the shootout in pissing contests.  I can, for
example, easily place Ocaml on top of that list just by <a href="http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&amp;lang=all&amp;calc=Calculate&amp;xfullcpu=1&amp;xmem=0&amp;xloc=4&amp;binarytrees=1&amp;chameneosredux=1&amp;fannkuch=1&amp;fasta=1&amp;knucleotide=1&amp;mandelbrot=1&amp;meteor=1&amp;nbody=1&amp;nsieve=1&amp;nsievebits=1&amp;partialsums=1&amp;pidigits=1&amp;recursive=1&amp;regexdna=1&amp;revcomp=1&amp;spectralnorm=1&amp;hello=1&amp;sumcol=1&amp;threadring=0">
giving a larger weight to the gzip size of the
programme</a> (a choice not altogether arbitrary: bear in
mind that gzip size is a good indicator of a language's
expressiveness; the smaller, typically the more expressive
a language is).

</p>

<p>

Another important caveat to consider is that the bottleneck
for the typical web application lies on the database side,
not on the webserver.  In many cases, the webserver does
little more than to fetch and to do minimal processing on
the results provided by the database.

</p>

<p>

Anyway, though I can't make comparisons between these
numbers and those from other frameworks using other
languages (who in their right mind would want to use
PHP?), it is nevertheless interesting to have an idea of
how well Ocsigen applications perform.  I am therefore
sharing the results of some simple tests I ran on two
different machines: an old Celeron running at 500 Mhz
(a very slow machine by today's standards), and a modern
Intel Pentium Dual E2160 running at 1.80 GHz.  Note that
architecture-wise, the former machine is an x86, while
the latter is an AMD64.

</p>

<p>

All of the tests concern the generation of dynamic content
using Ocsigen's Eliom.  Though test 1 always produces
the same result and could therefore easily be cached, that
has not been done.  The idea was to test the most demanding
operation for a web application: the dynamic generation
of pages (typically personalised for individual users).
Also, there are two sets of results for each test; one
running Ocsigen in bytecode, and another using native code.
Note that because Ocsigen relies on dynlink, and Ocaml 3.10
does not support the dynamic linking of native code, I had
to use the Ocaml CVS HEAD for the tests.  Native dynlinking
will arrive with Ocaml 3.11 (coming this summer?).

</p>

<p>

I used <a href="http://www.joedog.org/JoeDog/Siege">Siege</a> to
perform the actual benchmarking.  Each test was performed
with 10 concurrent client threads, and ran for 30 minutes.
Siege was executed on the same machine where the Ocsigen
server was located.  The results are presented in terms
of the number of transactions performed <b>per second</b>.
The higher the better, of course.

</p>

<h2>Test 1: simple page</h2>

<p>

This service takes no parameters and simply outputs a page
with a "bench1" header.  This is the Eliom handler that
creates the page:

</p><pre style="border: 1px solid black; padding: 0.5em; background: rgb(238, 238, 187) none repeat scroll 0% 50%; font-size: smaller; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">let bench1_handler sp () () =<br>    Lwt.return<br>        (html<br>            (head (title (pcdata "bench1")) [])<br>            (body [h1 [pcdata "bench1"]]))<br></pre>

<p>

And here are the results obtained:

</p>

<table>
<tbody><tr align="left">
	<th width="150"><br></th>
	<th width="150">Celeron</th>
	<th width="150">Pentium Dual</th>
</tr>
<tr align="left">
	<th>Bytecode</th>
	<td>110.41</td>
	<td>590.49</td>
</tr>
<tr align="left">
	<th>Native</th>
	<td>197.32</td>
	<td>1461.10</td>
</tr>
</tbody></table>


<h2>Test 2: arithmetic on integer parameters</h2>

<p>

This service takes two integers as a GET parameter, and outputs the
result of some common arithmetic functions performed on those
numbers:

</p><pre style="border: 1px solid black; padding: 0.5em; background: rgb(238, 238, 187) none repeat scroll 0% 50%; font-size: smaller; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">let rec gcd a = function<br>    | 0 -&gt; a<br>    | b -&gt; gcd b (a mod b)<br><br><br>let lcm a b = (a * b) / (gcd a b)<br><br><br>let bench2_handler sp (a, b) () =<br>  Lwt.return<br>    (html<br>      (head (title (pcdata "bench2")) [])<br>        (body<br>          [<br>          h1 [pcdata "bench2:"];<br>          p [pcdata (Printf.sprintf "%d plus %d is %d" a b (a+b))];<br>          p [pcdata (Printf.sprintf "%d minus %d is %d" a b (a-b))];<br>          p [pcdata (Printf.sprintf "%d times %d is %d" a b (a*b))];<br>          p [pcdata (Printf.sprintf "%d divided by %d is %d" a b (a/b))];<br>          p [pcdata (Printf.sprintf "%d mod %d is %d" a b (a mod b))];<br>          p [pcdata (Printf.sprintf "The GCD of (%d,%d) is %d" a b (gcd a b))];<br>          p [pcdata (Printf.sprintf "The LCM of (%d,%d) is %d" a b (lcm a b))]<br>          ]))<br></pre>

<p>

Note that the client had to request a page with two
GET parameters.  These were generated randomly with the
special shell variable $RANDOM, and stored in a urls.txt
file read by siege.  $RANDOM produces random integers
between 0 and 32767 (yes, I know there was a chance that
both "b" would be 0, causing an exception;  I checked
the urls.txt beforehand, making sure that didn't happen).
Anyway, here are the results obtained:

</p>

<table>
<tbody><tr align="left">
	<th width="150"><br></th>
	<th width="150">Celeron</th>
	<th width="150">Pentium Dual</th>
</tr>
<tr align="left">
	<th>Bytecode</th>
	<td>85.76</td>
	<td>444.06</td>
</tr>
<tr align="left">
	<th>Native</th>
	<td>172.39</td>
	<td>1215.19</td>
</tr>
</tbody></table>


<h2>Test 3: generate page with 100 pseudo-random paragraphs</h2>

<p>

The final test is a bit more demanding.  It takes no parameters,
and outputs a page consisting of 100 paragraphs containing both
a deterministic and a random component:

</p><pre style="border: 1px solid black; padding: 0.5em; background: rgb(238, 238, 187) none repeat scroll 0% 50%; font-size: smaller; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">let random_paragraph =<br>    let rng = Cryptokit.Random.device_rng "/dev/urandom"<br>    and to_hex = Cryptokit.Hexa.encode () in<br>    fun i -&gt;<br>        let random_num = Cryptokit.Random.string rng 80 in<br>        let random_str = Cryptokit.transform_string to_hex random_num in<br>        p [pcdata (Printf.sprintf "This is paragraph %d: %s." i random_str)]<br><br><br>let bench3_handler sp () () =<br>    Lwt.return<br>        (html<br>            (head (title (pcdata "bench3")) [])<br>                (body<br>                    [<br>                    h1 [pcdata "bench3:"];<br>                    div (List.init 100 random_paragraph)<br>                    ]))<br></pre>

<p>

Results obtained:

</p>

<table>
<tbody><tr align="left">
	<th width="150"><br></th>
	<th width="150">Celeron</th>
	<th width="150">Pentium Dual</th>
</tr>
<tr align="left">
	<th>Bytecode</th>
	<td>8.01</td>
	<td>40.66</td>
</tr>
<tr align="left">
	<th>Native</th>
	<td>28.67</td>
	<td>185.00</td>
</tr>
</tbody></table>

<h2>Conclusion</h2>

<p>

First, there is a clear advantage to using native code
(no surprise there!).  Ocaml 3.11 will therefore be
very welcome for Ocsigen users.  Moreover, note that the
byte/native code difference is even more acute on the AMD64
architecture.  There is at the moment still some discussion
on whether or not the AMD64 port should use the "-dlcode"
compiler option by default (this option is necessary for
native dynlinking).  Hopefully further tests will come
to the conclusion that there is little or no performance
impact of using it.

</p>

<p>

It would be interesting to investigate how other
languages/frameworks fare on similar tests.  Even more
interesting will be to repeat these tests on a more real
world scenario, with an actual application that accesses
a database, etc.  I intend to conduct these soon on
Lambdium-light.

</p>
]]></content>
	</entry>
	<entry>
		<title>Nleyten@1400: Netplexing</title>
		<link rel="alternate" href="http://nleyten.com/2008/04/17/nleyten1400-netplexing.aspx" />
		<id>tag:nleyten.com,2008-04-17:9252b1d1-0d21-468f-a151-4010fedb9bc4</id>
		<author>
			<name>Dario Teixeira</name>
		</author>
		<category term="ocaml" />
		<category term="ocsigen" />
		<category term="netplex" />
		<category term="lwt" />
		<category term="ocamlnet" />
		<updated>2008-04-17T16:31:57Z</updated>
		<published>2008-04-17T16:28:00Z</published>
		<content type="html"><![CDATA[<br>

<p>

The <a href="http://projects.camlcity.org/projects/ocamlnet.html">Ocamlnet</a>
set of libraries ranks among the many gems available
for Ocaml.  The blurb on the project's page describes it
this way:

</p>

<blockquote>

Ocamlnet implements a number of Internet protocols (http
client &amp; server, cgi and cgi variants, SunRPC, FTP,
POP, SMTP) and is a strong base for web and Internet
programming. Many protocols can even be driven in an
asychronous way, since Ocamlnet defines a framework for
asynchronous implementations (equeue). There is also a
generic server framework (netplex). There are a number of
accompanying data structures like mail messages, URLs,
buffers, channels, and also routines for character set
conversions.

</blockquote>

<p>

Netplex is of particular interest for me at the moment.
It is basically a generic server framework, allowing one
to build full-fledged servers with very little effort.
If you've ever built a server from scratch, you will
know that while building a basic server is relatively
straightforward, things start to get complicated if you
intend to move from a simple toy into a production-quality
application.  Pretty soon you'll start having to worry
about keeping pools of slave workers, managing the
workload, and synchronising the entire apparatus.  Netplex
takes care of all of that stuff for you.  The end result
is that you get an efficient, secure, and fully-featured
server with just a few lines of code.

</p>

<p>

I am using Netplex to build a "parsing server" (aka the
'Parserver').  It is basically a little daemon that sits
in the background providing a service that translates a
document formatted in one of the supported markups (like
Lambtex) into the native representation used by Lambdium.
Placing this service in an external, independent daemon
makes sense for a number of reasons:

</p>

<ol>

<li>it makes the system more scalable, since we can
easily move the parsing server into its own machine(s)
if necessary.</li>

<li>it makes the system more secure, since the parsing
daemon can run as 'nobody' as shield the rest of the
system from potential attacks based from the parsing
routines.</li>

<li>Applications built using the Ocsigen
framework should be built using the <a href="http://www.ocsigen.org/lwt">Lwt</a> library for
cooperative threads (Lwt stands for 'Lightweight Threads').
At the present no parser-generator includes support for
Lwt.  It does make sense therefore to place the parsing
outside the main application.</li>

</ol>

<p>

As for SVN's 1400 revision log itself, it reads "Defined
the protocol for communication with Parserver".

</p>
]]></content>
	</entry>
	<entry>
		<title>Ocsigen 1.0.0 released!</title>
		<link rel="alternate" href="http://nleyten.com/2008/04/01/ocsigen-100-released-today.aspx" />
		<id>tag:nleyten.com,2008-04-01:b09ec46a-18c5-406f-8c6d-48007d60b593</id>
		<author>
			<name>Dario Teixeira</name>
		</author>
		<category term="ocaml" />
		<category term="eliom" />
		<category term="ocsigen" />
		<updated>2008-04-01T16:52:23Z</updated>
		<published>2008-04-01T16:46:00Z</published>
		<content type="html"><![CDATA[<br>

<p>

<a href="http://sympa.pps.jussieu.fr/wws/arc/ocsigen/2008-04/msg00000.html">
Vincent Balat announced today</a> on the <a href="http://www.ocsigen.org/">Ocsigen</a> mailing-list
the release of version 1.0.0 of that of that web server +
web programming framework.  This is great news, as that
magical "1.0.0" will hopefully attract more users to this
exciting project.  Moreover, I can assure you this is a
rock solid release; in fact, it has been fairly mature
since the 0.6 days, and the 0.99.x series has been in out
and about for almost a year now.  (In case you haven't
noticed, this is the framework I have been using to develop
Lambdium and Lambdium-light).

</p>

<p>

So, why should you care about Ocsigen?  Well, it offers
much more than a high-performance web server written in
Ocaml (though that's also cool).  Integrated with Ocsigen
comes Eliom, a web programming framework based on the
Ocaml language.  It brings the advantages of a safe,
functional, strongly-typed, and amazingly fast language
to web development.  Here are some of the highlights:

</p>

<ul>

<li><b>Static checking of XHTML:</b> <p>Either using native
Ocaml or Ocamlduce, the type system makes sure at compile
time (no runtime penalties!) that the pages you generate
are valid XHTML.</p></li>

<li><b>Web sites consistent by construction:</b> <p>Again
thanks to Ocaml's type system, there's just no way for
a website to include broken links, type mismatching of
form fields, wrong evaluation of page parameters, and
similar brittleness.  And again, all this is checked at
compile-time.</p></li>

<li><b>One page, one function:</b> <p>This not only helps to
ensure the modularity and conciseness of web sites, but
it is a more elegant solution to the consistency problem
than the templating offered by other frameworks.</p></li>

<li><b>Continuation-based web programming:</b> <p>This is one
of those features that is a bit hard to explain, but whose
advantages are obvious once you actually start using it.
It does simplify tremendously the correct use of the "back"
button in browsers or "what if" scenarios when users open
multiple tabs from the same form.</p></li>

<li><b>Automatic handling of sessions:</b> <p>Eliom takes
care of most of the low-level stuff, automatically taking
care of session management.  Moreover, it offers you
a wealth of possibilities, including the choice between
volatile or persistent sessions (even if the web server is
restarted!), public versus private sessions, etc.</p></li>

<li><b>Amazing speed without sacrificing
expressiveness:</b> <p>Ocaml is known to be a very
fast language, comparable to C++ in terms of speed.
Moreover, it is a very high-level language, with a
degree of expressiveness comparable to Python or Ruby.
Wouldn't you like to to have the best of both worlds?
Now you can.</p></li>

</ul>

<p>

In short, Ocsigen brings web development from the
infant age into maturity.  So, if you are curious,
or just simply tired of dealing with the slowness
of Ruby on Rails or the epic brain damage that goes
by the name of PHP, I suggest you pay a visit to <a href="http://www.ocsigen.org/">Ocsigen's site</a> and
take a look at the tutorial.  The only prerequisite is
that you know the Ocaml language.  But it's well worth it.

</p>
]]></content>
	</entry>
	<entry>
		<title>S-expressions for long-term storage of Ocaml values</title>
		<link rel="alternate" href="http://nleyten.com/2008/03/10/sexpressions-for-longterm-storage-of-ocaml-values.aspx" />
		<id>tag:nleyten.com,2008-03-10:34990299-01e9-4596-b9a5-81d18250de95</id>
		<author>
			<name>Dario Teixeira</name>
		</author>
		<updated>2008-03-10T16:22:19Z</updated>
		<published>2008-03-10T16:21:00Z</published>
		<content type="html"><![CDATA[<br>

<p>

Call it marshalling, pickling, serialisation, or whatever
else you wish; this operation — where a value
(or "variable" in non-FP languages) is extracted from
a programme at runtime in order to be stored in disk or
transferred through the wire — is critical for many
applications.  Most programming languages therefore include
in their standard libraries some means of performing it.

</p>

<p>

Ocaml ships with the venerable Marshal module.  It is
extremely simple to use:  suppose we wished to convert
into a string <i>str</i> a marshalled representation of a
value <i>manuscript</i> of type Manuscript.t.  This would
suffice: <i>let str = Marshal.to_string manuscript
[]</i>.  The inverse operation — taking a string
with a marshalled representation and converting back
into a programme value — is also dead easy: <i>let
manuscript : Manuscript.t = Marshal.from_string str 0</i>.

</p>

<p>

The attent observer will have noticed the type annotation
in the unmarshalling example above; in general,
unmarshalling does require an explicit type annotation
(which otherwise is rarely needed in Ocaml).  The reason
is that the type inference mechanism may not have enough
information to determine what is the type of the marshalled
representation (imagine, for example, that the routines
performing the marshalling and unmarshalling reside in
different programmes!).   And here lies the Achilles'
heel of marshalling in Ocaml: should the programmer make
a mistake in specifying the type to be unmarshalled, the
programme will most surely segfault.  This problem also
occurs if a version of the programme stores a marshalled
value, which is then read back by a subsequent of the
same programme where the value's type has been modified
(even if ever so slightly).

</p>

<p>

Over the years, there appeared a number of extensions
to the Ocaml language offering type-safe marshalling
(<a href="http://www.cl.cam.ac.uk/%7Epes20/hashcaml/">
HashCaml</a> may be the most well-known, but it's not
the only one).  And judging from comments by Xavier Leroy
(the primary developer of the Ocaml language) at the <a href="http://wiki.cocan.org/events/europe/ocamlmeetingparis2008">Ocaml
users meeting</a> in Paris this last January, there's a
good chance that type-safe marshalling will make it into
the core language in the near future.

</p>

<p>

In Lambdium-light, stories and comments are stored in
the database backend using the marshalled representation
offered by the Marshal module.  While this works and is
extremely fast, it does have the problem of not being
very resilient to future changes in the story and comment
format.  Therefore, I have been looking at alternatives to
Marshal that provide some degree of backwards compatibility
while not sacrificing too much speed.

</p>

<p>

I suspect that the XML-fanboys in the audience
wouldn't even think twice, but personally I am far
from finding XML a good solution for many of the
problem domains where it is applied.  For this reason, <a href="http://caml.inria.fr/pub/ml-archives/caml-list/2008/02/440da478b5c5d51d1ea4132bf5792b19.en.html">I
asked about this</a> problem in the Caml-list.

</p>

<p>

Anyway, I am currently leaning
towards choosing a solution based on <a href="http://www.ocaml.info/home/ocaml_sources.html#sexplib310">Sexplib</a>,
a library that converts Ocaml values to/from <a href="http://en.wikipedia.org/wiki/S-expression">S-expressions</a>.
It comes with a syntax extension that given a type
<i>t</i> automatically writes the <i>sexp_of_t</i> and
<i>t_of_sexp</i> "marshalling" functions.  Making the
transition from Marshal to Sexplib is therefore very
straightforward.  Another advantage is that S-expressions
are essentially just text and are therefore human-readable.
Moreover, the format is very compact (a lot more than
XML!) and fairly easy to parse.  Speed-wise, while
obviously not being as fast as Marshal, it is still
reasonably fast, especially in native code.

</p>

<p>

Suppose I have a fairly large story of value
<i>Manuscript.t</i>.  On my machine, and using Ocaml byte
code, marshalling and unmarshalling this value 100,000
times takes approximately 19.68 seconds.  Using Sexplib,
these operations take 1175 seconds, which is about 60
times slower.  However, the times in native code are
respectively 17.98 and 105.3 seconds — Sexplib is
less than 6 times slower than Marshal.  Given the other
advantages of Sexplib, these are numbers I can live with.

</p>

<p>

If you are curious about how I got these numbers (and you
should — never take anyone's word at face value when
benchmarks are involved!), here follows the run-down of
the small programme I used for testing.

</p>

<p>

<i>run_marshal</i> is a function that given a manuscript,
does a marshalling followed by an unmarshalling using
the Marshal module.  <i>run_sexplib</i> does the same
thing but using Sexplib.  Note that the latter function
actually first converts the <i>Manuscript.t</i> into its
<i>Sexp.t</i> representation and then this latter value
into a string (and vice-versa for the reverse operation):

</p>

<pre>let run_marshal manuscript () =<br>        let marshalled = Marshal.to_string manuscript [] in<br>        let unmarshalled : Manuscript.t = Marshal.from_string marshalled 0 in<br>        ignore (unmarshalled)<br><br><br>let run_sexplib manuscript () =<br>        let manuscript_sexp_old = Manuscript.sexp_of_t manuscript in<br>        let mach_str = Sexplib.Sexp.to_string_mach manuscript_sexp_old in<br>        let manuscript_sexp_new = Sexplib.Sexp.of_string mach_str in<br>        let manuscript_new = Manuscript.t_of_sexp manuscript_sexp_new in<br>        ignore (manuscript_new)<br></pre>

<p>

I also define a generic benchmarking function that
loops a provided function 100,000 times.  It uses
<i>Unix.gettimeofday</i> to retrieve timing information:

</p>

<pre>let benchmark test =<br>        let start = Unix.gettimeofday () in<br>        for i = 1 to 100000 do<br>                test ()<br>        done;<br>        let finish = Unix.gettimeofday () in<br>        let duration = finish -. start in<br>        duration<br></pre>

<p>

Finally, the main programme simply creates a new manuscript
(assume that function <i> get_manuscript</i> returns a
new parsed manuscript) and calls the benchmark function
with the marshal and sexplib routines:

</p>

<pre>let () =<br>        let manuscript = get_manuscript () in<br>        let duration_marshal = benchmark (run_marshal manuscript) in<br>        let duration_sexplib = benchmark (run_sexplib manuscript) in<br>        Printf.printf "Marshal: %f\n" duration_marshal;<br>        Printf.printf "Sexplib: %f\n" duration_sexplib<br></pre>
]]></content>
	</entry>
	<entry>
		<title>Nleyten@1300: the joy of parsing</title>
		<link rel="alternate" href="http://nleyten.com/2008/02/26/nleyten1300-the-joy-of-parsing.aspx" />
		<id>tag:nleyten.com,2008-02-26:4110d200-92cc-45f4-a360-ca072871d55b</id>
		<author>
			<name>Dario Teixeira</name>
		</author>
		<updated>2008-02-26T15:03:57Z</updated>
		<published>2008-02-26T14:59:00Z</published>
		<content type="html"><![CDATA[<br>

<p>

I know this is bound to brand me as
an incurable language geek, but I find <a href="http://en.wikipedia.org/wiki/Abstract_syntax_tree">
Abstract Syntax Trees</a> a thing of extraordinary beauty.
Yeap, I am still immersed in the creation of the languages
and associated parsers for the markup of Lambdium stories
and comments.  And I'm finding that I'm really enjoying
all the stuff in this trade.

</p>

<p>

I have now completed the definition and most of parsing
tools for the full-fledged Lambtex parser.  As it turned
out, introducing support for labelling and references
forced me to rethink some of the prior assumptions I
had for the Lambtex language.  It was a difficult birth
of sorts, and the language definition did go through
several revisions until it arrived in its present state.
I am now however quite pleased with the result: Lambtex
manages to be both simple and powerful, gracefully handling
most complex cases without burdening beginners with an
arcane syntax.  I will write a small manual (to be part
of Nleyten's help system) soon enough — you will
then get a clearer idea of what I mean.

</p>

<p>

I also realise that I'm lucky enough to be able to be
creating both the language and the tools to parse it at
the same time.  The two play an intricate dance together,
and even minor changes to the syntax of a language can
have a profound effect on the parsing tools.  I am
also thankful to be doing this in Ocaml: the language
is just perfect for compiler writing!

</p>

<p>

As for the SVN changelog at revision 1300, it reads
"Adapted tokenizer to new Lambtex scanner".  The Lambtex
parsing chain is composed of four separate modules
(as typical with most compilers): at the lowest
level there is a scanner that splits the input into
recognisable language atoms; closely tied to it there is
a tokenizer that converts those atoms into proper parser
tokens; then we have the parser proper (I am using <a href="http://cristal.inria.fr/%7Efpottier/menhir/">Menhir</a>
to generate the parser; it's similar to ocamlyacc, but
better); and at last there is a postprocessor that verifies
that the document is semantically correct (all references
point to valid targets, for example) and produces its
final version.

</p>
]]></content>
	</entry>
	<entry>
		<title>The bottomless pit of cultural relativism takes another victim</title>
		<link rel="alternate" href="http://nleyten.com/2008/02/08/the-bottomless-pit-of-cultural-relativism-takes-another-victim.aspx" />
		<id>tag:nleyten.com,2008-02-08:bf08a071-f925-475a-94d9-5793d34110b8</id>
		<author>
			<name>Dario Teixeira</name>
		</author>
		<updated>2008-02-08T16:05:59Z</updated>
		<published>2008-02-08T16:00:00Z</published>
		<content type="html"><![CDATA[<br>

<p>

There are groups of people whose comments have to be
taken always with a grain of salt.  Heads of religious
confessions are obviously one such group — let's
face it, you don't get to be the head of organised lunacy
unless you're pretty much messed up as an individual.
That's just a fact of life.

</p>

<p>

You must have seen it already on the news, but if not, <a href="http://news.bbc.co.uk/2/hi/uk_news/politics/7233335.stm">
here's a link</a>.  In short, Rowan Williams, aka the
"Archbishop of Canterbury" (that's one of the titles
that certifies the person has a fucked up moral sense;
other such titles include "Pope" and "Imam"), stated that
adopting some aspects of Sharia law in the UK would be
unavoidable and a good thing.

</p>

<p>

I can't even begin to understand the layers upon layers of
perverted thinking the could have provoked such statements.
If ever anyone needed a perfect example of the dangers of
cultural relativism, this one will be hard to beat.

</p>

<p>

Another thing that I find particularly troubling with
this sort of news is the continued reverence these sorts
of reactionary idiots get from journalists.  Seriously
guys, take heed from a long-learned lesson in Internet
newsgroups: <strong>don't feed the trolls</strong>!

</p>

]]></content>
	</entry>
	<entry>
		<title>(A quiet announcement)</title>
		<link rel="alternate" href="http://nleyten.com/2008/02/05/a-quiet-announcement.aspx" />
		<id>tag:nleyten.com,2008-02-05:84583d70-a826-4e03-87b9-53ea2b21b826</id>
		<author>
			<name>Dario Teixeira</name>
		</author>
		<updated>2008-02-05T15:17:40Z</updated>
		<published>2008-02-05T15:16:00Z</published>
		<content type="html"><![CDATA[<br>

<p>

By the way, though I did make an announcement in the
Ocsigen mailing-list, I never mentioned it in this blog
that version 0.80 of Lambdium-light has been available from
<a href="http://dario.dse.nl/projects/lambdium-light/">the
usual place</a> for the last couple of weeks (sometimes I
forget that no one who reads this blog subscribes to that
mailing-list!).  It's feature-complete, though the code
will still suffer some refactoring.

</p>
]]></content>
	</entry>
	<entry>
		<title>A tutorial on Lambdium-light's BBcode markup</title>
		<link rel="alternate" href="http://nleyten.com/2008/01/18/a-tutorial-on-lambdiumlights-bbcode-markup.aspx" />
		<id>tag:nleyten.com,2008-01-18:abe96e8a-e7c8-43ba-9139-28d90074e8e2</id>
		<author>
			<name>Dario Teixeira</name>
		</author>
		<updated>2008-01-18T16:17:08Z</updated>
		<published>2008-01-18T16:13:00Z</published>
		<content type="html"><![CDATA[<br>

<p>

I'll be releasing Lambdium-light 0.80 very soon; this is
the version that accepts a variant of BBcode for markup.
For reference purposes, here follows a tutorial detailing
the use of this markup for stories/comments.

</p>

<ul>

<li>
<b>Paragraphs:</b>

<p>

An empty line is used to separate paragraphs.  The reason
this was chosen instead of an XHTMLy syntax (using
&lt;p&gt; and such) is because it is <b>so</b> much more
convenient.  Example:

</p>

<pre style="background: #eee">
This is all part of the same
paragraph.

But this is a new
one.
</pre>

<p>
Will produce:
<p>

<blockquote style="background: #ffe">
<p>This is all part of the same paragraph.</p>
<p>But this is a new one.</p>
</blockquote>	

</li>

<li>
<b>Inline formatting:</b>

<p>

You can apply various formatting tags to text inside a
paragraph (dubbed "inline text").  Example:

</p>

<pre style="background: #eee">
This is normal text, but [b]this one[/b] is in bold,
while [i]this one[/i] is italic.  You can also do
[sup]superscripts[/sup] and [sub]subscripts[/sub].
</pre>

<p>
Will produce:
</p>

<blockquote style="background: #ffe">
<p>

This is normal text, but <b>this one</b> is in bold,
while <i>this one</i> is italic.  You can also do
<sup>superscripts</sup> and <sub>subscripts</sub>.

</p>
</blockquote>	

</li>

<li>
<b>Escaping characters:</b>

<p>

Use '\' to escape other characters.  This is the only way
to tell the parser that the character '[' should not be
interpreted as the beginning of a tag.  Example:

</p>

<pre style="background: #eee">
Here is the character \\.  Opening tags take the form
\[tagname\], while their closing counterparts are
\[/tagname\].
</pre>

<p>
Will produce:
</p>

<blockquote style="background: #ffe">
<p>
Here is the character \.  Opening tags take the form
[tagname], while their closing counterparts are [/tagname].
</p>
</blockquote>	

</li>

<li>
<b>Links:</b>

<p>
You can produce links in either of two ways: if the text
to be displayed is the same as the URL, you can just use
the [url] tag. If, on the other hand, you wish to show a
different text, then pass the URL as a parameter to the
[url] tag.
</p>

<pre style="background: #eee">
Here is a link to [url]http://nleyten.com/[/url].
And this is a link to
[url=http://nleyten.com/]this blog[/url].
</pre>

<p>
Will produce:
</p>

<blockquote style="background: #ffe">
<p>
Here is a link to <a
href="http://nleyten.com/">http://nleyten.com/</a>.
And this is a link to <a href="http://nleyten.com/">this
blog</a>.
</p>
</blockquote>

</li>

<li>
<b>Section headings:</b>

<p>
Use the [section] tag.  Example:

<pre style="background: #eee">
This is a paragraph.

[section]This is a new section[/section]

This is another paragraph.
</pre>

<p>
Will produce:
</p>

<blockquote style="background: #ffe">
<p>This is a paragraph.</p>
<h1>This is a new section</h1>
<p>This is another paragraph.</p>
</blockquote>

</li>

<li>
<b>Quotations:</b>

<p>
Use the [quote] tag. Example:

<pre style="background: #eee">
This is a normal paragraph.

[quote]
This is a quote.  You can use [b]whatever[/b]
formatting you want inside quotes.

You can even begin new paragraphs and nest
quotes ad infinitum!
[/quote]

This is again a normal paragraph.
</pre>

<p>
Will produce:
</p>

<blockquote style="background: #ffe">
<p>This is a normal paragraph.</p>
<blockquote>
<p>This is a quote.  You can use <b>whatever</b> formatting you want inside quotes.</p>
<p>You can even begin new paragraphs and nest quotes ad infinitum!</p>
</blockquote>
<p>This is again a normal paragraph.</p>
</blockquote>

</li>

<li>
<b>Code blocks:</b>

<p>
You can use the [code] tag to delimit blocks that should
be displayed verbatim.  This is particularly useful for
displaying source code.  Example:
</p>

<pre style="background: #eee">
This is a normal paragraph.

[code]
type block = Paragraph | Section | Quote | Code

let block_of_string = function
	| "paragraph"	-&gt; Paragraph
	| "section"	-&gt; Section
	| "quote"	-&gt; Quote
	| "code"	-&gt; Code
	| _		-&gt; raise Invalid_argument
[/code]

This is again a normal paragraph.
</pre>

<p>
Will produce:
</p>

<blockquote style="background: #ffe">
<p>This is a normal paragraph.</p>
<pre>
type block = Paragraph | Section | Quote | Code

let block_of_string = function
	| "paragraph"	-&gt; Paragraph
	| "section"	-&gt; Section
	| "quote"	-&gt; Quote
	| "code"	-&gt; Code
	| _		-&gt; raise Invalid_argument
</pre>
<p>This is again a normal paragraph.</p>
</blockquote>

</li>

<li>
<b>Unordered lists:</b>

<p>
Use the [list] tag to mark the beginning of an unordered
list. The tag [*] is used to mark each item, and [/list]
ends the list.  Example:
</p>

<pre style="background: #eee">
This is a normal paragraph.

[list]
[*] This is an item;
[*] This is also an item;
[*] And this too is an item.
[/list]

This is again a normal paragraph.
</pre>

<p>
Will produce:
</p>

<blockquote style="background: #ffe">
<p>This is a normal paragraph.</p>
<ul>
<li> This is an item;</li>
<li> This is also an item;</li>
<li> And this too is an item.</li>
</ul>
<p>This is again a normal paragraph.</p>
</blockquote>

</li>

<li>
<b>Ordered lists:</b>

<p>
Ordered lists (or enumerations) are in all similar to
unordered lists.  The only difference is that [enum]
is used as the tag. Example:
</p>

<pre style="background: #eee">
This is a normal paragraph.

[enum]
[*] This is an item;
[*] This is also an item;
[*] And this too is an item.
	[list]
	[*] This belongs in a sublist;
	[*] This too.
	[/list]
[/enum]

This is again a normal paragraph.
</pre>

<p>
Will produce:
</p>

<blockquote style="background: #ffe">
<p>This is a normal paragraph.</p>
<ol>
<li> This is an item;</li>
<li> This is also an item;</li>
<li> And this too is an item.
	<ul>
	<li>This belongs in a sublist;</li>
	<li>This too.</li>
	</ul>
</ol>
<p>This is again a normal paragraph.</p>
</blockquote>

</li>

<li>
<b>Formal grammar:</b>

<p>
Below you will find the Ocaml type definitions that
describes a document (either a story or a comment).  As you
can see, a document is composed of a series of blocks,
where each block is either a text paragraph, or one of
the special blocks (such as section headings, quotations,
code, etc).  Particularly of relevance is the fact that
quotations and lists (both ordered and unordered) accept
entire documents as children.  You can therefore recurse
all you want.
</p>

<pre>
type text_t = string
type link_t = string

type inline_t = node_t list
 and node_t =
          Text of text_t
        | Bold of inline_t
        | Emph of inline_t
        | Sup of inline_t
        | Sub of inline_t
        | Link of link_t * text_t

type fragment_t = block_t list
 and block_t =
          Paragraph of inline_t
        | Section of inline_t
        | Quote of fragment_t
        | Code of text_t
        | Listing of fragment_t list
        | Enum of fragment_t list

type t = fragment_t
</pre>

]]></content>
	</entry>
	<entry>
		<title>And now for something completely amazing (or the beginning thereof)</title>
		<link rel="alternate" href="http://nleyten.com/2008/01/11/and-now-for-something-completely-amazing-or-the-beginning-thereof.aspx" />
		<id>tag:nleyten.com,2008-01-11:50d3904b-17cd-4168-affe-6938e526743a</id>
		<author>
			<name>Dario Teixeira</name>
		</author>
		<updated>2008-01-11T16:57:02Z</updated>
		<published>2008-01-11T16:53:00Z</published>
		<content type="html"><![CDATA[<br>

<img src="http://images.quickblogcast.com/34419-32102/kde_4_0_banner.png" border="0" width="427">

<p>

I previously reported on the upcoming new version of the
KDE project.  Today, version 4.0 was officially released.
See <a href="http://www.kde.org/announcements/4.0/">the
announcement</a>, take <a href="http://www.kde.org/announcements/4.0/guide.php">a
guide tour</a> of the new features,
and follow the discussion at the <a href="http://dot.kde.org/1200050369/">"Dot"</a>.

</p>

<p>

There's still a few rough edges here and there, and is not
as functional as 3.5.8 (yet!).  It is therefore targeted
mainly at developers and enthusiasts.  Regular users should
wait until 4.1 till they decide to make it their main
desktop.  It is however, without a doubt, the beginning
of something amazing...

</p>

<p>

You can of course try it out immediately without having to
install anything onto your computer thanks to the variety
of live CDs that are being released.  The Kubuntu folks <a href="http://kubuntu.org/announcements/kde-4.0.php">have
one out</a> and <a href="http://home.kde.org/%7Ebinner/kde-four-live/">so do of
course</a> the OpenSuse guys.  Other distros are following
suit as we speak.

</p>

<p>

Anyway, congratulations are in order to all the developers
of the KDE project!  I can't believe it's been almost
10 years since I first installed one of the betas for
KDE 1.0.  We've sure come a long way...  (World domination
proceeding as scheduled).

</p>
]]></content>
	</entry>
	<entry>
		<title>Nleyten@1200: all of the above (almost)</title>
		<link rel="alternate" href="http://nleyten.com/2007/12/31/nleyten1200-all-of-the-above-almost.aspx" />
		<id>tag:nleyten.com,2007-12-31:b0349a4a-9bca-4c80-afb6-d458960b2b9a</id>
		<author>
			<name>Dario Teixeira</name>
		</author>
		<updated>2007-12-31T14:35:51Z</updated>
		<published>2007-12-31T14:34:00Z</published>
		<content type="html"><![CDATA[<br>
<p>

Question: what sort of markup should we use for stories
and comments?  Here are some popular choices:

</p>

<ul>

<li><b>HTML:</b> It has the advantage of being so common
that most people are at least familiar with the idea of
adorning text with &lt;b&gt;, &lt;i&gt;, and such tags.
It has the disadvantage that HTML tends to be awfully
verbose (damn you XML!) and ugly.</li>

<li><b>BBCode:</b> Similar to HTML, but using a different
notation for tags and a much saner (though more limited)
way to delimit paragraphs.  It has the additional advantage
of having become fairly popular across Internet forums,
and being therefore very familiar.</li>

<li><b>LaTeX:</b> A lot less verbose than HTML and BBCode,
and a lot more readable even for large documents.  It has
the disadvantage that "kids these days" are not quite so
familiar with it.</li>

<li><b>Wiki:</b> It makes the basic formatting simple, but
the slightly more complex a nightmare to read and to parse.
I can easily build examples that are ambiguous for a human
to parse, much less a computer!</li> </ul>

<p>

The answer: Lambdium will accept all of the above, with
the possible exception of Wiki markup.  The reason is that
the first three are very similar parsing-wise, and I have
in fact already built working parsers for them.  As for
the Wiki markup, the situation is more complex.  The main
difficulty is that there's no simple way to express in
Wiki markup the complex structure that Lambdium accepts
for documents.  I was therefore faced with a choice of
a) extending the Wiki markup in a non-standard way so it
becomes more expressive, b) making Wiki-formatted documents
not as expressive as their siblings, or c) drop it for now,
and consider options a) or b) in the future if there's
enough demand for this markup.  I have chosen c).

</p>

<p>

As for the Subversion log for revision 1200, it reads
"BBcode parser now integrated into Lambdium-light".  Yeap,
I've integrated one of the parsers into Lambdium-light
(it previously accepted only text without formatting).
I've picked only one because Lambdium-light is supposed to
remain "light", obviously!  In addition, I didn't include
in the grammar some of the more advanced constructs (such
as tables, figures, citations, and cross-references),
because they would only make it more complex and
Lambdium-light is also supposed to be easy to learn.

</p>

<p>

If you're curious, here's the Ocaml definition of the
document structure for Lambdium-light's comments and
stories (note: Document.t = fragment_t).  As you can see,
a document is just a list of blocks; each block is either a
simple paragraph, or one of the compound blocks.  Some of
the latter can be as complex as to include fragment_t
in their definition (yeap, fragment_t is recursively
defined!).  As you can see, this simple definition allows
for document trees extremely complex — hopefully
as complex as required to express all conceivable stories
and comments.

</p>

<pre>type text_t = string<br>type link_t = string<br><br>type inline_t = node_t list<br> and node_t =<br>          Text of text_t<br>        | Bold of inline_t<br>        | Emph of inline_t<br>        | Sup of inline_t<br>        | Sub of inline_t<br>        | Url of link_t * inline_t<br><br>type fragment_t = block_t list<br> and block_t =<br>          Paragraph of inline_t<br>        | Section of inline_t<br>        | Quote of fragment_t<br>        | Code of text_t<br>        | Listing of fragment_t list<br>        | Enum of fragment_t list<br><br>type t = fragment_t<br></pre>
]]></content>
	</entry>
	<entry>
		<title>The bitter aftertaste of syntactic sugar</title>
		<link rel="alternate" href="http://nleyten.com/2007/12/20/the-bitter-aftertaste-of-syntactic-sugar.aspx" />
		<id>tag:nleyten.com,2007-12-20:cb5b18fb-580a-440d-b604-3868a8ee55e0</id>
		<author>
			<name>Dario Teixeira</name>
		</author>
		<updated>2007-12-20T18:35:55Z</updated>
		<published>2007-12-20T18:25:00Z</published>
		<content type="html"><![CDATA[<br/>

<p>

I am not particularly fond of <a href="http://en.wikipedia.org/wiki/Syntactic_sugar">syntactic sugar</a>.
Granted, there's the bare minimum of sweetness that a language should
have, but anything beyond that — no matter how tempting it is to
include it in the language definition — is only likely to bring
you pain in the long term (if you're looking for an example, then look
no further than Perl, whose sugary excesses resulted in a language
whose programmes have been described as "looking like an explosion in
a punctuation factory").  

</p>

<p>

The Ocaml language makes for an interesting case study in this regard.
While the core language is sprinkled with a fair share of sugary
treats*, it still makes for a reasonably lean language.  However,
this does not mean that a programmer can't use their favourite
non-standard candy (be it list comprehensions, for-in loops, <a href="http://en.wikipedia.org/wiki/Memoization">memoization</a>, or
whatever else) with Ocaml.  So, how can we solve this apparent dietary
paradox?

</p>

<p>

Enter Camlp4.

</p>

<p>

Camlp4 (and Camlp5, which confusingly is not the successor, but rather
the continuation of the old pre-3.10 Camlp4) is one of those tools whose
significance is understated and often completely overlooked by newcomers
to the Ocaml language.  So what does it do?  In brief, it allows the
programmer to create syntax extensions to the Ocaml language in such a
way that they integrate seamlessly with the core language.  Think of it as
the C preprocessor on steroids.

</p>

<p>

If you're curious, check
<a href="http://martin.jambon.free.fr/p4ck.list.html">this list</a>
for just some examples of the syntax extensions that
people have created for Ocaml.  Another great example is of course <a href="http://developer.berlios.de/projects/pgocaml/"> PG'OCaml</a>,
which extends Ocaml's syntax with the ability to directly embed SQL
statements, with compile-time checking of consistency between the Ocaml
code and the PostgreSQL database (which is of course contacted at compile-time:
think how cool that is!).

</p>

<p>

On a deeper level, tools like Camlp4 allow the definition of languages
whose core is lean and mean, but without sacrificing the possibility
of using syntactic sugar when it is justified.  And this is for me the
greatest lesson of Camlp4 to the designers of future languages.

</p>

<p>

<sup>*</sup>Check
<a href="http://www.cs.berkeley.edu/%7Eadamc/mlcomp/">this interesting comparison</a>
of Ocaml and Standard ML for more details.
You'll see that while Ocaml is "sweeter" than SML, most of Ocaml's sugar
additions tend to be well justified.

</p>
]]></content>
	</entry>
	<entry>
		<title>Proposition #5</title>
		<link rel="alternate" href="http://nleyten.com/2007/12/01/proposition-5.aspx" />
		<id>tag:nleyten.com,2007-12-01:0d8ca54e-403e-41e4-a1d8-0d79d3ef79b5</id>
		<author>
			<name>Dario Teixeira</name>
		</author>
		<updated>2007-12-01T15:11:33Z</updated>
		<published>2007-12-01T14:51:00Z</published>
		<content type="html"><![CDATA[<br>

<cite>
Many a journalist has fallen victim to the fallacy that in order to provide an objective account
of any issue one must dedicate equal time to all viewpoints on that issue.
</cite>

<p>
This is one of my major gripes with the current state of the media.  I would like to believe there is no malice in most reporters misunderstanding the nature of their profession, and that this attitude simply boils down to the lingering poisonous effects of Post-modernism.  Sometimes I have my doubts, though.
</p>

<p>
There are fortunately those who escape this widespread fallacy.  <a href="http://www.salon.com/opinion/greenwald/">Glenn Greenwald</a> from <a href="http://www.salon.com/">Salon magazine</a> is one of them.  And in a brilliant <a href="http://www.salon.com/opinion/greenwald/2007/11/30/real_reporting/index.html">recent article</a> he touches on this very subject. The context  is (surprise, surprise) the orgy of falsehoods that is dominating the run-up to next year's American election. Interesting read.
</p>
]]></content>
	</entry>
	<entry>
		<title>Nleyten@1100: timezones and rainbows</title>
		<link rel="alternate" href="http://nleyten.com/2007/11/21/nleyten1100-timezones-and-rainbows.aspx" />
		<id>tag:nleyten.com,2007-11-21:336b7ad1-65ab-491c-8bb2-237c178017e7</id>
		<author>
			<name>Dario Teixeira</name>
		</author>
		<updated>2007-11-21T13:48:41Z</updated>
		<published>2007-11-21T13:46:00Z</published>
		<content type="html"><![CDATA[<br>

<p>

SVN commit 1100 reads <em>"Added support for timezones
in the database (including accessory tables and API
functions)"</em>.  Yeap, I spent some time adding proper
support for timezones in the database.  The idea is of
course that while the timestamps for stories and comments
are stored in universal time (UTC), users typically prefer
to see their own local times.  It should have been an easy
addition, but it did take some time and effort because
of the slightly messy way that timezones are handled
by PostgreSQL.  But anyway, it's done!

</p>

<p>

Between revisions and 1000 and 1100, lots of other more
exciting stuff happened.  A barebones but working version
of Lambdium (called Lambdium-light) was born, and I made <a href="http://sympa.pps.jussieu.fr/wws/arc/ocsigen/2007-11/msg00003.html">an
unofficial release </a> of a beta version in the
Ocsigen mailing list.  (Once it hits 1.0, I'll do a
more formal announcement and explain the differences
between Lambdium and Lambdium-light).  I also
implemented support for strong crypto to store user
passwords in the database (passwords are salted and
digested through a time-consuming hash function).
The idea is of course to prevent the infamous <a href="http://en.wikipedia.org/wiki/Rainbow_table">"rainbow
table"</a> attack should the database ever be compromised.

</p>
]]></content>
	</entry>
	<entry>
		<title>Gaia is a tough bitch*</title>
		<link rel="alternate" href="http://nleyten.com/2007/10/29/gaia-is-a-tough-bitch.aspx" />
		<id>tag:nleyten.com,2007-10-29:4bb6300e-96aa-42ca-83dd-6230f4944acc</id>
		<author>
			<name>Dario Teixeira</name>
		</author>
		<updated>2007-10-29T21:48:38Z</updated>
		<published>2007-10-29T21:45:00Z</published>
		<content type="html"><![CDATA[<br>
<p>
As a follow-up to the posts about the peak oil, I've been
meaning to write a rebuttal to the more pessimistic
views concerning the effects not only of peak oil
but also of climate change.  Stay tuned for that.
In the meantime — and so that you are familiar
with the views professed by the prophets of impeding
doom— I strongly suggest you read three articles.  <a href="http://www.rollingstone.com/politics/story/16956300/the_prophet_of_climate_change_james_lovelock">
The first</a> is about James Lovelock (yes, that "Gaia"
fellow), and briefly summarises his argument of why the
consequences of climate change will be far worse (and
probably happen much sooner) than generally acknowledged.
<a href="http://canada.theoildrum.com/node/2516">The
second</a>, by Paul Chefurka, touches on the "elephant
in the room" issue, namely the fact that the current
human population levels (6.6x10^9 and rising) are far
beyond the natural carrying capacity of the planet,
and that only thanks to fossil fuels have we been
able to "cheat" nature.  His article goes into great
lengths (almost to the point of being morbid) about the
implications of peak oil for those population numbers. <a href="http://jameshowardkunstler.typepad.com/clusterfuck_nation/2007/10/assumptions.html">The
last suggested article</a> was written just today by
the master of pessimism himself, James Howard Kunstler.
As usual, while he does make a few good points, his overly
colourful language and gratuitous use of hyperboles makes
it difficult not to portray him as a caricature.  Though I
am sure this is the complete opposite of his intention,
Kunstler's writing often crosses the border into comical
territory.
</p>
<p>
<sup>*</sup>A quote from James Lovelock, himself quoting an anonymous colleague.
It roughly translates into "the planet is fine; it's the people that are screwed".
</p>
]]></content>
	</entry>
	<entry>
		<title>A somewhat rusty nail</title>
		<link rel="alternate" href="http://nleyten.com/2007/10/11/a-somewhat-rusty-nail.aspx" />
		<id>tag:nleyten.com,2007-10-11:59ce30f2-868f-4511-bc37-80e1f580d610</id>
		<author>
			<name>Dario Teixeira</name>
		</author>
		<updated>2007-10-11T14:41:04Z</updated>
		<published>2007-10-11T14:37:00Z</published>
		<content type="html"><![CDATA[<br>

<p>

I just bought Radiohead's last album,
<a href="http://www.inrainbows.com/"><em>"In
Rainbows"</em></a>.  Note that I use the word "bought"
in a very unconventional sense: so far, the album
is available only via a digital download from <a href="http://www.inrainbows.com/">their website</a>.
There are no intermediaries in this transaction: to hell
with the record companies and the hardly less morally
corrupt iTunes.  Moreover — and this is the truly
outstanding aspect — the price of the album is
set by the customer.  You pay what you think is fair.
And £0 is a valid offer.

</p>

<p>

Radiohead are of course to be applauded for this
initiative, and I encourage everyone to support them.
The success of "In Rainbows" will surely be a decisive
nail in the coffin of the recording industry mafia.

</p>

<p>

With the stakes being set so high, you would imagine
the band would have been careful to "do this right".
If the online sales of the album should fail primarily
due to technical mistakes and/or marketing blunders,
that supposedly decisive nail may prove to have been a
rusty one.

</p>

<p>

Unfortunately, they did make a number of serious,
stupid mistakes.  Some are already causing a backlash in
various corners of the "internets", and after having gone
through the album ordering process myself, I can attest
that while not being show-stoppers, these blunders do
cast an unnecessary shadow over what should have been a
glorious initiative:

</p>


<p>

</p><ul>

<li>

Whoever designed their website should be forced to use it.
Though this probably constitutes "cruel and unusual
punishment".  Honestly, are they trying to scare their
customers away?  (Note that I am not talking about the
looks of the website — those are quite nice —
but of its overall usability).

</li>

<li>

The only payment option is by credit card.  Not only does
this incur a fee of £0.45, but forces one to give
credit card details to yet another entity, particularly
one whose security concerns are less then commendable
(see next point).

</li>

<li>

Not only do they force you to register with the site
(why, oh why?!), but they store user passwords <b>in the
clear</b> in their database.  Sorry Radiohead, but this
violates the most basic of security practices.  If whoever
created your online shop were ever to sell their product
in a similar "name your own price" initiative, I sincerely
hope they would accept negative numbers.

</li>

<li>

The music downloads are only 160kpbs MP3.  This seems
to be the point that gets most people fired up; after
all, 192kbps is generally considered to be the minimum
quality-wise.  Personally, I don't think this is that
big of an issue: you can pay for your 160kbps version
<b>now</b>, and once the CDs come out, you can download the
high-quality versions from P2P (which the band won't mind).

</li>

<li>

I hope the bandwidth for your servers has been donated.
Centralised distribution is <b>so</b> 20th century.
You could have distributed CD-quality, lossless versions of
the album on P2P networks.  Not only would this have zero
cost to you, but would have rendered mute all complaints
about quality.

</li>
</ul>]]></content>
	</entry>
	<entry>
		<title>Nleyten@1000: introducing the Lambdium CMS</title>
		<link rel="alternate" href="http://nleyten.com/2007/10/03/nleyten1000-introducing-the-lambdium-cms.aspx" />
		<id>tag:nleyten.com,2007-10-03:43562340-1ed6-4091-b5f7-f902d191b373</id>
		<author>
			<name>Dario Teixeira</name>
		</author>
		<updated>2007-10-03T20:26:50Z</updated>
		<published>2007-10-03T20:23:00Z</published>
		<content type="html"><![CDATA[<br>

<p>

First of all, time for an explanation: Nleyten.com is not
the only community in my plans.  It may not even be the
first one to go "live".  In fact, I am planning a whole
set of communities based on the same guiding principles,
and Nleyten simply happens to be (provisional) umbrella
name for all of them.  These communities will also share
the same backend engine, the one which up till now I have
been informally referring to as the "Nleyten backend" or
"Nleyten CMS".

</p>

<p>

Sooner or later, this practice of using the same name for
the common backend and one of the branches was bound to
cause confusion.  With this in mind, and for a few weeks
now, the backend (and associated frontend stylesheets and
scripts) has been known as "Lambdium" in the Subversion
repository.  Let me thus introduce to you the Lambdium CMS
engine, the one that will power Nleyten and sister sites:

</p>

<img src="images/34419-32102/lambdium_logo.png" border="0" width="240">

<p>

About the name: it's a chemical
element inspired pun on the concept of "<a href="http://en.wikipedia.org/wiki/Lambda_calculus">lambda</a>"
(remember that I am using <a href="http://caml.inria.fr/">OCaml</a>, a functional
programming language).  And since I am using <a href="http://www.ocsigen.org/">Ocsigen</a> (another
chemical element pun) as the web development framework,
"Lambdium" seemed like a perfectly appropriate name.

</p>

<p>

As for the Subversion log at revision 1000, it says that I
"Finished handler refactoring".  It's a bit of a long story
to explain it in English, so it suffices to say that the
Lambdium CMS is slowly taking shape!

</p>
]]></content>
	</entry>
	<entry>
		<title>On a lighter note...</title>
		<link rel="alternate" href="http://nleyten.com/2007/09/28/on-a-lighter-note.aspx" />
		<id>tag:nleyten.com,2007-09-28:f22fdbcc-7fa5-425f-9841-ba2eed0f4637</id>
		<author>
			<name>Dario Teixeira</name>
		</author>
		<updated>2007-09-28T21:57:55Z</updated>
		<published>2007-09-28T21:56:00Z</published>
		<content type="html"><![CDATA[<br>

<p>

I must be growing old, because I've been rediscovering
the pleasure of Pop music (<u>good</u> Pop music,
mind you!), and digging through old stuff I listened
to as a teenager.  Since my last post was <b>waaay</b>
too serious, this time I'll bring you something lighter:
what's on my (<a href="http://amarok.kde.org/">Amarok</a>,
of course!) playlist at the moment.

</p><li>

<a href="http://wc01.allmusic.com/cg/amg.dll?p=amg&amp;sql=10:wpfpxqlaldte">
<strong>The Postal Service — <em>Give up</em></strong></a>

<p>

Though this album has been a frequent presence in my
playlist for the last couple of years now, it still
feels as fresh as ever.  This is what I mean by good
Pop: it's filled with beautiful and uplifting songs,
with just the right touch of sophistication to make them
stand out from the crowd.  Moreover, while the songs
deal with the typical pop subjects, the lyrics never
quite fall into clichés or cheesiness.  There is a
bittersweet hint to them, revealing a mature and talented
writer in Ben Gibbard.  Who else could have written such
a luminous song about nuclear holocaust (<em>'We Will
Become Silhouettes'</em>)?... Or two of the most original
love songs of the decade (<em>'Such Great Heights'</em>
and <em>'Brand New Colony'</em>)?...

</p>

</li>


<li>

<a href="http://wc01.allmusic.com/cg/amg.dll?p=amg&amp;sql=10:hjfqxqqsldfe">
<strong>Boards of Canada — <em>The Campfire Headphase</em></strong></a>

<p>

I have been a fan of this Scottish duo since <em><a href="http://wc09.allmusic.com/cg/amg.dll?p=amg&amp;sql=10:dcfyxqejldfe">Music
Has the Right to Children</a></em>
(a classic in Electronica).  <em><a href="http://wc01.allmusic.com/cg/amg.dll?p=amg&amp;sql=10:hjfqxqqsldfe">The
Campfire Headphase</a></em> is their last album;
while some hard core fans have snubbed its more
accessible and perhaps even more commercial sound
landscapes, this does not detract from the fact that
it is a beautiful album, rich in the dreamy, ethereal
quality that makes the Boards of Canada an obligatory
reference in Electronica. In fact, this album's more
accessible facet might make it a gentler introduction
to the band's music than the sometimes harsh <em><a href="http://wc09.allmusic.com/cg/amg.dll?p=amg&amp;sql=10:dcfyxqejldfe">Music
Has the Right to Children</a></em>
or the somewhat eccentric <em><a href="http://wc09.allmusic.com/cg/amg.dll?p=amg&amp;sql=10:0bftxqq0ldje">Geogaddi</a></em>
(which I also very much like anyway!).

</p>

</li>


<li>
<a href="http://wm09.allmusic.com/cg/amg.dll?p=amg&amp;sql=10:azfexqu0ld0e">
<strong>Zero 7 — <em>Simple Things</em></strong></a>

<p>

This is quite an old one, and an album I came back to every
now and again.  It's probably one of the most interesting
albums to have come out from the post-Trip Hop era, and
tracks like <em>'Destiny'</em> or <em>'In the Waiting
Line'</em> should definitely be on anyone's list of the
best pop songs ever.

</p>

</li>

<li>

<a href="http://wm09.allmusic.com/cg/amg.dll?p=amg&amp;sql=10:gpfrxqlkld6e">
<strong>Rachel's — <em>Selenography</em></strong></a>

<p>

There's something about the first chords of <em>'A French
Galleasse'</em> (the first track) that raises the hair
in the back of the neck.  This is an enthralling album,
dense and mysterious. Even its genre is hard to pin down:
describing it as 'experimental rock' does not do justice
to its multilayered texture.  Try it, but beware: you
might get hooked.

</p>

</li>

<li>

<a href="http://wm09.allmusic.com/cg/amg.dll?p=amg&amp;sql=10:dpfqxq9hld0e">
<strong>The Young Gods — <em>Only Heaven</em></strong></a>

<p>

I loved this album when I was a teenager.  Even then I
could tell that its lyrics are completely meaningless,
but who cares when there's such raw, primal energy in
these songs?...

</p>

</li>

]]></content>
	</entry>
</feed>