<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Edward A. Webb (.com) &#187; MIsc.Tips</title>
	<atom:link href="http://edwardawebb.com/category/tips/feed/" rel="self" type="application/rss+xml" />
	<link>http://edwardawebb.com</link>
	<description>get all his digital goodness 24/7</description>
	<lastBuildDate>Sat, 28 Jan 2012 17:46:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Verify file Checksum in Windows with context menu</title>
		<link>http://edwardawebb.com/tips/verify-file-checksum-windows-context-menu</link>
		<comments>http://edwardawebb.com/tips/verify-file-checksum-windows-context-menu#comments</comments>
		<pubDate>Tue, 07 Jun 2011 00:54:47 +0000</pubDate>
		<dc:creator>Eddie</dc:creator>
				<category><![CDATA[MIsc.Tips]]></category>
		<category><![CDATA[checksum]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://edwardawebb.com/?p=955</guid>
		<description><![CDATA[If your stuck on (or just love) windows, you can give yourself the ability to <strong>check any files checksum with the click of a mouse</strong>.]]></description>
			<content:encoded><![CDATA[<p>Checking the integrity of a file on a unix node is simple thanks to a confusingly named &#8220;checksum&#8221; utility.  It, oddly enough gives you the checksum of a file.</p>
<p>If your stuck on (or just love) windows, you can give yourself the ability to <strong>check any files checksum with the click of a mouse</strong>.</p>
<div id="attachment_956" class="wp-caption aligncenter" style="width: 431px"><a href="http://edwardawebb.com/wp-content/uploads/2011/06/Capture.jpg"><img class="size-full wp-image-956" title="rightclickverify" src="http://edwardawebb.com/wp-content/uploads/2011/06/Capture.jpg" alt="Capture Verify file Checksum in Windows with context menu" width="421" height="256" /></a><p class="wp-caption-text">Right-Click any file to validate the checksum integrity </p></div>
<p>&nbsp;</p>
<h3><span id="more-955"></span><br />
Download Microsoft&#8217;s FCIV.exe</h3>
<p>You can download their unsupported command line utility fciv from the following link, <a href="http://support.microsoft.com/kb/841290" rel="nofollow" >http://support.microsoft.com/kb/841290</a>.</p>
<p>If you have another tool, you may substitute and move on.</p>
<h3>Create a simple Batch file</h3>
<p>..to run the checksum utility of your choice, and then pause</p>

<div class="wp_syntax"><div class="code"><pre class="batch" style="font-family:monospace;">@echo off
:: edward a webb
:: June 6 2011
:: runs micorsofts fciv command line tool against file and wiats, fort use as context menu
:: http://edwardawebb.com/?p=955
cls
fciv.exe %1
pause</pre></div></div>

<h3>Drop both onto your PATH</h3>
<p>You can either add them to you system variables , or drop them in a folder like &lt;x&gt;:\windows\system 32.   I&#8217;m lazy and did the latter.</p>
<h3>Add the batch file as an context menu option</h3>
<p>Just save the file below, right click and merge into your registry.  It makes any file&#8217;s right click menu include the value of the first key as the text you&#8217;ll see, and the value of the second (&#8220;command&#8221;) key, the actual command to be run. Substitute &#8220;%1&#8243;  for the file (yes use double-quotes escaped in case the file your checking is on a path with spaces).</p>

<div class="wp_syntax"><div class="code"><pre class="reg" style="font-family:monospace;"><span style="color: #0000FF;">Windows Registry Editor Version 5.00</span>
&nbsp;
<span style="color: #000000;">&#91;</span><span style="color: #800000;">HKEY_CLASSES_ROOT</span>\*\shell\Checksum<span style="color: #000000;">&#93;</span>
<span style="">@</span><span style="color: #000000;">=</span><span style="">&quot;Verify CHecksum&quot;</span>
&nbsp;
<span style="color: #000000;">&#91;</span><span style="color: #800000;">HKEY_CLASSES_ROOT</span>\*\shell\Checksum\Command<span style="color: #000000;">&#93;</span>
<span style="">@</span><span style="color: #000000;">=</span><span style="">&quot;verify-checksum.bat \&quot;%1\&quot;&quot;</span></pre></div></div>

<p>That&#8217;s it, the changes are effective immediately, so try it out.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://edwardawebb.com/tips/verify-file-checksum-windows-context-menu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting IP addresses for remote nodes</title>
		<link>http://edwardawebb.com/linux/ip-addresses-remote-nodes</link>
		<comments>http://edwardawebb.com/linux/ip-addresses-remote-nodes#comments</comments>
		<pubDate>Thu, 29 Jul 2010 15:14:07 +0000</pubDate>
		<dc:creator>Eddie</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[MIsc.Tips]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[nslookup]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://edwardawebb.com/?p=824</guid>
		<description><![CDATA[I recently had the need to get the ip address for a remote node. Wait, scratch that.. I had to get the IP addresses for about 60 remote nodes. You&#8217;re right&#8230; I probably could have typed nslookup targetNode 60 times. But I am a programmer! SO I decided to pass my choir off to a [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had the need to <strong>get the ip address for a remote node</strong>.  Wait, scratch that.. I had to <strong>get the IP addresses for about 60 remote nodes</strong>.</p>
<p>You&#8217;re right&#8230; I probably <em>could have</em> typed
<pre>nslookup targetNode</pre>
<p> 60 times. But I am a programmer! <strong>SO I decided to pass my choir off to a shell script.</strong></p>
<p>If you have a similar need, read on!<br />
<span id="more-824"></span></p>
<p>The script is simple, just add all target nodes as a space separated list, and run the file.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash </span>
<span style="color: #666666; font-style: italic;"># author: Edward A Webb (http://edwardawebb.com</span>
<span style="color: #666666; font-style: italic;"># license: Just use it! its like 10 lines of shell script...</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># add your actual nodes here.....</span>
<span style="color: #007800;">nodes</span>=<span style="color: #7a0874; font-weight: bold;">&#40;</span> gonzo fenway einstein yogurt toxic babmbi rambo donna INXS etc... <span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #007800;">ips</span>=<span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #666666; font-style: italic;"># placeholder for results</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span> Determing IP addresses for provided nodes <span style="color: #000099; font-weight: bold;">\n</span> ignore these lines...<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span> i = <span style="color: #000000;">0</span> ; i <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #800000;">${#nodes[@]}</span> ; i++ <span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000; font-weight: bold;">do</span>
	<span style="color: #007800;">str</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span>nslookup <span style="color: #800000;">${nodes[$i]}</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tail</span> <span style="color: #660033;">--lines</span>=<span style="color: #000000;">2</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">head</span> <span style="color: #660033;">--lines</span>=<span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
	ips<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #007800;">$i</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$str</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-f</span> <span style="color: #000000;">2</span> <span style="color: #660033;">-d</span> <span style="color: #ff0000;">&quot; &quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">done</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span> COMPLETE<span style="color: #000099; font-weight: bold;">\n</span> Here are the results you care about..<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span> i = <span style="color: #000000;">0</span> ; i <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #800000;">${#ips[@]}</span> ; i++ <span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000; font-weight: bold;">do</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> address <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #800000;">${nodes[$i]}</span> is <span style="color: #800000;">${ips[$i]}</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tee</span> <span style="color: #660033;">-a</span> ip_results.txt
<span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://edwardawebb.com/linux/ip-addresses-remote-nodes/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Passing Parameters with h:commandLink in JSF</title>
		<link>http://edwardawebb.com/tips/passing-parameters-hcommandlink-jsf</link>
		<comments>http://edwardawebb.com/tips/passing-parameters-hcommandlink-jsf#comments</comments>
		<pubDate>Tue, 13 Jul 2010 19:47:57 +0000</pubDate>
		<dc:creator>Eddie</dc:creator>
				<category><![CDATA[MIsc.Tips]]></category>
		<category><![CDATA[commandAction]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[JSF]]></category>

		<guid isPermaLink="false">http://edwardawebb.com/?p=813</guid>
		<description><![CDATA[I have been growing fond of JSF as of late, but was stumped by the simplest task. How do I associate some value with a link? If I was using PHP I would just append a query parameter and grab the value. But with JSF it&#8217;s all done inside our xhtml files, so how do [...]]]></description>
			<content:encoded><![CDATA[<p>I have been growing fond of JSF as of late, but was stumped by the simplest task.</p>
<p>How do I associate some value with a link?  If I was using PHP I would just append a query parameter and grab the value.   But with JSF it&#8217;s all done inside our xhtml files, so how do we set a value based on the link clicked?</p>
<p>Just use</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;f:setPropertyActionListener
   target=&quot;#{bean.property}&quot; value=&quot;#{VALUE}&quot;/&gt;</pre></div></div>

<p>inside the commandAction.</p>
<p>This stores any expression into the specified bean&#8217;s property.</p>
<p>See below for a full faces example.  Each Player link will set the backing Bean&#8217;s player object before calling the action.</p>
<p><span id="more-813"></span></p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;html xmlns=&quot;http://ww.w3.org/1999/xhtml&quot; 
xmlns:ui=&quot;http://java.sun.com/jsf/facelets&quot;
xmlns:h=&quot;http://java.sun.com/jsf/html&quot;
xmlns:f=&quot;http://java.sun.com/jsf/core&quot;&gt;
&nbsp;
pageTitle
appTitle
content
&nbsp;
&nbsp;
&lt;ui:composition template=&quot;/template.xhtml&quot;&gt;
	&lt;ui:define name=&quot;pagetitle&quot;&gt;Team Management&lt;/ui:define&gt;
&nbsp;
&nbsp;
	&lt;ui:define name=&quot;apptitle&quot;&gt;Affinity Management Plus (Basketball)&lt;/ui:define&gt;
&nbsp;
	&lt;!-- team form --&gt;
	&lt;ui:define name=&quot;content&quot;&gt;
		&lt;h2&gt; #{team.teamName}  Player Summary&lt;/h2&gt;
		&lt;ul&gt;
		&lt;ui:repeat value=&quot;#{processor.team.players}&quot; var=&quot;player&quot;&gt;
                 &lt;li&gt; 
                      &lt;h:outputText value=&quot;#{player.number}&quot; /&gt; -  &lt;h:outputText value=&quot;#{player.name}&quot; /&gt;
&nbsp;
                 &lt;/li&gt; 
          &lt;/ui:repeat&gt;	
		  &lt;/ul&gt;	
&nbsp;
		&lt;h2&gt; #{team.teamName} Game Summary&lt;/h2&gt;
&nbsp;
		&lt;ui:repeat value=&quot;#{processor.team.games}&quot; var=&quot;game&quot;&gt;
&nbsp;
                 &lt;h3&gt;Played #{game.date} against #{game.team2.teamName}&lt;/h3&gt;
&nbsp;
				 &lt;ui:repeat value=&quot;#{game.statEntrySetList}&quot; var=&quot;entry&quot;&gt;
&nbsp;
					&lt;h:form&gt;
&nbsp;
                 	&lt;h3&gt;Stats for &lt;h:commandLink id=&quot;playerAction&quot; action=&quot;#{processor.preparePlayerAction}&quot; &gt;
                 	#{entry.key.name}
                 	&lt;f:setPropertyActionListener
   target=&quot;#{processor.player}&quot; value=&quot;#{entry.key}&quot;/&gt;&lt;/h:commandLink&gt;  &lt;/h3&gt;
                 	&lt;/h:form&gt;	
					&lt;table width=&quot;100%&quot; border=&quot;1&quot;&gt;
					    &lt;tr&gt;
					        &lt;th&gt;1
					        &lt;/th&gt;
					        &lt;th&gt;2
					        &lt;/th&gt;
					        &lt;th&gt;3
					        &lt;/th&gt;
					        &lt;th&gt;fouls	
					        &lt;/th&gt;
					        &lt;th&gt;steals
					        &lt;/th&gt;
					        &lt;th&gt;rebounds
					        &lt;/th&gt;
					        &lt;th&gt;minutes
					        &lt;/th&gt;
					    &lt;/tr&gt;
					    &lt;tr&gt;
					        &lt;td&gt;#{entry.value.onePointers}
					        &lt;/td&gt;
					        &lt;td&gt;#{entry.value.twoPointers}
					        &lt;/td&gt;
					        &lt;td&gt;#{entry.value.threePointers}
					        &lt;/td&gt;
					        &lt;td&gt;#{entry.value.fouls}
					        &lt;/td&gt;
					        &lt;td&gt;#{entry.value.steals}
					        &lt;/td&gt;
					        &lt;td&gt;#{entry.value.rebounds}
					        &lt;/td&gt;
					        &lt;td&gt;#{entry.value.minutesPlayed}
					        &lt;/td&gt;
					    &lt;/tr&gt;
					&lt;/table&gt;
&nbsp;
&nbsp;
&nbsp;
       			 &lt;/ui:repeat&gt;
&nbsp;
&nbsp;
        &lt;/ui:repeat&gt;		
	&lt;/ui:define&gt;
&nbsp;
&nbsp;
&lt;/ui:composition&gt;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&lt;/html&gt;</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Iterator</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.LinkedList</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.List</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.faces.event.ActionEvent</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.faces.model.SelectItem</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.libertymutual.amp.basketball.DAO.GameDAO</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.libertymutual.amp.basketball.DAO.PlayerDAO</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.libertymutual.amp.basketball.DAO.TeamDAO</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> TeamProcessor <span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">//Business MOdels (used for temporary associations and datastore)</span>
	<span style="color: #000000; font-weight: bold;">private</span> Team team<span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Team<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> Player player<span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> Player<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> Game game<span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> Game<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> Statistic statistic <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Statistic<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">private</span> CumulativeStatistic cumaltiveStat<span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> CumulativeStatistic<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">private</span> Team team2<span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Team<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> List<span style="color: #339933;">&lt;</span>SelectItem<span style="color: #339933;">&gt;</span> opponents <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> LinkedList<span style="color: #339933;">&lt;</span>SelectItem<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> TeamDAO teamDAO <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> TeamDAO<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> PlayerDAO playerDAO <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> PlayerDAO<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> GameDAO gameDAO <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> GameDAO<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//authorization</span>
	<span style="color: #000000; font-weight: bold;">private</span> List<span style="color: #339933;">&lt;</span>User<span style="color: #339933;">&gt;</span> users<span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> LinkedList<span style="color: #339933;">&lt;</span>User<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> tmpName<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> tmpPass<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">boolean</span> isAuthorized<span style="color: #339933;">=</span><span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
	<span style="color: #666666; font-style: italic;">//expose properties to jsf</span>
	<span style="color: #000000; font-weight: bold;">public</span> Game getGame<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> game<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setGame<span style="color: #009900;">&#40;</span>Game game<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">game</span> <span style="color: #339933;">=</span> game<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> Statistic getStatistic<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> statistic<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setStatistic<span style="color: #009900;">&#40;</span>Statistic statistic<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">statistic</span> <span style="color: #339933;">=</span> statistic<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> List<span style="color: #339933;">&lt;</span>User<span style="color: #339933;">&gt;</span> getUsers<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> users<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setUsers<span style="color: #009900;">&#40;</span>List<span style="color: #339933;">&lt;</span>User<span style="color: #339933;">&gt;</span> users<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">users</span> <span style="color: #339933;">=</span> users<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getTmpName<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> tmpName<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setTmpName<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> tmpName<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">tmpName</span> <span style="color: #339933;">=</span> tmpName<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getTmpPass<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> tmpPass<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setTmpPass<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> tmpPass<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">tmpPass</span> <span style="color: #339933;">=</span> tmpPass<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> Player getPlayer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> player<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setPlayer<span style="color: #009900;">&#40;</span>Player player<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">player</span> <span style="color: #339933;">=</span> player<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span>  Team getTeam<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> team<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setTeam<span style="color: #009900;">&#40;</span>Team team<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">team</span> <span style="color: #339933;">=</span> team<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setTeam2<span style="color: #009900;">&#40;</span>Team team2<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">team2</span> <span style="color: #339933;">=</span> team2<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> Team getTeam2<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> team2<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> List<span style="color: #339933;">&lt;</span>SelectItem<span style="color: #339933;">&gt;</span> getOpponents<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> opponents<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setOpponents<span style="color: #009900;">&#40;</span>List<span style="color: #339933;">&lt;</span>SelectItem<span style="color: #339933;">&gt;</span> opponents<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">opponents</span> <span style="color: #339933;">=</span> opponents<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> TeamProcessor<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// set valid users</span>
		User eddie <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> User<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		eddie.<span style="color: #006633;">setName</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;eddie&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		eddie.<span style="color: #006633;">setPassword</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;1234&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		users.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>eddie<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
		opponents <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> LinkedList<span style="color: #339933;">&lt;</span>SelectItem<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>Team team <span style="color: #339933;">:</span> teamDAO.<span style="color: #006633;">list</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            opponents.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> SelectItem<span style="color: #009900;">&#40;</span>team,team.<span style="color: #006633;">getTeamName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">/*
	 * 
	 * Action Methods
	 */</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> processTeam<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>isAuthorized<span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">return</span> <span style="color: #0000ff;">&quot;invalid-login&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">String</span> result<span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;success&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">return</span> result <span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> processPlayer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&gt;&gt;&gt; processPlayer&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>isAuthorized<span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">return</span> <span style="color: #0000ff;">&quot;invalid-login&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">String</span> result<span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;error&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span> team.<span style="color: #006633;">addPlayer</span><span style="color: #009900;">&#40;</span>player<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			result<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;success&quot;</span><span style="color: #339933;">;</span>
			playerDAO.<span style="color: #006633;">addPlayer</span><span style="color: #009900;">&#40;</span>player<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Added: &quot;</span><span style="color: #339933;">+</span>player.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		player<span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> Player<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;&lt;&lt; processPlayer&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">return</span> result<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> processPlayerAndAddAnother<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>	
		<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&gt;&gt;&gt; processPlayerAndAddAnother&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>isAuthorized<span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">return</span> <span style="color: #0000ff;">&quot;invalid-login&quot;</span><span style="color: #339933;">;</span>
		processPlayer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
		<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;&lt;&lt; processPlayerAndAddAnother&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> processPlayerDoner<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>	
		<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #0000ff;">&quot;success&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> loginAction<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #003399;">String</span> result<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;invalid-login&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span>User user <span style="color: #339933;">:</span> users<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>tmpName.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span>user.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
					<span style="color: #339933;">&amp;&amp;</span>
			tmpPass.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span>user.<span style="color: #006633;">getPassword</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				result <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;success&quot;</span><span style="color: #339933;">;</span>
				isAuthorized<span style="color: #339933;">=</span><span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">return</span> result<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> processGame<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&gt;&gt;&gt; processGame&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">String</span> result<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;error&quot;</span><span style="color: #339933;">;</span>
		game.<span style="color: #006633;">setTeam1</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">team</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		game.<span style="color: #006633;">setTeam2</span><span style="color: #009900;">&#40;</span>team2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>team.<span style="color: #006633;">addGame</span><span style="color: #009900;">&#40;</span>game<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			gameDAO.<span style="color: #006633;">addGame</span><span style="color: #009900;">&#40;</span>game<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			result<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;success&quot;</span><span style="color: #339933;">;</span>
			game<span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> Game<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;&lt;&lt; processGame:&quot;</span><span style="color: #339933;">+</span>result<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">return</span> result<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> processGameStats<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
		game.<span style="color: #006633;">addGameStat</span><span style="color: #009900;">&#40;</span>player, statistic<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&gt;&gt;&gt; processGameStats: &quot;</span> <span style="color: #339933;">+</span> game.<span style="color: #006633;">getTeam2</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getTeamName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span>player.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span>statistic.<span style="color: #006633;">getFouls</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		player<span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> Player<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		statistic<span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> Statistic<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		game<span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> Game<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> finishGameStats<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		processGameStats<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #0000ff;">&quot;success&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> preparePlayerAction<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #003399;">String</span> result <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;error&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;playerAction&gt;&gt;&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Player:&quot;</span><span style="color: #339933;">+</span>player.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;team:&quot;</span><span style="color: #339933;">+</span>team.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span> Game game <span style="color: #339933;">:</span> team.<span style="color: #006633;">getGames</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			Statistic stat <span style="color: #339933;">=</span> game.<span style="color: #006633;">getGameStatistic</span><span style="color: #009900;">&#40;</span>player<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>stat <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				cumaltiveStat.<span style="color: #006633;">addStatistic</span><span style="color: #009900;">&#40;</span>stat<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
			result<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;success&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>		
		<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;CS:&quot;</span><span style="color: #339933;">+</span>cumaltiveStat.<span style="color: #006633;">getAverage</span><span style="color: #009900;">&#40;</span>cumaltiveStat.<span style="color: #006633;">getFouls</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;playerAction&lt;&lt;&lt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">return</span> result<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> preparePlayerListener<span style="color: #009900;">&#40;</span><span style="color: #003399;">ActionEvent</span> ae<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;playerListener&gt;&gt;&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Iterator</span> iterator <span style="color: #339933;">=</span> ae.<span style="color: #006633;">getComponent</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getAttributes</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">entrySet</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">iterator</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> iterator.<span style="color: #006633;">hasNext</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #003399;">Object</span> o <span style="color: #339933;">=</span> iterator.<span style="color: #006633;">next</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>o.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #009900;">&#125;</span>
		<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Player:&quot;</span><span style="color: #339933;">+</span>player.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;playerListener&lt;&lt;&lt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> CumulativeStatistic getCumaltiveStat<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> cumaltiveStat<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setCumaltiveStat<span style="color: #009900;">&#40;</span>CumulativeStatistic cumaltiveStat<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">cumaltiveStat</span> <span style="color: #339933;">=</span> cumaltiveStat<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://edwardawebb.com/tips/passing-parameters-hcommandlink-jsf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Plugins for a Full Featured WordPress Content Manager</title>
		<link>http://edwardawebb.com/web-development/plugins-full-featured-wordpress-content-manager</link>
		<comments>http://edwardawebb.com/web-development/plugins-full-featured-wordpress-content-manager#comments</comments>
		<pubDate>Tue, 04 May 2010 14:06:05 +0000</pubDate>
		<dc:creator>Eddie</dc:creator>
				<category><![CDATA[MIsc.Tips]]></category>
		<category><![CDATA[Reviews]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[bookmarks]]></category>
		<category><![CDATA[cms]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[sharing]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://edwardawebb.com/?p=738</guid>
		<description><![CDATA[More and more clients are asking for dynamic sites that allow them to edit specials and pages at will. This is great because it surely means they will come back for more questions and changes as they use the site. (read : more income). What they want are CMS, or content management systems. What I [...]]]></description>
			<content:encoded><![CDATA[<p>More and more <strong>clients are asking for dynamic sites that allow them to edit specials and pages at will</strong>. This is great because it surely means they will come back for more questions and changes as they use the site. (read : more income).</p>
<p>What they want are CMS, or content management systems.  <strong>What I give them is usually wordpress loaded with useful plugins</strong>. (If custom business logic is needed i turn to CakePHP). </p>
<p>ANd why not? The WordPress engine provides post and page management, RSS feeds and discussion features, and customizable &#8220;widgets.&#8221;  But a few key features are needed to make the leap to a decent CMS. </p>
<p><Strong>Read This</Strong><br />
(<strong>Update</strong>:<strong> FInally a CMS that clients can use! &#8211; found <a href="http://www.concrete5.org/" rel="nofollow"  title="concrete5 - FInally a CMS that clients can use!">concrete5 CMS</a> very recently, and first impression is wow!- trust me its worth a demo </strong>)</p>
<p>Besides, no matter how many times I explain creating a new page in drupal, or how to add a side box in joomla. There is just too many steps and switches for the average small business owner. (is that a huge stereotype? yes, I apologize..)  <strong> But honestly, most non-technical users don&#8217;t think in terms of elements like footer, and side bars, and such. they think of pages!  (and conrete5 does that in a spectaciular manner)</strong></p>
<p>..but if you don&#8217;t want to give that a shot first, read on.</p>
<p>The plugins handle 4 critical areas for any decent site:</p>
<ul>
<li><strong>Page and Menu Management</strong></li>
<li><strong>SEO and Meta data</strong></li>
<li><strong>Sitemaps</strong></li>
<li><strong>Web 2.0 / Bookmarking / Sharing</strong></li>
</ul>
<p><strong>SO what plugins come standard on a Edward A Webb hosted WordPress install</strong>? <a href="/web-development/7-plugins-full-featured-wordpress-content-manager#more-738" rel="nofollow" >Read more</a> to bathe in the glory of these awesome plugins.</p>
<p><span id="more-738"></span></p>
<h2>Page Management</h2>
<p>WordPress has great page management, but the connection to Menus is lacking.  Clients need to hide  and reorder pages constantly, and explaining the &#8220;weighted order&#8221; field is not worth the effort.</p>
<ol>
<li><a href="http://wordpress.org/extend/plugins/pagemash/" rel="nofollow" title="PageMash - Ajax page sorting plugin for WordPress" >PageMash</a><br />
<blockquote><p>Customise the order your pages are listed in and manage the parent  structure with this simple ajax drag-and-drop administrative interface  with an option to toggle the page to be hidden from output. Great tool  to quickly re-arrange your page menus.</p></blockquote>
</li>
</ol>
<h2>SEO Enhancement</h2>
<p>Yes I can use buzz words. But SEO is legitimately important when administering a site for any business.  So to maximize client click-throughs and search ranking I use a few plugins to add clean urls and descriptive tags to everything!</p>
<ol>
<li> <a href="http://wordpress.org/extend/plugins/all-in-one-seo-pack/" rel="nofollow" title="All in One SEO Pack - get your meta tags in line!" >All in One SEO Pack</a><br />
<blockquote><ul>
<li>Support for CMS-style WordPress installations</li>
<li>Automatically optimizes your <strong>titles</strong> for search  engines</li>
<li>Generates <strong>META tags automatically</strong></li>
<li>Avoids the typical duplicate content found on WordPress blogs</li>
<li>For beginners, you don&#8217;t even have to look at the options, it works  out-of-the-box. Just install.</li>
</ul>
</blockquote>
</li>
<li><a href="http://wordpress.org/extend/plugins/seo-image/" rel="nofollow" title="SEO Friendly Images - add title attributes to all images" >SEO Friendly Images</a><br />
<blockquote><p>SEO Friendly Images is a WordPress optimization plugin which  automatically updates all images with proper ALT and TITLE attributes.  If your images do not have ALT and TITLE already set, SEO Friendly  Images will add them according the options you set. Additionally this  makes the post W3C/xHTML valid as well.</p></blockquote>
</li>
<li><a href="http://wordpress.org/extend/plugins/seo-slugs/" rel="nofollow" title="SEO Slugs - removes words liek at or the from urls" >SEO Slugs</a><br />
<blockquote><p>The SEO Slugs WordPress plugin removes common words like &#8216;a&#8217;, &#8216;the&#8217;,  &#8216;in&#8217; from post slugs to improve search engine optimization.</p></blockquote>
</li>
</ol>
<h2>Sitemaps</h2>
<p>Technically a perk for SEO, but the plugin I use exposes a nice user readable sitemap as well.</p>
<ol>
<li><a href="http://wordpress.org/extend/plugins/google-sitemap-generator/" rel="nofollow" title="Google XML Sitemaps - generates xml sitemaps for google, yahoo, bing and your readers!" >Google XML Sitemaps</a><br />
<blockquote><p>This plugin will generate a special XML sitemap which will help search  engines like Google, Bing, Yahoo and Ask.com to better index your blog.  With such a sitemap, it&#8217;s much easier for the crawlers to see the  complete structure of your site and retrieve it more efficiently.</p></blockquote>
</li>
</ol>
<h2>Social Media / Bookmarking</h2>
<p>If you have a group of dedicated followers &#8211; they can be your biggest tool for grabbing more readers. But you have to make their job easy!  That&#8217;s why<strong> I recommend a simple sharing plugin for any wordpress site</strong>.</p>
<ol>
<li><a href="http://wordpress.org/extend/plugins/sexybookmarks/" rel="nofollow" title="SexyBookmarks - Sharing is sexy .. and easy!" >SexyBookmarks</a><br />
<blockquote><p>Though the name may be a little &#8220;edgy&#8221; for some, SexyBookmarks has  proven time and time again to be an extremely useful and successful tool  in getting your readers to actually <strong>submit your articles</strong> to numerous social bookmarking sites.</p></blockquote>
</li>
<li><a href="http://wordpress.org/extend/plugins/wp-to-twitter/" rel="nofollow" title="WP to Twitter - automatically shorten and post your titles to Twitter" >WP to Twitter</a><br />
<blockquote><p>The WP-to-Twitter plugin posts a Twitter status update from your  WordPress blog using either the Cli.gs or Bit.ly URL shortening services  to provide a link back to your post from Twitter.<br />
<em>You can also use WordPress&#8217; built in ?p=529 for short urls.</em></p></blockquote>
</li>
</ol>
<p>That&#8217;s it!  Just install those 7 plugins and you&#8217;ll be running the next Tumblr.. I swear. Ok well that might be an overstatement, or understatement.. but it&#8217;s a good goal to shoot for.</p>
<h2>Feedback</h2>
<p>How about you? Am I missing any great ones, have you found ones that work better than my listed choices? Please share!</p>
<h2>Script It?</h2>
<p>You didn&#8217;t honestly expect me to expect you to download 7 or ore zip files and upload them to a wp install did you?  Hell no, I won&#8217;t even make you curl them individually from your server, just add the scripts you want to the plugins array and run the bash script below against your wp install!</p>
<pre lang="">$ sh wp_plugins.sh path/to/wp/root</pre>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#! /bin/bash</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># upload plugins to wordpress site</span>
<span style="color: #666666; font-style: italic;"># edward a webb - May 7, 2010</span>
<span style="color: #666666; font-style: italic;">#  http://edwardawebb.com/web-development/7-plugins-full-featured-wordpress-content-manager</span>
&nbsp;
<span style="color: #007800;">plugins</span>=<span style="color: #7a0874; font-weight: bold;">&#40;</span> all-in-one-seo-pack google-sitemap-generator.3.2.3 pagemash <span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$#</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #007800;">wproot</span>=<span style="color: #007800;">$1</span>
<span style="color: #000000; font-weight: bold;">else</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Usage: $0 path/to/wp/root&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-d</span> <span style="color: #007800;">$wproot</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span> i = <span style="color: #000000;">0</span> ; i <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #800000;">${#plugins[@]}</span> ; i++ <span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
	<span style="color: #000000; font-weight: bold;">do</span>
		curl http:<span style="color: #000000; font-weight: bold;">//</span>downloads.wordpress.org<span style="color: #000000; font-weight: bold;">/</span>plugin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #800000;">${plugins[$i]}</span>.zip <span style="color: #660033;">-o</span> <span style="color: #800000;">${plugins[$i]}</span>.zip
		<span style="color: #c20cb9; font-weight: bold;">unzip</span> <span style="color: #800000;">${plugins[$i]}</span>.zip <span style="color: #660033;">-d</span> <span style="color: #007800;">$wproot</span><span style="color: #000000; font-weight: bold;">/</span>wp-content<span style="color: #000000; font-weight: bold;">/</span>plugins<span style="color: #000000; font-weight: bold;">/</span>
		<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-f</span> <span style="color: #800000;">${plugins[$i]}</span>.zip
&nbsp;
&nbsp;
	<span style="color: #000000; font-weight: bold;">done</span>  
<span style="color: #000000; font-weight: bold;">else</span>
	<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span> Could not locate <span style="color: #007800;">$wproot</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">2</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">fi</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://edwardawebb.com/web-development/plugins-full-featured-wordpress-content-manager/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Backup all sub-directories with a Bash array loop</title>
		<link>http://edwardawebb.com/linux/backup-subdirectories-bash-array-loop</link>
		<comments>http://edwardawebb.com/linux/backup-subdirectories-bash-array-loop#comments</comments>
		<pubDate>Thu, 15 Apr 2010 22:02:05 +0000</pubDate>
		<dc:creator>Eddie</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[MIsc.Tips]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[tar]]></category>

		<guid isPermaLink="false">http://edwardawebb.com/?p=725</guid>
		<description><![CDATA[I manage lots of domains, and offer my clients free backup and recovery service. Nice selling perk, but I best be damn sure I am backing things up regularly.  Since there is no way my space-cadet brain would remember that, I rely on my &#8216;nix friends: bash, cron and tar to neatly package every sub-directory [...]]]></description>
			<content:encoded><![CDATA[<p>I manage lots of domains, and offer my clients free backup and recovery service.<br />
Nice selling perk, but I best be damn sure I am backing things up regularly.  Since there is no way my space-cadet brain would remember that, I rely on my &#8216;nix friends: <strong>bash, cron and tar</strong> to neatly package every sub-directory of my webroot into their own little tarballs.</p>
<p><strong>The bash script included after the break reads all directories into an array that we can loop through </strong>and manipulate as needed<strong>.</strong><br />
<span id="more-725"></span></p>
<h2>Background</h2>
<p>My webroot is pretty straightforward. Each subdirectory is the full URL of a site. Example:</p>
<pre lang="">
webroot
|-- baungenjar.com
|-- bythebootstrap.com
|-- cafe--espresso.com
|-- crm.webbmaster.org
|-- eaw-technologies.com
|-- edwardawebb.com
|-- entrepreneurmeetcapitalist.com
|-- kicksareforribs.com
|-- ollitech.com
|-- outlaw-photography.com
|-- piwik.baungenjar.com
|-- rendinaro.com
|-- riversidegrillnh.com
|-- sidi.webbmaster.org
|-- status.webbmaster.org
|-- steadfastsites.com
|-- stonybrookpottery.com
|-- survey.webbmaster.org
|-- top.webbmaster.org
|-- trippymedia.com
|-- webbmaster.org
`-- wishlist.webbmaster.org
</pre>
<p>So I want to take each directory and create a gzipped tarball using <em>tar -zcf</em>.    I don&#8217;t want to do any manual intervention.</p>
<p>*ALso, I want to exclude some directories. </p>
<h2>Solution</h2>
<p>This actually took me much longer than it should have. <strong>Too many articles insisted you should change the internal field separator (IFS) to a newline character and just use <em>ls</em></strong>.  Now in my training I was learn-ed that messing with IFS can be dangerous, and will disrupt many things, including any command that relies on options or arguments (i.e. ALL)<br />
<strong>So rather than make my entire script confirm to pesky newlines returned by ls, I did one simpler &#8211; eliminate the newlines in place of a decent token separator, like a space!</strong></p>
<p>To exclude directories I just use a magic file &#8220;.DONT_BACKUP&#8221; that the script checks for.</p>
<h2>Code</h2>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">#!/bin/bash
#
# Backup all directories within webroot
# use empty file &quot;.DONT_BACKUP&quot; to exclude any directory
&nbsp;
&nbsp;
# days to retain backup. Used by recycler script
DEFRETAIN=14
LOGFILE=/home/webb_e/site_backups/WebrootBackup.log
#
#
BU_FILE_COUNT=0
#
# and name of backup source subfolder under the users home
WEBDIR=webroot
#
# and name of dest folder for tar files
DESDIR=site_backups
&nbsp;
#alright, thats it for config, the rest is script
#########################################
&nbsp;
&nbsp;
cd ${HOME}/${WEBDIR}/
&nbsp;
&nbsp;
TODAY=`date`
BU_FILE_COUNT=0
suffix=$(date +%m-%d-%Y)
printf &quot;\n\n********************************************\n\tSite Backup r Log for:\n\t&quot; | tee -a $LOGFILE
echo $TODAY | tee -a $LOGFILE
printf &quot;********************************************\n&quot; $TODAY | tee -a $LOGFILE
echo &quot;see ${LOGFILE} for details&quot;
&nbsp;
#for DIR in $(ls | grep ^[a-z.]*$) 
&nbsp;
for DIR in $(ls | grep ^[a-z.]*$) 
do
	echo $DIR
	#tar the current directory
	if [ -f $DIR/.DONT_BACKUP ]
	then
&nbsp;
		printf &quot;\tSKIPPING $DIR as it contains ignore file\n&quot; | tee -a $LOGFILE
&nbsp;
	else
		cpath=${HOME}/${DESDIR}/${DIR}
		#
		#check if we need to make path
		#
		if [ -d $cpath ]
		then
			# direcotry exists, we're good to continue
			filler=&quot;umin&quot;
		else
			echo Creating $cpath
			mkdir -p $cpath
			echo $DEF_RETAIN &gt; $cpath/.RETAIN_RULE
		fi
		#
&nbsp;
		tar -zcf ${HOME}/${DESDIR}/${DIR}/${DIR}_$suffix.tar.gz ./$DIR
		BU_FILE_COUNT=$(( $BU_FILE_COUNT + 1 ))
	fi
&nbsp;
done
printf &quot;\n\n********************************************\n&quot; | tee -a $LOGFILE
echo $BU_FILE_COUNT sites were backed up
printf &quot;********************************************\n&quot; $TODAY | tee -a $LOGFILE</pre></div></div>

<h2>Result</h2>
<pre lang="">
$ ~/scripts/file_backups/SiteBackup.sh
see /home/myself/site_backups/WebrootBackup.log for details

********************************************
        Site Backup r Log for:
        Thu Apr 15 14:31:53 PDT 2010
********************************************
albums.stonybrookpottery.com
baungenjar.com
bythebootstrap.com
crm.webbmaster.org
digbiz.webroot.com
dotproject.webbmaster.org
edwardawebb.com
kicksareforribs.com
mantis.webbmaster.org
        SKIPPING mantis.webbmaster.org as it contains ignore file
ollitech.com
openx.webbmaster.org
piwik.baungenjar.com
rendinaro.com
riversidegrillnh.com
sidi.webbmaster.org
status.webbmaster.org
steadfastsites.com
stonybrookpottery.com
survey.webbmaster.org
svn.webbmaster.org
taskfreak.webbmaster.org
test.kicksareforribs.com
texpat.webbmaster.org
top.webbmaster.org
        Creating /home/myself/site_backups/top.webbmaster.org
trac.webbmaster.org
trippymedia.com
wave.webbmaster.org
webbmaster.org
wishlist.webbmaster.org

********************************************
33 sites were backed up
********************************************
</pre>
<p>But wait! We wanted to automate this whole thing right? And so we shall.</p>
<h2>Using Cron to automate the process</h2>
<p>If your using a webhost they likely provide a GUI to add cron jobs. If that&#8217;s the case you can just point to the full path where you saved the above script, select the interval and your good to go.</p>
<p>If your using this on your own server you&#8217;ll need to get your hands dirty with a crontab. You can open the crontab file in your editor of choice, or call it from the command line. IN this example we&#8217;ll rely in vi, my systems default editor.<br />
Create a crontab file if it does not already exist and open it for edit</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">crontab <span style="color: #660033;">-e</span></pre></div></div>

<p>You may see some existing lines or you may not. Just remember one job per line. THe layout may seem overwhelming at first, but its quite simple, and breaks down like this</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">min     hour     day    month    weekday     job_to_Run</pre></div></div>

<p>The values are in the respective ranges for day of week 0 is Sunday.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000;">0</span>-<span style="color: #000000;">59</span>    <span style="color: #000000;">0</span>-<span style="color: #000000;">23</span>     <span style="color: #000000;">1</span>-<span style="color: #000000;">31</span>    <span style="color: #000000;">1</span>-<span style="color: #000000;">12</span>     <span style="color: #000000;">0</span>-<span style="color: #000000;">6</span>        filename</pre></div></div>

<p>To omit a field replace it with an asterisk (*) which means all values. Alternately you may use comma separated lists. Although I believe it will treat any whitespace as a delimiter I use tabs to make the organization a little nicer.</p>
<p>So let&#8217;s suppose I want to run this job nightly, it is after all named DAILY sql backup <img src='http://edwardawebb.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile Backup all sub directories with a Bash array loop" class='wp-smiley' title="Backup all sub directories with a Bash array loop" /><br />
I will add the following line to my crontab</p>
<pre>
15    0     *    *   *     $HOME/scripts/file_backup.sh > logfile.log
</pre>
<p>This means every day @ 00:15 a.k.a 15 minutes past midnight it will run the script and print any output into the specified logfile.<br />
If you leave off the redirect to logfile it will email the user with the results. To omit any output use the handy standby
<pre>>/dev/null 2>&#038;1</pre>
<p>.</p>
<h2>More Help</h2>
<p><strong>If you are curious about the script that will actually recycle old backups, then I suggest <a href="http://edwardawebb.com/linux/log-recycler-script">Log Recycler Script</a> which could easily be updated to handle .tar.gz files instead of .sql.gz files <img src='http://edwardawebb.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile Backup all sub directories with a Bash array loop" class='wp-smiley' title="Backup all sub directories with a Bash array loop" /> </strong></p>
<p><strong><br />
If you want to backup your MySQL databases, I have that too, <a href="http://edwardawebb.com/web-development/simple-shell-script-backup-multiple-mysql-databases">Shell script to backup multiple databases</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://edwardawebb.com/linux/backup-subdirectories-bash-array-loop/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>XML vs JSON</title>
		<link>http://edwardawebb.com/tips/xml-json</link>
		<comments>http://edwardawebb.com/tips/xml-json#comments</comments>
		<pubDate>Sat, 27 Mar 2010 16:20:58 +0000</pubDate>
		<dc:creator>Eddie</dc:creator>
				<category><![CDATA[MIsc.Tips]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://edwardawebb.com/?p=689</guid>
		<description><![CDATA[The choir I tackled was to compare the performance of XML and JSON by downloading the user's recommendations from the Netflix API.  To make testing quick I would make a call to both XML and JSON classes in each loop, and repeat 10-30 times for each sample point. ]]></description>
			<content:encoded><![CDATA[<p>I recently read an <a href="http://www.linux-mag.com/cache/7717/1.html" rel="nofollow" title="Article from Linux Mag"  target="_blank">article on Linux Magazine that suggested JSON is a better tool for data transfer than XML on Android phones</a>.  So I decided to try switching some of QueueMan&#8217;s queue retrieves over to JSON.  Eliminating the verbose tags may be much quicker over wireless airwaves.</p>
<p><strong>The choir I tackled was to compare the performance of XML and JSON by downloading the user&#8217;s recommendations from the Netflix API. </strong> To make testing quick I would make a call to both XML and JSON classes in each loop, and repeat 10-30 times for each sample point.  The sample points were 1,5,10,15,25,50, and 64 discs. (64 being the current # of recommendations Netflix is offering me)</p>
<p>I used org.xml.sax, and org.json. JSON* as the libraries for my parsing.</p>
<p><span id="more-689"></span></p>
<h4>Why JSON is thought to be superior to XML</h4>
<p>So the thought, as I have seen and heard it is as follows:</p>
<blockquote><p>JSON&#8217;s lightweight payload allows for reduced bandwidth needs and faster transfers.</p></blockquote>
<p>That is particularly attractive for mobile devices.</p>
<h4>What my Testing Revealed about XML vs JSON</h4>
<p><img src="https://spreadsheets.google.com/oimg?key=0ApQs0QFa9ReJdFBMSkt3Sl9UVXVGd29ZOU5KZmVyMFE&amp;oid=1&amp;v=1269704842669" alt=" XML vs JSON "  title="XML vs JSON " /></p>
<p>You can see from the 108 samples above that i<strong>n the 1-5 disc range that JSON indeed performed a bit quicker</strong> than XML. <strong>However the numbers quickly turned, and JSON grew exponentially slower as the disc count increased</strong>.  XML&#8217;s time grew much slower.</p>
<h4>Why XML is a better Performer</h4>
<p>The argument that JSON&#8217;s has a lighter data definition structure is true, but only by 50%.   And the structure for 5 discs is less than 1% of the total character payload  (0.8% in JSONs case, assuming an average label of 12 characters, not counting all the commas, parentheses, and escape characters needed).  And this drops as the numbers increase.  So if you&#8217;re just passing a &#8220;tag_names&#8221; with payloads like &#8220;8974&#8243; than JSON would be much lighter.  Once you start passing text that far exceeds your tag lengths, than JSON loses its edge.</p>
<p><strong>Size Matters</strong></p>
<pre>{ "average_tag" :  {
"term1": "it's all about the data",
"term2": "and the amount of information",
"term3": "you need to transport"
}

&lt;average_tag&gt;
&lt;term1&gt;"it's all about the data&lt;/term1&gt;
&lt;term2&gt;and the amount of information&lt;/term2&gt;
&lt;term3&gt;you need to transport&lt;/term3&gt;
&lt;/average_tag&gt;
</pre>
<p>So although the payload is just slightly lighter,  it has one major trade-off.  XML is a parse-once-and-you&#8217;re-done deal. The entire XML file is walked once by Sax, and you just build a neat little Object as you go.  With JSON you rely on setting objects to represent the structure of the file and pull pieces using their index.   I suspect the JSON parsers walk though the string numerous times. (hence the requirement for a string, and not an input stream like Sax.)</p>
<p><strong>So, as far as QueueMan and I are concerned, we&#8217;ll stick with XML.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://edwardawebb.com/tips/xml-json/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Performance Tip: Boost Your SAX Life</title>
		<link>http://edwardawebb.com/tips/performance-tip-boost-sax-life</link>
		<comments>http://edwardawebb.com/tips/performance-tip-boost-sax-life#comments</comments>
		<pubDate>Fri, 16 Oct 2009 15:55:23 +0000</pubDate>
		<dc:creator>Eddie</dc:creator>
				<category><![CDATA[MIsc.Tips]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[parser]]></category>
		<category><![CDATA[SAX]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://edwardawebb.com/?p=571</guid>
		<description><![CDATA[So this may seem obvious to some of you, and is based on a well understood matter.  <strong>String comparisons are not cheap</strong>. They're not explicitly expensive, and having a half a dozen in one method would not usually cause any performance bottle necks.

But now imagine calling the same method 1,000's of times. That's 6,000 string comparisons! Each method in a SAX parse will do just that! So how do we reduce the number of comparisons needed?]]></description>
			<content:encoded><![CDATA[<p>SAX, or <em>Simple API for XML </em>has grown to be the standard in Java XML parsing.  Numerous studies show how its performance, in the majority of circumstances, beats others such as PULL.</p>
<p>Does that mean you should just bang out a custom handler and expect solid performance, hardly.<br />
This article has only two  tips, but it can have a huge impact.<span id="more-571"></span></p>
<h2>Sample Code</h2>
<p>In case it has been  a while since you wrote your last SAX XML handler, below is a sample method for the start of each element in an XML stream. This method will be called each and every time a new element starts, no matter how nested or trivial.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> startElement<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> uri, <span style="color: #003399;">String</span> name, <span style="color: #003399;">String</span> qName,	<span style="color: #003399;">Attributes</span> atts<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>name.<span style="color: #006633;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;category&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			inCategory <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">else</span> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>name.<span style="color: #006633;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;availability&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			inAvailability <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">else</span> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>name.<span style="color: #006633;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;delivery_formats&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			inFormats <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">else</span> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>name.<span style="color: #006633;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;queue_item&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			inQueueItem <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">else</span> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>name.<span style="color: #006633;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;id&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			inId <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">else</span> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>name.<span style="color: #006633;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;average_rating&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			inRating <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">else</span> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>name.<span style="color: #006633;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;position&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			inPosition <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">else</span> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>name.<span style="color: #006633;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;title&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			inTitle <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">else</span> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>name.<span style="color: #006633;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;box_art&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			inBoxArt <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>	
		<span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">else</span> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>name.<span style="color: #006633;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;etag&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			inETag <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>			
		<span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">else</span> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>name.<span style="color: #006633;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;number_of_results&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			inResultsTotal <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">else</span> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>name.<span style="color: #006633;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;results_per_page&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			inResultsPerPage <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span></pre></div></div>

<p>(That is part of a handler I use for Netflix&#8217;s API responses.)</p>
<h2>Keep it Simple SAX</h2>
<p>So this may seem obvious to some of you, and is based on a well understood matter.  <strong>String comparisons are not cheap</strong>. They&#8217;re not explicitly expensive, and having a half a dozen in one method would not usually cause any performance bottle necks.</p>
<p>But now imagine calling the same method 1,000&#8242;s of times. That&#8217;s 6,000 string comparisons!</p>
<p>Each method in a SAX parse will do just that! So how do we reduce the number of comparisons needed?</p>
<p>So if your not using &#8220;reasults_per_page&#8221; then there is no need to check for that element.  It may be useful to create separate handlers for various needs. One can get the quick and dirty summary, while the other can capture all the gritty details.</p>
<p>Hooray! we just knocked off 1,000 comparisons!</p>
<h2>Order is Everything!</h2>
<p>So keeping the If Else blocks short makes sense, the less comparisons, the faster the parsing.  But even for those blocks that require numerous element checks we can tune performance substantially by adjusting the order.</p>
<p>The next tip, and a hugely important one, is to carefully consider the frequency of each element called. To illustrate is a sample XML response form Netflix.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">standalone</span>=<span style="color: #ff0000;">&quot;yes&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;queue<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;etag<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>26049040137<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/etag<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url_template<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>http://api.netflix.com/users/se3cret/queues/disc?{-join|<span style="color: #ddbb00;">&amp;amp;</span>|sort|start_index|max_results}
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url_template<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;number_of_results<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>32<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/number_of_results<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;start_index<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>0<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/start_index<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;results_per_page<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>25<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/results_per_page<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;queue_item<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>http://api.netflix.com/users/secret/queues/disc/available/1/70056440
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;position<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/position<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link</span></span>
<span style="color: #009900;">			<span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;http://api.netflix.com/users/secret/queues/disc/available&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">rel</span>=<span style="color: #ff0000;">&quot;http://schemas.netflix.com/queues.available&quot;</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">&quot;available queue&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/link<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;category</span> <span style="color: #000066;">scheme</span>=<span style="color: #ff0000;">&quot;http://api.netflix.com/categories/queue_availability&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;available now&quot;</span> <span style="color: #000066;">term</span>=<span style="color: #ff0000;">&quot;available now&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Available Now<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/category<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;updated<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1185814282<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/updated<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;category</span> <span style="color: #000066;">scheme</span>=<span style="color: #ff0000;">&quot;http://api.netflix.com/categories/title_formats&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;DVD&quot;</span> <span style="color: #000066;">term</span>=<span style="color: #ff0000;">&quot;DVD&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/category<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;http://api.netflix.com/catalog/titles/movies/70056440&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">rel</span>=<span style="color: #ff0000;">&quot;http://schemas.netflix.com/catalog/title&quot;</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">&quot;300&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/link<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;title</span> <span style="color: #000066;">short</span>=<span style="color: #ff0000;">&quot;300&quot;</span> <span style="color: #000066;">regular</span>=<span style="color: #ff0000;">&quot;300&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;box_art</span> <span style="color: #000066;">small</span>=<span style="color: #ff0000;">&quot;http://cdn-0.nflximg.com/us/boxshots/tiny/70056440.jpg&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">medium</span>=<span style="color: #ff0000;">&quot;http://cdn-0.nflximg.com/us/boxshots/small/70056440.jpg&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">large</span>=<span style="color: #ff0000;">&quot;http://cdn-0.nflximg.com/us/boxshots/large/70056440.jpg&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/box_art<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;http://api.netflix.com/catalog/titles/movies/70056440/synopsis&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">rel</span>=<span style="color: #ff0000;">&quot;http://schemas.netflix.com/catalog/titles/synopsis&quot;</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">&quot;synopsis&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;synopsis<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><span style="color: #339933;">&lt;![CDATA[&lt;a href=&quot;http://www.netflix.com/RoleDisplay/Zack_Snyder/20057354&quot;&gt;Zack Snyder&lt;/a&gt; directs this faithful adaptation of Frank Miller's (Sin City) graphic novel about the storied Battle of Thermopylae, a conflict that pitted the ancient Greeks against the Persians in 480 B.C. The film, which blends live-action shots with virtual backgrounds to capture Miller's original vision, co-stars &lt;a href=&quot;http://www.netflix.com/RoleDisplay/Gerard_Butler/20015853&quot;&gt;Gerard Butler&lt;/a&gt; as the Spartan King Leonidas, who leads his small band of 300 soldiers against an army of more than one million.&amp;#x00A0;]]&gt;</span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/synopsis<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/link<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link</span></span>
<span style="color: #009900;">			<span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;http://api.netflix.com/catalog/titles/movies/70056440/bonus_materials&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">rel</span>=<span style="color: #ff0000;">&quot;http://schemas.netflix.com/catalog/titles/bonus_materials&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">title</span>=<span style="color: #ff0000;">&quot;bonus materials&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/link<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;release_year<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2007<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/release_year<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;category</span> <span style="color: #000066;">scheme</span>=<span style="color: #ff0000;">&quot;http://api.netflix.com/categories/mpaa_ratings&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;R&quot;</span> <span style="color: #000066;">term</span>=<span style="color: #ff0000;">&quot;R&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/category<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;category</span> <span style="color: #000066;">scheme</span>=<span style="color: #ff0000;">&quot;http://api.netflix.com/categories/genres&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;Action &amp;amp; Adventure&quot;</span> <span style="color: #000066;">term</span>=<span style="color: #ff0000;">&quot;Action &amp;amp; Adventure&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/category<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;category</span> <span style="color: #000066;">scheme</span>=<span style="color: #ff0000;">&quot;http://api.netflix.com/categories/genres&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;Adventures&quot;</span> <span style="color: #000066;">term</span>=<span style="color: #ff0000;">&quot;Adventures&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/category<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;category</span> <span style="color: #000066;">scheme</span>=<span style="color: #ff0000;">&quot;http://api.netflix.com/categories/genres&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;Military &amp;amp; War Action&quot;</span> <span style="color: #000066;">term</span>=<span style="color: #ff0000;">&quot;Military &amp;amp; War Action&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/category<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;category</span> <span style="color: #000066;">scheme</span>=<span style="color: #ff0000;">&quot;http://api.netflix.com/categories/genres&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;Epics&quot;</span> <span style="color: #000066;">term</span>=<span style="color: #ff0000;">&quot;Epics&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/category<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;category</span> <span style="color: #000066;">scheme</span>=<span style="color: #ff0000;">&quot;http://api.netflix.com/categories/genres&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;Comic Books and Superheroes&quot;</span> <span style="color: #000066;">term</span>=<span style="color: #ff0000;">&quot;Comic Books and Superheroes&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/category<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;category</span> <span style="color: #000066;">scheme</span>=<span style="color: #ff0000;">&quot;http://api.netflix.com/categories/genres&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;Blu-ray&quot;</span> <span style="color: #000066;">term</span>=<span style="color: #ff0000;">&quot;Blu-ray&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/category<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;category</span> <span style="color: #000066;">scheme</span>=<span style="color: #ff0000;">&quot;http://api.netflix.com/categories/genres&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;Warner Home Video&quot;</span> <span style="color: #000066;">term</span>=<span style="color: #ff0000;">&quot;Warner Home Video&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/category<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;runtime<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>6960<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/runtime<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link</span></span>
<span style="color: #009900;">			<span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;http://api.netflix.com/catalog/titles/movies/70056440/format_availability&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">rel</span>=<span style="color: #ff0000;">&quot;http://schemas.netflix.com/catalog/titles/format_availability&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">title</span>=<span style="color: #ff0000;">&quot;formats&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delivery_formats<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;availability</span> <span style="color: #000066;">available_from</span>=<span style="color: #ff0000;">&quot;1185840000&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
					<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;category</span> <span style="color: #000066;">scheme</span>=<span style="color: #ff0000;">&quot;http://api.netflix.com/categories/title_formats&quot;</span></span>
<span style="color: #009900;">						<span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;Blu-ray&quot;</span> <span style="color: #000066;">term</span>=<span style="color: #ff0000;">&quot;Blu-ray&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/category<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/availability<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;availability</span> <span style="color: #000066;">available_from</span>=<span style="color: #ff0000;">&quot;1185840000&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
					<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;category</span> <span style="color: #000066;">scheme</span>=<span style="color: #ff0000;">&quot;http://api.netflix.com/categories/title_formats&quot;</span></span>
<span style="color: #009900;">						<span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;DVD&quot;</span> <span style="color: #000066;">term</span>=<span style="color: #ff0000;">&quot;DVD&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/category<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/availability<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/delivery_formats<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/link<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link</span></span>
<span style="color: #009900;">			<span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;http://api.netflix.com/catalog/titles/movies/70056440/screen_formats&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">rel</span>=<span style="color: #ff0000;">&quot;http://schemas.netflix.com/catalog/titles/screen_formats&quot;</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">&quot;screen formats&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/link<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;http://api.netflix.com/catalog/titles/movies/70056440/cast&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">rel</span>=<span style="color: #ff0000;">&quot;http://schemas.netflix.com/catalog/people.cast&quot;</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">&quot;cast&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/link<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link</span></span>
<span style="color: #009900;">			<span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;http://api.netflix.com/catalog/titles/movies/70056440/directors&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">rel</span>=<span style="color: #ff0000;">&quot;http://schemas.netflix.com/catalog/people.directors&quot;</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">&quot;directors&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/link<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link</span></span>
<span style="color: #009900;">			<span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;http://api.netflix.com/catalog/titles/movies/70056440/languages_and_audio&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">rel</span>=<span style="color: #ff0000;">&quot;http://schemas.netflix.com/catalog/titles/languages_and_audio&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">title</span>=<span style="color: #ff0000;">&quot;languages and audio&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/link<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;average_rating<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>4.0<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/average_rating<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;http://api.netflix.com/catalog/titles/movies/70056440/similars&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">rel</span>=<span style="color: #ff0000;">&quot;http://schemas.netflix.com/catalog/titles.similars&quot;</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">&quot;similars&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/link<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;http://www.netflix.com/Movie/300/70056440&quot;</span> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">&quot;alternate&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">title</span>=<span style="color: #ff0000;">&quot;web page&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/link<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/queue_item<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;queue_item<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		...
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/queue_item<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/queue<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>So there are some important things to note;</p>
<ul>
<li>&#8216;queue&#8217; occurs once, and only once </li>
<li>Likewise &#8216;etag&#8217;, and result counts occur once and only once</li>
<li>&#8216;queue_item&#8217; occurs once for each movie (1 to many times)</li>
<li>&#8216;id&#8217;, &#8216;position&#8217; and movie details also occur once for each listing (1 to many times)</li>
<li>&#8216;availability&#8217; may occur 1 to 3 times for each movie (3 to (3*many) times )</li>
<li>&#8216;category&#8217; is by far the most notorious, occurring within each title multiple times, and within each availability (lots of times)</li>
</ul>
<p>So what does that mean? <strong> It means the very first element we&#8217;ll check for is &#8216;category&#8217;, then &#8216;availability&#8217;, and work our way to the least common element, &#8216;queue&#8217;.</strong></p>
<p>This is a very effective way to increase performance because <strong>once a match is found, we skip all the rest</strong>. </p>
<p>So a <strong>12 </strong>comparison method effectively becomes a <strong>single comparison</strong> if we are in a &#8216;category&#8217;, and a 2 comparison method if we are in &#8216;availability&#8217;, etc. Until finally on the rarest &#8216;queue&#8217; which occurs only once do we evaluate all 12 comparisons.</p>
<h2>Results</h2>
<p>This test is hardly conclusive, but you can see the average and max parse times of a randomly arranged handler and a popularity arranged handler.<br />
<img src="http://spreadsheets.google.com/oimg?key=0ApQs0QFa9ReJdHpselhsbGwxZVB3ZXdDa01ObmQ3Nnc&#038;oid=4&#038;v=1256445520530" title="Performance Tip: Boost Your SAX Life" alt=" Performance Tip: Boost Your SAX Life" /></p>
<p><img src="http://spreadsheets.google.com/oimg?key=0ApQs0QFa9ReJdHpselhsbGwxZVB3ZXdDa01ObmQ3Nnc&#038;oid=6&#038;v=1256445692757" title="Performance Tip: Boost Your SAX Life" alt=" Performance Tip: Boost Your SAX Life" /></p>
]]></content:encoded>
			<wfw:commentRss>http://edwardawebb.com/tips/performance-tip-boost-sax-life/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Automatically subscribe users to DreamHost announce lists</title>
		<link>http://edwardawebb.com/web-development/automatically-subscribe-users-dreamhost-announce-lists</link>
		<comments>http://edwardawebb.com/web-development/automatically-subscribe-users-dreamhost-announce-lists#comments</comments>
		<pubDate>Wed, 19 Aug 2009 18:58:01 +0000</pubDate>
		<dc:creator>Eddie</dc:creator>
				<category><![CDATA[MIsc.Tips]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[dreamhost]]></category>

		<guid isPermaLink="false">http://edwardawebb.com/?p=560</guid>
		<description><![CDATA[This is a response to a question on the DreamHost wiki posted by anonymous. &#8220;I have a Contact page using form mail, and want to include a checkbox that enable visitors, to also subscribe to our Announce List when posting their form mail. Is there a facility for adding users to the Announce List without [...]]]></description>
			<content:encoded><![CDATA[<p>This is a response to a question on the DreamHost wiki posted by anonymous.</p>
<blockquote><p>&#8220;I have a Contact page using form mail, and want to include a checkbox that enable visitors, to also subscribe to our Announce List when posting their form mail.</p>
<p>Is there a facility for adding users to the Announce List without using form POST&#8221;</p></blockquote>
<p>Without using POST? I am not sure about that.. but using a checkbox to subscribe users is a snap.</p>
<p><span id="more-560"></span>Your resources;</p>
<ul>
<li>DreamHost Panel API</li>
<li>PHP curl methods</li>
</ul>
<p>So it goes like this;</p>
<p>Your user registers a new account, or sends you a contact message. As part of the form they submit their email address and name.  We in turn pass that email and name onto DreamHost&#8217;s panel API thereby adding the user to future announcements.</p>
<p>The code I will explain needs to go in the form&#8217;s receiving code. We will check for the checkbox&#8217;s value, and if necessary handle the additional choir. This code should be pasted into your contact form or registration form wherever the initial data is received and handled.</p>
<p style="text-align: center;">
<div class="mceTemp mceIEcenter">
<dl id="attachment_561" class="wp-caption aligncenter" style="width: 682px;">
<dt class="wp-caption-dt">
<div class="mceTemp mceIEcenter">
<dl id="attachment_562" class="wp-caption aligncenter" style="width: 682px;"><a href="http://edwardawebb.com/wp-content/uploads/2009/08/process1.png"><img class="size-full wp-image-562  " title="process" src="http://edwardawebb.com/wp-content/uploads/2009/08/process1.png" alt="process1 Automatically subscribe users to DreamHost announce lists" width="672" height="504" /></a>
<dd class="wp-caption-dd">The red boundary denotes new code for the announce submission</dd>
</dl>
</div>
</dt>
</dl>
</div>
<p>Since every cms, site and blog are different, I am unable to provide specifics, but yu should be able to track down the code for your form and find the portion that handles the submission. (Most obviously denoted with $_POST or $_GET variable use.)  I will also assume your email field is named &#8216;email&#8217; and your name field is two fields; &#8216;firstName&#8217;, &#8216;lastName&#8217;;</p>
<h3> Details on the API command</h3>
<p>Below is a link to details on the command, needed parameters and possible responses.<br />
<a href="http://wiki.dreamhost.com/Application_programming_interface#announcement_list-add_subscriber" rel="nofollow" >Add Subscriber API Command</a></p>
<h3> The Announce Submission Code</h3>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'subscribeMe'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'subscribeMe'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
&nbsp;
       <span style="color: #666666; font-style: italic;">//get the values we need from form(this should in aprt already be somewhere in the code your editing)</span>
       <span style="color: #000088;">$email</span><span style="color: #339933;">=</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'email'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
       <span style="color: #000088;">$fullName</span><span style="color: #339933;">=</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'firstName'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'lastName'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
       <span style="color: #666666; font-style: italic;">//set values we shoudl know, and are constant</span>
       <span style="color: #000088;">$domain</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;domain of this form&quot;</span><span style="color: #339933;">;</span>
       <span style="color: #000088;">$listname</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;list-name&quot;</span><span style="color: #339933;">;</span>
       <span style="color: #000088;">$apiKey</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;666666666666&quot;</span><span style="color: #339933;">;</span>
&nbsp;
       <span style="color: #666666; font-style: italic;">// using curl and passing 5 critical values to the api</span>
       <span style="color: #666666; font-style: italic;">// list, domain, email, name and API Key</span>
&nbsp;
&nbsp;
		<span style="color: #000088;">$ch</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_init</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'https://api.dreamhost.com/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 		<span style="color: #990000;">curl_setopt</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_POST<span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 		<span style="color: #990000;">curl_setopt</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_POSTFIELDS<span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;key=<span style="color: #006699; font-weight: bold;">$apiKey</span>&amp;cmd=announcement_list-add_subscriber&amp;listname=<span style="color: #006699; font-weight: bold;">$listname</span>&amp;domain=<span style="color: #006699; font-weight: bold;">$domain</span>&amp;email=<span style="color: #006699; font-weight: bold;">$email</span>&amp;name=<span style="color: #006699; font-weight: bold;">$fullName</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 		<span style="color: #000088;">$result</span><span style="color: #339933;">=</span><span style="color: #990000;">curl_exec</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 		<span style="color: #990000;">curl_close</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">stripos</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$result</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'success'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;h2&gt;Congrats! &lt;/h2&gt;&lt;p&gt;You have been added to our Mailing List&lt;/p&gt;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
			<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;h2&gt; Ooops! &lt;/h2&gt;&lt;p&gt;Unable to add your email to our announcement list please contact site administrator.&lt;/p&gt;&quot;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Code: &quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$result</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #666666; font-style: italic;">// end if subscribe box checked</span></pre></div></div>

<h3> Getting a DreamHost API key</h3>
<p><a href="http://wiki.dreamhost.com/Application_programming_interface#What_values_does_DreamHost.27s_API_use.3F" rel="nofollow" >More info on DreamHost API</a></p>
]]></content:encoded>
			<wfw:commentRss>http://edwardawebb.com/web-development/automatically-subscribe-users-dreamhost-announce-lists/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Getting the most of cell phone favorites &#8211; a.k.a. free calls</title>
		<link>http://edwardawebb.com/tips/cell-phone-favorites-aka-free-calls</link>
		<comments>http://edwardawebb.com/tips/cell-phone-favorites-aka-free-calls#comments</comments>
		<pubDate>Sun, 12 Jul 2009 14:15:27 +0000</pubDate>
		<dc:creator>Eddie</dc:creator>
				<category><![CDATA[MIsc.Tips]]></category>
		<category><![CDATA[awk]]></category>
		<category><![CDATA[calls]]></category>
		<category><![CDATA[phone]]></category>
		<category><![CDATA[t-mobile]]></category>

		<guid isPermaLink="false">http://edwardawebb.com/?p=515</guid>
		<description><![CDATA[Many cell phone carriers are moving to implement a circle of friends that you can call for free. T-Mobile has MyFaves™,  Alltel has My Circle ™, even Verizon offers a discount on the ten numbers you call most. This begs the question;
"<strong>Who do I call Most?</strong>"
Well you can be subjective about it and decide you like Danny better than Mary-Lou, but the truth is that Mary-Lou calls you constantly, and that's going to put a dent in your anytime minutes.

The more objective and scientific method is to actually count the minutes you spend on each number and rank the accounts in order of use. Hmm, I am already thinking AWK.

<strong>Read on to get the awk script to sort your monthly calling logs into facts you can use!</strong>]]></description>
			<content:encoded><![CDATA[<p>Many cell phone carriers are moving to implement a circle of friends that you can call for free. T-Mobile has MyFaves™,  Alltel has My Circle ™, even Verizon offers a discount on the ten numbers you call most. This begs the question;<br />
&#8220;<strong>Who do I call Most?</strong>&#8221;<br />
Well you can be subjective about it and decide you like Danny better than Mary-Lou, but the truth is that Mary-Lou calls you constantly, and that&#8217;s going to put a dent in your anytime minutes.</p>
<p>The more objective and scientific method is to actually count the minutes you spend on each number and rank the accounts in order of use. Hmm, I am already thinking AWK.</p>
<p><strong>Read on to get the awk script to sort your monthly calling logs into facts you can use!</strong><br />
<span id="more-515"></span></p>
<h2>The Problem</h2>
<p>You need to know if your circle of chosen numbers is giving you the best use of your free calling.</p>
<h2>The Solution</h2>
<p>Tally up those calls and compare.   This uses some stanard &#8216;nix utils including awk and sort.</p>
<p>Start by jumping to your carriers website. They all  provide a digital view of your call logs.  You can copy and paste into a text file, or download a CSV file that lists them out.  Name this file callLogs.</p>
<p>(If you are using a CSV, I recommend replacing the commas with semi-colons, or another character that won&#8217;t be found anywhere else in the record. Removing extraneous quotations is helpful as well.)</p>
<h3>Sample Call Log</h3>
<pre>
07/11/09;INCOMING;06:09 PM;555-420-1118;;1
07/11/09;PLATTSBG, NJ;05:55 PM;555-420-5141;(V);1
07/11/09;PLATTSBG, NJ;05:55 PM;555-420-1318;;1
07/11/09;INCOMING;05:38 PM;555-420-5141;(V);2
07/11/09;PLATTSBG, NJ;05:20 PM;555-420-5141;(V);1
07/11/09;INCOMING;05:15 PM;555-420-5141;(V);2
07/11/09;VM Retrieval;05:12 PM;221;(F);5
07/11/09;POUGHA, NJ;04:04 PM;555-643-8173;;2
07/11/09;VM Retrieval;04:04 PM;221;(F);1
07/11/09;PLATTSBG, NJ;12:23 PM;555-563-1689;(V);2
07/11/09;INCOMING;12:36 AM;555-593-1910;;2
</pre>
<p>This is a T-Mobile Call Log. There are 6 fields. I only care about 3 of them. The number ($4) Their bucket, e.g. MyFave, Mobile to Mobile, ($5) and the call time ($6).<br />
Excellent.  Now we need some<strong> script to sort, total and report on those numbers</strong>. Enter AWK.</p>
<h3>The AWK Script to Total and Sort Call Logs</h3>
<p>*** Please pay attention to the field numbers used ($4,$5,$6)  the order and count of your fields may differ ***</p>

<div class="wp_syntax"><div class="code"><pre class="awk" style="font-family:monospace;"><span style="color:#808080;"># awk script that totals minutes based on verizon call log (pasted form site)</span>
&nbsp;
<span style="color:#808080;">#usage: cat callLog | awk -F&quot;;&quot; -f &lt;this file name&gt; </span>
&nbsp;
<span style="color:#808080;">#in T-Mobile world a F denote mobile to mobile and V denote my fave</span>
<span style="color:#808080;">#will have 3 buckets in total then</span>
<span style="color:#000088;">$2</span> <span style="color:#C4C364;">!~</span> <span style="color: #ff0000;">&quot;([VF])&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>minutes<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color:#000088;">$1</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color:black;">+</span>= <span style="color:#000088;">$3</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>  <span style="color:#808080;">#whenever minutes</span>
<span style="color:#000088;">$2</span> <span style="color:black;">==</span> <span style="color: #ff0000;">&quot;(V)&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>faves<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color:#000088;">$1</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color:black;">+</span>= <span style="color:#000088;">$3</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color:#808080;">#myfaves</span>
<span style="color:#000088;">$2</span> <span style="color:black;">==</span> <span style="color: #ff0000;">&quot;(F)&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>tm<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color:#000088;">$1</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color:black;">+</span>= <span style="color:#000088;">$3</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color:#808080;">#mobile to mobile</span>
&nbsp;
<span style="color:#808080;">#print a nice summary please</span>
<span style="color: #C20CB9; font-weight: bold;">END</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>		
		<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>i <span style="color: #000000; font-weight: bold;">in</span> minutes<span style="color: #7a0874; font-weight: bold;">&#41;</span>
		<span style="color: #7a0874; font-weight: bold;">&#123;</span>			
			 total <span style="color:black;">+</span>= minutes<span style="color: #7a0874; font-weight: bold;">&#91;</span>i<span style="color: #7a0874; font-weight: bold;">&#93;</span>
			<span style="color: #0BD507; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;%s calltime totaled %d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>, i, minutes<span style="color: #7a0874; font-weight: bold;">&#91;</span>i<span style="color: #7a0874; font-weight: bold;">&#93;</span>
		<span style="color: #7a0874; font-weight: bold;">&#125;</span>
		<span style="color: #0BD507; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;Total: %d&quot;</span>,total
		<span style="color: #0BD507; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span> Faves Totals<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
		<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>i <span style="color: #000000; font-weight: bold;">in</span> faves<span style="color: #7a0874; font-weight: bold;">&#41;</span>
		<span style="color: #7a0874; font-weight: bold;">&#123;</span>			
			 ftotal <span style="color:black;">+</span>= faves<span style="color: #7a0874; font-weight: bold;">&#91;</span>i<span style="color: #7a0874; font-weight: bold;">&#93;</span>
			<span style="color: #0BD507; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;%s calltime totaled %d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>, i, faves<span style="color: #7a0874; font-weight: bold;">&#91;</span>i<span style="color: #7a0874; font-weight: bold;">&#93;</span>
		<span style="color: #7a0874; font-weight: bold;">&#125;</span>
		<span style="color: #0BD507; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;Total: %d&quot;</span>,ftotal
		<span style="color: #0BD507; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span> T-Mobile Totals<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
		<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>i <span style="color: #000000; font-weight: bold;">in</span> tm<span style="color: #7a0874; font-weight: bold;">&#41;</span>
		<span style="color: #7a0874; font-weight: bold;">&#123;</span>			
			 ttotal <span style="color:black;">+</span>= tm<span style="color: #7a0874; font-weight: bold;">&#91;</span>i<span style="color: #7a0874; font-weight: bold;">&#93;</span>
			<span style="color: #0BD507; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;%s calltime totaled %d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>, i, tm<span style="color: #7a0874; font-weight: bold;">&#91;</span>i<span style="color: #7a0874; font-weight: bold;">&#93;</span>
		<span style="color: #7a0874; font-weight: bold;">&#125;</span>
		<span style="color: #0BD507; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;Total: %d&quot;</span>,ttotal
	<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p>Great, now we can <strong>run our call log through the awk script</strong> to see what we get..</p>
<h2>The Result</h2>
<p>I am on T-Mobile, so I have <strong>3 Categories of calls; My anytime or whenever minutes,  my MyFaves™ minutes, and my T-Mobile to T-Mobile calls.</strong></p>
<pre>
Eddie@HP-dv6z-420 ~
$ cat callLog | awk -F";" -f ~/scripts/CallLogSummary
555-448-3547 calltime totaled 2
555-572-7255 calltime totaled 2
555-593-0910 calltime totaled 5
555-643-8773 calltime totaled 2
555-433-1328 calltime totaled 8
555-578-2088 calltime totaled 2
555-682-8397 calltime totaled 2
555-335-1974 calltime totaled 3
555-334-3041 calltime totaled 5
555-373-8408 calltime totaled 7
555-593-2753 calltime totaled 26
555-351-8146 calltime totaled 12
555-420-6768 calltime totaled 4
555-531-0398 calltime totaled 4
555-420-6318 calltime totaled 8
555-448-2571 calltime totaled 1
555-740-4700 calltime totaled 1
Total: 94

 Faves Totals
555-563-0689 calltime totaled 76
555-420-5169 calltime totaled 23
555-593-1531 calltime totaled 5
555-420-5641 calltime totaled 23
530-721-0449 calltime totaled 23
Total: 150

 T-Mobile Totals
123 calltime totaled 12
555-420-8399 calltime totaled 4
221 calltime totaled 6
Total: 22
</pre>
<p>As you can see I am NOT getting the most of my plan.  I will switch the low My Fave out, and add the Highest called number from the first block.</p>
]]></content:encoded>
			<wfw:commentRss>http://edwardawebb.com/tips/cell-phone-favorites-aka-free-calls/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Keep your inbox clean with email aliases</title>
		<link>http://edwardawebb.com/tips/inbox-clean-email-aliases</link>
		<comments>http://edwardawebb.com/tips/inbox-clean-email-aliases#comments</comments>
		<pubDate>Sun, 05 Jul 2009 15:28:28 +0000</pubDate>
		<dc:creator>Eddie</dc:creator>
				<category><![CDATA[MIsc.Tips]]></category>
		<category><![CDATA[alias]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[gmail]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[tip]]></category>

		<guid isPermaLink="false">http://edwardawebb.com/?p=488</guid>
		<description><![CDATA[More and more sites require you to verify an account by recieveing an email.. fair enough.  But then 2 months later you start getting the newsletters and updates that you no longer care about.

Enter Gmail !

To be honest, other mail servers may do the same, it may be standard, but I have not seen it used outside of gmail domains. Anyway, I digress.

The Alias ability in Gmail lets you create a unique address for a site(s) and then set filters on those addresses, my favorite being send to trash..
]]></description>
			<content:encoded><![CDATA[<p>More and more sites require you to verify an account by receiving an email.. fair enough.  But then 2 months later you start getting the newsletters and updates that you no longer care about.</p>
<p>Enter Gmail !</p>
<p>To be honest, other mail servers may do the same, it may be standard, but I have not seen it used outside of gmail domains. Anyway, I digress.</p>
<p>The Alias ability in Gmail lets you <strong>create a unique address for a site(s) and then set filters on those addresses</strong>, my favorite being send to trash..</p>
<p><span id="more-488"></span></p>
<h3>Email Aliases &#8211; Best Approach?</h3>
<p>Ok so the downside is you can&#8217;t turn off the aliases, and senders won&#8217;t get a non-recipient error when they send the email. Most intelligent mass mailing systems will remove addresses that get this error on several attempts. So your not doing your part to cut down useless internet traffic.</p>
<p>BUT! you will never see the email and cringe with anger because you still have not bothered to login to the site, close the account and unsubscribe.</p>
<h3>The Gmail Way</h3>
<p>When you are signing up to a site with obligatory email, give them your email as follows;</p>
<p><a href="mailto:my.name+uniquetag@gmail.com" rel="nofollow" >my.name+uniquetag@gmail.com</a></p>
<p>You&#8217;ll get the one time &#8220;please click here&#8221; activation email just as if you provided your normal address.</p>
<p>Then, once you decide you no longer need to read their messages you can set the filter.  Just enter a plus sign and a unique tage ( &#8217;+uniquetag&#8217;) as the to: criteria. I get a ludicrous amount of emails from this Eddie fellow about cats, so its time I made a filter..</p>
<div id="attachment_489" class="wp-caption aligncenter" style="width: 310px"><a href="http://edwardawebb.com/wp-content/uploads/2009/07/gmail_alias.jpg"><img class="size-medium wp-image-489" title="gmail_alias" src="http://edwardawebb.com/wp-content/uploads/2009/07/gmail_alias-300x89.jpg" alt="gmail alias 300x89 Keep your inbox clean with email aliases" width="300" height="89" /></a><p class="wp-caption-text">Building a Filter from Gmail Alias</p></div>
<h3>Other Ideas</h3>
<p>So there are lots of reasons to use this aside from email address discretions.</p>
<ul>
<li>Labeling your email forwarded from other accounts, just change the FWD address in the other account</li>
<li>Sorting comments from a website contact form (+feedback, +sales, etc)</li>
<li>Telling people your email address has a plus sign, beat that!</li>
<li>Auto-Archive daily Cron messages</li>
</ul>
<p>I would love to hear about some more handy Gmail tricks.</p>
]]></content:encoded>
			<wfw:commentRss>http://edwardawebb.com/tips/inbox-clean-email-aliases/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

