Thursday, December 4, 2008

If a programming language was a boat...

Here is a funny post about "If a programming language was a boat..."

It's a short but very accurate and visual comparison of some of the most important programming languages out there and in the end the readers complement the missing languages all the way down to assembler, enjoy ;)

Wednesday, November 26, 2008

Integrating Spring Webflow to MyFaces

After working a couple of months developing a JSF based web application , I finally reached the point where I MUST integrate Spring to the project. The main reason is because I need the (conversation, flow and flash) scopes available in the Web Flow module.

JSF is a great MVC framework but up to this point it comes short of the tools I need, and SWF jumps in as a great complement to provide a solution to my current problem, but we all know that the Java world is huge and there are other frameworks with a similar goal to SWF, and for sure the biggest competitor is Seam.

The popularity of Seam has been growing a lot in the last months, and the fact that JBoss is on top of the work to create the Web Beans specification (JSR 299) and that Seam will be the base implementation, makes it a solid option, besides the community feedback has been very good and of course the integration with Richfaces is quite simple.

In this entry I will integrate Spring Webflow to MyFaces, and on the next one I will try to integrate MyFaces and Spring with Seam to get the best of both worlds.

The first step is to add the required Spring libraries, in my case I am using Maven so I added the repositories to my POM.xml file and declared the dependencies:

SpringSource Enterprise Bundle Repository - SpringSource
SpringSource Enterprise Bundle Repository - External

<!-- Spring webflow dependency -->

Next step is to modify your faces-config.xml to include the Spring variable resolver, it will allow to use EL binding in the application and it will look for values stored in the different scopes :

<!-- Facelets configuration -->
<!-- Spring integration -->

Now it's time to modify the web.xml file. A context parameter named "contextConfigLocation" will include the location of the spring configuration files, in our case we'll specify the webflow-config.xml, this file will contain the flows controlled by SWF.



Already at this point the application can be used again, and a simple reference to a bean can be declared at the webflow-config.xml like this:

<bean class="" scope="session" name="UserSessionBean"/>

Then we can access this bean from the jspx with the following EL:


That's it! a quick Spring integration to a MyFaces web application now you can start creating your flows and including your beans.

Thursday, November 20, 2008

Enhanced EL implementation

Normally in JSF you can use EL to access ${bean.someproperty} if this property has a setter and a getter, but sometimes this falls short of what we need. Jboss EL implementation allows to go beyond this point and you can call methods on an object like this ${bean.someobject.somemethod()}, probably this won't change your life but I'm sure it can make your coding easier.

All you need to do is to download jboss-el-2.0.1-GA.jar and declare the dependency:


And finally modify the web.xml:
Enjoy ;)

Wednesday, November 19, 2008

Maven and the Java Heap size...

Have you ever ran into this error while compiling a project using Maven in Eclipse:

"Java heap space error"

Well this can be easily solved by adding a couple of parameters to the JRE being used in Eclipse. Go to the following location:

Window/Preferences/Java/Installed JREs

Edit the JRE that is ticked and in the Default VM arguments add this:

-Xms128M -Xmx256M

You can modify these values according to your needs, and in case you had this problem while compiling through the console try setting this variable:

export MAVEN_OPTS="-xMS128m -xMX256m"

Tuesday, November 4, 2008

A week with Intrepid Ibex...

After a couple of months waiting for the release of Kubuntu 8.10 (Intrepid Ibex) I decided to give it a try and see what's good and what's not behind all the hype about kde 4, so here goes a small summary of what happened after a week using it.

It took around 3 hours for my Internet connection (at 90KBs) to download the whole thing and approximately 40 minutes to finish the installation process. The first impression is you'll get is that the look and feel of KDE 4 are great! I totally liked the effects, colors and window decorations.

The new plasma dashboard is a great functionality with a lot of potential in the near future for developers interested in creating new and clever widgets for each type of user. If you are bored of the current taskbar (now is called plasma panel), you can totally remove it and have a customized version including the widgets that you prefer at the location you like. I tried this new taskbarless way of working and I liked it, more work space and you have the stuff you need at the location you want.

After the initial excitement of the plasma dashboard, the effects and all the new visual improvements included with this release, came the small details that makes you go back to the comfort of Hardy Heron. First issue, the wifi connection, of course I had to plug my LAN cable to the wifi router to find a quick solution to this annoying problem and after googling and trying possible solutions for an hour or so, the wifi connection was back and the cable back in the drawer, the trick is to remove the Gnome default wifi manager, that for some unknown reason was being loaded at startup, this will allow KNetworkManager to take control of the wifi.

Now you will notice that KNetworkManager is still not working, at this point you should check the file /etc/network/interfaces and make sure that the wireless network interface is not included, the content of the file should be something like this:

auto lo
iface lo inet loopback

After fixing this issue and trying to go back to normal mode and keep coding java with eclipse I started noticing more and more issues... I noticed that the systray icons background are somehow mixed with the following icon, this issue is normally referred to a "corrupted systray" and so far it seems that there is no "cure" for this problem. While trying to fix the previous issue you will understand that the new systray and the new plasma panel (previously called taskbar) have less funtionalities that the KDE 3 one. It seems that the code for the previous version was hard to maintain and impossible to improve so the best solution was to start from scratch, and they will include functionalities little by little.

Since the systray wasn't quite working I decided to go taskbarless and everything was working ok until I noticed I am incredible dependent of all the information in the sytray like kontact, skype and pidgin notifications. Even though the sytray is available as widget for the plasma dashboard, it's not working correctly, the icons are displayed randomly and I was forced to resize the widget in order to make the icons appear again. This marked the end of the taskbarless era on my pc and I went back to the previous "corrupted systray" style until some magical update gets me out of it.

Firefox couldn't scape the problems and the tabs are not rendered correctly, it seems that GTK applications will suffer for a while and even though that the problem is visible, is not imposible to live with it...

So this week's summary is, if you are a Linux enthusiast that also likes to be productive with other things (in my case JEE development) and don't want to spend a whole week making your system bearable and besides you are reading this while using Hardy, well then keep Hardy and wait for a few months until this release gets really "stable" and some of the bugs and missing functionalities are included again, what can I say? well hopefully the second week will be better ;)

Running out of ram memory?

Hi everyone, a couple of days ago I was working at home with Eclipse, Geronimo, Mysql, Httpd and all the stuff you need to make things happen, when all of the sudden my 1GB ram memory wasn't enough for the duty... so after googling for a while I found out how to increase my swap space with a file and in just 5 minutes I was back on track, here are the details about how to do it:

dd if=/dev/zero of=/swapfile bs=1024 count=100000
mkswap /swapfile
swapon /swapfile

And if you want to have it active the next time you start your system then remember adding it to the fstab file like this:

/swapfile none   swap   sw   0   0

enjoy ;)

Thursday, October 23, 2008

a new beginning...

Hey all!

This is my first post and it's going to be a short one too :P I'm a JEE Developer with a couple of years of experience working on the IT business developing applications for big and small customers.

Currently I'm employed but on every single chance I get to work on a new technology or a new application I dig my toes into it as long as I can to learn new things as much as possible. I decided to start writing for two main reasons, it's a good way to keep track of what have I been doing and it's also good to share knowledge with the world.

Right now I'm working on web application based on MyFaces with a mix of RichFaces + OpenJPA +Facelets, I'll comeback later more details about...