The Lazy Dev

Do less. Develop more.  

I got satisfaction (architectural solutions and cool technologies)

Very busy couple of weeks. I got over some new (for me) technologies that are actually pretty cool.

I got a lot of free degree of movement in the rejuvenation and restructuring of a software infrastructure that aims to deliver an ecommerce store for different countries.

The plan was to build a new message driven middleware based on ActiveMQ to manage the store orders distribution to some external system (like SAP). We need to have a lot of different small, very specific subject that are able to consume and manage the store orders in, ehm, order to manipulate them the most natural solution to me seem to run them in a OSGi container that allows to install, uninstall, upgrade, start and stop many different OSGI bundles (nothing more than simple jars with some meta information) in the easiest and fastest way.

So I got the change to play with Apache ActiveMQ to build the middleware and Apache Felix to have the OSGi container.
I got over both of them in less than two weeks, doing other tasks in the meantime.
Now I have a running Felix and I am able to produce a bundle that got activated once installed and started. This without changing my build tool chain, a simple "mvn install" is enough to produce the bundle, I just miss the way to deploy directly to the felix install.
And on the  ActiveMQ side I can connect producer as well as subscribers to my queues or topics and my subscribers are able to reconnect and recover messages they lost when they were offline.

This solve all the first wave of technical challenges and put the basis for a nice infrastructure.

So I am satisfied and I deserve a present, let's go looking for that Android phone...

Filed under  //   activemq   architecture   felix   jms   osgi   solutions  

Comments [0]

Maven Eclipse Plugin and the POM packaging project

I simply hate that "mvn eclipse:eclipse" does not generate project files for Maven projects that have POM packaging. Yes I know that I can simply create a Default Eclipse project on the folder but why do I have to do this action many time when the target is to avoid to repeat task?
So I hacked into and "fixed" it. That was simple. What is not is to understand reason behind the choice and provide a better alternative. Let's dig into it
 
When it comes to multi-project maven configuration, there is always a little confusion. There has been a discussion about it on the jug Milano mailing list a few months ago and what put confusion in my opinion is that "pom" packaging type is misleading cause it is used for multi-modules project as well for POM inheritance.

So, "pom" is a bad keyword for a packaging type. First, is the name of the file itself, second isn't related in any way to the to the objective of the packaging type. We should have two different keyword, something like "multi-module" and "abstract", the second behing for pom inheritance while the first one is obvious.

Back to the maven-eclipse-plugin, I expect it to generate a default Eclipse project, not a Java Project, for those two kind of projects. And the multi-module of course should not include the childs project in its Eclipse project structure: a project with just the pom.xml in it should be more than enough.

What do you think about?

Filed under  //   maven eclipse plugin  

Comments [3]

Lifestyle

Building mozilla is all about having the right environment set up and then follow these simple instructions:
https://developer.mozilla.org/En/Prism/Build

Very short page with few steps from source checout to the actual build. Nice.

So complexity is all about prerequisites. Let's see what these prerequisites are in different Operative system

Windows:
Let's start with this long page: https://developer.mozilla.org/En/Developer_Guide/Build_Instructions/Windows_Prerequisites
From there we need to manually download and install: a Visual Studio, a Windows SDK, a Mozilla Build package and configure something else about ATL studying this page https://developer.mozilla.org/en/atlbase.h , taking care to a eight bullet points long paragraph about "Common problems, hints and restrictions". It seems lot of work and thousand of possible things that could not work or have problems.
Scary.

Linux:
In a terminal:

<pre>apt-get build-dep firefox
apt-get install mercurial libasound2-dev libcurl4-openssl-dev libnotify-dev libxt-dev libiw-dev mesa-common-dev autoconf2.13
 </pre>

Finished.

Make your choice.

Comments [0]

A Tale of developing a Social Network implementation in Java. SE01E01 (Pilot)

Well in the ancient days of computer programming, developing an authentication and authorizazion system was all about giving permission to different kind of system user. In the end, there was the admin and then some other figure like some super user, simple user, whatever. A simple Account-Profile-Permission schema worked fine.

In our days, in a "social" kind of website, the authorization system is more complicated. We must take care of authorization that depend on a user specific permission of a resource that is not provided by the system but by another user. And often this authorization check is based on the relation between two accounts. So the model change. The framework that we developers can use use just do not have models and utilities for this stuff. They have models for the classical authorization system and lot of utility for cryptografy, realms for any kind of old style repository (LDAP, JDBC...) but nothing for example that is ready for modern web aplication: what about a Realm that works with Google or Yahoo account? Or with Twitter? What about user to user relationships?

So in developing a Web application that have some social aspect I had to face many challanges regarding dynamical permissions, both account to user reources and account to account. There are architecture and design problem, first of all. Then there is the integration with other framework you may already been using like Spring Security or Apache Shiro that provide some basic mechanism you do not want to rewrite). And the Web framework of course.

And this is just the Authorization part. Do not forget that also authentication is far more than just registering a username and a password. What about OpenID like login? And a Twitter based login? We need that. I do not like a site that does not allow me to log in with another of my existing mainstream account.

So here we go, I developed a lot of stuff: sometime was hardcore design (authorization system), sometime just dealing with some library (OpenID implementations, Spring Security, Wicket...) to make everything work.

I am almost at the end of the journey now and have a lot of feature in place. In this blog series I will talk about the most interesting and generic things I made. Hope co0uld be of interest for someone.

Looking forward Episode 02 :)

Filed under  //   authentication. webapp   authorization   social  

Comments [0]

Rant against Eclipse

Ok, the day is arrived. I will say things that make me sad, because I loved Eclipse, I loved developing on it. I like to consider myself an Eclipse ninja.

But it is no more the time.

I started developing on Eclipse at the end of 2002, with version 2.something. I came from kawa/JBuilder/Netbeans and when I tried Eclipse it was a big, BIG boost. Something incredible for the time. Years ahead everything else. Refactoring, incredible CVS integration, great test support, amazing completion and aid. Wonderful.
But, since a couple of years, evolution of the product slowed down. Just to say, it is not acceptable that it still does not ship with a built in and always working SVN support. Subclipse and Subversive... you know. And you need a basic IDE support for svn, even if, like me, you do almost every SCM and Maven operation from the command line.

Eclipse development is almost stucked since last two years, or maybe is focused on stuff I do not care about. I need a great coding editor, jUnit support and refactoring. And Eclipse got them all. The problem is all the rest. And the update system is the greatest failure of all. This is non acceptable at all. Everyday I use apt and Firefox which have amazing modular update system that never broke. And I use apt in Ubuntu development even now. And it works, always.

Biggest problem: one year development cycle is too long nowadays. Example? Eclipse 3.5 Galileo ships in June 2009. I install Ubuntu 9.10 in September. Galileo is broken on it so install 3.6 Helios (in development), but hibernate/spring plugins are almost non-installable on it, and so is Subclipse, you can survive without but when Eclipse starts using a .xml.svn-base spring file instead of the actual one because it does not have any subversion support in it and latest subclipse does not install on latest eclipse milestone... ARGHHHHH, I went mad.

No subversion support, no maven support. I mean, basic support, nothing fancy. Basic. Instead: nothing at all. One year of wait to have new features, and development version is a mess with plugin dependencies.

So, it is time to use Idea community. Installed, imported a project from POM, immediately everything is working, dependencies, subversion. Smooth.

I will see how this goes, but maybe after almost eight years, my relationship with Eclipse can be closed.

Filed under  //   eclipse   ide   idea   java  

Comments [0]

Google and the Open Source world

In December, Asa Dotzler, from the Mozilla Foundations, had some concern about Google privacy policy and ended this short blog post telling people how to switch to Bling search engine. Also, use the Microsoft product instead of Google ones.
This week, the latest alpha version of the next Ubuntu incarnation (due the end of April) have Yahoo as default search engine for the Operating System and Firefox as well. Yahoo simply pays more revenue than Google to Canonical.

Small pieces. But indeed, if you foresee a little longer than the next quarter, you can see that something is changing. Google is no able to compete on the real time search and the social search in general, which started becoming really relevant since end of 2008. Google put a lot of effort in promoting open source. Their way of course, but they actually are the most open company between the big ones, indeed.

Despite this, something is going wrong. I do not know if it's because people perceive the Big Evil behind the "we are not evil" face. I think is something different. From my perception, the problem is that Google is no more able to produce a single rocking product since they released Google maps/earth.
No Single One. And their best services are no more evolving as good as we expect.

Search is no more able to produce good content if we focus on recent results. GMail is still a great product but when you compare to some other communication platform (twitter based) you can smell the oldness and rigidity, in perspective. And if you go to see the new Bing Maps demo well... just go :)

As a disclaimer, I am not against Google or whatever company. I am with people that are best for future and I pretend to be able to read what will be nice in five years, not just in the next five months.

Comments [0]

OSGi: manually download bundles?!?

I just reached this statement in the Maven Handbook, chapter "Cooking with Maven and OSGi"

"After installing the Apache Felix Web Management console, you will need to install some of its prerequisites."

No one move! What what what? I am missing something. Please tell me I am missing something.
I do not want to believe that after years to make people move to Maven and embrace automatical dependency resolution and download, now with OSGi, the new frontier, I have to manually install jars into a bundle local directory launching something as ugly as:

<pre class="screen"><span><strong class="command">mvn pax:import-bundle \
 -DgroupId=org.apache.felix \
 -DartifactId=javax.servlet
 -Dversion=1.0.0</strong></span>

Come on, tell me this is not true. A bad dream. Please.
--
Daniele Dellafiore
http://danieledellafiore.net

Filed under  //   maven   osgi  

Comments [0]

2010, 6th week report

Thought week, better to write down results to improve morale :)

After three days in London last week, my working week started on Sunday. I worked on Artivio, actually in private testing to some potential customer, and on my still secret project on social shopping. I had the chance to consolidate some new stuff and I want to share what are the new weapons I can use for my webapps, in no particular order. I also updated my oholo stack.

Hibernate Search
Using Hibernate as persistence technology, integrating text search engine like Lucene has been a breeze. Now I have relevance sorted result, can prepare AND and OR query and stuff like this. This have been more easy than what I could expect. Well documented.

Release with Maven
I started to use Maven on regular basis to make releases. I already published a small article about.

Wicket: images and consistent URLs
I am ready to write a small but important article about best practice to serve images with Wicket, being application resources or user uploaded images. I will also write about a nice "Ajax search" with consistent URLs (a la Gmail) which I just implemented for Artivio. Yes, @kinabalu, I primise, first article in a few days :)

JQuery Tools
Artivio now uses JQuery Tools for some frontend goodies. I have some nice tooltip and overlay and in future also the image gallery will use this amazing piece of technology. I also implemented a really nice table with clickable rows made with CSS + JQuery :)

OpenID
I manage out to complete a OpenId authentication process using openid4java and integrating everything with my Wicket front end, thanks also to this nice article on IBM developerWorks.

iPhone applications
I expanded my collaboration network so from now on I can provide solutions for iPhone and similar devices. First project is on the way.

Research: Apache Shiro and some authorisation design issue.
Resource access authorization can be a mess if implemented the wrong way. I have investigated and tried Apache Shiro which is really nice and very similar to a custom implementation I developed and used since a year. Wicket integration is also a mess but after some investigation I have a solution. Will work again on this the next week for the secret project.

Java User Group
I attended JUG meeting last Tuesday, couple of presentation about distributed SCM: Mercurial and Bazaar this time. Very nice. I also checked for interest about a Wicket presentation that I will make the next JUG meeting sometime in March.

That's all. Now finally comes the weekend, so I can play with something else, I just read an article about........

Filed under  //   apache shiro   hibernate search   iphone   jquery tools   jug milano   maven release   openid   wicket  

Comments [0]

No pain releases with Maven

Maven Release Plugin is the sort of thing that can strikes fear into people. What is that thing going to do with my project?
Well, I gave the guy a try yesterday and after some problem (I did follow website documentation, me fool) I realize that is really fine and is a great help.

First: the configuration. Nothing is needed. This is nice. You just need a maven project with normally is in development, let's say our version number is 1.0.0-SNAPSHOT. This is a Maven convention: version-SNAPSHOT.
Do not trust Maven web site that says to configure a tagBase parameter. That line created me a lot of problems and is not needed at all.

Second: preparation. Run

mvn release:prepare

And wait. Maven will ask you
1. what will be the version number for the project (and all it's submodules, if any), suggesting 1.0.0
2 what is the TAG name on subversion, suggesting artifactId-1.0.0
3. what is the new development version number, suggesting 1.0.1-SNAPSHOT.
For all these questions, you normally will just accept defaults.
Finally, all the tests are run.

If everything was all right, we have a new tag/my-app-1.0.0 on the subversion server and the project is ready to be released, version number locally are changed accordingly. We now can perform the release.

mvn release:perform

Here the default Maven target is run (deploy deploy-site, if you did not configured differently). In the end, we have our 1.0.0 deployed on the articfact repository and the new local version number is 1.0.1-SNAPSHOT.

The release is complete and we can continue.
If something is wrong during preparation, we can just run

mvn release:rollback

Is very nice and painless process. Things are as easy as this with multi modules projects, but we have to take care that modules are already configured the right way. That is:

Parent project

   <groupId>myGroup</groupId>
   <artifactId>myArtifact</artifactId>
   <version>1.0.0-SNAPSHOT</version>
   <packaging>pom</packaging>
 

A module:

   <parent>
      <groupId>myGroup</groupId>
      <artifactId>myArtifact</artifactId>
      <version>1.0.0-SNAPSHOT</version>
   </parent>

   <artifactId>module1</artifactId>
 


Without adding non useful information about group and version in the module.

Module Dependencies. Better to use this form

      <dependency>
         <groupId>myGroup</groupId>
          <artifactId>module1</artifactId>
         <version>${pom.version}</version>
       </dependency>
 

this way, we specify the version only in the parent POM and in the parent definition of all modules. Maven Release plugin will change all those version number accordingly.

Filed under  //   maven release plugin  

Comments [0]

Weekly Tech Bullet(in)

Summary
JSr303 (bean validation), Spring 3, Eclipse 3.6M4, Web UI Coolness, Misc Goodies, World Is Changing and...


JSR303, bean validation.

hibernate validator 4: https://www.hibernate.org/412.html
spring 3: http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/validation.html#validation-beanvalidation

and wicket integration
http://magnus-k-karlsson.blogspot.com/2009/10/integrate-jsr-303-bean-validation-and.html
http://42lines.net/content/integrating-hibernate-validator-and-wicket

maybe will be native with wicket 1.5

Spring 3
news roundup: http://www.infoq.com/news/2009/12/spring30
video+slide presentation, related with EE6 : http://www.infoq.com/presentations/Spring-and-Java-EE-6-Jurgen-Holler

Eclipse 3.6M4
Out, but without any real interesting news to justify a manual upgrade from M3. Wait for M5.
http://download.eclipse.org/eclipse/downloads/drops/S-3.6M4-200912101301/eclipse-news-M4.html

Web UI Coolness
http://ajaxian.com/archives/scripty2-in-the-wiiiild

Goodies

Downloadify is a tiny JavaScript + Flash library that enables the generation and saving of files on the fly, in the browser, without server interaction.
http://www.downloadify.info/downloadify/test.html

World is changing

google plans to replace HTTP:
http://blog.chromium.org/2009/11/2x-faster-web.html

finally, a memo: last week we had

Servlet 3.0 (and Glassfish 3.0) released, so here it comes JEE6:

EE6 tutorial: http://java.sun.com/javaee/6/docs/tutorial/doc/
Datasource definition: http://planets.sun.com/techtips/group/blogs/#78b02780-c047-4416-887c-6c22fc42c33f

and take a look at recent entries in these blogs:
http://blogs.sun.com/swchan/
http://blogs.sun.com/jluehe/

Filed under  //   bean validation   jee6   scripty2   servlet3   spring3  

Comments [0]