When you want to search for the dot (.) character in a regular expression and not use it as a metacharacter use the following syntax:
String regexPattern = “[.]”;
Principal Software Engineer/Architect, motorcyclist, drummer, and artist
When you want to search for the dot (.) character in a regular expression and not use it as a metacharacter use the following syntax:
String regexPattern = “[.]”;
With Java 5.0 enums became much more powerful, click here for an overview.
I am working on a project that is using an enum to keep track of an attribute of one of my objects and wanted to initialize a HashMap inline in the call to the enum’s constructor. Such was my delight to find out that using a simple initializer block that it was a snap.
Here is the relevant snippet of code that illustrates the syntax:
public enum MediaFileType{
IMAGE( new HashMap<String, String>() {
{
put(“.jpg”, “image/jpeg”);
put(“.jpeg”, “image/jpeg”);
}
} );
This is quite incredible. A purely Javascript Flash Player. Here are some examples.
I think that projects like this are simply proof that the days of Flash and it’s plugin based virtual machine in a browser are numbered. Along with jQuery and a host of other Javascript frameworks that are being built, once HTML 5 browsers are in the majority there will be many more options for multimedia content/interactivity on a page than Flash.
While learning Java I came accross the “final” keyword and wasn’t quite sure what it meant.
Here is a good article that explains it and it’s appropriate usage.
On the SWT FAQ there is a how-to for compiling a 64 bit version of SWT for Eclipse, however, it is currently incorrect and took a bit of research and experimentation to sort out.
Here is how to do it (I have copied the original how-to and made edits where appropriate.
In this case, I am using Eclipse 3.5.1 under Kubuntu 9.04.
In this how-to you will extract the SWT source from the CVS repository and build your own binaries.
Introduction to Programming Using Java, Fifth Edition Version 5.0, December 2006
David J. Eck also provides the source code to a TextIO class that he has written that provides some additional IO features. Click here for an outline of those methods and on that page is also a link to the source.