<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Kristian Lunde</title>
	<atom:link href="http://www.klunde.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.klunde.net</link>
	<description>www.klunde.net</description>
	<lastBuildDate>Sun, 18 Jul 2010 21:00:28 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Zend_Input_Filter and the Alnum Validator</title>
		<link>http://www.klunde.net/2010/07/18/zend_input_filter-and-the-alnum-validator/</link>
		<comments>http://www.klunde.net/2010/07/18/zend_input_filter-and-the-alnum-validator/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 21:00:28 +0000</pubDate>
		<dc:creator>Kristian Lunde</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[Zend]]></category>
		<category><![CDATA[Zend_Input_Filter]]></category>
		<category><![CDATA[Zend_Validate_Alnum]]></category>

		<guid isPermaLink="false">http://www.klunde.net/?p=518</guid>
		<description><![CDATA[
			
				
			
		
The Zend_Input_Filter is a very useful tool when you need to validate and filter the input to your application. It allows you to both filter and validate the input without a lot of hassle. One of the cool features it has is that it allows you to add the validators you need and meta commands [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.klunde.net%2F2010%2F07%2F18%2Fzend_input_filter-and-the-alnum-validator%2F" onclick="urchinTracker('/outgoing/api.tweetmeme.com/share?url=http_3A_2F_2Fwww.klunde.net_2F2010_2F07_2F18_2Fzend_input_filter-and-the-alnum-validator_2F&amp;referer=');"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.klunde.net%2F2010%2F07%2F18%2Fzend_input_filter-and-the-alnum-validator%2F&amp;source=kristianlunde&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>The <a href="http://framework.zend.com/manual/en/zend.filter.input.html" onclick="urchinTracker('/outgoing/framework.zend.com/manual/en/zend.filter.input.html?referer=');">Zend_Input_Filter</a> is a very useful tool when you need to validate and filter the input to your application. It allows you to both filter and validate the input without a lot of hassle. One of the cool features it has is that it allows you to add the validators you need and meta commands to each validator. For instance you can set an <a href="http://framework.zend.com/manual/en/zend.validate.set.html" onclick="urchinTracker('/outgoing/framework.zend.com/manual/en/zend.validate.set.html?referer=');">Alnum</a> validator to allow empty fields, set a default text and so on. </p>
<p>I came over this annoying issue the other day when I tried to setup the Alnum validator to allow white spaces and have a few meta commands attached to the validator chain. The <a href="http://framework.zend.com/manual/en/zend.filter.input.html" onclick="urchinTracker('/outgoing/framework.zend.com/manual/en/zend.filter.input.html?referer=');">manual</a> says that you can do this:</p>
<div class="geshi no php">
<ol>
<li class="li1">
<div class="de1"><span class="re1">$validators</span> <span class="sy0">=</span> <span class="kw3">array</span><span class="br0">&#40;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="st0">&#39;month&#39;</span> &nbsp; <span class="sy0">=&gt;</span> <span class="kw3">array</span><span class="br0">&#40;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&#39;Digits&#39;</span><span class="sy0">,</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="co1">// string</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">new</span> Zend_Validate_Int<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">,</span> <span class="co1">// object instance</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">array</span><span class="br0">&#40;</span><span class="st0">&#39;Between&#39;</span><span class="sy0">,</span> <span class="nu0">1</span><span class="sy0">,</span> <span class="nu0">12</span><span class="br0">&#41;</span> &nbsp;<span class="co1">// string with constructor arguments</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
</ol>
</div>
<p>Which I assumed would also work like this:</p>
<div class="geshi no php">
<ol>
<li class="li1">
<div class="de1"><span class="re1">$validators</span> <span class="sy0">=</span> <span class="kw3">array</span><span class="br0">&#40;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="st0">&#39;name&#39;</span> &nbsp; <span class="sy0">=&gt;</span> <span class="kw3">array</span><span class="br0">&#40;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&#39;Alnum&#39;</span><span class="sy0">,</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">new</span> Zend_Validate_Alnum<span class="br0">&#40;</span><span class="kw2">true</span><span class="br0">&#41;</span><span class="sy0">,</span> <span class="co1">//allow whitespaces</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;<span class="st0">&#39;default&#39;</span> <span class="sy0">=&gt;</span> <span class="st0">&#39;&#39;</span><span class="sy0">,</span> &nbsp;<span class="co1">//meta command 1</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;<span class="st0">&#39;presence&#39;</span> <span class="sy0">=&gt;</span> <span class="st0">&#39;required&#39;</span><span class="sy0">,</span> <span class="co1">//meta command 2</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
</ol>
</div>
<p>This does not work though. You need to remove the validator type string and replace it with an instance of the Zend_Validate_Alnum validator to get it to accept whitespaces and meta commands. This is the right way to do it:</p>
<div class="geshi no php">
<ol>
<li class="li1">
<div class="de1"><span class="re1">$validators</span> <span class="sy0">=</span> <span class="kw3">array</span><span class="br0">&#40;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="st0">&#39;name&#39;</span> &nbsp; <span class="sy0">=&gt;</span> <span class="kw3">array</span><span class="br0">&#40;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">new</span> Zend_Validate_Alnum<span class="br0">&#40;</span><span class="kw2">true</span><span class="br0">&#41;</span><span class="sy0">,</span> <span class="co1">//allow whitespaces</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;<span class="st0">&#39;default&#39;</span> <span class="sy0">=&gt;</span> <span class="st0">&#39;&#39;</span><span class="sy0">,</span> <span class="co1">//meta command 1</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;<span class="st0">&#39;presence&#39;</span> <span class="sy0">=&gt;</span> <span class="st0">&#39;required&#39;</span><span class="sy0">,</span> <span class="co1">//meta command 2</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
</ol>
</div>
<p>The entire script ends up looking like this:</p>
<div class="geshi no php">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="re1">$filters</span> <span class="sy0">=</span> <span class="kw3">array</span><span class="br0">&#40;</span><span class="st0">&#39;name&#39;</span> <span class="sy0">=&gt;</span> <span class="st0">&#39;StringTrim&#39;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re1">$validators</span> <span class="sy0">=</span> &nbsp;<span class="kw3">array</span><span class="br0">&#40;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="st0">&#39;name&#39;</span> &nbsp; <span class="sy0">=&gt;</span> <span class="kw3">array</span><span class="br0">&#40;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">new</span> Zend_Validate_Alnum<span class="br0">&#40;</span><span class="kw2">true</span><span class="br0">&#41;</span><span class="sy0">,</span> <span class="co1">//allow whitespaces</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;<span class="st0">&#39;default&#39;</span> <span class="sy0">=&gt;</span> <span class="st0">&#39;&#39;</span><span class="sy0">,</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;<span class="st0">&#39;presence&#39;</span> <span class="sy0">=&gt;</span> <span class="st0">&#39;required&#39;</span><span class="sy0">,</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="re1">$input</span> <span class="sy0">=</span> <span class="kw2">new</span> Zend_Input_Filter<span class="br0">&#40;</span><span class="re1">$filter</span><span class="sy0">,</span> <span class="re1">$input</span><span class="sy0">,</span> <span class="re1">$this</span><span class="sy0">-&gt;</span><span class="me1">getRequest</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">-&gt;</span><span class="me1">getParams</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.klunde.net/2010/07/18/zend_input_filter-and-the-alnum-validator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The big move</title>
		<link>http://www.klunde.net/2010/06/19/the-big-move/</link>
		<comments>http://www.klunde.net/2010/06/19/the-big-move/#comments</comments>
		<pubDate>Sat, 19 Jun 2010 18:00:48 +0000</pubDate>
		<dc:creator>Kristian Lunde</dc:creator>
				<category><![CDATA[Real Life]]></category>
		<category><![CDATA[job]]></category>
		<category><![CDATA[Newcastle]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://www.klunde.net/?p=509</guid>
		<description><![CDATA[
			
				
			
		
There is a lot of things going right now. We (@ramonahz, my daughter and myself) have decided to move back to Norway. We have thought about this for a while now and finally made the decision a few weeks ago. The main reason for moving back is that we want to be closer to our [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.klunde.net%2F2010%2F06%2F19%2Fthe-big-move%2F" onclick="urchinTracker('/outgoing/api.tweetmeme.com/share?url=http_3A_2F_2Fwww.klunde.net_2F2010_2F06_2F19_2Fthe-big-move_2F&amp;referer=');"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.klunde.net%2F2010%2F06%2F19%2Fthe-big-move%2F&amp;source=kristianlunde&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>There is a lot of things going right now. We (<a href="http://www.twitter.com/ramonahz" onclick="urchinTracker('/outgoing/www.twitter.com/ramonahz?referer=');">@ramonahz</a>, my daughter and myself) have decided to move back to Norway. We have thought about this for a while now and finally made the decision a few weeks ago. The main reason for moving back is that we want to be closer to our family, and not restrict our daughter to only see her grandparents a few times a year.</p>
<p>The move has affected my work slightly, I have resigned from my position at MySapient LTD and are now looking to do some freelance work from Norway. I also have a few other interesting things coming up, but I&#8217;ll leave that for a later blog post.</p>
<p>We have already started the process of moving back, and we&#8217;ll be leaving Newcastle and the UK on the 26th of July. We have spent almost 2 years in Newcastle, I have met some amazing people during these past two years, made some good friends and worked for two really cool companies. I am really going to miss living here, but hey, I&#8217;ll be back to visit soon.</p>
<p>Arrivederci Newcastle.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.klunde.net/2010/06/19/the-big-move/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>CentOS, where is all my memory gone?</title>
		<link>http://www.klunde.net/2010/01/15/centos-where-is-all-my-memory-gone/</link>
		<comments>http://www.klunde.net/2010/01/15/centos-where-is-all-my-memory-gone/#comments</comments>
		<pubDate>Fri, 15 Jan 2010 22:25:03 +0000</pubDate>
		<dc:creator>Kristian Lunde</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.klunde.net/?p=478</guid>
		<description><![CDATA[
			
				
			
		
I encountered a rather strange issue on one of MySapients CentOS 5 servers the other day, the server seemed to run fine, without any issues what so ever, but it seem to run very low on memory. In fact it only had 150MB memory available of a total 4GB. 
This obviously caused me a bit [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.klunde.net%2F2010%2F01%2F15%2Fcentos-where-is-all-my-memory-gone%2F" onclick="urchinTracker('/outgoing/api.tweetmeme.com/share?url=http_3A_2F_2Fwww.klunde.net_2F2010_2F01_2F15_2Fcentos-where-is-all-my-memory-gone_2F&amp;referer=');"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.klunde.net%2F2010%2F01%2F15%2Fcentos-where-is-all-my-memory-gone%2F&amp;source=kristianlunde&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>I encountered a rather strange issue on one of <a href="http://www.mysapient.com" onclick="urchinTracker('/outgoing/www.mysapient.com?referer=');">MySapients</a> CentOS 5 servers the other day, the server seemed to run fine, without any issues what so ever, but it seem to run very low on memory. In fact it only had 150MB memory available of a total 4GB. </p>
<p>This obviously caused me a bit of a worry, but after some digging around I found the answer, linux is borrowing unused memory to do disk caching. Memory is automatically reassigned when the server needs to allocate memory to other services, in other words there is nothing to worry about.</p>
<p>There is a good site about this describing this functionality in more detail, you can read it at:</p>
<p><a href="http://www.linuxatemyram.com/" onclick="urchinTracker('/outgoing/www.linuxatemyram.com/?referer=');">http://www.linuxatemyram.com/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.klunde.net/2010/01/15/centos-where-is-all-my-memory-gone/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>My Bookshelf &amp; openbook</title>
		<link>http://www.klunde.net/2009/11/22/my-bookshelf-openbook/</link>
		<comments>http://www.klunde.net/2009/11/22/my-bookshelf-openbook/#comments</comments>
		<pubDate>Sun, 22 Nov 2009 23:19:54 +0000</pubDate>
		<dc:creator>Kristian Lunde</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[openbook]]></category>

		<guid isPermaLink="false">http://www.klunde.net/?p=469</guid>
		<description><![CDATA[
			
				
			
		
Yesterday I installed the openbook plugin for wordpress on this site. My intentions was to build a &#8220;My bookshelf&#8221; page similar to what Mats Lindh and Trond Huso have on their sites. 
I installed the plugin without any problems but the layout was a bit nasty. I don&#8217;t know if that was because of the [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.klunde.net%2F2009%2F11%2F22%2Fmy-bookshelf-openbook%2F" onclick="urchinTracker('/outgoing/api.tweetmeme.com/share?url=http_3A_2F_2Fwww.klunde.net_2F2009_2F11_2F22_2Fmy-bookshelf-openbook_2F&amp;referer=');"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.klunde.net%2F2009%2F11%2F22%2Fmy-bookshelf-openbook%2F&amp;source=kristianlunde&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>Yesterday I installed the <a href="http://wordpress.org/extend/plugins/openbook-book-data/" onclick="urchinTracker('/outgoing/wordpress.org/extend/plugins/openbook-book-data/?referer=');">openbook</a> plugin for wordpress on this site. My intentions was to build a &#8220;My bookshelf&#8221; page similar to what <a href="http://e-mats.org/" onclick="urchinTracker('/outgoing/e-mats.org/?referer=');">Mats Lindh</a> and Trond Huso have on their sites. </p>
<p>I installed the plugin without any problems but the layout was a bit nasty. I don&#8217;t know if that was because of the theme I am running on this site or if the openbook markup was messed up. Anyway I rewrote the html and css for the openbooks template on its configuration page and added some custom css to the site to get it working. </p>
<p>This is my openbook template:</p>
<div class="geshi no html">
<ol>
<li class="li1">
<div class="de1">&lt;li&gt;
</div>
</li>
<li class="li1">
<div class="de1">&lt;div class=&quot;medium&quot;&gt;[OB_COVER_MEDIUM]&lt;/div&gt;
</div>
</li>
<li class="li1">
<div class="de1">&lt;div class=&quot;description&quot;&gt;
</div>
</li>
<li class="li1">
<div class="de1">&lt;div class=&quot;title&quot;&gt;[OB_TITLE]&lt;/div&gt;
</div>
</li>
<li class="li1">
<div class="de1">&lt;div class=&quot;meta-1&quot;&gt;Written by: [OB_AUTHORS]&lt;/div&gt;
</div>
</li>
<li class="li1">
<div class="de1">&lt;div class=&quot;publisher-year&quot;&gt;[OB_PUBLISHER] [OB_PUBLISHYEAR]&lt;/div&gt;
</div>
</li>
<li class="li1">
<div class="de1">&lt;div class=&quot;category&quot;&gt;[OB_LINK_WORLDCAT][OB_DOT][OB_READONLINE][OB_DOT][OB_LINK_LIBRARYTHING][OB_DOT][OB_LINK_GOOGLEBOOKS][OB_DOT][OB_LINK_BOOKFINDER]&lt;/div&gt;[OB_COINS]
</div>
</li>
<li class="li1">
<div class="de1">&lt;/div&gt;
</div>
</li>
<li class="li1">
<div class="de1">&lt;div class=&quot;clearboth&quot;&gt;&lt;/div&gt;
</div>
</li>
<li class="li1">
<div class="de1">&lt;/li&gt;</div>
</li>
</ol>
</div>
<p>This is the css I added:</p>
<div class="geshi no css">
<ol>
<li class="li1">
<div class="de1">ul<span class="re1">.books</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="kw1">list-style-type</span><span class="sy0">:</span> <span class="kw2">none</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">ul<span class="re1">.books</span> li <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="kw1">border-bottom</span><span class="sy0">:</span> <span class="re3">1px</span> <span class="kw2">solid</span> <span class="re0">#ccc</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="kw1">margin-bottom</span><span class="sy0">:</span> <span class="re3">15px</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="kw1">padding-bottom</span><span class="sy0">:</span> <span class="re3">15px</span><span class="sy0">;</span> </div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">ul<span class="re1">.books</span> li div<span class="re1">.medium</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;float<span class="re2">:left</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="kw1">margin-right</span><span class="sy0">:</span> <span class="re3">10px</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">ul<span class="re1">.books</span> li div<span class="re1">.medium</span> img <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;width<span class="re2">:<span class="re3">120px</span></span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">ul<span class="re1">.books</span> li div<span class="re1">.description</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="kw1">float</span><span class="sy0">:</span> <span class="kw1">left</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="kw1">width</span><span class="sy0">:</span> <span class="re3">450px</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">ul<span class="re1">.books</span> li div<span class="re1">.description</span> div <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="kw1">font-size</span><span class="sy0">:</span> <span class="re3">11px</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="kw1">padding-top</span><span class="sy0">:</span> <span class="re3">5px</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">ul<span class="re1">.books</span> li div<span class="re1">.clearboth</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="kw1">clear</span><span class="sy0">:</span> <span class="kw2">both</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>At last I added this custom html in the &#8220;my bookshelf&#8221; page:</p>
<div class="geshi no html">
<ol>
<li class="li1">
<div class="de1">&lt;ul class=&quot;books&quot;&gt;
</div>
</li>
<li class="li1">
<div class="de1"><i>[Open Library Server Error]</i> 
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><i>[Open Library Server Error]</i> 
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><i>[Open Library Server Error]</i> 
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&lt;/ul&gt;</div>
</li>
</ol>
</div>
<p>You can see the result here: <a href="http://www.klunde.net/my-bookshelf">My Bookshelf </a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.klunde.net/2009/11/22/my-bookshelf-openbook/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Great article on Super Columns and Cassandra</title>
		<link>http://www.klunde.net/2009/11/21/great-article-on-super-columns-and-cassandra/</link>
		<comments>http://www.klunde.net/2009/11/21/great-article-on-super-columns-and-cassandra/#comments</comments>
		<pubDate>Sat, 21 Nov 2009 16:37:17 +0000</pubDate>
		<dc:creator>Kristian Lunde</dc:creator>
				<category><![CDATA[NoSQL]]></category>
		<category><![CDATA[Cassandra]]></category>

		<guid isPermaLink="false">http://www.klunde.net/?p=445</guid>
		<description><![CDATA[
			
				
			
		
This is a great article describing super columns and the general structure of cassandra. A must read for NoSQL newbies. 
http://arin.me/code/wtf-is-a-supercolumn-cassandra-data-model
]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.klunde.net%2F2009%2F11%2F21%2Fgreat-article-on-super-columns-and-cassandra%2F" onclick="urchinTracker('/outgoing/api.tweetmeme.com/share?url=http_3A_2F_2Fwww.klunde.net_2F2009_2F11_2F21_2Fgreat-article-on-super-columns-and-cassandra_2F&amp;referer=');"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.klunde.net%2F2009%2F11%2F21%2Fgreat-article-on-super-columns-and-cassandra%2F&amp;source=kristianlunde&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>This is a great article describing super columns and the general structure of cassandra. A must read for NoSQL newbies. </p>
<p><a href="http://arin.me/code/wtf-is-a-supercolumn-cassandra-data-model" onclick="urchinTracker('/outgoing/arin.me/code/wtf-is-a-supercolumn-cassandra-data-model?referer=');">http://arin.me/code/wtf-is-a-supercolumn-cassandra-data-model</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.klunde.net/2009/11/21/great-article-on-super-columns-and-cassandra/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Cassandra and Thrift on OSX</title>
		<link>http://www.klunde.net/2009/11/20/installing-cassandra-and-thrift-on-osx/</link>
		<comments>http://www.klunde.net/2009/11/20/installing-cassandra-and-thrift-on-osx/#comments</comments>
		<pubDate>Fri, 20 Nov 2009 21:39:14 +0000</pubDate>
		<dc:creator>Kristian Lunde</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[NoSQL]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[Cassandra]]></category>

		<guid isPermaLink="false">http://www.klunde.net/?p=410</guid>
		<description><![CDATA[
			
				
			
		
Cassandra is a NoSQL distributed database developed by Facebook, it is built to handle huge amounts of data and to perform CRUD operations quickly. The Cassandra site&#8217;s strap line says:
&#8220;The Apache Cassandra Project develops a highly scalable second-generation distributed database, bringing together  Dynamo&#8217;s fully distributed design and Bigtable&#8217;s ColumnFamily-based data model. 
Thrift is also [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.klunde.net%2F2009%2F11%2F20%2Finstalling-cassandra-and-thrift-on-osx%2F" onclick="urchinTracker('/outgoing/api.tweetmeme.com/share?url=http_3A_2F_2Fwww.klunde.net_2F2009_2F11_2F20_2Finstalling-cassandra-and-thrift-on-osx_2F&amp;referer=');"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.klunde.net%2F2009%2F11%2F20%2Finstalling-cassandra-and-thrift-on-osx%2F&amp;source=kristianlunde&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p><a href="http://incubator.apache.org/cassandra/" onclick="urchinTracker('/outgoing/incubator.apache.org/cassandra/?referer=');">Cassandra</a> is a <a href="http://en.wikipedia.org/wiki/NoSQL" onclick="urchinTracker('/outgoing/en.wikipedia.org/wiki/NoSQL?referer=');">NoSQL</a> distributed database developed by <a href="http://www.facebook.com" onclick="urchinTracker('/outgoing/www.facebook.com?referer=');">Facebook</a>, it is built to handle huge amounts of data and to perform <a href="http://en.wikipedia.org/wiki/Create,_read,_update_and_delete" onclick="urchinTracker('/outgoing/en.wikipedia.org/wiki/Create_read_update_and_delete?referer=');">CRUD</a> operations quickly. The Cassandra site&#8217;s strap line says:</p>
<p><i>&#8220;The Apache Cassandra Project develops a highly scalable second-generation distributed database, bringing together  Dynamo&#8217;s fully distributed design and Bigtable&#8217;s ColumnFamily-based data model. </i></p>
<p><a href="http://incubator.apache.org/thrift/" onclick="urchinTracker('/outgoing/incubator.apache.org/thrift/?referer=');">Thrift</a> is also developed by <a href="http://www.facebook.com" onclick="urchinTracker('/outgoing/www.facebook.com?referer=');">Facebook</a> and is a software framework for service development and is used as an interface to Cassandra. The Thrift page site says:</p>
<p><i>&#8220;Thrift is a software framework for scalable cross-language services development. It combines a software stack with a code generation engine to build services that work efficiently and seamlessly between C++, Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, Smalltalk, and OCaml.&#8221;</i></p>
<p>Both <a href="http://incubator.apache.org/cassandra/" onclick="urchinTracker('/outgoing/incubator.apache.org/cassandra/?referer=');">Cassandra</a> and <a href="http://incubator.apache.org/thrift/" onclick="urchinTracker('/outgoing/incubator.apache.org/thrift/?referer=');">Thrift</a> are apache incubator projects.</p>
<h2>Installing Cassandra</h2>
<h3>1. Download cassandra</h3>
<p>Download from: <a href="http://incubator.apache.org/cassandra/" onclick="urchinTracker('/outgoing/incubator.apache.org/cassandra/?referer=');">http://incubator.apache.org/cassandra/</a>.</p>
<h3>2. Create and set the correct paths in the storage-conf.xml</h3>
<p>You can find the storage-conf.xml file in your cassandra root directory /conf</p>
<p>My configuration file settings in storage-conf.xml:</p>
<div class="geshi no xml">
<ol>
<li class="li1">
<div class="de1">&nbsp; <span class="sc3"><span class="re1">&lt;CommitLogDirectory<span class="re2">&gt;</span></span></span>/Users/kristianlunde/tmp/cassandra-log/commitlog<span class="sc3"><span class="re1">&lt;/CommitLogDirectory<span class="re2">&gt;</span></span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="sc3"><span class="re1">&lt;DataFileDirectories<span class="re2">&gt;</span></span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;DataFileDirectory<span class="re2">&gt;</span></span></span>/Users/kristianlunde/workspaces/mysapient/cassandra/data<span class="sc3"><span class="re1">&lt;/DataFileDirectory<span class="re2">&gt;</span></span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="sc3"><span class="re1">&lt;/DataFileDirectories<span class="re2">&gt;</span></span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="sc3"><span class="re1">&lt;CalloutLocation<span class="re2">&gt;</span></span></span>/Users/kristianlunde/workspaces/mysapient/cassandra/callouts<span class="sc3"><span class="re1">&lt;/CalloutLocation<span class="re2">&gt;</span></span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="sc3"><span class="re1">&lt;BootstrapFileDirectory<span class="re2">&gt;</span></span></span>/Users/kristianlunde/workspaces/mysapient/cassandra/bootstrap<span class="sc3"><span class="re1">&lt;/BootstrapFileDirectory<span class="re2">&gt;</span></span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="sc3"><span class="re1">&lt;StagingFileDirectory<span class="re2">&gt;</span></span></span>/Users/kristianlunde/workspaces/mysapient/cassandra/staging<span class="sc3"><span class="re1">&lt;/StagingFileDirectory<span class="re2">&gt;</span></span></span></div>
</li>
</ol>
</div>
<p><strong>Notice:</strong> You have to create all these directories for cassandra to run properly.</p>
<h3>3. Set a log directory in the log4j.properties file</h3>
<p>This file is found in the same directory as the storage-conf.xml</p>
<h3>4. Check that you are running java 6 as default</h3>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1">&nbsp;java -version</div>
</li>
</ol>
</div>
<p>If you are running an earlier version of java you will have to change your version. Java 6 should already be installed on your mac if you keep your os in sync with the automatic updates from apple. You can change your java version by using the <a href="http://www.apple.com/macosx/what-is-macosx/apps-and-utilities.html#java" onclick="urchinTracker('/outgoing/www.apple.com/macosx/what-is-macosx/apps-and-utilities.html_java?referer=');">&#8220;Java Settings&#8221;</a> application located in your <em>/Application/Utilities</em> directory.</p>
<h3>5. Starting Cassandra</h3>
<p>You should be ready to go now, navigate to the root directory of your cassandra installation and start cassandra by typing:</p>
<div class="geshi no pre">
<ol>
<li class="li1">
<div class="de1">bin/cassandra -f</div>
</li>
</ol>
</div>
<p>If you dont see any error messages cassandra is probably running as it should, so it is time to test it out.</p>
<p>Cassandra comes with a CLI interface which allowes you to do simple queries to the database. Notice that the CLI interface is not not as powerful as the thrift interface. You can for instance not execute get queries in <a href="http://arin.me/code/wtf-is-a-supercolumn-cassandra-data-model" onclick="urchinTracker('/outgoing/arin.me/code/wtf-is-a-supercolumn-cassandra-data-model?referer=');">Super Columns</a>, those queries will create a java exception.</p>
<p>To test the CLI interface, run the following command from the cassandra root directory:</p>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1">.<span class="sy0">/</span>bin<span class="sy0">/</span>cassandra-cli &#8211;host localhost &#8211;port <span class="nu0">9160</span></div>
</li>
</ol>
</div>
<p>Inserting values to the keyspace:</p>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1">&nbsp;cassandra<span class="sy0">&gt;</span> <span class="kw1">set</span> Keyspace1.Standard1<span class="br0">&#91;</span><span class="st0">&#39;blog-post&#39;</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st0">&#39;name&#39;</span><span class="br0">&#93;</span> = <span class="st0">&#39;Installing Cassandra and Thrift OSX&#39;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;Value inserted.</div>
</li>
<li class="li1">
<div class="de1">&nbsp;cassandra<span class="sy0">&gt;</span> <span class="kw1">set</span> Keyspace1.Standard1<span class="br0">&#91;</span><span class="st0">&#39;blog-post&#39;</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st0">&#39;author&#39;</span><span class="br0">&#93;</span> = <span class="st0">&#39;Kristian Lunde&#39;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;Value inserted.</div>
</li>
</ol>
</div>
<p>	Retrieving data from the keyspace:</p>
<div class="geshi no bash">
<div class="head">cassandra> get Keyspace1.Standard1[&#39;blog-post&#39;]</div>
<ol>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="br0">&#40;</span><span class="re2">column=</span>name, <span class="re2">value=</span>Installing Cassandra and Thrift OSX; <span class="re2">timestamp=</span><span class="nu0">1258748376097</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="br0">&#40;</span><span class="re2">column=</span>author, <span class="re2">value=</span>Kristian Lunde; <span class="re2">timestamp=</span><span class="nu0">1258748405486</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;Returned <span class="nu0">2</span> rows.</div>
</li>
<li class="li1">
<div class="de1">&nbsp;cassandra<span class="sy0">&gt;</span></div>
</li>
</ol>
</div>
<h2>Installing Thrift</h2>
<p><strong>Update:</strong> I found this manual after I had installed thrift: <a href="http://wiki.apache.org/thrift/ThriftInstallationMacOSX" onclick="urchinTracker('/outgoing/wiki.apache.org/thrift/ThriftInstallationMacOSX?referer=');">http://wiki.apache.org/thrift/ThriftInstallationMacOSX</a>, using this install guide will probably fix the issues I had with compiling thrift.</p>
<h3>1. Download Thrift</h3>
<p>Download from <a href="http://incubator.apache.org/thrift/download/" onclick="urchinTracker('/outgoing/incubator.apache.org/thrift/download/?referer=');">http://incubator.apache.org/thrift/download/</a> and extract it.</p>
<h3>2. Check that you have installed the following:</h3>
<ul>
<li>g++ 3.3.5+</li>
<li>Runtime libraries for lex and yacc might be needed for the compiler.</li>
<li>boost 1.33.1+ (1.34.0 for building all tests) <a href="http://www.boost.org/" onclick="urchinTracker('/outgoing/www.boost.org/?referer=');">http://www.boost.org/</a>.</li>
</ul>
<p>I had to install boost manually:</p>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">sudo</span> port <span class="kw2">install</span> boost</div>
</li>
</ol>
</div>
<p><strong>Notice:</strong> the boost installation might take a while, It took about 5 &#8211; 10 minutes on my Macbook PRO (2.53GHz).</p>
<p>You can see the full requirements for thrift at <a href="http://wiki.apache.org/thrift/ThriftRequirements" onclick="urchinTracker('/outgoing/wiki.apache.org/thrift/ThriftRequirements?referer=');">http://wiki.apache.org/thrift/ThriftRequirements</a>.</p>
<h3>3. Start the installation</h3>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1">&nbsp;kristian-lundes-macbook-pro:thrift kristianlunde$ .<span class="sy0">/</span>bootstrap.<span class="kw2">sh</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;configure.ac:<span class="nu0">26</span>: installing `.<span class="sy0">/</span>missing<span class="st0">&#39;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="st0"> configure.ac:26: installing `./install-sh&#39;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;compiler<span class="sy0">/</span><span class="kw2">cpp</span><span class="sy0">/</span>Makefile.am: installing `.<span class="sy0">/</span>depcomp<span class="st0">&#39;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="st0"> configure.ac: installing `./ylwrap&#39;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;kristian-lundes-macbook-pro:thrift</div>
</li>
</ol>
</div>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1">.<span class="sy0">/</span>configure</div>
</li>
</ol>
</div>
<p>This ended up in an error message for me:</p>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1">&nbsp;.<span class="sy0">/</span>configure: line <span class="nu0">20722</span>: syntax error near unexpected token `MONO,<span class="st0">&#39;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="st0"> ./configure: line 20722: ` &nbsp;PKG_CHECK_MODULES(MONO, mono &gt;= 2.0.0, net_3_5=yes, net_3_5=no)&#39;</span></div>
</li>
</ol>
</div>
<p>To fix this I had to copy my pkg.m4 file from /opt/local/share/aclocal/pkg.m4 to my thrift/aclocal directory.</p>
<p>Navigate to your thrift root directory:</p>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1">&nbsp;<span class="kw2">cp</span> <span class="sy0">/</span>opt<span class="sy0">/</span><span class="kw3">local</span><span class="sy0">/</span>share<span class="sy0">/</span><span class="kw2">aclocal</span><span class="sy0">/</span>pkg.<span class="kw2">m4</span> <span class="kw2">aclocal</span></div>
</li>
</ol>
</div>
<p>Thanks to <a href="http://aaronspotlatch.appspot.com/archive/Jul-2008" onclick="urchinTracker('/outgoing/aaronspotlatch.appspot.com/archive/Jul-2008?referer=');">http://aaronspotlatch.appspot.com/archive/Jul-2008</a> and<br />
<a href="http://qslack.com/post/thrift-macosx-104" onclick="urchinTracker('/outgoing/qslack.com/post/thrift-macosx-104?referer=');">http://qslack.com/post/thrift-macosx-104</a> for pointing me in the right direction.</p>
<p>You should now be ready to run make</p>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">make</span></div>
</li>
</ol>
</div>
<p>and</p>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">sudo</span> <span class="kw2">make</span> <span class="kw2">install</span></div>
</li>
</ol>
</div>
<p>You should now be able to run thrift on your mac.</p>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1">thrift</div>
</li>
</ol>
</div>
<p>You should now be ready to build your amazing application with Cassandra if both your installation of Cassandra and Thrift were successful.</p>
<p>I will try to post another blog post shortly on using Cassandra, Thrift and PHP. Stay tuned. </p>
<h3>Resources</h3>
<ul>
<li><a href="http://incubator.apache.org/cassandra/" onclick="urchinTracker('/outgoing/incubator.apache.org/cassandra/?referer=');">The Cassandra Project</a></li>
<li><a href="http://wiki.apache.org/cassandra/FrontPage" onclick="urchinTracker('/outgoing/wiki.apache.org/cassandra/FrontPage?referer=');">The Cassandra Wiki</a></li>
<li><a href="http://wiki.apache.org/thrift/FrontPage" onclick="urchinTracker('/outgoing/wiki.apache.org/thrift/FrontPage?referer=');">The Thrift Wiki</a></li>
<li><a href="http://jetfar.com/installing-cassandra-and-thrift-on-snow-leopard-a-quick-start-guide/" onclick="urchinTracker('/outgoing/jetfar.com/installing-cassandra-and-thrift-on-snow-leopard-a-quick-start-guide/?referer=');">http://jetfar.com/installing-cassandra-and-thrift-on-snow-leopard-a-quick-start-guide/</a></li>
<li><a href="http://posulliv.com/?p=149" onclick="urchinTracker('/outgoing/posulliv.com/?p=149&amp;referer=');">Setting up a Cassandra cluster</a></li>
<li><a href="http://www.onemanclapping.org/2009/11/building-cassandra-thrift-bindings-on.html" onclick="urchinTracker('/outgoing/www.onemanclapping.org/2009/11/building-cassandra-thrift-bindings-on.html?referer=');">http://www.onemanclapping.org/2009/11/building-cassandra-thrift-bindings-on.html</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.klunde.net/2009/11/20/installing-cassandra-and-thrift-on-osx/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Klunde.net moved server</title>
		<link>http://www.klunde.net/2009/11/06/klunde-net-moved-server/</link>
		<comments>http://www.klunde.net/2009/11/06/klunde-net-moved-server/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 23:39:41 +0000</pubDate>
		<dc:creator>Kristian Lunde</dc:creator>
				<category><![CDATA[Misc]]></category>

		<guid isPermaLink="false">http://www.klunde.net/?p=407</guid>
		<description><![CDATA[
			
				
			
		
Tonight (Friday 06.11.2009) klunde.net was moved from the servetheworld.net server to my new server provider Webfaction.co.uk. The move seemed to go painlessly, even the email accounts seem to work properly.
Klunde.net has been with servetheworld for approx. 5 years now. Webfaction had a much better solution to offer than Servetheworld and it was therefore an easy [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.klunde.net%2F2009%2F11%2F06%2Fklunde-net-moved-server%2F" onclick="urchinTracker('/outgoing/api.tweetmeme.com/share?url=http_3A_2F_2Fwww.klunde.net_2F2009_2F11_2F06_2Fklunde-net-moved-server_2F&amp;referer=');"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.klunde.net%2F2009%2F11%2F06%2Fklunde-net-moved-server%2F&amp;source=kristianlunde&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>Tonight (Friday 06.11.2009) klunde.net was moved from the servetheworld.net server to my new server provider Webfaction.co.uk. The move seemed to go painlessly, even the email accounts seem to work properly.</p>
<p>Klunde.net has been with servetheworld for approx. 5 years now. Webfaction had a much better solution to offer than Servetheworld and it was therefore an easy choice.</p>
<p>Farewell Servetheworld.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.klunde.net/2009/11/06/klunde-net-moved-server/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Recurring payments with Paypal and PHP</title>
		<link>http://www.klunde.net/2009/10/02/recurring-payments-with-paypal-and-php/</link>
		<comments>http://www.klunde.net/2009/10/02/recurring-payments-with-paypal-and-php/#comments</comments>
		<pubDate>Fri, 02 Oct 2009 09:59:03 +0000</pubDate>
		<dc:creator>Kristian Lunde</dc:creator>
				<category><![CDATA[Misc]]></category>

		<guid isPermaLink="false">http://www.klunde.net/?p=397</guid>
		<description><![CDATA[
			
				
			
		
I have spent the past few days working with online payment solutions for mysapient. Yesterday I came across a bit of a troublesome issue when setting up recurring payments with paypal. There is no secret that the quality of the paypal documentation varies, so I had some troubles finding any proper information about this issue. [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.klunde.net%2F2009%2F10%2F02%2Frecurring-payments-with-paypal-and-php%2F" onclick="urchinTracker('/outgoing/api.tweetmeme.com/share?url=http_3A_2F_2Fwww.klunde.net_2F2009_2F10_2F02_2Frecurring-payments-with-paypal-and-php_2F&amp;referer=');"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.klunde.net%2F2009%2F10%2F02%2Frecurring-payments-with-paypal-and-php%2F&amp;source=kristianlunde&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>I have spent the past few days working with online payment solutions for mysapient. Yesterday I came across a bit of a troublesome issue when setting up recurring payments with paypal. There is no secret that the quality of the paypal documentation varies, so I had some troubles finding any proper information about this issue. Luckily there was a lot of other developers struggling with this same issue. </p>
<p>A quick google search gives you a lot of results about this topic and it can take you a while to get through them all, but at least here is the forum post that helped me getting this solved:</p>
<p>http://www.pdncommunity.com/pdn/board/message?board.id=nvp&#038;view=by_date_ascending&#038;message.id=5463</p>
<p>It seems like the setExpressCheckout needs the following parameters to work properly:</p>
<div class="geshi no php">
<ol>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>L_BILLINGTYPE0<span class="br0">&#93;</span> <span class="sy0">=&gt;</span> RecurringPayments</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>L_BILLINGAGREEMENTDESCRIPTION0<span class="br0">&#93;</span> <span class="sy0">=&gt;</span> Basic Plan</div>
</li>
</ol>
</div>
<p>It is also important to add the &#8220;desc&#8221; field to the createRecurringPaymentsProfile call.</p>
<div class="geshi no php">
<ol>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>DESC<span class="br0">&#93;</span> <span class="sy0">=&gt;</span> Basic Plan</div>
</li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.klunde.net/2009/10/02/recurring-payments-with-paypal-and-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Amazon Frenzy</title>
		<link>http://www.klunde.net/2009/09/24/amazon-frenzy/</link>
		<comments>http://www.klunde.net/2009/09/24/amazon-frenzy/#comments</comments>
		<pubDate>Thu, 24 Sep 2009 20:29:36 +0000</pubDate>
		<dc:creator>Kristian Lunde</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Real Life]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.klunde.net/?p=383</guid>
		<description><![CDATA[
			
				
			
		
The other day I had a frenzy at amazon and ordered quite a few books I have had on my shopping list. The books are of course all computer and web related. The books I ordered was:


Building Scalable Web Sites by Cal Henderson


High Performance MySQL


JavaScript: The Good Parts by Douglas Crockford
Don&#8217;t Make Me Think!: A [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.klunde.net%2F2009%2F09%2F24%2Famazon-frenzy%2F" onclick="urchinTracker('/outgoing/api.tweetmeme.com/share?url=http_3A_2F_2Fwww.klunde.net_2F2009_2F09_2F24_2Famazon-frenzy_2F&amp;referer=');"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.klunde.net%2F2009%2F09%2F24%2Famazon-frenzy%2F&amp;source=kristianlunde&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>The other day I had a frenzy at amazon and ordered quite a few books I have had on my shopping list. The books are of course all computer and web related. The books I ordered was:</p>
<ul>
<li>
<a href="http://www.amazon.co.uk/exec/obidos/ASIN/0596102356/ref=ox_ya_oh_product" onclick="urchinTracker('/outgoing/www.amazon.co.uk/exec/obidos/ASIN/0596102356/ref=ox_ya_oh_product?referer=');">Building Scalable Web Sites</a> by <a href="http://www.iamcal.com/" onclick="urchinTracker('/outgoing/www.iamcal.com/?referer=');">Cal Henderson</a>
</li>
<li>
<a href="http://www.amazon.co.uk/exec/obidos/ASIN/0596101716/ref=ox_ya_oh_product" onclick="urchinTracker('/outgoing/www.amazon.co.uk/exec/obidos/ASIN/0596101716/ref=ox_ya_oh_product?referer=');">High Performance MySQL</a>
</li>
<li>
<a href="http://www.amazon.co.uk/exec/obidos/ASIN/0596517742/ref=ox_ya_oh_product" onclick="urchinTracker('/outgoing/www.amazon.co.uk/exec/obidos/ASIN/0596517742/ref=ox_ya_oh_product?referer=');">JavaScript: The Good Parts</a> by <a href="http://www.crockford.com/" onclick="urchinTracker('/outgoing/www.crockford.com/?referer=');">Douglas Crockford</a></li>
<li><a href="http://www.amazon.co.uk/exec/obidos/ASIN/0321344758/ref=ox_ya_oh_product" onclick="urchinTracker('/outgoing/www.amazon.co.uk/exec/obidos/ASIN/0321344758/ref=ox_ya_oh_product?referer=');">Don&#8217;t Make Me Think!: A Common Sense Approach to Web Usability</a> by <a href="http://www.sensible.com/about.html" onclick="urchinTracker('/outgoing/www.sensible.com/about.html?referer=');">Steve Krug</a>
</li>
<li><a href="http://www.amazon.co.uk/exec/obidos/ASIN/0321503619/ref=ox_ya_oh_product" onclick="urchinTracker('/outgoing/www.amazon.co.uk/exec/obidos/ASIN/0321503619/ref=ox_ya_oh_product?referer=');">Cocoa Programming for Mac OS X</a> by <a href="http://en.wikipedia.org/wiki/Aaron_Hillegass" onclick="urchinTracker('/outgoing/en.wikipedia.org/wiki/Aaron_Hillegass?referer=');">Aaron Hillegass</a>
</li>
</ul>
<p>
I am halfway through the building scalable web sites and it is really good, even if you are a seasoned web developer I think you can learn quite a bit from it. I have also started to read the MySQL book and can&#8217;t wait to learn more about database replication, that is something I really want to find out more about. The &#8220;Don&#8217;t make me think&#8221; book will hopefully assist me on building more user friendly web sites, and hopefully the javascript book(still in the mail) will help me to brush up my js skills.
</p>
<p>
The Cocoa book was on sale, and you never know when you have to do a bit of programming for a mac <img src='http://www.klunde.net/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.klunde.net/2009/09/24/amazon-frenzy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Merging code bases</title>
		<link>http://www.klunde.net/2009/09/16/merging-code-bases/</link>
		<comments>http://www.klunde.net/2009/09/16/merging-code-bases/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 07:22:58 +0000</pubDate>
		<dc:creator>Kristian Lunde</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://www.klunde.net/?p=367</guid>
		<description><![CDATA[
			
				
			
		
Yesterday I had the &#8220;pleasure&#8221; of merging two code bases of the same application. The code bases had been developed in two different parts of the world, but shared a common foundation. I got access to a development version of the code base a few weeks ago, and the final delivery of the application was [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.klunde.net%2F2009%2F09%2F16%2Fmerging-code-bases%2F" onclick="urchinTracker('/outgoing/api.tweetmeme.com/share?url=http_3A_2F_2Fwww.klunde.net_2F2009_2F09_2F16_2Fmerging-code-bases_2F&amp;referer=');"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.klunde.net%2F2009%2F09%2F16%2Fmerging-code-bases%2F&amp;source=kristianlunde&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>Yesterday I had the &#8220;pleasure&#8221; of merging two code bases of the same application. The code bases had been developed in two different parts of the world, but shared a common foundation. I got access to a development version of the code base a few weeks ago, and the final delivery of the application was done late last week. No version control system was shared between myself and the contractor which made the merge a bit more cumbersome. Unfortunately I could not wait for the contractor to finish the development before I started to add features and bug fixes to the application; this eventually resulted in two separate versions of the code base. </p>
<p>I was aware that this merge would going to happen from the very start so some precautions were taken before I started my own branch of the source code.</p>
<p>1. I separated all new features out in separate directories and added symbolic links to these in the existing code base. This worked very well and we had no problem at all adding the new features to the final delivery. </p>
<p>2. I tried to be very careful and keep track of all the bug fixes and changes done to the original code.</p>
<h2>Trouble</h2>
<p>I realized that we would have trouble with the final merge not long after I received the first development version, it was cluttered with bugs and issues which made it impossible to even run it in my development version. To get the application up and running I had to make a bunch of changes to the code. </p>
<p>In addition to the initial bugs I soon realized that the front end of the application (read: html and css) was a complete mess. The site was not browser compliant, nothing validated and it was impossible to go through. These issues would not be resolved by the contractor and since the project was on the clock it needed resolving as quickly as possible. This ended up in a complete rebuild of the front end which modified 300+ files. </p>
<h2>1st Attempt &#8211; Failure</h2>
<p>1. Created a git branch of my development code<br />
2. Added the final code from the contractor to the branch</p>
<p>This ended up in a complete mess, nothing working, a complete mess. </p>
<h2>2nd Attempt &#8211; Success</h2>
<p>When the final delivery from the contractor came through the two code bases was in completely different states, most of the bug fixes I had was still needed. </p>
<p>1. Created a git branch of my code base<br />
3. Found the differences from the initial development version we got and the final delivery</p>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">diff</span> -qr dev final <span class="sy0">|</span> <span class="kw2">grep</span> -v -e <span class="st0">&#39;DS_Store&#39;</span> -e <span class="st0">&#39;Thumbs&#39;</span> <span class="sy0">|</span> <span class="kw2">sort</span> <span class="sy0">&gt;</span> changes.txt</div>
</li>
</ol>
</div>
<p>Where <i>dev</i> is the directory of the untouched development version we got access to, and <i>final</i> is the directory of the final delivery. This resulted in a complete list (<i>changes.txt</i>) of files which differed between the two original versions. It also identified files that was obsolete in and new files that was added.  An example of the content in the <i>changes.txt</i> can be seen below.</p>
<div class="geshi no text">
<ol>
<li class="li1">
<div class="de1">Files dev/view/file-1.php and final/view/file-1.php differ</div>
</li>
<li class="li1">
<div class="de1">Files dev/view/file-2.php and final/view/file-2.php differ</div>
</li>
<li class="li1">
<div class="de1">Only in dev/css: css-1.css</div>
</li>
<li class="li1">
<div class="de1">Only in dev/css: css-2.css</div>
</li>
<li class="li1">
<div class="de1">Only in dev/css: css-3.css</div>
</li>
<li class="li1">
<div class="de1">Only in final/css: css.css</div>
</li>
<li class="li1">
<div class="de1">Only in final/: file-a.php</div>
</li>
</ol>
</div>
<p>4. Once I had this overview I added all the new files from the final version into my git branch.<br />
5. Updated all the files I knew had not been changed. I had a list of all the core files which had been changed.<br />
6. I manually had to go through all the core files that had been changed and compare them with the files from the final delivery.<br />
7. Remove all old files which only were present in the development delivery.<br />
8. Manual comparison of all the front end files, updating and merging these files by hand. Diff can not be used here since the entire front end has changed, and it would only result in a complete difference, still there might have been changes that I needed to incorporate with the new front end.</p>
<p>I still have approx 150 front end files to compare, it is time consuming and frustrating labor, but it seems to be the only way to do it. I keep testing the application while doing the update and so far all of the changes and updates has been successful.</p>
<p>The positive flip of this is that I get a good overview of the code and understanding of the application when I have to go through much of the code from the final delivery.</p>
<p>I might not have chosen the best solution and I would love to hear your approach if you have done similar things or have an opinion about it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.klunde.net/2009/09/16/merging-code-bases/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
