Showing posts with label Java. Show all posts
Showing posts with label Java. Show all posts

Java scripting for the Remedium platform

The latest version of Remedium comes with support for dynamic Java scripting provided by the BeanShell interpreter: http://www.beanshell.org/

If you never heard of it, think of bean shell as the PHP equivalent for Java.

Remedium needed a way of getting away from statically compiled classes onto a scripting language. There were plenty of choices available and I chose beanshell because of its simplicity and close resemblance to the Java language. If you know Java or C, you will instantly figure out how this works.

What's the advantage for Remedium?

As a web based platform, it allows developers to create scripts that take advantage of the platform without needing to setup a full development environment. This also eases the task of customization and updates.

Along with support for bean shell scripts I also added support for displaying pages of raw HTML from the disk. This works nicely to create, for example, HTML forms that call a given bean shell script. This way it is possible to add business logic without any compilation being necessary.


So, now we have a neat standalone application server that is capable of serving and interpreting scripts that output web pages. No need for a JBoss, Tomcat, JSP, Apache or even PHP interpreters.

If you haven't try out BeanShell before, go ahead. It is worth the time to try out.

:)

Making a long name shorter within a range

This is just a small JAVA snippet to reduce a given long name onto a format that fits a max size.

Enjoy.

/**
* Provides a text that will match a desired dimension, reducing
* it if necessary.
*/

public static String shortText(String text, int maxLength){
String result = text;

// if this text portion is bigger than allowed, reduce
if(text.length() > maxLength){
int half = maxLength / 2;
int length = text.length();
result = text.substring(0, half) + ".."
+ text.substring(length - half, length);
}

return result;
}


Remedium was launched

The first beta version of Remedium was launched this week at http://reboot.pro/14801/


It has been a very long year moving this platform from my sketches onto a a real implementation as seen on the screenshot but I am happy with the current result.

Remedium opens the door to a new portofolio of projects based on the Java platform/language.

It is also an opportunity to move from an aging concept of applications restricted to work from a desktop onto applications that take advantage of web browsers and remote management.

So, when accounting the learning curve to program in Java proficiently, the effort to create a new platform from scratch and still account with the research work necessary to implement a new security concept, I would say that our development time required to make this possible since the past year was indeed put to good use.

Wouldn't have made it this far without the help of Professor Benoit Morel from CMU and my close friend José Feiteirinha. The professor helped me keep my feet to ground about the goals to reach and José brought really cool ideas to make this platform a reality.

Unless you had been involved since the start, it is difficult to have an idea of the effort required to implement this work. It required a bit too many rewrites until it resulted in a simple solution.

The first phase has been completed. The remedium client is indexing all files inside a given machine and placing the gathered data inside a set of databases.

Indexing files is not an amazing feature, creating a superb architecture was the real challenge. It provides enterprise functionality such as message queues, web server and component based modules that will allow us and other developers to expand remedium with more features.

The next two phases are equally challenging if not even more. We will start to work in a networked environment and aggregating data from multiple sources along with also feeding multiple points.

In the end, we should have a system capable of allowing users to exchange data and provide feedback on their own, using a perfectly decentralized structure.

A lot of work ahead, but it has been fun so far.

Security analysis of java based web forum products

A month ago I received a request from the University of Coimbra to look into the current options of Java based web forum software to provide my opinion on each of them.

To be honest, I am not impressed nor convinced that any of them are suited to power a popular web site that gathers a lot of (malicious) attention.

Regardless of personal preferences, I am sharing my opinions and impressions after evaluating each product that might help other people in the situation of choosing a Java based forum. You find this report at http://goo.gl/TfvKn

My ranking for these products is the following:

1 - JForum
2 - mvnForum
3 - JavaBB
4 - Yazd
5 - JSforum
6 - JGossip

In the forum arena, I should really note that PHP based forum software from groups such as vBulletin, IPB and myBB will really save you a lot of headaches in the future. Plus, it is possible to run PHP inside Java using a framework such as Quercus PHP.


The importance of database isolation


This week I've continued to progress on the new project.

One of the worries that has been roaming my head was the isolation of data between different components. On the current concept, components are isolated from each other to some extent but they still share some common resources like the database.

Below is a simple diagram that depicts the difference between shared and isolated approaches to database storage (credits to Mary Taylor @ IBM).


It was a relevant point to ensure that this resource would also stop being shared for the following reasons:
  • One faulty component could wreck the database, causing other components to also fail
  • 10 components can share a single database, could 100 or even 1000 use the same model?
  • No duplicate table names on the database could exist, this issue is aggravated when sharing this resource with other components
  • One single point of failure, if the database goes offline then all others will also fail to recover themselves

And some advantages also surfaced:
  • Each component can define custom login/passwords to access their database
  • Full control over the data that is stored, no other components change the data by accident
  • Provides choice between running their HSQL database based on a disk file for optimum storage or stored in volatile RAM for optimum speed
  • Each component can now individually store up to 16Gb of data using HSQL

I suspected that transitioning from a shared database model onto an isolated model would be somewhat troublesome, but the implementation was (fortunately) completed in a half a day and the effort was surely worthwhile. The end result passed all test cases and works exactly as intended.


Lesson learned:

When designing/implementing an architecture, do take into consideration the importance of keeping these resources isolated from each component as early as possible. In the long run you are improving the robustness of the system that is being designed.



Old school programming


This weekend was intense.

While working on my current project, I've slowly reached the conclusion across the past week that many things were wrong on the adopted architecture and that a simpler solution could be adopted.

Reminding myself of the words from a wise software engineer about efficiency of the good enough I could have kept on moving, but it would pain my soul knowing that things were not optimal. If there was a time to make changes, the time was now.

Couldn't afford more schedule slips as seen for the month of the March. So I've decided to plunge myself into a coding marathon to rearrange the code and do things right.


Started of at Friday after work around 17:00 and stopped around 04:00 Saturday morning to grab a snack and some sleep. Saturday and Sunday followed similar hour addiction for code cranking the intended result. The outcome was fabulous!


Not only the new framework is simpler in terms of architecture, it also looks great. The web user interface provides a neat appearance and makes life a lot easier than creating a Swing based interface for each component of the system.

Many other nice-to-have features were also added this way. People can use browsers or third-party developers can create wrappers that make use of the provided web services.


I know that anything coded during a hackathon weekend will haunt me with defects across the next times. That is a risk. But it is still better than living with an architecture that that would only add layers of unnecessary complexity and my own (human) resources are too limited to cope with them.

As result, there is absolutely no need to adopt a Google web toolkit, hibernate, SEAM, JBoss or ActiveMQ COTS for the moment.

The current result can rightfully be called old school programming (compared to current trends of course). And I say this perfectly aware of all advantages and disadvantages that come from this design decision. But nevertheless all that, there is elegance in simplicity and this is the route that I prefer to follow whenever possible.

And speaking of small, the entire framework when including the database (HSQL), message queue, process manager, web interface and remaining components is still using some whooping 3Mb of disk space.


Below is demonstration screenshot of the current status. The page demonstrates two applications. The first one is a simple file browser and the second demonstrates a simple page with text. Each application can host child applications and these are automatically added on the page tabs.




Tough weekend but happy results.

:)



Last night a findbugs saved my life

Do you know what FindBugs is?

It's a neat tool for Java that helps coders find part of your software that are plain redundant or might even run into "bugs" in the future (I prefer to call them "defects" rather than plain "bugs").

I had already used FindBugs in the Eclipse IDE last year, but only recently started using this tool for the NetBeans IDE and now I really appreciate its value.

To install this tool as an integrated plugin of Netbeans is fairly simple and covered widely across the Internet (here's an example).


When I started applying FindBugs on my current project, I noticed that my code was syntactically correct and ran as intended on the test cases, but FindBugs flagged some relevant concerns.

For example, it would flag a warning when new objects were created in a redundant manner or even when a given result might not be handled properly (null handling).


But what I found to be the most useful feature of them all, is the help for coding systems where multiple concurrent threads share information between them.

I mean, a developer already has some notion of practices necessary to prevent thread starvation and other concurrency errors but there exists a good amount of human effort and possibility of human flaw that frustrate your coding progress.

This is where FindBugs came to the rescue. While coding it was consistently able of reporting to me which methods were required to be synchronized in order to prevent thread locking and inherent locking of the outputs expected by other threads.

I would have been able of solving the synchronization issues on my own but having this tool available to help was a real time saver.

If you're still resistant to the idea of using FindBugs after reading all this, do try it by yourself at least once and then let me know what you think.

Take care!

:)



Simple and fast recursive find files for Java

This week I needed a simple routine to find files inside a given folder and respective sub folders.

There are plenty of solutions around the web, but these solutions typically use a second method or even more, instead of a single recursive method.

Below is the code that I've written, it is not perfect nor fully tested but it is simple and fast on my Toshiba R630 Win7 laptop (indexed 152450 files in 30Gb of data under 12 seconds), so I'm happy and decided to share this code snippet with the rest of the world.

It will output an array list composed of File objects. You only need to define where (the starting folder) and maxDeep (the level of subfolders that you want to crawl).

If you have suggestions for future improvement, please do mention them and I'll update the snippet along with placing your name on the credits. I liked this solution but I'm by no means a coding guru.

Have fun!



You find the snippet at this doc: http://goo.gl/pKq0D



--- update 1 (23th March 2011), the code was made shorter and simpler. Please update.

--- Benchmarks
Testing on drive D: with 30Gb of data took an average 12 seconds for 152 450 files
Testing on drive C: with 92Gb of data and 476 789 files started with 829 seconds on the initial scan and on posterior scans dropped to an average of 140 seconds.

Machine of these testings was a Toshiba R630, equipped with 4Gb of RAM, an i7 core and Windows 7 x64 bits.

:)

My first MQ

I've finally got around to build my own MQ (Message Queue) service.

Since early January that I've been trying and looking for MQ's already implemented by someone else but they all seemed unadjusted to what I had in mind.

So, to keep things simple I've written a message queue server using a database running on HSQL that is also embedded inside the application.

It was a bit of a marathon, since early design up to implementation it took less than one day and a half but I'm happy that it is available and working as intended.

The advantage of using a built-in message queue is the ease in maintaining several disperse services working with each other in asynchronous manner. For example, A wants B to receive an update. So, A leaves the message on the queue that B will receive whenever becomes possible.

This is handy for cases where a massive amount of information needs to be handled by B from multiple sources, becoming a simple tool that smooths the peak usage from daytime activities that would otherwise require more hardware to cope with the resource demand.

So, the next step is implementing a process manager using the same technique. The overall idea is to implement a publisher-subcriber-alike feature at the running processes. This way, process A is running while processes B, C, D (..) can check the ongoing status of process A since he only needs to update his process status on the process manager.

This way we provide a real abstraction layer between the presentation and business logic of our system, allowing to expand a given application to other platforms and interfaces, let them be web-based, GUI based on even plain command line.

----

Still, I would have preferred to use a COTS or open source project that could save my time and effort to implement these features. There's only so much that one or two developers can do on their own.

I believe that the limitation of working in a small team can also bring advantages, for example, we can't afford to support the bulk associated with typical enterprise-level frameworks and we are constantly reminded that any given implementation needs to be simple or we'll risk not reaching our goals.

Not using enterprise-level frameworks, doesn't necessarily translate to "it won't scale". The idea is to start little and add abstraction at critical locations from the start, so that we can replace components by others with more power (and resource demands) as we progress across the years. So, start small, keep growing as needed.


After all this is done, the final step is moving a bit higher in the ladder and allow connectivity between several clients on a given network using the same application. Let's move forward.

:)

Creating test cases

Recently I had to brush up my memory of how test cases for Java are created.

By default, using JUnit is a simple and straightforward way of creating a test case that either validates your code or assures that things are working as you need.

To get started, I recommend looking at the following (quick) tutorial: http://www.cavdar.net/2008/07/21/junit-4-in-60-seconds/

It's from 2008 but nicely explained and still up to date.

:)

To EJB, or not to EJB?

I've found myself asking this question, what advantages does EJB bring?

Googled a lot, found a lot some bulleted lists repeated across many sites, but not so easy to find the real reasons that might drive a person to consider EJB in regard to other options.

Finally, I've found a really a good article from Humphrey Sheil that was written at the year of 2000. It encompasses the fundamental questions that one should ask ourselves while looking at this technology even after a decade has passed.

Below is the introduction:
To EJB, or not to EJB: that is the question.
Whether 'tis nobler in the mind, to suffer
The slings and arrows of outrageous licensing;
Or to take arms against a sea of potential overheads and features,
And by opposing end them? To roll your own: to reinvent the wheel;
No more; and by reinvent, to say, we continue
The heart-ache of low-level systems maintained in-house,
and the thousand natural shocks
That flesh is heir to; 'tis a consummation
Devoutly to be avoided.



HTTP servers for Java 5


At my project it is necessary to ensure that each client can also become a HTTP server on their own so that they can communicate with other clients.

One would think that this task would be easier using JMS or any other communication protocols like XMPP.

However, I'm assuming a worst case scenario where the proxy for a LAN only allows connections from port 80 to the outside world and even then, checks all packages to ensure that the content of each message is real HTTP content.

I'm also assuming that the users of the client have no administrative permissions and no power to allow ports to be open or controlled by applications with guest permissions.

So, port 80 is a nice way to communicate since LAN proxies often let this door open but we still can't move past the administrative permissions required to control port 80 so I'm using for the moment 8080 as an alternative.

I've considered several communication protocols over the past two weeks, I've lost so much time looking around that I became a bit disappointed at some time. Much of what you find in Java nowadays is targeted to enterprise applications and there are good reasons why whenever someone refers to "enterprise" it might just seems like another synonym for "slow", "fat" and "octopus" to come in mind.

Let's try to change this picture then.


As HTTP server, I've abandoned the option of JMS and went forward onto plain HTTP interpretation back and forth of HTML messages (possibly marshaled with XML instructions).

Looking for HTTP servers, I've discovered that Java 6 comes already built-in with an HTTP server (link), however, we can only use Java 5 as the minimum supported java so I went looking for other projects. Found quite many of them but my favorite was this one: nanoHTTPD.

It is self-contained inside a single Java file (sized in 24kb) and brings all the basic support for exchanging pages back and forth.


As a wishful thinking, it would be nice to use the servlet power since the application is intended to be flexible and allows plugins to be integrated but I'm running out of time and other priorities need to be meet on time.

Nevertheless, here is a list of other small sized web servers in plain java that you might be interested in taking a look:

Jibble - http://www.jibble.org/jibblewebserver.php (small sized)
WikiWebServer - http://www.wikiwebserver.org (user editable)
TJWs - http://tjws.sourceforge.net (requires 7beee dependency to build)
WinStone - http://winstone.sourceforge.net (Servlet, looks professional, multiple hosts, lite version is 170Kb)



Avoiding stackOverflow errors in Java


I have coded a method in Java that will recursively iterate through all folders and respective sub-folders on disk.

The code seemed to work as expected, but whenever reaching a certain folder it would simply thrown an exception error and complain about stackOverflow.

Now, what is this stack overflow all about? Googling around it seems to occur whenever you enter into an endless loop situation.

This occurred while crawling sub-folders, so even thought my hard drive is quite filled up, it's not exactly filed with folders up to infinity.

So, what is wrong on this picture?

It turns out that this method is vulnerable to badly formed dynamic links. Meaning that whenever a link is found that points to a folder on lower level - it would just re-bounce back to that lower sub-folder and then loop back again ad eternum.

I've lost plenty of time trying to avoid dynamic links from being crawled but to no avail. Also reached the point of calling the absolute path of dynamic links and indexing each path on a database to check one by one if they had already been called to avoid these annoying loops (losing a lot of performance in the process).

Fortunately, found the solution to this riddle on this website - http://leepoint.net/notes-java/io/10file/20recursivelist.html

Albeit being a simplistic code, it provides a very efficient way to deal with the "symbolic-link-limbo". All you need to is define a depth level. They mention 20 as the default value and I applied the same concept on my code.

The second piece of the puzzle is verifying that each new directory that you want to crawl matches in terms of absolute path and canonical path. I've used the code from the following page as inspiration: http://www.idiom.com/~zilla/Xfiles/javasymlinks.html

After applying these changes, the code WORKED LIKE A CHARM!

Now the same method is indexing all folders up to 20 levels of depth and working as expected without seeing any more stack overflow messages. Under a MacBookPro it can index over 600 000 files under 16 minutes using less than 10Mb of heap space in RAM.

:)

My first Google engine application


Yesterday I've created my first application using Google App Engine.

I've been thinking about the possibilities of using a cloud computing environment for quite some time now. Google brings the advantage that you can use their services for free up to a given threshold of resources.

When I first heard about google app engine, it was some years ago and it was only supported on Python. At the time, phyton didn't exactly rock my world so I just walked away and kept on doing other things.

A few months ago, Java support was announced. My wild guess is that Phyton was not exactly a popular choice amongst many developers but Java is a whole different case.

So, I went on with my trial of their (free) service.

The Java environment that is officially supported by Google is based on the Eclipse IDE, since my preferences on coding fall more on the NetBeans side of life, I've "googled" for this alternative.

It turns out to be a quite simple process of configuration.

The first step is downloading and unpacking the Google App Engine SDK to some folder inside your disk - http://code.google.com/intl/en/appengine/downloads.html

No fancy install involved, just unzip and place it somewhere nice.

-------------------

Then, we open NetBeans. Google support is added as a plugin for the NetBeans IDE. There is a very good page that details these steps: http://kenai.com/projects/nbappengine/pages/NBInstall

When configuring the google plugin, I didn't selected the Hibernate Support and didn't seemed to matter much in either case.

After all said and done, you're only missing to add google app engine as a server inside your environment and this is also a simple task.

Click on the "Services" tab (that is next to "Projects" and "Files" on the right side of the IDE) and right click on the "Servers" item.

All that is missing is add a new server - select the "Google App Engine".

---------------

You should now have everything set up.

To start a web project, create a new project and select "Java Web" --> "Web Application". It will create you a template project that will be saying "Hello world!"

When you're ready to publish the project on the cloud computing environment, just right click on the project and choose "Deploy to google app engine".


Don't forget that you need to have a project already configured on the side of the google app website. After this you should be able to visit your URL and try out the results.

You can also view a full video of all these steps at the following location: http://kenai.com/projects/nbappengine/pages/Home

---------

Hope you have fun with cloud computing, this is a really simple and interesting concept at a very affordable cost.

:)

Surviving to java.lang.OutOfMemoryError: Java heap space

Memory leaks happen.

You might be a neat and tidy person that tries to ensure that no waste is made since the start of your project coding but leaks happen.

I fell into this trap.

Was feeling nice and comfortable believing that all my code was behaving nice and using a database was keeping the memory consumption low.

Everything was working perfectly when working with a few hundred files.

However, when dealing with little over 50 thousand files the picture turned out to be grey and the evil java.lang.OutOfMemoryError: Java heap space appears.

I tried my best to pinpoint the evil doers but I couldn't really point my finger at any guilty party since none seemed to blame.

Looking for solutions, most people recommend increasing the size of the virtual machine to support the stress. But as mentioned on the opcode website: http://blogs.opcodesolutions.com/roller/java/entry/solve_java_lang_outofmemoryerror_java, adding more memory only hides the problem, doesn't really bring a scalable solution.

That blog post in particular turned out to be very useful. A good approach is using profiling tools that "police" my application and see how it behaves and which parts are not behaving nicely.

NetBeans is remarkable in that sense.

It already comes with a profiling tool that is built-in and quite simple to use.

Just click on "Profile" --> "Main Project" and follow the directions.

It will launch your project and allow you to track what is really going on underneath the hood while the program is running.

Far better than following your program from the external task manager.

I'm attaching a screenshot so that you can see how it looks like:


My application was bursting at 100Mb, with profiling I was able to track down the reason of the leak: the log entries were consuming too many resources.

Disabling the log entries you can see on the screenshot how it goes well above the previous limit using less than 10Mb of memory to index 100 000 files.

Still a lot of things to improve on my code but this nifty tool sure helps to make it possible.

:)



Java: Getting the localized path to the user's Desktop under Windows


Getting the path to the user's desktop under Windows is tricky if you're not using Java 1.6 and above.

Looking for a solution around the web, I see many people recommending to use a wrap around the Win32 API using SHGetSpecialFolderPath or reading the value directly from the host registry system as suggested here: http://stackoverflow.com/questions/1080634/how-to-get-the-desktop-path-in-java

But I'm not very fond of these solutions and found one that is simple and seems to work fairly well although it doesn't seem to be documented (yet).

Just try this snippet under a Windows machine:

FileSystemView filesys = FileSystemView.getFileSystemView();
File[] roots = filesys.getRoots();
filesys.getHomeDirectory()


And you should be able to get the desktop folder as expected. Under my language, this folder is called "Ambiente de trabalho" so it worked like a charm.

This tip comes from Russ Bradberry: http://stackoverflow.com/questions/570401/in-java-under-windows-how-do-i-find-a-redirected-desktop-folder

:)

Reading the file version from Windows EXE and DLL files.



One of my goals for this week was reading the version of Windows executable files. The code should be implemented in Java and avoid resorting to any native calls.

So, a solution that seemed simple and straightforward would be reading directly the PE header from these files and read the version number for our use.

As many things in life, it's easier said than done.

The troubles started with the code required to handle binary files. I'm using Java and had none of my trustworthy code from previous projects to read files using specific x86 sizes for DWORD, WORD and Unicode strings with a limited size.

To my rescue, I've found the nifty binary file class from Jeff Heaton: http://www.heatonresearch.com/articles/22/page2.html

It's simple and perfect. Far better than the code I used in my previous projects. To handle Unicode strings I read each byte of the Unicode string onto a byte buffer and then use a Java command to convert it properly:

Grabbing the byte sequence of the string:

rgbData = new byte[Data];
for (int i = 0; i < rgbData.length; i++){
rgbData[i] = (byte) bin.readByte();
if ((rgbData[i]==0)&&(rgbData[i-1]==0))
break;
}


Converting to plain string:
String output = new String(rgbData, "UTF-8");

--------------------------

But my biggest trouble was the fact that the file version was not kept inside the PE header itself. The file version for DLL, EXE, OCX, DRV, SCR and similar files is kept inside a resource on the file. (Thanks to TheK on boot-land for helping me sort this detail: http://www.boot-land.net/forums/index.php?showtopic=11890)

So, besides implementing the PE header reading part, it was also necessary to implement all the logic to correctly interpret resources inside executables.

For my luck, this format is extensively documented around the Internet and even MS itself has released official documentation that explains (to some extent) how the structures should be read.

Nevertheless, it took me far longer than initially expected. I had planned for a full day of work and ended up working 3 days to achieve this goal. The code itself is not optimized for speed but for the moment it will suffice the needs of the prototype.

I've tested both with DLL's from the Windows kernel and custom executables from other compilers that had inclusively been modified with UPX - the exe compressor.

It was a good adventure. I've learned far more than what I originally knew about the binary format of windows executable files and this added knowledge might certainly open the "window" for other adventures in the future.

:)

Making Java apps look good in Mac OSX

Mac OS comes bundled with Java already installed by default and strives to make the user interface easy for users.

However, for those that like coding Java applications it might seem like a daunting task to make it look user friendly. If we were coding a platform specific application, we'd just select an icon to include at runtime and be done with it.

But in java - it's just too complicated and most pages about this topic that I stumbled upon were not really shedding much light on the matter.

Eventually, I discovered that Mac OS by default also includes some nifty tools to solve this matter.

There is a life-saver application called "Jar Bundler" and you can find it inside the /Developer/Applications/Utilities folder within the Mac OS. I've found it on this page: http://developer.apple.com/mac/library/documentation/Java/Conceptual/Jar_Bundler/Packaging/Packaging.html

--------------

Using this tool is a snap, open it up, select the Jar file that you intend to run and select an icon.

Before clicking on "Create application", you will need to choose a folder that will serve as base for your application. My advice is to pick an empty folder inside the desktop.

-------------

Other tweaks:
You can click on the "Set working directory to inside application package" to ensure that any files that your jar creates are kept inside the package (to keep it nice and tidy).

The icon format used by this tool is .icns but don't worry, you can use the online service at http://iconverticons.com/ to convert the file without any pain. If you want to make your image transparent, just open it on gimp, click on "Colors" --> "Colors to Alpha" and then "Ok". If you save the image as .png then it will be lossless and preserve transparency.

That's all. Hope this tip help others creating good looking apps with Java for OSX.

:)

yEd - a hidden gem for those who need a simple and free diagram editor

I've been a long time fan of Dia.

Both the Windows and Ubuntu version worked good enough to suffice my diagram needs.

I just turn it on and place all the diagrams into position to later paste them onto any document. Some people like Visio better and I'm sure it is, but my interest was in using a freeware tool that didn't required a license for something that I deemed as very simple.

Well.. there is no Dia for Mac. There is an expensive replacement for Visio on OSX but I'm still interested in good and free solutions.

Looking around the web I've stumbled on a very neat application: yEd.

This graph editor is simply perfect for my needs. Runs in Java and I could start right away for a try without installing it on my machine. The design is very intuitive and thought there are some things that might take one hour or two to get used - it is very easy to use without the need to read any sort of manual.

That's the type of program that I like, free and simple.

This editor can handle UML and a lot of goodies that someone in software development will surely enjoy.

If you're in need for a simple diagram editor, you find it here:
http://www.yworks.com/en/products_yed_about.html

:)