<?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>HariKrishnan</title>
	<atom:link href="http://harikrishnan83.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://harikrishnan83.wordpress.com</link>
	<description>Thoughts on technology, programming and agile</description>
	<lastBuildDate>Wed, 18 Jan 2012 17:46:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='harikrishnan83.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>HariKrishnan</title>
		<link>http://harikrishnan83.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://harikrishnan83.wordpress.com/osd.xml" title="HariKrishnan" />
	<atom:link rel='hub' href='http://harikrishnan83.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Subdomains, pretty urls and some config</title>
		<link>http://harikrishnan83.wordpress.com/2011/01/15/subdomains-pretty-urls-and-some-config/</link>
		<comments>http://harikrishnan83.wordpress.com/2011/01/15/subdomains-pretty-urls-and-some-config/#comments</comments>
		<pubDate>Sat, 15 Jan 2011 09:36:29 +0000</pubDate>
		<dc:creator>harikrishnan83</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[rewrite]]></category>
		<category><![CDATA[subdomains]]></category>

		<guid isPermaLink="false">http://harikrishnan83.wordpress.com/?p=201</guid>
		<description><![CDATA[This post sort of collates information about using subdomains to make your urls look much nicer. Say suppose you are building a tumblr like service, then you would also think of providing subdomain based urls for each of your customers. Lets consider for the sake of explanation that you have a website called sconesandtea.com and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=harikrishnan83.wordpress.com&amp;blog=3801297&amp;post=201&amp;subd=harikrishnan83&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This post sort of collates information about using subdomains to make your urls look much nicer. Say suppose you are building a tumblr like service, then you would also think of providing subdomain based urls for each of your customers. Lets consider for the sake of explanation that you have a website called sconesandtea.com and you want to have several urls under this domain like cream.sconesandtea.com, jam.sconesandtea.com etc. Its not rocket science but it is rather painful to search for all the information yourself if you are new to this. This is more of a write up for myself, so excuse the free form writing style.</p>
<p>To start with you should configure subdomains with your domain registrar. Some basics are <a href="http://www.rossp.org/blog/2007/apr/28/using-subdomains-django/">here</a>.  In short you have to make sure the intendend subdomain based url reaches your server in addition to your domain based urls.</p>
<p>Once you are done with that, take stock of the problem you have at hand.</p>
<ol>
<li>If you just want your url to redirect, that can be handled at nginx or apache level. For example if you just want cream.sconesandtea.com to redirect to sconesandtea.com/addons/cream, you can achieve this with url rewrite in nginx or apache. The point to bear in mind is that this setup results in http redirect and the url in your browser will not be cream.sconesandtea.com, but it will be sconesandtea.com/addons/cream after the redirect. We will go into this in detail in a bit.</li>
<li>But if you do not want http://sconesandtea.com/addons/cream to be exposed to the outside world and the public url should be http://cream.sconesandtea.com, then it needs some logic to be built into the app.</li>
</ol>
<p><strong>Simple Redirection</strong></p>
<p>Below is a snippet of nginx url rewrite module.</p>
<p><code>set $subdomain "";<br />
set $subdomain_root "";<br />
if ($host ~* "^(.+)\.sconesandtea\.com$") {<br />
set $subdomain $1;<br />
rewrite ^(.*)$ http://sconesandtea.in/addons/$subdomain;<br />
break;<br />
}</code></p>
<p>This will return a http 302 redirect. If you want the status code to be 301 append permanent key word to the rewrite url line.</p>
<p><code>rewrite ^(.*)$ http://sconesandtea.com/addons/$subdomain;</code></p>
<p>More on this <a title="nginx rewrite module" href="http://wiki.nginx.org/HttpRewriteModule" target="_blank">here</a>.</p>
<p><strong>Handling subdomains at application level</strong></p>
<p>The first thing to get past for this is to simulate the production scenario on a dev box. As most of you would know add the below entry in you /etc/hosts to simulate domain based url on local.</p>
<p><code>127.0.1.1    sconesandtea.com</code></p>
<p>But /etc/hosts does not support wildcard based subdomains. So for testing purposes add the subdomain specifically.</p>
<p><code>127.0.1.1    cream.sconesandtea.com</code></p>
<p>Based on the framework you are using there may be several ways of achieving the logic to use subdomains to render specific pages. For django you could use the middleware available <a title="django subdomain middleware" href="http://djangosnippets.org/snippets/1119/" target="_blank">here</a>. This is quite a useful snippet. It makes subdomain available through request, which you can use elsewhere in your code. This snippet does not support subdomain based urls starting with www. So you may have to tweak it as per your application&#8217;s needs.</p>
<p>Please feel free to add or correct any information here.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/harikrishnan83.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/harikrishnan83.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/harikrishnan83.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/harikrishnan83.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/harikrishnan83.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/harikrishnan83.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/harikrishnan83.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/harikrishnan83.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/harikrishnan83.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/harikrishnan83.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/harikrishnan83.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/harikrishnan83.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/harikrishnan83.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/harikrishnan83.wordpress.com/201/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=harikrishnan83.wordpress.com&amp;blog=3801297&amp;post=201&amp;subd=harikrishnan83&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://harikrishnan83.wordpress.com/2011/01/15/subdomains-pretty-urls-and-some-config/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/58793a1b265e2f7b84039eec6f6485fd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">harikrishnan83</media:title>
		</media:content>
	</item>
		<item>
		<title>Sqlserver Non-clustered indexes and deadlocks</title>
		<link>http://harikrishnan83.wordpress.com/2010/07/05/non-clustered-indexes-and-deadlocks/</link>
		<comments>http://harikrishnan83.wordpress.com/2010/07/05/non-clustered-indexes-and-deadlocks/#comments</comments>
		<pubDate>Mon, 05 Jul 2010 11:27:53 +0000</pubDate>
		<dc:creator>harikrishnan83</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[clustered]]></category>
		<category><![CDATA[deadlock]]></category>
		<category><![CDATA[index]]></category>
		<category><![CDATA[non-clustered]]></category>
		<category><![CDATA[sqlserver]]></category>

		<guid isPermaLink="false">http://harikrishnan83.wordpress.com/?p=172</guid>
		<description><![CDATA[ORM tools and other abstraction on RDBMS have become ubiquitous. But there is no substitute for understanding the basics of a database. This opinion of mine was only reinforced by a recent issue which I was fixing with a colleague. Bug: Error log for showed the below exception System.Data.SqlClient.SqlException: Transaction (Process ID 53) was deadlocked [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=harikrishnan83.wordpress.com&amp;blog=3801297&amp;post=172&amp;subd=harikrishnan83&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>ORM tools and other abstraction on RDBMS have become ubiquitous. But there is no substitute for understanding the basics of a database. This opinion of mine was only reinforced by a recent issue which I was fixing with a colleague.</p>
<p><strong>Bug:</strong> Error log for showed the below exception<br />
<code>System.Data.SqlClient.SqlException: Transaction (Process ID 53) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.</code></p>
<p><strong>Tech stack:</strong> .Net 3.5, sqlserver 2005, nhibernate</p>
<p>The exception stack trace pointed to the table that was being deadlocked.</p>
<p><code>Could not execute command: UPDATE Email SET PersonId = @p0 WHERE Id =  @p1</code></p>
<p>Recreating deadlock issues is not a trivial thing. But thankfully in our case the deadlock was so severe that when I ran my tests in parallel, almost 50% of the transactions failed at a concurrent load of just 2. That was a decent first step since we were consistently able to reproduce the issue.</p>
<p>Sqlserver Management studio comes with some tools which are quite useful in this situation. To see what was causing the deadlock all I had to do was to run profiler on the database. To launch a profile follow the below steps.</p>
<p>tools &gt; profiler &gt; file &gt; new trace &gt; mention database details</p>
<p>The trace properties window should open up. Open the event selection tab and select show all events. This should show more events. Under the locks section select all the events that may be useful to you.</p>
<p>Start the trace, run your tests in parallel sit back with some popcorn and enjoy the action packed adventure. Run a find for Deadlocks and you should be presented with a nice picture of what is happening.</p>
<p><a href="http://harikrishnan83.files.wordpress.com/2010/07/deadlock_sqlserver3.jpg"><img class="alignnone size-medium wp-image-181" title="Deadlock_SqlServer" src="http://harikrishnan83.files.wordpress.com/2010/07/deadlock_sqlserver3.jpg?w=300&#038;h=182" alt="" width="300" height="182" /></a></p>
<p>Lets zoom in on the action.</p>
<p><a href="http://harikrishnan83.files.wordpress.com/2010/07/deadlock_zoom.jpg"><img class="alignnone size-medium wp-image-182" title="Deadlock_Zoom" src="http://harikrishnan83.files.wordpress.com/2010/07/deadlock_zoom.jpg?w=300&#038;h=180" alt="" width="300" height="180" /></a></p>
<p><strong>Inferences:</strong></p>
<ul>
<li>The deadlock is not on the object, because the object ids are the same. This is something which we also guessed from the query in the exception log <code>UPDATE Email SET PersonId = @p0 WHERE Id =  @p1</code></li>
<li>But the page ids are different.</li>
</ul>
<p>Quite puzzled we looked at the table design to see if something was wrong there. And yes we saw what the problem was. The table did not have a primary key column.</p>
<p>Even though that may look like harmless issue, there are consequences of creating a table without a primary key in sqlserver. When you define a primary key a <strong>unique clustered index</strong> is created. But this table had a unique constraint on the id column, which would create a <strong>unique non-clustered index</strong>. Non-clustered secondary indexes may introduce deadlocks. More details in this <a href="http://support.microsoft.com/kb/169960">link</a> (See Non-Clustered indexes). You will also find it very useful to know how clustered and non-clustered indexes work.</p>
<p>In this case, the primary key and there by the clustered index was missing. We introduced a primary key constraint on the id column and  ran tests again. Even at a much higher concurrent user count the deadlocks did not happen again.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/harikrishnan83.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/harikrishnan83.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/harikrishnan83.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/harikrishnan83.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/harikrishnan83.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/harikrishnan83.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/harikrishnan83.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/harikrishnan83.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/harikrishnan83.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/harikrishnan83.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/harikrishnan83.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/harikrishnan83.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/harikrishnan83.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/harikrishnan83.wordpress.com/172/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=harikrishnan83.wordpress.com&amp;blog=3801297&amp;post=172&amp;subd=harikrishnan83&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://harikrishnan83.wordpress.com/2010/07/05/non-clustered-indexes-and-deadlocks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/58793a1b265e2f7b84039eec6f6485fd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">harikrishnan83</media:title>
		</media:content>

		<media:content url="http://harikrishnan83.files.wordpress.com/2010/07/deadlock_sqlserver3.jpg?w=300" medium="image">
			<media:title type="html">Deadlock_SqlServer</media:title>
		</media:content>

		<media:content url="http://harikrishnan83.files.wordpress.com/2010/07/deadlock_zoom.jpg?w=300" medium="image">
			<media:title type="html">Deadlock_Zoom</media:title>
		</media:content>
	</item>
		<item>
		<title>Customize gradle directory structure</title>
		<link>http://harikrishnan83.wordpress.com/2010/06/04/customize-gradle-directory-structure/</link>
		<comments>http://harikrishnan83.wordpress.com/2010/06/04/customize-gradle-directory-structure/#comments</comments>
		<pubDate>Fri, 04 Jun 2010 16:07:12 +0000</pubDate>
		<dc:creator>harikrishnan83</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[Customize]]></category>
		<category><![CDATA[gradle]]></category>
		<category><![CDATA[sourceSets]]></category>

		<guid isPermaLink="false">http://harikrishnan83.wordpress.com/?p=162</guid>
		<description><![CDATA[I started using gradle very recently. It is so much more easy to understand than maven. I guess I am not intelligent enough for maven. Gradle also follows a very similar directory structure to maven. But I wanted to change it as per my projects directory structure. project project/src project/test All I had to do [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=harikrishnan83.wordpress.com&amp;blog=3801297&amp;post=162&amp;subd=harikrishnan83&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I started using gradle very recently. It is so much more easy to understand than maven. I guess I am not intelligent enough for maven. Gradle also follows a very similar directory structure to maven. But I wanted to change it as per my projects directory structure.</p>
<p><code>project<br />
project/src<br />
project/test</code></p>
<p>All I had to do was customize the sourceSets.</p>
<p><code>sourceSets {<br />
main {<br />
java {<br />
srcDir 'src'<br />
}<br />
}<br />
test {<br />
java {<br />
srcDir 'test'<br />
}<br />
}<br />
</code><br />
I could not find this information straight away (especially the test sources location). So I am posting it here for future reference.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/harikrishnan83.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/harikrishnan83.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/harikrishnan83.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/harikrishnan83.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/harikrishnan83.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/harikrishnan83.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/harikrishnan83.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/harikrishnan83.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/harikrishnan83.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/harikrishnan83.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/harikrishnan83.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/harikrishnan83.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/harikrishnan83.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/harikrishnan83.wordpress.com/162/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=harikrishnan83.wordpress.com&amp;blog=3801297&amp;post=162&amp;subd=harikrishnan83&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://harikrishnan83.wordpress.com/2010/06/04/customize-gradle-directory-structure/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/58793a1b265e2f7b84039eec6f6485fd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">harikrishnan83</media:title>
		</media:content>
	</item>
		<item>
		<title>CI &#8211; Have we forgotten the integration bit?</title>
		<link>http://harikrishnan83.wordpress.com/2010/05/22/ci-have-we-forgotten-the-integration-bit/</link>
		<comments>http://harikrishnan83.wordpress.com/2010/05/22/ci-have-we-forgotten-the-integration-bit/#comments</comments>
		<pubDate>Sat, 22 May 2010 14:31:23 +0000</pubDate>
		<dc:creator>harikrishnan83</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[Agile]]></category>
		<category><![CDATA[CI]]></category>
		<category><![CDATA[Continuous Integration]]></category>

		<guid isPermaLink="false">http://harikrishnan83.wordpress.com/?p=156</guid>
		<description><![CDATA[Almost all software that has every been built had to go through an integration stage in one way or another. It is quite odd that many software projects even to this day look at integration as a separate phase in the project. But things are changing quite fast and many projects adopting Continuous Integration. This [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=harikrishnan83.wordpress.com&amp;blog=3801297&amp;post=156&amp;subd=harikrishnan83&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Almost all software that has every been built had to go through an integration stage in one way or another. It is quite odd that many software projects even to this day look at integration as a separate phase in the project. But things are changing quite fast and many projects adopting Continuous Integration. This is good news because we are saving ourselves a lot of time wasted in the so called integration bugs.</p>
<p>So what is the issue?</p>
<p>Lets cut to the chase. Mostly organizations tend to try out CI on a not so important team before it is adopted across all teams. But in such a scenario CI is only building a smaller system.  Even organizations that have been using CI for quite some time seem to have CI builds per team. But usually the software that the smaller teams are building are just small pieces in a bigger system. Integration bugs still have a longer feedback cycle.</p>
<p>It is not enough to have a CI infrastructure that only verifies the subsystem. CI must deploy the smaller module on to an environment with the rest of the system and run tests as a whole. This gives feedback on the integration.</p>
<p>So we get the point. Whats the big deal?</p>
<p>Actually setting up a good CI is not so simple. Unless the build system is not well thought after CI does not come for free. While writing the build scripts/code one must keep in mind the bigger picture. The effort involved is very similar to a traditional production release. It is also important to revise the build from time to time. While a build that fails for several unknown reasons is a pain, a build that is not proving anything is even worse.</p>
<p>CI should also not be an activity solely done by configuration management team. The people who are responsible for the application design also have a big role to play. One size does not fit all and concepts that proved successful in one project may not work so well for another. Also CI has to evolve with the system that it is integrating. Unless it is up to date with the latest design changes its not doing much.</p>
<p>If your CI is testing a subsystem it can only be called an automated build system for that module. CI needs to verify key integration issues and to some extent even performance. Writing build systems that truly integrate is an interesting activity. It gets you thinking on how two systems integrate. Questions that you would have not thought about previously suddenly become more obvious.</p>
<p>A Continuous Integration build must be run on a production like environment. If not, the application must be deployed to production as often as possible.  A well written CI also inspires confidence to move to a continuous deployment mode.</p>
<p>I do not claim to be an expert on CI, but I think it is important not to forget the principles behind practices. I would associate more importance on the integration bit in CI than smaller checks that verify code style etc.</p>
<p>Also I would recommend reading Sai&#8217;s <a href="http://developer-in-test.blogspot.com/2010/05/continuous-integration-stop-lying-to-me.html">blog</a> on CI.</p>
<p>Let me know your thoughts on this.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/harikrishnan83.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/harikrishnan83.wordpress.com/156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/harikrishnan83.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/harikrishnan83.wordpress.com/156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/harikrishnan83.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/harikrishnan83.wordpress.com/156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/harikrishnan83.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/harikrishnan83.wordpress.com/156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/harikrishnan83.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/harikrishnan83.wordpress.com/156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/harikrishnan83.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/harikrishnan83.wordpress.com/156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/harikrishnan83.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/harikrishnan83.wordpress.com/156/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=harikrishnan83.wordpress.com&amp;blog=3801297&amp;post=156&amp;subd=harikrishnan83&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://harikrishnan83.wordpress.com/2010/05/22/ci-have-we-forgotten-the-integration-bit/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/58793a1b265e2f7b84039eec6f6485fd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">harikrishnan83</media:title>
		</media:content>
	</item>
		<item>
		<title>Continuous deployment and flexibility</title>
		<link>http://harikrishnan83.wordpress.com/2010/03/16/rule-engines-and-continuous-deployment/</link>
		<comments>http://harikrishnan83.wordpress.com/2010/03/16/rule-engines-and-continuous-deployment/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 10:53:06 +0000</pubDate>
		<dc:creator>harikrishnan83</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[contiuous deployment]]></category>
		<category><![CDATA[rule engines]]></category>

		<guid isPermaLink="false">http://harikrishnan83.wordpress.com/?p=146</guid>
		<description><![CDATA[Say a client asks you to build an application such that he can change it between releases. He wants to be able to do this so that he can react to business needs quickly. But most of the time this is interpreted as a way to build an application that is highly configurable. One of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=harikrishnan83.wordpress.com&amp;blog=3801297&amp;post=146&amp;subd=harikrishnan83&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Say a client asks you to build an application such that he can change it between releases. He wants to be able to do this so that he can react to business needs quickly. But most of the time this is interpreted as a way to build an application that is highly configurable.</p>
<p>One of the application I was working on had very high levels of complexity because of the infrastructure to make it configurable. The client was using a very expensive rule engine which was sold to him saying that business can deploy rules without developer help.</p>
<p>Clearly what the client wanted here was to be able to react to business needs. But what he got was an application which had a baggage of infrastructure to make it highly configurable. In this day and age where many projects use continuous deployment, there is not much of an issue in responding to a business need. Release becomes a non-event.</p>
<p>Even during maintenance phase, we can continue to keep the continuous deployment setup in some cases.</p>
<p>It is just a thought and I would love to see what people have to say about this.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/harikrishnan83.wordpress.com/146/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/harikrishnan83.wordpress.com/146/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/harikrishnan83.wordpress.com/146/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/harikrishnan83.wordpress.com/146/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/harikrishnan83.wordpress.com/146/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/harikrishnan83.wordpress.com/146/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/harikrishnan83.wordpress.com/146/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/harikrishnan83.wordpress.com/146/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/harikrishnan83.wordpress.com/146/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/harikrishnan83.wordpress.com/146/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/harikrishnan83.wordpress.com/146/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/harikrishnan83.wordpress.com/146/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/harikrishnan83.wordpress.com/146/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/harikrishnan83.wordpress.com/146/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=harikrishnan83.wordpress.com&amp;blog=3801297&amp;post=146&amp;subd=harikrishnan83&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://harikrishnan83.wordpress.com/2010/03/16/rule-engines-and-continuous-deployment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/58793a1b265e2f7b84039eec6f6485fd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">harikrishnan83</media:title>
		</media:content>
	</item>
		<item>
		<title>Agile Bengaluru 2010</title>
		<link>http://harikrishnan83.wordpress.com/2010/01/31/agile-bengaluru-2010/</link>
		<comments>http://harikrishnan83.wordpress.com/2010/01/31/agile-bengaluru-2010/#comments</comments>
		<pubDate>Sun, 31 Jan 2010 15:56:38 +0000</pubDate>
		<dc:creator>harikrishnan83</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[agile bangalore]]></category>
		<category><![CDATA[agile bengaluru 2010]]></category>
		<category><![CDATA[experience report]]></category>

		<guid isPermaLink="false">http://harikrishnan83.wordpress.com/?p=135</guid>
		<description><![CDATA[Its been a week since agile bengaluru 2010. It was a really nice experience to meet J. B. Rainsberger, Jeff Patton, David Hussman, Naresh Jain and many more people all in one place. I liked the venue even though there was no wifi . More than anything else I really appreciate the &#8220;go green&#8221; theme. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=harikrishnan83.wordpress.com&amp;blog=3801297&amp;post=135&amp;subd=harikrishnan83&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Its been a week since <a href="http://www.agileindia.org/agilebengaluru2010/agile-bengaluru-2010-program">agile bengaluru 2010</a>. It was a really nice experience to meet <a href="http://www.jbrains.ca/services" target="_blank">J. B. Rainsberger</a>, <a href="http://www.agileproductdesign.com/" target="_blank">Jeff Patton</a>, <a href="http://www.nofluffjuststuff.com/conference/speaker/david_hussman" target="_blank">David Hussman</a>, <a href="http://agilefaqs.com/nareshjain.html" target="_top">Naresh Jain</a> and many more people all in one place. I liked the venue even though there was no wifi <img src='http://s2.wp.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> . More than anything else I really appreciate the &#8220;go green&#8221; theme. This is not a complete experience report, apologies for my laziness when comes to writing long posts.</p>
<p>Being a &#8220;Post Agile Conference&#8221;,  most topics were aimed at reflecting on how agile has helped us in the past and where are we going. Below are some of the sessions that I enjoyed.</p>
<p><strong>Discovery and Delivery &#8211; Redesigning agility</strong> &#8211; Keynote by <a href="http://www.nofluffjuststuff.com/conference/speaker/david_hussman" target="_blank">David Hussman</a>. A great start to the conference.</p>
<p><strong>Monkey See Monkey Do</strong> &#8211; by <a href="http://agilefaqs.com/nareshjain.html" target="_top">Naresh Jain</a> and Sandeep Shetty &#8211; A very interesting talk that looked at some of the agile practices that have become dogma. It would have been great if we had some more time.</p>
<p><strong>Outside the code &#8211; Using agile practices to drive product success</strong> &#8211; by <a href="http://www.agileproductdesign.com/" target="_blank">Jeff Patton</a> &#8211; It was nice to hear about the &#8220;Discovery&#8221; part of the agile software development. Go check out the slides.</p>
<p><strong>Using Theory of Constraint and Just in time approach to coach agile teams</strong> &#8211; a workshop by <a href="http://www.jbrains.ca/services" target="_blank">J. B. Rainsberger</a> and <a href="http://agilefaqs.com/nareshjain.html" target="_top">Naresh Jain</a>.</p>
<p><strong>Stop it or I will Bury you alive in a box</strong> &#8211; by <a href="http://www.jbrains.ca/services" target="_blank">J. B. Rainsberger</a> &#8211; J.B. spoke about the 10 things we should stop doing in 2010.</p>
<p><strong>Captain planet (Saurabh Arora) talks</strong> &#8211; Very inspiring talk on global warming. Keep up the good work dude.</p>
<p>Apart from this I got an opportunity to talk to <a href="http://www.agileproductdesign.com/" target="_blank">Jeff Patton</a> some time between the sessions. Spoke about how words like requirements, customers etc do not go well with software development.</p>
<p>I had to rush before all the <strong>lightning talks</strong> got over. Managed to listen to a some talks like &#8220;Agile Deployment&#8221;. Just before I left I spoke about &#8220;Developer + Tester + Operations = DevTestOps&#8221;.</p>
<p><strong>Programming with the stars</strong> &#8211; A very entertaining session. The participants had to impress the audience to get selected to the next round. The winners would pair four accomplished developers (stars) and come up with a five minute coding exercise that they have to present to a panel of judges (<a href="http://www.jbrains.ca/services" target="_blank">J. B. Rainsberger</a>, <a href="http://www.agileproductdesign.com/" target="_blank">Jeff Patton</a>). Very entertaining. Really appreciate the participants and the stars for live coding in front of a sizable audience. The winners got a life time e-learning license from Industrial Logic.</p>
<p>Last but not the least enjoyed speaking about <strong>Breaking the monotony</strong> with <a href="http://developer-in-test.blogspot.com/" target="_blank">Sai Venkat</a>. Liked the way the talk went. Agility we seek is from the code we write and systems we build and not just from processes and practices we follow. This was the theme of our talk. Got great constructive feedback from the audience.</p>
<p>The conference ended with an open Q and A session.</p>
<p>Kudos to the organizers. The slides are available and the videos should be available soon.</p>
<p>Looking forward to see if we can get the Dogma out of agile and build great software. Feel free to add any comments about topics that I have miss out.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/harikrishnan83.wordpress.com/135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/harikrishnan83.wordpress.com/135/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/harikrishnan83.wordpress.com/135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/harikrishnan83.wordpress.com/135/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/harikrishnan83.wordpress.com/135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/harikrishnan83.wordpress.com/135/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/harikrishnan83.wordpress.com/135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/harikrishnan83.wordpress.com/135/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/harikrishnan83.wordpress.com/135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/harikrishnan83.wordpress.com/135/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/harikrishnan83.wordpress.com/135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/harikrishnan83.wordpress.com/135/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/harikrishnan83.wordpress.com/135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/harikrishnan83.wordpress.com/135/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=harikrishnan83.wordpress.com&amp;blog=3801297&amp;post=135&amp;subd=harikrishnan83&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://harikrishnan83.wordpress.com/2010/01/31/agile-bengaluru-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/58793a1b265e2f7b84039eec6f6485fd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">harikrishnan83</media:title>
		</media:content>
	</item>
		<item>
		<title>Building java projects on runcoderun.com</title>
		<link>http://harikrishnan83.wordpress.com/2010/01/26/building-java-projects-on-runcoderun-com/</link>
		<comments>http://harikrishnan83.wordpress.com/2010/01/26/building-java-projects-on-runcoderun-com/#comments</comments>
		<pubDate>Tue, 26 Jan 2010 06:30:17 +0000</pubDate>
		<dc:creator>harikrishnan83</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ant-junit]]></category>
		<category><![CDATA[hosted ci]]></category>
		<category><![CDATA[hosted continuous integration]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[junit 4]]></category>
		<category><![CDATA[junit4]]></category>
		<category><![CDATA[rapa]]></category>
		<category><![CDATA[runcoderun]]></category>

		<guid isPermaLink="false">http://harikrishnan83.wordpress.com/?p=131</guid>
		<description><![CDATA[RunCodeRun is a hosted Continuous integration environment developed by Relevance. Thanks to the Relevance team and their effort to provide this service free for opensource projects. I wanted to build rapa on RunCodeRun. I was trying to setup my project on RunCodeRun using instructions in a blog post. It is a very useful blog and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=harikrishnan83.wordpress.com&amp;blog=3801297&amp;post=131&amp;subd=harikrishnan83&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://runcoderun.com/" target="_blank">RunCodeRun </a>is a hosted Continuous integration environment developed by <a href="http://thinkrelevance.com/" target="_blank">Relevance</a>. Thanks to the Relevance team and their effort to provide this service free for opensource projects.</p>
<p>I wanted to build <a href="http://github.com/harikrishnan83/rapa" target="_blank">rapa</a> on RunCodeRun. I was trying to setup my project on <a title="RunCodeRun" href="http://runcoderun.com/" target="_blank">RunCodeRun</a> using instructions in a <a href="http://blog.runcoderun.com/post/110939721/building-java-projects-with-runcoderun-com-or-jruby" target="_blank">blog post</a>. It is a very useful blog and easy to follow. But I was having trouble getting code to compile on runcoderun box. Here are the problems and their solutions.</p>
<p><strong>I guess there is no real jdk on runcoderun, so my compile task on ant would not work.</strong></p>
<p>I checked in tools.jar as a part of my project libraries. Then I added it as part of the classpath when invoking ant from rake.</p>
<p><code>classpath = [File.join(".","lib","ant.jar"), File.join(".","lib","tools.jar"), File.join(".","lib","junit.jar"), File.join(".","lib","ant-junit.jar"), File.join(".","lib","ant-launcher.jar")].join(File::PATH_SEPARATOR)<br />
system "java -cp #{classpath} org.apache.tools.ant.Main -emacs dist"</code></p>
<p><strong>Even after I fixed that the build would always go green even if there was failure from ant</strong></p>
<p>I guess the exit status returned by rake was always zero irrespective of what ant returned. I changed the rakefile as shown below.</p>
<p><code>system "java -cp #{classpath} org.apache.tools.ant.Main -emacs dist"<br />
exit $?.exitstatus</code></p>
<p>This seemed to fix all the issues with the build.</p>
<p>Along with these issues I was also facing an issue with ant-junit task with junit 4. Basically standard distribution of ant does not understand the annotations of junit4 and requires the test class to extend TestCase. I had to checkout the latest source from ant subversion trunk and build it. I am currently using these jars.</p>
<p>Have a look at the project in github.</p>
<p>http://github.com/harikrishnan83/rapa</p>
<p>Continuous integration on.</p>
<p>http://runcoderun.com/harikrishnan83/rapa</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/harikrishnan83.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/harikrishnan83.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/harikrishnan83.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/harikrishnan83.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/harikrishnan83.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/harikrishnan83.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/harikrishnan83.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/harikrishnan83.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/harikrishnan83.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/harikrishnan83.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/harikrishnan83.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/harikrishnan83.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/harikrishnan83.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/harikrishnan83.wordpress.com/131/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=harikrishnan83.wordpress.com&amp;blog=3801297&amp;post=131&amp;subd=harikrishnan83&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://harikrishnan83.wordpress.com/2010/01/26/building-java-projects-on-runcoderun-com/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/58793a1b265e2f7b84039eec6f6485fd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">harikrishnan83</media:title>
		</media:content>
	</item>
		<item>
		<title>Mnesia Quickstart</title>
		<link>http://harikrishnan83.wordpress.com/2010/01/05/mnesia-quickstart/</link>
		<comments>http://harikrishnan83.wordpress.com/2010/01/05/mnesia-quickstart/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 19:49:21 +0000</pubDate>
		<dc:creator>harikrishnan83</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Erlang]]></category>
		<category><![CDATA[erlang-tv]]></category>
		<category><![CDATA[mnesia]]></category>
		<category><![CDATA[Mnesia quickstart]]></category>
		<category><![CDATA[Mnesia tutorial]]></category>
		<category><![CDATA[quickstart]]></category>

		<guid isPermaLink="false">http://harikrishnan83.wordpress.com/?p=119</guid>
		<description><![CDATA[Basic introduction on Mnesia Mnesia is a RDBMS. But it belongs to the nosql category of RDBMS. Reason being the query language is not sql but Erlang. That makes it very easy to store and retrieve without having to go through Object Relational Mapping. So we can actually call Mnesia an object relational database. Why [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=harikrishnan83.wordpress.com&amp;blog=3801297&amp;post=119&amp;subd=harikrishnan83&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Basic introduction on Mnesia</strong></p>
<p>Mnesia is a RDBMS. But it belongs to the nosql category of RDBMS. Reason being the query language is not sql but Erlang. That makes it very easy to store and retrieve without having to go through Object Relational Mapping. So we can actually call Mnesia an object relational database.</p>
<p><strong>Why and where would one want to Mnesia?</strong></p>
<p>Erlang in general is used to program highly distributed and fault tolerant systems. Even though it has its roots in the telecommunication industry, it has proven useful in several other sites like ejabbered, Facebook chat etc. Mnesia is just a part of Erlang and is built with Erlang.</p>
<p>Hence it gives you configurable degree of Fault-tolerance (by means of replication).</p>
<p>Another important feature of mnesia is the Dirty read interface. It is possible to read, write and search Mnesia tables without protecting the operation inside a transaction.</p>
<p><strong>Quickstart</strong></p>
<p>The below steps should get you started on mnesia, if you are using it for the first time.</p>
<p>Required Software &#8211; Erlang</p>
<p>I use ubuntu as my OS. But that should not make it much different on any other OS.</p>
<p>Now lets start with some code. It is useful to install the table-viewer (erlang-tv).</p>
<p>The goal of this exercise is to create table called person, insert few records and read them.</p>
<p>create a file called Person.hrl</p>
<p><code>-record(person, {name,      %% atomic, unique key<br />
age,        %% age<br />
married_to, %% name of partner or undefined<br />
children }).%% list of children</code></p>
<p>create a file called Person.erl</p>
<p><code>-module(person).<br />
-include("&lt;path_to_person.hrl&gt;/person.hrl").<br />
-export([init/0]).<br />
-export([insert/0]).<br />
-export([read/1]).<br />
init() -&gt;<br />
mnesia:create_table(person,[{attributes,record_info(fields,person)}])<br />
.<br />
insert() -&gt;<br />
T = fun() -&gt;<br />
X = #person{name=john,<br />
age=36,<br />
married_to=ana,<br />
children=[josh,kelly,samantha]<br />
},<br />
mnesia:write(X)<br />
end,<br />
mnesia:transaction(T)<br />
.<br />
read(Name) -&gt;<br />
R = fun() -&gt;<br />
mnesia:read(person,Name,write)<br />
end,<br />
mnesia:transaction(R)</code></p>
<p>Start command line erlang. Type in the below command from the directory which contains the above two files</p>
<p><code>erl mnesia dir .</code></p>
<p>The above command conveys that the current directory will be used to store Mnesia files.</p>
<p>Compile the person.erl</p>
<p><code>&gt;c(person).</code></p>
<p>{ok,person}</p>
<p>Start mnesia</p>
<p><code>&gt;mnesia:start().</code></p>
<p>Create person table.</p>
<p><code>&gt;person:init().</code></p>
<p>Insert a record.</p>
<p><code>&gt;person:insert().</code></p>
<p>Use table viewer to check if the record has been inserted.</p>
<p><code>&gt;tv:start().</code></p>
<p>This will launch table view application. By default the table viewer shows the ETS tables. To look at the table we just created go to view menu and select Mnesia tables.</p>
<p>Read the record using Mnesia:read()</p>
<p><code>&gt;person:read(klacke).<br />
{atomic,[{person,john,36,ana,[josh,kelly,samantha]}]}</code></p>
<p>In my next post I will cover Mnesia queries as List Comprehension.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/harikrishnan83.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/harikrishnan83.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/harikrishnan83.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/harikrishnan83.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/harikrishnan83.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/harikrishnan83.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/harikrishnan83.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/harikrishnan83.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/harikrishnan83.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/harikrishnan83.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/harikrishnan83.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/harikrishnan83.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/harikrishnan83.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/harikrishnan83.wordpress.com/119/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=harikrishnan83.wordpress.com&amp;blog=3801297&amp;post=119&amp;subd=harikrishnan83&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://harikrishnan83.wordpress.com/2010/01/05/mnesia-quickstart/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/58793a1b265e2f7b84039eec6f6485fd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">harikrishnan83</media:title>
		</media:content>
	</item>
		<item>
		<title>Jumping through hoops to represent trees in Database</title>
		<link>http://harikrishnan83.wordpress.com/2009/12/29/jumping-through-hoops-to-represent-trees-in-database/</link>
		<comments>http://harikrishnan83.wordpress.com/2009/12/29/jumping-through-hoops-to-represent-trees-in-database/#comments</comments>
		<pubDate>Tue, 29 Dec 2009 19:14:59 +0000</pubDate>
		<dc:creator>harikrishnan83</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[common table expression]]></category>
		<category><![CDATA[cte]]></category>
		<category><![CDATA[graph database]]></category>
		<category><![CDATA[hierarchical database]]></category>
		<category><![CDATA[neo4j]]></category>
		<category><![CDATA[nosql]]></category>
		<category><![CDATA[recursion in sql]]></category>
		<category><![CDATA[start with and connect by]]></category>
		<category><![CDATA[trees in sql]]></category>

		<guid isPermaLink="false">http://harikrishnan83.wordpress.com/?p=114</guid>
		<description><![CDATA[Recently I have been working on a project where we have to represent hierarchical data in Database. Unfortunately we do not have much choice with the database. We are using a relational database. If you have done this, you will agree with me that it is not a very enjoyable experience. Firstly we need to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=harikrishnan83.wordpress.com&amp;blog=3801297&amp;post=114&amp;subd=harikrishnan83&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Recently I have been working on a project where we have to represent hierarchical data in Database. Unfortunately we do not have much choice with the database. We are using a relational database.</p>
<p>If you have done this, you will agree with me that it is not a very enjoyable experience.</p>
<p>Firstly we need to choose between several models to represent trees in database</p>
<p>a. Adjacency (self referential tables)</p>
<p>b. Materialized path (lineage)</p>
<p><strong>Shortcomings of adjacency model</strong></p>
<p>Tree traversal is costly in adjacency model. Finding out children and grandchildren of a parent may be quite complex</p>
<p><strong>Shortcomings of materialized path<br />
</strong></p>
<p>Materialized path requires you to build this information at some point in time. If you have a million records for which you need to build materialized path, then I suggest you start now, because no knows when it will end. If some one knows of an efficient way of doing this please let me know. If you get past this stage, then there is the issue of updating the data to handle moves and deletions.</p>
<p><strong>Static and Dynamic Data</strong></p>
<p>The choice we make is mostly driven by how many changes can we expect. If we are never going to modify the data, probably materialized path any other approach which stores the lineage information alongside each row is useful. But this is rarely the case.</p>
<p><strong>Some vendor specific help</strong></p>
<p>The guys at micrsoft and oracle seem to have seen this issue and suggest the use of below techniques for this issue.</p>
<p>Sql Server</p>
<p>1. Common table expression: Popularly known as CTE, this is a way to run recursive queries on a self-referential table.</p>
<p>2. HierarchyID: This is a datatype that is available in SqlServer 2008. It uses materialized path.</p>
<p>Oracle</p>
<p>1. Start with and connect by: This is similar to the above method. It works on self-referential Table.</p>
<p><strong>Object modeling trees</strong></p>
<p>Imagine a scenario where you need to model a huge Family. I guess we start by having Person class. Each person has 0 or more children. Children is nothing but a collection of Persons. Mapping this to the data in database is a pain.</p>
<p>1. Lazy loading: Most probably you will have to lazy load the children as and when you need them. Else you may have to wait a generation to get the complete tree loaded.</p>
<p>2. If we want to implement things like Delete or reassignment, saving the data back to database will not be easy.</p>
<p><strong>Better ways to store hierarchical data</strong></p>
<p>Hierarchies are graphs. It is better to use a database like neo4j. Neo4j has been a very popular graph Db.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/harikrishnan83.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/harikrishnan83.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/harikrishnan83.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/harikrishnan83.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/harikrishnan83.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/harikrishnan83.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/harikrishnan83.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/harikrishnan83.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/harikrishnan83.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/harikrishnan83.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/harikrishnan83.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/harikrishnan83.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/harikrishnan83.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/harikrishnan83.wordpress.com/114/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=harikrishnan83.wordpress.com&amp;blog=3801297&amp;post=114&amp;subd=harikrishnan83&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://harikrishnan83.wordpress.com/2009/12/29/jumping-through-hoops-to-represent-trees-in-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/58793a1b265e2f7b84039eec6f6485fd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">harikrishnan83</media:title>
		</media:content>
	</item>
		<item>
		<title>Coroutines &#8211; back to basics</title>
		<link>http://harikrishnan83.wordpress.com/2009/12/27/coroutines-back-to-basics/</link>
		<comments>http://harikrishnan83.wordpress.com/2009/12/27/coroutines-back-to-basics/#comments</comments>
		<pubDate>Sun, 27 Dec 2009 18:25:07 +0000</pubDate>
		<dc:creator>harikrishnan83</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[asymmetric]]></category>
		<category><![CDATA[Continuations]]></category>
		<category><![CDATA[Coroutine]]></category>
		<category><![CDATA[Coroutines]]></category>
		<category><![CDATA[Fiber]]></category>
		<category><![CDATA[Fibinacci]]></category>
		<category><![CDATA[producer Consumer]]></category>
		<category><![CDATA[revactor]]></category>
		<category><![CDATA[ruby1.9]]></category>
		<category><![CDATA[symmetric]]></category>

		<guid isPermaLink="false">http://harikrishnan83.wordpress.com/?p=101</guid>
		<description><![CDATA[Ruby 1.9 Fibers has got me reading about Coroutines. Thought I should put all my understanding somewhere, as I read and understand coroutines in more depth. Most of the content in this post just a aggregation of various sources. Coroutines are program components that allow multiple entry points and can return any number of times. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=harikrishnan83.wordpress.com&amp;blog=3801297&amp;post=101&amp;subd=harikrishnan83&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Ruby 1.9 Fibers has got me reading about Coroutines.<br />
Thought I should put all my understanding somewhere, as I read and understand coroutines in more depth.</p>
<p>Most of the content in this post just a aggregation of various sources.</p>
<p>Coroutines are program components that allow multiple entry points and can return any number of times. Coroutines belong to a category of programming construct called Continuations.</p>
<p>All programming languages have one way or another to handle control flow. Within a control flow there is an associated state. This state is information like value of a variable etc. Callstack is one of the most popular way to store this information. Every method has its own call stack and this stack is erased once the method returns either normally or through exceptional Flow.</p>
<p>In a Coroutine this is not the case. We can suspend and resume execution without loosing the stack.</p>
<p><strong>Types of Coroutines:</strong></p>
<p>1. Symmetric Coroutines: A symmetric coroutine can use one function to yield and another to resume. Example: Lua</p>
<p>2. Asymmetric Coroutines: They are also called as semi-coroutines. The choice for the transfer of control is limited. Asymmetric Coroutines can only transfer control back to their caller. Example: Ruby 1.9  Fibers</p>
<p>Examples:</p>
<p><strong>producer consumer</strong></p>
<p><code><br />
#!/usr/bin/ruby1.9.1</p>
<p><code>def producer<br />
Fiber.new do<br />
value = 0<br />
loop do<br />
Fiber.yield value<br />
value += 1<br />
end<br />
end<br />
end<br />
</code></p>
<p><code>def consumer(source)<br />
Fiber.new do<br />
for x in 1..9 do<br />
value = source.resume<br />
puts value<br />
end<br />
end<br />
end</code></p>
<p>consumer(producer).resume<br />
</code></p>
<p><strong>Fibonacci</strong></p>
<p><code><br />
#!/usr/bin/ruby1.9.1</p>
<p><code>fib = Fiber.new do<br />
x, y = 0, 1<br />
loop do<br />
Fiber.yield y<br />
x, y = y, x+y<br />
end<br />
end</code></p>
<p><code>20.times { puts fib.resume }</code><br />
</code></p>
<p><strong>Why are coroutines important?</strong></p>
<p>The main reason why coroutines are making the limelight again is because of concurrency. In my humble opinion, concurrency is reviving many of the well known but forgotten programming concepts back.</p>
<p>To take the example of ruby, most of us are aware of the Global Interpreter Lock. Threading in ruby is totally useless because ultimately all thread run as part of the same OS thread, which means there no true concurrency. Fibers in ruby are very similar to threads but are light weight threads. They can scheduled, suspended and resumed as per the programmers choice.</p>
<p>Coroutines can be used to construct the actor model of concurrency. This is the same model used by Erlang. <a href="http://github.com/tarcieri/revactor">Revactor</a> is a very nice implementation of the actor model in ruby.</p>
<p>I will add code here when time permits.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/harikrishnan83.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/harikrishnan83.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/harikrishnan83.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/harikrishnan83.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/harikrishnan83.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/harikrishnan83.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/harikrishnan83.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/harikrishnan83.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/harikrishnan83.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/harikrishnan83.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/harikrishnan83.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/harikrishnan83.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/harikrishnan83.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/harikrishnan83.wordpress.com/101/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=harikrishnan83.wordpress.com&amp;blog=3801297&amp;post=101&amp;subd=harikrishnan83&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://harikrishnan83.wordpress.com/2009/12/27/coroutines-back-to-basics/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/58793a1b265e2f7b84039eec6f6485fd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">harikrishnan83</media:title>
		</media:content>
	</item>
	</channel>
</rss>
