/images/avatar.png

Welcome

My blog about programming, computer science, and other stuff.

Everything here is my personal opinion and is not related in any way to my current, past, or future employers.

Updating FreeBSD with ZFS Root File System

This weekend I wanted to update my FreeBSD box and saw that the ZFS tools fundamentally changed. The UPDATING file has a corresponding note: Installing kernel and world simultaneously is scary. If something breaks you are left with a broken system, no way to roll back, and uncertain repair possibilities. Sure, you should have backups, but restoring a whole system is still something that takes a lot of time. But is this not exactly one of ZFS’ strength?

Equals != Equality

The other day, I read the article How to Write an Equality Method in Java. Which reminded me that I wanted to write an entry about equality in programming. I cannot hope to cover this topic adequately in a blog post. My goal is merely to show that equality is very hard and that we often have a sever misconception about it. Most programming languages give us several ways to check equality.

duckprxy with javasist

I just released version 0.2 of duckprxy. It now comes with a duck proxy implementation that uses Javassist: JavassistDuckPrxy. Proxies created with JavassistDuckPrxy are not using runtime reflection, but dynamically created code that is compiled to byte code by Javassist. This should reduce the overhead to that of normal delegation, hence, very little. I did not do any performance tests yet, though.

FreeBSD: Encrpyted ZFS Root with Geli

ZFS is supposed to support encryption, but it does not yet on FreeBSD. In a previous post I wrote about setting up ZFS on FreeBSD where the root file system uses UFS and the rest goes to logical ZFS volumes. This time I use geli to encrypt a disk partition and use ZFS for the root file system. I encountered a few problems which I’d like to document here. The FreeBSD Handbook section on encrypted disks show how to set up encrypted disks with geom or geli.

Duck Typing for Java

Every now and then I need to implement some interface, but only one (or very few) methods of it. Usually I need something like this in test code, but it is useful elsewhere, too. The mocking libraries I have seen so far offer something similar, but not quite in the way I want to have it. I had the idea to use something like duck typing for it for a while now.

The Visitor Pattern in Differen Languages

In this post I want to explore the usage of the visitor pattern in different programming languages. The goal is always to represent expression trees, i.e., to have the abstract syntax tree (AST) of an algebraic expression like 2 * 5 - 3. Let us start with a simple implementation in Java: import java.util.HashMap; import java.util.Map; public class ExpressionTree { public static interface Operator { int eval(int ... args); } public static Map<String, Operator> OPERATOR_MAP = new HashMap<String, Operator>(); static { OPERATOR_MAP.