<?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>Who So</title>
	<atom:link href="http://www.trondhuso.no/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.trondhuso.no/blog</link>
	<description>Blogs from the life of Trond Husø</description>
	<lastBuildDate>Sun, 04 Jul 2010 08:51:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Being a standard browser</title>
		<link>http://www.trondhuso.no/blog/2010/07/04/being-a-standard-browser/</link>
		<comments>http://www.trondhuso.no/blog/2010/07/04/being-a-standard-browser/#comments</comments>
		<pubDate>Sun, 04 Jul 2010 08:51:56 +0000</pubDate>
		<dc:creator>Trond Husø</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Chrome]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[Opera]]></category>
		<category><![CDATA[Safari]]></category>
		<category><![CDATA[WebKit]]></category>

		<guid isPermaLink="false">http://www.trondhuso.no/blog/?p=260</guid>
		<description><![CDATA[I&#8217;d like to stir up some controversy with this post. I would like the W3C to say that in order for a browser to call it self a standard it needs to be available for all three OS platform. That means: Safari must be developed to work under Linux. Internet Explorer must be developed to [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;d like to stir up some controversy with this post.<br />
I would like the W3C to say that in order for a browser to call it self a standard it needs to be available for all three OS platform.<br />
That means:<br />
Safari must be developed to work under Linux.<br />
Internet Explorer must be developed to work under Linux.<br />
This means that only Opera, Firefox and Chrome currently are standard browsers. </p>
<p>Also:<br />
A browser shall not be dependent or locked into the operating system. It shall be a software standing on its own.<br />
Just my $0.05</p>
]]></content:encoded>
			<wfw:commentRss>http://www.trondhuso.no/blog/2010/07/04/being-a-standard-browser/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Standards matter</title>
		<link>http://www.trondhuso.no/blog/2010/06/22/standards-matter/</link>
		<comments>http://www.trondhuso.no/blog/2010/06/22/standards-matter/#comments</comments>
		<pubDate>Tue, 22 Jun 2010 08:30:29 +0000</pubDate>
		<dc:creator>Trond Husø</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Webdevelopment]]></category>

		<guid isPermaLink="false">http://www.trondhuso.no/blog/?p=261</guid>
		<description><![CDATA[Some thoughts regarding the Browser World War 2 in 2010.]]></description>
			<content:encoded><![CDATA[<p>I am not that great fan of Apple, but sometimes they have an idea of doing things correctly (like when they built the iPod). It&#8217;s when they start getting proprietary that everything hits the fan.<br />
This is what they&#8217;ve said recently:</p>
<blockquote><p><a href="http://www.apple.com/safari/what-is.html" target="_blank">Standards matter. Before standards, every browser had its own play book.</a> With standards, every browser’s on the same page. Great for developers, standards let them create sites that work on all browsers out of the box. Great for the browsing public, they ensure that you enjoy a great experience on every site you visit. And these technologies are free for anyone to use.</p></blockquote>
<p>I am currently spending some time checking out <a href="http://dev.w3.org/html5/spec/Overview.html">HTML5</a> and <a href="http://www.w3.org/Style/CSS/current-work">CSS3</a>. And from what I can see the browser world is now just as unsynchronized as it was in the first browser war.<br />
My inspiration for checking the new features in HTML5 and CSS3 is the fact that so many people are saying that with HTML5 (and CSS3) Flash is dead. </p>
<p>Well. </p>
<p>The good thing about Flash is that it runs on all platforms, though really slow on iPads and iPhones &#8211; but that&#8217;s another issue. It is browser independent, which makes it look the same in all browsers. That&#8217;s what makes Flash a graphic designers choice instead of HTML5/CSS3.<br />
An example I can use is this:<br />
Let&#8217;s say there is a website wanting to show information about the players on the teams playing in the World Cup in South Africa (in 2010). The designer want some animation like flipping cards, sliding in/sliding out and so on. Let&#8217;s say the company creating this application wants to use HTML5. Well, he can&#8217;t:</p>
<ol>
<li><a href="http://www.microsoft.com/windows/internet-explorer/default.aspx" target="_blank">Internet Explorer</a> (from 6 up to current build of IE) does not understand all the 3d-stuff in CSS3</li>
<li><a href="http://www.getfirefox.com" target="_blank">Firefox 3.6</a> (and most likely 3.7) does not understand all the 3d-stuff in CSS3</li>
<li><a href="http://www.opera.no" target="_opera">Opera</a> 10.5 (and most likely 10.6) does not understand all the 3d-stuff in CSS3</li>
<li><a href="http://www.google.com/chrome/">Chrome</a> 5 does not understand all the 3d-stuff in CSS3</li>
</ol>
<p>So there is only Safari (with about 5% of the market) that understands the 3d-stuff in CSS3. Which is not so weird. Apple was one of the promoters of 3D-transformations in CSS.<br />
Also: In Flash there is only one build. There are no specific style sheet for IE(6-X), Firefox, Webkit/Chrome/Safari or Opera. There are no need for [IF IE] in the HTML/CSS-code. </p>
<p>I do hope that the developers and the designers who works with CSS3 and HTML5 at Apple will become advocates of standards and that they will fight for this in their forums. I experienced the lasts browser war (which Microsoft claims it won&#8230; you don&#8217;t win wars, ok! and&#8230; look where it left us: With IE6 still being widely used in 2010!!!). I don&#8217;t want another one in 2010. </p>
<p>And I think there is only one way we can achieve a compliant standard that all browse vendors will follow: Start thinking of your users and the web developers. Stop creating HTML/CSS rendering engines. Standardize on one or two (Webkit and Mozilla, with the latter also being the one to disappear).<br />
Sorry Microsoft. When you are nine years behind&#8230; although you did invent the XMLhttpRequest, most important part of AJAX, why not start contributing to an open source project instead?<br />
And sorry Opera. Your market share is way to small, and I think you are better off using one of the other engines and start contributing to those instead. And: Three is one to many (or three is a crowd as the saying goes).</p>
<p>So what shall the vendors do when they cannot focus on their own engine? </p>
<ul>
<li>Contribute to the two standard engines (webkit/mozilla)</li>
<li>Focus on making the best <strong>looking</strong>, <strong>fastest</strong> or <strong>functional</strong> browser out there.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.trondhuso.no/blog/2010/06/22/standards-matter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Computing HTML5</title>
		<link>http://www.trondhuso.no/blog/2010/06/06/computing-html5/</link>
		<comments>http://www.trondhuso.no/blog/2010/06/06/computing-html5/#comments</comments>
		<pubDate>Sun, 06 Jun 2010 19:46:05 +0000</pubDate>
		<dc:creator>Trond Husø</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[web applications]]></category>
		<category><![CDATA[Web development]]></category>

		<guid isPermaLink="false">http://www.trondhuso.no/blog/2010/06/06/computing-html5/</guid>
		<description><![CDATA[I&#8217;ve just recently tested the HTML5-site at Apple, and one at Microsoft. Except that a lot of the example HTML5-pages that are on those websites are amazing, I also noticed one more thing: Quite a lot of the examples needs computers with lots of computing power. I experienced this by noticing that my computer, a [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just recently tested the HTML5-site at Apple, and one at Microsoft. Except that a lot of the example HTML5-pages that are on those websites are amazing, I also noticed one more thing:<br />
Quite a lot of the examples needs computers with lots of computing power.<br />
I experienced this by noticing that my computer, a Dell D420 laptop with 1.5 gb ram, was really slowing down.<br />
If this is the future of web design or web applications I am worried.<br />
It is of course great to see all the possibilities HTML5 gives us who works with web development.<br />
It&#8217;s just that I don&#8217;t like the expenses.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.trondhuso.no/blog/2010/06/06/computing-html5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Proposal: Windows-tag in HTML5</title>
		<link>http://www.trondhuso.no/blog/2010/05/25/proposal-in-html5/</link>
		<comments>http://www.trondhuso.no/blog/2010/05/25/proposal-in-html5/#comments</comments>
		<pubDate>Tue, 25 May 2010 07:31:08 +0000</pubDate>
		<dc:creator>Trond Husø</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Webdevelopment]]></category>

		<guid isPermaLink="false">http://www.trondhuso.no/blog/?p=251</guid>
		<description><![CDATA[Suggestion: windows tag Usage: If you want to create a modal form/window, a &#8220;popup&#8221; or a lightbox you have to use Javascript. I am suggesting this tag to remove the javascript need to create such a standard feature on the web. This technique uses iframe and css to create the look. Implementation: I am suggesting [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Suggestion: </strong>windows tag</p>
<p><strong>Usage:</strong> If you want to create a modal form/window, a &#8220;popup&#8221; or a lightbox you have to use Javascript. I am suggesting this tag to remove the javascript need to create such a standard feature on the web. This technique uses iframe and css to create the look.</p>
<p><strong>Implementation:</strong> I am suggesting that <windows> can use most of the same attributes as iframe/frame.<br />
Adding the following attributes: </p>
<ul>
<li>modal<br />
boolean, if the window shall be modal or not</li>
<li>movable<br />
boolean, true if the window shall be moveable, false if not</li>
<li>fade-background-color<br />
Color, set the background color being used when window opens. Default is dark gray&#8230;</li>
<li>background-opacity<br />
integer, set the transparency for the background</li>
</ul>
<p>I am not part of the W3 HTML 5 working group and I have not posted this suggestion to this group. I am just suggesting it here as something I wish to see in HTML 5. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.trondhuso.no/blog/2010/05/25/proposal-in-html5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP-Tip: Commenting your code</title>
		<link>http://www.trondhuso.no/blog/2010/05/17/php-tip-commenting-your-code/</link>
		<comments>http://www.trondhuso.no/blog/2010/05/17/php-tip-commenting-your-code/#comments</comments>
		<pubDate>Mon, 17 May 2010 20:52:32 +0000</pubDate>
		<dc:creator>Trond Husø</dc:creator>
				<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Webdevelopment]]></category>
		<category><![CDATA[commenting]]></category>

		<guid isPermaLink="false">http://www.trondhuso.no/blog/?p=248</guid>
		<description><![CDATA[This really isn&#8217;t a PHP-tip, but more like a programming tip. But since I do most of my development in PHP (and some in C#, and some on VB) I put it up as a PHP-tip. So there. This post is all about commenting. Some do it, some don&#8217;t. I tend to do it. Sometimes [...]]]></description>
			<content:encoded><![CDATA[<p>This really isn&#8217;t a PHP-tip, but more like a programming tip. But since I do most of my development in PHP (and some in C#, and some on VB) I put it up as a PHP-tip. So there.<br />
This post is all about commenting. Some do it, some don&#8217;t. I tend to do it. Sometimes I even comment to much. But that&#8217;s sometimes better than not doing it at all.<br />
Why should you comment your code: </p>
<ol>
<li>Because sometime in the future you might have to go back to the code and fix it. It&#8217;s always nice to know what the initial idea was. And with years and years of programming, you now know a better way to do it. If you don&#8217;t have the comment, you have to analyze your own code much more thoroughly.</li>
<li>If someone else is going to work with your code, it is always nice for them to read your comments. It makes it easier for them to understand the code and to get into it.</li>
<li>It can be fun looking at the comments you&#8217;ve written. I recently looked over some code I did back in 2005(ish) and here I write: &#8220;<em>This part is done in an amazingly stupid way</em>&#8221; or what about: &#8220;<em>I must do this to keep the string value</em> (line break and some code)<em>Really&#8230;????</em>&#8220;.<br />
I posted this on twitter and I got an answer from Frank W. Zammetti (<a href="http://twitter.com/fzammetti">fzammetti</a>):  <em>&#8220;The person that wrote this is a grade A a**hole&#8230; oh wait, it was me!&#8221; <strong>I wrote that one once.</strong></em><br />
I just couldn&#8217;t stop laughing.
</ol>
<p>This is my style of commenting (example in PHP/C/C++/C#-style)<br />
My first line in the file is always the name of the file. This is a habit I&#8217;ve grown to use. It is smart when you are editing code in e.g. VI where you not necessary get the name of the file in the titlebar.<br />
<code><br />
<?php</p>
<p>// name-of-file.php</p>
<p></code></p>
<p>Next comes a general description of what the code in the file shall do:<br />
<code><br />
/**<br />
 * This file is used to create and edit blog posts<br />
 *<br />
</code><br />
Eclipse, Komodo-IDE and NetBeans (And probably other IDEs) supports @todo in the comment. By adding this "tag" you add tasks to your tasks list.<br />
I tend to add tasks in the beginning of the file.<br />
<code><br />
 * @todo: This file need some work.<br />
 * @todo: Fix the code related to creating blog posts<br />
</code><br />
In the same area I also write out bugs that I have fixed, or tasks that I have completed:<br />
<code><br />
 * FIXES:<br />
 * 01.01.2010: Fixed a bug related to updating a blogpost<br />
 * 17.05.2010: Translated all of the comments from Norwegian to English<br />
 */<br />
</code><br />
(note/suggestion) I wouldn't mind if the IDEs could have a @fixed element that I could add to the end of the line so that the IDE could mark out the task as completed.</p>
<p>Then in the code I can comment like this (note that PHP-example is just as an example here):<br />
<code><br />
// Fixing the string so that it is ready for SQL-input<br />
$string = mysql_real_escape_string($string);</p>
<p>// Creating a string for a dropdown-menu.<br />
foreach ($this as $that) {<br />
   $string .= $that;<br />
}<br />
</code></p>
<p>I also sometimes use comments to clear my head or to get a clear overview of the task at hand. This is especially important when you feel that the task is complicated.<br />
An example could be:<br />
<code><br />
/**<br />
 * In this section we shall create the tree-view.<br />
 * We must remember that all nodes starting with W shall be at the top<br />
 * And that we shall mark posts with pictures with a (p) or a small icon<br />
 * Also remember that no lines can be longer than 25 characters. Check the <strong>left</strong> syntax in mySQL...<br />
 */<br />
</code></p>
<p>This is also good practice when you sometimes do not return to the code in a couple of days. An example could be:<br />
<code><br />
/**<br />
 * continue here on Monday.<br />
 * The idea behind the following section is ... .... .. . . ..<br />
 */<br />
</code></p>
<p>Hope this post regarding commenting your code is of any help for you. If you have any great examples of self criticism in your code, please do post them as comments... (No pun intended)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.trondhuso.no/blog/2010/05/17/php-tip-commenting-your-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP-tip: How to fix problems with file permissions</title>
		<link>http://www.trondhuso.no/blog/2010/05/14/php-tip-how-to-fix-problems-with-file-permissions/</link>
		<comments>http://www.trondhuso.no/blog/2010/05/14/php-tip-how-to-fix-problems-with-file-permissions/#comments</comments>
		<pubDate>Fri, 14 May 2010 20:58:18 +0000</pubDate>
		<dc:creator>Trond Husø</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Webdevelopment]]></category>

		<guid isPermaLink="false">http://www.trondhuso.no/blog/?p=243</guid>
		<description><![CDATA[Have you tried to create or read a file with fopen, file_get_content or file_put_content and only getting permission denied. A reason for this error message can be that the file you are about to read/write already exists and with your account as owner. A quick, and safe, fix is to change the owner and group [...]]]></description>
			<content:encoded><![CDATA[<p>Have you tried to create or read a file with fopen, file_get_content or file_put_content and only getting permission denied.<br />
A reason for this error message can be that the file you are about to read/write already exists and with your account as owner.<br />
A quick, and safe, fix is to change the owner and group of the file to the same owner/group as the apache-server is running as.<br />
Example:<br />
Let&#8217;s say you are about to update index.htm. This file was uploaded by you to the ftp-server, and so the file is owned by foo (you) which is a member of the group bar. The Apache-server how ever is being run by user:group apache. the user:group apache does not have permission to change anything to this file.<br />
So what you do is:</p>
<ul>
<li>Connect to the web server with ssh (shell account)</li>
<li>Change ownership to the file to apache by running <strong>chmod apache:apache index.htm</strong></li>
</ul>
<p>Now you should be able to change the content of the file with PHP.<br />
I have seen suggestions on websites where they say that you should change the mode to 775 or even worse, 777. This is a security breach and so you should not do so.<br />
Hope this helps someone out</p>
<h3>Suggested links</h3>
<ul>
<li><a href="http://no.php.net/manual/en/function.fopen.php">fopen</a></li>
<li><a href="http://no.php.net/manual/en/function.chmod.php">chmod (within PHP)</li>
<li><a href="http://no.php.net/manual/en/function.file-get-contents.php">file_get_contents</li>
<li><a href="http://no.php.net/manual/en/function.file-put-contents.php">file_put_contents</li>
<li><a href="http://bit.ly/brXNCe">Top 7 PHP Security Blunders</li>
<li><a href="http://www.devshed.com/c/a/PHP/PHP-Security-Mistakes/">PHP Security Mistakes</li>
<li><a href="http://www.unix.com/unix-dummies-questions-answers/33137-chmod-777-security-risks.html">A nice forum post regarding chmod</li>
<li>There are of course someone out there saying that chmod to 777 is not a security risk: <a href="http://www.simplemachines.org/community/index.php?topic=2987.0"><b>Why chmod 777 is NOT a security risk</b></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.trondhuso.no/blog/2010/05/14/php-tip-how-to-fix-problems-with-file-permissions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Virtual Ubuntu</title>
		<link>http://www.trondhuso.no/blog/2010/05/11/virtual-ubuntu/</link>
		<comments>http://www.trondhuso.no/blog/2010/05/11/virtual-ubuntu/#comments</comments>
		<pubDate>Tue, 11 May 2010 12:47:04 +0000</pubDate>
		<dc:creator>Trond Husø</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[OS]]></category>
		<category><![CDATA[Virtualbox]]></category>
		<category><![CDATA[Virtualization]]></category>

		<guid isPermaLink="false">http://www.trondhuso.no/blog/?p=240</guid>
		<description><![CDATA[Because of an introduction to laptop at work, I have to bring my laptop back and forth to work. Because this isn&#8217;t my laptop I feel that I cannot run Ubuntu Linux as the main OS &#8211; although I wish I could. Instead I have to rely heavily on windows 7 and VirtualBox. As of [...]]]></description>
			<content:encoded><![CDATA[<p>Because of an introduction to laptop at work, I have to bring my laptop back and forth to work. Because this isn&#8217;t my laptop I feel that I cannot run Ubuntu Linux as the main OS &#8211; although I wish I could. Instead I have to rely heavily on windows 7 and VirtualBox.<br />
As of writing this I have already had two crashes. This could be caused by the fact that the Ubuntu version I am running is quite new, and so the VirtualBox version I am running does not support it fully.<br />
During this process I have tried to find out if it was possible to make the physical Dell D420-laptop virtual using virtualization tools &#8211; also known as P2V. VMWare has such a tool, but when you only have VMWare Server installed, making a Linux OS virtual is not possible.<br />
What I ended up doing was to create a Virtual partition. Then install Ubuntu 10.04 (LTS). Then I started moving files and folders from the old laptop to the new one.<br />
I used SCP in this process.<br />
The good thing about doing this by hand is that you have total control over the process. The &#8220;drawback&#8221; is that it takes time.<br />
I hope that the guys (and girls) at Virtualbox (Oracle) will start developing a P2V with Linux-support for VirtualBox. It would be a nice addition to what seems to be a great product.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.trondhuso.no/blog/2010/05/11/virtual-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>No more c# on iPhone</title>
		<link>http://www.trondhuso.no/blog/2010/04/24/no-more-c-on-iphone/</link>
		<comments>http://www.trondhuso.no/blog/2010/04/24/no-more-c-on-iphone/#comments</comments>
		<pubDate>Fri, 23 Apr 2010 23:05:42 +0000</pubDate>
		<dc:creator>Trond Husø</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.trondhuso.no/blog/?p=235</guid>
		<description><![CDATA[Apple does not stop to surprise me. Luckily I haven&#8217;t started writing iPhone/iPad applications, and I am not sure if I want to either. As a Linux / windows user as I see it, I cannot create an application in my development environment. What do I have to do? Buy a Macintosh ($999 for MacBook) [...]]]></description>
			<content:encoded><![CDATA[<p>Apple does not stop to surprise me. Luckily I haven&#8217;t started writing iPhone/iPad applications, and I am not sure if I want to either. As a Linux / windows user as I see it, I cannot create an application in my development environment. What do I have to do?</p>
<ol>
<li>Buy a Macintosh ($999 for MacBook)</li>
<li>Get XCode</li>
<li>Register as a iPhone developer ($99 annually</li>
</ol>
<p>So it&#8217;ll only cost me $1100 to start writing applications for iPhone/iPad. That&#8217;s quite a lot of applications to sell&#8230;</p>
<p>With monotouch you have to pay $399, so that&#8217;s not cheap either. And I believe this might be the reason why Mr. Steve &#8220;I don&#8217;t want to share any money related to Apple products with anyone. And I want total control cos I am a control freak!&#8221; Jobs has changed the rules for developing applications for iPhone.</p>
<p><a href="http://daringfireball.net/2010/04/why_apple_changed_section_331">Daring Fireball</a> on why Apple changed Section 331.</p>
<p>Compared to Android:</p>
<ol>
<li>I don&#8217;t have to buy a new computer since I already have one ($0)</li>
<li>I can use Eclipse($0) (which is cross platform, so I can develop in both Windows and Linux environment)<br />
Or I can use MonoDroid that will ship in August to develop in C#</li>
<li>I have to register as an Android developer ($25)</li>
</ol>
<p>That&#8217;s more than $1000 difference. And even if I had a Mac, the difference is $74.</p>
<p>So, for which Touch phone platform are you going to develop for?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.trondhuso.no/blog/2010/04/24/no-more-c-on-iphone/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Download direct from ftp-server with php</title>
		<link>http://www.trondhuso.no/blog/2010/04/20/download-direct-from-ftp-server-with-php/</link>
		<comments>http://www.trondhuso.no/blog/2010/04/20/download-direct-from-ftp-server-with-php/#comments</comments>
		<pubDate>Tue, 20 Apr 2010 20:44:26 +0000</pubDate>
		<dc:creator>Trond Husø</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[download]]></category>

		<guid isPermaLink="false">http://www.trondhuso.no/blog/?p=228</guid>
		<description><![CDATA[For a web solution I am currently involved in I had a challenge where files from a FTP-server should be downloaded from the webserver. Thanks to a solution provided by NogDog to cesarcesar @ CodingForums.org in 2007 I managed to solve this. This is the solution: First you connect to your ftp-server $connection = ftp_connect($ftp_server); [...]]]></description>
			<content:encoded><![CDATA[<p>For a web solution I am currently involved in I had a challenge where files from a FTP-server should be downloaded from the webserver. Thanks to a solution provided by NogDog to cesarcesar @ CodingForums.org in 2007 I managed to solve this.</p>
<p>This is the solution:</p>
<p>First you connect to your ftp-server<br />
<code>$connection = ftp_connect($ftp_server);<br />
$login = ftp_login($connection, $ftp_user_name, $ftp_password);<br />
</code></p>
<p>You then check if it was possible to log in. If it wasn&#8217;t, you have to end the script.<br />
<code><br />
if (!$connection || !$login) {<br />
      die('Connection attempt failed!');<br />
}<br />
</code></p>
<p>I then created a local directory (/temp/) where I want these files to be downloaded. Then I created a filename.<br />
For my solution I am getting most values from a database, so here I am only creating a example filename<br />
<code><br />
$localfile = "./temp/example.doc";<br />
$remotefile = "/dir/seconddir/example.doc";<br />
</code></p>
<p>Now we do the actual download and at the same time the download to the visitor:<br />
<code><br />
if (ftp_get($connection, $localfile, $remotefile, FTP_BINARY)){<br />
header('Content-Length: '. filesize($localfile));<br />
header('Content-Type: application/octet-stream');<br />
header('Content-Disposition: attachment; filename="'.basename($localfile).'"');<br />
header('Content-Transfer-Encoding: binary');<br />
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');<br />
readfile($localfile); // send the file<br />
exit;  // make sure no extraneous characters get appended<br />
}<br />
</code></p>
<p>The file <strong>will</strong> be stored locally, and since you don&#8217;t know when the user has gotten the file, set up a cronjob to remove downloaded files so that your area doesn&#8217;t get filled with files you don&#8217;t need.</p>
<p>What you also can do, is to check if the file is downloaded already. </p>
<p><a href="http://www.codingforums.com/showthread.php?t=134463">Link to original post</a><br />
I hope this was of help for someone.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.trondhuso.no/blog/2010/04/20/download-direct-from-ftp-server-with-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Spec for an iPhone/Ipad application</title>
		<link>http://www.trondhuso.no/blog/2010/04/16/spec-for-an-iphoneipad-application/</link>
		<comments>http://www.trondhuso.no/blog/2010/04/16/spec-for-an-iphoneipad-application/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 08:00:41 +0000</pubDate>
		<dc:creator>Trond Husø</dc:creator>
				<category><![CDATA[Fun]]></category>
		<category><![CDATA[ipad]]></category>
		<category><![CDATA[iphone]]></category>

		<guid isPermaLink="false">http://www.trondhuso.no/blog/?p=226</guid>
		<description><![CDATA[Over a beer (or two) me and a few friends started discussing all the different and unnecessary iPhone applications available. So we came up with the following idea: Wife: An iPhone/iPad application that bugs the living …. Out of you. It shall remove/lock any contacts where name resembles a women or a person interested in [...]]]></description>
			<content:encoded><![CDATA[<p>Over a beer (or two) me and a few friends started discussing all the different and unnecessary iPhone applications available. So we came up with the following idea:</p>
<p><strong>Wife:</strong> An iPhone/iPad application that bugs the living …. Out of you. It shall remove/lock any contacts where name resembles a women or a person interested in soccer/football or any other type of sport. It shall also lock applications that can be used to guide the owner to a bar or other establishment selling alcohol. Map-application  can be unlocked if spouse is very close by.<br />
<strong>Price:</strong> $10</p>
<p><strong>Ex-wife:</strong> opens any contacts where name resembles a women or a person interested in soccer or any other type of sport. Map also opens for guidance to bards or other establishment selling alcohol.<br />
<strong>Price:</strong> Wife*2 (everyone knows that x-wifes are expencive) – Wife*200 if mistress is installed… J</p>
<p><strong>Mistress:</strong> Same as ex-wife but much more subtle  way – it also makes Wife very suspicious and will also force Wife to become more brutal and lock more services…<br />
<strong>Price:</strong> Wife*100 (everyone knows that mistresses are way more expensive than wifes)</p>
<p><strong>Child-app:</strong> Makes the hardware very unstable. Moves keyboard keys and shortcuts around. Also uninstalls apps at random – and of course especially just when you need them.. J<br />
<strong>Price:</strong> $1 (kids are just fun!)</p>
<p><strong>In-law:</strong> A more subtle version of wife and pretty much a pain in the neck!<br />
<strong>Price:</strong> (hard to say, they aren’t really expensive, just a pain in the neck) $5 (but wife must be installed, so it’s actually $15)</p>
<p>Now all I have to do is find an iPhone/iPad developer.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.trondhuso.no/blog/2010/04/16/spec-for-an-iphoneipad-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
