How to colorize an xml by code

The following class will help you to do that. You can easily transform this : <?xml version="1.0" encoding="UTF-8"?> <kcfg xmlns="http://www.kde.org/standards/kcfg/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0 http://www.kde.org/standards/kcfg/1.0/kcfg.xsd"> <kcfgfile name=""/> <group name="com.librehat.yahooweather"> <entry name="woeid" type="String"> <default></default> </entry> <entry name="interval" type="Int"> <default>60</default> </entry> <entry name="celsius" type="Bool"> <default>true</default> </entry> <entry name="fahrenheit" type="Bool"> <default>false</default> </entry> <entry name="ms" type="Bool"> <default>false</default> </entry> <entry name="kmh" type="Bool">… Read More »

How to read an ogg file in Java without JNI

Import jorbis as a dependenyc of your project Read the howto : http://www.jcraft.com/jorbis/tutorial/Tutorial.html Copy the source code. It will work, but will only be able to play a sound (not to convert it) Look at my JorbisCleanConverter. (https://raw.githubusercontent.com/libetl/soundtransform/master/src/main/java/org/toilelibre/libe/soundtransform/infrastructure/service/audioformat/converter/JorbisCleanConverter.java) and copy everything (you will need to change the catch clauses). You are now able to transform… Read More »

Junit : changer la valeur d’un champ ‘private final’ en toute impunité

Si dans une classe A, vous avez un champ private final String foo, et que dans une classe TestA, vous cherchez à la changer après avoir fait un new, normalement c’est impossible… Normalement, parce qu’il existe toujours une astuce pour contourner cela : A Ainstance = new A (); String newValue = "New value here… Read More »