<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>ukstokes.com</title>
	
	<link>http://ukstokes.com/blog</link>
	<description>tech stuff from a tech bloke</description>
	<lastBuildDate>Tue, 01 Nov 2011 11:29:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Ukstokescom" /><feedburner:info uri="ukstokescom" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Improving Skype notifications on Linux</title>
		<link>http://feedproxy.google.com/~r/Ukstokescom/~3/q8bJfW8weZI/</link>
		<comments>http://ukstokes.com/blog/2011/10/23/improving-skype-notifications-on-linux/#comments</comments>
		<pubDate>Sun, 23 Oct 2011 18:57:50 +0000</pubDate>
		<dc:creator>ben</dc:creator>
				<category><![CDATA[Desktop Linux]]></category>
		<category><![CDATA[libnotify]]></category>
		<category><![CDATA[skype]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://ukstokes.com/blog/?p=884</guid>
		<description><![CDATA[Continuing from the preview blog post on Gmail notifications, I wondered if there was a way to link Skype into libnotify. Skype uses its own notification system by default which doesn't fit with the Gnome / Unity desktop, and looks kind of crappy. I could start a rant about Skype now, and the fact the [...]]]></description>
			<content:encoded><![CDATA[<p>Continuing from the preview blog post on Gmail notifications, I wondered if there was a way to link Skype into libnotify. Skype uses its own notification system by default which doesn't fit with the Gnome / Unity desktop, and looks kind of crappy. I could start a rant about Skype now, and the fact the Linux client never gets updated, seems to silently crash when open for longer than an hour, and is generally a shoddy counterpart to the Windows and Mac versions ... then again since it's been acquired by Microsoft I can't see that this situation is going to ever improve now. Anyway, in the Options, under Notifications, if you select an event and then click Advanced, you can then clear the box that says "send a notification", and select to run a script instead.</p>
<p style="text-align: center;"><a href="http://ukstokes.com/blog/wp-content/uploads/2011/10/skype_options.png"><img class="alignnone size-medium wp-image-885" title="skype_options" src="http://ukstokes.com/blog/wp-content/uploads/2011/10/skype_options-300x203.png" alt="Advanced notification options" width="300" height="203" /><br />
</a><em>Advanced notification options</em></p>
<p>Using the 'Contact came online' event as an example, if you run the following as your 'script', inserting the name of a contact using the %sname variable, it looks like this:</p>
<pre class="brush: plain; title: ; notranslate">notify-send &quot;%sname is now online&quot; -i skype</pre>
<p>And for messages, you can use %smessage to insert the Skype message into a notification popup.</p>
<pre class="brush: plain; title: ; notranslate">notify-send &quot;%sname&quot; &quot;%smessage&quot; -i skype</pre>
<p style="text-align: center;"><em><img class="alignnone size-full wp-image-887" title="skype_message" src="http://ukstokes.com/blog/wp-content/uploads/2011/10/skype_message.png" alt="Skype message received" width="456" height="246" /><a href="http://ukstokes.com/blog/wp-content/uploads/2011/10/skype_message.png"><br />
</a>Skype message received</em></p>
<p>Much better!</p>
<p>A list of available variables is <a href="http://forum.skype.com/index.php?showtopic=85138&amp;st=0&amp;p=390732&amp;#entry390732">here</a>.</p>
<img src="http://feeds.feedburner.com/~r/Ukstokescom/~4/q8bJfW8weZI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://ukstokes.com/blog/2011/10/23/improving-skype-notifications-on-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://ukstokes.com/blog/2011/10/23/improving-skype-notifications-on-linux/</feedburner:origLink></item>
		<item>
		<title>Pretty Gmail notifications for Ubuntu</title>
		<link>http://feedproxy.google.com/~r/Ukstokescom/~3/Eu5sWsVj86Y/</link>
		<comments>http://ukstokes.com/blog/2011/10/22/pretty-gmail-notifications-for-ubuntu/#comments</comments>
		<pubDate>Sat, 22 Oct 2011 19:25:05 +0000</pubDate>
		<dc:creator>ben</dc:creator>
				<category><![CDATA[Desktop Linux]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[gmail]]></category>
		<category><![CDATA[libnotify]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://ukstokes.com/blog/?p=868</guid>
		<description><![CDATA[I've recently gone back to Ubuntu (10.11), and in my new installation wondered if there was an app I could install which gave me Gmail notifications via the default notification system (libnotify). I was a bit surprised to find that there wasn't, so I wrote a script in bash that does it: gmailpopup  My script [...]]]></description>
			<content:encoded><![CDATA[<p>I've recently gone back to Ubuntu (10.11), and in my new installation wondered if there was an app I could install which gave me Gmail notifications via the default notification system (libnotify). I was a bit surprised to find that there wasn't, so I wrote a script in bash that does it:</p>
<p style="text-align: center;"><a href="http://ukstokes.com/blog/wp-content/uploads/2011/10/gmailpopup.png"><img class="size-full wp-image-869 aligncenter" title="gmailpopup" src="http://ukstokes.com/blog/wp-content/uploads/2011/10/gmailpopup.png" alt="gmalpopup" width="414" height="478" /></a><em>gmailpopup </em></p>
<p>My script also stores your password hashed (unlike some of the alternatives in Software Centre), in a hidden file in your /home.</p>
<p><strong>Installation</strong></p>
<p>To install, run the following:</p>
<pre class="brush: bash; gutter: false; title: ; notranslate">
sudo apt-get install curl gnome-gmail
wget -q -O ~/gmailpopup http://ukstokes.com/scripts/gmailpopup
chmod +x ~/gmailpopup
sudo cp ~/gmailpopup /usr/bin
</pre>
<p>To configure it just type <strong>gmailpopup</strong> in a terminal and enter your Gmail address (GApps domains also supported) and password. If you have accidentally fat fingered the password and get an error, you can start again with <strong>gmailpopup --reconfigure</strong>. On subsequent runs you won't get a popup unless your unread email is different from last time.</p>
<p>This doesn't seem to run if inserted into the crontab. But it works fine if this is added as a startup application:</p>
<pre class="brush: bash; gutter: false; title: ; notranslate">
while true; do ~/bin/gmailpopup &amp;&amp; sleep 1m; done &amp;
</pre>
<p>Of course, this doesn't just work on Ubuntu. Any distro which uses libnotify will do. By the way the gnome-gmail package is just required for the Gmail icon. There is probably a better way of doing that, which I'll have a think about, but installing gnome-gmail has the added advantage of making Gmail your default mail client for mailto links etc. If that is not what you want, go to the "Default Applications" in "System Info" to set it back.</p>
<p>Thats it. Leave me a comment and let me know what you think!</p>
<img src="http://feeds.feedburner.com/~r/Ukstokescom/~4/Eu5sWsVj86Y" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://ukstokes.com/blog/2011/10/22/pretty-gmail-notifications-for-ubuntu/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://ukstokes.com/blog/2011/10/22/pretty-gmail-notifications-for-ubuntu/</feedburner:origLink></item>
		<item>
		<title>Living with Gnome 3</title>
		<link>http://feedproxy.google.com/~r/Ukstokescom/~3/nqOTYVPsV20/</link>
		<comments>http://ukstokes.com/blog/2011/07/19/living-with-gnome-3/#comments</comments>
		<pubDate>Tue, 19 Jul 2011 21:19:56 +0000</pubDate>
		<dc:creator>ben</dc:creator>
				<category><![CDATA[Desktop Linux]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://ukstokes.com/blog/?p=853</guid>
		<description><![CDATA[Here are some tips on how to make Gnome 3 behave a bit more like Gnome 2, to help you transition into this new and unfamiliar territory. Most of them are from this thread on Fedora Forums. Tip 1: Maximise and Minimise If you thought Ubuntu were naughty moving the buttons to the left, you [...]]]></description>
			<content:encoded><![CDATA[<p>Here are some tips on how to make Gnome 3 behave a bit more like Gnome 2, to help you transition into this new and unfamiliar territory. Most of them are from <a href="http://forums.fedoraforum.org/showthread.php?t=263006">this thread on Fedora Forums</a>.</p>
<p><strong>Tip 1</strong>: <em>Maximise and Minimise</em></p>
<p>If you thought Ubuntu were naughty moving the buttons to the left, you aint seen nothing. Gnome completely removed the maximise and minimise buttons. To get them back run the following (as you, not using sudo or su):</p>
<pre class="brush: bash; title: ; notranslate">gconftool-2 -s -t string /desktop/gnome/shell/windows/button_layout &quot;:minimize,maximize,close&quot;</pre>
<p>To see the changes press ALT+F2, press 'r', and hit enter. Your shell will reload without closing any apps and the extensions will be applied.</p>
<p><strong>Tip 2</strong>: <em>Remove the accessibility icon from the top panel</em></p>
<p>This is done by installing the following Gnome 3 extension:</p>
<pre class="brush: bash; title: ; notranslate">su -c 'yum install gnome-shell-extension-remove-accessibility-icon'</pre>
<p><strong>Tip 3</strong>: <em>Enable 'Power off' in the status menu</em></p>
<p>Usually you have to hold ALT to see this, which is frankly bullshit. Luckily this is also easily remedied by installing an extension.</p>
<pre class="brush: bash; title: ; notranslate">su -c 'yum install gnome-shell-extensions-alternative-status-menu'</pre>
<p><strong>Tip 4</strong>: <em>Better window management</em></p>
<p>I don't really like the 'dock' for managing background applications which appears inside the activities area. My advice is to install Docky. Other docks are available such as avant window manager, but I think Docky is the best.</p>
<pre class="brush: bash; title: ; notranslate">su -c 'yum install docky'</pre>
<p>Edit: Docky crashes A LOT for me, on both F15 machines. I am going to try an alternative.</pre>
<p><strong>Tip 5</strong>: <em>Add programs to 'startup applications'</em></p>
<p>The dialog box was removed from the settings screen. You can access it by pressing ALT+F2 and typing gnome-session-properties into the box.</p>
<p><strong>Tip 6</strong>: <em>Enable desktop icons/shortcuts</em></p>
<p>Another classic, you can't create shortcuts ANYWHERE in Gnome 3. WTF. But, there is a nifty program in the yum repos called gnome-tweak-tool that can fix that. Install it and then launch 'Tweak Advanced Settings' from the apps menu, then switch 'Have file manager manage the desktop' to ON.</p>
<pre class="brush: bash; title: ; notranslate">su -c 'yum install gnome-tweak-tool'</pre>
<p><strong>Tip 7</strong>: <em>Add icons</em></p>
<p>You might want to add icons for missing things like the gnome-session-properties tool. If you yum install 'alacarte' you get a menu editor (straight from Gnome 2) to create your missing shortcut items.</p>
<p><del><strong>Tip 8</strong>: <em>Change the ALT+TAB behaviour</em></del></p>
<p><del>Alt+Tab changed slightly in Gnome 3. If you have multiple windows of the same type open, for example 2 terminal windows, when you alt tab you only see one of them. Then when you hover over the item in Alt+Tab, the multiple instances are shown. I am indifferent about this but if you want to restore Window based, rather than Application based Alt+Tab, there is another extension to install:</del></p>
<pre class="brush: bash; title: ; notranslate">su -c 'yum install gnome-shell-extensions-alternate-tab'</pre>
<p>Edit: This extension causes my shell to crash. I wouldn't recommend it.</pre>
<img src="http://feeds.feedburner.com/~r/Ukstokescom/~4/nqOTYVPsV20" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://ukstokes.com/blog/2011/07/19/living-with-gnome-3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://ukstokes.com/blog/2011/07/19/living-with-gnome-3/</feedburner:origLink></item>
		<item>
		<title>HTC, you fail.</title>
		<link>http://feedproxy.google.com/~r/Ukstokescom/~3/qK2MMuR-O0c/</link>
		<comments>http://ukstokes.com/blog/2011/06/15/htc-you-fail/#comments</comments>
		<pubDate>Wed, 15 Jun 2011 06:21:38 +0000</pubDate>
		<dc:creator>ben</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Rants]]></category>
		<category><![CDATA[desire]]></category>
		<category><![CDATA[htc]]></category>
		<category><![CDATA[Rant]]></category>

		<guid isPermaLink="false">http://ukstokes.com/blog/?p=835</guid>
		<description><![CDATA[I'm the owner of a popular Android phone from yesteryear, the HTC Desire. It's been out for almost exactly one year from today and originally shipped with Eclair (Android 2.1), and was later updated to Froyo (2.2). HTC just announced via facebook that they will not be updating the HTC Desire any longer. Apparently it [...]]]></description>
			<content:encoded><![CDATA[<p>I'm the owner of a popular Android phone from yesteryear, the HTC Desire. It's been out for almost exactly one year from today and originally shipped with Eclair (Android 2.1), and was later updated to Froyo (2.2).</p>
<div id="attachment_841" class="wp-caption aligncenter" style="width: 281px"><a href="http://ukstokes.com/blog/wp-content/uploads/2011/06/desire.jpg"><img class="size-full wp-image-841" title="desire" src="http://ukstokes.com/blog/wp-content/uploads/2011/06/desire.jpg" alt="" width="271" height="224" /></a><p class="wp-caption-text">HTC Desire</p></div>
<p>HTC <a href="http://www.engadget.com/2011/06/14/htc-desire-tries-to-catch-gingerbread-cant-keep-up/">just announced via facebook</a> that they will not be updating the HTC Desire any longer. Apparently it doesn't have enough storage space for Android 2.3 (Gingerbread) + HTC Sense 3.0. There are a few angry ways that users could react to this.</p>
<p>First of all, there is the argument that HTC are only refusing to upgrade the Desire because they want users to upgrade to new handsets. Extending the lifetime of their old phones doesn't make them any money. This is at the cost of customer satisfaction though, and it's sad because most users will have 2 year contracts, and like me, had hoped that updates would at least carry on for the length of your contract since this was one of HTC's flagship phones. I've owned my phone for a whole year already, but I would be pretty pissed off if I had bought it recently to then discover HTC had abandoned it. What version of Android will be out one year from now, and what will the resale value of your Desire be if the Android version is 18 months out of date?</p>
<p>Secondly, the Nexus One, which is basically a Desire in a different shell with a trackball, is quite capable of running Android 2.3. Google pushed it out a few months ago.  So it seems to be clear that the problem is HTC Sense, it has become too bloated and no longer fits on the small storage of the Desire. In an ideal world they should give us the upgrade option of Android 2.3 without Sense.</p>
<p>Thirdly, there are TONS of Android 2.3 roms that include HTC Sense on <a href="http://forum.xda-developers.com/forumdisplay.php?f=628">XDA</a>. The fact that these exist and work perfectly well as a daily rom helps to argue the point that HTC's reasons for abandoning the Desire are a load of crap. Whether you root or not, <a href="http://www.youtube.com/watch?v=mIh5JJp_5J0">you can see that this phone is capable of running Gingerbread</a>.</p>
<p>Finally, there are the <em>rooters</em>. They don't care; they have been running Android 2.3 on the Desire for 6 months already. But it's been a tough journey - HTC went out of their way to lock the bootloader and the nand (storage), to make flashing custom roms difficult. Without groups like <a href="http://alpharev.nl/">AlphaRev</a> we would not have freedom to install whatever we like on our Desires and we would be chained to Froyo for the lifetime of our phones. It's sad because shouldn't have to be this way. Normal users will not hack their phones to run <a href="http://www.cyanogenmod.com/">CyanogenMod</a>. They will be stuck on Froyo for the remaining lifetime of their phones. They won't get any of the new features of Android, bug fixes, or <a href="http://crave.cnet.co.uk/mobiles/google-calendar-bug-plagues-android-phone-users-50004068/">security updates</a>, and to me that just seems wrong.</p>
<p><strong>Update:</strong> Apparently <a href="https://www.facebook.com/htcuk/posts/225857300777092">HTC will bring Gingerbread to the Desire</a> after all. We'll see.</p>
<img src="http://feeds.feedburner.com/~r/Ukstokescom/~4/qK2MMuR-O0c" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://ukstokes.com/blog/2011/06/15/htc-you-fail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://ukstokes.com/blog/2011/06/15/htc-you-fail/</feedburner:origLink></item>
		<item>
		<title>Unity (Ubuntu 11.04)</title>
		<link>http://feedproxy.google.com/~r/Ukstokescom/~3/dRPkjlOfD0w/</link>
		<comments>http://ukstokes.com/blog/2011/06/08/unity-ubuntu-11-04/#comments</comments>
		<pubDate>Wed, 08 Jun 2011 16:48:46 +0000</pubDate>
		<dc:creator>ben</dc:creator>
				<category><![CDATA[Desktop Linux]]></category>
		<category><![CDATA[Opinion]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[opinion]]></category>
		<category><![CDATA[Rant]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[unity]]></category>

		<guid isPermaLink="false">http://ukstokes.com/blog/?p=829</guid>
		<description><![CDATA[I am writing this post using Ubuntu 11.04 using the new ‘Unity Desktop’. In the interest of fairness and because I really don’t want to say goodbye to Ubuntu, I have been giving it a try for a while to see if I can adapt. Let me start with the criticism. There seem to be [...]]]></description>
			<content:encoded><![CDATA[<p><!-- ======================================================= --> <!-- Created by AbiWord, a free, Open Source wordprocessor.  --> <!-- For more information visit http://www.abisource.com.    --> <!-- ======================================================= --> <!-- #toc, .toc, .mw-warning { 	border: 1px solid #aaa; 	background-color: #f9f9f9; 	padding: 5px; 	font-size: 95%; } #toc h2, .toc h2 { 	display: inline; 	border: none; 	padding: 0; 	font-size: 100%; 	font-weight: bold; } #toc #toctitle, .toc #toctitle, #toc .toctitle, .toc .toctitle { 	text-align: center; } #toc ul, .toc ul { 	list-style-type: none; 	list-style-image: none; 	margin-left: 0; 	padding-left: 0; 	text-align: left; } #toc ul ul, .toc ul ul { 	margin: 0 0 0 2em; } #toc .toctoggle, .toc .toctoggle { 	font-size: 94%; }@media print, projection, embossed { 	body { 		padding-top:1in; 		padding-bottom:1in; 		padding-left:1in; 		padding-right:1in; 	} } body { 	font-family:'Times New Roman'; 	color:#000000; 	widows:2; 	font-style:normal; 	text-indent:0in; 	font-variant:normal; 	font-weight:normal; 	font-size:12pt; 	text-decoration:none; 	text-align:left; } table { } td { 	border-collapse:collapse; 	text-align:left; 	vertical-align:top; } p, h1, h2, h3, li { 	color:#000000; 	font-family:'Times New Roman'; 	font-size:12pt; 	text-align:left; 	vertical-align:normal; } --></p>
<div>
<p>I am writing this post using Ubuntu 11.04 using the new ‘Unity Desktop’. In the interest of fairness and because I really don’t want to say goodbye to Ubuntu, I have been giving it a try for a while to see if I can adapt.</p>
<p>Let me start with the criticism. There seem to be a lot of things which don’t make any sense to me. For example, why:</p>
<ul>
<li>the system settings are accessed by pressing the ‘power on/off’ icon</li>
<li>when I press the ‘menu’ button (the ubuntu button in the top left), my entire screen fills up with massive icons - my eyesight is actually fine and I’m using a laptop, not a tablet or touchscreen device.</li>
<li>on said Ubuntu menu, there is an icon called ‘more apps’ within the shortcuts.</li>
<li>if I click on ‘bin’ in the panel, I get ‘wastebasket’. They should be called the same thing. Why can't any Linux distros get this right!?</li>
<li>other than clicking the Home button, I cant see any way to open a file manager. I am also not able to rename my Home button to ‘File Manager’.</li>
</ul>
<p>&nbsp;</p>
<p>Additionally, I don’t seem to be able to customise this launcher at all other than by ‘pinning’ things to it. I can’t remove it and use something else. In fact if I go to the ‘system settings’ (ignoring the fact it then opens something called Control Centre, should be called ’System Settings’?), and then click on ‘Main Menu’, I get a dialog box for configuring the old Gnome menu, not the new Unity one. To me this seems to be a bit of a mess. I can't right click anywhere in the launcher. I don't see any method of editing the 'shortcuts' that appear.</p>
<p>The performance of Unity is pretty sluggish on my netbook (Samsung NC210). Full screen video is really choppy unless I run in a mode which has desktop compositing turned off.</p>
<p>What nice things can I say about it?</p>
<p>The global menu actually works quite well and gives me some more space back on my tiny netbook screen (I still go to the top right for my close button though). The menu options for a maximised program are now found on the top panel, like on a Mac.</p>
<p>Stability wise I have not had any application or system crashes. It’s been very stable.</p>
<p>The rest of the Ubuntu system is good. Installing software is really nice in the software centre. Getting audio codecs was easy during the install. The actual install itself was a piece of cake, too. But I think a 'What's new' screen and tour of Unity would have been helpful.</p>
<p>So, in summary I’ve got a user interface I don’t really like and can’t customise, which has worse graphical performance than on Gnome 2.x.</p>
<p>I feel quite sad to see the end of Gnome 2.x. It was a refined desktop that worked really well (particually the implementation from Ubuntu) and I’ve grown comfortable with it. Yes I know there is a 'classic mode' in Ubuntu which gives you Gnome 2, but Canonical have already said that option will not be there in 11.10. Sadly, I have not found Gnome 3 any better than Unity (which is the subject for another blog post perhaps). Xfce seems like a viable option, or even perhaps KDE4.</p>
</div>
<img src="http://feeds.feedburner.com/~r/Ukstokescom/~4/dRPkjlOfD0w" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://ukstokes.com/blog/2011/06/08/unity-ubuntu-11-04/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://ukstokes.com/blog/2011/06/08/unity-ubuntu-11-04/</feedburner:origLink></item>
		<item>
		<title>A cunning problem with for loops</title>
		<link>http://feedproxy.google.com/~r/Ukstokescom/~3/REhJfb0XJKQ/</link>
		<comments>http://ukstokes.com/blog/2011/03/18/a-cunning-problem-with-for-loops/#comments</comments>
		<pubDate>Fri, 18 Mar 2011 07:26:34 +0000</pubDate>
		<dc:creator>ben</dc:creator>
				<category><![CDATA[Desktop Linux]]></category>
		<category><![CDATA[Enterprise Linux]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[Bash scripting]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://ukstokes.com/blog/?p=815</guid>
		<description><![CDATA[I came across a cunning little problem with for loops where the values being parsed contain spaces, and can offer a couple of solutions to it. I'll explain what I mean with some code. If you md5sum a bunch of files, you get this kind of output: I wanted to iterate through a list of [...]]]></description>
			<content:encoded><![CDATA[<p>I came across a cunning little problem with for loops where the values being parsed contain spaces, and can offer a couple of solutions to it. I'll explain what I mean with some code.</p>
<p>If you md5sum a bunch of files, you get this kind of output:</p>
<pre class="brush: bash; title: ; notranslate">[ben@minitron ~]$ md5sum *.txt
d41d8cd98f00b204e9800998ecf8427e  myfile.txt
cdbd2b665e14f8803d6bddc80bff1402  omg.txt
6353f9b2e7c47f73b48eef4544968bcd  otherfile.txt</pre>
<p>I wanted to iterate through a list of files and their md5sums using a for loop, run a test and then take some action based on the result. But my script kept throwing unexpected output. I realised the for loop was parsing each word, rather than each line because of the spaces.</p>
<pre class="brush: bash; title: ; notranslate">[ben@minitron ~]$ for line in $(md5sum *.txt); do
echo $line; done
d41d8cd98f00b204e9800998ecf8427e
myfile.txt
cdbd2b665e14f8803d6bddc80bff1402
omg.txt
6353f9b2e7c47f73b48eef4544968bcd
otherfile.txt</pre>
<p>Sometimes putting spaces around variables can help bash to resolve values in the right way, but here it caused all line breaks to be removed:</p>
<pre class="brush: bash; title: ; notranslate">[ben@minitron ~]$ for line in &quot;$(md5sum *.txt)&quot;; do echo $line; done
d41d8cd98f00b204e9800998ecf8427e myfile.txt cdbd2b665e14f8803d6bddc80bff1402 omg.txt 6353f9b2e7c47f73b48eef4544968bcd otherfile.txt</pre>
<p>I needed to preserve the original line breaks in order for my script to make sense of which md5sum matched up to which file. There are a couple of ways to do this. One possible solution is to use <strong>tr </strong>to translate the spaces into a different character:</p>
<pre class="brush: bash; title: ; notranslate">[ben@minitron ~]$ for line in $(md5sum *.txt | tr &quot; &quot; :); do
echo $line; done
d41d8cd98f00b204e9800998ecf8427e::myfile.txt
cdbd2b665e14f8803d6bddc80bff1402::omg.txt
6353f9b2e7c47f73b48eef4544968bcd::otherfile.txt</pre>
<p>But for some reason md5sum uses 2 spaces for a field separator, if you wanted just one character between the md5sum and the filename, you could go a little more advanced:</p>
<pre class="brush: bash; title: ; notranslate">[ben@minitron ~]$ for file in *.txt; do
echo -n &quot;$file:&quot;;md5sum $file | cut -d &quot; &quot; -f1 ; done
myfile.txt:d41d8cd98f00b204e9800998ecf8427e
omg.txt:cdbd2b665e14f8803d6bddc80bff1402
otherfile.txt:6353f9b2e7c47f73b48eef4544968bcd</pre>
<p>This does give the output in the other way round but was good enough for me to make my script work.</p>
<img src="http://feeds.feedburner.com/~r/Ukstokescom/~4/REhJfb0XJKQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://ukstokes.com/blog/2011/03/18/a-cunning-problem-with-for-loops/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://ukstokes.com/blog/2011/03/18/a-cunning-problem-with-for-loops/</feedburner:origLink></item>
		<item>
		<title>Fedora 14 on a Samsung N210 netbook</title>
		<link>http://feedproxy.google.com/~r/Ukstokescom/~3/ZOCRzQ_dbZ4/</link>
		<comments>http://ukstokes.com/blog/2011/03/09/fedora-14-on-a-samsung-n210-netbook/#comments</comments>
		<pubDate>Wed, 09 Mar 2011 17:48:37 +0000</pubDate>
		<dc:creator>ben</dc:creator>
				<category><![CDATA[Desktop Linux]]></category>
		<category><![CDATA[Fedora]]></category>

		<guid isPermaLink="false">http://ukstokes.com/blog/?p=754</guid>
		<description><![CDATA[Here are some musings on getting Fedora 14 working on a Samsung N210 netbook. Why Samsung N210? It's undeniable the Next Big Thing is tablets. I love new tech and I kind of want an Android Honeycomb tab, but they are still waaaay over priced. I considered getting an iPad as Android tabs are still [...]]]></description>
			<content:encoded><![CDATA[<p>Here are some musings on getting Fedora 14 working on a Samsung N210 netbook.</p>
<p><strong>Why Samsung N210?</strong></p>
<p><a href="http://ukstokes.com/blog/wp-content/uploads/2011/03/Samsung-N210.jpg"><img class="size-thumbnail wp-image-799  alignleft" title="Samsung-N210" src="http://ukstokes.com/blog/wp-content/uploads/2011/03/Samsung-N210-150x150.jpg" alt="Samsung N210" width="84" height="84" /></a></p>
<p>It's undeniable the Next Big Thing is tablets. I love new tech and I kind of want an Android Honeycomb tab, but they are still waaaay over priced. I considered getting an iPad as Android tabs are still only just coming of age, but in the end I could not really justify double the cost of a netbook just for an alternate form factor and interface ... in my head I weighed up the following benefits of a netbook:</p>
<ul>
<li>More storage. The Samsung N210 has a 250Gb hard drive, big enough to fit all of my music and movies and still have extra room for iPlayer downloads - in fact it acts as backup for my desktop machine.</li>
<li>Better for typing. For example, writing this blog post.</li>
<li>Better for hacking. I guess this is debatable, since Android is a hackable platform.</li>
<li>A more practical on call companion. I can install work tools and vpn client and use it to rdp to my desktop. This can also be done from a tablet OS, but controling a mouse-driven desktop with fingers is tricky. Plus on a tablet when you bring up the keyboard, half of your screen is obscured.</li>
<li>Price. Netbooks are half the cost.</li>
</ul>
<p>There are possibly a few reasons why a tablet would be better.</p>
<ul>
<li>More convenient during rush hour commuting. You can stand up and pull it from your bag to read or watch a movie.</li>
<li>Battery life. I get about 6 hours from my netbook.  iPad  and competitors can go for about 9 hours I think.</li>
<li>Better interface. Another debatable one, most would agree that new tablet interfaces are pretty slick though.</li>
<li>More fun / better for gaming. But I don't really play games that much.</li>
<li>Portability. A tablet is marginally smaller and lighter.</li>
</ul>
<p>I think I am just not 100% sold on the tablet form factor yet, perhaps I will change my mind when tablets are more affordable.</p>
<p>So back to the N210 - by current netbook standards it pretty much falls into line with an Atom 1.6Ghz hyper threaded processor and 1Gb of RAM (I also purchased the 2Gb DIMM option from Amazon for £30). It only really sets itself apart from other similar netbooks by having a matt screen rather than glossy, which makes it more readable and less reflective in sunlight. I am averaging just over 6 hours of battery life between charges, this is with wireless and bluetooth always on, and usually with music streaming to bluetooth headphones or with video playing at full screen. The battery life is just below advertised but I am pleased with it. Amazon were selling it for just over £200 a few months ago because the Samsung were about to launch the successor to the N210 (which is pretty similar in specs but has a dual-core Atom chip).</p>
<p><strong>Why Fedora?</strong></p>
<p><img class="alignleft" title="Fedora Logo" src="http://ukstokes.com/images/fedora_logo.jpg" alt="Fedora Logo" width="78" height="78" />In my early days with Linux I hopped between distros a lot, but I had settled on Ubuntu and been a Ubuntu user until recently. But when I gave Ubuntu netbook remix (UNR) a test drive for a week I absolutely hated it. The UNR desktop called 'Unity' is a watered down experience for a power user, I couldn't even add an icon to the launcher bar and was frustrated that things like the file manager were difficult to access.</p>
<p>I don't resist change if there is good reason for it but I am getting annoyed by Ubuntu's deviation from standard conventions ... moving the close/maximise/minimise buttons to the left for no reason was their first bizarre move, and now moving the desktop experience to Unity on all Ubuntu installations has pretty much ended my interest in them.</p>
<p>A second reason, is since I use CentOS at work I thought I might get some technology previews by using it's upstream contributor - Fedora. I'll be able to get familiar with things like <a href="http://www.freedesktop.org/wiki/Software/systemd">SystemD</a> before they trickle down to Red Hat and derivatives.</p>
<p>I've also decided to use the traditional Gnome desktop rather than a netbook optimised environment, accepting that it will have a slightly bigger memory footprint than others - since this shoudn't be an issue for me with the 2b RAM upgrade.</p>
<p><strong>Configuration</strong></p>
<p>Like most netbooks the N210 doesn't have a CD tray, so I used <a href="http://unetbootin.sourceforge.net/">Unetbootin</a> to make a <a href="http://fedoraproject.org/get-fedora">Fedora</a> 14 USB stick and booted from that. And I was surprised to find almost everything worked from a fresh install! Desktop Linux has really come a long way since I first got my feet wet in 2005 ...</p>
<p>I noticed the Fn keys did not work, but the Fn volume control started working after I had updated all packages. The Fn controls for screen brightness were the only ones still not working, that was fixed by following instructions <a href="http://linuxtweaking.blogspot.com/2011/01/fedora-14-how-to-make-samsung-fn.html">here</a> and rebooting. The only major failure was the WiFi card which was not detected. The N210 uses a Realtek RTL8192E which is in the staging tree of the Fedora kernel, however rather than recompiling the kernel I chose to compile the driver from source as it seemed like less effort. The driver source can be found <a href="http://sites.google.com/site/johnfos...edirects=0&amp;d=1">here</a> - installing is straightforward:</p>
<pre class="brush: bash; title: ; notranslate">
su -
tar fzxv rtl8192e_linux_2.6.0014.0401.2010.tar.gz
cd rtl8192e_linux_2.6.0014.0401.2010
make
make install
reboot
</pre>
<p><strong>Note</strong>: WiFI drivers will break if the kernel is updated. Just return to your source directory and rebuild again (make &amp;&amp; make install) and it will be fixed. Or select to skip updates to the kernel package.</p>
<p>I was surprised to learn the touchpad on most Samsung netbooks are multitouch capable and let you use 2 fingered gestures for scrolling. To enable that in Fedora add the following to a file, make it executable and then set it as a startup application in the gnome preferences menu:</p>
<pre class="brush: bash; title: ; notranslate">
synclient VertTwoFingerScroll=1
synclient HorizTwoFingerScroll=1
synclient EmulateTwoFingerMinW=5
synclient EmulateTwoFingerMinZ=48
</pre>
<p>Credit goes to <a href="http://josthalen.wordpress.com/2010/07/03/linux-on-samsung-n210/">here</a> for that discovery. Failing that, just enable the "edge scrolling" feature in Gnome, which lets you scroll up and down using the right-hand edge of the touchpad.</p>
<p><strong>Sounds good to me</strong></p>
<p>I use Nokia BH-905 stereo bluetooth headphones paired with the netbook for music and video. This actually works out of the box, but A2DP is not enabled by default. After pairing your headset you have to open the Sound preferences dialog, on the Hardware tab choose A2DP, and on the Output tab you should then see you can select Stereo next to the headset. This is then remembered the next time you reboot.</p>
<div id="attachment_806" class="wp-caption alignright" style="width: 160px"><img class="size-thumbnail wp-image-806 " title="nokia-bh905" src="http://ukstokes.com/blog/wp-content/uploads/2011/03/nokia-bh905-150x150.jpg" alt="Nokia BH-905" width="150" height="150" /><p class="wp-caption-text">Nokia BH-905</p></div>
<p>With all the hardware problems sorted, the biggest problem in Fedora is with missing codecs for my movie files, I guess I should have known what I was getting into there with Fedora ... There isn't a package in the Fedora repos (like ubuntu-restricted-extras)  that sorts out codecs in one big hit. The bundled "Movie Player" causes selinux security failures if you try to let it find codecs automatically, and if you disable selinux and try again you will just get a Unable to find codecs message which links you to the <a href="https://fedoraproject.org/wiki/PackageKit_Items_Not_Found#Missing_Codec">fedora FAQ</a> (it basically says go and use Google, you're on your own).</p>
<p>So a bit of a FAIL by Fedora there, the codec discovery feature from "Movie Player" is basically completely broken and may as well not even be there. Oh well.</p>
<p><strong>Making it look pretty</strong></p>
<p>The standard Gnome desktop on Fedora is plain and simple and doesn't look very spectacular. I was looking for netbook optimised GTK themes and came across the <a href="http://tiheum.deviantart.com/art/Faenza-Icons-173323228">faenza icons</a> set (and the bokeh effect wallpaper from the same page), and <a href="http://gnome-look.org/content/show.php/Equinox+GTK+Engine?content=121881">Equinox GTK</a> theme for Gnome which look great. I also scrapped the bottom panel and replaced it with <a href="http://do.davebsd.com/wiki/Docky">Docky</a> for window switching and app launching.</p>
<p style="text-align: center;"><a href="http://ukstokes.com/images/desktop.png"><img title="My Desktop" src="http://ukstokes.com/images/desktop.png" alt="My Desktop" width="170" height="100" /></a><a href="http://ukstokes.com/images/desktop.png"><br />
</a><a href="http://ukstokes.com/images/desktop.png"><em>My Desktop</em></a></p>
<p>I use VLC as my media player for Video as it plays any file format without separate codec packages to be installed. I found a dark theme for VLC on their site that goes with my desktop theme.</p>
<p>The Plymouth boot screen was defaulting to an ugly failsafe mode. I just needed to rebuild my initrd and it looked good after that. I installed the Fedora Spinfinity theme which looks pretty good.</p>
<p><strong>Wrap up</strong><br />
Time to wrap up as this is already getting a bit waffly. I'm pleased with my Samsung N210. It's no powerhouse but with F14 installed it certainly runs faster than it did with the factory installed Windows 7 image. With a bit of tweaking everything in Fedora 14 is supported, and I think it's worth the effort. If you get stuck there is loads of support available. And with the regular releases you can ensure you're running the latest and greatest of everything, if like me, you're into that sort of thing.</p>
<img src="http://feeds.feedburner.com/~r/Ukstokescom/~4/ZOCRzQ_dbZ4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://ukstokes.com/blog/2011/03/09/fedora-14-on-a-samsung-n210-netbook/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://ukstokes.com/blog/2011/03/09/fedora-14-on-a-samsung-n210-netbook/</feedburner:origLink></item>
		<item>
		<title>Cycle London, with Android</title>
		<link>http://feedproxy.google.com/~r/Ukstokescom/~3/jLBQBCR7DmE/</link>
		<comments>http://ukstokes.com/blog/2011/02/18/cycle-london-with-android/#comments</comments>
		<pubDate>Fri, 18 Feb 2011 17:22:29 +0000</pubDate>
		<dc:creator>ben</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Cycling]]></category>
		<category><![CDATA[Fitness]]></category>
		<category><![CDATA[London]]></category>

		<guid isPermaLink="false">http://ukstokes.com/blog/?p=778</guid>
		<description><![CDATA[A few weeks ago I started using the London cycle hire scheme, aka 'Boris Bikes'. My journey to work previously included a 15 minute journey underground from Victoria to Embankment, but now I do it overground on a bike which is considerably more enjoyable (provided you don't mind cycling in heavy traffic) as well as [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft" title="Skating Android" src="http://ukstokes.com/android/images/skate1.gif" alt="" width="60" height="69" />A few weeks ago I started using the London cycle hire scheme, aka 'Boris Bikes'. My journey to work previously included a 15 minute journey underground from Victoria to Embankment, but now I do it overground on a bike which is considerably more enjoyable (provided you don't mind cycling in heavy traffic) as well as having some health benefits. The bikes are freaking heavy and only have 3 gears so you can't exactly go supersonic, but it's a cheap and more convenient alternative than bringing in a folding bike on the train. At the time of writing this, there are 4 location aware apps in the Market that can help you find nearby bike hire locations and see how many bikes and docks are available. Clearly this can save some wasted trips to docks with no bikes, or no slots to park your bike. I've been test driving these apps and here is my take on them.</p>
<p>1. Cycle Hire Widget - <a title="Market Link" href="https://market.android.com/details?id=com.littlefluffytoys.cyclehire">Market Link</a></p>
<p>This is quite a cool little app, despite the name there is more to it than just a widget. The widget hides under a homescreen icon of an Android riding a bike. When tapped, it reveals the directions of the 3 nearest docks, colour coded, the colours showing whether you can get a bike or a slot at the locations. This is very handy if you know your way around and can know which 3 docks it's pointing to.</p>
<p style="text-align: center;"><a href="http://ukstokes.com/android/images/widget1.png"><img title="Widget1.png" src="http://ukstokes.com/android/images/widget1.png" alt="View of home screen widget" width="120" height="200" /></a> <a href="http://ukstokes.com/android/images/widget2.png"><img title="Widget2.png" src="http://ukstokes.com/android/images/widget2.png" alt="Map view" width="120" height="200" /></a><a href="http://ukstokes.com/android/images/widget2.png"> </a><a href="http://ukstokes.com/android/images/widget3.png"><img title="Widget3.png" src="http://ukstokes.com/android/images/widget3.png" alt="List view" width="120" height="200" /></a><a href="http://ukstokes.com/android/images/widget3.png"><br />
</a><em>Home screen widget, map view, and list view</em></p>
<p>You can also view the docks in a list view, which is a relief as waiting for a) the map to build and b) the location/gps lock can be a bit tedious. I also discovered you can add docks to a list of favorites, if you pay for the premium version. I will probably do this as I am quite a fan. In terms of looks and usability, it rates quite high. The interface is obvious and easy to use. The dock data also seems to be accurate and up to date.</p>
<p>2. SpotCycle - <a title="Market Link" href="https://market.android.com/details?id=com.eightd.android.spotcycle">Market Link</a></p>
<p>I quite like SpotCycle, this is the one I've ended up using the most over the last few weeks, mostly because of the favorite docks lists. I guess most people in the cycle scheme are like me and visit the same docks every day. I've found going to a list of these is always going to be quicker than opening a map view, waiting for the map data to load, waiting for location and GPS lock, etc. I have to admit though, I had to spend some time to figure out how to create the groups for storing favorites. Those options are hidden away in a place where you don't expect.</p>
<p style="text-align: center;"><a href="http://ukstokes.com/android/images/spotcycle1.png"><img title="spotcycle1.png" src="http://ukstokes.com/android/images/spotcycle1.png" alt="Favorites" width="120" height="200" /></a> <a href="http://ukstokes.com/android/images/spotcycle2.png"><img title="spotcycle2.png" src="http://ukstokes.com/android/images/spotcycle2.png" alt="Map view" width="120" height="200" /></a><a href="http://ukstokes.com/android/images/spotcycle2.png"><br />
</a><em>SpotCycle: Favorites and Map views</em></p>
<p>The map view is pretty decent, it shows you circles of varying sizes and shades of red, to denote availability of bikes or docks. The data has always been up to date with this app, I've never turned up and been completely surprised at how wrong it was. A few criticisms: sometimes it stays on the splash screen for an unacceptable long time. Not sure what it's busy doing, maybe getting location data or refreshing the lists, but it's quite annoying. It also frequently says "Can't get cities list, make sure you are connected to the Internet" - well, it's a smartphone, I am always connected to the Internet! Another annoyance is it throws errors into the notification area when it can't update the dock data, to be honest I don't really want to see those. I would prefer it if could just try again later and keep quiet about it.  Over all I like it though, it's very configurable and despite annoyances it's reliable, and offers a lot of features. Being able to keep lists of favorites is a big win.</p>
<p>3. London Cycle Hire Live - <a title="Market Link" href="https://market.android.com/details?id=com.mobspot.cycle">Market Link</a></p>
<p>Your mileage may vary, but I didn't really have success with this app. It only has 2 stars in the Market which I guess is a fairly accurate measure of it's quality. It worked sometimes, but usually crashed with the error in the screenshot below. I have had apps Force Close on me before, but never seen anything like this.</p>
<p style="text-align: center;"><a href="http://ukstokes.com/android/images/london_cycle_hire.png"><img title="london_cycle_hire.png" src="http://ukstokes.com/android/images/london_cycle_hire.png" alt="Aw .. snap!" width="120" height="200" /></a><br />
<em>Holy crap.</em></p>
<p>This may be worth coming back to if the dev is still working on it, I didn't spend much more time checking it out though.</p>
<p>4. Boris Bikes Live - <a title="Market Link" href="https://market.android.com/details?id=com.errayane.android.bcs">Market Link</a></p>
<p>I like the eye-catching icon of our beloved Mayor of London riding the bike, but sadly you don't get a good first impression when you open this app. The landing screen is ugly as hell, the icons are lousy. Putting its initial appearance to one side though, the functionality should be pretty good. It basically offers a map, a list of docks ordered by proximity, list of favorites, and a timer (which is not yet implemented) so you can keep an eye on your journey times (because journeys that take less than 30 minutes are free). The presentation in the rest of the app is fine, and from the list views you can select a dock and get directions to it.</p>
<p style="text-align: center;"><a href="http://ukstokes.com/android/images/boris1.png"><img title="boris1.png" src="http://ukstokes.com/android/images/boris1.png" alt="List view" width="120" height="200" /></a> <a href="http://ukstokes.com/android/images/boris2.png"><img title="boris2.png" src="http://ukstokes.com/android/images/boris2.png" alt="Map view" width="120" height="200" /></a><a href="http://ukstokes.com/android/images/boris2.png"><br />
</a><em>Boris Bikes Live. It's got a nice icon.</em></p>
<p>With those functions it should really tick the boxes, but I seem to have issues with the bike data being out of date. The last thing you need to to turn up to dock your bike and unexpectedly find all the slots are taken. The update interval is not configurable so I don't think there's much that can be done about it. For that reason and because of the lack of aesthetics, I kept falling back to SpotCycle.</p>
<p>5. London Cycle Hire - <a title="Market Link" href="https://market.android.com/details?id=info.ifuller1.cycleHire">Market Link</a></p>
<p><a title="Market Link" href="https://market.android.com/details?id=info.ifuller1.cycleHire"></a> This is a paid for app. It's only £1.50 but to be honest is not really worth it. Although it's quite well presented, it really just consists of a map with the docks overlayed over the top, but they aren't colour coded or anything like that so at a glance you really can't see any helpful data apart from the location. Clicking on the dock locations then shows you the live data and a button which plots a route there from your current location.</p>
<p style="text-align: center;"><a href="http://ukstokes.com/android/images/cycle-london.png"><img title="cycle-london.png" src="http://ukstokes.com/android/images/cycle-london.png" alt="Another app" width="120" height="200" /></a><br />
<em>More of the same, but more expensive.</em></p>
<p>I emailed the dev and they said they are actively working on this app and they intend to release an updated version which has user maintained lists. Until then I guess I will use something else.</p>
<p><span style="text-decoration: underline;">Conclusion</span></p>
<p>My testing is by no means exhaustive, but so far I reckon SpotCycle and Cycle Hire Widget are the best. Cycle Hire Widget probably has an easier to use interface, but once you have SpotCycle set up with your favorite groups, you will rarely need to use anything else.</p>
<img src="http://feeds.feedburner.com/~r/Ukstokescom/~4/jLBQBCR7DmE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://ukstokes.com/blog/2011/02/18/cycle-london-with-android/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://ukstokes.com/blog/2011/02/18/cycle-london-with-android/</feedburner:origLink></item>
		<item>
		<title>Monitor AJP threads on multiple Tomcat servers</title>
		<link>http://feedproxy.google.com/~r/Ukstokescom/~3/DEr4_UyED0E/</link>
		<comments>http://ukstokes.com/blog/2011/02/04/monitor-ajp-threads-on-multiple-tomcat-servers/#comments</comments>
		<pubDate>Fri, 04 Feb 2011 06:57:18 +0000</pubDate>
		<dc:creator>ben</dc:creator>
				<category><![CDATA[Enterprise Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[tomcat]]></category>

		<guid isPermaLink="false">http://ukstokes.com/blog/?p=764</guid>
		<description><![CDATA[Here's a script to gather AJP thread usage from a farm of tomcat servers, in my case I needed to query 120 tomcat instances spread over 30 servers. It uses a freely avaiable JMX command line client to query the currentThreadsBusy of the JVM. There are perhaps more elegant solutions to do this, I needed [...]]]></description>
			<content:encoded><![CDATA[<p>Here's a script to gather AJP thread usage from a farm of tomcat servers, in my case I needed to query 120 tomcat instances spread over 30 servers. It uses a freely avaiable JMX command line client to query the currentThreadsBusy of the JVM. There are perhaps more elegant solutions to do this, I needed a quick solution.</p>
<p><strong>Notes<br />
</strong>One thing I have noticed with command line Java utilities, is they always output to stdErr. So if you want to grep or awk the output of the commands you have to redirect that to stdIn first, hence the "2&gt;&amp;1".</p>
<ul>
<li>Replace <strong>user:pass</strong> with the JMX username and password set in jmx.properties</li>
<li>Replace <strong>server</strong> with the first part of your server name</li>
<li>Replace the port numbers with the JMX ports your servers are using.</li>
<li>Finally you'll need to change the paths to the log file and the JMX client.</li>
<li>The variables "one","three", "five" and "seven" can be changed to anything you want. It makes sense to call them this in my environment.</li>
</ul>
<pre class="brush: bash; title: ; notranslate">#!/bin/bash
while true; do

 export now=$(date +%Y-%m-%d)
 export log=/path/to/ajp_all_tomcat_${now}.log
  if [ ! -f $log ]; then
   echo -n &quot;Start AJP thread count log
Time&quot; &gt; $log;
   for s in $(seq -w 1 30); do for i in 1 3 5 7; do echo -n &quot;,server${s}tc0${i}&quot; &gt;&gt; $log; done; done
   echo &gt;&gt; $log
  fi

 echo -n $(date +%H:%M:%S) &gt;&gt; $log
 for s in $(seq -w 1 30); do
  export one=$(/usr/bin/java -jar /path/to/cmdline-jmxclient-0.10.3.jar user:pass server${s}:7601 &quot;Catalina:type=ThreadPool,name=ajp-7501&quot; currentThreadsBusy 2&gt;&amp;1 | awk '{print $6}')
  export three=$(/usr/bin/java -jar /path/to/cmdline-jmxclient-0.10.3.jar user:pass server${s}:7603 &quot;Catalina:type=ThreadPool,name=ajp-7503&quot; currentThreadsBusy 2&gt;&amp;1 | awk '{print $6}')
  export five=$(/usr/bin/java -jar /path/to/cmdline-jmxclient-0.10.3.jar user:pass server${s}:7605 &quot;Catalina:type=ThreadPool,name=ajp-7505&quot; currentThreadsBusy 2&gt;&amp;1 | awk '{print $6}')
  export seven=$(/usr/bin/java -jar /path/to/cmdline-jmxclient-0.10.3.jar user:pass server${s}:7607 &quot;Catalina:type=ThreadPool,name=ajp-7507&quot; currentThreadsBusy 2&gt;&amp;1 | awk '{print $6}')
  echo -n &quot;,$one,$three,$five,$seven&quot; &gt;&gt; $log
 done
 echo &gt;&gt; $log

done
</pre>
<img src="http://feeds.feedburner.com/~r/Ukstokescom/~4/DEr4_UyED0E" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://ukstokes.com/blog/2011/02/04/monitor-ajp-threads-on-multiple-tomcat-servers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://ukstokes.com/blog/2011/02/04/monitor-ajp-threads-on-multiple-tomcat-servers/</feedburner:origLink></item>
		<item>
		<title>Automatic X forwarding</title>
		<link>http://feedproxy.google.com/~r/Ukstokescom/~3/3FQBZwkSKCU/</link>
		<comments>http://ukstokes.com/blog/2010/11/10/automatic-x-forwarding/#comments</comments>
		<pubDate>Wed, 10 Nov 2010 22:05:46 +0000</pubDate>
		<dc:creator>ben</dc:creator>
				<category><![CDATA[Desktop Linux]]></category>
		<category><![CDATA[Enterprise Linux]]></category>

		<guid isPermaLink="false">http://ukstokes.com/blog/?p=733</guid>
		<description><![CDATA[At work I've found I often need to bring up X applications like jvisualvm, or HPSUM, while I administer Linux servers from my Windows 7 machine. This is how I automatically set the $DISPLAY variable on the bash session to point to my machine: Add the following to the end of your .bash_profile: Then on [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://ukstokes.com/blog/wp-content/uploads/2010/11/xorg.jpg"><img src="http://ukstokes.com/blog/wp-content/uploads/2010/11/xorg-150x150.jpg" alt="" title="xorg" width="80" height="80" class="alignleft size-thumbnail wp-image-743" /></a>At work I've found I often need to bring up X applications like jvisualvm, or HPSUM, while I administer Linux servers from my Windows 7 machine. This is how I automatically set the $DISPLAY variable on the bash session to point to my machine:</p>
<p>Add the following to the end of your .bash_profile:</p>
<pre class="brush: bash; title: ; notranslate">export DISPLAY=$(who am i | awk -F &quot;(&quot; {'print $2'} | awk -F &quot;.&quot; {'print $1'}):0.0</pre>
<p>Then on my Windows 7 laptop, I installed <a href="http://sourceforge.net/projects/xming/files/">xming</a> and configured xlaunch to start automatically when the computer is started (with the "no access control" box ticked). </p>
<p>Now I can just SSH to servers and launch X apps, and they appear on my desktop with no configuration required.</p>
<img src="http://feeds.feedburner.com/~r/Ukstokescom/~4/3FQBZwkSKCU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://ukstokes.com/blog/2010/11/10/automatic-x-forwarding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://ukstokes.com/blog/2010/11/10/automatic-x-forwarding/</feedburner:origLink></item>
	</channel>
</rss>

