<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Juggling, Photography, Software, and Atheism</title>
	<atom:link href="http://schani.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://schani.wordpress.com</link>
	<description>and little else</description>
	<lastBuildDate>Sat, 11 Jul 2009 22:49:54 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language></language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='schani.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/5e14e106cb5ca7ade187797bc9282e40?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Juggling, Photography, Software, and Atheism</title>
		<link>http://schani.wordpress.com</link>
	</image>
			<item>
		<title>The ICFP Programming Contest 2009</title>
		<link>http://schani.wordpress.com/2009/07/11/the-icfp-programming-contest-2009/</link>
		<comments>http://schani.wordpress.com/2009/07/11/the-icfp-programming-contest-2009/#comments</comments>
		<pubDate>Sat, 11 Jul 2009 22:49:54 +0000</pubDate>
		<dc:creator>schani</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[icfp]]></category>
		<category><![CDATA[ocaml]]></category>
		<category><![CDATA[programming contest]]></category>
		<category><![CDATA[satellites]]></category>

		<guid isPermaLink="false">http://schani.wordpress.com/?p=91</guid>
		<description><![CDATA[<p>Two weeks ago the annual <a href="http://icfpcontest.org/">ICFP Programming Contest</a> took place and, once again, the glorious team <a href="http://schani.wordpress.com/2006/07/24/the-icfp-programming-contest-2006/">Funktion im Kopf der Mensch</a> participated.</p>

<p>This year's <a href="http://icfpcontest.org/task-1.9.pdf">task</a> was to control a satellite orbiting the earth in two-dimensional space and make it meet a few increasingly difficult goals.  We were given the specification of a very simple virtual machine and a few programs for that machine, which simulate the motions of the satellite to be controlled and of zero or more target satellites (and later also of the moon).  Each run of such a program simulates a timestep of one second and outputs various data, such as the satellite's positions, the remaining fuel and the score via variables called "output ports".  Commands can be given via "input ports".  Apart from the "scenario selection" command before the first timestep the only commands that can be given are thruster actuations, which are only limited by the available fuel, i.e. the whole remaining fuel can be spent in one timestep if necessary.</p>

<p>The first problem was a transfer from one circular orbit around the earth into another circular one and to stay in that orbit within a radius of one kilometer for 900 seconds.  A very simple and efficient way of achieving such an orbit change is the <a href="http://en.wikipedia.org/wiki/Hohmann_transfer">Hohmann transfer</a>, which requires only two thrusts.  Here's what it looks like in our visualization tool:</p>

<img alt="Screenshot" src="http://www.complang.tuwien.ac.at/schani/blog/icfp2009/orbsim-hohmann.png">

<p>It wasn't too hard to correctly perform this transfer, but already a few problems cropped up.  Using the formulae for calculating the thrusts for a Hohmann transfer analytically we saw that the simulated orbits differed a tiny bit from what they would be in reality, which was enough to throw us off by more than one kilometer.</p>

<p>Another approach we followed was to find the correct thrust by simply trying out some value, simulating the flight path of the satellite and, depending on whether our flight was too short or too long, adjust the thrust, until we arrived at the correct distance within some arbitrary tolerance.  We discovered that by doing this binary search we could find the thrust to bring us within one micrometer of the mark.</p>

<p>For the second problem we again had to transfer from a circular to another circular orbit, but this time we had to meet with another satellite there.  In other words, not only did we have to get to the right place, but also at the right time.</p>

<p>A very simple approach to this problem is to just wait until the two satellites are lined up in such a way that when our satellite does the transfer, it arrives in the target orbit at exactly the location of the target satellite at that time.  The downside of this solution is that the wait might be a very long one.</p>

<p>To avoid having to wait one can instead do a <a href="http://en.wikipedia.org/wiki/Bi-elliptic_transfer">bi-elliptic transfer</a>, which requires three thrusts and first transports the satellite into a higher (or lower) elliptical orbit which can be freely chosen within some limits.  Because the height of that orbit determines how long it takes the satellite to come back, we can choose an orbit which exactly makes up for the time difference in the target orbit between the two satellites.  Here's what it looks like:</p>

<img alt="Screenshot" src="http://www.complang.tuwien.ac.at/schani/blog/icfp2009/orbsim-meetgreet.png">

<p>The third problem is like the second one, except that the orbits are not circular anymore, but elliptical, which requires some intricate navigation.  We came up with this maneuver:</p>

<img alt="Blackboard" src="http://www.complang.tuwien.ac.at/schani/blog/icfp2009/ellman.jpg">

<p>We start out in the elliptical orbit between points A and B and want to meet the target satellite at point E.  The trick here is point C, which we can choose arbitrarily high or low, to adjust our timing, like in the second problem.  By searching for the correct thrusts this works out pretty well, more or less, and looks like this:</p>

<img alt="Screenshot" src="http://www.complang.tuwien.ac.at/schani/blog/icfp2009/orbsim-eccmeetgreet.png">

<p>When working on this problem we came upon an approach we should have though of much earlier: Just blindly follow the target satellite, orbital mechanics be damned.  Doing this correctly is not entirely trivial, but much simpler than calculating thrusts, and in cases where the satellites are close, it works amazingly well:</p>

<img alt="Screenshot" src="http://www.complang.tuwien.ac.at/schani/blog/icfp2009/orbsim-follower1.png">

<p>It can also gives some very amusing results when they're not close:</p>

<img alt="Screenshot" src="http://www.complang.tuwien.ac.at/schani/blog/icfp2009/orbsim-follower2.png">

<p>Here our satellite, which, left on its own, would have remained in a comparatively low orbit, makes a 90 degree turn to catch up with the satellite in the much higher orbit, and once it's close to it, makes another 90 degree turn to follow it.</p>

<p>At this point we hit our biggest hold-up.  The organizers of the competition had set up a system for submitting traces of the instructions given to the satellite, the scores of which were displayed on a publicly visible scoreboard, so the teams could compare their progress.  The other function that this system served for the teams was to be able to verify their implementations of their virtual machines.  When submitting this trace, and various variations of it, we always got the automatic reply that it "CRASHED", so naturally we assumed that our virtual machine was at fault, and spent hours upon hours trying to identify the problem or to work around it.  The issue wasn't cleared up until after the contest was over, and I'll discuss it below.</p>

<p>The fourth and last problem was to meet not one but 11 satellites in various orbits.  Originally the specification mentioned 12 satellites, and the fact that the 12th satellite didn't move relative to ours, combined with our earlier problems, convinced us even more that our virtual machine was faulty, so we spent even more time trying to find the issue.  Alas, the error in the specification was corrected and we continued working on the rendezvous.</p>

<p>Two complications in this problem were that the satellite's fuel was very limited and that there was the moon, in addition to the earth, exerting gravity.  To get by with the satellite's small fuel tank, there was a fueling station in low earth orbit which would refuel the satellite on contact, so we could meet one or two satellites and then return to refuel, etc.</p>

<p>We tried meeting a few satellites with the maneuver we had developed for problem three, but soon discovered that for the satellites in the outer orbits, we were very far off our mark.  We had calculated the time-delay point not by doing the simulation, but with a simple formula, which worked perfectly for problem three, but in problem four our orbits were distorted by the moon, so that we could easily be off by a hundred seconds, which is quite a lot for a satellite that travels at several kilometers per second.  In addition to that, the points at which we thrusted were no longer necessarily the apsides of the orbits, so the error accumulated.  Even for the satellites in lower orbits our path would be distorted enough to spoil the rendezvous with the fueling station, so we used the simple follower algorithm to catch up with it.  Here we ran into another issue: The fueling station was in a very low orbit, and the follower algorithm was not concerned with orbits at all, so when it had done its job it would sometimes leave us on a collision course with earth, which we had to correct.</p>

<p>At this point there were only a few hours left until the end of the contest, but we came up with two new, very simple approaches.  The first was to do only simple transfers from circular to circular orbits (as circular as the moon's gravity permits), to meet the target satellites in those orbits and to do time-delays by transferring into lower or higher elliptical orbits and then back into the circular orbits again.  All these transfers would be exactly calculated by our binary search method, so there would be very little that could go wrong.</p>

<p>The second approach was to do our more complicated maneuver, but instead of single thrusts to go from orbit to orbit, suffering from the moon's gravity, we would calculate the orbits as if there was no moon and then use our follower algorithm to chase a "virtual" satellite traveling along those orbits.  All we had to do was to calculate them correctly and the follower algorithm would do the rest. The only question remaining was whether it wouldn't waste too much fuel doing corrective thrusts.  Our first tests suggested that it would work just fine.  Unfortunately time ran out and we weren't able to finish either algorithm.</p>

<p>I mentioned earlier that the problems we had with our virtual machine were eventually resolved, but only after the contest had ended.  In fact, we had two almost completely independent virtual machine implementations - one an interpreter written in OCaml, the other a compiler written in Python, which generates C code.  Both VMs gave exactly the same results on our traces, whereas submitting them always failed.</p>

<p>We did our best to find the bug.  We examined our code multiple times, ran it on different machines to see if the floating point math might be the culprit, tried other team's traces that were made public by them.  When we found nothing we contacted the organizers, mailed them our traces, described our problems and asked them to give us more information about why our traces failed, but all we got back was the equivalent of "Sorry, we can't help you.".  All the information we ever got from the submission system was "CRASHED".</p>

<p>After the contest we were contacted Andy Gill, the contest's chair. He sent us their virtual machine implementation, which, on my machines, accepted our traces just fine.  I asked him to try our trace on his machine, where it also worked fine.  In the end it transpired that their submission system had a bug and would silently truncate all traces to 64K.</p>

<p>Drawing a conclusion over the contest I must say that the task was interesting and well chosen, but that the contest was organized and executed very poorly.  The task description made the impression of not having gone through a single round of testing, the submission system gave no feedback as to why a submission failed, making it very hard to find problems in the virtual machine (or, as would have been even more important, in the submission system itself) and trying to get non-trivial information from the organizers during the contest was essentially impossible.  I do realize that organizing such a contest is a huge and difficult task, but out of the eight ICFP programming contests I've participated in, this was the worst-organized one.</p>

<p>Which means that next year it's almost certainly going to be much better - hurray!</p>
<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=schani.wordpress.com&blog=143659&post=91&subd=schani&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Two weeks ago the annual <a href="http://icfpcontest.org/">ICFP Programming Contest</a> took place and, once again, the glorious team <a href="http://schani.wordpress.com/2006/07/24/the-icfp-programming-contest-2006/">Funktion im Kopf der Mensch</a> participated.</p>
<p>This year&#8217;s <a href="http://icfpcontest.org/task-1.9.pdf">task</a> was to control a satellite orbiting the earth in two-dimensional space and make it meet a few increasingly difficult goals.  We were given the specification of a very simple virtual machine and a few programs for that machine, which simulate the motions of the satellite to be controlled and of zero or more target satellites (and later also of the moon).  Each run of such a program simulates a timestep of one second and outputs various data, such as the satellite&#8217;s positions, the remaining fuel and the score via variables called &#8220;output ports&#8221;.  Commands can be given via &#8220;input ports&#8221;.  Apart from the &#8220;scenario selection&#8221; command before the first timestep the only commands that can be given are thruster actuations, which are only limited by the available fuel, i.e. the whole remaining fuel can be spent in one timestep if necessary.</p>
<p>The first problem was a transfer from one circular orbit around the earth into another circular one and to stay in that orbit within a radius of one kilometer for 900 seconds.  A very simple and efficient way of achieving such an orbit change is the <a href="http://en.wikipedia.org/wiki/Hohmann_transfer">Hohmann transfer</a>, which requires only two thrusts.  Here&#8217;s what it looks like in our visualization tool:</p>
<p><img alt="Screenshot" src="http://www.complang.tuwien.ac.at/schani/blog/icfp2009/orbsim-hohmann.png"></p>
<p>It wasn&#8217;t too hard to correctly perform this transfer, but already a few problems cropped up.  Using the formulae for calculating the thrusts for a Hohmann transfer analytically we saw that the simulated orbits differed a tiny bit from what they would be in reality, which was enough to throw us off by more than one kilometer.</p>
<p>Another approach we followed was to find the correct thrust by simply trying out some value, simulating the flight path of the satellite and, depending on whether our flight was too short or too long, adjust the thrust, until we arrived at the correct distance within some arbitrary tolerance.  We discovered that by doing this binary search we could find the thrust to bring us within one micrometer of the mark.</p>
<p>For the second problem we again had to transfer from a circular to another circular orbit, but this time we had to meet with another satellite there.  In other words, not only did we have to get to the right place, but also at the right time.</p>
<p>A very simple approach to this problem is to just wait until the two satellites are lined up in such a way that when our satellite does the transfer, it arrives in the target orbit at exactly the location of the target satellite at that time.  The downside of this solution is that the wait might be a very long one.</p>
<p>To avoid having to wait one can instead do a <a href="http://en.wikipedia.org/wiki/Bi-elliptic_transfer">bi-elliptic transfer</a>, which requires three thrusts and first transports the satellite into a higher (or lower) elliptical orbit which can be freely chosen within some limits.  Because the height of that orbit determines how long it takes the satellite to come back, we can choose an orbit which exactly makes up for the time difference in the target orbit between the two satellites.  Here&#8217;s what it looks like:</p>
<p><img alt="Screenshot" src="http://www.complang.tuwien.ac.at/schani/blog/icfp2009/orbsim-meetgreet.png"></p>
<p>The third problem is like the second one, except that the orbits are not circular anymore, but elliptical, which requires some intricate navigation.  We came up with this maneuver:</p>
<p><img alt="Blackboard" src="http://www.complang.tuwien.ac.at/schani/blog/icfp2009/ellman.jpg"></p>
<p>We start out in the elliptical orbit between points A and B and want to meet the target satellite at point E.  The trick here is point C, which we can choose arbitrarily high or low, to adjust our timing, like in the second problem.  By searching for the correct thrusts this works out pretty well, more or less, and looks like this:</p>
<p><img alt="Screenshot" src="http://www.complang.tuwien.ac.at/schani/blog/icfp2009/orbsim-eccmeetgreet.png"></p>
<p>When working on this problem we came upon an approach we should have though of much earlier: Just blindly follow the target satellite, orbital mechanics be damned.  Doing this correctly is not entirely trivial, but much simpler than calculating thrusts, and in cases where the satellites are close, it works amazingly well:</p>
<p><img alt="Screenshot" src="http://www.complang.tuwien.ac.at/schani/blog/icfp2009/orbsim-follower1.png"></p>
<p>It can also gives some very amusing results when they&#8217;re not close:</p>
<p><img alt="Screenshot" src="http://www.complang.tuwien.ac.at/schani/blog/icfp2009/orbsim-follower2.png"></p>
<p>Here our satellite, which, left on its own, would have remained in a comparatively low orbit, makes a 90 degree turn to catch up with the satellite in the much higher orbit, and once it&#8217;s close to it, makes another 90 degree turn to follow it.</p>
<p>At this point we hit our biggest hold-up.  The organizers of the competition had set up a system for submitting traces of the instructions given to the satellite, the scores of which were displayed on a publicly visible scoreboard, so the teams could compare their progress.  The other function that this system served for the teams was to be able to verify their implementations of their virtual machines.  When submitting this trace, and various variations of it, we always got the automatic reply that it &#8220;CRASHED&#8221;, so naturally we assumed that our virtual machine was at fault, and spent hours upon hours trying to identify the problem or to work around it.  The issue wasn&#8217;t cleared up until after the contest was over, and I&#8217;ll discuss it below.</p>
<p>The fourth and last problem was to meet not one but 11 satellites in various orbits.  Originally the specification mentioned 12 satellites, and the fact that the 12th satellite didn&#8217;t move relative to ours, combined with our earlier problems, convinced us even more that our virtual machine was faulty, so we spent even more time trying to find the issue.  Alas, the error in the specification was corrected and we continued working on the rendezvous.</p>
<p>Two complications in this problem were that the satellite&#8217;s fuel was very limited and that there was the moon, in addition to the earth, exerting gravity.  To get by with the satellite&#8217;s small fuel tank, there was a fueling station in low earth orbit which would refuel the satellite on contact, so we could meet one or two satellites and then return to refuel, etc.</p>
<p>We tried meeting a few satellites with the maneuver we had developed for problem three, but soon discovered that for the satellites in the outer orbits, we were very far off our mark.  We had calculated the time-delay point not by doing the simulation, but with a simple formula, which worked perfectly for problem three, but in problem four our orbits were distorted by the moon, so that we could easily be off by a hundred seconds, which is quite a lot for a satellite that travels at several kilometers per second.  In addition to that, the points at which we thrusted were no longer necessarily the apsides of the orbits, so the error accumulated.  Even for the satellites in lower orbits our path would be distorted enough to spoil the rendezvous with the fueling station, so we used the simple follower algorithm to catch up with it.  Here we ran into another issue: The fueling station was in a very low orbit, and the follower algorithm was not concerned with orbits at all, so when it had done its job it would sometimes leave us on a collision course with earth, which we had to correct.</p>
<p>At this point there were only a few hours left until the end of the contest, but we came up with two new, very simple approaches.  The first was to do only simple transfers from circular to circular orbits (as circular as the moon&#8217;s gravity permits), to meet the target satellites in those orbits and to do time-delays by transferring into lower or higher elliptical orbits and then back into the circular orbits again.  All these transfers would be exactly calculated by our binary search method, so there would be very little that could go wrong.</p>
<p>The second approach was to do our more complicated maneuver, but instead of single thrusts to go from orbit to orbit, suffering from the moon&#8217;s gravity, we would calculate the orbits as if there was no moon and then use our follower algorithm to chase a &#8220;virtual&#8221; satellite traveling along those orbits.  All we had to do was to calculate them correctly and the follower algorithm would do the rest. The only question remaining was whether it wouldn&#8217;t waste too much fuel doing corrective thrusts.  Our first tests suggested that it would work just fine.  Unfortunately time ran out and we weren&#8217;t able to finish either algorithm.</p>
<p>I mentioned earlier that the problems we had with our virtual machine were eventually resolved, but only after the contest had ended.  In fact, we had two almost completely independent virtual machine implementations &#8211; one an interpreter written in OCaml, the other a compiler written in Python, which generates C code.  Both VMs gave exactly the same results on our traces, whereas submitting them always failed.</p>
<p>We did our best to find the bug.  We examined our code multiple times, ran it on different machines to see if the floating point math might be the culprit, tried other team&#8217;s traces that were made public by them.  When we found nothing we contacted the organizers, mailed them our traces, described our problems and asked them to give us more information about why our traces failed, but all we got back was the equivalent of &#8220;Sorry, we can&#8217;t help you.&#8221;.  All the information we ever got from the submission system was &#8220;CRASHED&#8221;.</p>
<p>After the contest we were contacted Andy Gill, the contest&#8217;s chair. He sent us their virtual machine implementation, which, on my machines, accepted our traces just fine.  I asked him to try our trace on his machine, where it also worked fine.  In the end it transpired that their submission system had a bug and would silently truncate all traces to 64K.</p>
<p>Drawing a conclusion over the contest I must say that the task was interesting and well chosen, but that the contest was organized and executed very poorly.  The task description made the impression of not having gone through a single round of testing, the submission system gave no feedback as to why a submission failed, making it very hard to find problems in the virtual machine (or, as would have been even more important, in the submission system itself) and trying to get non-trivial information from the organizers during the contest was essentially impossible.  I do realize that organizing such a contest is a huge and difficult task, but out of the eight ICFP programming contests I&#8217;ve participated in, this was the worst-organized one.</p>
<p>Which means that next year it&#8217;s almost certainly going to be much better &#8211; hurray!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/schani.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/schani.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/schani.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/schani.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/schani.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/schani.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/schani.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/schani.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/schani.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/schani.wordpress.com/91/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=schani.wordpress.com&blog=143659&post=91&subd=schani&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://schani.wordpress.com/2009/07/11/the-icfp-programming-contest-2009/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/daf7ba6f06480c52ac459772f2bb5268?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">schani</media:title>
		</media:content>

		<media:content url="http://www.complang.tuwien.ac.at/schani/blog/icfp2009/orbsim-hohmann.png" medium="image">
			<media:title type="html">Screenshot</media:title>
		</media:content>

		<media:content url="http://www.complang.tuwien.ac.at/schani/blog/icfp2009/orbsim-meetgreet.png" medium="image">
			<media:title type="html">Screenshot</media:title>
		</media:content>

		<media:content url="http://www.complang.tuwien.ac.at/schani/blog/icfp2009/ellman.jpg" medium="image">
			<media:title type="html">Blackboard</media:title>
		</media:content>

		<media:content url="http://www.complang.tuwien.ac.at/schani/blog/icfp2009/orbsim-eccmeetgreet.png" medium="image">
			<media:title type="html">Screenshot</media:title>
		</media:content>

		<media:content url="http://www.complang.tuwien.ac.at/schani/blog/icfp2009/orbsim-follower1.png" medium="image">
			<media:title type="html">Screenshot</media:title>
		</media:content>

		<media:content url="http://www.complang.tuwien.ac.at/schani/blog/icfp2009/orbsim-follower2.png" medium="image">
			<media:title type="html">Screenshot</media:title>
		</media:content>
	</item>
		<item>
		<title>Wolfram Alpha disappoints</title>
		<link>http://schani.wordpress.com/2009/05/16/wolfram-alpha-disappoints/</link>
		<comments>http://schani.wordpress.com/2009/05/16/wolfram-alpha-disappoints/#comments</comments>
		<pubDate>Sat, 16 May 2009 15:19:17 +0000</pubDate>
		<dc:creator>schani</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://schani.wordpress.com/?p=86</guid>
		<description><![CDATA[<a href="http://www.wolframalpha.com/">Wolfram Alpha</a>, the much-hyped "computational knowledge engine" by Wolfram Research, the people behind <a href="http://www.wolfram.com/products/mathematica/index.html">Mathematica</a>, went online last night.  I played a bit with it today, and I am disappointed.  Alpha is not what it's cracked up to be.

<h4>Alpha is hard to figure out</h4>

Alpha is supposed to figure out what you mean by your query and present the answer.  Unfortunately, as with every natural language processing system in existence, it often fails to understand you.  In the end, what that means is that you have to learn how Alpha parses language and adjust your input accordingly.

For example, I tried to get Alpha to give me a plot of infant mortality vs gross domestic product.  It doesn't seem to be able to do that, but that's not the point.  Rather, my attempts illustrate the problems with Alpha's language parsing.

One of the examples for Alpha's usage is the comparison between the Pioneer 10 and 11 space probes.  You can enter, for example, "Pioneer 10 vs Pioneer 11", or "Pioneer 10, Pioneer 11" and get the same nice comparison tables.  Enter "infant mortality vs gdp", however, and you get the result "1 child deaths &#124; $54.61 trillion per year".  I don't know what that even means.  Enter "infant mortality, gdp" and you get "5.499x10^7 person children/yr &#124; $54.61 trillion per year", which seems to be the number of infant deaths per year in the whole world (but isn't) and the sum of the GDP's of all countries.  Enter "plot of infant mortality, gdp" or "plot of infant mortality vs gdp" and you get the same nonsensical "1 child deaths &#124; $54.61 trillion per year" answer, but in a slightly different table form.

Interestingly, if you're interested in mortality rather than infant mortality, Alpha will give you the plot if you ask for "mortality vs gdp" or "mortality, gdp".

Upon closer inspection the problem is that Alpha knows nothing about infant mortality (even though that data is available in Mathematica's <tt>CountryData</tt>) but interprets "infant mortality" as "child multiplied by mortality".  The one number it gave that seemed like it might be the number of infant deaths per year was actually the total number of deaths per year, multiplied by one child, i.e. pure nonsense.

Another thing I tried was something similar to an example they give for finding all words ending with "ager", the query for which is "words ending with ager".  What if I want to find all words containing "ager" instead?  The search "words containing ager" gives a list of words which contain each of the letters in "ager", but not necessarily in that order.  How to get the correct answer, or rather how to correctly pose the question, is anybody's guess.

<h4>Alpha gives wrong data</h4>

Not only does Alpha sometimes give nonsensical answers which look like they might mean something, it also presents completely wrong data now and then.  For example, when asking for information on the Spanish language, it tells us that there are 321.6 million native speakers and 322.3 million speakers in total, which would mean that only 700 thousand people speak Spanish as a second language, or only 0.2% of the total number of speakers.  I find that very hard to believe. According to Alpha, that proportion is 36% for English, 17% for Russian, 12% for German, over 8.6% for Italian and nearly 6% for Turkish.  If we are to believe Alpha there are more people who speak Czech as a second language than there are who speak Spanish non-natively.

But wait - Alpha has a feature which lists the sources of its data! Clicking on that link gives us a list of "Background sources and references" (among them Wikipedia), with the nice hint that those sources might not actually be where the data is from.  As "Primary source" is lists only one item: "Wolfram&#124;Alpha curated data".  In other words, you can either believe Wolfram or find the correct information yourself.

<h4>Alpha doesn't give all data</h4>

To add insult to injury, Alpha also fails to indicate that the data it has is incomplete.  Looking up the German language we are informed that it has 60% lexical similarity to English and 29% to French.  No other languages are given as points of comparison, leading one to believe that those are the two top ones.  However, German is much more closely related to, for example, Dutch, but apparently Alpha doesn't have that data, and it doesn't tell us, either.

<h4>Alpha isn't hyperlinked</h4>

There are almost no hyperlinks or further explanations in the data Alpha spits out, not even for the properties of whatever it is that is presented.  One of the pieces of information on the icosahedron, for example, is its dual polyhedron.  What is a dual polyhedron?  Alpha has no idea.  Wikipedia <a href="http://en.wikipedia.org/wiki/Dual_polyhedron">knows</a>.

<h4>Alpha is incomplete and very biased</h4>

When asked about "Turing", Alpha spits out a short table with biographical data about Alan Turing.  Regarding his work all it seems to know is that he was a mathematician.  "Turing machine" produces no data at all and neither does "Lambda calculus", whereas Alpha seems to know a whole lot about cellular automata, Stephen Wolfram's pet subject.

And, possibly worst of all, Alpha knows nothing about juggling or <a href="http://en.wikipedia.org/wiki/Siteswap">siteswaps</a>.
<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=schani.wordpress.com&blog=143659&post=86&subd=schani&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://www.wolframalpha.com/">Wolfram Alpha</a>, the much-hyped &#8220;computational knowledge engine&#8221; by Wolfram Research, the people behind <a href="http://www.wolfram.com/products/mathematica/index.html">Mathematica</a>, went online last night.  I played a bit with it today, and I am disappointed.  Alpha is not what it&#8217;s cracked up to be.</p>
<h4>Alpha is hard to figure out</h4>
<p>Alpha is supposed to figure out what you mean by your query and present the answer.  Unfortunately, as with every natural language processing system in existence, it often fails to understand you.  In the end, what that means is that you have to learn how Alpha parses language and adjust your input accordingly.</p>
<p>For example, I tried to get Alpha to give me a plot of infant mortality vs gross domestic product.  It doesn&#8217;t seem to be able to do that, but that&#8217;s not the point.  Rather, my attempts illustrate the problems with Alpha&#8217;s language parsing.</p>
<p>One of the examples for Alpha&#8217;s usage is the comparison between the Pioneer 10 and 11 space probes.  You can enter, for example, &#8220;Pioneer 10 vs Pioneer 11&#8243;, or &#8220;Pioneer 10, Pioneer 11&#8243; and get the same nice comparison tables.  Enter &#8220;infant mortality vs gdp&#8221;, however, and you get the result &#8220;1 child deaths | $54.61 trillion per year&#8221;.  I don&#8217;t know what that even means.  Enter &#8220;infant mortality, gdp&#8221; and you get &#8220;5.499&#215;10^7 person children/yr | $54.61 trillion per year&#8221;, which seems to be the number of infant deaths per year in the whole world (but isn&#8217;t) and the sum of the GDP&#8217;s of all countries.  Enter &#8220;plot of infant mortality, gdp&#8221; or &#8220;plot of infant mortality vs gdp&#8221; and you get the same nonsensical &#8220;1 child deaths | $54.61 trillion per year&#8221; answer, but in a slightly different table form.</p>
<p>Interestingly, if you&#8217;re interested in mortality rather than infant mortality, Alpha will give you the plot if you ask for &#8220;mortality vs gdp&#8221; or &#8220;mortality, gdp&#8221;.</p>
<p>Upon closer inspection the problem is that Alpha knows nothing about infant mortality (even though that data is available in Mathematica&#8217;s <tt>CountryData</tt>) but interprets &#8220;infant mortality&#8221; as &#8220;child multiplied by mortality&#8221;.  The one number it gave that seemed like it might be the number of infant deaths per year was actually the total number of deaths per year, multiplied by one child, i.e. pure nonsense.</p>
<p>Another thing I tried was something similar to an example they give for finding all words ending with &#8220;ager&#8221;, the query for which is &#8220;words ending with ager&#8221;.  What if I want to find all words containing &#8220;ager&#8221; instead?  The search &#8220;words containing ager&#8221; gives a list of words which contain each of the letters in &#8220;ager&#8221;, but not necessarily in that order.  How to get the correct answer, or rather how to correctly pose the question, is anybody&#8217;s guess.</p>
<h4>Alpha gives wrong data</h4>
<p>Not only does Alpha sometimes give nonsensical answers which look like they might mean something, it also presents completely wrong data now and then.  For example, when asking for information on the Spanish language, it tells us that there are 321.6 million native speakers and 322.3 million speakers in total, which would mean that only 700 thousand people speak Spanish as a second language, or only 0.2% of the total number of speakers.  I find that very hard to believe. According to Alpha, that proportion is 36% for English, 17% for Russian, 12% for German, over 8.6% for Italian and nearly 6% for Turkish.  If we are to believe Alpha there are more people who speak Czech as a second language than there are who speak Spanish non-natively.</p>
<p>But wait &#8211; Alpha has a feature which lists the sources of its data! Clicking on that link gives us a list of &#8220;Background sources and references&#8221; (among them Wikipedia), with the nice hint that those sources might not actually be where the data is from.  As &#8220;Primary source&#8221; is lists only one item: &#8220;Wolfram|Alpha curated data&#8221;.  In other words, you can either believe Wolfram or find the correct information yourself.</p>
<h4>Alpha doesn&#8217;t give all data</h4>
<p>To add insult to injury, Alpha also fails to indicate that the data it has is incomplete.  Looking up the German language we are informed that it has 60% lexical similarity to English and 29% to French.  No other languages are given as points of comparison, leading one to believe that those are the two top ones.  However, German is much more closely related to, for example, Dutch, but apparently Alpha doesn&#8217;t have that data, and it doesn&#8217;t tell us, either.</p>
<h4>Alpha isn&#8217;t hyperlinked</h4>
<p>There are almost no hyperlinks or further explanations in the data Alpha spits out, not even for the properties of whatever it is that is presented.  One of the pieces of information on the icosahedron, for example, is its dual polyhedron.  What is a dual polyhedron?  Alpha has no idea.  Wikipedia <a href="http://en.wikipedia.org/wiki/Dual_polyhedron">knows</a>.</p>
<h4>Alpha is incomplete and very biased</h4>
<p>When asked about &#8220;Turing&#8221;, Alpha spits out a short table with biographical data about Alan Turing.  Regarding his work all it seems to know is that he was a mathematician.  &#8220;Turing machine&#8221; produces no data at all and neither does &#8220;Lambda calculus&#8221;, whereas Alpha seems to know a whole lot about cellular automata, Stephen Wolfram&#8217;s pet subject.</p>
<p>And, possibly worst of all, Alpha knows nothing about juggling or <a href="http://en.wikipedia.org/wiki/Siteswap">siteswaps</a>.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/schani.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/schani.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/schani.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/schani.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/schani.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/schani.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/schani.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/schani.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/schani.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/schani.wordpress.com/86/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=schani.wordpress.com&blog=143659&post=86&subd=schani&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://schani.wordpress.com/2009/05/16/wolfram-alpha-disappoints/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/daf7ba6f06480c52ac459772f2bb5268?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">schani</media:title>
		</media:content>
	</item>
		<item>
		<title>Austria officially prefers superstition to science</title>
		<link>http://schani.wordpress.com/2009/05/12/austria-officially-prefers-superstition-to-science/</link>
		<comments>http://schani.wordpress.com/2009/05/12/austria-officially-prefers-superstition-to-science/#comments</comments>
		<pubDate>Tue, 12 May 2009 21:20:13 +0000</pubDate>
		<dc:creator>schani</dc:creator>
				<category><![CDATA[Atheism]]></category>
		<category><![CDATA[Politics]]></category>

		<guid isPermaLink="false">http://schani.wordpress.com/?p=83</guid>
		<description><![CDATA[<a href="http://www.nature.com/news/2009/090508/full/news.2009.459.html">Austria cannot affort to participate in CERN anymore</a>.  We simply cannot spare the 17 million Euros per year to finance the probably most important and exciting experiment in physics right now because we need to relieve the tax burden on membership fees to, say, a homophobic organization whose leader proclaims that <a href="http://www.guardian.co.uk/world/2009/mar/17/pope-africa-condoms-aids">condoms will increase the spread of HIV</a>.  Or to an <a href="http://wwrn.org/article.php?idd=30879">organization</a> that maintains that using blood transfusions to treat an ill child is immoral.  And those tax reliefs cost us 30 million Euros, so sorry, science - we can't afford you anymore.
<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=schani.wordpress.com&blog=143659&post=83&subd=schani&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://www.nature.com/news/2009/090508/full/news.2009.459.html">Austria cannot affort to participate in CERN anymore</a>.  We simply cannot spare the 17 million Euros per year to finance the probably most important and exciting experiment in physics right now because we need to relieve the tax burden on membership fees to, say, a homophobic organization whose leader proclaims that <a href="http://www.guardian.co.uk/world/2009/mar/17/pope-africa-condoms-aids">condoms will increase the spread of HIV</a>.  Or to an <a href="http://wwrn.org/article.php?idd=30879">organization</a> that maintains that using blood transfusions to treat an ill child is immoral.  And those tax reliefs cost us 30 million Euros, so sorry, science &#8211; we can&#8217;t afford you anymore.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/schani.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/schani.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/schani.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/schani.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/schani.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/schani.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/schani.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/schani.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/schani.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/schani.wordpress.com/83/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=schani.wordpress.com&blog=143659&post=83&subd=schani&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://schani.wordpress.com/2009/05/12/austria-officially-prefers-superstition-to-science/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/daf7ba6f06480c52ac459772f2bb5268?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">schani</media:title>
		</media:content>
	</item>
		<item>
		<title>A Solver for Puzzle Quest and Aurora Feint</title>
		<link>http://schani.wordpress.com/2008/12/25/a-solver-for-puzzle-quest-and-aurora-feint/</link>
		<comments>http://schani.wordpress.com/2008/12/25/a-solver-for-puzzle-quest-and-aurora-feint/#comments</comments>
		<pubDate>Thu, 25 Dec 2008 21:07:35 +0000</pubDate>
		<dc:creator>schani</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[games]]></category>
		<category><![CDATA[haskell]]></category>

		<guid isPermaLink="false">http://schani.wordpress.com/?p=76</guid>
		<description><![CDATA[<p><a href="http://www.puzzle-quest.com/">Puzzle Quest</a> and <a href="http://aurorafeint.com/">Aurora Feint</a> are two very similar games.  In both, you have to match three or more square blocks with the same color horizontally or vertically by exchanging two neighboring blocks.  Those matched blocks are then eliminated from the board and the blocks above them fall down to take their place.  Both games have special pre-built maps which challenge the player to clear all blocks.  In Puzzle Quest the difficulty is that only moves which result in matched blocks are permitted, whereas Aurora Feint requires that the challenge be completed with a certain number of moves or less.</p>

<p>Being too lazy to think for myself I wrote a program to solve those maps for me.  I have set up a public <a href="http://www.selenic.com/mercurial/wiki/">Mercurial</a> repository for it at <a href="http://hg.13thfloor.at/hg/puzzlequest/">http://hg.13thfloor.at/hg/puzzlequest/</a>.</p>

<p>Here's how to solve an Aurora Feint puzzle with a maximum of two moves:</p>

<code>$ ./puzzlequest -a -d2 &#60;af-puzzles/fall_rain.2 
. . . . . .
. . . . . .
. . . . . .
. . . g . .
. . b g . .
. g b b . .
&#160;
2,1 -&#62; 3,1
&#160;
. . . . . .
. . . . . .
. . . . . .
. . . g . .
. . g b . .
. g b b . .
&#160;
3,0 -&#62; 4,0
&#160;
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
</code>

<p>Coordinates are given in the form <em>column</em>,<em>row</em>, with the lower left block as the origin (0,0).</p>

<p>The program is written in <a href="http://www.haskell.org/">Haskell</a>.  It's only my second program written in that language, and it shows: it's neither elegant nor efficient.  My first Haskell program was an interpreter of a small subset of <a href="http://en.wikipedia.org/wiki/Scheme_(programming_language)">Scheme</a>, which I've made a point of implementing as the first thing in any new programming language I learn, a practice I can highly recommend.  <a href="http://www.complang.tuwien.ac.at/schani/oldstuff/index.html">Here</a> are interpreters I've written in Forth and O'Caml.</p>
<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=schani.wordpress.com&blog=143659&post=76&subd=schani&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://www.puzzle-quest.com/">Puzzle Quest</a> and <a href="http://aurorafeint.com/">Aurora Feint</a> are two very similar games.  In both, you have to match three or more square blocks with the same color horizontally or vertically by exchanging two neighboring blocks.  Those matched blocks are then eliminated from the board and the blocks above them fall down to take their place.  Both games have special pre-built maps which challenge the player to clear all blocks.  In Puzzle Quest the difficulty is that only moves which result in matched blocks are permitted, whereas Aurora Feint requires that the challenge be completed with a certain number of moves or less.</p>
<p>Being too lazy to think for myself I wrote a program to solve those maps for me.  I have set up a public <a href="http://www.selenic.com/mercurial/wiki/">Mercurial</a> repository for it at <a href="http://hg.13thfloor.at/hg/puzzlequest/">http://hg.13thfloor.at/hg/puzzlequest/</a>.</p>
<p>Here&#8217;s how to solve an Aurora Feint puzzle with a maximum of two moves:</p>
<p><code>$ ./puzzlequest -a -d2 &lt;af-puzzles/fall_rain.2<br />
. . . . . .<br />
. . . . . .<br />
. . . . . .<br />
. . . g . .<br />
. . b g . .<br />
. g b b . .<br />
&nbsp;<br />
2,1 -&gt; 3,1<br />
&nbsp;<br />
. . . . . .<br />
. . . . . .<br />
. . . . . .<br />
. . . g . .<br />
. . g b . .<br />
. g b b . .<br />
&nbsp;<br />
3,0 -&gt; 4,0<br />
&nbsp;<br />
. . . . . .<br />
. . . . . .<br />
. . . . . .<br />
. . . . . .<br />
. . . . . .<br />
. . . . . .<br />
</code></p>
<p>Coordinates are given in the form <em>column</em>,<em>row</em>, with the lower left block as the origin (0,0).</p>
<p>The program is written in <a href="http://www.haskell.org/">Haskell</a>.  It&#8217;s only my second program written in that language, and it shows: it&#8217;s neither elegant nor efficient.  My first Haskell program was an interpreter of a small subset of <a href="http://en.wikipedia.org/wiki/Scheme_(programming_language)">Scheme</a>, which I&#8217;ve made a point of implementing as the first thing in any new programming language I learn, a practice I can highly recommend.  <a href="http://www.complang.tuwien.ac.at/schani/oldstuff/index.html">Here</a> are interpreters I&#8217;ve written in Forth and O&#8217;Caml.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/schani.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/schani.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/schani.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/schani.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/schani.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/schani.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/schani.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/schani.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/schani.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/schani.wordpress.com/76/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=schani.wordpress.com&blog=143659&post=76&subd=schani&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://schani.wordpress.com/2008/12/25/a-solver-for-puzzle-quest-and-aurora-feint/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/daf7ba6f06480c52ac459772f2bb5268?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">schani</media:title>
		</media:content>
	</item>
		<item>
		<title>Jim Purbrick</title>
		<link>http://schani.wordpress.com/2008/11/25/jim-purbrick/</link>
		<comments>http://schani.wordpress.com/2008/11/25/jim-purbrick/#comments</comments>
		<pubDate>Tue, 25 Nov 2008 18:54:26 +0000</pubDate>
		<dc:creator>schani</dc:creator>
				<category><![CDATA[Photography]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://schani.wordpress.com/?p=74</guid>
		<description><![CDATA[<p><a href="http://www.flickr.com/photos/schani/3058703623/" title="Jim Purbrick by schani, on Flickr"><img src="http://farm4.static.flickr.com/3017/3058703623_6f6ab7c7e6.jpg" width="333" height="500" alt="Jim Purbrick" /></a></p>

<p>Jim Purbrick of <a href="http://lindenlab.com/">Linden Lab</a>, the guy who made <a href="http://secondlife.com/">Second Life</a> run on Mono, shot after the Mono Summit 2007.  Yes, I'm a year behind with my photo processing.</p>

<p><a href="http://www.flickr.com/photos/schani/sets/72157603407199853/">More Mono people</a></p>
<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=schani.wordpress.com&blog=143659&post=74&subd=schani&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://www.flickr.com/photos/schani/3058703623/" title="Jim Purbrick by schani, on Flickr"><img src="http://farm4.static.flickr.com/3017/3058703623_6f6ab7c7e6.jpg" width="333" height="500" alt="Jim Purbrick" /></a></p>
<p>Jim Purbrick of <a href="http://lindenlab.com/">Linden Lab</a>, the guy who made <a href="http://secondlife.com/">Second Life</a> run on Mono, shot after the Mono Summit 2007.  Yes, I&#8217;m a year behind with my photo processing.</p>
<p><a href="http://www.flickr.com/photos/schani/sets/72157603407199853/">More Mono people</a></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/schani.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/schani.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/schani.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/schani.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/schani.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/schani.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/schani.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/schani.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/schani.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/schani.wordpress.com/74/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=schani.wordpress.com&blog=143659&post=74&subd=schani&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://schani.wordpress.com/2008/11/25/jim-purbrick/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/daf7ba6f06480c52ac459772f2bb5268?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">schani</media:title>
		</media:content>

		<media:content url="http://farm4.static.flickr.com/3017/3058703623_6f6ab7c7e6.jpg" medium="image">
			<media:title type="html">Jim Purbrick</media:title>
		</media:content>
	</item>
		<item>
		<title>Shooting Jonglissimo</title>
		<link>http://schani.wordpress.com/2008/11/09/shooting-jonglissimo/</link>
		<comments>http://schani.wordpress.com/2008/11/09/shooting-jonglissimo/#comments</comments>
		<pubDate>Sun, 09 Nov 2008 02:13:59 +0000</pubDate>
		<dc:creator>schani</dc:creator>
				<category><![CDATA[Juggling]]></category>
		<category><![CDATA[Photography]]></category>
		<category><![CDATA[photos]]></category>

		<guid isPermaLink="false">http://schani.wordpress.com/?p=71</guid>
		<description><![CDATA[<p>Last weekend I had the pleasure of photographing my friends Christoph and Manuel Mitasch, aka <a href="http://www.jonglissimo.com/">Jonglissimo</a>, a world-class club passing duo, holders of four club-passing <a href="http://www.juggling.org/records/records.html">world records</a> and two-time <a href="http://www.juggle.org/">IJA</a> stage competition gold medal winners.</p>

<p>We did the first shooting session at the <a href="http://en.wikipedia.org/wiki/Stephansplatz">Stephansplatz</a> at around three in the morning.  It was seriously cold but - our reason for shooting at such an uncommon hour - there were almost no people there:</p>

<img alt="Photo" src="http://farm4.static.flickr.com/3222/3014536602_dc3a3796cf.jpg">

<img alt="Photo" src="http://farm4.static.flickr.com/3149/3014535670_1edc599156.jpg">

<p>After a few hours of sleep we had another session in a studio, where I learnt a few things: Motion-freezing juggling photos tend to suck. Even if you shoot from an uncommon angle they're barely more than tolerable:</p>

<img alt="Photo" src="http://farm4.static.flickr.com/3136/3013699287_2913217e87.jpg">

<p>Shooting with glowing props is much more interesting:</p>

<img alt="Photo" src="http://farm4.static.flickr.com/3274/3014534040_678ae55d4e.jpg">

<p>Five club double backcrosses - I should have shot this from a ladder and with a longer exposure:</p>

<img alt="Photo" src="http://farm4.static.flickr.com/3143/3013697703_1809879120.jpg">

<p>Club swinging sucks, but it looks kinda cool:</p>

<img alt="Photo" src="http://farm4.static.flickr.com/3059/3014535086_fc1611e316.jpg">

<p>Shooting people while they're jumping is fun:</p>

<img alt="Photo" src="http://farm4.static.flickr.com/3049/3013699485_540717d7c0.jpg">

<p>Even more so if you throw stuff at them while they're in the air:</p>

<img alt="Photo" src="http://farm4.static.flickr.com/3226/3014537048_5fdcc32dac.jpg">

<p>Obligatory back-lit portrait:</p>

<img alt="Photo" src="http://farm4.static.flickr.com/3204/3013698319_62f2132815.jpg">

<p>Manuel:</p>

<img alt="Photo" src="http://farm4.static.flickr.com/3142/3014532984_20931a414c.jpg">

<p><a href="http://www.flickr.com/photos/schani/sets/72157594331061333/">More photos of jugglers.</a></p>
<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=schani.wordpress.com&blog=143659&post=71&subd=schani&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Last weekend I had the pleasure of photographing my friends Christoph and Manuel Mitasch, aka <a href="http://www.jonglissimo.com/">Jonglissimo</a>, a world-class club passing duo, holders of four club-passing <a href="http://www.juggling.org/records/records.html">world records</a> and two-time <a href="http://www.juggle.org/">IJA</a> stage competition gold medal winners.</p>
<p>We did the first shooting session at the <a href="http://en.wikipedia.org/wiki/Stephansplatz">Stephansplatz</a> at around three in the morning.  It was seriously cold but &#8211; our reason for shooting at such an uncommon hour &#8211; there were almost no people there:</p>
<p><img alt="Photo" src="http://farm4.static.flickr.com/3222/3014536602_dc3a3796cf.jpg"></p>
<p><img alt="Photo" src="http://farm4.static.flickr.com/3149/3014535670_1edc599156.jpg"></p>
<p>After a few hours of sleep we had another session in a studio, where I learnt a few things: Motion-freezing juggling photos tend to suck. Even if you shoot from an uncommon angle they&#8217;re barely more than tolerable:</p>
<p><img alt="Photo" src="http://farm4.static.flickr.com/3136/3013699287_2913217e87.jpg"></p>
<p>Shooting with glowing props is much more interesting:</p>
<p><img alt="Photo" src="http://farm4.static.flickr.com/3274/3014534040_678ae55d4e.jpg"></p>
<p>Five club double backcrosses &#8211; I should have shot this from a ladder and with a longer exposure:</p>
<p><img alt="Photo" src="http://farm4.static.flickr.com/3143/3013697703_1809879120.jpg"></p>
<p>Club swinging sucks, but it looks kinda cool:</p>
<p><img alt="Photo" src="http://farm4.static.flickr.com/3059/3014535086_fc1611e316.jpg"></p>
<p>Shooting people while they&#8217;re jumping is fun:</p>
<p><img alt="Photo" src="http://farm4.static.flickr.com/3049/3013699485_540717d7c0.jpg"></p>
<p>Even more so if you throw stuff at them while they&#8217;re in the air:</p>
<p><img alt="Photo" src="http://farm4.static.flickr.com/3226/3014537048_5fdcc32dac.jpg"></p>
<p>Obligatory back-lit portrait:</p>
<p><img alt="Photo" src="http://farm4.static.flickr.com/3204/3013698319_62f2132815.jpg"></p>
<p>Manuel:</p>
<p><img alt="Photo" src="http://farm4.static.flickr.com/3142/3014532984_20931a414c.jpg"></p>
<p><a href="http://www.flickr.com/photos/schani/sets/72157594331061333/">More photos of jugglers.</a></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/schani.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/schani.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/schani.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/schani.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/schani.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/schani.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/schani.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/schani.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/schani.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/schani.wordpress.com/71/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=schani.wordpress.com&blog=143659&post=71&subd=schani&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://schani.wordpress.com/2008/11/09/shooting-jonglissimo/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/daf7ba6f06480c52ac459772f2bb5268?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">schani</media:title>
		</media:content>

		<media:content url="http://farm4.static.flickr.com/3222/3014536602_dc3a3796cf.jpg" medium="image">
			<media:title type="html">Photo</media:title>
		</media:content>

		<media:content url="http://farm4.static.flickr.com/3149/3014535670_1edc599156.jpg" medium="image">
			<media:title type="html">Photo</media:title>
		</media:content>

		<media:content url="http://farm4.static.flickr.com/3136/3013699287_2913217e87.jpg" medium="image">
			<media:title type="html">Photo</media:title>
		</media:content>

		<media:content url="http://farm4.static.flickr.com/3274/3014534040_678ae55d4e.jpg" medium="image">
			<media:title type="html">Photo</media:title>
		</media:content>

		<media:content url="http://farm4.static.flickr.com/3143/3013697703_1809879120.jpg" medium="image">
			<media:title type="html">Photo</media:title>
		</media:content>

		<media:content url="http://farm4.static.flickr.com/3059/3014535086_fc1611e316.jpg" medium="image">
			<media:title type="html">Photo</media:title>
		</media:content>

		<media:content url="http://farm4.static.flickr.com/3049/3013699485_540717d7c0.jpg" medium="image">
			<media:title type="html">Photo</media:title>
		</media:content>

		<media:content url="http://farm4.static.flickr.com/3226/3014537048_5fdcc32dac.jpg" medium="image">
			<media:title type="html">Photo</media:title>
		</media:content>

		<media:content url="http://farm4.static.flickr.com/3204/3013698319_62f2132815.jpg" medium="image">
			<media:title type="html">Photo</media:title>
		</media:content>

		<media:content url="http://farm4.static.flickr.com/3142/3014532984_20931a414c.jpg" medium="image">
			<media:title type="html">Photo</media:title>
		</media:content>
	</item>
		<item>
		<title>Faster Synchronized Methods</title>
		<link>http://schani.wordpress.com/2008/11/09/faster-synchronized-methods/</link>
		<comments>http://schani.wordpress.com/2008/11/09/faster-synchronized-methods/#comments</comments>
		<pubDate>Sun, 09 Nov 2008 01:23:41 +0000</pubDate>
		<dc:creator>schani</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[monitors]]></category>
		<category><![CDATA[mono]]></category>
		<category><![CDATA[synchronization]]></category>

		<guid isPermaLink="false">http://schani.wordpress.com/?p=68</guid>
		<description><![CDATA[<p>Until about a week ago Mono's Monitor implementation, which is used for synchronized methods and the <tt>lock</tt> statement, was comparatively slow.  Each <tt>Monitor.Enter</tt> and <tt>Monitor.Exit</tt> called into unmanaged code, which is very inefficient compared to a normal method call.  We improved this situation by implementing fast-paths that can be called cheaply and that can handle most cases.</p>

<p>The fast-paths come in two varieties: Portable fast-paths, implemented in CIL code, and native fast-paths, in hand-optimized assembler code.  We only have assembler fast-paths for x86 and AMD64, as those are the most-used architectures that Mono runs on.</p>

<p>I've done some <a href="http://monoport.com/38112">micro-benchmarking</a> to compare the fast-paths with the old unoptimized implementation. Each of the tests does 100 million calls to synchronized methods.  Two of the tests call static methods, the other two non-static ones, and two of the tests call empty non-recursive methods whereas the other two call recursive ones.</p>

<p>Here are the results for my x86 machine (2.16 GHz Core Duo):</p>

<img alt="Chart" src="http://www.complang.tuwien.ac.at/schani/blog/syncspeed/x86.png">

<p>The blue bars represent our old implementation.  The orange bars stand for the IL fast-paths and the yellow bars for the assembler fast-paths.  The green bars represent the run-times for non-synchronized methods.</p>

<p>The results for my AMD64 machine (1.86 GHz Core 2) look quite similar:</p>

<img alt="Chart" src="http://www.complang.tuwien.ac.at/schani/blog/syncspeed/amd64.png">

<p>To finish things off I also ran the benchmark on Microsoft .NET on my x86 machine.  Here is the comparison to Mono with the assembler fastpaths:</p>

<img alt="Chart" src="http://www.complang.tuwien.ac.at/schani/blog/syncspeed/monovsnet.png">
<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=schani.wordpress.com&blog=143659&post=68&subd=schani&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Until about a week ago Mono&#8217;s Monitor implementation, which is used for synchronized methods and the <tt>lock</tt> statement, was comparatively slow.  Each <tt>Monitor.Enter</tt> and <tt>Monitor.Exit</tt> called into unmanaged code, which is very inefficient compared to a normal method call.  We improved this situation by implementing fast-paths that can be called cheaply and that can handle most cases.</p>
<p>The fast-paths come in two varieties: Portable fast-paths, implemented in CIL code, and native fast-paths, in hand-optimized assembler code.  We only have assembler fast-paths for x86 and AMD64, as those are the most-used architectures that Mono runs on.</p>
<p>I did some <a href="http://monoport.com/38112">micro-benchmarking</a> to compare the fast-paths with the old unoptimized implementation. Each of the tests does 100 million calls to synchronized methods.  Two of the tests call static methods, the other two non-static ones, and two of the tests call empty non-recursive methods whereas the other two call recursive ones.</p>
<p>Here are the results for my x86 machine (2.16 GHz Core Duo):</p>
<p><img alt="Chart" src="http://www.complang.tuwien.ac.at/schani/blog/syncspeed/x86.png"></p>
<p>The blue bars represent our old implementation.  The orange bars stand for the IL fast-paths and the yellow bars for the assembler fast-paths.  The green bars represent the run-times for non-synchronized methods.</p>
<p>The results for my AMD64 machine (1.86 GHz Core 2) look quite similar:</p>
<p><img alt="Chart" src="http://www.complang.tuwien.ac.at/schani/blog/syncspeed/amd64.png"></p>
<p>To finish things off I also ran the benchmark on Microsoft .NET on my x86 machine.  Here is the comparison to Mono with the assembler fastpaths:</p>
<p><img alt="Chart" src="http://www.complang.tuwien.ac.at/schani/blog/syncspeed/monovsnet.png"></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/schani.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/schani.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/schani.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/schani.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/schani.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/schani.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/schani.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/schani.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/schani.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/schani.wordpress.com/68/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=schani.wordpress.com&blog=143659&post=68&subd=schani&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://schani.wordpress.com/2008/11/09/faster-synchronized-methods/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/daf7ba6f06480c52ac459772f2bb5268?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">schani</media:title>
		</media:content>

		<media:content url="http://www.complang.tuwien.ac.at/schani/blog/syncspeed/x86.png" medium="image">
			<media:title type="html">Chart</media:title>
		</media:content>

		<media:content url="http://www.complang.tuwien.ac.at/schani/blog/syncspeed/amd64.png" medium="image">
			<media:title type="html">Chart</media:title>
		</media:content>

		<media:content url="http://www.complang.tuwien.ac.at/schani/blog/syncspeed/monovsnet.png" medium="image">
			<media:title type="html">Chart</media:title>
		</media:content>
	</item>
		<item>
		<title>Fast Virtual Generic Calls</title>
		<link>http://schani.wordpress.com/2008/10/12/fast-virtual-generic-calls/</link>
		<comments>http://schani.wordpress.com/2008/10/12/fast-virtual-generic-calls/#comments</comments>
		<pubDate>Sun, 12 Oct 2008 17:02:54 +0000</pubDate>
		<dc:creator>schani</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[generics]]></category>
		<category><![CDATA[mono]]></category>
		<category><![CDATA[types]]></category>

		<guid isPermaLink="false">http://schani.wordpress.com/?p=66</guid>
		<description><![CDATA[Until about a week ago, Mono did not have an efficient implementation of virtual generic method calls.  Unlike non-virtual generic methods, it is not know at compile-time which method must be called, so some kind of look-up needs to be performed.  However, unlike non-generic virtual methods, there can be more than one instantiation [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=schani.wordpress.com&blog=143659&post=66&subd=schani&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Until about a week ago, Mono did not have an efficient implementation of virtual generic method calls.  Unlike non-virtual generic methods, it is not know at compile-time which method must be called, so some kind of look-up needs to be performed.  However, unlike non-generic virtual methods, there can be more than one instantiation of a particular virtual generic method per class, and it is not known in advance how many or which instantiations will be needed, so a traditional virtual method table cannot be used.  Mono&#8217;s previous solution was to do the look-up dynamically, by calling into unmanaged code, which is very inefficient.  According to a simple benchmark I wrote, performing a generic virtual call was about 200 times slower than performing a non-generic virtual call.</p>
<p>My <a href="http://lists.ximian.com/archives/public/mono-devel-list/2008-July/028573.html">first stab</a> at implementing a fast virtual generic call mechanism involved the <a href="http://schani.wordpress.com/2008/01/29/other-types/">runtime generic context data structure</a> I implemented for generic code sharing.  The idea was to use the RGCTX as an extensible virtual generic method table.  Whenever a new instantiation of a virtual generic method was needed, we would reserve a new slot for it in the RGCTX.  The performance this approach achieved was quite impressive, making generic virtual calls only about 3 times slower than non-generic virtual calls, but memory usage made it impractical. For only 64 different instantiations of virtual generic methods one benchmark required 46k more memory than with the old implementation.</p>
<p>Another implementation idea came from Paolo, who wanted to reuse the machinery we have for doing interface method lookups.  Every class&#8217;s VTable has a fixed number of slots set aside for interface methods. These slots are used as a hash table, with pointers to the individual interface method&#8217;s metadata as the keys.  Since the interface method to be called is known at compile-time (but not which particular implementation of it), the hash can be computed then and used as a constant index into the hash table.  Thus, an interface method call is done in almost the same way as a &#8220;normal&#8221; virtual method call. Problems occur only when more than one method hashes to the same slot. In that case, a small piece of code, called an &#8220;IMT thunk&#8221;, is generated, which resolves the lookup by doing a hard-coded search for the method&#8217;s implementation, given the method metadata pointer, which is passed as an implicit argument in interface calls.</p>
<p>Applying this technique to virtual generic methods requires reserving a single VTable slot for each virtual generic method, which points to a thunk that performs the look-up of the actual implementation, given its type arguments, which we represent by a single pointer.  In contrast to interface methods, where we have a complete list of all methods, the required instantiations of a virtual generic method become know one by one during run-time, so we do a fall-back into unmanaged code if the required instantiation is not found.  There the thunk might be re-built to include the new instantiation.</p>
<p>Currently the policy for deciding which instantiations to include in the thunk is very simple: If an instantiation was invoked at least 10 times then it will be included.  The potential danger of this policy is that the thunks might grow too big.  <a href="http://lists.ximian.com/archives/public/mono-devel-list/2008-September/029226.html">We discussed</a> a few alternatives, like having an upper limit on the number of instantiations and including only the most frequently used ones, but decided to keep the current implementation until we run into problems.</p>
<p><a href="http://lists.ximian.com/pipermail/mono-devel-list/2008-October/029300.html">Performance numbers</a> are a bit harder to come by for this implementation since the speed of the look-up depends on the size of the thunk.  For small thunks the performance seems to be comparable to that of my first approach, i.e. about 3 times slower than non-generic virtual calls.  Interface calls are not supported, yet.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/schani.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/schani.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/schani.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/schani.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/schani.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/schani.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/schani.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/schani.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/schani.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/schani.wordpress.com/66/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=schani.wordpress.com&blog=143659&post=66&subd=schani&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://schani.wordpress.com/2008/10/12/fast-virtual-generic-calls/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/daf7ba6f06480c52ac459772f2bb5268?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">schani</media:title>
		</media:content>
	</item>
		<item>
		<title>Hack Week 3: MathMap</title>
		<link>http://schani.wordpress.com/2008/09/12/hack-week-3-mathmap/</link>
		<comments>http://schani.wordpress.com/2008/09/12/hack-week-3-mathmap/#comments</comments>
		<pubDate>Fri, 12 Sep 2008 17:39:48 +0000</pubDate>
		<dc:creator>schani</dc:creator>
				<category><![CDATA[Photography]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[gimp]]></category>
		<category><![CDATA[graphics]]></category>
		<category><![CDATA[image processing]]></category>
		<category><![CDATA[mathmap]]></category>

		<guid isPermaLink="false">http://schani.wordpress.com/?p=63</guid>
		<description><![CDATA[
I&#8217;ve used this Hack Week, like the last one, to work on my long-time pet project MathMap, culminating in two releases, 1.3.3 and 1.3.4.
MathMap 1.3.3, released early in the week, features an optically much improved composer, implemented by Herbert P&#246;tzl, as you can see in the screenshot above.
Also new is a Gaussian blur filter which [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=schani.wordpress.com&blog=143659&post=63&subd=schani&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://www.complang.tuwien.ac.at/schani/mathmap/screencasts/convolve.html"><img alt="MathMap Screenshot" src="http://www.complang.tuwien.ac.at/schani/blog/mathmap_marlene.jpg" border="0" title="MathMap Screenshot" width="480" height="288" /></a></p>
<p>I&#8217;ve used this Hack Week, like the <a href="http://schani.wordpress.com/2008/02/17/hack-week-2-mathmap/">last one</a>, to work on my long-time pet project <a href="http://www.complang.tuwien.ac.at/schani/mathmap/index.html">MathMap</a>, culminating in two releases, 1.3.3 and 1.3.4.</p>
<p>MathMap 1.3.3, released early in the week, features an optically much improved composer, implemented by <a href="http://linux-vserver.org/Developers">Herbert P&ouml;tzl</a>, as you can see in the screenshot above.</p>
<p>Also new is a Gaussian blur filter which can be used in the composer as well as in hand-written filters.  What&#8217;s noteworthy about this filter is that it&#8217;s the first filter that is not implemented in the MathMap language, but rather in MathMap&#8217;s implementation language, C, which is why I call it a &#8220;native filter&#8221;.  The reason for this is that the MathMap language, which is very similar in spirit to pixel shader languages (but more powerful), does not lend itself well to filters which cannot be efficiently calculated for each pixel separately.  The only way to implement it would be for every pixel to be calculated to loop over its pixel region (the size of which depends on the blur radius) and sum up the pixels.</p>
<p>At the end of the week I released MathMap 1.3.4, which, apart from bug fixes and performance improvements, adds yet another native filter (three, actually), namely <a href="http://en.wikipedia.org/wiki/Convolution">convolution</a>.  It doesn&#8217;t realize its full potential yet, because there&#8217;s no sane way of providing pixel-precise convolution kernels, but I&#8217;ll fix that sooner or later.</p>
<p>To give you a feel for the new features of MathMap I&#8217;ve put together <a href="http://www.complang.tuwien.ac.at/schani/mathmap/screencasts/convolve.html">a new screencast</a>, despite grave technical difficulties.  It focusses mostly on the composer and the new native filters.  I&#8217;m also presenting an interesting way to make black and white images which you might find interesting independent of MathMap.  Have fun!</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/schani.wordpress.com/63/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/schani.wordpress.com/63/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/schani.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/schani.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/schani.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/schani.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/schani.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/schani.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/schani.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/schani.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/schani.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/schani.wordpress.com/63/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=schani.wordpress.com&blog=143659&post=63&subd=schani&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://schani.wordpress.com/2008/09/12/hack-week-3-mathmap/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/daf7ba6f06480c52ac459772f2bb5268?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">schani</media:title>
		</media:content>

		<media:content url="http://www.complang.tuwien.ac.at/schani/blog/mathmap_marlene.jpg" medium="image">
			<media:title type="html">MathMap Screenshot</media:title>
		</media:content>
	</item>
		<item>
		<title>Another Generic Sharing Update</title>
		<link>http://schani.wordpress.com/2008/06/27/another-generic-sharing-update/</link>
		<comments>http://schani.wordpress.com/2008/06/27/another-generic-sharing-update/#comments</comments>
		<pubDate>Fri, 27 Jun 2008 19:37:13 +0000</pubDate>
		<dc:creator>schani</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[generics]]></category>
		<category><![CDATA[mono]]></category>
		<category><![CDATA[types]]></category>

		<guid isPermaLink="false">http://schani.wordpress.com/?p=62</guid>
		<description><![CDATA[Since my last report on generic code sharing I chased down a few bugs we uncovered when trying out IronPython 2.0.  That new version uses the Microsoft Dynamic Language Runtime, which extensively utilizes generics.  One issue we came across was how to figure out the actual method for a delegate when only the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=schani.wordpress.com&blog=143659&post=62&subd=schani&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Since my <a href="http://schani.wordpress.com/2008/06/02/sharing-generic-methods/">last report</a> on generic code sharing I chased down a few bugs we uncovered when trying out IronPython 2.0.  That new version uses the Microsoft Dynamic Language Runtime, which extensively utilizes generics.  One issue we came across was how to figure out the actual method for a delegate when only the native code pointer (acquired with <tt>ldftn</tt>) and no target class is given.  For example:</p>
<p><code>public class Gen&lt;T&gt; {<br />
&nbsp;&nbsp;public void work () { ... }<br />
}</code></p>
<p>With generic code sharing the methods <tt>Gen&lt;string&gt;.work</tt> and <tt>Gen&lt;object&gt;.work</tt> will share the same native code, so given only a pointer to it it&#8217;s not possible to differentiate between the two.  What one could do to make it possible to tell between the two would be to let <tt>ldftn</tt> produce a pointer not to the method directly but to a small piece of trampoline code for which there is one for each instantiation of the method.  Fortunately it seems like we don&#8217;t have to bother with that, since the .NET CLR doesn&#8217;t either.  Instead it gives you the instantiation of the method where all type arguments are <tt>object</tt>, so we do the same.</p>
<p>Another thing I did was implement sharing of methods of generic value types.  There doesn&#8217;t seem too much code out there which utilizes generic value types extensively, but it wasn&#8217;t a big deal to implement so I went ahead and did it.  Since instances of value types don&#8217;t contain VTable pointers we need to pass the runtime generic context (RGCTX) explicitly for all methods, like we do for static methods of reference types.  One complication that arises here is when the value type implements an interface.  When casting such a value type to the interface type it gets boxed and receives a VTable for the interface methods.  Since the caller of those methods doesn&#8217;t know it&#8217;s dealing with a value type, much less which particular one, it cannot pass the RGCTX, so the methods in the interface VTable need a wrapper which will pass it.  This is very similar to the wrapper we use when taking the address of a <a href="http://schani.wordpress.com/2008/03/10/sharing-static-methods/">static method of a reference type</a> (for constructing a delegate, for example).</p>
<p>I&#8217;ll end with an updated table of memory statistics for a few test applications.  &#8220;Nemerle&#8221; is the <a href="http://nemerle.org/Main_Page">Nemerle</a> compiler compiling itself.  &#8220;<a href="http://www.codeplex.com/Wiki/View.aspx?ProjectName=IronPython">IronPython</a> 2.0&#8243; is running pystone.  &#8220;<a href="http://research.microsoft.com/fsharp/fsharp.aspx">F#</a> 1.9&#8243; is running a simple &#8220;Hello world&#8221; program on the command line and &#8220;<a href="http://research.microsoft.com/fsharp/fsharp.aspx">F#</a> 2.0&#8243; is compiling a simple program.</p>
<p><font size="-3"><br />
<table border="1">
<tr>
<td></td>
<td colspan="2" align="center">No sharing</td>
<td colspan="2" align="center">Sharing</td>
</tr>
<tr>
<td></td>
<td align="center">Methods<br />compiled</td>
<td align="center">Code<br />produced</td>
<td align="center">Methods<br />compiled</td>
<td align="center">Code<br />produced</td>
<td align="center">Memory for<br />(M)RGCTXs</td>
<td align="center">Savings</td>
</tr>
<tr>
<td>Nemerle</td>
<td align="right">7127</td>
<td align="right">2008k</td>
<td align="right">6159</td>
<td align="right">1895k</td>
<td align="right">23k</td>
<td align="right">90k</td>
</tr>
<tr>
<td>IronPython 2.0</td>
<td align="right">9060</td>
<td align="right">1607k</td>
<td align="right">5833</td>
<td align="right">1011k</td>
<td align="right">42k</td>
<td align="right">554k</td>
</tr>
<tr>
<td>F# 1.9</td>
<td align="right">15268</td>
<td align="right">2187k</td>
<td align="right">9828</td>
<td align="right">1659k</td>
<td align="right">111k</td>
<td align="right">417k</td>
</tr>
<tr>
<td>F# 2.0</td>
<td align="right">27186</td>
<td align="right">3781k</td>
<td align="right">15828</td>
<td align="right">2830k</td>
<td align="right">239k</td>
<td align="right">712k</td>
</tr>
</table>
<p></font></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/schani.wordpress.com/62/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/schani.wordpress.com/62/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/schani.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/schani.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/schani.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/schani.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/schani.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/schani.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/schani.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/schani.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/schani.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/schani.wordpress.com/62/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=schani.wordpress.com&blog=143659&post=62&subd=schani&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://schani.wordpress.com/2008/06/27/another-generic-sharing-update/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/daf7ba6f06480c52ac459772f2bb5268?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">schani</media:title>
		</media:content>
	</item>
	</channel>
</rss>