<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>nabeel shahzad</title>
	
	<link>http://nabeelio.com</link>
	<description />
	<lastBuildDate>Mon, 06 Feb 2012 20:15:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/nsslive" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="nsslive" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Breadcrumbs for your Cake (2.1 feature)</title>
		<link>http://nabeelio.com/2012/01/breadcrumbs-for-your-cake-2-1-feature/</link>
		<comments>http://nabeelio.com/2012/01/breadcrumbs-for-your-cake-2-1-feature/#comments</comments>
		<pubDate>Tue, 31 Jan 2012 19:24:48 +0000</pubDate>
		<dc:creator>Nabeel</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://nabeelio.com/?p=379</guid>
		<description><![CDATA[CakePHP 2.1+ (currently in beta) comes with an awesome new feature called view blocks and view extensions (official docs here). This allows you to modify views, append to them, and change them, based on the content that might come later on in your code. Previously, for building a breadcrumb, there was a giant if/else tree [...]]]></description>
			<content:encoded><![CDATA[<p>CakePHP 2.1+ (currently in beta) comes with an awesome new feature called view blocks and view extensions (<a href="http://book.cakephp.org/2.0/en/views.html" target="_blank">official docs here</a>). This allows you to modify views, append to them, and change them, based on the content that might come later on in your code.</p>
<p>Previously, for building a breadcrumb, there was a giant if/else tree for parsing the request object, and views and helpers all structured to allow for the flexibility. In short, a nightmare. Now with view blocks functionality, it reduces it down to a very simple set of elements, which can be called in meaningful views.</p>
<p>View blocks are built as, you guessed it, blocks. Each block has a name (you chose it, whatever is relevant, &#8220;sidebar&#8221;, &#8220;breadcrumb&#8221;). You define a block as such:</p>
<pre class="crayon-plain-tag"><code>// This goes in a view file
$this-&gt;start('breadcrumb');
echo 'Hello';
$this-&gt;end();

// You can also append to a block:
$this-&gt;append('breadcrumb');
echo ' World';
$this-&gt;end();

// And later on you retrieve it:
echo $this-&gt;fetch('breadcrumb');

// Outputs &quot;Hello World&quot;</code></pre>
<p>Where do you place this? In a view file. For example, when a user goes to <em>mysite.com/listings/add</em>, it loads a view in Listings/add.ctp. Inside this file, at the top, you do can do:</p>
<pre class="crayon-plain-tag"><code>// Listings/add.ctp
$this-&gt;start('breadcrumb');
echo &quot;Home &gt; Add Listing&quot;;
$this-&gt;end();

// Continue your view file</code></pre><p><p>This says that when this view (Listings/add.ctp) is loaded, then the breadcrumb should be &#8220;Home > Add Listing&#8221;. Of course this is simplified (I removed any HTML, etc, just to demonstrate).</p>
<p>Now that we have one view block, we need to pull this into the main layout. Since the breadcrumb shows up before any content, we will structure it using an element, which is pulled into the default layout file. I have an element, in Elements/breadcrumbs/base.ctp, which houses the basic structure of my breadcrumb. This element is called from my Layouts/default.ctp (also, super simplified):</p>
<pre class="crayon-plain-tag"><code>// Elements/breadcrumbs/base.ctp
&lt;ul class=&quot;breadcrumb&quot;&gt;
	&lt; ?php
	// There's nothing in this block, so output a default or base-level crumb
	if(!$this-&gt;fetch('breadcrumb')) {
		echo &quot;Home&quot;;
	} else {
		echo $this-&gt;fetch('breadcrumb');
	} ?&gt;
&lt;/ul&gt;


// Layouts/default.ctp
...
&lt;body&gt;
&lt;div id=&quot;nav&quot;&gt;
    &lt; ?php echo $this-&gt;element('breadcrumbs/base'); ?&gt;
&lt;/div&gt;
&lt;div id=&quot;body&quot;&gt;
    &lt; ?php echo $content_for_layout; ?&gt;
&lt;/div&gt;
...
&lt;/body&gt;</code></pre><p><p>
<p>The <em>$this->fetch(&#8216;breadcrumb&#8217;)</em> is getting a block by the name of breadcrumb. I check to see if that block exists; if it doesn&#8217;t, then I output a default item of &#8220;Home&#8221;. Otherwise, I output the contents of the &#8220;breadcrumb&#8221; block.</p>
<p>Then when you load the page, it will show Home, and if you go to Listings/add, it will show Home > Add. Pretty simple! In my views, instead of calling the start()/end(), I have an element, under Elements/breadcrumbs/single.ctp, that builds a single level breadcrumb:</p>
<pre class="crayon-plain-tag"><code>// Elements/breadcrumbs/single.ctp:
$this-&gt;start('breadcrumb');
echo '&lt;a href=&quot;/&quot;&gt;Home&lt;/a&gt; | &lt;a href=&quot;'.$url.'&quot;&gt;'.$title.'&lt;/a&gt;';
$this-&gt;end();

// First line in a view, let's say Listings/add.ctp
echo $this-&gt;element('breadcrumbs/single', array(
    'url' =&gt; 'listings/add', 'title' =&gt; 'Add a Listing'
));</code></pre><p><p><p>
<p>You can clean this up even more by automating it from the $this->request, and using $title_for_layout. I also have another view, which takes an array as a parameter, to build multi-level breadcrumbs:</p>
<pre class="crayon-plain-tag"><code>// Elements/breadcrumbs/multi.ctp:
$this-&gt;start('breadcrumb'); 

echo &quot;&lt;li&gt;&lt;a href='/'&gt;Home&lt;/a&gt;&lt;/li&gt;&quot;;

foreach($items as $i) {
    echo &quot;&lt;li&gt;&lt;a href='{$i[url]}'&gt;{$i[title]}&lt;/a&gt;&lt;/li&gt;&quot;;
}

$this-&gt;end(); 

// Use it in a view:
echo $this-&gt;element('breadcrumbs/multi', array('items' =&gt;
    array(
        array('url' =&gt; '/level1', 'title' =&gt; 'Level 1'),
        array('url' =&gt; '/level2', 'title' =&gt; 'Level 2'),
        // ...
    )
));</code></pre><p><p><p><p>
<p>Hope this helps! The $scripts_for_layout has also been deprecated in favor of of the view-blocks feature, which create, since now Javascript file can be included on a page-by-page basis, using $this->append</p>
]]></content:encoded>
			<wfw:commentRss>http://nabeelio.com/2012/01/breadcrumbs-for-your-cake-2-1-feature/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Node.js and nginx</title>
		<link>http://nabeelio.com/2012/01/node-js-and-nginx/</link>
		<comments>http://nabeelio.com/2012/01/node-js-and-nginx/#comments</comments>
		<pubDate>Sun, 22 Jan 2012 00:48:06 +0000</pubDate>
		<dc:creator>Nabeel</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[nginx]]></category>

		<guid isPermaLink="false">http://nabeelio.com/?p=370</guid>
		<description><![CDATA[This took me some time to figure out, and I didn&#8217;t see any detailed posts or bug reports on how to fix this. Nginx doesn&#8217;t support HTTP 1.1 on proxy pass, meaning, when you place Node.JS behind a proxy (for load balancing purposes, or you just have multiple endpoints on port 80), websockets will not [...]]]></description>
			<content:encoded><![CDATA[<p>This took me some time to figure out, and I didn&#8217;t see any detailed posts or bug reports on how to fix this. Nginx doesn&#8217;t support HTTP 1.1 on proxy pass, meaning, when you place Node.JS behind a proxy (for load balancing purposes, or you just have multiple endpoints on port 80), websockets will not work properly, since HTTP 1.1 is a core requirement. You&#8217;ll know, when you get errors similar to this:</p>
<pre class="crayon-plain-tag"><code>Error during WebSocket handshake: 'Connection' header value is not 'Upgrade'
XMLHttpRequest cannot load ***. Origin *** is not allowed by Access-Control-Allow-Origin.</code></pre>
<p>I&#8217;m running nginx 0.6.8, with nginx 1.0.11. To fix this, you need to upgrade to a later version of nginx (a development version), which supports HTTP 1.1 (albeit, experimentally), and then enable the proxy_http_version 1.1 parameter in your vhost configuration.</p>
<p>I&#8217;m doing this on Ubuntu.</p>
<p>First, let&#8217;s compile nginx:</p>
<pre class="crayon-plain-tag"><code>cd /usr/src
wget http://nginx.org/download/nginx-1.1.13.tar.gz
sudo tar xzvf nginx-1.1.13.tar.gz 
cd nginx-1.1.13
sudo ./configure --prefix=/etc/nginx --sbin-path=/usr/sbin --with-http_ssl_module
sudo make; sudo make install
/usr/sbin/nginx -V

# Something like this should show: 
nginx version: nginx/1.1.13
built by gcc 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3) 
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin --with-http_ssl_module</code></pre><p><p>Next, we setup our vhost:</p>
<pre class="crayon-plain-tag"><code>server {
  listen 80;
  server_name node.domain.com;
  location / {
    proxy_pass http://localhost:8000;   
    proxy_set_header   X-Real-IP            $remote_addr;
    proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
    proxy_set_header   Host                   $http_host;
    proxy_set_header   X-NginX-Proxy    true;
    proxy_redirect off;
    proxy_http_version 1.1;
  }
}</code></pre>
<p>And now no more errors, and nodejs is working properly. Do note that this is a &#8220;bleeding edge&#8221; version of nginx, and could come with its own share of issues &#8211; so keep an eye out and test thoroughly!</p>
<p>Edit: If you&#8217;re still running into some problems, you can enable only xhr-polling/jsonp-polling in your Node.JS/socket.io configuration:</p>
<pre class="crayon-plain-tag"><code>io.set('transports', [ 
  'xhr-polling',
  'jsonp-polling'
]);</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://nabeelio.com/2012/01/node-js-and-nginx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Domain updated!</title>
		<link>http://nabeelio.com/2012/01/domain-updated/</link>
		<comments>http://nabeelio.com/2012/01/domain-updated/#comments</comments>
		<pubDate>Tue, 17 Jan 2012 15:30:22 +0000</pubDate>
		<dc:creator>Nabeel</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://nsslive.net/?p=363</guid>
		<description><![CDATA[I&#8217;m now using &#8220;nabeelio.com&#8221; &#8211; since it&#8217;s been my long-time nickname, and nsslive just doesn&#8217;t mean anything anymore. All links have been updated, the old site will just redirect here. Cheers!]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m now using &#8220;nabeelio.com&#8221; &#8211; since it&#8217;s been my long-time nickname, and nsslive just doesn&#8217;t mean anything anymore. All links have been updated, the old site will just redirect here. Cheers!</p>
]]></content:encoded>
			<wfw:commentRss>http://nabeelio.com/2012/01/domain-updated/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sphinx and CakePHP</title>
		<link>http://nabeelio.com/2012/01/sphinx-and-cakephp/</link>
		<comments>http://nabeelio.com/2012/01/sphinx-and-cakephp/#comments</comments>
		<pubDate>Tue, 03 Jan 2012 15:01:29 +0000</pubDate>
		<dc:creator>Nabeel</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[phpVMS]]></category>

		<guid isPermaLink="false">http://nsslive.net/?p=358</guid>
		<description><![CDATA[For a project, I&#8217;ve decided to use the Sphinx search engine, and was looking for behaviors for CakePHP, to just make it much easier to implement. Since I&#8217;m using Cake 2.0, I could only find something that was for &#60; Cake 1.3. So I decided to update it for use with Cake2.0, and it&#8217;s working [...]]]></description>
			<content:encoded><![CDATA[<p>For a project, I&#8217;ve decided to use the Sphinx search engine, and was looking for behaviors for CakePHP, to just make it much easier to implement. Since I&#8217;m using Cake 2.0, I could only find something that was for &lt; Cake 1.3. So I decided to update it for use with Cake2.0, and it&#8217;s working beautifully with pagination.</p>
<p>It&#8217;s located in my github site:</p>
<p><a href="https://github.com/nshahzad/Sphinx-CakePHP">https://github.com/nshahzad/Sphinx-CakePHP</a></p>
<p>The usage is exactly the same as the original (the link to it is above). The only thing is that it&#8217;s assuming you have the sphinxapi.php (which comes with the Sphinx source) extracted into Vendor/sphinxapi/sphinxapi.php (that&#8217;s where App::import() will look for it).</p>
]]></content:encoded>
			<wfw:commentRss>http://nabeelio.com/2012/01/sphinx-and-cakephp/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Installing Redmine on Ubuntu 11.04 w/nginx and mongrel</title>
		<link>http://nabeelio.com/2011/10/installing-redmine-on-ubuntu-11-04-wnginx-and-mongrel/</link>
		<comments>http://nabeelio.com/2011/10/installing-redmine-on-ubuntu-11-04-wnginx-and-mongrel/#comments</comments>
		<pubDate>Mon, 03 Oct 2011 23:11:31 +0000</pubDate>
		<dc:creator>Nabeel</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://nsslive.net/?p=336</guid>
		<description><![CDATA[This one took me a few hours, but I&#8217;ve got my handy-dandy notes. I&#8217;m going to assume you&#8217;re got nginx installed, whether there are vhosts or not&#8230; I&#8217;m also installing to /var/www/redmine sudo apt-get install mongrel ruby gems cd /var/www wget http://rubyforge.org/frs/download.php/75097/redmine-1.2.1.tar.gz tar xzvf redmine-1.2.1.tar.gz mv redmine-1.2.1 redmine sudo chown www-data: redmine -R sudo chmod [...]]]></description>
			<content:encoded><![CDATA[<p>This one took me a few hours, but I&#8217;ve got my handy-dandy notes. I&#8217;m going to assume you&#8217;re got nginx installed, whether there are vhosts or not&#8230;</p>
<p>I&#8217;m also installing to /var/www/redmine</p>
<pre class="crayon-plain-tag"><code>sudo apt-get install mongrel ruby gems
cd /var/www
wget http://rubyforge.org/frs/download.php/75097/redmine-1.2.1.tar.gz
tar xzvf redmine-1.2.1.tar.gz
mv redmine-1.2.1 redmine
sudo chown www-data: redmine -R
sudo chmod 775 redmine -R</code></pre>
<p>Next, we are going to patch Redmine, to work with Mongrel</p>
<pre class="crayon-plain-tag"><code>cd /var/www/redmine/config/initializers/
wget http://www.redmine.org/attachments/6146/rails_6440_patch.rb
wget https://gist.github.com/raw/826692/cb0dcf784c30e6a6d00c631f350de99ab99e389d/mongrel.rb
sudo chmod 775 . -R
sudo chown www-data: -R</code></pre>
<p>Next, setup the right versions of Rails, etc</p>
<pre class="crayon-plain-tag"><code>gem install -v=2.3.14 rails
gem install rack -v=1.1.1
gem install rake -v0.8.7</code></pre>
<p>Now setup MySQL:</p>
<pre class="crayon-plain-tag"><code>mysql -uroot -p
create user 'redmine'@'localhost' identified by 'password';
grant all privileges on  `redmine%` . * to  'redmine'@'localhost';
create database redmine character set utf8;</code></pre>
<p>And next, we configure and run the installer for Redmine. We are going to edit the database.yml, set it to match your above settings</p>
<pre class="crayon-plain-tag"><code>cd /var/www/redmine/config
mv database.yml.production database.yml
nano database.yml
cd /var/www/redmine
rake generate_session_store
RAILS_ENV=production rake db:migrate
RAILS_ENV=production rake redmine:load_default_data</code></pre>
<p>Next, we start the server</p>
<pre class="crayon-plain-tag"><code>mongrel_rails start -e production -p 9001 -d</code></pre>
<p>Next, create the nginx vhost, I created it as /etc/nginx/sites-enabled/redmine</p>
<pre class="crayon-plain-tag"><code>server {

        listen  80;
        server_name YOUR_HOSTNAME_HERE;
        root /var/www/redmine/public;

        #error_log /var/log/nginx/redmine.log debug;
        expires epoch;

        location / {
                expires epoch;
                alias /var/www/redmine/public/;
                try_files  $uri/index.html $uri.html $uri @mongrel;
        }
        location @mongrel {
                proxy_set_header  X-Real-IP        $remote_addr;
                proxy_set_header  X-Forwarded-For  $proxy_add_x_forwarded_for;
                proxy_set_header  Host             $http_host;
                proxy_pass_header  Set-Cookie;
                proxy_pass        http://127.0.0.1:9001;
        }
}</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://nabeelio.com/2011/10/installing-redmine-on-ubuntu-11-04-wnginx-and-mongrel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL Diff Tool</title>
		<link>http://nabeelio.com/2011/04/mysql-diff-tool/</link>
		<comments>http://nabeelio.com/2011/04/mysql-diff-tool/#comments</comments>
		<pubDate>Wed, 13 Apr 2011 00:52:33 +0000</pubDate>
		<dc:creator>Nabeel</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://nsslive.net/?p=320</guid>
		<description><![CDATA[After searching for a while, I haven&#8217;t been able to find a tool which will show the diffs between two MySQL Databases. There are plenty to handle migrations, but migrations are tough when you&#8217;re writing an app which is install by an end-user. So I wrote a tool/class which will take the XML of a [...]]]></description>
			<content:encoded><![CDATA[<p>After searching for a while, I haven&#8217;t been able to find a tool which will show the diffs between two MySQL Databases. There are plenty to handle migrations, but migrations are tough when you&#8217;re writing an app which is install by an end-user. So I wrote a tool/class which will take the XML of a proper database (that file can be distributed in your package), and then will compare the XML schema against the schema in the current database.</p>
<p>Generate a MySQL Dump file:</p>
<pre class="crayon-plain-tag"><code>mysqldump --xml --no-data testuser -utestuser -ptest1 &gt; structure.xml</code></pre>
<p>Then call the command line script (diffgen):</p><pre class="crayon-plain-tag"><code>diffgen -utestuser -ptest1 -dtestuser -hlocalhost -fstructure.xml -tshow
 
    -u  Database User
    -p  Database Password
    -d  Database Name
    -h  Database Host
    -f  Dump File Path
    -t  &quot;show&quot; or &quot;run&quot; - show will output the SQL, &quot;run&quot; will run the SQL</code></pre><p><p>There&#8217;s also a class file (which it is all from), which you can use to integrate into your own custom scripts (as-is the case with phpVMS, which is distributed with the structure.xml that is generated by my Phing build process, and it &#8220;shapes&#8221; the database on the remote server properly in an update script).</p>
<pre class="crayon-plain-tag"><code>include 'MySQLDiff.class.php';

$params = ;

try {
    $diff = new MySQLDiff(array(
		'dbuser' =&gt; 'testuser',
		'dbpass' =&gt; 'test1',
		'dbname' =&gt; 'testuser',
		'dbhost' =&gt; 'localhost',
		'dumpxml' =&gt; 'structure.xml',
	));    
} catch(Exception $e) {
    echo $e-&gt;getMessage(); exit;
}

# This returns an array of what's missing in the database
try {
    $diff_lines = $diff-&gt;getDiffs();
    var_dump($diff_lines);
 catch(Exception $e) {
    echo $e-&gt;getMessage(); exit;
}

# This returns SQL queries which can be run to fix the database
try {
    $diff_lines = $diff-&gt;getSQLDiffs();
    var_dump($diff_lines);
} catch(Exception $e) {
    echo $e-&gt;getMessage(); exit;
}

# This generates the SQL and actually runs all of them
try { 
    $diff_lines = $diff-&gt;runSQLDiff();
    var_dump($diff_lines);
} catch(Exception $e) {
    echo $e-&gt;getMessage(); exit;
}</code></pre><p><p>
<p>The script can be downloaded from <a href="https://github.com/nshahzad/MySQLDiff">https://github.com/nshahzad/MySQLDiff</a></p>
]]></content:encoded>
			<wfw:commentRss>http://nabeelio.com/2011/04/mysql-diff-tool/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Amazon PHP API</title>
		<link>http://nabeelio.com/2010/09/amazon-php-api/</link>
		<comments>http://nabeelio.com/2010/09/amazon-php-api/#comments</comments>
		<pubDate>Wed, 29 Sep 2010 14:20:56 +0000</pubDate>
		<dc:creator>Nabeel</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://nsslive.net/?p=313</guid>
		<description><![CDATA[I couldn&#8217;t find a working PHP class for the Amazon API, which had Exception handling and some versatility. So I wrote one up. It&#8217;s a work-in-progress at the moment, but it&#8217;s available on GitHub: http://github.com/nshahzad/AmazonAPI The included README has detailed instructions. The class uses the __call() functionality, and you just pass the required parameters as [...]]]></description>
			<content:encoded><![CDATA[<p>I couldn&#8217;t find a working PHP class for the Amazon API, which had Exception handling and some versatility. So I wrote one up. It&#8217;s a work-in-progress at the moment, but it&#8217;s available on GitHub:</p>
<p><a href="http://github.com/nshahzad/AmazonAPI">http://github.com/nshahzad/AmazonAPI</a></p>
<p>The included README has detailed instructions. The class uses the __call() functionality, and you just pass the required parameters as a dictionary array. Requires some reading of the Amazon docs, but much more flexible.</p>
<pre class="crayon-plain-tag"><code>include 'amazon.php';
$amz = new AmazonProductLookup('YOUR AWS KEY', 'YOUR SECRET KEY');</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://nabeelio.com/2010/09/amazon-php-api/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP class for Google Geocoder API</title>
		<link>http://nabeelio.com/2010/07/php-class-for-google-geocoder-api/</link>
		<comments>http://nabeelio.com/2010/07/php-class-for-google-geocoder-api/#comments</comments>
		<pubDate>Sun, 04 Jul 2010 18:44:25 +0000</pubDate>
		<dc:creator>Nabeel</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://nsslive.net/?p=308</guid>
		<description><![CDATA[For a project I&#8217;ve been working on, I needed to access Google&#8217;s Geocoder API. I search for names (schools in this case), and return as much info as I can that Google has about it. I&#8217;ve posted the class up on Github, it&#8217;s straightforward, and might help some people out: http://github.com/nshahzad/Google-Geocoder The usage is in [...]]]></description>
			<content:encoded><![CDATA[<p>For a project I&#8217;ve been working on, I needed to access Google&#8217;s Geocoder API. I search for names (schools in this case), and return as much info as I can that Google has about it.</p>
<p>I&#8217;ve posted the class up on Github, it&#8217;s straightforward, and might help some people out:</p>
<p><a href="http://github.com/nshahzad/Google-Geocoder">http://github.com/nshahzad/Google-Geocoder</a></p>
<p>The usage is in the readme/displayed right on the github page. It uses cURL and JSON to keep the traffic transfered low. That also means you need the json_decode() function, which is in PHP 5.2 and up.</p>
<p>Happy 4th!</p>
]]></content:encoded>
			<wfw:commentRss>http://nabeelio.com/2010/07/php-class-for-google-geocoder-api/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building php-fpm against Ubuntu PHP Packages</title>
		<link>http://nabeelio.com/2010/04/building-php-fpm-against-ubuntu-php-packages/</link>
		<comments>http://nabeelio.com/2010/04/building-php-fpm-against-ubuntu-php-packages/#comments</comments>
		<pubDate>Sun, 04 Apr 2010 15:54:27 +0000</pubDate>
		<dc:creator>Nabeel</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://nsslive.net/?p=295</guid>
		<description><![CDATA[This is how I&#8217;ve been building php-fpm against the Debian PHP packages. It&#8217;ll be useful for when Ubuntu 10.04 (Lucid Lynx) Comes out with PHP 5.3. I do this from my home directory. It will download the package souce from Ubuntu, then compile php-fpm standalone against that. sudo apt-get install php5-cli php5-cgi php5-common \ php5-curl [...]]]></description>
			<content:encoded><![CDATA[<p>This is how I&#8217;ve been building php-fpm against the Debian PHP packages. It&#8217;ll be useful for when Ubuntu 10.04 (Lucid Lynx) Comes out with PHP 5.3. I do this from my home directory. It will download the package souce from Ubuntu, then compile php-fpm standalone against that.</p>
<pre class="crayon-plain-tag"><code>sudo apt-get install php5-cli php5-cgi php5-common \
php5-curl php5-dev php5-gd php5-mcrypt \
php5-memcache php5-mysql php5-suhosin

# Get from the Debian repo
sudo apt-get build-dep php5-common
sudo apt-get -b source php5-common

# Change this to the PHP version being used!
# Look on http://launchpad.net/php-fpm/master to match it
export PHP_VER=5.2.10
wget &quot;http://launchpad.net/php-fpm/master/0.6/+download/php-fpm-0.6-$PHP_VER.tar.gz&quot;
tar -zxvf &quot;php-fpm-0.6-$PHP_VER.tar.gz&quot;
cd &quot;php-fpm-0.6-$PHP_VER&quot;
mkdir fpm-build &amp;&amp; cd fpm-build
sudo ../configure --srcdir=../ \
--with-php-src=&quot;../../php5-5.2.10.dfsg.1&quot; \
--with-php-build=&quot;../../php5-5.2.10.dfsg.1/cgi-build&quot; \
--with-fpm-conf=&quot;/etc/php5/fpm/php-fpm.conf&quot; \
--with-libevent=&quot;/usr/lib&quot;


sudo make
sudo make install
sudo update-rc.d php-fpm defaults

# Resulting in:

Installing PHP FPM binary: /usr/local/bin/php-fpm
Installing PHP FPM config: /etc/php5/fpm/php-fpm.conf
Installing PHP FPM man page: /usr/local/man/man1/php-fpm.1
Installing PHP FPM init script: /etc/init.d/php-fpm

*** FPM Installation complete. ***

run:
`update-rc.d php-fpm defaults; invoke-rc.d php-fpm start`</code></pre>
<p>Then, configure the php-fpm file. That should be it <img src='http://nabeelio.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
			<wfw:commentRss>http://nabeelio.com/2010/04/building-php-fpm-against-ubuntu-php-packages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A better way for nginx PHP config</title>
		<link>http://nabeelio.com/2009/10/a-better-way-for-nginx-php-config/</link>
		<comments>http://nabeelio.com/2009/10/a-better-way-for-nginx-php-config/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 22:23:01 +0000</pubDate>
		<dc:creator>Nabeel</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[nginx]]></category>

		<guid isPermaLink="false">http://nsslive.net/?p=277</guid>
		<description><![CDATA[Doing some reconfiguration on my webserver (nginx) to make it easier to administer. My first goal was to get rid of this nastiness: server { ... location ~ \.php$ { include /etc/nginx/conf/fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/path/to/$fastcgi_script_name; } } It&#8217;s too verbose to copy/paste into each virtual host file. Instead, you can just [...]]]></description>
			<content:encoded><![CDATA[<p>Doing some reconfiguration on my webserver (nginx) to make it easier to administer. My first goal was to get rid of this nastiness:</p>
<pre class="crayon-plain-tag"><code>server {
  ...

  location ~ \.php$ {
        include /etc/nginx/conf/fastcgi_params;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /var/path/to/$fastcgi_script_name;
  }
}</code></pre>
<p>It&#8217;s too verbose to copy/paste into each virtual host file. Instead, you can just combine the file into the /etc/nginx/conf/fastcgi_params file. I renamed it to php_params, and this is what it&#8217;s got:</p>
<pre class="crayon-plain-tag"><code>location ~ \.php(.*)$ {
  fastcgi_pass  127.0.0.1:9000;
  fastcgi_index index.php;

  fastcgi_param  QUERY_STRING       $query_string;
  fastcgi_param  REQUEST_METHOD     $request_method;
  fastcgi_param  CONTENT_TYPE       $content_type;
  fastcgi_param  CONTENT_LENGTH     $content_length;

  fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
  fastcgi_param  REQUEST_URI        $request_uri;
  fastcgi_param  DOCUMENT_URI       $document_uri;
  fastcgi_param  DOCUMENT_ROOT      $document_root;
  fastcgi_param  SERVER_PROTOCOL    $server_protocol;

  fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;

  fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
  fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;

  fastcgi_param  REMOTE_ADDR        $remote_addr;
  fastcgi_param  REMOTE_PORT        $remote_port;
  fastcgi_param  SERVER_ADDR        $server_addr;
  fastcgi_param  SERVER_PORT        $server_port;
  fastcgi_param  SERVER_NAME        $server_name;

  # PHP only, required if PHP was built with --enable-force-cgi-redirect
  fastcgi_param  REDIRECT_STATUS    200;
}</code></pre><p><p>Now I don&#8217;t have to change it everywhere. So, instead, now I do:</p>
<pre class="crayon-plain-tag"><code>server {
  ...
  # Include the PHP Fast-CGI Params
  include /etc/nginx/conf/php_params;
}</code></pre>
<p>Bam! 6 lines down to one, and much easier to administer. I like, I like.</p>
]]></content:encoded>
			<wfw:commentRss>http://nabeelio.com/2009/10/a-better-way-for-nginx-php-config/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss><!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: basic
Database Caching using apc
Object Caching 1221/1314 objects using apc

Served from: nabeelio.com @ 2012-03-28 17:21:43 -->

