<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Hone Watson Bookmarks</title>
	<atom:link href="http://bookmarks.honewatson.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://bookmarks.honewatson.com</link>
	<description>I bring you the best from the web - random bookmarks.</description>
	<lastBuildDate>Mon, 04 Oct 2010 04:13:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='bookmarks.honewatson.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Hone Watson Bookmarks</title>
		<link>http://bookmarks.honewatson.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://bookmarks.honewatson.com/osd.xml" title="Hone Watson Bookmarks" />
	<atom:link rel='hub' href='http://bookmarks.honewatson.com/?pushpress=hub'/>
	<item>
		<title>App Engine StringListProperty Merge Join Attributes Pattern</title>
		<link>http://bookmarks.honewatson.com/2010/07/13/app-engine-stringlistproperty-merge-join-attributes-pattern/</link>
		<comments>http://bookmarks.honewatson.com/2010/07/13/app-engine-stringlistproperty-merge-join-attributes-pattern/#respond</comments>
		<pubDate>Tue, 13 Jul 2010 22:06:40 +0000</pubDate>
		<dc:creator><![CDATA[honewatson]]></dc:creator>
				<category><![CDATA[App Engine]]></category>
		<category><![CDATA[Python Programming]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Merge Join]]></category>

		<guid isPermaLink="false">http://bookmarks.honewatson.com/2010/07/13/app-engine-stringlistproperty-merge-join-attributes-pattern/</guid>
		<description><![CDATA[App Engine StringListProperty and merge join queries offer the ability to perform searches for a variety of purposes. class AttributeTags(db.model): tags = db.StringListProperty() Say for instance you would like to create a data object which needs dynamic properties that are easily searchable &#8211; for example real estate. Tags could be such: a = AttributeTags(tags=['000_3_bedroom', '001_2_bathroom', [&#8230;]<img alt="" border="0" src="http://pixel.wp.com/b.gif?host=bookmarks.honewatson.com&#038;blog=1388057&#038;post=422&#038;subd=honewatson&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>App Engine StringListProperty and merge join queries offer the ability to perform searches for a variety of purposes.</p>
<p><span id="more-422"></span></p>
<pre>

class AttributeTags(db.model):
	tags = db.StringListProperty()

</pre>
<p>Say for instance you would like to create a data object which needs dynamic properties that are easily searchable &#8211; for example real estate.</p>
<p>Tags could be such:</p>
<pre>

a = AttributeTags(tags=['000_3_bedroom', '001_2_bathroom', '002_1_garage'])
a.put()
b = AttributeTags(tags=['000_5_bedroom', '001_4_bathroom', '002_3_garage'])
b.put()
c = AttributeTags(tags=['000_4_bedroom', '001_3_bathroom', '002_3_garage'])
c.put()

SELECT __keys__ FROM AttributeTags WHERE tags &gt;= '000_3' AND tags &lt; '000_4'

</pre><img alt="" border="0" src="http://pixel.wp.com/b.gif?host=bookmarks.honewatson.com&#038;blog=1388057&#038;post=422&#038;subd=honewatson&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://bookmarks.honewatson.com/2010/07/13/app-engine-stringlistproperty-merge-join-attributes-pattern/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/f4e9f5ca1121158385c9408cb2dafd03?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">honewatson</media:title>
		</media:content>
	</item>
		<item>
		<title>Python @staticmethod vs @classmethod</title>
		<link>http://bookmarks.honewatson.com/2010/04/21/python-staticmethod-vs-classmethod/</link>
		<comments>http://bookmarks.honewatson.com/2010/04/21/python-staticmethod-vs-classmethod/#respond</comments>
		<pubDate>Wed, 21 Apr 2010 00:28:57 +0000</pubDate>
		<dc:creator><![CDATA[honewatson]]></dc:creator>
				<category><![CDATA[Python Programming]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://bookmarks.honewatson.com/?p=420</guid>
		<description><![CDATA[Finally, a simple explanation of @staticmethod vs @classmethod. Check this guys description @staticmethod vs @classmethod python.<img alt="" border="0" src="http://pixel.wp.com/b.gif?host=bookmarks.honewatson.com&#038;blog=1388057&#038;post=420&#038;subd=honewatson&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Finally, a simple explanation of @staticmethod vs @classmethod.</p>
<p><span id="more-420"></span></p>
<p>Check this guys description  <a href="http://rapd.wordpress.com/2008/07/02/python-staticmethod-vs-classmethod/">@staticmethod vs @classmethod python</a>.</p><img alt="" border="0" src="http://pixel.wp.com/b.gif?host=bookmarks.honewatson.com&#038;blog=1388057&#038;post=420&#038;subd=honewatson&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://bookmarks.honewatson.com/2010/04/21/python-staticmethod-vs-classmethod/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/f4e9f5ca1121158385c9408cb2dafd03?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">honewatson</media:title>
		</media:content>
	</item>
		<item>
		<title>Recursive Grep</title>
		<link>http://bookmarks.honewatson.com/2010/04/09/recursive-grep/</link>
		<comments>http://bookmarks.honewatson.com/2010/04/09/recursive-grep/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 04:49:08 +0000</pubDate>
		<dc:creator><![CDATA[honewatson]]></dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[egrep]]></category>
		<category><![CDATA[grep]]></category>
		<category><![CDATA[Search]]></category>

		<guid isPermaLink="false">http://bookmarks.honewatson.com/?p=417</guid>
		<description><![CDATA[Want to Grep through the files of a directory and sub directories recursively? find /your/path/here -name \*php -exec grep "text your searching for here" {} \; -exec ls -l {} \; Explained: find /your/path/here (the beginning path) -name \*php (All files that end in php) -exec grep &#8220;text your searching for here&#8221; {} \; (For [&#8230;]<img alt="" border="0" src="http://pixel.wp.com/b.gif?host=bookmarks.honewatson.com&#038;blog=1388057&#038;post=417&#038;subd=honewatson&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Want to Grep through the files of a directory and sub directories recursively?</p>
<p><span id="more-417"></span></p>
<pre>

find /your/path/here -name \*php -exec grep "text your searching for here" {} \; -exec ls -l {} \;

</pre>
<p>Explained:</p>
<p><strong>find /your/path/here</strong></p>
<p>(the beginning path)</p>
<p><strong> -name \*php </strong></p>
<p>(All files that end in php)</p>
<p><strong>-exec grep &#8220;text your searching for here&#8221; {} \;</strong></p>
<p>(For each php file found grep through looking for &#8220;text your searching for here&#8221; then echo the line)</p>
<p><strong> -exec ls -l {} \;</strong></p>
<p>(Echo the full location of the file)</p><img alt="" border="0" src="http://pixel.wp.com/b.gif?host=bookmarks.honewatson.com&#038;blog=1388057&#038;post=417&#038;subd=honewatson&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://bookmarks.honewatson.com/2010/04/09/recursive-grep/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/f4e9f5ca1121158385c9408cb2dafd03?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">honewatson</media:title>
		</media:content>
	</item>
		<item>
		<title>Drupal 6 Redirect Form hook_form_alter</title>
		<link>http://bookmarks.honewatson.com/2010/03/03/drupal-6-redirect-form-hook_form_alter/</link>
		<comments>http://bookmarks.honewatson.com/2010/03/03/drupal-6-redirect-form-hook_form_alter/#respond</comments>
		<pubDate>Wed, 03 Mar 2010 10:52:32 +0000</pubDate>
		<dc:creator><![CDATA[honewatson]]></dc:creator>
				<category><![CDATA[Drupal Development]]></category>
		<category><![CDATA[Web Apps]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[hook_form_alter]]></category>

		<guid isPermaLink="false">http://bookmarks.honewatson.com/2010/03/03/drupal-6-redirect-form-hook_form_alter/</guid>
		<description><![CDATA[How to redirect a form in drupal 6. Inside your module call hook_form_alter. function yourModuleName_form_alter(&#38;$form, $form_state, $form_id) { if ($form_id == 'user_register') { $form['#redirect'][] = 'node/341'; } } Of course you need to find the appropriate $form_id.<img alt="" border="0" src="http://pixel.wp.com/b.gif?host=bookmarks.honewatson.com&#038;blog=1388057&#038;post=415&#038;subd=honewatson&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>How to redirect a form in drupal 6.</p>
<p><span id="more-415"></span></p>
<p>Inside your module call hook_form_alter.</p>
<pre>
function yourModuleName_form_alter(&amp;$form, $form_state, $form_id) {
 	if ($form_id == 'user_register') {	
		$form['#redirect'][] = 'node/341';
	}
}

</pre>
<p>Of course you need to find the appropriate $form_id.</p><img alt="" border="0" src="http://pixel.wp.com/b.gif?host=bookmarks.honewatson.com&#038;blog=1388057&#038;post=415&#038;subd=honewatson&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://bookmarks.honewatson.com/2010/03/03/drupal-6-redirect-form-hook_form_alter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/f4e9f5ca1121158385c9408cb2dafd03?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">honewatson</media:title>
		</media:content>
	</item>
		<item>
		<title>Best Drupal Blog Tips</title>
		<link>http://bookmarks.honewatson.com/2010/02/18/best-drupal-blog-tips/</link>
		<comments>http://bookmarks.honewatson.com/2010/02/18/best-drupal-blog-tips/#respond</comments>
		<pubDate>Thu, 18 Feb 2010 03:14:20 +0000</pubDate>
		<dc:creator><![CDATA[honewatson]]></dc:creator>
				<category><![CDATA[Drupal Development]]></category>
		<category><![CDATA[Web Apps]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[drupal]]></category>

		<guid isPermaLink="false">http://bookmarks.honewatson.com/2010/02/18/best-drupal-blog-tips/</guid>
		<description><![CDATA[This is the best Drupal blog tips I&#8217;ve ever seen. It&#8217;s got simple to understand Drupal Developer tips which are presented in an easy to read manner. Eric&#8217;s Drupal Blog. A great section which has a number of form alter snippets for drupal.<img alt="" border="0" src="http://pixel.wp.com/b.gif?host=bookmarks.honewatson.com&#038;blog=1388057&#038;post=414&#038;subd=honewatson&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>This is the best Drupal blog tips I&#8217;ve ever seen.  It&#8217;s got simple to understand Drupal Developer tips which are presented in an easy to read manner.</p>
<p><span id="more-414"></span></p>
<p><a href="http://thedrupalblog.com/">Eric&#8217;s Drupal Blog</a>.</p>
<p>A great section which has a number of <a href="http://thedrupalblog.com/category/tags/form-alter">form alter snippets</a> for drupal.</p><img alt="" border="0" src="http://pixel.wp.com/b.gif?host=bookmarks.honewatson.com&#038;blog=1388057&#038;post=414&#038;subd=honewatson&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://bookmarks.honewatson.com/2010/02/18/best-drupal-blog-tips/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/f4e9f5ca1121158385c9408cb2dafd03?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">honewatson</media:title>
		</media:content>
	</item>
		<item>
		<title>Svn add all new files</title>
		<link>http://bookmarks.honewatson.com/2010/02/17/svn-add-all-new-files/</link>
		<comments>http://bookmarks.honewatson.com/2010/02/17/svn-add-all-new-files/#respond</comments>
		<pubDate>Wed, 17 Feb 2010 04:11:40 +0000</pubDate>
		<dc:creator><![CDATA[honewatson]]></dc:creator>
				<category><![CDATA[Web Apps]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://bookmarks.honewatson.com/?p=411</guid>
		<description><![CDATA[Want to add all new SVN files recursively? Use command line with svn and grep. svn status &#124; grep "^\?" &#124; awk '{print $2}' &#124; xargs svn add Original SVN brief. Plus check out this handy SVN cheatsheet.<img alt="" border="0" src="http://pixel.wp.com/b.gif?host=bookmarks.honewatson.com&#038;blog=1388057&#038;post=411&#038;subd=honewatson&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Want to add all new SVN files recursively?</p>
<p><span id="more-411"></span></p>
<p>Use command line with svn and grep.</p>
<pre>
svn status | grep "^\?" | awk '{print $2}' | xargs svn add
</pre>
<p><a href="http://lukewarmtapioca.com/2005/06/01/adding-all-new-files-with-svn/">Original SVN brief.</a></p>
<p>Plus check out this handy <a href="http://www.abbeyworkshop.com/howto/misc/svn01/">SVN cheatsheet</a>.</p><img alt="" border="0" src="http://pixel.wp.com/b.gif?host=bookmarks.honewatson.com&#038;blog=1388057&#038;post=411&#038;subd=honewatson&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://bookmarks.honewatson.com/2010/02/17/svn-add-all-new-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/f4e9f5ca1121158385c9408cb2dafd03?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">honewatson</media:title>
		</media:content>
	</item>
		<item>
		<title>k2 search engine friendly seo url&#8217;s Artio JoomSef sef Fix for Joomla</title>
		<link>http://bookmarks.honewatson.com/2010/02/17/k2-search-engine-friendly-seo-urls-artio-joomsef-sef-fix-for-joomla/</link>
		<comments>http://bookmarks.honewatson.com/2010/02/17/k2-search-engine-friendly-seo-urls-artio-joomsef-sef-fix-for-joomla/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 00:23:18 +0000</pubDate>
		<dc:creator><![CDATA[honewatson]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Web Apps]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Joomla]]></category>
		<category><![CDATA[sef]]></category>
		<category><![CDATA[seo]]></category>

		<guid isPermaLink="false">http://bookmarks.honewatson.com/?p=408</guid>
		<description><![CDATA[If you&#8217;re having issues with search engine friendly URL&#8217;s in K2 you can use the Artio JoomSef component with the Artio JoomSef k2 extension. You need to change the following file /components/com_sef/sef_ext/com_k2.php. The following getItemTitle function in the SefExt_com_k2 class needs to be replaced with this function: function getItemTitle($id){ $database =&#38; JFactory::getDBO(); if(preg_match('!:!', $id)) { [&#8230;]<img alt="" border="0" src="http://pixel.wp.com/b.gif?host=bookmarks.honewatson.com&#038;blog=1388057&#038;post=408&#038;subd=honewatson&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>If you&#8217;re having issues with search engine friendly URL&#8217;s in K2 you can use the Artio JoomSef component with the Artio JoomSef k2 extension.  <span id="more-408"></span></p>
<p>You need to change the following file /components/com_sef/sef_ext/com_k2.php.</p>
<p>The following getItemTitle function in the SefExt_com_k2 class needs to be replaced with this function:</p>
<pre>


    function getItemTitle($id){

        $database =&amp; JFactory::getDBO();



	if(preg_match('!:!', $id)) {

	    $idExplode = explode(':', $id);

	    $id = intval($id[0]);

	};

        $database-&gt;setQuery("SELECT `title`, `alias`, `catid` FROM `#__k2_items` WHERE `id` = $id");

        $item = $database-&gt;loadObject();



		$cat = $this-&gt;getCategoryTitle($item-&gt;catid);



		$name = $item-&gt;alias;

		array_push($cat, $name);

		

		return $cat;

    }
</pre><img alt="" border="0" src="http://pixel.wp.com/b.gif?host=bookmarks.honewatson.com&#038;blog=1388057&#038;post=408&#038;subd=honewatson&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://bookmarks.honewatson.com/2010/02/17/k2-search-engine-friendly-seo-urls-artio-joomsef-sef-fix-for-joomla/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/f4e9f5ca1121158385c9408cb2dafd03?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">honewatson</media:title>
		</media:content>
	</item>
		<item>
		<title>Drupal 6 node.save services taxonomy xmlrpc php and python</title>
		<link>http://bookmarks.honewatson.com/2009/11/20/drupal-6-node-save-services-taxonomy-xmlrpc-php-and-python/</link>
		<comments>http://bookmarks.honewatson.com/2009/11/20/drupal-6-node-save-services-taxonomy-xmlrpc-php-and-python/#respond</comments>
		<pubDate>Fri, 20 Nov 2009 00:54:43 +0000</pubDate>
		<dc:creator><![CDATA[honewatson]]></dc:creator>
				<category><![CDATA[Drupal Development]]></category>
		<category><![CDATA[Web Apps]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[xmlrpc]]></category>

		<guid isPermaLink="false">http://bookmarks.honewatson.com/2009/11/20/drupal-6-node-save-services-taxonomy-xmlrpc-php-and-python/</guid>
		<description><![CDATA[Drupal 6 node.save uses different methods for saving taxonomy for different taxonomy types. For multiple select based taxonomy: (php) $nodeObj-&#62;taxonomy = array(2=&#62;array(15,19)); (python) nodeOb['taxonomy']['2'] = [15,19] For tags based taxonomy: (php) $nodeObj-&#62;taxonomy = array( 'tags' =&#62; array( 2=&#62;'military,navy' ) );<img alt="" border="0" src="http://pixel.wp.com/b.gif?host=bookmarks.honewatson.com&#038;blog=1388057&#038;post=405&#038;subd=honewatson&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Drupal 6 node.save uses different methods for saving taxonomy for different taxonomy types.</p>
<p>For multiple select based taxonomy:</p>
<p>(php)</p>
<pre>
$nodeObj-&gt;taxonomy = array(2=&gt;array(15,19));
</pre>
<p>(python)</p>
<pre>
nodeOb['taxonomy']['2'] = [15,19]
</pre>
<p>For tags based taxonomy:</p>
<p>(php)</p>
<pre>
$nodeObj-&gt;taxonomy = array(
  'tags' =&gt; array(
         2=&gt;'military,navy'
   )
);
</pre><img alt="" border="0" src="http://pixel.wp.com/b.gif?host=bookmarks.honewatson.com&#038;blog=1388057&#038;post=405&#038;subd=honewatson&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://bookmarks.honewatson.com/2009/11/20/drupal-6-node-save-services-taxonomy-xmlrpc-php-and-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/f4e9f5ca1121158385c9408cb2dafd03?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">honewatson</media:title>
		</media:content>
	</item>
		<item>
		<title>Nginx WordPress Mu FastCgi_Cache Conf Rewrites</title>
		<link>http://bookmarks.honewatson.com/2009/09/02/nginx-wordpress-mu-fastcgi_cache-conf-rewrites/</link>
		<comments>http://bookmarks.honewatson.com/2009/09/02/nginx-wordpress-mu-fastcgi_cache-conf-rewrites/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 05:17:13 +0000</pubDate>
		<dc:creator><![CDATA[honewatson]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php-fpm]]></category>

		<guid isPermaLink="false">http://bookmarks.honewatson.com/2009/09/02/nginx-wordpress-mu-fastcgi_cache-conf-rewrites/</guid>
		<description><![CDATA[Nginx fastcgi cache with php-fpm can be a super fast of serving WordPress Mu. Nginx WordPress Mu FastCgi_Cache Conf Rewrites are an interesting thing to get set up because of the cookie situation. You also don&#8217;t want to have wp-admin php files cached either. One of the problems with mu supercache is it doesn&#8217;t have [&#8230;]<img alt="" border="0" src="http://pixel.wp.com/b.gif?host=bookmarks.honewatson.com&#038;blog=1388057&#038;post=393&#038;subd=honewatson&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Nginx fastcgi cache with php-fpm can be a super fast of serving WordPress Mu.</p>
<p>Nginx WordPress Mu FastCgi_Cache Conf Rewrites are an interesting thing to get set up because of the cookie situation.  You also don&#8217;t want to have wp-admin php files cached either.<span id="more-393"></span></p>
<p>One of the problems with mu supercache is it doesn&#8217;t have very good support for Nginx.  By default I think the latest version turns off the supercache portion if it cannot detect the apache mod_rewrite module or htaccess file.  This means supercache is automatically turned off for nginx servers.</p>
<p>The Nginx fastcgi_cache is blistering fast and makes supercache redundant for Nginx users.</p>
<p>Usually Nginx caches a response depending on whether you have added &#8220;X-Accel-Expires: 0&#8221; in the response with the cookie.  Then you include the cookie in your key.  This seemed unnecessarily complicated to set up on the wordpress side.  It did require a bit of lateral thinking to get something quick n dirty up and working that avoided the above approach.</p>
<p>Really the only content you want nginx fastcgi cached is any permalink running off /index.php the wordpress controller for all published page requests.  I couldn&#8217;t get try_files working so I just flagged the rest.  This set up is for cache to expire after one day for successful 302 and 200 requests.</p>
<p>Step One:</p>
<p>The first step is in the root folder of your Mu WordPress folder make a copy of your index.php file which is the wordpress controller and call it second_index.php.</p>
<p>example:</p>
<p>/home/mu/public_html/index.php<br />
/home/mu/public_html/second_index.php</p>
<p>Of course in your root wordpress folder there will be all the standard other wordpress files and folders.</p>
<p>Step Two:</p>
<p>In the main http { } area of your nginx create an area where the cached files are to be stored:</p>
<pre>
http {

fastcgi_cache_path  /var/nginx_cache levels=1:2 keys_zone=one:100m inactive=7d max_size=4g;

...
...
...
}
</pre>
<p>The above configuration sets the path to where the cache will be stored.  Level&#8217;s is the number of folders to use for the cache.  </p>
<p>keys_zone is the name of the zone which you will specify in your fast_cgi parameters and 100m means that nginx will use up to 100m for to store the key values.  </p>
<p>Inactive is the time that the cache file will stay in the cache inactive  before its deleted.  I&#8217;ve set this to a long time because I&#8217;d like to have static files cached for up to 7 days.  </p>
<p>max_size is the size of the maximum cache size. I&#8217;ve set 4 gigabytes.</p>
<p>The cached files are stored as binary files.  The key of the file is written in the binary file before the headers and the content.  The file name of the cached fastcgi request is an md5 of the url.  For example &#8216;bookmarks.honewatson.com/2009/09/02/nginx-wordpress-mu-fastcgi_cache-conf-rewrites/&#8217; filename is 119a34a0e9e5817140836ffb44883df1.  Using this knowledge I suppose a plugin could be written to grep through and delete the cache file if it is edited or comments are added.</p>
<p>Step Three:</p>
<p>Create a configuration that will direct all non-logged in cookie users to a location where requests are cached.  For all other php files, do not cache.  You don&#8217;t want to fastcgi_cache files of logged in users.  No php files in wp-admin are cached.  Any requests of logged in users are sent to second_index.php which is not cached.   They can see regularly updated comments.   You could also set it up so the cache time is much lower for logged in users.  Maybe 5 minutes.  I&#8217;ll include a second configuration down the bottom for this.</p>
<p>This means you get far greater control than you would with supercache.</p>
<p>So here is something that is working for me:</p>
<pre>
location / {
            	root   /home/mu/public_html;
            	index index.php;
		if ($http_cookie ~* "comment_author_|wordpress|wp-postpass_" ) {
			error_page       404 = /second_index.php?q=$uri;
			 
		}
	    	error_page       404 = /index.php?q=$uri;
}


location ~ /index\.php.*$ {
	fastcgi_cache_key $host$request_uri;
	fastcgi_cache_valid 200 302 1d;
	fastcgi_cache_valid 301 7d;
	fastcgi_cache_valid any 5m;
	fastcgi_cache_use_stale off;
	fastcgi_cache one;  
	fastcgi_ignore_headers  Cache-Control  Expires;
	fastcgi_pass   127.0.0.1:9000;
	fastcgi_index  index.php;
	fastcgi_param  SCRIPT_FILENAME /home/mu/public_html$fastcgi_script_name;
	include        /usr/local/nginx/conf/fastcgi_params;
}

location ~ \.php$ {
	fastcgi_pass   127.0.0.1:9000;
	fastcgi_index  index.php;
	fastcgi_param  SCRIPT_FILENAME /home/mu/public_html$fastcgi_script_name;
	include        /usr/local/nginx/conf/fastcgi_params;
}

</pre>
<p>Second configuration:</p>
<ol>
<li>Cache any 200 or 302 published content requests from anonymous users for 1 day.</li>
<li>Cache any 200 or 302 published content requests for logged in users for 5 minutes.</li>
<li>Don&#8217;t cache any other php files.</li>
</ol>
<pre>

location / {
            	root   /home/mu/public_html;
            	index index.php;
		if ($http_cookie ~* "comment_author_|wordpress|wp-postpass_" ) {
			error_page       404 = /second_index.php?q=$uri;
			 
		}
	    	error_page       404 = /index.php?q=$uri;
}


location ~ /index\.php.*$ {
	fastcgi_cache_key $host$request_uri;
	fastcgi_cache_valid 200 302 1d;
	fastcgi_cache_valid 301 7d;
	fastcgi_cache_valid any 5m;
	fastcgi_cache_use_stale off;
	fastcgi_cache one;  
	fastcgi_ignore_headers  Cache-Control  Expires;
	fastcgi_pass   127.0.0.1:9000;
	fastcgi_index  index.php;
	fastcgi_param  SCRIPT_FILENAME /home/mu/public_html$fastcgi_script_name;
	include        /usr/local/nginx/conf/fastcgi_params;
}

location ~ /second_index\.php.*$ {
	fastcgi_cache_key $host$request_uri;
	fastcgi_cache_valid 200 302 5m;
	fastcgi_cache_valid 301 1d;
	fastcgi_cache_valid any 5m;
	fastcgi_cache_use_stale off;
	fastcgi_cache one;  
	fastcgi_ignore_headers  Cache-Control  Expires;
	fastcgi_pass   127.0.0.1:9000;
	fastcgi_index  index.php;
	fastcgi_param  SCRIPT_FILENAME /home/mu/public_html$fastcgi_script_name;
	include        /usr/local/nginx/conf/fastcgi_params;
}


location ~ \.php$ {
	fastcgi_pass   127.0.0.1:9000;
	fastcgi_index  index.php;
	fastcgi_param  SCRIPT_FILENAME /home/mu/public_html$fastcgi_script_name;
	include        /usr/local/nginx/conf/fastcgi_params;
}

</pre>
<p>Third configuration:</p>
<ol>
<li>Cache uploaded files for 7 days &#8211; slip this extra configuration in before the all other php files location.</li>
</ol>
<pre>



location ~ /wp-content/blogs\.php.*$ {
access_log  /nginx_logs/muimagesphp_cache.access.log small_php;
fastcgi_read_timeout 10;
fastcgi_cache_key $host$request_uri;
	fastcgi_cache_valid 200 302 7d;
	fastcgi_cache_valid 301 7d;
       fastcgi_cache_valid 504 1s;
	fastcgi_cache_valid any 5m;
	fastcgi_cache_use_stale off;
	fastcgi_cache one;  
	fastcgi_ignore_headers  Cache-Control  Expires;
	fastcgi_pass   127.0.0.1:8084;
	fastcgi_index  index.php;
	fastcgi_param  SCRIPT_FILENAME /home/mu/public_html$fastcgi_script_name;
	include        /usr/local/nginx/conf/fastcgi_params;
}


location ~ \.php$ {
...
... etc

}


</pre><img alt="" border="0" src="http://pixel.wp.com/b.gif?host=bookmarks.honewatson.com&#038;blog=1388057&#038;post=393&#038;subd=honewatson&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://bookmarks.honewatson.com/2009/09/02/nginx-wordpress-mu-fastcgi_cache-conf-rewrites/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/f4e9f5ca1121158385c9408cb2dafd03?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">honewatson</media:title>
		</media:content>
	</item>
		<item>
		<title>Trac configured with Nginx MySql Python SVN on Ubuntu</title>
		<link>http://bookmarks.honewatson.com/2009/09/01/trac-configured-with-nginx-mysql-python-svn-on-ubuntu/</link>
		<comments>http://bookmarks.honewatson.com/2009/09/01/trac-configured-with-nginx-mysql-python-svn-on-ubuntu/#respond</comments>
		<pubDate>Tue, 01 Sep 2009 06:52:20 +0000</pubDate>
		<dc:creator><![CDATA[honewatson]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[trac]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://bookmarks.honewatson.com/2009/09/01/trac-configured-with-nginx-mysql-python-svn-on-ubuntu/</guid>
		<description><![CDATA[Assuming you&#8217;ve downloaded ./configure &#38;&#38; make &#38;&#38; make install the latest nginx and have mysql, svn already installed. More info on installing svn and setting up svn here. apt-get install trac apt-get install python-mysqldb Now once I&#8217;ll assume you&#8217;ve set up an svn repostitory in /home/svn/myproject. trac-admin /home/trac/myproject initenv #fill in details here assume project [&#8230;]<img alt="" border="0" src="http://pixel.wp.com/b.gif?host=bookmarks.honewatson.com&#038;blog=1388057&#038;post=392&#038;subd=honewatson&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Assuming you&#8217;ve downloaded ./configure &amp;&amp; make &amp;&amp; make install the latest nginx and have mysql, svn already installed.   More info on installing svn and setting up <a href="http://bookmarks.honewatson.com/tag/svn/">svn here</a>.</p>
<p><span id="more-392"></span></p>
<pre>
apt-get install trac
apt-get install python-mysqldb
</pre>
<p>Now once I&#8217;ll assume you&#8217;ve set up an svn repostitory in /home/svn/myproject.</p>
<pre>
trac-admin /home/trac/myproject initenv #fill in details here assume project name is myproject
htdigest -c /home/trac/myproject.passwd myproject.com my_username
trac-admin /home/trac/myproject permission add my_username TRAC_ADMIN
chown -R www-data /home/trac/myproject
sudo -u www-data tracd -d -p 3110 --auth=myproject,/home/trac/myproject.passwd,myproject.com /home/trac/myproject
</pre>
<p>Now you have a tracd server daemonized.</p>
<p>Now add an nginx conf file in your nginx conf directory:</p>
<pre>
 upstream live_trachosts_com {
          server  127.0.0.1:3110;
  }
  
  server {
          listen          80;
          server_name     myproject.com;
          location / {
                rewrite ^/$ /myproject last;
                  proxy_pass      http://live_trachosts_com;
          }
  
  }
</pre>
<p>Now restart/reload Nginx.</p><img alt="" border="0" src="http://pixel.wp.com/b.gif?host=bookmarks.honewatson.com&#038;blog=1388057&#038;post=392&#038;subd=honewatson&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://bookmarks.honewatson.com/2009/09/01/trac-configured-with-nginx-mysql-python-svn-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/f4e9f5ca1121158385c9408cb2dafd03?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">honewatson</media:title>
		</media:content>
	</item>
	</channel>
</rss>
