<?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>ErrorOK</title>
	<atom:link href="http://blog.errorok.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.errorok.com</link>
	<description>A library of useless knowledge</description>
	<lastBuildDate>Mon, 08 Mar 2010 22:36:14 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Edmonton Tennis Courts</title>
		<link>http://blog.errorok.com/2010/03/08/160/</link>
		<comments>http://blog.errorok.com/2010/03/08/160/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 22:36:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[tennis]]></category>

		<guid isPermaLink="false">http://blog.errorok.com/?p=160</guid>
		<description><![CDATA[Just a quick posting that i had planned to do over a year ago.  Way back when i first got myself into tennis mode, I started scanning Edmonton for tennis courts.  I did the scanning on google maps, and my result was a pretty filled set of tennis courts in and around Edmonton. [...]]]></description>
			<content:encoded><![CDATA[<p>Just a quick posting that i had planned to do over a year ago.  Way back when i first got myself into tennis mode, I started scanning Edmonton for tennis courts.  I did the scanning on google maps, and my result was a pretty filled set of tennis courts in and around Edmonton.  And i mean PRETTY DAMN FILLED, as in, even private backyard courts are marked (sorry if this is your back yard court, i am just being complete).  While the private courts are probably not of any use, the public and semi-private ones might be.  So here is the map.  It is open for collaboration, so please do not vandalize it, and please contribute if you have anything new.</p>
<p><a href="http://maps.google.com/maps/ms?ie=UTF&#038;msa=0&#038;msid= 111280860624041810439.000435ccccd375c63c7c2">Edmonton and Area Tennis Courts</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.errorok.com/2010/03/08/160/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dealing with Return of Capital distributions</title>
		<link>http://blog.errorok.com/2010/03/08/198/</link>
		<comments>http://blog.errorok.com/2010/03/08/198/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 22:30:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Smith Manoeuvre]]></category>

		<guid isPermaLink="false">http://blog.errorok.com/?p=198</guid>
		<description><![CDATA[Return of Capital (or RoC) distributions are sometimes sold as tax free distributions.  This is true, but not without some hidden knowledge.  True, you do get the distribution tax free; but false, you WILL have to pay taxes on your investment.  RoC works like the following:
Invest $1000 in Stock A
We&#8217;ll assume for [...]]]></description>
			<content:encoded><![CDATA[<p>Return of Capital (or RoC) distributions are sometimes sold as tax free distributions.  This is true, but not without some hidden knowledge.  True, you do get the distribution tax free; but false, you WILL have to pay taxes on your investment.  RoC works like the following:</p>
<p>Invest $1000 in Stock A<br />
We&#8217;ll assume for simplicity, that the stock&#8217;s share price does not increase or decrease in value until the distribution date<br />
Stock A pays a distribution of 5% ($50), of which 100% is RoC.</p>
<p>That $50 is totally tax free! Why? well, because your cost base of your investment is now only $950.  That&#8217;s not to say you only have $950 invested, your book value is still $1000, but $50 of your original investment is returned to you as a distribution.  So what does this really mean? well, even though you have not made any money on your investment (share price remained the same), if you sold your investment at this share price, you would trigger capital gains since your investment &#8220;made&#8221; $50 (since your ACB is only $950).  Extrapolate this into the future and you will see that you eventually end up with an ACB of $0, which means that you will eventually have to pay capital gains taxes on 100% of your book value, that is you pay your book value at your marginal rate, YIKES!!!.</p>
<p>Ok, so you are probably wondering why in the world would you want something that returns RoC distributions?  well, in the proper investment vehicle, you will not have to deal with the capital gains, such as a TFSA or an RSP account.  I think RoC&#8217;s are useful for corporations, but i really can&#8217;t tell you why.  All you need to remember is that they can be dangerous because of their ACB adjusting properties.</p>
<p>To make things worse, if you are using borrowed money to invest (making your loan interest payments tax deductible), then any RoC distributions can wreak havoc on your loan&#8217;s tax deductibility.  This is because the amount of the RoC is &#8220;no longer invested&#8221; so you could not claim that your full loan amount is being invested to generate income.  There is a fix for this, and here it is.  You can either calculate the portion of your distribution that is RoC and simply re-invest that portion right away (thus keeping the loan fully invested).  Or you can alternatively capitalize your loan&#8217;s interest with RoC income, because your loan&#8217;s interest is still tax deductible if you use your loan to pay for your loan&#8217;s interest (hopefully that makes sense, if it doesn&#8217;t then don&#8217;t worry, it&#8217;s all good).</p>
<p>That last point is especially important for Smith Manoeuvre warriors, since you can take advantage of funds that have RoC in your SM account.  I really don&#8217;t suggest doing this on purpose unless there is a compelling reason.  In my case, the reason being that there are no Canadian dividend ETF&#8217;s that are fully tax efficient.  Best i could find was XDV and it still has a small RoC portion.  The fix isn&#8217;t cut and dry, but it is still fairly simple, just a few extra manual transactions.  Ideally, however, I would rather avoid RoC&#8217;s altogether.</p>
<p>p.s. Thanks to Frugal Trader over at <a href="http://www.milliondollarjourney.com/">Million Dollar Journey</a> for the insight into capitalizing the LoC interest.  I had originally just thought of re-investing, but capitalizing is much smarter since you can just re-borrow it again right away.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.errorok.com/2010/03/08/198/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Smith Manoeuvre Started</title>
		<link>http://blog.errorok.com/2010/03/08/195/</link>
		<comments>http://blog.errorok.com/2010/03/08/195/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 19:54:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Smith Manoeuvre]]></category>

		<guid isPermaLink="false">http://blog.errorok.com/?p=195</guid>
		<description><![CDATA[It took me a while to get going, but i have finally decided to get moving on my smith manoeuvre.  My SM is going to differ slightly from the standard approach, mostly due to my home equity still being relatively low (until i have my house re-appraised in the future).  How my SM [...]]]></description>
			<content:encoded><![CDATA[<p>It took me a while to get going, but i have finally decided to get moving on my smith manoeuvre.  My SM is going to differ slightly from the standard approach, mostly due to my home equity still being relatively low (until i have my house re-appraised in the future).  How my SM differs is that I will be doing, what i am going to call, a couch potato smith manoeuvre.  As you can probably guess, this is a combination of the couch potato portfolio and the smith manoeuvre.  Specifically, I will be investing in broad ETF&#8217;s that have historically high dividend distributions, as well as I will be investing in both US and CAD equities to keep the proper weightings.  This will result in my SM portfolio being slightly less tax efficient than the ideal SM strategy.  However, for the initial startup with my situation (low equity), it is not too much of a burden and definitely helps the process get moving.</p>
<p>So here is the run down on how i have everything set up.<br />
<strong>Smith Manoeuvre Account</strong> &#8211; <em>Questrade Non Registered Account</em></p>
<ul>
<li>PFF &#8211; iShares S&#038;P US Pref Stock Idx Fnd</li>
<li>IDV &#8211; iShares Dow Jones EPAC Sel Div Ind</li>
<li>XDV &#8211; iShares CDN DJ Canda Slct Dvdnd Indx Fnd</li>
</ul>
<p>I also have a TD self directed RSP account, which also holds IDV and PFF (RSP account is the most tax efficient for international equities).  And I plan to open another Questrade account (TFSA) that will hold XRB, XSB, and XRE.  The bonds and REITs are less important right now so it will likely be a few months before they finally get purchased.  The reason for this is because (like my RSP contributions) the funds must come from my after-tax income, since bonds are not very SM compatible and REIT distributions are RoC (which are also not compatible with a SM).</p>
<p>I am still quite young so my weightings have been set at 10% for Bonds and REITs, 20% for Canadian equities, 35% US equities, and 35% international equities.  RSP contributions are currently annual and just the US and international funds, but SM contributions will be more often and contribute to Canadian, US, and international funds.  SM contributions will occur once the HELOC reaches $1000 or higher (3 &#8211; 4 biweekly mortgage payments).</p>
<p>Beyond these 3 accounts, I also hold other equities (Canadian and US) which i won&#8217;t include in the weighting.  The main reason for this is that one is a GE stock purchase plan with my employer, and the other is ECA and CVE shares that i have owned for over two decades.  Since it would take years of US and international contributions to even reach my desired weighting with Canadian equities, they will remain outside of the weighting.  Additionally, since these are three funds only, and my goal is diversification, there is no point including such high contributions in the global weighting.  In time, I will cash in my ECA and CVE shares and use the money to pay down the principal on my mortgage.  I have to be careful though because it will trigger monumental capital gains (seriously, well over 500% gain on ACB), so I need to plan it carefully so i don&#8217;t generate a massive amount of taxes owed.  With the funds added to the HELOC (whatever i don&#8217;t set aside to pay for the capital gains) I would end up purchasing equities based on the weighting, so ECA and CVE would no longer be held.  Also, if i ever decide to part from my employer, I would most certainly sell my GE shares and use the income to purchase according to the weighting again.  Furthermore, the GE shares are no very tax efficient right now anyways, so I really have no motivation to continue holding them in their current account.</p>
<p>Finally, i created a somewhat complicated spreadsheet (on google docs) to help manage the constant balancing of the portfolio&#8217;s.  Once i have been using it for a bit i will post a template.  For the time being though, it may still have bugs so i don&#8217;t want to confuse anyone beyond the need with an unfinished project.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.errorok.com/2010/03/08/195/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrade rtorrent in karmic 9.10 THE EASY WAY</title>
		<link>http://blog.errorok.com/2010/02/26/191/</link>
		<comments>http://blog.errorok.com/2010/02/26/191/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 23:37:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[ppa]]></category>
		<category><![CDATA[rtorrent]]></category>
		<category><![CDATA[rutorrent]]></category>

		<guid isPermaLink="false">http://blog.errorok.com/?p=191</guid>
		<description><![CDATA[This is just a quick follow-up to my earlier post.  I now have the rtorrent package source up and running on my ppa.  So now you just need to do the following:

echo -e "deb http://ppa.launchpad.net/patricksissons/rtorrent/ubuntu karmic main \ndeb-src http://ppa.launchpad.net/patricksissons/rtorrent/ubuntu karmic main" &#124; sudo tee /etc/apt/sources.list.d/rtorrent.list &#038;&#038; sudo apt-get update &#038;&#038; sudo apt-get install [...]]]></description>
			<content:encoded><![CDATA[<p>This is just a quick follow-up to my earlier post.  I now have the rtorrent package source up and running on my ppa.  So now you just need to do the following:<br />
<code><br />
echo -e "deb http://ppa.launchpad.net/patricksissons/rtorrent/ubuntu karmic main \ndeb-src http://ppa.launchpad.net/patricksissons/rtorrent/ubuntu karmic main" | sudo tee /etc/apt/sources.list.d/rtorrent.list &#038;&#038; sudo apt-get update &#038;&#038; sudo apt-get install rtorrent<br />
</code></p>
<p>This will add my rtorrent ppa to your custom sources, update your source cache, then install the updated version of rtorrent (as well as libtorrent and xmlrpc).  Combine this with <a href="http://code.google.com/p/rutorrent/" target="_blank">rutorrent</a> and you have a pretty sweet headless torrent server.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.errorok.com/2010/02/26/191/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tracking IKS channels for FTA satellite</title>
		<link>http://blog.errorok.com/2010/02/25/189/</link>
		<comments>http://blog.errorok.com/2010/02/25/189/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 23:21:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[fta]]></category>
		<category><![CDATA[iks]]></category>
		<category><![CDATA[satellite]]></category>

		<guid isPermaLink="false">http://blog.errorok.com/2010/02/25/189/</guid>
		<description><![CDATA[I wanted to play around with some of my new work the last few days, so i decided to mash up one of my beta projects with a chance to learn the google visualization api.
My beta project was a research project on ruby, Hpricot, and XPath.  you can see the minimalist webpage for this [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to play around with some of my new work the last few days, so i decided to mash up one of my beta projects with a chance to learn the google visualization api.</p>
<p>My beta project was a research project on ruby, Hpricot, and XPath.  you can see the minimalist webpage for this project at <a href="http://llamabot.com/" target="_blank">http://llamabot.com/</a> and play around with it.  It is just a quick and easy way to scrape pages without having to know much of anything about the page structure.</p>
<p>This new mash-up combines the XPath for scraping various IKS channel counts with google&#8217;s dynamic data visualization widgets.  With the addition of a cron job, the web page is now fully automated.  While it currently has very little data, soon the data set will grow and this will become a useful method of determining which systems are better suited for different people.</p>
<p>Check out the results at <a href="http://fta.errorok.com/" target="_blank">http://fta.errorok.com/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.errorok.com/2010/02/25/189/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Launchpad PPA&#8217;s</title>
		<link>http://blog.errorok.com/2010/02/24/186/</link>
		<comments>http://blog.errorok.com/2010/02/24/186/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 21:02:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[launchpad]]></category>
		<category><![CDATA[packages]]></category>
		<category><![CDATA[ppa]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://blog.errorok.com/?p=186</guid>
		<description><![CDATA[So after discovering that my quick and dirty rtorrent fix didn&#8217;t actually fix what i needed it to (xmlrpc stuff, specifically), I decided to instead look into setting up a ppa on launchpad to host some of my custom packages.  So here is a quick guide on how to do this:
first, some things you [...]]]></description>
			<content:encoded><![CDATA[<p>So after discovering that my quick and dirty rtorrent fix didn&#8217;t actually fix what i needed it to (xmlrpc stuff, specifically), I decided to instead look into setting up a ppa on launchpad to host some of my custom packages.  So here is a quick guide on how to do this:</p>
<p>first, some things you will need to install:<br />
<code>sudo apt-get install dput devscripts</code><br />
of course, you&#8217;ll need some of the usual stuff like build-essentials and other common dev packages.  dput is used to upload your source packages to your ppa, and devscripts contains some useful debian package scripts, such as debuild which is used to build your package.</p>
<p>now, create a gpg key for your ppa (or use an existing one if you have one)<br />
simply use gpg &#8211;gen-key to generate a key (use the defaults, unless you want to get more specific)<br />
if you already have a set of keys on another machine, you can export/import the public and private keys to your other machine.  If you get into trouble with not enough entropy (happens when your compile machine is headless and you do everything through ssh), then try installing rng-tools and set your device to /dev/urandom (in /etc/default/rng-tools) then start the service.  This will generate entropy for you.</p>
<p>Now setup your own ppa.  First you&#8217;ll need a launchpad account, then you just need to authenticate yourself and create a new ppa.  I won&#8217;t detail this process, but you can probably get a good idea from here: http://blog.launchpad.net/ppa/personal-package-archives-for-everyone</p>
<p>Now grab your source package as well as its build dependencies:<br />
<code>sudo apt-get build-dep PACKAGE<br />
apt-get source PACKAGE</code><br />
note that you don&#8217;t need to sudo when getting package sources.  If you are upgrading the package using the latest version, things can get a little wonky because ubuntu packages are usually customized with patches, and these patches often don&#8217;t work with bleeding edge source.  None the less you can give it a shot, simply grab the source for your package (not through apt, but from svn, git, http, etc&#8230;) and then copy the debian directory from the ubuntu source directory to your newer source directory.  You will need to modify the changelog and create a new entry for your package (with an updated version).  Alternatively, you can use dch to do this.  Once you have your source set up, you have to build the source package.  I recommend building the binary first, but this is not necessary, it just helps to for testing installation of the package and other things.  to build the source package:<br />
<code>debuild -S -sa</code><br />
this will generate a source package in the parent directory.  Once this finishes, you can upload it to you ppa.</p>
<p>to upload your package to your ppa, just run:<br />
<code>dput PPA PACKAGE_source.changes</code><br />
PPA will be something like ppa:USER_NAME/PPA_NAME<br />
the changes file will have been created as a part of the source package creation.<br />
this will ask you to enter your gpg password, and then upload the files to the launchpad servers.  In a few minutes your package will be built and you&#8217;ll get a notice saying it was successful or not.</p>
<p>Caveats!  They exist!  some things i have found which are slightly annoying are the following:<br />
you cannot re-upload (re-build) a package.  This is useful if you have a dependency issue, the only fix is to increment the version and re-upload (please correct me if there is a better solution).<br />
deleting packages is not very clear what happens, a deleted package still exists for quite some time on the server.  There appears to be no notice of a package being purged, it just randomly stops existing.</p>
<p>p.s. updated rtorrent ppa will come soon, if you really want to get it now, you can use this package source:<br />
<em>deb http://ppa.launchpad.net/patricksissons/pjs/ubuntu karmic main</em><br />
this is my development ppa, so it may contain things you don&#8217;t actually want to install.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.errorok.com/2010/02/24/186/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrade rtorrent in karmic 9.10</title>
		<link>http://blog.errorok.com/2010/02/07/182/</link>
		<comments>http://blog.errorok.com/2010/02/07/182/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 02:53:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[karmic]]></category>
		<category><![CDATA[rtorrent]]></category>

		<guid isPermaLink="false">http://blog.errorok.com/?p=182</guid>
		<description><![CDATA[here is a quick and easy way to upgrade to the latest rtorrent on karmic.  Basically we just snag it from lucid.
There are two basic methods to do this, the easiest is debatable between the two.  Personally, i just tried method one, but i&#8217;m sure method two would work just as well.
Method 1:

head [...]]]></description>
			<content:encoded><![CDATA[<p>here is a quick and easy way to upgrade to the latest rtorrent on karmic.  Basically we just snag it from lucid.</p>
<p>There are two basic methods to do this, the easiest is debatable between the two.  Personally, i just tried method one, but i&#8217;m sure method two would work just as well.</p>
<p>Method 1:</p>
<ol>
<li>head to <a href="http://packages.ubuntu.com/lucid/rtorrent" target="_blank">http://packages.ubuntu.com/lucid/rtorrent</a></li>
<li>download the deb for your architecture</li>
<li>download the deb for each of the following dependent packages:
<ol>
<li>libssl</li>
<li>librtorrent</li>
<li>libxmlrpc</li>
<li>libxmlrpc-core</li>
</ol>
</li>
<li>install each of the packages by running <tt>sudo dpkg -i *.deb</tt></li>
</ol>
<p>Method 2:</p>
<p>update your apt sources to lucid, do an apt update and then install rtorrent.  This should get the lucid packages and dependents.  Just remember to revert your changes to the apt source.</p>
<p>Like i said, i did method one, mostly because i was curious which packages i would need to backport to get rtorrent upgraded to version 0.8.6.  If you are curious why one might do this, it is because there are significant changes made to libtorrent and rtorrent, and this is an easy way to get access to them.</p>
<p>There may be some remaining issues to deal with regarding libxmlrpc, this is something i will look into once i have had a chance to work with this new version of rtorrent.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.errorok.com/2010/02/07/182/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making Google Chrome Work With a SOCKS5 proxy (i.e. putty ssh tunnel)</title>
		<link>http://blog.errorok.com/2009/12/21/175/</link>
		<comments>http://blog.errorok.com/2009/12/21/175/#comments</comments>
		<pubDate>Mon, 21 Dec 2009 19:00:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Software Developement]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[pac]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[socks5]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[ssh tunnel]]></category>
		<category><![CDATA[tunnel]]></category>

		<guid isPermaLink="false">http://blog.errorok.com/?p=175</guid>
		<description><![CDATA[Get chrome to work with your SSH tunnel proxy so you can surf those sites that your corporate proxy blocks!]]></description>
			<content:encoded><![CDATA[<p>I really like chrome, but something that is an absolute must is a SOCKS5 proxy.  This is due to my ultra restrictive corporate firewall, i need to tunnel http content through an ssh tunnel.  And ssh creates a SOCKS5 proxy when you use the -D option.  Chrome seems like it assumes that your proxy is SOCKS4.x and just fails on the ssh tunnel proxy.  But there is hope, i found a way to work around this and it isn&#8217;t even complicated!</p>
<p>Just a quick note, i actually use a plugin from chrome called <a href="http://www.samabox.com/projects/chrome/switchy/" target="_blank">Switchy!</a> which helps me quickly switch to and from the ssh tunnel proxy.  It is certainly no <a href="http://foxyproxy.mozdev.org/" target="_blank">foxyproxy</a>, but it works well enough that i can use it to solve most proxy related problems.</p>
<p>Now, the secret to this solution is to use Proxy Auto Configuration scripts.  These scripts allow you to specify which version of SOCKS to use for your proxy.  So all you need to do is create a file somewhere on your computer (say called pac-ssh-tunnel.pac) and then add the following to it:</p>
<pre>function FindProxyForURL(url, host)
{
   return "SOCKS5 localhost:8080";
}</pre>
<p>Now, take note that i am creating the ssh tunnel proxy using the following command:</p>
<pre>ssh -N -g -D 8080 username@remote_server</pre>
<p>Just FYI, &#8220;-N&#8221; means don&#8217;t execute any commands on the server (i.e. strictly a tunnel connection only).  And &#8220;-g&#8221; allows the remote host to connect to locally forwarded ports (which i must admit, most people will never need this, but handy if you do complex tunneling of data).   Finally, &#8220;-D 8080&#8243; means dynamically forward the proxy data through local port 8080.</p>
<p>So once you have your SSH SOCKS5 tunnel up and running, set chrome to use your proxy automatic configuration script that you created (either through chrome&#8217;s options, or through Switchy! if you prefer).  Now you can proxy traffic over your ssh tunnel.</p>
<p>One final note, PAC files are basically javascript files (with a few built-in functions).  You can actually create some complicated PAC files that do all your complex proxy selection for you (basically a lot of regular expression matching).  So if you get adventurous, you can just add all your proxy selection logic to that one function (or break it into multiple functions) and then you won&#8217;t even need to change your proxy around ever!</p>
<p>Happy surfing!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.errorok.com/2009/12/21/175/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>A quick guide to getting Hpricot to work for you</title>
		<link>http://blog.errorok.com/2009/09/28/173/</link>
		<comments>http://blog.errorok.com/2009/09/28/173/#comments</comments>
		<pubDate>Mon, 28 Sep 2009 22:43:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Software Developement]]></category>
		<category><![CDATA[hpricot]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[scraper]]></category>
		<category><![CDATA[xpath]]></category>

		<guid isPermaLink="false">http://blog.errorok.com/?p=173</guid>
		<description><![CDATA[use hpricot to search for text, then automatically build a list of xpath queries based on the results.]]></description>
			<content:encoded><![CDATA[<p>Hpricot is a cool tool for ruby that performs fast and efficient web page scraping by leveraging the DOM in a web page and the power of XPath.  The DOM is just a tree structure (defined in the HTML code), and XPath lets you query this this tree structure as if it were XML.  (Recall that most web pages are now XHTML compliant).</p>
<p>The problem with Hpricot is that XPath is not all that fun to work with.  But there are some things you can do to make things easier on yourself.  For one, there are several tools out there than will help you get the explicit (absolute) xpath for any element in the DOM (firebug extension for firefox comes to mind).  Something to note when taking this approach is that the xpath query is not always reliable; some browsers interpret HTML differently.  In the case of firefox, i was finding that firefox would transparently insert &lt;tbody&gt; tags under &lt;table&gt; tags in the DOM tree, even though they were not in the HTML code.Then there is MY solution, make Hpricot work for you.  Hpricot has the ability to build your query string for you.  The steps are as follows:</p>
<ol>
<li>first search for the DOM node</li>
<li>reverse-generate the xpath query string</li>
</ol>
<p>To find the DOM node, you will need to use the following query string:</p>
<p>//text()[text()*='text to search for']</p>
<p>The above query string will locate any nodes that contain the text &#8220;text to search for&#8221; somewhere.  If you want to search for an exact match, remove the asterix from the query.  this query will return a list of element nodes, from which you can request the node&#8217;s xpath.  That&#8217;s it.  Here is some basic ruby code to get the job done.</p>
<pre>require 'rubygems'
require 'hpricot'
require 'open-uri'

uri = 'http://www.google.ca/'
query = "//text()[text()*='more']"
doc = Hpricot(open(uri))

doc.search(query).each do |row|
    # print our xquery
    puts "[#{row.xpath}] =&gt; "
    # print the row data
    puts "#{row.to_html}\n"
end</pre>
<p>This will print out a list of DOM tree node&#8217;s that contain the text your searching for and the XPath query it takes to get to each one specifically.  Happy scraping!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.errorok.com/2009/09/28/173/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Yakuake For Windows</title>
		<link>http://blog.errorok.com/2009/05/26/168/</link>
		<comments>http://blog.errorok.com/2009/05/26/168/#comments</comments>
		<pubDate>Tue, 26 May 2009 21:14:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Software Developement]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[yakuake]]></category>

		<guid isPermaLink="false">http://blog.errorok.com/?p=168</guid>
		<description><![CDATA[A yakuake-like solution for windows]]></description>
			<content:encoded><![CDATA[<p>I know a lot of people will be searching for this title, so hopefully google directs them here so that they can quickly apply this solution to their &#8220;problem&#8221;</p>
<p>First off, this is <strong>*NOT*</strong> an actual version of yakuake for windows, for that you will have to wait for the required KDE libraries to be ported to windows, and then likely some yakuake adjustments.  It is coming, but i have no idea what the time frame is, it may be a while and my solution is ready, working, and available now.</p>
<p>The solution i have come up with comes from reading another blog, and although i am partially stealing what he has done (at least i give him credit for figuring most of this stuff out), there are a few things that make my solution a little better.  The original article can be found <a href="http://mcinroy.org/2008/03/11/drop-down-quake-style-command-terminal-for-windows/" target="_blank">HERE</a>, and i suggest you read it for extra information if you want to know how i began figuring t his out.  The original solution uses an older version of console, and does not provide the source for the AutoHotkey source (which can be useful if you want to customize further, like a custom installation path).</p>
<p>Now onto my solution. There are three parts to the solution, AutoHotkey + Console2 + Cygwin.  Cygwin is not necessary if you don&#8217;t want it, but i recommend it for any terminal like scripting.</p>
<p>We start off with the <a href="http://www.autohotkey.com/" target="_blank">AutoHotkey</a> program.  This program basically allows you to add global hotkey scripts to your windows OS by running a script that you compile into a daemon-like program.  The file included in this zip file (*.ahk) is the source for this script, and you can modify it to your liking if you don&#8217;t like how i did it.  Basically, the script will try and activate the console window if it is hidden and hide it if it is visible, if the console window doesn&#8217;t exist then a command is run (to start the console program).  Pretty simple stuff.  F12 key is the global hotkey assigned to this script.  If you want to make changes to the script, you will have to grab the installer or the zip file from the <a href="http://www.autohotkey.com/download/" target="_blank">AutoHotkey Downloads page</a> and recompile your changes with the included compiler.  The included compiled hotkey program is called CygTERM.exe and it runs in the background so you will need to use taskmanager to kill it (if necessary).</p>
<p>Next up is <a href="http://sourceforge.net/projects/console" target="_blank">Console2</a>.  Not much to say about this other than it is a pretty decent tabbed console.  It has a lot of features which offer a lot of customizability (something i was looking for).  The most important features i found were transparency, tabs, slab mode (no window decorations), and custom shell (cygwin&#8217;s bash instead of the default).  Basically this is configurable enough to be made into a nice yakuake style window (though no animations on show/hide, but who really wants that anyways!).  The config i provided is pretty good, but it is designed for a specific resolution, you can tweak it to your needs using the built-in configuration editor (use the right click menu).  Because the location of Console2 is compiled into the AutoH0tkey script, that means you will have to install this to C:\Program Files\Console2.  Alternatively you can recompile your custom location into a new hotkey program.</p>
<p>Finally, <a href="http://cygwin.com/" target="_blank">Cygwin</a>.  I am not going to explain cygwin beyond that it allows you to run posix programs in windows, most importantly the BASH shell.  BASH allows you to do complex scripting and can save you gratuitous amounts of time when doing any sort of text processing (among other things).</p>
<p>Combine all of these together and you have the basic workings of a windows version of yakuake.  Because of the way console2 works, you won&#8217;t be able to totally fill the desktop area with the terminal window, but you can come pretty close using the inside_border option.</p>
<p>Anyways, feel free to try this out at your leisure, i hope that it is everything that you need it to be until yakuake on kde4 is available on windows.</p>
<p>In case you have trouble figuring things out, here are the simple install instructions:</p>
<ol>
<li>Extract the <a href="http://blog.errorok.com/wp-content/uploads/2009/05/cygterm.zip" target="_self">zip archive</a> to C:\Program Files</li>
<li>Run C:\Program Files\Console2\CygTERM.exe</li>
<li>Hit F12</li>
<li>(Optionally) edit your Console2 configuration settings</li>
</ol>
<p>Here is an updated CygTERM.ahk file (the one you compile into CygTERM.exe).  This updated script will fix most of the focus bugs (if you have noticed any).  The focus bugs may occur with multi-monitor or multi-desktop (VirtuaWin) environments.</p>
<pre>#NoTrayIcon

F12::
DetectHiddenWindows, on

IfWinExist CygTERM
{
    IfWinActive CygTERM
    {
        WinHide, CygTERM
        DetectHiddenWindows, off
        Send !{Tab}
    }
    else
    {
        WinShow, CygTERM
        WinActivate CygTERM
    }
}
else
{
    Run C:\Program Files\Console2\Console.exe
    WinWait CygTERM
    WinActivate
}

return</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.errorok.com/2009/05/26/168/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.990 seconds -->
