Eclipse building workspace hangs

Eclipse, Java No Comments »

Today I encountered the problem that every time I started one of my Eclipse workspaces it always started to build the workplace and could not finish it. The progress monitor showed additional tasks waiting but I could not stop them. After killing the Java VM process several times and starting up again I searched for a solution and found this page.

I already heard about the clean command line argument and after adding it to the command line it resolved my problem. I will not add this permanently to my Eclipse links because it takes significantly longer to start up but I did a good job to fix the workspace.

Spring, AspectJ and Maven troubles

Eclipse, Java, Software No Comments »

In one of the applications I am currently working on I am using the following combination:

  • Eclipse IDE with AJDT
  • Spring
  • Maven

This week I upgraded Spring to version 2.5.5 and had some troubles with compiling my aspects in the maven build.I always encountered the following error message when trying to compile my project:

Unable to continue, this version of AspectJ supports classes built with weaver version 3.0 but the class org.springframework.beans.factory.aspectj.AbstractBeanConfigurerAspect is version 5.0

After doing some web search I found this JIRA entry for Spring about the changes in AspectJ dependencies. Then I found out that the aspectj-maven-plugin 1.0-beta-2 had dependencies to to AspectJ 1.5.2a in his pom file. To override this I did as described in this blog post and added the dependencies in my pom to AspectJ 1.6.0 - now I was able to do a build again.

Spartan Programming

.NET, Java, Software 1 Comment »

I feel good because the way I am trying to write code follows more and more the principles described on this wiki page:

Spartan programming strives for simultaneous minimization of all of the following measures of code complexity:

  1. horizontal complexity, that is, the depth of nesting of control structures, just as the total line length.
  2. vertical complexity, that is, the code length in lines.
  3. token count
  4. character count
  5. parameters that is the number of parameters to a routine or a generic structure.
  6. variables
  7. looping instruction, that is the number of iterative instructions and their nesting level.
  8. conditionals, that is the number of if and multiple branch switch statements.

Check out the post and this example!

Eclipse Ganymede release

Eclipse, Java, Uncategorized No Comments »

I am using Eclipse Ganymede for about three months now (since RC5 or RC6) and I am really excited about the new version. Here are my favorite improvements:

  1. Performance
    • Java compile on multi-CPU machines – the Eclipse Compiles now takes advantage of multi-threading capabilities of multi-CPU machines. Builds are a lot faster!
  2. UI improvements
    • I am a Firefox user so I am happy that it is now possible to close tabs by clicking on them with the middle mouse button
    • Focus on tooltips on mouse over – this means you do not have to press F2 to focus a tooltip. It allows selecting text inside a tooltip just by moving the mouse into it.
    • Quickfixes are focused on mouse over too. No double clicking on the small warning icon in front of the code line anymore – just moving the mouse over the wavy line below the bad code and click on the hyperlinked quickfix.
    • Debug tooltips show more detailed information – like in the variable view.
    • Values of constants are shown in tooltips too on mouseover
    • Rearranging code elements by drag and drop in the outline
  3. Coding
    • Code completion helps with casts – it reads the type of the instanceof condition and automatically offers more methods

      Afterwards it adds the necessary cast
    • Convert to StringBuffer quick assist – is useful sometimes when refactoring bad usage of String concatenation
  4. Formatting and cleanup
    • Format edited lines only – this setting allows you to format the code you added or changed and leaving the rest of the class untouched
    • The new cleanup settings allow to correct indentation and adding unimplemented methods automatically
    • Undo formatting for a set of Java elements – If you format your whole source or a package it can be undone again
    • Comments are formatted at the same time as code is formatted – happens in one pass and is a lot faster (for big classes)

See the New and Noteworthy for the whole list of new features.

There are a lot of plugins that are released simultaneous in new versions:

  • Web Tools Project version 3.0 – now includes a very nice JavaScript editor that allows to format JavaScript code in the same way as it is possible with Java code
  • Subversive version 1.0 – the official SVN plugin the Eclipse project chose
  • Mylyn 3.0 – no list of changes available until now

Thanks to the Eclipse team for bringing us this exciting new version of such a great tool!

Maven Eclipse plugin with better WTP support

Eclipse, Java, Software No Comments »

Seems like the new version 0.9.4.20080603-0114 of the Maven Eclipse plugin now provides better supports for WTP. In the last versions I had troubles when opening or closing depending Java projects. They were not added as jar files when the utility project was closed and the source project was not added to the maven dependency when opened again.

Check out the New and Noteworthy for more details about the new version.

JavaScript games

Fun, Java, Web No Comments »

Lately there a lot of people are experimenting what is possible wiht JavaScript. Libraries like prototype and scriptaculous are building the base für writing extensive object oriented JavaScript code. Some weeks ago the nihilogic blog presented a Super Mario implemented in 14kB of code playable in the browser. It even includes music ;-)

Today I found ProtoRPG an RPG engine written in JavaScript based on prototype and scriptaculous. There is also a playable demo online.

The last example is very interesting: A japanese user group managed to port parts of the Java VM to JavaScript. It allows to convert Java into byte code and embed it into the document. They created a cool Tetris clone.

The size of java.util.Calendar

Java No Comments »

A friend of mine asked me why his Java batch job reading a 23MB text file took over 300MB Memory. He read some text and date values and stored them in String an Calendar objects. A short web search brought up this blog post of Jason Rennie writing about the size of java.util.Calendar. He points out that a single instance of java.util.Calendar takes 432 bytes of memory. This was the explanation - 500000 calendar objects need 206MB memory! This was new to me …

Internationalization and JavaScript

Java, Web 2 Comments »

Lately the amount of JavaScript in web applications has grown a lot. JavaScript has always been there but with the need of AJAX and more and more dynamical features modern web developers can not avoid it.

Luckily there are a lot of good concepts arising and libraries available (e.g. prototype, yui, …) that show how to control the JavaScript monster. Something that always bothered me was that I was not able to find a good editor for JavaScript. Since about six months I am using JSEclipse from Adobe which is a free Eclipse plugin that provides a lot support for writing JavaScript (code-completion, syntac check, …).

The JSEclipse editor allows me to edit standalone JS files and script code included in JSPs but many times I ran into the problem that I needed to mix JavaScript and Java code. For example to define an URL for an AJAX request or to get a message from a resource bundle that has to be displayed in a JavaScript dialog. The JSEclipse editor does not understand this “mixed” code parts. Additionally it is not possible to externalize the JavaScript code into external files and the code looks ugly.

Yesterday I found this article about how to do I18N in JavaScript. I like the approach with the externalized constants very much because

  • it allows me to create a central include containing all the information from Java needed for the JavaScript code -> only one place to change
  • the main JavaScript code is “JavaScript only” -> editable by the JSEclipse editor
  • the JavaScript only code may be externalized into separate files
  • the appearance of the constants instantly makes their purpose clear and the JS code looks clean

There Ain’t No Such Thing as Plain Text

Java, Web No Comments »

Jeff Atwood posted a link to a site that sells T-shirts and stickers with the following image:

unicode

I am thinking of ordering some of them. Handling encodings is a very important part of programming and from my experience a lot of developers do not care enough about it. I encourage every developer to read “The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)” from Joel Spolsky. It describes the evolution of encodings in a very easy way.

Some months ago I wrote a post about how to deal with encodings when using Tomcat as web application container.

JSFDays summary

Java No Comments »

JSFDaysI have been to the JSFDays 08 in Vienna for the last three days and know I am starting to sort out all the information I got there.

I did not use JSF in a real project until know although I read the O’Reily book on JavaServer Faces more than three years ago. The main motivation for going to the JSFDays was that I am really unsatisfied with the currently available frameworks for building the UI of Java web applications.

The last projects I worked on mostly used Struts 1.x or Spring MVC. Like in many web projects that are currently under construction there had to be some sort of dynamic behavior and AJAX. So I used prototype, miraculous, jsonlib, ajaxtags and many more. But the whole process took a lot of manual effort and I was not satisfied with this way – although the results were correct.

In his keynote Ed Burns talked about the history of network aware applications. The conclusion of the keynote was that is important to use the ontology of UI styles to put things in buckets – to classify them. In the Q&A session after the keynote everybody agreed that the possibility to render components different for special devices (like mobiles) is not as important as initially thought (this was one of the ideas behind the JSF spec).

For me the keynote made clear what the idea behind JSF really is. It is not just another web application framework like Struts, WebWork, WebObjects or Tabestry. Sun tried to define a standard for how to build components of a web UI. This should allow different vendors to provide components based on the same standard so that developers may choose between them. The problem with JSF standards 1.1 and 1.2 was that it did not define enough to fulfill the users needs. The component frameworks that were created had to add a lot of features “outside” of the specification and this led to the incompatibility problems between the available libraries. The website jsfmatrix.net shows the result of this.

In the second session on Wednesday Jürgen Höller talked about new features in Spring 2.5 and how they could be used in a JSF environment. There were a lot of interesting new configuration options by using annotations I did not know. After the talk a discussion took place about what configurations should be done in external XML files and which configurations are better done with annotations.

Max Katz demonstrated how powerful the JBoss RichFaces are. They include over 70 components and provide nice AJAX features out of the box. It was a really impressing. I definitely have to give the JBoss tools a try when there is time. Max has also done a good comparison of available RIA tools with this article.

Matthias Wessendorf did a nice presentation of Oracle ADF Faces Rich Client. It seems like Oracle has put lot of energy into these components. They allow to create a very rich web interface.

In the fourth session Kito Mann showed us how scripting languages like Ruby or Groovy could be used in a JavaServer Faces application. Kito is running jsfcentral.com, a good place for finding information about JSF. He is also member of the JSF experts group and has written the book JavaServer Faces in Action.

On the second day Thomas Spiegl and Mario Ivankovits talked about JSF@work. They used Orchestra to resolve some common problems of JSF applications. Orchestra provides additional scopes (like a conversation scope) and other things. There is a website containing information about the small project they used for demonstration.

Alexander Jesse showed how he and his team use Selenium, JSFUnit and easymock to test JSF applications. I never used Selenium but it looks good, for me watij did the job.

Manfred Geiler used AOP to extend domain objects so that they could be used in a JSF view. A very interesting way to solve common demands. He is working on a library that will add the required utility classes which will be released as OpenSource.

In the BOF at on Friday some information about the future release of JSF 2.0 was showed. There will be an early draft available by the end of April.

The slides of the presentations are now available on the conference site. I added the pictures I made of the conference to my flickr account.

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in