<?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>alanjames.org &#187; Geekery</title>
	<atom:link href="http://www.alanjames.org/category/geekery/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.alanjames.org</link>
	<description>Things I thought worth sharing.</description>
	<lastBuildDate>Sun, 11 Jul 2010 11:09:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>My very own twitter client.</title>
		<link>http://www.alanjames.org/2010/07/my-very-own-twitter-client/</link>
		<comments>http://www.alanjames.org/2010/07/my-very-own-twitter-client/#comments</comments>
		<pubDate>Sat, 10 Jul 2010 15:35:22 +0000</pubDate>
		<dc:creator>Alan</dc:creator>
				<category><![CDATA[Geekery]]></category>

		<guid isPermaLink="false">http://www.alanjames.org/?p=201</guid>
		<description><![CDATA[Followers on Twitter may have noticed that I&#8217;m now posting using a client called alanjames. This is really just Spaz but now registered at Twitter under my own name. Here&#8217;s the how and why I&#8217;ve done that. For some months &#8230; <a href="http://www.alanjames.org/2010/07/my-very-own-twitter-client/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Followers on Twitter may have noticed that I&#8217;m now posting using a client called alanjames. This is really just <a title="Spaz" href="http://www.getspaz.com/">Spaz</a> but now registered at Twitter under my own name.</p>
<p>Here&#8217;s the how and why I&#8217;ve done that.</p>
<p>For some months now I&#8217;ve been using the in development versions of Spaz pulled from <a href="http://github.com/funkatron/spaz-desktop-air">the GitHub repository</a> mostly cos I like to get all the new stuff first. Recently though they&#8217;ve changed all the login code to use xAuth as it looks like Twitter will be forcing all clients to go that way sometime soon.</p>
<p>So when I pulled the latest code on Tuesday it wouldn&#8217;t run. It just complained that the SPAZCORE_CONSUMERKEY_TWITTER and SPAZCORE_CONSUMERSECRET_TWITTER values were empty. These are the values an app uses to identify itself with Twitter (so when it misbehaves and causes a problem for Twitter they know who to contact), and they would normally be hard coded into the application.</p>
<p>When you&#8217;ve got an open source app though, anyone could look in the code and take your keys and then impersonate your application, potentially making you look bad when they somehow cause the fail whale to resurface. So until that problem is solved Spaz isn&#8217;t putting their key and secret in the source code.</p>
<p>Fair enough, I thought, I&#8217;ll just register it myself and get my own keys. Here&#8217;s what I did.</p>
<ul>
<li>Go to http://dev.twitter.com/apps and register a new application. Call it what you like, set it to &#8216;client&#8217; and &#8216;read &amp; write&#8217;.</li>
<li>On the application detail page you&#8217;ll find your consumer key and secret.</li>
<li>In the Spaz source  you&#8217;ll find app/auth_config_sample.js copy this to app/auth_config.js and edit it.</li>
<li>Fill in the key and secret.</li>
<li>Run it and it still wont work. <img src='http://www.alanjames.org/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </li>
<li>Go back to your app page and notice the message at the bottom &#8220;<strong>Note</strong>: xAuth is not enabled for applications by default.  Email <a href="mailto:api@twitter.com">api@twitter.com</a> to request  xAuth access.&#8221;</li>
<li>Send them a nice email :<br />
Hi,</p>
<p>I have my own version of the twitter client Spaz and would like xAuth<br />
access for it. I&#8217;ve registered it here:<br />
<a href="http://dev.twitter.com/apps/204733" target="_blank">http://dev.twitter.com/apps/999999</a></p>
<p>I&#8217;ll keep it mostly in line with the cvs version from<br />
<a href="http://www.getspaz.com/" target="_blank">http://www.getspaz.com/</a> so any changes you require them to make I&#8217;ll<br />
quickly do the same.</p>
<p>Thanks,</p>
<p>@alanjames</li>
<li>Wait for 4 days.</li>
<li>Run it again and it works!</li>
</ul>
<p><script type="text/javascript">
	var flattr_url = 'http://www.alanjames.org/2010/07/my-very-own-twitter-client/';
</script><br />
<script src="http://api.flattr.com/button/load.js" type="text/javascript"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.alanjames.org/2010/07/my-very-own-twitter-client/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Within-group aggregates with another wrinkle.</title>
		<link>http://www.alanjames.org/2010/02/within-group-aggregates-with-another-wrinkle/</link>
		<comments>http://www.alanjames.org/2010/02/within-group-aggregates-with-another-wrinkle/#comments</comments>
		<pubDate>Sat, 20 Feb 2010 15:31:47 +0000</pubDate>
		<dc:creator>Alan</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.alanjames.org/?p=157</guid>
		<description><![CDATA[Recently when optimising an SQL query I needed to return a specific subset of records from a large table. The brilliant Common Queries Tree pointed me in the right direction, but the examples didn&#8217;t quite cover my specific case. I &#8230; <a href="http://www.alanjames.org/2010/02/within-group-aggregates-with-another-wrinkle/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Recently when optimising an SQL query I needed to return a specific subset of records from a large table. The brilliant <a href="http://www.artfulsoftware.com/infotree/queries.php?&#038;bw=1165">Common Queries Tree</a> pointed me in the right direction, but the examples didn&#8217;t quite cover my specific case.</p>
<p>I needed the records with the maximal value of x and the minimal value of y for that x.</p>
<p>For example, suppose you had a table of second hand books and each book has a quality and price. There are many copies of each book but you&#8217;re only interested in the best examples of each book and at the lowest price for that quality.</p>
<p><code><br />
CREATE TABLE Books( id int,<br />
                                     ISBN varchar(10),<br />
                                     Quality int,<br />
                                     price decimal(6,2)<br />
                                   );<br />
INSERT INTO Books VALUES<br />
( 1, '0618551050', 4, 5.00 ),<br />
( 2, '0618551050', 4, 6.00 ),<br />
( 3, '0618551050', 2, 3.00 ),<br />
( 4, '0786884061', 1, 8.00 ),<br />
( 5, '0786884061', 3, 8.00 );<br />
</code></p>
<p>Here we are only interested in records 1 and 5. The Common Queries Tree describes this as a <a href="http://www.artfulsoftware.com/infotree/queries.php?&#038;bw=1165#101">within-group aggregates</a> problem, and as it notes the <em>correlated subquery</em> is the most obvious solution but it was slow.</p>
<p>I started off with something like this<br />
<code>Select * from Books as b1<br />
where b1.id = (SELECT id from Books where Books.ISBN = b1.ISBN order by Quality desc, Price limit 1);</code></p>
<p>But with almost a million records in the table, a select on each one was taking forever. After a bit of head scratching I managed to use a <em>left self exclusion join</em> to find the records I wanted.</p>
<p><code>select b1.* from Books as b1<br />
left join Books as b2 on b1.ISBN = b2.ISBN and b1.Quality < b2.Quality<br />
left join Books as b3 on b1.ISBN = b3.ISBN and b1.Quality = b3.Quality and b1.Price > b3.Price<br />
WHERE b2.id is NULL and b3.id is NULL;</code></p>
<p>Here the idea is to select as b1 the records from Books where its impossible to find a book, b2, that has a higher quality and impossible to find a book, b3 with the same quality as b1 but a lower price. If there was another book with a higher quality then b2.id would not be NULL  so those records are excluded. Similarly if a book at the same quality had been found but with a lower price, b3.id would not be null.</p>
<p>This was much faster on my data set but it does produce a slightly different result when two items are indistinguishable.<br />
<code>insert into Books VALUES ( 6, '0786884061', 3, 8.00 );</code></p>
<p>With that my initial query would return either record 5 or 6 and the new query returns both. So group by b1.ISBN to restore the old behaviour. Once you&#8217;re happy, save your query into a view so you don&#8217;t have to look at it again.</p>
<p>Got a better solution ? If you can optimise my view you&#8217;ll make me very happy.</p>
<p>Alan.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alanjames.org/2010/02/within-group-aggregates-with-another-wrinkle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tethering Jolicloud with a Nokia 6500 Classic</title>
		<link>http://www.alanjames.org/2010/02/tethering-jolicloud-with-a-nokia-6500-classic/</link>
		<comments>http://www.alanjames.org/2010/02/tethering-jolicloud-with-a-nokia-6500-classic/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 18:55:55 +0000</pubDate>
		<dc:creator>Alan</dc:creator>
				<category><![CDATA[Geekery]]></category>

		<guid isPermaLink="false">http://www.alanjames.org/?p=154</guid>
		<description><![CDATA[Yesterday I plugged my Nokia 6500 Classic phone into my Jolicloud powered netbook, told the network manager I was on a Vodafone contract and bang, instant 3G internet access. It could hardly be simpler. Once its set up, you can &#8230; <a href="http://www.alanjames.org/2010/02/tethering-jolicloud-with-a-nokia-6500-classic/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Yesterday I plugged my Nokia 6500 Classic phone into my Jolicloud powered netbook, told the network manager I was on a Vodafone contract and bang, instant 3G internet access. It could hardly be simpler.</p>
<p>Once its set up, you can edit the configuration and see where it&#8217;s put the APN and other connection info, and edit to match your provider if its not on the list of presets.</p>
<p>Bluetooth is trickier, the GUI tool had a go at it but failed miserably just like it had on plain Ubuntu. Pairing and trasnferring files it&#8217;ll do but not dial up networking. For that you&#8217;ll have to use the guide I found <a href="http://www.spiration.co.uk/post/1307/Ubuntu%20Linux%20-%20Bluetooth%20and%20GPRS%20dialup%20connection">here</a>, which worked perfectly on Ubuntu and so should also work for Jolicloud.</p>
<p>I&#8217;m really happy with the cabled operation. My Netbook, a first generation EEE PC 701 (with a RAM upgrade) doesn&#8217;t have bluetooth built in so instead of carrying around a bluetooth dongle I can just carry the phones USB cable instead. I&#8217;ll be using less power too without the unnecessary radio chatter.</p>
<p>I might actually have to do some tech support from Glastonbury this year so I&#8217;m glad this is working so well now.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alanjames.org/2010/02/tethering-jolicloud-with-a-nokia-6500-classic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Spaz, the twitter client.</title>
		<link>http://www.alanjames.org/2009/10/spaz-the-twitter-client/</link>
		<comments>http://www.alanjames.org/2009/10/spaz-the-twitter-client/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 20:10:30 +0000</pubDate>
		<dc:creator>Alan</dc:creator>
				<category><![CDATA[Geekery]]></category>

		<guid isPermaLink="false">http://www.alanjames.org/?p=136</guid>
		<description><![CDATA[I use a Twitter client named Spaz. Now if you&#8217;re from the UK the name might strike you as being a bit distasteful, perhaps even offensive. Get over it, its just a random sound in most of the world. Actually &#8230; <a href="http://www.alanjames.org/2009/10/spaz-the-twitter-client/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><div id="attachment_137" class="wp-caption alignleft" style="width: 112px"><a href="http://www.alanjames.org/wp-content/uploads/2009/10/Screenshot-Spaz.png"><img src="http://www.alanjames.org/wp-content/uploads/2009/10/Screenshot-Spaz-102x300.png" alt="Spaz Screenshot" title="Spaz on my system - Click to enlarge" width="102" height="300" class="size-medium wp-image-137" /></a><p class="wp-caption-text">Spaz on my system</p></div><br />
I use a Twitter client named <a href="http://getspaz.com/">Spaz</a>. Now if you&#8217;re from the UK the name might strike you as being a bit distasteful, perhaps even offensive. Get over it, its just a random sound in most of the world. </p>
<p>Actually if you don&#8217;t like the name you can change it. Just edit the preferences.json file and tell it to report a different app name to the world. In fact there&#8217;s lots you can change about Spaz, and that&#8217;s why I like it.</p>
<p>Most of the changes I wanted to make were simple and could be done by editing the user.css file. Through css I changed the colours so they were a bit more like the old client I was used to, and prettied up the borders of each tweet by making them rounded.</p>
<p>For more advanced changes you can write your own theme, and if that&#8217;s not enough for you then download the source code and make your own version of Spaz!</p>
<p>Download my <a href="http://www.alanjames.org/wp-content/uploads/2009/10/user.css">my user.css file</a> to make your Spaz look like mine.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alanjames.org/2009/10/spaz-the-twitter-client/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL: Row N was truncated; a solution</title>
		<link>http://www.alanjames.org/2009/08/mysql-row-n-was-truncated-a-solution/</link>
		<comments>http://www.alanjames.org/2009/08/mysql-row-n-was-truncated-a-solution/#comments</comments>
		<pubDate>Thu, 13 Aug 2009 15:56:38 +0000</pubDate>
		<dc:creator>Alan</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.alanjames.org/?p=128</guid>
		<description><![CDATA[You&#8217;re importing some data into MySQL and using LOAD DATA INFILE so you can do a SHOW WARNINGS afterwards. Every line of your import file has a warning: &#124; Warning &#124; 1262 &#124; Row 1 was truncated; it contained more &#8230; <a href="http://www.alanjames.org/2009/08/mysql-row-n-was-truncated-a-solution/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>You&#8217;re importing some data into MySQL and using LOAD DATA INFILE so you can do a SHOW WARNINGS afterwards. Every line of your import file has a warning:</p>
<p>| Warning | 1262 | Row 1 was truncated; it contained more data than there were input columns<br />
| Warning | 1262 | Row 2 was truncated; it contained more data than there were input columns<br />
&#8230;etc.</p>
<p>The fix is easy, and you&#8217;d think of it eventually, but you thought you&#8217;d try google instead. So I&#8217;m posting this so that when you do there is something to find. There wasn&#8217;t much when I looked.</p>
<p>It&#8217;s the line endings. MySQL isn&#8217;t getting what it expects, so specify the format of the file using LINES TERMINATED BY &#8216;\r\n&#8217; or whatever is appropriate for you:</p>
<p>&#8216;\r\n&#8217; for files that came from Windows systems<br />
&#8216;\r&#8217; for files from VMS<br />
&#8216;\n&#8217; for every other source.</p>
<p>Hope that helps.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alanjames.org/2009/08/mysql-row-n-was-truncated-a-solution/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
