MySQL table names always converted to lowercase

Submitted by Jochus on Thu, 14/02/2013 - 16:58 | Posted in: Mac
Posted in


When I execute DDL statements to my MySQL database on my Mac installation, every table is converted to lowercase letters - even if the name is in uppercase letters in my script. This leads to errors in ALTER TABLE operations to add foreign keys (because of case sensitive).


According to this page:

How table and database names are stored on disk and used in MySQL is affected by the lower_case_table_names system variable, which you can set when starting mysqld. lower_case_table_names can take the values shown in the following table. This variable does not affect case sensitivity of trigger identifiers. On Unix, the default value of lower_case_table_names is 0. On Windows the default value is 1. On Mac OS X, the default value is 2.

I updated my my.cnf file:

$ sudo nano /private/etc/my.cnf

... by adding the following line:


Installing Windows fonts on a fresh Ubuntu installation

Submitted by Jochus on Tue, 12/02/2013 - 15:00 | Posted in: Linux
Posted in


Fonts like Tahoma, Verdana, ... are missing on a standard Ubuntu installation. I was looking to install the Microsoft TrueCrypt fonts so I could open Word documents (created in Microsoft Office) correctly in OpenOffice. Also, I had the issue some of my webpages were not looking ok in Firefox (Linux) - fonts were missing, so pages could look totally different.


  • Install package msttcorefonts
  • $ sudo aptitude install msttcorefonts

  • To be able to reload the fonts, without rebooting the machine, execute the command:
  • $ sudo fc-cache -fv

How to disallow content copying and printing of a PDF (aka securing a PDF)

Submitted by Jochus on Mon, 11/02/2013 - 21:18 | Posted in: Java
Posted in

I came across some issues with processing secured PDF's. These PDF files were encrypted. After reading the following documentation:…, I tried securing one of my own PDF's.


Encrypting the PDF so text cannot be copy/pasted and the PDF could not be printed


  • iText
  • BouncyCastle jars

Libraries used

  • iText: 5.3.5
  • BouncyCastle: bcprov-jdk14-1.47.jar and bcprov-ext-jdk14-1.47.jar


import com.itextpdf.text.pdf.PdfReader;
import com.itextpdf.text.pdf.PdfStamper;
import com.itextpdf.text.pdf.PdfWriter;
public class EncryptPDF {
	private static final String INPUT_FILENAME = "/tmp/test.pdf";
	private static final String OUTPUT_FILENAME = "/tmp/test_encrypted.pdf";
	private static final String USER_PASSWORD = "";
	private static final String OWNER_PASSWORD = "foobar";
	public static void main(String[] args) {
		PdfReader reader = null;
		FileOutputStream out = null;
		PdfStamper stamper = null;
		try {
			// Define input
			reader = new PdfReader(INPUT_FILENAME);
			// Define output
			out = new FileOutputStream(OUTPUT_FILENAME);
			// Encrypt document
			stamper = new PdfStamper(reader, out);
			stamper.setEncryption(USER_PASSWORD.getBytes(), OWNER_PASSWORD.getBytes(), 0, PdfWriter.STANDARD_ENCRYPTION_128);
		} catch (Exception ex) {
		} finally {
			if (stamper != null) {
				try {
				} catch (Exception ex) {
			if (reader != null) {
				try {
				} catch (Exception ex) {
			if (out != null) {
				try {
				} catch (Exception ex) {


You can also play with the permissions by providing PdfWriter perms instead of the value "0".

stamper.setEncryption(USER_PASSWORD.getBytes(), OWNER_PASSWORD.getBytes(), PdfWriter.ALLOW_ASSEMBLY | PdfWriter.ALLOW_COPY, PdfWriter.STANDARD_ENCRYPTION_128);

Check if PDF is secured

  • When opening the PDF with Acrobat Reader, the title should end with: (SECURED)
  • Open the properties of the PDF in Acrobat Reader ( + D on a Mac ) and look at Document Restrictions Summary

Changing the startup scripts of an Ubuntu installation

Submitted by Jochus on Sun, 10/02/2013 - 19:23 | Posted in: Linux
Posted in


When you boot your Ubuntu installation, a lot of scripts are started. A lot of scripts are superfluous. But how to disable the ones you don't need?


  • Install rcconf
  • $ sudo aptitude install rcconf

  • Disable the service by toggling the service using the "space bar".
  • $ sudo rcconf

Eclipse code assist in .xhtml pages (JSF tags, Richfaces tags, ...)

Submitted by Jochus on Sat, 09/02/2013 - 17:53 | Posted in: Java
Posted in

If you are missing code assist in XHTML pages, try to the change the following project settings:

  • Right click on project > Properties
  • Choose: Project Facets
  • Check and choose the correct version for Dynamic webmodule
  • Check and choose the correct version for JavaServer Faces

Formatting XML documents using Vi and Xmllint

Submitted by Jochus on Thu, 07/02/2013 - 14:48 | Posted in: Mac
Posted in

If you want to format the following XML document:

<?xml version="1.0" encoding="UTF-8"?><ROOT><FOO><BAR>Hello World</BAR></FOO><BAR><FOO>World Hello</FOO></BAR></ROOT>

... you can use Vi in combination with Xmllint to do the formatting

$ vi example.xml
:%!xmllint --format -

... the result will be:

<?xml version="1.0" encoding="UTF-8"?>
    <BAR>Hello World</BAR>
    <FOO>World Hello</FOO>

Building Richfaces 3.3.x from source code

Submitted by Jochus on Thu, 07/02/2013 - 14:43 | Posted in: Java
Posted in

When building Richfaces 3.3.x from source, you might run into the following error:

richfaces\framework\test\src\main\java\org\ajax4jsf\tests\[32,7] org.ajax4jsf.tests.EnumSupportExpressionFactoryWrapper is not abstract and does not override abstract method coerceToType(java.lang.Object,java.lang.Class) in javax.el.ExpressionFactory

The solution to solve this error:

The problem is that there are different versions of the "el-api-1.0.jar" on the Internet.

The official JAR, with 24432 bytes and SHA1 checksum df8c6ce0406676e70c5d018e5fb988be1bcf1024, is available at the usual locations:

RichFaces 3.3.X does not compile when this JAR is used. It needs the "el-api-1.0.jar" from the old Maven 1 repo at (29309 bytes, SHA1 1e72d5b13b698f99058d35751a29f87ef3066e87).

You don't have to clear the whole local repository or circumvent your Maven proxy. It is just enough to delete all files in %HOME_DIR%\.m2\repository\javax\el\el-api\1.0\ and download into that folder.


Submitted by Jochus on Wed, 06/02/2013 - 20:56 | Posted in: Java
Posted in

There are many comparison lists to find on the web, but this is one I've created after I tested GIT. I have a lot of experience with Subversion, but I was wondering what the power/advantages of GIT are.

What is GIT?

GIT is a free distributed revision control, or software source code management project with an emphasis on being fast. GIT was initially created by Linus Torvalds for Linux kernel development.

Every GIT working directory is a full-fledged repository with complete history and full revision tracking capabilities, not dependent on network access or a central server.

Several high-profile software projects now use GIT for revision control, most notably the Linux kernel, Perl, Samba, Server, Qt (toolkit), One Laptop per Child (OLPC) core development[5], Ruby on Rails web framework, VLC, Merb, Wine, SWI Prolog, DragonFly BSD and the Android mobile platform.


  • distributed: you are no longer dependent on 1 server. You can also retrieve data from your "neighbours" which have also checked out some code of a server. The retrieval of this data is called a pull operation; the sending of data to your neighbours (also called remotes), is called a push operation
  • .git folder: in contrast of Subversion in which each folder has a .svn directory, GIT will only create 1 .git folder. In this folder, each file/folder which is changed/added/deleted/renamed/ ... gets tracked. This .git folder is basicly an index in which files/folders can be quickly retrieved
  • DAG all data gets stored as a DAG (Directed Cyclic Graph). SVN uses a tree architecture. The use of a DAG gives GIT the possibility to create branches from different "trees". Different knots can point to different branches
  • GUI tools: if you don't like the commandline to use GIT, you can use of the many GUI tools like TortoiseGIT to keep track of changes in your directory in a graphical way
  • Merging: the way GIT thinks about merging is more flexible than SVN. For example: you can merge little parts of files to another branch, and leave the other changes in the file in your working copy. This is called: committing a hunk
  • changes: the changes to a tree can easily be e-mailed to other persons
  • history: asking for the history of file/folder in GIT is so much faster than SVN as you don't need a central server to ask for history. All history is stored in an index file
  • goal: GIT is very useful for open source projects: contributors can simply make patches, branch, merge branches of various contributors, all independent on the master server


  • distributed: it seems to be an advantage to move from a centralized to a distributed system, yet, it seems weird that you can retrieve data from the neighbours as well (and not only from a central repository). For me, this is something really strange. Imagine each developer has its own GIT local repository. If you want to update your local repository, you have to fetch the updates from all of the developers? Or do you still need a central repository? But then I need to commit AND and I need to push the changes to the central repository. That's 1 extra operation compared with SVN
  • high learning curve: a wide variety of commands can make this tool very complex. If you want to introduce GIT in your team, I really think you should have at least one developer which has advanced knowledge/experience of GIT. Or each of the developers needs to be for 100% committed to use this new version control system. Otherwise, people will be quickly annoyed.