GIT - Create/Delete a Remote Branch

It's really easy to create a remote branch on a distributed repository


   git push origin <newfeature>

Where origin is your remote name and newfeature is the name of the branch you want to push up.

Deleting is also quite simple:

   git push origin :<newfeature>

That will delete the newfeature branch on the origin remote, but you’ll still need to delete the branch locally with

   git branch -d newfeature.

The surprising truth about motivation

One of my favourite TED talks is Dan Pink "On the surprising science of motivation". I also read Dan Pink's book Drive - The surprising truth about motivation. Why I found the book and his talk interesting is because it helped me understand something I many times found contradictory - incentive and motivation. How incentive can be a demotivating, specially when you are talking incentives in form of reward or punishment. How we attract the wrong people that is lured by the money, but does not believe in your idea. Why people can put a lot of hours of their spare time working for free on e.g. Open Source projects, but is not motivated at work where they actually get paid for developing software. Money can be a demotivator if you do not pay enough, but is not a motivator for complex tasks. There are a lot of ways to motivate people like autonomy and mastery.

Dan Pink on the surprising science of motivation
http://www.ted.com/talks/lang/eng/dan_pink_on_motivation.html

RSA Animate
http://www.youtube.com/watch?v=u6XAPnuFjJc

maven-antrun-plugin and Windows

Had a "funny" problem today, created a multi-pom project in Netbeans (on Linux) and it worked fine until my colleague tried to build the project on his Windows machine (same Maven 2 version).

Maven produced the following code in the head pom file:
<plugin>
<groupId>org.apache.maven.plugins</groupId><artifactId>maven-antrun-plugin</artifactId>
....
</plugin>
which worked fine in Linux, but not in Windows. It took some time before we understood that windows version of Maven seem to require the version tag :)
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
Annoying, but happy that it works again :)

How do your team communicate?

Communication is a critical factor in any team, it's the difference between a high performance team and ordinary or even bad team. But communication is something that is really hard for most of us, we are filled with emotions that can get in the way of the communications between members; We do not listen to what others have to say, afraid of sharing our insights, or start to be aggressive because we feel threatened. Most of us are not trained in communication skills beyond social context, and we learn quickly to not stand out or say something offensive in a group, but at work we must share our thoughts and ideas and we need to have an opinion which is built upon our experience and knowledge.

A team should share ideas, build on each others ideas, help each other when someone is in trouble and be inspired by each other. There seems to be a special energy when a team communicates well, a lot of new thought processes starts simultaneously, creates new insights and ideas. The group's collective knowledge starting to grow larger than the collected individual knowledge. They learn to depend on each other and help each other.


A team can journey from low to high performance if they learn how to communicate with each other, learn how to listen observe and reflect. With a help of a good coach the team can see the potential in themselves. A good coach can get the team to share ideas and thoughts with each other freely. A coach can help building up the trust between team members and get them to depend on each other.

A good coach helps people to communicate and gives the team new perspective when needed.

Fun and educational with books

Everybody is talking about that book, the book you also want to read but have not found the time or the drive. Or maybe you read a lot of books but you want to explore it further, but has no one to talk to?

A fun and interesting way to learn, explore and maybe push yourself to read an interesting book, is to start a book club with your colleagues. It does not even have to be colleagues (or friends), you could use your twitter connection or blog readers to form a book club.

So why do I want to join or start a book club? If you read a book you will only have one point of view, your own, and you will be biased to the content due to your past experience and values, but adding more point of views allows you to draw new conclusions and maybe better understand the content. You will learn more about yourself and your pears while discussing the content, and letting new ideas, knowledge and experiences into you life.

How do I start?
1. Figure out what types of books you want to read, e.g. books about change, then choose a few books and let people vote. Also decide if everyone should buy the book themselves or make a big order for everyone.
2. Decide how many times and how often you want to meet. E.g four times and three weeks between meetings.
3. Decide where you want to meet; at the office, a coffee place, or at someone's apartment.
4. Food and beverages is also important. Do you have the meeting early, lunch break or after work? Will people be hungry? Should everyone bring their own food or do we order in? Is there coffee, the, water?
5. Decide how you want to conduct the meeting, using a talking stick (e.g. if it is a large group), post-it's where you vote on topics, free discussion, post-up sessions, and so on.

Remember to always have the door open for new members, some people will leave due to not enough time or have read the next book, or any other reason. Don't be afraid letting new people in on an ongoing book. New people means new thoughts and ideas, larger pool of knowledge to drink from.

FOG Factor in brainstorming meetings

When you sit down in a brainstorming meeting it can be quite hard to distinguish between facts, opinions and guesses, and it can be hard to track them even if you are using a visual aid like Post-it Notes.

I like to use different colours or use the first letters for Facts, Opinions, and Guesses.
Facts is what we can easily measure or prove, like how many users we have on our site or how long the response time is, and so on.
Opinions are things that people think is a fact, it can be true or be false, it can also be facts that cant be proven. Opinions can easily translate as facts if it comes from someone respectable, so opinions should be treated with caution. It is important to identify opinions and explore them.
Guesses are uncertain ideas, we do not know much about them, but could be valuable to explore. Many guesses are often proven to be wrong, and you may wonder why you should even bother if guesses are wrong, but those few that turns out to be right is often groundbreaking.

Opinion and guesses are often the reason for lengthy meetings and frustration, because we cant distinguish them from facts, but now when we have the FOG factor you can easily identify them and move forward. You could then try to make opinions and guesses into facts in-between meetings by researching them using surveys, fact search and market tests.

Image: dan / FreeDigitalPhotos.net

OpenJPA and OSGi class loading trick

When using OpenJPA with a OSGi container like Felix you will get into some class loading troubles because OpenJPA will not be able to create an Entity Manager. It need to bypass the OSGi container's class loader and this is how you do it.
  1. Store the old class loader (OSGi container)
  2. Set the new class loader (e.g. the standard class loader)
  3. Create an Entity Manager Factory
  4. Restore the class loader to the original (OSGi Container)
You can put your code into the start() method of your BundleActivator:
EntityManagerFactory emf = null;
ClassLoader oldCL = Thread.currentThread().getContextClassLoader();        Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());

Map<String, String> props = new HashMap<String, String>();
// Create a Properties object with connectio parameters for database
props.put("javax.persistence.provider", "org.apache.openjpa.persistence.PersistenceProviderImpl");
props.put("openjpa.ConnectionURL", database_url);
props.put("openjpa.ConnectionDriverName", database_driver);
props.put("openjpa.ConnectionUserName", database_user);
props.put("openjpa.ConnectionPassword", database_password);
props.put("openjpa.jdbc.SynchronizeMappings", "buildSchema");

emf = Persistence.createEntityManagerFactory("PERS_UNIT", props)

// Change it back to the old classloader when everything is initialized.
Thread.currentThread().setContextClassLoader(oldCL);
 When you have created the entity manager and restored the classloader you can now use the EntityManagerFactory to create an EntityManager and start to use it.
It is important that you do this after you have restored the classloader or you will get conflicts between classes e.g if you have used an interface and created the class in one module and sent it to another module, the system will complain about that the class was created with another class loader.