<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4377678849521971198</id><updated>2011-07-31T03:27:12.257+02:00</updated><title type='text'>New Kids On The Blog</title><subtitle type='html'>Parler de tout et de n'importe nawak</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://potimarara.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://potimarara.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Cyril Cheneson</name><uri>http://www.blogger.com/profile/06729852969924468436</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>27</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4377678849521971198.post-3296350921307294582</id><published>2009-08-12T10:11:00.003+02:00</published><updated>2009-08-12T10:17:53.036+02:00</updated><title type='text'>[SQL] Why 1 = 1 in SQL query ?</title><content type='html'>I saw that interesting thread on StackOverflow &lt;a href="http://stackoverflow.com/questions/1264681/what-is-the-purpose-of-using-where-11-in-sql-statements"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Sometimes, you need to build dynamically the WHERE statement in a SQL query.&lt;br /&gt;So you will concatenate some key/value seperated with a "AND" operator&lt;br /&gt;&lt;br /&gt;If you run the following:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;import java.util.HashMap;&lt;br /&gt;&lt;br /&gt;public class Test {&lt;br /&gt; &lt;br /&gt; public static void main(String[] args){&lt;br /&gt;  &lt;br /&gt;  StringBuffer query = new StringBuffer("SELECT * FROM users WHERE ");&lt;br /&gt;  &lt;br /&gt;  HashMap&lt;String,String&gt; mp = new HashMap&lt;String,String&gt;();&lt;br /&gt;  mp.put("firstname", "John");&lt;br /&gt;  mp.put("lastname", "Doe");&lt;br /&gt;  mp.put("login", "john.doe");&lt;br /&gt;  &lt;br /&gt;  for (String k: mp.keySet()) {&lt;br /&gt;   query.append(" AND " + k + " = \"" + mp.get(k) + "\"");&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  System.out.println(query.toString());    &lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The above will return:&lt;br /&gt;&lt;span style="font-style:italic;"&gt;SELECT * FROM users WHERE AND lastname = "Doe" AND login = "john.doe" AND firstname = "John"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The WHERE statement has been generated successfully except that now, we would need to remove the first occurence of the AND operator.&lt;br /&gt;&lt;br /&gt;The trick is to add the following statement at the beginning of the query:&lt;br /&gt;1 = 1&lt;br /&gt;&lt;br /&gt;With this additionnal above statement, we wont need to look for the first occurence of the AND operator and our query will work since 1=1 will always be evaluated to true&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;import java.util.HashMap;&lt;br /&gt;&lt;br /&gt;public class Test {&lt;br /&gt; &lt;br /&gt; public static void main(String[] args){&lt;br /&gt;  &lt;br /&gt;  StringBuffer query = new StringBuffer("SELECT * FROM users WHERE ");&lt;br /&gt;  &lt;br /&gt;  HashMap&lt;String,String&gt; mp = new HashMap&lt;String,String&gt;();&lt;br /&gt;  mp.put("firstname", "John");&lt;br /&gt;  mp.put("lastname", "Doe");&lt;br /&gt;  mp.put("login", "john.doe");&lt;br /&gt;  &lt;br /&gt;  query.append("1=1"); // This can also be moved when declaring the query in the StringBuffer&lt;br /&gt;  &lt;br /&gt;  for (String k: mp.keySet()) {&lt;br /&gt;   query.append(" AND " + k + " = \"" + mp.get(k) + "\"");&lt;br /&gt;  } &lt;br /&gt;  &lt;br /&gt;  System.out.println(query.toString());    &lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The result will return:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;SELECT * FROM users WHERE 1=1 AND lastname = "Doe" AND login = "john.doe" AND firstname = "John"&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4377678849521971198-3296350921307294582?l=potimarara.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://potimarara.blogspot.com/feeds/3296350921307294582/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4377678849521971198&amp;postID=3296350921307294582' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/3296350921307294582'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/3296350921307294582'/><link rel='alternate' type='text/html' href='http://potimarara.blogspot.com/2009/08/i-saw-that-interesting-thread-on.html' title='[SQL] Why 1 = 1 in SQL query ?'/><author><name>Cyril Cheneson</name><uri>http://www.blogger.com/profile/06729852969924468436</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4377678849521971198.post-7384649630159649572</id><published>2009-08-11T22:53:00.004+02:00</published><updated>2009-08-11T23:10:17.547+02:00</updated><title type='text'>[SpringMVC] Spring Tool Suite 2.1.0 includes a Spring MVC template project</title><content type='html'>I have just installed Spring Tool Suite 2.1.0. &lt;br /&gt;Spring Tool Suite (STS) is a tool from SpringSource based on the Eclipse IDE.&lt;br /&gt;It includes most of the tools (Maven, Tomcat ...) you would need to do some Spring development.&lt;br /&gt;&lt;br /&gt;I have tried STS 2.0.2 and one of the reason I stay with Netbeans (which is also a great product) is that creating a Spring MVC project was easier in Netbeans than in STS.&lt;br /&gt;With STS 2.0.2, I had spend long hours to find out how to make a Spring MVC template work with no success (using maven2 archtype).&lt;br /&gt;&lt;br /&gt;With STS 2.1.0, it's now easy to create a Spring MVC project to base your development on.&lt;br /&gt;&lt;br /&gt;To create a Spring MVC project, go to:&lt;br /&gt;&lt;br /&gt;1) File -&gt; New -&gt; Spring Template Project&lt;br /&gt;2) Select the kind of template you want (MVC, Batch, Webflow...) and click Next&lt;br /&gt;3) Enter your project name and top-level package name and click Finish&lt;br /&gt;4) Et Voila, a Spring MVC project ready to be used.&lt;br /&gt;&lt;br /&gt;Also, the great thing is that the configuration of this Spring MVC project is based on annotation instead of XML-only file (on Netbeans). The controller is then a simple POJO with @Controller.&lt;br /&gt;&lt;br /&gt;Have a try, I look forward to playing around with it&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4377678849521971198-7384649630159649572?l=potimarara.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://potimarara.blogspot.com/feeds/7384649630159649572/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4377678849521971198&amp;postID=7384649630159649572' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/7384649630159649572'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/7384649630159649572'/><link rel='alternate' type='text/html' href='http://potimarara.blogspot.com/2009/08/springmvc-spring-tool-suite-210.html' title='[SpringMVC] Spring Tool Suite 2.1.0 includes a Spring MVC template project'/><author><name>Cyril Cheneson</name><uri>http://www.blogger.com/profile/06729852969924468436</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4377678849521971198.post-902874460096225142</id><published>2009-08-10T21:45:00.008+02:00</published><updated>2009-08-10T22:05:58.504+02:00</updated><title type='text'>[Python] Easily make available some files through HTTP</title><content type='html'>At work, our desktop computers run on different OSes, mainly Linux and Windows.&lt;br /&gt;&lt;br /&gt;To be able to share files between Linux and Windows, a samba server will need to be installed and configured on the Linux box.&lt;br /&gt;&lt;br /&gt;Since I dont need any files to be permanently shared, I dont have samba configured. If I need to make some files accessible, I use the below script to create a simple python-powered HTTP server, so that the files I want to share are easily accessible for download through HTTP.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#!/usr/bin/python&lt;br /&gt;&lt;br /&gt;import SimpleHTTPServer&lt;br /&gt;import SocketServer&lt;br /&gt;&lt;br /&gt;# minimal web server.  serves files relative to the&lt;br /&gt;# current directory.&lt;br /&gt;&lt;br /&gt;#Replace the port number if the port 8000 is in use already&lt;br /&gt;PORT = 8000&lt;br /&gt;&lt;br /&gt;Handler = SimpleHTTPServer.SimpleHTTPRequestHandler&lt;br /&gt;&lt;br /&gt;httpd = SocketServer.TCPServer(("", PORT), Handler)&lt;br /&gt;&lt;br /&gt;print "serving at port", PORT&lt;br /&gt;httpd.serve_forever()&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;-Just save the below script (i.e. share_files.py) under the directory you want the World to have access to (i.e. $HOME/Pictures/)&lt;br /&gt;&lt;br /&gt;-Go to $HOME/Pictures/ folder&lt;br /&gt;&lt;br /&gt;-Give executable right to you script:&lt;br /&gt;&lt;code&gt;chmod u+x share_files.py&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;-Launch the script&lt;br /&gt;&lt;code&gt;./share_files.py&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;-Go to http://localhost:8000/&lt;br /&gt;You should see the list of files you have under $HOME/Pictures/&lt;br /&gt;&lt;br /&gt;To have the folder accessible for others, give away your IP address instead of localhost&lt;br /&gt;&lt;br /&gt;Note:&lt;br /&gt;The above script was found &lt;a href="http://effbot.org/librarybook/simplehttpserver.htm"&gt;here&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4377678849521971198-902874460096225142?l=potimarara.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://potimarara.blogspot.com/feeds/902874460096225142/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4377678849521971198&amp;postID=902874460096225142' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/902874460096225142'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/902874460096225142'/><link rel='alternate' type='text/html' href='http://potimarara.blogspot.com/2009/08/python-easily-make-available-some-files.html' title='[Python] Easily make available some files through HTTP'/><author><name>Cyril Cheneson</name><uri>http://www.blogger.com/profile/06729852969924468436</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4377678849521971198.post-4195360342067876290</id><published>2009-07-27T14:40:00.002+02:00</published><updated>2009-07-27T14:55:01.893+02:00</updated><title type='text'>[vim] Send the output of a command straight into vim</title><content type='html'>Here is a pretty cool tip I learn from the Ubuntu groups on LinkedIn.&lt;br /&gt;&lt;br /&gt;You are working with vim on a file and, for some reason, you need the output  of a command (i.e. ls to get the list of files in folder).&lt;br /&gt;&lt;br /&gt;1) First solution is to open a new shell and type '&lt;span style="font-style: italic;"&gt;ls&lt;/span&gt;', copy the result and paste it in the file that you are currently working on&lt;br /&gt;2)You can use redirection by closing the file you are working on and type:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;ls &gt;&gt; myfile.txt&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;3)This cool trick from vim (and vi).&lt;br /&gt;Place your cursor where you want the output to be pasted&lt;br /&gt;Type&lt;br /&gt;&lt;code&gt;&lt;br /&gt;:!r&amp;lt;command&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;In our example, it will be&lt;br /&gt;&lt;code&gt;&lt;br /&gt;:!rls&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;and the result of the ls will be pasted where you have place the cursor.&lt;br /&gt;&lt;br /&gt;Tip can be found &lt;a href="http://www.linkedin.com/groupAnswers?viewQuestionAndAnswers=&amp;amp;gid=27258&amp;amp;discussionID=5454469&amp;amp;commentID=5250647&amp;amp;trk=NUS_DISC_Q_subject&amp;amp;goback=.hom#commentID_5250647"&gt;here &lt;/a&gt;. You may need to join the Ubuntu group.&lt;a href="http://www.linkedin.com/groupAnswers?viewQuestionAndAnswers=&amp;amp;gid=27258&amp;amp;discussionID=5454469&amp;amp;commentID=5250647&amp;amp;trk=NUS_DISC_Q_subject&amp;amp;goback=.hom#commentID_5250647"&gt;&lt;br /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4377678849521971198-4195360342067876290?l=potimarara.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://potimarara.blogspot.com/feeds/4195360342067876290/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4377678849521971198&amp;postID=4195360342067876290' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/4195360342067876290'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/4195360342067876290'/><link rel='alternate' type='text/html' href='http://potimarara.blogspot.com/2009/07/vim-send-output-of-command-straight.html' title='[vim] Send the output of a command straight into vim'/><author><name>Cyril Cheneson</name><uri>http://www.blogger.com/profile/06729852969924468436</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4377678849521971198.post-6637973232722489212</id><published>2009-07-19T22:17:00.015+02:00</published><updated>2009-07-27T14:57:39.921+02:00</updated><title type='text'>[SpringMVC] Enabling annotation</title><content type='html'>The Spring MVC framework allows one to configure an application in 2 different ways :&lt;br /&gt;- via a XML configuration file&lt;br /&gt;- via annotations&lt;br /&gt;&lt;br /&gt;I use the Netbeans IDE (6.7) for Spring development.&lt;br /&gt;When you create a Spring MVC project, the template generated is using the XML configuration (to specify the mapping between URL patterns and Controllers)&lt;br /&gt;&lt;br /&gt;To enable annotation:&lt;br /&gt;-in ${project}-servlet.xml, remove/comment out the declarations regarding the&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;i&gt; ControllerClassNameHandlerMapping&lt;/i&gt;&lt;/li&gt;&lt;li&gt;&lt;i&gt;SimpleUrlHandlerMapping&lt;/i&gt;&lt;/li&gt;&lt;li&gt;&lt;i&gt;ParameterizableViewController&lt;/i&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;-in the applicationContext.xml, add the following declarations:&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;*When declaring the &amp;lt;beans&amp;gt; root,&lt;br /&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;add the '&lt;span style="font-style: italic;"&gt;context&lt;/span&gt;' namespace declaration: &lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic;"&gt;xmlns:context="http://www.springframework.org/schema/contex&lt;/span&gt;t&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Add the following to the &lt;span style="font-style: italic;"&gt;xsi:schemaLocation&lt;/span&gt;:&lt;br /&gt;&lt;span style="font-style: italic;font-size:85%;" &gt;http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-style: italic;"&gt;*&lt;/span&gt;&lt;span&gt;Add the below beans declarations:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;font-size:85%;" &gt;&amp;lt;bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" /&amp;gt;&lt;br /&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-style: italic;font-size:85%;" &gt;context:component-scan base-package="com.myapp"/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;From the documentation of Spring 2.5, &lt;span style="font-style: italic;font-size:85%;" &gt;DefaultAnnotationHandlerMapping &lt;/span&gt;&lt;span style="font-size:100%;"&gt;is an&lt;/span&gt;&lt;span style="font-style: italic;font-size:100%;" &gt; &lt;/span&gt;&lt;br /&gt;"implementation of the &lt;a href="http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/web/servlet/HandlerMapping.html" title="interface in org.springframework.web.servlet"&gt;&lt;code&gt;HandlerMapping&lt;/code&gt;&lt;/a&gt;  interface that maps handlers based on HTTP paths expressed through the  &lt;a href="http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/web/bind/annotation/RequestMapping.html" title="annotation in org.springframework.web.bind.annotation"&gt;&lt;code&gt;RequestMapping&lt;/code&gt;&lt;/a&gt; annotation at the type or method level.   "&lt;br /&gt;&lt;br /&gt;You will have to declare in your Java classes (POJO) a @RequestMapping which will represent an URL pattern.&lt;br /&gt;&lt;br /&gt;The component-scan will tell Spring to scan the base-package for classes that have been annotated (@Controller, @RequestMapping...)&lt;br /&gt;&lt;br /&gt;See more info on &lt;span style="font-style: italic;font-size:85%;" &gt;DefaultAnnotationHandlerMapping &lt;/span&gt;&lt;a href="http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/web/servlet/mvc/annotation/DefaultAnnotationHandlerMapping.html"&gt;&lt;span style="font-size:100%;"&gt;here&lt;/span&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4377678849521971198-6637973232722489212?l=potimarara.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://potimarara.blogspot.com/feeds/6637973232722489212/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4377678849521971198&amp;postID=6637973232722489212' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/6637973232722489212'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/6637973232722489212'/><link rel='alternate' type='text/html' href='http://potimarara.blogspot.com/2009/07/springmvc-enabling-annotation.html' title='[SpringMVC] Enabling annotation'/><author><name>Cyril Cheneson</name><uri>http://www.blogger.com/profile/06729852969924468436</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4377678849521971198.post-4244882556446491133</id><published>2009-03-11T17:29:00.003+01:00</published><updated>2009-03-11T17:49:34.734+01:00</updated><title type='text'>[OpenLDAP]How-to add a new tree in OpenLDAP</title><content type='html'>See below a short how-to I wrote as I had to create a new DIT (Directory Information Tree) in my OpenLDAP server.&lt;br /&gt;&lt;br /&gt;1)Create, for example under /var/lib, a directory that will be used to&lt;br /&gt;store the database file of the new tree  i.e. in "ldap-mynewtree"&lt;br /&gt;&lt;code&gt;sudo mkdir -p /var/lib/ldap-mynewtree&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;2)Give the ownership of the directory to the openldap user (or whatever user the LDAP server is using)&lt;br /&gt;&lt;code&gt;sudo chown openldap:openldap /var/lib/ldap-mynewtree&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;3)Add a second database and suffix to /etc/ldap/slapd.conf&lt;br /&gt;The below config has been taken from OpenLDAP default settings&lt;br /&gt;&lt;code&gt;######################&lt;br /&gt;# Specific Directives for database #2, of type 'other' (can be bdb too):&lt;br /&gt;# Database specific directives apply to this databasse until another&lt;br /&gt;# 'database' directive occurs&lt;br /&gt;&lt;br /&gt;database bdb&lt;br /&gt;&lt;br /&gt;# The base of your directory in database #2&lt;br /&gt;suffix          "dc=mynewtree,dc=com"&lt;br /&gt;&lt;br /&gt;# rootdn directive for specifying a superuser on the database.&lt;br /&gt;#This is needed for syncrepl.&lt;br /&gt;rootdn          "cn=admin,dc=mynewtree,dc=com"&lt;br /&gt;rootpw          pwdadmin&lt;br /&gt;&lt;br /&gt;# Where the database file are physically stored for database #2&lt;br /&gt;directory       "/var/lib/ldap-mynewtree"&lt;br /&gt;&lt;br /&gt;#The above has been taken from the default settings of OpenLDAP&lt;br /&gt;dbconfig set_cachesize 0 2097152 0&lt;br /&gt;dbconfig set_lk_max_objects 1500&lt;br /&gt;dbconfig set_lk_max_locks 1500&lt;br /&gt;dbconfig set_lk_max_lockers 1500&lt;br /&gt;&lt;br /&gt;# Indexing options for database #2&lt;br /&gt;index           objectClass eq&lt;br /&gt;&lt;br /&gt;# Save the time that the entry gets modified, for database #2&lt;br /&gt;lastmod         on&lt;br /&gt;&lt;br /&gt;access to *&lt;br /&gt;   by dn="cn=admin,dc=mynewtree,dc=com" write  &lt;br /&gt;   by dn="cn=admin,dc=mynewtree,dc=com" read  &lt;br /&gt;   by * read&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;div id=":1ix" class="ii gt"&gt;&lt;br /&gt;4)&lt;code&gt; sudo /etc/init.d/slapd stop&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;5)&lt;code&gt; sudo /etc/init.d/slapd start&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;6) Create a ldif file containing the basic tree structure and save it&lt;br /&gt;as mytreestructure.ldif&lt;br /&gt;&lt;br /&gt;Example of ldif:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;##############################&lt;br /&gt;version: 1&lt;br /&gt;&lt;br /&gt;dn: dc=mynewtree,dc=com&lt;br /&gt;objectClass: dcObject&lt;br /&gt;objectClass: organization&lt;br /&gt;dc: mynewtree&lt;br /&gt;o: Example Corporation&lt;br /&gt;description: The Example Corporation&lt;br /&gt;&lt;br /&gt;dn: cn=admin,dc=mynewtree,dc=com&lt;br /&gt;objectClass: organizationalRole&lt;br /&gt;cn: admin&lt;br /&gt;description: Directory Manager&lt;br /&gt;&lt;br /&gt;&lt;wbr&gt;##############################&lt;wbr&gt;#######&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;7)Add the structure from the ldif file to the OpenLDAP server:&lt;br /&gt;&lt;code&gt; ldapadd -x -W -D cn=admin,dc=mynewtree,dc=com -f mytreestructure.ldif -c&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;As reference, &lt;a href="http://www.linux.com/articles/113630?page=2" target="_blank"&gt;http://www.linux.com/articles/&lt;wbr&gt;113630?page=2&lt;/a&gt; :&lt;br /&gt;  * -c: This means don't die on every error; list errors, but&lt;br /&gt;continue and add those entries that did not contain errors&lt;br /&gt;  * -x: use simple authentication&lt;br /&gt;  * -W: prompt for the bind password&lt;br /&gt;  * -f filename: get entries from filename&lt;br /&gt;  * -D'binddn: Bind using binddn -- essentially a username expressed&lt;br /&gt;in LDAP's language, using the full dn.&lt;br /&gt;  For admin functions, this will be the rootdn you specified in your&lt;br /&gt;slapd.conf file.&lt;br /&gt;&lt;br /&gt;8)Update config.php for phpldapadmin to display the new root&lt;br /&gt;sudo vi /etc/phpldapadmin/config.php&lt;br /&gt;Around line 86: We add the new root dn of the new tree in the array&lt;br /&gt;&lt;code&gt;&lt;br /&gt;$ldapservers-&gt;SetValue($i,'&lt;wbr&gt;server','base',array('dc=&lt;wbr&gt;thefirsttree,dc=com','dc=mynewtree,dc=com'));&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;9)You should now see the new tree you have just created under phpldapadmin beside the first tree.&lt;br /&gt;&lt;span style="color: rgb(136, 136, 136);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style=""&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4377678849521971198-4244882556446491133?l=potimarara.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://potimarara.blogspot.com/feeds/4244882556446491133/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4377678849521971198&amp;postID=4244882556446491133' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/4244882556446491133'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/4244882556446491133'/><link rel='alternate' type='text/html' href='http://potimarara.blogspot.com/2009/03/openldaphow-to-add-new-tree-in-openldap.html' title='[OpenLDAP]How-to add a new tree in OpenLDAP'/><author><name>Cyril Cheneson</name><uri>http://www.blogger.com/profile/06729852969924468436</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4377678849521971198.post-2121337361194797537</id><published>2009-02-23T09:22:00.003+01:00</published><updated>2009-02-23T16:10:26.229+01:00</updated><title type='text'>[vim] Autocompletion/Commenting a block in vim</title><content type='html'>Here is a useful tip (IMHO) to use autocompletion in vim.&lt;br /&gt;To make it short, just type the first few letters and hit Ctrl+p.&lt;br /&gt;Tip found at &lt;a href="http://unstableme.blogspot.com/2008/01/vim-tips-1-autocomplete-by-ctrl-p.html"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Another tip to comment a block in vim.&lt;br /&gt;Select a block in Visual Mode (Ctrl+V), press Shift+I and type your comment sign (# for perl)&lt;br /&gt;Tip found at&lt;a href="http://shep-dev.com/?p=35"&gt; here&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4377678849521971198-2121337361194797537?l=potimarara.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://potimarara.blogspot.com/feeds/2121337361194797537/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4377678849521971198&amp;postID=2121337361194797537' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/2121337361194797537'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/2121337361194797537'/><link rel='alternate' type='text/html' href='http://potimarara.blogspot.com/2009/02/vim-autocompletion-in-vim.html' title='[vim] Autocompletion/Commenting a block in vim'/><author><name>Cyril Cheneson</name><uri>http://www.blogger.com/profile/06729852969924468436</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4377678849521971198.post-338526798407835233</id><published>2009-01-14T22:38:00.003+01:00</published><updated>2009-01-14T22:52:10.020+01:00</updated><title type='text'>[Java] Install Java 6 doc on Ubuntu 8.10 aka Intrepid Ibex</title><content type='html'>Ubuntu 8.10 doesnt provide the java 6 doc but an installer that will take care of unzipping and copying the java doc in the right location.&lt;br /&gt;&lt;br /&gt;If you want to install the java 6 doc on Ubuntu 8.10, you will have to:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;download the doc package at http://java.sun.com/javase/downloads/index.jsp. There, click on the "Download" button in the "Java SE 6 Documentation" section. The name of the just-downloaded file will look like &lt;span style="font-style: italic;"&gt;jdk-6u10-docs.zip&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Copy this file under /tmp&lt;/li&gt;&lt;li&gt;Rename it to &lt;span style="font-style: italic;"&gt;jdk-6-doc.zip&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Change the ownership of the zip to root &lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;code&gt;chown root:root  jdk-6-doc.zip&lt;/code&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Run &lt;span style="font-style: italic;"&gt;&lt;code&gt;sudo apt-get install sun-java6-doc&lt;/code&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Et Voila!&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4377678849521971198-338526798407835233?l=potimarara.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://potimarara.blogspot.com/feeds/338526798407835233/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4377678849521971198&amp;postID=338526798407835233' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/338526798407835233'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/338526798407835233'/><link rel='alternate' type='text/html' href='http://potimarara.blogspot.com/2009/01/java-install-java-6-doc-on-ubuntu-810.html' title='[Java] Install Java 6 doc on Ubuntu 8.10 aka Intrepid Ibex'/><author><name>Cyril Cheneson</name><uri>http://www.blogger.com/profile/06729852969924468436</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4377678849521971198.post-6458680001146668154</id><published>2009-01-09T13:16:00.002+01:00</published><updated>2009-01-09T13:26:01.032+01:00</updated><title type='text'>[LDAP] Comments that are not comments</title><content type='html'>Today, we try to run one of the application we worked on in a new environment. &lt;br /&gt;This application uses OpenLDAP and we had to reconfigure everything (create a new root dn, a binding user ...) but as Murpy's law says, "if anything can go wrong, it will". And I can confirm it happened.&lt;br /&gt;We found out that when we set up the access to the ldap server in slapd.conf, comments (starting with #) does not necessarily comment the line out.&lt;br /&gt;We had some lines as follow:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;access to attrs=userPassword,shadowLastChange&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;by dn="cn=admin,dc=myserver,dc=com" write &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;#by dn="uid=cyril,ou=People,dc=myserver,dc=com" write&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;#by anonymous auth&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;by self write&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;by * none&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;You would think that it would be like the below but it's not&lt;br /&gt;&lt;code&gt;&lt;br /&gt;access to attrs=userPassword,shadowLastChange&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;by dn="cn=admin,dc=myserver,dc=com" write &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;by self write&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;by * none&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;According to the &lt;a href="http://www.openldap.org/doc/admin22/slapdconfig.html"&gt;slapd config documentation&lt;/a&gt; &lt;br /&gt;&lt;span style="font-style:italic;"&gt;Blank lines and comment lines beginning with a '#' character are ignored. If a line begins with white space, it is considered a continuation of the previous line (even if the previous line is a comment).&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4377678849521971198-6458680001146668154?l=potimarara.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://potimarara.blogspot.com/feeds/6458680001146668154/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4377678849521971198&amp;postID=6458680001146668154' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/6458680001146668154'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/6458680001146668154'/><link rel='alternate' type='text/html' href='http://potimarara.blogspot.com/2009/01/ldap-comments-that-are-not-comments.html' title='[LDAP] Comments that are not comments'/><author><name>Cyril Cheneson</name><uri>http://www.blogger.com/profile/06729852969924468436</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4377678849521971198.post-4522669284089536795</id><published>2009-01-08T23:40:00.002+01:00</published><updated>2009-01-08T23:48:45.334+01:00</updated><title type='text'>[vi] Basic vi command</title><content type='html'>See below the basic you should (me anyway) need to get started with vi.&lt;br /&gt;I usually use vim(vi improved) but in some Sun servers, you may have only vi available.&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;div style="text-align: left;"&gt;&lt;ul&gt;&lt;li&gt;h &lt;/li&gt;&lt;/ul&gt;Move the cursor to the left one character position&lt;ul&gt;&lt;li&gt;&lt;code&gt;&lt;/code&gt;j&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;Move the cursor down one line.&lt;ul&gt;&lt;li&gt;k&lt;/li&gt;&lt;/ul&gt; Move the cursor up one line.&lt;ul&gt;&lt;li&gt;l&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt; Move the cursor to the right one character position.&lt;ul&gt;&lt;li&gt;X&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;Delete the character before the cursor.&lt;ul&gt;&lt;li&gt;x&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;Delete character under the cursor. A count tells how many characters to delete. The characters will be deleted after the cursor.&lt;ul&gt;&lt;li&gt;a&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;Enter insert mode, the characters typed in will be inserted after the current cursor position. A count inserts all the text that had been inserted that many times.&lt;ul&gt;&lt;li&gt;i&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;Enter insert mode, the characters typed in will be inserted before the current cursor position. A count inserts all the text that had been inserted that many times.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;code&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;You can find the above &lt;a href="http://www.eng.hawaii.edu/Tutor/vi.html#s-mvcur"&gt;here&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4377678849521971198-4522669284089536795?l=potimarara.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://potimarara.blogspot.com/feeds/4522669284089536795/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4377678849521971198&amp;postID=4522669284089536795' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/4522669284089536795'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/4522669284089536795'/><link rel='alternate' type='text/html' href='http://potimarara.blogspot.com/2009/01/vi-basic-vi-command.html' title='[vi] Basic vi command'/><author><name>Cyril Cheneson</name><uri>http://www.blogger.com/profile/06729852969924468436</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4377678849521971198.post-1900297730967968620</id><published>2009-01-08T22:17:00.002+01:00</published><updated>2009-01-08T22:23:23.335+01:00</updated><title type='text'>[perl] - Generate a random password</title><content type='html'>The following code will generate a random password composed of uppercase/lowercase/special characters and digits.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;sub generate_password {&lt;br /&gt;&amp;nbsp;&amp;nbsp;my $length = shift || 10;&lt;br /&gt;&amp;nbsp;&amp;nbsp;my @chars = ( "A" .. "Z", "a" .. "z", 0 .. 9, qw(! @ $ % ^ &amp; * ) );&lt;br /&gt;&amp;nbsp;&amp;nbsp;my $password = join("", @chars[ map { rand @chars } ( 1 .. $length ) ]);&lt;br /&gt;&amp;nbsp;&amp;nbsp;return $password;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;You can pass a number as parameter to the &lt;span style="font-style:italic;"&gt;generate_password&lt;/span&gt; function that will determine the length of the new password.&lt;br /&gt;Default length here is 10&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4377678849521971198-1900297730967968620?l=potimarara.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://potimarara.blogspot.com/feeds/1900297730967968620/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4377678849521971198&amp;postID=1900297730967968620' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/1900297730967968620'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/1900297730967968620'/><link rel='alternate' type='text/html' href='http://potimarara.blogspot.com/2009/01/perl-generate-random-password.html' title='[perl] - Generate a random password'/><author><name>Cyril Cheneson</name><uri>http://www.blogger.com/profile/06729852969924468436</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4377678849521971198.post-6867417056801896559</id><published>2008-12-12T11:09:00.003+01:00</published><updated>2008-12-12T11:14:00.828+01:00</updated><title type='text'>[Tips] List of protocols supported by Konqueror</title><content type='html'>I always use Konqueror as an alternative web browser to Firefox and to access my mobile phone via Bluetooth.&lt;br /&gt;I just find out that Konqueror supports lots of other protocols. &lt;br /&gt;See &lt;a href="http://en.opensuse.org/Konqueror_Tips_and_Tricks"&gt;http://en.opensuse.org/Konqueror_Tips_and_Tricks&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4377678849521971198-6867417056801896559?l=potimarara.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://potimarara.blogspot.com/feeds/6867417056801896559/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4377678849521971198&amp;postID=6867417056801896559' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/6867417056801896559'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/6867417056801896559'/><link rel='alternate' type='text/html' href='http://potimarara.blogspot.com/2008/12/i-always-use-konqueror-as-alternative.html' title='[Tips] List of protocols supported by Konqueror'/><author><name>Cyril Cheneson</name><uri>http://www.blogger.com/profile/06729852969924468436</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4377678849521971198.post-6022945524599049325</id><published>2008-12-08T11:21:00.001+01:00</published><updated>2008-12-08T11:22:58.863+01:00</updated><title type='text'>Webcast of OpenSolaris</title><content type='html'>Here is a little webcast from a OpenSolaris evangelist that shows the cool features of OpenSolaris 8.11, in particular ZFS in action&lt;br /&gt;http://webcast-west.sun.com/interactive/09A12416/index.html&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4377678849521971198-6022945524599049325?l=potimarara.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://potimarara.blogspot.com/feeds/6022945524599049325/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4377678849521971198&amp;postID=6022945524599049325' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/6022945524599049325'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/6022945524599049325'/><link rel='alternate' type='text/html' href='http://potimarara.blogspot.com/2008/12/webcast-of-opensolaris.html' title='Webcast of OpenSolaris'/><author><name>Cyril Cheneson</name><uri>http://www.blogger.com/profile/06729852969924468436</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4377678849521971198.post-8310830451978726380</id><published>2008-11-10T11:47:00.000+01:00</published><updated>2008-11-10T11:48:11.810+01:00</updated><title type='text'>[perl] Few tips</title><content type='html'>*To Jump to a variable/function declaration, type:&lt;br /&gt;gd&lt;br /&gt;Found at http://www.moolenaar.net/habits.html&lt;br /&gt;&lt;br /&gt;*To check if a user has an account on a host, you can use getpwnam&lt;br /&gt;Found at http://www.perl.com/doc/manual/html/pod/perlfunc/getpwnam.html&lt;br /&gt;See also getgrnam and other variants get*&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;*Some perl variables:&lt;br /&gt;$&lt;, $&gt;&lt;br /&gt;Description of those special perl variables at http://affy.blogspot.com/p5be/ch12.htm&lt;br /&gt;Those threads may help you understand&lt;br /&gt;http://www.linuxforums.org/forum/redhat-fedora-linux-help/106602-difference-between-uid-effective-uid.html&lt;br /&gt;http://stackoverflow.com/questions/205070/whats-the-deal-with-all-the-different-uids-a-process-can-have&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4377678849521971198-8310830451978726380?l=potimarara.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://potimarara.blogspot.com/feeds/8310830451978726380/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4377678849521971198&amp;postID=8310830451978726380' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/8310830451978726380'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/8310830451978726380'/><link rel='alternate' type='text/html' href='http://potimarara.blogspot.com/2008/11/perl-few-tips.html' title='[perl] Few tips'/><author><name>Cyril Cheneson</name><uri>http://www.blogger.com/profile/06729852969924468436</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4377678849521971198.post-6922705787958655330</id><published>2008-08-04T16:13:00.002+02:00</published><updated>2008-08-04T16:18:06.409+02:00</updated><title type='text'>[bash]Which file takes the most of the space</title><content type='html'>I was just asked to investigate on a problem.&lt;br /&gt;None of the user could not log in to our application that uses OpenLDAP.&lt;br /&gt;We restarted the slapd daemon, had a look at /var/log/apache2/error.log but nothing showed up. Weird&lt;br /&gt;A sample df -h showed me that the available amount of space was 0% :(.&lt;br /&gt;So to find out which file takes most of the space, run the command:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;find / -type f -size +20000k -exec ls -lh {} \; | awk '{ print $8 ": " $5 }'&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;and it will return the name of the file and its size.&lt;br /&gt;Tip found &lt;a href="http://snippets.dzone.com/posts/show/1491"&gt;here&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4377678849521971198-6922705787958655330?l=potimarara.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://potimarara.blogspot.com/feeds/6922705787958655330/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4377678849521971198&amp;postID=6922705787958655330' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/6922705787958655330'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/6922705787958655330'/><link rel='alternate' type='text/html' href='http://potimarara.blogspot.com/2008/08/bashwhich-file-takes-most-of-space.html' title='[bash]Which file takes the most of the space'/><author><name>Cyril Cheneson</name><uri>http://www.blogger.com/profile/06729852969924468436</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4377678849521971198.post-5210670561760345210</id><published>2008-07-25T11:10:00.003+02:00</published><updated>2008-07-25T11:28:54.354+02:00</updated><title type='text'>[Bash] Include a shell script within another one</title><content type='html'>I just found out today how to include a shell script into another one.&lt;br /&gt;It doesnt use the keyword 'include' like in javascript or php.&lt;br /&gt;A simple dot '.' will just do the trick.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;===== bash1.sh =======&lt;br /&gt;#!/bin/bash&lt;br /&gt;&lt;br /&gt;export MESSAGE="Hello World"&lt;br /&gt;export MESSAGE2="Hello World 2"&lt;br /&gt;echo $MESSAGE&lt;br /&gt;echo $MESSAGE2&lt;br /&gt;&lt;br /&gt;===== bash2.sh =======&lt;br /&gt;&lt;br /&gt;#!/bin/bash&lt;br /&gt;&lt;br /&gt;. bash1.sh&lt;br /&gt;echo $MESSAGE&lt;br /&gt;echo $MESSAGE2&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;When running bash2.sh, you will see:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;Hello World&lt;br /&gt;Hello World 2&lt;br /&gt;Hello World&lt;br /&gt;Hello World 2&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Explanation:&lt;br /&gt;You may think that running the bash1.sh script with :&lt;br /&gt;&lt;code&gt;./bash1.sh&lt;/code&gt;&lt;br /&gt;would work but no. Why?&lt;br /&gt;When running &lt;code&gt;./bash1.sh&lt;/code&gt; (or a call to the bash1.sh script with an absolute path), the current shell will create a child process and run the bash1.sh script within it.&lt;br /&gt;When the child process finished, bash2.sh carries on but doesnt display anything for the&lt;br /&gt;&lt;code&gt;&lt;br /&gt;echo $MESSAGE&lt;br /&gt;echo $MESSAGE2&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;lines&lt;br /&gt;For this you will have to run the bash1.sh script within the current shell instead of creating a child process. And you are doing this by using the '.' or you can use the 'source' command.&lt;br /&gt;&lt;br /&gt;'.' or 'source' will run the bash1.sh in the current shell, so when bash1.sh will finish to run , the environment variables $MESSAGE and $MESSAGE2 set from bash1.sh will persist wihtin the current shell and you' ll be able to use them from bash2.sh&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4377678849521971198-5210670561760345210?l=potimarara.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://potimarara.blogspot.com/feeds/5210670561760345210/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4377678849521971198&amp;postID=5210670561760345210' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/5210670561760345210'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/5210670561760345210'/><link rel='alternate' type='text/html' href='http://potimarara.blogspot.com/2008/07/bash-include-shell-script-within.html' title='[Bash] Include a shell script within another one'/><author><name>Cyril Cheneson</name><uri>http://www.blogger.com/profile/06729852969924468436</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4377678849521971198.post-8878288955155346914</id><published>2008-07-04T11:08:00.002+02:00</published><updated>2008-07-04T11:12:51.337+02:00</updated><title type='text'>[Bash] Populate command line with occurrences</title><content type='html'>Little tip for bash users:&lt;br /&gt;&lt;br /&gt;Let's say you want to delete all files in a directory that starts by 'exam' except one. I would use 'rm' and put all the file names I want to delete manually as there is just one I want to keep.&lt;br /&gt;By typing:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;rm exam[ESC + *]&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;the command &lt;span style="font-weight:bold;"&gt;[ESC + *]&lt;/span&gt; will populate the argument line with all occurrences of 'exam'. &lt;br /&gt;&lt;br /&gt;And now, you can remove the file you want to keep from the list.&lt;br /&gt;&lt;br /&gt;If you're lucky and the file you want to keep is the last one, a simple &lt;span style="font-weight:bold;"&gt;[Ctrl + W]&lt;/span&gt; will remove the last argument passed in the command line.&lt;br /&gt;&lt;br /&gt;The tip was found &lt;a href="http://linuxfr.org/forums/10/25458.html"&gt;here&lt;/a&gt;(in french)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4377678849521971198-8878288955155346914?l=potimarara.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://potimarara.blogspot.com/feeds/8878288955155346914/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4377678849521971198&amp;postID=8878288955155346914' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/8878288955155346914'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/8878288955155346914'/><link rel='alternate' type='text/html' href='http://potimarara.blogspot.com/2008/07/bash-populate-command-line-with.html' title='[Bash] Populate command line with occurrences'/><author><name>Cyril Cheneson</name><uri>http://www.blogger.com/profile/06729852969924468436</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4377678849521971198.post-5504467583083049994</id><published>2008-05-30T10:29:00.003+02:00</published><updated>2008-05-30T18:05:57.273+02:00</updated><title type='text'>[perl] Regular expressions</title><content type='html'>* Oneliner to remove spaces at the beginning and at the end of a string (trim)&lt;br /&gt;&lt;code&gt;$string =~ s|^(\s*)(.*?)(\s*)$|$2|s;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;* Replacing "::" by "/" . This can be useful when you want to see if you can load a module at run time &lt;br /&gt; &lt;code&gt;&lt;br /&gt; $module =~ s|::|/|g;&lt;br /&gt; eval "require $module.pm";&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4377678849521971198-5504467583083049994?l=potimarara.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://potimarara.blogspot.com/feeds/5504467583083049994/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4377678849521971198&amp;postID=5504467583083049994' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/5504467583083049994'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/5504467583083049994'/><link rel='alternate' type='text/html' href='http://potimarara.blogspot.com/2008/05/perl-regular-expressions.html' title='[perl] Regular expressions'/><author><name>Cyril Cheneson</name><uri>http://www.blogger.com/profile/06729852969924468436</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4377678849521971198.post-1769869171980507733</id><published>2008-05-27T17:47:00.000+02:00</published><updated>2008-05-27T17:48:59.794+02:00</updated><title type='text'>[mysql] - Dropping tables without caring about relationships</title><content type='html'>On Mysql, to avoid having a &lt;br /&gt;"Cannot delete or update a parent row: a foreign key constraint fails" &lt;br /&gt;message when dropping tables with relationships between them, you can set the flag &lt;br /&gt;&lt;code&gt;SET FOREIGN_KEY_CHECKS=0; &lt;/code&gt;&lt;br /&gt;at the very beginning of your sql script.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4377678849521971198-1769869171980507733?l=potimarara.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://potimarara.blogspot.com/feeds/1769869171980507733/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4377678849521971198&amp;postID=1769869171980507733' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/1769869171980507733'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/1769869171980507733'/><link rel='alternate' type='text/html' href='http://potimarara.blogspot.com/2008/05/mysql-dropping-tables-without-caring.html' title='[mysql] - Dropping tables without caring about relationships'/><author><name>Cyril Cheneson</name><uri>http://www.blogger.com/profile/06729852969924468436</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4377678849521971198.post-7583054274097029382</id><published>2008-05-19T19:17:00.002+02:00</published><updated>2008-05-19T19:20:20.074+02:00</updated><title type='text'>[Tip] How to concatenate pdf files</title><content type='html'>Sometimes, I received some few documents in pdf format and I would rather read them as a whole document than to close one page and open the next one.&lt;br /&gt;&lt;br /&gt;The tool "pdftk" can be used to concatenate the different pdf files to create 1 file containing the whole&lt;br /&gt;&lt;br /&gt;See &lt;a href="http://www.zolved.com/synapse/view_content/28160/How_to_combine_and_separate_pdf_files_on_Ubuntu"&gt;this tutorial on how to use it&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4377678849521971198-7583054274097029382?l=potimarara.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://potimarara.blogspot.com/feeds/7583054274097029382/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4377678849521971198&amp;postID=7583054274097029382' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/7583054274097029382'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/7583054274097029382'/><link rel='alternate' type='text/html' href='http://potimarara.blogspot.com/2008/05/tip-how-to-concatenate-pdf-files.html' title='[Tip] How to concatenate pdf files'/><author><name>Cyril Cheneson</name><uri>http://www.blogger.com/profile/06729852969924468436</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4377678849521971198.post-4512659105543650438</id><published>2008-05-02T17:08:00.002+02:00</published><updated>2008-05-02T17:16:10.126+02:00</updated><title type='text'>Which Linux version am I running?</title><content type='html'>I can't never remember which version of GNU/Linux I'm running on. I know I use Ubuntu but is it Gutsy Gibbon? Hoary Hedgehog? Feisty Fawn?&lt;br /&gt;&lt;br /&gt;I just found out about a tool called lsb_release.&lt;br /&gt;&lt;br /&gt;lsb_release is a tool created by the LSB (Linux Standard Base) that returns information about the distribution name, version, codename... So this tool should be available on most of the GNU/Linux distribution.&lt;br /&gt;&lt;br /&gt;The output will look like this:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;cyril@merlin:~$ lsb_release -a&lt;br /&gt;No LSB modules are available.&lt;br /&gt;Distributor ID: Ubuntu&lt;br /&gt;Description:    Ubuntu 7.10&lt;br /&gt;Release:        7.10&lt;br /&gt;Codename:       gutsy &lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Time to upgrade to Hardy Heron&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4377678849521971198-4512659105543650438?l=potimarara.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://potimarara.blogspot.com/feeds/4512659105543650438/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4377678849521971198&amp;postID=4512659105543650438' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/4512659105543650438'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/4512659105543650438'/><link rel='alternate' type='text/html' href='http://potimarara.blogspot.com/2008/05/which-linux-version-am-i-running.html' title='Which Linux version am I running?'/><author><name>Cyril Cheneson</name><uri>http://www.blogger.com/profile/06729852969924468436</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4377678849521971198.post-1241758415120757332</id><published>2008-04-29T14:04:00.004+02:00</published><updated>2008-05-02T18:43:07.765+02:00</updated><title type='text'>Perl - How to merge 2 simple hashes ?</title><content type='html'>How to merge 2 hashes ? with the use of hash slice:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;my %hash1 = ( hello1 =&gt; 'world1' , foo1 =&gt; 'bar1', hello2 =&gt; 'foobar' );&lt;br /&gt;my %hash2 = ( hello2 =&gt; 'world2' , foo2 =&gt; 'bar2' );&lt;br /&gt;my %hash = %hash1; # %hash contains the same keys/values as hash1&lt;br /&gt;@hash{keys %hash2} = values %hash2; # We merge the content of hash2 with hash&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;This uses hash slices in order to merge the content of hashes. Slices can also be used to remove duplicates entries in an array:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;my @array = qw/hello world foo bar hello/;&lt;br /&gt;my %hash;&lt;br /&gt;@hash{@array} = undef;&lt;br /&gt;my @array = keys(%hash);&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4377678849521971198-1241758415120757332?l=potimarara.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://potimarara.blogspot.com/feeds/1241758415120757332/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4377678849521971198&amp;postID=1241758415120757332' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/1241758415120757332'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/1241758415120757332'/><link rel='alternate' type='text/html' href='http://potimarara.blogspot.com/2008/04/perl-how-to-merge-2-simples-hashes.html' title='Perl - How to merge 2 simple hashes ?'/><author><name>Cyril Cheneson</name><uri>http://www.blogger.com/profile/06729852969924468436</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4377678849521971198.post-4822345864679567008</id><published>2008-04-11T11:27:00.006+02:00</published><updated>2008-04-11T11:52:16.663+02:00</updated><title type='text'>Transforming Unicode</title><content type='html'>I used to work in the localisation industry (terrible world).&lt;br /&gt;Once, a former colleague asked me if it would be possible to retrieve the japanese characters from the unicode string. With Perl, the answer is "YES"&lt;br /&gt;Just make sure you have the module Unicode::Escape installed, save your unicode string in a text file (i.e. unicodetext.txt) and run the oneliner:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;perl -MUnicode::Escape -ne 'print Unicode::Escape::unescape($_);'/path/to/unicodetext.txt&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Example with some strings in russian:&lt;br /&gt;With a unicode string:&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;\u041f\u0440\u0435\u0434\u0438\u0441\u043b\u043e\u0432\u0438\u0435&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;the result would be:&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;Предисловие&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4377678849521971198-4822345864679567008?l=potimarara.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://potimarara.blogspot.com/feeds/4822345864679567008/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4377678849521971198&amp;postID=4822345864679567008' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/4822345864679567008'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/4822345864679567008'/><link rel='alternate' type='text/html' href='http://potimarara.blogspot.com/2008/04/transforming-unicode.html' title='Transforming Unicode'/><author><name>Cyril Cheneson</name><uri>http://www.blogger.com/profile/06729852969924468436</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4377678849521971198.post-4253608221777225203</id><published>2008-04-11T10:15:00.002+02:00</published><updated>2008-04-11T10:22:57.363+02:00</updated><title type='text'>Your favorite Linux command</title><content type='html'>I am subscribed on a french Linux mailing list, &lt;a href="http://lea-linux.org"&gt;lea-linux.org&lt;/a&gt; and one of the moderator, Emmanuel F., sent this nice command to find out what your favorite command is:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;history|awk '{a[$2]++ }END{for(i in a){print a[i] " " i}}'|sort -rn|head&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4377678849521971198-4253608221777225203?l=potimarara.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://potimarara.blogspot.com/feeds/4253608221777225203/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4377678849521971198&amp;postID=4253608221777225203' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/4253608221777225203'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/4253608221777225203'/><link rel='alternate' type='text/html' href='http://potimarara.blogspot.com/2008/04/your-favorite-linux-command.html' title='Your favorite Linux command'/><author><name>Cyril Cheneson</name><uri>http://www.blogger.com/profile/06729852969924468436</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4377678849521971198.post-3106009345093534177</id><published>2008-04-08T12:26:00.013+02:00</published><updated>2008-04-09T21:56:18.811+02:00</updated><title type='text'>modperl - PerlAuthenHandler</title><content type='html'>Let's say you are working on tenth of web services. All of them work perfectly.&lt;br /&gt;And one day, your boss comes to you and says: "I need you to implement an Authorization mechanism for every web services".&lt;br /&gt;How do you think you can do that?&lt;br /&gt;You can create a class and edit every single handlers (web services) to handle authentication at the application level.&lt;br /&gt;or&lt;br /&gt;You can use the power of modperl and do this at the server level.&lt;br /&gt;&lt;br /&gt;Apache runs several phases (some depends on your configuration) before running the actual code you want to serve (called the response handler).&lt;br /&gt;Those phases can be found &lt;a href="http://perl.apache.org/docs/2.0/user/handlers/http.html"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The interesting phase (or HTTP handler) for authentication is PerlAuthenHandler.&lt;br /&gt;&lt;br /&gt;A basic configuration would be :&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;Location /mywebservice/&amp;gt;&lt;br /&gt;##############&lt;br /&gt;# The below directives are mandatory in order&lt;br /&gt;# to step in the PerlAuthenHandler phase&lt;br /&gt;AuthType Basic&lt;br /&gt;AuthName Test&lt;br /&gt;Require valid-user&lt;br /&gt;##############&lt;br /&gt;SetHandler perl-script &lt;br /&gt;PerlAuthenHandler MyAuthenticationModule&lt;br /&gt;PerlResponseHandler MyWebService&lt;br /&gt;&amp;lt;/Location&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Only the "Basic" type of authentication is supported (at the moment?)&lt;br /&gt;When running this phase, your favorite web browser would pop up a login window.&lt;br /&gt;You would then have to implement your authentication mechanism in the handler set at PerlAuthenHandler (in our case MyAuthenticationModule).&lt;br /&gt;&lt;br /&gt;The description of the  &lt;a href="http://perl.apache.org/docs/2.0/user/handlers/http.html#PerlAuthenHandler"&gt;PerlAuthenHandler&lt;/a&gt; is quite straight forward.&lt;br /&gt;&lt;br /&gt;This type of Authentication is called "Basic HTTP Authentication". After successful authentication, for every requests your browser will send, the HTTP request header will contain a "Authorization" field containing your credentials (username/password) encrypted with an base-64 algorithm.&lt;br /&gt;To reset the credentials, the server will have to call $r-&gt;note_basic_auth_failure and return a status code Apache2::Const::HTTP_UNAUTHORIZED.&lt;br /&gt;&lt;br /&gt;If you want a fancy web interface to deal with Basic HTTP authentication, my advise is to forget about it as there is no way to reset credentials (if you want to simulate a timeout session) except with the method above, but you will always get the login window ...&lt;br /&gt;&lt;br /&gt;So all you have to do is to edit the Apache configuration file and include the above directives without touching any code of your web services.&lt;br /&gt;&lt;br /&gt;modpython also has access to HTTP handlers. It uses the same name as modperl for configuration directives (smart move). I m not sure if php has this feature of using Apache HTTP handlers, to investigate...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4377678849521971198-3106009345093534177?l=potimarara.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://potimarara.blogspot.com/feeds/3106009345093534177/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4377678849521971198&amp;postID=3106009345093534177' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/3106009345093534177'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/3106009345093534177'/><link rel='alternate' type='text/html' href='http://potimarara.blogspot.com/2008/04/modperl-perlauthenhandler.html' title='modperl - PerlAuthenHandler'/><author><name>Cyril Cheneson</name><uri>http://www.blogger.com/profile/06729852969924468436</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4377678849521971198.post-1278817943982321135</id><published>2008-04-07T21:03:00.000+02:00</published><updated>2008-04-07T21:04:57.992+02:00</updated><title type='text'>What is poti marara?</title><content type='html'>What is a "poti marara"?&lt;br /&gt;"Poti marara" is a polynesian speed boat used for fishing.&lt;br /&gt;The boat is drivable by a stick. Like this, the fisherman can drive the boat with one hand and hold in the other hand his harpoon or net.&lt;br /&gt;&lt;br /&gt;A photo and a more-detailed description can be found &lt;a href="http://www.amateurboatbuilding.com/articles/design/ngdesign/open/open.html"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Why did I choose this name?&lt;br /&gt;Because I like it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4377678849521971198-1278817943982321135?l=potimarara.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://potimarara.blogspot.com/feeds/1278817943982321135/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4377678849521971198&amp;postID=1278817943982321135' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/1278817943982321135'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/1278817943982321135'/><link rel='alternate' type='text/html' href='http://potimarara.blogspot.com/2008/04/what-is-poti-marara.html' title='What is poti marara?'/><author><name>Cyril Cheneson</name><uri>http://www.blogger.com/profile/06729852969924468436</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4377678849521971198.post-2453311112586762757</id><published>2008-04-07T20:36:00.002+02:00</published><updated>2008-04-21T22:50:03.352+02:00</updated><title type='text'>Introduction</title><content type='html'>No, "New Kids On The Blog" is not a blog about a boy band from the 80s-90s.&lt;br /&gt;It's my (Cyril Cheneson) blog. Here, I' ll talk mainly about stuff I am working on (Apache, modperl, LDAP...), but also about anything.&lt;br /&gt;&lt;br /&gt;See a short biography:&lt;br /&gt;I am Cyril. I was borned in a tiny island lost in the middle of the Pacific Ocean called Tahiti which is part of the French Polynesia. No, we are not savage, we do have clothes and we do speak french.&lt;br /&gt;&lt;br /&gt;I grew up there and moved to France at around 15-16 years old.&lt;br /&gt;After getting my leaving certificate (baccalaureat) with a speciality in electronics, I continue my studies in M.I.T.(Montpellier Institut of Technology) in GEII (Electronic Engineering and Industrial Computing). After those 2 years study and the diploma, I moved to Dublin,Ireland where I work as a QA engineer and Test Automation Engineer for 6 years.&lt;br /&gt;&lt;br /&gt;Today, I live in Prague (+2.5 years), Czech Republic where I work first as a perl developper for MonsterTRAK (a division of Monster.com) and now,I work as a perl developper for a company specialized in 3 differents businesses: Video streaming for mobile phones, J2me games and web development.&lt;br /&gt;&lt;br /&gt;I like:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;hiking&lt;br /&gt;&lt;/li&gt;&lt;li&gt;inline/ice skating&lt;br /&gt;&lt;/li&gt;&lt;li&gt;snowboarding&lt;br /&gt;&lt;/li&gt;&lt;li&gt;biking (but dont have a bike at the moment)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;travelling&lt;br /&gt;&lt;/li&gt;&lt;li&gt;meeting new people&lt;br /&gt;&lt;/li&gt;&lt;li&gt;music&lt;br /&gt;&lt;/li&gt;&lt;li&gt;computers&lt;/li&gt;&lt;li&gt;sports (squash, basketball ...)&lt;/li&gt;&lt;/ul&gt;I don't like&lt;br /&gt;&lt;ul&gt;&lt;li&gt;doing nothing at work for weeks&lt;/li&gt;&lt;li&gt;Dublin Bus&lt;/li&gt;&lt;/ul&gt;I hope I will find the time to update this blog as often as possible but most of the time, lazyness takes over motivation but stay tune.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4377678849521971198-2453311112586762757?l=potimarara.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://potimarara.blogspot.com/feeds/2453311112586762757/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4377678849521971198&amp;postID=2453311112586762757' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/2453311112586762757'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4377678849521971198/posts/default/2453311112586762757'/><link rel='alternate' type='text/html' href='http://potimarara.blogspot.com/2008/04/no-new-kids-on-blog-is-not-blog-about.html' title='Introduction'/><author><name>Cyril Cheneson</name><uri>http://www.blogger.com/profile/06729852969924468436</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
