I’s been a while since I have written my last blog post. Mostly because I have been busy with Zero2Hero which I have co-founded in fall last year. Zero2Hero is offering the coolest trainings on hot technologies. You can checkout the current offerings at http://www.zero2hero.at.
At the moment we are preparing some Git workshops - we have been able to engage Tim Berglund, a well known GitHubber. Registration has already started.
- Git Beginners
- Git Advanced
In the past months we started a series of workhops around Groovy technologies. So we had started out with Groovy (with Dierk König, Canoo), did Gradle (with Peter Niederwieser, Gradleware). In Fall this year we should finalize this series with a Grails training.
Create a Amazon S3 bucket
Using the Amazon Console create a S3 bucket. Use your domain name (e.g. www.domain.tld) to name the bucket. Open the properties panel, switch to the Website tab, enable hosting of static web sites. Next go back to the permissions tab and click Edit bucket policy
1 2 3 4 5 6 7 8 9 10 11 12 13 14
Create a CNAME record with for your domain
The CNAME target is printed on the Amazon bucket properties panel, Website panel (bottom of panel).
Add the following line to the end of your
.bashrc file (be sure to edit your user name).
1 2 3
rvm install 1.9.3
1 2 3 4 5 6
Yesterday I had to move a few files from a Git repository A to repository B while working on a client’s project. Today I had to do it again on another project. Again I had to think about the sequence of commands I had used. For this reason I’m posting this here.
Prepare repository A (the source)
1 2 3 4 5 6 7 8 9 10
In line #1 we clone the source repository so we can’t break the original one, we also remove the remote in line #4 so no links back to the source repository exist. Next using the filter-branch command we filter out everything but the directory we want to keep. Pull files to new repository
1 2 3 4 5
For the past 18 months I have been utilizing hades for implementing JPA based repositories/DAOs. Hades has now been moved into the Spring Data JPA project. Starting with their 1.0.1 release I tried migrating one of my projects to this release. Following I document the steps that were necessary to achieve this.
Their project page starts off with showing the Maven repositories and dependency descriptors (in case you are using Maven). Obviously the first thing is to replace the hades artifact by the spring-data-jpa artifact.
The project’s domain classes implement the
org.synyx.hades.domain.Persistable interface which has to be replaced by
org.springframework.data.domain.Persistable (takes a single generics parameter for the id type).
DAO interfaces extending
org.synyx.hades.dao.GenericDao have to be modified to extend
org.springframework.data.repository.CrudRepository. With this modification you will face a couple of compile problems.
read*-methods have been renamed to
find*-methods. Also you are loosing the paging and sorting capable
find* - methods (which I didn’t use). If those are required then extend the
find* - methods now return iterables rather than list types requiring minor adjustments to existing codebase. To get around this, the interface can also extend from
JpaRepository. Using this base interface hands you a pretty powerful DAO that goes far beyond a simple CRUD repository.
When I started off with hades many month ago I used an explicit XML-based configuration of DAO components.
For migration the factory bean class has to be changed:
With these changes in place all tests were showing the green bar again. However, today I would recommend using repository namespace http://www.springframework.org/schema/data/jpa which significantly reduces the amount of configuration needed by utilizing class path scanning to detect repository components.
Certainly you might encounter more steps during migration depending on the features you have used from the old hades code base. In my case I only had used named JPA queries which just continued to work like before.
What a shame I haven’t published anything for a long time. To make up for this long pause, I’m going to discuss how Spring can support with analyzing class metadata. These days everybody is crazy about using annotations in their frameworks. Occasionally you need to know what classes/methods are annotated. A good example might be to build a list of class names for all JPA entities (those classes annotated with javax.persistence.Entity and the like).
A simple use-case showing how to detect classes annotated as components
This use-case is using a few Spring APIs and some home grown code that controls resource matching (ClassResourceResolver and AnnotationMetadataMatcher).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
ClassResourceResolver is doing the resource matching all from a set of resource paths
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
A ClassResourceMetadataMatcher is looking at the annotations present on a class resource
1 2 3 4 5 6 7 8 9 10 11
Under the hood Spring is using the ASM bytecode library for looking into the class files. Note that no class examined by the code above is actually loading any of the class objects so it is fairly lightweight and not filling up your perm gen space. Still you need to make up useful search paths so you don’t end up scanning through the full classpath.
Subversion, das wohl immer noch am weitesten verbreitete SCM im Java-Bereich, muss sich in letzter Zeit einige Kritik gefallen lassen. Tatsächlich häufen sich die Anzeichen, dass die Konkurrenten aus dem Lager der verteilten Systeme immer mehr an Popularität gewinnen. So wechseln immer mehr Projekte auf das verteilte Versionsmanagementsystem (DVCS) Git.Ist das nur ein temporärer Hype oder eine technologische ®Evolution?
Am 4.Mai 2011 gibt es erstmals in Österreich einen Git Workshop mit Matthew McCullough (offizieller GitHub Trainer) und somit eine einmalige Gelegenheit zu erfahren was denn hinter dem Erfolg von Git steckt.
- mit Matthew McCullough
- am 4. Mai 2011, von 9:00-16:30
- Spitz Hotel - Raum “Round Table 2”, Fiedlerstrasse 6, 4040 Linz, http://www.spitzhotel.at
- Trainingsprogramm (Broschüre)
- €330,00 (zuzüglich Mwst.)
Anmeldung per EMail (mit Name und Adresse des anzumeldenden Teilnehmers) an email@example.com. Zum Workshop in Englisch werden maximal 20 Teilnehmer zugelassen, ein eigener Laptop ist mitzunehmen.
Anmeldung von Gruppen ab 3 Personen zu ermäßigtem Preis auf Anfrage. Im Preis enthalten sind Getränke sowie ein Brötchenbuffet zu Mittag! Ermäßigtes Parken in der Hoteltiefgarage ist möglich.
Matthew McCullough’s Bio Matthew McCullough is an energetic 15 year veteran of enterprise software development, world-traveling open source educator, and co-founder of Ambient Ideas, LLC, a US consultancy. Matthew currently is a trainer for GitHub.com, author of the Git Master Class series for O’Reilly, speaker on the No Fluff Just Stuff tour, author of three of the top 10 DZone RefCards, including the Git RefCard, and President of the Denver Open Source Users Group. His current topics of research center around project automation: build tools (Maven, Leiningen, Gradle), distributed version control (Git), Continuous Integration (Hudson) and Quality Metrics (Sonar).
We all have learned that it is not wise to overuse static methods as these are kind of hard to test and deal with. So in general I strive to get out of their way. Sometimes I’m facing the situation that the use of a framework or that some technical infrastructure requires me to implement static methods. So for testing I found PowerMock which nicely integrates with EasyMock and Mockito.