Thursday, 22 December 2011

Apache CXF connector to Alfresco

After generating Apache CXF connector to Alfresco using WSDL document, we also have to add security interceptors. Here is a code fragment I have used:

org.apache.cxf.endpoint.Client client = ClientProxy.getClient(service);
Map inProps = new HashMap();
inProps.put(WSHandlerConstants.ACTION, "UsernameToken Timestamp");
inProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT);
inProps.put(WSHandlerConstants.PW_CALLBACK_CLASS, "com.roche.xp2.content.lowlevel.alfresco.util.AlfrescoRepositoryProviderCallback");
inProps.put(WSHandlerConstants.USER, "ticket");
WSS4JOutInterceptor wssIn = new WSS4JOutInterceptor(inProps);
client.getEndpoint().getOutInterceptors().add( new org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor());

Thursday, 15 December 2011

Spring 3.1 Released

This release provides a significant upgrade to the Spring framework with environment profiles, caching abstraction, JDBC 4.1 and Java 7 fork/join and Hibernate 4.0 support. More info about changes:
Download available here:

Sunday, 4 December 2011

How to log Garbage collection in java?

You have to add the following parameters when running a java program
  • -XX:+PringGC - switching on summary of every run of Garbage collection
  • -XX:+PringGCDetails - switching on detail summary of every run of Garbage collection
  • -Xloggc:filename - filename to which logs will be put

Logging application behavior, whose are deployed on tomcat

You can log many events of application without changing its code. You can switch on Valves in tomcat configuration. Valve (org.apache.catalina.valves.Valve) is acting like filter on HttpRequest. It is executed just before application gets the request. There are some predefined Valves you can use by just uncommenting them in server.xml configuration in tomcat. You can also develop your own Valve and use them after adding in configuration and in shared libs in tomcat.
More information can be read in the article:

Video showing how to use m2eclipse plugin

Look here:

ListPreference with values number type

In my Android application I tried to define preferences list with values of number type.
      android:dialogTitle="@string/preference_poll_list" />
I had to define lists in arrays.xml. But I had to define list poll_option_values as a string-array, like here:
    <array name="poll_option">
        <item>1 Minute</item>
        <item>2 Minutes</item>
        <item>5 Minutes</item>
        <item>10 Minutes</item>
        <item>20 Minutes</item>
    <string-array name="poll_option_values">
I couldn't use array type. Just another Android feature ;)

Saturday, 3 December 2011

Testing asynchronous actions using WebDriver (f.e. AJAX)

Here is a code snippet showing how to test ajax actions using WebDriver. You can use WebDriverWait.until method defining condition that checks if web page's structure has changed. In the WebDriverWait constructor you have to define timeout in seconds. If this time passes then method ends with an exception.
WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(new ExpectedCondition() {
  public Object apply(Object input) {
      try {
        WebElement elem = driver.findElement(;
        boolean condition = Here you can state condition
        return condition;
      } catch (StaleElementReferenceException e) {
        return false;

Monday, 28 November 2011

Spring Roo 1.2.0.RC1 released

New changes are ready for testing in the new Roo release candidate. The most interesting are:
  • Multi-module Maven project support
  • Enhancements in Entity model
See more on:

Sunday, 27 November 2011

ProGuard - obfuscator for Android

How to encode your code written in an Android application?
Use Proguard.

ProGuard is a free Java class file shrinker, optimizer, obfuscator, and preverifier. It detects and removes unused classes, fields, methods, and attributes. It optimizes bytecode and removes unused instructions. It renames the remaining classes, fields, and methods using short meaningless names. Finally, it preverifies the processed code for Java 6 or for Java Micro Edition.

More information on the product page:

Wednesday, 16 November 2011

How to change MANIFEST.MF generated by maven?

You have to add plugin configuration in pom.xml in section build/plugins:
Here is an example of configuring default class run when executing generated jar:
Here is an example of using already generated MANIFEST.MF file as the manifest file of the jar:

More info about plugin parameters on:

Loading properties file in java

You just have to define Properties variable and then use load method. Load method gets InputStream as a parameter.
Properties properties = new Properties();

Linux console tools for measuring performance

We can use following tools:
  • top, htop - processes measurement
  • df - storage space info
  • hdparm - storage performance
  • cat /proc/cpuinfo - CPU info
  • cat /proc/meminfo - RAM info
  • vmstat, dstat - processes, memory, swap, IO, CPU info
  • netstat - network info
  • mpstat - CPU summary
  • iostat - IO info
  • iptraf - many metrics

Latency and Responsiveness

These two measurements are important in Web Development.
  • Latency - a measure of time delay experienced in a system
  • Responsiveness - ability of a functional unit to complete assigned tasks within a given time

Tuesday, 15 November 2011

Runing ChromeDriver on Linux

I decided to use WebDriver in my project. It is a next version of Selenium library used for tests. I am using Ubuntu system. In my pom.xml I needed only to add one dependency:


I have created a simple java code in my main method:

 WebDriver driver = new ChromeDriver();

My program did not manage to connect to Chrome web browser. I needed to download chromedriver from and add a system property with path to this file.

It did work!

Thursday, 10 November 2011

CXF - maven plug-in

I was implementing a Webservice client. I used Apache CXF ( an open source services framework. It is a natural successor of Axis library.

After some time spent with CFX I can say that it uses Collections over Arrays (that is a big plus). On the other hand it hasn't got as good documentation as I expected. I tried to use maven task for generating java classes from WSDL definition files. When I got an error I had to use wsdl2java from command line to get detailed error message. Also I couldn't find syntax for wsdl2java task. I wished to use more parameters. I spent some time on finding how to do it. Underneath you can see an example to define configuration in pom.xml for wsdl2java operation. You can use more wsdlOption tags for generating classes from more then one WSDL file.


Saturday, 5 November 2011

Java Decompiler for Eclipse - JD-Eclipse

JD-Eclipse is the best Eclipse decompiler I have used.
Here are instructions how to install it:

Friday, 28 October 2011

Dependency tree in maven

To see dependency tree in maven use command:
mvn dependency:tree

Tuesday, 25 October 2011

How to create java object in Freemarker?

If you are using Freemarker integrated with struts, look at the class org.apache.struts2.views.freemarker.FreemarkerResult. In this class there is a method createModel(). There you have a list of objects inserted into model used in freemarker rendering.

  • Application - servlet context attributes hash model
  • JspTaglibs - jsp tag lib factory model
  • Request - request attributes hash model
  • Session - session attributes hash model
  • request - the HttpServletRequst object for direct access
  • response - the HttpServletResponse object for direct access
  • stack - the OgnLValueStack instance for direct access
  • ognl - the instance of the OgnlTool
  • action - the action itself
  • exception - optional : the JSP or Servlet exception as per the servlet spec (for JSP Exception pages)
  • struts - instance of the StrutsUtil class

In the ftl code you can use struts variable:

It will return object of this type, constructed with zero parameter constructor.

Format date in java with months' name changed

I was given the task to format dates. The requester needed months' name appropriate case endings.

It can be done be SimpleDateFormat class: (this example is for Polish language)

SimpleDateFormat sdf = new SimpleDateFormat("dd-MMMM-yyyy");
DateFormatSymbols dfs = new DateFormatSymbols();
dfs.setMonths(new String[]{"stycznia","lutego","marca","kwietnia","maja","czerwca","lipca","sierpnia","września","października","listopada","grudnia"});
String output = sdf.format(new Date());

Heap pollution

What is it?

Java Language Specification, Third Edition
§ Heap Pollution
It is possible that a variable of a parameterized type refers to an object that is not of that parameterized type. This situation is known as heap pollution. This situation can only occur if the program performed some operation that would give rise to an unchecked warning at compile-time.

Here is an example:

List l = new ArrayList();
List l1 = l;
Integer i = l1.get(0);

In java 7 the following additions help to deal with Heap Pollution:

  • A new mandatory compiler warning is generated on declaration sites of problematic varargs methods that are able to induce contributory heap pollution.
  • The ability to suppress those mandatory warnings at a declaration site using an @SuppressWarnings("varargs") annotation. The warnings may also be suppressing using the -Xlint:-varargs option to the compiler.
  • If the @SuppressWarnings("varargs") annotation is used on a problematic varargs method declaration, the unchecked warnings at call sites of that method are also suppressed.

Saturday, 22 October 2011

SpeakIt! - Chrome extension

Now you can mark a text in your Chrome browser and let the computer speak it!. Just install Chrome extension SpeakIt. You can find it here: SpeakIt.

Limit on Post Request - maxPostSize

Recently I was faced with a problem concerning a web page form. It stopped working without any change in the code. I have checked that due to database increase in this form I have over 50000 hidden inputs. So it looks like the server did not cope with such a big number of parameters in the post request.
I've found in the Tomcat and Jboss Connector configuration that we can define a constant maxPostSize that is the maximum size in bytes of the POST request that is handled by the container FORM parameter parsing. The limit can be disabled by setting this attribute to a value less than or equal to 0. If not specified, this attribute is set to 2097152 (2 megabytes).

Wednesday, 19 October 2011

STS 2.8.0 released. Supports Java 7

The new 2.8.0 release of the SpringSource Tool Suite (STS) is available. Now it has full IDE support for Java 7!
For more details browse to:

How to exclude folders from searches in Eclipse?

Right click on a folder. Choose properties. Set the folder as derived. Derived entities are not searchable by default.

Class Currency

In java 7 we have a new class:

It represents a currency. The currencies are identified by their ISO 4217 currency codes. Visit the ISO web site for more information, including a table of currency codes.

JRebel Newsletter

JRebel Newsletter is now available here:

LiveRebel is also worth mentioning. This product allows Java EE Hot Update without downtime, no lost session, no OutOfMemoryErrors, fully automated. Here is the demo.

Wednesday, 12 October 2011

Download AppDynamics Lite 2.0

New version of AppDynamics Lite is available. The newest version of Lite enables to:
  • monitor JMX metrics
  • include proactive email alerts when errors are found
To download Lite 2.0 go to:

Alfresco Certification

Alfresco has started a certification program. Certifications will confirm technical proficiency on the Alfresco platform. There are two certification paths for Engineer and Administrator. To certify you need to pass an exam at Pearson Vue. They have over 5,000 test centres in 165 countries. Test fee is 195 USD.
More details here:

Tuesday, 11 October 2011

Spring roo fixes bugs.

I've found a bug in Spring roo. I've created a project with module WEB MVC. I generated controller with mapping in mixed case. Unfortunately, the code generated by roo didn't work. I logged into the Spring roo Jira and created an issue: After a week, the bug was fixed. I am impressed. They do have a good support!

Thursday, 6 October 2011

Use Tomcat for EJB?

The Apache Software Foundation Announces Apache TomEE Certified as Java EE 6 Web Profile Compatible. If you wanted to use Java EE think about using it. Read more on:

Alfresco 4

A new version of Alfresco is ready to be downloaded now!
Alfresco Community 4, the first open platform for social content publishing is now available to download for free. Alfresco 4 includes new tools which allow developers to create social and cloud-scale, content-rich applications. Further, it includes a new, extensible service to publish content and status updates to social sites, including YouTube, Facebook, LinkedIn, Twitter, Flickr and SlideShare.
See details here

IBM SDK Java Technology Edition Version 7

IBM have announced the availability of IBM JDK 7 for both their AIX platform and the Linux platform. Windows is not supported by the SDK They have prepared changes not only supporting Java 7 features, but also big changes in Garbage Collection. More details here.

Wednesday, 5 October 2011

Assertiveness training

I have recently participated in the Assertiveness training . It's been the best soft skills training I have attended. Here're some useful tips:

Remark: This advice is relevant to Polish language and culture. In many others it could be seen as impolite or without any sense. ;-)

Assertive refusal has to have three parts:
  • The word No
  • Information on how you will behave
  • Short explanation
  • Expression of your being sorry
When you want to verify if your refusal was assertive answer one simple question:Do I feel good about it?

It is important not to excuse yourself to much. If not, it will be harder to stop repeated requests. There are some techniques that can be used if you are asked for something again and again:
  • Broken record - repeat still the same explanation
  • "I am elephant" technique - Say slowly, ask, paraphrase.
  • Jujitsu - If you are faced with the argument that a he/she has helped you in past, but now you are not willing to help him. Remember to thank him, but tell him that this time you cannot help.
  • authority - refer to the standards or authority
Assertive request Remember to:
  1. Think what will happen if you don't succeed.
  2. State your request in a short and logic way.
  3. End with a question about the actual decision (time or price).
A good assertive creates a platform for acceptance now or in the future.

Reaction for judging critique

You have two possibilities. You can say:
  • I agree. That's what I think.
  • I do not agree. I don't think about myself that way.
Don't get nervous! Don't persuade but state. Protest on unjust generalizations. When surprised, express it!

Feedback can be positive and negative. It has to contain 3 parts:

  • Fact - that has happened
  • Attitude - how do I feel about it
  • Expectation - what do I expect, how this person should behave.

Spring roo doesn't support Java 7

As in the title, Spring roo doesn't support java 7. See here.

Caching requests with status 301 in the browser

Recently I had to fix a bug found in the web application. I tried to repeat scenario in which the application reacted incorrectly. Unfortunately, in the logs I couldn't find some request from the browser. I used Mozilla Firefox with the Data Tamper plug-in, so I saw all requests made by the browser. I thought that Apache web server could cache it after I had found that application server doesn't do it. But it did not. In the end I found that Firefox cached it. Finally, in the Firefox plug-in Web Developer I switched off the cache. So I have found for the first time that a browser caches requests with response status 301.

Tuesday, 4 October 2011

Astah version 6.5

Change Vision has released Astah version 6.5. It is the next version of a program for building UML diagrams. The biggest change is possibility for creating your own plug-ins to extend Astah. Some bugs of version 6.4 were fixed. They have also released Astah Share version 2.5, that enables you to share your diagrams on your blog and wikis more easily. To see more go to page.

Monday, 3 October 2011

Alfresco Mobile

Alfresco Software has announced Alfresco Mobile - the free iOS app for the iPad and iPhone. With Alfresco Mobile, users can work more efficiently in a mobile environment. Application for iPad and iPhone can be download here.

Free version of JRebel

ZeroTurnaround company has released JRebel 4.5. They also included a new version, called JRebel Social. It's a free version, that requires: a social login (Facebook or Twitter), a constant internet connection. It's for non-commercial use only. To see more details: JRebel Social

Sunday, 2 October 2011

Cloud Foundry Deployments with Maven

The Cloud Foundry team has released the Cloud Foundry Maven Plugin. Developers can now easily integrate cloud deployments into their Maven projects. For more details go to:

Friday, 16 September 2011

Spring Roo 1.2.0.M1 released

Spring Roo 1.2.0.M1 was released. Significant changes:
  • Ten times faster
  • Now Apache licensed
  • Moved to GitHub
  • Adding service layer
Project page:

Wednesday, 14 September 2011

Some thoughts about plans

Recently I've heard a speech given by a successful business woman. What I've remembered was especially one point: The key to my success was not to have a plan, but to have a habit of planning. The world is changing so quickly that we have to change our plans very often!

Tuesday, 6 September 2011

Friends of Astah

Astah the producer of UML modeling program has started a new program: Friends of Astah. The Idea of their move is to make astah Professional available for free to individuals and organizations in the software community for one year, but not only.
You can profit from it in the following ways:
  • 1-year license of Astah Professional
  • The use of Friends of Astah logo
  • Publishing your activity (links to blog/articles/books)
  • Friend of Astah membership sticker
How to take part in the program look for:

Forcing a download dialog in the browser

If we have a link in our website to the resource, that can be opened in the browser itself, by default the resource will be open in the browser . But what can we do to have a link that will activate download instead? To force the resource to be downloaded by default, in the http response we should add header
Content-Disposition: attachment;filename="our_file_name"

To read more about http headers look at:

Saturday, 3 September 2011


LOGBack is a new logging framework, that is intended to be a successor of log4j. It is designed by the founder of log4j Ceki Gülcü.

It allows us to have an abstraction level of logging, so we can use API for logging and change only configuration to use an other framework in runtime producing logging.
Some new features: parameterized logging statements, abstraction of configurable encoders, Mapped Diagnostic Context (adding useful context information to every log line e.g. user who started current operation), event filtering

If you want to learn how to migrate to LOGBack read:


Since JDK 5 we have possibility to run Java application with parameter -javaagent, that allows to intercept compiled code with our own one. Our code is executed in the same JVM, loaded with system class loader with the same security policy.

To create your java agent you must implement method:
public static void premain(String agentArgs, Instrumentation inst);

and you have to archive this class into a jar file, that contains also file META-INF/MANIFEST.MF, with additional attribute Premain-Class with value of class that will be intercepted.
Then just run your application adding parameter -javaagent:your-jar-file.jar

Friday, 2 September 2011

Google App Engine changes!

Google corporation has announced that it changes Google App Engine terms of use. In the second half of September it will roll out further details. Some changes described in SLA draft (
  • reduction uptime to 99.95%
  • have 3 year deprecation policy, to plan application changes more easily due to API changes.
Summing up, there will be still a free version of service but more limited. Someone who wants to pay for an extended version might consider doing it before October 31st and you will get 50$ bonus.

Thursday, 1 September 2011

How to add Facebook button to your site?

How do you add Facebook's Like it button to your website or blog? It's really easy. You just have to add some javascript in the head of the page and a small piece of html code where you want to have it. A detailed description for Facebook's integration can be found at
Similar integration for Google Plus is available here

Wednesday, 31 August 2011

What is not possible with JRebel?

What isn't possible in class reloading when you are using JRebel?
  • Replacing superclass
  • Adding and removing implemented interfaces
For more details take a look at:

Tuesday, 30 August 2011

How to change classes in the running java application?

There are a few possibilities:
  • Hot deploy - Application is redeployed by application servers after the update of code. Usually after a few redeploys application server has to be restated because of possible memory leaks.
  • HotSwap - Allowed since Java 1.4. We can change the methods' definitions in classes during debug session. We cannot change class fields or add new methods, constructors or classes.
  • OSGI - Allows us to change modules of application. It is faster then Hot deploy, but we need to design our application to be OSGI modular, which requires more expensive and more difficult development process.
  • Throwaway class loaders - Many frameworks use components that are loaded in separate class loaders.The whole class loader is reloaded after the change, e.g. Tapestry, Seam, ...
  • Use JRebel - a tool updating class definitions. JRebel operates on class loaders.

Monday, 29 August 2011

java.util.Objects - new util class in Java 7

In Java 7 we have a new class java.util.Objects. It is a util class for shortening operations on Objects.

We have the following methods:

  • compare(T a, T b, Comparator c):int Returns 0 if the arguments are identical and, b) otherwise. Consequently, if both arguments are null 0 is returned
  • deepEquals(Object a, Object b):boolean Compares objects or Arrays
  • hash(Object... values):int Generates a hash code for a sequence of input values
  • T nonNull(T obj) If obj is not null, return obj else throw a NullPointerException

and other useful methods.

Look for more in javadoc:

Sunday, 28 August 2011

AppDynamics Lite - measuring performance

AppDynamics company has changed its application portfolio. They have made a new free product - AppDynamics Lite. It is a product designed for troubleshooting java applications performance in production environments.
It has some limitations, e.g. limited number of monitoring transaction types, but you can easily start using it. I have successfully connected it to three different applications on different servers: ATG on Jboss, one based on Spring framework on Tomcat, and CQ Day CMS instance.

Try for yourself:

Friday, 26 August 2011

How to lead self career?

Recently I've read an article with some useful career tips:
  • Do not start to many things. Focus on a reasonable amount.
  • Share your knowledge and responsibilities, so that you have time to learn new things.
  • Think how to capitalize your knowledge, activities. Make a plan. Maybe you will profit from it in a few years' time.
  • Specialize in areas that will make you a more valuable employee.
  • Prepare a long-term strategy for your career and revise it regularly.

Wednesday, 24 August 2011

Compressed oops in the Hotspot JVM 7 - new optimization

What is Compressed oops in the Hotspot JVM? It's a pointer to an object. They are stored in the Java heap. Not all of them are pointers to objects, but also e.g. pointers to fields in objects. Before Java 6u23 pointers have size corresponding with platform (32 bites or 64 bites) by default.
So unfortunately, on a 64 bites platform, applications need bigger heap.

In Java 7 by default, for heap smaller than 32GB, pointers are saved as 32 bites offset from the address of heap beginning. For bigger heaps pointers are addressed with 64 bites.

Wednesday, 17 August 2011

Questions to the employer on an interview

Recently I have read a thread concerning a question not what we will be asked on an interview but on the other hand what we should ask as an interviewee.

Some of the suggestions:
  1. What time does work start and ends?
  2. Which IDE and CI are used?
  3. Are there any internal trainings?
  4. Is unit testing used?
  5. Is wiki used?
  6. Which libraries and frameworks are used?
  7. Are there many own libraries created?
  8. Which work methodologies are used?
  9. Why does previous employee quit?
  10. Does work concern more maintenance or new projects?
  11. What trainings are possible?
  12. Are there any overtime if so how are they paid?

There is also a question which to choose as we wouldn't have time for many of them.

For me three most important are: 3,6, 10.

Tuesday, 16 August 2011

Tools for drawing UML

I can recommend some tools for UML.

First an on-line website It just create an image file with an UML diagram based on simple test instructions. Check it!

Other tools for creating UML based on textual notation:

Spring Roo 1.1.5 released

Spring Roo 1.1.5 has been released.

New release has 95 improvements and bug fixes.

More details on:

Monday, 15 August 2011

Apache Tomcat 5.5 end of support

Apache Tomcat 5.5 (released originally on August 31, 2004) will not be supported from October 1, 2012.

That means that after October 1, 2012 bugs and security issues will not be fixed for version 5.5.x.
After December 31, 2012 download pages will not be available any more.

Users of those tomcat version should proceed with migration to the newer version.

Sunday, 14 August 2011

JRebel for MyEclipse

New product has been released: JRebel for myEclipse.

This version will work only with this IDE. It is cheaper, so if you use only myEclipse or thinking of buying JRebel license for it you can save money.

Now it is 165$ a year. Full version costs from 200$.

More info on

Saturday, 13 August 2011

News from the JavaBlackBelt

Some changes have been delivered in the JavaBlackBelt, website well known for its tests on programming languages, technologies and tools. It allows users to pass exams, but also to be a part of community. We can create questions, precise them and create whole exams.

Everyone can test their knowledge now also in exams concerning Java 7, Android, Oracle SQL.

To see more go to

Sunday, 24 July 2011

JRebel changes prices

In mid September JRebel from the version 4.5 will change prices. It is not hard to predict that it will be more expensive :)

So new prices are:

JRebel Personal: $130
* Same as JRebel Base, but for individuals, students, and non-profit organizations

JRebel Base: $265 / user license per year
* Previously titled JRebel Standard, this version is for most small-medium sized teams. It supports all major IDEs, containers, application servers, and over 35 frameworks; plus we like that it makes us think of a galaxy far far away...

JRebel Enterprise: $365 / floating license per year
* This is the version of JRebel suitable for most enterprises. It includes everything from JRebel Base, then adds a License Server for Centralized Management and Reporting. Plus, multiple people can use the same license across an enterprise, as long as they’re not using it at the exact same time.

Premium Support Add-On: +$50 / license per year
* Only available for orders over 10 licenses, we’ll provide your organization with “Getting Started” and “Advanced JRebel Usage” webinars for your team, using the same technology you have in your environment. Any support cases you have will receive priority treatment, and we’ll ensure 1-hour response times during business hours.

If you consider buying you can do it cheaper and even for few years with multi year license.

And if you want to see what the new changes are in list of supporting frameworks, look at:

Saturday, 23 July 2011

How to export variables by a script in bash?

If you do not use bash more often but form time to time you can have a similar problem. Just before running java application from command line you would like to set up some system variables. So setting up them is done in a script. If you run it, those variables will be set only for time of script execution, as they will be created in a separate environment. What is the solution?

Just run script with preceding . or source

. ./

source ./

This time script will run within the existing shell. This is what we wanted!

Friday, 22 July 2011

Eclipse shortcuts

If you are an Eclipse developer you must know Eclipse keyboard's shortcuts. It will make your work much faster.

List of useful ones :

Assistant - Ctrl + 3
Content Assist - Ctrl + Space
Find Next - Ctrl + K
Find Previous - Ctrl + Shift + K
Find and Replace - Ctrl + F
Quick Fix - Ctrl + 1
Undo - Ctrl + Z
Redo - Ctrl + Y

Select Enclosing Element - Alt + Shift + Down
Select Next Element - Alt + Shift + Right
Select Previous Element - Alt + Shift + Left
Word Completion - Alt + /
Close All Files - Ctrl + Shift + W
New File - Ctrl + N
Properties - Alt + Enter

Declaration in Workspace - Ctrl + G
Find Text in Workspace - Ctrl + G
Open Search Dialog - Ctrl + H
References in Workspace - Ctrl + Shift + G

Change Method Signature - Alt + Shift + C
Extract Local Variable - Alt + Shift + L
Extract Method - Alt + Shift + M
Inline - Alt + Shift + I
Refactoring, Move - Alt + Shift + V
Refactoring, Rename - Alt + Shift + R
Refactoring Menu - Alt + Shift + T

Delete Line - Ctrl + D
Delete Next Word - Ctrl + Delete
Delete Previous Word - Ctrl + Backspace
Expand - Ctrl + Numpad_Add
Expand All - Ctrl + Numpad_Multiply
Move Lines Down - Alt + Down
Move Lines Up - Alt + Up

To Lower Case - Ctrl + Shift + Y
To Upper Case - Ctrl + Shift + X

Add Javadoc Comment - Alt + Shift + J
Format - Ctrl + Shift + F
Organize Imports - Ctrl + Shift + O
Source Quick Menu - Alt + Shift + S
Tooltip Description - F2
Comment - Ctrl + /

All Generic Views - Alt + Shift + Q
Debug Menu - Alt + Shift + D
Debug Last Launched - F11
Run Menu - Alt + Shift + X
Run Last Launched - Ctrl + F11
Run to Line (In Debug) - Ctrl + R

Navigate Backward History - Alt + Left
Navigate Forward History - Alt + Right
Go to Line - Ctrl + L
Go to Matching Bracket - Ctrl + Shift + P
Last Edit Location - Ctrl + Q
Call Hierarchy - Ctrl + Alt + H
Open Declaration - F3
Open Resource - Ctrl + Shift + R
Open Structure - Ctrl + F3
Open Type - Ctrl + Shift + T
Open Type Hierarchy - F4
Open Type in Hierarchy - Ctrl + Shift + H
Quick Hierarchy - Ctrl + T
Quick Outline - Ctrl + O

Activate Editor - F12
Maximize Active View - Ctrl + M
Next Perspective - Ctrl + F8
Next view - Ctrl + F7
Switch Editor - Ctrl + E
Key Assist - Ctrl + Shift + L

It is worth to remember some of them!

Thursday, 21 July 2011

Website for managing tasks - RememberTheMilk

How not to forget great ideas and things to do?
I can recommend the website for managing tasks.


You can use it for free in the browser. Only smartphone applications are paid. But it is a big plus to have the access not only on the computer, but as well on your phone.

It is owned by Yahoo, so don't be afraid that all you have typed in may one day disappear!

Usability of this site is also quite good. Just give it a try!

Wednesday, 20 July 2011

Revolution with JRebel

I have installed JRebel on my Eclipse.

It really makes java development faster. You do not have to restart application or application server after changes in Java classes any more.

To see how to install it in your IDE, go to:

To quote statistics from JRebel site:

* 17.5% - the average percentage of coding time spent redeploying (this varies on the size of the app, of course)
* 10.5 - the # of minutes wasted per hour of coding
* 4.38 - the # of hours wasted per week
* 5.25 - number of full work weeks wasted per year (40-hour weeks).
* ...and over 18 hours per month of preventable redeploys during your JRebel LiquidMetal license period!

So you can try 30-day trial license and if you want to buy it look at:

Thursday, 14 July 2011

Vaadin Plugin for Spring Roo

Vaadin, a framework for fast deployment of applications (internally using Google Web Toolkit), has just gained Plugin for Spring Roo. Now it has gained even more productivity and gives easy start for those who want to try Vaadin.

It seems that Roo starts to be the platform for fast production and deployment prototypes for many web frameworks.

More info on: and

Wednesday, 13 July 2011

Alfresco Team

New product from Alfresco family, Alfresco Team has just emerged. It is available in 6 languages, and fits neatly between the developer-focused Alfresco Community edition and the Alfresco Enterprise Platform. If you are looking to just get started with Alfresco or need a supported, departmental solution for content collaboration, then Alfresco Team is for you.

Alfresco Team™ is a pro-tool for content collaboration. If your team creates and collaborates on content - business documents, spreadsheets, presentations, designs, images, videos, or audio - Alfresco Team handles it. From the whiteboard to the final version, from your desktop to your mobile tablet, Alfresco Team has you covered.

This full install of Team includes 5 users and up to 500 documents (for free), runs on a Windows or Linux server, and can be easily upgraded to a paid subscription when you are ready to buy more users or support.

Monday, 11 July 2011

Thrift alternative for Web Services

Thrift - software library for exchanging data. It is a library for building RPC clients and servers with seamless communication across programming languages. That's all done by compiler generation code.

It was created by Facebook team, to exchange data between modules written in different languages (C++,Java,Python,PHP, ...)

They found a few alternatives to use: SOAP (excessive XML parsing), CORBA (heavyweight, over-designed), COM by Microsoft (not open source), Pillar (missing versioning, abstraction), Protocol Buffers (closed source, owned by Google).

Due to those cons they started project Thrift.
In April 2007 they made it opensource and in May 2008 it was moved to Apache Incubator.
Now it is used by Facebook, Twitter, Amazon, Recaptcha.

Thrift is written in C++. They have not found any suitable library to use in C++ for thread management, so they developed also that part in the library, using Java Thread Library concepts as template.

Thrift allows to use following protocols: binary, dense encoding, json, useful for debugging. Protocol abstraction can be easily changed transparently from other parts of system.

On the transport level we can used blocking/non-blocking sockets, files, shared memory.

We have blocking, non-blocking, single threaded and multi-threaded servers.

Supported languages:
C++, C#, Erlang, Haskell, Java, Objective C/Cocoa, OCaml, Perl, PHP, Python, Ruby, Squeak.

Thrift does not add own types, but uses key types used in most languages and maps them to the ones used in the target language.

We have base types: bool, byte, i16 (signed 16-bit integer), i32, i64, double (64-bit floating point value), string ( UTF-8 encoding), binary: a sequence of unencoded bytes.

We have also containers of types: ordered list with duplicates (target ArrayList in Java), unordered set of unique elements (target HashSet in Java), map of unique keys to values. With compiler directives we can change container types for target languages.

We can declare structures, that will be mapped for classes in target languages. Every structure has a list of fields. Every field has unique name and numeric identifier. If can also have default value. If we do not specify identifier, than it will be added by Thrift. Identifiers are used for versioning. In the generated structure we have fields that inform whether the value was set by the other side of communication or not. Developer can decide how to treat this situation as an error or resolve inconsistencies.

struct Book
1: string name,
2: i32 pages = 100,
3: Author op,
4: optional string comment,

We can define enums and exceptions, that will be compiled to abstract exception class in the target languages.

We declare services that are equal to defining interfaces. Compiler generates stubs implementing interface. Then in servers and clients we implements communication.

We can declare methods as void or async void. The first provides that the execution of method on the server was done, and the second only that the request to execute was done.

The scheme of usage Thrift is as follows:
create thrift script, generate code by compiler, write servers and clients using library objects.

Thrift do not support: cyclic structs, struct inheritance, overloading, heterogeneous containers, null return.

It gives: lower overhead due to the usage of binary format, simplify usage (no framework to code to, no XML), application-level wire format and the serialization-level wire format cleanly separated, soft versioning of the protocol, no build dependencies.

It can be recomenended for creating high-performance services, called from multiple languages when speed is a concern, but clients and servers are co-located.

Wednesday, 6 July 2011

Java not yet dead!

Twitter announced that it replaces Ruby on Rails front-end for search with a Java server.
I have recently read an article about Thrift architecture, where authors concluded, that Java thread architecture was the pattern for their solution. In C++ there were no library, that allowed them to get equal performance.
It looks like Ruby on Rails have similar problem.

Twitter after such change gained triple drop in search latency.

Ctrl + Space in Windows 7

I have upgraded OS. Now I have Windows 7 (with more then one system language set up).
So after installation of Eclipse I was faced with a problem of not working shortcut CTRL+SPACE.

This shortcut is used by Windows7 to change system language.

I have found a webpage with description how to fix it:

Now it works!

Monday, 27 June 2011

Changes to Java certificates. Not August 1, but September 30

Those who plan to make Java certificates, especially Java Developer and Java Architect, must know that Oracle changed requirements for them this year. From 1st August three expensive trainings will be required.

But I have read today, that deadline was postponed to September 30.

So changes apply to following certificates:
Java Architect, Java Developer, Solaris System Administrator and Solaris Security Administrator
Details on:

Sunday, 19 June 2011

Astah for UML

I have recently needed a tool to generate UML diagram. It's been ages since I was using one. I think that was during my studies. As far as I can remember I was using ArgoUML. By the way, today it is not often used in the project as it used to be. Probably because of Agile approach.

I have found that ArgoUML hasn't had any new releases for a few years.
However, I found Astah. It is quite a useful tool.

The community version is free.

So if you need to build UML diagrams, I can recommend it.

Friday, 17 June 2011

Problem with preferredMapping in Spring roo

I wish to present next error I have faced during using roo as a development tool.

In command controller class I used attribute --preferredMapping createSimple
So attribute consist capital letter, it cannot have as a value with capital letter.

In generated controller mappings on controller and to view names was not correct. In html it was generated lower case, but in mapping was with a capital ones. I have to fix them by had for it running.

Monday, 13 June 2011

Problem with roo + gwt

I have upgraded Spring roo to the version 1.1.4

It ended with the problem using gwt web frontend, with an error:

GWT module's gwt.xml file not found; cannot continue

I have found the cause:

So in Spring roo ver. 1.1.4 generating gwt web is not working

Friday, 10 June 2011


We do use HTTP Headers in coding web pages for the information from the browser client use.
f.e. I used Referer header to know which from which page new request comes.

I have discovered that it is not always true. On Firefox it was, but on Chrome and IE when the link was clicked in the Flash object Referer was set to the address of that flash object.

So be careful, Referer can be
- url of the page on which link was clicked,
- url for the flash object on which link was clicked.

Wednesday, 16 March 2011

Principles of object-oriented design

SOLID - five simple principles of object-oriented design
introduced by Robert C. Martin

- Single responsibility principle (S) - that an object should have only a single responsibility
- Open/closed principle (O) - “software entities … should be open for extension, but closed for modification
- Liskov substitution principle (L) - objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program
- Interface separation (I) - many client specific interfaces are better than one general purpose interface.
Dependency inversion principle (D) - Depend upon Abstractions. Do not depend upon concretions.