Skip to main content

JetBrains has released IntelliJ IDEA 9.0.2
   Posted:


IntelliJ Idea 9.0.2 has just been released.

This version includes these new features and improvements :

  • View vertical indent guides
  • New action "Show in Explorer" from the contextual menu
  • The detection of the necessity of rebuild project indexes has been improved
  • Some code samples have been added for Java, JavaScript and PHP
  • The source can be directly attached to decompiled class file from the edit window
  • The Java debugger supports autoboxing
  • A diff tool for UML
  • New consoles for SQL and HQL
  • Improvements of the Spring configuration file editor view
  • Improvements of the remote projects support
  • Stacktrace folding for Groovy code
  • Support of GWT 2.0 UIBinder
  • Package Adobe AIR applications
  • Better support of CSS3
  • Tracking of Grails 1.2 Ivy dependencies
  • Flex
    • Live templates for Flex
    • Parralel compilation of indenpendent Flex modules

  • PHP
    • New options for code style programming
    • New inspections
    • New quickfixes and intentions

You can view the complete release notes  of this new version.

There is no great new features, but the bug fixes and little enhancements make that version really interesting (like all new versions of IntelliJ IDEA).

Comments

Java 7 : New I/O features (Asynchronous operations, multicasting, random access) with JSR 203 (NIO.2)
   Posted:


Like I've said in other post, we will have a new API to access File System in Java 7, but we'll have several others new features in NIO.2 that I've not covered

So I'll try to cover them in that post. Indeed the JSR 203 (also known as NIO.2) add several new classes that improve I/O code.

In this post I cover the following features :

  • SeekableByteChannel : A random access channel
  • MulticastChannel : A channel that allow for IP multicasting
  • NetworkChannel : The new super interface for the network-oriented channels
  • Asynchronous I/O API : The new API to make I/O operations in an asynchronous way.

Read more…

Comments

Links of the week (April 20)
   Posted:


Some interesting links of the week:

Comments

Using Substance Look And Feel in OSGi
   Posted:


I experienced some problems with Substance in OSGi. Using this code :

SubstanceLookAndFeel.setSkin(new BusinessBlackSteelSkin());

I got different errors, like :

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at 
org.pushingpixels.substance.internal.utils.SubstanceColorUtilities.getDefaultBackgroundColor(SubstanceColorUtilities.java:823)

I found a simple solution to make Substance work in OSGi :

try {
      UIManager.setLookAndFeel(new SubstanceBusinessBlackSteelLookAndFeel());
} catch (UnsupportedLookAndFeelException e) {
      LoggerFactory.getLogger(getClass()).error(e.getMessage(), e);
}
UIManager.getLookAndFeelDefaults().put("ClassLoader", SubstanceBusinessBlackSteelLookAndFeel.class.getClassLoader());

With that code, i've no more problems using Substance Look And Feel.

Hope that will help someone.

Comments

Java 7 : Languages updates from Project Coin
   Posted:


I continue my posts on the new features of Java 7. In this post, I'll detail the news coming from the Project Coin. This project has computed more than 70 new features proposal from the Java community for integration in Java 7.

In this post, I'll detail the Final Five (or So) features chosen from this project to be included in Java 7.

Diamond Syntax

This feature is a really simple syntax improvement for generics. With that feature, you can avoid to write twice the generics type in a generics declaration. A little example :

Instead of writing this :

Map<String, Collection<Integer>> map = new LinkedHashMap<String, Collection<Integer>>();

You can now write that :

Map<String, Collection<Integer>> map = new LinkedHashMap<>();

That's really practical, but not essential.

Simplified Varargs Method Invocation

This improvement is not a new functionality, but only a move of a warning. Like you must know, we cannot create arrray of generics type because the type verification is not made at the same time. But with the Ellipse of Java 5, you can made that type of array implicitely and the compiler generate warning at each invocation of that kind of method, so the warning has moved to the method declaration to have less warnings.

Integers declaration

You'll can declare integers using binary values :

int binary = 0b11001001001;

and you can use _ (underscores) in the declaration :

double amount = 1_999_888_777.25;
int color = 0xdd_dd_dd;
int binary = 0b110_0100_1001;

That's allow to make more verbose code, but it's only sugar.

Collections manipulations and declaration

Another improvements to code verbosity, is the support of collections in the language. You'll have code facility to access and edit indexed collections like list and maps and to declare easily collections.

First, you can access to an element using the same syntax as the array :

List<String> list = ...;
Map<String, String> map = ...;
String firstValue = list[0];
map["Test"] = firstValue;
String valueFromMap = map["Test"];

For the maps, that works with any type of key. So if you have one of your class for key, you can directly pass it in the code like the Strings in my example.

And, you can also quickly declare collections like array :

Lists with [] :

List<Integer> numbers = [ 1, 2, 4, 8, 16, 32, 64, 128 ];

Sets with {}

Set<Integer> numbers = { 256, 512, 1024, 2048, 4096 };

And Maps with {} and : to split value and key :

Map<String, String> translations = {
  "Hi" : "Bonjour",
  "Goodbye" : "Au revoir",
  "Thanks" : "Merci"
} 

All that created collections are immutables.

Strings switch

A really good feature : Switch with Strings values. You can now do that kind of switch : ¨

String value = "";

switch (language) {
  case "fr":
    value = "Bonjour";
    break;
  case "en":
    value = "Hi";
    break;
  case "de":
    value = "Guten tag";
    break;
  default:
    value = "Hello";
    break;
}

I thinks, it's really great. With that, we can delete a lot of ugly list of if/else if code.

Automatic Resource Management (ARM)

Another great feature, you can automatically close the resources using a new try clause :

public void write(URL url, File file) throws IOException {
  try ( FileOutputStream fos = new FileOutputStream(file); InputStream is = url.openStream() ) {
    byte[] buf = new byte[2048];
    int len;
    while ((len = is.read(buf)) &amp;gt; 0) {
      fos.write(buf, 0, len);
    }
}

In that code, the FileOutputStream and the InputStream will automatically be closed after the try, making a cleared code and you cannot forgot a resource with that.

And last, the modifications to support the JSR 292 directly in the language. I've already described that features in other post : Java 7 : More Dynamics

That's all for these new language enhancements from the Project Coin.

For me, i like the new ARM and the Strings Switch, but i think this is simple enhancements, they were others proposals in the Project Coin i found better, like the "Improved Exception Handling for Java", "Improved Wildcard Syntax for Java" or "Elvis and Other Null-Safe Operators", but this a good start.

Comments

JTheque : Problems when migrating to OSGi
   Posted:


Like you perhaps know, i'm currently migrating JTheque to OSGi. During this migration i found several problems in the JTheque architecture that made the migration impossible without changing some concepts. In this post I'll detail all the problems I found.

Resources

First of all, i had to completely change the way to cache resources. Before, i used a ResourceManager to cache images/icons. To get an image/icon, i gave to it the path to the resource and the manager made the rest. I used Spring to load the resources (using the Resource class). That worked well because all the modules and the core were in the same application context.

But now, there is an application context for each OSGi bundle, so that doesn't work at all. So i had to find an other way. The manager cannot load the resources because they're accessible from the other bundles. So I changes the way the manager works :

  1. The modules must register all the resources they need in the resource manager. They can always use Spring to load the resource or direct use the Resource class to load it.
  2. When the module need an image/icon, it ask the resource manager. The manager watch on the cache (the cache associates the Resource to the loaded image/icon) if the image is already cached. If it's cached, it directly return the image else, it load the image from the resource and return the loaded image

In that way, the resource manager doesn't have to access directly to resources on other bundles and everything works well.

States

The states are a way to store configuration for the modules. Before, the states must implements an interface and when they we're saved, the class were saved in a file and at startup created by reflection. But that's was not possible anymore, because the class was not accessible from the state bundle.

So I changed the way the data were saved using directly methods of the interface to get the stored data and to restore them at startup. Moreover, I also replaced the interface by annotations.

Miscellaneous

More than these other major changes, i've also some others problems :

  • The JDBC driver class was not accessible. I add the package import to the manifest headers and get the driver version from SpringSource Repository to works with OSGi
  • Substance doesn't work anymore. At this time, i don't know i that comes from OSGi or from other changes i made in the application, but i've not solved this problem.
Comments

10 most useful Google Tools
   Posted:


More than provide an extremely powerful search engine used by almost everybody, Google provides also a lot of very useful tools. In this post, i list the 10 most useful Google tools from my point of view.

1. Gmail

For me, this is the best email client ever. The interface is quick and reactive and there are many interesting features. The spam filter is really powerful, i have no more spams since i've switched to GMail a long time ago. The storage capacity (~7.4 Go) is also totally enough. Moreover, this client is totally integrated with the other tools of the Google network (Documents, Buzz, Agenda, ...). With the plugins, you can also add several others features to GMail including integrating with other tools like RememberTheMilk by example.

The included chat is also a great functionality. I use it everyday.

No more spam with : Google Mail

Read more…

Comments

Drag and drop files to Gmail
   Posted:


The Gmail team has just added a great new functionality to Gmail.

Until now, to add attachment to your mails, you had to click "Attach a file", find the good file and click it.

Now, you can directly drag the file from your file system to Gmail :

Gmail Drag files from file explorer


Gmail Drag files from file explorer result

It's a little functionality, but that save a lot of time and that's the kind of feature we (computer scientist) love.

Try it, that's awesome !

Comments

Substance 6.0 is out
   Posted:


Kirill Grouchnikov has just announced the release of the final release of Substance 6.0. Substance is a really powerful look and feel for Java. This look and feel looks pretty good and is skinnable, you have several themes to apply to the look and feel to customize the appearance of your applications.

This version includes the following new features :

  • Multi-state animated transitions
  • New look for text components
  • Custom components states
  • Support for drop location

The deprecated APIs have been removed from this release. There is also revisited APIs that can break your code. The animations are now powered by Trident 1.2.

More information on the official announce.

Comments

Java 7 : More concurrency
   Posted:


With Java 7 (Dolphin), we'll have some concurrency and collections updates with the JSR166y, extension of the JSR166 of Doug Lea.

In this post, we'll see the most important news :

  • Fork/Join Framework
  • TrasnferQueue
  • ThreadLocalRandom

Read more…

Comments