Generics in Java and C#

Today I was writing some interceptors in Java, and I wanted to be able to filter the input based on whether it implemented a given interface or otherwise. Class<?> exposes a very handy isAssignableFrom method for this, but it doesn’t look very nice, so I tried to go for something a bit neater, like:

   1: Feature.<TargetFeature>isImplementedBy(interceptedInstance);

Neat, and much more readable. I didn’t quite make it there, but got close enough for my purposes, and had some (very little) deeper knowledge of generics inflicted upon me for my sins.

Continue reading “Generics in Java and C#”

iPhone won’t recharge after OS update

I’ve (belatedly) updated my iPhone 3g’s OS today. Just after the update, it started to heat up, and was not recharging no matter how long it was left on the charger. Restarting (hold down the home and the power buttons simultaneously for about 10s) seems to fix both issues.

First law of IT support – try restarting the bloody thing.