The subfiles latex package is a good way of splitting one large latex document up into several smaller ones. It has the capability to allow the subfiles to be compiled separately so you don’t have to wait for the main document to compile while you are trying things out.
Autoclosable method reference trick in Java 8
final Foo foo = new SomeFoo(); try (final AutoCloseable ignored = foo::close) { foo.doFoo(); } |
Mock Server
A remotely programmable HTTP “mock” server with expectation matchers/action responses http://www.mock-server.com/
Language Design – things not to do 2
Don’t make the behaviour of your strings depend on the system time! (Java String hashCodes I’m looking at you).
It seems like this is new in Java7, and is for security reasons (mostly to stop DOS attacks on hashmaps). So perhaps it could have been abstracted? Instead of putting the code into String.class, call a native method for the string hash seed, and let the JVM control the String hashCode policy? It is yet another source of non-detrminism in the core language.
Language Design – things not to do
Don’t require some classes to be initialised, then make thouse classes use methods (identifyHashCode) in some god class (System) which you also require to be initialised before any of its methods can be used.
IDE Ideas
When I open a class it should automatically show me all places that references this class (or all nearby places or something if there are lots).
Build z3 for Java
To clone z3 using ubuntu Git I had to follow this codeplex Git workaround
I got the unstable HEAD.
To build z3:
python scripts/mk_make.py --java cd build make all examples |
I also had to set LD_LIBRARY_PATH
to get the com.microsoft.z3.jar
code to load the z3 shared libraries correctly.
Using Jmock annotations with Junit 4
Recent versions of JMock have support for configuration by annotation using JUnit 4 MethodRule
package mypackage; import org.jmock.auto.Mock; import org.jmock.integration.junit4.JUnitRuleMockery; import org.junit.Rule; import org.junit.Test; public class TestMyClass { @Rule public final JUnitRuleMockery context = new JUnitRuleMockery(); @Mock private MyCollaborator collaborator; @Test public void somethingHappensWhenSomethingElse() { } } |
Hamcrest Combinable Matcher
Hamcrest seems to have gained a fluent interface for composing matchers both(containsString("a")).and(containsString("b"))
in org.hamcrest.core.CombinableMatcher
Using proguard 4.8 with maven
The proguard/maven ecosystem seems to be in a bit of a mess. Luckily wvengen and github have stepped up, and released a fork of the com.pyx4me proguard maven plugin.
Anyone that wants to put stuff in maven central should check out this guide to putting stuff in maven central using sonatype.
<plugin> <groupId>com.github.wvengen</groupId> <artifactId>proguard-maven-plugin</artifactId> <version>2.0.6</version> <executions> <execution> <phase>package</phase> <goals><goal>proguard</goal></goals> </execution> </executions> <configuration> <libs> <lib>${java.home}/lib/rt.jar</lib> </libs> </configuration> <dependencies> <dependency> <groupId>net.sf.proguard</groupId> <artifactId>proguard-base</artifactId> <version>4.8</version> <scope>runtime</scope> </dependency> </dependencies> </plugin> |