<?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>A Little Off &#187; Computers</title>
	<atom:link href="http://www.bemasher.net/archives/category/technology/computers/feed" rel="self" type="application/rss+xml" />
	<link>http://www.bemasher.net</link>
	<description>Code, Computers, Photography and Guns</description>
	<lastBuildDate>Mon, 21 Nov 2011 06:38:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Newegg&#8217;s JSON API</title>
		<link>http://www.bemasher.net/archives/1002?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=neweggs-json-quasi-api</link>
		<comments>http://www.bemasher.net/archives/1002#comments</comments>
		<pubDate>Thu, 17 Mar 2011 05:11:22 +0000</pubDate>
		<dc:creator>bemasher</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[CherryPy]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[lxml]]></category>
		<category><![CDATA[Newegg]]></category>
		<category><![CDATA[Product List]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Script]]></category>

		<guid isPermaLink="false">http://www.bemasher.net/?p=1002</guid>
		<description><![CDATA[For the longest time I've wanted access to Newegg's product list. For me they've been one of the better and more structured websites for buying computer hardware. So naturally they're usually my first choice when it comes to finding a good deal on a particular piece of hardware. They're also rather useful for seeing what's [...]]]></description>
			<content:encoded><![CDATA[<p>For the longest time I've wanted access to Newegg's product list. For me they've been one of the better and more structured websites for buying computer hardware. So naturally they're usually my first choice when it comes to finding a good deal on a particular piece of hardware. They're also rather useful for seeing what's out there since their product catalog is fairly complete.</p>
<p>A while back I had started wanting to sort through items to heuristically pick the best deal based on a number of features Newegg generally provides for each item. This method works pretty well on SSD's and system memory. But until a recent discovery I was limited to scraping Newegg's website in order to get any kind of information from them. If you've ever tried this sort of thing you know that it is messy and generally a bad idea because every single time Newegg changes the structure of their website or any minute detail this will almost always break your scraping script.</p>
<p>The discovery came in the form of a mobile application for Android<sup>[<a href="http://www.bemasher.net/archives/1002#footnote_0_1002" id="identifier_0_1002" class="footnote-link footnote-identifier-link" title="And iOS devices I assume as well.">1</a>]</sup>. The mobile app lets you browse their website in a clean and fast manner. But what got me thinking is that unlike some other mobile applications out there that are just application wrappers for the mobile version of their websites this one operates directly through the native GUI. Now this is where it got interesting. I knew that if Newegg had written the app to use the native GUI then they had to be providing the data to it somehow and I knew it had to be more structured than HTML scraping like what I've been doing<sup>[<a href="http://www.bemasher.net/archives/1002#footnote_1_1002" id="identifier_1_1002" class="footnote-link footnote-identifier-link" title="Because lets face it, that would be stupid.">2</a>]</sup>. You have no idea how happy I was to discover that I was right.</p>
<p>First thing I did was connect my Droid 2 Global to my home network via WiFi in order to sniff some of the traffic going to and from the mobile app. This was accomplished by mounting a CIFS drive from my Windows 7 desktop to my router running Tomato based firmware. The share had a binary for TCPDump which I then used to sniff for traffic originating or going to my phone's IP address. After setting this up and performing all of the basic operations I would need in order to "reverse engineer" the data source I got to work on filtering the important bits.</p>
<p>In WireShark I immediately discovered that they had a sub-domain they were using for these operations. All of the web requests that weren't images or for customer metrics and tracking went to this host:</p>
<p><a href="http://www.ows.newegg.com/">http://www.ows.newegg.com/</a></p>
<p>Because this API is structured more or less the same as navigating their site and the identifiers are different I decided to start with writing a query builder. Basically the purpose was to allow me to browse to the particular category I was interested in analyzing and filter it down to just a few simple requirements to simplify the analysis.</p>
<p>The first major entry point in the process of browsing to what you're interested in pulling is:</p>
<p><a href="http://www.ows.newegg.com/Stores.egg/Menus">http://www.ows.newegg.com/Stores.egg/Menus</a></p>
<p>This takes no parameters and provides the main menu:</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&#91;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;StoreDepa&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;ComputerHardware&quot;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;StoreID&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;ShowSeeAllDeals&quot;</span><span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Title&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Computer Hardware&quot;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;StoreDepa&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;PCNotebook&quot;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;StoreID&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">3</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;ShowSeeAllDeals&quot;</span><span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Title&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;PCs &amp;amp; Laptops&quot;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;StoreDepa&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Electronics&quot;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;StoreID&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">10</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;ShowSeeAllDeals&quot;</span><span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Title&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Electronics&quot;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; ...</div></td></tr></tbody></table></div>
<p>Once you've selected a store to browse the next uri is:</p>
<p><a href="http://www.ows.newegg.com/Stores.egg/Categories/{StoreID}">http://www.ows.newegg.com/Stores.egg/Categories/{StoreID}</a></p>
<p>The only parameter it takes is StoreID which you'll find in the first query. This will return all of the categories within a store. I haven't really explored this very much as I'm only really interested in browsing system memory and SSD's. Using the Computer Hardware store the output is as follows:</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&#91;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Description&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Backup Devices &amp;amp; Media&quot;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;StoreID&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;NodeId&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">6642</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;ShowSeeAllDeals&quot;</span><span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;CategoryType&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;CategoryID&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">2</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Description&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Barebone / Mini Computers&quot;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;StoreID&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;NodeId&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">6668</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;ShowSeeAllDeals&quot;</span><span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;CategoryType&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;CategoryID&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">3</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Description&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;CD / DVD Burners &amp;amp; Media&quot;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;StoreID&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;NodeId&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">6646</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;ShowSeeAllDeals&quot;</span><span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;CategoryType&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;CategoryID&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">10</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; ...</div></td></tr></tbody></table></div>
<p>StoreID is included from the parameters of the request. I'm not exactly sure how to describe the purpose of NodeID but it appears to be a distinguishing feature of a category or subcategory. CategoryID is used for filtering results down to a specific category and can be either a root category or a subcategory. CategoryType determines whether CategoryID is a root category or if it contains subcategories. A value of 1 for CategoryType indicates that it is the root category.</p>
<p>Now depending on CategoryType you either move straight to the search query or onto a navigation query. The navigation query is used if there are subcategories:</p>
<p><a href="http://www.ows.newegg.com/Stores.egg/Navigation/{StoreID}/{CategoryID}/{NodeID}">http://www.ows.newegg.com/Stores.egg/Navigation/{StoreID}/{CategoryID}/{NodeID}</a></p>
<p>This query takes StoreID, CategoryID and NodeID, which you can get from the category listing of a particular store. It will return a subcategory list. Below is the subcategory listing for the memory category.</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&#91;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Description&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Desktop Memory&quot;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;StoreID&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;NodeId&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">7611</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;ShowSeeAllDeals&quot;</span><span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;CategoryType&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;CategoryID&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">147</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Description&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Flash Memory&quot;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;StoreID&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;NodeId&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">8038</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;ShowSeeAllDeals&quot;</span><span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;CategoryType&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;CategoryID&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">68</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Description&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Laptop Memory&quot;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;StoreID&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;NodeId&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">7609</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;ShowSeeAllDeals&quot;</span><span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;CategoryType&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;CategoryID&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">381</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; ...</div></td></tr></tbody></table></div>
<p>From here you will go to the search query<sup>[<a href="http://www.bemasher.net/archives/1002#footnote_2_1002" id="identifier_2_1002" class="footnote-link footnote-identifier-link" title="... or get to the search query from selecting a root category in the main category listing for a store">3</a>]</sup>. At this point it does get a little tricky as the parameters for the query are no longer sent via GET they are instead sent using POST<sup>[<a href="http://www.bemasher.net/archives/1002#footnote_3_1002" id="identifier_3_1002" class="footnote-link footnote-identifier-link" title="At least this is the method used by the mobile app.">4</a>]</sup> which basically will require a programmatic method for making a search query. The search query given a category, store and node will list quite a lot of things. The first thing in the list is search filtering parameters, these will allow you to limit the products shown in the listing.</p>
<p>Data being posted is necessary to receive a non-404 response from the server, if you really wanted to you could just send an empty dictionary as this would just query newegg's entire product list. Any of the query options can be omitted, integer values may be omitted by substituting their value with -1.</p>
<p>The parameters you should concern yourself with are as follows along with the URL the data should be posted in JSON format to:</p>
<p><a href="http://www.ows.newegg.com/Search.egg/Advanced">http://www.ows.newegg.com/Search.egg/Advanced</a></p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">data <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #3366CC;">&quot;SubCategoryId&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">147</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; <span style="color: #3366CC;">&quot;NValue&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; <span style="color: #3366CC;">&quot;StoreDepaId&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; <span style="color: #3366CC;">&quot;NodeId&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">7611</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; <span style="color: #3366CC;">&quot;BrandId&quot;</span><span style="color: #339933;">:</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; <span style="color: #3366CC;">&quot;PageNumber&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; <span style="color: #3366CC;">&quot;CategoryId&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">17</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>NValue is a space separated list of NValues from the search parameters. Mind you, you cannot filter against more than one item in any category of search filters. For example in system memory you can't select <strong>DDR3 1333 (PC3 10600)</strong>, <strong>DDR3 1333 (PC3 10660)</strong> and <strong>DDR3 1333 (PC3 10666)</strong>. The query will return an unsucessful search result. The rest of the parameters are fairly self-explanatory.</p>
<p>The result returned will contain the following elements: RelatedLinkList, CoremetricsInfo, NavigationContentList, PaginationInfo, ProductListItems. CoremetricsInfo and RelatedLinkList can usually be ignored, the elements we're interested in are the NavigationContentList which is a list of search parameters//filters you can apply to the search. PaginationInfo describes how many elements were returned, what page we're on and how many elements there are per page. Last but not least the ProductListItems which provides a list of the products returned by the query along with some basic listing info for each one.</p>
<p>Below is a portion of the NavigationContentList:</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #3366CC;">&quot;NavigationContentList&quot;</span><span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;NavigationItemList&quot;</span><span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;SubCategoryId&quot;</span><span style="color: #339933;">:</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Description&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Free Shipping&quot;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;StoreDepaId&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">94</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;NValue&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;100007611 600006050 600052012 4808&quot;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;BrandId&quot;</span><span style="color: #339933;">:</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;StoreType&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">4</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;ItemCount&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">194</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;CategoryId&quot;</span><span style="color: #339933;">:</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;ElementValue&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;4808&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;SubCategoryId&quot;</span><span style="color: #339933;">:</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Description&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Top Sellers&quot;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;StoreDepaId&quot;</span><span style="color: #339933;">:</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;NValue&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;100007611 600006050 600052012 4802&quot;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;BrandId&quot;</span><span style="color: #339933;">:</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;StoreType&quot;</span><span style="color: #339933;">:</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;ItemCount&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">39</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;CategoryId&quot;</span><span style="color: #339933;">:</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;ElementValue&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;4802&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ...</div></td></tr></tbody></table></div>
<p>This section will also contain a group name:</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ...<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;TitleItem&quot;</span><span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;SubCategoryId&quot;</span><span style="color: #339933;">:</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Description&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Useful Links&quot;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;StoreDepaId&quot;</span><span style="color: #339933;">:</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;NValue&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;4800&quot;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;BrandId&quot;</span><span style="color: #339933;">:</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;StoreType&quot;</span><span style="color: #339933;">:</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">2</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;ItemCount&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;CategoryId&quot;</span><span style="color: #339933;">:</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;ElementValue&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;4800&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ...</div></td></tr></tbody></table></div>
<p>The PaginationInfo and ProductListItem elements will look like the following:</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; ...<br />
&nbsp; &nbsp; <span style="color: #3366CC;">&quot;PaginationInfo&quot;</span><span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;TotalCount&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">233</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;PageNumber&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;PageSize&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">20</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; <span style="color: #3366CC;">&quot;ProductListItems&quot;</span><span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;SellerId&quot;</span><span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;ItemOwnerType&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Title&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Crucial Ballistix 4GB (2 x 2GB) 240-Pin DDR3 SDRAM DDR3 2133 (PC3 17000) Desktop Memory with Thermal Sensor Model BL2KIT25664FN2139&quot;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;ItemGroupID&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;ReviewSummary&quot;</span><span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Rating&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">5</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;TotalReviews&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;[1]&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;IsCellPhoneItem&quot;</span><span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Discount&quot;</span><span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;FinalPrice&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;$104.99&quot;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;ItemNumber&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;20-148-372&quot;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;MappingFinalPrice&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;$104.99&quot;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;FreeShippingFlag&quot;</span><span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;OriginalPrice&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;$104.99&quot;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;IsComboBundle&quot;</span><span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;MailInRebateText&quot;</span><span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;ProductStockType&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Model&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;BL2KIT25664FN2139&quot;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;ShowOriginalPrice&quot;</span><span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Image&quot;</span><span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;FullPath&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;http://images17.newegg.com/is/image/newegg/20-148-372-TS?$S125W$&quot;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;SmallImagePath&quot;</span><span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;ThumbnailImagePath&quot;</span><span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Title&quot;</span><span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">null</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;SellerName&quot;</span><span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;ParentItem&quot;</span><span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">null</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; ...</div></td></tr></tbody></table></div>
<p>At this point you might be wondering what good will all this do me if I can't get specifications on an item? Well, you can and here's how: In each ProductListItems element you'll find an ItemNumber, this is essentially the primary key that each product is related to within this interface to newegg's product list. Using the following url you can obtain the full details page on any given item using it's ItemNumber:</p>
<p><a href="http://www.ows.newegg.com/Products.egg/{ItemNumber}/Specification">http://www.ows.newegg.com/Products.egg/{ItemNumber}/Specification</a></p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br />61<br />62<br />63<br />64<br />65<br />66<br />67<br />68<br />69<br />70<br />71<br />72<br />73<br />74<br />75<br />76<br />77<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #3366CC;">&quot;SpecificationGroupList&quot;</span><span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;GroupName&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Model&quot;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;SpecificationPairList&quot;</span><span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Value&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Crucial&quot;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Key&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Brand&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Value&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Ballistix&quot;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Key&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Series&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Value&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;BL2KIT25664FN2139&quot;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Key&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Model&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Value&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;240-Pin DDR3 SDRAM&quot;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Key&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Type&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;GroupName&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Tech Spec&quot;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;SpecificationPairList&quot;</span><span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Value&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;4GB (2 x 2GB)&quot;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Key&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Capacity&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Value&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;DDR3 2133 (PC3 17000)&quot;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Key&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Speed&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Value&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;9&quot;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Key&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Cas Latency&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Value&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;9-10-9-24&quot;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Key&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Timing&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Value&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;1.65V&quot;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Key&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Voltage&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Value&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;No&quot;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Key&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;ECC&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Value&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Unbuffered&quot;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Key&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Buffered/Registered&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Value&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Dual Channel Kit&quot;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Key&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Multi-channel Kit&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;GroupName&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Manufacturer Warranty&quot;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;SpecificationPairList&quot;</span><span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Value&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Lifetime limited&quot;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Key&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Parts&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Value&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Lifetime limited&quot;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">&quot;Key&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Labor&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; <span style="color: #3366CC;">&quot;NeweggItemNumber&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;N82E16820148372&quot;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; <span style="color: #3366CC;">&quot;Title&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Crucial Ballistix 4GB (2 x 2GB) 240-Pin DDR3 SDRAM DDR3 2133 (PC3 17000) Desktop Memory with Thermal Sensor Model BL2KIT25664FN2139&quot;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>From this point on you can grab all of the features and specifications of any particular item you're interested in. In the near future I'll be writing a new post for both my memory and SSD analysis scripts using this interface.</p>
<p>The full code for my query builder is as follows, though you should note this was a quick script and is in no way complete or fully functional. As soon as it was to a useable point I moved onto the main point of this whole ordeal. You should also note that this requires CherryPy<sup>[<a href="http://www.bemasher.net/archives/1002#footnote_4_1002" id="identifier_4_1002" class="footnote-link footnote-identifier-link" title="CherryPy: CherryPy is a pythonic, object-oriented HTTP framework.">5</a>]</sup> and lxml<sup>[<a href="http://www.bemasher.net/archives/1002#footnote_5_1002" id="identifier_5_1002" class="footnote-link footnote-identifier-link" title="lxml: A Pythonic binding for the C libraries libxml2 and libxslt.">6</a>]</sup>. The end result of this program is a query which you can use to retrieve a list of products matching the options you've selected. This is mainly to simplify product list selection and to minimalize the need to hardcode in certain values as newegg as a tendency to change things around on a regular basis.</p>
<div class="codecolorer-container python default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br />61<br />62<br />63<br />64<br />65<br />66<br />67<br />68<br />69<br />70<br />71<br />72<br />73<br />74<br />75<br />76<br />77<br />78<br />79<br />80<br />81<br />82<br />83<br />84<br />85<br />86<br />87<br />88<br />89<br />90<br />91<br />92<br />93<br />94<br />95<br />96<br />97<br />98<br />99<br />100<br />101<br />102<br />103<br />104<br />105<br />106<br />107<br />108<br />109<br />110<br />111<br />112<br />113<br />114<br />115<br />116<br />117<br />118<br />119<br />120<br />121<br />122<br />123<br />124<br />125<br />126<br />127<br />128<br />129<br />130<br />131<br />132<br />133<br />134<br />135<br />136<br />137<br />138<br />139<br />140<br />141<br />142<br />143<br />144<br />145<br />146<br />147<br />148<br />149<br />150<br />151<br />152<br />153<br />154<br />155<br />156<br />157<br />158<br />159<br />160<br /></div></td><td><div class="python codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #ff7700;font-weight:bold;">import</span> cherrypy<span style="color: #66cc66;">,</span> json<span style="color: #66cc66;">,</span> <span style="color: #dc143c;">urllib</span><span style="color: #66cc66;">,</span> <span style="color: #dc143c;">urllib2</span><br />
<span style="color: #ff7700;font-weight:bold;">from</span> lxml <span style="color: #ff7700;font-weight:bold;">import</span> etree<br />
<span style="color: #ff7700;font-weight:bold;">from</span> lxml.<span style="color: black;">builder</span> <span style="color: #ff7700;font-weight:bold;">import</span> E<br />
<br />
<span style="color: #ff7700;font-weight:bold;">class</span> QueryBuilder<span style="color: black;">&#40;</span><span style="color: #008000;">object</span><span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">def</span> index<span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; request <span style="color: #66cc66;">=</span> <span style="color: #dc143c;">urllib2</span>.<span style="color: black;">urlopen</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;http://www.ows.newegg.com/Stores.egg/Menus&quot;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; response <span style="color: #66cc66;">=</span> request.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; data <span style="color: #66cc66;">=</span> json.<span style="color: black;">loads</span><span style="color: black;">&#40;</span>response<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; body <span style="color: #66cc66;">=</span> E.<span style="color: black;">body</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; ul <span style="color: #66cc66;">=</span> E.<span style="color: black;">ul</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">for</span> store <span style="color: #ff7700;font-weight:bold;">in</span> data:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ul.<span style="color: black;">append</span><span style="color: black;">&#40;</span>E.<span style="color: black;">li</span><span style="color: black;">&#40;</span>E.<span style="color: black;">a</span><span style="color: black;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; store<span style="color: black;">&#91;</span><span style="color: #483d8b;">'Title'</span><span style="color: black;">&#93;</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; href<span style="color: #66cc66;">=</span> <span style="color: #483d8b;">'/Store?StoreID={}'</span>.<span style="color: black;">format</span><span style="color: black;">&#40;</span>store<span style="color: black;">&#91;</span><span style="color: #483d8b;">'StoreID'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; page <span style="color: #66cc66;">=</span> E.<span style="color: black;">html</span><span style="color: black;">&#40;</span>E.<span style="color: black;">body</span><span style="color: black;">&#40;</span>ul<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">return</span> etree.<span style="color: black;">tostring</span><span style="color: black;">&#40;</span>page<span style="color: #66cc66;">,</span> pretty_print<span style="color: #66cc66;">=</span><span style="color: #008000;">True</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; index.<span style="color: black;">exposed</span> <span style="color: #66cc66;">=</span> <span style="color: #008000;">True</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">def</span> Store<span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: #66cc66;">,</span> StoreID<span style="color: #66cc66;">=</span><span style="color: #008000;">None</span><span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> StoreID <span style="color: #ff7700;font-weight:bold;">is</span> <span style="color: #ff7700;font-weight:bold;">not</span> <span style="color: #008000;">None</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; request <span style="color: #66cc66;">=</span> <span style="color: #dc143c;">urllib2</span>.<span style="color: black;">urlopen</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;http://www.ows.newegg.com/Stores.egg/Categories/{}&quot;</span>.<span style="color: black;">format</span><span style="color: black;">&#40;</span>StoreID<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; response <span style="color: #66cc66;">=</span> request.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; data <span style="color: #66cc66;">=</span> json.<span style="color: black;">loads</span><span style="color: black;">&#40;</span>response<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; body <span style="color: #66cc66;">=</span> E.<span style="color: black;">body</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ul <span style="color: #66cc66;">=</span> E.<span style="color: black;">ul</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">for</span> category <span style="color: #ff7700;font-weight:bold;">in</span> data:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> category<span style="color: black;">&#91;</span><span style="color: #483d8b;">'CategoryType'</span><span style="color: black;">&#93;</span> <span style="color: #66cc66;">==</span> <span style="color: #ff4500;">1</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ul.<span style="color: black;">append</span><span style="color: black;">&#40;</span>E.<span style="color: black;">li</span><span style="color: black;">&#40;</span>E.<span style="color: black;">a</span><span style="color: black;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; category<span style="color: black;">&#91;</span><span style="color: #483d8b;">'Description'</span><span style="color: black;">&#93;</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; href<span style="color: #66cc66;">=</span><span style="color: #483d8b;">'/Search?StoreID={}&amp;CategoryID={}&amp;NodeID={}'</span>.<span style="color: black;">format</span><span style="color: black;">&#40;</span>StoreID<span style="color: #66cc66;">,</span> category<span style="color: black;">&#91;</span><span style="color: #483d8b;">'CategoryID'</span><span style="color: black;">&#93;</span><span style="color: #66cc66;">,</span> category<span style="color: black;">&#91;</span><span style="color: #483d8b;">'NodeId'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">else</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ul.<span style="color: black;">append</span><span style="color: black;">&#40;</span>E.<span style="color: black;">li</span><span style="color: black;">&#40;</span>E.<span style="color: black;">a</span><span style="color: black;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; category<span style="color: black;">&#91;</span><span style="color: #483d8b;">'Description'</span><span style="color: black;">&#93;</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; href<span style="color: #66cc66;">=</span><span style="color: #483d8b;">'/Category?StoreID={}&amp;CategoryID={}&amp;NodeID={}'</span>.<span style="color: black;">format</span><span style="color: black;">&#40;</span>StoreID<span style="color: #66cc66;">,</span> category<span style="color: black;">&#91;</span><span style="color: #483d8b;">'CategoryID'</span><span style="color: black;">&#93;</span><span style="color: #66cc66;">,</span> category<span style="color: black;">&#91;</span><span style="color: #483d8b;">'NodeId'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; page <span style="color: #66cc66;">=</span> E.<span style="color: black;">html</span><span style="color: black;">&#40;</span>E.<span style="color: black;">body</span><span style="color: black;">&#40;</span>ul<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">return</span> etree.<span style="color: black;">tostring</span><span style="color: black;">&#40;</span>page<span style="color: #66cc66;">,</span> pretty_print<span style="color: #66cc66;">=</span><span style="color: #008000;">True</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">else</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #483d8b;">&quot;Invalid parameters.&quot;</span><br />
&nbsp; &nbsp; Store.<span style="color: black;">exposed</span> <span style="color: #66cc66;">=</span> <span style="color: #008000;">True</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">def</span> Category<span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: #66cc66;">,</span> StoreID<span style="color: #66cc66;">,</span> CategoryID<span style="color: #66cc66;">,</span> NodeID<span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">None</span> <span style="color: #ff7700;font-weight:bold;">not</span> <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: black;">&#91;</span>StoreID<span style="color: #66cc66;">,</span> CategoryID<span style="color: #66cc66;">,</span> NodeID<span style="color: black;">&#93;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; request <span style="color: #66cc66;">=</span> <span style="color: #dc143c;">urllib2</span>.<span style="color: black;">urlopen</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;http://www.ows.newegg.com/Stores.egg/Navigation/{}/{}/{}&quot;</span>.<span style="color: black;">format</span><span style="color: black;">&#40;</span>StoreID<span style="color: #66cc66;">,</span> CategoryID<span style="color: #66cc66;">,</span> NodeID<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; response <span style="color: #66cc66;">=</span> request.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; data <span style="color: #66cc66;">=</span> json.<span style="color: black;">loads</span><span style="color: black;">&#40;</span>response<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; body <span style="color: #66cc66;">=</span> E.<span style="color: black;">body</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ul <span style="color: #66cc66;">=</span> E.<span style="color: black;">ul</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">for</span> subcategory <span style="color: #ff7700;font-weight:bold;">in</span> data:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ul.<span style="color: black;">append</span><span style="color: black;">&#40;</span>E.<span style="color: black;">li</span><span style="color: black;">&#40;</span>E.<span style="color: black;">a</span><span style="color: black;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; subcategory<span style="color: black;">&#91;</span><span style="color: #483d8b;">'Description'</span><span style="color: black;">&#93;</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; href<span style="color: #66cc66;">=</span> <span style="color: #483d8b;">'/Search?StoreID={}&amp;CategoryID={}&amp;SubCategoryID={}&amp;NodeID={}'</span>.<span style="color: black;">format</span><span style="color: black;">&#40;</span>StoreID<span style="color: #66cc66;">,</span> CategoryID<span style="color: #66cc66;">,</span> subcategory<span style="color: black;">&#91;</span><span style="color: #483d8b;">'CategoryID'</span><span style="color: black;">&#93;</span><span style="color: #66cc66;">,</span> subcategory<span style="color: black;">&#91;</span><span style="color: #483d8b;">'NodeId'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; page <span style="color: #66cc66;">=</span> E.<span style="color: black;">html</span><span style="color: black;">&#40;</span>E.<span style="color: black;">body</span><span style="color: black;">&#40;</span>ul<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">return</span> etree.<span style="color: black;">tostring</span><span style="color: black;">&#40;</span>page<span style="color: #66cc66;">,</span> pretty_print<span style="color: #66cc66;">=</span><span style="color: #008000;">True</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">else</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #483d8b;">&quot;Invalid parameters.&quot;</span><br />
&nbsp; &nbsp; Category.<span style="color: black;">exposed</span> <span style="color: #66cc66;">=</span> <span style="color: #008000;">True</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">def</span> Search<span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: #66cc66;">,</span> StoreID<span style="color: #66cc66;">=</span><span style="color: #008000;">None</span><span style="color: #66cc66;">,</span> CategoryID<span style="color: #66cc66;">=</span><span style="color: #008000;">None</span><span style="color: #66cc66;">,</span> SubCategoryID<span style="color: #66cc66;">=</span><span style="color: #008000;">None</span><span style="color: #66cc66;">,</span> NodeID<span style="color: #66cc66;">=</span><span style="color: #008000;">None</span><span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; url <span style="color: #66cc66;">=</span> <span style="color: #483d8b;">&quot;http://www.ows.newegg.com/Search.egg/Advanced&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; data <span style="color: #66cc66;">=</span> <span style="color: black;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">&quot;IsUPCCodeSearch&quot;</span>:&nbsp; &nbsp; &nbsp; <span style="color: #008000;">False</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">&quot;IsSubCategorySearch&quot;</span>:&nbsp; <span style="color: #008000;">True</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">&quot;isGuideAdvanceSearch&quot;</span>: <span style="color: #008000;">False</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">&quot;StoreDepaId&quot;</span>:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; StoreID<span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">&quot;CategoryId&quot;</span>: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CategoryID<span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">&quot;SubCategoryId&quot;</span>:&nbsp; &nbsp; &nbsp; &nbsp; SubCategoryID<span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">&quot;NodeId&quot;</span>: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NodeID<span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">&quot;BrandId&quot;</span>:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -<span style="color: #ff4500;">1</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">&quot;NValue&quot;</span>: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">&quot;&quot;</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">&quot;Keyword&quot;</span>:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">&quot;&quot;</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">&quot;Sort&quot;</span>: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">&quot;FEATURED&quot;</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">&quot;PageNumber&quot;</span>: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff4500;">1</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: black;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; params <span style="color: #66cc66;">=</span> json.<span style="color: black;">dumps</span><span style="color: black;">&#40;</span>data<span style="color: black;">&#41;</span>.<span style="color: black;">replace</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;null&quot;</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">&quot;-1&quot;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; request <span style="color: #66cc66;">=</span> <span style="color: #dc143c;">urllib2</span>.<span style="color: black;">Request</span><span style="color: black;">&#40;</span>url<span style="color: #66cc66;">,</span> params<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; response <span style="color: #66cc66;">=</span> <span style="color: #dc143c;">urllib2</span>.<span style="color: black;">urlopen</span><span style="color: black;">&#40;</span>request<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; data <span style="color: #66cc66;">=</span> json.<span style="color: black;">loads</span><span style="color: black;">&#40;</span>response.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> data<span style="color: black;">&#91;</span><span style="color: #483d8b;">'NavigationContentList'</span><span style="color: black;">&#93;</span> <span style="color: #ff7700;font-weight:bold;">is</span> <span style="color: #008000;">None</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">return</span> etree.<span style="color: black;">tostring</span><span style="color: black;">&#40;</span>E.<span style="color: black;">pre</span><span style="color: black;">&#40;</span>json.<span style="color: black;">dumps</span><span style="color: black;">&#40;</span>data<span style="color: #66cc66;">,</span> indent<span style="color: #66cc66;">=</span><span style="color: #ff4500;">4</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">,</span> pretty_print<span style="color: #66cc66;">=</span><span style="color: #008000;">True</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; body <span style="color: #66cc66;">=</span> E.<span style="color: black;">body</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; form <span style="color: #66cc66;">=</span> E.<span style="color: black;">form</span><span style="color: black;">&#40;</span>name<span style="color: #66cc66;">=</span><span style="color: #483d8b;">'PowerSearch'</span><span style="color: #66cc66;">,</span> action<span style="color: #66cc66;">=</span><span style="color: #483d8b;">'GenerateURL'</span><span style="color: #66cc66;">,</span> method<span style="color: #66cc66;">=</span><span style="color: #483d8b;">'GET'</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; table <span style="color: #66cc66;">=</span> E.<span style="color: black;">table</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; form.<span style="color: black;">append</span><span style="color: black;">&#40;</span>table<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">for</span> section <span style="color: #ff7700;font-weight:bold;">in</span> data<span style="color: black;">&#91;</span><span style="color: #483d8b;">'NavigationContentList'</span><span style="color: black;">&#93;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; index <span style="color: #66cc66;">=</span> <span style="color: #ff4500;">0</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tr <span style="color: #66cc66;">=</span> E.<span style="color: black;">tr</span><span style="color: black;">&#40;</span>E.<span style="color: black;">td</span><span style="color: black;">&#40;</span>section<span style="color: black;">&#91;</span><span style="color: #483d8b;">'TitleItem'</span><span style="color: black;">&#93;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'Description'</span><span style="color: black;">&#93;</span><span style="color: #66cc66;">,</span> colspan<span style="color: #66cc66;">=</span><span style="color: #483d8b;">'3'</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; table.<span style="color: black;">append</span><span style="color: black;">&#40;</span>tr<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">for</span> option <span style="color: #ff7700;font-weight:bold;">in</span> section<span style="color: black;">&#91;</span><span style="color: #483d8b;">'NavigationItemList'</span><span style="color: black;">&#93;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> index % <span style="color: #ff4500;">3</span> <span style="color: #66cc66;">==</span> <span style="color: #ff4500;">0</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tr <span style="color: #66cc66;">=</span> E.<span style="color: black;">tr</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; table.<span style="color: black;">append</span><span style="color: black;">&#40;</span>tr<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; index +<span style="color: #66cc66;">=</span> <span style="color: #ff4500;">1</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; checkbox <span style="color: #66cc66;">=</span> E.<span style="color: black;">td</span><span style="color: black;">&#40;</span>E.<span style="color: #008000;">input</span><span style="color: black;">&#40;</span>option<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;Description&quot;</span><span style="color: black;">&#93;</span><span style="color: #66cc66;">,</span> <span style="color: #008000;">type</span><span style="color: #66cc66;">=</span><span style="color: #483d8b;">&quot;checkbox&quot;</span><span style="color: #66cc66;">,</span> name<span style="color: #66cc66;">=</span>section<span style="color: black;">&#91;</span><span style="color: #483d8b;">'TitleItem'</span><span style="color: black;">&#93;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'Description'</span><span style="color: black;">&#93;</span>.<span style="color: black;">replace</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot; &quot;</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">&quot;&quot;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">,</span> value<span style="color: #66cc66;">=</span>option<span style="color: black;">&#91;</span><span style="color: #483d8b;">'NValue'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tr.<span style="color: black;">append</span><span style="color: black;">&#40;</span>checkbox<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">for</span> param<span style="color: #66cc66;">,</span> value <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: black;">&#91;</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'StoreID'</span><span style="color: #66cc66;">,</span> StoreID<span style="color: black;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: black;">&#40;</span><span style="color: #483d8b;">'CategoryID'</span><span style="color: #66cc66;">,</span> CategoryID<span style="color: black;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: black;">&#40;</span><span style="color: #483d8b;">'SubCategoryID'</span><span style="color: #66cc66;">,</span> SubCategoryID<span style="color: black;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: black;">&#40;</span><span style="color: #483d8b;">'NodeID'</span><span style="color: #66cc66;">,</span>NodeID<span style="color: black;">&#41;</span><span style="color: black;">&#93;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">try</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; form.<span style="color: black;">append</span><span style="color: black;">&#40;</span>E.<span style="color: #008000;">input</span><span style="color: black;">&#40;</span><span style="color: #008000;">type</span><span style="color: #66cc66;">=</span><span style="color: #483d8b;">'hidden'</span><span style="color: #66cc66;">,</span> name<span style="color: #66cc66;">=</span>param<span style="color: #66cc66;">,</span> value<span style="color: #66cc66;">=</span>value<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">except</span> <span style="color: #008000;">KeyError</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">pass</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; form.<span style="color: black;">append</span><span style="color: black;">&#40;</span>E.<span style="color: #008000;">input</span><span style="color: black;">&#40;</span><span style="color: #008000;">type</span><span style="color: #66cc66;">=</span><span style="color: #483d8b;">'submit'</span><span style="color: #66cc66;">,</span> value<span style="color: #66cc66;">=</span><span style="color: #483d8b;">'Submit'</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; page <span style="color: #66cc66;">=</span> E.<span style="color: black;">html</span><span style="color: black;">&#40;</span>E.<span style="color: black;">body</span><span style="color: black;">&#40;</span>form<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">return</span> etree.<span style="color: black;">tostring</span><span style="color: black;">&#40;</span>page<span style="color: #66cc66;">,</span> pretty_print<span style="color: #66cc66;">=</span><span style="color: #008000;">True</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; Search.<span style="color: black;">exposed</span> <span style="color: #66cc66;">=</span> <span style="color: #008000;">True</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">def</span> GenerateURL<span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: #66cc66;">,</span> StoreID<span style="color: #66cc66;">=</span><span style="color: #008000;">None</span><span style="color: #66cc66;">,</span> CategoryID<span style="color: #66cc66;">=</span><span style="color: #008000;">None</span><span style="color: #66cc66;">,</span> SubCategoryID<span style="color: #66cc66;">=</span><span style="color: #008000;">None</span><span style="color: #66cc66;">,</span> NodeID<span style="color: #66cc66;">=</span><span style="color: #008000;">None</span><span style="color: #66cc66;">,</span> **kwargs<span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; NValue <span style="color: #66cc66;">=</span> <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">for</span> arg <span style="color: #ff7700;font-weight:bold;">in</span> kwargs:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">type</span><span style="color: black;">&#40;</span>kwargs<span style="color: black;">&#91;</span>arg<span style="color: black;">&#93;</span><span style="color: black;">&#41;</span> <span style="color: #66cc66;">==</span> <span style="color: #008000;">list</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">for</span> value <span style="color: #ff7700;font-weight:bold;">in</span> kwargs<span style="color: black;">&#91;</span>arg<span style="color: black;">&#93;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NValue.<span style="color: black;">add</span><span style="color: black;">&#40;</span>value<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">else</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NValue.<span style="color: black;">add</span><span style="color: black;">&#40;</span>kwargs<span style="color: black;">&#91;</span>arg<span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; NValue <span style="color: #66cc66;">=</span> <span style="color: #008000;">list</span><span style="color: black;">&#40;</span>NValue<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; NValue.<span style="color: black;">sort</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> StoreID <span style="color: #ff7700;font-weight:bold;">is</span> <span style="color: #008000;">None</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; StoreID <span style="color: #66cc66;">=</span> -<span style="color: #ff4500;">1</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> CategoryID <span style="color: #ff7700;font-weight:bold;">is</span> <span style="color: #008000;">None</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CategoryID <span style="color: #66cc66;">=</span> -<span style="color: #ff4500;">1</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> SubCategoryID <span style="color: #ff7700;font-weight:bold;">is</span> <span style="color: #008000;">None</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SubCategoryID <span style="color: #66cc66;">=</span> -<span style="color: #ff4500;">1</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> NodeID <span style="color: #ff7700;font-weight:bold;">is</span> <span style="color: #008000;">None</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NodeID <span style="color: #66cc66;">=</span> -<span style="color: #ff4500;">1</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; data <span style="color: #66cc66;">=</span> <span style="color: black;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">&quot;StoreDepaId&quot;</span>:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">int</span><span style="color: black;">&#40;</span>StoreID<span style="color: black;">&#41;</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">&quot;CategoryId&quot;</span>: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">int</span><span style="color: black;">&#40;</span>CategoryID<span style="color: black;">&#41;</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">&quot;SubCategoryId&quot;</span>:&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">int</span><span style="color: black;">&#40;</span>SubCategoryID<span style="color: black;">&#41;</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">&quot;NodeId&quot;</span>: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">int</span><span style="color: black;">&#40;</span>NodeID<span style="color: black;">&#41;</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">&quot;BrandId&quot;</span>:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -<span style="color: #ff4500;">1</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">&quot;NValue&quot;</span>: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">' '</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>NValue<span style="color: black;">&#41;</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">&quot;PageNumber&quot;</span>: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff4500;">1</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: black;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">return</span> etree.<span style="color: black;">tostring</span><span style="color: black;">&#40;</span>E.<span style="color: black;">pre</span><span style="color: black;">&#40;</span>json.<span style="color: black;">dumps</span><span style="color: black;">&#40;</span>data<span style="color: #66cc66;">,</span> indent<span style="color: #66cc66;">=</span><span style="color: #ff4500;">4</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">,</span> pretty_print<span style="color: #66cc66;">=</span><span style="color: #008000;">True</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; GenerateURL.<span style="color: black;">exposed</span> <span style="color: #66cc66;">=</span> <span style="color: #008000;">True</span><br />
&nbsp; &nbsp; <br />
cherrypy.<span style="color: black;">quickstart</span><span style="color: black;">&#40;</span>QueryBuilder<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></div></td></tr></tbody></table></div>
<ol class="footnotes"><li id="footnote_0_1002" class="footnote">And iOS devices I assume as well.</li><li id="footnote_1_1002" class="footnote">Because lets face it, that would be stupid.</li><li id="footnote_2_1002" class="footnote">... or get to the search query from selecting a root category in the main category listing for a store</li><li id="footnote_3_1002" class="footnote">At least this is the method used by the mobile app.</li><li id="footnote_4_1002" class="footnote"><a href="http://www.cherrypy.org/">CherryPy</a>: CherryPy is a pythonic, object-oriented HTTP framework.</li><li id="footnote_5_1002" class="footnote"><a href="http://lxml.de/">lxml</a>: A Pythonic binding for the C libraries libxml2 and libxslt.</li></ol>]]></content:encoded>
			<wfw:commentRss>http://www.bemasher.net/archives/1002/feed</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Installing Ubuntu via Network</title>
		<link>http://www.bemasher.net/archives/967?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=installing-ubuntu-via-network</link>
		<comments>http://www.bemasher.net/archives/967#comments</comments>
		<pubDate>Thu, 24 Feb 2011 05:02:36 +0000</pubDate>
		<dc:creator>bemasher</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Boot]]></category>
		<category><![CDATA[DHCP]]></category>
		<category><![CDATA[dhcp-boot]]></category>
		<category><![CDATA[DNSMasq]]></category>
		<category><![CDATA[HFS]]></category>
		<category><![CDATA[Netboot]]></category>
		<category><![CDATA[Network boot]]></category>
		<category><![CDATA[Network install]]></category>
		<category><![CDATA[PXE]]></category>
		<category><![CDATA[tftpd32]]></category>
		<category><![CDATA[tomato]]></category>
		<category><![CDATA[TomatoUSB]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.bemasher.net/?p=967</guid>
		<description><![CDATA[At some point in the last 6 months or so I may or may not have accidentally left my 1GB Sandisk Cruzer in a pair of jeans when they went through the washer AND the dryer. As such it's not exactly in peak physical condition[1] and for whatever reason I've had issues with using it [...]]]></description>
			<content:encoded><![CDATA[<p>At some point in the last 6 months or so I may or may not have accidentally left my 1GB Sandisk Cruzer in a pair of jeans when they went through the washer AND the dryer. As such it's not exactly in peak physical condition<sup>[<a href="http://www.bemasher.net/archives/967#footnote_0_967" id="identifier_0_967" class="footnote-link footnote-identifier-link" title="In fact it&#039;s pretty far from peak physical condition.">1</a>]</sup> and for whatever reason I've had issues with using it for installing certain things<sup>[<a href="http://www.bemasher.net/archives/967#footnote_1_967" id="identifier_1_967" class="footnote-link footnote-identifier-link" title="Like ubuntu for example.">2</a>]</sup> lately<sup>[<a href="http://www.bemasher.net/archives/967#footnote_2_967" id="identifier_2_967" class="footnote-link footnote-identifier-link" title="I&#039;m not entirely sure if this is due to washing it or just from it being nearly 5 years old.">3</a>]</sup>.</p>
<p>Anyway it has become time again to get my file server back up and running and I needed to reinstall Ubuntu on it. Given my extreme laziness when it comes to doing this sort of stuff I was in no mood to move everything to the top of my desktop<sup>[<a href="http://www.bemasher.net/archives/967#footnote_3_967" id="identifier_3_967" class="footnote-link footnote-identifier-link" title="So the cable for the USB adapter I&#039;ve got my DVD drive connected to in my desktop can reach my mini-itx board.">4</a>]</sup> so I opted to try pxe booting<sup>[<a href="http://www.bemasher.net/archives/967#footnote_4_967" id="identifier_4_967" class="footnote-link footnote-identifier-link" title="Preboot Execution Environment">5</a>]</sup> again.</p>
<p>I've messed with pxe booting in the past, particularly with GeeXboX<sup>[<a href="http://www.bemasher.net/archives/967#footnote_5_967" id="identifier_5_967" class="footnote-link footnote-identifier-link" title="GeeXboX">6</a>]</sup> for my media center and that was a nightmare at the time and essentially required you to have a linux system in order to do it. Since then a wonderful application has made its way into the internet: tftpd32<sup>[<a href="http://www.bemasher.net/archives/967#footnote_6_967" id="identifier_6_967" class="footnote-link footnote-identifier-link" title="tftpd32: An open-source tftp//dhcp//syslog server for Windows.">7</a>]</sup>. Tftpd32 greatly simplifies the whole process by not requiring you to install anything or make any major system changes.</p>
<p>Before you continue take note, these instructions assume a few things:</p>
<ul>
<li>You're serving the netboot images from a windows system.</li>
<li>You have a tomato based router, although these instructions can be easily modified to work with any router firmware that uses DNSMasq or allows you to change advanced settings for the DHCP server.</li>
</ul>
<p>Things you'll need:</p>
<ul>
<li><a href="http://www.ubuntu.com/desktop/get-ubuntu/alternative-download">Ubuntu Alternative ISO</a>: This will be used for setting up the local http repository.</li>
<li><a href="http://archive.ubuntu.com/ubuntu/dists/maverick/main/installer-i386/current/images/netboot/">Ubuntu NetBoot Image</a>: Grab <strong>netboot.tar.gz</strong></li>
<li><a href="http://tftpd32.jounin.net/tftpd32*download.html">tftpd32</a>: This will be used for serving files during PXE booting.</li>
<li><a href="http://www.rejetto.com/hfs/">HFS ~ HTTP File Server</a>: This will be used for setting up a local http repository for installing from our local network instead of having ubuntu download everything from a mirror.</li>
</ul>
<p>Router Settings:</p>
<ul>
<li>Advanced -> DHCP / DNS -> Dnsmasq Custom Configuration</li>
<li>dhcp-boot=pxelinux.0,,[tftpd32 server ip address]</li>
<li>Save.</li>
</ul>
<p>For ease of readability from this point forward files will be <strong>bolded</strong> and directories will be <em>italicized</em>.</p>
<ul>
<li>Untar <strong>netboot.tar.gz</strong> into a folder, which I'll refer to as <em>netboot</em> from now on.</li>
<li>Delete <strong>pxelinux.0</strong> and <strong>pxelinux.cfg</strong> from <em>netboot/</em> as these are symlinks which will not work in windows.</li>
<li>Create the directory <em>netboot/pxelinux.cfg/</em></li>
<li>Copy <strong>pxelinux.0</strong> from <em>netboot/ubuntu-installer/i386/</em> to <em>netboot/</em></li>
<li>Copy <strong>sysconfig.cfg</strong> from <em>netboot/unbuntu-installer/i386/boot-screens/</em> to <em>netboot/pxelinux.cfg/</em></li>
<li>Rename <em>netboot/pxelinux.cfg/<strong></em>sysconfig.cfg</strong> to <em>netboot/pxelinux.cfg/<strong></em>default</strong></li>
</ul>
<p>Preparing tftpd32:</p>
<ul>
<li>Run tftpd32</li>
<li>Browse to the <em>netboot</em> folder we just finished setting up.</li>
<li>Tftpd32 should be serving the files in that directory at this point.</li>
</ul>
<p>Preparing the local HTTP Ubuntu Repository:</p>
<ul>
<li>Run <strong>HFS.exe</strong></li>
<li>Extract all of the files from <strong>ubuntu-10.10-alternate-i386.iso</strong> to a folder which I'll refer to as <em>ubuntu-alt</em> from this point on.</li>
<li>In the Virtual File System pane right click -> Add Folder from disk...
<ul>
<li>Browse to and select <em>ubuntu-alt</em></li>
<li>When HFS prompts you to ask what kind of folder it should be added as, select Real Folder</li>
</ul>
</li>
<li>Note the link in the address bar next to Open in browser, you'll use this link when installing ubuntu.</li>
</ul>
<p>Installing Ubuntu:</p>
<ul>
<li>Boot the system you're attempting to install Ubuntu on from your network device.</li>
<li>If you have tftpd32 up on another monitor at this point you should see a deluge of requests in the tftp server tab.</li>
<li>Ubuntu should show a boot menu select install.</li>
<li>Now I'm not going to go into full detail on how to install Ubuntu but when you get to mirror selection at the very top of the list there should be the option to enter a mirror manually this is where you should enter the address from the address bar in HFS, be sure to also include the port value.</li>
<li>If all goes well it should start installing and you should see another deluge of requests in HFS.</li>
</ul>
<ol class="footnotes"><li id="footnote_0_967" class="footnote">In fact it's pretty far from peak physical condition.</li><li id="footnote_1_967" class="footnote">Like ubuntu for example.</li><li id="footnote_2_967" class="footnote">I'm not entirely sure if this is due to washing it or just from it being nearly 5 years old.</li><li id="footnote_3_967" class="footnote">So the cable for the USB adapter I've got my DVD drive connected to in my desktop can reach my mini-itx board.</li><li id="footnote_4_967" class="footnote"><a href="http://en.wikipedia.org/wiki/Preboot*Execution*Environment">Preboot Execution Environment</a></li><li id="footnote_5_967" class="footnote"><a href="http://www.geexbox.org/">GeeXboX</a></li><li id="footnote_6_967" class="footnote"><a href="http://tftpd32.jounin.net/">tftpd32</a>: An open-source tftp//dhcp//syslog server for Windows.</li></ol>]]></content:encoded>
			<wfw:commentRss>http://www.bemasher.net/archives/967/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Choosing an SSD (A more different S)</title>
		<link>http://www.bemasher.net/archives/927?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=choosing-an-ssd-a-more-different-s</link>
		<comments>http://www.bemasher.net/archives/927#comments</comments>
		<pubDate>Mon, 13 Dec 2010 06:14:14 +0000</pubDate>
		<dc:creator>bemasher</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[ElementTree]]></category>
		<category><![CDATA[etree]]></category>
		<category><![CDATA[G.SKILL]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[lxml]]></category>
		<category><![CDATA[Newegg]]></category>
		<category><![CDATA[ocz]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[RevoDrive]]></category>
		<category><![CDATA[SSD]]></category>
		<category><![CDATA[TRIM]]></category>
		<category><![CDATA[XHTML]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[XPath]]></category>

		<guid isPermaLink="false">http://www.bemasher.net/?p=927</guid>
		<description><![CDATA[I've been periodically going back and revisiting the results for my SSD analysis script for newegg.com. The last few times I ran it I noticed that it was broken. It looks like newegg has modified a few things in their power search results page. One thing which is a little obnoxious[1] is that they no [...]]]></description>
			<content:encoded><![CDATA[<p>I've been periodically going back and revisiting the results for my SSD analysis script for newegg.com. The last few times I ran it I noticed that it was broken. It looks like newegg has modified a few things in their power search results page. One thing which is a little obnoxious<sup>[<a href="http://www.bemasher.net/archives/927#footnote_0_927" id="identifier_0_927" class="footnote-link footnote-identifier-link" title="I&#039;ve already sent feedback to them suggesting that they fix this.">1</a>]</sup> is that they no longer include the capacity in the description of the item or as a feature in the feature list when viewing the results page. This only seems to be an issue on the SSD page although I can't figure out why they decided it didn't need to be there in the first place. I see it this way: SSD's are first and foremost a storage device, you'd think that one of the most important features that should be listed with <em>every</em> SSD is the capacity at least.</p>
<p>Anyway, this change broke my script which I had been meaning to rewrite since regular expressions are definitely not the most efficient or cleanest way to parse HTML. I've been working with XML a more often lately despite my original prejudice against it for being a really bloated way to transfer data. One thing I discovered that makes XML a lot less painful is XPath<sup>[<a href="http://www.bemasher.net/archives/927#footnote_1_927" id="identifier_1_927" class="footnote-link footnote-identifier-link" title="Only if the XML parser you&#039;re using supports it, which it seems is not a whole lot of them. At least not all of them support the full specification which is annoying since nobody really seems to document which bits and pieces they support and which whey don&#039;t.">2</a>]</sup> which is an incredibly useful "language" for selecting data from an XML document.</p>
<p>Once I had gone through and read several tutorials and references about XPath I set out to use it in writing a show calendar script which parses data from tvrage.com's XML API. After that useful exercise I realized I could very easily and cleanly apply it to my SSD analysis script. Since HTML is similar in nature to XML<sup>[<a href="http://www.bemasher.net/archives/927#footnote_2_927" id="identifier_2_927" class="footnote-link footnote-identifier-link" title="Although not necessarily XML depending on the particular doctype you&#039;ve chosen, Newegg&#039;s is transitional HTML.">3</a>]</sup> I set out to parse Newegg's results page using XPath. This presented the first problem: Newegg's page isn't strictly XML or even XHTML for that matter. After a great deal of googling and research I landed on the lxml<sup>[<a href="http://www.bemasher.net/archives/927#footnote_3_927" id="identifier_3_927" class="footnote-link footnote-identifier-link" title="lxml: http://codespeak.net/lxml/">4</a>]</sup> website which as it turns out has an HTML parser for navigating and extracting data from HTML in the same way you would from an xml.etree.ElementTree<sup>[<a href="http://www.bemasher.net/archives/927#footnote_4_927" id="identifier_4_927" class="footnote-link footnote-identifier-link" title="xml.etree.ElementTree: http://docs.python.org/library/xml.etree.elementtree.html">5</a>]</sup>. With this in mind I immediately began rewriting the script.</p>
<p>First off lets consider my criteria for a "good" SSD on Newegg. The SSD can be either the typical 2.5" form factor, or a PCI-Express card<sup>[<a href="http://www.bemasher.net/archives/927#footnote_5_927" id="identifier_5_927" class="footnote-link footnote-identifier-link" title="Some of the PCI-Express SSD&#039;s are stupidly fast and more expensive except that it doesn&#039;t look like any of them support TRIM yet which is a major problem for me.">6</a>]</sup>. The interface can be SATAII, SATAIII or PCI-Express. Capacity must be greater than or equal to 120GB<sup>[<a href="http://www.bemasher.net/archives/927#footnote_6_927" id="identifier_6_927" class="footnote-link footnote-identifier-link" title="It is rare that I have a matured (read: haven&#039;t reformatted in a while) install of windows along with all of my most commonly used programs and games that exceeds 60GB so I estimate that doubling this should accommodate for any sudden urges to install really big things.">7</a>]</sup>. Last but not least, the disk should be sub $300<sup>[<a href="http://www.bemasher.net/archives/927#footnote_7_927" id="identifier_7_927" class="footnote-link footnote-identifier-link" title="I can&#039;t really justify spending much more than $300 on a single storage device. It had better be one hell of a storage device if I ever find myself spending more than $300 on it.">8</a>]</sup>.</p>
<p>The above requirements give us the following power search<sup>[<a href="http://www.bemasher.net/archives/927#footnote_8_927" id="identifier_8_927" class="footnote-link footnote-identifier-link" title="This will likely need to be updated at least once a month as Newegg is constantly adding new criteria and changing things.">9</a>]</sup> which we will be using as the source for the script:</p>
<div class="codecolorer-container python default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="python codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">url <span style="color: #66cc66;">=</span> <span style="color: #483d8b;">&quot;http://www.newegg.com/Product/ProductList.aspx?Submit=Property&amp;N=100008&quot;</span> + \<br />
&nbsp; &nbsp; <span style="color: #483d8b;">&quot;120&amp;IsNodeId=1&amp;maxPrice=300&amp;OEMMark=1,0&amp;PropertyCodeValue=4213:30854,421&quot;</span> + \<br />
&nbsp; &nbsp; <span style="color: #483d8b;">&quot;3:41472,4213:47725,4214:46019,4214:72313,4214:57574,4214:58118,4214:3941&quot;</span> + \<br />
&nbsp; &nbsp; <span style="color: #483d8b;">&quot;6,4214:47732,4214:30849,4214:47171,4214:46300,4214:77918,4214:72311,4214&quot;</span> + \<br />
&nbsp; &nbsp; <span style="color: #483d8b;">&quot;:77919,4214:55178,4214:47733,4214:57755,4214:44038,4215:55552,4215:47726&quot;</span> + \<br />
&nbsp; &nbsp; <span style="color: #483d8b;">&quot;,4215:41071&amp;bop=And&amp;Pagesize=100&quot;</span></div></td></tr></tbody></table></div>
<p>Now the first thing that made me cringe as I was rewriting this was the fact that I would basically have no choice but to load each individual product page from the results page as capacity is no longer included in either the description or the features list of each product in the results page. Eventually I will get around to multi-threading this to make it a little less painful, or I'll get lucky and Newegg will add the capacity feature back to the item listing in power searches for SSD's. The following is the full source code of the parser:</p>
<div class="codecolorer-container python default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br />61<br />62<br />63<br />64<br />65<br />66<br />67<br />68<br />69<br />70<br />71<br />72<br />73<br />74<br />75<br />76<br />77<br />78<br />79<br />80<br />81<br />82<br />83<br />84<br />85<br /></div></td><td><div class="python codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">re</span><span style="color: #66cc66;">,</span> <span style="color: #dc143c;">math</span><br />
<span style="color: #ff7700;font-weight:bold;">from</span> lxml <span style="color: #ff7700;font-weight:bold;">import</span> etree<br />
<br />
url <span style="color: #66cc66;">=</span> <span style="color: #483d8b;">&quot;http://www.newegg.com/Product/ProductList.aspx?Submit=Property&amp;N=100008&quot;</span> + \<br />
&nbsp; &nbsp; <span style="color: #483d8b;">&quot;120&amp;IsNodeId=1&amp;maxPrice=300&amp;OEMMark=1,0&amp;PropertyCodeValue=4213:30854,421&quot;</span> + \<br />
&nbsp; &nbsp; <span style="color: #483d8b;">&quot;3:41472,4213:47725,4214:46019,4214:72313,4214:57574,4214:58118,4214:3941&quot;</span> + \<br />
&nbsp; &nbsp; <span style="color: #483d8b;">&quot;6,4214:47732,4214:30849,4214:47171,4214:46300,4214:77918,4214:72311,4214&quot;</span> + \<br />
&nbsp; &nbsp; <span style="color: #483d8b;">&quot;:77919,4214:55178,4214:47733,4214:57755,4214:44038,4215:55552,4215:47726&quot;</span> + \<br />
&nbsp; &nbsp; <span style="color: #483d8b;">&quot;,4215:41071&amp;bop=And&amp;Pagesize=100&quot;</span><br />
<br />
featureMap <span style="color: #66cc66;">=</span> <span style="color: black;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #483d8b;">'Capacity'</span>: <span style="color: #483d8b;">'capacity'</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; <span style="color: #483d8b;">'Sequential Access - Write:'</span>: <span style="color: #483d8b;">'write'</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; <span style="color: #483d8b;">'Sequential Access - Write'</span>: <span style="color: #483d8b;">'write'</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; <span style="color: #483d8b;">'Sequential Access - Read:'</span>: <span style="color: #483d8b;">'read'</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; <span style="color: #483d8b;">'Sequential Access - Read'</span>: <span style="color: #483d8b;">'read'</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; <span style="color: #483d8b;">'Interface Type'</span>: <span style="color: #483d8b;">'interface'</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; <span style="color: #483d8b;">'Brand'</span>: <span style="color: #483d8b;">'brand'</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; <span style="color: #483d8b;">'Model'</span>: <span style="color: #483d8b;">'model'</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; <span style="color: #483d8b;">'Series'</span>: <span style="color: #483d8b;">'series'</span><br />
<span style="color: black;">&#125;</span><br />
<br />
speed_re <span style="color: #66cc66;">=</span> <span style="color: #dc143c;">re</span>.<span style="color: #008000;">compile</span><span style="color: black;">&#40;</span>r<span style="color: #483d8b;">'(<span style="color: #000099; font-weight: bold;">\d</span>+)<span style="color: #000099; font-weight: bold;">\s</span>?MB/s'</span><span style="color: black;">&#41;</span><br />
capacity_re <span style="color: #66cc66;">=</span> <span style="color: #dc143c;">re</span>.<span style="color: #008000;">compile</span><span style="color: black;">&#40;</span>r<span style="color: #483d8b;">'(<span style="color: #000099; font-weight: bold;">\d</span>+)GB'</span><span style="color: black;">&#41;</span><br />
<br />
<span style="color: #dc143c;">parser</span> <span style="color: #66cc66;">=</span> etree.<span style="color: #dc143c;">HTMLParser</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
<span style="color: #808080; font-style: italic;"># tree = etree.parse(&quot;temp.html&quot;, parser)</span><br />
tree <span style="color: #66cc66;">=</span> etree.<span style="color: black;">parse</span><span style="color: black;">&#40;</span>url<span style="color: #66cc66;">,</span> etree.<span style="color: #dc143c;">HTMLParser</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><br />
root <span style="color: #66cc66;">=</span> tree.<span style="color: black;">getroot</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
<br />
items <span style="color: #66cc66;">=</span> <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span><br />
<br />
<span style="color: #ff7700;font-weight:bold;">for</span> node <span style="color: #ff7700;font-weight:bold;">in</span> root.<span style="color: black;">findall</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;.//div[@class='itemCell']&quot;</span><span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; item <span style="color: #66cc66;">=</span> <span style="color: black;">&#123;</span><span style="color: black;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;"># Get link</span><br />
&nbsp; &nbsp; link <span style="color: #66cc66;">=</span> node.<span style="color: black;">find</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;.//a[@title='View Details']&quot;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; item<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;link&quot;</span><span style="color: black;">&#93;</span> <span style="color: #66cc66;">=</span> link.<span style="color: black;">attrib</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;href&quot;</span><span style="color: black;">&#93;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;"># Get feature list (loads each item's url, should multi-thread this in the future)</span><br />
&nbsp; &nbsp; itemPage <span style="color: #66cc66;">=</span> etree.<span style="color: black;">parse</span><span style="color: black;">&#40;</span>item<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;link&quot;</span><span style="color: black;">&#93;</span><span style="color: #66cc66;">,</span> etree.<span style="color: #dc143c;">HTMLParser</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>.<span style="color: black;">getroot</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; featureList <span style="color: #66cc66;">=</span> <span style="color: #008000;">map</span><span style="color: black;">&#40;</span><span style="color: #ff7700;font-weight:bold;">lambda</span> n: n.<span style="color: black;">text</span><span style="color: #66cc66;">,</span> itemPage.<span style="color: black;">findall</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;.//fieldset/dl/dt&quot;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; valueList <span style="color: #66cc66;">=</span> <span style="color: #008000;">map</span><span style="color: black;">&#40;</span><span style="color: #ff7700;font-weight:bold;">lambda</span> n: n.<span style="color: black;">text</span><span style="color: #66cc66;">,</span> itemPage.<span style="color: black;">findall</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;.//fieldset/dl/dd&quot;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; features <span style="color: #66cc66;">=</span> <span style="color: #008000;">zip</span><span style="color: black;">&#40;</span>featureList<span style="color: #66cc66;">,</span> valueList<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">for</span> feature<span style="color: #66cc66;">,</span> value <span style="color: #ff7700;font-weight:bold;">in</span> features:<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> value <span style="color: #ff7700;font-weight:bold;">is</span> <span style="color: #ff7700;font-weight:bold;">not</span> <span style="color: #008000;">None</span> <span style="color: #ff7700;font-weight:bold;">and</span> feature <span style="color: #ff7700;font-weight:bold;">in</span> featureMap:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;"># If it's a speed feature parse out the speed</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> featureMap<span style="color: black;">&#91;</span>feature<span style="color: black;">&#93;</span> <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;read&quot;</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">&quot;write&quot;</span><span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; item<span style="color: black;">&#91;</span>featureMap<span style="color: black;">&#91;</span>feature<span style="color: black;">&#93;</span><span style="color: black;">&#93;</span> <span style="color: #66cc66;">=</span> <span style="color: #008000;">min</span><span style="color: black;">&#40;</span><span style="color: #008000;">map</span><span style="color: black;">&#40;</span><span style="color: #ff7700;font-weight:bold;">lambda</span> x: <span style="color: #008000;">int</span><span style="color: black;">&#40;</span>x<span style="color: black;">&#41;</span><span style="color: #66cc66;">,</span> speed_re.<span style="color: black;">findall</span><span style="color: black;">&#40;</span>value<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;"># If it's a capacity feature, parse out the capacity</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">elif</span> featureMap<span style="color: black;">&#91;</span>feature<span style="color: black;">&#93;</span> <span style="color: #66cc66;">==</span> <span style="color: #483d8b;">&quot;capacity&quot;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; item<span style="color: black;">&#91;</span>featureMap<span style="color: black;">&#91;</span>feature<span style="color: black;">&#93;</span><span style="color: black;">&#93;</span> <span style="color: #66cc66;">=</span> <span style="color: #008000;">min</span><span style="color: black;">&#40;</span><span style="color: #008000;">map</span><span style="color: black;">&#40;</span><span style="color: #ff7700;font-weight:bold;">lambda</span> x: <span style="color: #008000;">int</span><span style="color: black;">&#40;</span>x<span style="color: black;">&#41;</span><span style="color: #66cc66;">,</span> capacity_re.<span style="color: black;">findall</span><span style="color: black;">&#40;</span>value<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;"># If the value doesn't need to be parsed, just store the value in item</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">else</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; item<span style="color: black;">&#91;</span>featureMap<span style="color: black;">&#91;</span>feature<span style="color: black;">&#93;</span><span style="color: black;">&#93;</span> <span style="color: #66cc66;">=</span> value.<span style="color: black;">strip</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;"># Get price</span><br />
&nbsp; &nbsp; price <span style="color: #66cc66;">=</span> <span style="color: #008000;">map</span><span style="color: black;">&#40;</span><span style="color: #ff7700;font-weight:bold;">lambda</span> n: n.<span style="color: black;">text</span><span style="color: #66cc66;">,</span> node.<span style="color: black;">findall</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;.//li[@class='priceFinal']/*&quot;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; item<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;price&quot;</span><span style="color: black;">&#93;</span> <span style="color: #66cc66;">=</span> <span style="color: #008000;">float</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">''</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>price<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span>:<span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;"># Only add the item if it has the features we need in it</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #483d8b;">&quot;read&quot;</span> <span style="color: #ff7700;font-weight:bold;">in</span> item <span style="color: #ff7700;font-weight:bold;">and</span> <span style="color: #483d8b;">&quot;write&quot;</span> <span style="color: #ff7700;font-weight:bold;">in</span> item <span style="color: #ff7700;font-weight:bold;">and</span> <span style="color: #483d8b;">&quot;capacity&quot;</span> <span style="color: #ff7700;font-weight:bold;">in</span> item <span style="color: #ff7700;font-weight:bold;">and</span> <span style="color: #483d8b;">&quot;series&quot;</span> <span style="color: #ff7700;font-weight:bold;">in</span> item:<br />
&nbsp; &nbsp; &nbsp; &nbsp; score <span style="color: #66cc66;">=</span> <span style="color: black;">&#40;</span>item<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;read&quot;</span><span style="color: black;">&#93;</span> * item<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;write&quot;</span><span style="color: black;">&#93;</span> * item<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;capacity&quot;</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span> / <span style="color: black;">&#40;</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">math</span>.<span style="color: black;">log</span><span style="color: black;">&#40;</span><span style="color: #008000;">abs</span><span style="color: black;">&#40;</span>item<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;read&quot;</span><span style="color: black;">&#93;</span> - item<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;write&quot;</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span> + <span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span> + item<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;price&quot;</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; item<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;score&quot;</span><span style="color: black;">&#93;</span> <span style="color: #66cc66;">=</span> score<br />
&nbsp; &nbsp; &nbsp; &nbsp; items.<span style="color: black;">append</span><span style="color: black;">&#40;</span>item<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; <br />
<span style="color: #008000;">sorted</span> <span style="color: #66cc66;">=</span> <span style="color: black;">&#123;</span><span style="color: black;">&#125;</span><br />
<span style="color: #ff7700;font-weight:bold;">for</span> item <span style="color: #ff7700;font-weight:bold;">in</span> items:<br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;"># Open addressing like in a hash table, so we don't wind</span><br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;"># up with any collisions, unlikely but good practice anyway</span><br />
&nbsp; &nbsp; score <span style="color: #66cc66;">=</span> item<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;score&quot;</span><span style="color: black;">&#93;</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">while</span> score <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">sorted</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; score +<span style="color: #66cc66;">=</span> <span style="color: #ff4500;">1</span><br />
&nbsp; &nbsp; <span style="color: #008000;">sorted</span><span style="color: black;">&#91;</span>score<span style="color: black;">&#93;</span> <span style="color: #66cc66;">=</span> item<br />
<br />
sortOrder <span style="color: #66cc66;">=</span> <span style="color: #008000;">sorted</span>.<span style="color: black;">keys</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
sortOrder.<span style="color: black;">sort</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
sortOrder.<span style="color: black;">reverse</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
<br />
headers <span style="color: #66cc66;">=</span> <span style="color: black;">&#91;</span><span style="color: #483d8b;">'brand'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'series'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'model'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'link'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'interface'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'price'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'capacity'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'read'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'write'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'score'</span><span style="color: black;">&#93;</span><br />
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\t</span>'</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>headers<span style="color: black;">&#41;</span><br />
<span style="color: #ff7700;font-weight:bold;">for</span> key <span style="color: #ff7700;font-weight:bold;">in</span> sortOrder:<br />
&nbsp; &nbsp; item <span style="color: #66cc66;">=</span> <span style="color: #008000;">sorted</span><span style="color: black;">&#91;</span>key<span style="color: black;">&#93;</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\t</span>'</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span><span style="color: #008000;">map</span><span style="color: black;">&#40;</span><span style="color: #ff7700;font-weight:bold;">lambda</span> x: <span style="color: #008000;">str</span><span style="color: black;">&#40;</span>item<span style="color: black;">&#91;</span>x<span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">,</span> headers<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></div></td></tr></tbody></table></div>
<p>At this point if you've gone through and read the entire script you'll probably notice that I've made a slight change to the scoring equation, it has been changed from the following:</p>
<p><center><img src='http://s0.wp.com/latex.php?latex=%5Cfrac%7B%5Ctext%7BRead%7D+%5Ctimes+%5Ctext%7BWrite%7D+%5Ctimes+%5Ctext%7BCapacity%7D%7D%7B%5Ctext%7BPrice%7D%7D&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='&#92;frac{&#92;text{Read} &#92;times &#92;text{Write} &#92;times &#92;text{Capacity}}{&#92;text{Price}}' title='&#92;frac{&#92;text{Read} &#92;times &#92;text{Write} &#92;times &#92;text{Capacity}}{&#92;text{Price}}' class='latex' /></center><br />
To the following:<br />
<center><img src='http://s0.wp.com/latex.php?latex=%5Cfrac%7B%5Ctext%7BRead%7D+%5Ctimes+%5Ctext%7BWrite%7D+%5Ctimes+%5Ctext%7BCapacity%7D%7D%7B%28%5Clog_%7B10%7D%28%7C%5Ctext%7BRead%7D+-+%5Ctext%7BWrite%7D%7C%29+%2B+1%29+%5Ctimes+%5Ctext%7BPrice%7D%7D&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='&#92;frac{&#92;text{Read} &#92;times &#92;text{Write} &#92;times &#92;text{Capacity}}{(&#92;log_{10}(|&#92;text{Read} - &#92;text{Write}|) + 1) &#92;times &#92;text{Price}}' title='&#92;frac{&#92;text{Read} &#92;times &#92;text{Write} &#92;times &#92;text{Capacity}}{(&#92;log_{10}(|&#92;text{Read} - &#92;text{Write}|) + 1) &#92;times &#92;text{Price}}' class='latex' /></center></p>
<p>I discovered that using the difference in read//write speed <em>heavily</em> penalized drives with anything greater than 10MB/s difference. So I figured that it may be a little more subtle to simply penalize drives based on the magnitude of the difference.</p>
<p>Now you're probably wondering: "When is this blathering idiot going to get to the damned results already?". And you'd be pleasantly surprised to know that I'm getting to them as you waste your time reading this.</p>
<p><center><br />
<img src="http://lh3.ggpht.com/_67X_BsG0Kiw/TQW3hjXnkdI/AAAAAAAAH3Y/K2iIOU7s0yg/Output.png"></img></p>
<table>
<tr>
<td>Manufacturer:</td>
<td>OCZ</td>
<td>OCZ</td>
<td>G.Skill</td>
<td>OCZ</td>
</tr>
<tr>
<td>Series:</td>
<td>RevoDrive</td>
<td>Vertex 2</td>
<td>Phoenix Pro Series</td>
<td>Agility 2</td>
</tr>
<tr>
<td>Capacity:</td>
<td>120GB</td>
<td>180GB</td>
<td>120GB</td>
<td>120GB</td>
</tr>
<tr>
<td>Read:</td>
<td>540MB/s</td>
<td>285MB/s</td>
<td>285MB/s</td>
<td>285MB/s</td>
</tr>
<tr>
<td>Write:</td>
<td>490MB/s</td>
<td>275MB/s</td>
<td>275MB/s</td>
<td>275MB/s</td>
</tr>
<tr>
<td>Item:</td>
<td>N82E16820227578<sup>[<a href="http://www.bemasher.net/archives/927#footnote_9_927" id="identifier_9_927" class="footnote-link footnote-identifier-link" title="OCZ RevoDrive">10</a>]</sup></td>
<td>N82E16820227602<sup>[<a href="http://www.bemasher.net/archives/927#footnote_10_927" id="identifier_10_927" class="footnote-link footnote-identifier-link" title="OCZ Vertex 2">11</a>]</sup></td>
<td>N82E16820231378<sup>[<a href="http://www.bemasher.net/archives/927#footnote_11_927" id="identifier_11_927" class="footnote-link footnote-identifier-link" title="G.SKILL Phoenix Pro Series">12</a>]</sup></td>
<td>N82E16820227593<sup>[<a href="http://www.bemasher.net/archives/927#footnote_12_927" id="identifier_12_927" class="footnote-link footnote-identifier-link" title="OCZ Agility 2">13</a>]</sup></td>
</tr>
<tr>
<td>Price:</td>
<td>$299.99</td>
<td>$294.99</td>
<td>$214.99</td>
<td>$214.99</td>
</tr>
</table>
<p></center></p>
<p>As you can see the RevoDrive far out-scores all the rest of the SSD's considered in this analysis. The main reason is that they've essentially included two 60GB SSD's on the same card and you're expected to perform software raid on them in your own system<sup>[<a href="http://www.bemasher.net/archives/927#footnote_13_927" id="identifier_13_927" class="footnote-link footnote-identifier-link" title="They show up as two separate physical devices despite being located on the same card.">14</a>]</sup>. Despite the incredible speeds they boast I don't think I would purchase one of these to use as my OS//Program disk because compatibility is a major limitation. You must be sure that your motherboard's BIOS supports booting via PCI-Express cards. And last but not least, the main reason I would pass up this card is the lack of TRIM support. As far as I can tell these cards do not support TRIM which is a major downside as far as I'm concerned.</p>
<p>The second disk in the list is the OCZ Vertex 2 180GB version. I'd probably skip this one just because I don't really consider the extra 60GB worth the extra $80.</p>
<p>Which leaves me with the last two disks which are as far as my analysis is concerned, identical. If you take into account the detailed features you'll notice that the G.Skill claims 50k IOPS on the 4k Random write test which seems a bit... optimistic. The OCZ makes no such claim and as far as I'm concerned both disks are more less the same thing. So it's pretty much up to brand preference at this point.</p>
<ol class="footnotes"><li id="footnote_0_927" class="footnote">I've already sent feedback to them suggesting that they fix this.</li><li id="footnote_1_927" class="footnote">Only if the XML parser you're using supports it, which it seems is not a whole lot of them. At least not all of them support the full specification which is annoying since nobody really seems to document which bits and pieces they support and which whey don't.</li><li id="footnote_2_927" class="footnote">Although not necessarily XML depending on the particular doctype you've chosen, Newegg's is transitional HTML.</li><li id="footnote_3_927" class="footnote">lxml: <a href="http://codespeak.net/lxml/">http://codespeak.net/lxml/</a></li><li id="footnote_4_927" class="footnote">xml.etree.ElementTree: <a href="http://docs.python.org/library/xml.etree.elementtree.html">http://docs.python.org/library/xml.etree.elementtree.html</a></li><li id="footnote_5_927" class="footnote">Some of the PCI-Express SSD's are stupidly fast and more expensive except that it doesn't look like any of them support TRIM yet which is a major problem for me.</li><li id="footnote_6_927" class="footnote">It is rare that I have a matured (read: haven't reformatted in a while) install of windows along with all of my most commonly used programs and games that exceeds 60GB so I estimate that doubling this should accommodate for any sudden urges to install <em>really big things</em>.</li><li id="footnote_7_927" class="footnote">I can't really justify spending much more than $300 on a single storage device. It had better be one hell of a storage device if I ever find myself spending more than $300 on it.</li><li id="footnote_8_927" class="footnote">This will likely need to be updated at least once a month as Newegg is constantly adding new criteria and changing things.</li><li id="footnote_9_927" class="footnote"><a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16820227578">OCZ RevoDrive</a></li><li id="footnote_10_927" class="footnote"><a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16820227602">OCZ Vertex 2</a></li><li id="footnote_11_927" class="footnote"><a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16820231378">G.SKILL Phoenix Pro Series</a></li><li id="footnote_12_927" class="footnote"><a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16820227593">OCZ Agility 2</a></li><li id="footnote_13_927" class="footnote">They show up as two separate physical devices despite being located on the same card.</li></ol>]]></content:encoded>
			<wfw:commentRss>http://www.bemasher.net/archives/927/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Choosing an SSD (Update)</title>
		<link>http://www.bemasher.net/archives/895?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=choosing-an-ssd-update</link>
		<comments>http://www.bemasher.net/archives/895#comments</comments>
		<pubDate>Sun, 10 Oct 2010 02:42:58 +0000</pubDate>
		<dc:creator>bemasher</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[agility]]></category>
		<category><![CDATA[G.SKILL]]></category>
		<category><![CDATA[Newegg]]></category>
		<category><![CDATA[ocz]]></category>
		<category><![CDATA[phoenix]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[sandforce]]></category>
		<category><![CDATA[SSD]]></category>
		<category><![CDATA[vertex]]></category>

		<guid isPermaLink="false">http://www.bemasher.net/?p=895</guid>
		<description><![CDATA[My brother is in the planning stages of building a new desktop. One of the things he's planning on doing differently from his last build[1] is using an SSD for OS + Programs. I had mentioned to him previously that I a wrote a program for helping to choose an SSD based on what SSD's [...]]]></description>
			<content:encoded><![CDATA[<p>My brother is in the planning stages of building a new desktop. One of the things he's planning on doing differently from his last build<sup>[<a href="http://www.bemasher.net/archives/895#footnote_0_895" id="identifier_0_895" class="footnote-link footnote-identifier-link" title="Which incidentally was right when SSD&#039;s were just becoming available to the average consumer.">1</a>]</sup> is using an SSD for OS + Programs.</p>
<p>I had mentioned to him previously that I a wrote a program for helping to choose an SSD based on what SSD's are meant for and are good at doing. So he asked if I could recommend him one. Below are the results of the latest run of my script based on the most current listings<sup>[<a href="http://www.bemasher.net/archives/895#footnote_1_895" id="identifier_1_895" class="footnote-link footnote-identifier-link" title="As of this date 10/09/2010.">2</a>]</sup> of SSD's newegg offers.<br />
<center><br />
<img src="http://lh4.ggpht.com/_67X_BsG0Kiw/TLEno4pTg5I/AAAAAAAAH2Y/sYifab5pRgI/s800/Output.png"></img></p>
<table>
<tr>
<td>Manufacturer:</td>
<td>OCZ</td>
<td>G.Skill</td>
<td>OCZ</td>
</tr>
<tr>
<td>Series:</td>
<td>Agility 2</td>
<td>Phoenix Pro</td>
<td>Vertex 2</td>
</tr>
<tr>
<td>Capacity:</td>
<td>120GB</td>
<td>120GB</td>
<td>120GB</td>
</tr>
<tr>
<td>Read:</td>
<td>285MB/s</td>
<td>285MB/s</td>
<td>285MB/s</td>
</tr>
<tr>
<td>Write:</td>
<td>275MB/s</td>
<td>275MB/s</td>
<td>275MB/s</td>
</tr>
<tr>
<td>Item:</td>
<td>N82E16820227543<sup>[<a href="http://www.bemasher.net/archives/895#footnote_2_895" id="identifier_2_895" class="footnote-link footnote-identifier-link" title="OCZ Agility 2">3</a>]</sup></td>
<td>N82E16820231378<sup>[<a href="http://www.bemasher.net/archives/895#footnote_3_895" id="identifier_3_895" class="footnote-link footnote-identifier-link" title="G.Skill Phoenix Pro">4</a>]</sup></td>
<td>N82E16820227551<sup>[<a href="http://www.bemasher.net/archives/895#footnote_4_895" id="identifier_4_895" class="footnote-link footnote-identifier-link" title="OCZ Vertex 2">5</a>]</sup></td>
</tr>
<tr>
<td>Price:</td>
<td>$235.99</td>
<td>$239.99</td>
<td>$240.00</td>
</tr>
</table>
<p></center><br />
It looks like OCZ has two of the top three places this run and G.Skill is still maintaining one of the top three from before. Between the 3 of them I think i would likely still go for the G.Skill just because of personal preference despite there not really being any significant differences between the three. Excepting price of course.</p>
<ol class="footnotes"><li id="footnote_0_895" class="footnote">Which incidentally was right when SSD's were just becoming available to the average consumer.</li><li id="footnote_1_895" class="footnote">As of this date 10/09/2010.</li><li id="footnote_2_895" class="footnote"><a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16820227543">OCZ Agility 2</a></li><li id="footnote_3_895" class="footnote"><a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16820231378">G.Skill Phoenix Pro</a></li><li id="footnote_4_895" class="footnote"><a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16820227551">OCZ Vertex 2</a></li></ol>]]></content:encoded>
			<wfw:commentRss>http://www.bemasher.net/archives/895/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Choosing an SSD</title>
		<link>http://www.bemasher.net/archives/836?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=choosing-an-ssd</link>
		<comments>http://www.bemasher.net/archives/836#comments</comments>
		<pubDate>Thu, 12 Aug 2010 06:02:27 +0000</pubDate>
		<dc:creator>bemasher</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[A-Data]]></category>
		<category><![CDATA[G.SKILL]]></category>
		<category><![CDATA[matplotlib]]></category>
		<category><![CDATA[Newegg]]></category>
		<category><![CDATA[Patriot]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Read]]></category>
		<category><![CDATA[Sequential]]></category>
		<category><![CDATA[SSD]]></category>
		<category><![CDATA[Western Digital]]></category>
		<category><![CDATA[Write]]></category>

		<guid isPermaLink="false">http://www.bemasher.net/?p=836</guid>
		<description><![CDATA[Before I started my new job I had an inordinate amount of free time and for a majority of that time, nothing to spend it doing[1]. I was still thinking about my desktop wishlist[2] and about choosing a better SSD than the one I had previously selected[3]. A long time ago when I was following [...]]]></description>
			<content:encoded><![CDATA[<p>Before I started my new job I had an inordinate amount of free time and for a majority of that time, nothing to spend it doing<sup>[<a href="http://www.bemasher.net/archives/836#footnote_0_836" id="identifier_0_836" class="footnote-link footnote-identifier-link" title="Nothing worth-while anyway">1</a>]</sup>. I was still thinking about my desktop wishlist<sup>[<a href="http://www.bemasher.net/archives/836#footnote_1_836" id="identifier_1_836" class="footnote-link footnote-identifier-link" title="See previous post: Wishlist.">2</a>]</sup> and about choosing a better SSD than the one I had previously selected<sup>[<a href="http://www.bemasher.net/archives/836#footnote_2_836" id="identifier_2_836" class="footnote-link footnote-identifier-link" title="Western Digital SiliconEdge 128GB SSD">3</a>]</sup>.</p>
<p>A long time ago when I was following the HDD market since I was looking to buy some bulk storage I wrote a php script which loaded newegg's product list based on some search parameters you provided newegg's productlist.xml<sup>[<a href="http://www.bemasher.net/archives/836#footnote_3_836" id="identifier_3_836" class="footnote-link footnote-identifier-link" title="Which no longer exists in it&#039;s original form.">4</a>]</sup>. The script would then parse the list and produce a list sorted based on price per gigabyte. Which is useful when you're in the market for capacity<sup>[<a href="http://www.bemasher.net/archives/836#footnote_4_836" id="identifier_4_836" class="footnote-link footnote-identifier-link" title="Which I was.">5</a>]</sup>.</p>
<p>I decided to do more or less the same thing with SSD's except this time I did it in python since I'm rusty on PHP and I didn't want to mess with setting up a web server to test on. So I got started by doing a power search on newegg for the specific flavor of SSD I was looking for.</p>
<p>The search parameters are as follows:</p>
<ul>
<li>2.5" Form Factor</li>
<li>SATA II/III</li>
<li>120GB or Greater</li>
<li>Less than $300</li>
<li>Retail or OEM</li>
<li>Support TRIM Command</li>
</ul>
<p>As of this writing those particular search parameters narrows the result to 17 SSD's. Now comes the code. Before I started coding I needed some way to sort them according to what I thought was important. The metric is as follows:</p>
<p><center>$$\frac{\text{Read} \times \text{Write} \times \text{Capacity}}{|\text{Read} - \text{Write}| \times \text{Price}}$$</center></p>
<p>After looking closer at the scores this produces I noticed that it <em>heavily</em> penalizes drives with huge differences between read and write speeds which effectively weeds out drives that still have acceptable read//write speeds. So I removed that section of the metric producing:</p>
<p><center><img src='http://s0.wp.com/latex.php?latex=%5Cfrac%7B%5Ctext%7BRead%7D+%5Ctimes+%5Ctext%7BWrite%7D+%5Ctimes+%5Ctext%7BCapacity%7D%7D%7B%5Ctext%7BPrice%7D%7D&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='&#92;frac{&#92;text{Read} &#92;times &#92;text{Write} &#92;times &#92;text{Capacity}}{&#92;text{Price}}' title='&#92;frac{&#92;text{Read} &#92;times &#92;text{Write} &#92;times &#92;text{Capacity}}{&#92;text{Price}}' class='latex' /></center></p>
<p>The basic idea behind this scoring measure is that sequential read and write speeds are important, as well as capacity. Price and difference between sequential read//write are considered bad<sup>[<a href="http://www.bemasher.net/archives/836#footnote_5_836" id="identifier_5_836" class="footnote-link footnote-identifier-link" title="Although we&#039;re excluding read//write speed difference.">6</a>]</sup>. In the equation read and write refer to sequential read and write speeds. The ratio of these will produce a score of the SSD's overall performance for capacity, read//write speeds and price.</p>
<p>The code is relatively simple in purpose. Load the data and parse it into a dictionary then sort based on the metric above.</p>
<div class="codecolorer-container python default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br /></div></td><td><div class="python codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">urllib2</span><span style="color: #66cc66;">,</span> <span style="color: #dc143c;">re</span><br />
<br />
<span style="color: #808080; font-style: italic;"># url = &quot;</span><br />
<span style="color: #808080; font-style: italic;"># http://www.newegg.com/Product/ProductList.aspx?Submit=Property&amp;Subcatego </span><br />
<span style="color: #808080; font-style: italic;"># ry=636&amp;Description=&amp;Type=&amp;N=100008120&amp;IsNodeId=1&amp;srchInDesc=&amp;MinPrice=&amp;M </span><br />
<span style="color: #808080; font-style: italic;"># axPrice=&amp;OEMMark=1&amp;OEMMark=0&amp;PropertyCodeValue=4213:30854&amp;PropertyCodeVa </span><br />
<span style="color: #808080; font-style: italic;"># lue=4214:30848&amp;PropertyCodeValue=4214:39416&amp;PropertyCodeValue=4214:30849 </span><br />
<span style="color: #808080; font-style: italic;"># &amp;PropertyCodeValue=4214:39415&amp;PropertyCodeValue=4215:55552&amp;PropertyCodeV </span><br />
<span style="color: #808080; font-style: italic;"># alue=4215:41071&amp;PropertyCodeValue=4215:46319&quot;</span><br />
<br />
<span style="color: #808080; font-style: italic;"># data = open(&quot;temp.html&quot;, &quot;w&quot;)</span><br />
<span style="color: #808080; font-style: italic;"># data.write(urllib2.urlopen(url).read())</span><br />
<span style="color: #808080; font-style: italic;"># data.close()</span><br />
raw <span style="color: #66cc66;">=</span> <span style="color: #008000;">open</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;temp.html&quot;</span><span style="color: black;">&#41;</span>.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
<br />
item_re <span style="color: #66cc66;">=</span> <span style="color: #dc143c;">re</span>.<span style="color: #008000;">compile</span><span style="color: black;">&#40;</span>r<span style="color: #483d8b;">'&lt;div class=&quot;itemCell&quot;.*?&gt;(.*?)&lt;br class=&quot;clear&quot;.*?&lt;/div&gt;'</span><span style="color: black;">&#41;</span><br />
feature_re <span style="color: #66cc66;">=</span> <span style="color: #dc143c;">re</span>.<span style="color: #008000;">compile</span><span style="color: black;">&#40;</span>r<span style="color: #483d8b;">&quot;&lt;li&gt;&amp;nbsp;(.*?)&lt;/li&gt;&quot;</span><span style="color: black;">&#41;</span><br />
feature_list_re <span style="color: #66cc66;">=</span> <span style="color: #dc143c;">re</span>.<span style="color: #008000;">compile</span><span style="color: black;">&#40;</span>r<span style="color: #483d8b;">'&lt;b&gt;(.*?)<span style="color: #000099; font-weight: bold;">\s</span>?<span style="color: #000099; font-weight: bold;">\#</span>?<span style="color: #000099; font-weight: bold;">\s</span>?:<span style="color: #000099; font-weight: bold;">\s</span>?&lt;/b&gt;<span style="color: #000099; font-weight: bold;">\s</span>?(.*?)&lt;/li&gt;'</span><span style="color: black;">&#41;</span><br />
speed_re <span style="color: #66cc66;">=</span> <span style="color: #dc143c;">re</span>.<span style="color: #008000;">compile</span><span style="color: black;">&#40;</span>r<span style="color: #483d8b;">&quot;(up to )?(<span style="color: #000099; font-weight: bold;">\d</span>+).*?MB/s&quot;</span><span style="color: black;">&#41;</span><br />
capacity_re <span style="color: #66cc66;">=</span> <span style="color: #dc143c;">re</span>.<span style="color: #008000;">compile</span><span style="color: black;">&#40;</span>r<span style="color: #483d8b;">&quot;(<span style="color: #000099; font-weight: bold;">\d</span>+)GB&quot;</span><span style="color: black;">&#41;</span><br />
price_re <span style="color: #66cc66;">=</span> <span style="color: #dc143c;">re</span>.<span style="color: #008000;">compile</span><span style="color: black;">&#40;</span>r<span style="color: #483d8b;">&quot;&lt;/span&gt;<span style="color: #000099; font-weight: bold;">\$</span>&lt;strong&gt;(<span style="color: #000099; font-weight: bold;">\d</span>+)&lt;/strong&gt;&lt;sup&gt;.(<span style="color: #000099; font-weight: bold;">\d</span>+)&lt;/sup&gt;&quot;</span><span style="color: black;">&#41;</span><br />
<br />
item_list <span style="color: #66cc66;">=</span> <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span><br />
valid <span style="color: #66cc66;">=</span> <span style="color: black;">&#91;</span><span style="color: #483d8b;">'Read'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'Item'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'Interface'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'Capacity'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'Model'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'Write'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'Size'</span><span style="color: black;">&#93;</span><br />
<br />
<span style="color: #ff7700;font-weight:bold;">for</span> item <span style="color: #ff7700;font-weight:bold;">in</span> item_re.<span style="color: black;">findall</span><span style="color: black;">&#40;</span>raw<span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; current <span style="color: #66cc66;">=</span> <span style="color: black;">&#123;</span><span style="color: black;">&#125;</span><br />
&nbsp; &nbsp; no_label <span style="color: #66cc66;">=</span> <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span><br />
&nbsp; &nbsp; features <span style="color: #66cc66;">=</span> feature_re.<span style="color: black;">findall</span><span style="color: black;">&#40;</span>item<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; current<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;Size&quot;</span><span style="color: black;">&#93;</span> <span style="color: #66cc66;">=</span> features<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><br />
&nbsp; &nbsp; current<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;Capacity&quot;</span><span style="color: black;">&#93;</span> <span style="color: #66cc66;">=</span> features<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span><br />
&nbsp; &nbsp; current<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;Interface&quot;</span><span style="color: black;">&#93;</span> <span style="color: #66cc66;">=</span> features<span style="color: black;">&#91;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#93;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">for</span> feature <span style="color: #ff7700;font-weight:bold;">in</span> feature_list_re.<span style="color: black;">findall</span><span style="color: black;">&#40;</span>item<span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> feature<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>.<span style="color: black;">find</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\r</span>&quot;</span><span style="color: black;">&#41;</span> <span style="color: #66cc66;">!=</span> -<span style="color: #ff4500;">1</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; current<span style="color: black;">&#91;</span>feature<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#93;</span> <span style="color: #66cc66;">=</span> feature<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\r</span>&quot;</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">else</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; current<span style="color: black;">&#91;</span>feature<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#93;</span> <span style="color: #66cc66;">=</span> feature<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span><br />
&nbsp; &nbsp; current<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;Read&quot;</span><span style="color: black;">&#93;</span> <span style="color: #66cc66;">=</span> <span style="color: #008000;">int</span><span style="color: black;">&#40;</span>speed_re.<span style="color: black;">findall</span><span style="color: black;">&#40;</span>current<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;Sequential Access - Read&quot;</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; current<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;Write&quot;</span><span style="color: black;">&#93;</span> <span style="color: #66cc66;">=</span> <span style="color: #008000;">int</span><span style="color: black;">&#40;</span>speed_re.<span style="color: black;">findall</span><span style="color: black;">&#40;</span>current<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;Sequential Access - Write&quot;</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; current<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;Capacity&quot;</span><span style="color: black;">&#93;</span> <span style="color: #66cc66;">=</span> <span style="color: #008000;">int</span><span style="color: black;">&#40;</span>capacity_re.<span style="color: black;">findall</span><span style="color: black;">&#40;</span>current<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;Capacity&quot;</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">for</span> feature <span style="color: #ff7700;font-weight:bold;">in</span> current.<span style="color: black;">keys</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> feature <span style="color: #ff7700;font-weight:bold;">not</span> <span style="color: #ff7700;font-weight:bold;">in</span> valid:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">del</span> current<span style="color: black;">&#91;</span>feature<span style="color: black;">&#93;</span><br />
&nbsp; &nbsp; current<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;Price&quot;</span><span style="color: black;">&#93;</span> <span style="color: #66cc66;">=</span> <span style="color: #008000;">float</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'.'</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>price_re.<span style="color: black;">findall</span><span style="color: black;">&#40;</span>item<span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; current<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;Item&quot;</span><span style="color: black;">&#93;</span> <span style="color: #66cc66;">=</span> <span style="color: #483d8b;">&quot;http://www.newegg.com/Product/Product.aspx?Item=%s&quot;</span> % <span style="color: black;">&#40;</span>current<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;Item&quot;</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; item_list.<span style="color: black;">append</span><span style="color: black;">&#40;</span>current<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; <br />
<span style="color: #008000;">sorted</span> <span style="color: #66cc66;">=</span> <span style="color: black;">&#123;</span><span style="color: black;">&#125;</span><br />
<span style="color: #ff7700;font-weight:bold;">for</span> item <span style="color: #ff7700;font-weight:bold;">in</span> item_list:<br />
&nbsp; &nbsp; ratio <span style="color: #66cc66;">=</span> <span style="color: black;">&#40;</span>item<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;Read&quot;</span><span style="color: black;">&#93;</span> * item<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;Write&quot;</span><span style="color: black;">&#93;</span> * item<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;Capacity&quot;</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span> / <span style="color: black;">&#40;</span>item<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;Price&quot;</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">sorted</span><span style="color: black;">&#91;</span>ratio<span style="color: black;">&#93;</span> <span style="color: #66cc66;">=</span> item<br />
&nbsp; &nbsp; <br />
sort_order <span style="color: #66cc66;">=</span> <span style="color: #008000;">sorted</span>.<span style="color: black;">keys</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
sort_order.<span style="color: black;">sort</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
sort_order.<span style="color: black;">reverse</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
<span style="color: #ff7700;font-weight:bold;">for</span> key <span style="color: #ff7700;font-weight:bold;">in</span> sort_order:<br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">#print '\t'.join(map(lambda x: str(x), sorted[key].keys()))</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\t</span>'</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span><span style="color: #008000;">map</span><span style="color: black;">&#40;</span><span style="color: #ff7700;font-weight:bold;">lambda</span> x: <span style="color: #008000;">str</span><span style="color: black;">&#40;</span>x<span style="color: black;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #008000;">sorted</span><span style="color: black;">&#91;</span>key<span style="color: black;">&#93;</span>.<span style="color: black;">values</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></div></td></tr></tbody></table></div>
<p>Now given that there is quite a lot of data to present and analyze all at once I've decided it would be easiest to just provide you with a pretty graph<sup>[<a href="http://www.bemasher.net/archives/836#footnote_6_836" id="identifier_6_836" class="footnote-link footnote-identifier-link" title="Scores have been normalized to 100%.">7</a>]</sup>:<br />
<center><img src="http://lh5.ggpht.com/_67X_BsG0Kiw/TGOKY0sqJKI/AAAAAAAAHyQ/nAVB8GIDJXQ/s800/Output.png"></img></center><br />
If you look closely at the scores of all the disks in the query, you'll notice that this is a noticeable gap between the top 3 and the rest. They are as follows:<br />
<center><br />
<table>
<tr>
<td>Manufacturer:</td>
<td>A-DATA</td>
<td>Patriot</td>
<td>G.Skill</td>
</tr>
<tr>
<td>Series:</td>
<td>S599</td>
<td>Inferno</td>
<td>Phoenix Series</td>
</tr>
<tr>
<td>Capacity:</td>
<td>128GB</td>
<td>120GB</td>
<td>120GB</td>
</tr>
<tr>
<td>Read:</td>
<td>280MB/s</td>
<td>285MB/s</td>
<td>285MB/s</td>
</tr>
<tr>
<td>Write:</td>
<td>270MB/s</td>
<td>275MB/s</td>
<td>275MB/s</td>
</tr>
<tr>
<td>Item:</td>
<td>N82E16820211471<sup>[<a href="http://www.bemasher.net/archives/836#footnote_7_836" id="identifier_7_836" class="footnote-link footnote-identifier-link" title="A-Data S599">8</a>]</sup></td>
<td>N82E16820220510<sup>[<a href="http://www.bemasher.net/archives/836#footnote_8_836" id="identifier_8_836" class="footnote-link footnote-identifier-link" title="Patriot Inferno">9</a>]</sup></td>
<td>N82E16820231372<sup>[<a href="http://www.bemasher.net/archives/836#footnote_9_836" id="identifier_9_836" class="footnote-link footnote-identifier-link" title="G.Skill Phoenix Series">10</a>]</sup></td>
</tr>
<tr>
<td>Price:</td>
<td>$295.99</td>
<td>$289.99</td>
<td>$299.00</td>
</tr>
</table>
<p></center><br />
I noticed that if you ignore capacity in the metric then the Patriot Inferno is the clear winner here. So as it turns out the Western Digital SiliconEdge I had selected when I first wrote the wishlist wasn't the best drive for my needs. But then I've always had a soft-spot for Western Digital. But now I'm convinced that the Patriot Inferno is the SSD I'll be getting unless by the time I get around to buying one there are better options<sup>[<a href="http://www.bemasher.net/archives/836#footnote_10_836" id="identifier_10_836" class="footnote-link footnote-identifier-link" title="Which there probably will be.">11</a>]</sup>.</p>
<ol class="footnotes"><li id="footnote_0_836" class="footnote">Nothing worth-while anyway</li><li id="footnote_1_836" class="footnote">See previous post: <a href="http://www.bemasher.net/archives/804">Wishlist</a>.</li><li id="footnote_2_836" class="footnote"><a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16820250002&#038;cm_re=Western_Digital_Silicon_Edge-_-20-250-002-_-Product">Western Digital SiliconEdge 128GB SSD</a></li><li id="footnote_3_836" class="footnote">Which no longer exists in it's original form.</li><li id="footnote_4_836" class="footnote">Which I was.</li><li id="footnote_5_836" class="footnote">Although we're excluding read//write speed difference.</li><li id="footnote_6_836" class="footnote">Scores have been normalized to 100%.</li><li id="footnote_7_836" class="footnote"><a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16820211471">A-Data S599</a></li><li id="footnote_8_836" class="footnote"><a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16820220510">Patriot Inferno</a></li><li id="footnote_9_836" class="footnote"><a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16820231372">G.Skill Phoenix Series</a></li><li id="footnote_10_836" class="footnote">Which there probably will be.</li></ol>]]></content:encoded>
			<wfw:commentRss>http://www.bemasher.net/archives/836/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wishlist</title>
		<link>http://www.bemasher.net/archives/804?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wishlist</link>
		<comments>http://www.bemasher.net/archives/804#comments</comments>
		<pubDate>Fri, 23 Jul 2010 03:11:14 +0000</pubDate>
		<dc:creator>bemasher</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[460]]></category>
		<category><![CDATA[920]]></category>
		<category><![CDATA[930]]></category>
		<category><![CDATA[Core i7]]></category>
		<category><![CDATA[Corsair]]></category>
		<category><![CDATA[DDR3]]></category>
		<category><![CDATA[Desktop]]></category>
		<category><![CDATA[G.SKILL]]></category>
		<category><![CDATA[GeForce]]></category>
		<category><![CDATA[GTX]]></category>
		<category><![CDATA[intel]]></category>
		<category><![CDATA[Newegg]]></category>
		<category><![CDATA[NVIDIA]]></category>
		<category><![CDATA[SSD]]></category>
		<category><![CDATA[Western Digital]]></category>
		<category><![CDATA[Wishlist]]></category>

		<guid isPermaLink="false">http://www.bemasher.net/?p=804</guid>
		<description><![CDATA[I've noticed recently that I tend to spend a lot of time shopping for things I can't afford when I don't have any excess income. I can't really tell if it's just because I'm bored a lot more often over the summer. Especially this one since I've been unemployed for the maojority of it so [...]]]></description>
			<content:encoded><![CDATA[<p>I've noticed recently that I tend to spend a lot of time shopping for things I can't afford when I don't have any excess income. I can't really tell if it's just because I'm bored a lot more often over the summer. Especially this one since I've been unemployed for the maojority of it so far<sup>[<a href="http://www.bemasher.net/archives/804#footnote_0_804" id="identifier_0_804" class="footnote-link footnote-identifier-link" title="I do have an interview coming up so wish me luck.">1</a>]</sup>.</p>
<p>As it stands there is a rather long list of things I intend on buying//upgrading//replacing in the future. First and foremost on this list is a new laptop since my current ASUS Eee-PC 1000H is driving me nuts. It's useful for... writing, and not even that sometimes. For the last year I've used it almost strictly for taking notes in class, which it does well enough. But using it for anything else is essentially impossible. I've found this to be even more true in the last few weeks since I've been spending every other weekend with my parents on their ranch or in Cheyenne. I've just been using it when I went since it's pretty impractical to take my desktop with me everytime. Especially considering a lot of the stuff I work on needs a decent amount of bandwidth and my parents' internet connection is satellite based on their ranch at least so it would be pointless to try and get any real work done.</p>
<p>I've essentially decided that my next laptop will be a 13" Macbook Pro. The main reason is that for the amount of money I intend on spending on a new laptop the Macbook Pro is far superior in both build quality and components to the equivelant Dell which is the manufacturer I've used for all my mobile computing needs until my netbook. Easy decision don't you think?</p>
<p>The next item on my list was building a new desktop. I only <strong>really</strong> need to replace the core components of my desktop since everything else is more or less in good working order. But that's boring so I've made an entire list of components including core and secondary components to build a new desktop, excluding optical drive and hard drives<sup>[<a href="http://www.bemasher.net/archives/804#footnote_1_804" id="identifier_1_804" class="footnote-link footnote-identifier-link" title="Again, excluding SSD from this list of parts I don&#039;t intend to buy.">2</a>]</sup></p>
<p>The first part I always start with when building a wishlist<sup>[<a href="http://www.bemasher.net/archives/804#footnote_2_804" id="identifier_2_804" class="footnote-link footnote-identifier-link" title="Always on Newegg.com, they&#039;re the de facto standard in online computer components.">3</a>]</sup> is the CPU and for this particular one it was a pretty simple choice. Intel's Core i7 series is pretty much the way to go when building a workstation. In this case there were only really two requirements I had for selecting the particular Core i7 I need for this build.</p>
<ul>
<li>$0 &lt; Price &lt; $500</li>
<li>Supports Triple Channel DDR3</li>
</ul>
<p>These requirements narrow down the selection to two processors.  The Core i7-920 and the Core i7-930. There are only two differences. The 930 is 2.8Ghz and the 920 is 2.66Ghz and the 930 is $10 cheaper than the 920, so it's pretty obvious which one is the one to go with.</p>
<p>Intel Core i7-930 Bloomfield 2.8Ghz LGA 1366 130W Quad-Core<br />
Model #: BX80601930<br />
Item #: <a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16819115225">N82E16819115225</a><br />
Price: $289.99</p>
<p>The second component I select after the CPU is the motherboard. Now this is where it gets tricky because the restrictions I use for selecting a motherboard have a lot less to do with technical capabilities than they do with reliability and proper functionality. This is where newegg becomes the right place to shop. Their product review system is by far the best in the online tech shopping world. I tend to score motherboards based on the number of reviews they receive and the score of the review. This is of course after I've removed motherboards incompatible with the other components I intend on using in the system.</p>
<ul>
<li>LGA 1366</li>
<li>Intel X58</li>
<li>Intel ICH10R</li>
<li>ATX form factor</li>
</ul>
<p>The motherboard that comes out on top after these restrictions is an EVGA board.</p>
<p>EVGA E758-TR Intel X58</p>
<p>http://www.newegg.com/Product/Product.aspx?Item=N82E16813188046</p>
<p>Model #: 132-BL-E758-TR<br />
Item #: <a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16813188046">N82E16813188046</a><br />
Price: $269.99 IMIR -$40.00: $229.99</p>
<p>Next up is system memory. This almost always follows from motherboard since some motherboards support odd RAM speeds and I tend to stick with standard speeds since they are a lot less prone to compatibility issues and just work. In this case the motherboard calls for DDR3 1333<sup>[<a href="http://www.bemasher.net/archives/804#footnote_3_804" id="identifier_3_804" class="footnote-link footnote-identifier-link" title="DDR3 SDRAM PC10666">4</a>]</sup>. I usually filter out for the specific kind of RAM I want which leaves me with a few dozen sets. Then I score based on CAS latency and price. I've used G.SKILL before and was pleased with it and in this case a G.SKILL set won on both price and CAS latency.</p>
<p>G.SKILL 3GB (3 x 1GB) DDR3 1333 (PC10666) Triple Channel<br />
Model #: F3-10666CL7T-3GBPK<br />
Item #: <a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16820231229">N82E16820231229</a><br />
Price: $84.99</p>
<p>Now you're probably thinking "Why does he only want 3GB that's puny!". There are some very good reasons for it. First of all I'm not really all that into 64-bit yet, I still have a few devices without 64-bit compatible drivers<sup>[<a href="http://www.bemasher.net/archives/804#footnote_4_804" id="identifier_4_804" class="footnote-link footnote-identifier-link" title="And will probably never be compatible for that matter.">5</a>]</sup>. For the most part 2GB of RAM has suited me just fine for nearly anything I've ever needed//wanted to do on my desktop until this point, why should I pile in twice or even three times that amount? Besides if I so desire I could just purchase a second set in the future. The only reason I might consider doing that is if I suddenly became obsessed with running a dozen virtual machines simultaneously<sup>[<a href="http://www.bemasher.net/archives/804#footnote_5_804" id="identifier_5_804" class="footnote-link footnote-identifier-link" title="Which I won&#039;t, so I won&#039;t.">6</a>]</sup>.</p>
<p>Next in line isn't exactly a component I <strong>need</strong> to buy, but I've been wanting to upgrade for a long time now and I figure a wishlist is the best place to do it. Ever since I saw an article on Gizmodo<sup>[<a href="http://www.bemasher.net/archives/804#footnote_6_804" id="identifier_6_804" class="footnote-link footnote-identifier-link" title="I think.">7</a>]</sup> about the new NVIDIA GeForce GTX 460 I've pretty much been set on that specific chipset. It was pretty easy to select a brand since they're all exactly the same price at this point and I only want the 768MB model. I've been wanting to do some CUDA development so here's my chance.</p>
<p>EVGA NVIDIA GeForce GTX 460 (Fermi) 768MB<br />
Model #: 768-P3-1360-TR<br />
Item #: <a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16814130562">N82E16814130562</a><br />
Price: $199.99</p>
<p>Another component I consider to be core but isn't necessarily a core component is the storage device used for the OS. In the past I've strictly used HDD's for my desktop. But since I installed a Patriot 32GB SSD in my laptop I've fallen in love with SSD's for the OS//Programs drive. You might hear people moan and complain about SSD's being disproportionatly priced based on their capacity. Well I've got news for you, you don't buy SSD's for capacity, you buy them for speed. Anyone reasonably knowledgeable about computer components and their functionality would know that. I'm not interested in price per GB as quite a lot of people might be, at least not for SSD's<sup>[<a href="http://www.bemasher.net/archives/804#footnote_7_804" id="identifier_7_804" class="footnote-link footnote-identifier-link" title="The only component I consider price per GB on is standard HDD&#039;s.">8</a>]</sup>. I'm a lot more interested in price per MB/s sequential read-write. The particular disk that won in this case is one of the new Western Digital SSD's.</p>
<p>Western Digital SiliconEdge Blue 128GB SSD MLC 220/170 SR/SW<br />
Model #: SSC-D0128SC-2100<br />
Item #: <a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16820250002">N82E16820250002</a><br />
Price: $199.99</p>
<p>In case the title of that product doesn't make sense the drive is 220MB/s Sequential Read and 170MB/s Sequential Write.</p>
<p>Everything from this point on I consider to be secondary components as they don't directly do any computation or data transfer//storage.</p>
<p>For this build I've decided that even though I don't <strong>need</strong> to get a new case, I've added one to the list anyway since my current case is due for an upgrade, especially in regards to aesthetics. I've been oggling this particular case for quite a while now, since it replaced it's predecessor at least. This case won by a long shot in aesthetics and functionality.</p>
<p>Antec P183 Black Aluminum/Steel ATX-Mid<br />
Model #: P183<br />
Item #: <a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16811129061">N82E16811129061</a><br />
Price: $179.99 IMIR -$25.00: $154.99</p>
<p>The next item due for an upgrade was actually necessary considering the major increase in power needs for the core components. I've always hated shopping for power supplies because there are far more factors to consider when it comes to selecting one that matches your needs and is of reasonable build quality. If you don't have a decent power supply you may as well just give up. In this case I stuck as close as possible to the power supply I have now. I was only really interested in making sure that there were enough PCI-e power connectors since my current PSU has none. I let the reviews do the majority of selecting for me in this case.</p>
<p>Corsair 650W (ATX|EPS)12V<br />
Model #: CMPSU-650TX<br />
Item #: <a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16817139005">N82E16817139005</a><br />
Price: $119.99 IMIR -$30.00: $89.99</p>
<p>This power supply matched most closely to the one I had now, it's simple, doesn't have too many "certifications" and marketing nonsense tacked onto the name and the cables are sheathed in black mesh<sup>[<a href="http://www.bemasher.net/archives/804#footnote_8_804" id="identifier_8_804" class="footnote-link footnote-identifier-link" title="Which lends nicely to aesthetics should I ever decide to show someone my desktop&#039;s inards.">9</a>]</sup>.</p>
<p>Now I don't normally bother with purchasing a 3rd party heatsink//cooling system for my CPU but in this case I had heard mention of a self-contained water cooling system with radiator, pump and CPU waterblock from Corsair. So I checked it out and I am impressed. Since it is self-contained it removes a lot of the frustration with resevoirs and replacing the coolant on a regular basis.</p>
<p>Corsair H50 CPU Cooler<br />
Model #: CWCH50-1<br />
Item #: <a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16835181010">N82E16835181010</a><br />
Price: $74.99</p>
<p>The last item in the list is more for interior neatness and organization. I've always hated just leaving components without a proper fastening inside the case. In this situation the SSD I select<sup>[<a href="http://www.bemasher.net/archives/804#footnote_9_804" id="identifier_9_804" class="footnote-link footnote-identifier-link" title="Like all SSD&#039;s.">10</a>]</sup> is 2.5" form factor, suitable for notebooks and less suitable for desktops. So I looked around for a set of 2.5" to 3.5" brackets to secure the drive in one of the HDD bays.</p>
<p>iStarUSA 2.5" to 3.5" HDD Bracket<br />
Model #: DIY-RP-HDD2.5<br />
Item #: <a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16816215157">N82E16816215157</a><br />
Price: $5.99</p>
<p>The subtotal for the build excluding shipping and including all instant mail in rebates comes out to $1330.91. Pretty good wouldn't you say? For a decently beefy workstation that would likely last me another 5-6 years before upgrading again. I'm currently on the 5th year since a major overhaul of my current system an Intel Core 2 Duo based rig.</p>
<ol class="footnotes"><li id="footnote_0_804" class="footnote">I do have an interview coming up so wish me luck.</li><li id="footnote_1_804" class="footnote">Again, excluding SSD from this list of parts I don't intend to buy.</li><li id="footnote_2_804" class="footnote">Always on Newegg.com, they're the de facto standard in online computer components.</li><li id="footnote_3_804" class="footnote">DDR3 SDRAM PC10666</li><li id="footnote_4_804" class="footnote">And will probably never be compatible for that matter.</li><li id="footnote_5_804" class="footnote">Which I won't, so I won't.</li><li id="footnote_6_804" class="footnote">I think.</li><li id="footnote_7_804" class="footnote">The only component I consider price per GB on is standard HDD's.</li><li id="footnote_8_804" class="footnote">Which lends nicely to aesthetics should I ever decide to show someone my desktop's inards.</li><li id="footnote_9_804" class="footnote">Like all SSD's.</li></ol>]]></content:encoded>
			<wfw:commentRss>http://www.bemasher.net/archives/804/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Open-Source Print Server</title>
		<link>http://www.bemasher.net/archives/765?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=open-source-print-server</link>
		<comments>http://www.bemasher.net/archives/765#comments</comments>
		<pubDate>Wed, 16 Jun 2010 05:27:15 +0000</pubDate>
		<dc:creator>bemasher</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[dd-wrt]]></category>
		<category><![CDATA[firmware]]></category>
		<category><![CDATA[Netgear]]></category>
		<category><![CDATA[Print Server]]></category>
		<category><![CDATA[Printer]]></category>
		<category><![CDATA[router]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[tomato]]></category>
		<category><![CDATA[TomatoUSB]]></category>
		<category><![CDATA[USB]]></category>
		<category><![CDATA[Wifi]]></category>
		<category><![CDATA[WNR3500L]]></category>

		<guid isPermaLink="false">http://www.bemasher.net/?p=765</guid>
		<description><![CDATA[One of the things I had always wanted to play with until I moved was a wireless router that was "deluxe" enough to have a USB port installed. Most of the time these sorts of routers expect that you're just going to plug an external hard drive into it and pretend like it's a full-fledged [...]]]></description>
			<content:encoded><![CDATA[<p>One of the things I had always wanted to play with until I moved was a wireless router that was "deluxe" enough to have a USB port installed.</p>
<p>Most of the time these sorts of routers expect that you're just going to plug an external hard drive into it and pretend like it's a full-fledged NAS becuase typically they manage to squeeze CIFS into the firmware that governs the router and for the most part this is good enough for the most basic of NAS needs. Except they tend to forget that throughput with such a simple processor is usually miserable. I've never actually tested any of this myself but all of the forums I've read on the subject seem to report that there is a throughput ceiling of around 5-6MB/s which is pretty bad.</p>
<p>The other purpose for the USB port that I bet people would get more use out of is the ability to use your router as a simple print server. The first reason this is a lot more practical is that nearly all consumer printers these days use USB for their interface. This means that essentially any printer that can be made to work for your current computer with USB can also be put behind a print server without too much trouble. The other way this is useful is for the growing number of laptops you'll find in any given household. Except for minority of people that do enough computer work that owning a desktop is a necessity most every house will mostly be comprised of laptops and all of them will likely communicate with Wifi.</p>
<p>Every time you need to print something from your laptop you'll have to take it back to wherever you've parked your printer and plug it in. But you'll also need to make sure that you plug it back into the same USB port you installed it with in the first place or your computer will go into full-retard mode and "Duhhh... new printer! I'll look for drivers for your awesome new printer."</p>
<p>Now you see where the real hassle is. But this is the point at which a lot of people go the wrong direction. The first thought a lot of people have<sup>[<a href="http://www.bemasher.net/archives/765#footnote_0_765" id="identifier_0_765" class="footnote-link footnote-identifier-link" title="If they&#039;re tech-savvy enough to realize that this is possible.">1</a>]</sup> is that they'll just solve this problem by throwing money at it which usually means shopping for and buying a printer with network capabilities built in.</p>
<p>The main problem with this is that, network attached printers are expensive, quite a lot more expensive than their non-network-aware brethren. The secondary problem is that a grand majority of home networks are made possible by DHCP<sup>[<a href="http://www.bemasher.net/archives/765#footnote_1_765" id="identifier_1_765" class="footnote-link footnote-identifier-link" title="Dynamic Host Configuration Protocol">2</a>]</sup> which divvies out IP addresses as devices connect to the network. This presents a problem when the main method for connecting to network attached printers involves knowing the printer's IP address, which can be problematic when your router arbitrarily hands out IP addresses on a regular basis. Every time the lease is up for your printer's IP address there is the possibility of that printer to get a new IP address which causes issues. So unless you are tech-savvy enough to setup static DHCP leases this will cause problems.</p>
<p>The next option for a lot of people is to shoehorn round peg into a square hole by buying a print server to make their current printer network friendly. See the above problem for why this isn't an optimal solution.</p>
<p>In comes the router with a USB port. I recently purchased a Netgear WNR3500L<sup>[<a href="http://www.bemasher.net/archives/765#footnote_2_765" id="identifier_2_765" class="footnote-link footnote-identifier-link" title="Netgear WNR3500L">3</a>]</sup> from newegg. If you're interested in my adventurous experience with installing Tomato on it see my previous<sup>[<a href="http://www.bemasher.net/archives/765#footnote_3_765" id="identifier_3_765" class="footnote-link footnote-identifier-link" title="3rd Party Router Firmware">4</a>]</sup> post about that.</p>
<p>Now you're probably wondering how on earth a router with a USB port is any better than a print server or a network attached printer. The reason it is better is that in typical household networks the router will have the same IP address no matter how you've got DHCP configured. For the most part your router lives at 192.168.1.1 or 192.168.0.1 and this will for most situations never change.</p>
<p>So given a router with a USB port and proper firmware to allow for print serving you can host your printer on your router which will almost always have the same IP address and you can do this all with one device instead of having to buy a separate device.</p>
<p>In my situation I got lucky. I bought the router originally only intending to install dd-wrt<sup>[<a href="http://www.bemasher.net/archives/765#footnote_4_765" id="identifier_4_765" class="footnote-link footnote-identifier-link" title="http://www.dd-wrt.com/">5</a>]</sup> on it. Later I found Tomato<sup>[<a href="http://www.bemasher.net/archives/765#footnote_5_765" id="identifier_5_765" class="footnote-link footnote-identifier-link" title="Tomato Firmware">6</a>]</sup> which looked like it would suit my needs a lot better than dd-wrt would. Except there was some initial stupidity on my part and eventually I got that all sorted out by installing a fork<sup>[<a href="http://www.bemasher.net/archives/765#footnote_6_765" id="identifier_6_765" class="footnote-link footnote-identifier-link" title="http://tomatousb.org/">7</a>]</sup> of the Tomato project which added USB support to Tomato.</p>
<p>For now the TomatoUSB fork only supports broadcom based routers like the original firmware but adds support for a few others which have USB ports. This is where I got lucky, I had never checked before I bought my router to see if it would be supported since I originally only intended on installing dd-wrt on it and it just happened to be supported.</p>
<p>Eventually I got around to unpacking my printer and decided to give it a try. While watching the USB section of the web interface of my router which at this point was running Tomato<sup>[<a href="http://www.bemasher.net/archives/765#footnote_7_765" id="identifier_7_765" class="footnote-link footnote-identifier-link" title="Which has in my opinion a much more beautiful interface that dd-wrt does.">8</a>]</sup>. I plugged in my printer's USB cable into my router and about 3 seconds later<sup>[<a href="http://www.bemasher.net/archives/765#footnote_8_765" id="identifier_8_765" class="footnote-link footnote-identifier-link" title="The default refresh time of pages that have dynamic content on Tomato.">9</a>]</sup> the printer showed up and it began serving the printer using raw data on port 9100 and with LPR<sup>[<a href="http://www.bemasher.net/archives/765#footnote_9_765" id="identifier_9_765" class="footnote-link footnote-identifier-link" title="Line Printer Remote">10</a>]</sup> queue lp0.</p>
<p>So that was easy... a little too easy. Lo' and behold, it was just that easy. All that was left to do was add the printer using a TCP/IP port with 192.168.1.1 as the address and use the driver that I had previously installed to use the printer via USB. That was pretty much all I had to do, it worked exactly as it was meant to the first time I tried it.</p>
<ol class="footnotes"><li id="footnote_0_765" class="footnote">If they're tech-savvy enough to realize that this is possible.</li><li id="footnote_1_765" class="footnote"><a href="http://en.wikipedia.org/wiki/DHCP">Dynamic Host Configuration Protocol</a></li><li id="footnote_2_765" class="footnote"><a href="http://www.netgear.com/Products/WirelessRouter/WirelessRoutersforWorkandPlay/WNR3500L.aspx">Netgear WNR3500L</a></li><li id="footnote_3_765" class="footnote"><a href="http://www.bemasher.net/archives/750">3rd Party Router Firmware</a></li><li id="footnote_4_765" class="footnote"><a href="http://www.dd-wrt.com/">http://www.dd-wrt.com/</a></li><li id="footnote_5_765" class="footnote"><a href="http://www.polarcloud.com/tomato">Tomato Firmware</a></li><li id="footnote_6_765" class="footnote"><a href="http://tomatousb.org/">http://tomatousb.org/</a></li><li id="footnote_7_765" class="footnote">Which has in my opinion a much more beautiful interface that dd-wrt does.</li><li id="footnote_8_765" class="footnote">The default refresh time of pages that have dynamic content on Tomato.</li><li id="footnote_9_765" class="footnote"><a href="http://en.wikipedia.org/wiki/Line_Printer_Remote">Line Printer Remote</a></li></ol>]]></content:encoded>
			<wfw:commentRss>http://www.bemasher.net/archives/765/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>3rd Party Router Firmware</title>
		<link>http://www.bemasher.net/archives/750?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=3rd-party-router-firmware</link>
		<comments>http://www.bemasher.net/archives/750#comments</comments>
		<pubDate>Tue, 08 Jun 2010 23:35:35 +0000</pubDate>
		<dc:creator>bemasher</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[3rd party]]></category>
		<category><![CDATA[broadcom]]></category>
		<category><![CDATA[dd-wrt]]></category>
		<category><![CDATA[firmware]]></category>
		<category><![CDATA[Netgear]]></category>
		<category><![CDATA[tomato]]></category>
		<category><![CDATA[WNR3500L]]></category>

		<guid isPermaLink="false">http://www.bemasher.net/archives/750</guid>
		<description><![CDATA[Until Monday I'm without any kind of proper internet connection which means until this point I've just been using my phone to browse the internet and chat with friends, which is frustrating to say the least. This prompted me to do a little more research on 3rd party firmware for wireless routers. The first project [...]]]></description>
			<content:encoded><![CDATA[<p>Until Monday I'm without any kind of proper internet connection which means until this point I've just been using my phone to browse the internet and chat with friends, which is frustrating to say the least. This prompted me to do a little more research on 3rd party firmware for wireless routers.</p>
<p>The first project that comes to mind is obviously DD-WRT<sup>[<a href="http://www.bemasher.net/archives/750#footnote_0_750" id="identifier_0_750" class="footnote-link footnote-identifier-link" title="DD-WRT Firmware">1</a>]</sup> the most popular and probably the most powerful of them all right out of the box.  Before I moved here I researched and purchased a new router to use at my new place. I stumbled upon a Netgear router which seemed to match all the features I needed at a reasonable price. I've never really been a huge fan of Netgear routers but I checked that it was compatible at least with DD-WRT before I bought it. The router I'm talking about is a Netgear WNR3500L<sup>[<a href="http://www.bemasher.net/archives/750#footnote_1_750" id="identifier_1_750" class="footnote-link footnote-identifier-link" title="Netgear WNR3500L">2</a>]</sup> which includes:</p>
<ul>
<li>802.11n WiFi</li>
<li>4x 10/100/1000 Ethernet ports</li>
<li>1x USB 2.0 port</li>
</ul>
<p>I think grand total it was ~$90<sup>[<a href="http://www.bemasher.net/archives/750#footnote_2_750" id="identifier_2_750" class="footnote-link footnote-identifier-link" title="Newegg.com: Netgear WNR3500L">3</a>]</sup>. Anyway first thing I did was install DD-WRT which is standard practice for me. Ran exactly as intended except when I tried to set it up to act as a wifi client which failed miserably, I never did figure out how to make it do what I wanted. Everything else worked as intended. But I recently discovered a new firmware I wanted to try, which was Tomato<sup>[<a href="http://www.bemasher.net/archives/750#footnote_3_750" id="identifier_3_750" class="footnote-link footnote-identifier-link" title="Tomato Firmware">4</a>]</sup> another open-source project like DD-WRT.</p>
<p>Tomato is essentially a watered down version of DD-WRT. I think the only useful feature it's missing that DD-WRT has is virtual wifi interfaces, but that's not such a big deal. On the other hand though Tomato has the most polished bandwidth monitoring features of any other project I've ever seen or used. DD-WRT has essentially the same feature but it's much weaker and not nearly as thought out and well designed as Tomato's is.</p>
<p>My main gripe with Tomato is it's lack of community support. DD-WRT is so popular that just about any router you can get your hands on has a forum post somewhere about someone's woes with installing something on it and getting it working the way they needed it. Tomato isn't quite the same way. Also it appears that Tomato mostly only supports broadcom chipsets which is what my new router has.</p>
<p>Well anyway I just decided to download the latest version and try it out. Bad idea. I hadn't really considered that putting firmware on it that doesn't support USB would brick it. Figured USB just wouldn't work, WRONG. Got the firmware uploaded and reset it nothing. Nothing at all. So first thing I did was look up instructions for uploading a new firmware (one that I knew worked) using tftp. No luck, the router responds to pings for about 2 seconds immediately after booting but then ceases to respond. This was a good sign at least, means some basic features were still working properly. Also discovered that because Windows 7 implements CTCP instead of a simpler TCP protocol this breaks most ability to upload new firmware via tftp. So I downloaded an atftp.deb for my linux box and that didn't work either.</p>
<p>Eventually I stumbled upon an article about using a USB-TTL cable to unbrick the router. This article was mostly useless because all they were doing was using a USB serial adapter and dissecting the cable to work with the serial connection on the routers board, which I could just as easily have done with my arduino. But hidden deep in the comments was a far simpler trick than that. Only thing I needed to buy was a torx screw driver set to get the thing open. I looked up the chip used for storing settings and found that there were two pins on it that could be shorted to erase nvram (the structure responsible for storing all the router's settings).</p>
<p>So I busted open the router and proceeded to power on the router while shorting the two pins. No effect. I tried powering it on and then shorting the pins. No effect. Finally I tried shorting the pins exactly when the router responded to pings during that 1-2 second window. Success!</p>
<p>Then I fired up tftp and uploaded a modified version of Tomato to support USB and vaula! Tomato works properly on my router now. As well as the wifi client mode and wifi bridge mode. Anyway that occupied  several hours of tinkering where I would have otherwise been bored out of my mind.</p>
<ol class="footnotes"><li id="footnote_0_750" class="footnote"><a href="http://www.dd-wrt.com/">DD-WRT Firmware</a></li><li id="footnote_1_750" class="footnote"><a href="http://kb.netgear.com/app/products/model/a_id/12150">Netgear WNR3500L</a></li><li id="footnote_2_750" class="footnote"><a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16833122334">Newegg.com: Netgear WNR3500L</a></li><li id="footnote_3_750" class="footnote"><a href="http://www.polarcloud.com/tomato">Tomato Firmware</a></li></ol>]]></content:encoded>
			<wfw:commentRss>http://www.bemasher.net/archives/750/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Analog Monitor Calibration</title>
		<link>http://www.bemasher.net/archives/726?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=analog-monitor-calibration</link>
		<comments>http://www.bemasher.net/archives/726#comments</comments>
		<pubDate>Tue, 04 May 2010 01:30:36 +0000</pubDate>
		<dc:creator>bemasher</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Analog]]></category>
		<category><![CDATA[Calibration]]></category>
		<category><![CDATA[DVI]]></category>
		<category><![CDATA[LCD]]></category>
		<category><![CDATA[lcdtest]]></category>
		<category><![CDATA[Monitor]]></category>
		<category><![CDATA[Pattern]]></category>
		<category><![CDATA[Test]]></category>
		<category><![CDATA[VGA]]></category>

		<guid isPermaLink="false">http://www.bemasher.net/?p=726</guid>
		<description><![CDATA[Many of you probably already are aware that LCD Monitors typically will come with an analog VGA port[1] but the typical way that LCD Monitors work is that they reference individual pixels to draw something where CRT's use a scanning electron beam to illuminate pixels. Because of the way this works LCD Monitors usually come [...]]]></description>
			<content:encoded><![CDATA[<p>Many of you probably already are aware that LCD Monitors typically will come with an analog VGA port<sup>[<a href="http://www.bemasher.net/archives/726#footnote_0_726" id="identifier_0_726" class="footnote-link footnote-identifier-link" title="[W: VGA_connector]">1</a>]</sup> but the typical way that LCD Monitors work is that they reference individual pixels to draw something where CRT's use a scanning electron beam to illuminate pixels. Because of the way this works LCD Monitors usually come with an "Auto" button or "Auto-calibrate" which will align the analog image to the displayable area of the monitor. But doing this with just any image won't always give you the sharpest alignment and calibration.</p>
<p>The method I've used for quite some time is a program that generates a black and white cross-hatch that basically makes a checkerboard of every single pixel on the screen. This makes it very easy for the auto-calibration feature of the monitor to almost exactly align the image to exact pixels. The program i use to do this is called lcdtest<sup>[<a href="http://www.bemasher.net/archives/726#footnote_1_726" id="identifier_1_726" class="footnote-link footnote-identifier-link" title="http://www.brouhaha.com/~eric/software/lcdtest/">2</a>]</sup>. There are even windows binaries<sup>[<a href="http://www.bemasher.net/archives/726#footnote_2_726" id="identifier_2_726" class="footnote-link footnote-identifier-link" title="http://code.google.com/p/lcdtest-win32/">3</a>]</sup> that can be found by digging through the page, I've provided a link in the footnotes to the page I usually get them from.</p>
<p>The program starts and immediately draws the test pattern on the entire screen. You'll want to press <em>w</em> to change the color to white on black. Then you'll want to press <em>x</em> to change the pattern to crosshatch. Then using the <em>-</em> key to zoom out until it looks nearly grey. This is a good point at which you can see how well your monitor is calibrated already. If it looks very grey this is a sign that the scanning frequencies may not be exact, you might also see waves where it's clear and areas where it is blurry, these will likely go away once we're done. At this point you should use the auto-calibration feature of your monitor to calibrate the display using the crosshatch being displayed.</p>
<p>For those of you running more than one monitor at a time, this program will only display the pattern on the primary monitor. But never fear, there is an easy fix. Using paint or paint.net or your favorite image editing program you can create an image of the test pattern and set it as the wallpaper for the other monitors and calibrate them as well. Using <em>Alt+PrtScn</em> to capture only the current application's area of the screen (the test pattern) and pasting into a new image you can then save the image as a <em>png</em><sup>[<a href="http://www.bemasher.net/archives/726#footnote_3_726" id="identifier_3_726" class="footnote-link footnote-identifier-link" title="[W: Portable_Network_Graphics]">4</a>]</sup> preferably as it will compress it losslessly.</p>
<p>Once you've saved the image simply set it as the wallpaper of your system and use tiling in the case that your other monitor is not the same dimensions as your primary monitor and then run the auto-calibration process on the remaining monitors. You'll find that this will significantly improve the quality of the image displayed on your monitors if they were improperly calibrated to begin with. But of course you could completely avoid this by switching to DVI<sup>[<a href="http://www.bemasher.net/archives/726#footnote_4_726" id="identifier_4_726" class="footnote-link footnote-identifier-link" title="[W: Digital_Visual_Interface]">5</a>]</sup></p>
<ol class="footnotes"><li id="footnote_0_726" class="footnote">[W: VGA_connector]</li><li id="footnote_1_726" class="footnote"><a href="http://www.brouhaha.com/~eric/software/lcdtest/">http://www.brouhaha.com/~eric/software/lcdtest/</a></li><li id="footnote_2_726" class="footnote"><a href="http://code.google.com/p/lcdtest-win32/">http://code.google.com/p/lcdtest-win32/</a></li><li id="footnote_3_726" class="footnote">[W: Portable_Network_Graphics]</li><li id="footnote_4_726" class="footnote">[W: Digital_Visual_Interface]</li></ol>]]></content:encoded>
			<wfw:commentRss>http://www.bemasher.net/archives/726/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DVD Ripping Made Easy</title>
		<link>http://www.bemasher.net/archives/707?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=dvd-ripping-made-easy</link>
		<comments>http://www.bemasher.net/archives/707#comments</comments>
		<pubDate>Fri, 09 Apr 2010 19:39:48 +0000</pubDate>
		<dc:creator>bemasher</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[constant quality]]></category>
		<category><![CDATA[decrypting]]></category>
		<category><![CDATA[decryptor]]></category>
		<category><![CDATA[dvd]]></category>
		<category><![CDATA[dvdfab]]></category>
		<category><![CDATA[handbrake]]></category>
		<category><![CDATA[high profile]]></category>
		<category><![CDATA[makemkv]]></category>
		<category><![CDATA[matroska]]></category>
		<category><![CDATA[mkv]]></category>
		<category><![CDATA[rip]]></category>
		<category><![CDATA[ripper]]></category>
		<category><![CDATA[ripping]]></category>

		<guid isPermaLink="false">http://www.bemasher.net/?p=707</guid>
		<description><![CDATA[Reading through my normal list of RSS feeds I stumbled upon a post claiming to have found some software that greatly simplifies the process of decrypting and ripping DVD's. And surprisingly for the most part they were right. The software in question is called MakeMKV[1]. The software seems to do a decent job of both [...]]]></description>
			<content:encoded><![CDATA[<p>Reading through my normal list of RSS feeds I stumbled upon a post claiming to have found some software that greatly simplifies the process of decrypting and ripping DVD's. And surprisingly for the most part they were right.</p>
<p>The software in question is called MakeMKV<sup>[<a href="http://www.bemasher.net/archives/707#footnote_0_707" id="identifier_0_707" class="footnote-link footnote-identifier-link" title="http://makemkv.com/">1</a>]</sup>. The software seems to do a decent job of both decrypting and ripping DVD's. Mind you this software is not meant for transcoding DVD video into a different format.</p>
<p>The software functions much like most DVD decrypting software does. DVDFab<sup>[<a href="http://www.bemasher.net/archives/707#footnote_1_707" id="identifier_1_707" class="footnote-link footnote-identifier-link" title="http://www.dvdfab.com/">2</a>]</sup> and DVD Decryptor<sup>[<a href="http://www.bemasher.net/archives/707#footnote_2_707" id="identifier_2_707" class="footnote-link footnote-identifier-link" title="http://www.dvddecrypter.org.uk/">3</a>]</sup> provide the same basic functions as MakeMKV with one major exception. Where both DVDFab Decryptor and DVD Decryptor will provide you with the ability to decrypt a DVD and dump it's contents to a directory, MakeMKV instead muxes all of the video, audio and subtitle streams into a single container instead of having several VOB files from the entire DVD. Each title on the disk is muxed into a single container, which really simplifies the process when backing up TV Seasons from DVD to your computer since each episode is typically it's own title.</p>
<p>All that is left to do once you've ripped to a Matroska<sup>[<a href="http://www.bemasher.net/archives/707#footnote_3_707" id="identifier_3_707" class="footnote-link footnote-identifier-link" title="Matroska">4</a>]</sup> container is either leave it by itself since it's a perfectly fine container and format (albiet nearly the same size as the original content) or transcode it into your favorite format//container. Typically when ripping DVD's I use Handbrake and encode the DVD using the High Profile preset which performs decombing and detelecine. The high profile preset is also uses constant quality encoding which seems to be the preferred method for encoding these days since it provides the best perceptible quality vs. compression ratio.</p>
<p>Now the first thing that bothered me about MakeMKV is the fact that the site specifically states that it is free for the beta. But when you read closer it does get better:</p>
<blockquote><p>Functionality to open DVD discs is free and will always stay free.</p></blockquote>
<p>So that's promising. At least if you're only interested in ripping DVD's and not Blu-Ray or HDDVD then you'll be golden with this software.</p>
<p>Overall I've decided to just stick with MakeMKV for all my decrypting//backup needs from now on since it seems to do as good of a job or better than any of the other DVD rippers on the market at the moment.</p>
<ol class="footnotes"><li id="footnote_0_707" class="footnote"><a href="http://makemkv.com/">http://makemkv.com/</a></li><li id="footnote_1_707" class="footnote"><a href="http://www.dvdfab.com/">http://www.dvdfab.com/</a></li><li id="footnote_2_707" class="footnote"><a href="http://www.dvddecrypter.org.uk/">http://www.dvddecrypter.org.uk/</a></li><li id="footnote_3_707" class="footnote"><a href="http://en.wikipedia.org/wiki/Matroska">Matroska</a></li></ol>]]></content:encoded>
			<wfw:commentRss>http://www.bemasher.net/archives/707/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

