<?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>Arne Aase &#187; php</title>
	<atom:link href="http://www.arneaase.net/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.arneaase.net</link>
	<description>Stuff i find interesting</description>
	<lastBuildDate>Tue, 17 Mar 2009 22:51:16 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Weekend fun</title>
		<link>http://www.arneaase.net/2008/08/weekend-fun/</link>
		<comments>http://www.arneaase.net/2008/08/weekend-fun/#comments</comments>
		<pubDate>Thu, 14 Aug 2008 15:33:31 +0000</pubDate>
		<dc:creator>Arne Aase</dc:creator>
				<category><![CDATA[Coding competition]]></category>
		<category><![CDATA[Kodehjelp]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.arneaase.net/?p=9</guid>
		<description><![CDATA[Mats hosted a little competition last weekend. The main goal of the competition was to make a program which found the shortest path from . to X in a labyrinth, and the code size should be as small as possible.
My first approach was a depth-first seach algorithm, but when I ran the code on large [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://e-mats.org/">Mats</a> hosted a little <a title="competition" href="http://e-mats.org/2008/08/finding-your-way-around-for-the-weekend/" target="_blank">competition</a> last weekend. The main goal of the competition was to make a program which found the shortest path from . to X in a labyrinth, and the code size should be as small as possible.</p>
<p>My first approach was a <a href="http://en.wikipedia.org/wiki/Depth-first_search" target="_blank">depth-first seach</a> algorithm, but when I ran the code on large labyrinths the algorithm took to long time. Then I tried a <a href="http://en.wikipedia.org/wiki/Breadth-first_search">breadth-first search</a> algorithm which proved much faster and stable on finding the shortest path.</p>
<p>Even if I did manage to get my code down to 518 bytes, I didn&#8217;t even get close to the winner, which got it down to 253 (results can be found <a title="here" href="http://e-mats.org/2008/08/the-results-of-our-weekend-challenge/" target="_blank">here</a>). You can take a look at my code <a href="http://www.arneaase.net/resources/kodehjelp/maze_pretty.phps" target="_self">here</a>, it isn&#8217;t as advanced as the other examples shown on mats&#8217; page but it works and finds the correct answer quickly.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.arneaase.net/2008/08/weekend-fun/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing And Using A Fileinfo Resource In php</title>
		<link>http://www.arneaase.net/2008/08/installing-and-using-a-fileinfo-resource-in-php/</link>
		<comments>http://www.arneaase.net/2008/08/installing-and-using-a-fileinfo-resource-in-php/#comments</comments>
		<pubDate>Tue, 05 Aug 2008 19:59:34 +0000</pubDate>
		<dc:creator>Arne Aase</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.arneaase.net/?p=8</guid>
		<description><![CDATA[My server is finally up and I started writing a little web script to unpack and move files from a local place on disk to a ftp folder. I decided to use php since it is a language i know and it is quite efficient on small programs.
I bumped into some problems installing the fileinfo [...]]]></description>
			<content:encoded><![CDATA[<p>My server is finally up and I started writing a little web script to unpack and move files from a local place on disk to a ftp folder. I decided to use php since it is a language i know and it is quite efficient on small programs.</p>
<p>I bumped into some problems installing the fileinfo resource extension when using a windows server. I used the php msi installer to install php and used the same installer to add the fileinfo extension, but the installer didn&#8217;t include all the files. You also need some extra files in the php/extras folder, these files can be found on <a title="sourceforge" href="http://sourceforge.net/project/showfiles.php?group_id=23617&amp;package_id=18878" target="_blank">sorcefourge</a>. You need the magic and magic.mgc files located in the bin package.</p>
<p>When the extension was successfully installed I tried with a simple example to see if it would match the filetype.</p>

<div class="wp_syntax"><div class="code"><pre class="language" style="font-family:monospace;">$fi = new finfo(FILEINFO_MIME, 'C:\PHP\extras\magic');
echo 'filetype ' . $fi-&gt;file('e:\test.rar');</pre></div></div>

<p>this code should print &#8220;filetype application/x-rar&#8221;, but it showed application/x-dpkg instead. The reason was that windows returns a match if the condition starts with &#8220;!&#8221;, so i had to add &#8220;\&#8221; in front of every condition that started with &#8220;!&#8221; in order to get a correct match.</p>
<p>example:</p>
<blockquote><p>0    string        !&lt;arch&gt;\ndebian application/x-dpkg<br />
should be:<br />
0    string        \!&lt;arch&gt;\ndebian application/x-dpkg</p></blockquote>
<p>If you don&#8217;t like to use objects you could use this code instead:</p>

<div class="wp_syntax"><div class="code"><pre class="language" style="font-family:monospace;">$fi = finfo_open(FILEINFO_MIME, 'C:\PHP\extras\magic');
echo 'filetype: ' . finfo_file($fi, 'e:\test.rar');</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.arneaase.net/2008/08/installing-and-using-a-fileinfo-resource-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
