Saturday, December 31, 2011

Colorify your Eclipse

Yesterday, while I was watching a video about the Play! framework, I realized that I was contemplating TextMate's colors. So, after some googlings, I discovered a "color plugin" which changes the text theme (it doesn't concern the overall look and feel but just the text apparence here). It is so nice so I put here the update-site url :

Wednesday, December 14, 2011

Spring saved my day on an UTF-8 encoding problem

I'm working on Jasig CAS (an SSO server) and I had an issue with special chars. For example, it was impossible to log in with a password like &é"'(-.
  • I checked my jsp file :it was encoded in UTF-8
  • I checked the encoding directive (<%@ page contentType="text/html; charset=UTF-8" %>) : OK
The idea was to force the request encoding with something like :


But I was in Spring MVC and I didn't want an ugly hack. Fortunately, Spring saved my day with a builtin servlet filter to declare in the web.xml.



Friday, November 18, 2011

Ubuntu 11.10 with classic gnome shell (like gnome 2)

I discovered that there's a port of gnome indicator applet which allows to have Ubuntu 11.10 with a gnome 3 which looks like gnome 2. It could be nice if you don't like gnome-shell.

Wednesday, November 16, 2011

Common Linux shell commands

Terminal Cheat Sheet V5

Thursday, November 10, 2011

Kill Oracle session after a JVM was killed

For the moment, I'm playing with Spring Batch. In development, it appends that I need to kill my JVM. The problem is that C3P0 is not allowed to acquire another connection on Oracle on next restart. It's just because the previous one is still there. If you have an Oracle account with the required privileges, the you can see your old session in v$session and destroy it :

  • select * from v$session
  • alter system kill session 'sid,serial#'

Tuesday, November 01, 2011

Ubuntu 11.10 : how to disable the startup sound

The quickest way is to simply rename the login sound file from a terminal :

  • mv /usr/share/sounds/ubuntu/stereo/desktop-login.ogg /usr/share/sounds/ubuntu/stereo/desktop-login.ogg.disabled

Sunday, October 30, 2011

Ubuntu 11.10 : install OpenJDK

Open a terminal (Ctrl+Alt+T) and execute the following command ;

sudo apt-get install openjdk-7-jdk

Thursday, October 27, 2011

Ubuntu 11.10 and ATI radeon problem : fan always on

Since I migrated my laptop (HP 4720s) to Ubuntu 11.10 with gnome-shell, I have the following issue :
  • the open source ATI drivers works well but my fan is always spinning
  • the additional drivers proposed by Ubuntu don't work and make gnome-shell unusable
  • the drivers (11.9) from AMD is very slow

So, for the moment, the best deal for me is to keep the open source drivers. DON'T INSTALL ANY OTHER DRIVER THAN THE ONCE INSTALLED BY DEFAULT. What we will do is to underclock the GPU to keep the temperature acceptable and avoid any problems with the fan. Let's open a terminal :
  • echo -e '#!/bin/sh\necho low > /sys/class/drm/card0/device/power_profile' | sudo tee /etc/init.d/ati-power-save
  • sudo chmod +x /etc/init.d/ati-power-save
  • sudo update-rc.d ati-power-save defaults 99
By the way, we will increase FPS by disabling vertical sync.

  • echo 'export vblank_mode=0' | sudo tee -a /etc/environment

Reboot and enjoy the silence!

Friday, October 21, 2011

Ubuntu 11.10 : you should try gnome-shell

Ubuntu 11.10 is provided with Unity, the graphical user interface from Canonical. Compared to the previous release (Ubuntu 11.04), you can now swith to Gnome Shell. But, why should you swith from Unity to Gnome Shell that you could consider as very similar? My opinion is that Gnome Shell is more pragmatic and beautiful than Unity.

So, how to activate Gnome Shell ?
  1. Go to the software center and activate the patner repositories in the software sources
  2. In a terminal, run sudo apt-get install gnome-shell
  3. Activate it by default with sudo /usr/lib/lightdm/lightdm-set-defaults -s gnome-shell
  4. Reboot and enjoy!
Now that you have almost a prefect shell, you should install some addons :
  1. sudo apt-get install ubuntu-restricted-extras (for flash, java and dvd features)
  2. enable dvd decryption with sudo sh /usr/share/doc/libdvdread4/
  3. sudo apt-get update
  4. sudo apt-get install chromium-browser
  5. sudo apt-get remove firefox
  6. sudo apt-get install smplayer
A good thing is also to enable numlock on lightdm :
  1. sudo apt-get install numlockx
  2. echo 'greeter-setup-script=/usr/bin/numlockx on' | sudo tee -a /etc/lightdm/lightdm.conf
That's all for my default config.

Tuesday, September 13, 2011

Another Software Crasftmen Club

I found it today and I read some interesting stuffs about SCRUM and software development :

Monday, September 12, 2011

PL/SQL interroperability

My company uses an ERP mainly developed in PL/SQL. And we need to deal with external systems. Today, I found a project. It could really help :

Monday, May 30, 2011

Recover your disk after a WUBI crash

This is what I had today. After some two weeks long holidays, my Ubuntu distrib installed with WUBI refused to start. This is the solution I found to get back my files :

sudo fdisk -l
sudo mkdir /win
sudo mount /dev/sdxy /win
sudo mkdir /vdisk
sudo mount -o loop /win/ubuntu/disks/root.disk /vdisk

(Source :

Saturday, May 14, 2011

A Java VNC Server implementation

I found this code today and I really have to test it.

Sources are here :

import java.awt.AWTException;
import java.awt.Image;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
import java.awt.event.*;

public class JVNCserver{

private final int WIDTH = Toolkit.getDefaultToolkit().getScreenSize().width;
private final int HEIGHT = Toolkit.getDefaultToolkit().getScreenSize().height;
private final Rectangle screenRect = new Rectangle(0, 0, WIDTH, HEIGHT);
public Socket socket;
public ServerSocket s;
private CaptureThread capturethread;
private CaptureEvents captureevents;
private Robot robot;
private ObjectOutputStream out;
private BufferedReader in;
private BufferedImage i;
Image image;

public static void main(String arg[])
JVNCserver s = new JVNCserver();

public JVNCserver()
s = new ServerSocket(1166);
socket = s.accept();
System.out.println("Server Started");
out = new ObjectOutputStream(socket.getOutputStream());
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
robot = new Robot();
capturethread = new CaptureThread();
captureevents = new CaptureEvents();

catch(Exception e)
JOptionPane.showMessageDialog(null,"server is stop");

public void sendImage() throws IOException
i = robot.createScreenCapture(screenRect);
image = i.getScaledInstance(WIDTH, HEIGHT-60, Image.SCALE_SMOOTH); out.writeObject(new ImageIcon(image));

private class CaptureThread implements Runnable
private volatile boolean keepRunning;
Thread thread;
thread = new Thread(this,"Capture Thread");
keepRunning = true;
public void run()
while (keepRunning)
catch(InterruptedException e1)
{ System.out.println("Thread Stop"); }
catch (IOException ex) { ex.printStackTrace(); }
catch(Exception e) {
JOptionPane.showMessageDialog(null,"server is stoped"); } } }
public void stopRunning() { keepRunning = false; } }

private class CaptureEvents implements Runnable {
private volatile boolean keepRunning;
Thread thread;
private int HY = HEIGHT / 2;
int y;
thread = new Thread(this,"Capture Events");
keepRunning = true;
public void run()
while (keepRunning)
if (in!=null)
String e = (String)in.readLine();
if (e!=null)
{ //System.out.println(e);
int eventType = Integer.parseInt(e.substring(0, e.indexOf("")));
int arg1 = Integer.parseInt(e.substring(e.indexOf("")+1, e.lastIndexOf("")));
int arg2 = Integer.parseInt(e.substring(e.lastIndexOf("")+1));
if(eventType==JVNCconstant.CLOSE) { keepRunning = false; in.close(); out.close(); return; }
if(arg2 < y =" arg2"> HY) y = arg2 + 21;
if (eventType == JVNCconstant.MOUSE_MOVE) robot.mouseMove(arg1,y);
else if (eventType == JVNCconstant.MOUSE_PRESS)
{ robot.mousePress(InputEvent.BUTTON1_MASK); }
else if (eventType==JVNCconstant.MOUSE_RELEASE) robot.mouseRelease(InputEvent.BUTTON1_MASK);
else if(eventType== JVNCconstant.MOUSE_WHEEL) robot.mouseWheel(arg1);
else if(eventType == JVNCconstant.KEY_PRESS_EVENTS)
case KeyEvent.VK_ENTER: robot.keyPress(KeyEvent.VK_ENTER); break;
case KeyEvent.VK_F1: robot.keyPress(KeyEvent.VK_F1); break;
case KeyEvent.VK_ESCAPE: robot.keyPress(KeyEvent.VK_ESCAPE); break; } } } }
System.out.println("In empty"); //Thread.currentThread().sleep(50); } /*catch(InterruptedException e) { System.out.println("Thread Stop"); }*/ catch(SocketException ex) { ex.printStackTrace(); JOptionPane.showMessageDialog(null,"Client is stopped"); break; } catch (IOException ex) { ex.printStackTrace(); } catch(Exception e) { JOptionPane.showMessageDialog(null,"Server is stop"); } } } public void stopRunning() { keepRunning = false; } }

Tuesday, April 26, 2011

VMWare is not the only one to virtualize desktops

Today, as I was looking for some information about Ubuntu 11.04, I discovered Edubuntu weblive. This solution allows to open a real linux session over internet. Just go here and enjoy this revolution :

By the way, I had to understand what kind of technology there is under weblive. I first found Stephane Graber's blog : Then, I understood that it's a Linux terminal server with a FreeNX java agent. I realized how it is a real concurrent of the vmware solution.

If (like me), you want to "virtualize" desktops in your company, you have to :
If you have legacy Microsoft applications such as Outlook, Office or specific IE webapps, there's a video showing an integration sample :

If you want to see who implemented LSTP, go here :

Thursday, March 03, 2011

Monday, February 21, 2011

Maven war overlay and debugging

I'm currently working on a project which uses the maven war overlay feature. In such condition, I didn't succeed to start my a Tomcat instance from Eclipse WTP. That's because the war is built to late in the maven process and the Maven integration with WTP never calls the appropriate building step. Thus, I decided to start my server from the command line. With 'war overlay', I need to do :

mvn tomcat:run-war

But, what about debugging? Here I found two solutions.

Solution 1 : the standard mode

Just use :

mvnDebug tomcat:run-war

But it's a pre-configured solution and you should want to precise some specific options according to your environment.

Solution 2 : customize your debugging options

This is very simple.
  • Ensure that you correctly declared your JAVA_HOME
  • Set the debugging options which will be used by the JVM

For example :
export MAVEN_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"

Then, just start your server with mvn tomcat:run-war