The Ikosaeder

Java Technology and more

Getting started with Bean Validation (JSR-303)

Posted by tine2k on April 28, 2011

JSR-303 specifies annotations to validate Java objects. It is part of Java EE 6 but can already be used with Java SE. With JSR-303 you can specify validation rules. In addition to creating your own rules there are several that are built-in:

@AssertFalse, @AssertTrue For boolean fields/methods. The annotated element must be false/true.
@DecimalMin, @DecimalMax For number fields/methods. The annotated element must be a number whose value must be lower/higher or equal to the specified maximum.
@Digits For number fields/methods. The annotated element must be a number within accepted range.
@Future, @Past For date fields/methods. The annotated element must be a date in the future/past.
@Min, @Max For number fields/methods. The annotated element must be a number whose value must be lower or equal to the specified minimum/maximum.
@Null, @NotNull For Object fields/methods. The annotated element must not be null/not null.
@Pattern For String fields/methods. The annotated String must match the specified regular expression.

Let’s get started with the reference implementation (Hibernate Validator 4). For this, just add the following to your pom.xml:

<dependency>
	<groupId>org.hibernate</groupId>
	<artifactId>hibernate-validator</artifactId>
	<version>4.1.0.Final</version>
</dependency>
<dependency>
	<groupId>org.slf4j</groupId>
	<artifactId>slf4j-jdk14</artifactId>
	<version>1.5.6</version>
</dependency>

Now let’s create a simple Java Class that we want to validate:

import java.util.ArrayList;
import java.util.List;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

public class BeanToValidate {

	@NotNull
	private String name; // will check if the name is set

	@Min(value = 3)
	@Max(value = 30)
	private int age; // will check if int is between 3 and 30

	@Pattern(regexp = ".+@.+\\..{2,4}")
	private String email;

	@Size(min = 2, max = 4)
	@NotNull
	private List<String> things; // will check if list has 2 to 4 items

	// getters, setters are here
}

This will set up a standard Java class with annotations for validation. If you want to validate objects of this class you can use the following code:

import java.util.Set;
import java.util.logging.Logger;

import javax.validation.ConstraintViolation;
import javax.validation.Validation;
import javax.validation.Validator;
import javax.validation.ValidatorFactory;

public class BeanValidator {

	private static Logger LOGGER = Logger.getLogger(BeanValidator.class.getName());

	public static void main(String[] args) {

		BeanToValidate bean = new BeanToValidate();

		ValidatorFactory factory = Validation.buildDefaultValidatorFactory();

		Validator validator = factory.getValidator();

		Set<ConstraintViolation<BeanToValidate>> violations = validator.validate(bean);
		for (ConstraintViolation<BeanToValidate> violation : violations) {
			LOGGER.severe(violation.getPropertyPath().toString() + " " + violation.getMessage());
		}
	}
}

Running the code above will result in the following output showing us what violations the validator has found.

28-Apr-2011 15:46:58 org.hibernate.validator.util.Version <clinit>
INFO: Hibernate Validator 4.1.0.Final
28-Apr-2011 15:46:58 BeanValidator main
SEVERE: age must be greater than or equal to 3
28-Apr-2011 15:46:58 BeanValidator main
SEVERE: name may not be null
28-Apr-2011 15:46:58 BeanValidator main
SEVERE: things may not be null

The following code will satisify the validation requirements for all fields. If you run it before the validate() method is called the validation errors are gone.

bean.setAge(29);
bean.setEmail("doesnotexist@martinmaier.name");
bean.setName("Martin Maier");
bean.setThings(Arrays.asList("A", "B", "C"));

Cool, heh?

References:
http://www.jcp.org/en/jsr/detail?id=303
http://download.oracle.com/javaee/6/tutorial/doc/gircz.html
http://www.hibernate.org/subprojects/validator.html

Posted in Java | Leave a Comment »

iPhone IT Safe mode

Posted by tine2k on April 19, 2011

This morning, I hit the play button in the iPod app on my iPhone and the Springboard crashed. It restarted (showing the Apple logo) and started into something called IT Safe Mode. It shows ‘it Safe Mode’ where the time of clock is supposed to be (see screenshot). Whatever that mode is, it disappeared after rebooting the device.

I have an iPhone 4, running a jailbroken iOS 4.3.1.

Posted in Apple | 1 Comment »

Replacing the top case of my MacBook Pro 15 inch (Mid 2010)

Posted by tine2k on March 20, 2011

A couple of weeks ago I spilled coffee over my MacBook. It was only a few drops but enough to break the keyboard. The rest of the internal parts were not affected. Some keys still worked but the back light on the right side broke along with most of the keys:

I had several options on how to proceed:

  1. Get it fixed by Apple or Gravis: My MacBook is pretty new. I just bought it a bit over half a year ago. My initial thought was to get Gravis to fix it in order not to void the warranty. Unfortunately, the people at Gravis and the Apple told me that fixing a broken keyboard of my MacBook model costs about 600€. The reason why this is so expensive is that Apple only sells the keyboard only as part of the unibody top case and that alone is about 400€. For the cumbersome procedure of changing the case Gravis would charge about 200€.
  2. Get a spare part and replace it myself: While this is a cheaper option it has more risks. It voids the warranty and there is a chance that I break it or something else unexpected happens.
  3. Ignore the damage and get a Bluetooth keyboard: This is the cheapest but not a good one. After all, I have the notebook to carry it around. I don’t want to bring a separate keyboard along with it all the time.

After evaluating those options I decided to go for a combination of option 2 and 3. I bought a bluetooth keyboard to keep my macbook functioning until I had found a used top case on ebay:

After figuring out what exact part to get I looked several weeks on eBay for a replacement top case. I ended up buying a used item for about 60€ with a working keyboard. I also bought the following tools (total about 25€) from iFixit:

  1. Phillips #00 screwdriver
  2. Tri-Wing Y0 screwdriver
  3. Torx T6 screwdriver
  4. Spudger (= a plastic tool with a flat and a tip end to remove connectors)

I found a great tutorial about replacing a top case at iFixIt. It is an amazing tutorial with high quality pictures and great instructions.

After two weeks I received the package with the tools and the new top case from the US. I was all set, the adventure could begin:

Step 1: Removing the bottom case
Easy so far :)

Step 2: Removing the battery
The battery has to be removed using the the Tri-Wing screwdriver. It looks like Apple tries to make it difficult to replace the battery on your own by using this uncommon type of screws here. But once you have the right tools, removing the battery is actually quite simple.

Step 3: Removing the fans
The fans come off without any problems. I used the spudger here to disconnect the fan cables from the logic board.

Step 4: Removing the connectors and the logic board
This part is the most difficult one. The logic board has several connectors to all different kind internal parts. Since the logic board is the center of the computer everything is connected to it: Wifi, Bluetooth, iSight camera, keyboard+backlight, battery, display, trackpad, optical drive, power button, infrared etc. It is very important here that you do not apply force and make sure you apply force only the connector not the socket itself. Once all the connectors are disconnected, the logic board can be removed from the case.

Step 5: Remove the harddisk
Thats a very simple step, just a couple of screws and harddisk comes off.

Step 6: Removed Wifi, Bluetooth and iSight camera
I then carefully disconnected the antennas (they are all in the display) and removed the cable channels. This is beautifully done by Apple. I admire its compact design.

Step 7: Remove optical drive
Since the optical drive is already disconnected it is easy to remove the optical drive.

Step 8: Separate display from the case
After removing the cable holders and removing the screws that hold the display I separated the display from the case.

The display by itself looks a bit like a big iPad :)

Done!
That’s it. All parts are removed from the top case.

All internals of the MacBook in one picture:

Behind the black protection of the keyboard the coffee is visible. Guess it was a bit more than a few drops…

I then repeated all steps in reverse order with the new top case. The logic board was a bit tricky to put back on because you have to attach the power connector under the board. It was easier for me to remove the power connector from the top case, connect to the board, and reattach the power connector while holding the board with the other hand.

After putting it all back together, I turn on the MacBook and…
… it works. I succeeded! The MacBook and all its sensors work fine without any problem. The best of all: the keyboard works :)

My lessons learned:

  • Don’t ever, ever, ever spill coffee over your laptop! :)
  • When you choose to repair on your own, make sure you are well prepared, have to right tools and you know what you are doing.
  • Try to find something to put the screws in while you replace the top case. Make sure you have a system that helps you remember what screws are for what step of the procedure. This is important, you have to work with over 40 screws of at least 10 different types.

Posted in Apple | 1 Comment »

Sun Certified Web Component Developer

Posted by tine2k on February 27, 2008

A couple of weeks ago I got certified as a Sun Certified Web Component Developer. A pretty straight forward exam about web stuff, servlets, taglibs and company. I didn’t learn much in fact while preparing for the exam. Most of the things I knew already. Some details, however, about custom taglibs and jsp expression language are good to know now All in all, I am pretty happy about my second Java certification. However I would have preferred a JSTL based certification if there were one available.
Atm I am preparing for the Business Component Developer, which is more interesting. EJB 3 rocks! I am looking forward to the day I am able to post an entry titling “Sun Certified Business Component Developer for Java EE 5″. Hope it will be soon…

Posted in Java, Personal | Leave a Comment »

My Top 10 Mac OS X Applications

Posted by tine2k on January 4, 2008

I am always looking for cool new little third-party Mac apps that make our life easier. In case you do not know all of my picks give them a try. Here they are, my Top 10 Mac app picks:

  1. Quicksilver (http://www.blacktree.com): An awesome application launcher and make-your-life-easier-every-day application
  2. Omnigraffle* (http://www.omnigroup.com/applications/omnigraffle): The best diagramming application I know.
  3. AdiumX* (http://www.adiumx.com/): The best Instant Messaging client on the planet.
  4. Growl (http://www.growl.info/): A system wide popup notifer, which is widely supported.
  5. Textmate* (http://macromates.com/): The best text editor on the mac!
  6. PearLyrics (http://www.pearworks.com/pages/pearLyrics.html): A Dashboard Widget and Application to retrieve and save lyrics for your iTunes songs.
  7. Gmail Notifier (http://toolbar.google.com/gmail-helper/notifier_mac.html): Notifies you of new mail in your Gmail inbox.
  8. Cyberduck (http://cyberduck.softonic.de/mac): A great open-source FTP client with great on-the-fly file edit support
  9. Teamspeex (http://www.savvy.nl/blog/): A Teamspeak Frontend for the Mac. Sometimes a bit buggy, but uses little CPU.
  10. Ecto* (http://infinite-sushi.com/software/ecto/): I wrote this very entry with ecto, a blog software.

What are your picks? Let me know…

* Commercial

Posted in Apple | Leave a Comment »

My new iPhone

Posted by tine2k on November 24, 2007

I finally got it, my new iPhone! :)

A colleague of mine, Fritz, went to Oracle Open world two weeks ago and got one for me (thanks again Fritz). The price in the US is 399$, so I only paid 296€ for it which is just so cheap for a phone like this. I would never pay 1000€ (like they sell it for in Germany). However, I would have paid 399€ for an iPod touch. But now I paid 100€ less and got so much more than an iPod. The iPhone is a great iPod as well and I have replaced my old Nano with my new iPhone, obviously.

The unlocking procedure was pretty simple. I did not even need a computer to perform the jailbreak and the unlocking. I just configured my WLAN network and navigated to http://jailbreakme.com and the magic happened. The site uses the TIFF-File exploit to execute code on my iPhone and performed the (fake) activation as well as the jailbreak itself. After that I could install the App Tap Installer to get access to all third party applications available on the iPhone. One of those is anySim which I unlock the iPhone with to use my T-Mobile sim. It was really easy to do, even though the process behind the curtain is very complex (flashing of the modem etc.). I did it with version 1.1.1, which was the one that bricked some of the iPhones that upgrade from 1.0.2.

The phone itself is beyond anything I have seen before. There is so much innovation in this device. it’s amazing. Flicking through contacts and music is even more comfortable than the iPod click wheel, which was already very innovative. It is all thought through! Apple really did a great job on this. I am overwhelmed with this device. Safari works great and so does Youtube, Calendar and all the other apps on it. I use all of them all the time! Internet works great with WLAN. I don’t have Internet access via T-Mobile, so WLAN is fine. The only important thing to remember is to turn it off after I have used it. Otherwise the battery dies pretty quickly.

What I miss on the iPhone though:

  • I can not use SMS delivery reports. They are provider specific and only work with AT&T. Maybe there will be a fix in the future. But at the moment the only way to get the report is to add something like *#01# at the beginning of a text message. Well, I won’t do that…
  • SMS grouping is based on numbers not on contacts.
  • I have not found a WEP cracker yet. Still looking for one…

However, it is clearly the best phone I ever had. The next time you meet me, I will be happy to show it to you. Even though the iPhone exists since July I have not seen that many people with it in Austria. :)

Posted in Apple | Leave a Comment »

WJAX 2007

Posted by tine2k on November 13, 2007

I returned from WJAX 2007 on Friday. It was an extraordinary conference. I met many great people and it was a lot of fun. Most of the session were very well prepared and had competent speakers. On Wednesday night they had a very nice event where they had about 20 tables with small signs. Every sign had a topic written on it. Every table had its own topic where people could discuss things around the topic of the table. I spent a lot of time on the Application Security table discussing Kerberos and other security related topics. That’s where I met Mike Wiesner, who wrote a good Kerberos article for Java Magazin that I had started to learn Kerberos with. I also spent some time on the Groovy table as well as talking to the great guys of Interface21 on the Spring table.
I especially enjoyed the session about Annotation processing with Angelika Langer. You can do great things with Annotations already, but there is even more to come with Java 7. Type Annotation have the potential to do amazing things in Java. In particular, you will be able to check pre- and postconditions more easily and get one step closer to finite state machines. At the moment you have to use some sort of AOP to achieve that (which is not a big deal if you use Spring, to be fair).
On Monday I attended a workshop about Groovy. I hadn’t done much with Groovy and did not know what to expect really. I was impressed what you can do with Groovy when it comes to processing collections and types. The power of Groovy when it comes to sorting and modifying collection is over the top. However, I still am a bit skeptical on when and how Groovy can play a major role in Enterprise development. But where performance does not matter, Groovy can be a great add-on to Java. Dirk König said: ‘The questions is not whether Groovy or Java is better but to think of Groovy as Java’s little dynamic brother‘. I can’t wait to get good IDE support for Groovy. :)
The new Time and Date classes were presented by Adam Bien, which was quite interesting. They SR is not yet finished yet but it is already certain that the new classes will be a great improvement over the current Date situation in Java. They will make heavy use of Fluent API Design that will make Java a little lighter and more dynamic. I am very excited about what Java 7 will bring!

Those are the session I attended:

  • Von Java zu Groovy (Tammo Freese, Dierk König, Johannes Link)
  • Praxisbericht Java EE 5 / Seam (Werner Eberling, Michael Plöd, Francis Pouatcha)
  • Spring 2.1 in der Welt von Java 6 und Java EE 5 (Jürgen Höller)
  • Advanced JavaServer Faces (Matthias Wessendorf)
  • Secure Coding (Bruce Sams)
  • Java Concurrency – Mythen, Sagen und Legenden (Rainer Jung)
  • Security Last – Sicherheitsentscheidungen spät treffen (Mike Wiesner)
  • Der 10-Punkte-Plan für den sicheren Weg zum nicht-wartbaren Code (Benjamin Schmid, Oliver Pehnke)
  • Spring und Persistenz (Eberhard Wolff)
  • BOF: java.util.Date und new Time And Date (JSR-310) (Adam Bien)
  • Einführung in Domain Driven Design (Michael Plöd, Arno Haase)
  • Annotation Processing (Angelika Langer)
  • State-of-the-Art Java EE – II (Lars Röwekamp, Jens Schumann)
  • Domänenspezifische Sprachen (DSLs) mit Xtext (Sven Efftinge, Arno Haase)

Posted in Java, Personal | Leave a Comment »

Apple’s Leopard

Posted by tine2k on October 28, 2007

I was pretty excited about the new Mac OS operation system when it was first introduced. I installed it today and that’s my review:

  • Safari: I love it! The best thing is the new search functionality. I always thought that the highlighting feature of Firefox was very helpful when searching a page. Safari 3 does not only highlight, I grays the page a little bit out to signalise that the search mode is on. It also animates the matches when you iterate through them. That’s just the best way there is to search an Internet page. The new RSS reader has also some nice improvements.
  • Mail: Stationary is quite nice. All in all the application seems even more mature, and I it seems to finally get all the messages from my IMAP folders on my server right away without the need of checking each folder.
  • iCal: Have not used it much, but I probably will as soon as I have my iPhone around 19th of November :)
  • Reflective Dock: To be honest, I miss the triangle below the icons of the started programs. The reflection looks great, but this blue shivering egg… What’s that supposed to be?
  • QuickLook: I am going to use that a lot. Just by selecing any item(s) and hitting Cmd-Y one can take a quick look! Great! Preview.app is pretty good already but quick look is faster and supports more file types.
  • Spaces: Very nice feature. Unfortunately I can not use it from within WC3 which I had hoped for. However, it can be very helpful as soon as you get used to it. It is essential when there are so many windows open that Expose is not enough anymore.
  • Stacks: Finally a great way to download files to a folder with good UI support. My desktop (which I used before as my download location) is already full with other stuff…
  • Time Machine: I am not going to use it and waste an full external harddrive just for backups. However, I think its a great feature for normal users that do not want to intentionally backup their things…

The Downside
Some great programs that I was using on Tiger every day do not work anymore: SwitchResX and SofaControl. It’s interesting that Leopard broke them. It seems like Vista is not the only OS that breaks applications.

Posted in Apple | Leave a Comment »

Sun Certified Java Programmer

Posted by tine2k on October 21, 2007

I finally did it what I have been planning for so long. I took the certification test for SCJP (Sun Certified Java Programmer). I took me about 10 hours to prepare and about 4 to take the test. Even though I did not have to prepare much the questions can be quite tricky. You HAVE to know the syntax exactly. Every question that give you a code snippet (and thats quite many), will have a ‘Does not compile’ answer. So before considering any other answer, you have to play comiler and check the syntax. I guess that’s fair enough considering that you are about to become a Ceritified Programmer. Some concurrency and Generic question were quite tough as well. But all in all I did pretty well, 82% I believe.
I am already preparing for SCWCD (Sun Certified Web Component Developer) which I will do in November. So watch out world, I am coming :)

Posted in Java, Personal | Leave a Comment »

My new iMac

Posted by tine2k on September 12, 2007

It is finally here. My new baby. I have been waiting for it for months to be finally available. Always tracking down the latest news about new iMacs and waiting for the next key date to finally finalise my decision to move over to the Mac platform. Well, it’s done.

I have been working on my new iMac for 10 days and I am very satisfied over all. The computer is very silent; in fact I can not hear it, which is a big improvement over my former computer. Which, by the way, fulfils its duty now as my new email and file server in the next room.
The screen is just gorgeous. Very bright and pin sharp. I would always go for a glossy display, if I had the choice. You don’t have the choice with the new iMacs, which was one thing Apple was criticised for. But never mind, no harm done.
The processor does a very good job as well. Boy, is it fast! When I start Safari on my old iBook the icon bounces 5 times or so. On my new iMac, Safari is up and running before the icon finishes the first bounce :)
The new keyboard is fine. I am not too excited about that though. I had a great Coolermaster keyboard, which I replaced with the new mac one. The new mighty mouse however just sucks. I am happy I did not pay for it since it comes with every iMac with no additional costs. It’s an okay mouse if you use only the single button. But who does that anyway? The mighty mouse actually supports left, right and middle mouse button clicks. The problem is that I does not always work. If you leave you finger one the left side of the mouse, the mighty mouse does not detect a right or middle click. That can really annoying especially when you play DotA :) So, anyone wants to buy a “mighty” mouse from me?

Over all it is the best computer I ever bought. I has to be since it is also the most expensive computer I ever bought :) Well, but what the hack, luxury costs money, and that’s what Apple products are.

Posted in Apple, Personal | Leave a Comment »

10 things I love about Mac OS X

Posted by tine2k on June 5, 2007

I recently decided to go for a new iMac as soon as they come out. That will, so Steve will, at the end of June according to [1]. That means that I will switch my main computer to Mac OS X which is not a small step for a person like me that spends several hours a day in front of it. But the more I observ my own computer habbits the more I realise that I just do “normal people” stuff. I do not use any exotic software products and I do not use any strange hardware. I use a handful of programmes like an email client, a browser, a video player, a music player, an address book and a shell to connect to my Linux box. If I compare those programmes on a Mac with those that are available on Linux or Windows, the Mac ones just perform better. There are 10 simple reason why I chose to switch:

  1. iSync in combination with the Mac address book: I have never seen contacts syncronisation that works that well. I have tried 4 different phones so far and iSync just work sooo great. There is just no replacement for it on Windows (do not even mention ActiveSync!)
  2. Exposé: Window navigation at its best. On the mac it just does not matter how many windows are open. Spaces in Leopard will even extend the navigability.
  3. Adium X: There is just no replacement for that great program on Windows. Trillian is pretty close but Adium X just integrates a lot better (especially with the Mac address book).
  4. iTunes: What can I say, I just the best music player there is. However, the Windows version is dog slow. It not Windows’ fault but a good reason to switch :)
  5. Finder: Explorer vs Finder? Let’s not go into that :)
  6. Dashboard: I am not using it very much on my iBook because its pretty slow. I will however on my new iMac.
  7. Omnigraffle: That’s the one program I was impressed of when I used it for the first time. The usability is just great. I don’t think it has as many functions as Visio but one can get simple diagrams done a lot faster with Onmigraffle.
  8. Mac icons: Screw those tiny litte Windows icons. Especially as the screen resolutions increase…
  9. Leopard features: New features like Spaces and Time Machine are good reasons to switch.
  10. Drag and Drop: Mac OS X shows how Drag & Drop should really work. Makes sense since Apple invented it.

Those are the (first) 10 reasons at the top of my head. Hmmm, did I mention that Mac OS X is just beautiful? :)
To give Vista some credit: It is beautiful as well but after all, it still Windows – and you can feel it.

References:
[1] AppleInsider: new iMacs?

Posted in Apple | Leave a Comment »

Sudoku

Posted by tine2k on November 22, 2006

I wrote this little Sudoku app to try what Obj-C and XCode have to offer. It’s sweet.
Just mount it, run it, and have fun. Of course it’s in the very efficient Universal Binary format ;) I have not tried it on the new Macs. Let me know if there are some problems.

Download Sudoku

Download Source Files

Posted in OSS | Leave a Comment »

The whole IM mess

Posted by tine2k on September 17, 2006

I don’t really know when I opened my first instant messaging account. It was a loooong time ago and an ICQ account apparently. I think it was the first instant messenger ever. I can remember, at the beginning, ICQ client had only a window that closed immediately after you had sent a message. It felt more like sending e-mails back and forth rather than a chat. At that time it was easy to distinguish between “real” chat like IRC and ICQ. In one of the following version of the ICQ client, they introduced a chat-type interface where you could actually see what the opposite had written. Today, ICQ has many fancy things like games, video chat, and all other stuff. They completely lost perspective and developed all kinds of rubbish rather than focussing on the basic functionality of IM.
I started to use MSN last year when I came to England. It sooo much nicer than ICQ. Well, I am not talking about the client programmes but about the protocols. You can have a really nice and high resolution buddy icons on MSN, can enter new nicknames, which can be instantly seen by the other people. Changing your nickname on ICQ does not do anything. You can see the nickname in the profile but it does not change in your buddy list. Also the buddy icon is just tiny and sooo 90s. Why haven’t they done anything about that???
I really want to move to a better protocol and get rid of ICQ. The problem is that _all_ my friends in my country are using it. And nobody wants to switch because its working well enough even though MSN (or probably something else) is technically and functionally a lot better. It reminds me of the Windows vs. Mac OS X case. It’s just a shame!
So therefore, if you want to contact by IM, please use MSN! ;)

Posted in Internet | Leave a Comment »

Master Dissertation: Gene Expression Analysis with Fuzzy Logic

Posted by tine2k on September 17, 2006

Titel: Gene Expression Analysis with Fuzzy Logic
Type: Master Dissertation
Author: Martin Maier
Published on: 15-Sept-2006
Language: English

Abstract:
This paper documents the project about the development of a novel algorithm to analyse gene expression data. The algorithm is based on an existing approach that uses fuzzy logic and heuristic rules and adopts it for classificatory gene expression data. The algorithm forms gene triplets based on an activator-repressor-target gene model and evaluates how well the model is satisfied by forming error score and variance for the gene combinations observed. Samples class are taken into account by inverting the heuristic rules for the opposite class to observe networks that behave differently between two classes of samples.
The algorithm was implemented in form of a Java application; its development process is documented in this paper. The development incorporated a reverse engineering approach of an existing application that implements a similar algorithm. The application uses object-orientation and an extendable infrastructure to enable reuse and further development.
A comparison of the results produced to outcome of the same data with different methods did no show any significant similarities. However, the novel algorithm is based on a legitimate algorithm and reasonable extends it for the use of sample classes. Some observations could be made about the genes, which serve as input for further studies.

Download Paper

Download XGeneClient

Posted in Publications | Leave a Comment »

This year's Google Code Jam

Posted by tine2k on September 6, 2006

Today ends the qualification round for this years Google Code Jam 2006. Actually, there was Google Code Jam Europe that was this spring, which I missed unfortunately. However, I took part in the Google Code Jam in summer 2004. That was the time I was working for Austrian Nationalbank. I was really into Java at that time and tried to solve every problem programmatically I could find.
Since I have been programming the whole summer, I thought about participating in the Google Code Jam this summer, but I didn’t. I am wondering why I missed the one last year… Anyway, I took a look at the example problems and they are as they were two years ago. Really geeky problems wrapped in a ‘real-world’ description. If you have not programmed complex algorithms in some time it is quite hard to do it again just like that. So it would have taken me a day at least to train myself for it again, solve all the training problems, prepare code snippets and the IDE to be most time-effective and competitve. But I am very busy right now writing on my Master paper and the hand-in comes closer and closer (but I always have time to write a blog entry :) )
One thing that I noticed when I had a look at the training problems was that you have to use TopCoder’s interface for programming now. They provide a Java Web Start interface that you have to use to get the problems and submit the solutions. Two years ago I used eclipse and copy-pasted the code in the interface and submitted. You cannot do that now because they do not allow pasting in the field anymore. So you have either write off your code if you use an (external) IDE or use their text-editor that does not support any IDE-features. That sucks because programming in that text-field is not fun at all and that’s what participating in the Google Code Jam was all about.

Posted in Personal | Leave a Comment »

Closures for Java 7?

Posted by tine2k on August 29, 2006

I like closures. They have been really successful in dynamic languages like Python or Ruby. Neal Gafter proposed them to be a feature in Java 7 (formerly known as Dolphin). He worked out a proposal together with some guys at Sun including James Gosling. Closures in Java could be used like that: int(int) plus2b = (int x) {return x+2; };
So you can inject code instead of a value, which is pretty cool but nothing new. Of course you can solve the same thing using anonymous inner classes. In fact, closures might be realised as inner classes internally. So there won’t any performance to get out of it. At the same time I can not think of any reason why it should be more expensive. So, essentially, what it boils down to is a simple syntactical discussion whether it can be useful or not.
Let’s have a look at the cons: closures will make the source code more complicated to read since it is a new syntactical extension. The second question to ask is if we really need it because we can solve pretty much everything with inner classes anyway. I, personally, hate inner classes. Even though I can hide them in Eclipse they still annoy me just for being there :) In times like these where dynamic languages become more popular it is a nice sign to make Java a bit more dynamic. But we should not forget that it static approach made Java popular in the first place. I like pretty much everything that makes my code cleaner and better to read. That’s the reason why I still like the for-each loop that much. So I hope to see closures in Java 7 (in probably 2008). I can handle the slight increase of code compexity.

Posted in Java | 2 Comments »

Java and Open Source

Posted by tine2k on August 19, 2006

The promise to make Java open source has been out for a long time. I was pretty happy when I heard Sun’s ‘the question is how not if’-statement at JavaOne. Frankly, I was not at JavaOne but i saw the keynote and some other videos here. But I will go there eventually, maybe 2007 or 2008.

Quite recently Sun announced on LinuxWorld Conference that will make JME open source as well, which is obviously great. The best thing I find about this announcement was, however, that they will do by the end of 2006, which is incredibly soon! Hence, parts of Mustang will be open source; JavaC and Hotspot VM to be exact. So finally all the three editions will be OSS very soon. They have not announced what license is going to be used though. Since Glassfish is released under the ‘Cuddle’-Licence (CDDL – Community Development and Distribution License) it would be just reasonable when JSE gets the same license.

Whatever the license, Java being open source is just great. Sun has been a good keeper so far but we can all sleep better when we know that our Java is open and gives maximum freedom. As long as there are people in need of Java, there will be people developing it. OSS makes that possbile. Sun, thank you for that! Honour where honour is due.

Posted in Java | Leave a Comment »

Apple's Time Machine

Posted by tine2k on August 14, 2006

I just watched the keynote of this year’s WWDC. It always amazes me how innovative Apple is. The new Mac OS X release Leopard is going to be wicked! The new feature Time Machine alone is reason enough to get it when it’s released in Spring 2007. Time Machine is a build-in automated backup mechanism. It will automatically copy files or their changes to an external storage target which can be a server or another hard-drive. All the Apple programs will support this new feature which will make it possible to go ‘back in time’ within iPhoto, Address Book and all the others. It sort of reminds me of the ext3cow File System ;)

The first thing that crossed my mind is how much additional space you have to provide to backup all your data including your operation system. I reckon that only the differences of each file will be saved. However, if you change big files frequently (like video files) the demand of hard-disk space will be enormous. Well, I bet you can configure Time Machine just to backup parts of your hard-drive or specific folders.

Another thing that I was wondering about is if Time Machine backups instantly after a file has changed or if it just flags it and backups in time intervals. To really make sure that every version of a particular file is accessible, it actually has to be instantly. That makes me think how much (not if) it affects the performance of the operating system. Although the biggest part is transferring the file itself, the operation system still has to calculate the differences and index it in a way.

After all I think Time Machine is a great feature that will come in handy. It is features like that why I like Mac OS so much. Something like that won’t be included in Windows in the next ten years or so. After those ten years and after it has been successful on the Mac platform, they might implement it, call it ‘Microsoft Windows Auto Saveâ„¢’, and present it as something completely new. How can an operation system like Windows be that little innovative but still that popular?

Posted in Apple | Leave a Comment »

Mustang is going to rock!

Posted by tine2k on August 2, 2006

Finally I found the time to take a closer look at Mustang, the new release of the Java SE. After a quick and dirty evaluation, these are the features I like most:

  1. Web Services
    Now you can easily expose a POJO as a Web Service just by adding the @Webservice Tag to your class! After that you can deploy it to your app server OR use the Endpoint class, which is a small web server, that’s included in Mustang. :) I used some third party libraries in my previous projects, now it’s included in JSE. How much easier can it get?
  2. Rhino
    They integrated the JavaScript engine Rhino in Mustang. Everybody seems to get all crazy about scripting languages. I am still trying to stay low key about that. However, Java can now be combined with its own JavaScript engine and other languages like Groovy, Jython, Ruby, Beanshell etc. I am not 100% where the whole scripting languages thing is going, but it can be pretty helpful.
  3. GUI improvements
    They included Windows Vista support and introduced features to get Java closer to each operating system. Mustang provides classes that let you easily access default programs (like your default browser or email client) or put an icon into the systray. You have been able to do that before, however, Mustang introduces a standard and an easy way of doing it. Also, Swing is going to be a lot faster. The presentation at the JavaOne just rocked.
  4. Java DB
    Sun included a whole small memory based DBMS in Mustang. The Java DB is based on Cloudscape (great DB btw) which was given to the Apache Foundation by IBM about a year ago afaik.
  5. Compiler API
    You can now invoke the compiler from inside the code. So you can write a piece of code that writes code, compiles and runs by itself. A great way of producing infinite loops. Neat!
  6. Classpath Wildcards
    I always wanted that feature since I was running my first Java program on the command line: ‘java -cp lib/*’ Why did it take them that long?
  7. Pluggable Annotations
    That’s a nice thing too. Apparently framework vendors can define their own annotations and have core support for plugging in and executing the processors that do the heaving lifting that can make custom annotations so cool.
  8. Improved Management
    They did quite a lot to increase manageability with Mustang by introducing a new type of JMX Beans, called MXBean. To be honest, I have not done much with JMX yet but the new features sound pretty cool. I am going to try them as soon as I have time left.

References:

  1. http://java.sun.com/developer/technicalArticles/J2SE/Desktop/mustang/
  2. http://blogs.sun.com/roller/page/dannycoward?entry=the_10_things_you_need

Posted in Java | Leave a Comment »

What's the most and least sexy tech standard out there?

Posted by tine2k on July 31, 2006

There are many great ones out there. TCP/IP, HTTP, XML, Bittorent, … just to name a few. However, in the last couple of years there has been one that did quite a lot for society: RSS (RDF Site Summary)! Of course, it is used with HTTP and has the same request/response problems and the lack of state. But still, RSS offered a whole new way of distributing news over the web. The idea of making news feeds independent of their representation and puting them in a common format is great. People have been using RSS for so many things: At first it was just used for actual news sites which was great enough already. Also, the whole podcasting relies on RSS. Quite recently, Apple introduced their photocasting in iPhoto which uses RSS as well. Of course there is plenty to improve. A statefull way of distributing news would be even better. However, a stateful approach can never be as easy and straight forwards as RSS is now.

There are obviously many bad technolgies out there: FTP, Miranda, EJB-CMP, etc. Even more have become bad technolgies because they are used in a different way to what they have been designed for. One of the worst is SMB – the Server Message Blocks Protocol that MS Windows uses to share and access ressources on the network. SMB offers several thousand (!) types of messages that can be sent back and forth between client and server. If I had to redesign the protocol I would not see the need for more than… say.. 50. File creating, deletion, change attributes, moving files, and so on. Volker Lendecke of the Samba project said once that not even MS has documented all the features that SMB uses. That goes perfectly together with all the former MS developers saying what a huge organisational mess MS has in their developments.

However, MS has always been great in being backward compatible (or carrying relics, if you want to call it that way). Hence, we are going to continue to face SMB for even more years. Using it is not that much of a pain, however, I really have pity on the guys working on the SAMBA project. Keep up the good work, we love you!

Posted in Internet | Leave a Comment »

 
Follow

Get every new post delivered to your Inbox.