<?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>Misterdom's World &#187; Linux</title>
	<atom:link href="http://www.guinard.org/~misterdom/category/loogbook/linux-loogbook/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.guinard.org/~misterdom</link>
	<description>My Computing Logbook</description>
	<lastBuildDate>Sat, 24 Dec 2011 09:31:38 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Squeeze Box Server not Starting on Synology</title>
		<link>http://www.guinard.org/~misterdom/2011/12/24/squeeze-box-server-not-starting-on-synology/</link>
		<comments>http://www.guinard.org/~misterdom/2011/12/24/squeeze-box-server-not-starting-on-synology/#comments</comments>
		<pubDate>Sat, 24 Dec 2011 09:31:38 +0000</pubDate>
		<dc:creator>misterdom</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.guinard.org/~misterdom/?p=196</guid>
		<description><![CDATA[Strangely enough, my squeeze box server which was running like a charm on my Synology DS210j decided not to start this morning.
I first tried to run it from the service control panel again but that didn&#8217;t help either, although I got a message from the panel saying it was running, it in fact wasn&#8217;t.
Next, I [...]]]></description>
			<content:encoded><![CDATA[<p>Strangely enough, my squeeze box server which was running like a charm on my Synology DS210j decided not to start this morning.</p>
<p>I first tried to run it from the service control panel again but that didn&#8217;t help either, although I got a message from the panel saying it was running, it in fact wasn&#8217;t.</p>
<p>Next, I tried to run it manually from an SSH shell:<br />
<code><br />
 /usr/bin/perl -w /volume1/@appstore/SqueezeCenter/slimserver.pl --daemon --user admin --pidfile /volume1/@appstore/SqueezeCenter</code></p>
<p>and found out that it was simply blocking because it could not write to the log file:</p>
<p><code><br />
Can't open /volume1/@appstore/SqueezeCenter/Logs/server.log (Permission denied) at /volume1/@appstore/SqueezeCenter/CPAN/Log/Log4perl/Appender/File.pm line 103.</code></p>
<p>Looking at the <code>server.log</code> file it somehow belonged to root while the slimserver was started with admin. Changing the owner of the <code>server.log</code> file worked fine and solved the bug.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guinard.org/~misterdom/2011/12/24/squeeze-box-server-not-starting-on-synology/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Convert an MP3 to an Ogg on Linux</title>
		<link>http://www.guinard.org/~misterdom/2011/08/19/convert-an-mp3-to-an-ogg-on-linux/</link>
		<comments>http://www.guinard.org/~misterdom/2011/08/19/convert-an-mp3-to-an-ogg-on-linux/#comments</comments>
		<pubDate>Fri, 19 Aug 2011 12:47:31 +0000</pubDate>
		<dc:creator>misterdom</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.guinard.org/~misterdom/?p=194</guid>
		<description><![CDATA[mpg321 input.mp3 -w - &#124; oggenc -o output.ogg -
Source post
]]></description>
			<content:encoded><![CDATA[<blockquote><p><code>mpg321 input.mp3 -w - | oggenc -o output.ogg -</code></p></blockquote>
<p><a href="http://www.perturb.org/display/entry/687/">Source post</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.guinard.org/~misterdom/2011/08/19/convert-an-mp3-to-an-ogg-on-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Take a Timed Screenshot with Linux</title>
		<link>http://www.guinard.org/~misterdom/2011/06/30/timed-screenshot-with-linux/</link>
		<comments>http://www.guinard.org/~misterdom/2011/06/30/timed-screenshot-with-linux/#comments</comments>
		<pubDate>Thu, 30 Jun 2011 15:41:50 +0000</pubDate>
		<dc:creator>misterdom</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[screenshot]]></category>

		<guid isPermaLink="false">http://www.guinard.org/~misterdom/?p=190</guid>
		<description><![CDATA[sleep 3s; import -window root screenshot.png
Source: http://www.linux-noob.com/forums/index.php?/topic/339-how-to-take-a-screenshot-in-linux/
]]></description>
			<content:encoded><![CDATA[<blockquote><p><code>sleep 3s; import -window root screenshot.png</code></p></blockquote>
<p>Source: <a href="http://www.linux-noob.com/forums/index.php?/topic/339-how-to-take-a-screenshot-in-linux/">http://www.linux-noob.com/forums/index.php?/topic/339-how-to-take-a-screenshot-in-linux/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.guinard.org/~misterdom/2011/06/30/timed-screenshot-with-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Embedding Databases in a WAR File</title>
		<link>http://www.guinard.org/~misterdom/2010/10/22/embedding-db-war-file/</link>
		<comments>http://www.guinard.org/~misterdom/2010/10/22/embedding-db-war-file/#comments</comments>
		<pubDate>Thu, 21 Oct 2010 22:38:58 +0000</pubDate>
		<dc:creator>misterdom</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[derby]]></category>
		<category><![CDATA[glassfish]]></category>
		<category><![CDATA[sqlite]]></category>
		<category><![CDATA[tomcat]]></category>

		<guid isPermaLink="false">http://www.guinard.org/~misterdom/?p=180</guid>
		<description><![CDATA[Lately I needed a Java Web Application to have its own small database. I know the common/good practice is to have Web apps connect to a DB through a database pool but this requires some user configuration (at least copying the DB driver to the lib folder of the app server) when deploying the app. [...]]]></description>
			<content:encoded><![CDATA[<p>Lately I needed a Java Web Application to have its own small database. I know the common/good practice is to have Web apps connect to a DB through a database pool but this requires some user configuration (at least copying the DB driver to the lib folder of the app server) when deploying the app. Since the Web app was supposed to be deploy-and-play this was not an option.</p>
<p>Thus, we decided to embed a SQLite database in the app. This worked fine as long as I was locally testing the application. However, when deploying to a production Tomcat instance I started getting these exceptions:</p>
<blockquote><p>
<code>java.sql.SQLException: opening db: 'restfulepcis.db': Permission denied<br />
	at org.sqlite.Conn. init(Conn.java:117)<br />
	at org.sqlite.Conn. init(Conn.java:49)<br />
	at org.sqlite.JDBC.connect(JDBC.java:86)</code>
</p></blockquote>
<p>The reason is pretty clear, on the production server I did not have permission to write to the Tomcat working directory.</p>
<p>I was left with two solutions:<br />
1) have the directory where the database has to be created as a config parameter<br />
2) find a directory that&#8217;s universally accessible from an app in an app server.<br />
Since 1) involved user-configuration it was not an option.</p>
<p>There is actually a folder to which any Web app can write, the folder where the app is deployed (or at least my knowledge). The location of this folder can be found by calling:</p>
<blockquote><p><code><br />
ServletContext context = servletContext.getRealPath("/")<br />
</code>
</p></blockquote>
<p>from a servlet. Since my app is a JAX-RS (RESTful) application I can obtain it by CDI (Contexts and Dependency Injection):</p>
<blockquote><p><code>    @Context<br />
    ServletContext servletContext;</p>
<p>    /**<br />
     * Returns a representation of the EPCIS REST Adapter home resource according to the requested mime type<br />
     *<br />
     * @param context<br />
     * @return an instance of javax.ws.rs.core.Resource<br />
     */<br />
    @GET<br />
    public Resource getRESTfulEPCIS(@Context UriInfo context) {<br />
        System.setProperty("sqlite.system.home", servletContext.getRealPath("/"));<br />
        RESTfulEPCISBusinessLogic logic = new RESTfulEPCISBusinessLogic();<br />
        return logic.getRESTfulEPCIS(context);<br />
    }<br />
</code></p></blockquote>
<p>I then load the sqlite.system.home from my database manager class (which is not a Servlet) and use it as path in my database connection URI:</p>
<blockquote><p>
<code><br />
...<br />
     String sqliteHome = System.getProperty("sqlite.system.home");<br />
...<br />
    private Connection getConnection() {<br />
        Connection connection = null;<br />
        try {<br />
            Class.forName(DRIVER);<br />
            connection = DriverManager.getConnection("jdbc:sqlite:" + sqliteHome + DB_NAME + ".db");<br />
...<br />
</code>
</p></blockquote>
<p>Note that for Apache Derby, you can make it even easier by simply setting the <code>derby.system.home</code> in the servlet class. Then, you do not need to read it manually from your database manager class as it is read automatically when loading the driver:</p>
<blockquote><p><code> System.setProperty("derby.system.home", servletContext.getRealPath("/"));</code></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.guinard.org/~misterdom/2010/10/22/embedding-db-war-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Switching Java Versions in Ubuntu</title>
		<link>http://www.guinard.org/~misterdom/2010/09/08/switching-java-versions-in-ubuntu/</link>
		<comments>http://www.guinard.org/~misterdom/2010/09/08/switching-java-versions-in-ubuntu/#comments</comments>
		<pubDate>Wed, 08 Sep 2010 14:00:13 +0000</pubDate>
		<dc:creator>misterdom</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.guinard.org/~misterdom/?p=171</guid>
		<description><![CDATA[Use this command to switch between the versions of Java (e.g. Sun, Oracle, Openjdk, etc.)
sudo update-alternatives --config java
]]></description>
			<content:encoded><![CDATA[<p>Use this command to switch between the versions of Java (e.g. Sun, Oracle, Openjdk, etc.)</p>
<blockquote><p><code>sudo update-alternatives --config java</code></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.guinard.org/~misterdom/2010/09/08/switching-java-versions-in-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Manually Add a Jar to a Maven Repository</title>
		<link>http://www.guinard.org/~misterdom/2010/06/21/manually-add-a-jar-to-a-maven-repository/</link>
		<comments>http://www.guinard.org/~misterdom/2010/06/21/manually-add-a-jar-to-a-maven-repository/#comments</comments>
		<pubDate>Mon, 21 Jun 2010 16:42:15 +0000</pubDate>
		<dc:creator>misterdom</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[jar]]></category>
		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://www.guinard.org/~misterdom/?p=148</guid>
		<description><![CDATA[Use this command to manually add a Jar to a Maven Repository
mvn install:install-file -DgroupId=javax.comm -DartifactId=comm -Dversion=3.0 -Dpackaging=jar -Dfile=/home/misterdom/Documents/3_Software_Projects/WebPlogg/commapi/comm.jar
]]></description>
			<content:encoded><![CDATA[<p>Use this command to manually add a Jar to a Maven Repository<br />
<code>mvn install:install-file -DgroupId=javax.comm -DartifactId=comm -Dversion=3.0 -Dpackaging=jar -Dfile=/home/misterdom/Documents/3_Software_Projects/WebPlogg/commapi/comm.jar</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.guinard.org/~misterdom/2010/06/21/manually-add-a-jar-to-a-maven-repository/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Removing a Service from Init.d in Linux</title>
		<link>http://www.guinard.org/~misterdom/2010/05/29/removing-a-service-from-init-d-in-linux/</link>
		<comments>http://www.guinard.org/~misterdom/2010/05/29/removing-a-service-from-init-d-in-linux/#comments</comments>
		<pubDate>Sat, 29 May 2010 12:53:31 +0000</pubDate>
		<dc:creator>misterdom</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.guinard.org/~misterdom/?p=140</guid>
		<description><![CDATA[Use this command:
sudo update-rc.d -f SERVICE_NAME remove
where SERVICE_NAME is the name of the service to remove, e.g. vsftpd.
More info on the topic: http://www.unixtutorial.org/2009/01/disable-service-startup-in-ubuntu/
]]></description>
			<content:encoded><![CDATA[<p>Use this command:</p>
<blockquote><p><code>sudo update-rc.d -f SERVICE_NAME remove</code></p></blockquote>
<p>where <code>SERVICE_NAME</code> is the name of the service to remove, e.g. vsftpd.</p>
<p>More info on the topic: <a href="http://www.unixtutorial.org/2009/01/disable-service-startup-in-ubuntu/">http://www.unixtutorial.org/2009/01/disable-service-startup-in-ubuntu/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.guinard.org/~misterdom/2010/05/29/removing-a-service-from-init-d-in-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Changing the Default Java Vendor (or Version) in Ubuntu</title>
		<link>http://www.guinard.org/~misterdom/2010/04/20/changing-the-default-java-vendor-or-version-in-ubuntu/</link>
		<comments>http://www.guinard.org/~misterdom/2010/04/20/changing-the-default-java-vendor-or-version-in-ubuntu/#comments</comments>
		<pubDate>Tue, 20 Apr 2010 08:34:13 +0000</pubDate>
		<dc:creator>misterdom</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.guinard.org/~misterdom/?p=135</guid>
		<description><![CDATA[Run sudo update-java-alternatives -l to see the current configuration and possibilities.
Run sudo update-java-alternatives -s XXXX to set the XXX java version as default.
For Sun Java 6 this would be sudo update-java-alternatives -s java-6-sun
Run java -version to ensure that the correct version is being called. 
Source: https://help.ubuntu.com/community/Java
]]></description>
			<content:encoded><![CDATA[<p><code>Run sudo update-java-alternatives -l to see the current configuration and possibilities.</code></p>
<p><code>Run sudo update-java-alternatives -s XXXX to set the XXX java version as default.<br />
For Sun Java 6 this would be sudo update-java-alternatives -s java-6-sun</code></p>
<p>Run <code>java -version</code> to ensure that the correct version is being called. </p>
<p>Source: <a href="https://help.ubuntu.com/community/Java">https://help.ubuntu.com/community/Java</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.guinard.org/~misterdom/2010/04/20/changing-the-default-java-vendor-or-version-in-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Delete all the SVN Folders in a Directory</title>
		<link>http://www.guinard.org/~misterdom/2009/10/08/delete-all-the-svn-folders/</link>
		<comments>http://www.guinard.org/~misterdom/2009/10/08/delete-all-the-svn-folders/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 16:38:06 +0000</pubDate>
		<dc:creator>misterdom</dc:creator>
				<category><![CDATA[Dev Logbook]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[command]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://www.guinard.org/~misterdom/?p=116</guid>
		<description><![CDATA[find . -name ".svn" -exec rm -rf {} \;
]]></description>
			<content:encoded><![CDATA[<blockquote><p><code>find . -name ".svn" -exec rm -rf {} \;</code></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.guinard.org/~misterdom/2009/10/08/delete-all-the-svn-folders/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Howto SVN Clean your Folders</title>
		<link>http://www.guinard.org/~misterdom/2009/08/12/howto-svn-clean-your-folders/</link>
		<comments>http://www.guinard.org/~misterdom/2009/08/12/howto-svn-clean-your-folders/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 09:32:27 +0000</pubDate>
		<dc:creator>misterdom</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[command]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://www.guinard.org/~misterdom/2009/08/12/howto-svn-clean-your-folders/</guid>
		<description><![CDATA[This command is useful when you want to clean a directory tree from all the .svn folders it might contain:
find . -name ".svn" -exec rm -rf {} \;
Basically it &#8220;finds&#8221; all the .svn folders and excutes rm -rf on each of these.
]]></description>
			<content:encoded><![CDATA[<p>This command is useful when you want to clean a directory tree from all the .svn folders it might contain:</p>
<blockquote><p><code>find . -name ".svn" -exec rm -rf {} \;</code></p></blockquote>
<p>Basically it &#8220;finds&#8221; all the .svn folders and excutes rm -rf on each of these.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guinard.org/~misterdom/2009/08/12/howto-svn-clean-your-folders/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

