Archiv für Januar 2010

Top 10 Software Project Management Books

Mittwoch, 20. Januar 2010

Here is my personal Top 10 list of books about software project management:

  1. Making Things Happen
  2. The Deadline
  3. Software Project Survival Guide
  4. Peopleware
  5. Applied Software Project Management
  6. Death March
  7. Manage It!
  8. Waltzing With Bears
  9. Behind Closed Doors: Secrets of Great Management
  10. Manage Your Project Portfolio

Post to Twitter Tweet This Post

Top 10 Software Engineering Books

Mittwoch, 20. Januar 2010

Here is my personal Top 10 list of books about various topics of software engineering:

  1. The Mythical Man-Month
  2. Design Patterns
  3. Facts and Fallacies of Software Engineering
  4. Applying UML and Patterns
  5. Object-Oriented Software Construction
  6. Head First Design Patterns
  7. Patterns of Enterprise Application Architecture
  8. Domain-Driven Design
  9. Release It!
  10. Enterprise Integration Patterns

Post to Twitter Tweet This Post

Top 10 Programming Books

Dienstag, 19. Januar 2010

Here is my personal Top 10 list of books for computer programmers:

  1. Code Complete
  2. The Pragmatic Programmer: From Journeyman to Master
  3. Refactoring: Improving the Design of Existing Code
  4. Rapid Development
  5. Clean Code
  6. Working Effectively with Legacy Code
  7. Art of Computer Programming
  8. Programming Pearls (2nd Edition)
  9. The Productive Programmer
  10. The Practice of Programming

If you like this Top 10 list, I will create other lists of my favourite agile books and software engineering books.

Post to Twitter Tweet This Post

Develop web applications with IPhone Look and Feel

Montag, 18. Januar 2010

If you want to create applications for the IPhone but don’t want to go into the troubles with the ITunes Store or you are too lazy to learn Objective-C, there is another possibility: create a web application with a native IPhone Look and Feel.

For this purpose there exist some frameworks:

These frameworks fake the Look and Feel of an IPhone application by using CSS and JavaScript. The developer creates normal HTML lists and includes the framework, which does all the hard work. Following there are two pictures that show a music application developed with the frameworks iui (on the left) and iWebKit (on the right).

To hide the status bar of the Safari browser, add the following code to the HTML header:

<meta name="viewport" content="width=device-width; initial-scale=1.0;
               maximum-scale=1.0; user-scalable=0;"/>
<meta name="apple-touch-fullscreen" content="YES"/>

The web application can be placed on the IPhone start screen like a native app. The title of the HTML file is used as application name. The icon of the application can be set with the following code:

<link rel="apple-touch-icon" href="icon.png"/>

If you want to upload your web application to the ITunes Store, you should look at the following frameworks:

They allow the conversion of HTML pages into native IPhone apps.

Post to Twitter Tweet This Post

Make changes to an Android Package internally in Java

Donnerstag, 14. Januar 2010

We’re just finishing our new BlueID Client for Android devices. During the development I realized, that we need to rezip the BlueID software for Android because it must be personalized on the fly on download request. This is needed for security!

I found no tutorial explaining this content and it was a little bit tricky. If you like to make changes to an Android Package (file ending apk) internally in Java you need to do more than only unzip and zip again. I first tried to solve this by using the apkbuilder form the android-sdk tools, but it only works with file operations. I think I found a better solution.

First you need to include some libraries from the android-sdk tools lib folder into your project.

  • apkbuilder.jar
  • androidprefs.jar
  • jarutils.jar

Then you need to make your changes to your package with the standard ZipStreams from Java. After this, use the following method for rezip or sign the package correctly for Android phones.

public byte[] packApk(byte[] zip) throws Exception {

        DebugKeyProvider keyProvider = new DebugKeyProvider(null, null, null);
        PrivateKey key = keyProvider.getDebugKey();
        X509Certificate certificate = (X509Certificate) keyProvider.getCertificate();

        ByteArrayOutputStream bout = new ByteArrayOutputStream();

        SignedJarBuilder builder = new SignedJarBuilder(bout, key, certificate);
        builder.writeZip(new ByteArrayInputStream(zip), null);
        builder.close();

        return bout.toByteArray();
}

I hope this code will help you!

Regards, Julia Bory

Post to Twitter Tweet This Post

Spring und JAX-RS

Donnerstag, 14. Januar 2010

Dieser Artikel erläutert, wie man das Spring Framework zusammen mit dem JAX-RS-Provider Jersey einsetzen kann. Das Ziel soll sein, dass die Rest-Resourcen automatisch instantitiert werden und die benötigten Abhängigkeiten über Spring injiziert werden.

Dazu muss zuerst in der web.xml das Spring-Framework durch die Angabe zweier Listener und durch Festlegung der Spring-Konfigurationsdatei initialisiert werden. Außerdem muss ein spezielles SpringServlet eingebunden werden, dass die Rest-Anfragen an Jersey weiterleitet. Dieses Servlet liefert Jersey im Paket jersey-spring mit.

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/applicationContext.xml</param-value>
    </context-param>
    <listener>
        <listener-class>
           org.springframework.web.context.ContextLoaderListener
        </listener-class>
    </listener>
    <listener>
        <listener-class>
  org.springframework.web.context.request.RequestContextListener
        </listener-class>
    </listener>
    <servlet>
        <servlet-name>Jersey Spring Web Application</servlet-name>
        <servlet-class>
           com.sun.jersey.spi.spring.container.servlet.SpringServlet
        </servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>Jersey Spring Web Application</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>
</web-app>

In der Spring-Konfigurationsdatei ist nur ein Eintrag nötig. Mittels Component-Scan werden alle Rest-Resourcen gefunden, die mit der Annotation @Component markiert sind. Danach werden alle Beans definiert, die in die Rest-Resourcen-Klassen injiziert werden sollen (im Beispiel: testObject).

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="

http://www.springframework.org/schema/beans

http://www.springframework.org/schema/beans/spring-beans-2.5.xsd

http://www.springframework.org/schema/context

http://www.springframework.org/schema/context/spring-context-2.5.xsd">

    <context:component-scan base-package="de.baimos.blueid.test"/>

    <bean id="testObject" class="de.baimos.blueid.test.TestObject"/>
</beans>

Nachfolgend wir eine Rest-Resourcen-Klasse erstellt. Wie bereits erwähnt, muss diese mit der Annotation @Component ausgezeichnet werden, um vom Spring-Framework gefunden zu werden. Damit nicht bei jeder Anfrage ein neues Objekt erzeugt wird, wird der Scope auf Singleton gesetzt. Mit Hilfe der Annotation Path wird festgelegt unter welchen Pfad die Resource zu erreichen ist.

Schließlich wird eine Instanz von TestObject über die Annotation @Resource angefragt, die dann von Spring automatisch injiziert wird.

@Component
@Path("hello")
@Scope("singleton")
public class HelloWorld {

    @Resource
    private TestObject testObject;

    @GET
    public String sayHello( @QueryParam("name")String name){
           return testObject.sayHello(name);
    }

}

Post to Twitter Tweet This Post

Fun with Java Generics: A Fluent Map

Donnerstag, 14. Januar 2010

Are you sick of creating maps with all the redundant syntax like in the example below?

Map<Integer, String> map = new HashMap<Integer, String>();
map.put(1, "ONE");
map.put(2, "TWO");
map.put(3, "THREE");

With the usage of some advanced Java 5 features, we can make map creation simpler:

Map(
   o(1, "ONE"),
   o(2, "TWO"),
   o(3, "THREE"),
);

Too make this happen you need the class that is listed below. Just import the methods Map and o statically and then lets rock!

public class FluentMap {

    public static <K, V> Map<K, V> Map(Tuple<K, V>... entries) {
        Map<K, V> map = new HashMap<K, V>();

        for (Tuple<K, V> entry : entries) {
            map.put(entry.t1, entry.t2);
        }
        return map;
    }

    public static <T1, T2> Tuple<T1, T2> o(T1 o1, T2 o2) {
        return new Tuple<T1, T2>(o1, o2);
    }

    public static class Tuple<T1, T2> {
        private T1 t1;
        private T2 t2;

        public Tuple(T1 t1, T2 t2) {
            this.t1 = t1;
            this.t2 = t2;
        }
    }
}

The trick here is that Java supports type inference in static methods. That is why you don’t need to specify any type.

Post to Twitter Tweet This Post

Webapplikation mit IPhone Look and Feel

Donnerstag, 14. Januar 2010

Um die Komplikationen mit dem ITunes Store zu umgehen oder um sich die Einarbeitung in Objective-C zu sparen, empfiehlt es sich, eine Webapplikation mit IPhone Look and Feel zu entwickeln.

Für diesen Zweck gibt es bereits einige Frameworks. Dazu gehören:

Diese Frameworks bilden durch geschickten Einsatz von CSS und JavaScript eine native IPhone-Applikation nach. Die nachfolgenden zwei Bilder zeigen eine Musikapplikation die mit den Frameworks iui (links) und iWebKit (rechts) entwickelt wurde.

Um die Statusleisten des Browsers verschwinden zu lassen ist folgender Code im Header der HTML-Datei zu platzieren:

<meta name="viewport" content="width=device-width; initial-scale=1.0;
               maximum-scale=1.0; user-scalable=0;"/>
<meta name="apple-touch-fullscreen" content="YES"/>

Die Webapplikation lässt sich, wie eine native Anwendung auch, auf den Startscreen des IPhones ziehen. Als Applikationsname wird der in der HTML-Datei festgelegt Titel verwendet. Das Icon kann man durch folgenden Code im Header setzen.

<link rel="apple-touch-icon" href="icon.png"/>

Wer seine Webapplikationen  in den ITunes Store hochladen will, sollte sich folgende Frameworks ansehen.

Diese erlauben nämlich die Umwandlung von HTML-Seiten in native IPhone-Applikationen.

Post to Twitter Tweet This Post