Patent, publicity

Patent, publicity

Wow, just wow…

Thanks a lot for all your support people, it’s great to see and read I’m not the only one to think this situation isn’t normal.

Social networking:

First it became huge on social network sites:
- #1 on yCombinator Hacker News: here
- #1 on Reddit: here
- Frontpage on Slashdot: here
- DZone Top Link: here
- Digg: here

Blogs and news sites:

And it was featured on some major blogs/news sites:

- BoingBoing: here
- OpenDotDotDot: here
- Webwereld...

Read more...


Patent infringement

Patent infringement

Some time ago I received the following email about this project.

-–
Mr. van Rijn,

I am Darren Briggs, the Chief Technical Officer of Landmark Digital Services, LLC. Landmark Digital Services owns the patents that cover the algorithm used as the basis for your recently posted “Creating Shazam In Java”. While it is not Landmark’s intention to alienate those in the Open Source and Music Information Retrieval community, Landmark must request that you do not ship, deploy or post the code presented in your post. Landmark also requests that in the future you do not ship, deploy or post any portions or versions of this code in its current state or in any modified state.

We hope you understand our position and that we would be legally remiss not to make this request. We appreciate your immediate attention and response.

Best regards,

Darren P. Briggs
Vice President &
Chief Technical Officer
Landmark Digital Services, LLC
-–

This scared me a bit, why are they emailing me? I’ve written some code (100% my own) and implemented my own methods for matching music. There are some key differences with the algorithm Shazam uses.

Read more...


Music Matching (part deux)

Music Matching (part deux)

After a comment on my previous blog entry (about creating a shazam clone) I started tinkering again.

Somebody asked: Could this be used to detect duplicate songs in my mp3 collection!?

That is exacly what I just tried!

The results

Here are some examples:

Duplicate found: 01 - everything in its right place.mp3.song matches with D:\data\v2\01-radiohead-everything_in_it’s_wrong_place-h8me.mp3.song and score: 134
(note: This is a remix of the original, with some rap mixed in)

Duplicate found: 01 - Joy Division - Exercise One.mp3.song matches with D:\data\v2\114 - Joy Division - Exercise One (From Still).mp3.song and score: 255
(note: Yes,...

Read more...


Creating Shazam in Java

Creating Shazam in Java

A couple of days ago I encountered this article: How Shazam Works

This got me interested in how a program like Shazam works… And more importantly, how hard is it to program something similar in Java?

About Shazam

Shazam is an application which you can use to analyse/match music. When you install it on your phone, and hold the microphone to some music for about 20 to 30 seconds, it will tell you which song it is.

When I first used it it gave me a magical feeling. “How did it do that!?”. And even today, after using...

Read more...


Playing around with HTML 5

Playing around with HTML 5

Yesterday, while browsing DZone, I encountered a couple of HTML 5 blogs. So I decided to try and code some HTML5 - Canvas myself.

This is the result of one hour trail-and-error:

Sorry, no support, please upgrade your browser!

Maybe I’ll do a write-up soon, but for now, just check the sources. (Yes they are wrong/hack-ish, I know…).


Some of my software development rules

Some of my software development rules

Here are (in my opinion) five of the most important ‘rules’ in software development.

Changes happen

The reason why waterfall doesn’t work and agile works a lot better. Changes happen. People will always change their mind, over time technology changes and situations change. So during software development you will have to be flexible with the requirements.

Create software that the client wants, not what he says he wants.

What the clients tells you he wants might not (entirely) be what he/she actually wants or the organisation needs. It is vital to ask questions and release early. When you...

Read more...


Compression by prediction

Compression by prediction

The last couple of weeks I have been playing around with compression/decompression algorithms. This is a field that has always intrigued me. It gives me a magical feeling, like a magician you wave some algorithm around and suddenly the files shrink and bytes dissapear. With the same motion you can undo all your actions and re-generate the original files from thin air!

Arithmetic Coding

Arithmetic coding is a different method to encode bytes. On itself it doesn’t compress, but it is the backbone of a whole family of compression algorithms. To explain how it works we need some example...

Read more...


Handling null in Java

Handling null in Java

Its a problem I encouter in most JEE projects I’ve worked on so far. Handling null-values. But why is this a problem? And what strategies can we follow to reduce the problem? That is what I’m trying to find out in this post.

Lets start with a piece of business logic, in a world where we don’t have null-values:

public BigDecimal getBalance(Person person) {
    Set<Account> accounts = person.getAccounts();
    BigDecimal totalBalance = BigDecimal.ZERO;
    for(Account account: accounts) {
        totalBalance = totalBalance.add(account.getBalance());
    }
    return totalBalance;
}

This looks good and understandable! But this isn’t what I see in most projects. Usually I see code like this:

public BigDecimal getBalance(Person person) {
	if(person != null) {
	    Set<Account> accounts = person.getAccounts();
	    if(accounts != null) {
	    	BigDecimal totalBalance = BigDecimal.ZERO;
	    	for(Account account: accounts) {
	    		if(account != null) {
	    			totalBalance = totalBalance.add(account.getBalance());
	    		}
	    	}
	    }
	    return totalBalance;
	} else {
		return null;
	}
}

Wow, that is not a pretty sight, not at all! What can we do about it and how did it happen?

Read more...


Placement of circle over points

Placement of circle over points

For the Queue ICPC programming game Capture I ran into a geometrical problem.
While programming my little robot I wanted to have an algorithm calculate this for me:

  1. I have a field with 122 points
  2. I have a circle of fixed size

How do I calculate where to put the circle so it encapsulates the most points?

This is what I came up with, three algorithms:

Algorithm #1: Centerpoint

The first algorithm was created as a test. It doesn’t find the perfect solution, but gives a decent solution.
First I loop over all the...

Read more...


I hate printers

I hate printers

  1. Why, when one color has run out of ink, you can’t print anything!?
  2. Why does a pencil cost $0,50 and does an ink-cartridge cost $30,-?
  3. Why does a pencil still work after 5 years and is an ink-cartridge completely dried up?
  4. Why is a new printer (including ink cartridge) sometimes cheaper then a seperate ink-cartridge (crazy!)
  5. Why do printers eat paper for lunch?
  6. Why is printer-software so invasive? What happened to a simple ‘driver’
  7. Why does most hardware run perfectly under Linux, except printers?

Screw this, I’ll just mail my report instead of printing it…

Printer-bashing comic:

Read more...


Guess the algorithm

Guess the algorithm

Yesterday I found and programmed a nice little algorithm. I’m not going to tell you (yet) what it does and how its called, but I’ll just show the code:

private int function(int x, int y) {
	int r = 0;
	while(x!=0) {
		if((x&1)==1) {
			r+=y;
		}
		x>>>=1;
		y<<=1;
	}
	return r;
}

So tell me, what does this do, and what is the algorithm called?

Read more...


Learn to use Dependency Injection

Learn to use Dependency Injection

Recently I placed a comment on this interesting blog from Uncle Bob Martin (Robert C. Martin). It contains a brief description on how I teach people how to use the Spring Framework.

Now, by popular demand (one person requested it over Twitter), I’ll guide you through the method and examples I use in this blogpost. It explains why people should use frameworks like Spring and/or Google Guice, and how.

Ordering Milk

Lets take a look at the application we have. We have a service:

package nl.redcode.examples.milkman;

public interface MilkRequestService {

	/**
	 * Process a new order.
	 * @param customer
	 * @param amountOfBottles
	 */
	public void processOrder(String customer, Integer amountOfBottles);

}

Read more...


What if your favourite movie was remade as porno

What if your favourite movie was remade as porno

What if your favourite movie was remade as a porn movie? How would it be called, what would the title be?

My collegues and I were discussing this, and we came up with a top 10. We’ve also started a twitter hashtag.

Top 10

  1. Shaving Ryan’s Privates (everybodies favourite)
  2. The Curious Taste of Benjamin’s Bottom
  3. Honey, I shagged the kids
  4. Missionary Impossible III
  5. Good Will Humping
  6. Free my Willy
  7. Legally Boned
  8. I Know Who you did last Summer
  9. Schindler’s Fist
  10. Cliff Banger

Honourable mentions

And some honourable mentions to the titles that just didn’t make...

Read more...


Does my car hate me?

Does my car hate me?

Why does my car do this to me? It bugs me everyday. When I drive with the snow outside I have to use my windscreen washer quite a lot. When I pull the little lever behind my steering wheel it spurts a jet of antifreeze/washer fluid onto my screen and it starts to wipe for about 10 times. Then it stops… my window is clean again!

picture of dirty windscreen

But after about 15 seconds it does one final sweep… and this last sweep always leaves ugly marks!

Why do cars do this!!!? First it cleans my...

Read more...


MD5 quine, fixed point

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...

Read more...