Sunday, November 25, 2012

Big Data: Querying

Just two slides about querying Big Data. If you want to read more about Big Data and NoSQL have a look at my latest book about Mobile & Cloud Computing: http://bookboon.com/de/studium/informatik-office/mobile-und-cloud-computing

CAP Theorem, From RDB to NoSQL, Querying Big Data, MapReduce
Big Data: CAP Theorem, From RDB To NoSQL, Querying BigData, MapReduce
Apache Pig, Pig Latin, Wide Column Store


















































cheers Alex

Saturday, August 11, 2012

Bilanzanalyse IT-Unternehmen unter besonderer Berücksichtigung der vergangenen Dotcom-Blase und dem speziellen Vergleich mit etablierten IT-Unternehmen



Bilanzanalyse der gegenwärtigen jungen IT-Unternehmen unter besonderer Berücksichtigung der vergangenen Dotcom-Blase und dem speziellen Vergleich mit etablierten IT-Unternehmen
--
Financial Statement Analysis of current and young IT Companies with special consideration of the past Dot-com Bubble and with special comparison between long-established IT Companies
Download Paper (PDF)
Hosted on GoogleDocs - Click on "Download original" to save PDF to view it in a higher resolution

Download Excel Calculation (XLSX)
Hosted on GoogleDocs - Use the download function and open it with Microsoft Excel

Download Slides (PDF)
Hosted on GoogleDocs - Click on "Download original" to save PDF to view it in a higher resolution

„Wiederholt sich das Dot-Com-Desaster?“, „Why private investors should avoid Internet IPOs“, oder „Böse Erinnerungen an die Dot-Com-Blase“ sind Schlagzeilen bzw. Titel von Reports, die in letzter Zeit zu lesen waren. Grund für derartige Artikel und noch weitere dieser Art war wohl der Börsengang des Business-Social-Networks LinkedIn Corp. (LinkedIn) im Mai 2011, der mit einer Kurssteigerung von über 100% auf sich aufmerksam machte. Der am 18. Mai 2012 durchgeführte Börsengang von Facebook Inc. (Facebook), der rund 105,1 Mrd. US-Dollar (USD) einbrachte, und die kürzliche Akquisition von Instagram durch Facebook, bei der Facebook ca. 1 Mrd. USD zahlte, tragen ihr Übriges zur Diskussion bei. Doch wie begründet ist diese Angst einer erneuten deutlichen Überbewertung von Unternehmen aus der IT-Branche? Dieser Frage soll im Zuge der vorliegenden Arbeit nachgegangen werden. Nach einer Einführung, die den Datenbestand an untersuchten Unternehmen darstellt, behandelt Kapitel 2 die theoretischen Themen des Technologiesektors. Hierbei stehen die Besonderheiten der Bilanzierung von IT-Unternehmen im Vordergrund, aber auch auf Finanzierungsformen und Methoden der Unternehmensbewertung wird eingegangen. Kapitel 3, Kapitel 4 und Kapitel 5 bilden das Zentrum dieser Ausarbeitung. Zuerst werden die jungen IT-Betriebe analysiert, die kürzlich den Gang auf das Parkett gewagt haben. Dabei spielt das makroökonomische Umfeld und die Branchentendenz eine Rolle, vor allem aber die Bilanzanalyse der relevanten Unternehmen. Eine alleinige Analyse dieser Unternehmen bietet leider noch nicht genügend Aussagekraft, um die oben gestellte Frage zu beantworten. Deshalb findet anhand zweier formulierter Thesen eine weitere Analyse der heutigen jungen IT-Betriebe statt. Zum einen werden diese mit denjenigen Unternehmen aus der Dotcom-Zeit verglichen, zum anderen findet ein Vergleich mit den etablierten Unternehmen der IT-Branche statt. Innerhalb eines Fazits werden anschließend die Einzelergebnisse zu einer Gesamtaussage zusammengefasst.
Content:
Bilanzanalyse, Bilanzanalyse, Financial Statement Analysis, IT-Unternehmen, Dotcom, Unternehmensformen, Finanzierung, US-GAAP, IFRS, HGB, Konzernabschluss, Consolidated Financial Statement, Balance Sheet, Income Statement, Cashflow Statement, Cash, Short Term Investments, Goodwill, Intangible Assets, Firmenwert, immaterielle Vermögenswerte, Patente, Bilanzierung von Software, R&D, F&E, Kennzahlen, Kennzahlensysteme, Vermögenslage, Ertragslage, Finanzlage, Marktlage, Unternehmensbewertung, EV, Makroökonomische Analyse, Branchenanalyse, Mobile, Cloud, Social, Key Success Factors, Werttreiber, Innovation, Human Capital, Risiko, Dotcom, Dotcom Bubble, Dotcom-Blase, Benchmarking, Baidu, Dangdang, Demand Media, Demandware, Facebook, Giant, Groupon, HomeAway, Jiayuan, Jive, LinkedIn, Orbits, Pandora, Qihoo, Rackspace, Renren, Shanda, SouFun, Tudou, VMware, Yandex, Yelp, Youku, Zillow, Zynga, ACG, ADVA, Aixtron, Biodata, BroadVision, Brokat, ComRoad, Cybernet, Ebookers.com, TheGlobe.com, LetsBuyIt.com, Medion, Singulus, Kontron, Intershop, United Internet, Webvan, WorldCom, Barnes&Noble, eToys, InfoSpace, Lastminute.com, Pets.com, The Fantastic Corp, Think Tools, Xcelera, Adobe, Amazon, BMC, CA, Cicso, Dell, eBay, EMC, Google, Hitachi, HP, IBM, Intel, Intuit, Lenovo, Microsoft, Motorola, Nokia, Oracle, SAP, Sony, Symantec

Alex



Thursday, April 26, 2012

Bilanzanalyse: Entwurf eines rechnergestützten Modells auf Basis von Microsoft® Excel zur Umsetzung einer Bilanzanalyse


Belegarbeit zum Thema: Entwurf eines rechnergestützten Modells auf Basis von Microsoft® Excel zur Umsetzung einer Bilanzanalyse

Download Paper (PDF)
Hosted on GoogleDocs

Download Excel Calculation (XLSX)
Hosted on GoogleDocs - Use the download function and open it with Microsoft Excel

cheers Alex

Thursday, February 2, 2012

Mobile- und Cloud-Computing unter besonderer Betrachtung der Technologien der US amerikanischen Unternehmenen Google Inc. und Amazon.com Inc. und der deutschen SAP AG

Mobile- und Cloud-Computing unter besonderer Betrachtung der Technologien der US‑amerikanischen Unternehmen Google Inc. und Amazon.com Inc. und der deutschen SAP AG
--
Mobile- and Cloud-Computing with special regard to technologies of the American companies Google Inc. and Amazon.com Inc. and the German SAP AG

Download Book (PDF)
Publisher: BookBoon, ISBN 978-87-403-0264-6, 129 Pages

In dieser Projektarbeit werden die Themen Mobile-und Cloud-Computing unter spezieller Berücksichtigung der Technologien der Unternehmen Google Inc., im folgenden Google genannt, Amazon.com Inc., im folgenden Amazon genannt, und der SAP AG, im folgenden SAP genannt, evaluiert. Diese Evaluierung soll einem Unternehmen als Blueprint dienen, um so die Unternehmensprozesse mit den genannten Technologien umsetzen zu können. Das Unternehmen erhofft sich dadurch eine Effizenzsteigerung durch Automatisierung, Flexibilisierung, Skalierung und Benutzerfreundlichkeit. Der Autor verbindet in dieser Arbeit verschiedenste Technologien und gibt subjektive Empfehlungen für die Nutzung der jeweiligen Technologie ab. Die Themen Mobile Computing und Cloud Computing werden zunächst seperat dargestellt. Im Anschluss zeigt Kapitel 4 wie beide Welten zusammenwirken und welche Rolle etablierte Technologien spielen. Zudem wird auf das aktuelle Thema In-Memory Computing eingegangen und dargestellt wie es sich in das Mobile- und Cloud-Computing Ökosystem eingliedert.

This project assignment evaluates and presents the topics Mobile- and Cloud-Computing with special regard to the technologies of the companies Google Inc. (Google), Amazon.com Inc. (Amazon) and SAP AG (SAP). The evaluation should serve as a blueprint for a company to implement business processes with the mentioned technologies. By using these technologies the company tries to increase its efficiency via automation, flexibilisation, scaling and usability. The author of this paper combines different technologies and gives subjective advices regarding the use of a particular technology. First the topics Mobile Computing and Cloud Computing will be shown separately. Afterwards chapter 4 will show how both technologies interoperate and the meaning of legacy technologies. Furthermore, In-Memory Computing will be explained and how it fits in the ecosystem of Mobile- and Cloud-Computing.

Content:
Mobile Computing, Cloud Computing, In-Memory Computing, Google, Amazon, SAP, Android, iOS, BlackBerry BBX, NFC, LBS, Adobe, Flash, Flex, Windows Phone 7, WP7, Sybase, SUP, Sybase Unwired Platform, SAP NetWeaver Gateway, SAP NetWeaver Mobile, SAP ITSmobile, Mobile-WebApp, Hybrid-NativeApp, Purely-NativeApp, HTML5, JavaScript, CSS3, Dart, Coffeescript, jQueryMobile, jQM, jqMobi, jQTouch, sencha touch, iUI, iWebKit, Dojo Mobile, Jo, iScroll, Ajax, Comet, Streaming, Long-Polling, XHR, XHR2, Polling, Piggyback-Polling, WebSocket, Socket.IO, Athmosphere, CometD, Kaazing, Kaazing WebSocket Gateway, Native Frameworks, Briding Frameworks, PhoneGap, Titanium, Rhodes, IaaS, PaaS, DaaS, SaaS, FaaS, HuaaS, MoaaS, Virtualisierung, Skalierung, Scale-out, Scale-up, SOA, SOAP, REST, Messaging, SQS, SNS, AMQP, JMS, RabbitMQ, Qpid, ActiveMQ, HornetQ, CAP, ACID, BASE, Map, Reduce, BigTable, Dynamo, Wide-Column-Store, Row-oriented, Column-oriented, Key-Value-Store, Graph-Store, Document-Store, CouchDB, MongoDB, HBase, Cassandra, SimpleDB, Redis, Riak, Neo4J, Replizierung, Big Data, Schema-free, Sharding, MVCC, Consistent-Hashing, EC2, EBS, S3, ElastiCache, RDS, Cloud Front, Elastic Beanstalk, Cloud SQL, Cloud Storage, C2DM, App Engine, GAE, Page Speed Service, Akamai, River, OpenShift, NetSuite, Salesforce.com, Cloud Foundry, CloudBees, Heroku, Oracle Cloud Service, Oracle Public Cloud, Database Cloud Service, Java, Scala, Ceylon, Kotlin, Groovy, JSON, NoSQL, Node.js, Node, Asynchron, Event-Driven, Non-Blocking, NIO, Event-Loop, Nginx, Android-Couchbase, 2-Tier, 3-Tier, Java EE 5, Java EE 6, JSF, Ruby on Rails, Wicket, GWT, SanssouciDB, SAP HANA, OLTP, OLAP, IMDB

Big thanks to all the proof readers!
Your feedback is welcome!

Tuesday, December 6, 2011

Saturday, November 5, 2011

Latente Steuern im externen Rechnungwesen unter Berücksichtigung von BilMoG

Belegarbeit zum Thema Latente Steuern unter Berücksichtigung von BilMoG & IFRS.
 
Download Paper (PDF)
Hosted on GoogleDocs

Download Slides (PDF)
Hosted on GoogleDocs

cheers Alex

Friday, November 4, 2011

SAP: Einsatz und Entwicklung innerhalb von SAP ERP Systemen auf Basis der SAP NetWeaver-Plattform

Usage and development within SAP ERP applications based on the SAP NetWeaver platform
I wrote a paper about SAP. The paper includes SAP SaaS, SAP PaaS, NetWeaver Architecture, SAP Frontend Technologies, Development within SAP (ABAP & Co.) and describes the Commercial and OpenSource competitors of SAP. The paper is written in german and is a good introduction into SAP especially for SAP beginners.

Download Paper (PDF)
Hosted on GoogleDocs

Cheers Alex

Abstract
In dieser Projektarbeit wird das SAP ERP System auf Basis der SAP NetWeaver-Plattform evaluiert.Die Evaluierung soll einem Unternehmen dienen, dass eine ERP Software im Betrieb zu implementieren plant. Aus diesem Grund werden sowohl die fachlichen Funktionen als auch die technischen Grundlagen eines SAP Systems dargestellt. So kann das Unternehmen seine Anforderungen mit den gegebenen SAP Funktionalitäten abgleichen und überprüfen ob ein SAP System in die technische Systemlandschaft integriert werden kann. Zudem wird auf die Entwicklung und weitere Technologien eingegangen um die Anpassungsfähigkeit eines SAP Systems an die unternehmensspezifischen Eigenheiten zu zeigen. Alternative ERP Systeme sind ein weiterer Bestandteil dieser Projektarbeit. Als Ergebnis der Evaluierung dient diese Ausarbeitung auf deren Grundlage das Unternehmen die Entscheidung für ein SAP ERP System oder für eine der genannten Alternativen trifft.
The following project assignment evaluates the SAP ERP systems based on the SAP NetWeaver platform. The evaluation will serve as an overview for a company which wants to implement an ERP system. For that reason the business functionality as well as the technical basis of a SAP system are shown. Afterwards the company will be able to compare its requirements to the given SAP functionality and check whether the SAP system can be integrated into the existing IT landscape.
Furthermore, the development and additional technologies are described to show the adaptability of a SAP system to company-specific issues. Alternative ERP possibilities are shown as well. This paper can help a company to determine whether to implement a SAP ERP system or whether to implement an alternative ERP system.


Tuesday, October 25, 2011

((Ceylon vs. Kotlin) vs. Scala) vs. The Rest of the World

The blog title sounds a bit like buzzword bingo, doesn't it? Damn, I forgot to mention Gosu.

There are quite many new brand-new-must-have-technologies these days.
There are Android, HTML5, PhoneGap, CoffeeScript, node.js, Websockets, Flex, Adobe Air, REST, JSON, BSON, AMQP, RabbitMQ, JEE6/7, Cloud (you know, everything is in the cloud today), NoSQL, SaaS/PaaS/IaaS, and of course, Ceylon, Kotlin, Gosu, Clojure, Scala, Groovy, JRuby and all the other JVM based programming languages.
So, how should look a really, really cool application? Android Mobile Frontend written in Scala, REST Interface to get some data from a server which is written in Ceylon which access a NoSQL HBase Database via Map/Reduce to read&write Big Data. Our server is hosted on AWS (plain Tomcat, Glassfish or JBoss AS on AWS or should we use OpenShift from RedHat rather than Amazon?), of course. Oops, I forgot a non-smart-phone client. Ok, web-based client written in... hmmm... JSF? GWT? Wicket? JavaFX 2.0? Flex? Silverlight? or just plain HTML5 with a ass kickin' Websocket connection to our server? Ok we pick HTML5. But when I wanna pick HTML5 and I do not wanna write so much JavaScript by myself (even if the new JavaScript API is pretty cool in HTML5) I am gonna need a full-fledged JavaScript Library/Toolkit. No problem at all. What do you want? jQuery, dojo, ExJS, MooTools, scriptaculous or YUI? Whatever... just pick jQuery as everybody does... (BTW I did not mention AJAX because it is not buzzword-noteworthy anymore. Even Comet/Bayeux got the kiss of death from Websockets...)

Puhhh, buzzword scrabble finished and application architecture defined. Nope. We have made a mistake. There isn't a compiler for Ceylon yet. Someone told me Ceylon is a vaporware until now. Ok, replace Ceylon with Kotlin. Ops, there isn't a compiler for Kotlin as well. Doesn't matter let's assume that I can run my Ceylon/Kotlin code (instead of just write them down on some slides). What should we choose? Ceylon or Kotlin? In the following you will find a short feature comparison. It is a non-offical and subjective comparison from my point of view. It relies on the information which is available until now. Found any mistakes? Just leave a comment!

Enough said. Here is the comparison. BTW I did not include Scala because it is "to academic/function/not functional enough/..." ;-)

Comparison is not finished yet. I will update it from time to time.


Ceylon
Kotlin
Source Code organization (Java's packages)
derived from the file path of the source code file e.g. Class Person in package org.j4fry.mypkg must be in directory org/j4fry/mypkg/Person.ceylon
import org.j4fry.mypkg { Person }
uses namespaces e.g.
namespace org.j4fry.Person
with import statement
import org.j4fry.Person
Semicolons
mandatory
optional
Return types (Java's void)
uses void keyword which is, in fact, a return type named Void
shared abstract class Void() of Object|Nothing {}
uses Unit
Unit is a tuple of zero components (Tuple0) e.g.
fun myFunc( ) : Unit {… }
String interpolation
shared variable Natural c := 10
writeLine("Value of c " c "!");
var c = 10
print("Value of c ${c} !")
Using types and type inference
like Java
String s = "Ceylon"
With type inference
local s = "Ceylon"
Like Scala:
val c : Int
With type inference
val c = 10
Mutable and Immutable
Mutable: local, variable (with := assignment)
class C { shared variable Natural c := 10 }
Immutable: without variable
class C { shared Natural c = 10; }
Mutable: var
public class C(){private var c : Int = 0;}
Immutable: val
public class C(){private val c : Int = 0;}
Fields and Properties (Java's Getter&Setter Freak-Show)
Actually there are only properties (like in C#)
public class C() {
public val mutable_name : String
public var immutable_name : String
get() = …
set(value) { $immutable_name = value }
}
Accessability, Visibility & Modifiers (Java's public, protected, private and default scope)
Doesn't know the usual modifiers. Uses instead the shared keyword which controls the visibility of attributes, methods, classes, etc. depending on the context e.g.
non-shared class à class only visible to classes in the same package
shared class à class visible to other packages
shared class C( ) { … }
Uses Java's access modifiers private, protected and public. Additionally internal modifier. Probably internal works like the C# internal modifier e.g. visible in same namespace?
Enums (Java's enum)
Not included. Use of clause (mention subtypes in the base-class signature) in combination with anonymous classes.
Like Java enums on steroids. You can subclass enums in Kotlin and there are some other enum features in Kotlin e.g. member overriding, enum pattern-matchin, etc.
Inheritance
Uses the extends clause in class signature but different annotations to declare overridable and overridden methods.
class Base( ) {
shared default String doSth() {…}
}
class Subclass() extends Base() {
shared actual String doSth() {…}
}
Overloading
Not supported. Use optional parameters instead. Comment of Kotlin FAQ: "Ceylon is Java-incompatible, because it does not support overloading"
Interfaces


There are some heated discussions about Ceylon and Kotline already.

Pro Ceylon

Contra Ceylon


On the following websites you could find the resources which I have used to create the above mentioned comparison:

Resources Ceylon

Resources Kotlin

Hopefully you have learnt to understand the irony and sarcasm at the beginning of this blog post. It doesn't matter which programming language you choose. It is only important to try out new things because "Standstill".means("Falling Behind")

cheers Alex

Wednesday, January 13, 2010

J4Fry on Twitter

J4Fry is now available on Twitter.
Just follow @J4Fry

Monday, December 14, 2009

CVS log commit messages

Every now and then when making a release I need an alphabetical list of all CVS commit messages since a particular previous tag. This is what I use (for tag 'mytag'):

cvs log -rmytag:: -S -N | grep '^RCS\|^Working\|^head\|^branch\|^locks\|^access\|^keyword\|^total\|^description\|^-------\|^========\|^revision\|^\?\|^date\|^$\|\*\*\*' -v | sort -u

Is there anybody on this planet with a more elegant solution?

Best regards,
Ganesh

Tuesday, June 23, 2009

Hibernate Event Listeners with Spring

You can configure your Hibernate event listeners via your spring-context.xml.
When you declare your Bean from type org.springframework.orm.hibernate3.LocalSessionFactoryBean you can initilize the property "eventListeners". This attribute is from type Map. The key defines the type of the event listeners (e.g. flush, load, delete, etc.). The value defines the corresponding class which implements the EventListener interface or extend the DefaultEventListener implementation class.


Sample of your context.xml

<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
...
<property name="eventListeners">
<map>
<entry key="flush">
<bean class="org.j4fry.hibernate.eventlisteners.FlushEventListener" />
</entry>
</map>
</property>
...
</bean>
Sample of a FlushEventListener

package org.j4fry.hibernate.eventlisteners;
import org.apache.log4j.Logger;
import org.hibernate.HibernateException;
import org.hibernate.event.FlushEvent;
import org.hibernate.event.def.DefaultFlushEventListener;

public class FlushEventListener extends DefaultFlushEventListener {
public void onFlush(FlushEvent fe) throws HibernateException {
super.onFlush(fe);
}
}
List of keys and the corresponding Interfaces and implementation-classes
Map-KeyInterfaceDefault implementation class
auto-flushAutoFlushEventListener
deleteDeleteEventListener
dirty-checkDirtyCheckEventListener
evictEvictEventListener
flush-entityFlushEntityEventListener
flushFlushEventListener
load-collectionInitializeCollectionEventListener
loadLoadEventListener
lockLockEventListener
mergeMergeEventListener
create-onflushPersistEventListener
post-deletePostDeleteEventListener
post-insertPostInsertEventListener
post-loadPostLoadEventListener
post-updatePostUpdateEventListener
pre-deletePreDeleteEventListener
pre-insertPreInsertEventListener
pre-loadPreLoadEventListener
pre-updatePreUpdateEventListener
refreshRefreshEventListener
replicateReplicateEventListener
save-updateSaveOrUpdateEventListener

Saturday, June 20, 2009

IE8 script cache and AJAX script replace

Today I tried debugging the MyFaces 2.0 AJAXS scripts in IE8. The debugger is quite nice. The hard side came in when I starting changing the scripts and tried testing my new script versions. IE8 prooved to be a resilient beast like it's anchestors and insisted on running an old script version. The nice button "clear browser cache" in the developer tools didn't do anything. What finally helped was the first menu option in menu "cache" - in german it says: Immer vom Server aktualisieren.
Now that I could step into my Javascript code things got even weirder. I had a simple

<span id="test"><script ... ></span>

construction and I tried do replace element "test" with an AJAX call. So what do you think happened? I did:

item.insertAdjacentHTML('beforeBegin', '<span id="test"><script ... ></span>');

and then checked item.previousSibling. I turned out IE8 had inserted:

<span id="test"></span>

It just left out my new script. I changed the HTML code to look like (don't ask me what gave me the idea to do so, years of suffering train intuition):

<span id="test">
<input type="hidden" />
<script ... >
</span>

and suddenly IE inserted it all like it should. If you want to know which tricks are necessary to trigger script execution have a look at the MyFaces repository:
http://svn.apache.org/repos/asf/myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Utils.js

It's interesting code - external and embedded scripts need to be treated differently.

Friday, June 19, 2009

HowTo integrate JUnit and WebBeans

WebBeans provides an easy way to integrate it with JUnit.
I use for the examples WebBeans 1.0.0.PREVIEW1 and Junit4.

Follw these steps to integrate JUnit and WebBeans.

1. Create a base class called AbstractWebBeansContextTest
This super class contains the setup of the WebBeans Context and makes the WebBeans Manager available for its subclasses. You have to add the webbeans-se.jar to your build path. This jar provides the possibility to initialize the WebBeans context within a SE (Java StandardEdtion) environment.

import javax.inject.manager.Manager;
import org.jboss.webbeans.CurrentManager;
import org.jboss.webbeans.environment.se.StartMain;

public abstract class AbstractWebBeansContextTest {
public static final Manager manager;
static {
StartMain.main(new String[]{});
manager = CurrentManager.rootManager();
}
}

2. Put a beans.xml into the root-source directory of your testing project
In that beans.xml you could define your testing deployment types (e.g. @Mock, etc.). In our case this beans.xml left blank.

3. Create your test class
Create a new test class which is a subclass of AbstractWebBeansContextTest.
Annotate a method with @BeforeClass and initialize your WebBeans which you wan to use in your test case.
Annotate some other methods with @Test and use your initialized WebBeans.

public class MyTestCase extends AbstractWebBeansContextTest {

public static MyService service;

@BeforeClass
public static void startup() {
service = manager.getInstanceByType(MyService.class);
}

@Test
public void testServiceMethod() throws Exception {
...
service.myServiceMethod();
...
}
}

Wednesday, June 17, 2009

JSF 2.0 and dojo create NO_MODIFICATION_ALLOWED_ERR: DOM Exception 7 on Safari

When testing our dojo facelets examples in Safari I realized that they don't work with Mojarra 2.0. After some investigation it turned out that Mojarra 2.0 sends a reponse-header Content-Type: application/xhtml+xml thus triggering a bug in Safari.With JSF 1.2 (also with Facelets) it was always Content-Type: text/html. The result is that Safari throws NO_MODIFICATION_ALLOWED_ERR on some DOM operations that are needed from the dojo side.

I added a Listener to set the Content-Type to text/html and - helas! - it works just fine.

public void beforePhase(PhaseEvent event) {
FacesContext context = FacesContext.getCurrentInstance();
ExternalContext extContext = context.getExternalContext();
Object response = extContext.getResponse();
if (event.getPhaseId() == PhaseId.RENDER_RESPONSE) {
String contentType = "text/html; charset=UTF-8";
if (response instanceof ServletResponse) {
((ServletResponse) response).setContentType(contentType);
} else if (response instanceof RenderResponse) {
((RenderResponse) response).setContentType(contentType);
}
}
}

Tuesday, June 16, 2009

JSF 2.0 AJAX overview

Many AJAX JSF frameworks are on the market - but the moment you start combining them you may get random results due to incompatibilities. JSF 2.0 will help with this! Specifying the AJAX API will help assemble the different approaches under one roof. The spec (JSR-314) defines an f:ajax tag as well as a javscript API together with an AJAX enhanced JSF lifecycle.

I helped implement one of the numerous AJAX JSF approaches for years (the fry:ajax tag from J4Fry) and during the last months this approach was integrated into Apache MyFaces 2.0 while adapting it's interfaces to the new spec. The spec covers a lot of the basic features in a generic and flexible way. Btw.: MyFaces 2.0 is on its way, we're currently gluing everything together and I'm hoping for an alpha by end of august.

The most basic part of an AJAX implementation is replacing parts of the document. These are the features the JSF 2.0 API provides:
  • execute - The components that will be processed on the server in a blank separated list. Only the components named within this parameter get their decode, validate and updateModel methods called during phase 2-4. There is an @all keyword you can use to process the entire component tree.
  • render - The components that will be rendered and replaced within the HTML page in a blank separated list.
  • onevent - A JS callback that is triggered with three different events:
    • begin - occurs immediately before the request is sent
    • complete - occurs after the AJAX request has completed but before DOM manipulation has taken place
    • success - occurs after DOM manipulation has taken place (only for successfull request, else see onerror)
  • onerror - A JS callback that is triggered when the server signalizes that an error has occured.
  • params - An object that may include additional parameters to include in the request.
There have been discussions on both the MyFaces and Mojarra mailing lists on the nature of the ids in the execute and render parameters. Are they HTML ids or component ids? Here's the truth: The f:ajax tag can take either component ids that resolve relative to the nearest naming container or HTML ids. There is an algorithm that tries both. The procedural interface jsf.ajax.request(source, event, {execute: ..., render: ...}) requires HTML ids. The f:ajax tag will resolve the component and generate a behaviour that is in fact a call to jsf.ajax.request.

f:ajax provides three more attributes that offer JSF specific enhancements:
  • disabled - Indicates whether the AJAX behavior script should not be rendered.
  • listener - A method binding to execute when the AJAX request is processed on the server.
  • immediate - same as the attribute you know from the standard JSF action sources.
For Tomahawk 2.0 we are preparing a t:ajax tag that will include a bunch of extra options. Implementation will happen in J4Fry JSF 2.0 with a fry:ajax tag (targeted for end of juli) which will be repackaged for Tomahawk 2.0 when it is ready. This is the list of extra options we want to support:
  • timout - How long to wait for the HTTP response before aborting the request.
  • delay - How long to wait before issuing a request (helpfull with onkeyup or mouse move events to avoid tons of requests).
  • queuesize - Number of requests to queue (discard the oldest when the queue is full and a new one arrives).
  • partial submit - The current spec requires submission of the entire form though only the elements named in the execute parameter are being processed. Setting partial submit (or pps) to true could reduce the submit volume to the actually processed values.
  • disable - HTML id's of the components to disable while the request is running (can be implemented via onevent).
  • loadingbar - HTML id of an img tag to make visible while the request is running (can also be implemented via onevent).
  • errorhandling for errors that occur within the javascript - can be done with the onerror parameter, but the spec doesn't mention this use.
Just in case you've made it up to here (which would only happen if you are really deep into JSF and AJAX technology) you will be keen to know whether JSF 2.0 AJAX will do an auto eval on incoming scripts. If you rerender a portion of your markup that contains a script then auto eval will execute the newly arrived scripts. The spec doesn't mention this issue, Mojarra 2.0 (in it's current beta state) doesn't do auto eval but MyFaces 2.0 will.

Thursday, June 4, 2009

HowTo integrate Apache Axis and WebBeans

IMO WebBeans becomes a pretty cool dependency injection framework for Java. It works in a type-safe way (greetz to Spring ;-)) by using annotations. It provides Interceptors, Decorators and Event-Processing as well.
On the other hand Axis is a powerful framework to implement WebServices.

If you want to use the WebBeans benefits in your Axis Services you have to integrate both technologies. Axis provides two simple ways to do this:
  1. with a custom MessageReceiver
  2. with a ServiceObjectSupplier
So lets integrate WebBeans into Axis.
I'm running on Tomcat 6.0.18 with Apache Axis2 1.4.1 and WebBeans 1.0.0. Preview1.

Create a WebBeans integration class

package org.j4fry.webbeans;
import javax.inject.manager.Manager;
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.Parameter;
import org.jboss.webbeans.CurrentManager;

public abstract class WebBeansIntegration {
public static Object createInstance(AxisService axisService) throws AxisFault {
Parameter parameterServiceClass = axisService.getParameter(Constants.SERVICE_CLASS);
Class serviceClass = null;
try {
serviceClass = Class.forName(parameterServiceClass.getValue().toString());
} catch (ClassNotFoundException e) {
throw new AxisFault("There's not valid serviceClass specified", "serviceClass");
}
Manager manager = CurrentManager.rootManager();
return manager.getInstanceByType(serviceClass);
}
}

Possibility 1: Adjust Axis to use this integration class via a custom Message Receiver

package org.j4fry.webbeans;
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.MessageContext;

public class CustomMessageReceiver extends org.apache.axis2.rpc.receivers.RPCMessageReceiver {
@Override
protected Object makeNewServiceObject(MessageContext msgCtx) throws AxisFault {
return WebBeansIntegration.createInstance(msgCtx.getAxisService());
}
}

Possibility 2: Adjust Axis to use this integration class via ServiceObjectSupplier

package org.j4fry.webbeans;
import org.apache.axis2.AxisFault;
import org.apache.axis2.ServiceObjectSupplier;
import org.apache.axis2.description.AxisService;

public class WebBeansObjectSupplier implements ServiceObjectSupplier {
public Object getServiceObject(AxisService axisService) throws AxisFault {
return WebBeansIntegration.createInstance(axisService);
}
}

Tomcat Configuration - web.xml
Tomcat's web.xml have to reference the WebBeans Manager (of course you have to include the AxisServlet and the mapping information as well)

<resource-env-ref>
<description>WebBeans Manager</description>
<resource-env-ref-name>app/Manager</resource-env-ref-name>
<resource-env-ref-type>javax.inject.manager.Manager</resource-env-ref-type>
</resource-env-ref>

Axis Service Configuration - services.xml
The services.xml from your Axis-Service archive (.aar file)
If you choose possibility 1 you have to include your custom Message Receiver with the following tag inside the service-element:

<messageReceivers>
<messageReceiver mep="http://www.w3.org/ns/wsdl/in-out" class="org.j4fry.webbeans.CustomMessageReceiver"/>
</messageReceivers>

If you choose possiblity 2 you have to add the "ServiceObjectSupplier" parameter to your service element like this

<parameter name="ServiceObjectSupplier">org.j4fry.webbeans.WebBeansObjectSupplier</parameter>

Use WebBeans Annotation inside your Service class
If you've finished the previous steps you can use the WebBeans Annotations to inject some resources in your service class.

Resources
WebBeans RI 1.0.0 Preview1 (thanks to JBoss): http://downloads.sourceforge.net/jboss/webbeans-1.0.0.PREVIEW1.zip
Apache Axis2 1.4.1: http://ws.apache.org/axis2/

Wednesday, May 20, 2009

Use Subversive and Putty together on Windows

1. Download Eclipse Ganymede
From http://www.eclipse.org/
2. Download Putty
From http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
3. Extract Putty
Extract the putty.zip under C:\Apps\putty\ for instance.
4. Install Subversive (Subversion Plugin) and SVN Connectors
Open Eclipse and select "Help"->"Software Updates..."
Click on "Available Software" Tab
You need these two update sites:
Subversive Plugin: http://download.eclipse.org/technology/subversive/0.7/update-site/
SVN Connectors: http://www.polarion.org/projects/subversive/download/eclipse/2.0/update-site/
So add these two sites by clicking on "Add Site..." Button (two times)
Afterwards you see in your "Available Software" Panel the new two sites.
Expand the "Subversive Site" and select the following plugins:
Subversive SVN Team Provider Plugin
Now expand the "Subversive SVN Connectors Site" and select the following plugins:
Subversive SVN Connectors
After these steps click the "Install..." Button
If the installation is finished you have to restart Eclipse.
5. Configure PLINK
Add a new environment variable
Name: SVN_SSH
Value: C:\\Apps\\putty\\plink.exe -ssh -2 -A -l mySvnUser
You have to adjust the svn user.
Now start the PAGEANT and select your Private Key
6. Configure SVN Connectors
In Eclipse go to "Window"->"Preferences"
Select the "Team"->"SVN"
Select the "SVN Connector" Tab
Set the Option "SVN Connector" to "Native JavaHL (svn:1.6.0 (r36650) jni:0.9.0)"
Click the "Apply" Button
7. Add a new Repository Location
Go to "Window"->"Open Perspective"->"Other..." and select "SVN Repository Exploring"
Switch to the SVN Repository Perspective and click the Button "New Repository Location"
Now enter your SVN Repository (for example: svn+ssh://example.org/var/svn/myRepo)
Click the "Finish" Button.

There's one harm: Everytime when you use the Subversive Plugin via PLINK a DOS Prompt is opened by Windows :-(

Sunday, March 15, 2009

Fuzzy String Match in PostgreSQL with Debian

If you want to use FuzzyStringMatching in PostgreSQL you have to do the following steps.
Prerequisites: Debian 4.0 Etch (or higher), installed PostgreSQL 8.3, existing database in postgres

1. Install the postgresql-contrib package via apt

apt-get install postgresql-contrib

2. Switch to your postgres user

su - postgres

3. Open the psql interactive terminal with the following options database, user, password and the installation file for the fuzzy string functions

psql -d myDatabase -U myUser --password myPassword -h localhost -f /usr/share/postgresql/8.3/contrib/fuzzystrmatch.sql

Afterwards you can use the soundex, levenshtein, metaphone and double metaphone functions in your sql statements.
Offical documentation about the fuzzy string match functions: http://www.postgresql.org/docs/8.3/static/fuzzystrmatch.html

Tuesday, February 24, 2009

Comparing RIA Frameworks

If you are interested in RIA Frameworks you can have a look at that comparison http://sonymathew.blogspot.com/2009/02/comparing-ria-frameworks.html (Thanks to . ADF Oracle Faces RC you can find here, thanks to Juan Camilo Ruiz.
Unfortunately JavaFX as well as Microsoft Silverlight is not mentioned in that comparison. That's why you can find the "missing" JavaFX column here:


Platform/Technology: JavaFX/Java
User Experience: Modest Rich if you're familar with Java. Is exactly like a Desktop App. No Page refreshes, all data-access & rendering in the background. Includes also data-bindings from variables to GUI-widgets. JavaFX wraps some Swing components to use them in a JavaFX GUI. JavaFX 1.1 API
Browser Support: Support all browser. You can deploy JavaFX applications via an Java Applet, Java-WebStart (JNLP - Java Network Launching Protocol) or stand-alone applications on the desktop.
Throu Java Web Start a one-click installation is possible. Awesome feature: You drag an applet from the browser to your desktop.
UI Code: JavaFX Scripting and Java. Via JavaFX you can describe your GUI in a declarative way. JavaFX allows to bind variables to GUI-widgets (data-bindings) and provide a possibility to add triggers to variables.
You can develop the business logic in Java. There's a plugin for different Adobe Tools (e.g. Photoshop) for designing your GUI.
Access Remote Services & Data: You can invoke remote Java-Services via RMI.
Code Complexity Management: JavaFX files (JavaFX Script Programming Language), Java files, Organize into Class/Object hierarchies, Packages. It's statically typed and a compiled language.
Tool Support / Eclipse Integration: There's a JavaFX Plugin for Netbeans. The plugin in provides Code-Completion, Live-Preview of the GUI and so on. Download page
Refactoring & Code-Completion Support: All Java Refactoring & Code Completion with NebBeans.
JEE Integration: You can invoke EJBs like in any other stand-alone Java-Application.
Migration: You can use existing Backend-Services. Of course you can use existing any Java-Code inside a JavaFX-Application
Performance: Partial downloading of the JRE is one of the performances pros. So you can use JavaFX-Applications on clients which haven't got a full installed version of the JRE. Modest download-time to browser because of modularized JRE (Entire JRE: 14,5MB but you need in most cases only the Typical Applet version 4,6MB)
Static-Content (Externally Managed): You can style your widgehts with CSS
Requirements: You need JRE 1.6 Update 10
Search Engine Optimization: Not compatible.

Currently J4Fry is working on some Dojo-Tags for Facelets for RIA feelings in JSF applications.
The declarative Tag should ease the use of Dojo in JSF Applications.
There'll be news about J4Fry-DojoFaces-Project when there's a beta version for testing.