<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Peter's Blog</title>
    <link>http://www.petersblog.org/</link>
    <description>Blatherings of the deranged</description>
    <item>
      <title>Humyo</title>
      <link>http://www.petersblog.org/node/view/2316</link>
      <description>&lt;p&gt;
Humyo online storage. 
&lt;/p&gt;
&lt;p&gt;
In a nutshell: 
&lt;/p&gt;
&lt;div class=&quot;picture&quot;&gt;&lt;div class=&quot;pictureframe&quot;&gt;&lt;a href=&quot;/pictures/0000/0220/Humyo.JPG&quot; rel=&quot;lightbox&quot; title=&quot;Humyo- WTF&quot;&gt;&lt;img alt=&quot;Humyo- WTF&quot; src=&quot;/pictures/0000/0220/Humyo_normal.JPG&quot;&gt;&lt;/a&gt;&lt;br/&gt;&lt;p&gt;Humyo- WTF&lt;/p&gt;&lt;/div&gt;&lt;/div&gt; 
&lt;p&gt;
Humyo is looking like a waste of space (100G of it) if it won't upload my files. 
&lt;/p&gt;
&lt;p&gt;
I'm not convinced it is useful: it uploads modified files immediately so presumably will instantly propogate cockups. Have to pay extra for multi-user account for snapshots which gives me less storage and a superfluous second user account. 
&lt;/p&gt;
&lt;p&gt;
The web site is nice but the excessive nagging to upgrade is a bit much. Careful where you click! 
&lt;/p&gt;
&lt;p&gt;
Running screaming back to Jungle Disk. 
&lt;/p&gt;&lt;p&gt;Related Posts: &lt;a href=&quot;/tag/crap&quot;&gt;crap&lt;/a&gt; &lt;a href=&quot;/tag/fail&quot;&gt;fail&lt;/a&gt;&lt;/p&gt;</description>
      <guid>http://www.petersblog.org/node/view/2316</guid>
      <pubDate>Thu, 24 Sep 2009 15:44:00 +0100</pubDate>
      <category domain="http://www.technorati.com/tag">crap</category>
      <category domain="http://www.technorati.com/tag">fail</category>
    </item>
    <item>
      <title>Raw and Unplugged</title>
      <link>http://www.petersblog.org/node/view/2315</link>
      <description>&lt;p&gt;
I decided I wanted an acoustic guitar for a few reasons: 
&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;
I play mostly pre-breakfast time with unplugged electric to avoid disturbing people. 
&lt;/li&gt;
&lt;li&gt;
the unplugged sound has grown on me 
&lt;/li&gt;
&lt;li&gt;
it is hassle hooking it up to an amp. Impromptu recitals/singsongs require setting up. 
&lt;/li&gt;
&lt;li&gt;
acoustic strings are heavier and hence would make my fingers stronger. 
&lt;/li&gt;&lt;/ul&gt;

&lt;p&gt;
I went into town on a mission to try a mid-range &#163;400 ish electro- acoustic, preferably not in a natural wood finish (too folky) and a smallish design, not a huge dreadnought/jumbo. 
&lt;/p&gt;
&lt;p&gt;
I found a second hand yamaha apx700 in very good condition (light scratches where pickguard ought to be) in beautiful deep shiny black (i.e it always needs polishing). It was a great price, about &#163;175 off Internet prices, enough to alleviate any guilt about buying a second guitar. 
&lt;/p&gt;
&lt;div class=&quot;picture&quot;&gt;&lt;div class=&quot;pictureframe&quot;&gt;&lt;a href=&quot;/pictures/0000/0217/photo.jpg&quot; rel=&quot;lightbox&quot; title=&quot;Raw and Unplugged&quot;&gt;&lt;img alt=&quot;Raw and Unplugged&quot; src=&quot;/pictures/0000/0217/photo_normal.jpg&quot;&gt;&lt;/a&gt;&lt;br/&gt;&lt;p&gt; &lt;/p&gt;&lt;/div&gt;&lt;/div&gt; 
&lt;p&gt;
It sounds amazing, it makes wonderful noise, especially when plugged into an amp, lovely full sound. Open chords are easy to play, barre chords are harder as it is very fussy about being fingered close to the frets. It's all good for technique though. 
&lt;/p&gt;
&lt;p&gt;
The neck is slightly slimmer than my electric Vintage V6. Another noticable difference to the V6 is that the strings are dead level and I can strum upwards! This never felt right on the V6 as the strings have individual height adjustment and came out of the box unlevelled which I assumed was how it was supposed to be. 
&lt;/p&gt;
&lt;p&gt;
The built quality is pretty much faultless. 
&lt;/p&gt;
&lt;p&gt;
The Yamaha can make a lot of noise, even unplugged. For my practise I have been concentrating on gentle arpeggios as they are good practise for forming chords (shows up mistakes). It only takes the lightest touch to pluck a string and I love the sound. 
&lt;/p&gt;
&lt;p&gt;
The guy in the shop gave me a free guitar bag and chucking it in the car was enough to knock a few strings out of tune. I used my iPhone app to tune it but it does have a built-in tuner which seems to work, although it needs guessword to determine how far out of tune it is, the iPhone app (guitar toolkit) has a meter. 
&lt;/p&gt;
&lt;p&gt;
I need to buy a guitar strap, one that is up to the good looks of the guitar. 
&lt;/p&gt;&lt;p&gt;Related Posts: &lt;a href=&quot;/tag/guitarhero&quot;&gt;guitarhero&lt;/a&gt;&lt;/p&gt;</description>
      <guid>http://www.petersblog.org/node/view/2315</guid>
      <pubDate>Sun, 30 Aug 2009 20:03:00 +0100</pubDate>
      <category domain="http://www.technorati.com/tag">guitarhero</category>
    </item>
    <item>
      <title>Rocking Progress</title>
      <link>http://www.petersblog.org/node/view/2314</link>
      <description>&lt;p&gt;
I bought a great guitar book called Fretboard Roadmaps that very succinctly provides a great insight into how a guitar fretboard is laid out. It describes chord progressions very well, explains the cicrle of fifths and has made it clear to me how to play the basic I- IV-V chord progression in any key. 
&lt;/p&gt;
&lt;p&gt;
The I-IV chord change is simply moving from an E shape barre chord to an A shape on the same fret (because the E and A strings are four notes apart! The same interval as I-IV). Then IV-V is just moving along two frets on the A string. Easy. Try working that out from a book of bald chord chards. 
&lt;/p&gt;
&lt;p&gt;
I can now do E and A barre chords, although I struggle with the B barre chord on the second fret (finger span not wide enought to fret properly) so I will have to settle for doing B with an E shape on the 7th fret. 
&lt;/p&gt;
&lt;p&gt;
It seems that while my little finger is a bit too weedy for four fret hammer-ons, my ring finger bends backwards in a way that means I can sound string 1 on my A shape barre chords. 
&lt;/p&gt;
&lt;p&gt;
Other signs of progress: 
&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;
I can play simple open chord progressions without looking at the fretboard (gasp). 
&lt;/li&gt;
&lt;li&gt;
I can work out simple chord progressions fir songs, e.g. Twinkle twinkle little star: no need for tabs! 
&lt;/li&gt;
&lt;li&gt;
can play 'Happy Birthday' with bluesy string bending! 
&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Related Posts: &lt;a href=&quot;/tag/guitarhero&quot;&gt;guitarhero&lt;/a&gt;&lt;/p&gt;</description>
      <guid>http://www.petersblog.org/node/view/2314</guid>
      <pubDate>Fri, 21 Aug 2009 20:45:52 +0100</pubDate>
      <category domain="http://www.technorati.com/tag">guitarhero</category>
    </item>
    <item>
      <title>Evernote(s)</title>
      <link>http://www.petersblog.org/node/view/2313</link>
      <description>&lt;p&gt;
I had a minor revelation in notetaking today: why not just web clip problems and solutions from web into my Evernote book? No need for me to type, just clip the forum post or whatever where someone describes my problem and then clip the best solution. Chuck it in Evernote and leave it for search to deal with. Et voil&#224;, a database of problems I had and how they were overcome. If there are no solutions out there, solve it myself (it can happen) and blog it. 
&lt;/p&gt;
&lt;p&gt;
I also figured out why Evernote web keeps asking for me to log in, I bookmarked http://evernote.com but http://www.evernote.com/Home.action?login=true#Thumbs   remembers me. 
&lt;/p&gt;
&lt;p&gt;
It turns out that Evernote has a nice iPhone web app, faster and more reliable than their native iPhone app. It is even possible to create a 'clip to evermote' bookmark and this works perfectly, even clipping selections. I created mine by making a bookmark on the iPhone and pasting the 'clip to evernote' link into the bookmark. 
&lt;/p&gt;
&lt;p&gt;
Since the iPhone app is slow to start up and hangs or crashes frequently, posting a quick note from the iPhone can be done in three ways: 
&lt;/p&gt;
&lt;ol&gt;&lt;li&gt;
via email (wish Evernote would delete auto-added sig) 
&lt;/li&gt;
&lt;li&gt;
quick note link on web app (hidden at bottom of list of posts but worth bookmarking) 
&lt;/li&gt;
&lt;li&gt;
clip to evernote has a notes box 
&lt;/li&gt;&lt;/ol&gt;

&lt;p&gt;
The search on the web app is fast. There is little benefit with the iPhone app since it keeps notes online too ( unless you have the foresight to mark the ones you want offline as favourites). 
&lt;/p&gt;
&lt;p&gt;
No excuse for not getting organised &lt;img alt=&quot;sad&quot; src=&quot;/images/smileys/sad.png&quot; /&gt; 
&lt;/p&gt;&lt;p&gt;Related Posts: &lt;a href=&quot;/tag/evernote&quot;&gt;evernote&lt;/a&gt; &lt;a href=&quot;/tag/iphone&quot;&gt;iphone&lt;/a&gt;&lt;/p&gt;</description>
      <guid>http://www.petersblog.org/node/view/2313</guid>
      <pubDate>Mon, 10 Aug 2009 20:35:09 +0100</pubDate>
      <category domain="http://www.technorati.com/tag">evernote</category>
      <category domain="http://www.technorati.com/tag">iphone</category>
    </item>
    <item>
      <title>Uncool But Wireless</title>
      <link>http://www.petersblog.org/node/view/2312</link>
      <description>&lt;p&gt;
On an impulse I bought some wireless headphones. These were for two purposes: 
&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;
playing guitar through Line 6 Pocket Pod and wired headphones I felt horribly wired up 
&lt;/li&gt;
&lt;li&gt;
on rowing machine I, ahem, stuck my iPhone in a plastic bag and shoved it down my boxers. 
&lt;/li&gt;&lt;/ul&gt;

&lt;p&gt;
The headphones solve these problems nicely. The sound quality is ok (a bit compressed, like fm radio) but quite clear and there is little interference (occasional mobile phone noise). The ear cups get sweaty when exercising but they are quite comfortable and far less annoying than wired headphones. 
&lt;/p&gt;
&lt;p&gt;
The range is as far as I am willing to roam while wearing them in case I am seen. They are plugged into the base station to recharge and are supposed to last 15 hours which is enough for 90 10 minute rowing sessions. 
&lt;/p&gt;
&lt;p&gt;
Only problem is the total lack of cool. 
&lt;/p&gt;
&lt;div class=&quot;picture&quot;&gt;&lt;div class=&quot;pictureframe&quot;&gt;&lt;a href=&quot;/pictures/0000/0214/photo.jpg&quot; rel=&quot;lightbox&quot; title=&quot;Uncool But Wireless&quot;&gt;&lt;img alt=&quot;Uncool But Wireless&quot; src=&quot;/pictures/0000/0214/photo_normal.jpg&quot;&gt;&lt;/a&gt;&lt;br/&gt;&lt;p&gt; &lt;/p&gt;&lt;/div&gt;&lt;/div&gt; &lt;p&gt;Related Posts: &lt;a href=&quot;/tag/dick&quot;&gt;dick&lt;/a&gt; &lt;a href=&quot;/tag/guitarhero&quot;&gt;guitarhero&lt;/a&gt; &lt;a href=&quot;/tag/philips&quot;&gt;philips&lt;/a&gt;&lt;/p&gt;</description>
      <guid>http://www.petersblog.org/node/view/2312</guid>
      <pubDate>Tue, 04 Aug 2009 20:18:02 +0100</pubDate>
      <category domain="http://www.technorati.com/tag">dick</category>
      <category domain="http://www.technorati.com/tag">guitarhero</category>
      <category domain="http://www.technorati.com/tag">philips</category>
    </item>
    <item>
      <title>Kenken Puzzles</title>
      <link>http://www.petersblog.org/node/view/2311</link>
      <description>&lt;p&gt;
Kenken is my latest iPhone app craze. It's like Suduko (spelling?) but with sums instead of the cross patterns. The first beginners levels were taking me 20 seconds to solve but it gets trickier by the 33rd amateur level (below). Yes I did over 33 levels in a couple of hours, it smashes through the play-once-then-meh barrier. 
&lt;/p&gt;
&lt;p&gt;
I tried the new Space Invaders but it seems devoid of skill if I use the shoot-round-corners gun and the stuff between each level lasts longer than the levels themselves. Bejeweled 2 is either a total roll of the dice as to how many levels you go or I am just not getting it. 
&lt;/p&gt;
&lt;div class=&quot;picture&quot;&gt;&lt;div class=&quot;pictureframe&quot;&gt;&lt;a href=&quot;/pictures/0000/0211/photo.jpg&quot; rel=&quot;lightbox&quot; title=&quot;Kenken Puzzles&quot;&gt;&lt;img alt=&quot;Kenken Puzzles&quot; src=&quot;/pictures/0000/0211/photo_normal.jpg&quot;&gt;&lt;/a&gt;&lt;br/&gt;&lt;p&gt; &lt;/p&gt;&lt;/div&gt;&lt;/div&gt; &lt;p&gt;Related Posts: &lt;a href=&quot;/tag/iphone&quot;&gt;iphone&lt;/a&gt;&lt;/p&gt;</description>
      <guid>http://www.petersblog.org/node/view/2311</guid>
      <pubDate>Mon, 03 Aug 2009 21:03:15 +0100</pubDate>
      <category domain="http://www.technorati.com/tag">iphone</category>
    </item>
    <item>
      <title>Having a Singalong</title>
      <link>http://www.petersblog.org/node/view/2310</link>
      <description>&lt;p&gt;
Found the TuneWiki app on the iPhone app store this morning and it's big fun. It's a music player that plays your iTunes library and shows the song lyric, Kareoke style (spelling?). Not all songs have lyrics but when they are available they are very well synchronised to the playback. I can rarely understand lyrics as sung and seeing them written down is often a revelation. 
&lt;/p&gt;
&lt;p&gt;
The tunewiki app lists songs in some random order but I found that since it is a front end for the iPod music player I can start a song from there and flip to tunewiki to sing along. 
&lt;/p&gt;
&lt;p&gt;
More than this, it does Internet streaming radio with lyrics too! 
&lt;/p&gt;
&lt;p&gt;
Tunewiki can also tell the world that someone in Ashford, Kent is listening to Mr Blue Sky. I better be careful what I listen to. Someone in Soton, Cambridgeshire is listening to Phil Collins &lt;img alt=&quot;cool&quot; src=&quot;/images/smileys/cool.png&quot; /&gt; 
&lt;/p&gt;
&lt;p&gt;
It as a free application but it keeps showing adverts for flirting websites so I'd better not show it to the wife. 
&lt;/p&gt;
&lt;div class=&quot;picture&quot;&gt;&lt;div class=&quot;pictureframe&quot;&gt;&lt;a href=&quot;/pictures/0000/0208/photo.jpg&quot; rel=&quot;lightbox&quot; title=&quot;Having a Singalong&quot;&gt;&lt;img alt=&quot;Having a Singalong&quot; src=&quot;/pictures/0000/0208/photo_normal.jpg&quot;&gt;&lt;/a&gt;&lt;br/&gt;&lt;p&gt; &lt;/p&gt;&lt;/div&gt;&lt;/div&gt; &lt;p&gt;Related Posts: &lt;a href=&quot;/tag/iphone&quot;&gt;iphone&lt;/a&gt; &lt;a href=&quot;/tag/mrbluesky&quot;&gt;mrbluesky&lt;/a&gt;&lt;/p&gt;</description>
      <guid>http://www.petersblog.org/node/view/2310</guid>
      <pubDate>Sat, 01 Aug 2009 08:00:00 +0100</pubDate>
      <category domain="http://www.technorati.com/tag">iphone</category>
      <category domain="http://www.technorati.com/tag">mrbluesky</category>
    </item>
    <item>
      <title>Line 6 Pocket Pod PSU</title>
      <link>http://www.petersblog.org/node/view/2309</link>
      <description>&lt;p&gt;
The Line 6 Pocket Pod is a wonderful guitar toy. Most of my practise is with the guitar unplugged so being able to use the pod and listen to real guitar sounds is a good thing. Problem is the pod comes without a power supply, it's an extra that costs &#163;12 (line 6 Dc1). 
&lt;/p&gt;
&lt;p&gt;
I bought the pod hoping to live with four rechargable AAA batteries but: 
&lt;/p&gt;
&lt;ol&gt;&lt;li&gt;
they only last about two hours and suddenly go flat in mid-rock 
&lt;/li&gt;
&lt;li&gt;
my charger can only charge two AAAs at a time so recharging was a bind. 
&lt;/li&gt;&lt;/ol&gt;

&lt;p&gt;
I was still reluctant to part with &#163;12 so I looked around for an old one. I found one from a land phone, 6v 400ma. The connector plugged into the pod just right. The DC1 is 9v but since the pod runs from four 1.5 volt batteries I figured 6v would suffice. A google told me the pod draws 200mA so again this should be fine, capacity to spare. The DC1 is used on a few line6 products that presumably need more juice. 
&lt;/p&gt;
&lt;p&gt;
The little diagrams on the pod and psu told me the polarity was wrong so I cut the cable and swapped the wires. 
&lt;/p&gt;
&lt;p&gt;
It worked: the pod runs fine. I spent the next few hours banging out barre chords to guitar settings like 'white room' and 'smoke on the water'. The good thing about fat chunks of distortion and reverb is that it disguises a lot of clumsy fingering. 
&lt;/p&gt;
&lt;p&gt;
In the photo you can see the masking tape on the power line. I really must buy some insulating tape for this kind of work. 
&lt;/p&gt;
&lt;div class=&quot;picture&quot;&gt;&lt;div class=&quot;pictureframe&quot;&gt;&lt;a href=&quot;/pictures/0000/0205/photo.jpg&quot; rel=&quot;lightbox&quot; title=&quot;Line 6 Pocket Pod PSU&quot;&gt;&lt;img alt=&quot;Line 6 Pocket Pod PSU&quot; src=&quot;/pictures/0000/0205/photo_normal.jpg&quot;&gt;&lt;/a&gt;&lt;br/&gt;&lt;p&gt; &lt;/p&gt;&lt;/div&gt;&lt;/div&gt; &lt;p&gt;Related Posts: &lt;a href=&quot;/tag/guitarhero&quot;&gt;guitarhero&lt;/a&gt; &lt;a href=&quot;/tag/mean&quot;&gt;mean&lt;/a&gt; &lt;a href=&quot;/tag/soldering&quot;&gt;soldering&lt;/a&gt;&lt;/p&gt;</description>
      <guid>http://www.petersblog.org/node/view/2309</guid>
      <pubDate>Fri, 31 Jul 2009 20:55:20 +0100</pubDate>
      <category domain="http://www.technorati.com/tag">guitarhero</category>
      <category domain="http://www.technorati.com/tag">mean</category>
      <category domain="http://www.technorati.com/tag">soldering</category>
    </item>
    <item>
      <title>Using OAuth with Twitter</title>
      <link>http://www.petersblog.org/node/view/2308</link>
      <description>&lt;p&gt;
I have been using the Twitter gem to post tweets regarding new blog updates. During some testing I was seeing bare passwords in urls which prompted me into migrating to using Oauth to authenticate with twitter. However this proved to be a bit of a minefield. Oauth tends to be described in explicit technical details and the gems available have cursory examples based on the simplest use cases and they never explain how to get the tokens. 
&lt;/p&gt;
&lt;p&gt;
So here is how to use oauth with twitter in enough detail for other people to do it. The main problem is that even if you are writing, say, a command line twitter app you will still need to write a web based app to get twitter to provide you with the right authentication keys as the process involves being redirected through the twitter web site. 
&lt;/p&gt;
&lt;p&gt;
First go &lt;a href=&quot;http://twitter.com/oauth_clients&quot;&gt;here&lt;/a&gt; and ask twitter nicely for your Consumer Token and your Consumer Secret. I won't bore you with what these are, if you want to be bored read the oauth docs. 
&lt;/p&gt;
&lt;p&gt;
Stick these in a yaml file like this: 
&lt;/p&gt;
&lt;pre class=&quot;lazy&quot;&gt;&lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;
accountname:
  consumer_secret: ulasdfjasdhflkshdflkjsdfhasdfasdfasdffs
  consumer_token: 9asdjfhkasjdfhkhkjhkjA

&lt;/pre&gt;
&lt;p&gt;
I put this in RAILS_ROOT/config/twitter.yml 
&lt;/p&gt;
&lt;p&gt;
Now install the twitter gem: 
&lt;/p&gt;
&lt;pre class=&quot;lazy&quot;&gt;sudm gem install twitter
&lt;/pre&gt;
&lt;p&gt;
Here is a library to encapsulate reading and writing these tokens. I called it PetersTwit.rb and put it in RAILS_ROOT/lib: 
&lt;/p&gt;
&lt;pre class=&quot;lazy&quot;&gt;&lt;span class=&quot;line-numbers&quot;&gt;   1 &lt;/span&gt; &lt;span class=&quot;Comment&quot;&gt;&lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   2 &lt;/span&gt; &lt;span class=&quot;Comment&quot;&gt;&lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt; Simple wrapper for twitter oauth tokens&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   3 &lt;/span&gt; &lt;span class=&quot;Comment&quot;&gt;&lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   4 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;   5 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;rubygems&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   6 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;twitter&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   7 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;yaml&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   8 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;   9 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;PetersTwit&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  10 &lt;/span&gt; &lt;span class=&quot;Comment&quot;&gt;  &lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  11 &lt;/span&gt; &lt;span class=&quot;Comment&quot;&gt;  &lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt; Initialise oauth stuff. strConfig points to the yaml config file,&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  12 &lt;/span&gt; &lt;span class=&quot;Comment&quot;&gt;  &lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt; strAccount is the name of an account in the file (need not be same name&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  13 &lt;/span&gt; &lt;span class=&quot;Comment&quot;&gt;  &lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt; as twitter account)&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  14 &lt;/span&gt; &lt;span class=&quot;Comment&quot;&gt;  &lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  15 &lt;/span&gt;   &lt;span class=&quot;Keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;initialize&lt;/span&gt;(&lt;span class=&quot;Variable&quot;&gt; strConfig&lt;span class=&quot;Variable&quot;&gt;,&lt;/span&gt; strAccount&lt;/span&gt;)
&lt;span class=&quot;line-numbers&quot;&gt;  16 &lt;/span&gt;     &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;strConfig&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; strConfig
&lt;span class=&quot;line-numbers&quot;&gt;  17 &lt;/span&gt;     &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;strAccount&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; strAccount
&lt;span class=&quot;line-numbers&quot;&gt;  18 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;  19 &lt;/span&gt;     &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;oTokens&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;nil&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  20 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;  21 &lt;/span&gt;     &lt;span class=&quot;Keyword&quot;&gt;begin&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  22 &lt;/span&gt;       &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;oAllTokens&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;YAML&lt;/span&gt;::&lt;span class=&quot;Entity&quot;&gt;load_file&lt;/span&gt;( strConfig)
&lt;span class=&quot;line-numbers&quot;&gt;  23 &lt;/span&gt;       &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;oTokens&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;oAllTokens&lt;/span&gt;[&lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;strAccount&lt;/span&gt;]
&lt;span class=&quot;line-numbers&quot;&gt;  24 &lt;/span&gt;     &lt;span class=&quot;Keyword&quot;&gt;rescue&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  25 &lt;/span&gt;       &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;oAllTokens&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; {}
&lt;span class=&quot;line-numbers&quot;&gt;  26 &lt;/span&gt;     &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  27 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;  28 &lt;/span&gt;     &lt;span class=&quot;Keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;oTokens&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  29 &lt;/span&gt;       &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;oTokens&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; {
&lt;span class=&quot;line-numbers&quot;&gt;  30 &lt;/span&gt;         &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;consumer_token&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt; =&amp;gt; &lt;span class=&quot;Constant&quot;&gt;nil&lt;/span&gt;,
&lt;span class=&quot;line-numbers&quot;&gt;  31 &lt;/span&gt;         &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;consumer_secret&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt; =&amp;gt; &lt;span class=&quot;Constant&quot;&gt;nil&lt;/span&gt;,
&lt;span class=&quot;line-numbers&quot;&gt;  32 &lt;/span&gt;         &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;access_token&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt; =&amp;gt; &lt;span class=&quot;Constant&quot;&gt;nil&lt;/span&gt;,
&lt;span class=&quot;line-numbers&quot;&gt;  33 &lt;/span&gt;         &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;access_secret&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt; =&amp;gt; &lt;span class=&quot;Constant&quot;&gt;nil&lt;/span&gt;,
&lt;span class=&quot;line-numbers&quot;&gt;  34 &lt;/span&gt;       }
&lt;span class=&quot;line-numbers&quot;&gt;  35 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;  36 &lt;/span&gt;       &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;oAllTokens&lt;/span&gt;[&lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;strAccount&lt;/span&gt;] &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;oTokens&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  37 &lt;/span&gt;     &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  38 &lt;/span&gt;   &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  39 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;  40 &lt;/span&gt;   &lt;span class=&quot;Keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;consumer&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  41 &lt;/span&gt;     &lt;span class=&quot;Variable&quot;&gt;OAuth&lt;/span&gt;::&lt;span class=&quot;Entity&quot;&gt;Consumer&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;new&lt;/span&gt;(
&lt;span class=&quot;line-numbers&quot;&gt;  42 &lt;/span&gt;        &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;oTokens&lt;/span&gt;[&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;consumer_token&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;],
&lt;span class=&quot;line-numbers&quot;&gt;  43 &lt;/span&gt;        &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;oTokens&lt;/span&gt;[&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;consumer_secret&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;],
&lt;span class=&quot;line-numbers&quot;&gt;  44 &lt;/span&gt;        {&lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;site&lt;/span&gt; =&amp;gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;http://twitter.com&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;}
&lt;span class=&quot;line-numbers&quot;&gt;  45 &lt;/span&gt;     )
&lt;span class=&quot;line-numbers&quot;&gt;  46 &lt;/span&gt;   &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  47 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;  48 &lt;/span&gt;   &lt;span class=&quot;Keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;SetAccessToken&lt;/span&gt;(&lt;span class=&quot;Variable&quot;&gt; strToken&lt;span class=&quot;Variable&quot;&gt;,&lt;/span&gt; strSecret&lt;/span&gt;)
&lt;span class=&quot;line-numbers&quot;&gt;  49 &lt;/span&gt;     &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;oTokens&lt;/span&gt;[&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;access_token&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;] &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; strToken
&lt;span class=&quot;line-numbers&quot;&gt;  50 &lt;/span&gt;     &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;oTokens&lt;/span&gt;[&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;access_secret&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;] &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; strSecret
&lt;span class=&quot;line-numbers&quot;&gt;  51 &lt;/span&gt;     &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;oAllTokens&lt;/span&gt;[&lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;strAccount&lt;/span&gt;] &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;oTokens&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  52 &lt;/span&gt;     &lt;span class=&quot;Variable&quot;&gt;Save&lt;/span&gt;()
&lt;span class=&quot;line-numbers&quot;&gt;  53 &lt;/span&gt;   &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  54 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;  55 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;  56 &lt;/span&gt;   &lt;span class=&quot;Keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;Save&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  57 &lt;/span&gt;     &lt;span class=&quot;Variable&quot;&gt;YAML&lt;/span&gt;::&lt;span class=&quot;Entity&quot;&gt;dump&lt;/span&gt;( &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;oAllTokens&lt;/span&gt;, &lt;span class=&quot;Entity&quot;&gt;open&lt;/span&gt;( &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;strConfig&lt;/span&gt;, &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;w&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;))
&lt;span class=&quot;line-numbers&quot;&gt;  58 &lt;/span&gt;   &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  59 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;  60 &lt;/span&gt;   &lt;span class=&quot;Keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;Auth&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  61 &lt;/span&gt;     oAuth &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Support&quot;&gt;Twitter&lt;/span&gt;::&lt;span class=&quot;Entity&quot;&gt;OAuth&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;new&lt;/span&gt;( &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;oTokens&lt;/span&gt;[&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;consumer_token&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;], &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;oTokens&lt;/span&gt;[&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;consumer_secret&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;])
&lt;span class=&quot;line-numbers&quot;&gt;  62 &lt;/span&gt;     oAuth.&lt;span class=&quot;Entity&quot;&gt;authorize_from_access&lt;/span&gt;( &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;oTokens&lt;/span&gt;[&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;access_token&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;], &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;oTokens&lt;/span&gt;[&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;access_secret&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;])
&lt;span class=&quot;line-numbers&quot;&gt;  63 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;  64 &lt;/span&gt;     &lt;span class=&quot;Keyword&quot;&gt;return&lt;/span&gt; oAuth
&lt;span class=&quot;line-numbers&quot;&gt;  65 &lt;/span&gt;   &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  66 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;div class=&quot;linetoggle&quot; onclick=&quot;$$('.line-numbers').invoke( 'toggle');&quot;&gt;Toggle Line Numbers&lt;/div&gt;&lt;/pre&gt;
&lt;p&gt;
Now add the following actions to a handy rails controller you may have: 
&lt;/p&gt;
&lt;pre class=&quot;lazy&quot;&gt;&lt;span class=&quot;line-numbers&quot;&gt;   1 &lt;/span&gt;   &lt;span class=&quot;Keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;twitter_oauth_login&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   2 &lt;/span&gt;     oTwit &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Support&quot;&gt;PetersTwit&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;new&lt;/span&gt;( &lt;span class=&quot;Support&quot;&gt;File&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;join&lt;/span&gt;( &lt;span class=&quot;Variable&quot;&gt;RAILS_ROOT&lt;/span&gt;, &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;config&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;twitter.yml&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;), &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;therealpeter&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;)
&lt;span class=&quot;line-numbers&quot;&gt;   3 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;   4 &lt;/span&gt;     request_token &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; oTwit.&lt;span class=&quot;Entity&quot;&gt;consumer&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;get_request_token&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   5 &lt;/span&gt;     session[&lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;request_token&lt;/span&gt;] &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; request_token.&lt;span class=&quot;Entity&quot;&gt;token&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   6 &lt;/span&gt;     session[&lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;request_token_secret&lt;/span&gt;] &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; request_token.&lt;span class=&quot;Entity&quot;&gt;secret&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   7 &lt;/span&gt; &lt;span class=&quot;Comment&quot;&gt;&lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt; Send to twitter.com to authorize&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   8 &lt;/span&gt;     redirect_to request_token.&lt;span class=&quot;Entity&quot;&gt;authorize_url&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   9 &lt;/span&gt;   &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  10 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;  11 &lt;/span&gt;   &lt;span class=&quot;Keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;twitter_oauth_register&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  12 &lt;/span&gt;     oTwit &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Support&quot;&gt;PetersTwit&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;new&lt;/span&gt;( &lt;span class=&quot;Support&quot;&gt;File&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;join&lt;/span&gt;( &lt;span class=&quot;Variable&quot;&gt;RAILS_ROOT&lt;/span&gt;, &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;config&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;twitter.yml&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;), &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;therealpeter&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;)
&lt;span class=&quot;line-numbers&quot;&gt;  13 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;  14 &lt;/span&gt;     request_token &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;OAuth&lt;/span&gt;::&lt;span class=&quot;Entity&quot;&gt;RequestToken&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;new&lt;/span&gt;( oTwit.&lt;span class=&quot;Entity&quot;&gt;consumer&lt;/span&gt;, session[&lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;request_token&lt;/span&gt;], session[&lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;request_token_secret&lt;/span&gt;])
&lt;span class=&quot;line-numbers&quot;&gt;  15 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;  16 &lt;/span&gt; &lt;span class=&quot;Comment&quot;&gt;    &lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  17 &lt;/span&gt; &lt;span class=&quot;Comment&quot;&gt;    &lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt; Exchange the request token for an access token.&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  18 &lt;/span&gt; &lt;span class=&quot;Comment&quot;&gt;    &lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  19 &lt;/span&gt;     access_token &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; request_token.&lt;span class=&quot;Entity&quot;&gt;get_access_token&lt;/span&gt;( &lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;oauth_verifier&lt;/span&gt; =&amp;gt; params[&lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;oauth_verifier&lt;/span&gt;])
&lt;span class=&quot;line-numbers&quot;&gt;  20 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;  21 &lt;/span&gt;     oTwit.&lt;span class=&quot;Entity&quot;&gt;SetAccessToken&lt;/span&gt;( access_token.&lt;span class=&quot;Entity&quot;&gt;token&lt;/span&gt;, access_token.&lt;span class=&quot;Entity&quot;&gt;secret&lt;/span&gt;)
&lt;span class=&quot;line-numbers&quot;&gt;  22 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;  23 &lt;/span&gt;     &lt;span class=&quot;Entity&quot;&gt;redirect_to&lt;/span&gt;( &lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;action&lt;/span&gt; =&amp;gt; &lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;index&lt;/span&gt;)
&lt;span class=&quot;line-numbers&quot;&gt;  24 &lt;/span&gt;   &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;div class=&quot;linetoggle&quot; onclick=&quot;$$('.line-numbers').invoke( 'toggle');&quot;&gt;Toggle Line Numbers&lt;/div&gt;&lt;/pre&gt;
&lt;p&gt;
When you register your application with twitter you can say it is a web application and where it asks for a callback url you can point to the url of the twitter_oauth_register. I did this but it never called me back &lt;img alt=&quot;sad&quot; src=&quot;/images/smileys/sad.png&quot; /&gt; 
&lt;/p&gt;
&lt;p&gt;
Run the rails app and go to the twitter_oauth_login url which should redirect you to twitter where you log into your twitter account (I'm not phishing here, honest) and authorise twitter to let your application connect to twitter without any more tedious password nonsense. 
&lt;/p&gt;
&lt;p&gt;
In an ideal world twitter will redirect you back to your app but this is broken for me. Instead Twitter acts as if I asked for a desktop app and displays a seven digit PIN. This can still be used by manually entering the url for: 
&lt;/p&gt;
&lt;pre class=&quot;lazy&quot;&gt;http://yourserver/your_controller/twitter_oauth_register?oauth_verifier=1234567
&lt;/pre&gt;
&lt;p&gt;
where 1234567 is the PIN that twitter gave you. 
&lt;/p&gt;
&lt;p&gt;
After this you should have values for access_token and access_secret appear in your yaml file. These are good, keep these safe as they will let you post to twitter without passwords and crap. You can use them anywhere: web app or command line app. They allow your app to access twitter under a particular twitter user name. 
&lt;/p&gt;
&lt;p&gt;
Posting to twitter from the command line is now easy: 
&lt;/p&gt;
&lt;pre class=&quot;lazy&quot;&gt;&lt;span class=&quot;Keyword&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;PetersTwit&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;Keyword&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;twitter&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;

oPTwit &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Support&quot;&gt;PetersTwit&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;new&lt;/span&gt;( &lt;span class=&quot;Support&quot;&gt;File&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;join&lt;/span&gt;( &lt;span class=&quot;Variable&quot;&gt;RAILS_ROOT&lt;/span&gt;, &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;config&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;twitter.yml&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;), &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;therealpeter&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;)
oTwit &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Support&quot;&gt;Twitter&lt;/span&gt;::&lt;span class=&quot;Entity&quot;&gt;Base&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;new&lt;/span&gt;( oPTwit.&lt;span class=&quot;Entity&quot;&gt;Auth&lt;/span&gt;())

oTwit.&lt;span class=&quot;Entity&quot;&gt;update&lt;/span&gt;( &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;OMG jonas brothers&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;)
&lt;/pre&gt;
&lt;p&gt;
When developing this the biggest conceptual hurdles came in the handling of the exchange of request tokens and access tokens. What can be confusing is that this can only be done once: if you get a set of request tokens you have one chance to swap them for access tokens and if you screw it up you need a fresh set of request tokens. But you don't need to know that if you follow my recipe, it's an implementation detail. 
&lt;/p&gt;&lt;p&gt;Related Posts: &lt;a href=&quot;/tag/oauth&quot;&gt;oauth&lt;/a&gt; &lt;a href=&quot;/tag/pita&quot;&gt;pita&lt;/a&gt; &lt;a href=&quot;/tag/rails&quot;&gt;rails&lt;/a&gt; &lt;a href=&quot;/tag/ruby&quot;&gt;ruby&lt;/a&gt;&lt;/p&gt;</description>
      <guid>http://www.petersblog.org/node/view/2308</guid>
      <pubDate>Fri, 31 Jul 2009 12:20:00 +0100</pubDate>
      <category domain="http://www.technorati.com/tag">oauth</category>
      <category domain="http://www.technorati.com/tag">pita</category>
      <category domain="http://www.technorati.com/tag">rails</category>
      <category domain="http://www.technorati.com/tag">ruby</category>
    </item>
    <item>
      <title>Twittering: 31 July 2009 08:59</title>
      <link>http://www.petersblog.org/node/view/2307</link>
      <description>&lt;p&gt;
PC hasn't given me a bsod since I  uninstalled VirtualBox. Big shame, vmware server's web interface is horrible and VirtualPC doesn't do USB 
&lt;/p&gt;&lt;p&gt;Related Posts: &lt;a href=&quot;/tag/twittering&quot;&gt;twittering&lt;/a&gt;&lt;/p&gt;</description>
      <guid>http://www.petersblog.org/node/view/2307</guid>
      <pubDate>Fri, 31 Jul 2009 08:59:49 +0100</pubDate>
      <category domain="http://www.technorati.com/tag">twittering</category>
    </item>
  </channel>
</rss>
