<?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 &#187; PHP</title>
	<atom:link href="http://www.trondhuso.no/blog/category/webdevelopment/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.trondhuso.no/blog</link>
	<description>Blog about PHP, HTML, CSS, patents and all things inbetween</description>
	<lastBuildDate>Tue, 20 Dec 2011 23:45:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<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>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>PHP vs ASP.Net</title>
		<link>http://www.trondhuso.no/blog/2010/01/20/php-vs-asp-net/</link>
		<comments>http://www.trondhuso.no/blog/2010/01/20/php-vs-asp-net/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 08:00:11 +0000</pubDate>
		<dc:creator>Trond Husø</dc:creator>
				<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Webdevelopment]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[Web development]]></category>

		<guid isPermaLink="false">http://www.trondhuso.no/blog/?p=174</guid>
		<description><![CDATA[Well, this isn&#8217;t really a VS-blog-post, I just had a discovery while reading up on ASP.Net (Professional ASP.Net 2.0) and I see here that PHP has a way to go when it comes to make web development more productive. Yes we have more control on our code and so on, but the .Net Framework and [...]]]></description>
			<content:encoded><![CDATA[<p>Well, this isn&#8217;t really a VS-blog-post, I just had a discovery while reading up on ASP.Net (Professional ASP.Net 2.0) and I see here that PHP has a way to go when it comes to make web development more productive.<br />
Yes we have more control on our code and so on, but the .Net Framework and Visual Studio just makes things quite attractive for web developers.<br />
<em>I never really believed that I would ever write this in a blog post!</em><br />
I mean, there are components for everything.<br />
Want to create a login form? Drag it onto the canvas.<br />
What about a tree of data? Drag it onto the canvas &#8211; change the settings and boom.<br />
Want to create a portal? Use the .Net Portal Framework &#8211; which makes it possible for you to create something like Sharepoint! (well, that what it looked like in the book)</p>
<p>That is, is, is &#8230; awesome (<em>Again, I never really believed that I would ever write this in a blog post</em>)</p>
<p>There are of course cons related to .Net web application development.<br />
Configuring the IIS-server isn&#8217;t quite understandable, and you cannot go to the IIS.conf file to see what has been done to it in order to make it work like it is. So I would give Apache the victory here!</p>
<p>I have been working/maintaining/fixing on some websites that has been depended on .dll-files. One we recently had to upgrade from 1.1 to 3.5, and making it work under 3.5 wasn&#8217;t all that understandable &#8211; well at least not for me &#8211; but then again, I am still a Noob when it comes to .Net Web Application Development.<br />
Again, I&#8217;ll give PHP the advantage here as it is much easier to understand what has been done. the PHP.ini-file and such is easy to either go through or diff against the default PHP.ini to spot differences.</p>
<p>But for rapidness, especially when you start a project from scratch &#8211; ASP.Net gets one point. </p>
<p>This is where PHP must be heading. Yes it is easier to start with PHP. Or at least that is what used to be the best argument to start programming your dynamic web solution with PHP. But dragging, do some coding, and so on, will mean that .Net development will narrow the gap between PHP and ASP.Net.</p>
<p>According to websites PHP is still the most popular language to use when it comes to web development.<br />
A search on PHP and asp on GoogleFight returns:<br />
301.000.000 (301 million) results for PHP and 98.800.000 (98.8 million) results for asp<br />
ASP.net returns 30.400.000 (30.4 million) hits.</p>
<p>TIOBE Programming Community Index for January 2010 tells us that PHP is on the rise. It&#8217;s on third place behind Java and C, but in front of C++. VB is in fifth while C# is on 6th place. I believe I would put those two together to get some ASP.Net figgures.<br />
The two/three languages below:<br />
3  	5  	  	PHP  	10.071%  	+1.19%  	  A<br />
5 	4 		(Visual) Basic 	7.354% 	-1.81% 	  A<br />
6 	6 		C# 	5.767% 	+0.16% 	  A</p>
<p>PHP is still my language of choice, but I will follow ASP.Net closely. .Net 2.0 is dated and so I need a book for 3.5&#8230; (and probably 4.0) to see what&#8217;s new. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.trondhuso.no/blog/2010/01/20/php-vs-asp-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rapid Application Development under Linux</title>
		<link>http://www.trondhuso.no/blog/2009/12/20/development-under-linux/</link>
		<comments>http://www.trondhuso.no/blog/2009/12/20/development-under-linux/#comments</comments>
		<pubDate>Sun, 20 Dec 2009 08:00:21 +0000</pubDate>
		<dc:creator>Trond Husø</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MonoDevelop]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Webdevelopment]]></category>
		<category><![CDATA[asp]]></category>
		<category><![CDATA[Basic]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[Delphi]]></category>
		<category><![CDATA[Gamba]]></category>
		<category><![CDATA[Pascal]]></category>
		<category><![CDATA[rad]]></category>
		<category><![CDATA[Visual Basic]]></category>

		<guid isPermaLink="false">http://www.trondhuso.no/blog/?p=115</guid>
		<description><![CDATA[There are a few ways to develop applications under/for Linux. You can write cross platform applications using MonoDevelop, Real Basic and QT (not pronounced Cute, but Q.T. &#8211; yes, sort of like E.T&#8230;.). Or you can use any other language and use IDEs like Komodo, Eclipse and so on. Coming from the Windows side of [...]]]></description>
			<content:encoded><![CDATA[<p>There are a few ways to develop applications under/for Linux. You can write cross platform applications using <a href="http://www.monodevelop.com" target="_blank" title="MonoDevelop">MonoDevelop, <a href="http://www.realsoftware.com">Real Basic</a> and <a href="http://qt.nokia.com">QT</a> (not pronounced Cute, but Q.T. &#8211; yes, sort of like E.T&#8230;.). Or you can use any other language and use IDEs like <a href="http://www.activestate.com">Komodo</a>, <a href="http://www.eclipse.org">Eclipse</a> and so on.</p>
<p>Coming from the Windows side of things and being used to <a href="http://msdn.microsoft.com/en-gb/vstudio/default.aspx">Visual Basic</a> (I probably have the 1.0 floppy somewhere if I start looking!!!), <a href="http://www.codegear.com">Delphi</a> and now lately <a href="http://msdn.microsoft.com/en-gb/vstudio/default.aspx">Visual Studio</a> (It might seem weird that I&#8217;ve just recently been introduced to VS, but I have mostly coded in <a href="http://www.php.net">PHP</a> and <a href="http://msdn.microsoft.com/en-us/library/aa286483.aspx">classic ASP</a> for the last 8-10 years, and then you sort of don&#8217;t need VS), I have been accustomed to drag&#8217;n drop + double click to add code to the application. I have yet to write an application for <a href="http://www.linux.org">Linux</a>, but I have made a few attempts. My first attempt included being introduced to the <a title="Glade - A User Interface Designer" href="http://glade.gnome.org/" target="_blank">Glade</a> application which is/was used to create the layout of the application &#8211; aka GUI. Then you write the code in another IDE.</p>
<p>This was (hm) a while back &#8211; not writing year here, but I can write years if you like&#8230;</p>
<p><strong>The Good</strong></p>
<p>With the introduction of <a title="MonoDevelop" href="http://monodevelop.com" target="_blank">MonoDevelop</a>, <a title="Real Basic" href="http://www.realsoftware.com/" target="_blank">Real Basic</a> and <a title="QT" href="http://qt.nokia.com/" target="_blank">QT</a> we don&#8217;t have to open one application to create the GUI and a second one to attach code. It is all being done (and taken care of) in one development tool. This is, and I&#8217;d like to emphasize on this, the best way to write applications (my humble opinion &#8211; hey my blog!). The tool and GUI-designer is implemented and things can and should work smoothly. Also: You don&#8217;t have to learn two applications and probably also two &#8220;languages&#8221; &#8211; although I am all for having knowledge in as many programming languages as you can. I can now code in C#, VB.Net, Delphi/Pascal (although somewhat very rusty), Perl (briefly, by no means an expert and more or less a novice  and PHP (if that is considered a programming language).</p>
<p>I have tested QT, MonoDevelop and Real Basic. As I am no C++ developer (but I wish I was!), QT would be my choice of  development tool to use when learning that language. Real Basic has only been tested a few times after listening to Bryan Lunduke (Linux Action Show / Computer Action Show) speaking highly of it. MonoDevelop is as of now the tool I use when I&#8217;m now doing some C# stuff on Linux and trying to get the grips of  GTK-development.</p>
<p>I do want to check out <a title="Python" href="www.python.org/" target="_blank">Python</a> as a programming language as I have heard so much positive things regarding the language. But writing an application where you use <a title="RAD using Python and Glade" href="http://www.linuxjournal.com/article/7421" target="_blank">Glade</a> + editor of choice is not something I want to do. Not in 2009/2010. I think I&#8217;ve read somewhere that it can be possible to write applications in Python using QT, but I haven&#8217;t spent to much time getting this to work &#8211; as I don&#8217;t know that much Python &#8211; yet&#8230;</p>
<p>One thing though: By using <a title="Glade - A User Interface Designer" href="http://glade.gnome.org/" target="_blank">Glade</a> and similar applications you separate logic with presentation which can/is a good thing. But there are also drawbacks to this way of designing and developing applications. More below.</p>
<p><strong>The &#8220;Bad&#8221;</strong></p>
<p>I have also tried Android development in Eclipse, and it seems promising. But again: If the only way to create a GUI is to write XML-code, then no thanks. To the developers of development tools out there: Look at the calendar. It is &#8211; as of writing &#8211; saying December 19 in 2009, start creating drag&#8217;n drop applications.</p>
<p>This also goes for creating Web applications (as this is the new term for web pages). DreamWeaver alternatives for Linux? Not even close. Visual Studio + PHP under Linux. Nope.</p>
<p>Two years ago I attended a class to get a jumpstart on C#-development. And I was shown how to create a zebra-striped/styled datalist in VS. The teacher showed me how to do this in three ways: the first one without using any code, the second way with some code and placing the &#8220;plugin&#8221; and the last way by creating the object and so on.</p>
<p>So let&#8217;s say you have never programmed anything in your entire life. Which one would you start using to get going and to be inspired to code more? First one, most likely &#8211; until you understand that it gives you some restrictions and/or problems down the line. But at least you get inspired. You get the application out there to impress friends/boss/yourself quickly.</p>
<p>There are of course drawbacks to this type of applications. No one can argue that DW and such applications creates optimized code. And I am my self a user of Notepad-like applications to generate PHP-code &#8211; that is &#8211; I have moved from Bluefish to <a title="Aptana Studio" href="http://www.aptana.com" target="_blank">Aptana</a>/<a title="Eclipse - Open Source IDE" href="http://www.eclipse.org/" target="_blank">Eclipse</a>. Sometimes I do wish it was a faster way to create forms than the way I do it now &#8211; even though it doesn&#8217;t take that much time.</p>
<p>I have checked out <a title="Zend Studio" href="http://www.zend.com/products/studio/" target="_blank">Zend Studio</a> &#8211; which is now an Eclipse plugin, and I was hoping that ZS would be the way to do the same thing for PHP under Linux/Windows. Nope &#8211; not as I have found out &#8211; yet. It saddens me. Especially because they market this as <em>&#8220;Zend Studio 7.1 is the next generation of our professional-grade PHP application development environment. It has been designed to maximize developer productivity by enabling you to develop and maintain code faster, solve application problems quickly and improve team collaboration.&#8221;</em></p>
<p>I don&#8217;t think they are close to be a next generation professional-grade PHP application development environment. This is 2009 (soon 2010) and 7.1 should&#8217;ve had drag&#8217;n drop datalists, form creation in place. I hope, how ever, that ZS will in the end turn out to become a drag&#8217;n drop Rapid Web Application development (RWAD &#8211; Coined by Trond Husø on December 19, 2009!!!) tool for PHP.</p>
<p><strong>My Dream!</strong><br />
Maybe, in 2010(not likely) we could have a universal Rapid Application Development tool to be used to develop Linux applications that supports Python, Java, Perl, C, C++, PHP (if you want to!), C# and any other programming languages you can think of. And most importantly: The RAD tool should work out of the box. No spending much time on plugins and so on.</p>
<p><strong>Some links:</strong><br />
There are some RAD applications out there and here are some links:<br />
Python<br />
<a title=" href=" href="http://www.zend.com/products/studio/" target="_blank">Dabo</a></p>
<p><strong>Visual Basic</strong></p>
<p><a title="Gambas" href="http://gambas.sourceforge.net/en/main.html" target="_blank">Gambas</a></p>
<p><a title="MonoDevelop" href="http://monodevelop.com/" target="_blank">MonoDevelop</a></p>
<p><strong>Pascal</strong></p>
<p><a title="Lazarus" href="http://sourceforge.net/projects/lazarus/" target="_blank">Lazarus</a></p>
<p>(more links to come &#8211; obviously&#8230; &#8211; please do suggest some!)</p>
<p>Another discussion regarding development under Linux:</p>
<p><a title="RA development" href="https://ldn.linuxfoundation.org/article/putting-squeeze-python-application-development" target="_blank">Putting the Squeeze on Python Application Development</a></p>
<p>(more links to come)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.trondhuso.no/blog/2009/12/20/development-under-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Twitter and zend framework</title>
		<link>http://www.trondhuso.no/blog/2009/11/19/twitter-and-zend-framework/</link>
		<comments>http://www.trondhuso.no/blog/2009/11/19/twitter-and-zend-framework/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 20:07:07 +0000</pubDate>
		<dc:creator>Trond Husø</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[zend]]></category>

		<guid isPermaLink="false">http://www.trondhuso.no/blog/2009/11/19/twitter-and-zend-framework/</guid>
		<description><![CDATA[# twitter_index.php /** * This code shall update the twitter-status when a new graphic is posted * It will be using the Zend Framework */ $path = &#8216;/Zend/library/&#8217;; set_include_path(get_include_path() . PATH_SEPARATOR . $path); include &#8220;Zend/Service/Twitter.php&#8221;; # include &#8220;Rest/client.php&#8221;; # Connect to the twitter-service try { $twitter = new Zend_Service_Twitter(&#8216;username&#8217;, &#8216;password&#8217;); echo &#8220;that&#8217;s nice \n&#8221;; echo [...]]]></description>
			<content:encoded><![CDATA[<p># twitter_index.php</p>
<p>/**<br />
* This code shall update the twitter-status when a new graphic is posted<br />
* It will be using the Zend Framework<br />
*/<br />
$path = &#8216;/Zend/library/&#8217;;<br />
set_include_path(get_include_path() . PATH_SEPARATOR . $path);<br />
include &#8220;Zend/Service/Twitter.php&#8221;;<br />
# include &#8220;Rest/client.php&#8221;;</p>
<p># Connect to the twitter-service<br />
try {<br />
$twitter = new Zend_Service_Twitter(&#8216;username&#8217;, &#8216;password&#8217;);</p>
<p>echo &#8220;that&#8217;s nice<br />
\n&#8221;;<br />
echo &#8220;Followers: &#8220;.$twitter-&gt;userFollowers();</p>
<p># verify your credentials with twitter<br />
$response = $twitter-&gt;accountVerifyCredentials();</p>
<p># Here you should add:<br />
echo $response-&gt;error;</p>
<p>echo &#8220;That&#8217;s great!&#8221;.$response.&#8221;<br />
\n&#8221;;</p>
<p># echo &#8220;StatusShow: &#8220;.$twitter-&gt;statusShow($response).&#8221;\n&#8221;;<br />
echo &#8220;status: &#8220;.$twitter-&gt;status-&gt;friendsTimeline().&#8221;\n&#8221;;</p>
<p>$response = $twitter-&gt;status-&gt;userTimeline();<br />
$twitterstatus = (string)$response-&gt;status[0]-&gt;text;<br />
echo &#8220;twitterstatus: &#8220;.$twitterstatus.&#8221;\n&#8221;;</p>
<p>echo &#8220;timeline: &#8220;.$twitter-&gt;status-&gt;UserTimeline().&#8221;\n&#8221;;</p>
<p>$response = $twitter-&gt;status-&gt;update(&#8216;My Great Tweet-from PHP&#8217;);<br />
} catch (exception $e) {<br />
echo &#8220;That&#8217;s odd<br />
\n&#8221;;<br />
echo $e;<br />
exit();<br />
} catch (Zend_Service_Twitter_Exception $t){<br />
echo &#8220;Hello there!<br />
\n&#8221;;<br />
echo $t;<br />
exit();<br />
}</p>
<p>?&gt;</p>
<p>Fixed: I had the wrong password.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.trondhuso.no/blog/2009/11/19/twitter-and-zend-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A way to prevent SQL-injection</title>
		<link>http://www.trondhuso.no/blog/2009/11/17/a-way-to-prevent-sql-injection/</link>
		<comments>http://www.trondhuso.no/blog/2009/11/17/a-way-to-prevent-sql-injection/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 20:26:42 +0000</pubDate>
		<dc:creator>Trond Husø</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.trondhuso.no/blog/?p=65</guid>
		<description><![CDATA[A little while back I wanted to check if there was another way to prevent SQL-injection than to run the mysql_real_escape_string function and other checks. What I did was to add a user that only had read and write access to the database. The user was not allowed to delete. I ran only a few [...]]]></description>
			<content:encoded><![CDATA[<p>A little while back I wanted to check if there was another way to prevent SQL-injection than to run the mysql_real_escape_string function and other checks.<br />
What I did was to add a user that only had read and write access to the database. The user was not allowed to delete. I ran only a few tests since I am no master on SQL-injections, but those I ran was successful. The injector was not able to empty the database or run other dangerous SQL-queries.<br />
The drawback is that not all server hosts set up two users &#8211; one with restricted access, but I believe they should start doing this. It is a very effective way to stop some SQL-injections.<br />
What it does not stop &#8211; of course &#8211; is for an intruder to fill the database with bogus-data.<br />
Please do discuss this post and test different SQL-injection-queries.<br />
This is of course a method to be used on frontends, not backends as you would need to also delete data in the administration tool, but still it is better than nothing.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.trondhuso.no/blog/2009/11/17/a-way-to-prevent-sql-injection/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>IDE/Weaver/Studio Ramblings</title>
		<link>http://www.trondhuso.no/blog/2009/09/20/ide_weaver_studio_ramblings/</link>
		<comments>http://www.trondhuso.no/blog/2009/09/20/ide_weaver_studio_ramblings/#comments</comments>
		<pubDate>Sun, 20 Sep 2009 10:04:07 +0000</pubDate>
		<dc:creator>Trond Husø</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Webdevelopment]]></category>
		<category><![CDATA[Activestate]]></category>
		<category><![CDATA[Aptana]]></category>
		<category><![CDATA[Dreamweaver]]></category>
		<category><![CDATA[ide]]></category>
		<category><![CDATA[Komodo]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[MonoDevelop]]></category>
		<category><![CDATA[studio]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.trondhuso.no/blog/?p=57</guid>
		<description><![CDATA[On the Linux platform we (web) developers have quite a lot of texteditors or IDE (Integrated Development Environment) to choose from. What I miss are tools like Visual Studio and Dreamweaver. I know that we have MonoDevelop on the Linux (Windows and Mac)-side, but this is mostly a development environment for developing applications (and ASPX-websites). [...]]]></description>
			<content:encoded><![CDATA[<p>On the Linux platform we (web) developers have quite a lot of texteditors or IDE (<a href="http://en.wikipedia.org/wiki/Integrated_development_environment">Integrated Development Environment</a>) to choose from.</p>
<p>What I miss are tools like Visual Studio and Dreamweaver. I know that we have MonoDevelop on the Linux (Windows and Mac)-side, but this is mostly a development environment for developing applications (and ASPX-websites). We also have Qt (which shall support PHP, but I haven&#8217;t checked it out &#8211; yet) and RealBasic. </p>
<p>I am glad that those development tools exists. Without them Linux-developers would still be working with one program that creates the GUI, and another (most likely VI(m)) where code development would happen. There are positive side effects from separating code and GUI like that, but at the same time it makes developing a tad bit harder. Coming from the Window-side (who hasn&#8217;t?) I have been used to GUI-design and code in the same program since Visual Basic 1.0 and Borland Delphi 1.0, and later Visual Studio.<br />
To me using MonoDevelop is as natural as coding in those before mentioned programming tools. </p>
<p>On the web side (thinking PHP, Perl and probably also Ruby here) we are lagging behind Windows here. I know we have Kompozer (former NVU) on the Linux side, but this tool lacks a lot of the features that Dreamweaver has. Also: it is filled with bugs. </p>
<p>I really wish that ActiveState, Aptana and/or Eclipse would step up and start working on a &#8220;Studio&#8221;-like software where designers can design the website easily (and of course clean up the HTML afterwards) and the developers can create the code to make the website work as intended &#8211; in the same software. I really hope we get there one day.<br />
One feature that I would very much like to see is that if a developer created a class for, let&#8217;s say HTML-form-elements, this class could be added to the toolbar and be used by designers later. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.trondhuso.no/blog/2009/09/20/ide_weaver_studio_ramblings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exercise &#8211; creating table using css</title>
		<link>http://www.trondhuso.no/blog/2009/09/12/exercise-creating-table-using-css/</link>
		<comments>http://www.trondhuso.no/blog/2009/09/12/exercise-creating-table-using-css/#comments</comments>
		<pubDate>Fri, 11 Sep 2009 22:57:20 +0000</pubDate>
		<dc:creator>Trond Husø</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.trondhuso.no/blog/?p=42</guid>
		<description><![CDATA[Today I played around with css and the display: table / table-row / table-cell settings. And it worked out quite well. The reason for playing with this was to create a table without using the table-tag. I am not religious regarding using or not using the table-tag to render the page, but some are out [...]]]></description>
			<content:encoded><![CDATA[<p>Today I played around with css and the display: table / table-row / table-cell settings. And it worked out quite well. The reason for playing with this was to create a table without using the table-tag.</p>
<p>I am not religious regarding using or not using the table-tag to render the page, but some are out there, and so it is nice to know how to use css to create a table.</p>
<p>Below is the code that I used to get some data. What it does it looping the &#8220;root&#8221; of my personal development apache server. Then by using the div-tag and css a table is created.</p>
<p>This is the index.php file<br />
<code><br />
&lt;?php<br />
# index.php</code></p>
<p>/*<br />
* This file shall have a little menu in it. It shall also list up the folders we have<br />
* in the root directory<br />
*/<br />
echo &#8216;&lt;html&gt;<br />
&lt;head&gt;<br />
&lt;title&gt;Localhost&lt;/title&gt;<br />
&lt;link rel=&#8221;stylesheet&#8221; href=&#8221;style/localhost.css&#8221; type=&#8221;text/css&#8221; /&gt;</p>
<p>&lt;/head&gt;</p>
<p>&lt;body&gt;&#8217;;</p>
<p>if ($handle = opendir(&#8216;.&#8217;)) {<br />
echo $_SERVER['SERVER_NAME'].&#8221; running on: &#8220;;<br />
echo $_SERVER['SERVER_SOFTWARE'].&#8221;&lt;br&gt;&#8221;;<br />
# echo &#8220;Directory handle: $handle\n&#8221;;<br />
echo &#8220;&lt;b&gt;Files:&lt;/b&gt;\n&lt;br&gt;&#8221;;</p>
<p># This will be a test for css and tables<br />
echo &#8220;&lt;div class = \&#8221;table\&#8221;&gt;\n&#8221;;<br />
$rows = 1;<br />
$cols = 0;<br />
$files = 0;<br />
/* This is the correct way to loop over the directory. */<br />
while (false !== ($file = readdir($handle))) {<br />
if (strlen($file) &gt; 2) {<br />
# we shall change rows when we have created three columns<br />
$cols++;</p>
<p>if ($cols == 5) {<br />
echo &#8220;&lt;/div&gt;\n&#8221;;<br />
$cols = 1;<br />
}</p>
<p>if ($cols == 1) {<br />
echo &#8220;&lt;div class = \&#8221;tr&#8221;.$rows.&#8221;\&#8221;&gt;&#8221;;<br />
$rows++;</p>
<p>if ($rows == 3) {<br />
$rows = 1;<br />
}<br />
}</p>
<p>echo &#8220;&lt;div class = \&#8221;td\&#8221;&gt;&#8221;.$file.&#8221;&lt;/div&gt;&#8221;;</p>
<p>}<br />
}</p>
<p>closedir($handle);<br />
echo &#8220;&lt;/div&gt;&#8221;;<br />
}</p>
<p>?&gt;</p>
<p>And this is the CSS-file</p>
<p><code><br />
/*<br />
This style is used to check how to create tables in css<br />
*/</code></p>
<p>div.table {<br />
display: table;<br />
table-layout: fixed;<br />
background-color: rgb(120, 20, 90);<br />
width:100%;</p>
<p>}</p>
<p>div.tr1 {<br />
display: table-row-group;<br />
background-color: #e5e5e5;<br />
}</p>
<p>div.tr2 {<br />
display: table-row-group;<br />
background-color: #bfbfbf;<br />
}<br />
div.td {<br />
display: table-cell;<br />
vertical-align: top;<br />
padding: 2px 0px 3px 0px;<br />
border-bottom: 1px solid #d3d1d1;<br />
width: 20px;<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>http://www.trondhuso.no/blog/2009/09/12/exercise-creating-table-using-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My bookshelf</title>
		<link>http://www.trondhuso.no/blog/2008/11/17/my-bookshelf/</link>
		<comments>http://www.trondhuso.no/blog/2008/11/17/my-bookshelf/#comments</comments>
		<pubDate>Mon, 17 Nov 2008 21:09:54 +0000</pubDate>
		<dc:creator>Trond Husø</dc:creator>
				<category><![CDATA[Books]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Webdevelopment]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[asp]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[web forms]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.trondhuso.no/blog/?p=76</guid>
		<description><![CDATA[At the moment my bookshelf (and I am now stricktly writing about books related to programming) contains: PHP Professional PHP Programming (Wrox) (first PHP book that I bought) Programming PHP (O&#8217;Reilly) Web Database Applications with PHP and mySQL (O&#8217;Reilly) Object-Oriented PHP (No Starch Press) Latest additions: Advanced PHP Programming (Developer&#8217;s Library) CodeIgniter (Wrox) Professional Search [...]]]></description>
			<content:encoded><![CDATA[<p>At the moment my bookshelf (and I am now stricktly writing about books related to programming) contains:</p>
<p><strong>PHP</strong><br />
Professional PHP Programming (Wrox) (first PHP book that I bought)<br />
Programming PHP (O&#8217;Reilly)<br />
Web Database Applications with <em>PHP and mySQL</em> (O&#8217;Reilly)<br />
Object-Oriented PHP (No Starch Press)<br />
<em><strong>Latest additions:</strong></em><br />
Advanced PHP Programming (Developer&#8217;s Library)<br />
CodeIgniter (Wrox)<br />
Professional Search Engine Optimization with PHP (Wrox)<br />
PHP Cookbook  (O&#8217;Reilly)<br />
PHP Objects, Patterns and Practice (apress)<br />
php|architect&#8217;s Guide to PHP Security (php|architect&#8217;s)<br />
php|architect&#8217;s Guide to Date and Time Programming (php|architect&#8217;s)<br />
Essential PHP Security (O&#8217;Reilly)</p>
<p><strong>Javascript/AJAX:</strong><br />
Javascript <em>The Definitive Guide</em> (O&#8217;Reilly)<br />
AJAX The complete Reference (Mc Graw Hill)<br />
Professional AJAX (Wrox)<br />
Javascript: The Good Parts  (O&#8217;Reilly)<br />
Dojo: The Definitive Guide  (O&#8217;Reilly)<br />
jQuery: Jquery Novice to Ninja (Sitepoint)</p>
<p><strong>mySQL</strong><br />
mySQL and Perl for the Web (New Rides)<br />
MySQL (Developer&#8217;s Library)<br />
High Performance mySQL (O&#8217;Reilly)</p>
<p><strong>Perl</strong><br />
Perl Cookbook  (O&#8217;Reilly)<br />
Perl for Web Site Managers  (O&#8217;Reilly)</p>
<p><strong>Other languages</strong><br />
C# 2005 (Wrox)<br />
ASP.NET 2.0 (Wrox)</p>
<p><strong>XML</strong><br />
XML A Beginners Guide (Mc Graw Hill)<br />
XSLT (O&#8217;Reilly)</p>
<p><strong>Other</strong><br />
Web Form Design (Rosenfeld)<br />
Apache 2 Pocket Reference  (O&#8217;Reilly)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.trondhuso.no/blog/2008/11/17/my-bookshelf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

