<?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/"
	>

<channel>
	<title>Crazy Coding Conundrums</title>
	<atom:link href="http://zwitserloot.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://zwitserloot.com</link>
	<description></description>
	<lastBuildDate>Thu, 05 Aug 2010 00:22:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Case insensitive comparison: A lot more complicated than you might think!</title>
		<link>http://zwitserloot.com/2010/08/04/case-insensitive-comparison-a-lot-more-complicated-than-you-might-think/</link>
		<comments>http://zwitserloot.com/2010/08/04/case-insensitive-comparison-a-lot-more-complicated-than-you-might-think/#comments</comments>
		<pubDate>Wed, 04 Aug 2010 15:17:10 +0000</pubDate>
		<dc:creator>rzwitserloot</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://zwitserloot.com/?p=262</guid>
		<description><![CDATA[Inspired by a discussion on the relative merits of scala vs. java which brought up sorting a list of strings based on the result of a call to toLowercase(), I offer you a trip around the world to convince you that string comparison is a lot more complex. If you are a java user and [...]]]></description>
			<content:encoded><![CDATA[<p>Inspired by a discussion on the relative merits of scala vs. java which brought up sorting a list of strings based on the result of a call to <code>toLowercase()</code>, I offer you a trip around the world to convince you that string comparison is a lot more complex.</p>

<p>If you are a java user and don&#8217;t want to read it all, the take-away lesson is simple: You should be using <a href="http://download-llnw.oracle.com/javase/6/docs/api/java/text/Collator.html">java.text.Collator</a> which is better than <code>Collections.sort(list, String.CASE_INSENSITIVE_ORDER)</code> which is better than just calling <code>toLowerCase()</code> on everything.</p>

<p>To explain why string comparison is so much more nuanced, we&#8217;ll visit three interesting locales, each throwing a unique wrench in the works.</p>

<!-- more -->

<h3>Example 1: The Eszett character</h3>

<p>In german, a certain ligature for two consecutive s characters has 
been used so much for so long it&#8217;s considered its own unique 
character. The <em>Eszett</em> or <em>Scharfes s</em>: ß. It shows up all over the 
place in german, for example in the word street, which is straße in 
german. The Eszett is somewhat unique in that it has no capital form. 
Words don&#8217;t start with double s so there has never been a reason to 
capitalize it. Instead, if you ask a german to write street in all 
caps, they&#8217;d write <code>STRASSE</code>.</p>

<p>Uhoh. That&#8217;s not a reversible operation! The lowercase form of 
<code>STRASSE</code> is <code>strasse</code>, and even knowing that the locale is german, 
you can&#8217;t just guess that double-s <em>ALWAYS</em> becomes the ß character. You&#8217;d 
need a dictionary. Arguably you&#8217;re better off doing that conversion 
than not doing it if you know its german (more likely), but it won&#8217;t 
be a sure thing. Nevertheless, trying to check if <code>straße</code> and 
<code>STRASSE</code> are two equal strings under case insensitive comparison 
<em>should</em> return true, and not false, but while that&#8217;s in the cards, 
using <code>.toLowerCase()</code> as a proxy for case insensitive comparison is 
never going to get us that.</p>

<p>Java actually gets this right, sort of. trying to uppercase <code>straße</code> will
in fact produce <code>STRASSE</code> even when just using <code>.toUpperCase()</code>, you don&#8217;t
have to specify <code>Locale.GERMANY</code>. You can experiment by using \u00DF which
is the (lowercase) Eszett. There is such a thing as a capital Eszett in unicode,
which nobody in germany uses and is clearly a silly idea: You don&#8217;t hack a living,
breathing language to get around i18n problems. If that&#8217;s feasible we might as well tell the 
world to stop whining and only use english when using machines.</p>

<p>Here&#8217;s the problem: <code>String.CASE_INSENSITIVE_ORDER</code> does not in fact return 
&#8217;0&#8242; (indicating equality) when comparing <code>straße</code> and <code>STRASSE</code>, even 
though every single language that uses the ß (german. That&#8217;s it!) says 
those two are case-insensitive equal. Nevertheless, that does not excuse the
brokenness of the &#8216;toLowerCase() is an alternative for case insensitive comparison&#8217; meme.</p>

<p>NB: My thanks go to <a href="http://www.reddit.com/r/programming/comments/cxb8h/case_insensitive_comparison_a_lot_more/c0vyq7e">dpark</a> who spotted a problem in an earlier version of this post where I erroneously reported java did in fact use the invented uppercase variant.</p>

<h3>Example 2: The turkish dotless/dotted i, and the somewhat famous PHP breaks on turkish computers problem</h3>

<p>The ß vs. SS issue indicates that <code>toLowerCase()</code> isn&#8217;t a valid 
replacement for case insensitive comparison, but it gets worse. You 
can&#8217;t, in fact, say anything whatsoever about casing, or case 
insensitive equality, without knowing the locale you&#8217;re operating in. 
In turkish there&#8217;s not one &#8216;i&#8217; but two: The dotted i and the dotless 
i. Where this gets crazy is the capital forms of those. The capital 
form of &#8216;i&#8217; is a <em>dotted</em> capital I, and the capital form of dotless 
&#8216;i&#8217; is our normal, familiar capital I, which doesn&#8217;t have a dot in it. 
This even messes with kerning (fi is a common kerning where the tip of 
the curvey top of the f is joined with the i&#8217;s dot. That&#8217;s not 
appropriate in turkish, where that dot is important). This means &#8220;i&#8221; 
and &#8220;I&#8221; are not equal in case-insensitive comparison in the Turkish 
locale. <code>toLowerCase()</code> comparison gets this wrong, of course. 
<code>toLowerCase(new Locale("TR"))</code> would actually get this right. 
<code>String.CASE_INSENSITIVE_ORDER</code> gets this wrong, because you can&#8217;t give 
it a locale. For natural language comparison (and why are you upper/ 
lowering strings in the first place, if not because youre doing 
natural language comparison?), tLC(), tUC(), 
String.CASE_INSENSITIVE_ORDER &#8211; are all inherently broken. Java gets 
this a little right and offers Locale-based variants of tLC() and 
tUC(), as I hinted at earlier.</p>

<p>That PHP we always like to bash on? One of the things PHP does (or 
perhaps did, I don&#8217;t keep up with it) wrong for the longest of times 
was that it would completely lose its marbles if the system&#8217;s locale 
was set to turkish. It would just fail to work. PHP identifiers are 
defined as case insensitive, and PHP implemented this by 
toLowerCase()ing everything, using the platform default encoding. This 
turns &#8220;FILE&#8221; into &#8220;fıle&#8221; which is not equal to &#8220;file&#8221;, and thus 
running most PHP code on a machine configured with turkish locale 
breaks, if the PHP is in english. This is a famous example of the 
universally lamented &#8220;it works for me&#8221; attitude. So, yes, making this 
mistake has dire consequences.</p>

<h3>Example 3: Ascii hacks</h3>

<p>To make matters worse still, lets think about why one would want to do 
a case insensitive comparison in the first place. Presumably because 
there&#8217;s some user input of some sort that needs to be compared, and 
you don&#8217;t want to bother the user with case sensitivity. However, if 
thats the aim, &#8220;case insensitive&#8221; is entirely the wrong idea. There 
are a bajillion systems around that can&#8217;t deal with unicode. For 
example, if many &#8216;name&#8217; forms don&#8217;t even accept a dash in your last 
name, how many do you think accept a &#8220;ü&#8221; in it? And yet plenty of 
german folks are called &#8220;Müller&#8221;. The &#8216;fix&#8217; these poor saps have used 
for years and years is to write the canonical ascii alternative for 
their funky character. ß becomes ss, ü because ue, etcetera. I&#8217;m 
betting that if you intend for &#8220;JOE&#8221; and &#8220;joe&#8221; to be equal, then you 
should consider &#8220;müller&#8221; and &#8220;mueller&#8221; equal too.</p>

<p>Whats really needed is a human inputted string comparator. Optimally 
speaking such a tool will first canonicalize each string, turning for 
example dotless i of any capitalization into a dotted lowercase i, 
turns ß into ss, ü into ue, etcetera, and only then compare the 
strings. I&#8217;m not even sure this can be done properly without knowing a 
locale, but you could do a lot better than 
<code>String.CASE_INSENSITIVE_ORDER</code> that way, and far better still versus 
comparing the .toLowerCase() versions of any two given strings. 
Java does in fact have something for this: <code>java.text.Collator</code>. This 
indeed does more or less what I just described, and it is in fact what 
one ought to be using. If I were you, I&#8217;d make a pmd plugin right now 
that checks for usage of locale-less tLC and tUC, as well as 
<code>String.CASE_INSENSITIVE_ORDER</code>, and flag them all as warnings.</p>

<h3>Bonus Example: Lower case. Upper case. And Title case??</h3>

<p>Astute folks may have observed that <code>Character.toTitleCase()</code> exists in the java standard library.</p>

<p>What&#8217;s that you ask? Well, in some languages, there are single 
characters that look like 2 characters. For example the &#8216;dz&#8217;. That&#8217;s 
one character in some languages. This is very similar to the germans 
who have enshrined the much used ß ligature into a unique character. 
However, unlike the ß which has pretty much lost all resemblance to 
the original character, and which can never appear at the beginning of 
a word, these characters are mostly just a kerned version of the 
original, and CAN appear at the beginning of the word. In unicode 
speak these are called digraphs. These have 3 and not 2 capitalization 
forms: all lowercase, all uppercase, and the first part of the digraph 
uppercased, the second part lowercased. This is what you&#8217;d use when 
you want a word with just the first letter capitalized, and you use 
the all-caps version only if you need an all-caps rendering of the 
word (i.e. rarely). This obscure little factoid actually was useful 
for me when writing lombok: The method that turns &#8220;foo&#8221; into &#8220;getFoo&#8221; 
will use <code>toTitleCase()</code> and not <code>toUpperCase()</code>.</p>

<p>And there ends our trip round the world. I hope you enjoyed it. Though 
now you know: That feeling of despair when someone mentions i18n? 
You&#8217;re entirely correct in feeling it. It&#8217;s a pain in the tusch!</p>
]]></content:encoded>
			<wfw:commentRss>http://zwitserloot.com/2010/08/04/case-insensitive-comparison-a-lot-more-complicated-than-you-might-think/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Dutch Politics: Welke coalities zijn er uberhaupt mogelijk?</title>
		<link>http://zwitserloot.com/2010/03/07/dutch-politics-welke-coalities-zijn-er-uberhaupt-mogelijk/</link>
		<comments>http://zwitserloot.com/2010/03/07/dutch-politics-welke-coalities-zijn-er-uberhaupt-mogelijk/#comments</comments>
		<pubDate>Sun, 07 Mar 2010 21:50:36 +0000</pubDate>
		<dc:creator>rzwitserloot</dc:creator>
				<category><![CDATA[politics]]></category>

		<guid isPermaLink="false">http://zwitserloot.com/?p=259</guid>
		<description><![CDATA[This is a post about some interesting events in dutch politics, particularly about the upcoming election. As it&#8217;s going to be frightfully boring to anyone who doesn&#8217;t live here, I&#8217;m going to write the rest of this post in dutch. Het is algemeen bekend dat een (meerderheids)coalitie erg moeilijk gaat worden na de volgende verkiezingen, [...]]]></description>
			<content:encoded><![CDATA[<p>This is a post about some interesting events in dutch politics, particularly about the upcoming election. As it&#8217;s going to be frightfully boring to anyone who doesn&#8217;t live here, I&#8217;m going to write the rest of this post in dutch.</p>

<p>Het is algemeen bekend dat een (meerderheids)coalitie erg moeilijk gaat worden na de volgende verkiezingen, maar terwijl ik vandaar zat te denken aan hoe een minderheidscoalitie er dan uit moet zien kwam ik tot de conclusie dat zelfs een minderheids coalitie vrijwel onmogelijk is! Ik loop door wat opties. Ik houdt me hier aan de polls van De Hond met wat gezond verstand erbij (to wit: Gekeken naar de crash van het CDA in de Gemeenteraads verkiezingen gaat die zeker niet beter uitkomen in de polls dan hun nu al magere positie, PvdA is een beetje een wildcard door de recente gebeurtenissen, en Wilders is ook wel een wildcard want is moeilijk te pollen: Velen zullen niet durven uitkomen dat ze Wilders stemmen, maar anderen &#8216;stemden&#8217; tot nu toe bij de polls voor Wilders meer als buikgevoel/tegenstem en gaan dat niet daadwerkelijk doen na bezinning).</p>

<p>Peilingsdata is hier beschikbaar: <a href="http://www.peil.nl/?2891">http://www.peil.nl/?2891</a></p>

<h1>Meerderheidscoalities.</h1>

<h2>MegaRechts: VVD, CDA, PVV, TON.</h2>

<p>Deze mix kan in feite wel door een deur. De grootste vraag voor een leek zou kunnen zijn: Wil de CDA dit wel? Maar die hebben uiteindelijk toch vrij duidelijk getoond dat ze geen grote problemen zien om samen met Wilders te regeren. Dat VVD, TON, en PVV goed samen kunnen werken lijkt me duidelijk. Het probleem is echter dat ik niet verwacht dat dit setje de 76 zetels haalt; in de polls staat deze groep op 71. Het CDA en TON gaan hier zeker niet een hoger nummer van maken, dus zou Wilders + VVD 5 zetels meer moeten krijgen dan in de polls. Dat lijkt me een brug te ver.</p>

<h2>MegaRechts2: VVD, CDA, PVV, CU (en TON).</h2>

<p>Deze mix zal de 76 wel halen, maar het CU en de PVV gaat niet echt samen. Verder is het CU in een soortement van machtsstrijd verzonken met de CDA om de christelijke stem, en zal het CU ook wel weten dat ze door de kiezers uitgekotst gaan worden als zij het mogelijk maken dat de zwaar op verlies staande CDA en Wilders aan de macht gaan komen. Half nederland kan die coalitie niet uitstaan, en de andere helft gelooft er zo hard in dat die stemmen allemaal naar PVV en CDA gaan volgende electie. Ik verwacht dus dat de CU gewoon gaat bedanken voor dit idee.</p>

<h2>Paars+: Groen Links, PvdA, D66, VVD.</h2>

<p>Deze mix haalt de 76 misschien niet en dan zou de CU er ook nog bij moeten. Ik zie niet helemaal hoe Groen Links en de VVD in een coalitie moeten gaan komen. Verder smakt dit toch redelijk naar Paars, waar ik totaal geen probleem mee had, maar zal na fortuijn&#8217;s crusade tegen Paars toch een wrange nasmaak aan zitten.</p>

<h2>MegaLinks: SP, Groen Links, PvdA, D66</h2>

<p>Dit gaat de 76 niet halen. Zal dus de CU bij moeten, en uberhaupt heb je dan wel een grote verliezer (PvdA) en een hele grote verliezer (SP) in de coalitie. Ook is de overlap in standpunten van bijvoorbeeld SP en PvdA niet zo groot, en als de CU er ook nog bij moet dan zie ik dit ook niet gebeuren.</p>

<h2>Centrum: CDA, D66, VVD, PvdA</h2>

<p>Niet helemaal ondenkbaar, maar wel raar dat de huidige regering (CDA+PvdA) die zo ontiegelijk afgestraft gaat worden opnieuw gaat regeren. Ik zou dan verwachten dat D66 en VVD het voortouw gaan nemen en dat Pechtold of Rutten de MP gaat leveren. Ook vind ik persoonlijk dat de standpunten van het CDA en D66 eigenlijk niet echt samen kan, maar desondanks wordt VVD+CDA+D66 hier en daar ge-opperd (maar haalt het niet) dus als dat kan waarom dit niet? Als duidelijk wordt dat minderheids coalities niet gaan werken (zie onder) dan zal dit toch meerdere malen genoemd worden als oplossing, verwacht ik. Maar wil de CDA, die toch redelijk anti-liberaal is, in een coalitie met D66 <em>EN</em> VVD (is CDA/D66/VVD ooit gebeurd vroeger?), zeker aangezien Rutte en/of Pechtold, om de smaak van een herhaling van balkenende IV weg te halen, de MP gaat worden?</p>

<h1>Minderheidscoalities.</h1>

<p>De minderheidscoalities hebben het probleem dat ze altijd een extra partij mee moeten krijgen, en dus kunnen ze niet te controversieel zijn. Dat is het probleem, kijk maar:</p>

<h1>MegaRechts: VVD, PVV, CDA (, TON).</h1>

<p>Als minderheidscoalitie gaat dit nooit werken; ik verwacht dat de rest van de kamer het gewoon niet zal toestaan en op alles principieel nee stemt. Tussen Wilders en het CDA is er meer dan genoeg politieke reden om je zo op te stellen en ik verwacht minimaal dat D66, SP, Groen Links, PvdD en D66 dit ook zullen doen. Dan zal de druk op de CU en de SGP zo groot zijn dat ze zelf ook niet over willen komen als lamme schapen die achter deze controversiele coalitie lopen en dat gaat dus niet werken. Hetzelfde geldt voor een andere minderheidscoalitie met Wilders er in. Het lijkt me duidelijk dat als Wilders wil regeren het alleen kan in de vorm van een meerderheidscoalitie, en zoals boven getoond wordt dat lastig.</p>

<h1>Paars: PvdA, VVD, D66.</h1>

<p>Ik denk dat vooral D66 graag wil regeren, desnoods in een minderheidscoalitie, maar of de PvdA die nu toch al in recovery mode is geraakt dit aandurft vraag ik me af. Het is ook puur Paars dus verwacht ik dat er veel backwash zal zijn (met stemmen die veelal naar Wilders zullen gaan, ook) niet zozeer omdat zo&#8217;n kabinet rare dingen gaat doen maar omdat het volk nou eenmaal denkt dat Paars zuigt. Als de PvdA top denkt zoals ik gaan ze hier nooit aan beginnen. Desondanks is deze combo de meest denkbare momenteel, denk ik.</p>

<h1>Links: PvdA, D66, Groen Links.</h1>

<p>Een minderheidscoalitie hoeft geen 76 zetels te halen, maar iets in die buurt is wel handig natuurlijk, en dit setje haalt maar de 56. Dat betekent ten eerste dat het een schaarse representatie wordt voor de ministersposten, en ten tweede dat ze bijvoorbeeld aan het overtuigen van de SP niet genoeg hebben en dat wordt dus erg zwaar regeren. Desondanks kan het wel; op liberaal gebied is er geen enkel probleem en komen ze makkelijk aan 76 stemmen voor. Op economisch probleem zullen ze of SP+CU of CDA mee moeten krijgen, want ik verwacht niet dat deze coalitie met ideeën op economisch vlak komt waar de VVD op voor gaat stemmen. (Ik ga er even vanuit dat de CDA zich recalcitrant en onwerkbaar op gaat stellen, omdat die partij momenteel nogal in de war ligt). Met de grote winst voor &#8216;rechts&#8217; wilders denk ik ook dat een grote groep nederlanders zeer luidkeels gaat protesteren tegen dit idee wat er voor gaat zorgen dat het onmogelijk wordt gemaakt voor deze coalitie om de extra stemmen te krijgen en gaat het dus niet werken.</p>
]]></content:encoded>
			<wfw:commentRss>http://zwitserloot.com/2010/03/07/dutch-politics-welke-coalities-zijn-er-uberhaupt-mogelijk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apple is evi&#8230; well, no. But perhaps shortsighted?</title>
		<link>http://zwitserloot.com/2010/02/15/apple-is-evi-well-no-but-perhaps-shortsighted/</link>
		<comments>http://zwitserloot.com/2010/02/15/apple-is-evi-well-no-but-perhaps-shortsighted/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 07:50:08 +0000</pubDate>
		<dc:creator>rzwitserloot</dc:creator>
				<category><![CDATA[apple]]></category>
		<category><![CDATA[education]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[tech]]></category>

		<guid isPermaLink="false">http://zwitserloot.com/?p=255</guid>
		<description><![CDATA[Apple&#8217;s iPad is perfectly suitable as your only computer. I know the sales pitch for the Apple iPad to be a third device, but I think that&#8217;s just shortsighted. What would your average family really need to do that the iPad cannot do? Play intricate games? Well, don&#8217;t discount the iPad&#8217;s hardware, but evenso the [...]]]></description>
			<content:encoded><![CDATA[<h2>Apple&#8217;s iPad is perfectly suitable as your only computer.</h2>

<p>I know the sales pitch for the <a href="http://www.apple.com/ipad">Apple iPad</a> to be a <em>third device</em>, but I think that&#8217;s just shortsighted. What would your average family really need to do that the iPad cannot do? Play intricate games? Well, don&#8217;t discount the iPad&#8217;s hardware, but evenso the usual solution to that is to buy a games console and not a PC. Program? Well, yeah, but that is by itself not going to convince an average family to keep a PC around unless they&#8217;re already into programming. Work long hours? Not sure if a family really needs to consider that, but one can argue the keyboard dock will do the trick. Sure, it sucks for posture, but if many of my friends slave away for many hours behind a notebook and don&#8217;t bother to invest in a docking station, clearly that&#8217;s not a big concern.</p>

<p>Computers are complicated. Really, really, really complicated. Mac OS X is really no exception to this; it is perhaps the lesser evil amongst the 3 major OSes, but my parents, for example, still can&#8217;t make heads or tails of it. An iPhone, though, that&#8217;s easy. Even for technophobes and digital illiterates. I foresee the iPad being used as a replacement PC. it&#8217;s far more convenient, it&#8217;s cheaper, and if the reviews are to be believed, browsing the web (95% of what family computers need to do, these days) is actually <em>nicer</em> on it.</p>

<p>But therein lies a problem. Game consoles are already closed NDA-protected fiefdoms, and the iPad is no different.</p>

<h2>Without exaggerating, can you explain succintly why this is so bad?</h2>

<p>No problem. It boils down to two very simple problems:</p>

<ul>
<li><p>You can&#8217;t <em>just</em> get the SDK. You need a mac, you need $99, and <em>you need to be 18 years old</em> to sign that NDA. I don&#8217;t know about you folks, but I made my first tentative steps into the world of programming when I was less than half that age.</p></li>
<li><p>There&#8217;s no nice learning environment. Something like <a href="http://en.wikipedia.org/wiki/Logo_(programming_language)">The LOGO programming language</a> isn&#8217;t available in the SDK. That&#8217;s not the direct problem &#8211; the direct problem is that it isn&#8217;t possible to remedy this in a way that doesn&#8217;t involve getting some facetime with <a href="http://en.wikipedia.org/wiki/Steve_jobs">Mr. Jobs</a> and convincing him it&#8217;s necessary. You can&#8217;t make <em>LOGO</em> for the iPad; appstore programs can&#8217;t run other programs. You can&#8217;t make <em>LOGO</em> for another platform either &#8211; only the official SDK can produce a distributable that can be loaded onto an iPhone / iPad / iPod.</p></li>
</ul>

<h2>Shortsighted?</h2>

<p>I&#8217;d say its a bit short-sighted to not presume the iPad could be such a success, and/or not considering that a lot of excellent programmers got started just tinkering about. I certainly didn&#8217;t just say one day: I know! I&#8217;ll become a programmer! &#8211; that&#8217;s not generally how it goes. I can also imagine an awesome development environment to draw creative talent all around the world into the world of programming &#8211; something graphics and &#8216;oooh!&#8217; factor heavy, with modules that can be represented as little puzzle blocks, that you can easily stick together by making gestures, for example doing the zoom gesture to investigate the source. Sadly, you can&#8217;t build such a fantastic idea, because you&#8217;d run afoul of the needlessly strict rules for app store apps.</p>

<h2>Addendums</h2>

<p>Technically you can attempt to introduce programming via websites. <a href="https://bespin.mozilla.com/">Mozilla Bespin</a> shows that there&#8217;s some merit to this idea, but reading out the camera in HTML5 is very far off indeed. Programming is also one of these things where internet latency can be a real issue. Nevertheless, <em>bespin</em> is a very cool project, and I hope it may perhaps fill this gap.</p>
]]></content:encoded>
			<wfw:commentRss>http://zwitserloot.com/2010/02/15/apple-is-evi-well-no-but-perhaps-shortsighted/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Scoping your method locals: Neat programming trick.</title>
		<link>http://zwitserloot.com/2009/12/17/scoping-your-method-locals-neat-programming-trick/</link>
		<comments>http://zwitserloot.com/2009/12/17/scoping-your-method-locals-neat-programming-trick/#comments</comments>
		<pubDate>Thu, 17 Dec 2009 10:53:21 +0000</pubDate>
		<dc:creator>rzwitserloot</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://zwitserloot.com/?p=250</guid>
		<description><![CDATA[It&#8217;s a fairly common programming maxim that you should not let your methods grow too large. If that happens, the maxim generally suggests you split up your behemoth method by spinning off parts of it into their own &#8216;helper&#8217; methods. I agree to the maxim, but I never really liked the solution. Helper methods are [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s a fairly common programming maxim that you should not let your methods grow too large. If that happens, the maxim generally suggests you split up your behemoth method by spinning off parts of it into their own &#8216;helper&#8217; methods.</p>

<p>I agree to the maxim, but I never really liked the solution. Helper methods are awkward; where do you put them in the source file? They should obviously &#8216;go with&#8217; the method they are a helper for, but in many code houses (including for example google), you&#8217;re supposed to sort your methods in a specific order, so you&#8217;d have to prefix all your helper names with the original method name. Thus, something like:</p>

<pre><code> public void enormousMethod() {
     enormousMethod_doStep1();
     enormousMethod_doStep2();
 }

 private void enormousMethod_doStep1() {
     ...
 }

 private void enormousMethod_doStep2() {
     ...
 }
</code></pre>

<p>Doable, but annoying. The more serious problem is that you have to pass in variables for all state from the main method that you need, and you have to return everything that you mutate or produce in the helper method. If you mutate/produce more than 1 result, then you need to return a tuple of some sort, which is unwieldy. You also have to refactor, which IDEs can help you with, but only to an extent.</p>

<p>I&#8217;ve found a solution which I think is superior. We&#8217;re going to use a little known java feature: Scope blocks &#8211; you can just start a block in java, anywhere. All variables declared inside the block are no longer valid when the scope ends, just like when you use them as the block associated with a while, if, or for construct. Thus, we can have &#8216;methods in methods&#8217; so to speak:</p>

<pre><code>public void enormousMethod() {
    /* Explanation of what step 1 is for */ {
        ...
    }

    /* Explanation of what step 2 is for */ {
        ...
    }
}
</code></pre>

<p>It&#8217;s not a panacea; sometimes a helper method is the better choice. For example, you cannot just break out of a scope block, whereas with a helper method, you can (You <code>return</code> from the method). However, you nicely separate your behemoth method into mostly self-contained blocks that can have their own local variable names, and you have absolutely no problem sharing state in between them where that makes sense. Thus, they can all increase a counter for example.</p>

<p>Another more drastic trick you can do in java is to create a method local class, with state stored in that method local&#8217;s fields. If in another language you would have used an actual method-in-a-method, then that&#8217;s the nearest simile java has to offer. It&#8217;s a bit unwieldy in syntax, but in rare cases it ends up being the cleanest solution.</p>
]]></content:encoded>
			<wfw:commentRss>http://zwitserloot.com/2009/12/17/scoping-your-method-locals-neat-programming-trick/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>I love patches!</title>
		<link>http://zwitserloot.com/2009/12/09/i-love-patches/</link>
		<comments>http://zwitserloot.com/2009/12/09/i-love-patches/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 15:12:27 +0000</pubDate>
		<dc:creator>rzwitserloot</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://zwitserloot.com/?p=246</guid>
		<description><![CDATA[I recently got an email about a side-project, org.microformats.hCard, about the src zip being broken. Once I got that sorted out, an almost immediately followup that a 1.6 dependency snuck in there, including detailed reports. Earlier, someone contributed XFN support for it. And, for lombok, we&#8217;ve recently received patches for netbeans and JDK7 support. The [...]]]></description>
			<content:encoded><![CDATA[<p>I recently got an email about a side-project, <a href="http://zwitserloot.com/org-microformats-hcard/">org.microformats.hCard</a>, about the src zip being broken. Once I got that sorted out, an almost immediately followup that a 1.6 dependency snuck in there, including detailed reports.</p>

<p>Earlier, someone contributed XFN support for it. And, for lombok, we&#8217;ve recently received patches for netbeans and JDK7 support. The current lombok &#8216;hailbunny&#8217; beta is out with netbeans support thanks to these patches (Jan Lahoda: You rock!). You can download the beta <a href="http://projectlombok.org/downloads/lombok-0.9.2-BETA3RC.jar">here</a>.</p>

<p>Could be a coincidence, but this is the first time that the <em>make it open source and people send you patches</em> theory is starting to work out, and as a developer, that kind of feedback is just awesome.</p>

<p>So, if you are a user of an open source project and you find a bug or think of a nice feature, implement it, send a patch, and odds are you&#8217;ll get the eternal gratitude of the developer, and you&#8217;ll likely see your patch integrated into the main release.</p>

<div id="attachment_247" class="wp-caption alignnone" style="width: 310px"><img src="http://zwitserloot.com/wp-content/uploads/russell_eyepatch.jpg" alt="Patches rock!" title="Patches rock!" width="300" height="400" class="size-full wp-image-247" /><p class="wp-caption-text">Patches rock!</p></div>
]]></content:encoded>
			<wfw:commentRss>http://zwitserloot.com/2009/12/09/i-love-patches/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Mark Reinhold on jigsaw &#8211; live notes from devoxx</title>
		<link>http://zwitserloot.com/2009/12/06/mark-reinhold-on-jigsaw-live-notes-from-devoxx/</link>
		<comments>http://zwitserloot.com/2009/12/06/mark-reinhold-on-jigsaw-live-notes-from-devoxx/#comments</comments>
		<pubDate>Sun, 06 Dec 2009 19:07:31 +0000</pubDate>
		<dc:creator>rzwitserloot</dc:creator>
				<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://zwitserloot.com/?p=235</guid>
		<description><![CDATA[I posted this on the java posse googlegroup about 5 minutes after Mark Reinhold&#8217;s talk on jigsaw at devoxx &#8217;09. I&#8217;m consolidating it here on my blog after some requests to do so. Notes from his presentation at devoxx, 17:40-18:40 Central European Time, November 19th, 2009. Section 1: Problems and Solutions (why jigsaw, what is [...]]]></description>
			<content:encoded><![CDATA[<p>I posted this on the <a href="http://groups.google.com/group/javaposse/browse_thread/thread/9a6f2630306ad2f3">java posse googlegroup</a> about 5 minutes after Mark Reinhold&#8217;s talk on jigsaw at devoxx &#8217;09. I&#8217;m consolidating it here on my blog after some requests to do so.</p>

<p><span id="more-235"></span></p>

<p>Notes from his presentation at devoxx, 17:40-18:40 Central European Time, November 19th, 2009.</p>

<h2>Section 1: Problems and Solutions</h2>

<h3>(why jigsaw, what is it trying to solve? Subtext: What is it trying to solve that OSGi can&#8217;t?)</h3>

<p>jigsaw exists because they want to have modules-all-the-way-down. OSGi depends on java classes, but how can you then modularize the core java classes like <code>java.util.List</code> or even <code>java.lang.String</code> with OSGi? So, the module system needs to be done in the JVM core. OSGi comes with baggage such as lifecycle management that isn&#8217;t needed for slicing <code>rt.jar</code> into modules.</p>

<p>Secondly, jar files are a fine distro tool, but a crappy runtime tool, so a new package processing system is required. If everyone versions, then we can go back to the model of installing &#8216;jars&#8217; (whatever they will be) into the system, without running into version conflicts anymore. By changing the format between running and distro, java can verify at install time, do some ahead-of-time compilation, and store JIT profiles straight into the local module base for future executions of the JVM. This is not something OSGi does (or even should do). Also, class files are great for distribution, but they aren&#8217;t that great for efficient loading. The java core libraries are what they are. They can&#8217;t be changed now. And yet, e.g. <code>java.io.FileInputStream</code> has a method to get a <code>java.nio.FileChannel</code>. If <code>java.io</code> and <code>java.nio</code> are to be different packages, and you don&#8217;t want <code>io</code> to be dependent on <code>nio</code>, then what?</p>

<p>Even worse, some non-util packages contribute a class or two to <code>java.util</code>. OSGi is very much anti split packages. If java were to be designed from scratch with modularization in mind, that might be okay, but java wasn&#8217;t. Thus, split packages, in-package optional dependencies are all fairly complicated requirements that are needed for slicing <code>rt.jar</code> into modules.</p>

<p>Big point he keeps making: He looked at OSGi to slice <code>rt.jar</code>, decided it just wasn&#8217;t going to work, so came up with a new module system that is mostly not intersecting with OSGi&#8217;s bailiwick. And then he decided that, as java code itself will have to have the capability of stating that it doesn&#8217;t, for example, need <code>swing</code>, or <code>nio</code>, or <code>corba</code> (heh), it makes sense to allow other people to make modules in this as well. Hence, jigsaw.</p>

<h2>Section 2: Jigsaw &#8211; technical details</h2>

<h3>Part A: Grouping</h3>

<p>A module system needs to group classes and other resources in a single module.</p>

<p>jigsaw solution: <code>module-info.java</code> file, at the top of the relevant source tree (so at <code>~/module.info</code> if your class is at <code>~/com/foo/Whatever.class</code>)</p>

<p>Flipside of coin: Need ability to state dependency, better than <code>import foo;</code></p>

<p>example:</p>

<pre><code>module com.foo {
    requires org.bar.lib;
    requires edu.baz.util;
}
</code></pre>

<p>and with versions:</p>

<pre><code>module com.foo @ 1.0.0 {
    requires org.bar.lib @ 2.1-alpha;
    requires edu.baz.util @ 5.2_11;
}
</code></pre>

<p>Version syntax is now chosen to be non-descriptive at all. Anything goes. Just like apt-get. Awareness of the need to then look up versioning scheme per module, and there WILL be syntaxes like 2.(1+). Preferable to OSGi forced versioning system. Tokenizes on a limited number of characters (dots and dashes, pretty much), and each subsequence can be matched against with wildcards. It seems to work well for debian, and for rpm (their their algo is slightly different), hence confidence this will be fine, and should make for much easier adoption amongst existing projects, such as Oracle v1.9.12.0.0.0.0.0.0.0.0.0.2 <em>(red: I&#8217;m channeling Joe here, not Mark)</em></p>

<p>As there is to be interop between e.g. rpm and debian, anything more rigid will also not translate very well (e.g. a complex wildcard just couldn&#8217;t be translated to a deb file!) <code>requires</code> by default flows through to dependents. So if A requires B, and C requires B, then C has access to A&#8217;s stuff. Get around via <code>requires private</code>.</p>

<p>You can also get around this FROM A:</p>

<pre><code>module com.foo.secret {
    permits com.foo.lib;
}
</code></pre>

<p>means that only <code>com.foo.lib</code> can <code>requires</code> it, and can&#8217;t export it (forced to say <code>private</code>, or compiler error).</p>

<p>Optional dependencies: <code>requires optional</code></p>

<p>Of course, your code will need to deal with the <code>ClassNotFoundErrors</code> and such that could result.</p>

<p>virtual modules: Like apt-get&#8217;s virtual <code>java</code> package. It&#8217;s a bit like a module interface concept, though it&#8217;s just a name, there&#8217;s no structure in a virtual module. So:</p>

<pre><code>module com.foo.lib {
}

module com.foo.lib.impl.phone {
    provides com.foo.lib;
}
</code></pre>

<p>If another module then wants <code>com.foo.lib</code>, it&#8217;ll get <code>com.foo.lib.impl.phone</code>.</p>

<h3>Part B: Interop with other packaging systems, and module distribution.</h3>

<p>You can for example create a debian package (For apt-get, so you can install on ubuntu, debian, etc):</p>

<pre><code>jpkg - m classes deb com.foo.app com.foo.lib
</code></pre>

<p>creates a .deb file for apt-get from the modules <code>com.foo.app</code> and <code>com.foo.lib</code>. All dependencies are reflected into the debian package, so if <code>com.foo.app</code> requires <code>foo.bar.baz</code>, this is reflected in the apt file&#8217;s <code>Requires</code> block.</p>

<p>For windows, with no such package manager, or in any java-centric environment, or even on phones with a stripped-down linux without rpm or apt-get, you just stick with java&#8217;s own. There will be a platform independent transfer format (basically v2.0
of jar files. Won&#8217;t be zip on the inside, will be opaque so the format can be revved by sun over time, but it&#8217;s mostly the same concept). It will have a new file extension.</p>

<h3>Part C: Slicing the JDK.</h3>

<p>Here&#8217;s a chart of dependencies per package in java core library:</p>

<p><img src="http://img.mobypicture.com/6742728c9690cc3c01d5f2bfaf101289_full.jpg" alt="deps-core" /></p>

<p>Here&#8217;s what base is dependent on in JDK6 (so, almost everything):</p>

<p><img src="http://img.mobypicture.com/00e8081bf4d3cb234d3228ee6dafc077_full.jpg" alt="deps-jdk6" /></p>

<p>Here&#8217;s what it looks like now in an experimental JDK7. with base dependent on very little, and nearly acyclic:</p>

<p><img src="http://img.mobypicture.com/0e91bc811727df81337d1812bb4cda3c_full.jpg" alt="deps-jdk7" /></p>

<p>And even simpler with optional deps removed (this photo you should be able to read):</p>

<p><img src="http://img.mobypicture.com/909438be5b3529b3d3e9dc8ac13fe1f7_full.jpg" alt="deps-jdk7-detail" /></p>

<p><em>JIGSAW BINARIES</em> will go live in a few minutes after this talk!</p>

<p><a href="http://openjdk.java.net/projects/jigsaw">http://openjdk.java.net/projects/jigsaw</a></p>

<p><a href="http://dl.openjdk.java.net/jigsaw">http://dl.openjdk.java.net/jigsaw</a></p>

<p>only binaries for unbuntu jaunty, but you can always build from source (that&#8217;s just because Mark is an ubuntu user). It&#8217;s all very raw, but it includes the packaging tools, as well as support for <code>module-info.java</code> and the like.</p>

<h3>Part D: OSGi interop.</h3>

<p>(Not mentioned in main presentation, but someone asked).</p>

<p>Status unknown, but it&#8217;s something they&#8217;ll look at. Realization that compatibility is rather difficult due to different requirements, such as split-packages. Realization that having 2 competing module formats, forcing lib devvers to make 2 versions. Something Mark is looking at is extending jigsaw libraries to just wrap around an OSGi library. That way, you can choose to just make an OSGi library and ship that.</p>

<p>NB: There&#8217;s a BOF coming up on this at 20:00 Central European about the Modular Java Platform and Jigsaw with Mark, so this isn&#8217;t the last word.</p>

<p>NB2: Slicing <code>rt.jar</code> is well on its way, but not quite done yet. Still dependencies exist that will be eliminated before JDK7 RC. Also, so far, no measurable performance benefits (yet). However, new installed-module stuff (ahead-of-time implementation, second version of class file format optimized for reading, jit profiles) aren&#8217;t live yet, and should bring significant performance benefits.</p>
]]></content:encoded>
			<wfw:commentRss>http://zwitserloot.com/2009/12/06/mark-reinhold-on-jigsaw-live-notes-from-devoxx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pascal&#8217;s Wager for environmentalists: You&#8217;re being silly.</title>
		<link>http://zwitserloot.com/2009/01/20/pascals-wager-for-environmentalists-youre-being-silly/</link>
		<comments>http://zwitserloot.com/2009/01/20/pascals-wager-for-environmentalists-youre-being-silly/#comments</comments>
		<pubDate>Tue, 20 Jan 2009 01:01:34 +0000</pubDate>
		<dc:creator>rzwitserloot</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[environment]]></category>

		<guid isPermaLink="false">http://www.zwitserloot.com/?p=201</guid>
		<description><![CDATA[Every so often a well meaning famous person re-invents the notion of the environmentalist Pascal&#8217;s Wager. The case being made works like this: We drastically reduce pollutionWe don&#8217;t change much Earth is doomed if we don&#8217;t drastically reduce our damage to the environment. Damage: 0Damage: Infinite Earth will be allright no matter what we do.Damage: [...]]]></description>
			<content:encoded><![CDATA[<p>Every so often a well meaning famous person re-invents the notion of the environmentalist <a href="http://en.wikipedia.org/wiki/Pascal%27s_wager">Pascal&#8217;s Wager</a>. The case being made works like this:</p>

<table border="1"><tr><td></td><td>We drastically reduce pollution</td><td>We don&#8217;t change much</td></tr>
<tr><td>Earth is doomed if we don&#8217;t drastically reduce our damage to the environment.</td>
<td>Damage: 0</td><td>Damage: Infinite</td></tr>
<tr><td>Earth will be allright no matter what we do.</td><td>Damage: couple billion dollars</td><td>Damage: 0</td></tr></table>

<p>The theory then goes: Even if the odds that the earth is actually doomed unless we make some drastic changes is very low &#8211; then the above table should make it obvious that anything above 0% is more than enough reason to get drastic and do get started right now. After all, multiplying the odds will always get you to -infinity if the world decides to keep going as we are.</p>

<p>This argument is often touted by crackpots. See <a href="http://www.youtube.com/watch?v=zORv8wwiadQ">Exhibit A</a>. That&#8217;s okay &#8211; it takes all sorts to make a world. However, I get personally miffed when otherwise <a href="http://radar.oreilly.com/2009/01/pascals-wager-and-climate-change.html">very smart people</a> fall for this logical fallacy. I get even more miffed when they somehow proudly proclaim how they repurposed Pascal&#8217;s Wager. Pascal&#8217;s Wager is itself a fairly obvious fallacy. Normally, smart people are supposed to be able to add two and two together. Maybe that M. Night Shyamalan movie was on the something and tree hugging makes your brains fall out of your ears. I don&#8217;t know what it is.</p>

<p>Thus, a public service for all those who experience temporary bouts of idiocy when it comes to the environment. It happens to all of us, don&#8217;t feel bad.</p>

<p>I&#8217;ll fix that table for you, should make it obvious why you should stop talking about Pascal already:</p>

<table border="1"><tr><td></td><td>We drastically reduce pollution</td><td>We instead focus on space flight (a big source of pollution if you do a lot of it)</td></tr>
<tr><td>Earth is doomed if we don&#8217;t drastically reduce our damage to the environment.</td>
<td>Damage: 0</td><td>Damage: Infinite</td></tr>
<tr><td>Earth will be allright environment-wise, but in 20 years a comet will obliterate this planet.</td><td>Damage: Infinite</td><td>Damage: 0</td></tr></table>

<p>If you think that particular doom scenario is preposterous, I will posit that earth being utterly doomed when we don&#8217;t fix up the environment is similarly preposterous. There are also lots and lots of other doom scenarios: A killer virus, aliens, global thermonuclear war, a world-wide revolt due to male overpopulation and religious fanaticism due to continued poverty, corruption, and civil war in the third world &#8211; pick your poison. You&#8217;ll find plenty of theories about how the earth could end if we aren&#8217;t careful.</p>

<p>So, we should fix all of that right?</p>

<p>Right. Except earth is a place of finite resource. Human creativity is still a finite resource. We can&#8217;t focus on all of that equally. We have to make choices.</p>

<p>And this is where I, and other sane and right thinking individuals like <a href="http://www.ted.com/index.php/talks/bjorn_lomborg_sets_global_priorities.html">Bjorn Lomborg</a> &#8211; who is one of the few true environmentalists I know of, stand: The only way to get out of this dilemma is to create win-win scenarios. Running around like a headless chicken screaming bloody murder about the environment, using cockamamie theories like the Environmentalist&#8217;s Pascal&#8217;s Wager, the more we&#8217;re going to really risk ending up doomed. There are so many things we could do that would actually save the environment, and be a net positive effect on mankind economically and scientifically, but virtually none of it gets done. Instead we spend all our time lobbying for people to become just as treehugger crazy and for utterly ineffective corn ethanol. D&#8217;oh.</p>

<p>There&#8217;s also a long-standing tradition in certain more fanatical <a href="http://www.greenpeace.org/international/">environmentalist groups</a> to be completely unreasonable, and make downright retarded decisions. Every hip american buying a Prius is one fine example: Considering the trade-in value is so worthless that most of them hit the scrapyards inside of 15 years (those batteries just don&#8217;t last all that long), you should probably just buy a Hummer. Mother Earth would be more grateful. Inane FUD spreading of nuclear power plants is another one: It&#8217;s a very tough choice, but France has been doing just fine with it so far. If the french can make nuclear safe enough, then what the heck is everybody whining about? We should at least take it a bit more seriously.</p>

<p>Apple is being torched almost daily for not being green enough. This is the company that make the notebook computer as the only computer you own popular. The amount of power and material saved is enormous. Green peace and company should grovel at Steve Jobs&#8217; knees and thank him for the good he&#8217;s done. Of every soul I meet that proclaims they are an environmentalist, 99% of them are short sighted bags of hot air. It annoys me so.</p>

<p>The latest fine example of environmentalists being absolute idiots is <a href="http://technology.timesonline.co.uk/tol/news/tech_and_web/article5489134.ece">2 google searches generate 7 grams of co2</a>.</p>

<p>Riiiight &#8211; and driving to the library and spending 5 hours looking it up there is much better for the environment. How short-sighted can you get? Google, and the internet in general, is the best most scalable thing that has ever happened to the environment.</p>

<p>I&#8217;m not a global warming denialist. I strongly feel that we, as mankind, ought to be doing more. I just get annoyed when otherwise smart people turn into blithering idiots, is all. Please, for the sake of this planet &#8211; use some common sense. I thank you.</p>
]]></content:encoded>
			<wfw:commentRss>http://zwitserloot.com/2009/01/20/pascals-wager-for-environmentalists-youre-being-silly/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The dinosaur suicides.</title>
		<link>http://zwitserloot.com/2008/12/10/the-dinosaur-suicides/</link>
		<comments>http://zwitserloot.com/2008/12/10/the-dinosaur-suicides/#comments</comments>
		<pubDate>Wed, 10 Dec 2008 22:11:20 +0000</pubDate>
		<dc:creator>rzwitserloot</dc:creator>
				<category><![CDATA[marketing]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[blackberry]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[markets]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[mpaa]]></category>
		<category><![CDATA[palm]]></category>
		<category><![CDATA[rim]]></category>

		<guid isPermaLink="false">http://www.zwitserloot.com/?p=197</guid>
		<description><![CDATA[Quoth Stephen Fry about the new Blackberry Storm: An accelerometer is a device that lets an object know which way up it is. That’s just what the RIM corporation itself seems to need, for it is clear that with the release of this dog they don’t know their tits from their tibias. And his isn&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>Quoth <a href="http://www.stephenfry.com/blog/2008/12/11/gee-one-bold-storm-coming-up%e2%80%a6/">Stephen Fry</a> about the new Blackberry Storm:</p>

<blockquote>
An accelerometer is a device that lets an object know which way up it is. That’s just what the RIM corporation itself seems to need, for it is clear that with the release of this dog they don’t know their tits from their tibias.
</blockquote>

<p>And his isn&#8217;t the only brutal review of the storm around. It seems to be universally panned to the point of <em>hate</em>.</p>

<p>It&#8217;s RIM&#8217;s attempt to build an iPhone. It even includes one actual honest attempt to innovate: Its touchscreen clicks down physically like apple&#8217;s new macbook trackpads. They screwed it up royally, but that&#8217;s sort of the point: These dinosaurs of the old age tend to run themselves full tilt into a wall when faced with revolutionary competitors. When you&#8217;re the market leader, you <em>don&#8217;t</em> make a product that is way more immature than the new competition. Everyone that values stability and patience, the <em>one</em> market you get for free, goes running to your competitor. What could possibly possess RIM to screw up so gigantically?</p>

<p><img src="http://www.zwitserloot.com/wp-content/uploads/2008/12/bunny-suicide.gif" alt="" title="bunny-suicide" width="450" height="311" class="aligncenter size-full wp-image-198" /></p>

<p>Palm self destructed spectacularly when it faced some marginal competition, but the handheld device market isn&#8217;t the only industry that has kindly committed seppuku to let the new blood run rampant. Microsoft is finally getting some actual pushback on many fronts and in response they hand over the keys to the kingdom to <a href="http://en.wikipedia.org/wiki/Steve_Ballmer">Steve &#8216;chairsbane monkeydance&#8217; the marketer</a>. A marketer? Microsoft? Bill Gates would turn in his grave&#8230; is what we would have said if he wasn&#8217;t the guy that made that happen. Is self-destructing microsoft part of his new <a href="http://en.wikipedia.org/wiki/Bill_%26_Melinda_Gates_Foundation">humanitarian efforts</a>? Microsoft&#8217;s recent OS release, utterly ignorant of a new world filled with notebooks, netbooks, and mobile phones, all of which want slick kernels that know how to conserve power, is such a fantastic dud that it defies comprehension. That took 7 years?</p>

<p>Piracy became a somewhat serious problem when it became easy and pedestrian. Before napster, a dedicated individual could pay 5 bucks a month for newsgroup access and download -whatever- he could possibly want as fast as his pipe can carry it. But you need some serious technical knowhow. Napster and its children, and even bittorrent, via sites like the pirate bay, make fast transfer easy for everybody. -THAT- scares the pants off of the RIAA and the MPAA. How do they respond? By making the piracy <strong>easier</strong> than the real thing by charging prohibitive prices for legal online downloads, getting stuck in a new format war, and adding unskippable piracy warnings in front of every movie. The only way I can make sense of this move is if the MPAA is kindly downing the family size bottle of sleeping pills in order to make way for a new digital distribution age.</p>

<p>How about the car industry? &#8220;Bailout&#8221;. Nuff said. The sheer insanity of the leaders of the big three in the US has already been covered far better in numerous other places.</p>

<p>What in the world possesses these companies to self destruct so quickly when faced with something they do not understand?</p>

<p>One thing I do know: Without the convenient propensity of the big hulking elephants in the industry to shoot themselves in the face, the world wouldn&#8217;t be moving forward nearly as quickly. Thank you, dinosaurs. Thank you very much.</p>
]]></content:encoded>
			<wfw:commentRss>http://zwitserloot.com/2008/12/10/the-dinosaur-suicides/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python3k: Compatibility fail</title>
		<link>http://zwitserloot.com/2008/12/06/python3k-compatibility-fail/</link>
		<comments>http://zwitserloot.com/2008/12/06/python3k-compatibility-fail/#comments</comments>
		<pubDate>Sat, 06 Dec 2008 11:10:51 +0000</pubDate>
		<dc:creator>rzwitserloot</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.zwitserloot.com/?p=195</guid>
		<description><![CDATA[The blogosphere is rapidly heating up with dismay and sometimes outright anger at the bungling of the Python 3000 release. I walked into the #django IRC channel and I got my head bitten off for asking which version of python I should use for django. (After the channel cooled down some, I was able to [...]]]></description>
			<content:encoded><![CDATA[<p>The blogosphere is rapidly heating up with dismay and sometimes outright anger at the bungling of the Python 3000 release. I walked into the #django IRC channel and I got my head bitten off for asking which version of python I should use for django. (After the channel cooled down some, I was able to ask why: Evidently every 5 minutes someone asks if django is py3k compatible).</p>

<p>Herein lies at least some vindication for Sun&#8217;s &#8216;backwards compatibility trumps everything&#8217; mode of thought regarding java releases. You must be backwards compatible.</p>

<p>What intrigues me some is that this python3k release could have been done so much nicer, and it wouldn&#8217;t have been too difficult:</p>

<p>Start with a &#8216;version&#8217; indicator in the source. Something like &#8216;python 3&#8242; right at the top of the file (it would be legal nowhere else, to avoid having to declare a real new keyword). This then gives the interpreter the opportunity to parse the file differently, depending on version. Lack of version indicator means its assumed to be python 2.6 (the last pre-3 release).</p>

<p>Now, some py3k changes may not be easily solvable even if the interpreter knows what the code was written for. But the simple stuff, such as py3k &#8216;range&#8217; being the same as py2k&#8217;s &#8216;xrange&#8217;, and py3k no longer having an xrange function at all, could easily be handled by a backwards compatible py3k interpreter. With some effort I bet you could build a py3k that is 100% backwards compatible in this fashion. Python is a dynamic language with duck typing, which makes this proposal quite a bit easier compared to a language that uses nominal typing, such as java. So why hasn&#8217;t python taken this option?</p>

<p>I have no idea.</p>

<p>That&#8217;s not all she wrote though: I am still waiting for a language that offers infinite smooth upgrade ability for its own language, its own core libraries, and for any third party library that chooses to offer it. I&#8217;ve tried to work this out and its not exactly simple to build such a programming language, but it can be done: Each library that wants to offer backwards compatibility can break its API and offer adapters that essentially build a &#8216;view&#8217; that acts like the older API. This way code expecting the old API can work with code that expected the newer API without breaking it. A few languages / loaders offer the ability to load whatever version a program expected, but those tools simply don&#8217;t work if one module of a program expects v2, and the other expects v3. That&#8217;s why you need views, so that the actual library itself can always be at the latest version. Also should be great for security updates: You now never need to update multiple versions. Just update the latest version and make sure the adapters work well.</p>
]]></content:encoded>
			<wfw:commentRss>http://zwitserloot.com/2008/12/06/python3k-compatibility-fail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Philips: Customer Service doghouse.</title>
		<link>http://zwitserloot.com/2008/12/06/philips-customer-service-doghouse/</link>
		<comments>http://zwitserloot.com/2008/12/06/philips-customer-service-doghouse/#comments</comments>
		<pubDate>Sat, 06 Dec 2008 10:38:25 +0000</pubDate>
		<dc:creator>rzwitserloot</dc:creator>
				<category><![CDATA[marketing]]></category>
		<category><![CDATA[philips]]></category>

		<guid isPermaLink="false">http://www.zwitserloot.com/?p=193</guid>
		<description><![CDATA[That was an interesting experience. Frustrated that a giant, recently bought, Philips TV&#8217;s remote control is incapable of controlling the philips satellite box next to it, without much help from the user manual, I decided to ring them up. Maybe Seth Godin is slipping a little, but Seth Godin&#8217;s simple missive: Make a customer happy [...]]]></description>
			<content:encoded><![CDATA[<p>That was an interesting experience. Frustrated that a giant, recently bought, Philips TV&#8217;s remote control is incapable of controlling the philips satellite box next to it, without much help from the user manual, I decided to ring them up.</p>

<p>Maybe Seth Godin is slipping a little, but Seth Godin&#8217;s simple missive: <a href="http://sethgodin.typepad.com/seths_blog/2008/11/how-to-answer-t.html">Make a customer happy when he calls. Otherwise, <strong>do not answer the phone!</strong></a> &#8211; is very much true.</p>

<p>Before I called, I was mildly annoyed that philips hardware can&#8217;t work with philips hardware. After I called, I was seething mad at their boundless idiocy.</p>

<p>After half an hour getting the runaround, the conclusion was that the Philips TV and the Philips satellite receiver aren&#8217;t compatible. It was my fault for not realizing it, according to Philips, because &#8216;STB&#8217; stands for Set Top Box, and not Satellite Box. This was a fairly basic mistake so they wouldn&#8217;t try to fix it by e.g. sending me a Philips Universal Remote Control. When I pointed out that their own technical support staff are just as clueless as I am (given the runaround I&#8217;ll describe below the fold), and that their standards seemed to be set just <em>slightly</em> too high, the service rep got angry with me. Specifically, she was quite perturbed about me not accepting her apologies. That just bewilders me. I thought it was a tech support number, not a &#8220;We&#8217;ll listen to your whines and agree with you, for 10ct a minute&#8221; service number. Why would her personal apology that their hardware sucks help?</p>

<p>How come I, a techno geek, knows more about marketing than a supposed world leader in this sort of thing?</p>

<p>Well, congratulations, Philips. That&#8217;s the last time I&#8217;ll ever buy from you.</p>

<p><span id="more-193"></span></p>

<p>The runaround was even worse:</p>

<p>First guy I got wants to know my personal details (I told him to go screw himself, but nicely, considering that I had a simple question and I was paying to call them), then wants to know how the satellite box was connected to the TV. At this point I bit back a colourful statement regarding his brain size, and instead just said &#8220;I&#8217;m talking about the remote control!&#8221;. He put me on hold, it took too long, so I hung up instead and redialed in a hope to get a more clueful operator.</p>

<p>The next operator at least got the basic gist and gave me a different number for their universal remote control division. I told him it wasn&#8217;t a universal remote, but he was certain they&#8217;d fix it for me.</p>

<p>I then dialed the other number and got a very clueful person on the line. He actually insulted the other number&#8217;s staff, apologizing profusely for sending me on a wild goose chase. He double checked the TV&#8217;s model number and then assured me that my remote isn&#8217;t programmable and if it doesn&#8217;t work right away it never will. He then gave me a last hail mary and gave me the way their universal remotes are configured: Press the STB button continuously until your satellite box turns off. Let go right away &#8211; it&#8217;s now set. That didn&#8217;t work.</p>

<p>Armed with this knowledge, I dialed the main number again to ask for a reasonable solution. I then made the mistake of mentioning that the satellite box was bought slightly too long ago for me to return it, at which point the tone of the conversation turned icy and the above story was foisted on me.</p>
]]></content:encoded>
			<wfw:commentRss>http://zwitserloot.com/2008/12/06/philips-customer-service-doghouse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
