Benchmarkjs : a very small tool to compare speed

Wanting to quickly figure out which way is the fastest ? Want to see median times in µs ? Download that module : https://gist.github.com/libetl/952e026f889be1cc7cdb3b42767ea845 And call benchmark that way : (copy/paste that code, change 'forThisWork' - what to measure, 'theContestants '- who to measure, and 'seedInit' - what data should it use) benchmark({theContestants: {naive: seed… Read More »

How to crash javac (jdk8) for free

This simple snippet can cause javac (from the JDK 8) to crash : public class TestExtendConsumer { @FunctionalInterface public interface NumberConsumer< E extends Number> extends java.util.function.Consumer< E>{void accept(E number);} private static < E extends Number> void extend(E number) { System.out.println(number); } public static void main(String[] args) { NumberConsumer numberConsumer = TestExtendConsumer::extend; numberConsumer.accept(1); } } Impressive.… Read More »

Tableau de visualisation SNCF (sorry, post in french only)

Je dois dire que je suis un habitué de l'app fusion de la sncf sobrement appelé "SNCF" https://play.google.com/store/apps/details?id=com.sncf.fusion. Et rien à dire, elle est plutôt complète puisqu'elle offre la possibilité de visualiser les horaires par gare ou par ligne, où que l'on se trouve. Elle permet aussi d'avoir toutes les infos "publiées" (donc pas toutes… Read More »

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 »