<?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>Marius van Witzenburg &#187; PHP</title>
	<atom:link href="http://mariusvw.com/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://mariusvw.com</link>
	<description>&#34;Learned my lesson in life, now setting my action to stay in life.&#34;</description>
	<lastBuildDate>Tue, 07 Sep 2010 08:02:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Inconsistent line ending (EOL) style</title>
		<link>http://mariusvw.com/2010/08/25/inconsistent-line-ending-eol-style/</link>
		<comments>http://mariusvw.com/2010/08/25/inconsistent-line-ending-eol-style/#comments</comments>
		<pubDate>Wed, 25 Aug 2010 09:56:24 +0000</pubDate>
		<dc:creator>mariusvw</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[ASP]]></category>
		<category><![CDATA[CFM]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Ending]]></category>
		<category><![CDATA[EOL]]></category>
		<category><![CDATA[Find]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Inconsistent]]></category>
		<category><![CDATA[JS]]></category>
		<category><![CDATA[Line]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PL]]></category>
		<category><![CDATA[Replace]]></category>
		<category><![CDATA[Script]]></category>
		<category><![CDATA[TXT]]></category>

		<guid isPermaLink="false">http://mariusvw.com/?p=4967</guid>
		<description><![CDATA[If you work with subversion you might get this error when you got files that have been edited on different operating systems like Windows, Linux, FreeBSD or Mac OS X. Well, the fix is quite simple. You simply replace the wrong line endings with right ones depending of which you want. In my situation I [...]]]></description>
			<content:encoded><![CDATA[<p>If you work with subversion you might get this error when you got files that have been edited on different operating systems like Windows, Linux, <a href='http://www.freebsd.org' rel='external ' title=''>FreeBSD</a> or Mac OS X.</p>
<p>Well, the fix is quite simple. You simply replace the wrong line endings with right ones depending of which you want. In my situation I want unix style line endings.</p>
<p>Replace in <a href='http://www.php.net' rel='external ' title=''>PHP</a> files:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">find</span> .<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*.php'</span> <span style="color: #660033;">-type</span> f <span style="color: #660033;">-exec</span> <span style="color: #c20cb9; font-weight: bold;">perl</span> <span style="color: #660033;">-i</span> <span style="color: #660033;">-wpe</span> <span style="color: #ff0000;">'s/\r\n/\n/g'</span> <span style="color: #ff0000;">'{}'</span> \;
<span style="color: #c20cb9; font-weight: bold;">find</span> .<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*.php'</span> <span style="color: #660033;">-type</span> f <span style="color: #660033;">-exec</span> <span style="color: #c20cb9; font-weight: bold;">perl</span> <span style="color: #660033;">-i</span> <span style="color: #660033;">-wpe</span> <span style="color: #ff0000;">'s/\r/\n/g'</span> <span style="color: #ff0000;">'{}'</span> \;</pre></div></div>

<p>In case you want to replace them in multiple file types you can adjust the command. In this example we want to replace in the following file types:</p>
<ol>
<li>asp</li>
<li>cfm</li>
<li>css</li>
<li>html</li>
<li>js</li>
<li>php</li>
<li>pl</li>
<li>txt</li>
</ol>
<p>Use the following commands:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">find</span> .<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*.asp'</span> <span style="color: #660033;">-or</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*.cfm'</span> <span style="color: #660033;">-or</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*.css'</span> <span style="color: #660033;">-or</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*.html'</span> <span style="color: #660033;">-or</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*.js'</span> <span style="color: #660033;">-or</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*.php'</span> <span style="color: #660033;">-or</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*.pl'</span> <span style="color: #660033;">-or</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*.txt'</span> <span style="color: #660033;">-type</span> f <span style="color: #660033;">-exec</span> <span style="color: #c20cb9; font-weight: bold;">perl</span> <span style="color: #660033;">-i</span> <span style="color: #660033;">-wpe</span> <span style="color: #ff0000;">'s/\r\n/\n/g'</span> <span style="color: #ff0000;">'{}'</span> \;
<span style="color: #c20cb9; font-weight: bold;">find</span> .<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*.asp'</span> <span style="color: #660033;">-or</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*.cfm'</span> <span style="color: #660033;">-or</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*.css'</span> <span style="color: #660033;">-or</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*.html'</span> <span style="color: #660033;">-or</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*.js'</span> <span style="color: #660033;">-or</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*.php'</span> <span style="color: #660033;">-or</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*.pl'</span> <span style="color: #660033;">-or</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*.txt'</span> <span style="color: #660033;">-type</span> f <span style="color: #660033;">-exec</span> <span style="color: #c20cb9; font-weight: bold;">perl</span> <span style="color: #660033;">-i</span> <span style="color: #660033;">-wpe</span> <span style="color: #ff0000;">'s/\r/\n/g'</span> <span style="color: #ff0000;">'{}'</span> \;</pre></div></div>

<p>Keep in mind, you may use these commands on your own risk. I'm not responsible if you lose your work <img src='http://mariusvw.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' title="Inconsistent line ending (EOL) style photo" /> </p>
<p>Now you should be able to commit your files again <img src='http://mariusvw.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' title="Inconsistent line ending (EOL) style photo" /> </p>
<!-- PHP 5.x -->]]></content:encoded>
			<wfw:commentRss>http://mariusvw.com/2010/08/25/inconsistent-line-ending-eol-style/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Show hidden .htaccess files in Eclipse/Aptana</title>
		<link>http://mariusvw.com/2010/04/14/show-hidden-htaccess-files-in-eclipseaptana/</link>
		<comments>http://mariusvw.com/2010/04/14/show-hidden-htaccess-files-in-eclipseaptana/#comments</comments>
		<pubDate>Wed, 14 Apr 2010 07:55:36 +0000</pubDate>
		<dc:creator>mariusvw</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Aptana]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Hidden]]></category>
		<category><![CDATA[Period]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Visible]]></category>

		<guid isPermaLink="false">http://mariusvw.com/?p=1660</guid>
		<description><![CDATA[Most webdevelopers require .htaccess files to be visible in their projects, since by default Eclipse and Aptana both hide files starting with a . (=period) this can be quite irritating since you have to open the file from your operating system file explorer. The fix to make .htaccess files visible is quite simple, you have [...]]]></description>
			<content:encoded><![CDATA[<p>Most webdevelopers require .htaccess files to be visible in their projects, since by default <a href='http://www.eclipse.org' rel='external ' title=''>Eclipse</a> and Aptana both hide files starting with a . (=period) this can be quite irritating since you have to open the file from your operating system file explorer.</p>
<p>The fix to make .htaccess files visible is quite simple, you have to modify the file browser view filter to show hidden files but hide certain file types so you won't get a mess in your view.</p>
<p>First goto the filters menu by clicking the little arrow on the top right of the file browser and click 'Filters...'.</p>
<p>See the menu below:<br />
<a href="http://mariusvw.com/wp-content/uploads/2010/04/eclipse_hidden_files-1.png" rel="lightbox[1660]" title="<a href='http://www.eclipse.org' rel='external ' title=''>Eclipse</a>/Aptana hidden files, 1"><img src="http://mariusvw.com/wp-content/uploads/2010/04/eclipse_hidden_files-1-512x320.png" alt="eclipse hidden files 1 512x320 Show hidden .htaccess files in Eclipse/Aptana" title="<a href='http://www.eclipse.org' rel='external ' title='' />Eclipse</a>/Aptana hidden files, 1" width="512" height="320" class="size-medium wp-image-1661" /></a></p>
<p>When you are at the filter menu you will see the following window:<br />
<a href="http://mariusvw.com/wp-content/uploads/2010/04/eclipse_hidden_files-2.png" rel="lightbox[1660]" title="<a href='http://www.eclipse.org' rel='external ' title=''>Eclipse</a>/Aptana hidden files, 2"><img src="http://mariusvw.com/wp-content/uploads/2010/04/eclipse_hidden_files-2-448x512.png" alt="eclipse hidden files 2 448x512 Show hidden .htaccess files in Eclipse/Aptana" title="<a href='http://www.eclipse.org' rel='external ' title='' />Eclipse</a>/Aptana hidden files, 2" width="448" height="512" class="size-medium wp-image-1662" /></a></p>
<p>In this window uncheck <em>'.* resources'</em> and check <em>'Name filter patterns (matching names will be hidden):'</em>.</p>
<p>Now you have to add a filter because you will be flooded by hidden files in your file explorer.<br />
The filter I used is:</p>
<blockquote><p>._*, *.svn, .cvsignore, _notes, .*.swp, .DS_Store, .AppleDouble, .project, .buildpath, .settings</p></blockquote>
<p>You might append more filters to your needs.</p>
<p>In case you have a remote filesystem plugin installed you might need to check <em>'Show hidden files'</em> in your preferences.</p>
<p>This is an example how this window might look:<br />
<a href="http://mariusvw.com/wp-content/uploads/2010/04/eclipse_hidden_files-r.png" rel="lightbox[1660]" title="<a href='http://www.eclipse.org' rel='external ' title=''>Eclipse</a>/Aptana hidden files, remote filesystems"><img src="http://mariusvw.com/wp-content/uploads/2010/04/eclipse_hidden_files-r-512x447.png" alt="eclipse hidden files r 512x447 Show hidden .htaccess files in Eclipse/Aptana" title="<a href='http://www.eclipse.org' rel='external ' title='' />Eclipse</a>/Aptana hidden files, remote filesystems" width="512" height="447" class="size-medium wp-image-1663" /></a></p>
<p>Another handy thing to know, <strong>never edit the .project file!</strong></p>
<p>That was about it for now, happy coding! <img src='http://mariusvw.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' title="Show hidden .htaccess files in Eclipse/Aptana photo" /> </p>
<!-- PHP 5.x -->]]></content:encoded>
			<wfw:commentRss>http://mariusvw.com/2010/04/14/show-hidden-htaccess-files-in-eclipseaptana/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>List only directories on the command-line or in your scripts</title>
		<link>http://mariusvw.com/2010/03/10/list-only-directories-on-the-command-line-or-in-your-scripts/</link>
		<comments>http://mariusvw.com/2010/03/10/list-only-directories-on-the-command-line-or-in-your-scripts/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 10:53:03 +0000</pubDate>
		<dc:creator>mariusvw</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[Command-line]]></category>
		<category><![CDATA[Directories]]></category>
		<category><![CDATA[Find]]></category>
		<category><![CDATA[Ls]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Script]]></category>
		<category><![CDATA[SH]]></category>

		<guid isPermaLink="false">http://mariusvw.com/?p=1322</guid>
		<description><![CDATA[Here you have some different ways of showing only the directories on a path you specify. This can be used in different other languages such as PHP with shell_exec for example. ls -l /shares/ &#124; grep &#34;^d&#34; &#124; awk '{ print $9 }' find /shares/ -maxdepth 1 -mindepth 1 -type d &#124; sed 's/.\///g' find [...]]]></description>
			<content:encoded><![CDATA[<p>Here you have some different ways of showing only the directories on a path you specify.<br />
This can be used in different other languages such as <a href='http://www.php.net' rel='external ' title=''>PHP</a> with <em>shell_exec</em> for example.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-l</span> <span style="color: #000000; font-weight: bold;">/</span>shares<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;^d&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{ print $9 }'</span>
<span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #000000; font-weight: bold;">/</span>shares<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #660033;">-maxdepth</span> <span style="color: #000000;">1</span> <span style="color: #660033;">-mindepth</span> <span style="color: #000000;">1</span> <span style="color: #660033;">-type</span> d <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #ff0000;">'s/.\///g'</span>
<span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #000000; font-weight: bold;">/</span>shares<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #660033;">-maxdepth</span> <span style="color: #000000;">1</span> <span style="color: #660033;">-mindepth</span> <span style="color: #000000;">1</span> <span style="color: #660033;">-type</span> d <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">perl</span> <span style="color: #660033;">-pi</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'s/.\///g'</span>
<span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #000000; font-weight: bold;">/</span>shares<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #660033;">-maxdepth</span> <span style="color: #000000;">1</span> <span style="color: #660033;">-mindepth</span> <span style="color: #000000;">1</span> <span style="color: #660033;">-type</span> d <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-v</span> <span style="color: #ff0000;">'^\./\.'</span></pre></div></div>

<p>I hope you find them useful on some way <img src='http://mariusvw.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' title="List only directories on the command line or in your scripts photo" /><br />
Of course comments are more than welcome!</p>
<!-- PHP 5.x -->]]></content:encoded>
			<wfw:commentRss>http://mariusvw.com/2010/03/10/list-only-directories-on-the-command-line-or-in-your-scripts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Easy replace php short open tags with long php open tags</title>
		<link>http://mariusvw.com/2010/03/03/easy-replace-php-short-open-tags-with-long-php-open-tags/</link>
		<comments>http://mariusvw.com/2010/03/03/easy-replace-php-short-open-tags-with-long-php-open-tags/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 19:36:38 +0000</pubDate>
		<dc:creator>mariusvw</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Cake]]></category>
		<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Open]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Replace]]></category>
		<category><![CDATA[Script]]></category>
		<category><![CDATA[Short]]></category>
		<category><![CDATA[Tag]]></category>

		<guid isPermaLink="false">http://mariusvw.com/?p=1305</guid>
		<description><![CDATA[I wrote a quite simple script to fix short open tags to long open tags. This script is compatible with CakePHP 1.1 and 1.2, on request Have fun using it! I suggest saving this file to /usr/local/bin/php_fix_short_open_tag 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 [...]]]></description>
			<content:encoded><![CDATA[<p>I wrote a quite simple script to fix short open tags to long open tags.</p>
<p>This script is compatible with <a href='http://cakephp.org/' rel='external ' title=''>Cake<a href='http://www.php.net' rel='external ' title=''>PHP</a></a> 1.1 and 1.2, on request <img src='http://mariusvw.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' title="Easy replace php short open tags with long php open tags photo" /> </p>
<p>Have fun using it!</p>
<p>I suggest saving this file to <em>/usr/local/bin/php_fix_short_open_tag</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
<span style="color: #666666; font-style: italic;"># Written by Marius van Witzenburg &lt;info@mariusvw.com&gt;</span>
&nbsp;
<span style="color: #007800;">path</span>=<span style="color: #ff0000;">&quot;.&quot;</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-z</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-d</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #007800;">path</span>=<span style="color: #ff0000;">&quot;$1&quot;</span>
<span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-z</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Invalid path defined, using default.&quot;</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Searching for php short open tags...&quot;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Starting path: <span style="color: #007800;">$path</span>&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #007800;">$path</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*.php'</span> <span style="color: #660033;">-type</span> f <span style="color: #660033;">-exec</span> <span style="color: #c20cb9; font-weight: bold;">perl</span> <span style="color: #660033;">-i</span> <span style="color: #660033;">-wpe</span> <span style="color: #ff0000;">'s/&lt;\?=/&lt;\?php echo /g'</span> <span style="color: #ff0000;">'{}'</span> \; 
<span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #007800;">$path</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*.php'</span> <span style="color: #660033;">-type</span> f <span style="color: #660033;">-exec</span> <span style="color: #c20cb9; font-weight: bold;">perl</span> <span style="color: #660033;">-i</span> <span style="color: #660033;">-wpe</span> <span style="color: #ff0000;">'s/&lt;\?/&lt;\?php/g'</span> <span style="color: #ff0000;">'{}'</span> \; 
<span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #007800;">$path</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*.php'</span> <span style="color: #660033;">-type</span> f <span style="color: #660033;">-exec</span> <span style="color: #c20cb9; font-weight: bold;">perl</span> <span style="color: #660033;">-i</span> <span style="color: #660033;">-wpe</span> <span style="color: #ff0000;">'s/&lt;\?phpphp/&lt;\?php/g'</span> <span style="color: #ff0000;">'{}'</span> \; 
<span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #007800;">$path</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*.ctp'</span> <span style="color: #660033;">-type</span> f <span style="color: #660033;">-exec</span> <span style="color: #c20cb9; font-weight: bold;">perl</span> <span style="color: #660033;">-i</span> <span style="color: #660033;">-wpe</span> <span style="color: #ff0000;">'s/&lt;\?=/&lt;\?php echo /g'</span> <span style="color: #ff0000;">'{}'</span> \; 
<span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #007800;">$path</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*.ctp'</span> <span style="color: #660033;">-type</span> f <span style="color: #660033;">-exec</span> <span style="color: #c20cb9; font-weight: bold;">perl</span> <span style="color: #660033;">-i</span> <span style="color: #660033;">-wpe</span> <span style="color: #ff0000;">'s/&lt;\?/&lt;\?php/g'</span> <span style="color: #ff0000;">'{}'</span> \; 
<span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #007800;">$path</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*.ctp'</span> <span style="color: #660033;">-type</span> f <span style="color: #660033;">-exec</span> <span style="color: #c20cb9; font-weight: bold;">perl</span> <span style="color: #660033;">-i</span> <span style="color: #660033;">-wpe</span> <span style="color: #ff0000;">'s/&lt;\?phpphp/&lt;\?php/g'</span> <span style="color: #ff0000;">'{}'</span> \; 
<span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #007800;">$path</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*.inc'</span> <span style="color: #660033;">-type</span> f <span style="color: #660033;">-exec</span> <span style="color: #c20cb9; font-weight: bold;">perl</span> <span style="color: #660033;">-i</span> <span style="color: #660033;">-wpe</span> <span style="color: #ff0000;">'s/&lt;\?=/&lt;\?php echo /g'</span> <span style="color: #ff0000;">'{}'</span> \; 
<span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #007800;">$path</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*.inc'</span> <span style="color: #660033;">-type</span> f <span style="color: #660033;">-exec</span> <span style="color: #c20cb9; font-weight: bold;">perl</span> <span style="color: #660033;">-i</span> <span style="color: #660033;">-wpe</span> <span style="color: #ff0000;">'s/&lt;\?/&lt;\?php/g'</span> <span style="color: #ff0000;">'{}'</span> \; 
<span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #007800;">$path</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*.inc'</span> <span style="color: #660033;">-type</span> f <span style="color: #660033;">-exec</span> <span style="color: #c20cb9; font-weight: bold;">perl</span> <span style="color: #660033;">-i</span> <span style="color: #660033;">-wpe</span> <span style="color: #ff0000;">'s/&lt;\?phpphp/&lt;\?php/g'</span> <span style="color: #ff0000;">'{}'</span> \; 
<span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #007800;">$path</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*.thtml'</span> <span style="color: #660033;">-type</span> f <span style="color: #660033;">-exec</span> <span style="color: #c20cb9; font-weight: bold;">perl</span> <span style="color: #660033;">-i</span> <span style="color: #660033;">-wpe</span> <span style="color: #ff0000;">'s/&lt;\?=/&lt;\?php echo /g'</span> <span style="color: #ff0000;">'{}'</span> \; 
<span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #007800;">$path</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*.thtml'</span> <span style="color: #660033;">-type</span> f <span style="color: #660033;">-exec</span> <span style="color: #c20cb9; font-weight: bold;">perl</span> <span style="color: #660033;">-i</span> <span style="color: #660033;">-wpe</span> <span style="color: #ff0000;">'s/&lt;\?/&lt;\?php/g'</span> <span style="color: #ff0000;">'{}'</span> \; 
<span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #007800;">$path</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*.thtml'</span> <span style="color: #660033;">-type</span> f <span style="color: #660033;">-exec</span> <span style="color: #c20cb9; font-weight: bold;">perl</span> <span style="color: #660033;">-i</span> <span style="color: #660033;">-wpe</span> <span style="color: #ff0000;">'s/&lt;\?phpphp/&lt;\?php/g'</span> <span style="color: #ff0000;">'{}'</span> \; 
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'Done!'</span></pre></td></tr></table></div>

<p>Please leave the credits in if you want to modify it.<br />
Donations are welcome haha <img src='http://mariusvw.com/wp-includes/images/smilies/icon_razz.gif' alt=':-P' class='wp-smiley' title="Easy replace php short open tags with long php open tags photo" /> </pre>
<!-- PHP 5.x -->]]></content:encoded>
			<wfw:commentRss>http://mariusvw.com/2010/03/03/easy-replace-php-short-open-tags-with-long-php-open-tags/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Shellproxy, an easy tool to run shell commands from PHP or other languages</title>
		<link>http://mariusvw.com/2010/03/02/shellproxy-an-easy-tool-to-run-shell-commands-from-php-or-other-languages/</link>
		<comments>http://mariusvw.com/2010/03/02/shellproxy-an-easy-tool-to-run-shell-commands-from-php-or-other-languages/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 19:53:02 +0000</pubDate>
		<dc:creator>mariusvw</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Command]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Proxy]]></category>
		<category><![CDATA[Return]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[Value]]></category>

		<guid isPermaLink="false">http://mariusvw.com/?p=1302</guid>
		<description><![CDATA[This is a simple script that runs a shell command from PHP with the function system(). It sometimes happens that a command doesn't close the stdin or stdout, resulting the system() function to halt and wait for it to finish... This causes PHP to reach the 30 second time limit and kill the script. This [...]]]></description>
			<content:encoded><![CDATA[<p>This is a simple script that runs a shell command from <a href='http://www.php.net' rel='external ' title=''>PHP</a> with the function system().<br />
It sometimes happens that a command doesn't close the stdin or stdout, resulting the system() function to halt and wait for it to finish...<br />
This causes <a href='http://www.php.net' rel='external ' title=''>PHP</a> to reach the 30 second time limit and kill the script.</p>
<p>This script runs it in the background and you could make your commands send their output to a log file and still having full control.</p>
<p>Read the code below how to use it.</p>
<p>You can compile it by placing the code into 'shellproxy.c' and then compile it with the following command:</p>
<p><code>gcc -o shellproxy shellproxy.c</code></p>
<p>I hope this is something useful for you as it was for me.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#include &lt;stdio .h&gt;</span>
<span style="color: #339933;">#include &lt;stdlib .h&gt;</span>
<span style="color: #339933;">#include &lt;string .h&gt;</span>
&nbsp;
<span style="color: #993333;">int</span> main<span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> argc<span style="color: #339933;">,</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>argv<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #993333;">char</span> command<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">1024</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #993333;">int</span> t<span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>argc <span style="color: #339933;">==</span> <span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>Shell Proxy<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;By Marius van Witzenburg &lt;http ://mariusvw.com&gt;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;You will mostly use this program from PHP or any other<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;webscripting language to background run programs<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Usage:<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;- CLI:<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;shellproxy <span style="color: #000099; font-weight: bold;">\&quot;</span>&lt;cmd&gt; &lt;arg&gt;<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;shellproxy <span style="color: #000099; font-weight: bold;">\&quot;</span>&lt;cmd&gt; &lt;arg&gt; &gt; redirect.txt<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;- PHP:<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;system('shellproxy <span style="color: #000099; font-weight: bold;">\&quot;</span>&lt;cmd&gt; &lt;arg&gt; &amp;<span style="color: #000099; font-weight: bold;">\&quot;</span>');<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;system('shellproxy <span style="color: #000099; font-weight: bold;">\&quot;</span>&lt;cmd&gt; &lt;arg&gt; &gt; redirect.txt<span style="color: #000099; font-weight: bold;">\&quot;</span>');<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    command<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span>t <span style="color: #339933;">=</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span> t <span style="color: #339933;">&lt;</span> argc<span style="color: #339933;">;</span> t<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        strcat<span style="color: #009900;">&#40;</span>command<span style="color: #339933;">,</span> argv<span style="color: #009900;">&#91;</span>t<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        strcat<span style="color: #009900;">&#40;</span>command<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot; &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    fclose<span style="color: #009900;">&#40;</span>stdin<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    fclose<span style="color: #009900;">&#40;</span>stdout<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    fclose<span style="color: #009900;">&#40;</span>stderr<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    system<span style="color: #009900;">&#40;</span>command<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>It would be nice if you keep my name mentioned into this code if you use it.</p>
<p>Ps. Donations are welcome... <img src='http://mariusvw.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' title="Shellproxy, an easy tool to run shell commands from PHP or other languages photo" /> </p>
<!-- PHP 5.x -->]]></content:encoded>
			<wfw:commentRss>http://mariusvw.com/2010/03/02/shellproxy-an-easy-tool-to-run-shell-commands-from-php-or-other-languages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Got a new &#8220;Supermicro SATA server 6015B-NTR&#8221; today.</title>
		<link>http://mariusvw.com/2009/11/13/got-a-new-supermicro-sata-server-6015b-ntr-today/</link>
		<comments>http://mariusvw.com/2009/11/13/got-a-new-supermicro-sata-server-6015b-ntr-today/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 14:26:51 +0000</pubDate>
		<dc:creator>mariusvw</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Hosting]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Redundant]]></category>
		<category><![CDATA[SATA]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[Websites]]></category>

		<guid isPermaLink="false">http://mariusvw.com/?p=1152</guid>
		<description><![CDATA[Toys, always welcome Lets see if this baby can host what I want to host on it... Two things that I noticed directly after removing the top case are the double fans. Which means you have a more powerful air throughput and the two USB ports on the motherboard. I must say, again, Supermicro is [...]]]></description>
			<content:encoded><![CDATA[<p>Toys, always welcome <img src='http://mariusvw.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' title="Got a new Supermicro SATA server 6015B NTR today. photo" /> </p>
<p>Lets see if this baby can host what I want to host on it...</p>
<p>Two things that I noticed directly after removing the top case are the double fans. Which means you have a more powerful air throughput and the two USB ports on the motherboard.</p>

<a href='http://mariusvw.com/2009/11/13/got-a-new-supermicro-sata-server-6015b-ntr-today/dsc05472/' title='Supermicro SATA server 6015B-NTR, 00'><img width="150" height="150" src="http://mariusvw.com/wp-content/uploads/2009/11/DSC05472-150x150.jpg" class="attachment-thumbnail" alt="Supermicro SATA server 6015B-NTR, 00" title="Supermicro SATA server 6015B-NTR, 00" /></a>
<a href='http://mariusvw.com/2009/11/13/got-a-new-supermicro-sata-server-6015b-ntr-today/dsc05457/' title='Supermicro SATA server 6015B-NTR, 01'><img width="150" height="150" src="http://mariusvw.com/wp-content/uploads/2009/11/DSC05457-150x150.jpg" class="attachment-thumbnail" alt="Supermicro SATA server 6015B-NTR, 01" title="Supermicro SATA server 6015B-NTR, 01" /></a>
<a href='http://mariusvw.com/2009/11/13/got-a-new-supermicro-sata-server-6015b-ntr-today/dsc05458/' title='Supermicro SATA server 6015B-NTR, 02'><img width="150" height="150" src="http://mariusvw.com/wp-content/uploads/2009/11/DSC05458-150x150.jpg" class="attachment-thumbnail" alt="Supermicro SATA server 6015B-NTR, 02" title="Supermicro SATA server 6015B-NTR, 02" /></a>
<a href='http://mariusvw.com/2009/11/13/got-a-new-supermicro-sata-server-6015b-ntr-today/dsc05459/' title='Supermicro SATA server 6015B-NTR, 03'><img width="150" height="150" src="http://mariusvw.com/wp-content/uploads/2009/11/DSC05459-150x150.jpg" class="attachment-thumbnail" alt="Supermicro SATA server 6015B-NTR, 03" title="Supermicro SATA server 6015B-NTR, 03" /></a>
<a href='http://mariusvw.com/2009/11/13/got-a-new-supermicro-sata-server-6015b-ntr-today/dsc05460/' title='Supermicro SATA server 6015B-NTR, 04'><img width="150" height="150" src="http://mariusvw.com/wp-content/uploads/2009/11/DSC05460-150x150.jpg" class="attachment-thumbnail" alt="Supermicro SATA server 6015B-NTR, 04" title="Supermicro SATA server 6015B-NTR, 04" /></a>
<a href='http://mariusvw.com/2009/11/13/got-a-new-supermicro-sata-server-6015b-ntr-today/dsc05461/' title='Supermicro SATA server 6015B-NTR, 05'><img width="150" height="150" src="http://mariusvw.com/wp-content/uploads/2009/11/DSC05461-150x150.jpg" class="attachment-thumbnail" alt="Supermicro SATA server 6015B-NTR, 05" title="Supermicro SATA server 6015B-NTR, 05" /></a>
<a href='http://mariusvw.com/2009/11/13/got-a-new-supermicro-sata-server-6015b-ntr-today/dsc05462/' title='Supermicro SATA server 6015B-NTR, 06'><img width="150" height="150" src="http://mariusvw.com/wp-content/uploads/2009/11/DSC05462-150x150.jpg" class="attachment-thumbnail" alt="Supermicro SATA server 6015B-NTR, 06" title="Supermicro SATA server 6015B-NTR, 06" /></a>
<a href='http://mariusvw.com/2009/11/13/got-a-new-supermicro-sata-server-6015b-ntr-today/dsc05463/' title='Supermicro SATA server 6015B-NTR, 07'><img width="150" height="150" src="http://mariusvw.com/wp-content/uploads/2009/11/DSC05463-150x150.jpg" class="attachment-thumbnail" alt="Supermicro SATA server 6015B-NTR, 07" title="Supermicro SATA server 6015B-NTR, 07" /></a>
<a href='http://mariusvw.com/2009/11/13/got-a-new-supermicro-sata-server-6015b-ntr-today/dsc05464/' title='Supermicro SATA server 6015B-NTR, 08'><img width="150" height="150" src="http://mariusvw.com/wp-content/uploads/2009/11/DSC05464-150x150.jpg" class="attachment-thumbnail" alt="Supermicro SATA server 6015B-NTR, 08" title="Supermicro SATA server 6015B-NTR, 08" /></a>
<a href='http://mariusvw.com/2009/11/13/got-a-new-supermicro-sata-server-6015b-ntr-today/dsc05466/' title='Supermicro SATA server 6015B-NTR, 10'><img width="150" height="150" src="http://mariusvw.com/wp-content/uploads/2009/11/DSC05466-150x150.jpg" class="attachment-thumbnail" alt="Supermicro SATA server 6015B-NTR, 10" title="Supermicro SATA server 6015B-NTR, 10" /></a>
<a href='http://mariusvw.com/2009/11/13/got-a-new-supermicro-sata-server-6015b-ntr-today/dsc05467/' title='Supermicro SATA server 6015B-NTR, 11'><img width="150" height="150" src="http://mariusvw.com/wp-content/uploads/2009/11/DSC05467-150x150.jpg" class="attachment-thumbnail" alt="Supermicro SATA server 6015B-NTR, 11" title="Supermicro SATA server 6015B-NTR, 11" /></a>
<a href='http://mariusvw.com/2009/11/13/got-a-new-supermicro-sata-server-6015b-ntr-today/dsc05468/' title='Supermicro SATA server 6015B-NTR, 12'><img width="150" height="150" src="http://mariusvw.com/wp-content/uploads/2009/11/DSC05468-150x150.jpg" class="attachment-thumbnail" alt="Supermicro SATA server 6015B-NTR, 12" title="Supermicro SATA server 6015B-NTR, 12" /></a>
<a href='http://mariusvw.com/2009/11/13/got-a-new-supermicro-sata-server-6015b-ntr-today/dsc05469/' title='Supermicro SATA server 6015B-NTR, 13'><img width="150" height="150" src="http://mariusvw.com/wp-content/uploads/2009/11/DSC05469-150x150.jpg" class="attachment-thumbnail" alt="Supermicro SATA server 6015B-NTR, 13" title="Supermicro SATA server 6015B-NTR, 13" /></a>
<a href='http://mariusvw.com/2009/11/13/got-a-new-supermicro-sata-server-6015b-ntr-today/dsc05470/' title='Supermicro SATA server 6015B-NTR, 14'><img width="150" height="150" src="http://mariusvw.com/wp-content/uploads/2009/11/DSC05470-150x150.jpg" class="attachment-thumbnail" alt="Supermicro SATA server 6015B-NTR, 14" title="Supermicro SATA server 6015B-NTR, 14" /></a>
<a href='http://mariusvw.com/2009/11/13/got-a-new-supermicro-sata-server-6015b-ntr-today/dsc05471/' title='Supermicro SATA server 6015B-NTR, 15'><img width="150" height="150" src="http://mariusvw.com/wp-content/uploads/2009/11/DSC05471-150x150.jpg" class="attachment-thumbnail" alt="Supermicro SATA server 6015B-NTR, 15" title="Supermicro SATA server 6015B-NTR, 15" /></a>

<p>I must say, again, Supermicro is nice stuff to see and to have <img src='http://mariusvw.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' title="Got a new Supermicro SATA server 6015B NTR today. photo" /> </p>
<p>Too bad you only have such stuff near you for some hours <img src='http://mariusvw.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' title="Got a new Supermicro SATA server 6015B NTR today. photo" />  Then it goes directly to the datacenter to do its job...</p>
<!-- PHP 5.x -->]]></content:encoded>
			<wfw:commentRss>http://mariusvw.com/2009/11/13/got-a-new-supermicro-sata-server-6015b-ntr-today/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>E_STRICT crashes php if date.timezone is not set in php.ini</title>
		<link>http://mariusvw.com/2009/09/13/e_strict-crashes-php-if-date-timezone-is-not-set-in-php-ini/</link>
		<comments>http://mariusvw.com/2009/09/13/e_strict-crashes-php-if-date-timezone-is-not-set-in-php-ini/#comments</comments>
		<pubDate>Sun, 13 Sep 2009 09:33:28 +0000</pubDate>
		<dc:creator>mariusvw</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Config]]></category>
		<category><![CDATA[Crash]]></category>
		<category><![CDATA[Error]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[Strict]]></category>

		<guid isPermaLink="false">http://mariusvw.com/?p=988</guid>
		<description><![CDATA[In case you use the following in your php.ini: error_reporting = E_ALL &#124; E_STRICT You might notice that if you do a phpinfo() that php crashes the apache child. Reason is a bug in php that causes an infinite loop. You can solve this by setting "date.timezone =" to your timezone. For a list of [...]]]></description>
			<content:encoded><![CDATA[<p>In case you use the following in your <em>php.ini</em>:</p>
<pre>
error_reporting = E_ALL | E_STRICT
</pre>
<p>You might notice that if you do a <em>phpinfo()</em> that php crashes the apache child.</p>
<p>Reason is a bug in php that causes an infinite loop.</p>
<p>You can solve this by setting "<em>date.timezone =</em>" to your timezone.</p>
<p>For a list of timezones check:<br />
<a href="http://www.php.net/datetime">http://www.php.net/datetime</a></p>
<!-- PHP 5.x -->]]></content:encoded>
			<wfw:commentRss>http://mariusvw.com/2009/09/13/e_strict-crashes-php-if-date-timezone-is-not-set-in-php-ini/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Performance &#8211; isset() versus empty() versus PHP Notices</title>
		<link>http://mariusvw.com/2009/07/31/php-performance-isset-versus-empty-versus-php-notices/</link>
		<comments>http://mariusvw.com/2009/07/31/php-performance-isset-versus-empty-versus-php-notices/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 13:00:55 +0000</pubDate>
		<dc:creator>mariusvw</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Empty]]></category>
		<category><![CDATA[Isset]]></category>
		<category><![CDATA[Notice]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://mariusvw.wordpress.com/?p=125</guid>
		<description><![CDATA[Original Posting I’m cleaning up a lot of PHP code and always program with PHP error_reporting set to E_ALL and display_errors turned on so that I make sure to catch any PHP messages that come up. Since starting on this site, I have fixed literally hundreds (maybe thousands) of PHP Notices about using uninitialized variables [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.brandonchecketts.com/archives/php-performance-isset-versus-empty-versus-php-notices">Original Posting</a></p>
<p>I’m cleaning up a lot of <a href='http://www.php.net' rel='external ' title=''>PHP</a> code and always program with <a href='http://www.php.net' rel='external ' title=''>PHP</a> error_reporting set to E_ALL and display_errors turned on so that I make sure to catch any <a href='http://www.php.net' rel='external ' title=''>PHP</a> messages that come up. Since starting on this site, I have fixed literally hundreds (maybe thousands) of <a href='http://www.php.net' rel='external ' title=''>PHP</a> Notices about using uninitialized variables and non-existent array indexes.</p>
<p>I have been fixing problems like this where $somevar is sometimes undefined:</p>
<pre>
if ($somevar)
</pre>
<p>by changing it to:</p>
<pre>
if (isset($somevar) &amp;&amp; $somevar)
</pre>
<p>This successfully gets rid of the NOTICEs, but adds some overhead because <a href='http://www.php.net' rel='external ' title=''>PHP</a> has to perform two checks. After fixing a lot of this in this manner, I’ve noticed that the pages seem to be generated a little slower.</p>
<p>So, to provide some conclusive results to myself, I wrote up a quick benchmarking script - available at <a href="http://www.brandonchecketts.com/downloads/php_empty_benchmark.php">php_empty_benchmark.php</a>. It goes through 1,000,000 tests using each of these methods:</p>
<ol>if ($a) - This generates a notice if $a is not set</ol>
<ol>if (isset($a)) - A simple clean way to check if the variable is set (note that it is not equivalent to the one above)</ol>
<ol>if (isset($a) &amp;&amp; ($a) - The one that I have been using which is equivalent to if($a), but doesn’t generate a notice.</ol>
<ol>if (!empty($a)) - This is functionally equivalent to if($a), but doesn’t generate a notice.</ol>
<p>It measures the time to perform 1 million tests using a defined percentage of values that are set.  It then computes the difference as a percentage of the time taken for the original test (the one that generates the notices).   A ‘diff’ of 100 means that the execution time is the same, greater than 100 means that it is faster, and less than 100 means that it is slower. A typical test produced these results:</p>
<pre>
With NOTICE: 0.19779300689697
With isset:  0.19768500328064 / Diff: 100.05463419811
With both:   0.21704912185669 / Diff: 91.128222590815
With !empty: 0.19779801368713 / Diff: 99.997468735875
</pre>
<p>In summary, using the if (isset($a) &amp;&amp; $a) syntax is about 8-10% slower than generating the <a href='http://www.php.net' rel='external ' title=''>PHP</a> Notice. Using !empty() should be a drop-in replacement that doesn’t generate the notice and has virtually no performance impact. Using ifset() also has no performance impact, but is not exactly the same as ‘if($a)’ since isset() will return true if the variable is set to a false value. I included it here, because it often make the code a little more readable than the !empty($a) syntax. For example:</p>
<pre>
$myvalue = !empty($_REQUEST['myvalue']) ? $_REQUEST['myvalue'] : '';
</pre>
<p>Versus</p>
<pre>
$myvalue = isset($_REQUEST['myvalue']) ? $_REQUEST['myvalue'] : '';
</pre>
<!-- PHP 5.x -->]]></content:encoded>
			<wfw:commentRss>http://mariusvw.com/2009/07/31/php-performance-isset-versus-empty-versus-php-notices/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>400 new avatars added to random avatar script</title>
		<link>http://mariusvw.com/2008/09/28/400-new-avatars-added-to-random-avatar-script/</link>
		<comments>http://mariusvw.com/2008/09/28/400-new-avatars-added-to-random-avatar-script/#comments</comments>
		<pubDate>Sun, 28 Sep 2008 16:35:32 +0000</pubDate>
		<dc:creator>mariusvw</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Avatars]]></category>
		<category><![CDATA[Images]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://mariusvw.com/?p=308</guid>
		<description><![CDATA[Today I have added almost 400 new images to the random avatar script, you can find it under Gadgets, have fun with it!]]></description>
			<content:encoded><![CDATA[<p>Today I have added almost 400 new images to the random avatar script, you can find it under Gadgets, have fun with it!</p>
<!-- PHP 5.x -->]]></content:encoded>
			<wfw:commentRss>http://mariusvw.com/2008/09/28/400-new-avatars-added-to-random-avatar-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New counter for avatar gadget</title>
		<link>http://mariusvw.com/2008/04/28/new-counter-for-avatar-gadget/</link>
		<comments>http://mariusvw.com/2008/04/28/new-counter-for-avatar-gadget/#comments</comments>
		<pubDate>Mon, 28 Apr 2008 09:10:26 +0000</pubDate>
		<dc:creator>mariusvw</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Avatars]]></category>
		<category><![CDATA[Counter]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://mariusvw.com/?p=294</guid>
		<description><![CDATA[Today I wrote a counter into the avatar script. It simply counts the total hits on the script and saves that to the database. I set the counter to the old value of the avatar script. You can see the total views on the info page of the this gadget.]]></description>
			<content:encoded><![CDATA[<p>Today I wrote a counter into the avatar script.</p>
<p>It simply counts the total hits on the script and saves that to the database.</p>
<p>I set the counter to the old value of the avatar script.</p>
<p>You can see the total views on the info page of the this gadget.</p>
<!-- PHP 5.x -->]]></content:encoded>
			<wfw:commentRss>http://mariusvw.com/2008/04/28/new-counter-for-avatar-gadget/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
