torsdag den 17. april 2008

Choosing a desktop gui tool

Choosing a tool should amongst other parameters be chosen based on how popular it is. We ask google trends.

søndag den 11. november 2007

JBoss Tools

An important part of a Java-developers toolset is the IDE. (This is actually what makes us not care about codelines so much that we use RubyOnRails).

JBoss Tools is a set of plugins for eclipse. It can be downloaded on top of an eclipse for Jee developers using this update site:

http://download.jboss.org/jbosstools/updates/development

So if you start from scratch:

  1. Download Eclipse for Jee developers (MyEclipse doesn't work)
  2. http://www.eclipse.org/downloads/
  3. Go to > help > install updates
  4. Add new remote site with url = http://download.jboss.org/jbosstools/updates/development
  5. Select the available parts of this toolset.
  6. Click finish.
See more:

fredag den 9. november 2007

Documentation please

JBoss seam is cool. The idea is basically to make it simple to develop enterprise applications using EJB3...

This is all perfect but the documentation lacks a lot.

I've tried to get up and running using various application generators for a week or two (full time) and have used google to find the places to start, the plugins to install etc.

And I keep running into bugs, errors without ever feeling that I get much help from online ressources.

I need (please) one good website containing all the info I need to get started... It really isn't that difficult.

Please take a look at:
My task as a consultant is to suggest tools to be used. I've suggested seam since it looks very promising, but the lack of documentation means that I can't really get some good examples up and running as fast as I could if the tools available are able to do half of what they promise.

One good example is seam-gen. Where's the website explaining me how to generate the view for existing EJB's?

tirsdag den 6. november 2007

Generate your webapplication with JBoss Seam from an existing MySQL database (at least some of it)

JBoss seam is a nice framework. Code is relatively simple. It can be setup using a simple tool "seam-gen" and basically works out of the box.

But it's perhabs still a bit too new to be used in real life?

Let's try it:

My setup:
  • OS: Mac OS X (10.4.0) - macbook with 1.5 GB ram
  • DB: MySQL 5. something
  • Java: JDK 1.5
How to use seam-gen to generate a basic webapplication from an existing database.

Step 1)
  • Install JBoss seam and JBoss itself.
    • I'm using:
      • Jboss-4.2.2.GA
      • JBoss-seam-2.0CR3
      • MySQL
  • Go to the seam home dir.
  • Run the following set of commands:
./seam setup
./seam create-project
./seam generate-entities

What I got was a running application that could be opened in eclipse and Netbeans with EJB3 java classes, EntityHome classes, JSF views, editors and lists of all the entities in the database.

Good stuff:
  • It is a really good starting point for a brand new application (if the database is build up front)

Problems I found:
  • Whenever the tables in the database contains blobs or byte[] (bytearrays) it causes problems.
Disappointments:
  • The editors created disappointingly enough didn't make it possible to choose the "One" side in a ManyToOne relationship.
  • The String based properties were all to be edited in a textarea.
Questions:
  • Why is it not possible to create views from existing EJB3 entities?
    • Seams not to be a good idea to have to generate from a database if the EJB's are allready in place.
  • What's the plans with seam-gen?
  • Is it possible to generate-entities several times while working with an application without removing or overwriting added code?
  • Where can I find a real life example of a running application. (Not the academic examples provided, but some real applications).

WHAT I DID:
Here's what I chose for my specific settings:
morten-matras-computer:~/Desktop/jboss-seam-2.0.0.CR3 mortenmatras$ ./seam setup


Buildfile: build.xml

init:

setup:
[echo] Welcome to seam-gen :-)
[input] Enter your Java project workspace (the directory that contains your Seam projects) [/Users/mortenmatras/Documents/workspace] [/Users/mortenmatras/Documents/workspace]

[input] Enter your JBoss home directory [/Applications/jboss-4.2.2.GA] [/Applications/jboss-4.2.2.GA]

[input] Enter the project name [cat2] [cat2]
cat3
[echo] Accepted project name as: cat3
[input] Select a RichFaces skin (not applicable if using ICEFaces) [blueSky] ([blueSky], classic, ruby, wine, deepMarine, emeraldTown, sakura, DEFAULT)

[input] Is this project deployed as an EAR (with EJB components) or a WAR (with no EJB support) [ear] ([ear], war, )

[input] Enter the Java package name for your session beans [com.blob.session] [com.blob.session]

[input] Enter the Java package name for your entity beans [com.blob.entity] [com.blob.entity]

[input] Enter the Java package name for your test cases [com.blob.test] [com.blob.test]

[input] What kind of database are you using? [mysql] (hsql, [mysql], oracle, postgres, mssql, db2, sybase, enterprisedb, h2)

[input] Enter the Hibernate dialect for your database [org.hibernate.dialect.MySQLDialect] [org.hibernate.dialect.MySQLDialect]

[input] Enter the filesystem path to the JDBC driver jar [/Users/mortenmatras/Desktop/mysql-connector-java-5.1.5/mysql-connector-java-5.1.5-bin.jar] [/Users/mortenmatras/Desktop/mysql-connector-java-5.1.5/mysql-connector-java-5.1.5-bin.jar]

[input] Enter JDBC driver class for your database [com.mysql.jdbc.Driver] [com.mysql.jdbc.Driver]

[input] Enter the JDBC URL for your database [jdbc:mysql://localhost/catalog] [jdbc:mysql://localhost/catalog]
jdbc:mysql://localhost/THE_NAME_OF_A_SPECIFIC_DATABASE_EXISTING

[input] Enter database username [root] [root]

[input] Enter database password [] []
YOUR_PASSWORD_HERE

[input] skipping input as property hibernate.default_schema.new has already been set.
[input] Enter the database catalog name (it is OK to leave this blank) [] []

[input] Are you working with tables that already exist in the database? [y] ([y], n, )

[input] Do you want to drop and recreate the database tables and data in import.sql each time you deploy? [n] (y, [n], )

[input] Enter your ICEfaces home directory (leave blank to omit ICEfaces) [] []

[delete] Deleting: /Users/mortenmatras/Desktop/jboss-seam-2.0.0.CR3/seam-gen/build.properties
[propertyfile] Creating new property file: /Users/mortenmatras/Desktop/jboss-seam-2.0.0.CR3/seam-gen/build.properties
[echo] Installing JDBC driver jar to JBoss server
[echo] Type 'seam create-project' to create the new project

BUILD SUCCESSFUL
Total time: 38 seconds
morten-matras-computer:~/Desktop/jboss-seam-2.0.0.CR3 mortenmatras$ ./seam create-project
Buildfile: build.xml

init:

init-properties:
[echo] /Applications/jboss-4.2.2.GA

validate-workspace:

validate-project:

icefaces-staging-copy:

initcopy:

initpoms:
[echo] Setting up dependencies
[copy] Copying 1 file to /Users/mortenmatras/Desktop/jboss-seam-2.0.0.CR3/classes/poms
[artifact:install] [INFO] Installing /Users/mortenmatras/Desktop/jboss-seam-2.0.0.CR3/classes/poms/root.pom to /Users/mortenmatras/.m2/repository/org/jboss/seam/root/2.0.0.CR3/root-2.0.0.CR3.pom
[copy] Copying 1 file to /Users/mortenmatras/Desktop/jboss-seam-2.0.0.CR3/classes/poms
[artifact:install] [INFO] Installing /Users/mortenmatras/Desktop/jboss-seam-2.0.0.CR3/classes/poms/parent.pom to /Users/mortenmatras/.m2/repository/org/jboss/seam/parent/2.0.0.CR3/parent-2.0.0.CR3.pom
[copy] Copying 1 file to /Users/mortenmatras/Desktop/jboss-seam-2.0.0.CR3/classes/poms
[copy] Copying 1 file to /Users/mortenmatras/Desktop/jboss-seam-2.0.0.CR3/classes/poms
[copy] Copying 1 file to /Users/mortenmatras/Desktop/jboss-seam-2.0.0.CR3/classes/poms
[copy] Copying 1 file to /Users/mortenmatras/Desktop/jboss-seam-2.0.0.CR3/classes/poms
[copy] Copying 1 file to /Users/mortenmatras/Desktop/jboss-seam-2.0.0.CR3/classes/poms
[copy] Copying 1 file to /Users/mortenmatras/Desktop/jboss-seam-2.0.0.CR3/classes/poms
[copy] Copying 1 file to /Users/mortenmatras/Desktop/jboss-seam-2.0.0.CR3/classes/poms
[copy] Copying 1 file to /Users/mortenmatras/Desktop/jboss-seam-2.0.0.CR3/classes/poms

copyseam:

copyseamdependencies:

copyjbossembedded:

copy-lib:
[echo] Copying Seam and depdencies to the /Users/mortenmatras/Documents/workspace/cat3/lib directory...
[copy] Copying 97 files to /Users/mortenmatras/Documents/workspace/cat3/lib
[echo] Copying JBoss Embedded configuration to the /Users/mortenmatras/Documents/workspace/cat3/bootstrap directory...
[copy] Copying 26 files to /Users/mortenmatras/Documents/workspace/cat3/bootstrap

file-copy-war:

file-copy-ear:
[echo] Copying resources needed for EAR deployment to the /Users/mortenmatras/Documents/workspace/cat3/resources directory...
[copy] Copying 1 file to /Users/mortenmatras/Documents/workspace/cat3/resources/WEB-INF
[copy] Copying 1 file to /Users/mortenmatras/Documents/workspace/cat3
[copy] Copying 6 files to /Users/mortenmatras/Documents/workspace/cat3/resources

setup-filters:

file-copy:
[copy] Copying 11 files to /Users/mortenmatras/Documents/workspace/cat3/resources
[copy] Copying 1 file to /Users/mortenmatras/Documents/workspace/cat3
[copy] Copying 1 file to /Users/mortenmatras/Documents/workspace/cat3
[copy] Copying 1 file to /Users/mortenmatras/Documents/workspace/cat3/resources
[copy] Copying 1 file to /Users/mortenmatras/Documents/workspace/cat3/.settings
[copy] Copying 1 file to /Users/mortenmatras/Documents/workspace/cat3/resources
[copy] Copying 1 file to /Users/mortenmatras/Documents/workspace/cat3/resources
[copy] Copying 1 file to /Users/mortenmatras/Documents/workspace/cat3/resources
[copy] Copying 1 file to /Users/mortenmatras/Documents/workspace/cat3/resources
[copy] Copying 1 file to /Users/mortenmatras/Documents/workspace/cat3/resources
[copy] Copying 11 files to /Users/mortenmatras/Documents/workspace/cat3/view
[copy] Copying 3 files to /Users/mortenmatras/Documents/workspace/cat3/view
[copy] Copying 1 file to /Users/mortenmatras/Documents/workspace/cat3/src/action/com/blob/session
[copy] Copying 6 files to /Users/mortenmatras/Documents/workspace/cat3
[mkdir] Created dir: /Users/mortenmatras/Documents/workspace/cat3/src/model
[mkdir] Created dir: /Users/mortenmatras/Documents/workspace/cat3/src/test
[copy] Copying 1 file to /Users/mortenmatras/Documents/workspace/cat3/src/test
[mkdir] Created dir: /Users/mortenmatras/Documents/workspace/cat3/nbproject
[copy] Copying 3 files to /Users/mortenmatras/Documents/workspace/cat3/nbproject

create-project:
[echo] A new Seam project named 'cat3' was created in the /Users/mortenmatras/Documents/workspace directory
[echo] Type 'seam explode' and go to http://localhost:8080/cat3
[echo] Eclipse Users: Add the project into Eclipse using File > New > Project and select General > Project (not Java Project)
[echo] NetBeans Users: Open the project in NetBeans

BUILD SUCCESSFUL
Total time: 3 seconds
morten-matras-computer:~/Desktop/jboss-seam-2.0.0.CR3 mortenmatras$ ./seam generate-entities
Buildfile: build.xml

init:

init-properties:
[echo] /Applications/jboss-4.2.2.GA

validate-workspace:

validate-project:

generate-entities:
[echo] Reverse engineering database using JDBC driver /Users/mortenmatras/Desktop/mysql-connector-java-5.1.5/mysql-connector-java-5.1.5-bin.jar
[echo] project=/Users/mortenmatras/Documents/workspace/cat3
[echo] model=com.blob.entity
[hibernate] Executing Hibernate Tool with a JDBC Configuration (for reverse engineering)
[hibernate] 1. task: hbm2java (Generates a set of .java files)
[hibernate] 2007-11-06 19:15:22 org.hibernate.cfg.Environment
[hibernate] INFO: Hibernate 3.2.5
[hibernate] 2007-11-06 19:15:22 org.hibernate.cfg.Environment
[hibernate] INFO: hibernate.properties not found
[hibernate] 2007-11-06 19:15:22 org.hibernate.cfg.Environment buildBytecodeProvider
[hibernate] INFO: Bytecode provider name : cglib
[hibernate] 2007-11-06 19:15:22 org.hibernate.cfg.Environment
[hibernate] INFO: using JDK 1.4 java.sql.Timestamp handling
[hibernate] 2007-11-06 19:15:22 org.hibernate.cfg.reveng.OverrideRepository addFile
[hibernate] INFO: Override file: /Users/mortenmatras/Documents/workspace/cat3/resources/seam-gen.reveng.xml
[hibernate] 2007-11-06 19:15:22 org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernate] INFO: Using Hibernate built-in connection pool (not for production use!)
[hibernate] 2007-11-06 19:15:22 org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernate] INFO: Hibernate connection pool size: 20
[hibernate] 2007-11-06 19:15:22 org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernate] INFO: autocommit mode: false
[hibernate] 2007-11-06 19:15:22 org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernate] INFO: using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost/catalog
[hibernate] 2007-11-06 19:15:22 org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernate] INFO: connection properties: {user=root, password=****}
[hibernate] 2007-11-06 19:15:22 org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: RDBMS: MySQL, version: 5.0.41
[hibernate] 2007-11-06 19:15:22 org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.1.5 ( Revision: ${svn.Revision} )
[hibernate] 2007-11-06 19:15:23 org.hibernate.dialect.Dialect
[hibernate] INFO: Using dialect: org.hibernate.dialect.MySQLDialect
[hibernate] 2007-11-06 19:15:23 org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
[hibernate] INFO: Using default transaction strategy (direct JDBC transactions)
[hibernate] 2007-11-06 19:15:23 org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
[hibernate] INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
[hibernate] 2007-11-06 19:15:23 org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: Automatic flush during beforeCompletion(): disabled
[hibernate] 2007-11-06 19:15:23 org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: Automatic session close at end of transaction: disabled
[hibernate] 2007-11-06 19:15:23 org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: JDBC batch size: 15
[hibernate] 2007-11-06 19:15:23 org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: JDBC batch updates for versioned data: disabled
[hibernate] 2007-11-06 19:15:23 org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: Scrollable result sets: enabled
[hibernate] 2007-11-06 19:15:23 org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: JDBC3 getGeneratedKeys(): enabled
[hibernate] 2007-11-06 19:15:23 org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: Connection release mode: auto
[hibernate] 2007-11-06 19:15:23 org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: Maximum outer join fetch depth: 2
[hibernate] 2007-11-06 19:15:23 org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: Default batch fetch size: 1
[hibernate] 2007-11-06 19:15:23 org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: Generate SQL with comments: disabled
[hibernate] 2007-11-06 19:15:23 org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: Order SQL updates by primary key: disabled
[hibernate] 2007-11-06 19:15:23 org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: Order SQL inserts for batching: disabled
[hibernate] 2007-11-06 19:15:23 org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
[hibernate] INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
[hibernate] 2007-11-06 19:15:23 org.hibernate.hql.ast.ASTQueryTranslatorFactory
[hibernate] INFO: Using ASTQueryTranslatorFactory
[hibernate] 2007-11-06 19:15:23 org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: Query language substitutions: {}
[hibernate] 2007-11-06 19:15:23 org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: JPA-QL strict compliance: disabled
[hibernate] 2007-11-06 19:15:23 org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: Second-level cache: enabled
[hibernate] 2007-11-06 19:15:23 org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: Query cache: disabled
[hibernate] 2007-11-06 19:15:23 org.hibernate.cfg.SettingsFactory createCacheProvider
[hibernate] INFO: Cache provider: org.hibernate.cache.HashtableCacheProvider
[hibernate] 2007-11-06 19:15:23 org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: Optimize cache for minimal puts: disabled
[hibernate] 2007-11-06 19:15:23 org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: Structured second-level cache entries: disabled
[hibernate] 2007-11-06 19:15:23 org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: Statistics: disabled
[hibernate] 2007-11-06 19:15:23 org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: Deleted entity synthetic identifier rollback: disabled
[hibernate] 2007-11-06 19:15:23 org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: Default entity-mode: pojo
[hibernate] 2007-11-06 19:15:23 org.hibernate.cfg.SettingsFactory buildSettings
[hibernate] INFO: Named query checking : enabled
[hibernate] 2007-11-06 19:15:23 org.hibernate.connection.DriverManagerConnectionProvider close
[hibernate] INFO: cleaning up connection pool: jdbc:mysql://localhost/catalog
[hibernate] 2007-11-06 19:15:24 org.hibernate.tool.Version
[hibernate] INFO: Hibernate Tools 3.2.0.b10
2007-11-06 19:15:24 org.hibernate.connection.DriverManagerConnectionProvider close
INFO: cleaning up connection pool: jdbc:mysql://localhost/catalog
[hibernate] 2. task: generic exportertemplate: view/list.xhtml.ftl
[hibernate] 3. task: generic exportertemplate: view/view.xhtml.ftl
[hibernate] 4. task: generic exportertemplate: view/view.page.xml.ftl
[hibernate] 5. task: generic exportertemplate: view/edit.xhtml.ftl
[hibernate] 6. task: generic exportertemplate: view/edit.page.xml.ftl
[hibernate] 7. task: generic exportertemplate: src/EntityList.java.ftl
[hibernate] 8. task: generic exportertemplate: view/list.page.xml.ftl
[hibernate] 9. task: generic exportertemplate: src/EntityHome.java.ftl
[hibernate] 10. task: generic exportertemplate: view/layout/menu.xhtml.ftl
[javaformatter] Java formatting of 64 files completed. Skipped 0 file(s).
[echo] Type 'seam restart' and go to http://localhost:8080/cat3

BUILD SUCCESSFUL
Total time: 5 seconds

lørdag den 3. november 2007

Comparing programming languages

Get a good salary by guessing what the next big trend is!

Here's a good starter:

.NET and Java looks like the overall winners of the Programming language race:

But Ruby on Rails is really accelerating:

How will the big players react to this new player?

We expect some reaction and I know that the Java world is making an effort:
  • Stripes, brilliant and simple to learn
  • JBoss Seam, standard based and with application-generators
  • Grails, dynamic language on top of java
  • JRuby - the best of the old language + the best from the new...

torsdag den 1. november 2007

Jobs and frameworks

Indeed indeed is interesting. The site works by comparing the number of jobs offered for the searched terms over time. Thereby we can display the number of people needed now and trends for the future.

This enables us to figure out what companies are choosing and perhabs make it possible to foresee the next big trends within software development:
Keep coming back. This blog will be updated with new trends comparisons...

Next time I'm back I'll try to find the frameworks to steer away from. (The dead ends).

Comparing Web frameworks

Many frameworks to choose from. One test to determine what's hot and what's not is the googletest.

The idea is quite simple:

  • Search for the framework name in google - results only in the last month

Name Total
Combined with Hibernate
Combined with EJB3
Combined with tutorial
Combined with EJB3 tutorial
EJB3
77.400

28.700
Hibernate
911.000

272.000
Grails
102.000 37.200 72 44.50058
JBoss Seam
81.600 12.700 540 12.30088
Stripes
350.000 16.500 31 Unsure
22
Wicket
413.000 28.800 65 39.10041
GWT
434.000167.000 88134.00040
JRuby
202.000 47.200 66 95.00046
"Spring MVC"
13.900 913 72 36134
Jython
78.000 20.200 23 41.00013
Ruby on Rails
1.400.000 142.000 697 202.00062
Tapestry
121.00041.0009560.50048

Stripes searched using: "Java Stripes" when framework by itself.

What web framework is the next big one?

Om mig

Odense, Denmark
A simple man with a simple life... Couldn't be better