MD5 quine, fixed point
MD5 quines
Sometimes I let my mind wonder and I get crazy questions. Today was a good example, I encountered a MD5 hash and I started to wonder, would there be a hash which would (when hashed again) be the same?
Thus: MD5(x) = x
This would be a kind of MD5 quine, when fed into the algorithm you get the original value back. This is actually called an MD5 fixed point.
Information I’ve found
So I started investigating, soon I discovered this website about collisions. Its well known that all hashing algorithms must have collisions, you...
Splitting up Spring Web Flow & Facelets into JARs
In our current project we want to have multiple Spring Web Flow-flows in one WAR-file. But we also want the flows and pages to be inside seperate JAR files, making the application a bit more managable and modulair.
This sounds straightforward but it took quite a bit of code and time…
First I created a single WAR-project with all the basic Spring, JSF and Facelet configuration. Like any Spring Web Flow (SWF) project we have a project-servlet.xml.
The first thing I did was changing our flowRegistry:
Cleaner code: Inversion of logic
Design patterns
Almost all programmers have heard about and used design patterns. And there are a lot of them. Famous design patterns include the Singleton, Observer, Template method. These are all patterns that focus on objects and the relationship between them.
There are more groups of patterns, for example take Dependency Injection (or Inversion of Control). This is an architectural pattern. They tell you things about the design of the whole program. And there are specific pattern groups, like concurrency patterns.
These patterns help you solve common problems in a well defined way, other programmers will...
Java EE 6 released, including Servlet 3.0
Today marks the release of Java EE 6. The reference implementation (Glassfish V3) has been released and the specifications are going into their final state very soon.
About two years ago, while I was attending the JavaOne conference, I first heard about the Servlet 3.0 ideas. As a web developer I’ve worked a lot with these Servlets so I was curious about the ideas. But what I saw wasn’t what I hoped for. On the contrary, what I saw was a huge mistake in my opinion!
So I decided to contact the guys behind this JSR, to ask for some...
Steve Oakley, the head hunter
Every once in a while head hunters call me. They call you at home, at work, they work out your email adress and mail you… This will probably sound very familiar to most IT professionals.
Anyway, the thing that strikes me is that about 50% of the time a head hunter calls, its Steve Oakley! And it isn’t just me that is getting calls from Steve Oakley, no, all my collegues and friends are getting calls from him as well!
So, are you in or out? Have you been called by Steve Oakley yet?
Read more...
Testing with Spring
To improve the quality of your code it is important to thoroughly test your code. Not only using unit tests but also using integration tests. I’ll describe these terms and show examples on how to create tests using JUnit and Spring’s Test library.
Unit Testing
A unit-test is an automated test that tests one single unit-of-work. So, what is this unit-of-work? Its the smallest piece of code that can be distinguished. If you are programming in Java the smallest unit you can test is a single method. So all unit-tests should only test this single unit, and no other...
Feed your curiosity
Curiosity is an emotion related to natural inquisitive behaviour such as exploration, investigation, and learning, evident by observation in human and many animal species.
Source: wikipedia
To me, curiosity is one of the greatest things we as humans have. It feeds you with knowledge and sparks your fantasy, its an emotion that tickles your brain and forces you to explore.
In life its vital to search for new things, new limits, new experiences. Always keep asking questions, because with every answer you find, more questions will arise!
At first this...
Atheist look on Christmas
Something other then the usual technical posts…
As you might already know, I am an atheist. Yes, in my opinion there is no God, there never was and (probably) never will be.
Atheistic Christmas?
Being an Atheist with Christian friends I get a lot of questions. Recently a friend of mine asked: “Why do you celebrate Christmas when you are an Atheist?”.
This question, to me, is quite simple. First of all, because it is a tradition. I think its a wonderful holiday. Ask around, what do people think about when you ask them about Christmas?
People think...
VMWare on your phone?
Recently VMWare, known from its computer virtualization software, has announced they are developing a dual-boot mobile version. This would allow you to run both Windows Mobile and Android on your phone.
But it isn’t going to be a dual-boot you know from your computer, they are planning on running the OS’es at the same time. This would allow you to switch between OS on-the-fly.
- You want to use a Windows Mobile app? *click*
- Oh, you want to use something on the Andriod platform? *click*.
I’m very curious how this will work out performance-wise, but the idea itself is...
Eureqa
I’ve just stumbled across a new program: Eureqa
Its a program, developed by the Cornell Computational Synthesis Laboratory, that can detect equations in sets of data. Its primary goal is to identify the simplest mathematical formulas which could describe the underlying mechanisms that produced the data.
Its best described using their instructional video:
I’ve been playing around with it, for example trying to find a good prediction equation for the Son of Darts competition I blogged about earlier.
The algorithm(s) used in this program are based around “symbolic regression”....
#songsincode
What is #songsincode ?
Last week I discovered a new hype on Twitter. The so-called “#songsincode”. It’s a huge hype under programmers and technical users. The best way to explain is probably by showing an example:
This obviously is Paint It Black by the Rolling Stones (if the door is red, paint it black)
My own #songsincode:
Here is a collection of the #songsincode I created and tweeted:
...Java Generics for Compare
I’ve been developing with Java 5+ for quite a while now. Not all developers are this lucky, some are still stuck with 1.4… some even with 1.3! But my clients all made the excellent step forward to Java 5 (some even to 6). The problem is, they moved the runtime/JDK but forget to move their developers!
In Java 5 the language brings some good improvements, the for-loop is easy to understand, and almost all the developers are using this by now. The problem starts with generics. There is a part most developers understand, the Collections API. Almost all programmers use...
Son Of Darts
Another thing I’ve been very busy with lately is AZsPCs (Al Zimmermanns Programming Competition). The current contest is called Son of Darts.
The idea behind these contests are that they are easy to grasp, but very hard to master.
Lets take three darts. You have to throw them to a dartboard which is divided into 4 regions. For example, the values on these regions are: 1,2,4,6.
The first question is: What is the lowest value you can’t throw with these three darts?
This is easy to calculate:
Can we throw one? Yes: 1 dart in the 1
Quine - McCluskey
About a week ago I had a discussion with a fellow programmer about some boolean logic. We had three parameters, something like:
- personHasInsurence (A)
- personNeedsInsurence (B)
- personIsKnownAtThisAgency (C)
We also had two particulair cases for an insurance page:
Case 1:
Person has insurence and isn’t yet known at this agency
Case 2:
Person doesn’t have insurence, needs insurence and is known at this agency
Case 3:
Person doesn’t have insurence, doesn’t need insurence and is known at this agency
Corewars - Brainf*ck
I’ve implemented a Brainfuck interpreter!
Yes, you heard it right, Brainfuck (BF).
BF is an esoteric programming language. More information on BF can be found here.
The language itself is pretty simple, and most of it was implemented rather quickly in Redcode. The only big problem was navigating back to the correct closing brackets in a loop. This is now solved by counting the amount of open/close brackets in between.
So here is the code: