<?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>Yak Shaving</title>
	<atom:link href="http://www.chrishannam.co.uk/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.chrishannam.co.uk</link>
	<description>just me</description>
	<lastBuildDate>Thu, 17 Sep 2009 15:28:52 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>WebDriver and Select Boxes</title>
		<link>http://www.chrishannam.co.uk/2009/09/webdriver-and-select-boxes/</link>
		<comments>http://www.chrishannam.co.uk/2009/09/webdriver-and-select-boxes/#comments</comments>
		<pubDate>Sun, 06 Sep 2009 20:24:59 +0000</pubDate>
		<dc:creator>channam</dc:creator>
				<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.chrishannam.co.uk/?p=258</guid>
		<description><![CDATA[This one had me puzzled for a while as I never took the time to sit down and read the documentation fully... I decided to look at this again after seeing the issue appear on the WebDriver mailing list. How to you use select and option html elements? Below is Python demo.
$ python
Python 2.6.2 (release26-maint, [...]]]></description>
			<content:encoded><![CDATA[<p>This one had me puzzled for a while as I never took the time to sit down and read the documentation fully... I decided to look at this again after seeing the issue appear on the WebDriver mailing list. How to you use select and option html elements? Below is Python demo.</p>
<pre class="python">$ python
Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
&gt;&gt;&gt; from webdriver_firefox.webdriver import FirefoxLauncher
&gt;&gt;&gt; from webdriver_firefox.webdriver import WebDriver
&gt;&gt;&gt; d = WebDriver()
&gt;&gt;&gt; d.get("http://cassandra.appspot.com/")
&gt;&gt;&gt; e = d.find_elements_by_xpath(
"/html/body/div[@id='container']/div[@id='search']/form[@id='searchForm']/div/select")
&gt;&gt;&gt; r = e[0]
&gt;&gt;&gt; t = r.find_elements_by_tag_name("option")
&gt;&gt;&gt; t
[&lt;webdriver_firefox.webelement.WebElement object at 0x8dd778c&gt;,
&lt;webdriver_firefox.webelement.WebElement object at 0x8dd772c&gt;,
&lt;webdriver_firefox.webelement.WebElement object at 0x8dd77ac&gt;,
&lt;webdriver_firefox.webelement.WebElement object at 0x8dd77ec&gt;]
&gt;&gt;&gt; for i in t:
...     print i.get_text()
...
Artist
Location
last.fm Username
Venue
&gt;&gt;&gt; t[2].set_selected()
&gt;&gt;&gt;</pre>
<p>Now in your WebDriver browser session the option box has changed to "last.fm Username". Excuse the variable names but I wanted to make a note before I lost the code.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrishannam.co.uk/2009/09/webdriver-and-select-boxes/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Speeding up the Web</title>
		<link>http://www.chrishannam.co.uk/2009/09/speeding-up-the-web/</link>
		<comments>http://www.chrishannam.co.uk/2009/09/speeding-up-the-web/#comments</comments>
		<pubDate>Sun, 06 Sep 2009 16:28:28 +0000</pubDate>
		<dc:creator>channam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.chrishannam.co.uk/?p=255</guid>
		<description><![CDATA[Might be old news and to be honest it should be if you do web development Speed. This page from Google contains lots of tips for speeding up web pages, lots of useful tips and worth at least one read.
]]></description>
			<content:encoded><![CDATA[<p>Might be old news and to be honest it should be if you do web development <a href="http://code.google.com/speed/articles/">Speed</a>. This page from Google contains lots of tips for speeding up web pages, lots of useful tips and worth at least one read.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrishannam.co.uk/2009/09/speeding-up-the-web/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Little Script to Check Twitter&#8217;s Status</title>
		<link>http://www.chrishannam.co.uk/2009/08/little-script-to-check-twitters-status/</link>
		<comments>http://www.chrishannam.co.uk/2009/08/little-script-to-check-twitters-status/#comments</comments>
		<pubDate>Sun, 09 Aug 2009 15:31:22 +0000</pubDate>
		<dc:creator>channam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.chrishannam.co.uk/?p=253</guid>
		<description><![CDATA[
#!/usr/bin/env python

from lxml import html

print "Starting..."

page = html.parse("http://www.pingdom.com/reports/vb1395a6sww3/check_overview/?name=twitter.com%2Fhome")

if page:
    try:
        t = page.xpath("/html/body/div[@id='content']/table[1]/tr[2]/td")
        status_icon = t[0].xpath("img/@src")[0]
        status = status_icon.split('_')[2].split('.')[0]
        date = t[1].text
   [...]]]></description>
			<content:encoded><![CDATA[<pre name="code" class="python">
#!/usr/bin/env python

from lxml import html

print "Starting..."

page = html.parse("http://www.pingdom.com/reports/vb1395a6sww3/check_overview/?name=twitter.com%2Fhome")

if page:
    try:
        t = page.xpath("/html/body/div[@id='content']/table[1]/tr[2]/td")
        status_icon = t[0].xpath("img/@src")[0]
        status = status_icon.split('_')[2].split('.')[0]
        date = t[1].text
        print "Twitter is %s! Checked at: %s Pacific Time (GMT - 8:00)" % (status, date)
    except:
        print "Unable to correctly verify Twitters status"
else:
    print "Can't access http://www.pingdom.com status page!"
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.chrishannam.co.uk/2009/08/little-script-to-check-twitters-status/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Conduit from SVN</title>
		<link>http://www.chrishannam.co.uk/2009/07/conduit-from-svn/</link>
		<comments>http://www.chrishannam.co.uk/2009/07/conduit-from-svn/#comments</comments>
		<pubDate>Sun, 19 Jul 2009 21:26:29 +0000</pubDate>
		<dc:creator>channam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.chrishannam.co.uk/2009/07/conduit-from-svn/</guid>
		<description><![CDATA[Installed in it from svn and kept getting:  ImportError: No module named conduit
Fixed it with a: sudo cp -r /usr/lib/python2.6/site-packages/conduit /usr/lib/python2.6/ after failing with ./autogen.sh --prefix /usr
]]></description>
			<content:encoded><![CDATA[<p>Installed in it from svn and kept getting:  ImportError: No module named conduit</p>
<p>Fixed it with a: sudo cp -r /usr/lib/python2.6/site-packages/conduit /usr/lib/python2.6/ after failing with ./autogen.sh --prefix /usr</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrishannam.co.uk/2009/07/conduit-from-svn/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get CouchDB up and running</title>
		<link>http://www.chrishannam.co.uk/2009/07/get-couchdb-up-and-running/</link>
		<comments>http://www.chrishannam.co.uk/2009/07/get-couchdb-up-and-running/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 11:01:39 +0000</pubDate>
		<dc:creator>channam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.chrishannam.co.uk/?p=250</guid>
		<description><![CDATA[run:
sudo apt-get install libcurl4-gnutls-dev libmozjs-dev libicu-dev erlang
This should be all you require to build and install apache-couchdb-0.9.0
]]></description>
			<content:encoded><![CDATA[<p>run:<br />
sudo apt-get install libcurl4-gnutls-dev libmozjs-dev libicu-dev erlang</p>
<p>This should be all you require to build and install apache-couchdb-0.9.0</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrishannam.co.uk/2009/07/get-couchdb-up-and-running/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Playing a DVD</title>
		<link>http://www.chrishannam.co.uk/2009/07/playing-a-dvd/</link>
		<comments>http://www.chrishannam.co.uk/2009/07/playing-a-dvd/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 22:49:52 +0000</pubDate>
		<dc:creator>channam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.chrishannam.co.uk/?p=248</guid>
		<description><![CDATA[A friend was getting the following error when playing some dvds:
[  172.864397] Buffer I/O error on device sr0, logical block 278
Following https://help.ubuntu.com/community/RestrictedFormats/PlayingDVDs solved it.
]]></description>
			<content:encoded><![CDATA[<p>A friend was getting the following error when playing some dvds:</p>
<p>[  172.864397] Buffer I/O error on device sr0, logical block 278</p>
<p>Following <a href="https://help.ubuntu.com/community/RestrictedFormats/PlayingDVDs">https://help.ubuntu.com/community/RestrictedFormats/PlayingDVDs</a> solved it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrishannam.co.uk/2009/07/playing-a-dvd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Contact API</title>
		<link>http://www.chrishannam.co.uk/2009/07/google-contact-api/</link>
		<comments>http://www.chrishannam.co.uk/2009/07/google-contact-api/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 20:06:03 +0000</pubDate>
		<dc:creator>channam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.chrishannam.co.uk/?p=239</guid>
		<description><![CDATA[This is more for me as a reminder.
To find the postal address from a gdata.contacts.ContactEntry use:

import atom
import gdata.contacts
import gdata.contacts.service
gd_client = gdata.contacts.service.ContactsService()
gd_client.email = 'jo@gmail.com'
gd_client.password = 'passdword'
gd_client.source = 'exampleCo-exampleApp-1'
gd_client.ProgrammaticLogin()
from lxml import etree
feed = gd_client.GetContactsFeed()
entry = feed.entry[0]
entry
entry.postal_address[0].text
'123 Fake Street'

Took me ages to figure that out...
]]></description>
			<content:encoded><![CDATA[<p>This is more for me as a reminder.</p>
<p>To find the postal address from a gdata.contacts.ContactEntry use:</p>
<pre name="code" class="python">
import atom
import gdata.contacts
import gdata.contacts.service
gd_client = gdata.contacts.service.ContactsService()
gd_client.email = 'jo@gmail.com'
gd_client.password = 'passdword'
gd_client.source = 'exampleCo-exampleApp-1'
gd_client.ProgrammaticLogin()
from lxml import etree
feed = gd_client.GetContactsFeed()
entry = feed.entry[0]
entry
entry.postal_address[0].text
'123 Fake Street'
</pre>
<p>Took me ages to figure that out...</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrishannam.co.uk/2009/07/google-contact-api/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Quick memcache demo for Python</title>
		<link>http://www.chrishannam.co.uk/2009/06/a-quick-memcache-demo-for-python/</link>
		<comments>http://www.chrishannam.co.uk/2009/06/a-quick-memcache-demo-for-python/#comments</comments>
		<pubDate>Sun, 21 Jun 2009 22:47:05 +0000</pubDate>
		<dc:creator>channam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.chrishannam.co.uk/?p=232</guid>
		<description><![CDATA[So you need to use memcache with Python? Below is a brief intro I figured out in about 20 mins.
First install everything you need. I run Ubuntu so python-memcached memcached packages were required.
Next start the memcached server if its not already running:

/usr/bin/memcached -m 64 -p 11211 -u nobody -l 127.0.0.1

The above gets you a 64Mb [...]]]></description>
			<content:encoded><![CDATA[<p>So you need to use memcache with Python? Below is a brief intro I figured out in about 20 mins.</p>
<p>First install everything you need. I run Ubuntu so<em> python-memcached memcached</em> packages were required.</p>
<p>Next start the memcached server if its not already running:</p>
<pre name="code" class="python">
/usr/bin/memcached -m 64 -p 11211 -u nobody -l 127.0.0.1
</pre>
<p>The above gets you a 64Mb server, more than enough to play on.</p>
<p>Next some python below is from the interpreter as I was in a hurry:</p>
<pre name="code" class="python">
import memcache
memc = memcache.Client(['127.0.0.1:11211'])
class test():
    def __init__(self):
        self.m = "Hello, world"

t = test()
memc.set('cheese', t, 120)
True
r = memc.get('cheese')
r.m
'Hello, world'
</pre>
<p>The above instantiates an object and then saves it memcached with set() and then we get it back using get(). Dead simple. The usage is pretty, try and fetch from memcached if if fails fetch from your datasource and then save that document ready for next time.</p>
<p>memc.set('cheese', t, 120) cheese is the reference, t is the object to store and 120 is the time to live. After 120 seconds the object is cleared from the cache.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrishannam.co.uk/2009/06/a-quick-memcache-demo-for-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WebDriver for logging into Twitter</title>
		<link>http://www.chrishannam.co.uk/2009/06/webdriver-for-logging-into-twitter/</link>
		<comments>http://www.chrishannam.co.uk/2009/06/webdriver-for-logging-into-twitter/#comments</comments>
		<pubDate>Sat, 20 Jun 2009 13:05:15 +0000</pubDate>
		<dc:creator>channam</dc:creator>
				<category><![CDATA[webdriver]]></category>

		<guid isPermaLink="false">http://www.chrishannam.co.uk/?p=224</guid>
		<description><![CDATA[No real reason for choosing Twitter apart from its cool  . 
The code below uses unittest to run. It creates a new WebDriver object and users it to fetch http://twitter.com and submit a username and password. Once the details are added it "clicks" the "Sign In" button to login into Twitter.

#!/usr/bin/env python

import unittest
import logging
from [...]]]></description>
			<content:encoded><![CDATA[<p>No real reason for choosing Twitter apart from its cool <img src='http://www.chrishannam.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . </p>
<p>The code below uses unittest to run. It creates a new WebDriver object and users it to fetch http://twitter.com and submit a username and password. Once the details are added it "clicks" the "Sign In" button to login into Twitter.</p>
<pre name="code" class="python">
#!/usr/bin/env python

import unittest
import logging
from webdriver_firefox.webdriver import FirefoxLauncher
from webdriver_firefox.webdriver import WebDriver

class TwitterTests (unittest.TestCase):

    def test_login_twitter(self):
        driver = WebDriver()
        driver.get("http://twitter.com")

        # find our elements - the html on the page with same ids
        username_element = driver.find_element_by_id('username')
        password_element = driver.find_element_by_id('password')

        # use this to toggle the remember me box
        remember_me_element = driver.find_element_by_id('remember')

        # type into the boxes
        username_element.send_keys('yourusername')
        password_element.send_keys('yourpassword')
        remember_me_element.toggle()

        # click Sign In and we should be logged in
        driver.find_element_by_id('signin_submit').click()

       # check that the title of the page is correct to see if we logged in
        self.assertEqual(driver.get_title(), 'Twitter / Home')

        # Extract from the html using xpath to find username and updates of the people on the screen
        updates = driver.find_elements_by_xpath("//span[@class='entry-content']");
        user = driver.find_elements_by_xpath("//a[@class='screen-name']");

        # display in the terminal the name and the update
        for i,update in enumerate(updates):
            print user[i].get_text() + ": " +update.get_text()

        # uncomment the following to close the window and finish
        #driver.quit()

if __name__ == "__main__":
    logging.basicConfig(level=logging.INFO)
    unittest.main()
</pre>
<p>The docs are not great for WebDriver but reading the source is pretty simple. Being able to mentally parse Java to Python is also a big advantage!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrishannam.co.uk/2009/06/webdriver-for-logging-into-twitter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Webdriver and Python Bindings</title>
		<link>http://www.chrishannam.co.uk/2009/06/webdriver-and-python-bindings/</link>
		<comments>http://www.chrishannam.co.uk/2009/06/webdriver-and-python-bindings/#comments</comments>
		<pubDate>Sat, 20 Jun 2009 12:51:08 +0000</pubDate>
		<dc:creator>channam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.chrishannam.co.uk/?p=221</guid>
		<description><![CDATA[I`m working on some WebDriver stuff and below is quick guide to get you started:

svn checkout http://webdriver.googlecode.com/svn/trunk/ webdriver
cd webdriver/
sudo python setup.py install

add the following to make sure you new libs can be found correctly

vi ~/.bashrc
export WEBDRIVER=/home/channam/Code/python/webdriver
. ~/.bashrc

and you are good to go.
]]></description>
			<content:encoded><![CDATA[<p>I`m working on some WebDriver stuff and below is quick guide to get you started:</p>
<pre name="code" class="python">
svn checkout http://webdriver.googlecode.com/svn/trunk/ webdriver
cd webdriver/
sudo python setup.py install
</pre>
<p>add the following to make sure you new libs can be found correctly</p>
<pre name="code" class="python">
vi ~/.bashrc
export WEBDRIVER=/home/channam/Code/python/webdriver
. ~/.bashrc
</pre>
<p>and you are good to go.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrishannam.co.uk/2009/06/webdriver-and-python-bindings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
