Authorfforw

Ignorance does not prevent loss of rights

No english translation yet

Killergames in the Bundeswehr

When a 19 year old likes to play digital cops and robbers (aka Counter-strike)¬† here in Germany, our goverment is quick to renounce this as “killer game” that is totally not consistent with the human dignity our basic law holds so high. If he goes to Afghanistan with our military (“die Bundeswehr”) to bomb fuel trucks, it’s not only no war, he serves our democracy and an important mission in the war against terror. This hypocrisy totally makes me sick. Somehow no one could yet explain to me what we’re actually doing down there — apart from the obvious motivations to brown-nose the Americans. So we marched in with the UN to beat our democratic values into the taliban, but in the end we did not really want to go through with it. So now we’re defending a government, under which women still are stoned to death for adultery, with the lives of our soldiers — just because the enemy happens to be even more inhumane. I still don’t get it.

Majority of german welfare recipients wouldn’t move for a job

no english translation yet

.

Wahl-o-mat 2009

Just found out that the new Wahl-o-mat for the upcoming federal elections in Germany. The Wahl-o-mat asks you a couple of questions and tells you how similar your political views are compared to a number of political parties. The result was not really a surprise for me:

wahl-o-mat

Interesting is the even higher match with “the Left” party than with the pirate party. Principially I would not mind a left alternative in the elections, but “THE LEFT” isn’t going to be it. I don’t trust them.

fforw.de on WordPress

This blog has been relatively stale for a while now — mostly due to increasing work pressure and the limited amount of time I had left for it. What little time I had was mostly wasted on coding on it. The previous version was written in turbogears which seemd like a good idea back in 2006. Over time I kind of regretted that decision, which was not really Turbogears fault, but just caused by my laziness to really update it etc.

I’ve been frustrated with the old blog code and the old design for some time now and wanted to redo everything and already started multiple attempts in various technological reincarnations — the latest being an implementation in java/spring using my jcouchdb library. The design got more and more ambitious over time; so ambitious that it would basically require me to work full-time on it. Continue reading

Memory consumption changes in svenson 1.3

Implementing a streaming attachment feature for jcouchdb, I started to wonder whether it would be a good idea for svenson to support JSON parsing from a stream, too, as I don’t really need the complete stream to start constructing the java object graph.

Implementing stream parsing was really nice and easy thanks to the units test present in svenson. After that, I came upon two ways to generally cut down on memory use. All tokens with fixed values could just have a single instance. The recording of tokens to provide token based look ahead was not really needed in all cases. But how much does that save?

As a test case I wrote a small tool class to generate random, nested JSON datasets, generated two test files of 65kb and 4.5mb size and parsed these with svenson 1.2.8 and what now is svenson 1.3.

Measuring the actual memory usage for these two test files proved to be difficult. Somehow none of the programs I tried seemed to give me the data I wanted. Eclipse TPTP just ignored Strings that were no member of any class but just parameters, making stream and string parsing look exactly the same memory-wise. tijmp and others did not provide the data I wanted at all.

So in the end I wrote a little python script that parses a hprof ASCII output to

  • sum up all memory use
  • group allocations by class type, but only if the stack trace of it touches svenson
  • output the top 10 of those classes and the sums

This provided meaningful data and also showed some points for further improvement. There was a huge number of java.lang.reflect.Method allocations which turned out to be caused by svenson inspecting the target classes for annotations and appropriate methods which was done on a per target basis instead of the better per target class basis.

All in all the memory usage went down quite a bit:

memory usage for different svenson versions, with and without streaming

memory usage for different svenson versions, with and without streaming

45% less memory for the small file and 62% for the large file for all allocations. I think that is really good..

Below are some links to the files needed to repeat the benchmarking. The transform hprof script might also prove to be useful for other projects if changed appropriately.

The new jcouchdb release will also use stream parsing.

Links:

edit:
The command to generate the hprof file was something like

java -agentlib:hprof=heap=sites,depth=100,cutoff=0 -cp .. svensonperf.ReadJSONOld big.json

YUIZilla Compressor

After again spending time to fix issues resulting from a collision of the yuicompressor jar and the normal rhino jar in one of my projects, I came up with a more radical solution:

  1. Download the source codes from yuicompressor and the corresponding rhino release
  2. Replace every occurance of “mozilla” with “yuizilla”
  3. PROFIT!

¬†So now I have a version of the yuicompressor that works fine and does not conflict with the rhino version I also have in my project. And I don’t need any stupid jar class loaders or have to write stdin/stdout handling for some terribly slow external yuicompressor process. I can just use the classes

  • com.yahoo.platform.yui.compressor.CssCompressor
  • com.yahoo.platform.yui.compressor.JavaScriptCompressor¬†

and be done with it. Hurray for fast dynamic server-side script and style compression!

Hybrid XML-Annotation-based Controllers in Spring

When talking to people about the Spring MVC, it became increasingly clear to me that many are thrilled by the possibilities of using annotation based controllers but are somewhat put off by auto discovery / auto-injecting.

Luckily, it’s pretty easy to combine the power of annotation-based MVC Controller (extremely flexible controller methods, flexible binding and validation) and the advantages of¬† externally declared beans: You continue to use the @Controller annotation, but you don’t use a <context:component-scan/> directive.

 

My media hub

I’ve been thinking about the idea of a small, low-power media pc for the living room for quite some time now. when I saw the eee box, I knew that I would like to try to build a system based on it.

My plans are now entering the final stages after a long and diffcult journey. Both delivery problems (the eee took about 3 months to be actually delivered) and an unusual amount of linux driver problems were the main causes of this.

The components I got in the end were:

  • Asus Eee Box B202
  • One “Terratec Cynergy DT USB XS Diversity”, a dual DVB-T tuner USB stick
  • an external DVD rewriter

Continue reading

Two new projects: svenson and jcouchdb

In my never ending fight against teh wind-mills, I have produced two new open source projects that are somehow connected to each other.

First there is svenson which is a release of my own personal JSON generator / parser. The name is a result of a joke. When my boss asked me what was the unique characteristic of it, my first answer was: “It’s written by me!”. So the name comes from “Sven’s JSON”.¬†

The answer was of course not totally serious. I wrote svenson because none of the JSON parsers out there seemed to have the right combination of being not too complicated yet flexible enough to work well in different scenarios. Being able to use a healthy mix of concrete typed java beans and dynamic map / list constructs seemed to be the best way to go, yet none of the JSON libraries out there seemed to go even near that direction. 

See the svenson wiki at google code for an explanation of how svenson works.

The other project is called jcouchdb and is my attempt at writing a Java driver for couchdb. It is very much connected to svenson as it was the driving force for the parser part of svenson. it offers an API that lets you use all those nice svenson features with couchdb documents. 

Links:

update:  link to couchdb

© 2020 fforw.de

Theme by Anders NorénUp ↑