<?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 &#187; web development</title>
	<atom:link href="http://www.klunde.net/category/web/web-development/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.klunde.net</link>
	<description>www.klunde.net</description>
	<lastBuildDate>Wed, 01 Feb 2012 23:57:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Zend_View and base paths outside the application directory</title>
		<link>http://www.klunde.net/2012/02/01/zend_view-and-base-paths-outside-the-application-directory/</link>
		<comments>http://www.klunde.net/2012/02/01/zend_view-and-base-paths-outside-the-application-directory/#comments</comments>
		<pubDate>Wed, 01 Feb 2012 23:57:01 +0000</pubDate>
		<dc:creator>Kristian Lunde</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://www.klunde.net/?p=571</guid>
		<description><![CDATA[I&#8217;ve recently been working on a Zend application (v1.11.11) that required several views directories and they had to be located outside the application directory. The documentation says that you can have as many view basePaths as you like, which sounds great. The only problem is that the Zend_Controller_Action_Helper_ViewRenderer checks that the alternative basePaths are located [...]]]></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%2F2012%2F02%2F01%2Fzend_view-and-base-paths-outside-the-application-directory%2F" onclick="urchinTracker('/outgoing/api.tweetmeme.com/share?url=http_3A_2F_2Fwww.klunde.net_2F2012_2F02_2F01_2Fzend_view-and-base-paths-outside-the-application-directory_2F&amp;referer=');"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.klunde.net%2F2012%2F02%2F01%2Fzend_view-and-base-paths-outside-the-application-directory%2F&amp;source=kristianlunde&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>I&#8217;ve recently been working on a Zend application (v1.11.11) that required several views directories and they had to be located outside the application directory. The documentation says that you can have as many view basePaths as you like, which sounds great. The only problem is that the Zend_Controller_Action_Helper_ViewRenderer checks that the alternative basePaths are located within the default basePath (APPLICATION_PATH &#8220;/views/&#8221;). </p>
<p>The easiest way of resolving this is to add the full path to the directory like this:</p>
<p><code><br />
APPLICATION_PATH . '/views/../../themes/my-theme/';<br />
</code></p>
<p>The example below is from my Bootstrap file:<br />
<code><br />
protected function _initView() {<br />
  $view = new Zend_View();</p>
<p>  $view->setBasePath(APPLICATION_PATH . '/views/../../themes/my-theme/');<br />
  $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();<br />
  $viewRenderer->setView($view);<br />
  Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);<br />
  return $view;<br />
}<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.klunde.net/2012/02/01/zend_view-and-base-paths-outside-the-application-directory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Review: PHP5 Social Networking</title>
		<link>http://www.klunde.net/2011/05/06/review-php5-social-networking/</link>
		<comments>http://www.klunde.net/2011/05/06/review-php5-social-networking/#comments</comments>
		<pubDate>Fri, 06 May 2011 20:34:51 +0000</pubDate>
		<dc:creator>Kristian Lunde</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://www.klunde.net/?p=551</guid>
		<description><![CDATA[Packt publishing contacted me couple of months back, asking me if I was interested in reviewing &#8220;PHP5 Social Networking&#8221; by Michael Peacock. The title intrigued me as I&#8217;ve built several social networking applications and I was interested in seeing Michaels approach to this. The first chapter starts by defining social networking, it looks at 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%2F2011%2F05%2F06%2Freview-php5-social-networking%2F" onclick="urchinTracker('/outgoing/api.tweetmeme.com/share?url=http_3A_2F_2Fwww.klunde.net_2F2011_2F05_2F06_2Freview-php5-social-networking_2F&amp;referer=');"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.klunde.net%2F2011%2F05%2F06%2Freview-php5-social-networking%2F&amp;source=kristianlunde&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p><a href="http://www.packtpub.com/" onclick="urchinTracker('/outgoing/www.packtpub.com/?referer=');">Packt publishing</a> contacted me  couple of months back, asking me if I was interested in reviewing <a href="http://www.amazon.co.uk/PHP-Social-Networking-Michael-Peacock/dp/1849512388/ref=sr_1_1?ie=UTF8&#038;s=books&#038;qid=1304713910&#038;sr=8-1" onclick="urchinTracker('/outgoing/www.amazon.co.uk/PHP-Social-Networking-Michael-Peacock/dp/1849512388/ref=sr_1_1?ie=UTF8_038_s=books_038_qid=1304713910_038_sr=8-1&amp;referer=');">&#8220;PHP5 Social Networking&#8221;</a> by <a href="http://www.michaelpeacock.co.uk/" onclick="urchinTracker('/outgoing/www.michaelpeacock.co.uk/?referer=');">Michael Peacock</a>. The title intrigued me as I&#8217;ve built several social networking applications and I was interested in seeing Michaels approach to this. </p>
<p>The first chapter starts by defining social networking, it looks at the most known social networks out there. It also reviews available social network software out there such as <a href="http://www.elgg.org/" onclick="urchinTracker('/outgoing/www.elgg.org/?referer=');">Elgg</a>, <a href="http://drupal.org/" onclick="urchinTracker('/outgoing/drupal.org/?referer=');">drupal</a> and <a href="http://www.joomla.org/" onclick="urchinTracker('/outgoing/www.joomla.org/?referer=');">joomla</a>. The approach taken in this book is to roll out an own application from scratch with no base framework. The basics of this framework is described in chapter 2 and 3. </p>
<p>Chapter 4 to 10 deals with the core elements of social networks, such as friends, friend requests, statuses, streams, messaging and events. Each chapter describe how to the functionality should work, a detailed implementation plan is shown and ideas for further development is discussed.</p>
<p>Chapter 11 show the reader how the application easily can support an API, I really like that Michael chose to add this chapter as I think it is a crucial element to any social network that is going to go somewhere. </p>
<p>Maintenance, security and deployment is discussed  in chapter 12. I find this chapter a bit odd as it describe very basic steps to get the application up and running on the production server. I would have liked to see more about automated deployment in this chapter.</p>
<p>All social network sites need to get users and hopefully generate some revenue, this is the topic of chapter 13 which describe solutions and approaches to marketing, SEO techniques and monetization. </p>
<p>The last chapter is &#8220;Planning for growth&#8221; a very important chapter in my mind. It describes approaches for profiling of web applications, server scaling, redundancy and more. </p>
<p>It is a well written book with good examples and it describes the build of the application in detail so the user easily can follow and copy the examples. I would definitely recommend this book to novice developers as it is a good introduction to a lot of good programming practices. It can also be a decent book to read if you are an experienced developer that want to learn more about the core concepts of building a social network. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.klunde.net/2011/05/06/review-php5-social-networking/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reviewing &#8220;PHP 5 Social Networking&#8221;</title>
		<link>http://www.klunde.net/2011/02/08/reviewing-php-5-social-networking/</link>
		<comments>http://www.klunde.net/2011/02/08/reviewing-php-5-social-networking/#comments</comments>
		<pubDate>Tue, 08 Feb 2011 12:51:49 +0000</pubDate>
		<dc:creator>Kristian Lunde</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Real Life]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://www.klunde.net/?p=544</guid>
		<description><![CDATA[Packt Publishing has asked me to review Michael Peacocks &#8220;PHP 5 Social Networking&#8221; something I&#8217;ve happily agreed to do. I am expecting to receive the book soon and look forward to read it. Social networks and PHP is something I&#8217;ve worked quite a bit with and I am interested to see Michaels take on this [...]]]></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%2F2011%2F02%2F08%2Freviewing-php-5-social-networking%2F" onclick="urchinTracker('/outgoing/api.tweetmeme.com/share?url=http_3A_2F_2Fwww.klunde.net_2F2011_2F02_2F08_2Freviewing-php-5-social-networking_2F&amp;referer=');"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.klunde.net%2F2011%2F02%2F08%2Freviewing-php-5-social-networking%2F&amp;source=kristianlunde&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p><a href="http://www.packtpub.com/" onclick="urchinTracker('/outgoing/www.packtpub.com/?referer=');">Packt Publishing</a> has asked me to review Michael Peacocks &#8220;<a href="https://www.packtpub.com/php-create-powerful-dynamic-social-networking-website/book" onclick="urchinTracker('/outgoing/www.packtpub.com/php-create-powerful-dynamic-social-networking-website/book?referer=');">PHP 5 Social Networking</a>&#8221; something I&#8217;ve happily agreed to do. I am expecting to receive the book soon and look forward to read it. Social networks and PHP is something I&#8217;ve worked quite a bit with and I am interested to see Michaels take on this topic.</p>
<p>I&#8217;ll be posting the review as soon as I&#8217;ve finished the book. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.klunde.net/2011/02/08/reviewing-php-5-social-networking/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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&amp;b=2" 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>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[web]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[Wordpress]]></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&amp;b=2" 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>[No Book Data for this Book Number]</i> 
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><i>[No Book Data for this Book Number]</i> 
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><i>[No Book Data for this Book Number]</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>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&amp;b=2" 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>
		<item>
		<title>Javascript snippets</title>
		<link>http://www.klunde.net/2009/06/18/javascript-snippets/</link>
		<comments>http://www.klunde.net/2009/06/18/javascript-snippets/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 22:55:29 +0000</pubDate>
		<dc:creator>Kristian Lunde</dc:creator>
				<category><![CDATA[web]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://www.klunde.net/?p=302</guid>
		<description><![CDATA[Lately I have been doing some javascript development and I have written a couple of functions which I find really useful. I almost find the code snippets to be used on all sites I work on so I thought I would share them with you. Both the snippets are written using the jQuery library. Opening [...]]]></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%2F06%2F18%2Fjavascript-snippets%2F" onclick="urchinTracker('/outgoing/api.tweetmeme.com/share?url=http_3A_2F_2Fwww.klunde.net_2F2009_2F06_2F18_2Fjavascript-snippets_2F&amp;referer=');"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.klunde.net%2F2009%2F06%2F18%2Fjavascript-snippets%2F&amp;source=kristianlunde&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Lately I have been doing some javascript development and I have written a couple of functions which I find really useful. I almost find the code snippets to be used on all sites I work on so I thought I would share them with you. Both the snippets are written using the <a href="http://www.jquery.com" rel="external" title="jQuery" onclick="urchinTracker('/outgoing/www.jquery.com?referer=');">jQuery</a> library.</p>
<h3>Opening urls in a separate window/tab in a xhtml strict environment</h3>
<p>The <i>target</i> attribute is not a valid attribute in xhtml strict and your site will fail to validate if you use it, so to get around this you can use replace your <i>target</i> attribute with the <i>rel</i> attribute. Adding the <i>rel=&#8221;external&#8221;</i> attribute on your anchors that points to an external source and adding some javascript solves the problem.</p>
<div class="geshi no html">
<ol>
<li class="li1">
<div class="de1">&lt;a href=&quot;http://www.klunde.net&quot; rel=&quot;external&quot; title=&quot;Klunde.net&quot;&gt;Kristian Lunde&lt;/a&gt;</div>
</li>
</ol>
</div>
<div class="geshi no javascript">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">function</span> externalLinks<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; $<span class="br0">&#40;</span><span class="st0">&quot;a[rel=&#39;external&#39;]&quot;</span><span class="br0">&#41;</span>.<span class="me1">each</span><span class="br0">&#40;</span><span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; $<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span>.<span class="me1">attr</span><span class="br0">&#40;</span><span class="st0">&#39;target&#39;</span>, <span class="st0">&#39;_blank&#39;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span>; </div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span>;</div>
</li>
</ol>
</div>
<p>The code here is pretty self explaining, but to describe it briefly, the javascript function must be invoked once the DOM is loaded (see code further down on the page). The function loops through all anchors that have the <i>rel=&#8221;external&#8221;</i> attribute and add the attribute <i>target=&#8221;_blank&#8221;</i>. I guess this is a bit of a hack, but it works and it keeps the clients happy <img src='http://www.klunde.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<h3>Creating spam proof mailto: anchors</h3>
<p>It is a well known fact that if you add your email address on a site in a plain mailto anchor you will be flooded by spam after a while. You can easily avoid this by adding a little bit of javascript on your site. </p>
<p>It works simply by printing out the email address as plain text replacing the @ with a &#8221; AT &#8221; and add the email addresses in a <i>div</i> or which ever element you prefer and add a set class to that tag. Then you run a small snippet of javascript that find all the elements with that class, I have chosen the class name &#8220;email&#8221;. The script replaces the content in all the elements with the email class with the proper html anchor. This can not be picked up by web crawlers and it displays the links properly for the user. All browsers without javascript support / enabled will of course only see the post AT somesite.com.</p>
<div class="geshi no html">
<ol>
<li class="li1">
<div class="de1">&lt;div class=&quot;email&quot;&gt;post AT &nbsp;somesite.com&lt;/div&gt;</div>
</li>
</ol>
</div>
<div class="geshi no javascript">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">function</span> createMailTo<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> c_email_field = $<span class="br0">&#40;</span><span class="st0">&#39;.email&#39;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="kw1">if</span><span class="br0">&#40;</span>$<span class="br0">&#40;</span>c_email_field<span class="br0">&#41;</span>.<span class="me1">length</span> <span class="sy0">&gt;</span> <span class="nu0">0</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; $<span class="br0">&#40;</span>c_email_field<span class="br0">&#41;</span>.<span class="me1">each</span><span class="br0">&#40;</span><span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw2">var</span> email = $<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span>.<span class="me1">html</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">replace</span><span class="br0">&#40;</span><span class="st0">&#39; AT &#39;</span>, <span class="st0">&#39;@&#39;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;$<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span>.<span class="me1">html</span><span class="br0">&#40;</span><span class="st0">&#39;&lt;a href=&quot;mailto:&#39;</span> + email + <span class="st0">&#39;&quot; rel=&quot;nofollow&quot; title=&quot;&#39;</span> + email + <span class="st0">&#39;&quot;&gt;&#39;</span> + email + <span class="st0">&#39;&lt;/a&gt;&#39;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="br0">&#125;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span>;</div>
</li>
</ol>
</div>
<p>Running this script would transform the code into:</p>
<div class="geshi no html">
<ol>
<li class="li1">
<div class="de1">&lt;a href=&quot;mailto:post@somesite.com&quot; rel=&quot;nofollow&quot; title=&quot;post@somesite.com&quot;&gt;post@somesite.com&lt;/a&gt;</div>
</li>
</ol>
</div>
<h3>Putting it all together</h3>
<p>I have but together a simple example to illustrate the functions in action with all code and functionality. You should be able to copy this code save it as a .html file and run it in your browser.</p>
<div class="geshi no javascript">
<ol>
<li class="li1">
<div class="de1"><span class="sy0">&lt;!</span>DOCTYPE html <span class="kw2">PUBLIC</span> <span class="st0">&quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot;</span> <span class="st0">&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;</span><span class="sy0">&gt;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="sy0">&lt;</span>html<span class="sy0">&gt;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="sy0">&lt;</span>head<span class="sy0">&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="sy0">&lt;</span>title<span class="sy0">&gt;</span>Javascript snippets<span class="sy0">&lt;/</span>title<span class="sy0">&gt;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="sy0">&lt;/</span>head<span class="sy0">&gt;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="sy0">&lt;</span>body<span class="sy0">&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="sy0">&lt;</span>a href=<span class="st0">&quot;http://www.klunde.net&quot;</span> rel=<span class="st0">&quot;external&quot;</span> title=<span class="st0">&quot;Klunde.net&quot;</span><span class="sy0">&gt;</span>Kristian Lunde<span class="sy0">&lt;/</span>a<span class="sy0">&gt;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="sy0">&lt;</span>div <span class="kw2">class</span>=<span class="st0">&quot;email&quot;</span><span class="sy0">&gt;</span>post AT somesite.<span class="me1">com</span><span class="sy0">&lt;/</span>div<span class="sy0">&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="sy0">&lt;</span>script type=<span class="st0">&quot;text/javascript&quot;</span> src=<span class="st0">&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&quot;</span><span class="sy0">&gt;&lt;/</span>script<span class="sy0">&gt;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="sy0">&lt;</span>script type=<span class="st0">&quot;text/javascript&quot;</span><span class="sy0">&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">function</span> externalLinks<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; $<span class="br0">&#40;</span><span class="st0">&quot;a[rel=&#39;external&#39;]&quot;</span><span class="br0">&#41;</span>.<span class="me1">each</span><span class="br0">&#40;</span><span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; $<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span>.<span class="me1">attr</span><span class="br0">&#40;</span><span class="st0">&#39;target&#39;</span>, <span class="st0">&#39;_blank&#39;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</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"><span class="kw2">function</span> createMailTo<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> c_email_field = $<span class="br0">&#40;</span><span class="st0">&#39;.email&#39;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="kw1">if</span><span class="br0">&#40;</span>$<span class="br0">&#40;</span>c_email_field<span class="br0">&#41;</span>.<span class="me1">length</span> <span class="sy0">&gt;</span> <span class="nu0">0</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; $<span class="br0">&#40;</span>c_email_field<span class="br0">&#41;</span>.<span class="me1">each</span><span class="br0">&#40;</span><span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw2">var</span> email = $<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span>.<span class="me1">html</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">replace</span><span class="br0">&#40;</span><span class="st0">&#39; AT &#39;</span>, <span class="st0">&#39;@&#39;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;$<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span>.<span class="me1">html</span><span class="br0">&#40;</span><span class="st0">&#39;&lt;a href=&quot;mailto:&#39;</span> + email + <span class="st0">&#39;&quot; rel=&quot;nofollow&quot; title=&quot;&#39;</span> + email + <span class="st0">&#39;&quot;&gt;&#39;</span> + email + <span class="st0">&#39;&lt;/a&gt;&#39;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="br0">&#125;</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">$<span class="br0">&#40;</span><span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; externalLinks<span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; createMailTo<span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="sy0">&lt;/</span>script<span class="sy0">&gt;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="sy0">&lt;/</span>body<span class="sy0">&gt;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="sy0">&lt;/</span>html<span class="sy0">&gt;</span></div>
</li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.klunde.net/2009/06/18/javascript-snippets/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Flowplayer, https and the streamnotfound &#8220;problem&#8221;</title>
		<link>http://www.klunde.net/2009/01/16/flowplayer-https-and-the-streamnotfound-problem/</link>
		<comments>http://www.klunde.net/2009/01/16/flowplayer-https-and-the-streamnotfound-problem/#comments</comments>
		<pubDate>Fri, 16 Jan 2009 14:25:40 +0000</pubDate>
		<dc:creator>Kristian Lunde</dc:creator>
				<category><![CDATA[web]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[Amazon S3]]></category>
		<category><![CDATA[Flowplayer]]></category>

		<guid isPermaLink="false">http://www.klunde.net/?p=240</guid>
		<description><![CDATA[Lately I have been working on a project which used Amazon S3 to provide videos to Flowplayer on a website. This was working superbly until we added a link to a video using the https protocol. This broke the Flowplayer on Internet explorer 6 and 7 and Safari, and we got a: streamNotFound, clip: &#39;https://someurl&#39; [...]]]></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%2F01%2F16%2Fflowplayer-https-and-the-streamnotfound-problem%2F" onclick="urchinTracker('/outgoing/api.tweetmeme.com/share?url=http_3A_2F_2Fwww.klunde.net_2F2009_2F01_2F16_2Fflowplayer-https-and-the-streamnotfound-problem_2F&amp;referer=');"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.klunde.net%2F2009%2F01%2F16%2Fflowplayer-https-and-the-streamnotfound-problem%2F&amp;source=kristianlunde&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Lately I have been working on a project which used <a href="http://aws.amazon.com/s3/" onclick="urchinTracker('/outgoing/aws.amazon.com/s3/?referer=');">Amazon S3</a> to provide videos to <a href="http://flowplayer.org/" onclick="urchinTracker('/outgoing/flowplayer.org/?referer=');">Flowplayer</a> on a website. This was working superbly until we added a link to a video using the https protocol. This broke the <a href="http://flowplayer.org/" onclick="urchinTracker('/outgoing/flowplayer.org/?referer=');">Flowplayer</a> on Internet explorer 6 and 7 and Safari, and we got a:</p>
<div class="geshi no html">
<ol>
<li class="li1">
<div class="de1">streamNotFound, clip: &#39;https://someurl&#39;</div>
</li>
</ol>
</div>
<p>Solution: <a href="http://aws.amazon.com/s3/" onclick="urchinTracker('/outgoing/aws.amazon.com/s3/?referer=');">Amazon S3</a> supports both http and https, so replacing https with http solved the problem. This problem probably occurs because the web browser is unable to cache the data from the https url and therefore the <a href="http://flowplayer.org/" onclick="urchinTracker('/outgoing/flowplayer.org/?referer=');">Flowplayer</a> is unable to play the video.</p>
<p>Interestingly enough Firefox had no problem at all running <a href="http://flowplayer.org/" onclick="urchinTracker('/outgoing/flowplayer.org/?referer=');">Flowplayer</a> and https urls.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.klunde.net/2009/01/16/flowplayer-https-and-the-streamnotfound-problem/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>All frameworks sucks&#8230;. ?</title>
		<link>http://www.klunde.net/2008/10/25/all-frameworks-sucks/</link>
		<comments>http://www.klunde.net/2008/10/25/all-frameworks-sucks/#comments</comments>
		<pubDate>Fri, 24 Oct 2008 22:40:01 +0000</pubDate>
		<dc:creator>Kristian Lunde</dc:creator>
				<category><![CDATA[Drupal]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[Framework]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.klunde.net/?p=126</guid>
		<description><![CDATA[I&#8217;ve been hearing this a lot lately, that most framework sucks, well do they? Mr. Paul M. Jones has a really good article about the subject, he says that when a developer has to do a major change in his mindset and development routines to get used to a new framework, the developer often think [...]]]></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%2F2008%2F10%2F25%2Fall-frameworks-sucks%2F" onclick="urchinTracker('/outgoing/api.tweetmeme.com/share?url=http_3A_2F_2Fwww.klunde.net_2F2008_2F10_2F25_2Fall-frameworks-sucks_2F&amp;referer=');"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.klunde.net%2F2008%2F10%2F25%2Fall-frameworks-sucks%2F&amp;source=kristianlunde&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>I&#8217;ve been hearing this a lot lately, that most framework sucks, well do they? </p>
<p>Mr. <a href="http://paul-m-jones.com/?p=355" onclick="urchinTracker('/outgoing/paul-m-jones.com/?p=355&amp;referer=');">Paul M. Jones</a> has a really good article about the subject, he says that when a developer has to do a major change in his mindset and development routines to get used to a new framework, the developer often think that the &#8220;framework sucks&#8221;.</p>
<p>Personally I&#8217;ve been the kind of developer who like to write my own frameworks from scratch, and yes that also mean that I&#8217;ve written a couple of frameworks for myself, and threw them away. Since I like to write things from the scratch I&#8217;ve also been a bit critical to other frameworks,and I do understand  term &#8220;all frameworks sucks&#8221;. When you&#8217;ve written your own framework, you know how it works, and it works just the way you want it to, at least that was the goal of writing it in the first place. It also gives you the possibility to change or add functionality in the core of the framework rather easily.</p>
<p>The advantages with a &#8220;off the shelf&#8221; framework can sometimes be intriguing, with a little bit of effort you can become darn efficent with this kind of framework, that will of course require a bit from the developer to learn the framework. Another bonus about learning a new framework is that you pick up on some of the bright ideas the developers have implemented in their framework.</p>
<p>I do not think that all frameworks sucks but, there are some frameworks out there that do not match my mindset at all, there is no secret that I&#8217;m not a huge fan of large enterprise frameworks with a wide extent of xml files and structures (I&#8217;m not naming any names, but the Java world have a few of these). Why on earth would you need to define a new page in three different xml files to get it working? </p>
<p>I&#8217;ve heard a lot about <a href="http://codeigniter.com/" onclick="urchinTracker('/outgoing/codeigniter.com/?referer=');">Code Ignitor</a> and it sounds like a promising framework, I have not had the time to have a look at it yet. I am familiar with the <a href="http://framework.zend.com/" onclick="urchinTracker('/outgoing/framework.zend.com/?referer=');">Zend framework</a> and <a href="http://ez.no/ezcomponents" onclick="urchinTracker('/outgoing/ez.no/ezcomponents?referer=');">EZ components</a> which probably are more of a set of building bricks than frameworks, both of these are quite good and comfortable to work with. </p>
<p>Recently I&#8217;ve started to look at the <a href="http://drupal.org" onclick="urchinTracker('/outgoing/drupal.org?referer=');">Drupal</a>. I realize that Drupal is more of a content management system than a framework, but it has its similarities to a framework. So far I still think Drupal &#8220;sucks&#8221; <img src='http://www.klunde.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  but I do however like  the simplicity of writing modules. What I do not like at all is the &#8220;lack&#8221; of OOP, and yes I know Drupal have its own way of implementing OOP, but I still feels thats is a little bit awkward, I am a bit of a OOP junkie <img src='http://www.klunde.net/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /><br />
Anyway I see the potential of Drupal and look forward to getting to know it better. I believe I eventually will  like Drupal because it is easy to extend, you get a lot of stuff for free because someone has already written it for you and it is a big community around it with a lot of smart developers. There is probably a reason why Drupal is one of the largest PHP framework out there.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.klunde.net/2008/10/25/all-frameworks-sucks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Templating with Eclipse</title>
		<link>http://www.klunde.net/2008/08/20/templating-with-eclipse/</link>
		<comments>http://www.klunde.net/2008/08/20/templating-with-eclipse/#comments</comments>
		<pubDate>Wed, 20 Aug 2008 20:18:39 +0000</pubDate>
		<dc:creator>Kristian Lunde</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHPEclipse]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://www.klunde.net/?p=54</guid>
		<description><![CDATA[Today I came over a a post on dzone.com about Eclipse and templating. It turns out that you can write small templates of code snippets you use a lot and bind them to a keyword. When typing the keyword, press &#8220;ctrl&#8221; and &#8220;space&#8221; and a list of possible templates available will appear, select the prefered [...]]]></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%2F2008%2F08%2F20%2Ftemplating-with-eclipse%2F" onclick="urchinTracker('/outgoing/api.tweetmeme.com/share?url=http_3A_2F_2Fwww.klunde.net_2F2008_2F08_2F20_2Ftemplating-with-eclipse_2F&amp;referer=');"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.klunde.net%2F2008%2F08%2F20%2Ftemplating-with-eclipse%2F&amp;source=kristianlunde&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Today I came over a a post on <a href="http://www.dzone.com" onclick="urchinTracker('/outgoing/www.dzone.com?referer=');">dzone.com</a> about Eclipse and templating. It turns out that you can write small templates of code snippets you use a lot and bind them to a keyword. When typing the keyword, press &#8220;ctrl&#8221; and &#8220;space&#8221; and a list of possible templates available will appear, select the prefered template, press &#8220;enter&#8221; and the code snippet is inserted into your working code. I works just the same way code completion. This actually means that you do not have to write the boring &#8220;for&#8221; loops or &#8220;if&#8221; tests anymore, just write a template and become a more efficient developer. </p>
<p>The <a href="http://firstclassthoughts.co.uk/java/eclipse_tip_templates_public_static_final.html" onclick="urchinTracker('/outgoing/firstclassthoughts.co.uk/java/eclipse_tip_templates_public_static_final.html?referer=');">original post</a> explains how to set up templates, so I will not go into that in this post, but since I am primarily a PHP developer and the post describes templating for Java, I&#8217;ll just give a description of where to go if you use the PHPEclipse.<br />
To edit and create templates for PHP, HTML or css, even javascript you have to use this path:</p>
<p><em>window -> preferences -> PHPeclipse Web Development -> PHP -> Templates.</em></p>
<p>To write and edit the templates, just follow the guidelines from <a href="http://firstclassthoughts.co.uk/java/eclipse_tip_templates_public_static_final.html" onclick="urchinTracker('/outgoing/firstclassthoughts.co.uk/java/eclipse_tip_templates_public_static_final.html?referer=');">Mr. Graversen</a>, or have a look at the links below.</p>
<p>For further reading have a look these sites.</p>
<ul>
<li><a href="http://firstclassthoughts.co.uk/java/eclipse_tip_templates_public_static_final.html" onclick="urchinTracker('/outgoing/firstclassthoughts.co.uk/java/eclipse_tip_templates_public_static_final.html?referer=');">http://firstclassthoughts.co.uk/java/eclipse_tip_templates_public_static_final.html</a>
<li>http://www.phpeclipse.de/tiki-index.php?page=Howto+use+the+templates+system</li>
<li><a href="http://help.eclipse.org/help21/index.jsp?topic=/org.eclipse.jdt.doc.user/concepts/ctemplates.htm" onclick="urchinTracker('/outgoing/help.eclipse.org/help21/index.jsp?topic=/org.eclipse.jdt.doc.user/concepts/ctemplates.htm&amp;referer=');">http://help.eclipse.org/help21/index.jsp?topic=/org.eclipse.jdt.doc.user/concepts/ctemplates.htm</a></li>
</ul>
<p>I guess if I had read the PHPEclipse manual when I first started using Eclipse, I would probably been using it from the start <img src='http://www.klunde.net/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>Good luck with your  Eclipse templates, I know I will be using them extensively.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.klunde.net/2008/08/20/templating-with-eclipse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

