Java Bean Getters/Setters

Many Java developers think they know everything about Java Beans and the correct getter/setter styles, but there are some hidden traps 😉

Let’s do a little quiz!

How should the correct and getter/setter for a property with the following field look like?

private String name;

This is an easy one:

public String getName() {
  return name;
}

public void setName(String name) {
  this.name = name;
}

Notice that the first letter of the field was made uppercase.

Read more →

Deutsche Telekom erdrosselt Internet

Wenn ich so lese was die Deutsche Telekom mit ihren beschrĂ€nkten neuen Tarifen so plant wird mir ganz heiß. Da fĂ€llt es mir schwer die richtigen Worte zu finden. Es zeigt einfach wieder, dass sich beim Thema “Internetanbindung” alles in die falsche Richtung entwickelt - die Anbindungen werden eher schlechter als besser. Ich habe ja hier schon des öfteren darĂŒber geschrieben in welcher Situation ich mich selbst hier in Österreich befinde, aber zumindest kann ich mit meiner zur VerfĂŒgung stehenden Bandbreite noch machen was ich will.

Read more →

A fresh start

Today I deleted my blog - not intentionally, it happened. I tried to upgrade MySQL from 5.1 to 5.5, it did not work as expected. I tried varios things and somewhere in between I issued the wrong rm command. I deleted both the backup directory and the tgz of the mysql database directory I made before the update.

After a short heat flash I thought: ok, know I have to import the database again from the SQL dump I have on my Amazon S3. A script copies it there every night. After extracting the tgz from S3 I was shocked that the sql file had a zero byte file size. It turned out that the backup script used an old password for the mysqldump command so it was not able to backup for over a year and I do not have any older backup file.

Read more →

Signing Android APK files under JDK7

We are using maven to build our Android applications in Jenkins for testing and for publishing them to the Play Store. Recently I started to have problems with the Play Store saying that the APK files were not signed or not aligned so I upgraded the Android Maven plugin and adapted the pom.xml files. Finally I was able to submit the signed and aligned APK files again to the Play Store – everything fine again, at least I thought so.

Read more →

Spannende Wochen fĂŒr RIM

Es sind spannende Wochen, die da auf RIM zukommen. In den nĂ€chsten Tagen wird RIM ihr neues Betriebssystem BlackBerry 10 und ihre neuen BlackBerry GerĂ€te vorstellen. Die Neuvorstellung reprĂ€sentiert fĂŒr RIM und die Marke BlackBerry quasi einen Neustart in vielerlei Hinsicht.

Das neue Betriebssystem basiert auf QNX, wie bereits das System das auf dem Playbook gelaufen ist. RIM hat das Playbook OS allerdings sehr viel weiter entwickelt, und in BlackBerry 10 wieder die gesamten Funktionen eingebaut, fĂŒr die BlackBerry bekannt wurde (Synchronisierung von Mail, Kalendar, Kontakten, Todo’s usw.) plus ein paar zusĂ€tzlicher Funktionen (z.B. Balance fĂŒr Work/Private Trennung). Komplett neues Betriebssystem heisst, dass sich alles ziemlich “fluffig” anfĂŒhlt – Ă€hnlich wie bei iOS und Windows Phone ist das UI fast verzögerungsfrei, ruckelt nicht und alles ist schön animiert. Komplett neu heisst aber auch, dass sĂ€mtliche Anwendungen, die es bisher fĂŒr BlackBerry gab, neu fĂŒr BlackBerry 10 geschrieben werden mĂŒssen bzw. portiert werden mĂŒssen.

Read more →

What to ignore

With the latest improvements we made at troii to our development workflow, we discussed what should be committed to a source code repository and what files should be ignored. We already had the rule in place, that nothing should be put into the repository, that is generated from other sources (typically .class files, .war, .jar, 
) – this rule is very common and agreed by almost every developer.

How to handle another set of files usually leads to a lot of discussion: IDE settings, e.g. Eclipse .settings, .project, .classpath or IDEA IntelliJ .iml and .idea directory). Up until a year ago we mainly used Eclipse and I used to store the IDE configuration files in the repository. With switching to IntelliJ and working more with git branches, I startet to think about this again, because I had the feeling that those settings files changed more frequently.

Read more →

Kundenservice – Media Markt vs. Amazon

Ich hatte beim Kauf unserer DVB Sat Receiver kein GlĂŒck. FĂŒrs Wohnzimmer habe ich einen Kathrein UFS 922 bei Amazon gekauft (mit eingebauter 500 GB Festplatte fĂŒr Timeshift und Aufnahmen) – Preis im November 2011 402,- EUR. FĂŒr das Schlafzimmer genĂŒgte ein einfacher Receiver ohne Aufnahmefunktion. Ich bin einfach in den Media Markt gegangen und habe den gĂŒnstigsten Receiver mit UnterstĂŒtzung fĂŒr die ORF Smart Card gekauft – Marke Top Field, Preis 119,- EUR im JĂ€nner 2012.

Read more →

akostart meetup

Heute Abend war ich beim akostart meetup in der Humboldtstraße in Linz. Die Beschreibung des akostart meetups aus dem facebook-event-about:

Die Akostart Meetups sind regelmĂ€ĂŸige Treffen von GrĂŒndern und GrĂŒndungsinteressierten zum Informationsaustausch. Die ungezwungene Umgebung im Coworking Space schafft die optimalen Voraussetzungen zum PrĂ€sentieren, Diskutieren und Zuhören. Spannende Ideen, BusinessplĂ€ne, ImpulsvortrĂ€ge und Lessons-Learned stehen im Vordergrund. SelbstverstĂ€ndlich darf das Netzwerken nicht zu kurz kommen.

Ich bin wieder mal begeistert von den AktivitĂ€ten, die in letzter Zeit, im linzer Raum, in der Kreativwirtschaft stattfinden! Nachdem heuer das Technologieplauscherl gestartet ist und das Cocoaheads Chapter Linz die ersten Treffen durchgefĂŒhrt hat zeigt sich wieder mal, was fĂŒr eine super Location Linz fĂŒr Software Entwicklung ist.

Read more →

Sort algorithm changes in Java 7

I just got the info from one of out customers that an error in the export function of a Grails application happend. The stacktrace looked like:

Error Details

Error 500: Executing action [export] of controller [ExportController] caused exception: Runtime error executing action
Servlet: grails
URI: /app/grails/export/export.dispatch
Exception Message: Comparison method violates its general contract!
Caused by: Comparison method violates its general contract!
Class: ExportPrintController
At Line: [105]
Code Snippet:
Stack Trace

java.lang.IllegalArgumentException: Comparison method violates its general contract!
at java.util.TimSort.mergeHi(TimSort.java:868)
at java.util.TimSort.mergeAt(TimSort.java:485)
at java.util.TimSort.mergeCollapse(TimSort.java:408)
at java.util.TimSort.sort(TimSort.java:214)
at java.util.TimSort.sort(TimSort.java:173)
at java.util.Arrays.sort(Arrays.java:659)
at java.util.Collections.sort(Collections.java:217)
at com.troii.app.web.ExportController$_closure2.doCall(ExportController.groovy:105)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)

I did some web search and came up with this interesting discussion on stackoverflow. Which links to the compatibility information page of JDK7 and a specific change they made in Java 7: changing the default sort algorithm from MergeSort to TimSort in the java.util.Arrays.sort method.

Read more →

Technologieplauscherl am 22.11.2012 bei netural

Ich war heute endlich wieder mal auf einem Technologieplauscherl. Das hat heute in den RĂ€umlichkeiten von netural stattgefunden – vielen Dank dafĂŒr, die Verpflegung war erstklassig! (Gösser Radler und Brötchen von Jindrak)

Beim heutigen Plauscherl handelte es sich um eine “Book Edition!” – Hauptthema waren also BĂŒcher.

Als Ausreisser aus der “Book Edition” hat Bernhard Wurm TypeScript demonstriert – eine interessante Sprache von Microsoft die nach (tatsĂ€chlich schönem, lesbaren) JavaScript compiliert wird. Aus dieser PrĂ€sentation ist eine ganz interessante Diskussion ĂŒber Sprachen mit Ă€hnlichen AnsĂ€tzen entstanden, wie zB CofeeScript und Dart.

Read more →