<?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>Peter Törnstrand</title>
	<atom:link href="http://www.tornstrand.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tornstrand.com</link>
	<description>Drupal, PHP and web developing</description>
	<lastBuildDate>Sun, 22 Nov 2009 11:29:06 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Widgets, a Drupal module</title>
		<link>http://www.tornstrand.com/2009/11/22/widgets-a-drupal-module/</link>
		<comments>http://www.tornstrand.com/2009/11/22/widgets-a-drupal-module/#comments</comments>
		<pubDate>Sun, 22 Nov 2009 11:26:29 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[drupal]]></category>
		<category><![CDATA[interface]]></category>
		<category><![CDATA[module]]></category>

		<guid isPermaLink="false">http://www.tornstrand.com/?p=51</guid>
		<description><![CDATA[Widgets is a module that enables a site editor to, on a per node basis, select &#8220;widgets&#8221; that should be displayed when viewing a node. A &#8220;widget&#8221; in it&#8217;s simplest form is just a regular node (page, story etc) but the power of the module is that you can create custom content types (with CCK) [...]]]></description>
			<content:encoded><![CDATA[<p><em>Widgets</em> is a module that enables a site editor to, on a per node basis, select &#8220;widgets&#8221; that should be displayed when viewing a node. A &#8220;widget&#8221; in it&#8217;s simplest form is just a regular node (page, story etc) but the power of the module is that you can create custom content types (with CCK) to use as &#8220;widgets&#8221;. You could say that Widgets brings the power of the block right into the node edit form.<span id="more-51"></span></p>
<p>This module was developed by me and sponsored by <a href="http://www.happiness.se/">Happiness</a>.</p>
<p><a href="http://drupal.org/project/widgets">Download</a> and read more about <em>Widgets</em>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tornstrand.com/2009/11/22/widgets-a-drupal-module/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drupal Flickr Photoset block module</title>
		<link>http://www.tornstrand.com/2009/10/20/drupal-flickr-photoset-block-module/</link>
		<comments>http://www.tornstrand.com/2009/10/20/drupal-flickr-photoset-block-module/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 07:38:44 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[drupal]]></category>
		<category><![CDATA[flickr]]></category>
		<category><![CDATA[module]]></category>
		<category><![CDATA[photoset]]></category>

		<guid isPermaLink="false">http://www.tornstrand.com/?p=42</guid>
		<description><![CDATA[I have previously written about creating photo galleries using the Flickr Field module. Before I came up with the solution described in the post Drupal Flickr gallery using Flickr field I developed a Flickr Photoset block module. Since I&#8217;m not going to use it nor contribute it to the Drupal contrib repository I thought I [...]]]></description>
			<content:encoded><![CDATA[<p>I have previously written about creating photo galleries using the Flickr Field module. Before I came up with the solution described in the post <a href="http://www.tornstrand.com/2009/10/15/flickr-gallery-using-flickr-field/">Drupal Flickr gallery using Flickr field</a> I developed a Flickr Photoset block module. Since I&#8217;m not going to use it nor contribute it to the Drupal contrib repository I thought I at least <span style="text-decoration: line-through;">upload it here</span> put it on GitHub so that anyone that might be in need of a Photoset block can use it.</p>
<p>The module is still in early development but fully functional. Use it at your own risk.</p>
<p><a href="http://github.com/petertornstrand/Flickr-Photoset-Block">Flickr Photoset Module at GitHub</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tornstrand.com/2009/10/20/drupal-flickr-photoset-block-module/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drupal Flickr gallery using Flickr field</title>
		<link>http://www.tornstrand.com/2009/10/15/flickr-gallery-using-flickr-field/</link>
		<comments>http://www.tornstrand.com/2009/10/15/flickr-gallery-using-flickr-field/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 05:55:41 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[drupal]]></category>
		<category><![CDATA[cck]]></category>
		<category><![CDATA[flickr]]></category>

		<guid isPermaLink="false">http://www.tornstrand.com/?p=33</guid>
		<description><![CDATA[With the Flickr module you can display images from Flickr in various ways. On thing you can&#8217;t do out of the box is to display a perticular photoset with multiple thumbnails. Say you have the content type news and every news item is associated with a perticular Flickr photoset. When viewing the news item you [...]]]></description>
			<content:encoded><![CDATA[<p>With the <a href="http://drupal.org/project/flickr">Flickr module</a> you can display images from Flickr in various ways. On thing you can&#8217;t do out of the box is to display a perticular photoset with multiple thumbnails. Say you have the content type <em>news</em> and every news item is associated with a perticular Flickr photoset. When viewing the <em>news</em> item you want to display the photoset below the node body.<span id="more-33"></span></p>
<p>So how do you go about making this happen? Well, the Flickr module ships with several different blocks, none however lets you input a photoset id. The blocks provide more versatile functionality such as displaying the latest images by a user, the latest photoset and so on. So instead we turn to the Flickr modules CCK addition, the <em>Flickr field</em>. The Flickr field lets you define a field that accepts either a photo or photoset id. To enable the photoset feature you need to activate the module <em>Flicker Sets</em> which shipps with the Flickr module.</p>
<p>The first step is to add a Flickr field to a content type, in our case the <em>news</em> content type. Once you added the field make sure to visit the <em>Display</em> tab and setup the preferred image display size. Now lets create a new <em>news</em> item and input a valid Flickr user id and photoset id.</p>
<p>Once we have added the Flickr field to our <em>news</em> content type and created our first post it may take a while for the photoset to show up in your newly created <em>news</em> post. When it shows up you will see that it only shows the cover photo from the photoset and displays a link to the photoset at flickr.com. That is not the desired behavior. We want all the images to display in a nice list. To make this happen we need to override som theme functions. If you don&#8217;t already got a <em>template.php</em> file in your theme create one.</p>
<p>In the <em>template.php</em> file we will override the function <em>theme_flickrfield_photoset</em>. Look at the code below:</p>
<p><code>function yourthemename_flickrfield_photoset($img, $photo_url, $formatter, $photo_data, $node) {<br />
return theme_flickr_photoset($photo_data, $photo_data['owner'], $formatter);<br />
}</code></p>
<p>Thats all it&#8217;s to it. Now the photoset will render as a complete set with a pager available when the photoset is larger then 20 photos.</p>
<p>In my case I also wanted the photoset images to open in a <a href="http://fancybox.net/">Fancybox</a> window instead of linking to flickr.com. To make this happen you need to override another theme function, see below.</p>
<p><code>function yourthemename_flickr_photo($p, $size = NULL, $format = NULL, $attribs = NULL) {<br />
$img = flickr_img($p, $size, $attribs);<br />
$photo_url = flickr_photo_img($p, NULL, $format);<br />
$title = is_array($p['title']) ? $p['title']['_content'] : $p['title'];<br />
return l($img, $photo_url, array('attributes' =&gt; array(<strong>'rel' =&gt; 'photos'</strong>, 'title' =&gt; $title), 'absolute' =&gt; TRUE, 'html' =&gt; TRUE));<br />
}</code></p>
<p>The attribute <em>rel=&#8221;photos&#8221;</em> is required to enable image browsing with Fancybox.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tornstrand.com/2009/10/15/flickr-gallery-using-flickr-field/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>The Drupal module jungle</title>
		<link>http://www.tornstrand.com/2009/08/19/the-drupal-module-jungle/</link>
		<comments>http://www.tornstrand.com/2009/08/19/the-drupal-module-jungle/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 13:00:14 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[cms]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[modules]]></category>

		<guid isPermaLink="false">http://www.tornstrand.com/2009/08/19/the-drupal-module-jungle/</guid>
		<description><![CDATA[Drupal is a great CMS, during the time I have spent working with it I have come to love it. However, for an emerging Drupal developer the abundance of different modules can be a real hassel. Sometimes you need third party modules to perform simple tasks, such as getting the breadcrumb trail to work properly [...]]]></description>
			<content:encoded><![CDATA[<p>Drupal is a great CMS, during the time I have spent working with it I have come to love it. However, for an emerging Drupal developer the abundance of different modules can be a real hassel. Sometimes you need third party modules to perform simple tasks, such as getting the breadcrumb trail to work properly or to display a simple menu. Below you will find a list of modules I find indespensable when developing a Drupal web site. I have left out the modules <span style="font-style: italic">Views</span> and <span style="font-style: italic">CCK</span> since they are so vital to developing a Drupal site you are probably already using them.<span id="more-30"></span></p>
<h2>Administration</h2>
<p><a href="http://drupal.org/project/admin"><strong>Admin</strong></a><br />
Perhapse the mose confusing part when first starting to work with Drupal is the lack of a proper administration section. The &#8220;back end&#8221; of the web site in Drupal is an integrated part of the site itself. This probably has to do with Drupals history as a community system where all users were able to create content. This is however not the case, for the most parts, when I develop sites.</p>
<p>The module simply named <em>Admin</em> solves this problem and does it beautifully. <em>Admin</em> is developed as part of the new administration interface in Drupal 7. The module rearranges the default Drupal navigation menu and makes it more logical for administrators and also ships with a custom administation theme that makes the admin section of your web site look beautiful as well.</p>
<p><a href="http://drupal.org/project/admin_theme"><strong>Administration theme</strong></a><em><br />
Administration theme</em> is a module allowing you to use your selected administration theme on any page. Good for among other things to get the batch processing pages to display with the administration theme.</p>
<p><a href="http://drupal.org/project/better_formats"><strong>Better formats</strong></a><em><br />
Better formats</em> adds more flexibility to Drupal&#8217;s core input format system. It allows you to set default formats for different user roles and is pretty much a must have if you have more then one administrator/editor on your site.</p>
<p><a href="http://drupal.org/project/trash"><strong>Trash</strong></a><br />
This module adds a <em>trashcan</em> for nodes. Nodes can be moved to the trash instead of being deleted and thus can be restored or permanently deleted later on.</p>
<h2>Menus, breadcrumbs and taxonomy</h2>
<p><a href="http://drupal.org/project/menu_block"><strong>Menu block</strong></a><em><br />
Menu block</em> if a module for creating blocks displaying only parts of a specific menu. Say you want to display a menu only containing level 2+, then this module is for you.</p>
<p><a href="http://drupal.org/project/menu_breadcrumb"><strong>Menu breadcrumbs</strong></a><br />
By default, Drupal 6 will use the built in Navigation menu for the breadcrumb. This module allows you to use the menu the current page belongs to for the breadcrumb.</p>
<p><a href="http://drupal.org/project/taxonomy_breadcrumb"><strong>Taxonomy breadcrumb</strong></a><br />
The <em>Taxonomy breadcrumb</em> module generates taxonomy based breadcrumbs on node pages and taxonomy/term pages.</p>
<p><a href="http://drupal.org/project/taxonomy_forceall"><strong>Taxonomy force all</strong></a><br />
This module forces the paramter <var>all</var> to the taxonomy listing pages. This corrects the problem of empty pages when using hierarchical taxonomy terms.</p>
<h2>Editing and file management</h2>
<p><a href="http://drupal.org/project/wysiwyg"><strong>Wysiwyg</strong><strong> API</strong></a><em><br />
Wysiwyg API</em> module allows you to use client-side editors (a.k.a. WYSIWYG editors) to edit content in Drupal. It integrates your editor of choice (well, almost) with Drupal. Personally I almost always use <a href="http://tinymce.moxiecode.com/">TinyMCE</a>, a free editor by Moxiecode.</p>
<p><a href="http://drupal.org/project/imce"><strong>IMCE</strong></a><br />
IMCE is an image/file uploader and browser that supports personal directories and quota. It&#8217;s not the prettiest module out there but it gets the job done. This module can also be integrated with client-side editors to allow for a more intuitive image selection tool when creating or editing HTML content.</p>
<p>I use this module as a file manager and with a bit of tweaking you can get this module to integrate visually with the <em>Admin</em> module.</p>
<p><a href="http://drupal.org/project/imagecache"><strong>ImageCache</strong></a><em><br />
ImageCache</em> allows you to setup presets for image processing. If an <em>ImageCache</em> derivative doesn&#8217;t exist the web server&#8217;s rewrite rules will pass the request to Drupal which in turn hands it off to <em>ImageCache</em> to dynamically generate the file.</p>
<p>This is a must have module if you are using a lot of images in your content. It takes one image uploaded by the content creator and transforms it to exactly fit the desired dimensions.</p>
<h2>Utility</h2>
<p><a href="http://drupal.org/project/google_analytics"><strong>Google Analytics</strong></a><br />
Adds the Google Analytics web statistics tracking system to your website. Supports tracking of logged in users and outgoing links.</p>
<p><a href="http://drupal.org/project/backup_migrate"><strong>Backup and Migrate</strong></a><br />
Backup and Migrate simplifies the task of backing up and restoring your Drupal database or copying your database from one Drupal site to another. It supports gzip, bzip and zip compression as well as automatic scheduled backups.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tornstrand.com/2009/08/19/the-drupal-module-jungle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dining in Phuket, Thailand</title>
		<link>http://www.tornstrand.com/2009/08/17/dining-in-phuket-thailand/</link>
		<comments>http://www.tornstrand.com/2009/08/17/dining-in-phuket-thailand/#comments</comments>
		<pubDate>Mon, 17 Aug 2009 12:54:37 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[misc]]></category>
		<category><![CDATA[food]]></category>
		<category><![CDATA[restaurants]]></category>
		<category><![CDATA[thailand]]></category>

		<guid isPermaLink="false">http://www.tornstrand.com/2009/08/17/dining-in-phuket-thailand/</guid>
		<description><![CDATA[I recently got back from a two week holiday to Phuket, Thailand (actually this post has been in the draft stage for over a year). During my stay in Patong Beach, the number one turist trap on the island, I visited several restaurants. As one might expect, there are hundreds of restaurants in Patong, many [...]]]></description>
			<content:encoded><![CDATA[<p>I recently got back from a two week holiday to Phuket, Thailand (actually this post has been in the draft stage for over a year). During my stay in Patong Beach, the number one turist trap on the island, I visited several restaurants. As one might expect, there are hundreds of restaurants in Patong, many located near Beach road, the main road running next to the beach, and some hidden away on the second floor of some obscure pub. It took me a few days to figure out where the real gems lay hidden and I ate some pretty crappy food before I found them and I can tell you this &#8211; there are no respectable restaurants on Beach road.<br />
<span id="more-18"></span></p>
<p>Since there are so many bad restaurant in Patong I will only write about those that I thought was good and would visit again. Before I begin I would just like to mention that while I found many of the much frequented restaurants along Beach road a total bust you might not. But if you feel you actually have standards when it comes to food and refuse to call what they serve at McDonalds a hamburger then this might just be for you.</p>
<h2>The good</h2>
<p><a href="http://www.whiteboxrestaurant.com/"><strong>White Box</strong></a></p>
<p><img src="http://www.tornstrand.com/wp-content/uploads/2008/04/white_box.jpg" alt="White Box" align="right" /><em>White Box</em> get it&#8217;s name from the building itself, a glowing white building shaped like a box. The restaurant is located in north Patong with a view of the ocean. Walking is not an option unless you are staying at one of the hotels right next to the restaurant. A Tuk-tuk ride from anywhere in Patong should set you back about 150-200 baht. <em>White Box</em> also sports a very own pick up service if you make reservations (recommended) that can pick you up at any location in Patong for free and also takes you back home after you have eaten.</p>
<p>The service is excellent, without a doubt the best I encountered during my stay in Thailand. The waitresses are friendly and are not hording the tables like flies which you encounter all to often in upscale restaurants outside of Europe. During our complementary starter the owner comes to our table and introduces himself and offers advice on wine selection to go with our orders, a nice touch.</p>
<p>The food at <em>White Box</em> was top notch besides the fish soup I ordered for starter. It was served in a bowl much to large for a starter and taste much like thickend fish stock. For main course I ordered duck which was excellent and cooked just right. For dessert I had three different flavors of sorbet which was just right thing to finish of an exelent meal. The bill for this 3 course meal with a bottle of wine came to about 2300 baht (about half a workers monthly sallary in Thailand).</p>
<p><a href="http://www.baanrimpa.com/"><strong>Baan Rim Pa</strong></a></p>
<p><img src="http://www.tornstrand.com/wp-content/uploads/2008/05/baan_rim_pa.jpg" alt="Baan Rim Pa" align="right" />There where six of us on this holliday trip to Thailand. One night me and my girlfriend went out to have a romantic dinner on our own. We ended up at the restaurant <em>Baan Rim Pa</em>, one of the most famous restaurants in Thailand if you read the brochure or the web page. <em>Baan Rim Pa</em> exclusevely serves what they call &#8220;royal thai cuisine&#8221; which probably is what we westerners call thai food.</p>
<p>Just like all the other fancy restaurant in Patong <em>Baan Rim Pa</em> is beautifully located on the north shore and is only accessible by car. Just like <em>White Box</em> they have a pick up service. However they didn&#8217;t give you the same star treatment as we had to share a car with a strange westerner and his company which I believe was a prostitute.</p>
<p>We both ordered a specially assembled menu which consisted of a starter, five different thai dishes for main course and a dessert. The food was excellent except for the dessert, a fruit sallad, which I felt was a bit ordinary. I should probably also mention they have a great selection of wine available. However, since all imported liquor in Thailand are belayed with heavy import taxes don&#8217;t be supprised if a bottle of wine costs twice as much as a complete three course dinner for two.</p>
<p><a href="http://www.the9thfloor.com/"><strong>The 9th Floor</strong></a></p>
<p><img src="http://www.tornstrand.com/wp-content/uploads/2008/05/the_9th_floor.jpg" alt="The 9th Floor restaurant" align="right" /><em>The 9th Floor</em> is a restaurant located on the 9th floor in one of two tall buildings in Patong. It&#8217;s an open air restaurant which in this case means the walls of the place open up and you can look out over the city while you eat. Don&#8217;t be put off by the restaurants souroundings (a dodgy apartment hotel), the momentarily unpleasantness getting to the place is worth it when you get there.</p>
<p><em>The 9th Floor</em> serves mediterranean food which is a nice break if you been eating thai food for a long period. They also have a wide range of cigars which you can buy and smoke right at your table, a rare sight in Europe these days with the ban on smoking in restaurants in many countries.</p>
<p>For starters I ordered goat cheese wrapped in italian ham which was placed on a bed of rocket sallad. For mains I had charr with risotto which was beautifully cooked with a crunchy skin. The selection of desserts was a bit disapointing which seems to be a recurring theme in  restaurants in Thailand. Often you have about three choices with one always beeing sorbet.</p>
<h2>The ugly</h2>
<p><strong>Floyd&#8217;s</strong></p>
<p><img src="http://www.tornstrand.com/wp-content/uploads/2008/05/floyds.jpg" alt="Floyd’s" align="right" />English celebrity chef Keith Floyd have one restaurant in asia and it is located at the <em>Burasari</em> hotel in Patong. This is actually the hotel we stayed at during our holliday. It&#8217;s a great hotel not far from the beach with two swimming pools, pool bar and all the things you expect from a hotel in the mid/high price range. It does however lack in one important sense, the hotel restaurant is awfull.</p>
<p>During our stay we ate at the hotell restaurant at least five times, mostly during lunch time. Every time, either the service was slow, we didn&#8217;t get what we ordered or the food was blend and tasteless. <em>Floyd&#8217;s</em> place isn&#8217;t actually part of the hotells own restaurant but they share the same kitchen and have the same waiters. That&#8217;s why we didn&#8217;t eat at <em>Floyd&#8217;s</em>. And if that wasn&#8217;t enough, look at the picture to the right. The interior of the restaurant is awfull.</p>
<h2>Local delights</h2>
<p>My food experience in Thailand was not all about fancy restaurants and expensive wines. Grilled corncob, bought from a mobile stand, was one of the best and most authentic food experiences I had. Right next to the beach there where tons of different food stands selling all kinds of different food at extremely low prices. You could get a freshly grilled corncob for about 40 baht, which was prepared in front of you while you waited. There was fresh fruits, chicken, soups and lots of other delights. The locals working at the beach often got theire lunches from theses stands and the prizes reflected that.</p>
<p>Another great food experience was the food court at Patong City weekend market. Every weekend there was a big market in Patong City visited by both locals and turists. In the different stands you could find cheap knockoffs of designer goods such as bags, t-shirts, watches, shoes and also lots of different food. My visit to the market came just as we where about to fly home again and I didn&#8217;t dare to try anything to wild in fear of stomach problems. My girlfriend and I ended up with a couple of pork and vegetable skewers and some fried rice which set us back just 100 baht.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tornstrand.com/2009/08/17/dining-in-phuket-thailand/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reading a XML processing instruction with PHP</title>
		<link>http://www.tornstrand.com/2008/10/21/reading-a-xml-processing-instruction-with-php/</link>
		<comments>http://www.tornstrand.com/2008/10/21/reading-a-xml-processing-instruction-with-php/#comments</comments>
		<pubDate>Tue, 21 Oct 2008 15:56:36 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[processing instruction]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[xpath]]></category>
		<category><![CDATA[xsl]]></category>

		<guid isPermaLink="false">http://www.tornstrand.com/2008/10/21/reading-a-xml-processing-instruction-with-php/</guid>
		<description><![CDATA[I&#8217;m doing some XSL transformations in a project I&#8217;m involved in right now. The XML documents that are beeing transformed all include a xml-stylesheet processing instruction that I need to read in order to know what stylesheet to use for a specfic document. To my surprise, reading processing instructions from a DOMDocument in PHP was [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m doing some XSL transformations in a project I&#8217;m involved in right now. The XML documents that are beeing transformed all include a xml-stylesheet processing instruction that I need to read in order to know what stylesheet to use for a specfic document. To my surprise, reading processing instructions from a DOMDocument in PHP was not so easy as one might assume.</p>
<p><span id="more-29"></span>I wont go into details and tell you about all the hair (of which I have very little) I lost during my search for a way to get ahold of those processing instructions. In the end I used a XPath expression to select the PI. Below you&#8217;ll find the code I used.</p>
<p><code>$doc = new DOMDocument;<br />
$doc-&gt;load("document.xml");<br />
$xpath = new DOMXpath($doc);<br />
$nodes = $xpath-&gt;evaluate("/child::processing-instruction('xml-stylesheet')");<br />
if(!empty($nodes))<br />
$pi = $nodes-&gt;item(0);<br />
print $pi-&gt;target;<br />
print $pi-&gt;data;</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tornstrand.com/2008/10/21/reading-a-xml-processing-instruction-with-php/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Don&#8217;t miss Ubiquity</title>
		<link>http://www.tornstrand.com/2008/08/29/dont-miss-ubiquity/</link>
		<comments>http://www.tornstrand.com/2008/08/29/dont-miss-ubiquity/#comments</comments>
		<pubDate>Fri, 29 Aug 2008 07:31:31 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[misc]]></category>

		<guid isPermaLink="false">http://www.tornstrand.com/2008/08/29/dont-miss-ubiquity/</guid>
		<description><![CDATA[I installed the Ubiquity browser plugin yesterday and I&#8217;ve had some time to play around with it. Without a doubt Ubiquity is the most exceting thing that has happend to web browsers in years. I&#8217;m not going to rant about all the things this browser plugin can do for you, instead see for yourself at [...]]]></description>
			<content:encoded><![CDATA[<p>I installed the <a href="http://labs.mozilla.com/2008/08/introducing-ubiquity/">Ubiquity</a> browser plugin yesterday and I&#8217;ve had some time to play around with it. Without a doubt Ubiquity is the most exceting thing that has happend to web browsers in years. I&#8217;m not going to rant about all the things this browser plugin can do for you, instead see for yourself at <a href="http://labs.mozilla.com/2008/08/introducing-ubiquity/">Ubiquity project at Mozilla Labs</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tornstrand.com/2008/08/29/dont-miss-ubiquity/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zend_Form custom/localized error messages</title>
		<link>http://www.tornstrand.com/2008/06/27/zend_form-customlocalized-error-messages/</link>
		<comments>http://www.tornstrand.com/2008/06/27/zend_form-customlocalized-error-messages/#comments</comments>
		<pubDate>Fri, 27 Jun 2008 19:45:25 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[localization]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[zend_form]]></category>

		<guid isPermaLink="false">http://www.tornstrand.com/2008/06/27/zend_form-customlocalized-error-messages/</guid>
		<description><![CDATA[I&#8217;ve been playing around with Zend_Form and Zend Framework 1.5 these last couple of days. Like most people I hade some trouble getting used to the decorator part of the form API. Decorators are used to style form elements for rendering in the browser, adding tags before, after and wrapping the form element itself. After [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been playing around with <a href="http://framework.zend.com/manual/en/zend.form.html">Zend_Form</a> and <a href="http://framework.zend.com/">Zend Framework</a> 1.5 these last couple of days. Like most people I hade some trouble getting used to the decorator part of the form API. Decorators are used to style form elements for rendering in the browser, adding tags before, after and wrapping the form element itself. After much swearing I finally found <a href="http://devzone.zend.com/article/3450-Decorators-with-Zend_Form">this article</a> in the Zend Developer forums that did a pretty good job explaining it.</p>
<p>The next problem I ran into was customizing the form error messages, not just customizing the messages but also localizing them. The framework has default error messages defined for all validators you can use with your form elements but they are kind of stiff and I doubt anyone really want&#8217;s to use them. It turns out the solution is really simple.</p>
<p>To attach a validator to a form element you normally write something like this:</p>
<p><code>$textField = new Zend_Form_Element_Text("myField");<br />
$textField-&gt;addValidator(new Zend_Validate_NotEmpty());</code></p>
<p>If you want to customize the message and maybe even localize it you simply init a validator and manuelly set the message via the <em>setMessage</em> method, like this:</p>
<p><code>$notEmpty = new Zend_Validate_NotEmpty();<br />
$notEmpty-&gt;setMessage("You have to enter a value");<br />
$textField = new Zend_Form_Element_Text("myField");<br />
$textField-&gt;addValidator($notEmpty);</code></p>
<p>If you like to localize the error message, replace the setMessage call with:</p>
<p><code>$notEmpty-&gt;setMessage($this-&gt;getView()-&gt;translate("You have to enter a value"));</code></p>
<p>It&#8217;s just that simple <img src='http://www.tornstrand.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.tornstrand.com/2008/06/27/zend_form-customlocalized-error-messages/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Google Maps Cluster markers</title>
		<link>http://www.tornstrand.com/2008/06/18/google-maps-cluster-markers/</link>
		<comments>http://www.tornstrand.com/2008/06/18/google-maps-cluster-markers/#comments</comments>
		<pubDate>Wed, 18 Jun 2008 08:49:41 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[cluster markers]]></category>
		<category><![CDATA[google maps]]></category>

		<guid isPermaLink="false">http://www.tornstrand.com/2008/06/18/google-maps-cluster-markers/</guid>
		<description><![CDATA[I&#8217;m working on a project right now where we make use of the Google Maps API to display various information on Google Maps. One page calls for a view of all golf courses in Sweden. To my surprice there are actually quite a few of them, closer to 500 golf courses. When you position lots [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m working on a project right now where we make use of the Google Maps API to display various information on Google Maps. One page calls for a view of all golf courses in Sweden. To my surprice there are actually quite a few of them, closer to 500 golf courses. When you position lots and lots of markers in a small area of a map it can get quite cluttered and eventually the map starts to load painfully slow.</p>
<p>So with this in mind I set out to find a way to avoid this problem. I&#8217;ve seen on other sites markers that change depending on what level of zoom you&#8217;re currently in and a quick search on Google gave me the answer I was looking for. Cluster markers. Cluster markers is not a part of the Google Maps API but are supplied by third party developers. I went through a couple of different solutions but finally choose to use <a href="http://googlemapsapi.110mb.com/clustermarker/index.htm">ClusterMarker</a> by Martin Pearman.</p>
<blockquote><div class="blockquote_extender"><span>&lsquo;</span></div><p>ClusterMarker detects any group(s) of two or more markers whose icons visually intersect when displayed. Each group of intersecting markers is then replaced with a single <span style="font-weight: bold">cluster marker</span>. The cluster marker, when clicked, simply centers and zooms the map in on the markers whose icons previously intersected.</p></blockquote>
<p>The <a href="http://googlemapsapi.110mb.com/clustermarker/reference.htm">ClusterMarker API is well documented</a> and really easy to implement and use.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tornstrand.com/2008/06/18/google-maps-cluster-markers/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Finally got sound in Vista X64</title>
		<link>http://www.tornstrand.com/2008/06/11/finally-got-sound-in-vista-x64/</link>
		<comments>http://www.tornstrand.com/2008/06/11/finally-got-sound-in-vista-x64/#comments</comments>
		<pubDate>Wed, 11 Jun 2008 13:25:16 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[mac]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.tornstrand.com/2008/06/11/finally-got-sound-in-vista-x64/</guid>
		<description><![CDATA[Back in april I bough a MacBook to use at home and in the office. I installed Windows Vista X64 via BootCamp to use mostly at work (I do some programing in Visual Studio). I read about the many problems with drivers and was a bit anxious but to my surprise everything except the audio [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.tornstrand.com/wp-content/uploads/2008/06/macbook-black.jpg" alt="Apple MacBook (black)" align="right" hspace="10" vspace="10" />Back in april I bough a MacBook to use at home and in the office. I installed Windows Vista X64 via BootCamp to use mostly at work (I do some programing in Visual Studio). I read about the many problems with drivers and was a bit anxious but to my surprise everything except the audio worked. I spent some time trying to resolve the issue, trying all kinds of different driver. Microsoft High Definition Audio (default driver choosen by Vista), Sigmatel and Realtek. None worked. I finally gave up and decided I didn&#8217;t need audio support while working in Vista.</p>
<p>Some time went by and I soon realized I really did need audio support. Not so much for the work I do but for listening to music while doing it. So I gave it another try and now I actually got it working. Since my last attempt it seems new versions of the Realtek drivers must have been released and it installed with any fuzz.</p>
<p>So now I&#8217;m writing this post so that others in the same situation might find a solution to their Vista X64 audio problems as well. The drivers that finally worked was <strong><a href="http://drivers.softpedia.com/get/SOUND-CARD/REALTEK/Realtek-High-Definition-Audio-Codecs-R194-Vista.shtml">Realtek High Definition Audio Codecs R1.94 Vista</a></strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tornstrand.com/2008/06/11/finally-got-sound-in-vista-x64/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
