<?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>khi's life with an ech</title>
	<atom:link href="http://khigia.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://khigia.wordpress.com</link>
	<description>where even the subtitle doesn't help to understand the title</description>
	<lastBuildDate>Thu, 08 Sep 2011 23:15:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='khigia.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>khi's life with an ech</title>
		<link>http://khigia.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://khigia.wordpress.com/osd.xml" title="khi&#039;s life with an ech" />
	<atom:link rel='hub' href='http://khigia.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Thanks wordpress.com</title>
		<link>http://khigia.wordpress.com/2009/05/24/thanks-wordpress-com/</link>
		<comments>http://khigia.wordpress.com/2009/05/24/thanks-wordpress-com/#comments</comments>
		<pubDate>Sun, 24 May 2009 16:19:37 +0000</pubDate>
		<dc:creator>khigia</dc:creator>
				<category><![CDATA[erlang]]></category>
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://khigia.wordpress.com/?p=217</guid>
		<description><![CDATA[Dear reader, This blog is moving to some other hosting service (and other blog platform). This blog URL will change and the RSS feed will change too; sorry about that. If you want to follow this blog, please consider browsing http://blog.khigia.net and changing your RSS subscription to http://feeds2.feedburner.com/khigia/blog (or http://feeds2.feedburner.com/khigia/blog/erlang to filter only erlang related [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=khigia.wordpress.com&amp;blog=490125&amp;post=217&amp;subd=khigia&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Dear reader,</p>
<p>This blog is moving to some other hosting service (and other blog platform).</p>
<p>This blog URL will change and the RSS feed will change too; sorry about that.</p>
<p>If you want to follow this blog, please consider browsing <a href="http://blog.khigia.net">http://blog.khigia.net</a> and changing your RSS subscription to <a href="http://feeds2.feedburner.com/khigia/blog">http://feeds2.feedburner.com/khigia/blog</a> (or <a class="popup" href="http://feeds2.feedburner.com/khigia/blog/erlang" target="_blank">http://feeds2.feedburner.com/khigia/blog/erlang</a> to filter only erlang related posts).</p>
<p>Thanks WordPress.com for both the hosting and the platform you&#8217;re providing.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/khigia.wordpress.com/217/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/khigia.wordpress.com/217/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/khigia.wordpress.com/217/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/khigia.wordpress.com/217/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/khigia.wordpress.com/217/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/khigia.wordpress.com/217/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/khigia.wordpress.com/217/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/khigia.wordpress.com/217/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/khigia.wordpress.com/217/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/khigia.wordpress.com/217/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/khigia.wordpress.com/217/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/khigia.wordpress.com/217/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/khigia.wordpress.com/217/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/khigia.wordpress.com/217/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=khigia.wordpress.com&amp;blog=490125&amp;post=217&amp;subd=khigia&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://khigia.wordpress.com/2009/05/24/thanks-wordpress-com/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/714c7a1f37a4027d4a9ebc9d0aeafdfa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">khigia</media:title>
		</media:content>
	</item>
		<item>
		<title>Adding a timeout to a shell command</title>
		<link>http://khigia.wordpress.com/2009/04/24/adding-a-timeout-to-a-shell-command/</link>
		<comments>http://khigia.wordpress.com/2009/04/24/adding-a-timeout-to-a-shell-command/#comments</comments>
		<pubDate>Fri, 24 Apr 2009 16:40:42 +0000</pubDate>
		<dc:creator>khigia</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[timeout]]></category>

		<guid isPermaLink="false">http://khigia.wordpress.com/?p=173</guid>
		<description><![CDATA[Quite a few times one or the other of my automation shell scripts got hang while running some external command (e.g. a remote shell command may hang if network is in weird state). For those cases where a stopped automation script could really hurt the system, I ended up writing a script wrapper that add [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=khigia.wordpress.com&amp;blog=490125&amp;post=173&amp;subd=khigia&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Quite a few times one or the other of my automation shell scripts got hang while running some external command (e.g. a remote shell command may hang if network is in weird state). For those cases where a stopped automation script could really hurt the system, I ended up writing a script wrapper that add a timeout to any command.</p>
<p>This is kind of heavy weight implementation: instead of running the command directly, this start a first process sleeping for the duration of the timeout, and execute the command in a background process, and finally return the result of the first finishing process! 3 processes: 1 working, 1 sleeping, 1 waiting &#8230; but it helped me few times!</p>
<p><a href="http://gist.github.com/101192">http://gist.github.com/101192</a></p>
<p>Can&#8217;t embed the gist in this blog <img src='http://s0.wp.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/khigia.wordpress.com/173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/khigia.wordpress.com/173/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/khigia.wordpress.com/173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/khigia.wordpress.com/173/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/khigia.wordpress.com/173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/khigia.wordpress.com/173/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/khigia.wordpress.com/173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/khigia.wordpress.com/173/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/khigia.wordpress.com/173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/khigia.wordpress.com/173/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/khigia.wordpress.com/173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/khigia.wordpress.com/173/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/khigia.wordpress.com/173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/khigia.wordpress.com/173/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=khigia.wordpress.com&amp;blog=490125&amp;post=173&amp;subd=khigia&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://khigia.wordpress.com/2009/04/24/adding-a-timeout-to-a-shell-command/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/714c7a1f37a4027d4a9ebc9d0aeafdfa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">khigia</media:title>
		</media:content>
	</item>
		<item>
		<title>For the lost twitter sheeps</title>
		<link>http://khigia.wordpress.com/2009/04/10/for-the-lost-twitter-sheeps/</link>
		<comments>http://khigia.wordpress.com/2009/04/10/for-the-lost-twitter-sheeps/#comments</comments>
		<pubDate>Fri, 10 Apr 2009 13:42:29 +0000</pubDate>
		<dc:creator>khigia</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://khigia.wordpress.com/?p=152</guid>
		<description><![CDATA[Tweet-tweet here, tweet-tweet there, here tweet, there tweet, &#8230; everybody tweet! And you got to choose who to follow or you&#8217;ll be quickly overwhelmed! MrTweet can help you there by proposing you some tweets to follow. How can he achieve that? Through this blog post, let&#8217;s focus on the subject of recommending twitter users to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=khigia.wordpress.com&amp;blog=490125&amp;post=152&amp;subd=khigia&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Tweet-tweet here, tweet-tweet there, here tweet, there tweet, &#8230; everybody tweet! And you got to choose who to follow or you&#8217;ll be quickly overwhelmed!</p>
<p><a href="http://mrtweet.net/">MrTweet </a>can help you there by proposing you some tweets to follow. How can he achieve that? Through this blog post, let&#8217;s focus on the subject of recommending twitter users to follow to existing user.</p>
<p>Disclamer: I have no accointance what&#8217;s so ever with MrTweet, and absolutely no knowledge about it, nada; all the following are random thoughts; oh, and I have no accointance with <a href="http://twitter.com/">Twitter </a>neither!</p>
<p>Let say you have access to all the tweets of the world [1], and you can know who&#8217;s following who on twitter. How would you look for new user to follow?<br />
Obviously there are quite a few possibilities &#8230; and some of them are probably yet to be invented. Traditionally, mining this kind of info can be done at 2 levels: (1) looking at the content and recommend to user U1 to follow user U2 if there is any correlation between tweets content of users U1 and U2; (2) second level is to look at the graph on connected communities and recommend user U1 to follow user U2 if they share some links in the graph.<br />
On top of this there are many refinements in what can be done to mine such information: focusing and differenciating static data and dynamic aspects of user behaviours, mixing approaches of content and meta data, looking for time-series correlation &#8230; this is a vast domain.</p>
<p>Following are some ideas about different way to implement MrTweet.</p>
<h2>The UserRank dictature</h2>
<p>Using a Pagerank-like algorithm to explore the graph of followers, you can obtain a global UserRank for all the twitter users.</p>
<p>Why Pagerank? Well, this is probably not the best approach of the problem, as it extract a global knowledge of your data, where in this case we should focus on communities. But heck! I like PageRank, it&#8217;s simple, and it&#8217;s a good start to think about the problem. PageRank was the first <a href="http://citeseer.ist.psu.edu/page98pagerank.html">scientific article</a> that I study thoroughly, and it was  a ha-ha moment: simple to read, easy to understand, easy to implement &#8230; computer science was possible! No need of linear algebra, matrix and eigenvector to understand it (it helps for the proof though <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ). [2]</p>
<p>So how to apply Pagerank to &#8220;tweeterers&#8221;? Well, following is one way to do it.</p>
<p>For each user consider its followers as mark of interest. The algo define PageRank number Pr of user U as the weighted sum of the Pr of all its followers, where the weight is in inverse proportion of the number of people followed by the follower.</p>
<p>That is, with some notations to make it hopefully clearer:</p>
<ul>
<li>Let Pr(U) be the PageRank of user U;</li>
<li>Let Fo(U) be the set of all user that U is following, and [Fo(U)] its cardinality;</li>
<li>Let Fi(U) be the set of all user that are following U;</li>
<li>PageRank is: Pr(Ux) = Sum(Pr(Un)/[Fo(Un)]), for all  Un in Fi(Ux).</li>
</ul>
<p>Thus Pr is high if the user is followed by users which have a high Pr and are not following everybody! Easy enough but wait &#8230; how to get the Pr of the followers? this is kind of a recursive definition!</p>
<p>The beauty of the PageRank algo is that it propose an simple iterative solution to solve this problem: asume first that everybody as a Pr=Pr_0 of 1/N (N is the number of users, this give everybody a fair starting value), compute the new Pr_1 of each user using Pr_0 assumption, then compute the Pr_2 of each user given your Pr_1 assumption &#8230; and iterate a few more times until the Pr stabilize, usually after few computations only (this is not magic but math &#8230; which sometimes looks alike). If you like matrix and linear algebra, you can write the whole process as a loop which multiply a the vector of all PageRank by a square matrix of all &#8216;follow-relations&#8217;.</p>
<p>Now, all we have is a Pr for each user? then what? Who shall I follow? Well, use your network to discover it!</p>
<p>Take all the people you are following, grab all the people they follow themselves, and remove your own sibling from this big set of people; sort them by Pr and you&#8217;ll get to follow the most &#8220;popular&#8221; people linked to your network.</p>
<p>We have a UserRank algo to recommend people to follow to any twitter user! Well, all this rely on assumption that being followed give the user some importance. And I don&#8217;t know if this works, I haven&#8217;t tried it! Maybe it can be done with google API and the twitter page of the user <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Let explore another algo with another kind of idea.</p>
<h2>Following the Slope</h2>
<p>In fact, what we&#8217;re looking for with MrTweet, is the same kind of recommendation as Amazon made popular: &#8220;users who like this also like that&#8221;. Using the same meta-data as previously (the graph of followers), we can rephrase it as &#8220;user who follow Ux and Uy are also following Uz&#8221;.</p>
<p>Algo to solve those problems are usually classified as recommender systems (see the NetFlix for importance of those kind of algo). A big problem of those solution for web application is often scalability and dynamic nature. But let&#8217;s pick one such recommender system and see what can be done for MrTweet problem.</p>
<p>No surprise, let&#8217;s look at <a href="http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.60.4503">SlopeOne</a> algorithm. The <a href="http://en.wikipedia.org/wiki/Slope_One">wikipedia page</a> explain it very simply and I surely can&#8217;t do better. All we need to do is map the data to our problem. Let say that if user U1 follow user U2, this means user U1 rate user U2 with weight 1. Doing so, we&#8217;ll have only rating of weight 1. This is ok for SlopeOne to give some result though.</p>
<p>The main difference with previous method of UserRank is that this is not a global analysis of all the users but rely more on the network of the user to which you want to do the recommendation.</p>
<p>Wanna real rating value to feed your SlopeOne algo? well, why not use the UserRank you defined previously as the rating value, and compute the SlopeOne prediction based on that? thus you would get as recommendation not the most popular user linked to your network but the most popular user liked by your network! Not so bad! Maybe yes, maybe not &#8230; need to be tested!</p>
<h2>More than a graph?</h2>
<p>We&#8217;ve been looking at the graph of followers, which give recommendatons based on &#8220;neighborhood&#8221;. Let&#8217;s open the problem a bit more &#8230;</p>
<ul>
<li>instead of using followers, we can look at the graph of replies</li>
<li>why not look at the tweet content? we could check correlation in keyword, or in the URL (even following the URL)?</li>
<li>why not cross data from twitter with data from other network? &#8230; and I&#8217;m going to read about this just here: http://33bits.org/2009/03/19/de-anonymizing-social-networks <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
</ul>
<p>I don&#8217;t know you, but this kind of problem delight me. But after all this thinking and no action, I&#8217;m now going to write some real code to do more than think about algo <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> .</p>
<p>[1] With N millions users, 7 tweets a day, 140 bytes a tweet in raw format &#8230; storage is not that huge, even for few years. How many twitter users? where does seven come from? who care! engineers only need order of magnitude and units!</p>
<p>[2] Pagerank is closely related to the hub and authorities: <a href="http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.120.3875">http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.120.3875</a> [3]</p>
<p>[3] I know, all those ref are &#8220;old&#8221; <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/khigia.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/khigia.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/khigia.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/khigia.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/khigia.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/khigia.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/khigia.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/khigia.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/khigia.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/khigia.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/khigia.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/khigia.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/khigia.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/khigia.wordpress.com/152/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=khigia.wordpress.com&amp;blog=490125&amp;post=152&amp;subd=khigia&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://khigia.wordpress.com/2009/04/10/for-the-lost-twitter-sheeps/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/714c7a1f37a4027d4a9ebc9d0aeafdfa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">khigia</media:title>
		</media:content>
	</item>
		<item>
		<title>TAOCP vs. Code Complete</title>
		<link>http://khigia.wordpress.com/2009/01/10/taocp-vs-code-complete/</link>
		<comments>http://khigia.wordpress.com/2009/01/10/taocp-vs-code-complete/#comments</comments>
		<pubDate>Sat, 10 Jan 2009 04:10:59 +0000</pubDate>
		<dc:creator>khigia</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://khigia.wordpress.com/?p=137</guid>
		<description><![CDATA[Surprising! as of now, in my experiences of software engineer, I met more people that read/know about TAOCP than people who read Code Complete. It may be a probability accident (I kind of remember that probabilities and small numbers are not good friends). It may also be influenced by my fields of experiences. But assuming [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=khigia.wordpress.com&amp;blog=490125&amp;post=137&amp;subd=khigia&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Surprising! as of now, in my experiences of software engineer, I met more people that read/know about <a href="http://www-cs-faculty.stanford.edu/~knuth/taocp.html">TAOCP</a> than people who read <a href="http://cc2e.com/">Code Complete</a>.</p>
<p>It may be a probability accident (I kind of remember that probabilities and small numbers are not good friends). It may also be influenced by my fields of experiences. But assuming this is real (i.e. programmers know more about TOACP), it&#8217;s doesn&#8217;t seems right.</p>
<p>I consider TAOCP as a reference to write efficient code; Code Complete is a reference to write good software (eventually being a product maintained by a team). Both are important, but the first one being used way less often!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/khigia.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/khigia.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/khigia.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/khigia.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/khigia.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/khigia.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/khigia.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/khigia.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/khigia.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/khigia.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/khigia.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/khigia.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/khigia.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/khigia.wordpress.com/137/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=khigia.wordpress.com&amp;blog=490125&amp;post=137&amp;subd=khigia&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://khigia.wordpress.com/2009/01/10/taocp-vs-code-complete/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/714c7a1f37a4027d4a9ebc9d0aeafdfa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">khigia</media:title>
		</media:content>
	</item>
		<item>
		<title>Back to roots &#8230; with physics!</title>
		<link>http://khigia.wordpress.com/2009/01/07/back-to-roots-with-physics/</link>
		<comments>http://khigia.wordpress.com/2009/01/07/back-to-roots-with-physics/#comments</comments>
		<pubDate>Wed, 07 Jan 2009 15:05:33 +0000</pubDate>
		<dc:creator>khigia</dc:creator>
				<category><![CDATA[cpp]]></category>
		<category><![CDATA[3D]]></category>
		<category><![CDATA[bullet]]></category>
		<category><![CDATA[irrlicht]]></category>
		<category><![CDATA[physics]]></category>

		<guid isPermaLink="false">http://khigia.wordpress.com/?p=129</guid>
		<description><![CDATA[This blog is not completely abandoned &#8230; I&#8217;m just buzy lazy those days. Just to relate my brief come back to roots: doing physics simulation in 3D . I&#8217;ve been playing with Irrlicht as 3D framework. It&#8217;s good, not to complex. But the API is not always easy (you&#8217;re forced to use the irrlicht not-automatic [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=khigia.wordpress.com&amp;blog=490125&amp;post=129&amp;subd=khigia&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This blog is not completely abandoned &#8230; I&#8217;m just buzy lazy those days.</p>
<p>Just to relate my brief come back to roots: doing physics simulation in 3D <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> .</p>
<p>I&#8217;ve been playing with <a title="Irrlicht" href="http://irrlicht.sourceforge.net/">Irrlicht</a> as 3D framework. It&#8217;s good, not to complex. But the API is not always easy (you&#8217;re forced to use the irrlicht not-automatic counting ref). I haven&#8217;t found doc about coordinate systems (orientation and angle&#8217;s units) but it&#8217;s using common practices in game engine. It&#8217;s pretty fast, and the simple included demos help a lot to get started (Ogre3D don&#8217;t come with simple examples).</p>
<p>For the physics engine, I&#8217;ve used <a title="Bullet" href="http://www.bulletphysics.com/Bullet/wordpress/">Bullet</a>, and it&#8217;s really pleasant to use! and result are great! I only quickly went through some part of the code, and it&#8217;s great code, I think I will learn quite a few tricks of this code (e.g. how to avoid conditional branch (&#8216;if&#8217;) to select between 2 unsigned integers &#8230; and it even can be usefull for efficiency on some processor like Cell (maybe related to parallelism and pipelining?). No really, this is beautiful code, and if you just want to play a little bit with physics, using Bullet directly is more fun than <a title="PAL" href="http://www.adrianboeing.com/pal/index.html">PAL</a> (Physic Abstraction Layer).</p>
<p>I&#8217;ll post the code when/if my Domino Rally simu is done <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  &#8230; but without sound it&#8217;s not good.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/khigia.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/khigia.wordpress.com/129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/khigia.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/khigia.wordpress.com/129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/khigia.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/khigia.wordpress.com/129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/khigia.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/khigia.wordpress.com/129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/khigia.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/khigia.wordpress.com/129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/khigia.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/khigia.wordpress.com/129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/khigia.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/khigia.wordpress.com/129/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=khigia.wordpress.com&amp;blog=490125&amp;post=129&amp;subd=khigia&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://khigia.wordpress.com/2009/01/07/back-to-roots-with-physics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/714c7a1f37a4027d4a9ebc9d0aeafdfa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">khigia</media:title>
		</media:content>
	</item>
		<item>
		<title>Terminology: radix, Patricia, TRIE and tree</title>
		<link>http://khigia.wordpress.com/2008/11/30/terminology-radix-patricia-trie-and-tree/</link>
		<comments>http://khigia.wordpress.com/2008/11/30/terminology-radix-patricia-trie-and-tree/#comments</comments>
		<pubDate>Sun, 30 Nov 2008 15:11:17 +0000</pubDate>
		<dc:creator>khigia</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://khigia.wordpress.com/?p=117</guid>
		<description><![CDATA[I took some time to get the terminology: radix tree/trie, patricia tree/trie &#8230; it&#8217;s all the same, really: A trie is a multi-way tree; I guess radix term replaced the Patricia appellation because it sounds more generic (not specific to information retrieval); And in the case of radix trie, if you use the binary representation [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=khigia.wordpress.com&amp;blog=490125&amp;post=117&amp;subd=khigia&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I took some time to get the terminology: radix tree/trie, patricia tree/trie &#8230; it&#8217;s all the same, really:</p>
<ul>
<li>A trie is a multi-way tree;</li>
<li>I guess radix term replaced the Patricia appellation because it sounds more generic (not specific to information retrieval);</li>
<li>And in the case of radix trie, if you use the binary representation of the key, you have an alphabet of 2 and the trie become a 2-ways tree, thus radix tree <img src='http://s2.wp.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/khigia.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/khigia.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/khigia.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/khigia.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/khigia.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/khigia.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/khigia.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/khigia.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/khigia.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/khigia.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/khigia.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/khigia.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/khigia.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/khigia.wordpress.com/117/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=khigia.wordpress.com&amp;blog=490125&amp;post=117&amp;subd=khigia&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://khigia.wordpress.com/2008/11/30/terminology-radix-patricia-trie-and-tree/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/714c7a1f37a4027d4a9ebc9d0aeafdfa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">khigia</media:title>
		</media:content>
	</item>
		<item>
		<title>String specific data-structure: set and map</title>
		<link>http://khigia.wordpress.com/2008/08/09/string-specific-data-structure-set-and-map/</link>
		<comments>http://khigia.wordpress.com/2008/08/09/string-specific-data-structure-set-and-map/#comments</comments>
		<pubDate>Sat, 09 Aug 2008 08:52:54 +0000</pubDate>
		<dc:creator>khigia</dc:creator>
				<category><![CDATA[ocaml]]></category>

		<guid isPermaLink="false">http://khigia.wordpress.com/?p=109</guid>
		<description><![CDATA[Lately I&#8217;ve been playing a bit &#8230; well, that&#8217;s a programmer kind of game: I wrote yet other implementations (with yet other bugs I assume) of some classic data-structures, in Ocaml. Those are all about string set or string map, and are purely functional (thus persistent). The code is in the project ocaml-stringset (http://github.com/khigia/ocaml-stringset/tree/master). There [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=khigia.wordpress.com&amp;blog=490125&amp;post=109&amp;subd=khigia&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Lately I&#8217;ve been playing a bit &#8230; well, that&#8217;s a programmer kind of game: I wrote yet other implementations (with yet other bugs I assume) of some classic data-structures, in Ocaml.</p>
<p>Those are all about string set or string map, and are purely functional (thus persistent).</p>
<p>The code is in the project ocaml-stringset (<a href="http://github.com/khigia/ocaml-stringset/tree/master">http://github.com/khigia/ocaml-stringset/tree/master</a>). There is a TST (ternary search tree), a Collapsed TST, a Trie (<a href="http://www.amazon.com/Purely-Functional-Structures-Chris-Okasaki/dp/0521663504">bootstrap version of Chris Okasaki</a>) and maybe other will be added. Most of the code is in file/module StringSet so it is easy to embed in a project. There is one example file for each datastructure (as well as some unit test &#8230; and the unit tests of TST iss pretty bad as it test the internal structure, not the API).</p>
<p>Haven&#8217;t been as far as doing stress tests though it would be nice to compare the different behaviours.</p>
<p><strong>Update:</strong> those algo are implemented for string, but we could certainly provide a generic implementation for any datatype that is iterable collection and whose items are comparable. I may try to make some generic version later on.</p>
<p><strong>Update:</strong> most of those tree algo implementation are NOT tail recursive; this would probably need continuations &#8230; I&#8217;ll add this if/when needed (in production environment, it should probably be done anyway except if the use case is restricted and ensure a limit in recursion depth).</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/khigia.wordpress.com/109/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/khigia.wordpress.com/109/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/khigia.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/khigia.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/khigia.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/khigia.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/khigia.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/khigia.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/khigia.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/khigia.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/khigia.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/khigia.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/khigia.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/khigia.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/khigia.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/khigia.wordpress.com/109/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=khigia.wordpress.com&amp;blog=490125&amp;post=109&amp;subd=khigia&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://khigia.wordpress.com/2008/08/09/string-specific-data-structure-set-and-map/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/714c7a1f37a4027d4a9ebc9d0aeafdfa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">khigia</media:title>
		</media:content>
	</item>
		<item>
		<title>Generate all pair permutations in (not really) random order (and space efficiently)</title>
		<link>http://khigia.wordpress.com/2008/08/07/generate-all-pair-permutations-in-not-really-random-order-and-space-efficiently/</link>
		<comments>http://khigia.wordpress.com/2008/08/07/generate-all-pair-permutations-in-not-really-random-order-and-space-efficiently/#comments</comments>
		<pubDate>Thu, 07 Aug 2008 10:03:34 +0000</pubDate>
		<dc:creator>khigia</dc:creator>
				<category><![CDATA[ocaml]]></category>

		<guid isPermaLink="false">http://khigia.wordpress.com/?p=104</guid>
		<description><![CDATA[(that time I learnt the lesson: never promise what the next post will be about coz I often not deliver) Optimization algo need to explore the space of solutions, and this exploration is a major part of the algo! Let&#8217;s focus on one simple case: exploring in random order two finite dimensions. For example, let [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=khigia.wordpress.com&amp;blog=490125&amp;post=104&amp;subd=khigia&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><em>(that time I learnt the lesson: never promise what the next post will be about coz I often not deliver)</em></p>
<p>Optimization algo need to explore the space of solutions, and this exploration is a major part of the algo! Let&#8217;s focus on one simple case: exploring in random order two finite dimensions. For example, let two integer variables, V1 taking value in interval [1, 100] and V2 taking value in interval [1, 20]: how to explore all the possible pairs (v1,v2) in random order?</p>
<p>A simple (almost-)solution is given by the following python code:</p>
<pre class="brush: python;">
[(e1,e2) for e1 in shuffle(range([1,100)), for e2 in shuffle(range(1,20))]
</pre>
<p>which is in fact the cartesian product of the shuffles of V1 and V2 intervals &#8230; but this is ordered by values of the first shuffle and thus not random.</p>
<p>OK, now is the bad news: I have no solution completely space efficient to propose. My best effort is a solution which compute at least two shuffles, one on each dimension (kind of O(n + m) for space) and is even not random &#8230; just random enough for most of the cases <img src='http://s2.wp.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>So how? the solution is describe in this post <a href="http://weblog.raganwald.com/2007/02/haskell-ruby-and-infinity.html">http://weblog.raganwald.com/2007/02/haskell-ruby-and-infinity.html</a> and especialy the section about the tabular view of the cartesian product. Did you read it? so the proposed solution is to navigate the cross-product table along its diagonal instead of row by row &#8230; simply smart isn&#8217;t it? It give &#8220;impression&#8221; of randomness <img src='http://s2.wp.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>Ocaml code for this algo is here: <a href="http://github.com/khigia/ocaml-anneal/tree/master/walks.ml">http://github.com/khigia/ocaml-anneal/tree/master/walks.ml</a> (function <span class="n">pair_permutation_random_seq); </span>It uses extensively an ad-hoc stream implementation (Seq module) to perform the walk lazyly. It was a good example to test the stream implementation!</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/khigia.wordpress.com/104/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/khigia.wordpress.com/104/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/khigia.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/khigia.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/khigia.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/khigia.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/khigia.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/khigia.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/khigia.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/khigia.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/khigia.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/khigia.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/khigia.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/khigia.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/khigia.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/khigia.wordpress.com/104/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=khigia.wordpress.com&amp;blog=490125&amp;post=104&amp;subd=khigia&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://khigia.wordpress.com/2008/08/07/generate-all-pair-permutations-in-not-really-random-order-and-space-efficiently/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/714c7a1f37a4027d4a9ebc9d0aeafdfa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">khigia</media:title>
		</media:content>
	</item>
		<item>
		<title>Simulated annealing in OCaml</title>
		<link>http://khigia.wordpress.com/2008/06/11/simulated-annealing-in-ocaml/</link>
		<comments>http://khigia.wordpress.com/2008/06/11/simulated-annealing-in-ocaml/#comments</comments>
		<pubDate>Wed, 11 Jun 2008 15:34:34 +0000</pubDate>
		<dc:creator>khigia</dc:creator>
				<category><![CDATA[ocaml]]></category>

		<guid isPermaLink="false">http://khigia.wordpress.com/?p=98</guid>
		<description><![CDATA[I&#8217;ve been using this python implementation of simulated annealing to deduce Singapore bus service from a database of bus stops (see previous posts about Google Map API). I wanted to play a little bit more with this algo and decided to port it to OCaml: you can find the code on GitHub. As a first [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=khigia.wordpress.com&amp;blog=490125&amp;post=98&amp;subd=khigia&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using this <a href="http://psychicorigami.com/2007/06/28/tackling-the-travelling-salesman-problem-simmulated-annealing/">python implementation</a> of <a href="http://en.wikipedia.org/wiki/Simulated_annealing">simulated annealing</a> to deduce Singapore bus service from a database of bus stops (see <a href="http://khigia.wordpress.com/2008/05/24/sg-bus-services-map/">previous</a> <a href="http://khigia.wordpress.com/2008/05/28/sg-bus-routes-following/">post</a>s about Google Map API).</p>
<p>I wanted to play a little bit more with this algo and decided to port it to OCaml: you can find <a href="http://github.com/khigia/ocaml-anneal/tree/master">the code on GitHub</a>.</p>
<p>As a first try, I wrote a direct code translation. Only few points differ:</p>
<ul>
<li>The OCaml code use a <a href="http://github.com/khigia/ocaml-anneal/tree/master/seq.ml">stream implementation</a> (lazy list) &#8230; (mostly equivalent to my <a href="http://khigia.wordpress.com/2007/05/07/44/">previous</a> Erlang implementation).</li>
<li>The OCaml code uses array structure where Python uses list.</li>
<li>The OCaml implementation of function reversed_section do only one array reverse in all cases.</li>
</ul>
<p>Result is quite ok. Without any optimization on the algo, the OCaml native code performed quite faster (around 10 times faster), meaning that solving the TSP problem for SG bus services took 40 minutes for OCaml version where the Python code ran for hours (of course we could improve this version too).</p>
<p>The algo itself can be improve (I guestimate the time for SG map problem can be reduce by one more order of magnitude with the same simulated annealing approach).</p>
<p>But in coming post (code is there, need time to clean it), I&#8217;ll be looking at other interesting problems I found inside this one, especially on how to walk in solutions space in quasi-random order.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/khigia.wordpress.com/98/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/khigia.wordpress.com/98/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/khigia.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/khigia.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/khigia.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/khigia.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/khigia.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/khigia.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/khigia.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/khigia.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/khigia.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/khigia.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/khigia.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/khigia.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/khigia.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/khigia.wordpress.com/98/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=khigia.wordpress.com&amp;blog=490125&amp;post=98&amp;subd=khigia&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://khigia.wordpress.com/2008/06/11/simulated-annealing-in-ocaml/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/714c7a1f37a4027d4a9ebc9d0aeafdfa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">khigia</media:title>
		</media:content>
	</item>
		<item>
		<title>SG bus routes &#8230; following</title>
		<link>http://khigia.wordpress.com/2008/05/28/sg-bus-routes-following/</link>
		<comments>http://khigia.wordpress.com/2008/05/28/sg-bus-routes-following/#comments</comments>
		<pubDate>Wed, 28 May 2008 14:34:37 +0000</pubDate>
		<dc:creator>khigia</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://khigia.wordpress.com/?p=100</guid>
		<description><![CDATA[This post is a following to the previous post about drawing SG bus route with google map API. Status of the system This is for now only a toy demo, all in a single javascript document that draw the map when loaded (the javascript file is generated from a KML file by a python program [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=khigia.wordpress.com&amp;blog=490125&amp;post=100&amp;subd=khigia&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This post is a following to the <a href="http://khigia.wordpress.com/2008/05/24/sg-bus-services-map/">previous post about drawing SG bus route</a> with google map API.</p>
<h3>Status of the system</h3>
<p>This is for now only a toy demo, all in a single javascript document that draw the map when loaded (the javascript file is generated from a KML file by a python program that also computes the bus service routes).</p>
<h3>Toward drawing all the bus services &#8230;</h3>
<p>Drawing all the bus services on the same map not only is *very heavy* for the browser (at least for firefox, and its SVG renderer) but also give very little information (it is too much data at one time).</p>
<p>See by yourself:</p>
<p style="text-align:center;"><a href="http://khigia.files.wordpress.com/2008/05/screenshot-sgbus-all_inner.jpg"><img class="alignnone size-medium wp-image-101 aligncenter" src="http://khigia.files.wordpress.com/2008/05/screenshot-sgbus-all_inner.jpg?w=300&#038;h=152" alt="" width="300" height="152" /></a></p>
<p>Even zooming (on Dhoby Ghaut station):</p>
<p style="text-align:center;"><a href="http://khigia.files.wordpress.com/2008/05/screenshot-sgbus-all-zoom_inner.jpg"><img class="alignnone size-medium wp-image-102 aligncenter" src="http://khigia.files.wordpress.com/2008/05/screenshot-sgbus-all-zoom_inner.jpg?w=300&#038;h=152" alt="" width="300" height="152" /></a></p>
<h3>What could be done &#8230;</h3>
<ul>
<li>To solve the problem of too many services displayed at same time, definitively a good UI could improve usability.<br />
What I have in mind is a kind of UI which enable to select which services to display &#8230; but maybe something better can be done like auto-selection of services to display depending of zoom factor or user itinary?</li>
<li>The previous point could also help to not send all the data to the client (in order to save bandwith).</li>
<li>Automatic route simplification: on one route, when adjacent stops are &#8220;too close&#8221; to each other, we could remove one of them on the drawing (which would make it lighter, and also remove some artifact like tiny wigzag caused by stop on the opposite side of the road).</li>
<li>Adding some constraints manually (editing few distance between some stops) to correct some wrong path.</li>
</ul>
<h3>More?</h3>
<p>As in the previous post conclusions, I think a mashup of existing itinery service to display the itinery on a map could be quite interesting.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/khigia.wordpress.com/100/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/khigia.wordpress.com/100/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/khigia.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/khigia.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/khigia.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/khigia.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/khigia.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/khigia.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/khigia.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/khigia.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/khigia.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/khigia.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/khigia.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/khigia.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/khigia.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/khigia.wordpress.com/100/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=khigia.wordpress.com&amp;blog=490125&amp;post=100&amp;subd=khigia&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://khigia.wordpress.com/2008/05/28/sg-bus-routes-following/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/714c7a1f37a4027d4a9ebc9d0aeafdfa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">khigia</media:title>
		</media:content>

		<media:content url="http://khigia.files.wordpress.com/2008/05/screenshot-sgbus-all_inner.jpg?w=300" medium="image" />

		<media:content url="http://khigia.files.wordpress.com/2008/05/screenshot-sgbus-all-zoom_inner.jpg?w=300" medium="image" />
	</item>
	</channel>
</rss>
