Friday, August 29, 2008

Newbie to REST

I found this while researching about REST WebServices, trying to find a simple way to describe it:

How to explain REST to my wife
http://tomayko.com/writings/rest-to-my-wife

Wednesday, August 13, 2008

Essential Skill for Agile Developmet (Turning Comments into Code)

I started reading this book and find it quiet good in the way it clear show you how to improved your development skills in a very simple way.

Today im reading the following chapter 2: "Turning Comments into Code".

How often we find outdated comments in the code, how often do we find useless comments in the code.

Basically this chapter tells you that if would be better insteads of putting a comments side by side with the code, just to make the code as clear as the comments itself. i.e:

public class ParticipantInfoOnBadge {
String pid; //participant ID
String engName; //participant's full name in English
String chiName; //participant's full name in Chinese
String engOrgName; //name of the participant's organization in English
String chiOrgName; //name of the participant's organization in Chinese
String engCountry; //the organization's country in English
String chiCountry; //the organization's country in Chinese
...
}

this could be written like:

public class ParticipantInfoOnBadge {
String participantId;
String participantEngFullName;
String participantChiFullName;
String engOrgName;
String chiOrgName;
String engOrgCountry;
String chiOrgCountry;
}


As you can see the code itself is clear enough to understand the meaning on each fields, even thought i could place a lot of examples showing where comments are not worth, i would rather prefer you to read the book.

Let me cite a paragraph from the chapter that clearly shows what the author is trying to teach us:

Why delete the separate comments?
In fact, comments by themselves are not bad. The problem is that we often
do not write clear code (because it is hard), so we take a shortcut
(use comments) to hide the problem. The result is, nobody will try to make
the code clearer.

Later, as the code is updated, commonly nobody updates the comments
accordingly. In time, opposed to making the code easier to read,
these outdated comments will actually mislead the readers. At the end of
the day, what we have is: Some code that is unclear by itself, mixed with
some incorrect comments.

Monday, July 7, 2008

Wall-E it is a Must See!!


Guys Pixar did it again, take your time and see that movie. I went with my 5 years old daughter and i enjoy it as much as she did.

WALL-E =

Waste
Allocation
Load
Lifters
Earth-Class

Rate 8.7 at imdb.com

Monday, June 9, 2008

Organizing your Mp3 Files - MediaMonkey is your tools

Don't really know if you have the same problem as i do with my MP3, i have around 15 Gig of files some of them well organized and other not, most of them just says "Track 01" as the filename.

I was goggling for a way to re-organizes my files to have the correct "file-name" based on the ID3 tag, i can do it manually file by file, but it will be a pain.

Then i found this EXCELLENT Free software, MediaMonkey

I must agree it has a funny name, but damn that tool rocks!!!!

The auto-organizes feature and auto-tag from web really helps to organizes your music, so you can browse your Music Collection easily. Even when the file is is not properly tag, it allows you to easily search on the web and then select the correct one.

Wednesday, June 4, 2008

Wicket Resources Links

Hey, i found myself really mad when trying to find out any documentation about something and can't find anything useful due to my bad search skill (I admit, im not as good as i should when trying to create a "good search criteria" on any search engine), then when all the hopes is gone out of the sudden i get the right words on my "google search" and voila get what i was looking for.

This time, im talking about Wicket Framework resources (I wont say again, how great Wicket is). but this post is just for a setting a reminder point where to find right information and good examples in a well organized places for this great framework. Hopefully, i'll keep adding other's resources on this post. So anyone on the net can find them easier than i did :)

For my friends (Yes, i know i'm a "MALETA" when talking about searching criterias).

For those non-spanish reader ("MALETA", gets translate as "SUITCASE", but we aren't talking about travels here :P) in DR (Dominican Republic) we use this term as of referring to someone with bad skill for something in particular in a very non-offensive and joking way.

General
http://cwiki.apache.org/WICKET

Wicket Best practices and Gotcha
http://cwiki.apache.org/WICKET/best-practices-and-gotchas.html

Great Reference Library
http://cwiki.apache.org/WICKET/reference-library.html

How to do things in wicket
http://cwiki.apache.org/WICKET/how-to-do-things-in-wicket.html

Wicket Examples
http://www.wicket-library.com/wicket-examples/

I'll keep adding more link on demands. Happy Wicket!

A quick look at "Inversion of Control and Dependency Injection Pattern"

I recently found a very good article for any java starter, which explain really well how this two Pattern works and why we should use them. You can find the whole article at MartinFowler.com

Here is a preview of the article :) Enjoy it!
"In the Java community there's been a rush of lightweight containers that help to assemble components from different projects into a cohesive application. Underlying these containers is a common pattern to how they perform the wiring, a concept they refer under the very generic name of "Inversion of Control". In this article I dig into how this pattern works, under the more specific name of "Dependency Injection", and contrast it with the Service Locator alternative. The choice between them is less important than the principle of separating configuration from use."

One of the entertaining things about the enterprise Java world is the huge amount of activity in building alternatives to the mainstream J2EE technologies, much of it happening in open source. A lot of this is a reaction to the heavyweight complexity in the mainstream J2EE world, but much of it is also exploring alternatives and coming up with creative ideas. A common issue to deal with is how to wire together different elements: how do you fit together this web controller architecture with that database interface backing when they were built by different teams with little knowledge of each other.A number of frameworks have taken a stab at this problem, and several are branching out to provide a general capability to assemble components from different layers. These are often referred to as lightweight containers, examples include PicoContainer, and Spring.

Underlying these containers are a number of interesting design principles, things that go beyond both these specific containers and indeed the Java platform. Here I want to start exploring some of these principles. The examples I use are in Java, but like most of my writing the principles are equally applicable to other OO environments, particularly .NET.

Components and Services

The topic of wiring elements together drags me almost immediately into the knotty terminology problems that surround the terms service and component. You find long and contradictory articles on the definition of these things with ease. For my purposes here are my current uses of these overloaded terms.

I use component to mean a glob of software that's intended to be used, without change, by application that is out of the control of the writers of the component. By 'without change' I mean that the using application doesn't change the source code of the components, although they may alter the component's behavior by extending it in ways allowed by the component writers.

A service is similar to a component in that it's used by foreign applications. The main difference is that I expect a component to be used locally (think jar file, assembly, dll, or a source import). A service will be used remotely through some remote interface, either synchronous or asynchronous (eg web service, messaging system, RPC, or socket.)

I mostly use service in this article, but much of the same logic can be applied to local components too. Indeed often you need some kind of local component framework to easily access a remote service. But writing "component or service" is tiring to read and write, and services are much more fashionable at the moment.

Read the whole article at MartinFowler.com

Tuesday, May 27, 2008

Elaborates Reports with EXCEL

In my life as a Software Developer I've been on the need to work with MS-Office in some many programming languages and regardless the language it's always a pain.

EXCEL is the favorite tool for a common user on its daily basic work. For me and for most the people i know, EXCEL if the best software packaged in the MS-Office Suite.

How ever finding a library that suite your needs it kinda difficult sometime.

Currently exist Apache POI, this library intends to be the bridge between all MS-Office package and the Java World, currently its on a very early stage and most of the work its being done on the EXCEL implementation API. This library give you the complete control over the documents and sheets, w
hich i found it interesting when you want to build your report from scratch.


But in the other hand, the JXLS Project which only focus on EXCEL Interoperability, seems for me the right choice when you have a very elaborate template with a fancy design and just want a way to inject data directly into it.

Check the following example and you will know what i mean.

Wednesday, May 14, 2008

Are u a Good Programmer or Not, how to find it out

I found an essay which describe how to identify a good programmer following just some few hints, even thought there are some points i am not totally agree with him, it seems he is pretty close to the reality.

Let me list you the "Criteria Bullets" you can use to identify if a Programmer you know, it may be good or bad :-)

Here you can find the whole article with a detail explanation on each point, please enjoy it :)

http://www.inter-sections.net/2007/11/13/how-to-recognise-a-good-programmer/

The criteria in bullets

So, in summary, here are some indicators and counter-indicators that should help you recognize a good programmer.

Positive indicators:

  • Passionate about technology
  • Programs as a hobby
  • Will talk your ear off on a technical subject if encouraged
  • Significant (and often numerous) personal side-projects over the years
  • Learns new technologies on his/her own
  • Opinionated about which technologies are better for various usages
  • Very uncomfortable about the idea of working with a technology he doesn’t believe to be “right”
  • Clearly smart, can have great conversations on a variety of topics
  • Started programming long before university/work
  • Has some hidden “icebergs”, large personal projects under the CV radar
  • Knowledge of a large variety of unrelated technologies (may not be on CV)

Negative indicators:

  • Programming is a day job
  • Don’t really want to “talk shop”, even when encouraged to
  • Learns new technologies in company-sponsored courses
  • Happy to work with whatever technology you’ve picked, “all technologies are good”
  • Doesn’t seem too smart
  • Started programming at university
  • All programming experience is on the CV
  • Focused mainly on one or two technology stacks (e.g. everything to do with developing a java application), with no experience outside of it

Friday, May 2, 2008

RIA Development - Choosing the right tools

I've been quite busy these days, but now I’m back with something pretty interesting. During the time I’ve been a Java Web Developer I had pass many of my free time researching about the right tool for the right Job, which mean I’ve test a bunch of tools available in the market.

Even that RIA is not a new term for me, I start wondering myself how would be a full Ajax-Enabled application with no servlets, no JSF, not any framework that tie me up to a Preprocessing Life Cycle for generating dynamic content into my pages.

I know HTML, I know JavaScript (at least that what I think :-] ) , and I know Java, how can I mix this up and build a Web 2.0 Application with zero Page processing (JSF, JSP, Servlets, SpringMVC, Struts, Wicket),because all of them required you to build your JSP/HTML with some kind of markup in order to get processed in the server.

The answer is just at the next corner: DOJO + DWR

DOJO with its incredible set of JavaScript Widget, DOM manipulator utilities and great look and feel, makes you take it seriously as the right tool for developing RICH UI with just HTML and JavaScript.

Check the "Why Dojo"? .

Check the next example as well.

What’s great from DOJO is that you have a lot of JavaScript power for the price of "24K" (Relax, 'K' stands for Kilobytes not Money :-] )

Now in the other hand with DWR:
Which turns to be my Counterpart for the Server Side Processing, since DWR can automatically Marshall and UnMarshall Java Object into JavaScript Object make it perfect as my Transport and Processing Layer between the Client and the Server.

This mean I can have my plain Java Class with access to my set of Hibernate DAO and have communication back and forth without need to write a Servlet or any Special Class that will be managed by the Container.

And since with DWR I can have access to the Http Session Object via the WebContextFactory I can managed the State between my JavaScript AJAX calls. :), for me that something cool.

Think about it, I believe this two technologies can work pretty well if you're a trying to build the Next Web2.0 Application for your Customer. Give them a try and let me know your thoughts.

Thursday, March 27, 2008

When a boolean answer is not enought

This is the kind of post you will find in place like 'The Daily WTF' site, but i just couldn't resist to share what i found today while dealing with some External System:

ExternalSystem -> isDuableOperation( param)

-> Literal Formal Answer: "YES" | "NO"

At first i just thought why didn't return a boolean, nah never mind and i built all my API's around the following assumption

[java code]
public static boolean isDuableOperation(String param){
String output;
// Code that invoke the ExternalSystem;

return "YES".equals(output);
}

it seems simple and works perfectly fine, however few weeks later i got a call saying the UI-Flow was stop none of the inputs were validated correctly.

After digging in the logs the following was found:

[Log file simulation]
dd-mm-yyyy: INFO: com.xyz.ExternalSystemGateway-isDuableOperation -> "The variable ouput is 'ERROR' "

I was shocked, and reminds me WTF web site, then i said myself WTF with the guy who designed the interfaces and how the output should looks like, "YES/NO/ERROR". The most interesting part of this is that when i called the ExternalSystem Support even they were clueless...... :-S

Wednesday, March 12, 2008

Wicket, a web framework that provides real Event Driven Programming

I have being researching about Web Framework for a while, and i had stop with several frameworks on the road.

Frameworks, Frameworks Everywhere

Echo Cocoon Millstone OXF
Struts SOFIA Tapestry WebWork
RIFE Spring MVC Canyamo Maverick
JPublish JATO Folium Jucas
Verge Niggle Bishop Barracuda
Action Framework Shocks TeaServlet wingS
Expresso Bento jStatemachine jZonic
OpenEmcee Turbine Scope Warfare
JWAA Jaffa Jacquard Macaw
Smile MyFaces Chiba JBanana
Jeenius JWarp Genie Melati
Dovetail Cameleon JFormular Xoplon
Japple Helma Dinamica WebOnSwing
Nacho Cassandra Baritus Stripes
Click GWT


Looking for a framework that provides a way to represent a true Event Driven Model, instead of the common MVC Front Controller J2EE pattern and truly believe i hit on the right nail.

I grabbed most of the content from an article posted on javageek.com on 2006 and from Wicket Introduction pages, to gives you a brief of how amazing this framework can be for Web Development.

WICKET

So, what is Wicket? This is the description from the main site:

Wicket is a Java web application framework that takes simplicity, separation of concerns and ease of development to a whole new level. Wicket pages can be mocked up, previewed and later revised using standard WYSIWYG HTML design tools. Dynamic content processing and form handling is all handled in Java code using a first-class component model backed by POJO data beans that can easily be persisted using your favourite technology.

What that basically means is that Wicket separates the front-end visual design (HTML) from the back-end application logic (Java), using components (think Swing JComponents for the web). Instead of being another MVC framework, Wicket is more of an event-driven framework, like a traditional GUI. However, you could look at each 'component' as a tiny MVC with the 'view' part being the html code (but they won't tell it like that). As you will see later, all the application logic falls inside the Java classes, instead of mixing it with the pages, like JSP (true separation of concerns). The Java code is glued to the HTML page by using a special wicket:id attribute that can be assigned to almost any HTML tag, and that tells Wicket where do you want to render a component. Wicket comes with several components like Labels, Links, Lists, etc., which are uniquely defined on a webpage by setting an Id to the component, and the content which is represented by a Model.

Wicket, in my opinion, focuses the development efforts in the right place, inside plain Java code, and leaves the graphical presentation where it should be, inside html. At first you might find a little hard to grasp this paradigm shift, as so many developers are being 'forced' to rely on jstl and jsp scriptlets to accomplish logic programming for a page with all the other frameworks. But once you get used to this, I'm sure wicket will provide really fast development times.

Component state
In Wicket, all server side state is automatically managed. You will never directly use an HttpSession object or similar wrapper to store state. Instead, state is associated with components. Each server-side page component holds a nested hierarchy of stateful components, where each component's model is, in the end, a POJO (Plain Old Java Object). Wicket maintains a map of these pages in each user's session. One purpose of this page map (and the component hierarchy on each page) is to allow the framework to hide all details of how your components and models are accessed. You deal with simple, familiar Java objects and Wicket deals with things like URLs, session ids and GET/POST requests.

Non Intrusive for your HTML Designers
Wicket does not introduce any special syntax to HTML. Instead, it extends HTML in a standards-compliant way via a Wicket namespace that is fully compliant with the XHTML standard. This means that you can use Macromedia Dreamweaver, Microsoft Front Page, Word, Adobe Go Live, or any other existing HTML editor to work on your web pages and Wicket components. To accomplish this, Wicket consistently uses a single id attribute in the Wicket namespace ("wicket:id") to mark HTML tags that should receive special treatment by the toolkit. If you prefer not to render Wicket namespaced tags and attributes to your end-users, Wicket has a simple setting to strip them all out, resulting in ordinary, standards-compliant HTML.

Simplicity
Wicket is all about simplicity. There are no configuration files to learn in Wicket. Wicket is a simple class library with a consistent approach to component structure. In Wicket, your web applications will more closely resemble a Swing application than a JSP application. If you know Java (and especially if you know Swing), you already know a lot about Wicket.

Hopefully you will grasp the idea behind Wicket Framework and start playing around with it to understand how it truly works.

Tuesday, March 11, 2008

Are you still thinking what Java Web framework do you need to learn..

Here is an image found at indeed.com That just show a Job Graph ( 2005 / 2008), showing what's the market is asking for.

Saturday, March 1, 2008

Keeping Spammers away from gmail

This days everyone knows what spam means, just a very annoying way of marketing that eveybody has tasted.

Many popular sites started using the CAPTCHA methodology to avoid automatic registrations via BOTS since year 2000. Sites like hotmail, yahoo, gmail and others are using this method to avoid 'automatic account creation'.

CAPTCHA (Completely Automated Public Turing test to tell Computers and Humans Apart) developed by the Carnagie Mellon University, was broken a weeks ago. It just matter of time to start seeing spammers with Gmail account and other sites being violated.

If you have a site that use this method to keep BOTS, outside your site. Be aware that
CAPTCHA is not longer safe.

Since, CAPTCHA was developed by Carnagie Mellon University. Can we expect some solution by
Google?. Lets think about that for a minute Google has always overpass everyone expectation with many contributions and probably they had already started some internal research on this. (This is just my assumption, i haven't heard anything official yet).

Lets wait and see what happens. :D

Saturday, February 16, 2008

Spring Overtakes EJB

I found this on a group i frequently read, hope you find it interesting as me:

http://www.infoq.com/news/2008/02/ejb-spring-job-listings-trends

Monday, February 4, 2008

Managing Eclipse Plugins Installations

As a user and fan of Eclipse IDE for the past 4 years, I would say that I've become in loved with the performance, scalability and easy of use of this IDE.

How it manages its plugins is quite amazing, just decompressed the package inside its corresponding "eclipse/plugins or eclipse/features" directory and restarting the IDE will be enough for having the plugin already installed in your workspace.

But I must say that such great architecture has a huge disadvantage, since inside those directories are tons of predefine plugins which are available with the default eclipse installation, it's become hard to keep track of all you post-installation plugins and it gets worse when you make an IDE upgrade i.e. (from Eclipse 3.1 to Eclipse 3.2) you get on the need to install all those cool plugins you downloaded for your development environment once again or imagine you want to upgrade an existing plugin manually, that can be really troublesome!

Digging on the Internet, found an interesting article posted by IBM on 2003 called:
Put Eclipse features to work for you.

Where one on its topic it how to organize all your plugins outside the "Eclipse" installation directory, arrange them in a non-intrusive way so you can upgrade them or remove them easily.

Lets focus on that topic:

First use a clean copy of Eclipse with no other installed plugin, you can choose the flavor you want from the
Eclipse Download Center and place it on "C:\eclipse" or "~/home/eclipse" or "/opt/eclipse" where ever you want on you Disk architecture :D

Let’s assume it’s installed on "C:\eclipse" for the simplicity of the example.

Now, lets prepare our plugins repositories:

In any place of your hard drive create the following directories which will hold your plugins structure, in my case I have: "D:\javarelated\eclipseplugins\jbostool\eclipse", for this example I’ m installing the new set of JBOSSTool plugins for my Eclipse 3.3, after doing this uncompressed all you plugins there, since each plugins knows where it must be installed (plugins or features directory) you will end with the following structure:

"D:\javarelated\eclipseplugins\jbostool\eclipse\plugins"
"D:\javarelated\eclipseplugins\jbostool\eclipse\features"

Ok, guys we are almost done, lets now link them together (The fresh Eclipse Installation and you newly plugins repository", move to your eclipse installation directory and create a new directory name it as "links" i.e.: "C:\eclipse\links" and using your favorite Text editor create a file with the name you like but it must have the ".link" suffix, on this example I created: "jbosstool.link" containing the following line:

path=D:\\javarelated\\eclipseplugins\\jbostool

Please watch the double “\” here.

And we are done, make sure you restart you eclipse with the -clean argument to get any new plugins loaded and have happy coding.

Friday, February 1, 2008

Some Funniest video i have seen, starring: "I will Survive"

Hope you enjoy these funny video as much as i did, the first one is a classic which i first saw it like 8 year ago. Please enjoy them








Life is only one, Enjoy it!

Yikes! I' m 25 years old and have 5 years old daughter.

I can remember that day when I got the news that I was going to be dad (Almost got a heart attack :D ), for sure can also remember how I felt when she was born, and when I was at the Hospital afraid of taking her on my arms because I thought that I was going to drop her or hurt her tiny body because of my inexperience on this area :)

But now she is 5 years old of pure energy and love; she is so cute that she can make the toughest person to get melt.

I still can remember her first photographic session that we have together at place called: "El Jardin Botanico" she was 1 year old. Please Guys/Ladies listen to me, share with your kids a "photographic session" not a "formal" session with a tuxedo or an elegant dress, just a "session" where you can play with them and get caught by the lens of a camera, believe me you wont regret it. :)

The point that I' m trying to make here is simple:
If you lost some money, you can get it back.
If you lost your Job, you can get a new Job back.
....
But the time you lost, it’s time you won’t get back no matter how much you try it.

The time is passing faster than when were kids and it’s up to us not wasting our time, in things that will not bring you nothing to your life.
So manage your time correctly, and you will never regret it.

PS:
Please i don't want to make you have the impression i' m an OLD Man sitting in a couch, just telling stories of my life.

Its just i' m realistic, that we are getting older and need to be focus on important things.

Wednesday, January 30, 2008

First Post

Once someone told me that when you writes you immortalize those moments in your life, that probably you may want to remember tomorrow. I didn't pay attention at that time, but as a common reader of his Blog, i had realized that he already have 2 years of Blogging which for me as his friend found this amazing since i didn't expect him to make this as daily basis routine.

I don't know if i can keep the track of those greats Blogs out there, but i 'll try my best and just the time will judged me if i did it right or not.

With this first entry i hope to start my journey as a common writer while expanding my vocabulary, share my thoughts and anything that comes into my mind with you.