Saturday, April 10, 2010

Qwickie: a usefull eclipse plugin for Wicket Development

In this post I will introduce Qwickie, a usefull eclipse plugin for Wicket Development.

In my daily work I develop software applications. As a web framework we use Wicket, a component based framework with a clear separation of the presentation and the logic.

The connection you between presentation and logic is made via "wicket:id"'s. (See the wicket examples page how this is done.) I found myself executing the following behavioural pattern or it's inverse a lot.

  1. Seek a wicket:id in a webpage
  2. Find corresponding wicket:id in the code

Recently I came across a nice little eclipse plugin which speeds up this pattern. It is named Qwickie, and it facilitates the following use cases:

  • Navigate from java code elements to the corresponding html element via wicket:id
  • Show the corresponding html fragment from the java code element

Both actions are performed by clicking the wicket:id while holding down the ctrl button. This shaves off time following the association between presentation and logic.

Tuesday, February 23, 2010

Google Code as Maven Repository

In this post I will explain how to set up a Google code project as a maven repository.

I like Maven. The fact that I can checkout some code and let Maven figure out all the dependencies is wonderful. I know that there are developers out there who will criticize Maven. But in my opinion, a lot of the critique is not really justified.

I also like Google code project hosting. It is very easy to start a project on Google code and have a mature environment for software development.

When I was looking around for a way to publicize my own artefacts I came across the idea of using project hosting on Google code as a maven repository. Because It took me a while to get everything up and running, I will outline the steps I had to take.

As a precondition, I assume a you have a Google code project where you can submit to and a working maven project.

  1. Add the Java.net maven repository.

    We will be using a plugin which is found on the java.net maven repository.
    
      
        maven2-repository.dev.java.net
        Java.net Repository for Maven
        http://download.java.net/maven/2/
      
    
    

  2. Add the wagon-svn plugin

    We are going to use the wagon-svn plugin which will do all the heavy lifting for us. Make sure to use the latest version.
    
    
        
          org.jvnet.wagon-svn
          wagon-svn
          1.9
        
      
    
    

  3. Come up with a naming scheme.

    We are going to create repositories in the svn tree. I propose the following convention. Create a maven directory at the top of the svn tree. This directory will contain a repo directory and a snapshot-repo.

    This can be configured in the following way.
      
        
          minimal-examples-repository
          Maven Repository for minimal-examples
          svn:https://minimal-examples.googlecode.com/svn/maven/repo
        
        
          minimal-examples-snapshot-repository
          Maven Repository for minimal-examples (snapshot)
          svn:https://minimal-examples.googlecode.com/svn/maven/snapshot-repo
          false
        
      
    

Now we are all set to start deploying! By running the command maven deploy, the svn-wagon plugin will deploy the artifacts to the repository. The first time you will have to accept the certificate that the Google code project return.
Furthermore, you will have to authenticate yourself with your username and password which are known to the Google code project. You can take up this information in your ~/.m2/settings.xml, so you do not have to enter this information all the time.


  
    minimal-examples-repository
    my_username
    my_password
  
  
    minimal-examples-snapshot-repository
    my_username
    my_password
  

This wraps up the set up for using a Google code project as a Maven repository.

Friday, February 5, 2010

Observation on Binary Trees

In this post I will proof the following observation:

Let \(T\) be a binary tree, \(I\) the number of internal nodes and \(L\) the number of leaves in \(T\) then

\[
L = I + 1
\]

We will proof this fact by observing the following. Every binary tree can be "grown" by replacing leaves with trivial binary tree.
A minimal criminal C
Assume to the contrary that not every binary tree can be grown by replacing leaves with trivial binary trees. Then there must exist a smallest binary tree which can not be grown in such a way. Call it \(C\).
Notice that both subtrees of \(C\) are smaller binary trees. Because \(C\) was the smallest tree which could not be grown, both subtrees can be grown.
But the following description grows \(C\).

  1. Take trivial binary tree
  2. On the left leaf use the description for the left subtree of \(C\)
  3. On the right leaf use the description for the right subtree of \(C\)

This contradicts the fact that \(C\) was the smallest such tree. We are forced to drop the assumption that there exist a binary tree which could not be grown. Therefore all binary trees can be grown.

Now for the trivial binary tree is is clear that

\[
L = I + 1
\]

And when a leaf is grown both \(L\) and \(I\) go up by 1, maintaining the equality. From the above observations one can conclude that the equations hold for all binary trees.

Monday, December 7, 2009

The Power of the Internet

In this blog I reflect on a recent experience, which showed my the power of the internet.

Followers of my blog may have noticed that I wrote an article about the number 3435. In that article I generalized one of the properties 3435 has i.e.

\[
3^3 + 4^4 + 3^3 + 5^5 = 3435
\]

I defined Munchausen numbers in base b and proved that there are only finitely many Munchausen numbers in any base. Although I appreciated the result I never expected that the article would be read. This is where the power of the internet enters the stage.

Soon after I posted my article on the internet, a Andrew Baxter mailed my with some comments and suggestions. After including Andrew's suggestions and posting a new version of the article, I was content. Someone else had read my article, and it wasn't my mom.

After that I got an other mail, this time by Tracy Harms. He told my that my article inspired a discussion on Twitter. The discussion was about understanding the source of a program in the programming language J.
So a lot more people had read my article, even twittered about it.

I just finished googling "Munchausen Numbers" and there are numerous links all about an article I wrote. Without the internet nobody (besides my mom) would have read my article, let alone reacted on it. This experience showed my the power of the internet. And I am in awe.

Tuesday, November 17, 2009

Why I Believe In Strong AI

I am a believer in strong AI. There I said it. In this blog I will motivate my believe.

I think that my brain is responsible for all the acts of intelligence that I perform. How it does it, I do not know. But I think that my thoughts, emotions, feelings and decisions originate in my brain.
My brain is, in a sense, nothing but a machine. It has neurons which interact with each other in a certain way. Nothing in this setup is in any way unique, except the specific complexity attained.

I believe that it is possible that a machinery which acts in a similar way will produce similar result. So if there are a lot of agents who can simulate neurons, and if these agents could interconnecting in a similar way as my neurons do, I believe that the same processes will occur as in my brain.

If such a machine were to be build, it would live in a way I could relate to. It would have feelings like I do. it would have a personality like I do. It would be intelligent.
Such a machine would live and it would die if we would pull the plug.

That's is how I think about it.

Sunday, October 25, 2009

Interesting Destination

I use the train a lot. Everyday I use the train to commute to my work. And although I know the train schedule by heart, I often glance at the electronic information boards.

A while ago I noticed a peculiar destination on the board. Below are pictures of the board and a close up. I never heard of a city called: "mmlh".


I keep wondering: How can a mistake like this be made? And for how long did it go unnoticed?

Sunday, August 30, 2009

The virtues of 3435

Folklore tells us that there is no such thing as an uninteresting integer. For, would such uninteresting integers exist, there would certainly be a smallest among them. But being the smallest uninteresting integer is a very interesting property, hence we should not have found it. The only way around this conundrum is to conclude that every integer is interesting.

Well, today three thousand four hundred thirty five got a little more interesting. Besides having a nice decimal representation, this number also possesses the following curious property:

\[
3^3 + 4^4 + 3^3 + 5^5 = 3435
\]

The only numbers who have this property are 1 and 3435. I know this for a fact because an exhaustive computer search until \(10^{10}\) did not reveal any other then numbers mentioned above.
Furthermore, if \(n > 10^{10}\) then \(n > 9^9\log(n)\) for

\[
\frac{10^{10}}{\log(10^{10})} = \frac{10^{10}}{10} = 10^{9} > 9^{9}
\]

Now, define \(\theta(n) := \sum c_{i}^{c_{i}}\) where the \(c_{i}\) are the numerals that express \(n\) in base 10. Then it can be shown that \(9^{9}\log(n) > \theta(n)\).

Now we know that 3435 is the only nontrivial number with such a special property.