Skip to main content

Posts

Showing posts from 2006

Non-standard code in NetBeans

The NetBeans IDE has the facility to allow non-NetBeans generated enterprise projects to be imported into the IDE. It then generates a build file for the project allowing all the necessary build tasks to be carried out as if it were a NetBeans generated project. The catch here though, is that NetBeans can only load external enterprise projects if they are stored in the format recommended in the Java Blueprints. It would be really nice if NetBeans were a bit more flexible about this and allowed projects to use whatever directory structures they want – just like IntelliJ IDEA does. I have several older projects that I regularly work on which don’t use the blueprints recommended directory structure. Does anyone know if NetBeans have plans to be a bit more flexible in this area?

Einstein @ Home – Why not join in?

I’ve just created Team Software Developers for the Einstein @ Home project. Einstein @ Home is described as … a program that uses your computer’s idle time to search for spinning neutron stars (also called pulsars) using data from the LIGO and GEO gravitational wave detectors. Einstein@Home is a World Year of Physics 2005 project supported by the American Physical Society (APS) and by a number of international organizations. If you’ve got some spare CPU cycles, why not join the team. All software developers are welcome to join the team if they want. You can get details on how to join the team at: http://einstein.phys.uwm.edu/team_display.php?teamid=6956

Hibernate is the most popular Persistence API

A recent poll on java.net is currently showing that out of 1488 votes, Hibernate is the most common persistence API with 30.2% of the votes, whereas JDBC only has 11.3% of the votes. Its interesting and encouraging to see the number of people using EJB3 persistence is 18.6% This is encouraging given the short time that EJB3 has been available and also the limited number of app servers that support EJB3. I’m surprised (but pleased) that the number of people using JDBC is relatively low. There is often the impression that JDBC is easier to develop with than ORM solutions such as Hibernate or EJB3 – this isn’t something I generally agree with. Hopefully as Java Enterprise Edition 5 gets more traction, the adoption of EJB3 will increase and developers will see the benefits it (and other ORM solutions) provide.

Subversion Support for NetBeans 5.5 on Mac

I’ve been trying to get the Subversion support working within NetBeans 5.5 on my Mac and have been getting the following error message when I try to access the repository: NetBeans Subversion support requires Subversion executable! Install Subversion 1.3 (http://subversion.tigris.org) or later, add it to PATH, test by running 'svn --version' from command line, and finally restart the IDE, please. I’ve got the subversion client installed and can access it correctly from a terminal – its just NetBeans that doesn’t seem to like it. After a bit of Googling, I came up with the answer. You need to edit theNetBeans.app/Contents/Resources/NetBeans/bin/netbeans file and add a line near the beginning to set the path to include the directory Subversion is installed to: PATH=$PATH:/usr/local/bin Restart NetBeans and the Subversion support works!

NetBeans Visual Web Pack

On Roman Strobl’s Blog , Roman provides a 7 minute flash presentation showing some of the features of the new Visual Web Pack (essentially Java Studio Creator functionality) for NetBeans. The demo shows how to visually configure page flows in JSF and how to do data binding to a table, including pagination. The demo is impressive and shows how the Java Studio Creator functionality is being moved into NetBeans. Java Studio Creator is a good IDE for generating web apps, but I feel it is let down by not supporting Java Enterprise Edition 5 functionality. This new Visual Web Pack will however give us the JSC functionality in NetBeans which has supported Java EE 5 for quite a while now. Thanks for the demo Roman. I’m looking forward ot the technical preview!

NetBeans 5.5 RC1 Fixes Mac Issues

I’ve had quite a few issues with NetBeans Beta 2 running on my Mac. Occasionally (particularly when opening projects), NetBeans beta 2 presents a stack trace before completing an operation. I’ve just downloaded the new RC1 and I’m pleased to say these issues have now been fixed. According to the NetBeans Roadmap , we can expect the full release of 5.5 towards the end of this month.

Caught out by subversion.

I’ve just been caught out by Subversion! I copied a directory to another branch in my code tree using the cp command from a command shell and then tried to add the new directory to Subversion. To my surprise, Subversion told me that the directory was already under source control. When you copy directories that are under Subversion control, you have to be careful about the .svn directories as Subversion uses these to keep track of what is going on. In the Windows world this isn’t too much of a problem as the files are there to see in explorer. In the Unix/Mac world however they are hidden files and are easily forgotten about ;)

Subversion client for Mac OS X

This question is probably asked a lot, but are there any really good Subversion clients for Mac OS X? By really good, I’m thinking of something along the lines of TortoiseSVN on Windows. I’m currently using svnX which is good, but it doesn’t support properties yet which makes it impossible to tell it to ignore directories (e.g. the build directory). Are there any other good Subversion clients for Macs (apart from the command line of course !)?

Security for JSF Applications

I see a lot of posts around the internet by people asking what the standard mechanism for security is in JSF web applications. From a security standpoint, JSF applications are no different from any other servlet based framework applications. If you’re deploying applications on J2EE / EE servers (e.g. Glassfish or JBoss ) or even on Tomcat, then my first choice would be to use JAAS for security. JAAS is straightforward to configure, is flexible and is a standard. Next time you need to implement a security mechanism, I’d recommend you take a look at JAAS before embarking on writing custom security mechanisms. You never know – it may save you a lot of time.

Starting the Java DB in Glassfish

I’ve been doing a lot of development in NetBeans 5.5 beta 2 recently using Glassfish as my target application server. When doing development, its often quite useful to use the Derby DB bundled within Glassfish. As you’d expect from a modern IDE, NetBeans makes this easier for you by starting the database automatically so you don’t need to worry about it. When you deploy your application to a standalone Glassfish that isn’t "controlled" via NetBeans, you will probably find that the Derby DB doesn’t start automatically when Glassfish starts. Starting the DB is easily done from the command prompt though using the command: asadmin start-database

Is Java's Date Handling Good Enough?

In his  blog , Stephen Colebourne asks whether the Date and Calendar classes within the JDK are good enough or whether some other library such as  Joda Time  is a better replacement for date handling. Stephen is soliciting peoples opinions on whether JDK 7 should contain better date support in an attempt to establish whether a new Date JSR should be made for Java. All comments positive and negative are invited on  Stephen's blog .

Eclipse 3.2 – I don’t think so

With the recent release of Eclipse 3.2 and the Calisto release of 10 Eclipse projects, I thought I would give Eclipse a try. I’ve not used Eclipse in anger since the 2.x days, however I’ve used it on an off since, but never for my main development. I decided to give Eclipse 3.2 a try on Mac OS (Intel) so my view is tainted by how it works on that particular OS. My comments may or may not be valid on other OS – I don’t know. To try out Eclipse, I decided to write a few simple web apps – nothing too complicated, simply a few JSPs and JSF backing beans. The first problem I encountered was trying to get support for Glassfish inside Eclipse. There is a plugin availble for this, but this has to be downloaded and installed separately. This isn’t difficult, but a fiddle not the less. After installing the plugin, I found there are issues with it. It doesn’t always start the server correctly, and nearly always says that it has failed to start the server. If you want a few seconds, sometime...

Spring Web Flow RC 1 Released

Spring Web Flow RC1 has been released. Spring Web Flow allows you to capture page flows within a web application and can be used to build applications that guide users through a series of steps in a buisness process. The new and noteworthy features in RC1 include: Improved support for managing stateful business components Enhanced support for flow variables, created automatically when a flow starts A new flow execution redirect response type, for redirecting to a unique "flow execution URL" Refinements in state exception handling, with convenient support for transition-executing state exception handlers Improvements in flow attribute mapping support. Support for dynamic view name and target state expressions Enhanced JSF integration See  http://www.springframework.org/node/267  for more details. Are you using Spring Web Flow within your applications? If so, what sort of applications are you developing?

Java SE 6.0 Release 1 Developer Preview 1 Available For Intel Mac

Apple have today announced via the Apple Developer Mailing Lists that Java SE 6.0 Release 1 Developer Preview 1 is available for download for Intel based Macs. This is a welcome addition for Apple Java developers as it hopefully signifies the end of lengthy timescales between new releases of Java being available for other platforms long before being available on the Mac. See  http://lists.apple.com/archives/java-dev/2006/May/msg00040.html  for more details.

Apache Axiom Version 1.0 Released

After nearly 2 years of development, the Apache Software Foundation has released version 1.0 of Apache Axiom. "Apache AXIOM is a StAX-based, XML Infoset compliant object model which supports on-demand building of the object tree." See  http://ws.apache.org/commons/axiom/  for more details

Exception-Handling Antipatterns

I’ve just read an article on exception handling antipatterns by Tim McCune over on java.net. In this article, Tim describes the different types of exceptions Java has and when each different type should be used. He then goes on to detail 12 antipatterns giving an example of each and explaining why the code is wrong. This is an excellent article, and one I would recommend to any Java developer.

An Overview Of The New Features in J2SE 5.0

David Salter, 21st May 2006 J2SE 5.0 has been available for download since the end of 2004. This new release included many changes and enhancements to the Java platform such as speed and stability. Additionally, some changes were made to the Java language itself. These fairly major changes made to the language are: Generics Enhanced for loop Annotations (sometimes called metadata). Autoboxing and unboxing Typesafe enumerations Variable arguments (varargs) Static imports Using these new language features in your applications can have a big effect on your code, so this article aims to provide an overview of these new features so that you can start leveraging them in your code. As a Java developer I make extensive use of these features now and find that they bring the Java language much more upto date. Generics The latest version of J2SE could have a collection of any type of object). Prior to Java 5, if you wanted to extract the contents of a collection, you would use c...

Four Rules for NULLs in databases

There is an interesting article over on sqlservercentral.com that gives four rules for using null values in databases. Its quite an interesting read for anyone starting out with databases. The article is biased to SQL Server, but a lot of the article is relevant to other database engines as well.

Subversion support for NetBeans 5.0

I’ve just read an interesting post on the NetBeans User mailing list about enabling Subversion support in NetBeans 5.0. If you’ve not installed Subversion support already, here’s how to do it. To enable Subversion support in NetBeans 5.0, you need to select the "NetBeans Update Center Beta” on the Update Center Wizard. In the list of available modules, you can then choose “Subversion Profile for Generic VCS". I don’t know wht this isn’t in the standard update center, but …

Are the Intel iMacs as good as Apple Claim?

A few weeks ago when the new Apple iMacs were released, there was a flurry of activity in the blog space about whether the new iMacs are the perfect machine for Java or not. Since then, I’ve see articles that compare the Intel iMacs to their PowerPC brothers but not any articles comparing them from a developer point of view. So, does anyone have one of these new machines? Do they run Java better than the PowerPC counterparts?

Sun Java Studio Enterprise

Thanks to this post on The Pragmatic Architect I’ve downloaded Sun’s Java Studio Enterprise with the intention of using it for UML modelling. I’ve only played with it so far, but it looks like a comprehensive UML modelling package. I’ll post some more notes when I’ve used it further.

New Microsoft 2005 (2000) JDBC Driver Released

The new Microsoft SQL Server 2005 driver has been released and can be downloaded from here. The new driver is a type 4 driver that has been completely written from scratch and supports SQL Server 2000 as well as 2005. Accoring to MS, its been tested against Weblogic, Websphere, JBoss and Sun AS. Currently I’m using the jTDS drivers for connection to SQL Server and they seem pretty reliable. Its probably a bit early for any comparisons (the new driver was only released yeaterday), but if anyone knows any, please post a link in the comments.

NetBeans support for Subversion

Its good to see that a Subversion project web page has been created on the NetBeans web site. The aim of this project is to deliver good Subversion client support to NetBeans similar to that of the new CVS support . Accoring to the web page, the project is currently in its planning stage with the goal of having a prototype in May 2006. More details of this can be found at http://subversion.netbeans.org/teepee/ I hope the project team looks at TortoiseSVN and gets a bit of inspiration from this product. This has got to be one of the best SVN front ends available (Windows only I’m afraid).

Enumerating Ant targets programatically

In my previous blog post, I provided some sample code showing how to execute ant targets programatically from Java. This code showed how to execute the default ant target. Enumerating the targets is a similarly easy process. The code below shows how to iterate through all the ant targets within an ant build file. Project p = new Project(); // Setup Project p Hashtable table = p.getTargets(); Set set = table.keySet(); Iterator iter = set.iterator(); while (iter.hasNext()) { System.out.println("Target:"+(String)iter.next()); }

Executing Ant tasks programatically

Executing ant tasks programatically via Java is fairly straightforward as shown in the following code sample. To compile and run the following code, ensure you have ant.jar, xercesImpl.jar, xml-apis.jar and ant-launcher.jar (all from the ant lib directory) on your claspath. /* * AntRunner.java */ import java.io.File; import org.apache.tools.ant.DefaultLogger; import org.apache.tools.ant.Project; import org.apache.tools.ant.ProjectHelper; import org.apache.tools.ant.taskdefs.Ant; public class AntRunner { public AntRunner() { } public static void main(String args[]) throws Exception { File buildFile = new File("/path/to/build.xml"); Project p = new Project(); p.setUserProperty("ant.file", buildFile.getAbsolutePath()); p.init(); ProjectHelper helper = ProjectHelper.getProjectHelper(); p.addReference("ant.projectHelper", helper); helper.parse(p, buildFile); ...