<?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>What&#039;s In The Box?</title>
	<atom:link href="http://leftnode.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://leftnode.com</link>
	<description>Software Development .plan for Vic Cherubini</description>
	<lastBuildDate>Tue, 09 Mar 2010 10:55:38 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Refactoring a few Jolt tests</title>
		<link>http://leftnode.com/refactoring-a-few-jolt-tests/</link>
		<comments>http://leftnode.com/refactoring-a-few-jolt-tests/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 10:55:38 +0000</pubDate>
		<dc:creator>Vic Cherubini</dc:creator>
				<category><![CDATA[Jolt]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://leftnode.com/?p=800</guid>
		<description><![CDATA[ZDC is a much more talented developer than I am, so I frequently throw my code his way for review. In reviewing some of the tests I wrote for Jolt, he had some criticisms. One test in particular, testRouteNamesAreValid(), was quite smelly.
It was incredibly verbose and tested two things at once: valid named routes and [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://sanitycheckfail.com/">ZDC</a> is a much more talented developer than I am, so I frequently throw my code his way for review. In reviewing some of the tests I wrote for Jolt, he had some criticisms. One test in particular, <a href="http://github.com/leftnode/Jolt/blob/88c7a0215654c7932f99619bec1b08d4d92096b7/Tests/JoltCore/Route/Route/NamedTest.php">testRouteNamesAreValid()</a>, was quite smelly.</p>
<p>It was incredibly verbose and tested two things at once: valid named routes and invalid named routes. He suggested I refactor it to use a <a href="http://www.phpunit.de/manual/3.4/en/writing-tests-for-phpunit.html#writing-tests-for-phpunit.data-providers">data provider</a> and to split it up into two distinct test. The updated code is much more concise, easier to read, and more descriptive.</p>
<p>Read the <a href="http://github.com/leftnode/Jolt/blob/bf3539573f165f061da7dd6dd6848e2343d28c75/Tests/JoltCore/Route/Route/NamedTest.php">new unit tests</a> to see what I changed. Adding a new route to test as either valid or invalid is now simply adding another element to the array in either of the data providers.</p>
<p>I used this method in a few other test classes as well to test exceptions are being thrown properly.</p>
<p>Writing Unit Tests has definitely tested my discipline as a developer more than any other tool I&#8217;ve ever used. As I&#8217;m becoming more familiar with them, they&#8217;ll become second nature like using source control. If you&#8217;re not using them, do yourself a favor and add them to your toolbelt.</p>
]]></content:encoded>
			<wfw:commentRss>http://leftnode.com/refactoring-a-few-jolt-tests/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Jolt Routing</title>
		<link>http://leftnode.com/jolt-routing/</link>
		<comments>http://leftnode.com/jolt-routing/#comments</comments>
		<pubDate>Sun, 07 Mar 2010 23:11:48 +0000</pubDate>
		<dc:creator>Vic Cherubini</dc:creator>
				<category><![CDATA[Jolt]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://leftnode.com/?p=786</guid>
		<description><![CDATA[This is a valid article, and is considered technically accurate up to March 7, 2010.
Over the weekend, I worked on the routing code for Jolt. Following a strict TDD design, I wrote the tests first and then wrote the code to match the tests.
I primarily worked on the Named Route code. Jolt will have two [...]]]></description>
			<content:encoded><![CDATA[<div class="valid">This is a valid article, and is considered technically accurate up to March 7, 2010.</div>
<p>Over the weekend, I worked on the routing code for <a href="http://joltcore.org">Jolt</a>. Following a strict TDD design, I wrote the tests first and then wrote the code to match the tests.</p>
<p>I primarily worked on the Named Route code. Jolt will have two types of routes: Named and RESTful. Named Routes are exactly that, they&#8217;re explicitly specified and can be routed to any controller and action. They do have a specific format, and they won&#8217;t let you create a route if the format is invalid.</p>
<h2>Named Routing</h2>
<p>Take the example of a simple messaging application. You want to send messages to the server, but don&#8217;t wish to use a purely RESTful interface. Simply create a create-message and send-message route and you&#8217;re on your way.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">namespace</span> Jolt<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$router_config</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
  <span style="color: #0000ff;">'site_root'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'http://joltcore.org'</span><span style="color: #339933;">,</span>
  <span style="color: #0000ff;">'site_root_secure'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'https://joltcore.org'</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$named_route_list</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
  <span style="color: #000000; font-weight: bold;">new</span> Named_Route<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/create-message'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Message'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'create'</span><span style="color: #339933;">,</span> Route<span style="color: #339933;">::</span><span style="color: #004000;">METHOD_POST</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
  <span style="color: #000000; font-weight: bold;">new</span> Named_Route<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/send-message/%d/%d'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Message'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'send'</span><span style="color: #339933;">,</span> Route<span style="color: #339933;">::</span><span style="color: #004000;">METHOD_POST</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$router</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Router<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$router</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setConfig</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$router_config</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$router</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setNamedList</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$named_route_list</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$router</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">dispatch</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>All calls to http://joltcore.com/create-message through a POST method along with any associated data (which the controller is responsible for loading) will be passed to the <strong>Message</strong> controller and the <strong>create()</strong> action. If the method is called through GET, an HTTP 400<sup>[<a href="#reference-1">#1</a>]</sup> will be returned because it is a bad request.</p>
<p>Additionally, a call made to http://joltcore.org/send-message/10/18 through a POST method will call the <strong>Message</strong> controller and the <strong>send()</strong> action, which would, for example, send the last created message from User #10 to User #18.</p>
<p>As you can see, Named Routes are clearly very powerful. All named routes must start with a &#8220;/&#8221; and can be nested infinitely. Values can be replaced with normal printf() replacements: %d for digits, %s for strings would be the most common.</p>
<h2>RESTful Routing</h2>
<p>RESTful routing is very powerful, but less flexible than Named routing. RESTful routing lets you define a route and a resource. From there, Jolt handles everything else. Assuming the setup from above, adding a RESTful route for managing Users would be simple.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$restful_route_list</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
  <span style="color: #000000; font-weight: bold;">new</span> Restful_Route<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'User'</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$router</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setRestfulRouteList</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$restful_route_list</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>By defining the <strong>User</strong> resource as RESTful, several methods will be automatically available.</p>
<ul>
<li>http://joltcore.org/user GET &#8211; <em>Get a list of all User models (objects).</em></li>
<li>http://joltcore.org/user/1 GET &#8211; <em>Retrieve data for a specific user.</em></li>
<li>http://joltcore.org/user POST &#8211; <em>Create a new user.</em></li>
<li>http://joltcore.org/user/1 PUT &#8211; <em>Update a user&#8217;s data.</em></li>
<li>http://joltcore.org/user/1 DELETE &#8211; <em>Delete a user.</em></li>
<li>http://joltcore.org/user DELETE &#8211; <em>Delete all users.</em></li>
</ul>
<p>You&#8217;ll be expected to write the actual controller to handle these requests. Following a formal RESTful interface, you should not add additional resources. If they are required, please us a Named route.</p>
<p>All routes will take into account the Accept and Content-Type HTTP headers. The resulting controller will then use these to determine the format of the incoming data and the format of the result data. Additionally, each controller will return the correct HTTP status code.</p>
<p>Routes can accept multiple formats as well. If the Content-Type header specifies the incoming data is <em>text/json</em> and wants the data back as XML (the Accept header specifies <em>text/xml</em>), the controller will be able to handle that. </p>
<h2>Conclusion</h2>
<p>Building an application in Jolt will be seamless and easy. Bundled with the framework is a set of tools to facilitate this. One command line tool, <em>jolt-app</em> will read in your list of Routes and build all of the controller and action skeletons for them. It is my hope you&#8217;ll become an active and interested participant in the Jolt project. Please follow it on <a href="http://github.com/leftnode/Jolt">Github</a> or <a href="/feed/">subscribe to this blog</a>.</p>
<h2>References</h2>
<ol>
<li><a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html" name="reference-1">HTTP/1.1: Status Code Definitions</a></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://leftnode.com/jolt-routing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Moving Forward as a PHP Developer</title>
		<link>http://leftnode.com/moving-forward-as-a-php-developer/</link>
		<comments>http://leftnode.com/moving-forward-as-a-php-developer/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 13:02:24 +0000</pubDate>
		<dc:creator>Vic Cherubini</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://leftnode.com/?p=758</guid>
		<description><![CDATA[This is a valid article, and is considered technically accurate up to March 1, 2010.
Programmers are (generally) defined by the language they know best or use most frequently. I&#8217;m a PHP programmer, John Resig is a JavaScript programmer, DHH is a Ruby programmer, and Randal Schwartz is a Perl programmer. Every programmer needs to know [...]]]></description>
			<content:encoded><![CDATA[<div class="valid">This is a valid article, and is considered technically accurate up to March 1, 2010.</div>
<p>Programmers are (generally) defined by the language they know best or use most frequently. I&#8217;m a PHP programmer, John Resig is a JavaScript programmer, DHH is a Ruby programmer, and Randal Schwartz is a Perl programmer. Every programmer needs to know several languages to be successful, but programmers usually know one or two very well.</p>
<p>Right now, <a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=380731">PHP is not very respected</a>. As a PHP developer, hearing language like that frankly hurts.</p>
<blockquote><p>We have to put up with php as a language for web apps, but it&#8217;s a rotten language whose use should not be encouraged.  Or supported beyond what&#8217;s necessary.</p></blockquote>
<p><em>Ouch.</em> Hearing that the language I use daily, make my living with, and the one I want to build a <a href="http://joltcore.org">really cool framework</a> in is &#8220;rotten&#8221; sucks. One might respond that it shouldn&#8217;t matter what other people think about your language of choice, and I suppose I really shouldn&#8217;t, but also implied in that statement is that not only the language sucks, but the developers who use that language suck. And that does hurt.</p>
<p>The PHP namespace (of developers) is filled with a lot of cruft, but there is also some great PHP code written. While there&#8217;s no concrete way to describe what is <em>rotten code</em>, I would venture to say most of the PHP released is rotten (I&#8217;ve personally worked with some of the worst PHP out there). This is mainly what gives us a bad name. Poor code can be written in any language, however. Many argue that PHP allows you to do that easier, but I don&#8217;t think it&#8217;s PHP that lets you do that. I believe it&#8217;s the entire stack of applications: you can begin writing PHP programs in minutes on any system. Combine that with inexperience, and you have a strong force to be reckoned with. An inexperienced developer can write a very usable application in PHP very quickly, release it to the world, let it become popular, and then watch as its ripped apart by crackers; the same isn&#8217;t true for C, C++, or Java for example.</p>
<p>So, what should PHP developers do about this? Can we make the language respected? Can we make PHP developers respected? Let&#8217;s analyze some ways we can do this.</p>
<h2>Break Everything</h2>
<p>PHP7 should break everything. PHP developers are used to things breaking between releases, but the PHP team should announce that PHP7 will most likely break everything. PHP7 will be a highly respected language, and in doing so, it will not allow a lot of backward compatibility. Here&#8217;s how.</p>
<ul>
<li><strong>Create a concrete, core language.</strong> Remove all library methods, and keep centralized core methods on objects. You should be able to compile PHP7 without any external libraries or extensions and have a nice complete language for basic input/output, string manipulation, and math. Anything outside of that should come through approved extensions.</li>
<li><strong>Treat everything as an object.</strong> Take from Ruby, Smalltalk, and (mostly) Java and treat everything as an object. Integers are objects, strings are objects, and each of them have methods that can operate on them. I don&#8217;t believe PHP needs the ideas of Ruby and Smalltalk where objects pass messages between each other; calling methods on objects is fine.</li>
<li><strong>Consistent naming of methods and classes.</strong> Because one of the biggest complaints of PHP is constantly having to check if its (needle, haystack) or (haystack, needle), or some_function(), or function_some(), or someFunction(), a consistent format needs to be chosen. I prefer camelCase, but will live with whatever decision is chosen.</li>
<li><strong>Make things strict.</strong> Try to pass a string as a float to a method? That&#8217;s a warning. Let me use strict/static typing if I want to. Let me define a method with a return type and throw an error if the value returned isn&#8217;t that type.</li>
<li><strong>Everything is Unicode.</strong> I believe in PHP6 all strings are Unicode, but if not PHP7 should ensure this.</li>
<li><strong>Central start point.</strong> Create a Main or Init class where all code execution originates from.</li>
<li><strong>Clean up the C code.</strong> I&#8217;m not a C expert, but if you compare the Ruby C code to the PHP C code, it&#8217;s easy to understand the internals of Ruby over PHP. I would love that for PHP so I could begin writing my own extensions easier.</li>
<li><strong>Get rid of eval().</strong> eval() is evil. If you&#8217;re using it, something is wrong.
<li><strong>Support operator overloading.</strong> Because everything are objects, operators are simply methods on objects. Thus, I could have the + operator do something entirely different on an object.</li>
<li><strong>Allow method signatures.</strong> Allow true method signatures, so programmers can have methods of the same name with a different argument list or return type.

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> A <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">public</span> int <span style="color: #000000; font-weight: bold;">function</span> doSomething<span style="color: #009900;">&#40;</span>int <span style="color: #000088;">$a</span><span style="color: #339933;">,</span> float <span style="color: #000088;">$b</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    int <span style="color: #000088;">$c</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$a</span> <span style="color: #339933;">*</span> <span style="color: #000088;">$b</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">to_int</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Same as $a-&gt;*($b-&gt;to_int());</span>
    <span style="color: #b1b100;">return</span> <span style="color: #000088;">$c</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> float <span style="color: #000000; font-weight: bold;">function</span> doSomething<span style="color: #009900;">&#40;</span>int <span style="color: #000088;">$a</span><span style="color: #339933;">,</span> float <span style="color: #000088;">$b</span><span style="color: #339933;">,</span> float <span style="color: #000088;">$c</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    float <span style="color: #000088;">$d</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$a</span> <span style="color: #339933;">*</span> <span style="color: #000088;">$b</span> <span style="color: #339933;">*</span> <span style="color: #000088;">$c</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Same as calling $a-&gt;*($b-&gt;*($c)); since * is a method on each object $a and $b.</span>
    <span style="color: #b1b100;">return</span> <span style="color: #000088;">$d</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

</li>
<li><strong>Build a PHP Virtual Machine (PVM).</strong> I&#8217;m not entirely sure this is possible as I&#8217;m not a language designer, but it would be nice to have a PHP Virtual Machine. It could execute PHP bytecode, and allow an explicit heap and stack.</li>
<li><strong>Remove copy-on-write (COW).</strong> COW is a fairly foreign concept to newer developers, and can cause problems if you&#8217;re not aware it exists. With a PVM, PHP could have an explicit stack and heap, allowing programmers to declare variables statically on the stack, and dynamically on the heap. The garbage collector would then collect variables on the heap.</li>
<li><strong>Publish an official PHP spec.</strong> Similar to the W3C HTML5 spec, but much more concise and designed by a smaller committee, the PHP spec would allow developers to implement their own versions of PHP and would ensure there&#8217;s concrete examples to compile against.</li>
</ul>
<h2>Respect the Language</h2>
<p>An effort should be made to get the language respected. We should try to recruit developers who can be very vocal about great features of PHP7. We should release great code that&#8217;s secure, simple to read, and teach new developers the right way to do things. PEAR should be cleaned up, and a great set of core libraries written in PHP7 should be released.</p>
<p>If we can get higher profile developers to <em>respect</em> the language, we&#8217;ll be in the right direction. They don&#8217;t have to use the language, but just some mutual respect. I&#8217;m not crazy about Ruby, but I respect the language. I see it&#8217;s power, and I see where Ruby on Rails is a very nice framework, it&#8217;s just not my favorite. If we could get high profile developers (say, Martin Fowler) to endorse or respect the language, it would go far in a lot of people&#8217;s eyes.</p>
<h2>Respected Developers</h2>
<p>Continuing from above, we need a core team of very highly respected PHP developers. As they release code, give talks, and show people the &#8220;right way&#8221; to do things, this team will grow and soon many developers will be respected. Similar to what John Resig has done to JavaScript, these developers would do with PHP. Take the language to new heights and show how powerful it can be.</p>
<h2>Conclusion</h2>
<p>I&#8217;m excited about the future of PHP. I highly doubt any of my ideas would be implemented, but I truly believe they&#8217;d help the community as a whole. I was very excited when PHP announced HipHop-PHP. Having the second largest website in the world announce they were helping the PHP community that much is great. PHP isn&#8217;t going away, there&#8217;s simply too much code written in it to go away for a long time. However, lets try to improve it at each release, and maybe one day, it will be a highly respected language.</p>
<p>Finally, I&#8217;m not a language designer. My ideas could be entirely horseshit, or valid. If I&#8217;m incorrect somewhere, please politely let me know and I&#8217;ll be happy to talk about it. Let&#8217;s work together to make PHP a well respected, powerful, fast, and efficient language.</p>
<p>Happy hacking.</p>
]]></content:encoded>
			<wfw:commentRss>http://leftnode.com/moving-forward-as-a-php-developer/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>git-daemon Startup Script</title>
		<link>http://leftnode.com/git-daemon-startup-script/</link>
		<comments>http://leftnode.com/git-daemon-startup-script/#comments</comments>
		<pubDate>Sat, 27 Feb 2010 15:43:58 +0000</pubDate>
		<dc:creator>Vic Cherubini</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://leftnode.com/?p=748</guid>
		<description><![CDATA[This is a valid article, and is considered technically accurate up to Feb. 27, 2010
I&#8217;m hosting Jolt&#8217;s Git repository on my server rather than using Github. To do this, I&#8217;m using Gitosis, a small and efficient program in Python to manage your Git repositories. The brilliant thing about Gitosis is it uses Git to manage [...]]]></description>
			<content:encoded><![CDATA[<div class="valid">This is a valid article, and is considered technically accurate up to Feb. 27, 2010</div>
<p>I&#8217;m hosting Jolt&#8217;s Git repository on my server rather than using Github. To do this, I&#8217;m using Gitosis, a small and efficient program in Python to manage your Git repositories. The brilliant thing about Gitosis is it uses Git to manage your repositories. You can <a href="http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way">learn to properly host your Git repositories</a> quickly and easily.</p>
<p>What that article doesn&#8217;t mention is how to start up and shutdown the git-daemon properly on an Ubuntu system. The git-daemon program is what is used to serve a Git repository. I wrote a small init script to handle starting and stopping git-daemon. Place this script in /etc/init.d/ as <strong>gitd</strong> and make sure it is executable (chmod +x gitd).</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
&nbsp;
<span style="color: #007800;">BIN</span>=git-daemon
<span style="color: #007800;">USER</span>=git
<span style="color: #007800;">GITDIR</span>=<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>git
<span style="color: #007800;">REPODIR</span>=<span style="color: #007800;">$GITDIR</span><span style="color: #000000; font-weight: bold;">/</span>repositories<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #007800;">PIDFILE</span>=<span style="color: #007800;">$GITDIR</span><span style="color: #000000; font-weight: bold;">/</span>.git-daemon-pid
&nbsp;
<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #000000; font-weight: bold;">in</span>
  <span style="color: #666666; font-style: italic;"># Start command</span>
  start<span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Starting <span style="color: #007800;">$BIN</span>&quot;</span>
    <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #660033;">-u</span> <span style="color: #007800;">$USER</span> <span style="color: #007800;">$BIN</span> <span style="color: #660033;">--base-path</span>=<span style="color: #007800;">$REPODIR</span> <span style="color: #660033;">--pid-file</span>=<span style="color: #007800;">$PIDFILE</span> <span style="color: #000000; font-weight: bold;">&amp;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$BIN</span> started successfully&quot;</span>
  <span style="color: #000000; font-weight: bold;">;;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;"># Stop command</span>
  stop<span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Stopping <span style="color: #007800;">$BIN</span>&quot;</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$PIDFILE</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
      <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #660033;">-u</span> <span style="color: #007800;">$USER</span> <span style="color: #c20cb9; font-weight: bold;">kill</span> <span style="color: #660033;">-9</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #007800;">$PIDFILE</span><span style="color: #000000; font-weight: bold;">`</span>
      <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #660033;">-u</span> <span style="color: #007800;">$USER</span> <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$PIDFILE</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$BIN</span> stopped successfully&quot;</span>
  <span style="color: #000000; font-weight: bold;">;;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Usage: /etc/init.d/gitd {start|stop}&quot;</span>
    <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
  <span style="color: #000000; font-weight: bold;">;;</span>
<span style="color: #000000; font-weight: bold;">esac</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span></pre></div></div>

<p>Change the directories to wherever you have Gitosis installed. Install the script by running update-rc.d.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">update-rc.d gitd defaults</pre></div></div>

<p>And now it will be executed on startup and shutdown.</p>
]]></content:encoded>
			<wfw:commentRss>http://leftnode.com/git-daemon-startup-script/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Nope, that&#8217;s what I charge</title>
		<link>http://leftnode.com/nope-thats-what-i-charge/</link>
		<comments>http://leftnode.com/nope-thats-what-i-charge/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 12:18:14 +0000</pubDate>
		<dc:creator>Vic Cherubini</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://leftnode.com/?p=734</guid>
		<description><![CDATA[I do freelance work from time to time to pick up some extra money for my family. It&#8217;s generally not much, just small changes here and there on mostly existing websites. Rarely I write software from scratch for a client. I always get a surprised look when I explain how much I charge. I generally [...]]]></description>
			<content:encoded><![CDATA[<p>I do freelance work from time to time to pick up some extra money for my family. It&#8217;s generally not much, just small changes here and there on mostly existing websites. Rarely I write software from scratch for a client. I always get a surprised look when I explain how much I charge. I generally use my hourly rate to determine an overall cost for the project as well (if the project is very large, I&#8217;ll give an estimated project price). I&#8217;ll do my best to determine the number of hours I think it&#8217;ll take to complete it and multiply it by my hourly rate.</p>
<p>My last bid was for changing some functionality of an existing shopping cart built on Joomla and VirtueCart. I&#8217;m not familiar with either of those platforms (from a developers perspective, I&#8217;ve taken cursory glances at both), so doing the changes the client wanted was going to take longer. That learning experience will be passed on to the client. When doing freelance work, you should treat yourself as an individual corporation (and if you&#8217;re not incorporated, you should be). Corporations generally don&#8217;t do things for free, and you shouldn&#8217;t either.</p>
<p>I also build software correctly. Even if I&#8217;m just working alone, I try to maintain an agile approach. I write tests (this is definitely my weak spot, but I&#8217;m rapidly improving), I track bugs, I use source control. If you&#8217;re not doing these things, you&#8217;re not building software correctly. That work is time passed on to the client. If you, the client, wish for properly developed software, you will have to pay for it.</p>
<p>VirtueCart is horribly written. I can tell it&#8217;s horribly written just by glancing at it. I&#8217;ve been writing PHP for 10 years now, I know what crap PHP looks like quickly (conversely, I know what <em>great</em> PHP looks like quickly, and it&#8217;s very possible to write great PHP). The code [VirtueCart] is typical PHP garbage, very little coding standards, globals littered everywhere, no true object oriented design, etc. (Joomla has a test suite, and seems much better architected). There&#8217;s very little design that went into VirtueCart&#8217;s development, and it appears to be a horrible experience to work with. Having to work in that environment is going to cost the customer. Some refactoring will be required to make the software bearable, which will cost the client.</p>
<p>In the end, I lost the bid (fortunately). What was unfortunate was this <em>was</em> functionality the customer really wanted. This means they&#8217;ll approach a cheaper developer to get it completed. Hopefully, the developer maintains a high level of development standards, but it seems like in the web world, that just doesn&#8217;t happen often.</p>
<p>When I first started to learn about agile approaches and test driven development, the ideas sounded absurd: no client is going to <em>pay</em> for that! They throw a fit when it costs them even the slightest change. But that&#8217;s not how it works. If you wish to have properly developed software, you need to spend the money to get it. There is too much <em>shit</em> out there, and it&#8217;s only going to get worse unless developers become active, passionate, and involved in their craft. The client does not have to understand or know you&#8217;re writing unit tests, they simply need to know how much it will cost them.</p>
<p>Software development should not be a &#8220;thing I do for a living&#8221;. It should be your passion. If it&#8217;s not, please leave the industry and find something else to do. I charge what I do because software development is my passion, and not one I take lightly.</p>
<p>So, yes, that is what I charge, no, I&#8217;m not changing it: take it or leave it.</p>
]]></content:encoded>
			<wfw:commentRss>http://leftnode.com/nope-thats-what-i-charge/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Jolt Interceptors</title>
		<link>http://leftnode.com/jolt-interceptors/</link>
		<comments>http://leftnode.com/jolt-interceptors/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 12:15:01 +0000</pubDate>
		<dc:creator>Vic Cherubini</dc:creator>
				<category><![CDATA[Jolt]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://leftnode.com/?p=724</guid>
		<description><![CDATA[This is a valid article, and is considered technically accurate up to Feb. 22, 2010
Interceptors will be a new feature added to Jolt. When dealing with a classic Model-View Controller, the Router should determine both the type of content coming in (via the Content-Type header), and the type of data the client with accept (via [...]]]></description>
			<content:encoded><![CDATA[<div class="valid">This is a valid article, and is considered technically accurate up to Feb. 22, 2010</div>
<p>Interceptors will be a new feature added to Jolt. When dealing with a classic Model-View Controller, the Router should determine both the type of content coming in (via the Content-Type header), and the type of data the client with accept (via the Accept header).</p>
<p>If an HTTP/1.1 request contains these headers, the RESTful application should respond correctly.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">Content-Type: text/json
Accept: text/json</pre></div></div>

<p>The MIME-type application/json is also valid, I believe. The Router needs to interpret this headers and tell the Controller how to respond accordingly. Of course, the default Content-Type and Accept headers are text/html in Jolt, but in the cases when they are different, what should be done?</p>
<p>The concept of Interceptors are introduced. An Interceptor takes the resulting object from the Controller and determines what View to send it to and how. By default, an Interceptor will take the entire Model and turn it into the appropriate type.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> User_Controller <span style="color: #000000; font-weight: bold;">extends</span> Jolt_Controller <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> bookListGet<span style="color: #009900;">&#40;</span><span style="color: #000088;">$user_id</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// Assuming the Accept header is text/json, Content-Type is normal text/html</span>
    <span style="color: #000088;">$user</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> User<span style="color: #009900;">&#40;</span><span style="color: #000088;">$user_id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$book_list</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getBookList</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// Render accordingly</span>
    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">book_list</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$book_list</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">render</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'book-list'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The <strong>render()</strong> method will know what type of content the client accepts. If it&#8217;s the default HTML, that View will be loaded, rendered, and returned. In this example, the JSON Interceptor would turn the $book_list object (or array) into a JSON object and return that to the client.</p>
<p>What if the resource were to only return a single object? How might that look?</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> Post_Controller <span style="color: #000000; font-weight: bold;">extends</span> Jolt_Controller <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> postGet<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post_id</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$post</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Post<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post_id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$post</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">render</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'post'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The client would receive a JSON object that contains the post data.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #009900;">&#123;</span><span style="color: #3366CC;">&quot;date_create&quot;</span><span style="color: #339933;">:</span><span style="color: #CC0000;">1266926552</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;date_modify&quot;</span><span style="color: #339933;">:</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;title&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;My First Post&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;content&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;Here is the body of my first post.&quot;</span><span style="color: #009900;">&#125;</span></pre></div></div>

<p>This is a fairly straight-forward example, but what if you didn&#8217;t want the date_create or date_modify fields returned in the object? The default JSON Interceptor does a 1:1 conversion between a PHP object and JSON.</p>
<p>An extended Interceptor would be written for that resource that would remove those fields.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> Post_Interceptor <span style="color: #000000; font-weight: bold;">extends</span> Jolt_Interceptor_Json <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> run<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// $this-&gt;post is the object from above passed into here.</span>
    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">remove</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'date_create'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'date_modify'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// Encode everything to JSON and return it to the client.</span>
    parent<span style="color: #339933;">::</span><span style="color: #004000;">run</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The above are just examples as I&#8217;m fleshing out Jolt, but this should allow for systems that can be quickly and easily built. Basic models will easily handle themselves. More complex models may require further action; an Interceptor could run additional operations on an object before it was returned to the client.</p>
<p>As Jolt becomes more mature, I promise the methods above will change; this should give you an idea of how a small system would work.</p>
]]></content:encoded>
			<wfw:commentRss>http://leftnode.com/jolt-interceptors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Artisan System Becomes Jolt</title>
		<link>http://leftnode.com/artisan-system-becomes-jolt/</link>
		<comments>http://leftnode.com/artisan-system-becomes-jolt/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 10:56:49 +0000</pubDate>
		<dc:creator>Vic Cherubini</dc:creator>
				<category><![CDATA[Jolt]]></category>

		<guid isPermaLink="false">http://leftnode.com/?p=714</guid>
		<description><![CDATA[This is a valid article, and is considered technically accurate up to Feb. 22, 2010
I released Artisan System in November 2008. Ever since I released it, I was never crazy about the name. I always felt like it would be difficult for developers to say they used Artisan System. I intended it to be a [...]]]></description>
			<content:encoded><![CDATA[<div class="valid">This is a valid article, and is considered technically accurate up to Feb. 22, 2010</div>
<p>I released Artisan System in November 2008. Ever since I released it, I was never crazy about the name. I always felt like it would be difficult for developers to say they used Artisan System. I intended it to be a &#8220;system&#8221; level framework, where it handles many of the system requirements of Internet software. It has since morphed from there to something more, so I feel its time for a name change.</p>
<p>Coming up with a new name is very difficult. It seems like every other framework out there has a great name, except mine. I tried going the ancient god&#8217;s route, and thought Gnosis was good, but there are already plenty of Open Source projects named that, one of which is related to PHP development. So that was out. I found a Hindu god of knowledge and creativity, Saraswati, and thought about the name Swati. It was unique, easy to pronounce and spell, but after talking to <a href="http://sanitycheckfail.com">ZDC</a>, I determined it wasn&#8217;t a fitting name.</p>
<p>Ultimately stuck, I turned to my wife. I explained to her my dilemma, and within about three or four attempts, she came up with Jolt. I loved it. Easy to spell, four letters that mean a lot. Speed, intensity. The things I wan to convey with my framework.</p>
<p>Jolt.com is, of course, taken (and for sale consequently). After coming up with a name is finding the right domain to go along with it. This one was easier than expected. I like the name &#8220;core&#8221; associated with my projects since I want Jolt to be the core framework you use for your project. Unfortunately joltcore.com is taken, but not used for anything. Joltcore.org was free, and since this is a non-project Open Source, a .org works great for it.</p>
<p>I&#8217;ve reserved a sizable <a href="http://linode.com">Linode</a> server for hosting. Issue Tracking, Wiki, Technical Docs, Mail, Git, and the main website will be hosted there. Copies of Jira and Confluence will be used for the issue tracker and Wiki, respectively. I&#8217;ll be using Gitosis for Git hosting, and Doxygen will be used for documentation.</p>
<p>This is an exciting time for my software. With a rename comes an entirely new roadmap and scope for Jolt.</p>
<h2>What&#8217;s New For Jolt</h2>
<p>Jolt aims to be an entire solution for building Web based software quickly and painlessly. Jolt will support an entirely RESTful interface for building a front facing website or an API. </p>
<p>More will announced later this week as I develop the roadmap and timeline even more. If you&#8217;re a developer and wish to contribute, I&#8217;d love to hear from you.</p>
<p>I&#8217;m very excited about this change and what it will bring to software development. Who knows, maybe I&#8217;ll even win a <a href="http://www.joltawards.com/">Jolt Award</a>.</p>
<p>Happy hacking. </p>
]]></content:encoded>
			<wfw:commentRss>http://leftnode.com/artisan-system-becomes-jolt/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Compiling HipHop-PHP on Ubuntu 9.10 64bit</title>
		<link>http://leftnode.com/compiling-hiphop-php-on-ubuntu-9-10-64bit/</link>
		<comments>http://leftnode.com/compiling-hiphop-php-on-ubuntu-9-10-64bit/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 13:18:45 +0000</pubDate>
		<dc:creator>Vic Cherubini</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://leftnode.com/?p=699</guid>
		<description><![CDATA[This is a valid article, and is considered technically accurate up to Feb. 22, 2010
Facebook recently open-sourced their new software, HipHop-PHP. HPHP compiles PHP source to very efficient C++, which is then compiled to an executable binary. After a few hiccups, building HPHP is surprisingly easy. HPHP must be compiled on a 64bit platform. If [...]]]></description>
			<content:encoded><![CDATA[<div class="valid">This is a valid article, and is considered technically accurate up to Feb. 22, 2010</div>
<p>Facebook recently open-sourced their new software, HipHop-PHP. HPHP compiles PHP source to very efficient C++, which is then compiled to an executable binary. After a few hiccups, building HPHP is surprisingly easy. HPHP must be compiled on a 64bit platform. If you only have a 32bit platform and you <strong>really</strong> want to play with it, set up a VM at <a href="http://slicehost.com">Slicehost</a> or <a href="http://linode.com">Linode</a> and compile it there (if you have a 32bit platform, you can&#8217;t install a 64bit VM). I eventually used my Linode account and built it there.</p>
<p>First, you&#8217;ll need to install Git if you haven&#8217;t already.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># You might as well drop into root. You'll be doing everything as root</span>
<span style="color: #666666; font-style: italic;"># so I won't prepend everything with sudo.</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">su</span>
<span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> git-core</pre></div></div>

<p>Ubuntu comes with a handy package called <strong>build-essential</strong> which installs all of the tools you need (make, gcc, g++, and more) to build software from scratch.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> build-essential</pre></div></div>

<p>Navigate to the <strong>/opt</strong> directory and clone the project from Github.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>opt
git clone git:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>facebook<span style="color: #000000; font-weight: bold;">/</span>hiphop-php.git</pre></div></div>

<p>It comes with another Git module, libmbfl, which will cause you a lot of headaches if you don&#8217;t initialize it.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> hiphop-php
git submodule init
git submodule update
<span style="color: #7a0874; font-weight: bold;">cd</span> ..</pre></div></div>

<p>HPHP requires a patched version of cURL and libevent, so you&#8217;ll have to patch and compile those normally.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># cURL first, this will be installed into /usr/local/lib/,</span>
<span style="color: #666666; font-style: italic;"># manually change the prefix in ./configure to install it elsewhere</span>
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>curl.haxx.se<span style="color: #000000; font-weight: bold;">/</span>download<span style="color: #000000; font-weight: bold;">/</span>curl-7.20.0.tar.gz
<span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-xvzf</span> curl-7.20.0.tar.gz
<span style="color: #7a0874; font-weight: bold;">cd</span> curl-7.20.0
<span style="color: #c20cb9; font-weight: bold;">patch</span> <span style="color: #660033;">-p0</span> <span style="color: #000000; font-weight: bold;">&lt;</span> ..<span style="color: #000000; font-weight: bold;">/</span>hiphop-php<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>third_party<span style="color: #000000; font-weight: bold;">/</span>libcurl.fb-changes.diff
.<span style="color: #000000; font-weight: bold;">/</span>configure
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> ..</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># libevent will be installed to /usr/local/lib/,</span>
<span style="color: #666666; font-style: italic;"># manually change the prefix in ./configure to install it elsewhere</span>
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.monkey.org<span style="color: #000000; font-weight: bold;">/</span>~provos<span style="color: #000000; font-weight: bold;">/</span>libevent-1.4.13-stable.tar.gz
<span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-xvzf</span> libevent-1.4.13-stable.tar.gz
<span style="color: #7a0874; font-weight: bold;">cd</span> libevent-1.4.13-stable
<span style="color: #c20cb9; font-weight: bold;">patch</span> <span style="color: #660033;">-p0</span> <span style="color: #000000; font-weight: bold;">&lt;</span> ..<span style="color: #000000; font-weight: bold;">/</span>hiphop-php<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>third_party<span style="color: #000000; font-weight: bold;">/</span>libevent.fb-changes.diff
.<span style="color: #000000; font-weight: bold;">/</span>configure
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> ..</pre></div></div>

<p>HPHP requires libicu, a Unicode library. However, it requires 4.2+, and the latest version in the Ubuntu repositories is 4.0, so you&#8217;ll have to manually compile that as well.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># libicu will be installed to /usr/local/lib/,</span>
<span style="color: #666666; font-style: italic;"># manually change the prefix in ./configure to install it elsewhere</span>
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>download.icu-project.org<span style="color: #000000; font-weight: bold;">/</span>files<span style="color: #000000; font-weight: bold;">/</span>icu4c<span style="color: #000000; font-weight: bold;">/</span>4.2.1<span style="color: #000000; font-weight: bold;">/</span>icu4c-<span style="color: #000000;">4</span>_2_1-src.tgz
<span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-xvzf</span> icu4c-<span style="color: #000000;">4</span>_2_1-src.tgz
<span style="color: #7a0874; font-weight: bold;">cd</span> icu<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">source</span>
.<span style="color: #000000; font-weight: bold;">/</span>configure
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> ..</pre></div></div>

<p>Oniguruma is a Unicode regular expression library that you&#8217;ll need to compile and install.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># oniguruma first, this will be installed into /usr/local/lib/,</span>
<span style="color: #666666; font-style: italic;"># manually change the prefix in ./configure to install it elsewhere</span>
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.geocities.jp<span style="color: #000000; font-weight: bold;">/</span>kosako3<span style="color: #000000; font-weight: bold;">/</span>oniguruma<span style="color: #000000; font-weight: bold;">/</span>archive<span style="color: #000000; font-weight: bold;">/</span>onig-5.9.2.tar.gz
<span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-xvzf</span> onig-5.9.2.tar.gz
<span style="color: #7a0874; font-weight: bold;">cd</span> onig-5.9.2
.<span style="color: #000000; font-weight: bold;">/</span>configure
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> ..</pre></div></div>

<p>Head back into the hiphop-php source tree. We&#8217;ll be able to install the rest of the required libraries from Ubuntu&#8217;s repository.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> hiphop-php
&nbsp;
<span style="color: #666666; font-style: italic;"># Libraries</span>
<span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> cmake <span style="color: #c20cb9; font-weight: bold;">flex</span> <span style="color: #c20cb9; font-weight: bold;">bison</span> re2c libmysqlclient16 libmysqlclient16-dev libxml2 libxml2-dev libmcrypt4 libmcrypt-dev binutils binutils-dev libcap2 libcap2-dev libgd2-xpm libgd2-xpm-dev zlibc libtbb2 libtbb-dev libpcre3 libpcre3-dev libpcre++-dev libssl0.9.8 libssl-dev
&nbsp;
<span style="color: #666666; font-style: italic;"># Boost, in reality you do not need *all* of Boost, only a few</span>
<span style="color: #666666; font-style: italic;"># libraries, but you might as well install all of it to play with.</span>
<span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> libboost-date-time1.40.0 libboost-date-time1.40-dev libboost-filesystem1.40.0 libboost-filesystem1.40-dev libboost-graph1.40.0 libboost-graph1.40-dev libboost-graph-parallel1.40.0 libboost-graph-parallel1.40-dev libboost-iostreams1.40.0 libboost-iostreams1.40-dev libboost-math1.40.0 libboost-math1.40-dev libboost-mpi1.40.0 libboost-mpi1.40-dev libboost-program-options1.40.0 libboost-program-options1.40-dev libboost-python1.40.0 libboost-python1.40-dev libboost-regex1.40.0 libboost-regex1.40-dev libboost-serialization1.40.0 libboost-serialization1.40-dev libboost-signals1.40.0 libboost-signals1.40-dev libboost-system1.40.0 libboost-system1.40-dev libboost-test1.40.0 libboost-test1.40-dev libboost-thread1.40.0 libboost-thread1.40-dev libboost-wave1.40.0 libboost-wave1.40-dev</pre></div></div>

<p>Define some environment variables for compiling.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Ensure you are in /opt/hiphop-php/ at this point</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">CMAKE_PREFIX_PATH</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">local</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">HPHP_HOME</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">pwd</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">HPHP_LIB</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">pwd</span><span style="color: #000000; font-weight: bold;">`/</span>bin</pre></div></div>

<p>Compile and install everything.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">cmake .
&nbsp;
<span style="color: #666666; font-style: italic;"># Assuming cmake doesn't give you any errors.</span>
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p>After you&#8217;ve compiled HPHP, the binary is located in <strong>hiphop-php/src/hphp/</strong> and is aptly named hphp. From here, you can follow the instructions on <a href="http://wiki.github.com/facebook/hiphop-php/running-hiphop">http://wiki.github.com/facebook/hiphop-php/running-hiphop</a> on how to use it.</p>
<p>So far, it&#8217;s very promising. Of course, you probably don&#8217;t fit the use-case for this. Regardless, I believe this will take PHP application in new directions. No longer will you need a Zend Encoder or Optimizer, application deployment can be installing a single binary, and it will be possible for companies to sell their applications without giving away the source code. Everything I release will still be entirely Open Source, however, a HPHP binary may be attached for easy deployment.</p>
]]></content:encoded>
			<wfw:commentRss>http://leftnode.com/compiling-hiphop-php-on-ubuntu-9-10-64bit/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Validating Articles</title>
		<link>http://leftnode.com/validating-articles/</link>
		<comments>http://leftnode.com/validating-articles/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 11:47:01 +0000</pubDate>
		<dc:creator>Vic Cherubini</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://leftnode.com/?p=639</guid>
		<description><![CDATA[I recently read an article about a problem with blogging: very outdated and inaccurate articles (particularly technical articles) are still indexed by Google, so when you&#8217;re browsing for a solution to your answer, and you find an article from 2001, you end up becoming more frustrated.
Because this is a technically oriented website, I&#8217;ll be validating [...]]]></description>
			<content:encoded><![CDATA[<p>I recently read an article about a problem with blogging: very outdated and inaccurate articles (particularly technical articles) are still indexed by Google, so when you&#8217;re browsing for a solution to your answer, and you find an article from 2001, you end up becoming more frustrated.</p>
<p>Because this is a technically oriented website, I&#8217;ll be validating all of my articles, and doing it on a routine basis. You&#8217;ll see a banner above each article explaining that it is still technically valid should you happen onto it by way of a search engine.</p>
<p>Valid articles will see a describing the date the article is valid until. If the current date is after that date, that doesn&#8217;t mean the article isn&#8217;t invalid, simply that it hasn&#8217;t been validated since that time.</p>
<div class="valid">This is a valid article, and is considered technically accurate up to Feb. 21, 2010</div>
<p>Invalid articles also have a header describing them.</p>
<div class="invalid">This article is no longer valid as of Feb. 21, 2010</div>
]]></content:encoded>
			<wfw:commentRss>http://leftnode.com/validating-articles/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HipHop PHP From Facebook Released</title>
		<link>http://leftnode.com/hiphop-php-from-facebook-released/</link>
		<comments>http://leftnode.com/hiphop-php-from-facebook-released/#comments</comments>
		<pubDate>Sat, 20 Feb 2010 15:15:44 +0000</pubDate>
		<dc:creator>Vic Cherubini</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://leftnode.com/?p=636</guid>
		<description><![CDATA[This is a valid article, and is considered technically accurate up to Feb. 21, 2010
Facebook has officially released HipHop for PHP on GitHub. I&#8217;ve spent all morning attempting to compile it on my local machine (Ubuntu 9.10 32bit) with no luck. I&#8217;ll try another computer in a moment, and then post a detailed instruction set [...]]]></description>
			<content:encoded><![CDATA[<div class="valid">This is a valid article, and is considered technically accurate up to Feb. 21, 2010</div>
<p>Facebook has officially released HipHop for PHP on <a href="http://github.com/facebook/hiphop-php/">GitHub</a>. I&#8217;ve spent all morning attempting to compile it on my local machine (Ubuntu 9.10 32bit) with no luck. I&#8217;ll try another computer in a moment, and then post a detailed instruction set on how to build it fully.</p>
<p>If you&#8217;re not familiar with compiling programs on a Linux environment, it definitely has a steep learning curve.</p>
<p>Stay around for updates throughout the day.</p>
<p><strong>Update:</strong> You must compile this on a 64bit platform.</p>
]]></content:encoded>
			<wfw:commentRss>http://leftnode.com/hiphop-php-from-facebook-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
