“Before you speak, listen. Before you write, think. Before you spend, earn. Before you invest, investigate. Before you criticize, wait. Before you pray, forgive. Before you quit, try. Before you retire, save. Before you die, give.”

Sunday, October 24, 2010

GWT compiling performance

Just a reminder for myself of the required performance to compile a GWT -GAE Application.
This is on my Core i7 860 machine with only 2GB of RAM (for now).Some people might notice I am running on 1GB of swap so let's just say that this is the blocking issue for now. Still it's a core i7 running at full power for a while just to do this processing. I wonder if people developing with GWT do this kind of work on Core i7 980 processors (extreme hexa-cores processors).















I have created a Proof of Concept online for a Java application that I want to test but for now it is not quite ready to go public.
Google is number one for offering some things I could not find online
1) Affordable Java web hosting - this one is free for small loads
2) The GWT toolkit saving me from writing Javascript (I don't like Javascript very much).
3) The AI driven car which they are working on (but on this on a different article)-

Still the approach is causing me a lot of headache. You need to be able to write Java code which is then transformed into Javascript and then the whole package is transformed into a war and deployed on the server.
My other home hobby project is created as an ear and it only takes 40 seconds to compile , run unit tests and create an ear.
This one ( a very stupid GWT hello world) took me as much as 2 minutes to do the same thing in a normal non -blocking mode(no other consuming applications) 1 minute 30 seconds.
I need to look into it but I guess generating JavaScript is not quite instantaneous.
The benefit of writing Java code AND unit-tests is clear. You know exactly what goes wrong and why it goes wrong (if you are a decent Java programmer).


Nevertheless I think that adding another abstraction layer on top of JavaScript might cause some impossible to fix bugs ( without JavaScript knowledge).
It took me a lot to just compile classes and make GWT compile a different set of classes .. because GWT classes do not mix with backend classes such as Hibernate or JPA classes so you need to specify that accordingly.

Will it work ? Well I will let you know soon enough as I am preparing my application.

Later Edit : After a week fixing a RichFaces bug involving extending both RichFaces and Facelets frameworks (just to handle a ViewExpiredException and to make IE7 handle a redirect ) I have the feeling that GWT might be a better alternative then the JSF and Javascript combination at least in the short run.
Of course there is always Flex which is a bit safer but involves also learning anew language and buying the FlexBuilder.

Friday, September 17, 2010

The challenge

Here I am facing a new challenge : Getting admitted into the masters program at the university.
It's a Master in Artificial Intelligence which is a field I am interested in but it is not very easy to get in.
You have to pass an exam containing subjects from
1) Algorithms analysis and design -using the famous CLRS book ("Introduction to Algorithms")
2) Databases
3) Object oriented programming - mainly SCJP like questions
4) Subject of choice from 4 other fields - I chose AI here and the AIMA book.

I started reading the AIMA book and the CLRS book but it looks like the mathemathics involved is overwhelming ... I never was a math genius.

This situation raised a lot of mental blocks for me and considering that Monday I have to take the exam it looks like I am heading for a complete disaster.
But it never hurts to try. I need to get admitted on a 1 1/2 candidates/position situation , all things considered it is a lot better then some interviews I attended .

Also I realize that although I have a B.Sc. in Computer Science and Electrjcal Engineering I never used a lot of the knowledge from the university .. maybe this is a industry problem , maybe I am trying to learn astronomy when I am they guy that fixes telescopes.
Writing good programs involves knowing things like complexity , knowing if a problem is NP-complete and stuff like that .. but most of the times you can just call an external library that already figured this stuff for you .. so you don't have to.
Just for fun I wrote some Java code that performs a merge sort and another performing insertion sort and tried to enter 10.000.000 long array.
The difference was amazing. Even on my core I7 860 processor using it's 8 cores (4 physical and HT) it took 1252 seconds to do the insertion sort and about 159 seconds for the merge sort.
On the other hand most algorithms offered by programming languages are fast enough so I rarely was in a position where I needed to evaluate the algorithms.
So a part of me is wondering : shouldn't I worry about more important stuff then about this albeit important ,pretty much useless in real world enterprise development , but the part of me willling to learn new stuff supports this idea.
Now I need to get back to work and hopefully not be the last on the exam.
LE : If I fail I have the "excuse" that I studied for my SCEA certification and had not time for this exam , and I did not study algorithms design at the university .. and I am lazy :).
LLE : As expected I got a bad mark (6.91) qualifying me for the "tax" part of Artificial Intelligence. Since I am not eager to pay 1100 Euro to study AI I guess I can wait another year in which I can sort other issues in my life.
Anyway my view is that the exam was totally doable and thinking positive would have helped. No harm done anyway.

Thursday, September 2, 2010

Automating functional testing

So here is the drill : You need to wear the testing hat and verify the bugs .
You need to test a huge application and see if some bugs are reproduced.
Typically each bug requires about 3 page navigation and 20 clicks and you need to be able to reproduce it without issues and show it to a co-worker.
My attention span in the open plan office is not that big .. I always click some button I shouldn't have clicked and then have to start all over. Anyway bugs need to be fixed and issues need to be found. You also need to find new bugs and regressions.
Here is the solution: Automate functional testing.
What I used so far and can fully recommend:
1)Selenium IDE - first step is to record the tests and generate the required Java/Ruby Code
2) Use Selenium Java (or Ruby) driver and write the tests in the IDE
3) Start Selenium Server.
4) Run Selenium code from the IDE ( or a C.I. machine like Hudson,CruiseControl)

Here is how I test a simple login , search and logout(Ruby version) :

require "test/unit"
require "rubygems"
gem "selenium-client"
require "selenium/client"

class WorldFredomTest < verification_errors =" []" selenium =" Selenium::Client::Driver.new" host =""> "localhost",
:port => 4444,
:browser => "*chrome",
:url => "http://localhost:8080/",
:timeout_in_second => 60

@selenium.start_new_browser_session
end

def teardown
@selenium.close_current_browser_session
assert_equal [], @verification_errors
end

def test_login
@selenium.set_speed"2000"
@selenium.open "/WorldFreedom-war/mainPanel.htm"
@selenium.type "j_username","mihai"
@selenium.type "j_password","freewilly"

@selenium.click "login_button"
@selenium.wait_for_page_to_load "5000"


@selenium.click "searchFreedomsTab_lbl"
@selenium.click "j_id102:searchButton"
@selenium.wait_for_page_to_load "5000"
@selenium.click "logout"

end
end

Of course no warranty is provided for the code above. It just works on my PC.
Coding the functional tests should be done by a functional testing team (no connection to the actual development team) and bugs should be reproduced by means of running these tests.
Of course in an agile environment these tests are also used as acceptance tests.
Setting the speed of the tests is also good since making them run too fast will reveal performance problems with the application.

There is a catch here : No test will ever catch a cosmetic bug , a colour which is wrongly used or a table that is creating a horizontal scrollbar. You need a human for that .. and that human tester will be required for the foreseeable future.

Wednesday, August 18, 2010

Sun Certified Enterprise Architect

Today I received a mail from Sun (well Oracle) stating that I have passed the architect certification .. one of my objectives for the year.
What does this mean ? It means I have passed the highest Sun Java certification enabling me to actually design and implement a solution for an actual business problem. It is an external confirmation of my worth as a professional and it makes me confident I can use my UML and design skills at my job.
It has been a lengthy process starting from I could say December 2006 (officially in October 2007 with part 1) and really ending in July 2010 (on 23rd) with the submission of the assignment.
How I took the parts
In October 2007 while working in France I took part I - easiest of all
May 2010 I received the assignment and started working on it.
Two months and a lot of work latter I submitted the assignment .
August 18th - received email from Sun confirming I have passed.

I was really busy and tried to stay committed to the goal while maintaining a busy work schedule and other social obligations. I think SCEA is a worthy goal for people with less than 10 years experience.

As I posted on the blog I was really motivated to do it as I had invested some money into it.
Now I am working on a GWT and Java application which will be running in the Google App Engine and which will be available to plenty of users (me especially). But that is for another post.

My Ruby love -affair is still on and on weekends using my wife's laptop I do some coding in Ruby also but for now I can't find anything relevant in the job market - not even project-based.
I had to cancel the master program (did not want to get into debt to finance it) but otherwise I am doing pretty good.

Tuesday, August 10, 2010

The failure

Ever had the feeling you know precisely what needs to be done and yet for an unknown reason you fail to do it ?
This is not about the failure of my SCEA certification .. I am still waiting for the results from Sun after having submitted it on July 23rd(although I might fail the cert too) , it's about failure to keep things over control.
The last months where a continuous and accelerated degradation of my life .. in more ways then I am willing to admit.
Although I am quite confident that a GTD style needs to be used and applied at work and in personal life, that diet food is better for me,that TV time is useless time e and that concentration on work things is mandatory I cannot do the right stuff.
I found myself procrastinating and browsing car forums despite my commitment to being car-lite or even car free.
I know debt is bad but I just applied for a credit card .. it is really unbelievable.
Here I am at 2.00 AM writing on the blog after not being able to sleep for 3h.
I blame the high daily temperatures for this (35-37 Celsius ) behaviour.
My mind is obsessed with 2 idiotic things : buying a laptop (and making the purchase look necessary) and controlling expenses ( I have been an avid reader of GRS)
Since working for one employer is a risky endeavours I am trying to find other income sources which can finance say a laptop purchase a month at least.So far not very successful with this issue.
I am looking at
1) Freelancing - slim chances in J2EE field
2) Google Android development - requires a 500 Euro investment in Android phone and offers
little profit guarantees
3) Doing something completely unrelated (driving a taxi maybe ? ).


In other news :
My Decathlon Triban Trail 7(trekking bike) is officially 3 years old .. and has only 3000 km on it .. I need to increase the mileage on it.
Today after 3 months I managed to see my weight going under 100 kg again - 99.9 kg.
My wife agreed to let me buy a road bike when I reach 90 kg so I must not give up.
Last but not least after spending a lot of money in our short holiday in Amsterdam we got to see that fascinating city. I got to walk and bike and .. yes smoke pot in Amsterdam :). I wish I could write more but all I can say after 4 days is that Amsterdam really is the city of freedom and it is fantastic for tourists a great place to spend some of your holiday.
On the other hand I realised that although it is a bike paradise ( you are king of the road with your bike there) it was not designed to be a bike paradise (neither was most of Holland) , the bike simply imposed as the best solution for the city transportation (the lands is very flat).
I have met another Romanian guy which as hired to work there this month. By checking the prices and the salary he quoted I know that it is better then what I make .. and many of my colleagues. Unfortunately for the moment such a thing is not possible for us.
Oh .. did I mention my English looks pathetic when compared to the English of people in Netherlands ? I should have... because I felt embarrassed there (this does not happen very often) for not spelling words right in English.

Well I wrote here for 30 minutes .. it's time to get some sleep and re-organize in the morning.

Saturday, June 5, 2010

About motivation

Since last month not much happened. Except loosing about half my co-workers to competition (better pay, more responsibilities ,respect were the reasons).
I started about thinking about motivation a lot this year and I see that in fact it is very hard to define it . In my mind it is obvious that a developer has to be well paid enough to not think about money issues too much but also that financial incentives do not work once you reach the "I can afford to live well no matter who I work for" status.
As Joel put it in order to motivate developers you need to give them a better work environment then they have at home and this means either hire really poor developers or give them a top work environment. Link
And I started evaluating other tools for organization that is the famous "Pomodoro technique" which I find very interesting even in a interruption prone environment because it teaches you to stay focused and also deal with interruptions comfortably.
The good news about having your colleagues leaving is that the great open-space is a lot more quiet so quiet that it is strange but the bad news is that management is so shocked nothing gets done around the base.
The weird stuff is still that my monitor is still placed in everyone's view and that I still feel like a rat under observation and that makes me browse StackOverflow or loose time on the internet on purpose .. more than I would in a more comfortable situation.
So as I want to finish my SCEA assignment and essay by June 27th I realise that I am a lot more motivated when I pay money for something.
I invested 535 Euro's in this certification and I want it done :) . I look at ways to improve the diagrams , to analyse the system and to improve it generally as much as possible. And I will not be paid .. but my efforts will (hopefully) be recognized.
On the other hand I was thinking about what level of salary would motivate me to actually deliver working solutions .. the sad part is that I would strive more out of professional pride (one I pass a certain level and I am close to it) then for money.
You can always fake your motivation but your pride is something you can't fake.
I will also post the youtube link here.

Monday, May 10, 2010

Following my yearly plan , going to the darkside ?

I am back again ..
First thing .. I managed to get to Constanta .. 10 h in the first day and 12h in the second day.The good thing is that I got there the bad is that I was among the last.
Strange enough there were several guys with new road bikes that did not make it.
The worst local brand "DHS" was present , some competitors used the damn bikes and got there .. with 100 Euros bikes. It's not all in the equipment after all.
The organization was not perfect and strange enough only the ones that left the group and went ahead got to Constanta , 60 km before a call to buses was made to pickup everybody , I and a couple of friends on MTB's were ahead and managed to continue.
The final descent to Constanta (at 21:00 I think) was made in complete darkness and at full (MTB) speed .. fantastic.As I and other fat cyclists learned 150 km (90 miles almost) are not something to do on a MTB when fighting wind and hills. Eventually we all got there .. but it was not easy.
Getting to Constanta made me think I can do what I really want to do .. so last week I went to Iasi and finished "Programming Ruby" by Pragmatic Programmers .. I really think I am able to write basic Ruby programs but still I am not ready to make the switch just yet but I do intend to use Ruby for prototyping.
And finally I bought the vouchers for SCEA as I intend to pass the Sun certification finally (part 2 and 3). I decided to really dedicate 2h /day (at least) to it to make sure I pass it before July 23rd.
Last but not least I intend to start a master in Management ( Management of IT projects) which finally puts me in the "DARK" side of programming - management.
To quote Jack O'Neill in Stargate : " I spent my whole life sticking it to the man .. now I am the man".
For starters I still think I need to pass the certification to increase the chances of getting a real architect Job .. or a senior software developer (as in respected senior software developer not the stuff I have to get through)


Written from my Thinkpad