<?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>Release The Codes!</title>
	<atom:link href="http://releasethecodes.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://releasethecodes.com</link>
	<description></description>
	<lastBuildDate>Wed, 17 Feb 2010 17:48:00 +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>10 Minutes to a Leaner LAMP stack</title>
		<link>http://releasethecodes.com/10-minutes-to-a-leaner-lamp-stack/</link>
		<comments>http://releasethecodes.com/10-minutes-to-a-leaner-lamp-stack/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 23:42:40 +0000</pubDate>
		<dc:creator>sam keen</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://releasethecodes.com/?p=311</guid>
		<description><![CDATA[For this quick article I am only going to quickly cover the A and the M of the LAMP stack.
The Setup
Assumptions: You have root on the server in question or you at least have enough server access to effect the configuration of Apache and MySQL.
The test server setup:

A Virtual Private server running on Rackspace cloud
Ubuntu 9.04 [...]]]></description>
			<content:encoded><![CDATA[<p>For this quick article I am only going to quickly cover the <strong>A</strong> and the <strong>M</strong> of the <strong>LAMP</strong> stack.</p>
<h2 id="toc-the-setup">The Setup</h2>
<p>Assumptions: You have root on the server in question or you at least have enough server access to effect the configuration of Apache and MySQL.</p>
<h3 id="toc-the-test-server-setup">The test server setup:</h3>
<ul>
<li>A Virtual Private server running on Rackspace cloud</li>
<li>Ubuntu 9.04 (Jaunty Jackalope)</li>
</ul>
<p>Few quick commands and viola, you have a LAMP server&#8230;</p>
<pre>$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo locale-gen en_US.UTF-8
$ sudo apt-get install apache2-mpm-prefork php5 php5-dev mysql-server-5.0 mysql-client-5.0 php5-mysql
$ sudo a2enmod rewrite</pre>
<ul>
<li>Installed latest Wordpress and added some test posts</li>
</ul>
<h2 id="toc-baseline-performance">Baseline Performance:</h2>
<p>Before you start changing anything be sure to record the baseline performance ot the server.  Place the server under load.  I used <a href="http://www.acme.com/software/http_load/">http_load</a> but anything similar can be used</p>
<h3 id="toc-the-test-urls-that-http_load-will-draw-from">The Test URL&#8217;s that http_load will draw from</h3>
<pre>$ cat pdxphp-test

http://67.23.47.195/

http://67.23.47.195/2010/02/test-post-1/

http://67.23.47.195/2010/02/test-post-2/

http://67.23.47.195/2010/02/test-post-3/

http://67.23.47.195/2010/02/test-post-4/

http://67.23.47.195/2010/02/test-post-5/</pre>
<h3 id="toc-run-the-test">Run the test</h3>
<pre>$ http_load -parallel 5 -seconds 20 pdxphp-test
83 fetches, 5 max parallel, 1.74373e+06 bytes, in 20.0009 seconds
21008.8 mean bytes/connection
<strong>4.14982 fetches/sec</strong>, 87182.7 bytes/sec
msecs/connect: 80.6013 mean, 99.26 max, 71.974 min
<strong>msecs/first-response: 795.394 mean</strong>, 5495.6 max, 225.29 min
HTTP response codes:
  code 200 -- 82</pre>
<div id="attachment_318" class="wp-caption alignnone" style="width: 671px"><a href="http://releasethecodes.com/wp-content/uploads/2010/02/top-stock1.png"><img class="size-full wp-image-318" title="top-stock" src="http://releasethecodes.com/wp-content/uploads/2010/02/top-stock1.png" alt="" width="661" height="391" /></a><p class="wp-caption-text">web server under load</p></div>
<p>To see how much RAM MySQL actually wants, we restart it with Apache stopped</p>
<div id="attachment_315" class="wp-caption alignnone" style="width: 651px"><a href="http://releasethecodes.com/wp-content/uploads/2010/02/mysql-stockhttpd-stopped.png"><img class="size-full wp-image-315" title="mysql-stock(httpd-stopped)" src="http://releasethecodes.com/wp-content/uploads/2010/02/mysql-stockhttpd-stopped.png" alt="" width="641" height="179" /></a><p class="wp-caption-text">MySQL running on it&#39;s own, gobbles up 21M RAM</p></div>
<h2 id="toc-apache">Apache</h2>
<h3 id="toc-reduce-the-number-of-modules-loaded">Reduce the number of modules loaded</h3>
<p>You can start with this.  It will typically not give you incredible results but you will save some resource and it is a good security policy.</p>
<p>You can list your loaded modules with</p>
<pre>apache2ctl -t -D DUMP_MODULES</pre>
<pre>Loaded Modules:
 core_module (static)
 log_config_module (static)
 logio_module (static)
 mpm_prefork_module (static)
 http_module (static)
 so_module (static)
 alias_module (shared)
 auth_basic_module (shared)
 authn_file_module (shared)
 authz_default_module (shared)
 authz_groupfile_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 <strong>cgi_module (shared)</strong>
 deflate_module (shared)
 dir_module (shared)
 env_module (shared)
 mime_module (shared)
 negotiation_module (shared)
 php5_module (shared)
 rewrite_module (shared)
 setenvif_module (shared)
 status_module (shared)</pre>
<p>Choosing to unload any of these modules is completely dependent of how you are using the server.  But for many PHP developers can safely unload cgi.</p>
<pre>$ sudo a2dismod cgi
Module cgi disabled.
Run '/etc/init.d/apache2 restart' to activate new configuration!
sam@pdx-test:/etc/apache2/mods-enabled$ sudo apache2ctl start</pre>
<h3 id="toc-turn-off-htaccess">Turn off htaccess</h3>
<p>Explanation from <a href="http://httpd.apache.org/docs/2.2/howto/htaccess.html#when">Apache</a>.  So all you need to do is take the contents of the .htaccess file in your site&#8217;s webroot and place that in the corresponding vhost.  Then turn off htaccess files with <strong>AllowOverride None</strong> and rm the .htaccess file in the web root after restarting apache.</p>
<pre>sudo vi /etc/apache/sites-enabled/wordpress</pre>
<p>&lt;Directory /var/www/wordpress&gt;</p>
<p>&lt;IfModule mod_rewrite.c&gt;<br />
RewriteEngine On<br />
RewriteBase /<br />
RewriteCond %{REQUEST_FILENAME} !-f<br />
RewriteCond %{REQUEST_FILENAME} !-d<br />
RewriteRule . /index.php [L]<br />
&lt;/IfModule&gt;</p>
<p><strong>AllowOverride None</strong></p>
<p>&lt;/Directory&gt;</p>
<pre>rm /var/www/wordpress/.htaccess</pre>
<h3 id="toc-now-how-to-really-affect-apache">Now, how to really affect apache</h3>
<p>This is all well and good and Apache will be better off for it but if you had a server that was paging and dying under load, after making these changes, that will probably not change.</p>
<p>The bigger issue shown in the top output above is that, for the amount of physical RAM, there are just too many 20+MB processes</p>
<p>the apache conf file controls these settings (/etc/apache2/apache2.conf on Ubuntu)</p>
<p>The stock settings:</p>
<pre>&lt;IfModule mpm_prefork_module&gt;
    StartServers          5
    MinSpareServers       5
    MaxSpareServers      10
    MaxClients          150
    MaxRequestsPerChild   0
&lt;/IfModule&gt;</pre>
<p>Possible more appropriate settings for a little personal blog site.  Overall you need to lower <strong>MaxClients</strong> to the amount you can run without paging.  If this is too few, you probably need more RAM.</p>
<pre>&lt;IfModule mpm_prefork_module&gt;
    StartServers          1
    MinSpareServers       1
    MaxSpareServers       5
    MaxClients            5
    MaxRequestsPerChild   1000
&lt;/IfModule&gt;</pre>
<h3 id="toc-the-results-thus-far">The Results thus far</h3>
<div id="attachment_332" class="wp-caption alignnone" style="width: 661px"><a href="http://releasethecodes.com/wp-content/uploads/2010/02/top-apache-trimmed-under-load.png"><img class="size-full wp-image-332" title="Top output with Apache Trimmed and under load" src="http://releasethecodes.com/wp-content/uploads/2010/02/top-apache-trimmed-under-load.png" alt="" width="651" height="250" /></a><p class="wp-caption-text">Top output with Apache Trimmed and under load</p></div>
<h2 id="toc-mysql"><strong>MySQL</strong></h2>
<p>Now onto MySQL.  We saw above that MySQL is staring up and grabbing ~21M of RAM.  A low to medium volume LAMP server probably doesn&#8217;t need all that but, again every situation is different.  Here though are some notes of how to tune the <em>Low Hanging Fruit</em> of MySQL</p>
<h3 id="toc-if-you-dont-use-it-turn-it-off">If you don&#8217;t use it, Turn it off</h3>
<p>Same as with Apache modules, turn off what you do not need.  Storage engines are a great place to start.  Very few frameworks (including WP),  utilize InnoDB by default.  Most use good old MyISAM.</p>
<p>Stopping MySQl from loading the InnoDb engine (and its predecessor:bdb) is quite simple, the lines are in my.cnf, just uncomment them</p>
<pre><strong>skip-innodb
skip-bdb</strong></pre>
<p>Now there are many, many MySQL config options that affect the amount of resource it uses.  I&#8217;ll just cover a couple here, the <strong>key buffer</strong> and the <strong>query cache</strong></p>
<p>The stock settings for these are</p>
<pre># used for holding built indexes
key_buffer              = 16M
# largest query that is cache-able
query_cache_limit       = 1M
# used for caching queries
query_cache_size        = 16M</pre>
<p>For many types of sites,  these can be a bit large,  for small sites, some suggested settings might be:</p>
<pre># used for holding built indexes
key_buffer		= 4M
# largest query that is cache-able
query_cache_limit       = 500K
# used for caching queries
query_cache_size        = 8M</pre>
<p>To see what the runtime values are concerning the query cache and key buffer use (once server has been under load)</p>
<pre>mysql&gt; SHOW STATUS WHERE Variable_name LIKE 'Key_blocks_%' OR Variable_name LIKE 'Qcache_%';
+-------------------------+----------+
| Variable_name           | Value    |
+-------------------------+----------+
| Key_blocks_not_flushed  | 0        |
| Key_blocks_unused       | 13369    |
| Key_blocks_used         | 27       |
| Qcache_free_blocks      | 4        |
| Qcache_free_memory      | 16326632 |
| Qcache_hits             | 5969     |
| Qcache_inserts          | 95       |
| Qcache_lowmem_prunes    | 0        |
| Qcache_not_cached       | 410      |
| Qcache_queries_in_cache | 46       |
| Qcache_total_blocks     | 106      |
+-------------------------+----------+
11 rows in set (0.00 sec)</pre>
<p>As you reduce key_buffer and query_cache_size, check the output of the SHOW STATUS command shown above while the server is under load to verify that you are not running low on <span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">Key_blocks_unused or Qcache_free_memory</span></p>
<h2 id="toc-the-final-result-of-our-tinkering">The Final result of our tinkering</h2>
<p>So now that we have trimmed Apache and MySQL lets see what the top output looks like with the server under load</p>
<p><a href="http://releasethecodes.com/wp-content/uploads/2010/02/top-all-trimmed.png"><img class="alignnone size-full wp-image-343" title="top-all-trimmed" src="http://releasethecodes.com/wp-content/uploads/2010/02/top-all-trimmed.png" alt="" width="643" height="233" /></a></p>
<p>Our CPU load has reduced (idle is up to ~65%).  More importantly we are no longer paging and we still have a bit of RAM left over.  MySQL is running with ~8M of RAM, down from ~21M.</p>
<p>Also as seen below, we&#8217;ve roughly doubled our performance.  Up to 6.85 req/sec and first response in down to 276ms.</p>
<pre>$ http_load-parallel 5 -seconds 20 pdxphp-test
137 fetches, 5 max parallel, 4.69493e+06 bytes, in 20 seconds
34269.6 mean bytes/connection
6.85 fetches/sec, 234747 bytes/sec
msecs/connect: 80.6284 mean, 96.353 max, 73.043 min
msecs/first-response: 276.766 mean, 447.707 max, 225.995 min
HTTP response codes:
  code 200 -- 137</pre>
<h4 id="toc-links">Links:</h4>
<ul>
<li><a href="http://emergent.urbanpug.com/?p=60">http://emergent.urbanpug.com/?p=60</a></li>
<li><a href="http://emergent.urbanpug.com/?p=61">http://emergent.urbanpug.com/?p=61</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://releasethecodes.com/10-minutes-to-a-leaner-lamp-stack/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Some Experiments with Canvas Drag and Drop</title>
		<link>http://releasethecodes.com/some-experiments-with-canvas-drag-and-drop/</link>
		<comments>http://releasethecodes.com/some-experiments-with-canvas-drag-and-drop/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 06:06:00 +0000</pubDate>
		<dc:creator>sam keen</dc:creator>
				<category><![CDATA[html5]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://releasethecodes.com/?p=305</guid>
		<description><![CDATA[I&#8217;ve been toying around with canvas tag and learning the ins and outs of Drag and Drop
I created a little proof of concept app that allows you to add markers to an image.  The meta about the markers (relative location, marker symbol, desc, color, etc) are stored in a DB on another server using JSONP [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been toying around with canvas tag and learning the ins and outs of Drag and Drop</p>
<p>I created a little proof of concept app that allows you to add markers to an image.  The meta about the markers (relative location, marker symbol, desc, color, etc) are stored in a DB on another server using JSONP requests.</p>
<p>See the demo <a href="http://confab.releasethecodes.com/">here</a> (FF3+ recommended)</p>
<p>The code repo is currently on <a href="http://code.google.com/p/confabulate/">google code</a></p>
<p><a href="http://confab.releasethecodes.com/"><img class="alignnone size-full wp-image-308" title="confab-screenshot1" src="http://releasethecodes.com/wp-content/uploads/2010/01/confab-screenshot1.png" alt="" width="785" height="308" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://releasethecodes.com/some-experiments-with-canvas-drag-and-drop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ipad: My impressions</title>
		<link>http://releasethecodes.com/ipad-my-impressions/</link>
		<comments>http://releasethecodes.com/ipad-my-impressions/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 15:39:17 +0000</pubDate>
		<dc:creator>sam keen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://releasethecodes.com/?p=300</guid>
		<description><![CDATA[Sexy little (well medium i guess) device.  As a software developer though I cannot see it replacing my laptop (currently a msi u123).  I don&#8217;t see writing code on a ipad.
Also, it would not be replacing my phone.  I guess we will be able to use skype (or skype-like services) on the [...]]]></description>
			<content:encoded><![CDATA[<p>Sexy little (well medium i guess) <a href="http://www.apple.com/ipad/specs/">device</a>.  As a software developer though I cannot see it replacing my laptop (currently a msi u123).  I don&#8217;t see writing code on a ipad.<br />
Also, it would not be replacing my phone.  I guess we will be able to use skype (or skype-like services) on the 3G models.  But still, the form factor of the iPad does not make for a convenient phone.</p>
<p>I do see the iPad as the dream machine for bloggers (though I&#8217;m surprised there is no camera) and makes an excellent &#8220;couch computer&#8221;.  I believe in many people&#8217;s minds, it competes in the iPod touch market.</p>
<p>Do we see Ubuntu or Android ever being ported to this device?  That could make things interesting.</p>
]]></content:encoded>
			<wfw:commentRss>http://releasethecodes.com/ipad-my-impressions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>vnstat : excellent networking tool</title>
		<link>http://releasethecodes.com/vnstat-excellent-networking-tool/</link>
		<comments>http://releasethecodes.com/vnstat-excellent-networking-tool/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 16:51:32 +0000</pubDate>
		<dc:creator>sam keen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://releasethecodes.com/?p=296</guid>
		<description><![CDATA[I recently found myself considering moving one of our servers to the Rackspace Cloud.  I needed to get an estimate of the cost for bandwidth usage.
I remembered I had installed vnstat on that server when it was deployed.  This made the bandwidth calculation completely simple:
Just have vnstat give me the bandwidth sliced by Month:
$ [...]]]></description>
			<content:encoded><![CDATA[<p>I recently found myself considering moving one of our servers to the Rackspace Cloud.  I needed to get an estimate of the cost for bandwidth usage.<br />
I remembered I had installed <a href="http://humdi.net/vnstat/">vnstat</a> on that server when it was deployed.  This made the bandwidth calculation completely simple:</p>
<p>Just have vnstat give me the bandwidth sliced by Month:</p>
<pre>$ vnstat -m

 eth0  /  monthly

   month         rx      |      tx      |   total
-------------------------+--------------+--------------------------------------
  Aug '09       7.00 GB  |     8.48 GB  |    15.48 GB   %::
  Sep '09      14.98 GB  |    15.75 GB  |    30.72 GB   %%%::::
  Oct '09      31.70 GB  |    14.79 GB  |    46.50 GB   %%%%%%%%:::
  Nov '09      45.46 GB  |    14.64 GB  |    60.10 GB   %%%%%%%%%%%:::
  Dec '09      73.71 GB  |    15.40 GB  |    89.11 GB   %%%%%%%%%%%%%%%%%%::::
  Jan '10      66.25 GB  |    16.89 GB  |    83.14 GB   %%%%%%%%%%%%%%%%::::
-------------------------+--------------+--------------------------------------
 estimated     94.97 GB  |    24.21 GB  |   119.18 GB</pre>
<p>The install of vnstat on Ubuntu can be done with <code>apt-get</code>:</p>
<pre>sudo apt-get install vnstat</pre>
<p>Remember, once installed to initiate you vnstat DB.  Just execute <code>vnstat</code> and it will tell you how.   <code>vnstat -u -i eth0</code> in my case</p>
<p>Then check the man page for the command to see all the different ways you will be able to slice and dice your network data</p>
]]></content:encoded>
			<wfw:commentRss>http://releasethecodes.com/vnstat-excellent-networking-tool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Your First PHP Development Environment</title>
		<link>http://releasethecodes.com/your-first-php-development-environment/</link>
		<comments>http://releasethecodes.com/your-first-php-development-environment/#comments</comments>
		<pubDate>Wed, 30 Sep 2009 03:48:30 +0000</pubDate>
		<dc:creator>sam keen</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://releasethecodes.com/?p=266</guid>
		<description><![CDATA[I&#8217;m teaching a PHP/MySQL course at the local community college this fall.  First order of business is to get everyone set up with a PHP development environment.  I decided to go ahead and post the strategy for the course as a post here in case it may be helpful others just starting out in PHP [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m teaching a PHP/MySQL course at the local community college this fall.  First order of business is to get everyone set up with a PHP development environment.  I decided to go ahead and post the strategy for the course as a post here in case it may be helpful others just starting out in PHP development.</p>
<p>This post is meant to help the individual who is just setting out to learn PHP web development and has no previous programming experience.  I&#8217;m listing a set of tools to help in that quest and giving some pointers as to how to initially configure them (though part of the reason these tools were chosen was that they require very little tweaking before you can start using them).</p>
<p>The OS used in this example is Windows, but all theses tools are cross platform (deliberately chosen for that reason), and the instructions will only change slightly for other OS&#8217;s.</p>
<p>Below are examples of installing a client (the web browser), a server stack (PHP and MySQL) and a code editor.  They&#8217;ve been chosen based on:</p>
<ul>
<li>ease of install and use for someone new to all this technology</li>
<li>cross platform<br />
<em>versions available for Windows and Linux flavors including OS X</em></li>
<li>extensibility<br />
<em>In particular, Firefox and Netbeans.  As the user grows comfortable with these tools, they will discover that they contain many features to aid in web development.  (firefox: firebug, web-dev toolbar   netbeans: integrated source control, xdebug, etc)</em></li>
</ul>
<p>PHP is a cross platform technology at heart so that enables a plethora of alternatives to the choices I&#8217;ve made above<em>. </em>So feel free to explore the other options and find the tools that work best for you.</p>
<h2 id="toc-firefox">Firefox</h2>
<h3 id="toc-install">Install</h3>
<p>Get the files from: <a title="http://www.mozilla.com/en-US/firefox/firefox.html" rel="nofollow" href="http://www.mozilla.com/en-US/firefox/firefox.html">http://www.mozilla.com/en-US/firefox/firefox.html</a></p>
<p>Install the firebug addon : <a href="http://getfirebug.com/">http://getfirebug.com/</a></p>
<h2 id="toc-xampp">XAMPP</h2>
<h3 id="toc-install-on-windows-windows-7-64bit-edition-shown">Install on Windows (windows 7 64bit edition shown)</h3>
<p>Get the files from: <a title="http://sourceforge.net/projects/xampp/files" rel="nofollow" href="http://sourceforge.net/projects/xampp/files">http://sourceforge.net/projects/xampp/files</a></p>
<p><img title="xampp0" src="http://releasethecodes.com/wp-content/uploads/2009/09/xampp0.png" alt="xampp0" width="700" height="344" /></p>
<p><img title="xampp-install" src="http://releasethecodes.com/wp-content/uploads/2009/09/xampp-install.png" alt="xampp-install" width="465" height="260" /></p>
<p>XAMPP should do this by default, but be sure to install at C:\</p>
<p><img title="xampp-intall-root" src="http://releasethecodes.com/wp-content/uploads/2009/09/xampp-intall-root.png" alt="xampp-intall-root" width="503" height="383" /></p>
<p>In service section check</p>
<ul>
<li>
<div>Install apache as service</div>
</li>
<li>
<div>Install mysql as service</div>
</li>
</ul>
<p>This causes those services to automatically start when Windows starts</p>
<p><img title="xampp-services" src="http://releasethecodes.com/wp-content/uploads/2009/09/xampp-services.png" alt="xampp-services" width="502" height="388" /></p>
<p>Test install by opening a browser and going to <a title="http://localhost" rel="nofollow" href="http://localhost/">http://localhost</a></p>
<p><img title="xampp-browser-test" src="http://releasethecodes.com/wp-content/uploads/2009/09/xampp-browser-test-300x164.png" alt="xampp-browser-test" width="300" height="164" /></p>
<h2 id="toc-netbeans-editor">Netbeans Editor</h2>
<div>
<p>Netbeans <a title="http://www.netbeans.org/features/php/" rel="nofollow" href="http://www.netbeans.org/features/php/">PHP IDE</a></p>
<p>Download <a title="http://www.netbeans.org/downloads/index.html" rel="nofollow" href="http://www.netbeans.org/downloads/index.html">here</a></p>
<h3 id="toc-configure-after-install">Configure after Install</h3>
<h4 id="toc-apply-updates">Apply Updates</h4>
<div id="attachment_279" class="wp-caption alignnone" style="width: 648px"><img class="size-full wp-image-279" title="netbeans check for updates" src="http://releasethecodes.com/wp-content/uploads/2009/09/Picture-59.png" alt="Picture 59" width="638" height="243" /><p class="wp-caption-text">Go to Help &gt; Check For Updates</p></div>
<h3 id="toc-test" id="test">Test</h3>
<p>Now create a new PHP application project called <em style="color: #666666;">{YOUR NAME}</em>-week1</p>
<p><img title="netbeans-test1" src="http://releasethecodes.com/wp-content/uploads/2009/09/netbeans-test1.png" alt="netbeans-test1" width="332" height="140" /></p>
<p><img title="netbeans-test2" src="http://releasethecodes.com/wp-content/uploads/2009/09/netbeans-test2.png" alt="netbeans-test2" width="658" height="335" /></p>
<p>Place the project in the XAMPP htdocs folder</p>
<p><img class="alignnone size-full wp-image-282" title="Picture 64" src="http://releasethecodes.com/wp-content/uploads/2009/09/Picture-64.png" alt="Picture 64" width="660" height="403" /></p>
<p>Confirm the URL your project will be found at. (In our case, Netbeans should make the right guess here, so just confirm and click &#8216;Finish&#8217;</p>
<p><img class="alignnone size-full wp-image-283" title="Picture 62" src="http://releasethecodes.com/wp-content/uploads/2009/09/Picture-62.png" alt="Picture 62" width="669" height="455" /></p>
<h4 id="toc-editor-will-open-and-netbeans-will-automatically-create-a-starter-index-php-file-for-you"><a id="editor_will_open" name="editor_will_open">Editor Will Open</a> and Netbeans will automatically create a starter index.php file for you</h4>
<h4 id="toc-"><img class="alignnone size-full wp-image-284" title="Picture 65" src="http://releasethecodes.com/wp-content/uploads/2009/09/Picture-65.png" alt="Picture 65" width="923" height="654" /></h4>
<h4 id="toc-clean-up-some-unneeded-windows"><a id="clean_up_some_unneeded_windows" name="clean_up_some_unneeded_windows">Clean up some unneeded windows</a></h4>
<p>close these windows (you can always get them back later if you like)</p>
<ul>
<li>
<div>navigator</div>
</li>
<li>
<div>files</div>
</li>
<li>
<div>services</div>
</li>
<li>
<div>palette</div>
</li>
</ul>
<div>
<dl id="attachment_263" style="width: 829px;">
<dt><img class="alignnone size-full wp-image-285" title="Picture 66" src="http://releasethecodes.com/wp-content/uploads/2009/09/Picture-66.png" alt="Picture 66" width="907" height="640" /></dt>
</dl>
</div>
<h4 id="toc-now-to-make-a-few-edits-and-create-a-new-file-so-we-can-start-to-get-familiar-with-the-ide">Now to make a few edits and create a new file so we can start to get familiar with the IDE.</h4>
<p>Add some PHP</p>
<p><img class="alignnone size-full wp-image-268" title="netbeans-add-php" src="http://releasethecodes.com/wp-content/uploads/2009/09/netbeans-add-php.png" alt="netbeans-add-php" width="704" height="309" /></p>
<p>See the file in a browser by clicking the green Play (&gt;) button on the toolbar.  The Browser should open at the URL for the file.</p>
<p><img class="alignnone size-full wp-image-286" title="Picture 67" src="http://releasethecodes.com/wp-content/uploads/2009/09/Picture-67.png" alt="Picture 67" width="908" height="642" /></p>
<p><strong>create another file called new-file.php</strong></p>
<ul>
<li><strong>Menu: File &gt; New File</strong></li>
<li><strong>Choose category PHP, File Type PHP Web Page</strong></li>
<li><strong>Next</strong></li>
<li><strong>Change the filename to new-file.php</strong></li>
<li><strong>Finnish</strong></li>
</ul>
<p><strong><br />
</strong><img class="alignnone size-full wp-image-288" title="Picture 68" src="http://releasethecodes.com/wp-content/uploads/2009/09/Picture-68.png" alt="Picture 68" width="818" height="580" /></div>
<div><strong>In new-file.php create a hyper link to index.php and in index.php create a link to new-file.php</strong></div>
<div><img class="alignnone size-full wp-image-289" title="Picture 69" src="http://releasethecodes.com/wp-content/uploads/2009/09/Picture-69.png" alt="Picture 69" width="818" height="585" /></div>
<div><strong>The resulting filesystem</strong></div>
<div><img class="alignnone size-full wp-image-293" title="Picture 70" src="http://releasethecodes.com/wp-content/uploads/2009/09/Picture-70.png" alt="Picture 70" width="852" height="702" /></div>
<div><strong>Note, the nbproject folder is used by Netbeans (it is full of projects metadata).  You can simply ignore it (but don&#8217;t edit or delete it)</strong></div>
]]></content:encoded>
			<wfw:commentRss>http://releasethecodes.com/your-first-php-development-environment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Portland Restaurant Health Map</title>
		<link>http://releasethecodes.com/portland-restaurant-health-map/</link>
		<comments>http://releasethecodes.com/portland-restaurant-health-map/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 15:51:00 +0000</pubDate>
		<dc:creator>sam keen</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[geo]]></category>

		<guid isPermaLink="false">http://dabbling.in/?p=3</guid>
		<description><![CDATA[Inspired by Toby Segaran’s creation of a heat map of restaurant health inspection scores for San Francisco, I set out to do the same for Portland, Oregon.  I was able to scrape establishment records from the existing Multnomah County Food Establishment Inspections Search.  Then I got lat/longs for those addresses using Google’s geocode API.  Using [...]]]></description>
			<content:encoded><![CDATA[<p>Inspired by <a href="http://blog.kiwitobes.com/?p=65">Toby Segaran’s</a> creation of a heat map of restaurant health inspection scores for San Francisco, I set out to do the same for Portland, Oregon.  I was able to scrape establishment records from the existing Multnomah County Food Establishment Inspections Search.  Then I got lat/longs for those addresses using <a href="http://">Google’s geocode API</a>.  Using the gathered establishment records I was able to scrape the MCHD search site once more for the Inspection records of those businesses.  Lastly, I displayed the data on a Google map graded green for good score down through to red for the not so good scores.</p>
<p>See the map <a href="/www/mchd/portland-restaurant-health-map.php">here</a>. (It’s plotting ~3000 markers so it can take a bit of time to load).</p>
<p><a href="/www/mchd/portland-restaurant-health-map.php"><img class="size-full wp-image-8 alignnone" title="health-scores-map" src="http://releasethecodes.com/wp-content/uploads/2009/08/picture-12.png" alt="Health Scores Map" /></a></p>
<p>After looking at the map I realized, just as Toby did, other than displaying ‘concerning’ red areas, this map exposes restaurant ‘clusters’ that you may not have known about and can then choose to explore.</p>
<p>Below is some more detail on the techniques I used to build this particular map.</p>
<h3 id="toc-get-the-data">Get the data</h3>
<p>I searched around the web and found the Multnomah County <a href="http://www2.co.multnomah.or.us/Health/mchealthinspect/ListSearch.aspx">Food Establishment Inspections</a> Search.  I made an attempt to get an export of the back-end data for this by calling county health.  They were helpful but when I received the export of the data it was just the business records, not the inspection records for the businesses.  I think they may have just misunderstood me and  I probably could have pressed more and gotten data I needed, but I thought it would be fun the polish the old web scraping skills instead.  Also, a scraping strategy would allow me to refresh the data whenever needed and I wouldn’t have to keep bugging MCHD.</p>
<p><a href="http://seleniumhq.org/">Selenium</a> is a suite of web app testing tools.  Selenium IDE is a firefox addon that records all the actions you take in the browser.  Meant for building functional testing scripts but doubles as a great web scrape script building tool.  What I find most useful about Selenium IDE is that after recording your script you can export it to the xUnit version of your choice, PHPUnit in my case.  This gives you the starting point for your script and you can then add things like database persistence for the information you are scraping and utilize the phpUnit assertion methods to let you know if your script has broken.  Then, you can use a tool called <a href="http://seleniumhq.org/projects/remote-control/">Selenium Remote Control</a> to re-run the script (and drive the browser) anytime you need.  This intro <a href="http://seleniumhq.org/movies/intro.mov">video</a> does a great job of explaining some of Selenium’s features.</p>
<div id="attachment_94" class="wp-caption aligncenter" style="width: 610px"><img class="size-full wp-image-94" title="mchd-running" src="http://releasethecodes.com/wp-content/uploads/2009/08/mchd-running.jpg" alt="mchd-running" width="600" height="322" /><p class="wp-caption-text">Selenium Script Churning Through Data</p></div>
<p>So I needed to accomplish 4 things.</p>
<p>(I included links to the scripts I used, these are by no means ‘production ready’ but some might find them useful as a starting point to their own projects.  Also here is the DB <a href="/www/mchd/health-map-database-sql.html">sql</a> used.)</p>
<h3 id="toc-step-i-pull-the-establishment-records-from-the-mchd-site">Step I: Pull the establishment records from the MCHD site</h3>
<p>I noticed that on the MCHD site, if you just clicked ’search’ without any criteria you were taken to a holistic, paginated set of the records (currently 130 pages for total of just over 3000 records).  So my first script was started with selenium IDE and worked through these 130 pages, gathering establishment meta-data and storing it in a mysql database. The <a href="/www/mchd/scrape-establishments.phps">Script</a></p>
<h3 id="toc-step-ii-pull-the-inspection-scores-for-the-gathered-establishments-from-the-mchd-site">Step II: Pull the inspection scores for the gathered establishments from the MCHD site.</h3>
<p>This was done by again, using Selenium IDE to start a PHPUnit script that scraped the inspection record for each gathered establishment.  It simply queries all the establishment ids from out database and builds URLs to scrape the inspection data for each business and store that information in an inspections table in the database. The <a href="/www/mchd/scrape-establishment-scores.phps">Script</a></p>
<h3 id="toc-step-iii-geocode-the-establishment-records-using-google">Step III: Geocode the Establishment Records using Google</h3>
<p>In preparation for displaying the data on a map, I needed to get the lat/long for each establishment in the database.  I did this using Google’s Geocode service but there are many options for services that can accomplish this.  Just be sure you stay within their Terms Of Use. The <a href="/www/mchd/geocode.phps">Script</a></p>
<h3 id="toc-step-iv-display-the-establishments-on-something-akin-to-a-heat-map">Step IV: Display the Establishments on something akin to a heat-map</h3>
<p>This is the easy part once you’ve done the heavy lifting in steps I,II and III.   It involves one query from the Db to pull the score, latitude, and longitude for each establishment we know about.  Then using a fairly simple php web page we build the HTML and javascript to display this data on a Google map.  The <a href="/www/mchd/portland-restaurant-health-map.phps">Script</a></p>
]]></content:encoded>
			<wfw:commentRss>http://releasethecodes.com/portland-restaurant-health-map/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://seleniumhq.org/movies/intro.mov" length="9052981" type="video/quicktime" />
		</item>
		<item>
		<title>SOLR : very impressive lucene based search tool</title>
		<link>http://releasethecodes.com/solr-very-impressive-lucene-based-search-tool/</link>
		<comments>http://releasethecodes.com/solr-very-impressive-lucene-based-search-tool/#comments</comments>
		<pubDate>Sat, 21 Mar 2009 00:38:00 +0000</pubDate>
		<dc:creator>sam keen</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[search]]></category>

		<guid isPermaLink="false">http://dabbling.in/uncategorized/solr-very-impressive-lucene-based-search-tool</guid>
		<description><![CDATA[Very impressed with Solr and the development community behind it. http://lucene.apache.org/solr/
1.5 days of research, submitted bug and resulting immediate patch and I have a fully functional search engine for a project at work.
If you&#8217;ve ever thought it would be nice to have your very own google type appliance, I highly recommend you check out solr [...]]]></description>
			<content:encoded><![CDATA[<p>Very impressed with Solr and the development community behind it. <a href="http://lucene.apache.org/solr/">http://lucene.apache.org/solr/</a></p>
<p>1.5 days of research, submitted bug and resulting immediate patch and I have a fully functional search engine for a project at work.</p>
<p>If you&#8217;ve ever thought it would be nice to have your very own google type appliance, I highly recommend you check out solr and the underlying IR engine: lucene.</p>
]]></content:encoded>
			<wfw:commentRss>http://releasethecodes.com/solr-very-impressive-lucene-based-search-tool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Passing the Turing Test</title>
		<link>http://releasethecodes.com/passing-the-turing-test/</link>
		<comments>http://releasethecodes.com/passing-the-turing-test/#comments</comments>
		<pubDate>Fri, 20 Mar 2009 17:23:00 +0000</pubDate>
		<dc:creator>sam keen</dc:creator>
				<category><![CDATA[misc]]></category>

		<guid isPermaLink="false">http://dabbling.in/uncategorized/passing-the-turing-test</guid>
		<description><![CDATA[One of the books I am currently reading is &#8220;An Introduction to Neural Networks&#8220;. The introductory chapter covered the Turing Test and the fact that no computer has ever come close to passing it.  The context of the chapter was about the limitations of the computer to house and efficiently access a db of [...]]]></description>
			<content:encoded><![CDATA[<p>One of the books I am currently reading is &#8220;<a href="http://www.amazon.com/Introduction-Neural-Networks-Java-2nd/dp/1604390085/">An Introduction to Neural Networks</a>&#8220;. The introductory chapter covered the <a href="http://en.wikipedia.org/wiki/Turing_test">Turing Test</a> and the fact that no computer has ever come close to passing it.  The context of the chapter was about the limitations of the computer to house and efficiently access a db of <span style="font-style: italic;">human knowledge</span> in order to answer the questions as a human would.</p>
<p>A thought occurred to me.  Are humans becoming more <span style="font-style: italic;">computer-like</span> in the way we interact with each other? In this day and age, many of us interact with computers more than we do with humans.  I&#8217;m doing it write now as I write this.  We gain a great deal of our knowledge as a result of direct contact with computer systems and much of our &#8216;human to human&#8217; interaction are proxied through computer systems (twitter, IM, email, etc) and we adapt our language on those systems accordingly.</p>
<p>For instance,  a human could ask another human:<br />
<span style="font-weight: bold;">&#8220;Hey Sam, are you attending OSCON this year?&#8221;</span></p>
<p>The equivilent tweet might be:<br />
<span style="font-weight: bold;">&#8220;@samkeen are you </span><span style="font-weight: bold;">attending</span><span style="font-weight: bold;"> #oscon2009&#8243;</span></p>
<p>And some line of computer code might be:<br />
<span style="font-family: courier new; font-weight: bold;">if(samkeen.attending(&#8216;oscon2009&#8242;)) {</span><br />
<span style="font-family: courier new; font-weight: bold;"> #take some action;</span><br />
<span style="font-family: courier new; font-weight: bold;">}</span></p>
<p>From this you could conclude that the Tweet syntax is bridging the gap between <span style="font-style: italic;">programming code</span> and <span style="font-style: italic;">human</span> dialogue.</p>
<p>If it is true that the way we attain, and share knowledge is becoming more <span style="font-style: italic;">computer-like</span>,  will that not someday allow a computer system to pass the Turing Test.  Or in that case would it be the human passing the Turing Test?</p>
]]></content:encoded>
			<wfw:commentRss>http://releasethecodes.com/passing-the-turing-test/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Trying out bloggers mobile interface</title>
		<link>http://releasethecodes.com/trying-out-bloggers-mobile-interface/</link>
		<comments>http://releasethecodes.com/trying-out-bloggers-mobile-interface/#comments</comments>
		<pubDate>Wed, 18 Mar 2009 22:16:00 +0000</pubDate>
		<dc:creator>sam keen</dc:creator>
				<category><![CDATA[misc]]></category>

		<guid isPermaLink="false">http://dabbling.in/uncategorized/trying-out-bloggers-mobile-interface</guid>
		<description><![CDATA[

Adding some message body to see where it ends up.
]]></description>
			<content:encoded><![CDATA[<p><img class="size-full wp-image-130 alignleft" title="blogger-mobile" src="http://releasethecodes.com/wp-content/uploads/2009/03/blogger-mobile.jpg" alt="blogger-mobile" width="320" height="240" /></p>
<p class="mobile-photo">
<p>Adding some message body to see where it ends up.</p>
]]></content:encoded>
			<wfw:commentRss>http://releasethecodes.com/trying-out-bloggers-mobile-interface/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>kindle2 web browser</title>
		<link>http://releasethecodes.com/kindle2-web-browser/</link>
		<comments>http://releasethecodes.com/kindle2-web-browser/#comments</comments>
		<pubDate>Tue, 10 Mar 2009 21:53:00 +0000</pubDate>
		<dc:creator>sam keen</dc:creator>
				<category><![CDATA[gadgets]]></category>

		<guid isPermaLink="false">http://dabbling.in/uncategorized/kindle2-web-browser</guid>
		<description><![CDATA[
Very happy with my Kindle2 so far as a book reader.  I enjoy reading tech books and my wife uses it for novels.
I&#8217;ve started playing with the experimental web browser and have found it to be very useful.  As expecting it has trouble with graphics but for mobile oriented sites it has proved [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://releasethecodes.com/wp-content/uploads/2009/03/kindle21.jpg"><img class="alignnone size-medium wp-image-135" title="kindle2" src="http://releasethecodes.com/wp-content/uploads/2009/03/kindle21-225x300.jpg" alt="kindle2" width="225" height="300" /></a></p>
<p>Very happy with my Kindle2 so far as a book reader.  I enjoy reading tech books and my wife uses it for novels.</p>
<div>I&#8217;ve started playing with the experimental web browser and have found it to be very useful.  As expecting it has trouble with graphics but for mobile oriented sites it has proved quite handy, especially since I have access through 3G.</div>
<div>Shown here is m.twitter.com</div>
<div style="clear: both; text-align: left;"></div>
]]></content:encoded>
			<wfw:commentRss>http://releasethecodes.com/kindle2-web-browser/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
