<?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>The efnx code blog. &#187; PHP</title>
	<atom:link href="http://efnx.com/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://efnx.com</link>
	<description>code. blog.</description>
	<lastBuildDate>Tue, 15 May 2012 17:46:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>PHP – Nested Tuple</title>
		<link>http://efnx.com/php-nested-tuple/</link>
		<comments>http://efnx.com/php-nested-tuple/#comments</comments>
		<pubDate>Sat, 05 Sep 2009 00:55:02 +0000</pubDate>
		<dc:creator>Schell</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[data structures]]></category>

		<guid isPermaLink="false">http://blog.efnx.com/?p=211</guid>
		<description><![CDATA[Here&#8217;s a quick nested tuple [list of head and tail, where tail is the list minus the head]. I wrote this for a current project I&#8217;m working on. It works with any parameters except one array. If you only pass one array, it will convert your one array into a list of Tuples. &#60;?php /** [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a quick nested tuple [list of head and tail, where tail is the list minus the head]. I wrote this for a current project I&#8217;m working on. It works with any parameters except one array. If you only pass one array, it will convert your one array into a list of Tuples.</p>
<div class="codecolorer-container php twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<span style="color: #009933; font-style: italic;">/**<br />
&nbsp;* Tuple is a list of variables. Really it is a head and a tail, where the tail<br />
&nbsp;* is also a Tuple. (Tuple(n)=head + Tuple(n-1))<br />
&nbsp;*/</span><br />
<br />
<span style="color: #000000; font-weight: bold;">class</span> Tuple<br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000088;">$head</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000088;">$tail</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #000088;">$args</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/is_array"><span style="color: #990000;">is_array</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$args</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <a href="http://www.php.net/func_num_args"><span style="color: #990000;">func_num_args</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// get all the arguments and package them as an array</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$args</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/func_get_args"><span style="color: #990000;">func_get_args</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// take the first element and use that as the head of the list</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">head</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array_shift"><span style="color: #990000;">array_shift</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$args</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// if there are still args left, make a new list and use that as tail</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/count"><span style="color: #990000;">count</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$args</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// pass the remainder</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">tail</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Tuple<span style="color: #009900;">&#40;</span><span style="color: #000088;">$args</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">?&gt;</span></div></div>
<p>Here&#8217;s some usage and output:</p>
<div class="codecolorer-container php twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<span style="color: #000088;">$list</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Tuple<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/print_r"><span style="color: #990000;">print_r</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$list</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>That prints out:</p>
<div class="codecolorer-container php twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Tuple Object<br />
<span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#91;</span>head<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#91;</span>tail<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> Tuple Object<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#91;</span>head<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">2</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#91;</span>tail<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> Tuple Object<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#91;</span>head<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">3</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#91;</span>tail<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> Tuple Object<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#91;</span>head<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">4</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#91;</span>tail<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#41;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#41;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#41;</span><br />
<br />
<span style="color: #009900;">&#41;</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://efnx.com/php-nested-tuple/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Formatting gcc, g++ Output Using PHP In TextMate</title>
		<link>http://efnx.com/formatting-gcc-g-output-using-php-in-textmate/</link>
		<comments>http://efnx.com/formatting-gcc-g-output-using-php-in-textmate/#comments</comments>
		<pubDate>Sat, 20 Sep 2008 22:55:53 +0000</pubDate>
		<dc:creator>Schell</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Shell Scripting]]></category>
		<category><![CDATA[compiler]]></category>

		<guid isPermaLink="false">http://blog.efnx.com/?p=70</guid>
		<description><![CDATA[While at ZendCon08 I saw a lot of people sharing the same love for TextMate as myself. I fricken love TextMate. Some of my friends laughed at me, saying &#8220;Bah, TM&#8217;s not an IDE, why do you want to write shell scripts to try to make it one?&#8221; And I&#8217;d be like, &#8220;I&#8217;m an ActionScript [...]]]></description>
			<content:encoded><![CDATA[<p>While at ZendCon08 I saw a lot of people sharing the same love for TextMate as myself. I fricken love TextMate. Some of my friends laughed at me, saying &#8220;Bah, TM&#8217;s not an IDE, why do you want to write shell scripts to try to make it one?&#8221; And I&#8217;d be like, &#8220;I&#8217;m an ActionScript developer, there&#8217;s no point in using a sledge hammer to pound in nails.&#8221; This makes sense because my friends use Eclipse. I tried Eclipse but it&#8217;s so huge and the plugins are huge and the interface is cluttered and theming syntax-coloring is a pain. So when I got home from ZendCon, with my renewed love for PHP, and my continual quest to eventually be a good C programmer, I decided to write a gcc parser script that linked back into TextMate to go directly to my errors. I use a dark syntax theme, a slightly modded Amy, and the parser reflects that. Check out a picture of these gcc errors:<br />
<div id="attachment_71" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.efnx.com/wp-content/uploads/2008/09/phpgccparse.png" rel="lightbox"><img src="http://blog.efnx.com/wp-content/uploads/2008/09/phpgccparse.png" alt="Picture of colored gcc output." title="phpgccparser" width="300" height="187" class="size-medium wp-image-71" /></a><p class="wp-caption-text">Picture of colored gcc output.</p></div><br />
To do this you&#8217;ll need <a href="http://php.net">PHP</a> installed on your machine. After that, the first step is to create a new command in TextMate&#8217;s C Bundle. Call it &#8220;Build, Format With PHP,&#8221; or anything else. Set it to save all files in the project when run [from the pull down at the top] now enter this into the text area:</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">FILE</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">basename</span> <span style="color: #800000;">${TM_FILEPATH}</span><span style="color: #000000; font-weight: bold;">`</span><br />
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">DIR</span>=<span style="color: #800000;">${TM_PROJECT_DIRECTORY}</span><br />
~<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Application\ Support<span style="color: #000000; font-weight: bold;">/</span>TextMate<span style="color: #000000; font-weight: bold;">/</span>Support<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>make_format_gcc.sh</div></div>
<p>Next select Output as &#8220;Show as HTML&#8221; so we can see our output. Now create a file called &#8220;make_format_gcc.sh&#8221; in the folder ~/Library/Application Support/TextMate/Support/bin/<br />
Once you&#8217;ve created the file, use TM or vim to fill it with this:</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #000000; font-weight: bold;">&amp;&gt;</span> <span style="color: #800000;">${FILE}</span>.mkout<br />
php <span style="color: #660033;">-f</span> ~<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Application\ Support<span style="color: #000000; font-weight: bold;">/</span>TextMate<span style="color: #000000; font-weight: bold;">/</span>Support<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>gcc_format.php <span style="color: #800000;">${FILE}</span> <span style="color: #800000;">${DIR}</span></div></div>
<p>This bash script executes the make on the makefile and directs the standard and error output to the same file. Then the script calls php to parse and display the file. So now create a file named &#8220;gcc_format.php&#8221; in the same folder as make_format_gcc.sh and fill it with the meat of our parser:</p>
<div class="codecolorer-container php twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// get stdout and stderr then delete temp file</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$dir</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$argv</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$commandFile</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$argv</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'.mkout'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$commands</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/file_get_contents"><span style="color: #990000;">file_get_contents</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$commandFile</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// break lines up by line ending</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$lines</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/explode"><span style="color: #990000;">explode</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$commands</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// find errors and link them to pages and line number</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$errors</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">&lt;</span> <a href="http://www.php.net/count"><span style="color: #990000;">count</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$lines</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$fnpos</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/strpos"><span style="color: #990000;">strpos</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$lines</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">':'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$filename</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$lines</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$fnpos</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$lnpos</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/strpos"><span style="color: #990000;">strpos</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$lines</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">': error:'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$linestart</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$lnpos</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$fnpos</span> <span style="color: #339933;">-</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$linestart</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">continue</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$line</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$lines</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$fnpos</span><span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #000088;">$lnpos</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$fnpos</span> <span style="color: #339933;">-</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$link</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;txmt://open/?url=file://<span style="color: #006699; font-weight: bold;">$dir</span>/<span style="color: #006699; font-weight: bold;">$filename</span>&amp;line=<span style="color: #006699; font-weight: bold;">$line</span>&amp;column=1&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$lines</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/substr_replace"><span style="color: #990000;">substr_replace</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$lines</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;/a&gt;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$lnpos</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$lines</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;a href=<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #006699; font-weight: bold;">$link</span><span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$lines</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$errors</span><span style="color: #339933;">++;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$output</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/implode"><span style="color: #990000;">implode</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;br /&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$lines</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'<br />
&nbsp; &nbsp; &lt;html&gt;<br />
&nbsp; &nbsp; &lt;head&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;style type=&quot;text/css&quot;&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; body &nbsp; &nbsp;{background:#000000; color:#999999;}<br />
&nbsp; &nbsp; &nbsp; &nbsp; #comment{width:100%; background: #230021; color:#6060BF;}<br />
&nbsp; &nbsp; &nbsp; &nbsp; #fail &nbsp; {width:100%; background:#3E0018; color:#9918B8;}<br />
&nbsp; &nbsp; &nbsp; &nbsp; #succ &nbsp; {width:100%; background:#230021; color:#B0FFF0;}<br />
&nbsp; &nbsp; &nbsp; &nbsp; dslsh &nbsp; {color:#A96AA9;}<br />
&nbsp; &nbsp; &nbsp; &nbsp; a:link &nbsp;{color:#008080;}<br />
&nbsp; &nbsp; &nbsp; &nbsp; a:hover {color:#80A0FF;}<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;/style&gt;<br />
&nbsp; &nbsp; &lt;/head&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;body&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div id=&quot;comment&quot;&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;dslsh&gt;//&lt;/dslsh&gt; '</span><span style="color: #339933;">.</span> <span style="color: #000088;">$argv</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">'\'s build results:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/div&gt;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$output</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;br /&gt;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$errors</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;div id=&quot;fail&quot;&gt;Build failed with '</span><span style="color: #339933;">.</span> <span style="color: #000088;">$errors</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">' errors.&lt;/div&gt;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;div id=&quot;succ&quot;&gt;Build Succeeded!&lt;/div&gt;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">echo</span><span style="color: #0000ff;">'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;/body&gt;<br />
&nbsp; &nbsp; &lt;/html&gt;'</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">?&gt;</span></div></div>
<p>This example assumes that you are working in a directory with a makefile, but I&#8217;m sure it can be easily modded to work with any build script. The colors reflect my favorite theme, but they should also be easily modded with lines 32-38 of the php script. Happy coding, peoples!</p>
]]></content:encoded>
			<wfw:commentRss>http://efnx.com/formatting-gcc-g-output-using-php-in-textmate/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>ZendCon 08</title>
		<link>http://efnx.com/zendcon-08/</link>
		<comments>http://efnx.com/zendcon-08/#comments</comments>
		<pubDate>Thu, 18 Sep 2008 22:18:15 +0000</pubDate>
		<dc:creator>Schell</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[convention]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.efnx.com/?p=68</guid>
		<description><![CDATA[I just got back from ZendCon 2008 and it was pretty fun. Much more fun than a typical work week. I got to learn a lot about the new features of PHP, some common and not so common security pitfalls and I met a lot of rad programmers. The highlight for me though, was the [...]]]></description>
			<content:encoded><![CDATA[<p>I just got back from ZendCon 2008 and it was pretty fun. Much more fun than a typical work week. I got to learn a lot about the new features of PHP, some common and not so common security pitfalls and I met a lot of rad programmers. The highlight for me though, was the Yahoo party. Yahoo raffled off a Nintendo Wii, which I happened to win! When I went to pick it up from the rafflers the crowd of PHP developers started shouting &#8220;Speech! Speech!&#8221; So I stood up on a chair and told them I was an AS3 developer, and they promptly booed me down. I escaped unscathed, with the Wii.</p>
<p><img src="http://farm4.static.flickr.com/3106/2867225229_6ba3c84998.jpg?v=0" /></p>
<p><img src="http://farm4.static.flickr.com/3183/2867667466_6083218aff.jpg?v=0" /></p>
<p>Look at that happy lad! Time to get this thing ready for some homebrew apps.</p>
]]></content:encoded>
			<wfw:commentRss>http://efnx.com/zendcon-08/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

