dailylog
from my work as a developer
from my work as a developer
Feb 2nd
It was quite busy beginning of the year. I was working on the two projects – in both partially
Anyway I found out the way how to handle such situation. What works the best are the short Sprints (Scrum), about a week. So I’m working hard one week on the first project and at the end of the week I’m delivering some peace on a functionality. Next week I’m starting a new Sprint but for the second project.
In such a case, I can focus and get into the project for a long time. I don’t feel disrupted that I forgot to finish something.
On the beginning I was trying to switch the project each day, but it worthless and useless. Human’s brain needs up to 20 minutes to switch a context. For large tasks (like a project) even more, for me it was around half a day to get into – to check what I did previously, what are the new task and where the project is in matter of functionality.
Short Sprints demands a short estimation and short tasks. After second, third sprint I’ve got used to it
And it was even funny to work that way – short sprint are the best!
To be more specific what I did, I’m going to share my deep knowledge with you
The first project is related to Circular – I’m writing a Desktop Client which will be able to communicate throughout a REST API with the service. Is written in Java Swing and the latest Java 1.6 brings many new futures to cooperate with a Desktop System. The first is the java.awt.Dekstop class. It can be used to open file with a default editor, open links with the default browser and so on. Very useful class. The next is the javax.swing.SwingWorker class. It’s used to launch long running process which must communicate with a Swing UI, e.g. to display progress.
You’re wondering why I’m using the native Swing instead Eclipse RCP or NetBeans Platform. The answer is easy – size of the file. With the current solution, the executable file has around 3.6 MB with all the dependencies included in it – you can use Maven Shade Plugin to do it. I’m also using a modified Launch4j Maven Plugin to create Windows Executable file from my Mac OSX – the modified source code you can find here.
The second project I’m working on is the Attikis service. It’s used to monitor Alarm Systems throughout a phone line. The UI is built using JavaServer Faces 2.0. And the last time I spent the whole day to solve a problem with the SelectManyListBox tag that has a custom converter attached to it. In such a case, you must use a bean with well defined equals() and hashCode() methods or just a simple String as a SelectItem. In other case you will end up with strange error: Field not valid!
It’s a very weird behaviour, whilst you will attach a built in converter, you can use Integer or what else you want
Ok, that’s it for today and at last I’ve got something from TED that I want to share with you
Jan 12th
It took me more time than I’ve expected to start the New Year on my blog. So here it is, the first post for the New Year! Happy New Year!
The last year I was at Devoxx 2010 conference and attended to Neal Ford‘s presentation about Implementing Emergent Design. This talk based on his post on the IBM’s DeveloperWorks web site about Evolutionary architecture and emergent design: Harvesting idiomatic patterns and the whole series.
The talk was about ckjm metrics and cyclomatic complexity – quite interesting tools to discover potential bugs and hard-to-maintain code in a project. What was the most important for me, Neal used the Apace Struts 2 project as an example, especially the UIBean class – you can find the details in the mentioned article. He presented how to prepare these metrics, how to read them and what they mean. A really interesting talk.
After all, I’ve asked Neal to give me more details about the problem and few days later I received an e-mail from him. I’ve followed his advice and inspired by his talk I’ve gave a promise to my self that I must improve that badly-looking code.
…. but wait, it’s just a badly-looking code. It had taken me another few weeks to discover it isn’t so important to improve that piece of code, it really doesn’t matter right now. There are plenty of places to improve code base of the Apache Struts 2 project and so many users don’t care about that – UIBean doesn’t exist for them.
The current UIBean implementation do the job, it isn’t pretty or easy to maintain, but right now there is no one for whom it is important. No one complains about it. Some day I’ll refactor the code of UIBean class but today isn’t that day.
The conclusion is the same as for code optimization, you shouldn’t optimize too early, so you shouldn’t improve too early. Don’t throw everything and try to improve some not-important part of your project. Don’t trust metrics by heart, they can lie to you, try to figure out what they mean in context of your knowledge of the project. They aren’t a silver bullet.
Today’s day brings to me another newsletter from TED web site and gave me answer to important question: the shortest connection between two points is …
Dec 16th
I had been preparing a new Struts 2 release for last few weeks. It contains only a tiny change regarding security and I had been counting that it shouldn’t take more than a week to release it. How wrong I was
Everything had started smoothly, I’ve created a new Subversion branch, to not interfere with current on-going development of the new Struts 2.2.2. The branch was made from Subversion tag (yeah, branches, tags and trunks are all the same, just copies
). Next, I’ve applied a patch to solve the security hole and I was truly sure that’s it – I can start the release process. So I’ve gone ahead, mvn release:prepare command went smoothly, so the next step was mvn release:perform. And after almost waiting 1h I’ve got a strange looking massage: not all licenses were approved !?!
The first thought, I’m using the latest Maven 3.0.1 and that’s the problem, but it wasn’t. I started looking into RAT plugin source code to check what could be wrong. I’ve just discovered that the plugin is checking wrong Apache License header but also looking for the License’s URL so it should be ok. The origin of the problem was quite simple. The Maven Release plugin allows to make release only from a SNAPSHOT version, so I’ve changed the version only in the parent pom of the project. The rest was unmodified. After changing all the version signatures in all the poms the problem was gone
To launch another release process I’ve had to rollback all the changes made during previous launching release command. mvn release:rollback did the job but I’ve had to manually remove the tag from Subversion repository. And of course I’ve removed the wrong one
Thanks to Wes for a tip how to rollback such a huge mistake, the command looks like this:
svn copy https://svnrepo/project/tags/TAG_1@10 https://svnrepo/project/tags
TAG_1 is the removed tag, number 10 is the revision -1 when the tag was removed.
So I’ve started again, to make a release and again something went wrong. I noticed the release plugin is making a tag base on wrong path – it was using the original path of the tag from which the branch was made of instead the branch path. And again I’ve had to rollback all changes and remove the tag – this time the correct one
Resolution was easy – change scm tag in all the poms to point to the branch
And again, I’ve started the release process and this time everything went more than smoothly, all the artifacts were uploaded to Apache Nexus, so the last think before calling a vote was to close a staging repository. And again I was wrong, during that, Nexus reported that two jar files don’t have corresponding files with signature. I’ve checked locally and everything was ok. After short conversation with guys from support, I’ve got the solution – upgrade to latest Apache Parent
Yep, easy, but to do that I’ve had to once again rollback everything, prepare a new Struts Parent that will inherit from the latest Apache Parent, release it and call for a vote
Finally, after almost 2 months I was able to release Struts 2.2.1.1 – the vote is under way, so if you are Struts PMC, please test the release and vote!
Just to relax a bit, take a time and watch that very inspiring talk about camels:
Dec 1st
The whole last week I was migrating my current project from the JBoss AS 6 M2 to the JBoss AS 6 CR1. First of all I had been thinking it should be easy, just switch few things, use other Java packages and so on. Niether I had been expecting some problems nor it will take a week. So I’ve just started my migration “project” – yep, you should always treat it that way, it isn’t just renaming packages or tweaking some configuration files. It’s a huge project that either can take a hour or a week. So be prepared!
To move to the JBoss CR1 I had to also switch to latest versions of our internal libraries, commonly called SML Commons. The main problem was with the CDI Extension package, which base on WELD. During switching the version I discovered some problems during an application deployment. First of all Bean Manager was missing in JNDI context. Googling and looking through existing solution didn’t help. I had to prepare a demo application and try to register an issue with JBoss’ JIRA. The problem was, that my demo application was working just fine with the JBoss CR1. Just Adam was able to break it – the trick was to include in EAR package another module as a Java JAR archive with CDI enabled beans. Then the application blown up!
After few hours we got answer to the problem – add additional beans.xml file to WAR archive!
So I thought the rest should be easy, but wasn’t
The next problem was with the application’s tests. All the tests that were base on Arquillian started yielding – wrong dependency in Maven pom, I had to remove few of them, cut out some unused profile and everything went smoothly.
So, the next problem was with Selenium and it looked strange as the whole JVM blown up with irritating ”red zone” message. And till now I don’t know what it was, maybe just wrong configuration or missing dependency. And during solving that problem I discovered a really interesting CDI behaviour. When you defining a bean with @Produces annotation you have access to the InjectionPoint object. It provides many different information about where your bean will be injected.
But there is a slight diference how InjectionPoint.getBean() is working. If your @Produces annotated bean will be used / injected in already CDI managed bean, getBean() will return that bean. But in other way it will return null
Finally, I gave up
After passing all that problems, another one hit me directly in the face and I haven’t had enough energy to solved it. I shelved all my changes with IntelliJ IDEA and returned to normal coding work, ufff….
And just to change my attitude, today’s morning I got monthly newsletter from TED and I want to share with you that brilliant talk about why bosses and meetings are boilerplate at work, enjoy!
Nov 24th
The last few days / weeks were very buys for me and it wasn’t related to work
First I was presenting at JavaCamp #5 topic about self-development. You can find the slides and video here (sorry folks – only in Polish
). Besides me there were other lectures and they were presenting quite interesting topics
In mean time pizza had arrived so there was time to discuss and socialize, what else I can say – very nice Saturday and looking for the next JavaCamp.
After that I was working hard on my project, maybe soon I’ll share more details. What can I say now is that I’m using the latest fancy stuff from Java EE world: JSF 2, CDI, EJB 3.1, JPA 2 (ok JSF 2 isn’t the coolest thing
).
Then the long weekend arrived – Independence Day – so I spent that time with my family at my parents-in-law. The most excited thing happend during returning – my wife hunted board by car
And came the Day – first time I’ve been participating in Devoxx conference. The journey had started at 10.00 AM from my home town and finished around 11.30 PM in All Seasons Hotel in Antwerpen – quite long as for 21st Century
The whole SoftwareMill team were there with me!
The next three days were full of expected and unexpected experiences. Opening keynote was very cool – a bit too many people but Mark Reinhold was presenting very interesting topics about future of Java language. You know all that fancy tools like Lambda expressions, Closures, etc. Java 7 should be brilliant but Java 8 will be astonish
Lectures and presentations had very different levels of funny, essentiality and meeting expectations – from my point of view the same statement I can post about Javarsovia conference. So we don’t have to shame!
Anyway, presentation aren’t the main part of any conference. Also very important are people and discussions. During Devoxx I had plenty of both. I met other members of JetBrains Development Academy – we had very nice evening with dinner and few beers
Thanks to Robert Dammer and other JetBrains guys and Ann
Next day I had pleasure to meet and talk to two Apache Struts committers – Rene Gielen and Rainer Hermanns. I missed the Open Source dinner, but I didn’t know about it early
Next time. I also had chance talk to Matt Raible and Neal Ford – just few words but always….
There were also many guys and one girl from Poland – it was a great pleasure to meet you guys and drink some beers
After third day we had to come back, tired but with many new ideas and colleagues. What to say more – I’m very pleased that I was there and met all of you!
Cya next year!
PS. Few photos ![]()
Nov 8th
Recently I’ve been changing a cluster configuration. Maybe it isn’t a real cluster, it looks more like a cloud or load balancer. The ingredients are as follow:
The problem I had was that I just want to enable clustering for given VirtualHost section and not for the whole Web server. Current configuration was quite simple, as you can find out on mod_cluster’s web page. On the JBoss AS side you must uncomment one line or so and provide list with mod_cluster enabled web servers.. But as I said, such configuration enable clustering for the entire web server. I didn’t want that, as I want to create another Virtual Host to serve static content.
So, the first step was to read the documentation, but it didn’t answer my questions. I was trying many different configurations and what I achieved was a separation of Virtual Hosts – I could define the different clusters for different Virtual Hosts, but still wasn’t able to serve static content
The answer was simple, just disable creation of balancer for all Virtual hosts with this directive:
CreateBalancers 1
The second thing was to enable use of aliases (and disabling advertising as it isn’t supported by Amazon EC2)
UseAlias 1 ServerAdvertise Off
Also on JBoss AS I had to define the Alias:
<Host name="localhost"> <Alias>my.domain.com</Alias> ...
The rest was easy, just I have had to enable use of Virtual Hosts on given IP address, specify the web server name and define the Virtual Hosts. After restart everything seemed to work perfectly. I had static pages under one domain name and an application under second. The only problem was that I wasn’t able to login to the application. Why? Simply, my session wasn’t a Sticky Session. And not because JBoss server didn’t support it. Much simpler. My session ID wasn’t passed to the JBoss server and back to the Apache HTTPD
To solve that I just had to add ProxyPass and ProxyPassReverse directive:
ProxyPass / balancer://mycluster/ stickysession=JSESSIONID|jsessionid nofailover=On ProxyPassReverse / balancer://mycluster/ stickysession=JSESSIONID|jsessionid
And that was the end, everything was working smoothly. But the customer decide not to use the same server for load balancing and serving static pages. So all my work was useless, except experience I’ve got
Anyway it’s a very elastic configuration, as you can add another JBoss servers and attach them to the cloud in a minute.
The whole configuration just for future reference:
LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
LoadModule proxy_ajp_module /usr/lib/apache2/modules/mod_proxy_ajp.so
LoadModule slotmem_module /usr/lib/apache2/modules/mod_slotmem.so
LoadModule manager_module /usr/lib/apache2/modules/mod_manager.so
LoadModule proxy_cluster_module /usr/lib/apache2/modules/mod_proxy_cluster.so
LoadModule advertise_module /usr/lib/apache2/modules/mod_advertise.so
LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so
ServerName www.domain.com
NameVirtualHost 10.10.10.10:80
DocumentRoot /var/www
CreateBalancers 1
ServerAdvertise Off
UseAlias 1
<VirtualHost 10.10.10.10:80>
DocumentRoot /var/www
ServerName www.domain.com
ServerAlias domain.com
</VirtualHost>
<VirtualHost 10.10.10.10:80>
ServerName my.domain.com
ProxyPass / balancer://mycluster/ stickysession=JSESSIONID|jsessionid nofailover=On
ProxyPassReverse / balancer://mycluster/ stickysession=JSESSIONID|jsessionid
<Location /status>
SetHandler mod_cluster-manager
Order deny,allow
Deny from all
Allow from 127.0.0.1
#Allow from all
</Location>
KeepAliveTimeout 60
MaxKeepAliveRequests 0
</VirtualHost>
Oct 29th
Title of this post should tell everything.
I started an new job over four weeks ago and from beginning it was a deep dive. Everything was new and exciting, I wasn’t able to think about anything else. I just want to more and more … more knowledge. I was so impassioned, that I would like to have spent all the time in the front of my new Mac (forgot to mentioned?).
So what I’ve been doing during that time?
The first thing is a entirely new MacBook Pro on my desk
Gift from my new company SoftwareMill. I spent few days (or maybe weeks) getting use to it. Recently I was using Linux box but it isn’t the same. The first obvious thing is keyboard. It isn’t just Cmd key instead Win key. Many more keys are missed, it’s like changing your way of thinking. You must switch your brain and old habits.
What I like in Mac?
What I don’t like?
What have I learnt during these weeks?
Plenty of new things and technology like SIP Servlets, JavaServer Faces 2.0 and CDI (Weld). Everything is new and exciting but after these four weeks I’m able to have a distance and focus also on other things. The last thing left – some free time that I can spend reading books, but I’m working on that
Oct 2nd
It’s Done!
I finished my job for a large financial institution in Warsaw. I spent three years far away from home, but I don’t regret – it was amazing time.
During these years I learned many new things and I’m not talking just about technical skills. What I’ve learnt the most are the soft social skills. It was great pleasure to work with such astonished people. The beginning was hard, the same as the end
Also Warsaw as a city where you can enlarge your technical skills is brilliant. So many possibilities to extend your knowledge, meet fascinating high skilled people or just talkative
And the only condition – you must want to!
To be not so pathetic there are so negatives. Honestly, the only think I don’t like is Warsaw as a crowded city ![]()
Maybe I could use to it, but it’s very exhausting, especially that I was able to compare it with other place – my home town. Small, quite and green. It’s very hard to live in Warsaw if you have other possibilities.
The final word – it doesn’t mean that I will not visit Warsaw from time to time – conferences and other events ![]()
Also, if you’re in my home town, just let me know and we will drink coffee or something … (special).
Sep 23rd
I always want to be a mentor. You know, the guy who knows all the answers. You can call him in the middle of the night and he’ll always give you the best solution. He’s the second after … you know
And know what? Recently I discovered that I became a mentor
Few days ago, I’ve was asked by some brilliant (in my opinion) developer. First I was a bit surprised and I really didn’t know what to say. The question was quite simple (maybe not to simple) and to answer it also should be easy. But it wasn’t
I realized, it not so funny to be a mentor!
I’ve been thinking about that for while. Even before, I had been asked many times for solution by team mates and I had noticed that I was asked a bit too often than others. Right now it’s clear for me, I’ve started becoming the mentor ages ago. I don’t like that
You’re probably surprised – why?
It’s easy – it’s very hard to extend your knowledge, you cannot base on someone’s experience, because you’re the most experienced guy (in theory)! You must read more than others, you must participated in more events than others, and so on… It’s the most exhausting way to learn
I don’t remember in which book I’ve read, that you must change either a job or a project in such situation. If you want learn easily something new, find a mentor!
Subconsciously I had known that when I was searching for a new job and hopefully I found it – the job and the mentor
Sep 16th
At last I’m back online – to be correct – my blog is back online
After some rumour with switching hostig providers finally I managed to close all the DNS issues. Hopefully, I don’t have to worry for loooong time
Recently lots of things are happening in my life, to say just few – I’m changing company, project and technology (but still Java but who knows
)
Just for the beginning some nice talks from TED. If you have opportunity, I strongly encourage you to join TEDxKrakow at 15th of October – I’m waiting for confirmation!
The first presentation is about Crowd-Accelerated Innovation – YouTube-driven communication and future learning:
The second talk is directly connected with our work as a Software Developer, just switch context – why everything is broken by Seth Godin
Seth Godin at Gel 2006 from Gel Conference on Vimeo.