<?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>LogikDevelopment</title>
	<atom:link href="http://www.logikdev.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.logikdev.com</link>
	<description>&#34;Il n&#039;y a pas de problème, il n&#039;y a que des solutions. L&#039;esprit de l&#039;homme invente ensuite le problème.&#34; André Gide</description>
	<lastBuildDate>Sun, 06 May 2012 12:29:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Redirect traffic to a specific network</title>
		<link>http://www.logikdev.com/2012/05/06/redirect-traffic-to-a-specific-network/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=redirect-traffic-to-a-specific-network</link>
		<comments>http://www.logikdev.com/2012/05/06/redirect-traffic-to-a-specific-network/#comments</comments>
		<pubDate>Sun, 06 May 2012 12:29:22 +0000</pubDate>
		<dc:creator>smoreau</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tricks]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[route]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://www.logikdev.com/?p=1707</guid>
		<description><![CDATA[This is a little trick which can be useful in some very specific case. For example, you could have a machine with two network cards. One of the network is behind a proxy and the other one is connected directly to the internet. You might want to forward all the traffic for google.com to the [...]]]></description>
			<content:encoded><![CDATA[<p>This is a little trick which can be useful in some very specific case.</p>
<p>For example, you could have a machine with two network cards. One of the network is behind a proxy and the other one is connected directly to the internet.<br />
You might want to forward all the traffic for google.com to the network which doesn&#8217;t have a proxy.</p>
<p>To do this, I am using the command <a href="http://linux.die.net/man/8/route" target="_blank"><strong>route</strong></a>:</p>
<pre class="brush: bash; light: true; title: ; notranslate">
route add &lt;hostname&gt; &lt;target network&gt;
</pre>
<p>For example:</p>
<pre class="brush: bash; light: true; title: ; notranslate">
route add google.com 192.168.101.1
</pre>
<p>Note that this command is available on both Linux and Mac.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.logikdev.com/2012/05/06/redirect-traffic-to-a-specific-network/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install a JDBC driver in SpagoBI</title>
		<link>http://www.logikdev.com/2012/04/21/install-a-jdbc-driver-in-spagobi/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=install-a-jdbc-driver-in-spagobi</link>
		<comments>http://www.logikdev.com/2012/04/21/install-a-jdbc-driver-in-spagobi/#comments</comments>
		<pubDate>Sat, 21 Apr 2012 22:16:07 +0000</pubDate>
		<dc:creator>smoreau</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[BI]]></category>
		<category><![CDATA[BIRT]]></category>
		<category><![CDATA[Business Intelligence]]></category>
		<category><![CDATA[JDBC driver]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[SpagoBI]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.logikdev.com/?p=1646</guid>
		<description><![CDATA[For those who don&#8217;t know what is SpagoBI, please read the following (copied from Wikipedia): SpagoBI is the only entirely Open Source Business Intelligence suite, belonging to the free/open source SpagoWorld initiative, founded and supported by Engineering Group. SpagoBI supports day-to-day and strategic business, both at the decision-making and operational levels. SpagoBI is a BI [...]]]></description>
			<content:encoded><![CDATA[<p>For those who don&#8217;t know what is SpagoBI, please read the following (copied from <a href="http://en.wikipedia.org/wiki/SpagoBI" target="_blank">Wikipedia</a>):</p>
<blockquote><p><a href="http://www.spagobi.org/" title="SpagoBI Suite" target="_blank"><strong>SpagoBI</strong></a> is the only entirely Open Source Business Intelligence suite, belonging to the free/open source SpagoWorld initiative, founded and supported by Engineering Group.<br />
SpagoBI supports day-to-day and strategic business, both at the decision-making and operational levels. SpagoBI is a BI suite because it covers the whole range of analytical needs, supporting developers, testers and administrators in their daily activities.</p></blockquote>
<p>SpagoBI is not very difficult to install but it is a bit more complicated to configure.<br />
One of the problem I had was the following one:</p>
<pre>
GRAVE: Cannot open connection.
org.eclipse.birt.report.data.oda.jdbc.JDBCException:
Cannot load JDBC Driver class: com.microsoft.sqlserver.jdbc.SQLServerDriver
</pre>
<p><br/>This exception is quite clear, it means that SpagoBI cannot load the JDBC driver for SQL Server. Indeed, I was connecting to a SQL Server database from one of my BIRT report.</p>
<p>What you have to do to fix this problem is:</p>
<ol>
<li>Download the driver JAR file from the Microsoft website: <a href="http://www.microsoft.com/download/en/details.aspx?id=2505" target="_blank">http://www.microsoft.com/download/en/details.aspx?id=2505</a></li>
<li>Copy the JAR file into the following folder under the SpagoBI installation folder:<br />
<code>webapps/SpagoBIBirtReportEngine/WEB-INF/platform/plugins/org.eclipse.birt.report.data.oda.jdbc_2.6.1.v20100909/drivers</code><br />
Note that the path might differ a little bit depending on the version of SpagoBI.
</li>
<li>Restart SpagoBI</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.logikdev.com/2012/04/21/install-a-jdbc-driver-in-spagobi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Check if field is displayed with JavaScript</title>
		<link>http://www.logikdev.com/2012/04/10/check-if-field-is-displayed-with-javascript/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=check-if-field-is-displayed-with-javascript</link>
		<comments>http://www.logikdev.com/2012/04/10/check-if-field-is-displayed-with-javascript/#comments</comments>
		<pubDate>Mon, 09 Apr 2012 23:40:58 +0000</pubDate>
		<dc:creator>smoreau</dc:creator>
				<category><![CDATA[Html]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[offsetTop]]></category>

		<guid isPermaLink="false">http://www.logikdev.com/?p=1649</guid>
		<description><![CDATA[When you have dynamic content on your webpage, it is sometimes useful to check if an HTML element is displayed on the screen. For example, it could be handy to move the focus on a specific field after validation. But what if this field is actually hidden? Does your browser like to move the focus [...]]]></description>
			<content:encoded><![CDATA[<p>When you have dynamic content on your webpage, it is sometimes useful to check if an HTML element is displayed on the screen.<br />
For example, it could be handy to move the focus on a specific field after validation. But what if this field is actually hidden? Does your browser like to move the focus on an hidden field? Well, I can tell you that IE doesn&#8217;t like it very much! <img src='http://www.logikdev.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>There are a lot of solutions on the web to check if a field is displayed or not. However, the solution I propose is probably the simplest:</p>
<pre class="brush: jscript; title: ; notranslate">
function isDisplay(obj) {
    return obj.offsetTop &gt; 0;
}
</pre>
<p>Note that this code has been tested on Google Chrome 18.0, Firefox 3.6, Safari 5.1.5 and IE 7.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.logikdev.com/2012/04/10/check-if-field-is-displayed-with-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install s3fs on Amazon Clouds</title>
		<link>http://www.logikdev.com/2012/04/03/install-s3fs-on-amazon-clouds/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=install-s3fs-on-amazon-clouds</link>
		<comments>http://www.logikdev.com/2012/04/03/install-s3fs-on-amazon-clouds/#comments</comments>
		<pubDate>Tue, 03 Apr 2012 21:38:02 +0000</pubDate>
		<dc:creator>smoreau</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Amazon S3]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[FUSE filesystem]]></category>
		<category><![CDATA[hard links]]></category>
		<category><![CDATA[libfuse]]></category>
		<category><![CDATA[libxml]]></category>
		<category><![CDATA[mount]]></category>
		<category><![CDATA[rsync]]></category>
		<category><![CDATA[s3fs]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://www.logikdev.com/?p=1710</guid>
		<description><![CDATA[s3fs is a FUSE filesystem that allows you to mount an Amazon S3 bucket as a local filesystem. It stores files natively and transparently in S3 (i.e., you can use other programs to access the same files). The following instructions detail the steps to install the program s3fs on an Amazon&#160;EC2 running Debian&#160;5.0.5. Install libfuse [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>
s3fs is a FUSE filesystem that allows you to mount an Amazon S3 bucket as a local filesystem. It stores files natively and transparently in S3 (i.e., you can use other programs to access the same files).
</p></blockquote>
<p>The following instructions detail the steps to install the program <a href="http://code.google.com/p/s3fs/" target="_blank"><strong>s3fs</strong></a> on an Amazon&nbsp;EC2 running Debian&nbsp;5.0.5.</p>
<ol>
<li><strong>Install libfuse</strong><br />
First, you need to install the package libfuse manually as the one provided via apt-get is too old (s3fs needs a version greater than or equal to 2.8.4).</p>
<pre class="brush: bash; light: true; title: ; notranslate">
wget http://downloads.sourceforge.net/project/fuse/fuse-2.X/2.8.7/fuse-2.8.7.tar.gz
tar xzf fuse-2.8.7.tar.gz
cd fuse-2.8.7
./configure --prefix=/usr
make install
</pre>
</li>
<li><strong>Install libxml</strong><br />
You can simply install the package provided by apt-get:</p>
<pre class="brush: bash; light: true; title: ; notranslate">
apt-get install libxml2-dev
</pre>
</li>
<li><strong>Upgrade mount</strong><br />
Because of a problem between fuse and mount, you need to upgrade the version of mount:</p>
<pre class="brush: bash; light: true; title: ; notranslate">
wget http://www.kernel.org/pub/linux/utils/util-linux/v2.21/util-linux-2.21-rc1.tar.gz
tar xzf util-linux-2.21-rc1.tar.gz
./configure --prefix=/usr --without-ncurses
make install
</pre>
<p>For more information about this issue, please go to the following page: <a href="http://code.google.com/p/s3fs/issues/detail?id=228" target="_blank" title="Issue 228:	/bin/mount: unrecognized option '--no-canonicalize'">http://code.google.com/p/s3fs/issues/detail?id=228</a>
</li>
<li><strong>Install s3fs</strong><br />
You can now install s3fs using the following commands:</p>
<pre class="brush: bash; light: true; title: ; notranslate">
wget http://s3fs.googlecode.com/files/s3fs-1.61.tar.gz
tar xvzf s3fs-1.61.tar.gz
cd s3fs-1.61/
./configure --prefix=/usr
make install
</pre>
</li>
</ol>
<p><br/>Note that I wanted to use s3fs to create incremental snapshot-style backups with rsync. Unfortunately, as mentioned on the following page, it didn&#8217;t work because s3fs doesn&#8217;t support <a href="http://en.wikipedia.org/wiki/Hard_link" target="_blank">hard links</a>: <a href="http://code.google.com/p/s3fs/issues/detail?id=46" target="_blank" title="Issue 46:	Does s3fs support hard links?">http://code.google.com/p/s3fs/issues/detail?id=46</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.logikdev.com/2012/04/03/install-s3fs-on-amazon-clouds/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Changes in Twitter4J 2.2.5</title>
		<link>http://www.logikdev.com/2012/02/27/changes-in-twitter4j-2-2-5/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=changes-in-twitter4j-2-2-5</link>
		<comments>http://www.logikdev.com/2012/02/27/changes-in-twitter4j-2-2-5/#comments</comments>
		<pubDate>Mon, 27 Feb 2012 21:42:39 +0000</pubDate>
		<dc:creator>smoreau</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[OAuth]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[Twitter4J]]></category>

		<guid isPermaLink="false">http://www.logikdev.com/?p=1721</guid>
		<description><![CDATA[Over a year ago, I wrote an article on how to update Twitter status using Twitter4J: Update your Twitter status with Java Note that I was using the version 2.1.7 of Twitter4J at that time. Following a few comments from users who were getting errors, I decided to get my code working on the latest [...]]]></description>
			<content:encoded><![CDATA[<p>Over a year ago, I wrote an article on how to update Twitter status using <a href="http://twitter4j.org/en/index.html" target="_blank">Twitter4J</a>:<br />
<a href="http://www.logikdev.com/2010/12/02/update-your-twitter-status-with-java/" title="Update your Twitter status with Java">Update your Twitter status with Java</a><br />
Note that I was using the version 2.1.7 of Twitter4J at that time.</p>
<p>Following a few comments from users who were getting errors, I decided to get my code working on the latest version of Twitter4J, the version <strong>2.2.5</strong>. <img src='http://www.logikdev.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>This is the two differences I found:</p>
<ol>
<li>The package <code>twitter4j.http</code> has been renamed <code>twitter4j.auth</code>;</li>
<li>The constructor of the object <code>twitter4j.auth.OAuthAuthorization</code> has changed and now only take an object of type <code>twitter4j.conf.Configuration</code>.</li>
</ol>
<p>Considering this, please find below the updated code to get the access token:</p>
<pre class="brush: java; title: ; notranslate">
import java.io.BufferedReader;
import java.io.InputStreamReader;

import twitter4j.Twitter;
import twitter4j.TwitterException;
import twitter4j.TwitterFactory;
import twitter4j.auth.AccessToken;
import twitter4j.auth.RequestToken;

public class TwitterAccessToken {
	private static final String CONSUMER_KEY = &quot;[your consumer key]&quot;;
	private static final String CONSUMER_SECRET = &quot;[you consumer secret]&quot;;

	public static void main(String[] args) throws Exception {
 		Twitter twitter = new TwitterFactory().getInstance();
		twitter.setOAuthConsumer(CONSUMER_KEY, CONSUMER_SECRET);
		RequestToken requestToken = twitter.getOAuthRequestToken();
		AccessToken accessToken = null;
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		while (null == accessToken) {
			System.out.println(&quot;Open the following URL and grant access to your account:&quot;);
			System.out.println(requestToken.getAuthorizationURL());
			System.out.print(&quot;Enter the PIN (if available) or just hit enter.[PIN]:&quot;);
			String pin = br.readLine();
 			try {
				if (pin.length() &gt; 0) {
					accessToken = twitter.getOAuthAccessToken(requestToken, pin);
				} else {
					accessToken = twitter.getOAuthAccessToken();
				}
			} catch (TwitterException e) {
				if (401 == e.getStatusCode()) {
					System.err.println(&quot;Unable to get the access token.&quot;);
				} else {
					e.printStackTrace();
				}
			}
		}

		System.out.println(&quot;Access Token: &quot; + accessToken.getToken());
		System.out.println(&quot;Access Token Secret: &quot; + accessToken.getTokenSecret());
	}
}
</pre>
<p>And here is the amended code which allows to update your Twitter status:</p>
<pre class="brush: java; title: ; notranslate">
import twitter4j.Twitter;
import twitter4j.TwitterException;
import twitter4j.TwitterFactory;
import twitter4j.auth.OAuthAuthorization;
import twitter4j.conf.ConfigurationBuilder;

public class TwitterTest {
	private static final String ACCESS_TOKEN = &quot;[your access token]&quot;;
	private static final String ACCESS_TOKEN_SECRET = &quot;[your access token secret]&quot;;
	private static final String CONSUMER_KEY = &quot;[your consumer key]&quot;;
	private static final String CONSUMER_SECRET = &quot;[you consumer secret]&quot;;

    public static void main(String[] args) {
    	ConfigurationBuilder builder = new ConfigurationBuilder();
    	builder.setOAuthAccessToken(ACCESS_TOKEN);
    	builder.setOAuthAccessTokenSecret(ACCESS_TOKEN_SECRET);
    	builder.setOAuthConsumerKey(CONSUMER_KEY);
    	builder.setOAuthConsumerSecret(CONSUMER_SECRET);
        OAuthAuthorization auth = new OAuthAuthorization(builder.build());
        Twitter twitter = new TwitterFactory().getInstance(auth);
		try {
			twitter.updateStatus(&quot;Hello World!&quot;);
		} catch (TwitterException e) {
			System.err.println(&quot;Error occurred while updating the status!&quot;);
			return;
		}
        System.out.println(&quot;Successfully updated the status.&quot;);
    }
}
</pre>
<p>See you maybe next year for an update on using the version 2.3 of Twitter4j. <img src='http://www.logikdev.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.logikdev.com/2012/02/27/changes-in-twitter4j-2-2-5/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Too many open files on Tomcat</title>
		<link>http://www.logikdev.com/2011/12/20/too-many-open-files-on-tomcat/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=too-many-open-files-on-tomcat</link>
		<comments>http://www.logikdev.com/2011/12/20/too-many-open-files-on-tomcat/#comments</comments>
		<pubDate>Tue, 20 Dec 2011 00:24:25 +0000</pubDate>
		<dc:creator>smoreau</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[java.net.SocketException]]></category>
		<category><![CDATA[lsof]]></category>
		<category><![CDATA[open file descriptors]]></category>
		<category><![CDATA[Tomcat]]></category>
		<category><![CDATA[Too many open files]]></category>
		<category><![CDATA[ulimit]]></category>

		<guid isPermaLink="false">http://www.logikdev.com/?p=1678</guid>
		<description><![CDATA[The other day, one of my websites was not available anymore. Looking at the log files, I found the following exception: Dec 7, 2011 1:22:39 AM org.apache.jk.common.ChannelSocket acceptConnections WARNING: Exception executing accept java.net.SocketException: Too many open files at java.net.PlainSocketImpl.socketAccept(Native Method) at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384) at java.net.ServerSocket.implAccept(ServerSocket.java:450) at java.net.ServerSocket.accept(ServerSocket.java:421) at org.apache.jk.common.ChannelSocket.accept(ChannelSocket.java:307) at org.apache.jk.common.ChannelSocket.acceptConnections(ChannelSocket.java:661) at org.apache.jk.common.ChannelSocket$SocketAcceptor.runIt(ChannelSocket.java:872) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690) at [...]]]></description>
			<content:encoded><![CDATA[<p>The other day, one of my websites was not available anymore. Looking at the log files, I found the following exception:</p>
<pre>
Dec 7, 2011 1:22:39 AM org.apache.jk.common.ChannelSocket acceptConnections
WARNING: Exception executing accept
java.net.SocketException: Too many open files
	at java.net.PlainSocketImpl.socketAccept(Native Method)
	at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384)
	at java.net.ServerSocket.implAccept(ServerSocket.java:450)
	at java.net.ServerSocket.accept(ServerSocket.java:421)
	at org.apache.jk.common.ChannelSocket.accept(ChannelSocket.java:307)
	at org.apache.jk.common.ChannelSocket.acceptConnections(ChannelSocket.java:661)
	at org.apache.jk.common.ChannelSocket$SocketAcceptor.runIt(ChannelSocket.java:872)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
	at java.lang.Thread.run(Thread.java:595)
</pre>
<p><br/>This was the first time I was getting this exception. What is even stranger is that I didn&#8217;t change anything on this application for quite a while!<br />
Anyway, I first did what I usually do with Tomcat: restart it! This fixed the issue but only for a few hours before it crashed again.</p>
<p>After some investigation, it seems that Tomcat was reaching the limit of open file descriptors allowed in this machine (1024 in my case).<br />
To get the maximum number of open file descriptors, simply type the following command:</p>
<pre class="brush: bash; light: true; title: ; notranslate">
ulimit -n
</pre>
<p>It is possible to increase this value by editing the file <code>/etc/security/limits.conf</code> and adding the new limit for the user running Tomcat. However, this is not recommended as 1024 should be sufficient.</p>
<p>The second thing I did was to check the list of open files used by the Tomcat process:</p>
<pre class="brush: bash; light: true; title: ; notranslate">
lsof -p
</pre>
<p>What I found by running this command was a bit odd. It seems that Tomcat was having a multitude of opened connections to one of the web services used by the application. So it looks like the connections between my website and the web service were never closed!  <img src='http://www.logikdev.com/wp-includes/images/smilies/icon_neutral.gif' alt=':-|' class='wp-smiley' /><br />
Because I didn&#8217;t change the code on my side, I asked the third party who owns the web service to check their code. I don&#8217;t know what was the root cause of the problem but they fixed it on their side and it is now working fine.</p>
<p><strong>In conclusion, if you get the same exception, try to find where the problem is coming from before increasing the maximum number of open file descriptors.</strong> <img src='http://www.logikdev.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.logikdev.com/2011/12/20/too-many-open-files-on-tomcat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Samba access problem with Mac OS X 10.6+</title>
		<link>http://www.logikdev.com/2011/12/13/samba-access-problem-with-mac-os-x-10-6/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=samba-access-problem-with-mac-os-x-10-6</link>
		<comments>http://www.logikdev.com/2011/12/13/samba-access-problem-with-mac-os-x-10-6/#comments</comments>
		<pubDate>Tue, 13 Dec 2011 21:31:15 +0000</pubDate>
		<dc:creator>smoreau</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[D-Link]]></category>
		<category><![CDATA[DNS-313]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Samba]]></category>
		<category><![CDATA[security mode]]></category>

		<guid isPermaLink="false">http://www.logikdev.com/?p=1653</guid>
		<description><![CDATA[This is a problem I encountered when I upgraded Mac OS X from the version 10.5 (Leopard) to 10.6 (Snow Leopard). One of my friend also got a similar problem when she upgraded to the version 10.7 (Lion). This issue was affecting the access to the network shares set up with Samba (version 3.0.24) on [...]]]></description>
			<content:encoded><![CDATA[<p>This is a problem I encountered when I upgraded Mac OS X from the version 10.5 (Leopard) to 10.6 (Snow Leopard). One of my friend also got a similar problem when she upgraded to the version 10.7 (Lion).<br />
This issue was affecting the access to the network shares set up with <strong>Samba</strong> (version 3.0.24) on my D-Link DNS-323. For some reason, I wasn&#8217;t able to authenticate on the shares as soon as I upgraded to Snow Leopard!</p>
<p>Here is the error message I was getting:<br />
<a href="http://www.logikdev.com/wp-content/uploads/2011/12/samba-access-problem.png" rel="lightbox[1653]"><img src="http://www.logikdev.com/wp-content/uploads/2011/12/samba-access-problem-300x271.png" alt="" title="Samba authentication problem on Mac OS X" width="300" height="271" class="alignnone size-medium wp-image-1669" /></a></p>
<p>After browsing a few forums on the web, I finally found a solution. <img src='http://www.logikdev.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
I simply had to change the security mode in the Samba configuration file (<code>smb.conf</code>) to read:</p>
<pre class="brush: bash; light: true; title: ; notranslate">
security = USER
</pre>
<p>Note that this property can be found under the <code>[global]</code> section.</p>
<p>For more information about the Samba security mode, please read the following article by Jack Wallen:<br />
<a href="http://www.ghacks.net/2010/03/17/understanding-samba-security-modes/" title="Understanding Samba security modes" target="_blank">Understanding Samba security modes</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.logikdev.com/2011/12/13/samba-access-problem-with-mac-os-x-10-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>S3 command failed if the time is not synced</title>
		<link>http://www.logikdev.com/2011/12/06/s3-command-failed-if-time-not-synced/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=s3-command-failed-if-time-not-synced</link>
		<comments>http://www.logikdev.com/2011/12/06/s3-command-failed-if-time-not-synced/#comments</comments>
		<pubDate>Tue, 06 Dec 2011 23:11:43 +0000</pubDate>
		<dc:creator>smoreau</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Amazon S3]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[ntpdate]]></category>
		<category><![CDATA[s3sync]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[system date]]></category>

		<guid isPermaLink="false">http://www.logikdev.com/?p=1610</guid>
		<description><![CDATA[This is already the second post about the s3sync ruby program. The first article was focused on monitoring s3sync with Zabbix. I will talk on this one about an error I got when running the S3 synchronisation: S3 command failed: list_bucket prefix /data max-keys 200 delimiter / With result 403 Forbidden S3 ERROR: # s3sync.rb:290:in [...]]]></description>
			<content:encoded><![CDATA[<p>This is already the second post about the <a href="https://forums.aws.amazon.com/thread.jspa?threadID=11975&amp;start=0&amp;tstart=0" target="_blank"><strong>s3sync</strong></a> ruby program. The first article was focused on <a title="Monitor s3sync with Zabbix" href="http://www.logikdev.com/2011/11/24/monitor-s3sync-with-zabbix/">monitoring s3sync with Zabbix</a>.</p>
<p>I will talk on this one about an error I got when running the S3 synchronisation:</p>
<pre>
S3 command failed:
list_bucket prefix /data max-keys 200 delimiter /
With result 403 Forbidden
S3 ERROR: #
s3sync.rb:290:in `+': can't convert nil into Array (TypeError)
	from s3sync.rb:290:in `s3TreeRecurse'
	from s3sync.rb:346:in `main'
	from ./thread_generator.rb:79:in `call'
	from ./thread_generator.rb:79:in `initialize'
	from ./thread_generator.rb:76:in `new'
	from ./thread_generator.rb:76:in `initialize'
	from s3sync.rb:267:in `new'
	from s3sync.rb:267:in `main'
	from s3sync.rb:735
</pre>
<p>As you can see, this error is not very human-friendly! <img src='http://www.logikdev.com/wp-includes/images/smilies/icon_surprised.gif' alt=':-o' class='wp-smiley' />  The only thing we know is that the S3 command failed because of the error <code>can't convert nil into Array</code>. It looks to me like an internal error within s3sync&#8230;</p>
<p>But after some investigation, it appears it is simply because the system date on the server is not correct. I cannot tell you how much time I spent on this one!  <img src='http://www.logikdev.com/wp-includes/images/smilies/icon_eek.gif' alt='8-O' class='wp-smiley' /> </p>
<p>Anyway, if you are doing automatic backups as describe on <a href="http://blog.eberly.org/2006/10/09/how-automate-your-backup-to-amazon-s3-using-s3sync/" target="_blank">John Eberly&#8217;s blog</a>, you need to add the following code at the top of your <code>upload.sh</code> script:</p>
<pre class="brush: bash; title: ; notranslate">
# update the system date
/usr/sbin/ntpdate 3.uk.pool.ntp.org 2.uk.pool.ntp.org 1.uk.pool.ntp.org 0.uk.pool.ntp.org
</pre>
<p><br/><strong>NB:</strong> please find below the command lines I use to install <a href="http://www.eecis.udel.edu/~mills/ntp/html/ntpdate.html" target="_blank"><strong>ntpdate</strong></a> on a Debian server:</p>
<pre class="brush: bash; light: true; title: ; notranslate">
apt-get install ntpdate
dpkg-reconfigure tzdata
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.logikdev.com/2011/12/06/s3-command-failed-if-time-not-synced/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Monitor s3sync with Zabbix</title>
		<link>http://www.logikdev.com/2011/11/24/monitor-s3sync-with-zabbix/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=monitor-s3sync-with-zabbix</link>
		<comments>http://www.logikdev.com/2011/11/24/monitor-s3sync-with-zabbix/#comments</comments>
		<pubDate>Thu, 24 Nov 2011 22:28:53 +0000</pubDate>
		<dc:creator>smoreau</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Amazon S3]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[Monitoring]]></category>
		<category><![CDATA[s3sync]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[synchronisation]]></category>
		<category><![CDATA[Zabbix]]></category>

		<guid isPermaLink="false">http://www.logikdev.com/?p=1566</guid>
		<description><![CDATA[s3sync is a ruby program that easily transfers directories between a local directory and an S3 bucket:prefix. It behaves somewhat, but not precisely, like the rsync program. I am using this tool to automatically backup the important data from Debian servers to Amazon S3. I am not going to explain here how to install s3sync [...]]]></description>
			<content:encoded><![CDATA[<p><a href="https://forums.aws.amazon.com/thread.jspa?threadID=11975&#038;start=0&#038;tstart=0" target="_blank"><strong>s3sync</strong></a> is a ruby program that easily transfers directories between a local directory and an S3 bucket:prefix. It behaves somewhat, but not precisely, like the <strong>rsync</strong> program.</p>
<p>I am using this tool to automatically backup the important data from Debian servers to Amazon S3. I am not going to explain here how to install s3sync as it is not the purpose of this article. However, you can read this very useful article from John Eberly&#8217;s blog: <a href="http://blog.eberly.org/2006/10/09/how-automate-your-backup-to-amazon-s3-using-s3sync/" target="_blank">How I automated my backups to Amazon S3 using s3sync</a>.</p>
<p>If you followed the steps from John Eberly&#8217;s post, you should have an <code>upload.sh</code> script and a crontab job which executes this script periodically.</p>
<p>From this point, here is what you need to do to monitor the success of the synchronisation with <a href="http://www.zabbix.com/" target="_blank"><strong>Zabbix</strong></a>:</p>
<ol>
<li>Add the following code at the end of your <code>upload.sh</code> script:
<pre class="brush: bash; title: ; notranslate">
# print the exit code
RETVAL=$?
[ $RETVAL -eq 0 ] &amp;&amp; echo &quot;Synchronization succeed&quot;
[ $RETVAL -ne 0 ] &amp;&amp; echo &quot;Synchronization failed&quot;
</pre>
</li>
<li>Log the output of the cron script as follow:
<pre class="brush: bash; light: true; title: ; notranslate">
30 2 * * sun /path/to/upload.sh &gt; /var/log/s3sync.log 2&gt;&amp;1
</pre>
</li>
<li>On Zabbix, create a new item which will check the existence of the sentence &#8220;Synchronization failed&#8221; in the file <code>/var/log/s3sync.log</code>:<br />
<a href="http://www.logikdev.com/wp-content/uploads/2011/11/zabbix_s3sync_item.png" rel="lightbox[1566]"><img src="http://www.logikdev.com/wp-content/uploads/2011/11/zabbix_s3sync_item-297x300.png" alt="" title="Create a new item on Zabbix to monitor s3sync" width="297" height="300" class="aligncenter size-medium wp-image-1569" /></a><br />
Item key: <code>vfs.file.regmatch[/var/log/s3sync.log,Synchronization failed]</code><br />
<br/>
</li>
<li>Still on Zabbix, define a new trigger for the previously created item:<br />
<a href="http://www.logikdev.com/wp-content/uploads/2011/11/zabbix_s3sync_trigger.png" rel="lightbox[1566]"><img src="http://www.logikdev.com/wp-content/uploads/2011/11/zabbix_s3sync_trigger-300x160.png" alt="" title="Define a new trigger on Zabbix to monitor s3sync" width="300" height="160" class="aligncenter size-medium wp-image-1570" /></a><br />
Trigger expression: <code>{Template_AmazonCloud_Debian:vfs.file.regmatch[/var/log/s3sync.log,Synchronization failed].last(0)}=1</code>
</li>
</ol>
<p>With these few steps, you should now receive Zabbix alerts when a backup on S3 fails. <img src='http://www.logikdev.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.logikdev.com/2011/11/24/monitor-s3sync-with-zabbix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Refresh GeoIP automatically</title>
		<link>http://www.logikdev.com/2011/11/07/refresh-geoip-automatically/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=refresh-geoip-automatically</link>
		<comments>http://www.logikdev.com/2011/11/07/refresh-geoip-automatically/#comments</comments>
		<pubDate>Mon, 07 Nov 2011 22:55:09 +0000</pubDate>
		<dc:creator>smoreau</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[GeoIP]]></category>
		<category><![CDATA[IP address]]></category>
		<category><![CDATA[MaxMind]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://www.logikdev.com/?p=1440</guid>
		<description><![CDATA[GeoIP is a very useful tool provided by MaxMind. It can determine which country, region, city, postal code, and area code the visitor is coming from in real-time. For more information, visit MaxMind website. This tool is also coming with an Apache module allowing to redirect users depending on their location. For example, we could [...]]]></description>
			<content:encoded><![CDATA[<p><strong>GeoIP</strong> is a very useful tool provided by MaxMind. It can determine which country, region, city, postal code, and area code the visitor is coming from in real-time. For more information, visit <a href="http://www.maxmind.com/app/ip-locate" target="_blank">MaxMind website</a>.</p>
<p>This tool is also coming with an Apache module allowing to redirect users depending on their location. For example, we could redirect all users from France to the French home page of a multi-language website, or we could block the traffic to users from a specific country.</p>
<p>To install this module on a Debian server, you simply need to run the following command:</p>
<pre class="brush: bash; light: true; title: ; notranslate">
apt-get install libapache2-mod-geoip
</pre>
<p><br/>But, how does this module work? How does it know where the user comes from?  <img src='http://www.logikdev.com/wp-includes/images/smilies/icon_eek.gif' alt='8-O' class='wp-smiley' /><br />
It is actually quite simple: GeoIP is using a mapping file of IP address by country. On Debian, this file is stored in the folder <code>/usr/share/GeoIP</code> and is named <code>GeoIP.dat</code>.</p>
<p>However, the IP addresses are something which change all the time. So this file will get out-of-date very quickly. This is why MaxMind provides an updated file at the beginning of each month for free. To read the installation instructions, please click the following link: <a href="http://www.maxmind.com/app/installation" target="_blank">http://www.maxmind.com/app/installation</a></p>
<p>This is good and well, but who will remember or even have the time to update this file every month? And imagine if you have to do this on hundreds of servers?<br />
The solution is to use a shell script which will download, extract and install the updated GeoIP file automatically once a month:</p>
<pre class="brush: bash; title: ; notranslate">
#!/bin/sh

# Go in the GeoIP folder
cd /usr/share/GeoIP

# Remove the previous GeoIP file (if present)
rm GeoIP.dat.gz

# Download the new GeoIP file
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz

# Remove the previous GeoIP backup file
rm GeoIP.dat.bak

# Backup the existing GeoIP file
mv GeoIP.dat GeoIP.dat.bak

# Extract the new GeoIP file
gunzip GeoIP.dat.gz

# Change the permission of the GeoIP file
chmod 644 GeoIP.dat

# Reload Apache
service apache2 reload
</pre>
<p>You can place this file in your root folder and set up the following crontab job:</p>
<pre class="brush: bash; light: true; title: ; notranslate">
0 0 3 * * /root/update_geoip.sh
</pre>
<p>This will execute the script automatically on the third day of every month.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.logikdev.com/2011/11/07/refresh-geoip-automatically/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

