Upgrade rtorrent in karmic 9.10

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’m sure method two would work just as well.

Method 1:

  1. head to http://packages.ubuntu.com/lucid/rtorrent
  2. download the deb for your architecture
  3. download the deb for each of the following dependent packages:
    1. libssl
    2. librtorrent
    3. libxmlrpc
    4. libxmlrpc-core
  4. install each of the packages by running sudo dpkg -i *.deb

Method 2:

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.

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.

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.

Making Google Chrome Work With a SOCKS5 proxy (i.e. putty ssh tunnel)

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’t even complicated!

Just a quick note, i actually use a plugin from chrome called Switchy! which helps me quickly switch to and from the ssh tunnel proxy.  It is certainly no foxyproxy, but it works well enough that i can use it to solve most proxy related problems.

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:

function FindProxyForURL(url, host)
{
   return "SOCKS5 localhost:8080";
}

Now, take note that i am creating the ssh tunnel proxy using the following command:

ssh -N -g -D 8080 username@remote_server

Just FYI, “-N” means don’t execute any commands on the server (i.e. strictly a tunnel connection only).  And “-g” 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, “-D 8080″ means dynamically forward the proxy data through local port 8080.

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’s options, or through Switchy! if you prefer).  Now you can proxy traffic over your ssh tunnel.

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’t even need to change your proxy around ever!

Happy surfing!

A quick guide to getting Hpricot to work for you

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).

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 <tbody> tags under <table> 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:

  1. first search for the DOM node
  2. reverse-generate the xpath query string

To find the DOM node, you will need to use the following query string:

//text()[text()*='text to search for']

The above query string will locate any nodes that contain the text “text to search for” 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’s xpath.  That’s it.  Here is some basic ruby code to get the job done.

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}] => "
    # print the row data
    puts "#{row.to_html}\n"
end

This will print out a list of DOM tree node’s that contain the text your searching for and the XPath query it takes to get to each one specifically.  Happy scraping!

Yakuake For Windows

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 “problem”

First off, this is *NOT* 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.

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 HERE, 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).

Now onto my solution. There are three parts to the solution, AutoHotkey + Console2 + Cygwin.  Cygwin is not necessary if you don’t want it, but i recommend it for any terminal like scripting.

We start off with the AutoHotkey 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’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’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 AutoHotkey Downloads page 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).

Next up is Console2.  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’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.

Finally, Cygwin.  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).

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’t be able to totally fill the desktop area with the terminal window, but you can come pretty close using the inside_border option.

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.

In case you have trouble figuring things out, here are the simple install instructions:

  1. Extract the zip archive to C:\Program Files
  2. Run C:\Program Files\Console2\CygTERM.exe
  3. Hit F12
  4. (Optionally) edit your Console2 configuration settings

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.

#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

Oilers vs. Red Wings

Links:

Oilers vs. Blue Jackets

For some reason ATDHE.net is missing all hockey streams today, I hope this doesn’t mean no more hockey from them.

Links:

  • Yahoo Sports (not available in canada, you need to use Hotspot Shield)

The stressful days before the big day

So Monday is the day I head to the lawyer’s office to sign the final documents.  It is also where i spend the most money I have ever spent in one place.  So before Monday arrives, I need to get my finances in order.  Since my down payment is sitting in two different accounts, I was intending on writing two cheques, but for whatever reason it didn’t occur to me that I would need a bank draft and not a personal cheque.  This creates somewhat of a problem since PCF can’t really just print a bank draft for me.  So I went through some steps to see how I can transfer my funds from PCF to TD (where i CAN get a bank draft).  The trouble is how do I do this over the weekend.

The answer was actually to first transfer the funds from PCF savings (high interest) to the PCF chequings.  Now for those who don’t know much about PCF accounts, making changes with your high interest account does not happen instantly.  Rather, the changes appear the next business day.  So transferring the funds on Friday means i don’t actually have funds until Monday.  Cutting it close, but I’m used to cutting things close by now.  Now come Monday, I need to head over to TD and have the bank manager accept the cheque, call PCF and confirm the funds, then credit the account immediately with the funds.  This is instead of TD holding the cheque for X business days until the funds clear.  I don’t think TD will do this anytime you want, but for time critical situations it seems that they are very accomodating.

So, with Monday will come the end of the stress.  The last “cutting it close” item.  There is still moving day(s) but I am much less concerned about moving day since moving will be spread out across two days.

VOIP on the iPod Touch

VOIP on the touch was certainly possible back in the days of 1.1.x firmware. You simply had to order a touchmods mic (now apparently called mango mics) and grab the siphon software from Installer or Cydia and you were ready to go. There were even tricks to making free phone calls from your touch to land lines (insanity i tell you). I did this for a bit, until i lost my mic, then i found it again, but discovered that it was useless with the 2.x firmware. Tragic, i know.

Well never fear, now the touch is VOIP enabled once again (and has been since 2.2 came out), and I plan to cash in on this wonderful VOIPy goodness. Here are the deets:

  1. Grab a MacAlley iVoice III
  2. Grab Nimbuzz on your ipod (through the app store)

Here is a decent article on the whole process.

Oilers vs. Flames

I have a feeling the edmonton fans are getting restless, with every point counting, and losing the past two games we find ourselves dangling near the edge of defeat. Normally, playing a team ranked 3rd in the west should give us chills, but when we are playing our sworn enemies to the south at home, I have trouble imagining what a better time would be to break the losing streak. I’ll be at hudson’s having some beers and cheering the oil on. Make us proud.

Links:

Thoughts on what has happened these past few weeks

Just going through some news items that have passed through my feed reader that I found interesting.

  • I found a very interesting video on the Fibonacci Rule (for trading in gold apparently).  I have my doubts on how well this really works, but it’s worth investigating at the very least.  It looks like you need a Market Club account (which i will likely look into soon).  I am skeptical about such “unexplainable” strategies, but there are a lot of things that make no sense when it comes to number theory (take a look at the Golden Ratio).  Long story short, this is a strategy i have never heard of so I would be interested to find out more about it, and how those lines are calculated in the video (honestly, i can’t find any information this anywhere).
  • Here is an Article that lists those responsible (partially at least) for the economic turmoil.  My favorite part is “… and six more who saw it coming” section, which details the smart people who profited from the collapse.
  • For Smith Manoeuvre people, MDJ does a good summary of the Lipson Case.  This is useful since the Lipsons attempted a SM-like tax strategy, however a lot more complex, and apparently completely illegal (though not obviously illegal).
  • A nice article from Chris Davies on the employment stats for Canada as of January 2009.  Interesting to note that Alberta is relatively unaffected by the massive amount of job losses (relative to the other provinces of course).  Saskatchewan also appears to be doing rather well to weather the economic storm.  Chris also does us all a solid by providing his numbers to look at (and maybe doing something with them).
  • Canadian Mortgage News had a great post on the 30 day banker’s acceptance yield, something which i have never heard of.  Seems that variable rates are driven by this yield (which was at 0.90% a few weeks ago).  He mentions the spread (prime – BAY) is high at 2.10% compared to a 10 year average of 1.69%.  While a lower BAY means a higher spread, which usually means lower variable rates, we didn’t see any adjustments yet.  However, the BoC will likely cut interest rates on March 3rd which will translate into minor subtractions from the current prime rate (otherwise the spread gets unreasonably large).  As an added note, while BoC interest rate changes affect variable rates more directly, fixed rates are not really correlated with the prime rate.  Fixed rates are governed by bond rates, as 5 year bond rates go up, you will see fixed rates go down (vice versa applies as well).  Finally, the article lists some mortgage details, and comparing my own numbers it looks like i am getting what i should be, prime + 0.8%.
  • Canadian Capitalist describes in a post that you shouldn’t go out of your way to make use of the HRTC this year.  By that he means that you may have better options, such as mortgage pre-payments or RRSP contributions.  If you have money set aside for a reno project, then now may be a good time to use it, but don’t dip into your other funds just to do home renos for the tax credit.  Personally, i am torn because i don’t have a reno fund, but i do want to convert my newly acquired basement into a rent-able space to generate a new income stream.  To do this, I would have to defer prepayments (and possibly RRSP contributions).  However, the resulting income stream would be very helpful for mortgage payments.  Additionally, owning rented space is a tax deductible expense (utils + maintenance).  I am not entirely certain whether not the conversion expenses can be considered tax deductible though, i will have to enquire about this.
  • Another post on the Canadian Mortgage News blog, this time about the benefits of variable vs fixed rate mortgages.  Most people know that more often than not (in fact 77%-90% of the time) variable is better than fixed.  However, it is noted in the article that this may be one of those rare times where fixed is actually better (you know, that 10%-23%).  Honestly I think that the article has substantial truth.  So why am I still going with a variable rate?  Well the answer is that in recent years, it has become much easier to estimate when the BoC will raise the rates.  So i am best off to hang on to the variable rate (in case the rates drop, which they most likely will on march 3rd) and when economists suspect the BoC to raise rates, i will lock into a long fixed term.  Additionally, 5 year bond rates are quite low these days so waiting for the rates to raise before comitting means that I might be able to lock into a fixed term at an even lower rate than today.
  • A local post from the Edmonton Real Estate Blog on the weekly update last week shows that I have chosen a good time to buy (for the short time span analyzed).  Edmonton real estate numbers have returned to relatively normal numbers (whether or not this is sustainable who knows), and to make matters better the (inflated in my opinion) condo prices have dropped, while SFH prices are on the rise.
  • MDJ had a cool post on getting HDTV for free!  This interests me because i currently do not have a cable package.  However, since we don’t live near the US (where the digital channel OTA switch is happening right away) I will likely not receive anything.  But in the future, when Canada finally switches over there is a good chance that free HDTV is better quality that paid HDTV.  The catch is that you don’t get all the channels.
  • MDJ explains that QuickTax now lets you build your tax return for free, and then once you decide to file with QuickTax you are charged.  This is handy as you can see whether or not QuickTax is any good first before committing to purchase it.  I will definitely be trying this out in the coming weeks/months.
  • more from MDJ (i like his blog ok???), where Ed Rempel describes how to use this recession to your advantage.  Through a nice chart capturing 183 years of US stock market history, we can visualize why the stock market is a good long term investment.  Additionally, it is pointed out that even in some of the most dire market conditions (the recessions and the depressions) the market tends to bounce back quite rapidly.  Will we see a quick (by quick i mean 2 to 3 years) bounce back to high annual gains?  History says yes we will!
  • Canadian Mortgage News explains why waiting for better fixed rates makes no sense in this market.  If you refuse to make use of variable rate mortgages, then you might as well commit to the current rates available for fixed terms.  Contact a broker and have them hold a rate for you, you don’t have to use that rate, but you can if rates go up.  If they go down, you get a new guaranteed rate from your broker.  Honestly, I do think fixed rates will go down a little but not significantly, so unless you have time to waste while you look for your house, i suggest at least reserving a rate for yourself before March 3rd.
  • Finally, to further the previous article, CMN posts an article link that helps explain how fixed rates are calculated by the lenders (PDF).  Worth a read if you are interested.
Next Page »