Articles

Set a correct exception template !

As a developer, you'll face bugs in production. To analyze what happened, you'll rely on logs and well-known stack traces. But, in order to get stack traces in your logs, exceptions in your application should be handled correctly. Sometimes, you just see no stack trace in your logs because of a block like this: Loading .... Obviously, if an exception happens, you won't have any clue in your logs. This kind of code is often generated by your IDE. So, take a few minutes and change your try/catch template to the following : Loading .... Now, if the same exception appears, it will be rethrown in an unchecked exception. If your application is correctly configured, it will be caught somewhere and logged there. Try to convince your colleagues to do the same !

Where to put curly braces

Code formatting is clearly something personal. Some prefer code without blank lines, others like when the code is grouped in blocks separated with blank lines. I belong in the second team. A common talk with colleagues is where to put curly braces ?

Easily create your own Eclipse

Image
Eclipse contains hundreds of preferences to set. It takes years to know perfectly what option exists, which value is the best and where is this option. When you work with multiple workspaces it become almost impossible to have all your preferences set in all of them. If you use one workspace but work with other colleagues, everyone has different settings. What if, you could build your own zip of Eclipse with your plugins, your JDKs, all your preferences applied automatically in a new workspace ? In fact, you can do it quite easily. we will describe all the steps in this article.

Eclipse.ini file

A common way to optimize Eclipse performances is to customize its eclipse.ini file. Here is the content of mine (for Eclipse Luna) : -startup plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar -showlocation --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20140603-1326 -product org.eclipse.epp.package.jee.product --launcher.defaultAction openFile --launcher.XXMaxPermSize 256M -showsplash org.eclipse.platform --launcher.XXMaxPermSize 256m --launcher.defaultAction openFile --launcher.appendVmargs -vmargs -server -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:+UnlockExperimentalVMOptions -javaagent:lombok.jar -Xbootclasspath/a:lombok.jar -Dosgi.requiredJavaVersion=1.6 -Xms256m -Xmx1024m -Xverify:none If you don't use Lombok, remove the " -javaagent:lombok.jar " line.

Reminder : Mdadm commands

I'll try to sum up here everyday needed commands with mdadm. Of course, you'll need to replace partitions letters and numbers by yours. Every line is a different command and require root privileges. Install raid manager (mdadm) on Debian based distros (Ubuntu, Linux Mint...)  apt-get install mdadm Create a new raid with all disks presents  mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1 Create a new raid with only one present (use it to migrate a single drive to a raid : first create the raid with one disk, copy data, complete the raid with the second disk)  mdadm --create /dev/md0 --level=1 --raid-devices=2 missing /dev/sda1   Get a quick overview of raids running on the system   cat /proc/mdstat  Get full details of a raid   mdadm --detail /dev/md0 Assemble an existing raid with all disks presents  mknod /dev/md0 b 9 0  mdadm --assemble /dev/md0 /dev/sda1 /dev/sdb1 Assemble a 2-disks raid with only one present

Calendrier google des jours fériés

Ayant cherché un moment, je n'ai trouvé aucun calendrier à importer pour me donner les jours fériés en Alsace Moselle ! J'ai donc créer ce calendrier public qui recensent les 26 décembre et les vendredis saints. Il vous suffit d'importer le calendrier suivant : https://www.google.com/calendar/ical/qaer9j4cm84g0i2g8onli2ch2c%40group.calendar.google.com/public/basic.ics De même, le calendrier proposé pour les jours fériés français est loin d'être parfait. Certains jours sont faux (comme Pâques qui n'a jamais été un jour férié) mais même certaines dates passées dont fausses. De plus, le calendrier ne va pas très loin dans le futur. J'ai donc recréer un calendrier qui reprend tous les jours fériés depuis longtemps et jusqu'à longtemps ! Voici l'URL : https://www.google.com/calendar/ical/k0al2s95erpv0jja5grpppvr0o%40group.calendar.google.com/public/basic.ics Si vous souhaitez aussi visualiser les week-end, ce calendrier les liste tous : http