2012 in review

The WordPress.com stats helper monkeys prepared a 2012 annual report for this blog.

Here’s an excerpt:

4,329 films were submitted to the 2012 Cannes Film Festival. This blog had 16,000 views in 2012. If each view were a film, this blog would power 4 Film Festivals

Click here to see the complete report.


Git – Synchronize repositories through USB memory stick

Hi All,

Recently I faced a new challenge by synchronizing two workspaces through a USB memory stick since I didn’t have any servers to upload my code to and also GitHub was out of discussion. One repository was on a Mac machine and another one on an Ubuntu machine.

The conclusion I reached was that the best way for me was to create my main repository on the memory stick, then clone this one on my two machines and then with push and pull to upload or retrieve my changes.

Let’s establish some notations in order to make the tutorial simple:

1. Memory stick name = STICK

2. Project name = Test

Also please note that the location for the memory stick is media for Ubuntu and Volumes for Mac.

Step 1:

Copy your project on your memory stick. Let’s say the location is STICK/Test.

Step 2:

Make this location a main repository with the following command:

git init

git commit -a -m "Initial commit"

Step 3:

Clone your repository on Machine A(E.g. Ubuntu machine). First insert your memory stick. Second go to your workspace and Create the folder Test. Then with Terminal go into this folder and run the following command:

git clone /media/STICK/Test

After that you can import your project in Eclipse or in which IDE you used when you created the project that you moved on your memory stick.

If you change code on this machine in the future first go inside your project folder and run:

git commit -a -m "Commit comments"

And then push them to your memory stick main repository(also from inside your project folder):

git push /media/STICK/Temp

You can pull changes from you memory stick main repository(also from inside your project folder) using:

git pull /media/STICK/Temp

Step 4:

Insert your memory stick in Machine B(Mac machine) and clone your repository here with following command:

git clone /Volumes/STICK/Temp

You can apply all Step 3 commands here with the mention that for Mac machine you will use /Volumes/STICK instead of /media/STICK.

Hope this helps and I expect you question, suggestions or improvements.


Solve java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

Recently I faced a problem regarding jdbc mySql connector. The error above kept popping in my Tomcat 7 console.

I created a web app using Maven 3 Spring 3 Hibernate 3 using the following URL:


Until now everything is great, but the error above popped again. Then in the project’s classpath in libraries tab I went to Add Variable and I chose Extend. In this window I added in M2_REPO the jar file from mysql folder in the repository. The console still displayed the same error.

After few minutes of searching I found the solution. The solution is that you have to copy the jar in lib folder from CATALINA_HOME.

So, although you’d expect MAVEN to handle this it seems it doesn’t so you have to do it manually.


Andrei Visan.

jQuery doesn’t load in Firefox

Hello all,

Last day I had a problem with jQuery and Firefox. I had to create a drop-down menu and it worked perfectly fine in Safari and IE but not in Firefox.

My code looked like this:

<script type=”text/javascript” src=”js/jquery-1.4.4.min.js”/>

//some jQuery code


The problem is that Firefox wants <script type=”text/javascript” src=”js/jquery-1.4.4.min.js”></script> and not <script type=”text/javascript” src=”js/jquery-1.4.4.min.js”/>.

Hope this helps,


CodeIgniter datepicker with JQuery

Hello all,


First of all I want to thank all my viewers from the previous post and I hope that post helped them as much as possible.


I am currently developing a web application using CodeIgniter. It is a great framework and everything is very well documented and well thought. But nothing is perfect on this world so I found that creating a date picker using JQuery and CodeIgniter could be very painful especially if you are quite new with both these technologies. So let me first explain how you should proceed and make everything work great.


1. Download CodeIgniter from their website. You will receive a folder called CodeIgniter_1.7.3 with everything you need in it. Create a folder called assets underneath CodeIgniter_1.7.3 and under assets create 3 folders: css, images, js.

2. Download JQuery and JQuery UI from their website and place jquery-1.4.4.min.js and jquery-ui-1.8.8.custom.min.js under the js folder created above. When you download JQuery UI you will see that under their css folder they have a folder called ui-lightness. Place this one under you css folder created above.

3.  In CodeIgniter_1.7.3/system/application/config you must edit config.php file like this:

$config[‘base_url’] = “http://&#8221;.$_SERVER[‘HTTP_HOST’].”/CodeIgniter_1.7.3″;

This will set your base url to you root folder.

4. Finally lets create the view. Under the  CodeIgniter_1.7.3/system/application/views create a new view. Let’s call it test.php. Edit it as it follows:





<script src=”<?=base_url()?>/assets/js/jquery-1.4.4.min.js” type=”text/javascript”></script>

<script src=”<?=base_url()?>/assets/js/jquery-ui-1.8.8.custom.min.js” type=”text/javascript”></script>




$(document).ready(function() { $(“test”).datepicker(); });



<input type=”text” id=”test” name=”test” />





So these are the 4 steps you need to follow in order to set up you JQuery running on you CodeIgniter platform. For the controller that will launch the view above you can watch lots of tutorials on CodeIgniter web site and also on YouTube.

Hope this helps.


itext 1.5 Html to Pdf

Hello all and Welcome to my first blog post,

I have recently ran into a big problem on how to use iText 1.5 in order to parse a HTML that was converted to a String into a pdf file. The project that I am working on is quite old and we are trying to migrate it from Java 1.4 to Java 6. With that being said we are also trying to use the latest versions on all our jars.

The old itext had also an itextXml library that used a SaxmyHtmlHandler class to handle the content and parsed the content using a SaxParser. So I begun researching for ways to rewrite SaxmyHtmlHandler with the new itext library since itextXml.jar wasn’t available for the new version. The documentation is very weak and lacks in giving the right examples. On the lowagie site the examples are useless since they write their on parsers for a very particular case not a general case like  SaxmyHtmlHandler treated.

After days of researching I had discovered HTMLWorker. I have seen it before in their lib but no examples were there to explain how should it be done properly. I will give you the code below.  It should be put in void main(String args[]) method. Hope this helps!

try {

com.itextpdf.text.Document document = new com.itextpdf.text.Document(PageSize.A4);
PdfWriter pdfWriter = PdfWriter.getInstance(document, new FileOutputStream(“D://testpdf.pdf”));
document.addAuthor(“Author of the Doc”);
document.addCreator(“Creator of the Doc”);
document.addSubject(“Subject of the Doc”);
document.addTitle(“This is the title”);

//SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
//SAXmyHtmlHandler shh = new SAXmyHtmlHandler(document);

HTMLWorker htmlWorker = new HTMLWorker(document);
String str = “<html><head><title>titlu</title></head><body><table><tr><td><p style=’font-size: 10pt; font-family: Times’>” +
“Cher Monsieur,</p><br><p align=’justify’ style=’text-indent: 2em; font-size: 10pt; font-family: Times’>” +
“asdasdasdsadas<br></p><p align=’justify’ style=’text-indent: 2em; font-size: 10pt; font-family: Times’>” +
“En vous remerciant &agrave; nouveau de la confiance que vous nous t&eacute;moignez,</p>” +
“<br><p style=’font-size: 10pt; font-family: Times’>Bien Cordialement,<br>” +
“<br>ADMINISTRATEUR ADMINISTRATEUR<br>Ligne directe : 04 42 91 52 10<br>Acadomia&reg; – ” +
“37 BD Aristide Briand  – 13100 Aix en Provence  </p></td></tr></table></body></html>”;
htmlWorker.parse(new StringReader(str));


} catch(DocumentException e) {
} catch (FileNotFoundException e) {
} catch (UnsupportedEncodingException e) {
} catch (IOException e) {