<?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"
	>

<channel>
	<title>Chanel's Blog</title>
	<atom:link href="http://cmunezero.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://cmunezero.com</link>
	<description>Ravings of a mad coder.  My thoughts on programming, music, and everything else I experience in life.</description>
	<pubDate>Tue, 02 Sep 2008 17:40:59 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
			<item>
		<title>jQuery: Syncronising Multiple Objects and Animations</title>
		<link>http://cmunezero.com/2008/09/02/jquery-syncronising-multiple-objects-and-animations/</link>
		<comments>http://cmunezero.com/2008/09/02/jquery-syncronising-multiple-objects-and-animations/#comments</comments>
		<pubDate>Tue, 02 Sep 2008 17:40:59 +0000</pubDate>
		<dc:creator>chanel</dc:creator>
		
		<category><![CDATA[javascript]]></category>

		<category><![CDATA[jquery]]></category>

		<category><![CDATA[animate]]></category>

		<category><![CDATA[animation]]></category>

		<category><![CDATA[attributes]]></category>

		<category><![CDATA[css]]></category>

		<category><![CDATA[dhtml]]></category>

		<category><![CDATA[dom]]></category>

		<category><![CDATA[html]]></category>

		<category><![CDATA[interval]]></category>

		<category><![CDATA[jquery javascript]]></category>

		<category><![CDATA[timer interval]]></category>

		<category><![CDATA[timers]]></category>

		<guid isPermaLink="false">http://cmunezero.com/?p=78</guid>
		<description><![CDATA[I was just told to do some crazy animations involving multiple css attributes on multiple DOM objects.  With jQuery and its animate method, this is fairly easy to do:

$&#40;obj1&#41;.animate&#40;&#123;height:10,width:32,margin:30,left:5&#125;&#41;;
$&#40;obj2&#41;.animate&#40;&#123;height:20,width:62,margin:20,left:45&#125;&#41;;
$&#40;obj3&#41;.animate&#40;&#123;height:30,width:92,margin:10,left:25&#125;&#41;;
$&#40;obj4&#41;.animate&#40;&#123;height:40,width:122,margin:00,left:23&#125;&#41;;

Well everything is not entirely prefect because each animation occurs within its own timer interval.  If one animation is slighter more complex than the other, [...]]]></description>
			<content:encoded><![CDATA[<p>I was just told to do some crazy animations involving multiple css attributes on multiple DOM objects.  With <a href="http://jquery.com">jQuery</a> and its <a href="http://docs.jquery.com/Effects/animate#paramsdurationeasingcallback">animate</a> method, this is fairly easy to do:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript">$<span style="color: #009900;">&#40;</span>obj1<span style="color: #009900;">&#41;</span>.<span style="color: #006600;">animate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>height<span style="color: #339933;">:</span><span style="color: #CC0000;">10</span><span style="color: #339933;">,</span>width<span style="color: #339933;">:</span><span style="color: #CC0000;">32</span><span style="color: #339933;">,</span>margin<span style="color: #339933;">:</span><span style="color: #CC0000;">30</span><span style="color: #339933;">,</span>left<span style="color: #339933;">:</span><span style="color: #CC0000;">5</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
$<span style="color: #009900;">&#40;</span>obj2<span style="color: #009900;">&#41;</span>.<span style="color: #006600;">animate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>height<span style="color: #339933;">:</span><span style="color: #CC0000;">20</span><span style="color: #339933;">,</span>width<span style="color: #339933;">:</span><span style="color: #CC0000;">62</span><span style="color: #339933;">,</span>margin<span style="color: #339933;">:</span><span style="color: #CC0000;">20</span><span style="color: #339933;">,</span>left<span style="color: #339933;">:</span><span style="color: #CC0000;">45</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
$<span style="color: #009900;">&#40;</span>obj3<span style="color: #009900;">&#41;</span>.<span style="color: #006600;">animate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>height<span style="color: #339933;">:</span><span style="color: #CC0000;">30</span><span style="color: #339933;">,</span>width<span style="color: #339933;">:</span><span style="color: #CC0000;">92</span><span style="color: #339933;">,</span>margin<span style="color: #339933;">:</span><span style="color: #CC0000;">10</span><span style="color: #339933;">,</span>left<span style="color: #339933;">:</span><span style="color: #CC0000;">25</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
$<span style="color: #009900;">&#40;</span>obj4<span style="color: #009900;">&#41;</span>.<span style="color: #006600;">animate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>height<span style="color: #339933;">:</span><span style="color: #CC0000;">40</span><span style="color: #339933;">,</span>width<span style="color: #339933;">:</span><span style="color: #CC0000;">122</span><span style="color: #339933;">,</span>margin<span style="color: #339933;">:</span><span style="color: #CC0000;">00</span><span style="color: #339933;">,</span>left<span style="color: #339933;">:</span><span style="color: #CC0000;">23</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Well everything is not entirely prefect because each animation occurs within its own timer interval.  If one animation is slighter more complex than the other, it forces the rest of the animations to wait.  This problem compounds itself to create an &#8220;easing&#8221; affect where the animation appears exponentially instead of linearly.  This is due to how browsers fail to isolate different javascript timers or tabs from affecting each other.  </p>
<p>Now my quest is to find an animation plugin where you can animate multiple objects with their own parameters in a single animation timer interval to ensure smooth, linear animation.  If I can&#8217;t find one, this might be my chance to finally submit something back to jQuery.  It might look something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript">$.<span style="color: #006600;">animate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span>
    <span style="color: #009900;">&#123;</span>obj<span style="color: #339933;">:</span> obj1<span style="color: #339933;">,</span> params<span style="color: #339933;">:</span><span style="color: #009900;">&#123;</span>height<span style="color: #339933;">:</span><span style="color: #CC0000;">10</span><span style="color: #339933;">,</span>width<span style="color: #339933;">:</span><span style="color: #CC0000;">32</span><span style="color: #339933;">,</span>margin<span style="color: #339933;">:</span><span style="color: #CC0000;">30</span><span style="color: #339933;">,</span>left<span style="color: #339933;">:</span><span style="color: #CC0000;">5</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    <span style="color: #009900;">&#123;</span>obj<span style="color: #339933;">:</span> obj2<span style="color: #339933;">,</span> params<span style="color: #339933;">:</span><span style="color: #009900;">&#123;</span>height<span style="color: #339933;">:</span><span style="color: #CC0000;">20</span><span style="color: #339933;">,</span>width<span style="color: #339933;">:</span><span style="color: #CC0000;">62</span><span style="color: #339933;">,</span>margin<span style="color: #339933;">:</span><span style="color: #CC0000;">20</span><span style="color: #339933;">,</span>left<span style="color: #339933;">:</span><span style="color: #CC0000;">45</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    <span style="color: #009900;">&#123;</span>obj<span style="color: #339933;">:</span> obj3<span style="color: #339933;">,</span> params<span style="color: #339933;">:</span><span style="color: #009900;">&#123;</span>height<span style="color: #339933;">:</span><span style="color: #CC0000;">30</span><span style="color: #339933;">,</span>width<span style="color: #339933;">:</span><span style="color: #CC0000;">92</span><span style="color: #339933;">,</span>margin<span style="color: #339933;">:</span><span style="color: #CC0000;">10</span><span style="color: #339933;">,</span>left<span style="color: #339933;">:</span><span style="color: #CC0000;">25</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    <span style="color: #009900;">&#123;</span>obj<span style="color: #339933;">:</span> obj4<span style="color: #339933;">,</span> params<span style="color: #339933;">:</span><span style="color: #009900;">&#123;</span>height<span style="color: #339933;">:</span><span style="color: #CC0000;">40</span><span style="color: #339933;">,</span>width<span style="color: #339933;">:</span><span style="color: #CC0000;">122</span><span style="color: #339933;">,</span>margin<span style="color: #339933;">:</span><span style="color: #CC0000;">00</span><span style="color: #339933;">,</span>left<span style="color: #339933;">:</span><span style="color: #CC0000;">23</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://cmunezero.com/2008/09/02/jquery-syncronising-multiple-objects-and-animations/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Useful Linux Commands: Find and Search</title>
		<link>http://cmunezero.com/2008/09/01/useful-linux-scripts-find-and-search/</link>
		<comments>http://cmunezero.com/2008/09/01/useful-linux-scripts-find-and-search/#comments</comments>
		<pubDate>Tue, 02 Sep 2008 00:29:28 +0000</pubDate>
		<dc:creator>chanel</dc:creator>
		
		<category><![CDATA[linux]]></category>

		<category><![CDATA[bash]]></category>

		<category><![CDATA[bash scripting]]></category>

		<category><![CDATA[commandline]]></category>

		<category><![CDATA[commands]]></category>

		<category><![CDATA[find]]></category>

		<category><![CDATA[grep]]></category>

		<category><![CDATA[linux scripting]]></category>

		<category><![CDATA[linux terminal]]></category>

		<category><![CDATA[scripting]]></category>

		<category><![CDATA[scripts]]></category>

		<category><![CDATA[search]]></category>

		<category><![CDATA[terminal]]></category>

		<category><![CDATA[zsh]]></category>

		<guid isPermaLink="false">http://cmunezero.com/?p=70</guid>
		<description><![CDATA[Learning Linux commands is probably the largest hump anybody new to Linux faces.  Over the last year, I&#8217;ve compiled some useful, and somewhat non-obvious scripts that are really helpful to me on a weekly basis.  Here are commands that deal with finding files and searching for text within a file:
Find and delete a [...]]]></description>
			<content:encoded><![CDATA[<p>Learning Linux commands is probably the largest hump anybody new to Linux faces.  Over the last year, I&#8217;ve compiled some useful, and somewhat non-obvious scripts that are really helpful to me on a weekly basis.  Here are commands that deal with finding files and searching for text within a file:</p>
<p>Find and delete a directory:</p>

<div class="wp_syntax"><div class="code"><pre class="bash"><span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #000000; font-weight: bold;">/</span>PATH<span style="color: #000000; font-weight: bold;">/</span>TO<span style="color: #000000; font-weight: bold;">/</span>DIR -type d -name SEARCH -exec <span style="color: #c20cb9; font-weight: bold;">rm</span> -rf <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \;</pre></div></div>

<p>Find and delete a file:</p>

<div class="wp_syntax"><div class="code"><pre class="bash"><span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #000000; font-weight: bold;">/</span>PATH<span style="color: #000000; font-weight: bold;">/</span>TO<span style="color: #000000; font-weight: bold;">/</span>DIR -name SEARCH -exec <span style="color: #c20cb9; font-weight: bold;">rm</span> -rf <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \;</pre></div></div>

<p>Search within files:</p>

<div class="wp_syntax"><div class="code"><pre class="bash"> <span style="color: #c20cb9; font-weight: bold;">grep</span> -r <span style="color: #ff0000;">&quot;SEARCH&quot;</span> <span style="color: #000000; font-weight: bold;">*</span>.EXTENSION <span style="color: #000000; font-weight: bold;">/</span>PATH<span style="color: #000000; font-weight: bold;">/</span>TO<span style="color: #000000; font-weight: bold;">/</span>DIR</pre></div></div>

<p>Find and search within files:</p>

<div class="wp_syntax"><div class="code"><pre class="bash">﻿<span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #000000; font-weight: bold;">/</span>PATH<span style="color: #000000; font-weight: bold;">/</span>TO<span style="color: #000000; font-weight: bold;">/</span>DIR -name <span style="color: #ff0000;">&quot;SEARCH&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">xargs</span> -I<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> -H SEARCH <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p>For more advanced options there&#8217;s always:</p>

<div class="wp_syntax"><div class="code"><pre class="bash"><span style="color: #c20cb9; font-weight: bold;">man</span> <span style="color: #c20cb9; font-weight: bold;">find</span>
<span style="color: #c20cb9; font-weight: bold;">man</span> <span style="color: #c20cb9; font-weight: bold;">grep</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://cmunezero.com/2008/09/01/useful-linux-scripts-find-and-search/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Removing Trackerd</title>
		<link>http://cmunezero.com/2008/08/27/removing-trackerd/</link>
		<comments>http://cmunezero.com/2008/08/27/removing-trackerd/#comments</comments>
		<pubDate>Wed, 27 Aug 2008 14:33:53 +0000</pubDate>
		<dc:creator>chanel</dc:creator>
		
		<category><![CDATA[linux]]></category>

		<category><![CDATA[find]]></category>

		<category><![CDATA[grep]]></category>

		<category><![CDATA[linux search]]></category>

		<category><![CDATA[search]]></category>

		<category><![CDATA[tracker-utils]]></category>

		<category><![CDATA[trackerd]]></category>

		<category><![CDATA[ubuntu]]></category>

		<category><![CDATA[ubuntu search]]></category>

		<guid isPermaLink="false">http://cmunezero.com/?p=67</guid>
		<description><![CDATA[Trackerd is probably the least useful tool that comes with Ubuntu.  While indexing, it maxes out cpu and memory.  Of course it allows you to search, but the search never finds what I&#8217;m looking.  In my experience, i&#8217;ve found that find and grep are much more useful, especially if its only within [...]]]></description>
			<content:encoded><![CDATA[<p>Trackerd is probably the least useful tool that comes with Ubuntu.  While indexing, it maxes out cpu and memory.  Of course it allows you to search, but the search never finds what I&#8217;m looking.  In my experience, i&#8217;ve found that <a href="http://unixhelp.ed.ac.uk/CGI/man-cgi?find">find</a> and <a href="http://unixhelp.ed.ac.uk/CGI/man-cgi?grep">grep</a> are much more useful, especially if its only within a subdirectory.</p>
<p>Trying to remove trackerd is much harder than one would think.  Using apt/aptitude proved fruitless since trying to remove/purge trackerd or tracker-utils does absolutely nothing.  From <a href="http://dailyvim.blogspot.com/">Travis</a>, I use these two scripts to basically prevent trackerd from running:</p>
<p>killall trackerd<br />
mv /usr/bin/trackerd /usr/bin/trackerd-old</p>
<p>You might want to use &#8216;whereis trackerd&#8217; to find out where your trackerd binary is actually located before using the move command.</p>
]]></content:encoded>
			<wfw:commentRss>http://cmunezero.com/2008/08/27/removing-trackerd/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Coding Tip: Programming as a Game</title>
		<link>http://cmunezero.com/2008/08/12/coding-tip-programming-as-a-game/</link>
		<comments>http://cmunezero.com/2008/08/12/coding-tip-programming-as-a-game/#comments</comments>
		<pubDate>Tue, 12 Aug 2008 21:30:45 +0000</pubDate>
		<dc:creator>chanel</dc:creator>
		
		<category><![CDATA[life]]></category>

		<category><![CDATA[programming]]></category>

		<category><![CDATA[ajax]]></category>

		<category><![CDATA[coding]]></category>

		<category><![CDATA[game]]></category>

		<category><![CDATA[games]]></category>

		<category><![CDATA[howto]]></category>

		<category><![CDATA[javascript]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[tip]]></category>

		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://cmunezero.com/?p=58</guid>
		<description><![CDATA[I recently read a Wired article where people achieved success losing weight because Weight Watchers is basically an RPG.  One game/exercise that I often do is to see how many lines of code or components I can write without any errors.  It&#8217;s hard to quantify but my record so far as about 200 [...]]]></description>
			<content:encoded><![CDATA[<p>I recently read a <a href="http://www.wired.com/gaming/virtualworlds/commentary/games/2008/08/gamesfrontiers_0811">Wired article</a> where people achieved success losing weight because Weight Watchers is basically an RPG.  One game/exercise that I often do is to see how many lines of code or components I can write without any errors.  It&#8217;s hard to quantify but my record so far as about 200 lines of Javascript/AJAX code.  It was kind of cheating because I was basically re-using Javascript and backend PHP code that had been thoroughly tested.  Overall, this is a pretty good method to increase the amount of code you can hold in your head and attempts to reduce the relying of debugging tools in favor of self/mental debugging.</p>
]]></content:encoded>
			<wfw:commentRss>http://cmunezero.com/2008/08/12/coding-tip-programming-as-a-game/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Consistent Memcache Hashing and Failover with PHP</title>
		<link>http://cmunezero.com/2008/08/11/consistent-memcache-hashing-and-failover-with-php/</link>
		<comments>http://cmunezero.com/2008/08/11/consistent-memcache-hashing-and-failover-with-php/#comments</comments>
		<pubDate>Mon, 11 Aug 2008 15:07:13 +0000</pubDate>
		<dc:creator>chanel</dc:creator>
		
		<category><![CDATA[life]]></category>

		<category><![CDATA[misc]]></category>

		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://cmunezero.com/?p=54</guid>
		<description><![CDATA[I&#8217;ve written about Memcache before because it&#8217;s one of the best pieces of software written.  It&#8217;s power lies in it&#8217;s simplicity and how easily you can plug it into any application.  One of the things I really wanted was to implement consistent hashing and failover.
After checking out the PHP/Memcache documentation, the code to [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve written about Memcache before because it&#8217;s one of the best pieces of software written.  It&#8217;s power lies in it&#8217;s simplicity and how easily you can plug it into any application.  One of the things I really wanted was to implement <a href="http://en.wikipedia.org/wiki/Consistent_hashing">consistent hashing</a> and <a href="http://en.wikipedia.org/wiki/Failover">failover</a>.</p>
<p>After checking out the <a href="http://us3.php.net/manual/en/function.memcache-addserver.php">PHP</a>/<a href="http://us3.php.net/manual/en/memcache.examples.php">Memcache</a> <a href="http://us3.php.net/manual/en/memcache.ini.php">documentation</a>, the code to achieve this is fairly simple:</p>

<div class="wp_syntax"><div class="code"><pre class="php"><span style="color: #990000;">ini_set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'memcache.allow_failover'</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// default is usually true</span>
<span style="color: #990000;">ini_set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'memcache.hash_strategy'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'consistent'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Somewhere in your configuration/initialization script, make sure these memcache settings are in place.  Allow failover tells the memcache client to try another server if it cannot connect to a particular memcache daemon.  The hash strategy is pretty self explanatory.  Now onto the actual server code:</p>

<div class="wp_syntax"><div class="code"><pre class="php"><span style="color: #000033;">$failCount</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
<span style="color: #000033;">$realInstance</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Memcache<span style="color: #339933;">;</span>
<span style="color: #000033;">$testInstance</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Memcache<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000033;">$servers</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;server1&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;server2&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;server3&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000033;">$defautlPort</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'1'</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000033;">$servers</span> <span style="color: #b1b100;">as</span> <span style="color: #000033;">$host</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000033;">$testInstance</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">connect</span><span style="color: #009900;">&#40;</span><span style="color: #000033;">$host</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000033;">$realInstance</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addServer</span><span style="color: #009900;">&#40;</span><span style="color: #000033;">$host</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000033;">$testInstance</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// only close if connection was success</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000033;">$realInstance</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addServer</span><span style="color: #009900;">&#40;</span><span style="color: #000033;">$host</span><span style="color: #339933;">,</span> defautlPort<span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">true</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">-1</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000033;">$failCount</span><span style="color: #339933;">++;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000033;">$isConnected</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">true</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000033;">$failCount</span> <span style="color: #339933;">==</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000033;">$servers</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// set false if every server is marked as failed</span>
    <span style="color: #000033;">$isConnected</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>I use two instances of Memcache (might not be most optimal solution) to check the availability of that server and if it is available, add it to the pool with all of the default options.  If it is not available, set up the connection to automatically failover but also maintain its position in the server pool.  These options are set using this paragraph from the PHP docs:</p>
<blockquote><p>
bool Memcache::addServer  ( string $host  [, int $port  [, bool $persistent  [, int $weight  [, int $timeout  [, int $retry_interval  [, bool $status  [, callback $failure_callback  ]]]]]]] )</p>
<p><b>retry_interval</b>: Controls how often a failed server will be retried, the default value is 15 seconds. Setting this parameter to -1 disables automatic retry.</p>
<p><b>status</b>: Controls if the server should be flagged as online. Setting this parameter to FALSE and retry_interval  to -1 allows a failed server to be kept in the pool so as not to affect the key distribution algoritm. Requests for this server will then failover or fail immediatly depending on the memcache.allow_failover  setting.
</p></blockquote>
<p>There&#8217;s also error checking to ensure that at least one server is online to be considered connected to a memcache pool.</p>
]]></content:encoded>
			<wfw:commentRss>http://cmunezero.com/2008/08/11/consistent-memcache-hashing-and-failover-with-php/feed/</wfw:commentRss>
		</item>
		<item>
		<title>New Sphinx</title>
		<link>http://cmunezero.com/2008/07/26/new-sphinx/</link>
		<comments>http://cmunezero.com/2008/07/26/new-sphinx/#comments</comments>
		<pubDate>Sat, 26 Jul 2008 04:58:19 +0000</pubDate>
		<dc:creator>chanel</dc:creator>
		
		<category><![CDATA[mysql]]></category>

		<category><![CDATA[programming]]></category>

		<category><![CDATA[0.9.8]]></category>

		<category><![CDATA[new]]></category>

		<category><![CDATA[new release]]></category>

		<category><![CDATA[new sphinx]]></category>

		<category><![CDATA[sphinx]]></category>

		<guid isPermaLink="false">http://cmunezero.com/?p=53</guid>
		<description><![CDATA[So a brand new version of Sphinx has come out.  I&#8217;ve been using a beta version of 0.9.8 so I&#8217;ve been using most of the new features already but the list of new features and bug fixes is still pretty impressive.  For those of you who don&#8217;t know, Sphinx is a MySQL full-text [...]]]></description>
			<content:encoded><![CDATA[<p>So a brand new version of <a href="http://sphinxsearch.com">Sphinx</a> has come out.  I&#8217;ve been using a beta version of 0.9.8 so I&#8217;ve been using most of the new features already but the <a href="http://sphinxsearch.com/doc.html#rel098">list of new features and bug fixes</a> is still pretty impressive.  For those of you who don&#8217;t know, Sphinx is a MySQL full-text replacement for implementing search.  And its hella fast.</p>
]]></content:encoded>
			<wfw:commentRss>http://cmunezero.com/2008/07/26/new-sphinx/feed/</wfw:commentRss>
		</item>
		<item>
		<title>jQuery: I thought I knew you so well</title>
		<link>http://cmunezero.com/2008/07/25/jquery-i-thought-i-knew-you-so-well/</link>
		<comments>http://cmunezero.com/2008/07/25/jquery-i-thought-i-knew-you-so-well/#comments</comments>
		<pubDate>Fri, 25 Jul 2008 19:50:06 +0000</pubDate>
		<dc:creator>chanel</dc:creator>
		
		<category><![CDATA[misc]]></category>

		<category><![CDATA[api]]></category>

		<category><![CDATA[javascript]]></category>

		<category><![CDATA[jquery]]></category>

		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://cmunezero.com/?p=52</guid>
		<description><![CDATA[I just recently found out that jQuery&#8217;s &#8220;get&#8221; method actually returns the DOM objects within the jQuery object.  For the longest time, I&#8217;ve been using my own &#8220;dom&#8221; method to do the same thing.  For some reason, I never use their documentation site.  The search isn&#8217;t that great, and something about the [...]]]></description>
			<content:encoded><![CDATA[<p>I just recently found out that jQuery&#8217;s <a href="http://docs.jquery.com/Core/get">&#8220;get&#8221;</a> method actually returns the DOM objects within the <a href="http://www.jquery.com">jQuery</a> object.  For the longest time, I&#8217;ve been using my own &#8220;dom&#8221; method to do the same thing.  For some reason, I never use their <a href="http://docs.jquery.com/">documentation site</a>.  The search isn&#8217;t that great, and something about the site itself just makes me not want to use.  Maybe its because I loved the old <a href="http://visualjquery.com">Visual jQuery</a> site so much.  Only if someone would update it for jQuery 1.2.</p>
]]></content:encoded>
			<wfw:commentRss>http://cmunezero.com/2008/07/25/jquery-i-thought-i-knew-you-so-well/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Classic Children TV Shows</title>
		<link>http://cmunezero.com/2008/07/15/classic-children-tv-shows/</link>
		<comments>http://cmunezero.com/2008/07/15/classic-children-tv-shows/#comments</comments>
		<pubDate>Tue, 15 Jul 2008 23:44:59 +0000</pubDate>
		<dc:creator>chanel</dc:creator>
		
		<category><![CDATA[funny]]></category>

		<category><![CDATA[video]]></category>

		<category><![CDATA[classic]]></category>

		<category><![CDATA[nickelodeon]]></category>

		<category><![CDATA[shows]]></category>

		<category><![CDATA[tv]]></category>

		<category><![CDATA[tv shows]]></category>

		<category><![CDATA[videos]]></category>

		<category><![CDATA[youtube]]></category>

		<guid isPermaLink="false">http://cmunezero.com/?p=50</guid>
		<description><![CDATA[Found these two videos on Youtube and it really brought me back to the good ole days:
Camp Videos: The Nostalgia Song:


Classic Nickelodeon Show Intros:

]]></description>
			<content:encoded><![CDATA[<p>Found these two videos on Youtube and it really brought me back to the good ole days:</p>
<p><a href="http://video.google.com/videoplay?docid=6082012061502805354">Camp Videos: The Nostalgia Song</a>:<br />
<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/VGelvv2EFWo&#038;hl=en&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/VGelvv2EFWo&#038;hl=en&#038;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object></p>
<p></p>
<p><a href="http://www.youtube.com/watch?v=MlfkAFcFT50">Classic Nickelodeon Show Intros</a>:<br />
<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/MlfkAFcFT50&#038;hl=en&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/MlfkAFcFT50&#038;hl=en&#038;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://cmunezero.com/2008/07/15/classic-children-tv-shows/feed/</wfw:commentRss>
		</item>
		<item>
		<title>MySQL Tips #1</title>
		<link>http://cmunezero.com/2008/07/14/mysql-tips-1/</link>
		<comments>http://cmunezero.com/2008/07/14/mysql-tips-1/#comments</comments>
		<pubDate>Mon, 14 Jul 2008 19:11:40 +0000</pubDate>
		<dc:creator>chanel</dc:creator>
		
		<category><![CDATA[mysql]]></category>

		<category><![CDATA[web]]></category>

		<category><![CDATA[innodb]]></category>

		<category><![CDATA[mysql tips]]></category>

		<category><![CDATA[performance]]></category>

		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://cmunezero.com/?p=49</guid>
		<description><![CDATA[Working with Mysql a lot, I&#8217;ve come across a lot of resources for finding ways of improving Myql performance in relation to configurations, queries and importing/exporting data.  Here&#8217;s a list of sources I use a lot:
MySQL Performance Blog:  This is my favorite Mysql site and was absolutely indispensable when first starting out with [...]]]></description>
			<content:encoded><![CDATA[<p>Working with Mysql a lot, I&#8217;ve come across a lot of resources for finding ways of improving Myql performance in relation to configurations, queries and importing/exporting data.  Here&#8217;s a list of sources I use a lot:</p>
<p><a href="http://www.mysqlperformanceblog.com/">MySQL Performance Blog</a>:  This is my favorite Mysql site and was absolutely indispensable when first starting out with Mysql.  They pretty much cover any Mysql related topic.</p>
<p><a href="http://dev.mysql.com/doc/#manual">MySQL Reference</a>:  The actual reference site is a must have.  It&#8217;s fairly thorough and covers everything in simple detail.</p>
<p><a href="http://dailyvim.blogspot.com/search?q=mysql">Travis&#8217;s Mysql Postings</a>: He&#8217;s the most knowledgeable database person I know and is usually the first person I go to with anything Mysql.</p>
<p><a href=""http://wanderr.com/jay">Jay&#8217;s Mysql Postings</a>: He&#8217;s the 2nd most knowledgeable database person I know and he&#8217;s always spot-on with any tips he gives.</p>
<p>The rest are just a list of sites/pages that I find useful for whenever I need something specific:</p>
<p><a href="http://www.joestump.net/2006/09/speeding-up-innodb-table-imports.html">Speeding up InnoDB Imports</a><br />
<a href="http://forge.mysql.com/wiki/Top10SQLPerformanceTips">10 Performance Tips</a><br />
<a href="http://www.debianadmin.com/top-84-mysql-performance-tips.html">84 Performance Tips</a><br />
<a href="http://www.google.com/search?q=mysql+performance+tips">Google Search</a></p>
]]></content:encoded>
			<wfw:commentRss>http://cmunezero.com/2008/07/14/mysql-tips-1/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Ubuntu Sound and Video Problems</title>
		<link>http://cmunezero.com/2008/06/23/ubuntu-sound-and-video-problems/</link>
		<comments>http://cmunezero.com/2008/06/23/ubuntu-sound-and-video-problems/#comments</comments>
		<pubDate>Mon, 23 Jun 2008 21:08:47 +0000</pubDate>
		<dc:creator>chanel</dc:creator>
		
		<category><![CDATA[linux]]></category>

		<category><![CDATA[compiz]]></category>

		<category><![CDATA[dell]]></category>

		<category><![CDATA[kernel]]></category>

		<category><![CDATA[linux kernel]]></category>

		<category><![CDATA[nvidia]]></category>

		<category><![CDATA[sound]]></category>

		<category><![CDATA[ubuntu]]></category>

		<category><![CDATA[ubuntu dell]]></category>

		<category><![CDATA[ubuntu sound]]></category>

		<category><![CDATA[ubuntu video]]></category>

		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://cmunezero.com/?p=47</guid>
		<description><![CDATA[For the longest time, I&#8217;ve had terrible luck with sound and video problems with Ubuntu on a Dell Dimension E521 with nVidia sound and video cards.  I thought it was terrible support by nVidia.  Everytime I would update my computer, it would totally trash my video settings and sometimes, my sound settings.
Today after [...]]]></description>
			<content:encoded><![CDATA[<p>For the longest time, I&#8217;ve had terrible luck with sound and video problems with Ubuntu on a Dell Dimension E521 with nVidia sound and video cards.  I thought it was terrible support by nVidia.  Everytime I would update my computer, it would totally trash my video settings and sometimes, my sound settings.</p>
<p>Today after doing a bunch of updates, both my video and sound went to crap.  With the help of my favorite Linux hacker, <a href="http://dailyvim.blogspot.com">Travis</a>, we figured out that I was actually running the server version of the Linux kernel.  Next, I uninstalled all instances of the server kernels, uninstalled all nvidia drivers and modules, and rebooted.  From there, I followed the basic steps to install nVidia drivers, configured my screen settings and now I am able to run all of the fancy Compiz visuals and my Ubuntu install has never been better.</p>
]]></content:encoded>
			<wfw:commentRss>http://cmunezero.com/2008/06/23/ubuntu-sound-and-video-problems/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
