<?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>B1</title>
	<atom:link href="http://www.kromhouts.net/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kromhouts.net/blog</link>
	<description>The over analysing database said.</description>
	<lastBuildDate>Tue, 20 Dec 2011 11:45:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.5</generator>
		<item>
		<title>Oracle (Sun) Java JDK for Debian, Ubuntu, Linux Mint</title>
		<link>http://www.kromhouts.net/blog/server-admin/oracle-sun-java-jdk-for-debian-ubuntu-linux-mint/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=oracle-sun-java-jdk-for-debian-ubuntu-linux-mint</link>
		<comments>http://www.kromhouts.net/blog/server-admin/oracle-sun-java-jdk-for-debian-ubuntu-linux-mint/#comments</comments>
		<pubDate>Tue, 20 Dec 2011 11:45:32 +0000</pubDate>
		<dc:creator>gavingc</dc:creator>
				<category><![CDATA[Server-admin]]></category>

		<guid isPermaLink="false">http://www.kromhouts.net/blog/?p=353</guid>
		<description><![CDATA[Between Oracle and the various GNU/Linux distributions the damn Java ball has been dropped! Really unprofessional from both sides, I don&#8217;t care for the technicalities, both sides screwed up and your users are suffering. Basically along with Oracle&#8217;s security update 29 the terms that allow Linux distributions to distribute the Sun JRE and JDK have [...]]]></description>
			<content:encoded><![CDATA[<p>Between Oracle and the various GNU/Linux distributions the damn Java ball has been dropped!<br />
Really unprofessional from both sides, I don&#8217;t care for the technicalities, both sides screwed up and your users are suffering.</p>
<p>Basically along with <a href="http://www.oracle.com/technetwork/topics/security/javacpuoct2011-443431.html">Oracle&#8217;s security update 29</a> the terms that allow Linux distributions to distribute the Sun JRE and JDK have been removed. This required Debian/Ubuntu/Mint to <a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=645881">remove the package as per this bug report</a>.</p>
<p>So what the hell are our Java options for production servers?</p>
<p><span id="more-353"></span></p>
<p>Turns out that the only real solution at the moment is to manually download and install the JRE / JDK from Oracle. Which may be exactly what Oracle wants but for production software there really is no other option:</p>
<ul>
<li>Production servers must be security patched.</li>
<li>We can&#8217;t hope that production code will work 100% on openJDK.</li>
<li>OpenJDK-6 is in Debian Squeeze, but openJDK-7 is not.</li>
<li>IntelliJ IDEA does not support openJDK.</li>
<li>It would madness to develop on one JDK and deploy on another at this stage.</li>
</ul>
<p>Further Oracle&#8217;s license terms are not fun and include a &#8216;call home&#8217; function&#8230;grumble&#8230;</p>
<p>Anyway until this mess is corrected by the parties involved download the Oracle JDK:</p>
<ul>
<li><a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html">http://www.oracle.com/technetwork/java/javase/downloads/index.html</a></li>
</ul>
<p>Register for email security update notifications:</p>
<ul>
<li><a href="http://www.oracle.com/technetwork/topics/security/securityemail-090378.html">http://www.oracle.com/technetwork/topics/security/securityemail-090378.html</a></li>
</ul>
<p>Follow this Debian/Ubuntu how to:</p>
<ul>
<li><a href="http://sites.google.com/site/easylinuxtipsproject/java">http://sites.google.com/site/easylinuxtipsproject/java</a></li>
</ul>
<p>My JDK install steps:<br />
<code></p>
<ol>
<li>Install openjdk-6-jre OR openjdk-6-jre-headless to keep Debian package dependencies happy.</li>
<li>Remove all sun-java6-* packages (BIG security holes remember...)</li>
<li>Ensure that any browser plug-in's are removed (icedtea-plugin, sun-java6-plugin).</li>
<li>For 32bit OR for 64bit</li>
<li>mkdir -p /usr/local/bin/java/32 OR mkdir -p /usr/local/bin/java/64</li>
<li>cd /usr/local/bin/java/32 OR cd /usr/local/bin/java/64</li>
<li>Download: wget http://download.oracle.com/otn-pub/java/jdk/6uXX-b12/jdk-6uXX-linux-yyy.bin</li>
<li>chmod +x jdk-6uXX-linux-yyy.bin</li>
<li>Run the self extracting file: ./jdk-6uXX-linux-yyy.bin</li>
<li>ln -s /usr/local/bin/java/32/jdk1.6.0_XX /usr/local/bin/oracle-java-default OR ln -s /usr/local/bin/java/64/jdk1.6.0_XX /usr/local/bin/oracle-java-default</li>
<li>update-alternatives --install "/usr/bin/java" "java" "/usr/local/bin/oracle-java-default/bin/java" 1</li>
<li>update-alternatives --set java "/usr/local/bin/oracle-java-default/bin/java"</li>
</ol>
<p></code></p>
<p><strong>Note:</strong> that we can now use our <strong>/usr/local/bin/oracle-java-default</strong> symlink in all further setup.<br />
<strong>Note:</strong> that <strong>XX</strong> must be replaced by the latest version and <strong>yyy</strong> must be replaced by x64 or i586 in the above steps.</p>
<p>To install browser plugin for each user:<br />
<code></p>
<ol>
<li>In Iceweasel/Firefox Tools -> Add-ons -> Plugins -> Disable Java Plugin.</li>
<li>Copy the three commands below, shut browser down.</li>
<li>mkdir ~/.mozilla/plugins</li>
<li>rm ~/.mozilla/plugins/libnpjp2.so</li>
<li>ln -s /usr/local/bin/oracle-java-default/jre/lib/i386/libnpjp2.so ~/.mozilla/plugins/ OR ln -s /usr/local/bin/oracle-java-default/jre/lib/amd64/libnpjp2.so ~/.mozilla/plugins/</li>
<li>Start browser and check that Add-ons shows correct Java Plugin version.</li>
</ol>
<p></code></p>
<p>To setup Tomcat:<br />
<code></p>
<ol>
<li>Edit: nano /etc/environment</li>
<li>Set: JAVA_HOME=/usr/local/bin/oracle-java-default</li>
<li>Edit: nano /etc/default/tomcat6</li>
<li>Set: JAVA_HOME=/usr/local/bin/oracle-java-default</li>
</ol>
<p></code></p>
<p>To upgrade Java version using our symlink:<br />
<code></p>
<ol>
<li>cd /usr/local/bin/java/32/ OR cd /usr/local/bin/java/64</li>
<li>Download .bin file, chmod +x, run the self extracting file: ./jdk-XuXX-linux-yyy.bin</li>
<li>rm /usr/local/bin/oracle-java-default</li>
<li>ln -s /usr/local/bin/java/32/jdk1.6.0_XX /usr/local/bin/oracle-java-default OR ln -s /usr/local/bin/java/64/jdk1.6.0_XX /usr/local/bin/oracle-java-default</li>
</ol>
<p></code></p>
<p>To check Java versions:<br />
$ java -version<br />
visit <a href="http://java.com/en/download/installed.jsp">http://java.com/en/download/installed.jsp</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.kromhouts.net/blog/server-admin/oracle-sun-java-jdk-for-debian-ubuntu-linux-mint/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>The entrepreneur&#8217;s doldrums</title>
		<link>http://www.kromhouts.net/blog/entrepreneurial/the-entrepreneurs-doldrums/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=the-entrepreneurs-doldrums</link>
		<comments>http://www.kromhouts.net/blog/entrepreneurial/the-entrepreneurs-doldrums/#comments</comments>
		<pubDate>Wed, 20 Jul 2011 03:55:22 +0000</pubDate>
		<dc:creator>gavingc</dc:creator>
				<category><![CDATA[Entrepreneurial]]></category>

		<guid isPermaLink="false">http://www.kromhouts.net/blog/?p=259</guid>
		<description><![CDATA[Just like ye sailors of old there comes a time when an entrepreneur finds that he has no wind in the sails. We&#8217;ve done the hard yards and have the technology working. We predicted this market would emerge yonks ago. We had fevered dreams, nightly wracking and twisting of the brain to think through many [...]]]></description>
			<content:encoded><![CDATA[<p>Just like ye sailors of old there comes a time when an entrepreneur finds that he has no wind in the sails.</p>
<p><span id="more-259"></span></p>
<p>We&#8217;ve done the hard yards and have the technology working.<br />
We predicted this market would emerge yonks ago.<br />
We had fevered dreams, nightly wracking and twisting of the brain to think through many facets and learn so much.</p>
<p>But now as the market emerges, just as anticipated, we find that we have no wind in the sails.<br />
Does the wind simply not blow in our direction or is it the same for everyone?<br />
We&#8217;re tired, worn out, the depression lurks in dark corners of our minds or perhaps we really are just tired?</p>
<p>dol·drums<br />
<em> –noun </em><br />
a state of inactivity or stagnation, as in business or art: August is a time of doldrums for many enterprises. </p>
<p>Ah perhaps that is the problem it&#8217;s nearly August!</p>
<p>Or perhaps we are trying to reach outside of our creative arena.<br />
A place where we are smart and powerful, a place where we know how to move our hands so that creations emerge.<br />
To reach deep into the business world a place where our creativity seems insignificant and the rules are not clear to us.</p>
<p>Either way it&#8217;s the inevitable result when you apply pressure to turn all that investment into a buck.</p>
<p>Well I haven&#8217;t got all the answers yet.<br />
In the mean time play some <a href="http://www.yngwiemalmsteen.com/">Yngwie Malmsteen</a> to lift the spirit.<br />
Resist the urge to dive deep back into your creative arena or surrender and lay on the sand.<br />
Work on your project management and todo lists, plan to succeed in 3 things each day.<br />
Have the confidence that these 3 things will reap rewards.<br />
This is a game of long term endurance where many will drop away simply by the course of time.<br />
This is <em>not</em> a game of doing all that you can, you will kill yourself thinking that way, this is a game of persistence.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kromhouts.net/blog/entrepreneurial/the-entrepreneurs-doldrums/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Many ways to skin a war file</title>
		<link>http://www.kromhouts.net/blog/server-admin/many-ways-to-skin-a-war-file/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=many-ways-to-skin-a-war-file</link>
		<comments>http://www.kromhouts.net/blog/server-admin/many-ways-to-skin-a-war-file/#comments</comments>
		<pubDate>Sun, 03 Jul 2011 16:59:14 +0000</pubDate>
		<dc:creator>gavingc</dc:creator>
				<category><![CDATA[Server-admin]]></category>

		<guid isPermaLink="false">http://www.kromhouts.net/blog/?p=168</guid>
		<description><![CDATA[Web application war files can quickly grow. Here are some of the options to deploy a war to production. Copy Simply copy the war from the build machine to the production machine then deploy it. Pro &#8211; Simple. Con &#8211; Slow if large war file and slow connection. Build Build the war file on the [...]]]></description>
			<content:encoded><![CDATA[<p>Web application war files can quickly grow. Here are some of the options to deploy a war to production.<br />
<span id="more-168"></span></p>
<p><strong>Copy</strong><br />
Simply copy the war from the build machine to the production machine then deploy it.</p>
<p>Pro &#8211; Simple.<br />
Con &#8211; Slow if large war file and slow connection.</p>
<p><strong>Build</strong><br />
Build the war file on the production machine then deploy it.</p>
<p>Pro &#8211; Built in the exact production environment, use VCS for very small transfers and build triggers.<br />
Con &#8211; Full SDK on production machine and enough server resources to not effect production application.</p>
<p>I actually used this for some time on a demo site and it worked well until resources became an issue.<br />
The effect on the production application can be minimised with `renice +19 -p $$` and `ionice -c2 -n7 -p $$ ` in the build script. But once you run out of RAM and go into swap even this can&#8217;t help.</p>
<p><strong>Rsync war</strong><br />
Rsync the war to the production machine then deploy it.</p>
<p>Pro &#8211; Faster than copy method and still simple.<br />
Con &#8211; Don&#8217;t get the full performance of rsync since small changes in source cause larger changes in zip/war files.</p>
<p>This is my current favourite method, war files can be rsync pushed from build machine to a binary repository (e.g. maven) then production machines can rsync pull and deploy. Rsync is averaging a 4-5 speedup with 14/60MB or 25% transfer. It&#8217;s modular, recoverable and makes sense.</p>
<p>Commands &#8211; Standard mod-time and size comparison `rsync -avzh &#8211;progress $SRC $DEST` or for the more accurate checksum comparison `rsync -acvzh &#8211;progress $SRC $DEST`.</p>
<p><strong>Rsync exploded</strong><br />
Rsync the exploded war to the production machine then zip and deploy or deploy exploded.</p>
<p>Pro &#8211; Transfer is very fast.<br />
Con &#8211; Hidden complexity and war files are designed to be deployed not exploded first.</p>
<p>Initially this seems ideal but has complications.<br />
Distributing war files then adding unzip/re-zip to the process adds failure and variation points.<br />
The war can be unzipped on the build or repository server then rsynced to an existing exploded dir. The transfer is very fast but unzipping/re-zipping time cancels the benefit. </p>
<p>Commands &#8211; Grails can be set to leave the staging dir exploded and not build the war with `grails -Dgrails.war.exploded=true war`. This can be used in conjunction with `grails.project.war.exploded.dir = &#8220;target/exploded-war&#8221;`. Building the war can be accomplished with `zip -r myapp.war exploded-war` or `jar -cf myapp.war exploded-war/` or even an ant build task. But none of these provided a war file with the exact build size of `grails war` and the build is no longer atomic but partial and distributed. The war build can be skipped altogether but this defeats all the benefits of war files in the first place.</p>
<p>THE END</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kromhouts.net/blog/server-admin/many-ways-to-skin-a-war-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Samsung RF511 (S04-AU) Review with Debian GNU/Linux</title>
		<link>http://www.kromhouts.net/blog/pc-hardware/samsung-rf511-s04-au-review-with-debian-gnulinux/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=samsung-rf511-s04-au-review-with-debian-gnulinux</link>
		<comments>http://www.kromhouts.net/blog/pc-hardware/samsung-rf511-s04-au-review-with-debian-gnulinux/#comments</comments>
		<pubDate>Sat, 04 Jun 2011 23:38:55 +0000</pubDate>
		<dc:creator>gavingc</dc:creator>
				<category><![CDATA[PC Hardware]]></category>

		<guid isPermaLink="false">http://www.kromhouts.net/blog/?p=128</guid>
		<description><![CDATA[The RF511 is a tasty i7 laptop for the price. Here is another of my real user reviews including Linux notes. Out of the Box Most of the basic computing functions work under Linux (Debian 6.0 [Squeeze], CPU, RAM, Screen, Keyboard, TouchPad, USB). Some of the Fn buttons even work! Notably though the Integrated 802.11bgn [...]]]></description>
			<content:encoded><![CDATA[<p>The RF511 is a tasty i7 laptop for the price.<br />
Here is another of my real user reviews including Linux notes.</p>
<p><span id="more-128"></span></p>
<p><strong>Out of the Box</strong><br />
Most of the basic computing functions work under Linux (Debian 6.0 [Squeeze], CPU, RAM, Screen, Keyboard, TouchPad, USB). Some of the Fn buttons even work! Notably though the Integrated 802.11bgn Wireless (try: aptitude install firmware-brcm80211) and 3D Graphics do not work out of the box on Squeeze. But never fear, everything works in Debian Wheezy which is really amazing considering that this hardware was only released literally months ago. There are only a few &#8216;multimedia&#8217; buttons to worry about, nice! After installing Linux the Boot-up &#8216;F4 &#8211; Restore&#8217; will no longer work and you&#8217;ll get use of the whole hard drive, good stuff.</p>
<p><strong>Get One!</strong></p>
<blockquote><p>
<a href="http://www.kromhouts.net/blog/wp-content/plugins/adrotate/adrotate-out.php?track=NCwwLDA=" rel="nofollow" target="_blank"><img border="0" src="http://ws.assoc-amazon.com/widgets/q?_encoding=UTF8&amp;Format=_SL160_&amp;ASIN=B0056EY4JS&amp;MarketPlace=US&amp;ID=AsinImage&amp;WS=1&amp;tag=wwwkromhoutsn-20&amp;ServiceVersion=20070822"  alt=""/></a><img src="http://www.assoc-amazon.com/e/ir?t=wwwkromhoutsn-20&amp;l=as2&amp;o=1&amp;a=B0056EY4JS&amp;camp=217145&amp;creative=399373" width="1" height="1" alt="" style="border:none !important; margin:0px !important;" /> RF511-S04 <a href="http://www.kromhouts.net/blog/wp-content/plugins/adrotate/adrotate-out.php?track=NSwwLDA=" rel="nofollow" target="_blank"><img border="0" src="http://ws.assoc-amazon.com/widgets/q?_encoding=UTF8&amp;Format=_SL160_&amp;ASIN=B0056EY4MK&amp;MarketPlace=US&amp;ID=AsinImage&amp;WS=1&amp;tag=wwwkromhoutsn-20&amp;ServiceVersion=20070822" alt=""/></a><img src="http://www.assoc-amazon.com/e/ir?t=wwwkromhoutsn-20&amp;l=as2&amp;o=1&amp;a=B0056EY4MK&amp;camp=217145&amp;creative=399373" width="1" height="1" alt="" style="border:none !important; margin:0px !important;" />
 RF711-S03 <a href="http://www.kromhouts.net/blog/wp-content/plugins/adrotate/adrotate-out.php?track=NiwwLDA=" rel="nofollow" target="_blank"><img border="0" src="http://ws.assoc-amazon.com/widgets/q?_encoding=UTF8&amp;Format=_SL160_&amp;ASIN=B004LB4A82&amp;MarketPlace=US&amp;ID=AsinImage&amp;WS=1&amp;tag=wwwkromhoutsn-20&amp;ServiceVersion=20070822"  alt="" /></a><img src="http://www.assoc-amazon.com/e/ir?t=wwwkromhoutsn-20&amp;l=as2&amp;o=1&amp;a=B004LB4A82&amp;camp=217145&amp;creative=399373" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /> RF711-S02
</p></blockquote>
<p><strong>Hardware</strong><br />
The 15.6&#8243; RF511 lappy is nice and portable but still has plenty of screen and keyboard real estate. I was considering a 17&#8243; model but that really is a little on the large side (for me) to be portable. Of course if you are after a big laptop then give the 17.3&#8243; RF711 a go.</p>
<p>The Keyboard is fantastic, almost as good as my Logitech k750. The slim base and careful key layout means you get a full width keyboard with number pad. The arrow and Delete/Home/End/PgUp/PgDn placement takes a moment to get used to but should be fine after a couple of days use.</p>
<p>The Screen is nice, a wide 15.6&#8243; (1366&#215;768), clear and bright when plugged in. With linux-image-2.6.38-2 and xserver-xorg-video-intel-2:2.15 (and newer) there is now full brightness control. Note that linux-image-2.6.32-5 that comes with Debian Squeeze can&#8217;t seem to control the back-light brightness so take note of the update recommendations bellow.</p>
<p>The CPU is the main reason that I purchased the Samsung rf511-s04. One of the first laptops to have the Q1 2011 Sandy Bridge, Intel Core i7 2630QM Quad-Core 2.0Ghz (2.9GHz Turbo). Four real cores on one chip providing 8 virtual CPU&#8217;s need I say more, bring on the compilers and virtualisation!</p>
<p>The RAM is supplied with anything from 4G to 8G. Two slots are available and easy to get to. If you happen to buy a unit with 1 stick of 4G then it is very easy to upgraded to the max of 8G for ~AU$100.</p>
<p>The Graphics that the Sandy Bridge CPU has on-board are pretty decent. While this machine also comes with a 1G Nvidia Optimus GT 540M. Unfortunately the Optimus chip is still waiting for full Linux support, normally Nvidia is good at providing drivers (even if only binary) but they are having some trouble since Xorg support is required or some such. Recently I have seen some support from a project called <a href="https://github.com/MrMEEE/bumblebee">BumbleBee</a> (<a href="https://github.com/z0rc/debumblebee">Debian fork</a>) but I am happy using the Intel graphics on the CPU which can easily run Compiz 3D desktop stuff, this should also provide better battery life. Although I have seen it written that the Optimus chip may be on and draining battery anyway, I have not verified this.</p>
<p>The Battery seems to get 3-4 hours with steady use (while installing Debian packages).</p>
<p>The 640GB HDD is good but as with all current machines can be the main bottle neck. An SSD drive would provide an optional boost.</p>
<p>Integrated Bluetooth seems to work fine.</p>
<p>The SD card slot seems to work fine.</p>
<p>The Touchpad is large and has a fine texture. Basic tap/click and point works accurately and smoothly but xserver-xorg-input-synaptics continues to report that it is not supported. So no multi-touch in Linux. Which is ok for me since the Fn+F10 disables it for typing and I much prefer my G700 external mouse.</p>
<p>Sound is of good quality and did work after installing alsaplayer and tinkering with all volume controls in alsamixer, there is a &#8216;speaker&#8217; and &#8216;pcm&#8217; volume that must be turned up to full. The &#8216;master&#8217; volume is controlled by the software and Fn keys. The &#8216;headphone&#8217; volume can be controlled independently, very nice.</p>
<p>Fn buttons.</p>
<ul>
<li> Fn+Esc (Moon symbol, Suspend to Ram) Screen may not resume without correct drivers.</li>
<li>Fn+F2 (XF86Battery) Does nothing in my system.</li>
<li>Fn+F3 (€) Reports a series of key presses in X.</li>
<li>Fn+F4 (XF86Display) Randr to cycle external monitor config.</li>
<li>Fn+F5 (XF86Launch1, Brigtness symbol)</li>
<li>Fn+F6 (XF86AudioMute) Works in KDE</li>
<li>Fn+F7 (XF86Launch2, unknown symbol)</li>
<li>Fn+F8 (XF86Launch3, unknown symbol)</li>
<li>Fn+F9 (XF86WLAN) Neither this nor the hardware wifi button change the wifi state in my system.</li>
<li>Fn+F10 (XF86TouchpadToggle) Handy when using external mouse, appears to be detected by hardware.</li>
<li>Fn+F12 (Lock symbol) Does not report or appear to do anything.</li>
</ul>
<p><strong>Updates</strong><br />
To get support for the Sandy Bridge CPU we really have to be running a newer Linux kernel than the stock Debian (Squeeze) image. At the very least at get 2.6.38 from backports. I&#8217;m now running 3.0.0-1-amd64 from Debian (Wheezy) and support is perfect.</p>
<p>Intel graphics support was only added to the Intel driver in <a href="http://intellinuxgraphics.org/2010Q4.html">2010Q4 v2.14</a> with full support only added in <a href="http://intellinuxgraphics.org/2011Q1.html">2011Q1 v2.15</a>.<br />
The 2.15 Intel drivers are available in Debian (Wheezy), testing at the time of writing, therefore <span style="background:#FFFF00">to get the best from this laptop a dist-upgrade to Wheezy is highly recommended.</span></p>
<p>Another option, if like me you have the need to stick to stable as much as possible, is to run a <a href="http://forums.debian.net/viewtopic.php?t=15612">mixed stable/testing system</a> which is <a href="http://www.linuxquestions.org/questions/debian-26/debian-testing-vs-debian-stable-with-testing-repositories-708263/">not recommended</a> but entirely possible <img src='http://www.kromhouts.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  To do this we will need to upgrade: linux-image, linux-base, xserver-xorg-video-intel (remove any xserver-xorg-* drivers that you are not using) and the xserver itself will also need to be upgraded&#8230;not for the faint of heart&#8230;pay very careful attention to the dependencies.</p>
<p>These are the main packages that I ended up running from Wheezy:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;">$ apt-show-versions | grep testing
&nbsp;
bluez-alsa/testing uptodate 4.96-1
gcc-4.6-base/testing uptodate 4.6.1-4
initramfs-tools/testing uptodate 0.99
lib32asound2/testing uptodate 1.0.24.1-4
libasound2/testing uptodate 1.0.24.1-4
libassuan0/testing uptodate 2.0.2-1
libcairo2/testing uptodate 1.10.2-6.1
libdrm-intel1/testing uptodate 2.4.26-1
libgcrypt11/testing uptodate 1.5.0-3
libgl1-mesa-dri/testing uptodate 7.11-6
libgl1-mesa-glx/testing uptodate 7.11-6
libglapi-mesa/testing uptodate 7.11-6
libglib2.0-0/testing uptodate 2.28.6-1
libglu1-mesa/testing uptodate 7.11-6
libstdc++6/testing uptodate 4.6.1-4
libva-glx1/testing uptodate 1.0.12-2
libva-tpi1/testing uptodate 1.0.12-2
libva-x11-1/testing uptodate 1.0.12-2  
libva1/testing uptodate 1.0.12-2       
libwmf0.2-7/testing uptodate 0.2.8.4-8.1
libxcb-util0/testing uptodate 0.3.8-1
libxfont1/testing uptodate 1:1.4.4-1
linux-base/testing uptodate 3.3
linux-image-3.0.0-1-amd64/testing uptodate 3.0.0-3
memtest86+/testing uptodate 4.20-1
memtester/testing uptodate 4.2.2-1
multiarch-support/testing uptodate 2.13-21
xorg/testing uptodate 1:7.6+9
xserver-common/testing uptodate 2:1.11.1-1
xserver-xorg/testing uptodate 1:7.6+9
xserver-xorg-core/testing uptodate 2:1.11.1-1
xserver-xorg-input-evdev/testing uptodate 1:2.6.0-2+b2
xserver-xorg-input-synaptics/testing uptodate 1.4.1-1+b1
xserver-xorg-video-intel/testing uptodate 2:2.16.0-1
xserver-xorg-video-vesa/testing uptodate 1:2.3.0-7+b1
xserver-xorg-video-vmware/testing uptodate 1:11.0.3-2+b2</pre></div></div>

<p><strong>lspci:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># lspci -v
00:00.0 Host bridge: Intel Corporation Sandy Bridge DRAM Controller (rev 09)
        Subsystem: Samsung Electronics Co Ltd Device c0a5
        Flags: bus master, fast devsel, latency 0
        Capabilities: [e0] Vendor Specific Information: Len=0c &lt;?&gt;
&nbsp;
00:01.0 PCI bridge: Intel Corporation Sandy Bridge PCI Express Root Port (rev 09) (prog-if 00 [Normal decode])
        Flags: bus master, fast devsel, latency 0
        Bus: primary=00, secondary=01, subordinate=01, sec-latency=0
        I/O behind bridge: 0000d000-0000dfff
        Memory behind bridge: f4000000-f50fffff
        Prefetchable memory behind bridge: 00000000d0000000-00000000e1ffffff
        Capabilities: [88] Subsystem: Samsung Electronics Co Ltd Device c0a5
        Capabilities: [80] Power Management version 3
        Capabilities: [90] MSI: Enable+ Count=1/1 Maskable- 64bit-
        Capabilities: [a0] Express Root Port (Slot+), MSI 00
        Capabilities: [100] Virtual Channel
        Capabilities: [140] Root Complex Link
        Kernel driver in use: pcieport
&nbsp;
00:02.0 VGA compatible controller: Intel Corporation Sandy Bridge Integrated Graphics Controller (rev 09) (prog-if 00 [VGA controller])
        Subsystem: Samsung Electronics Co Ltd Device c0a5                                                                    
        Flags: bus master, fast devsel, latency 0, IRQ 11                                                                    
        Memory at f5400000 (64-bit, non-prefetchable) [size=4M]                                                              
        Memory at c0000000 (64-bit, prefetchable) [size=256M]                                                                
        I/O ports at e000 [size=64]                                                                                          
        Expansion ROM at &lt;unassigned&gt; [disabled]                                                                             
        Capabilities: [90] MSI: Enable- Count=1/1 Maskable- 64bit-                                                           
        Capabilities: [d0] Power Management version 2                                                                        
        Capabilities: [a4] PCI Advanced Features                                                                             
&nbsp;
00:16.0 Communication controller: Intel Corporation Cougar Point HECI Controller #1 (rev 04)                                 
        Subsystem: Samsung Electronics Co Ltd Device c0a5                                                                    
        Flags: bus master, fast devsel, latency 0, IRQ 11                                                                    
        Memory at f760a000 (64-bit, non-prefetchable) [size=16]                                                              
        Capabilities: [50] Power Management version 3                                                                        
        Capabilities: [8c] MSI: Enable- Count=1/1 Maskable- 64bit+                                                           
&nbsp;
00:1a.0 USB Controller: Intel Corporation Cougar Point USB Enhanced Host Controller #2 (rev 04) (prog-if 20 [EHCI])
        Subsystem: Samsung Electronics Co Ltd Device c0a5
        Flags: bus master, medium devsel, latency 0, IRQ 16
        Memory at f7608000 (32-bit, non-prefetchable) [size=1K]
        Capabilities: [50] Power Management version 2
        Capabilities: [58] Debug port: BAR=1 offset=00a0
        Capabilities: [98] PCI Advanced Features
        Kernel driver in use: ehci_hcd
&nbsp;
00:1b.0 Audio device: Intel Corporation Cougar Point High Definition Audio Controller (rev 04)
        Subsystem: Samsung Electronics Co Ltd Device c0a5
        Flags: bus master, fast devsel, latency 0, IRQ 22
        Memory at f7600000 (64-bit, non-prefetchable) [size=16K]
        Capabilities: [50] Power Management version 2
        Capabilities: [60] MSI: Enable- Count=1/1 Maskable- 64bit+
        Capabilities: [70] Express Root Complex Integrated Endpoint, MSI 00
        Capabilities: [100] Virtual Channel
        Capabilities: [130] Root Complex Link
        Kernel driver in use: HDA Intel
&nbsp;
00:1c.0 PCI bridge: Intel Corporation Cougar Point PCI Express Root Port 1 (rev b4) (prog-if 00 [Normal decode])
        Flags: bus master, fast devsel, latency 0
        Bus: primary=00, secondary=02, subordinate=02, sec-latency=0
        I/O behind bridge: 0000c000-0000cfff
        Memory behind bridge: f6c00000-f75fffff
        Prefetchable memory behind bridge: 00000000e3700000-00000000e40fffff
        Capabilities: [40] Express Root Port (Slot+), MSI 00
        Capabilities: [80] MSI: Enable+ Count=1/1 Maskable- 64bit-
        Capabilities: [90] Subsystem: Samsung Electronics Co Ltd Device c0a5
        Capabilities: [a0] Power Management version 2
        Kernel driver in use: pcieport
&nbsp;
00:1c.3 PCI bridge: Intel Corporation Cougar Point PCI Express Root Port 4 (rev b4) (prog-if 00 [Normal decode])
        Flags: bus master, fast devsel, latency 0
        Bus: primary=00, secondary=03, subordinate=03, sec-latency=0
        I/O behind bridge: 0000b000-0000bfff
        Memory behind bridge: f6200000-f6bfffff
        Prefetchable memory behind bridge: 00000000e2c00000-00000000e35fffff
        Capabilities: [40] Express Root Port (Slot+), MSI 00
        Capabilities: [80] MSI: Enable+ Count=1/1 Maskable- 64bit-
        Capabilities: [90] Subsystem: Samsung Electronics Co Ltd Device c0a5
        Capabilities: [a0] Power Management version 2
        Kernel driver in use: pcieport
&nbsp;
00:1c.4 PCI bridge: Intel Corporation Cougar Point PCI Express Root Port 5 (rev b4) (prog-if 00 [Normal decode])
        Flags: bus master, fast devsel, latency 0
        Bus: primary=00, secondary=04, subordinate=04, sec-latency=0
        I/O behind bridge: 0000a000-0000afff
        Memory behind bridge: f5800000-f61fffff
        Prefetchable memory behind bridge: 00000000e2100000-00000000e2afffff
        Capabilities: [40] Express Root Port (Slot+), MSI 00
        Capabilities: [80] MSI: Enable+ Count=1/1 Maskable- 64bit-
        Capabilities: [90] Subsystem: Samsung Electronics Co Ltd Device c0a5
        Capabilities: [a0] Power Management version 2
        Kernel driver in use: pcieport
&nbsp;
00:1d.0 USB Controller: Intel Corporation Cougar Point USB Enhanced Host Controller #1 (rev 04) (prog-if 20 [EHCI])
        Subsystem: Samsung Electronics Co Ltd Device c0a5
        Flags: bus master, medium devsel, latency 0, IRQ 23
        Memory at f7607000 (32-bit, non-prefetchable) [size=1K]
        Capabilities: [50] Power Management version 2
        Capabilities: [58] Debug port: BAR=1 offset=00a0
        Capabilities: [98] PCI Advanced Features
        Kernel driver in use: ehci_hcd
&nbsp;
00:1f.0 ISA bridge: Intel Corporation Cougar Point LPC Controller (rev 04)
        Subsystem: Samsung Electronics Co Ltd Device c0a5
        Flags: bus master, medium devsel, latency 0
        Capabilities: [e0] Vendor Specific Information: Len=0c &lt;?&gt;
&nbsp;
00:1f.2 SATA controller: Intel Corporation Cougar Point 6 port SATA AHCI Controller (rev 04) (prog-if 01 [AHCI 1.0])
        Subsystem: Samsung Electronics Co Ltd Device c0a5
        Flags: bus master, 66MHz, medium devsel, latency 0, IRQ 29
        I/O ports at e0b0 [size=8]
        I/O ports at e0a0 [size=4]
        I/O ports at e090 [size=8]
        I/O ports at e080 [size=4]
        I/O ports at e060 [size=32]
        Memory at f7606000 (32-bit, non-prefetchable) [size=2K]
        Capabilities: [80] MSI: Enable+ Count=1/1 Maskable- 64bit-
        Capabilities: [70] Power Management version 3
        Capabilities: [a8] SATA HBA v1.0
        Capabilities: [b0] PCI Advanced Features
        Kernel driver in use: ahci
&nbsp;
00:1f.3 SMBus: Intel Corporation Cougar Point SMBus Controller (rev 04)
        Subsystem: Samsung Electronics Co Ltd Device c0a5
        Flags: medium devsel, IRQ 18
        Memory at f7605000 (64-bit, non-prefetchable) [size=256]
        I/O ports at e040 [size=32]
&nbsp;
01:00.0 3D controller: nVidia Corporation Device 0df4 (rev a1)
        Subsystem: Samsung Electronics Co Ltd Device c0a5
        Flags: fast devsel, IRQ 16
        Memory at f4000000 (32-bit, non-prefetchable) [size=16M]
        Memory at d0000000 (64-bit, prefetchable) [size=256M]
        Memory at e0000000 (64-bit, prefetchable) [size=32M]
        I/O ports at d000 [size=128]
        Expansion ROM at f5000000 [disabled] [size=512K]
        Capabilities: [60] Power Management version 3
        Capabilities: [68] MSI: Enable- Count=1/1 Maskable- 64bit+
        Capabilities: [78] Express Endpoint, MSI 00
        Capabilities: [b4] Vendor Specific Information: Len=14 &lt;?&gt;
        Capabilities: [100] Virtual Channel
        Capabilities: [128] Power Budgeting &lt;?&gt;
        Capabilities: [600] Vendor Specific Information: ID=0001 Rev=1 Len=024 &lt;?&gt;
&nbsp;
02:00.0 Network controller: Broadcom Corporation BCM4313 802.11b/g/n Wireless LAN Controller (rev 01)
        Subsystem: Askey Computer Corp. Device 7179
        Flags: fast devsel, IRQ 16
        Memory at f6c00000 (64-bit, non-prefetchable) [size=16K]
        Capabilities: [40] Power Management version 3
        Capabilities: [58] Vendor Specific Information: Len=78 &lt;?&gt;
        Capabilities: [48] MSI: Enable- Count=1/1 Maskable- 64bit+
        Capabilities: [d0] Express Endpoint, MSI 00
        Capabilities: [100] Advanced Error Reporting
        Capabilities: [13c] Virtual Channel
        Capabilities: [160] Device Serial Number 00-00-9f-ff-ff-94-b4-74
        Capabilities: [16c] Power Budgeting &lt;?&gt;
&nbsp;
03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 06)
        Subsystem: Samsung Electronics Co Ltd Device c0a5
        Flags: bus master, fast devsel, latency 0, IRQ 28
        I/O ports at b000 [size=256]
        Memory at e2c04000 (64-bit, prefetchable) [size=4K]
        Memory at e2c00000 (64-bit, prefetchable) [size=16K]
        Capabilities: [40] Power Management version 3
        Capabilities: [50] MSI: Enable+ Count=1/1 Maskable- 64bit+
        Capabilities: [70] Express Endpoint, MSI 01
        Capabilities: [b0] MSI-X: Enable- Count=4 Masked-
        Capabilities: [d0] Vital Product Data
        Capabilities: [100] Advanced Error Reporting
        Capabilities: [140] Virtual Channel
        Capabilities: [160] Device Serial Number 01-00-00-00-68-4c-e0-00
        Kernel driver in use: r8169
&nbsp;
04:00.0 USB Controller: NEC Corporation uPD720200 USB 3.0 Host Controller (rev 04) (prog-if 30)
        Subsystem: Samsung Electronics Co Ltd Device c0a5
        Flags: bus master, fast devsel, latency 0, IRQ 16
        Memory at f5800000 (64-bit, non-prefetchable) [size=8K]
        Capabilities: [50] Power Management version 3
        Capabilities: [70] MSI: Enable- Count=1/8 Maskable- 64bit+
        Capabilities: [90] MSI-X: Enable- Count=8 Masked-
        Capabilities: [a0] Express Endpoint, MSI 00
        Capabilities: [100] Advanced Error Reporting
        Capabilities: [140] Device Serial Number ff-ff-ff-ff-ff-ff-ff-ff
        Capabilities: [150] #18</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.kromhouts.net/blog/pc-hardware/samsung-rf511-s04-au-review-with-debian-gnulinux/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Tweaking Debian Squeeze</title>
		<link>http://www.kromhouts.net/blog/server-admin/tweaking-debian-squeeze/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=tweaking-debian-squeeze</link>
		<comments>http://www.kromhouts.net/blog/server-admin/tweaking-debian-squeeze/#comments</comments>
		<pubDate>Fri, 13 May 2011 09:41:03 +0000</pubDate>
		<dc:creator>gavingc</dc:creator>
				<category><![CDATA[Server-admin]]></category>

		<guid isPermaLink="false">http://www.kromhouts.net/blog/?p=106</guid>
		<description><![CDATA[All my systems have been upgraded to Squeeze for a couple of months now. Initial impression was that there are lots of nice new toys and the GNU tools and base Debian system feel even more solid than ever. However KDE is more flakey and slower than I have seen a GNU/Linux desktop in a [...]]]></description>
			<content:encoded><![CDATA[<p>All my systems have been upgraded to Squeeze for a couple of months now. Initial impression was that there are lots of nice new toys and the GNU tools and base Debian system feel even more solid than ever. However KDE is more flakey and slower than I have seen a GNU/Linux desktop in a while. There are also missing features in some KDE programs that were yet to be ported (to plasma I presume) at the time that Debian froze the KDE version.</p>
<p><span id="more-106"></span></p>
<p>Turns out the slowness can be much improved with a few tweaks. Mainly disabling that complete failure (<a href="http://forums.opensuse.org/applications/418846-how-do-i-get-rid-nepomuk-virus.html">or virus</a>) Nepomuk. After this the entire KDE desktop feels much smoother and more responsive and doesn&#8217;t get buried into swap with run away indexing.</p>
<blockquote><p>
In System Settings/Advanced tab/Desktop search:<br />
- Disable checkbox for &#8220;Nepomuk Semantic Desktop&#8221;<br />
- Disable checkbox for &#8220;Strigi Desktop File Indexer&#8221;
</p></blockquote>
<blockquote><p>
In System Settings/Advanced tab/Service Manager:<br />
- Disable any services you don&#8217;t need e.g: Power Devil if not using a laptop.<br />
- Yes Nepomuk is in here too, disable it, although that does not seem to change anything.<br />
- Take some time to consider which services you will really use every day.
</p></blockquote>
<p>~/.kde/Autostart/killnepomuk.sh</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
<span style="color: #666666; font-style: italic;">#Kill the nepomuk virus.</span>
pkill nepomukserver <span style="color: #000000; font-weight: bold;">&amp;</span></pre></div></div>

<p>Remove and exclude from all backups (this cache can get to 650MB!):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-R</span> .kde<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>apps<span style="color: #000000; font-weight: bold;">/</span>nepomuk<span style="color: #000000; font-weight: bold;">/</span>repository</pre></div></div>

<p>Other things that I previously didn&#8217;t need to exclude from backups:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">exclude = <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/*/</span>.kde<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>apps<span style="color: #000000; font-weight: bold;">/</span>nepomuk<span style="color: #000000; font-weight: bold;">/</span>repository
exclude = <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/*/</span>.mozilla<span style="color: #000000; font-weight: bold;">/</span>eclipse
exclude = <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/*/</span>.mozilla<span style="color: #000000; font-weight: bold;">/</span>firefox</pre></div></div>

<p>Uninstall and disable akonadi from starting mysql, .config/akonadi/akonadiserverrc:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">StartServer</span>=<span style="color: #c20cb9; font-weight: bold;">false</span></pre></div></div>

<p>Note that this may cause you some issues if you use kde pim apps, I don&#8217;t.</p>
<p><strong>Conclusion</strong></p>
<p>I really love the KDE Alt+F2 command line runner, I know the concept is not completely new but this is the first time that I really find it working for me. The menu is flashy but takes too long, use Alt+F2. </p>
<p>Dolphin is not powerful enough for me and I am back to using Konqueror. I did give Dolphin a fair go but I multi-split panes and right click to get svn context menu&#8217;s&#8230;all day long.</p>
<p>Webkit in Konqueror is still not for browsing, still using Iceweasel/Firefox and all it&#8217;s toys.</p>
<p>Kate, luv ya, finally *smart* auto brackets and code snippets/templates.</p>
<p>I&#8217;m finding the 3D window switching and screen edge actions so productive that I have done away with the task bar, nice! Again not brand new concepts but really working for me for the first time.</p>
<p>Kdesvn mostly better, sadly I&#8217;ll be leaving you for Git soon.</p>
<p>USB mount/umount WAY better, thanks to the Angel that fixed this.</p>
<p><strong>Comment with your tweaks if you&#8217;ve got em!</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.kromhouts.net/blog/server-admin/tweaking-debian-squeeze/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Alfresco aka Bloatware</title>
		<link>http://www.kromhouts.net/blog/general-software/alfresco-aka-bloatware/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=alfresco-aka-bloatware</link>
		<comments>http://www.kromhouts.net/blog/general-software/alfresco-aka-bloatware/#comments</comments>
		<pubDate>Fri, 13 May 2011 09:12:07 +0000</pubDate>
		<dc:creator>gavingc</dc:creator>
				<category><![CDATA[General Software]]></category>

		<guid isPermaLink="false">http://www.kromhouts.net/blog/?p=95</guid>
		<description><![CDATA[For some time I&#8217;ve been looking for a document management system (DMS) to add to my tool kit. I have come across good reports of Alfresco a few times and thought I would give it a go. Now it&#8217;s not my intention here to hurt any persons feelings so don&#8217;t take this personally&#8230;but I just [...]]]></description>
			<content:encoded><![CDATA[<p>For some time I&#8217;ve been looking for a document management system (DMS) to add to my tool kit. I have come across good reports of Alfresco a few times and thought I would give it a go.</p>
<p><span id="more-95"></span></p>
<p>Now it&#8217;s not my intention here to hurt any persons feelings so don&#8217;t take this personally&#8230;but I just have to vent! I went to download the Alfresco package and found that it was ~500MB. Now that seems a little on the large side and it must be packing a bunch of embedded things like Tomcat and Mysql which I already have on any Debian system. So I thought I would just grab a copy of the source and compile it quickly&#8230;I cut the download off at 1.5GB! May as well have just run:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #000000; font-weight: bold;">*</span>.jar</pre></div></div>

<p>Holy crap, they must have included every Java library ever written on planet Earth and a few from just outside the Solar System! Ever heard of dependancy management or Ivy caching? Makes my 60MB war file look like a toy (which I can assure you it&#8217;s not). At this point I don&#8217;t care any more how functional the app is, I&#8217;m not going to use it. How is a man to be Agile (let alone Lean) with tools that over weight?</p>
<p>MyDMS may not have super cow powers but so far is the best that I can find, the Grails Stitches plugin looks promising if I can update it to a newer version of Grails. KnowledgeTree looks interesting and I&#8217;m pretty sure that I can build a basic Grails DMS that holds the document in a relational database. But I still have the nagging feeling that an IT problem this old should have been solved already&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kromhouts.net/blog/general-software/alfresco-aka-bloatware/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Proof that I once knew this!</title>
		<link>http://www.kromhouts.net/blog/life/proof-that-i-once-knew-this/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=proof-that-i-once-knew-this</link>
		<comments>http://www.kromhouts.net/blog/life/proof-that-i-once-knew-this/#comments</comments>
		<pubDate>Fri, 22 Apr 2011 12:24:29 +0000</pubDate>
		<dc:creator>gavingc</dc:creator>
				<category><![CDATA[Life]]></category>

		<guid isPermaLink="false">http://www.kromhouts.net/blog/?p=91</guid>
		<description><![CDATA[Do you know what is cool/strange/amazing/wonderful? When I &#8216;google&#8217; for something and the answer is a link to my own blog! Proving that I once knew this!]]></description>
			<content:encoded><![CDATA[<p>Do you know what is cool/strange/amazing/wonderful?<br />
When I &#8216;google&#8217; for something and the answer is a link to my <strong>own blog!</strong></p>
<p>Proving that I once knew this!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kromhouts.net/blog/life/proof-that-i-once-knew-this/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Backupninja rsync handler</title>
		<link>http://www.kromhouts.net/blog/server-admin/backupninja-rsync-handler/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=backupninja-rsync-handler</link>
		<comments>http://www.kromhouts.net/blog/server-admin/backupninja-rsync-handler/#comments</comments>
		<pubDate>Thu, 07 Apr 2011 06:54:21 +0000</pubDate>
		<dc:creator>gavingc</dc:creator>
				<category><![CDATA[Server-admin]]></category>

		<guid isPermaLink="false">http://www.kromhouts.net/blog/?p=70</guid>
		<description><![CDATA[&#8230;because the rsync support for backupninja (or at least the Debian one) is a bit naff&#8230;or I just simply do not understand it. Very true if a little surprising since all the other backupninja handlers have always worked very well for me. Backupninja is wonderful for creating a backup system, run these shell commands, hotcopy [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.digriz.org.uk/backups">&#8230;because the rsync support for backupninja (or at least the Debian one) is a bit naff&#8230;or I just simply do not understand it. </a> Very true if a little surprising since all the other backupninja handlers have always worked very well for me. Backupninja is wonderful for creating a backup <em>system</em>, run these shell commands, hotcopy those databases, rdiff-backup the result and rsync or duplicity all that somewhere else. Wonderful stuff now lets fix rsync.</p>
<p>P.S: if you do know how to make the supplied rsync handler work then please post a comment.</p>
<p><span id="more-70"></span></p>
<p>The backupninja supplied rsync handler might be able to do rotations when all I want is a mirror&#8230;but as far as actual backup even the simplest config causes trouble.</p>
<p>/etc/backup.d/10.TunesToBak.rsync:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>general<span style="color: #7a0874; font-weight: bold;">&#93;</span>
mountpoint = <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1</span>
days = <span style="color: #000000;">30</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">source</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>
from = <span style="color: #7a0874; font-weight: bold;">local</span>
include = <span style="color: #000000; font-weight: bold;">/</span>tunes</pre></div></div>

<p>Note: example taken from an official backupninja bug, I have also tried and failed with many other combinations.</p>
<p>All I get is this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Info: <span style="color: #000000; font-weight: bold;">&gt;&gt;&gt;&gt;</span> starting action <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>backup.d<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">10</span>.rsync <span style="color: #7a0874; font-weight: bold;">&#40;</span>because of --now<span style="color: #7a0874; font-weight: bold;">&#41;</span>
Debug: <span style="color: #c20cb9; font-weight: bold;">yes</span>
Info: Rotating <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">///</span>tunes...
Info: Syncing <span style="color: #000000; font-weight: bold;">/</span>tunes on <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">///</span>tunes<span style="color: #000000; font-weight: bold;">/</span>tunes.0<span style="color: #000000; font-weight: bold;">/</span>...
Debug: <span style="color: #c20cb9; font-weight: bold;">nice</span> <span style="color: #660033;">-n</span> <span style="color: #000000;">0</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>rsync <span style="color: #660033;">-av</span> <span style="color: #660033;">--delete</span> <span style="color: #660033;">--recursive</span> <span style="color: #660033;">--numeric-ids</span> <span style="color: #000000; font-weight: bold;">//</span>tunes<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">///</span>tunes<span style="color: #000000; font-weight: bold;">/</span>tunes.0<span style="color: #000000; font-weight: bold;">/</span>
rsync: <span style="color: #660033;">-av</span> <span style="color: #660033;">--delete</span> <span style="color: #660033;">--recursive</span> --numeric-ids: unknown option
rsync error: syntax or usage error <span style="color: #7a0874; font-weight: bold;">&#40;</span>code <span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> at main.c<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1443</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #007800;">client</span>=3.0.7<span style="color: #7a0874; font-weight: bold;">&#93;</span>
Info: <span style="color: #000000; font-weight: bold;">&lt;&lt;&lt;&lt;</span> finished action <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>backup.d<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">10</span>.rsync: SUCCESS
Debug: send report to root
Info: FINISHED: <span style="color: #000000;">1</span> actions run. <span style="color: #000000;">0</span> fatal. <span style="color: #000000;">0</span> error. <span style="color: #000000;">0</span> warning.</pre></div></div>

<p>So even though the backup clearly failed there are no errors reported! What the hell is up with all the extra ////&#8217;s! The strange thing is that manually running the rsync command that debug outputs works just fine. Smells bad, in every example that I found people are using the .sh handler to rsync just as I was, at least this is simple and works but often suffers from not reporting rsync errors. Seems there is a need for a .rsyncsimple handler.</p>
<p><strong>Handler .sh</strong></p>
<p>Turns out that the .sh handler is smarter than explicitly mentioned in the docs, it can report errors!</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># This script can run most any command normally run on the command line.
# Add anything usefull that you would like to do during a backup.
# Handler output functions may be used:
#    * debug $msg -- log debugging info
#    * info $msg -- log general information.
#    * warning $msg -- log a warning
#    * error $msg -- log an error
#    * fatal $msg -- log a fatal error and exit
&nbsp;
# (1) a list of all the packages installed and removed.
#     this file can be used to restore the state of installed packages
#     by running &quot;dpkg --set-selections &lt; dpkg-selections.txt&quot;
&nbsp;
BAK_GET_SELECTIONS=&quot;ssh root@host 'dpkg --get-selections &gt; /var/backups/dpkg-selections.txt'&quot;
eval $BAK_GET_SELECTIONS || fatal &quot;$BAK_GET_SELECTIONS&quot;
&nbsp;
# (2) used with along with /etc/fstab and /var/backups/partitions.hdx.txt
#     to decide on how to partition a new disk during a recovery.
#     possibly by running &quot;sfdisk /dev/sdx &lt; partitions.hdx.txt&quot;
#      (MAKE SURE YOU PARTITION THE CORRECT DISK!!!)
&nbsp;
BAK_DF=&quot;ssh root@host 'df &gt; /var/backups/df.txt'&quot;
eval $BAK_DF || fatal &quot;$BAK_DF&quot;</pre></div></div>

<p><strong>Handler .rsyncsimple</strong></p>
<p>Turns out Chris Lamb felt the same way and posted a <a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=515108">Debian bug report</a> with a GLP&#8217;d .rsync_ssh handler. Thanks Chris!</p>
<p>Sadly I&#8217;ve just upgraded to Debian 6.0 &#8220;Squeeze&#8221; and even with the new &#8216;mirror&#8217; option I don&#8217;t get what I want. So adapting .rsync_ssh I think we can get .rsyncsimple, retain Chris&#8217;s ssh functionality and put it on gist.github.com! More tomorrow 01:30 and bed time&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kromhouts.net/blog/server-admin/backupninja-rsync-handler/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Prevent Tomcat Starting at Boot</title>
		<link>http://www.kromhouts.net/blog/server-admin/prevent-tomcat-starting-at-boot/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=prevent-tomcat-starting-at-boot</link>
		<comments>http://www.kromhouts.net/blog/server-admin/prevent-tomcat-starting-at-boot/#comments</comments>
		<pubDate>Thu, 07 Apr 2011 06:37:35 +0000</pubDate>
		<dc:creator>gavingc</dc:creator>
				<category><![CDATA[Server-admin]]></category>

		<guid isPermaLink="false">http://www.kromhouts.net/blog/?p=42</guid>
		<description><![CDATA[If you use Tomcat occasionally you may want the package installed but not have it startup at boot time. These notes are for Debian 6.0 (Squeeze) and the supplied Tomcat 6 package. Tomcat can simply be removed between uses with apt-get or aptitude. But this is time consuming and can be error prone if one [...]]]></description>
			<content:encoded><![CDATA[<p>If you use Tomcat occasionally you may want the package installed but not have it startup at boot time.<br />
These notes are for Debian 6.0 (Squeeze) and the supplied Tomcat 6 package.</p>
<p><span id="more-42"></span></p>
<p>Tomcat can simply be removed between uses with apt-get or aptitude. But this is time consuming and can be error prone if one accidentally purges and removes all the carefully crafted config files.</p>
<p>Many Debian packages use an &#8220;enabled=1&#8243; setting in /etc/default/packageName to control startup but even though some great improvements have been made in the Tomcat startup scripts this was not one of them.</p>
<p>Check the run level config:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># ls -l /etc/rc?.d/*tomcat*
lrwxrwxrwx 1 root root 17 Apr  6 00:42 /etc/rc0.d/K01tomcat6 -&gt; ../init.d/tomcat6
lrwxrwxrwx 1 root root 17 Apr  6 00:42 /etc/rc1.d/K01tomcat6 -&gt; ../init.d/tomcat6
lrwxrwxrwx 1 root root 17 Apr  6 00:42 /etc/rc2.d/S20tomcat6 -&gt; ../init.d/tomcat6
lrwxrwxrwx 1 root root 17 Apr  6 00:42 /etc/rc3.d/S20tomcat6 -&gt; ../init.d/tomcat6
lrwxrwxrwx 1 root root 17 Apr  6 00:42 /etc/rc4.d/S20tomcat6 -&gt; ../init.d/tomcat6
lrwxrwxrwx 1 root root 17 Apr  6 00:42 /etc/rc5.d/S20tomcat6 -&gt; ../init.d/tomcat6
lrwxrwxrwx 1 root root 17 Apr  6 00:42 /etc/rc6.d/K01tomcat6 -&gt; ../init.d/tomcat6</pre></div></div>

<p>To disable run level startup:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># update-rc.d -f tomcat6 remove
update-rc.d: using dependency based boot sequencing</pre></div></div>

<p>Confirmation check:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># ls -l /etc/rc?.d/*tomcat*
ls: cannot access /etc/rc?.d/*tomcat*: No such file or directory</pre></div></div>

<p>Yay!</p>
<p>Now we can manually start/stop Tomcat at will:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># /etc/init.d/tomcat6 start
# /etc/init.d/tomcat6 stop
# /etc/init.d/tomcat6 restart</pre></div></div>

<p>To re-enable run level startup (as per .deb package postinst):</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;"># update-rc.d tomcat6 defaults 92 08
update-rc.d: using dependency based boot sequencing
&nbsp;
# ls -l /etc/rc?.d/*tomcat*
lrwxrwxrwx 1 root root 17 Apr  6 00:45 /etc/rc0.d/K01tomcat6 -&gt; ../init.d/tomcat6
lrwxrwxrwx 1 root root 17 Apr  6 00:45 /etc/rc1.d/K01tomcat6 -&gt; ../init.d/tomcat6
lrwxrwxrwx 1 root root 17 Apr  6 00:45 /etc/rc2.d/S20tomcat6 -&gt; ../init.d/tomcat6
lrwxrwxrwx 1 root root 17 Apr  6 00:45 /etc/rc3.d/S20tomcat6 -&gt; ../init.d/tomcat6
lrwxrwxrwx 1 root root 17 Apr  6 00:45 /etc/rc4.d/S20tomcat6 -&gt; ../init.d/tomcat6
lrwxrwxrwx 1 root root 17 Apr  6 00:45 /etc/rc5.d/S20tomcat6 -&gt; ../init.d/tomcat6
lrwxrwxrwx 1 root root 17 Apr  6 00:45 /etc/rc6.d/K01tomcat6 -&gt; ../init.d/tomcat6</pre></div></div>

<p>It&#8217;s back!</p>
<p>The same should be possible for other services like mysql:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;">update-rc.d -f mysql remove
update-rc.d -f mysql-ndb remove
update-rc.d -f mysql-ndb-mgm remove</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.kromhouts.net/blog/server-admin/prevent-tomcat-starting-at-boot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Updating multiple page elements with Grails, Ajax and jQuery</title>
		<link>http://www.kromhouts.net/blog/grails/updating-multiple-page-elements-with-grails-and-ajax/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=updating-multiple-page-elements-with-grails-and-ajax</link>
		<comments>http://www.kromhouts.net/blog/grails/updating-multiple-page-elements-with-grails-and-ajax/#comments</comments>
		<pubDate>Sat, 12 Mar 2011 05:47:12 +0000</pubDate>
		<dc:creator>gavingc</dc:creator>
				<category><![CDATA[Grails]]></category>
		<category><![CDATA[Grails-1.2]]></category>

		<guid isPermaLink="false">http://www.kromhouts.net/blog/?p=35</guid>
		<description><![CDATA[The moment you start doing real work with Ajax you will find that multiple page elements have to be updated from a single action. The options that I found are: Write a massive heap of javascript with triggers and parameterised calls every where. Create a porcelain ajax framework using Grails includes. Write a javascript element [...]]]></description>
			<content:encoded><![CDATA[<p>The moment you start doing real work with Ajax you will find that multiple page elements have to be updated from a single action.</p>
<p><span id="more-35"></span></p>
<p>The options that I found are:</p>
<ol>
<li>Write a massive heap of javascript with triggers and parameterised calls every where.</li>
<li>
  <a href="http://iamnoah.blogspot.com/2010/07/grails-porcelain-ajax-framework-part-i.html">Create a porcelain ajax framework using Grails includes.</a>
 </li>
<li><a href="http://weichhold.com/2009/07/20/updating-multiple-page-fragments-with-grails-and-ajax/">Write a javascript element update function with a nice interface and send JSON to it.</a></li>
</ol>
<p>#1 Quickly does not scale.<br />
#2 Seems very nice but is not a complete solution yet and has the disadvantage of multiple calls, one per element.<br />
#3 Is the option further developed here.</p>
<p>The good news is that as of Grails-1.2 the JSON can now be built directly in the controller using the newer JSON builder:</p>

<div class="wp_syntax"><div class="code"><pre class="groovy" style="font-family:monospace;">render<span style="color: #66cc66;">&#40;</span>contentType:<span style="color: #ff0000;">&quot;text/json&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    updates <span style="color: #66cc66;">=</span> array <span style="color: #66cc66;">&#123;</span>
        element<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#91;</span> mode: <span style="color: #ff0000;">'replace'</span>, target:<span style="color: #ff0000;">&quot;$params.target&quot;</span>, content: g.<span style="color: #006600;">render</span><span style="color: #66cc66;">&#40;</span>template: <span style="color: #ff0000;">'create'</span>, model:model<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>
        element<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#91;</span> mode: <span style="color: #ff0000;">'execute'</span>, script: <span style="color: #ff0000;">&quot;alert('Hi');&quot;</span> <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>The jQuery javascript can be simplified to:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// Apply updates to multiple page elements.</span>
<span style="color: #006600; font-style: italic;">// @json JSON response object from an ajax request.</span>
<span style="color: #006600; font-style: italic;">// @json.updates Array of element updates to apply.</span>
<span style="color: #006600; font-style: italic;">// @element.mode The update mode: execute or replace, prepend, append.</span>
<span style="color: #006600; font-style: italic;">// @element.script Script to execute, if execute mode.</span>
<span style="color: #006600; font-style: italic;">// @element.target jQuery target selector, if update mode.</span>
<span style="color: #006600; font-style: italic;">// @element.content Content to update target with, if update mode.</span>
<span style="color: #003366; font-weight: bold;">function</span> applyElementUpdates<span style="color: #009900;">&#40;</span>json<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> updates<span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> script<span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>json.<span style="color: #660066;">updates</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        updates <span style="color: #339933;">=</span> json.<span style="color: #660066;">updates</span><span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">var</span> element<span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">var</span> scripts <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Array<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span>element <span style="color: #000066; font-weight: bold;">in</span> updates<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            element <span style="color: #339933;">=</span> updates<span style="color: #009900;">&#91;</span>element<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #000066; font-weight: bold;">switch</span><span style="color: #009900;">&#40;</span>element.<span style="color: #660066;">mode</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'execute'</span><span style="color: #339933;">:</span>
                    scripts.<span style="color: #660066;">push</span><span style="color: #009900;">&#40;</span>element.<span style="color: #660066;">script</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'replace'</span><span style="color: #339933;">:</span>
                    jQuery<span style="color: #009900;">&#40;</span>element.<span style="color: #660066;">target</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span>element.<span style="color: #660066;">content</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'prepend'</span><span style="color: #339933;">:</span>
                    jQuery<span style="color: #009900;">&#40;</span>element.<span style="color: #660066;">target</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">prepend</span><span style="color: #009900;">&#40;</span>element.<span style="color: #660066;">content</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'append'</span><span style="color: #339933;">:</span>
                    jQuery<span style="color: #009900;">&#40;</span>element.<span style="color: #660066;">target</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">append</span><span style="color: #009900;">&#40;</span>element.<span style="color: #660066;">content</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #006600; font-style: italic;">// Run scripts.</span>
        <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span>script <span style="color: #000066; font-weight: bold;">in</span> scripts<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            script <span style="color: #339933;">=</span> scripts<span style="color: #009900;">&#91;</span>script<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">eval</span><span style="color: #009900;">&#40;</span>script<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// if(json.updates)</span>
<span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// applyElementUpdates</span></pre></div></div>

<p><strong>Usage Example</strong></p>
<p>Controller:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">class</span> ExampleController <span style="color: #009900;">&#123;</span>
&nbsp;
    static allowedMethods <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>ajaxCreate<span style="color: #339933;">:</span><span style="color: #3366CC;">'POST'</span><span style="color: #009900;">&#93;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// Cookie based authentication should apparently be protected by only accepting post.</span>
    def ajaxCreate <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
        def book <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Book<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
        book.<span style="color: #660066;">properties</span> <span style="color: #339933;">=</span> params
&nbsp;
        <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>someError<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            params.<span style="color: #660066;">errorMessage</span> <span style="color: #339933;">=</span> g.<span style="color: #660066;">message</span><span style="color: #009900;">&#40;</span>code<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;default.not.found&quot;</span><span style="color: #339933;">,</span> args<span style="color: #339933;">:</span><span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'Book'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
            render<span style="color: #009900;">&#40;</span>contentType<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;text/json&quot;</span><span style="color: #339933;">,</span> <span style="color: #000066;">status</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">403</span><span style="color: #339933;">,</span> template<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;/shared/messages&quot;</span><span style="color: #009900;">&#41;</span>
            <span style="color: #000066; font-weight: bold;">return</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #006600; font-style: italic;">// Success.</span>
        def model <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'book'</span><span style="color: #339933;">:</span> book<span style="color: #009900;">&#93;</span>
        render<span style="color: #009900;">&#40;</span>contentType<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;text/json&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            updates <span style="color: #339933;">=</span> array <span style="color: #009900;">&#123;</span>
                element<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span> mode<span style="color: #339933;">:</span> <span style="color: #3366CC;">'replace'</span><span style="color: #339933;">,</span> target<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;#myDiv&quot;</span><span style="color: #339933;">,</span> content<span style="color: #339933;">:</span> g.<span style="color: #660066;">render</span><span style="color: #009900;">&#40;</span>template<span style="color: #339933;">:</span> <span style="color: #3366CC;">'create'</span><span style="color: #339933;">,</span> model<span style="color: #339933;">:</span>model<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
                element<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span> mode<span style="color: #339933;">:</span> <span style="color: #3366CC;">'append'</span><span style="color: #339933;">,</span> target<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;#anotherDiv&quot;</span><span style="color: #339933;">,</span> content<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Done&quot;</span> <span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
                element<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span> mode<span style="color: #339933;">:</span> <span style="color: #3366CC;">'execute'</span><span style="color: #339933;">,</span> script<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;initFunction();&quot;</span> <span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Javascript:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">    <span style="color: #006600; font-style: italic;">// On success load target.</span>
    <span style="color: #003366; font-weight: bold;">function</span> success<span style="color: #009900;">&#40;</span>data<span style="color: #339933;">,</span> textStatus<span style="color: #339933;">,</span> jqXHR<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        applyElementUpdates<span style="color: #009900;">&#40;</span>data<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #006600; font-style: italic;">// init()...</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// On error show controller responseText or show default error.</span>
    <span style="color: #003366; font-weight: bold;">function</span> error<span style="color: #009900;">&#40;</span>jqXHR<span style="color: #339933;">,</span> textStatus<span style="color: #339933;">,</span> errorThrown<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>jqXHR.<span style="color: #000066;">status</span> <span style="color: #339933;">==</span> <span style="color: #CC0000;">403</span> <span style="color: #339933;">&amp;&amp;</span> jqXHR.<span style="color: #660066;">responseText</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            target.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span>jqXHR.<span style="color: #660066;">responseText</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
            target.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span>errorIndication<span style="color: #009900;">&#40;</span>jqXHR<span style="color: #339933;">,</span> textStatus<span style="color: #339933;">,</span> errorThrown<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">show</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    jQuery.<span style="color: #660066;">ajax</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
        url<span style="color: #339933;">:</span> actionUrl<span style="color: #339933;">,</span>
        data<span style="color: #339933;">:</span> params<span style="color: #339933;">,</span>
        type<span style="color: #339933;">:</span> <span style="color: #3366CC;">'POST'</span><span style="color: #339933;">,</span>
        dataType<span style="color: #339933;">:</span> <span style="color: #3366CC;">'json'</span><span style="color: #339933;">,</span> <span style="color: #006600; font-style: italic;">// Strict JSON parsing to javascript object.</span>
        success<span style="color: #339933;">:</span> success<span style="color: #339933;">,</span>
        error<span style="color: #339933;">:</span> error
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p><strong>Error Handling</strong><br />
So far as I can tell best practices are still developing in this area.<br />
For example I have seen some recommendations that action errors and http errors should be separated. I could see the javascript updater interface extended to handle action errors (json.updates and json.errors) but for now the http error codes 403 and 503 allow clean branching in the success and error javascript.</p>
<p><strong>Security</strong><br />
Firstly I&#8217;m still in the early stages of Ajax usage so this ain&#8217;t gospel just a pattern under development.<br />
I would be especially interested in constructive comments about ensuring and improving security. But please no eval is evil comments (see link) all technology can be used for both good and bad.</p>
<p>More on eval usage:<br />
<a href="http://javascriptweblog.wordpress.com/2010/04/19/how-evil-is-eval/">http://javascriptweblog.wordpress.com/2010/04/19/how-evil-is-eval/</a><br />
More ajax patterns:<br />
<a href="http://ajaxpatterns.org/">http://ajaxpatterns.org/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.kromhouts.net/blog/grails/updating-multiple-page-elements-with-grails-and-ajax/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

