Where does this go!

September 9th, 2009

In April 2007 I quit my job as software architect at Sony. I liked the job there but I felt that it is time to start something new. My first project was a web shop and remote charging interface for an audion digitization software (AudioInspector). It’s a pretty cool project and I still do maintenance work for the team. After a month in China for Android development I decided to join the team of Netociety as CTO in January 2008.

Netociety started with reselling and customization of Atlassian’s Confluence and Jira products. In early 2008 we decided to build our own wiki based social software. In May 2009 we finished version 1.0 of the software and it is already used by quite some projects in UK and Austria. Even if our collaboration software has unique features none of the competitors has it is more difficult to explain and sell than expected. Anyway the progress is very good and our team has enough to do to execute the customer projects.

About a year ago (in summer 2008) I met Philipp and we talked about ideas for an application for the Google Android Challenge (ADC). He really created it, submitted the software to ADC and was in the top 50. Wikitude, an augmented reality (AR) browser for the Android phone was born. This summer we decided to closer work together and I joined the team of Mobilizy as project manager. Basically I do more than traditional project management, I created the Wikitude.me web interface, help with software and system architecture, write specifications and manage tasks and resources as well.

But this is not the only initiative. Last month I had a weekend free, so I decided to try out the Java version of Google AppEngine. It was on my list for quite some time but I never had the time for it. When starting with a simple application it quickly turned out that this is a brilliant application. I personally think such an idea you only have once in your live. It’s simple, the first version can be built in less than 2 weeks, has a simple business model, does not require initial investment, and has the potential to grow and grow and grow. I finish and launch version 1.0 quite soon. You will be surprised.

Anyway, three very interesting projects I’m involved and I’m really looking forward to 2010 and see which of the projects is successful at the end.

Lucene Analyzer, Tokenizer and TokenFilter

June 26th, 2008

Lucene is a very powerful and widely used search framework, and I heavily use it for the Web 2.0 product I currently create together with netoCiety. In this post I explain Lucene Analyzer, Tokenizer and TokenFilter. What they are and how you can create your custom Analyzer. Additionally I show you how to create an Analyzer for HTML documents and discuss Analyzers for different languages.

When you create a search index, you have documents with fields that contain text. For instance if you create an index of HTML documents the fields can be the title, description and body of the HTML page. In the index you don’t store the entire text but separate tokens of the text. For instance let’s take the text “This is a test”. When adding this text to the index only the separate words (tokens) are stored in the index. This split of text in tokens is handled by the Analyzer. For instance using the WhitespaceAnalyzer on the test text above results in the following index structure.

luke-1.png

For browsing the search index I use Luke. In the table in the bottom right corner you see the individual tokens.

Usually the Analyzer first builds a Tokenizer which breaks the entire text string into raw tokens, and then one or more TokenFilters are applied to the output of the Tokenizer. To demonstrate this let’s create a simple Analyzer that first builds a StandardTokenizer that splits the text at white space characters. Then apply a LengthTokenFilter that filters out tokens with a length less than 3 characters. Additionally apply a LowerCaseFilter to store all tokens in lower case. The final result will create the following index of the previous example.

luke-2.png

As you can see the tokens “a” and “is” that have a length less than 3 are ignored, and the term “this” has changed to lower case.

Now let’s have a look at the CustomAnalyzer class:

public class CustomAnalyzer extends Analyzer {
    public TokenStream reusableTokenStream(
        String fieldName, Reader reader) throws IOException {

        SavedStreams streams =
            (SavedStreams) getPreviousTokenStream();

        if (streams == null) {
            streams = new SavedStreams();
            setPreviousTokenStream(streams);

            streams.tokenizer = new StandardTokenizer(reader);
            streams.stream = new StandardFilter(streams.tokenizer);
            streams.stream = new LengthTokenFilter(streams.stream, 3);
            streams.stream = new LowerCaseFilter(streams.stream);
        } else {
            streams.tokenizer.reset(reader);
        }

        return streams.stream;
    }

    private class SavedStreams {
        Tokenizer tokenizer;
        TokenStream stream;
    }

    public TokenStream tokenStream(
        String fieldName, Reader reader) {

        Tokenizer tokenizer = new StandardTokenizer(reader);
        TokenStream stream = new StandardFilter(tokenizer);
        TokenStream stream = new LengthTokenFilter(stream, 3);
        stream = new LowerCaseFilter(stream);

        return stream;
    }
}

For performance reasons Lucene tries to re-use as much as possible. This is why it is important to implement the reusableTokenStream method. Lucene programmers usually use a private class to save the TokenStreams. Important is the part where a StandardTokenizer is created and then passed to the StandardFilter, LengthTokenFilter and LowerCaseFilter.

I don’t show you the implementation of the Tokenizer because usually you first use the StandardTokenizer and then apply one or more filters.

Now let’s have a look at the LengthTokenFilter:

public class LengthTokenFilter extends TokenFilter {
    private int minLength;

    protected LengthTokenFilter(
        TokenStream input, int minLength) {

        super(input);
        this.minLength = minLength;
    }

    public Token next(Token result)
        throws IOException {

        while ((result = input.next(result)) != null) {
            if (result.termLength() >= minLength) {
                return result;
            }
        }

        return null;
    }
}

The method “next” has to return the next token. Therefore the it checks if the length of the token is greater or equal the minimum length. If so it returns the token, otherwise it checks the next token.

To test the functionality I simply created a simple test class that creates the index with the CustomAnalyzer:

public class AnalyzerTest {
    public static void main(String[] args)
        throws CorruptIndexException,
        LockObtainFailedException, IOException {

        File tmpDir = new File(
            System.getProperty("java.io.tmpdir"));
        File indexDir = new File(tmpDir, "idx");

        IndexWriter indexWriter = new IndexWriter(
            indexDir, new CustomAnalyzer());
        indexWriter.addDocument(getDocument());
        indexWriter.close();
    }

    private static Document getDocument() {
        String text = "This is a test";

        Document document = new Document();
        document.add(new Field("text", text,
            Field.Store.YES,
            Field.Index.TOKENIZED));

        return document;
    }
}

So now we have covered Analyzer, Tokenizer and TokenFilter, and I think it is pretty clear how they work and how to create a custom Analyzer. But quite often you don’t want to index normal text but HTML text. Let’s try to index the following simple HTML with the CustomAnalyzer created above.

<html>
<head>
    <title>Lucene Test</title>
</head>
<body>
    <h1>Lucene Test</h1>
    <p>Simple HTML document</p>
</body>
</html>

The index created looks like this.

luke-3.png

As you can see not only the text is indexed but also the tags. But this does not make sense because you will never search for the “body” tag when performing a search. Luckily the Solr team created a HTMLStripReader that simply wraps a Reader and ignores HTML tags. Now you are able to create a HtmlTokenizer that extends StandardTokenizer and replace the StandardTokenizer in the CustomAnalyzer we created above. The HtmlTokenizer looks like this:

public class HtmlTokenizer extends StandardTokenizer {
    public HtmlTokenizer(Reader input) {
        super(new HTMLStripReader(input));
    }
}

Then you have the output you wanted:

luke-4.png

The last topic I discuss are Analyzers for different languages. These kind of Analyzers not only split the text into tokens but also use stemming to return the base form of a word. Wikipedia writes about stemming: “… Stemming is the process for reducing inflected (or sometimes derived) words to their stem, base or root form – generally a written word form. … A stemming algorithm reduces the words “fishing”, “fished”, “fish”, and “fisher” to the root word, “fish”. …

Lucene provides some Analyzers for specific languages like the GermanAnyalyzer or FrenchAnalyzer, but more interesting is the SnowballAnalyzer which is based on Snowball, a framework for writing stemming algorithms.

The only thing you have to be aware when using Analyzers that use stemming is that the index only stores the base words. For instance if a text contains the word “fishing” the stemming process reduces it to “fish”, and only “fish” is then stored in the index. Now when you search for “fishing” you first have to convert the word to its base word “fish”, otherwise you wont find anything. Therefore the search terms are usually tokenzied with the same Analyzer initially used to create the index.

Mac OSX (Leopard) 10.5.3 Update Hangs at “Configure the Installation”

June 10th, 2008

Just tried to update Mac OSX (Leopard) on my MacBook Pro to 10.5.3. It started with the installation process, but the installation hangs at “Configure the Installation”.

Solution that worked for me: Skip the installation process and reboot. Download the update from the Mac OS X 10.5.3 Combo Update page and manual install the 10.5.3 update.

Multi Core Processors, Scalability, Devices with always-on Broadband Access - Some of the Future Programming Challenges

June 6th, 2008

What are the future technology trends and what impact will they have for us programmers? Here are my thoughts on this.

From my point of view there are 3 major changes that will influence technology dramatically:

  • Multi core processors and parallel programming will become standard
  • Many more devices will have broadband Internet access, not only computers and mobile phones
  • This results in increased scalability requirements for Internet services

As everybody already realized, the clock rate of the processors in our computers don’t increase anymore. Instead there are dual core and quad core chips at the moment. There is a trend to put more and more processors on one chip.  It will not take long time and there are 32, 64, 128 or a few years later thousands and millions of processors on one single chip. The biggest problem with this trend is, that the software is not written for supporting multiple processors. Currently people say that you benefit from dual or quad core in a way that you can run several applications in parallel. But even when you can spread individual threads of you application across several processors, you hit a point where hundreds of processors are unused. I’m pretty sure that in the future - we as software developers - have to program for parallelism in mind. Currently most of the programming languages don’t have parallel concepts built into the language. Erlang is probably the most prominent exception. Parallel computing is very difficult, but not a new topic, so there already exists a lot of experience, concepts and solutions.

Secondly broadband Internet access will be available for every device everywhere. I don’t care if it is 4G, 5G, WLAN extrem or LAN, fact is the network bandwidth is there. And with broadband Internet access I mean a bandwidth that enables you to stream video on demand to any device. Chips will be available that manufacturers of different kind of products will have Internet access built into their products. Can you imagine the possibilities?

These two trends result in new scalability requirements of the services, because many more clients request information. Traditional 3-tier-architectures with web server layer, application server layer and database layer only scale to a certain extend. I assume that many of those services will be replaced by new highly scalable solutions similar to Google AppEngine and Amazon Elastic Compute Cloud (Amazon EC2).

Now let’s have a look at some existing programming languages and how they eventually support those new trends. I’m an extensive Java user, but not always very happy with the language and especially with the J2SE standard libraries. Java definitely will improve the support for multi core servers as they always mention, but I doubt that it will have language level support for other parallel computing techniques like map/reduce. Currently there are other programming languages that get more and more popular then traditional Java, C++, or C#. Two of them are the scripting languages Ruby and Python. From my point of view they are quite similar but I prefer Python, not because I think it is the better language. It’s just because it is used and supported by Google and they have a really dominant role. Additionally Python has native support of the map/reduce concept and is the major technology behind Google’s AppEngine. I also believe that Python will play an important role for scalable web applications and parallel computing. Erlang is another interesting language with a strong support of concurrent and distributed programming. I don’t think that a functional programming language will be a huge success. It’s just not the way people normally think and structure tasks. I remember the time at the university where I had to learn Lisp. For some problems you can write really elegant programs but I didn’t continue to use it later. A few years ago PHP/MySQL was the number one web technology out there, but I think it will loose attraction. This combination is just not made for the requirements in the future. Microsoft is an own story. It will still be an important company with a big community, but will continuously loose to be important. There are many other interesting programming languages like Scala, but none convinced me to be the future language.

Conclusion, people like scripting languages, and prefer short code and quick results over strong typing and complex syntax. But I did not find the perfect programming language yet, so there is probably a good time to invent something new.

Another important aspect of the new parallelism concept is data. I’m pretty sure most of the DBA’s disagree, but traditional databases are often not the right tool for many problems. First of all databases don’t scale well, and are simply too complex for storing simple data. The whole object relational (O/R) mapping topic is a disaster. Of course, databases have its place and will have its place in the future, but you can already see some alternatives like Google bigtable, Amazon S3 or Hbase.

The iPhone and Google Android already showed it. New devices and new input methods will come up. But not only PC’s and mobile phones with Internet access will exist, also many other new devices and products. The biggest problem at the moment is, that there is no platform, operating system, programming language and environment on the market that enables those device manufacturers to create new products very easy. Google Android is an exception, and enables companies to create custom applications quite easy. But currently it is only available for mobile phones with a well-defined specification.

My Vision

I believe right now it is a perfect time for a new operating system, programming language and environment, and I would have so many innovative ideas for it. Here are some of ideas for the operating system:

  • It has to be secure by design
  • Support concurrent and distributed computing concepts
  • Network enabled
  • Can be used on servers, desktops, mobile phones and many other devices
  • Supports different output and input methods

Probably many will argue that it is very difficult for people to accept a new operating system and new concepts. Additionally how do you get companies to write applications for the new operating system with the new programming language? Can you remember, Steve Jobs had a brilliant computer and environment with NeXT. Years ahead of Windows, Unix and Mac but also failed.

I think the situation has changed dramatically. My vision is that you don’t need such a big operating system like Windows Vista bundled with its thousands of applications. The only thing that is required is a web browser with some extended functionality. I think this is enough as a desktop replacement. Combined with some new ways for input and output like on the iPhone, but for the desktop, it would be perfect.
Applications you would get with this concept:

  • Email (e.g. Google Mail, Yahoo! Mail, Hotmail, …)
  • Calendar (e.g. Google Calendar, …)
  • Office (e.g. Google Docs and Spreadsheet, …)
  • Project management tools (e.g. Mingle, Jira, Confluence, …)
  • Messaging (e.g. Google Talk, …)
  • Programming environments (e.g. Heroku, …)
  • And many many more

I have so many ideas for a future operating system, programming environment, device support. If I would have the time, money, people and resources I would start this project immediately.

Lucene Sort and Filter

May 23rd, 2008

Apache Lucene is a great search technology. Usually you perform searches on a search index, and you try to optimize the ranking of the results. But sometimes you would like to simply sort the result by one field like a date.

Let’s discuss the following use case: You maintain a search index of HTML documents, each time you create or update a page an update of the search index will be automatically triggered. Additionally you would like to store the history of the indexed documents in the index. The search index may consist of the following fields:

  • id
  • page
  • body
  • updated
  • version
  • live

The following table shows a snapshot of the index. The columns are the fields, and each row of the table represents one document of the Lucene index.

lucene.png

  • id identifies each individual document and is always required with a Lucene index.
  • page identifies each HTML page that is indexed.
  • body is the text of the HTML page, normal searches search terms in this field.
  • updated is the date of the last update, represented as long value
  • version stores a version history of the indexed pages
  • live is just a field that marks the actual version of a page. This helps to filter the actual page documents.

Now I would like to list the latest updated pages. This can be easily done with a search on the search index via sorting reverse on the field “updated”. Additionally I want to filter out only pages that are live, because otherwise the about.html page will be displayed twice.

...

Searcher searcher = new IndexSearcher(indexPath);

Query query = new MatchAllDocsQuery();
Filter filter = new LiveFilter();
Sort sort = new Sort("updated", true);

Hits hits = searcher.search(query, filter, sort);

...

First get a Lucene searcher of a search index. For the query we would like to return all documents in this case. Additionally filter out only documents with the field live equals Y, and sort by the field updated in reverse order. Be aware, the sorted field (in this case “updated”) must not be tokenized.

The LiveFilter class looks like this:

public class LiveFilter extends Filter {
    public BitSet bits(IndexReader reader)
        throws IOException {

        BitSet bitSet = new BitSet(reader.maxDoc());

        Term term = new Term("live", "Y");
        TermDocs docs = reader.termDocs(term);

        while (docs.next()) {
            bitSet.set(docs.doc());
        }

        return bitSet;
    }
}

Learning the Yahoo! User Interface Library

May 15th, 2008

An important part of my recent project is an interactive web based user interface that meets the latest usability requirements and technology. Therefore I have to use DHTML, JavaScript, HTML and CSS. Because of the different behavior of current web browsers I decided to use one of the existing JavaScript libraries. After evaluating several of them I decided to go with the Yahoo! User Interface (YUI) library. Even if the YUI online documentation is brilliant and reading the YUI source code is relatively easy, I like to read a book as well. This post outlines my experience with the recently published book: “Learning the Yahoo! User Interface Library” by Dan Wellman.

The book is structured into a short introduction to YUI, and several chapters each covering the different utilities and controls of the library. The structure of the chapters is always quite similar. First there is a detailed explanation of the component and for what it might be used. Later in the chapter the power of the utility or control is demonstrated on a good  example which he describes very detailed. Dan did a very good job on selecting practical examples that find the balance between being not too simple, but on the other hand are not too complex to follow.

You will find examples for almost all YUI controls like with calendar, button, tree view, auto complete but also utilities like animation, connection manager and browser history manager. Unfortunately Dan did not cover any beta widgets in his book. I understand his decision, but there are some very interesting beta components in the YUI library like the rich text editor, resize and data table. I know that the APIs of the beta components are not stable and may change, but he could have added a chapter covering some of the most interesting beta development.

In the book Dan mentions that he assumes that the reader of the book already knows JavaScript, HTML and CSS. You don’t find any section in the book teaching you about the JavaScript language or the other technologies. Therefore if you are new to JavaScript and the YUI library you need an additional source to learn JavaScript. Unfortunately there is no good book out there that I can recommend. Maybe the new book from Douglas Crockford, “JavaScript: The Good Parts” is the JavaScript learning book everyone already has waited for.

Conclusion: Dan did an excellent job explaining the YUI library on very practical examples. If you plan to use the YUI library for one of your projects, I can recommend this book as an addition to the excellent YUI online documentation. But this book requires that you already know JavaScript, or that you learn JavaScript from a different source.

Getting Started: JavaScript and the Yahoo! User Interface (YUI) Library

March 5th, 2008

For my current open source project I have to create a JavaScript application that runs in all major web browsers. Until now I spent most of my time to develop Java applications on the server side. And if I did some JavaScript I just copied an existing example and modified it to my specific needs. So it was really cool to have a reason to learn about JavaScript, its libraries and possibilities ;-) Here I want to share my experiences with JavaScript and the Yahoo! User Interface (YUI) library.

Because of the browser differences I thought it is a good idea to base my development on a solid, well tested library. After a short investigation time, I decided to have a closer look at the following alternatives:

For each of the libraries I created some small prototypes, read the documentation to get a feeling about the concept and possibilities. After this evaluation phase it was clear for me, that the Yahoo! user interface (YUI) library is by far the best framework for my needs. Compared to the other frameworks it uses the full power of the JavaScript language, and offers a library and a concept that enables you to create big JavaScript applications. I don’t go into further detail on Prototype and GWT here, and concentrate this blog on YUI. If you are interested in my experience with the other two frameworks, just contact me.

For an experienced Java developer it takes a little bit to get familiar with the language specifics of JavaScript. Unfortunately I did not find one good JavaScript book :-( Therefore here the most important concepts.

JavaScript Basics

Objects

It is very important that you understand the syntax and behavior of objects, because you find them everywhere. Let’s start with a simple example:

var person = {
    firstName: "Markus",
    lastName: "Tripp"
};

There are other ways an object can be created, but object are usually created using the curly brackets { }. Then think about an object in JavaScript as a kind of hash table, with key/value pairs. Where key is a string and value can be anything from string, function, or a nested object. To get the first name of the person object above, call: person.firstName.

Like with a hash table, any object can be extended by simple assigning new members. Let’s add a nested address object and a toString function to the above created person object.

person.address = {
    city: "Salzburg",
    country: "Austria"
};  

person.toString = function() {
    return firstName + " " + lastName;
}

If you would have created the entire person object in the beginning, it looks like this:

var person = {
    firstName: "Markus",
    lastName: "Tripp",
    address: {
        city: "Salzburg",
        country: "Austria"
    },
    toString: function() {
        return firstName + " " + lastName;
    }
};

Additionally objects are very often dynamically created as parameters for functions. For instance, if you have a function called addPerson that expects a person object as an argument, you often see it programmed this way:

addPerson({
    firstName: "Markus",
    lastName: "Tripp"
});

This just calls the addPerson function and passes an object with the attributes firstName and lastName. Of course this object may contain nested objects and functions. It’s also possible that you pass arrays or functions as parameters for functions. For instance if you pass a persons toString method to the logPerson function this would look like this:

logPerson(function(person) {
    return person.firstName + " " + person.lastName;
});

That’s basically all you have to understand to start working with objects. As you can see, JavaScript does not have Java’s static typing and strong type checking.

Functions

Functions inherit from Object and therefore can store name/value pairs. As you saw before, functions can be passed as arguments, returned from other functions, or just stored like other values. The following two examples define the same function:

function addPerson(person) {
    ...
};  

var addPerson = function addPerson(person) {
    ...
};

Arrays

Like functions, arrays also inherit from Object. This means arrays have the same characteristics, you can store any other object or function as values, and it can be extended like any other object. One difference is, that indexes are converted as strings and used as names to retrieve the values. Here a simple example:

var names = ["Markus", "Harry"];
var i;
for (i = 0; i < names.length; i += 1) {
    var name = names[i];
    // do something with the name
}

Scope and Closure

It is essential that you understand scope and closure, to understand most of the existing JavaScript examples and libraries.

Scope: An inner function has access to the variables and parameters of functions that it is contained within.

Closure: The scope continues, even after the parent function has returned.

For additional information and details about JavaScript and advanced language concepts like inheritance I recommend that you watch the videos from Douglas Crockford about JavaScript at the YUI Theater page.

Yahoo! User Interface (YUI) Library

After some basics about the JavaScript language, I discuss here some basics about the YUI framework. When evaluating the 3 framework options, I was really impressed, what the Yahoo! developers created. A stable library with an easy to understand concept and lot’s of documentation and examples.

One of the things YUI always mention is, that global variables are evil.

<script>
    var name = "Markus";
</script>

When you embed the above script into a web page, the variable “name” is global, and can be accessed and modified everywhere. For a simple mouseover script this is OK, but if you have a rich JavaScript application, or even worse if you use external JavaScript applications, this variable can be accessed or modified by all scripts. Therefore YUI has only one global variable, and stores everything within this object. The object is called YAHOO. For your projects I recommend to use the same concept by using the namespace function of the YAHOO global object. For instance my personal projects have one global MEXT object.

var MEXT = YAHOO.namespace("mext");

So, we have something that is similar to a package in Java. Now it would be helpful to have something like a class to structure the application. YUI usually use the term “module pattern”. I think I best describe the YUI module pattern with a simple example. I create a class AsyncLoader that has one public method load. The load method loads HTML content from a server asynchronously and inserts the HTML in a given div tag. Except that the server returns HTML instead of XML this is a real AJAX example (AJAX stands for Asynchronous JavaScript and XML). In the HTML page the call looks like this:

<div id="content">Loading...</div>
<script>
    var loader = new MEXT.AsyncLoader();
    loader.load("content", "proxy?service=latestNews");
</script>

var loader = new MEXT.AsyncLoader() instantiates the class and loader.load(…) executes the load method, which calls proxy?service=latestNews on the server and inserts the result in the div above with the name “content”. Why do I call a proxy service on my server? Because of security restrictions of modern browsers it is not allowed to make AJAX calls to external resources directly. One way to workaround this is passing the request through a proxy. Read more about this here. Additionally this gives you some nice possibilities, like caching of the remote call responses, pre and post processing.

Now let’s have a look at the JavaScript class I created using the module pattern.

File: ajax.js  

var MEXT = YAHOO.namespace(”mext”);  

(function() {  

    // private member variables
    var Dom = YAHOO.util.Dom;
    var Connect = YAHOO.util.Connect;  

    // private functions (methods)
    var handleSuccess = function(response) {
        var element = Dom.get(response.argument.id);
        element.innerHTML = response.responseText;
    }  

    var handleFailure = function(response) {
        var element = Dom.get(response.argument.id);
        element.innerHTML = response.status;
    }  

    // Class constructor
    MEXT.AsyncLoader = function() {
        // empty constructor
    };  

    // Public methods of class
    MEXT.AsyncLoader.prototype = {
        load: function(divId, url) {  

            var callback = {
                success: handleSuccess,
                failure: handleFailure,
                argument: { id: divId }
            };  

            var transaction = Connect.asyncRequest(
                “GET”, url, callback, null);
        }
    };  

})();

In this simple example you see how to create a class, add private members and methods, and add public methods.

(function() {
    ...
})();

This is just required to be sure that nothing within this function is global. Because global is evil as we learned. Therefore the code is incapsulated in a function and the brackets around just ensures that the code inside the function is initialized and executed. This function does not get executed:

function() {
    ...
};

Create private members and private functions. Because of the scope described before, those variables can be used also in the inner functions.

Create a class constructor, and then all public methods within the objects prototype. For more information about the Object.prototype and other advanced JavaScript concept I recommend watching the videos on the YUI theater page.

I’m working with JavaScript intensively for 2 weeks now, and I really have to tell you, if you have experience in programming languages (e.g. Java) and understand the above example, you can do pretty everything.

To complete the example, here the entire HTML. It demonstrates another extremely cool YUI part, the YUI CSS foundation. Usually the web pages have a column based layout. If you code always everything from scratch this can be quite an effort to support all the major browsers. The YUI CSS foundation and especially the YUI CSS grids provides you a kind of standard to come over this problem very quickly and easily.

File: ajax.html  

<!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01 Strict//EN”
    “http://www.w3.org/TR/html4/strict.dtd”>
<html>
<head>
    <title>Ajax Example</title>
    <meta http-equiv=”Content-Type”
        content=”text/html; charset=UTF-8″ />  

    <link rel=”stylesheet” type=”text/css”
        href=”http://yui.yahooapis.com/2.5.0/build/
            reset-fonts-grids/reset-fonts-grids.css” />
    <link type=”text/css” href=”screen.css” />  

    <script src=”http://yui.yahooapis.com/2.5.0/build/yahoo/
        yahoo-min.js”></script>
    <script src=”http://yui.yahooapis.com/2.5.0/build/event/
        event-min.js”></script>
    <script src=”http://yui.yahooapis.com/2.5.0/build/connection/
        connection-min.js”></script>
    <script src=”http://yui.yahooapis.com/2.5.0/build/dom/
        dom-min.js”></script>
    <script src=”ajax.js” mce_src=”ajax.js”></script>
</head>
<body>
<div id=”doc2″ class=”yui-t2″>
    <div id=”hd”>
        Header
    </div>
    <div id=”bd”>
        <div id=”yui-main”>
            <div class=”yui-b”>
                <h1>Content</h1>
                <div id=”content”>Loading…</div>
                <script>
                    var loader = new MEXT.AsyncLoader();
                    loader.load(”content”,
                        “proxy?service=latestNews”);
                </script>
            </div>
        </div>
        <div class=”yui-b”>
            Navigation
        </div>
    </div>
    <div id=”ft”>
        Footer
    </div>
</div>
</body>
</html>

The above used CSS id’s and classes create a 950px width centered page (<div id=”doc2″>) with a header, body and footer. The body consists of two blocks (columns - yui-t2), one 180px column on the left which is the navigation and a second column which is the main block and contains the main content. Additionally you could nest additional columns in the main content using grids. This all with cross browser support and without writing one line CSS. Brilliant.

I think as a starting point this is enough. As a next step I recommend to go to the YUI home page, discover the examples and dig into the YUI source code. An excellent place to learn.

Quite interesting is, that for my current open source project I use quite some technologies, where Yahoo! has its hands on, YUI (JavaScript + CSS), Flickr, OpenID, Lucene, Firebug. Thanks, Yahoo! I hope, I can give you something back at some time :-)

Challenging Work

February 15th, 2008

Since my last blog post I had a challenging and interesting time. In December I worked as a consultant for db4objects in Beijing with the Google Android platform. It was really a great experience and a lot of fun to work in a team of IT experts, half Chinese and half European. Thanks, Christof. And some of them got really good friends, hey Simon :-) Simon, I hope we meet soon, but latest when we (Austria) play against you (Germany) at the European Soccer Championship. This time we will win ;-)

Since beginning of the year I’m working on a kind of social networking platform. I’m prototyping and thinking about the concept of the platform for more than 2 years. And now it is the right time to realize it together with a great team. The platform is mainly based on Java6 and Lucene technology. The basis of the platform will be a completely new service framework. It is something like the Spring framework but much smaller, simpler and with zero configuration, and almost no learning required. Based on that we develop the platform with features derived from wikis, social networking sites, blogs, mashups, ajax, mobile and many more. I don’t want to write more about it now, but it has some really unique features, and most important is its flexibility and simplicity.

We just passed the first milestone, and I’m really happy at the moment. I will write more about it, when it’s time for it.

Google Android: New opportunities for mobile applications

November 19th, 2007

Last week Google launched it’s mobile platform Android. In my previous job our company developed applications for Symbian OS and Java ME. So I know the problems and pain for developers to create mobile applications. Therefore I was very interested about this Google initiative.

As many other developers I installed the SDK and Eclipse plug-in. Installation, configuration, programming and running the first small applications in the emulator was extremely easy and great fun. Documentation is also quite good already, so everything is there, that ideas for new applications and businesses can grow.

I predict that next year will be a big change in the mobile market. First, Apple’s iPhone is an amazing mobile phone with unique user interface ideas. But until now developers can only write web applications with some client side Javascript code. Second, Google Android puts a lot of pressure to the other mobile platforms, like Windows Mobile, Symbian, … I already had a clear vision about my personal future direction, but I will probably start to re-think everything. There are probably great new opportunities in developing applications for mobile phones.

After writing some Android demo applications I examined the Android API’s. Android consists of the following parts:

This is quite OK as a starting point. I will probably come up with some missing libraries when more working with the framework. So let’s have a closer look at the Android API’s. My first impression is, that the interfaces and classes are structured very differently. I assume that the packages are developed by separate teams with no one responsible for the overall API’s. I would have expected cleaner and more consistent class and interface definitions.

Packages

android.location and com.google.android.maps

This is obviously the most interesting and fascinating package. It enables developers to create location based services and even include Google Maps. I will definitely try out these package. And this will probably the basis for many cool ideas and new services.

android.database

Package to persist objects. I looked at the API and was very disappointed. I hoped to find something innovative and easy to use like db4objects. Instead I found something that is even more confusing then JDBC.

android.media

This package contains API’s to control a media player and media recorder. Used to play and audio and video files. Looks quite simple, but I did not find anything about supported codec’s and DRM’s. But as PacketVideo is part of the open handset alliance and contributes to the Android platform, I expect that the most widely used codec’s and DRM’s are supported. Find more at the PV Technology page.

android.speech.recognition

Quite interesting. Speech recognition is a very complex topic, and you have to be careful, how advanced the speech recognition libraries are and what functionality they support.

android.telephony

API’s to establish calls from your application, or send SMS messages. Cool.

android.webkit

This enables you to embed HTML components to your application. Interesting fact is, that Apple’s iPhone and Google Android use the same framework, that is WebKit.

Summary

I’m really very impressed by Google Android. It will definitely change the mobile market, and I will evaluate if there is a business to develop mobile applications for Google Android, Apple iPhones or Windows Mobile. This would really be great fun.

AudioInspector Live

October 29th, 2007

With the beginning of this month (October 2007) my first bigger project went live. Visit it at www.audioinspector.com.

AudioInspector is a tool for digitization of analogue audio streams. It is used for transferring audio content from original recording media to digital mass storage systems. AudioInspector is a desktop program that runs on Microsoft Windows XP and Vista (Screenshot of AudioInspector).

AudioInspector can be only purchased online, at www.audioinspector.com. It is available in two license models, usage-based and unlimited. With the usage-based model you pay a small initial license fee, and then you just pay when using the software. Therefore the software makes remote calls to audioinspector.com for authentication, license installation, and charging.

My part of the project was to create

  • Web page design and layout
  • Web shop including checkout and credit card payment
  • Remote Interface for authentication, license handling and charging
  • Backoffice for user management, license handling and order management
  • Hosting, maintenance and monitoring

Read details about the way I implemented the platform.