<?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>Ten Fingers And A Brain</title>
	<atom:link href="http://ten-fingers-and-a-brain.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://ten-fingers-and-a-brain.com</link>
	<description>Martin Lormes on Wordpress, PHP, Nagios, XML, FileMaker, BlackBerry, Arduino</description>
	<lastBuildDate>Sun, 15 Jan 2012 19:13:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>3.19 – The Web Hosting Bandwidth Constant</title>
		<link>http://ten-fingers-and-a-brain.com/2012/01/3-19-the-web-hosting-bandwidth-constant/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=3-19-the-web-hosting-bandwidth-constant</link>
		<comments>http://ten-fingers-and-a-brain.com/2012/01/3-19-the-web-hosting-bandwidth-constant/#comments</comments>
		<pubDate>Sun, 15 Jan 2012 19:13:09 +0000</pubDate>
		<dc:creator>Martin Lormes</dc:creator>
				<category><![CDATA[Anything else]]></category>
		<category><![CDATA[hosting]]></category>

		<guid isPermaLink="false">http://ten-fingers-and-a-brain.com/?p=366</guid>
		<description><![CDATA[In case you've ever wondered what the monthly traffic allowance in your web hosting plan means in bandwidth, here's an easy-to-remember number: 3.19 (month kbit) / (sec GB) – I shall call this the Brian Adkins number Under the assumption that traffic from a web server only flows in one direction it means that for [...]]]></description>
			<content:encoded><![CDATA[<div><div style="float: left; margin: 0 0px 5px 0;"><g:plusone size="medium" href="http://ten-fingers-and-a-brain.com/2012/01/3-19-the-web-hosting-bandwidth-constant/"></g:plusone></div><div style="float: left; margin: 0 30px 5px 0;"><a class="FlattrButton" style="display:none;" title="3.19 – The Web Hosting Bandwidth Constant" rev="flattr;uid:tfnab;category:text;language:en_GB;button:compact;" href="http://ten-fingers-and-a-brain.com/2012/01/3-19-the-web-hosting-bandwidth-constant/">In case you've ever wondered what the monthly traffic allowance in your web hosting plan means in bandwidth, here's an easy-to-remember number: 3.19 (month kbit) / (sec GB) – I shall call this the Brian Adkins number Under the assumption that traffic from a web server only flows in one direction it means that for every GB (gigabyte) of monthly traffic included in your plan you could consume 3.19 kbit/s constantly. Or for every TB (terabyte) of traffic allowed per month you can transmit data at a constant rate of 3.19 Mbit/s.</a></div><div style="float: left; margin: 0 15px 5px 0;"><a style="display:none;" href="http://twitter.com/share?url=http%3A%2F%2Ften-fingers-and-a-brain.com%2F2012%2F01%2F3-19-the-web-hosting-bandwidth-constant%2F&amp;via=10fnab&amp;text=3.19%20%E2%80%93%20The%20Web%20Hosting%20Bandwidth%20Constant&amp;count=horizontal" class="twitter-share-button">Tweet</a></div><div style="float: left; margin: 0 0px 5px 0;"><fb:like href="http://ten-fingers-and-a-brain.com/2012/01/3-19-the-web-hosting-bandwidth-constant/" layout="button_count"></fb:like></div></div><div style="clear: both;"></div><p>In case you&#8217;ve ever wondered what the monthly traffic allowance in your web hosting plan means in bandwidth, here&#8217;s an easy-to-remember number:</p>
<p><strong>3.19 (month kbit) / (sec GB)</strong> – I shall call this the <a href="http://lojic.com/blog/2007/09/03/web-hosting-bandwidth-constant/">Brian Adkins number</a></p>
<p>Under the assumption that traffic from a web server only flows in one direction it means that for every GB (gigabyte) of monthly traffic included in your plan you could consume 3.19 kbit/s constantly. Or for every TB (terabyte) of traffic allowed per month you can transmit data at a constant rate of 3.19 Mbit/s.</p>
]]></content:encoded>
			<wfw:commentRss>http://ten-fingers-and-a-brain.com/2012/01/3-19-the-web-hosting-bandwidth-constant/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New WordPress Plugin: Smart Quotes</title>
		<link>http://ten-fingers-and-a-brain.com/2012/01/new-wordpress-plugin-smart-quotes/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=new-wordpress-plugin-smart-quotes</link>
		<comments>http://ten-fingers-and-a-brain.com/2012/01/new-wordpress-plugin-smart-quotes/#comments</comments>
		<pubDate>Wed, 11 Jan 2012 00:26:37 +0000</pubDate>
		<dc:creator>Martin Lormes</dc:creator>
				<category><![CDATA[WordPress Plugins]]></category>
		<category><![CDATA[i18n]]></category>
		<category><![CDATA[L10n]]></category>
		<category><![CDATA[typography]]></category>

		<guid isPermaLink="false">http://ten-fingers-and-a-brain.com/?p=353</guid>
		<description><![CDATA[There is a nifty function in WordPress that automagically turns so-called &#34;straight&#34; or &#34;dumb&#34; quotes into so-called "smart" or "curly" quotes. (Look at the last sentence closely: There's a difference between the various quotation marks.) Different languages use different quotation marks, e.g. Germans use a lower double quotation mark (&#8222;) to open a quotation. The [...]]]></description>
			<content:encoded><![CDATA[<div><div style="float: left; margin: 0 0px 5px 0;"><g:plusone size="medium" href="http://ten-fingers-and-a-brain.com/wordpress-plugins/smart-quotes/"></g:plusone></div><div style="float: left; margin: 0 30px 5px 0;"><a class="FlattrButton" style="display:none;" title="Smart Quotes" rev="flattr;uid:tfnab;category:text;language:en_GB;button:compact;" href="http://ten-fingers-and-a-brain.com/wordpress-plugins/smart-quotes/">There is a nifty function in WordPress that automagically turns so-called &quot;straight&quot; or &quot;dumb&quot; quotes into so-called "smart" or "curly" quotes. (Look at the last sentence closely: There's a difference between the various quotation marks.) Different languages use different quotation marks, e.g. Germans use a lower double quotation mark (&#8222;) to open a quotation. The double curly quotation mark that the English use to open (&#8220;) the Germans use to close a quotation. So built right into WordPress is the option for translators to change the look of the smart quotes in the language files. However there are two caveats which I address in the plugin "Smart Quotes": Many languages have alternative styles, depending on personal taste, industry tradition, etc., or some languages are spoken in multiple countries, but countries speaking the same language may still use different quotation marks – e.g. Germans use &#8222;&#8230;&#8220; whereas the German-speaking Swi...</a></div><div style="float: left; margin: 0 15px 5px 0;"><a style="display:none;" href="http://twitter.com/share?url=http%3A%2F%2Ften-fingers-and-a-brain.com%2F2012%2F01%2Fnew-wordpress-plugin-smart-quotes%2F&amp;via=10fnab&amp;text=New%20WordPress%20Plugin%3A%20Smart%20Quotes&amp;count=horizontal" class="twitter-share-button">Tweet</a></div><div style="float: left; margin: 0 0px 5px 0;"><fb:like href="http://ten-fingers-and-a-brain.com/wordpress-plugins/smart-quotes/" layout="button_count"></fb:like></div></div><div style="clear: both;"></div><p>I have recently released my newest WordPress plugin to the public:</p>
<p><a href="http://ten-fingers-and-a-brain.com/wordpress-plugins/smart-quotes/">Smart Quotes</a> should appeal to the international audience. E.g. if you&#8217;re a German writer and would like to use German book style quotation marks (&#187;&#8230;&#171;) even when you type so-called &quot;dumb&quot; quotes or use the &lt;q> element: This plugin is for you!</p>
<p>Right now the plugin comes with shortcuts for Croatian/Hungarian/Polish/Romanian style quotation marks (&#8222;&#8230;&#8221;), Czech or German style (&#8222;&#8230;&#8220;), Danish (or German books) style (&#187;&#8230;&#171;), Finnish or Swedish style (&#8221;&#8230;&#8221;), French style (&#171;&nbsp;&#8230;&nbsp;&#187; &ndash; with spaces), Greek/Italian/Norwegian/Portuguese/Russian/Spanish/Swiss style (&#171;&#8230;&#187; &ndash; without spaces), Japanese or Traditional Chinese style (&#12300;&#8943;&#12301;), but you&#8217;re free to manually enter/paste any arbitrary characters or character combinations.</p>
<p><a class="download" href="http://downloads.wordpress.org/plugin/smart-quotes.zip">Download &#8220;Smart Quotes&#8221; (.zip) now</a></p>
<p>After you&#8217;ve <a href="http://wordpress.org/extend/plugins/smart-quotes/installation/">installed</a> the plugin go to your Wrting Settings screen where you will find this:</p>
<p><img src="http://ten-fingers-and-a-brain.com/wp-content/uploads/2012/01/screenshot-1.png" alt="Screenshot of Smart Quotes Settings" width="500" height="129" class="alignnone size-full wp-image-354" /></p>
<p>Right now the plugin comes in English and with a German translation, but for &#8220;Smart Quotes&#8221; I&#8217;d be particularly interested in adding more languages. Contact me if you think you can help! The <a href="http://plugins.svn.wordpress.org/smart-quotes/trunk/smart-quotes.pot">.POT file</a> for this one is really small, so I&#8217;m thinking it could be a quick fix. – If you have never translated software before: <a href="http://forums.lesterchan.net/index.php?topic=108.0">this thread on Lester Chan&#8217;s Forums</a> is a good start and it&#8217;s specific to WordPress plugins.</p>
]]></content:encoded>
			<wfw:commentRss>http://ten-fingers-and-a-brain.com/2012/01/new-wordpress-plugin-smart-quotes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nagios Plugin to check a Subversion Working Copy for Modifications</title>
		<link>http://ten-fingers-and-a-brain.com/2012/01/nagios-plugin-to-check-a-subversion-working-copy-for-modifications/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=nagios-plugin-to-check-a-subversion-working-copy-for-modifications</link>
		<comments>http://ten-fingers-and-a-brain.com/2012/01/nagios-plugin-to-check-a-subversion-working-copy-for-modifications/#comments</comments>
		<pubDate>Mon, 09 Jan 2012 22:29:28 +0000</pubDate>
		<dc:creator>Martin Lormes</dc:creator>
				<category><![CDATA[Nagios]]></category>
		<category><![CDATA[Nagios Plugins]]></category>
		<category><![CDATA[Subversion]]></category>
		<category><![CDATA[nagios]]></category>
		<category><![CDATA[nagios-plugins]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://ten-fingers-and-a-brain.com/?p=343</guid>
		<description><![CDATA[I use revision control systems for almost all of my software development, deployment, and server configuration. When using Subversion there is, technically, no difference between a working copy on my personal or development machines vs. a working copy on a production server. (Yes, you need a working copy on the production server, because exports cannot [...]]]></description>
			<content:encoded><![CDATA[<div><div style="float: left; margin: 0 0px 5px 0;"><g:plusone size="medium" href="http://ten-fingers-and-a-brain.com/2012/01/nagios-plugin-to-check-a-subversion-working-copy-for-modifications/"></g:plusone></div><div style="float: left; margin: 0 30px 5px 0;"><a class="FlattrButton" style="display:none;" title="Nagios Plugin to check a Subversion Working Copy for Modifications" rev="flattr;uid:tfnab;category:text;language:en_GB;button:compact;" href="http://ten-fingers-and-a-brain.com/2012/01/nagios-plugin-to-check-a-subversion-working-copy-for-modifications/">I use revision control systems for almost all of my software development, deployment, and server configuration. When using Subversion there is, technically, no difference between a working copy on my personal or development machines vs. a working copy on a production server. (Yes, you need a working copy on the production server, because exports cannot be updated that easily.) However, modifications of the checked out code or config files on a production server can cause problems with the next round of updates. Sometimes you just don't notice that there are conflicts that need to be resolved. To make sure I notice when a colleague or I have fallen back into the bad habit of changing things on a production server directly, rather than checking in changes to the repository, I have created a Nagios Plugin: it's called "check_svnstatus" You can download, clone, or fork the plugin from my GitHub repository for Nagios plugins. (I know it's a bit ironic to host this here.) If you're unfami...</a></div><div style="float: left; margin: 0 15px 5px 0;"><a style="display:none;" href="http://twitter.com/share?url=http%3A%2F%2Ften-fingers-and-a-brain.com%2F2012%2F01%2Fnagios-plugin-to-check-a-subversion-working-copy-for-modifications%2F&amp;via=10fnab&amp;text=Nagios%20Plugin%20to%20check%20a%20Subversion%20Working%20Copy%20for%20Modifications&amp;count=horizontal" class="twitter-share-button">Tweet</a></div><div style="float: left; margin: 0 0px 5px 0;"><fb:like href="http://ten-fingers-and-a-brain.com/2012/01/nagios-plugin-to-check-a-subversion-working-copy-for-modifications/" layout="button_count"></fb:like></div></div><div style="clear: both;"></div><p>I use <a href="http://en.wikipedia.org/wiki/Revision_control">revision control</a> systems for almost all of my software development, deployment, and server configuration. When using <a href="http://subversion.apache.org/">Subversion</a> there is, technically, no difference between a working copy on my personal or development machines vs. a working copy on a production server. (Yes, you need a working copy on the production server, because exports cannot be updated that easily.) However, modifications of the checked out code or config files on a production server can cause problems with the next round of updates. Sometimes you just don&#8217;t notice that there are conflicts that need to be resolved.</p>
<p>To make sure I notice when a colleague or I have fallen back into the bad habit of changing things on a production server directly, rather than checking in changes to the repository, I have created a Nagios Plugin: it&#8217;s called &#8220;check_svnstatus&#8221;</p>
<p><span id="more-343"></span></p>
<p>You can <a href="https://github.com/tfnab/tfnab-nagios-plugins" title="My Nagios Plugins on GitHub">download, clone, or fork the plugin from my GitHub repository for Nagios plugins</a>. (I know it&#8217;s a bit ironic to host this here.) If you&#8217;re unfamiliar with GitHub: <a href="https://github.com/tfnab/tfnab-nagios-plugins/zipball/master" title="My Nagios Plugins on GitHub, .zip download">here&#8217;s a .zip version</a>, and <a href="https://github.com/tfnab/tfnab-nagios-plugins/tarball/master" title="My Nagios Plugins on GitHub, .tar.gz download">here&#8217;s a .tar.gz version</a>.</p>
<h3>Installation and Configuration</h3>
<p>Copy <code>check_svnstatus.sh</code> to your Nagios plugins directory. Usually this will be <code>/usr/lib/nagios/plugins</code> or <code>/usr/local/nagios/libexec</code> but your environment may be different. The plugin needs to be copied to the same server as your working copy, i.e. if you&#8217;re watching working copies on different servers you need the plugin on all of those servers.</p>
<p>Make <code>check_svnstatus.sh</code> executable:</p>
<pre class="brush: bash; title: ; notranslate">
chmod +x check_svnstatus.sh
</pre>
<p>You can test the plugin now by manually invoking it:</p>
<pre class="brush: bash; title: ; notranslate">
/path/to/check_svnstatus.sh -d /your/working-copy
</pre>
<p>You should see &#8220;OK: working copy at /your/working-copy is unmodified&#8221;, but &#8220;CRITICAL: working copy at /your/working-copy contains modifications&#8221; would also be OK for the moment; you can clean up later.</p>
<p>Now we need this to be run from Nagios&#8230; Things will be slightly different depending on whether your working copy resides on the same server as Nagios or on a different server. Lets start with a local working copy, i.e. one that&#8217;s on the same server as your Nagios install.</p>
<p>First you need a Nagios command. If you&#8217;re still using a modified version of the sample configuration files (nothing wrong with that!) append this to <code>commands.cfg</code>:</p>
<pre class="brush: plain; title: ; notranslate">
define command{
  command_name check_local_svnstatus
  command_line $USER1$/check_svnstatus.sh -d $ARG1$
}
</pre>
<p>Then you can add a service definition, e.g. append these lines to <code>localhost.cfg</code>:</p>
<pre class="brush: plain; title: ; notranslate">
define service{
  use                 local-service
  host_name           localhost
  service_description SVN ST /your/working-copy
  check_command       check_local_svnstatus!/your/working-copy
}
</pre>
<p>Reload the Nagios configuration (or, if you get the hint: check in the config changes to your Subversion repository, then run <code>svn update</code> on the config directory on your Nagios server, then run something like <code>service nagios reload</code>) and Nagios will schedule the first check of your working copy&#8230; Things will be very straightforward and self-explaining from here.</p>
<p>Now if your working copy is on a different server than your Nagios install, you need a method to invoke the plugin remotely. There are various methods for doing so, and there tend to be lengthier discussions about the pros and cons, but please keep in mind that this post is <em>not</em> about remote invocation methods. For this example I&#8217;ll be using <a href="http://nagiosplugins.org/man/check_by_ssh">check_by_ssh</a> but <a href="http://nagios.sourceforge.net/docs/nrpe/NRPE.pdf" title="NRPE Documentation (PDF)">NRPE</a> or other methods will work as well. If you&#8217;re unfamiliar with remote invocation and/or you&#8217;ve never run &#8220;check_by_ssh&#8221; before you should get this sorted out first, e.g. by reading <a href="http://www.techrepublic.com/blog/opensource/remotely-monitor-servers-with-the-nagios-checkbyssh-plugin/321" title="Remotely monitor servers with the Nagios check_by_ssh plugin">this post on TechRepublic</a>.</p>
<div class="insert" style="background-color:#fe0;">The following example relies on &#8220;check_by_ssh&#8221; and thus requires additional configuration which is not covered in this article!</div>
<p>Again you need a Nagios command. Append this to <code>commands.cfg</code>:</p>
<pre class="brush: plain; title: ; notranslate">
define command{
  command_name check_ssh_svnstatus
  command_line $USER1$/check_by_ssh -H $HOSTADDRESS$ -C &quot;/path/to/check_svnstatus.sh -d $ARG1$&quot;
}
</pre>
<p>Note: <code>/path/to/check_svnstatus.sh</code> should be the location on the remote server. This path may be a different than the location of your plugins on the Nagios server itself.</p>
<p>Then you can add a service definition the server&#8217;s .cfg file:</p>
<pre class="brush: plain; title: ; notranslate">
define service{
  use                 generic-service
  host_name           servername
  service_description SVN ST /your/working-copy
  check_command       check_ssh_svnstatus!/your/working-copy
}
</pre>
<p>Once again: reload the Nagios configuration and Nagios will schedule the first check of your working copy&#8230; Things will be as straightforward and self-explaining as they were for a local working copy.</p>
<p>By the way: You can also call this a poor-man&#8217;s <a href="http://en.wikipedia.org/wiki/Intrusion_detection_system" title="Intrusion detection system">IDS</a> as it will trigger alerts when someone exploits your website and drops or alters PHP or other files in your htdocs directory (if you&#8217;re using Subversion to deploy).</p>
<p>Oh, and think about this: It might be good idea to put your Nagios configuration in a Subversion repository. Whether or not you end up monitoring the working copy on the Nagios server.</p>
<h3>Additional reading</h3>
<p>If you&#8217;ve been scratching your head over the &#8220;deployment&#8221; remark in my opening sentence you might want to follow these links:</p>
<ul>
<li><a href="http://josephscott.org/archives/2009/02/installing-wordpress-as-a-subversion-checkout-or-external-in-a-subdirectory/">Joseph Scott: Installing WordPress As A Subversion Checkout (Or External) In A Subdirectory</a></li>
<li><a href="http://codex.wordpress.org/Installing_WordPress_With_Clean_Subversion_Repositories">WordPress Codex: Installing WordPress With Clean Subversion Repositories</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://ten-fingers-and-a-brain.com/2012/01/nagios-plugin-to-check-a-subversion-working-copy-for-modifications/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Subversion post-commit hook E-mail report script that sends the diff as an attachment</title>
		<link>http://ten-fingers-and-a-brain.com/2012/01/subversion-post-commit-hook-e-mail-report-script-that-sends-the-diff-as-an-attachment/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=subversion-post-commit-hook-e-mail-report-script-that-sends-the-diff-as-an-attachment</link>
		<comments>http://ten-fingers-and-a-brain.com/2012/01/subversion-post-commit-hook-e-mail-report-script-that-sends-the-diff-as-an-attachment/#comments</comments>
		<pubDate>Sun, 08 Jan 2012 11:27:19 +0000</pubDate>
		<dc:creator>Martin Lormes</dc:creator>
				<category><![CDATA[E-Mail]]></category>
		<category><![CDATA[Subversion]]></category>
		<category><![CDATA[diff]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[hooks]]></category>
		<category><![CDATA[notifications]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://ten-fingers-and-a-brain.com/?p=341</guid>
		<description><![CDATA[I'm using the post-commit hook to send out E-mail notifications when changes are committed to Subversion repositories. If you search the web you'll find a ton of scripts in various languages for this purpose. They all do more or less the same thing: create an E-mail message for the commit, including such details as the [...]]]></description>
			<content:encoded><![CDATA[<div><div style="float: left; margin: 0 0px 5px 0;"><g:plusone size="medium" href="http://ten-fingers-and-a-brain.com/2012/01/subversion-post-commit-hook-e-mail-report-script-that-sends-the-diff-as-an-attachment/"></g:plusone></div><div style="float: left; margin: 0 30px 5px 0;"><a class="FlattrButton" style="display:none;" title="Subversion post-commit hook E-mail report script that sends the diff as an attachment" rev="flattr;uid:tfnab;category:text;language:en_GB;button:compact;" href="http://ten-fingers-and-a-brain.com/2012/01/subversion-post-commit-hook-e-mail-report-script-that-sends-the-diff-as-an-attachment/">I'm using the post-commit hook to send out E-mail notifications when changes are committed to Subversion repositories. If you search the web you'll find a ton of scripts in various languages for this purpose. They all do more or less the same thing: create an E-mail message for the commit, including such details as the revision author, number, timestamp, a list of the paths that were changed, and a diff of the changes. For one particular project I wanted the diff as an attachment, though, rather than inline in the message text. So I ended up writing my own script. It's a Shell script that should work on most Unix/Linux based systems. Source code Installation instructions To install this for your repository: Copy commit-report.sh to the server hosting your repository, for instance to /usr/local/bin, and make sure it's executable (run chmod +x commit-report.sh) Check line #2 of commit-report.sh – you may need to change that address depending on your individual circumstances I remove...</a></div><div style="float: left; margin: 0 15px 5px 0;"><a style="display:none;" href="http://twitter.com/share?url=http%3A%2F%2Ften-fingers-and-a-brain.com%2F2012%2F01%2Fsubversion-post-commit-hook-e-mail-report-script-that-sends-the-diff-as-an-attachment%2F&amp;via=10fnab&amp;text=Subversion%20post-commit%20hook%20E-mail%20report%20script%20that%20sends%20the%20diff%20as%20an%20attachment&amp;count=horizontal" class="twitter-share-button">Tweet</a></div><div style="float: left; margin: 0 0px 5px 0;"><fb:like href="http://ten-fingers-and-a-brain.com/2012/01/subversion-post-commit-hook-e-mail-report-script-that-sends-the-diff-as-an-attachment/" layout="button_count"></fb:like></div></div><div style="clear: both;"></div><p>I&#8217;m using the <a href="http://svnbook.red-bean.com/en/1.7/svn.ref.reposhooks.post-commit.html">post-commit hook</a> to send out E-mail notifications when changes are committed to Subversion repositories.</p>
<p>If you search the web you&#8217;ll find a ton of scripts in various languages for this purpose. They all do more or less the same thing: create an E-mail message for the commit, including such details as the revision author, number, timestamp, a list of the paths that were changed, and a diff of the changes.</p>
<p>For one particular project I wanted the diff as an attachment, though, rather than inline in the message text. So I ended up writing my own script. It&#8217;s a Shell script that should work on most Unix/Linux based systems.</p>
<p><span id="more-341"></span></p>
<h3>Source code</h3>
<p><script src="https://gist.github.com/1577891.js"> </script></p>
<h3>Installation instructions</h3>
<p>To install this for your repository:</p>
<ol>
<li>Copy <code>commit-report.sh</code> to the server hosting your repository, for instance to <code>/usr/local/bin</code>, and make sure it&#8217;s executable (run <code>chmod +x commit-report.sh</code>)</li>
<li><del>Check line #2 of <code>commit-report.sh</code> – you may need to change that address depending on your individual circumstances</del> <ins>I removed this item later: see <a href="http://ten-fingers-and-a-brain.com/2012/01/subversion-post-commit-hook-e-mail-report-script-that-sends-the-diff-as-an-attachment/#comment-7811">this comment</a></ins></li>
<li>Edit line #2 of the file <code>post-commit</code>: change <code>/path/to</code> to the correct path for your server, e.g. <code>/usr/local/bin</code></li>
<li>Edit line #2 of the file <code>post-commit</code>: you probably don&#8217;t want to send reports to foo and bar at foo.local but to some other address(es)</li>
<li>If you want a fancy name in the subject line, instead of &#8220;SVN: `basename-of-your-repository`&#8221; append <code>-name "Your fancy name here"</code> to line #2 in <code>post-commit</code></li>
<li>If you haven&#8217;t used the post-commit hook yet, copy the file <code>post-commit</code> to the <code>hooks</code> directory in your repository – Note: Don&#8217;t check it in, but copy it to the respository itself, e.g. in <code>/srv/svn/repositories/myrepo/hooks</code></li>
<li>If you&#8217;ve already used the post-commit hook, and it&#8217;s a Shell script, append line #2 of the file <code>post-commit</code> to your script. If it&#8217;s not a Shell script you&#8217;ll have to figure out a way to call <code>commit-report.sh</code> with the correct parameters in your language</li>
</ol>
<p>You can always test <code>commit-report.sh</code> by invoking it manually.</p>
<h3>Troubleshooting</h3>
<p><strong>Update:</strong> Pointers for troubleshooting have been added later, based on your feedback&#8230;</p>
<ul>
<li>If the script runs without any errors on the console, but you never receive a commit report, change line #2 of <code>commit-report.sh</code>: put something like <code>FROMADDRESS="youremail@yourdomain"</code> in here</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://ten-fingers-and-a-brain.com/2012/01/subversion-post-commit-hook-e-mail-report-script-that-sends-the-diff-as-an-attachment/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Webduino now with support for HTTP Basic access authentication</title>
		<link>http://ten-fingers-and-a-brain.com/2012/01/webduino-now-with-support-for-http-basic-access-authentication/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=webduino-now-with-support-for-http-basic-access-authentication</link>
		<comments>http://ten-fingers-and-a-brain.com/2012/01/webduino-now-with-support-for-http-basic-access-authentication/#comments</comments>
		<pubDate>Thu, 05 Jan 2012 15:55:19 +0000</pubDate>
		<dc:creator>Martin Lormes</dc:creator>
				<category><![CDATA[Webduino]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[authentication]]></category>

		<guid isPermaLink="false">http://ten-fingers-and-a-brain.com/?p=337</guid>
		<description><![CDATA[Webduino, the web server library for Arduino, now supports HTTP Basic access authentication. You can download a .zip file of the latest version from GitHub. (Note: The download link does not point to a specific version, but always to the very latest version of Webduino including features and/or bugs that were added/fixed after I wrote [...]]]></description>
			<content:encoded><![CDATA[<div><div style="float: left; margin: 0 0px 5px 0;"><g:plusone size="medium" href="http://ten-fingers-and-a-brain.com/2012/01/webduino-now-with-support-for-http-basic-access-authentication/"></g:plusone></div><div style="float: left; margin: 0 30px 5px 0;"><a class="FlattrButton" style="display:none;" title="Webduino now with support for HTTP Basic access authentication" rev="flattr;uid:tfnab;category:text;language:en_GB;button:compact;" href="http://ten-fingers-and-a-brain.com/2012/01/webduino-now-with-support-for-http-basic-access-authentication/">Webduino, the web server library for Arduino, now supports HTTP Basic access authentication. You can download a .zip file of the latest version from GitHub. (Note: The download link does not point to a specific version, but always to the very latest version of Webduino including features and/or bugs that were added/fixed after I wrote this post. Here's the front page of the GitHub repository.) Authentication means that you can now protect the web-enabled functions of your Arduino with a username and password. There is at least one other version of Webduino supporting authentication, written by Claudio Baldazzi. It's in this post on the original Google Project site of Webduino, with an example here. When I started working on improvements of the Webduino, plus new features for my own use, I considered using Claudio's version but decided against it for the following reason: With the Claudio's version all pages of the Arduino would be protected by the same username and password. However...</a></div><div style="float: left; margin: 0 15px 5px 0;"><a style="display:none;" href="http://twitter.com/share?url=http%3A%2F%2Ften-fingers-and-a-brain.com%2F2012%2F01%2Fwebduino-now-with-support-for-http-basic-access-authentication%2F&amp;via=10fnab&amp;text=Webduino%20now%20with%20support%20for%20HTTP%20Basic%20access%20authentication&amp;count=horizontal" class="twitter-share-button">Tweet</a></div><div style="float: left; margin: 0 0px 5px 0;"><fb:like href="http://ten-fingers-and-a-brain.com/2012/01/webduino-now-with-support-for-http-basic-access-authentication/" layout="button_count"></fb:like></div></div><div style="clear: both;"></div><p><a href="http://ten-fingers-and-a-brain.com/arduino-projects/webduino/">Webduino</a>, the web server library for Arduino, now supports <a href="http://en.wikipedia.org/wiki/Basic_access_authentication">HTTP Basic access authentication</a>. You can <a href="https://github.com/sirleech/Webduino/zipball/master">download a .zip file of the latest version from GitHub</a>. (Note: The download link does not point to a specific version, but always to the very latest version of Webduino including features and/or bugs that were added/fixed after I wrote this post. <a href="https://github.com/sirleech/Webduino">Here&#8217;s the front page of the GitHub repository</a>.)</p>
<p>Authentication means that you can now protect the web-enabled functions of your Arduino with a username and password.</p>
<p>There is at least one other version of Webduino supporting authentication, written by Claudio Baldazzi. It&#8217;s in <a title="Webduino Basic Authentication" href="http://code.google.com/p/webduino/issues/detail?id=6">this post on the original Google Project site of Webduino</a>, with an <a title="Webduino Basic Authentication Sample" href="http://code.google.com/p/webduino/issues/detail?id=7">example here</a>. When I started working on improvements of the Webduino, plus new features for my own use, I considered using Claudio&#8217;s version but decided against it for the following reason:</p>
<p>With the Claudio&#8217;s version all pages of the Arduino would be protected by the same username and password. However I wanted a way to distinguish different user levels. E.g. Person A should be allowed to see on the web whether the lights are on or off, but only Person B is allowed to flick the switch.</p>
<p>Here&#8217;s how I did it.</p>
<p>The WebServer class now has two new methods: <a href="http://ten-fingers-and-a-brain.com/arduino-projects/webduino/httpunauthorized/">httpUnauthorized()</a> sends error 401 back to the client, which in the case of a regular web browser causes the user to see a prompt for username and password. <a href="http://ten-fingers-and-a-brain.com/arduino-projects/webduino/checkcredentials/">checkCredentials()</a> checks whether a username and password have been sent with the request and whether they are valid, i.e. they have certain values. In a Webduino command function you should first run checkCredentials() and depending on the return value either run your &#8220;protected&#8221; code, like turning on the lights, or fire httpUnauthorized(). See the methods&#8217; subpages of the <a title="Webduino API documentation" href="http://ten-fingers-and-a-brain.com/arduino-projects/webduino/#doc">API documentation</a> for example code.</p>
]]></content:encoded>
			<wfw:commentRss>http://ten-fingers-and-a-brain.com/2012/01/webduino-now-with-support-for-http-basic-access-authentication/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>On Webduino, a Web Server Library for the Arduino Platform, and on favicon.ico</title>
		<link>http://ten-fingers-and-a-brain.com/2011/12/on-webduino-and-on-favicon-ico/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=on-webduino-and-on-favicon-ico</link>
		<comments>http://ten-fingers-and-a-brain.com/2011/12/on-webduino-and-on-favicon-ico/#comments</comments>
		<pubDate>Sat, 31 Dec 2011 01:57:23 +0000</pubDate>
		<dc:creator>Martin Lormes</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Webduino]]></category>
		<category><![CDATA[favicon.ico]]></category>
		<category><![CDATA[git]]></category>

		<guid isPermaLink="false">http://ten-fingers-and-a-brain.com/?p=284</guid>
		<description><![CDATA[As reported earlier I had been given an Arduino Uno. I subsequently received my Ethernet Shield to hook the board up to the network. I'm clearly heading towards the Internet of things... Although I am still not 100% certain about what I'm going to do with the board (or how many additional ones I am [...]]]></description>
			<content:encoded><![CDATA[<div><div style="float: left; margin: 0 0px 5px 0;"><g:plusone size="medium" href="http://ten-fingers-and-a-brain.com/2011/12/on-webduino-and-on-favicon-ico/"></g:plusone></div><div style="float: left; margin: 0 30px 5px 0;"><a class="FlattrButton" style="display:none;" title="On Webduino, a Web Server Library for the Arduino Platform, and on favicon.ico" rev="flattr;uid:tfnab;category:text;language:en_GB;button:compact;" href="http://ten-fingers-and-a-brain.com/2011/12/on-webduino-and-on-favicon-ico/">As reported earlier I had been given an Arduino Uno. I subsequently received my Ethernet Shield to hook the board up to the network. I'm clearly heading towards the Internet of things... Although I am still not 100% certain about what I'm going to do with the board (or how many additional ones I am going to have to buy) one things is pretty clear: It will have to be controllable and/or configurable over a web interface. I found the Webserver example that ships with the Arduino IDE to be rather dull and unflexible. It wasn't long before I stumbled upon Webduino, a very flexible generic Web Server library originally written by Ben Combee. The Webduino project homepage on Google Project Hosting points to this GitHub page. I downloaded the version adapted to Arduino 1.0 and started hacking away. Let me say this now: Webduino does meet my expectations. However after a short while I ran into problems. None of them were to blame on the library, but rather on myself, but that's actually not...</a></div><div style="float: left; margin: 0 15px 5px 0;"><a style="display:none;" href="http://twitter.com/share?url=http%3A%2F%2Ften-fingers-and-a-brain.com%2F2011%2F12%2Fon-webduino-and-on-favicon-ico%2F&amp;via=10fnab&amp;text=On%20Webduino%2C%20a%20Web%20Server%20Library%20for%20the%20Arduino%20Platform%2C%20and%20on%20favicon.ico&amp;count=horizontal" class="twitter-share-button">Tweet</a></div><div style="float: left; margin: 0 0px 5px 0;"><fb:like href="http://ten-fingers-and-a-brain.com/2011/12/on-webduino-and-on-favicon-ico/" layout="button_count"></fb:like></div></div><div style="clear: both;"></div><p><a href="http://ten-fingers-and-a-brain.com/2011/12/kosmos-electronic-x3000-meets-arduino-uno/">As reported earlier</a> I had been given an <a href="http://arduino.cc/en/Main/ArduinoBoardUno">Arduino Uno</a>. I subsequently received my <a href="http://arduino.cc/en/Main/ArduinoEthernetShield">Ethernet Shield</a> to hook the board up to the network. I&#8217;m clearly heading towards the Internet of things&#8230; Although I am still not 100% certain about what I&#8217;m going to do with the board (or how many additional ones I am going to have to buy) one things is pretty clear: It will have to be controllable and/or configurable over a web interface.</p>
<p>I found the Webserver example that ships with the <a href="http://arduino.cc/en/Main/Software">Arduino IDE</a> to be rather dull and unflexible. It wasn&#8217;t long before I stumbled upon Webduino, a very flexible generic Web Server library originally written by <a href="http://unwiredben.livejournal.com/290704.html">Ben Combee</a>. The <a href="http://code.google.com/p/webduino/">Webduino project homepage on Google Project Hosting</a> points to <a title="Webduino fork by Chris Lee on GitHub" href="https://github.com/sirleech/Webduino">this GitHub page</a>. I downloaded the version adapted to Arduino 1.0 and started hacking away. Let me say this now: Webduino does meet my expectations.</p>
<p>However after a short while I ran into problems. None of them were to blame on the library, but rather on myself, but that&#8217;s actually not the point of this post&#8230; When I ran <a href="http://www.wireshark.org/">Wireshark</a> to look at the data going over the network I noticed that for every page loaded Firefox also tries to download <a href="http://en.wikipedia.org/wiki/Favicon">favicon.ico</a> from the web server. Since Webduino sends a 400 error back on any requests for resources that have not been defined Firefox just keeps retrying forever.</p>
<p>At around the same time I discovered that, to avoid excess traffic from robots, there is a default <a href="http://en.wikipedia.org/wiki/Robots_exclusion_standard">robots.txt</a> built into Webduino. So I decided to add a default favicon.ico, based on the icon used in the &#8220;Web_Image&#8221; example that ships with Webduino. Now when the first page is requested, Firefox loads the icon file, which actually eats more resources than <em>one</em> 400 error, but it pays off down the road when Firefox caches the icon and does not request it again, saving the Arduino from having to generate many 400 errors&#8230;</p>
<div id="attachment_286" class="wp-caption alignnone" style="width: 310px"><a href="https://github.com/tfnab/Webduino"><img class="size-full wp-image-286" title="Webduino &quot;Hello World!&quot; page with favicon.ico" src="http://ten-fingers-and-a-brain.com/wp-content/uploads/2011/12/Webduino_HelloWorld_favicon.png" alt="Webduino &quot;Hello World!&quot; page with favicon.ico" width="300" height="112" /></a><p class="wp-caption-text">Webduino &quot;Hello World!&quot; page with favicon.ico; this is the default favicon.ico in my version of Webduino</p></div>
<p>And since I see projects hosted on GitHub as an open invitation to fork I ended up with <a href="https://github.com/tfnab/Webduino">my own Webduino project on GitHub</a>. Feel free to look at the code, to fork, clone, whatever (MIT license), and to let me know what you think! (Oh, and I gave the readme some TLC and also added a keywords.txt file for syntax highlighting.)</p>
<p><strong>Update:</strong> I started to write <a href="http://ten-fingers-and-a-brain.com/arduino-projects/webduino/">a &#8220;beautiful&#8221; API documentation</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ten-fingers-and-a-brain.com/2011/12/on-webduino-and-on-favicon-ico/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Kosmos electronic X3000 meets Arduino Uno</title>
		<link>http://ten-fingers-and-a-brain.com/2011/12/kosmos-electronic-x3000-meets-arduino-uno/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=kosmos-electronic-x3000-meets-arduino-uno</link>
		<comments>http://ten-fingers-and-a-brain.com/2011/12/kosmos-electronic-x3000-meets-arduino-uno/#comments</comments>
		<pubDate>Wed, 28 Dec 2011 21:15:51 +0000</pubDate>
		<dc:creator>Martin Lormes</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[geeky]]></category>

		<guid isPermaLink="false">http://ten-fingers-and-a-brain.com/?p=277</guid>
		<description><![CDATA[I found an Arduino Uno under the X-mas tree: I'm still waiting for my Ethernet Shield to ship. In the meantime I wanted to get started with some of the "simple" stuff like controlling single LEDs, triggering events using pushbuttons etc. It came in handy I still had my 1980's "Kosmos electronic X3000" workshop kit [...]]]></description>
			<content:encoded><![CDATA[<div><div style="float: left; margin: 0 0px 5px 0;"><g:plusone size="medium" href="http://ten-fingers-and-a-brain.com/2011/12/kosmos-electronic-x3000-meets-arduino-uno/"></g:plusone></div><div style="float: left; margin: 0 30px 5px 0;"><a class="FlattrButton" style="display:none;" title="Kosmos electronic X3000 meets Arduino Uno" rev="flattr;uid:tfnab;category:text;language:en_GB;button:compact;" href="http://ten-fingers-and-a-brain.com/2011/12/kosmos-electronic-x3000-meets-arduino-uno/">I found an Arduino Uno under the X-mas tree: I'm still waiting for my Ethernet Shield to ship. In the meantime I wanted to get started with some of the "simple" stuff like controlling single LEDs, triggering events using pushbuttons etc. It came in handy I still had my 1980's "Kosmos electronic X3000" workshop kit around, which I used to experiment with when I was a teenage nerd: I guess I'm still a nerd: My heart jumped a bit when I found out they seem to still sell these things. Here's what they look like in combination: You and I know that talking about new ideas prematurely is the best way to kill them. Anyhow you should expect some Arduino related posts over the next year or so...</a></div><div style="float: left; margin: 0 15px 5px 0;"><a style="display:none;" href="http://twitter.com/share?url=http%3A%2F%2Ften-fingers-and-a-brain.com%2F2011%2F12%2Fkosmos-electronic-x3000-meets-arduino-uno%2F&amp;via=10fnab&amp;text=Kosmos%20electronic%20X3000%20meets%20Arduino%20Uno&amp;count=horizontal" class="twitter-share-button">Tweet</a></div><div style="float: left; margin: 0 0px 5px 0;"><fb:like href="http://ten-fingers-and-a-brain.com/2011/12/kosmos-electronic-x3000-meets-arduino-uno/" layout="button_count"></fb:like></div></div><div style="clear: both;"></div><p>I found an <a href="http://www.amazon.com/dp/B004CG4CN4?tag=tenfingeandab-20" title="You can buy Arduino Uno at Amazon.com">Arduino Uno</a> under the X-mas tree:</p>
<p><img src="http://ten-fingers-and-a-brain.com/wp-content/uploads/2011/12/IMG00024-20111228-0243-300x225.jpg" alt="Arduino Uno" title="Arduino Uno" width="300" height="225" class="alignnone size-medium wp-image-278" /></p>
<p>I&#8217;m still waiting for my <a href="http://arduino.cc/en/Main/ArduinoEthernetShield">Ethernet Shield</a> to ship. In the meantime I wanted to get started with some of the &#8220;simple&#8221; stuff like controlling single LEDs, triggering events using pushbuttons etc. It came in handy I still had my 1980&#8242;s &#8220;Kosmos electronic X3000&#8243; workshop kit around, which I used to experiment with when I was a teenage nerd:</p>
<p><img src="http://ten-fingers-and-a-brain.com/wp-content/uploads/2011/12/IMG00029-20111228-2141-300x225.jpg" alt="Kosmos electronic X3000 workshop" title="Kosmos electronic X3000 workshop" width="300" height="225" class="alignnone size-medium wp-image-280" /></p>
<p>I guess I&#8217;m still a nerd: My heart jumped a bit when I found out <a href="http://www.amazon.com/dp/B001ALNDUM?tag=tenfingeandab-20" title="Thames &#038; Kosmos Technology and Electronics Electronics Workshop on Amazon.com">they seem to still sell these things</a>.</p>
<p>Here&#8217;s what they look like in combination:</p>
<p><img src="http://ten-fingers-and-a-brain.com/wp-content/uploads/2011/12/IMG00027-20111228-2140-300x225.jpg" alt="Arduino Uno with Kosmos &quot;breadboard&quot;" title="Arduino Uno with Kosmos &quot;breadboard&quot;" width="300" height="225" class="alignnone size-medium wp-image-279" /></p>
<p>You and I know that talking about new ideas prematurely is the best way to kill them. Anyhow you should expect some <a href="http://arduino.cc/en/">Arduino</a> related posts over the next year or so&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://ten-fingers-and-a-brain.com/2011/12/kosmos-electronic-x3000-meets-arduino-uno/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress 3.3 Admin Bar: Make &#8220;+New&#8221; Default to New Page Instead of New Post</title>
		<link>http://ten-fingers-and-a-brain.com/2011/12/wordpress-3-3-admin-bar-make-new-default-to-new-page-instead-of-new-post/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wordpress-3-3-admin-bar-make-new-default-to-new-page-instead-of-new-post</link>
		<comments>http://ten-fingers-and-a-brain.com/2011/12/wordpress-3-3-admin-bar-make-new-default-to-new-page-instead-of-new-post/#comments</comments>
		<pubDate>Sun, 18 Dec 2011 12:01:51 +0000</pubDate>
		<dc:creator>Martin Lormes</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[CMS]]></category>

		<guid isPermaLink="false">http://ten-fingers-and-a-brain.com/?p=269</guid>
		<description><![CDATA[Some of my clients are using their WordPress installs with pages only, i.e. without any posts, and with comments turned off completely. This is often referred to as "WordPress as a CMS". To free the screen from clutter I like to remove the comments link from the new/revised WordPress 3.3 Admin Bar. I also usually [...]]]></description>
			<content:encoded><![CDATA[<div><div style="float: left; margin: 0 0px 5px 0;"><g:plusone size="medium" href="http://ten-fingers-and-a-brain.com/2011/12/wordpress-3-3-admin-bar-make-new-default-to-new-page-instead-of-new-post/"></g:plusone></div><div style="float: left; margin: 0 30px 5px 0;"><a class="FlattrButton" style="display:none;" title="WordPress 3.3 Admin Bar: Make &quot;+New&quot; Default to New Page Instead of New Post" rev="flattr;uid:tfnab;category:text;language:en_GB;button:compact;" href="http://ten-fingers-and-a-brain.com/2011/12/wordpress-3-3-admin-bar-make-new-default-to-new-page-instead-of-new-post/">Some of my clients are using their WordPress installs with pages only, i.e. without any posts, and with comments turned off completely. This is often referred to as "WordPress as a CMS". To free the screen from clutter I like to remove the comments link from the new/revised WordPress 3.3 Admin Bar. I also usually change the "+ New" link to default to creating a new page instead of creating a new post. To accomplish this you can drop the following lines into your theme's functions.php file: 1 To find out more about the Admin Bar API you should check out this post by Andrew Nacin on the official WordPress Development Blog.</a></div><div style="float: left; margin: 0 15px 5px 0;"><a style="display:none;" href="http://twitter.com/share?url=http%3A%2F%2Ften-fingers-and-a-brain.com%2F2011%2F12%2Fwordpress-3-3-admin-bar-make-new-default-to-new-page-instead-of-new-post%2F&amp;via=10fnab&amp;text=WordPress%203.3%20Admin%20Bar%3A%20Make%20%26%238220%3B%2BNew%26%238221%3B%20Default%20to%20New%20Page%20Instead%20of%20New%20Post&amp;count=horizontal" class="twitter-share-button">Tweet</a></div><div style="float: left; margin: 0 0px 5px 0;"><fb:like href="http://ten-fingers-and-a-brain.com/2011/12/wordpress-3-3-admin-bar-make-new-default-to-new-page-instead-of-new-post/" layout="button_count"></fb:like></div></div><div style="clear: both;"></div><p>Some of my clients are using their WordPress installs with pages only, i.e. without any posts, and with comments turned off completely. This is often referred to as &#8220;WordPress as a CMS&#8221;. To free the screen from clutter I like to remove the comments link from the new/revised WordPress 3.3 Admin Bar. I also usually change the &#8220;+ New&#8221; link to default to creating a new page instead of creating a new post.</p>
<p><img src="http://ten-fingers-and-a-brain.com/wp-content/uploads/2011/12/wp330adminbar_new.png" alt="" title="&quot;+New&quot; in WordPress 3.3 Admin Bar" width="140" height="28" class="alignnone size-full wp-image-270" /></p>
<p>To accomplish this you can drop the following lines into your theme&#8217;s <code>functions.php</code> file:</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
function my_admin_bar_menu( $wp_admin_bar )
{
  $wp_admin_bar-&gt;remove_node( 'comments' );
  $newpage = $wp_admin_bar-&gt;get_node( 'new-page' );
  $wp_admin_bar-&gt;add_node( array( 'id' =&gt; 'new-content', 'href' =&gt; $newpage-&gt;href, ) );
}
add_action( 'admin_bar_menu', 'my_admin_bar_menu', 100 );
</pre>
<p>To find out more about the Admin Bar API you should check out <a href="http://wpdevel.wordpress.com/2011/12/07/admin-bar-api-changes-in-3-3/">this post by Andrew Nacin on the official WordPress Development Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://ten-fingers-and-a-brain.com/2011/12/wordpress-3-3-admin-bar-make-new-default-to-new-page-instead-of-new-post/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nagios doesn&#8217;t update the host alias macro – Workaround</title>
		<link>http://ten-fingers-and-a-brain.com/2011/10/nagios-doesnt-update-the-host-alias-macro-%e2%80%93-workaround/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=nagios-doesnt-update-the-host-alias-macro-%25e2%2580%2593-workaround</link>
		<comments>http://ten-fingers-and-a-brain.com/2011/10/nagios-doesnt-update-the-host-alias-macro-%e2%80%93-workaround/#comments</comments>
		<pubDate>Wed, 12 Oct 2011 13:22:22 +0000</pubDate>
		<dc:creator>Martin Lormes</dc:creator>
				<category><![CDATA[Nagios]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[nagios]]></category>
		<category><![CDATA[workaround]]></category>

		<guid isPermaLink="false">http://ten-fingers-and-a-brain.com/?p=265</guid>
		<description><![CDATA[Since the upgrade to version 3.2.2 Nagios does not update the host alias macro when the configuration is reloaded. Macros are the variables used in commands, such as notification commands, i.e. the information you receive via E-mail when there is a problem with your hosts or services. As long as you don't change your host [...]]]></description>
			<content:encoded><![CDATA[<div><div style="float: left; margin: 0 0px 5px 0;"><g:plusone size="medium" href="http://ten-fingers-and-a-brain.com/2011/10/nagios-doesnt-update-the-host-alias-macro-%e2%80%93-workaround/"></g:plusone></div><div style="float: left; margin: 0 30px 5px 0;"><a class="FlattrButton" style="display:none;" title="Nagios doesn&#039;t update the host alias macro – Workaround" rev="flattr;uid:tfnab;category:text;language:en_GB;button:compact;" href="http://ten-fingers-and-a-brain.com/2011/10/nagios-doesnt-update-the-host-alias-macro-%e2%80%93-workaround/">Since the upgrade to version 3.2.2 Nagios does not update the host alias macro when the configuration is reloaded. Macros are the variables used in commands, such as notification commands, i.e. the information you receive via E-mail when there is a problem with your hosts or services. As long as you don't change your host alias information you will never notice. I did change it and I found myself scratching my head for some time, especially since the same information does get updated in the web interface. I found a greater number of forum discussions relating to this, but none seemed to offer a practical solution for larger scale environments. After some pondering I came up with these lines: 1 They do the trick in my installations. Update: Here's a brief s...</a></div><div style="float: left; margin: 0 15px 5px 0;"><a style="display:none;" href="http://twitter.com/share?url=http%3A%2F%2Ften-fingers-and-a-brain.com%2F2011%2F10%2Fnagios-doesnt-update-the-host-alias-macro-%25e2%2580%2593-workaround%2F&amp;via=10fnab&amp;text=Nagios%20doesn%26%238217%3Bt%20update%20the%20host%20alias%20macro%20%E2%80%93%20Workaround&amp;count=horizontal" class="twitter-share-button">Tweet</a></div><div style="float: left; margin: 0 0px 5px 0;"><fb:like href="http://ten-fingers-and-a-brain.com/2011/10/nagios-doesnt-update-the-host-alias-macro-%e2%80%93-workaround/" layout="button_count"></fb:like></div></div><div style="clear: both;"></div><p>Since the upgrade to version 3.2.2 Nagios does not update the host alias macro when the configuration is reloaded. Macros are the variables used in commands, such as notification commands, i.e. the information you receive via E-mail when there is a problem with your hosts or services.</p>
<p>As long as you don&#8217;t change your host alias information you will never notice. I did change it and I found myself scratching my head for some time, especially since the same information does get updated in the web interface.</p>
<p>I found a greater number of forum discussions relating to this, but none seemed to offer a practical solution for larger scale environments.</p>
<p>After some pondering I came up with these lines:</p>
<pre class="brush: bash; title: ; notranslate">service nagios stop
cp /usr/local/nagios/var/retention.dat /usr/local/nagios/var/retention.bak
grep -v ^alias /usr/local/nagios/var/retention.bak &gt; /usr/local/nagios/var/retention.dat
service nagios start</pre>
<p>They do the trick in my installations.</p>
<p><strong>Update:</strong> Here&#8217;s a brief summary of the error and what the script does to work around it.</p>
<p>When Nagios parses the configuration and finds a <em>new</em> host it loads the <code>alias</code> field into memory. When Nagios reloads the configuration, the <code>alias</code> information that is already in memory does <em>not</em> get updated. When Nagios stops (or before reloading the configuration) the <code>alias</code> information in memory is dumped to the <code>retention.dat</code> file. When Nagios isn&#8217;t running and you start the service, it doesn&#8217;t load the <code>alias</code> information from the configuration files but from <code>retention.dat</code>, <em>unless</em> that information is not present in the file. So my solution does the following:</p>
<ol>
<li>Stop Nagios</li>
<li>Make a backup copy of the <code>retention.dat</code> file (Note: I&#8217;m copying the file instead of renaming it to make sure that it will still have the same owner/group and permissions when I write to the original file in the next step)</li>
<li>Strip all lines starting with &#8220;alias&#8221; from the backup file and overwrite the original <code>retention.dat</code> file with this data</li>
<li>Start Nagios</li>
</ol>
<p>You may have to tweak the file location for the <code>retention.dat</code> and backup files. You may also need to change the commands that stop and start the Nagios deamon.</p>
]]></content:encoded>
			<wfw:commentRss>http://ten-fingers-and-a-brain.com/2011/10/nagios-doesnt-update-the-host-alias-macro-%e2%80%93-workaround/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sneak Preview: Open Graph Pro 1.1 with Support for Custom Object Types</title>
		<link>http://ten-fingers-and-a-brain.com/2011/08/sneak-preview-open-graph-pro-1-1-with-support-for-custom-object-types/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=sneak-preview-open-graph-pro-1-1-with-support-for-custom-object-types</link>
		<comments>http://ten-fingers-and-a-brain.com/2011/08/sneak-preview-open-graph-pro-1-1-with-support-for-custom-object-types/#comments</comments>
		<pubDate>Mon, 01 Aug 2011 20:22:16 +0000</pubDate>
		<dc:creator>Martin Lormes</dc:creator>
				<category><![CDATA[Open Graph Protocol]]></category>
		<category><![CDATA[WordPress Plugins]]></category>

		<guid isPermaLink="false">http://ten-fingers-and-a-brain.com/?p=256</guid>
		<description><![CDATA[Open Graph Pro is a WordPress plugin. It adds Open Graph Protocol metadata to your WordPress powered blog/website. It does not (yet) add any Facebook "Like" buttons. The Open Graph Protocol enables your website/blog to have the same functionality as a Facebook page. Open Graph Pro is hosted on wordpress.org: Download Upcoming versions Version 1.1 [...]]]></description>
			<content:encoded><![CDATA[<div><div style="float: left; margin: 0 0px 5px 0;"><g:plusone size="medium" href="http://ten-fingers-and-a-brain.com/wordpress-plugins/ogp/"></g:plusone></div><div style="float: left; margin: 0 30px 5px 0;"><a class="FlattrButton" style="display:none;" title="Open Graph Pro" rev="flattr;uid:tfnab;category:text;language:en_GB;button:compact;" href="http://ten-fingers-and-a-brain.com/wordpress-plugins/ogp/">Open Graph Pro is a WordPress plugin. It adds Open Graph Protocol metadata to your WordPress powered blog/website. It does not (yet) add any Facebook "Like" buttons. The Open Graph Protocol enables your website/blog to have the same functionality as a Facebook page. Open Graph Pro is hosted on wordpress.org: Download Upcoming versions Version 1.1 will feature an API for theme and plugin developers to access the Open Graph Protocol metadata to add "Like" buttons to their blogs and to use custom Object Types. Go to the download page and grab the Development Version if you want to try it!</a></div><div style="float: left; margin: 0 15px 5px 0;"><a style="display:none;" href="http://twitter.com/share?url=http%3A%2F%2Ften-fingers-and-a-brain.com%2F2011%2F08%2Fsneak-preview-open-graph-pro-1-1-with-support-for-custom-object-types%2F&amp;via=10fnab&amp;text=Sneak%20Preview%3A%20Open%20Graph%20Pro%201.1%20with%20Support%20for%20Custom%20Object%20Types&amp;count=horizontal" class="twitter-share-button">Tweet</a></div><div style="float: left; margin: 0 0px 5px 0;"><fb:like href="http://ten-fingers-and-a-brain.com/wordpress-plugins/ogp/" layout="button_count"></fb:like></div></div><div style="clear: both;"></div><p>The next version 1.1 of my <a href="http://ten-fingers-and-a-brain.com/wordpress-plugins/ogp/">Open Graph Pro WordPress Plugin</a> will feature an <a href="http://ten-fingers-and-a-brain.com/wordpress-plugins/ogp/api/" title="Open Graph Pro API Documentation">API</a> (a public method and two filter hooks) that can be utilized by theme and plugin developers who would like to add &#8220;Like&#8221; buttons to their blogs. The API also allows you to add Custom Object Types.</p>
<p>If you want to test-run the API go to the <a href="http://wordpress.org/extend/plugins/ogp/download/">Open Graph Pro download page</a> and grab the <a href="http://downloads.wordpress.org/plugin/ogp.zip">Development Version</a>. The <a href="http://ten-fingers-and-a-brain.com/wordpress-plugins/ogp/api/" title="Open Graph Pro API Documentation">API</a> is not going to change anymore. The code is also pretty much final. I&#8217;m merely working on some final UI touches and i18n/L10n of the plugin.</p>
<p>Code snippets for adding &#8220;Like&#8221; buttons or using Custom Object Types are part of the <a href="http://ten-fingers-and-a-brain.com/wordpress-plugins/ogp/api/">API documentation</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://ten-fingers-and-a-brain.com/2011/08/sneak-preview-open-graph-pro-1-1-with-support-for-custom-object-types/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

