"Jon Hegg bloggs about all things related to the crafting of quality code."
Setting Eclipse color themes
Tue, 03/08/2011 - 12:52 | by jonheggEclipse has la lot of settings, but no easy way to quickly change the syntax coloring in editors. But there is a plugin that helps with this. Eclipse Color Themes does just what it says, and I like it a lot. I also created my own theme that I use regularly. I have found out that I prefer the background to be dark and the text to be light. It feels easier on the eyes.
My theme
SOAP traffic through a middleware solution?
Mon, 03/07/2011 - 07:47 | by jonheggYes, it's possible. We've been doing it for years. But no longer. After a big period of troubles in a large SOA system, we finally routed the SOAP traffic outside the middleware, and guess what? No more troubles! I guess the lesson is this; use the middleware for what it's good at, orchestration and transformations, and not as a very expensive SOAP proxy.
Modifying Views from another thread in Android
Fri, 02/04/2011 - 13:40 | by jonheggIf you have tried to modify a View object from a different thread than the one that created the View, you have probably seen this exception in the log :
ERROR/AndroidRuntime(1975): android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
The exception really says it all. You can not modify the View object from outside of the originating thread. But what if you really want to, anyway? For instance, what if you use a JavaScriptInterface bridge to modify the Views based on actions in a WebView? Whats you need, is a Handler object that can receive messages in the originating thread. Here is a small piece of code that shows this. It creates a Handler that updates the text on a button :
public class MainPage extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
The Bus Load Distribution Pattern
Tue, 07/14/2009 - 09:29 | by jonheggMy day job is being the lead developer of a nation-wide SOA system in the health sector, and some of the key priorities for this system is load distribution and performance. The back-end of the system consists of a cluster of Jboss j2EE servers that are stateless, and thus unaware of each others existence. There are serveral processing threads running on each server, and all of them access the same database. The problem is; how to avoid unecessary concurrency problems, such as race conditions and locking problems? One solution I came up with, and that works nicely, is taking advantage of the fact that all the Jboss servers are wired up to a common bus (MQ/ESB). The way I did this, is as follows:
Wrestling with Eclipse
Fri, 06/05/2009 - 11:12 | by jonheggIm using Eclipse for most of my development work, and it's a great IDE. But there one thing that is not really well implemented at all, and that's the management of plugins. Im getting pretty tired of the "plugin-updates available -> dependencies failed -> try to figure out whats missing -> reload with -clean -> still not working -> scratch head and curse" routine by now. And its getting worse and worse. Eventually I will be forced to do a clean installation, and I hate that! When, oh, when will there be a working plugin manager in Eclipse? Will I be forced to start using NetBeans or IntelliJ instead?
Eclipse plugin woes
At CommunityOne North
Thu, 04/16/2009 - 10:29 | by jonheggI attended the Sun CommunityOne North conference yesterday. It was the first time this event was held outside North Amcerica. A great horde of nerds invaded the conference center in Oslo, and a good time was had by all, I think. Still, the talks was only thirty minutes long, and I feel thats a bit on the short side. Simon Phipps held a great keynote talk about the three different waves of open source that I really enjoyed.
The mysterious art of Java boxing
Thu, 03/26/2009 - 12:27 | by jonheggA common situation in many programming languages, is the convertion between language primitives, like int and long in Java, and their corresponding wrapper classes. In this example, that would be Integer and Long.![]()
Prior to the release 5 of Java, you would have to do these convertions manually, by invoking the Value method on the wrapper object. For instance, new Integer(5) would create an Integer wrapper object with 5 as the value, and Integer.intValue() would return the int primitive value (5). This process is called boxing and unboxing.