Configuring Eclipse SVN (Subclipse) to use JavaHL(JNI)

 

Configuring JavaHL for Eclipse is not as straightforward as it could be so posting a quick HOWTO. Following applies mostly to Linux users.

With Ubuntu the fool-proof steps are:

  1. Make sure libsvn-java, subversion and libsvn1 packages are installed
  2. Add following to the end of your eclipse.ini file: -Djava.library.path=/usr/lib/jni
  3. Restart eclipse and make sure JavaHL is selected under Window->Preferences->Team->SVN

By using JavaHL it gets more likely that your svn repo doesn’t get screwed up when using both command-line/shell and subclipse for svn.



Configuring Eclipse to use native SVN client - JavaHL

Share:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • digg
  • Reddit
Comments (1) Thursday, January 10, 4:04 pm

Avoid useless Plugin Initialization and/or Class Loading

Here’s a tip for initializing your plugins or any other singleton-like repository only when needed.

Consider a code like this:

if (isConfigurable()) {
  Bundle bundleCopy = bundle;
  Preferences[] preferencesCopy = new Preferences[1];
  preferencesCopy[0] = new org.eclipse.core.internal.
			preferences.legacy.PreferenceForwarder(
			this, bundleCopy.getSymbolicName());
  return preferencesCopy;
}
return null;

Do you see what’s wrong there?

The problem is that if your #isConfigurable is always FALSE then your code still:

  1. loads PreferencesForwarder class
  2. initializes all PreferencesForwarder’s static variables
  3. forces Preferences plugin to load

Always, if possible and makes sense, isolate your class loading into a simple Runnable inner class if there is some static init or plugin activation trigger involved!

Then the code would become:

if (isConfigurable()) {
  final Bundle bundleCopy = bundle;
  final Preferences[] preferencesCopy = new Preferences[1];
  Runnable innerCall = new Runnable() {
    public void run() {
      preferencesCopy[0] = new org.eclipse.core.internal.
			       preferences.legacy.PreferenceForwarder(
				 this, bundleCopy.getSymbolicName());
    }
  };
  innerCall.run();
}
return null;

When you think of it - this pattern is somewhat similar to the singleton pattern implementation - the one of the very few thread-safe and fast singleton patterns that is bugfree and truly lazy!

Quoting wonderful singleton impl from wikipedia:

public class Singleton {
   private Singleton() {}
   private static class SingletonHolder {
     private final static Singleton INSTANCE = new Singleton();
   }
   public static Singleton getInstance() {
     return SingletonHolder.INSTANCE;
   }
 }

(OK, to be fully honest, since java1.5 you can also trust volatile flags but - trust noone, use the old stuff:P)

For the reference, the PreferencesForwarder example was taken from the org.eclipse.core.runtime.Plugin#getPluginPreferences class and modified a bit.

UPDATE: This post is not fully correct! Never assume something to be true even if it comes from a trustworthy source like eclipse core runtime source. Please see the comments for explanation!

Share:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • digg
  • Reddit
Comments (3) Wednesday, December 19, 2:08 pm

Summer of Code: writing PHP plugins

 

Toomas finished the official part of the google summer of code program. It was an honor to be the mentor and I had/still have a lot of fun with him.

Grab The PHP writing plugin for Eclipse from the update site and check it out if it works for you!

Sorry, but java6 and eclipse 3.3 only! (jsr-223 scripting engine starts from java 6)

Quercus GPL-licensed PHP Fragment is not mandatory - the plugin supports also javascript (and possibly all JSR223 scripting engines).

Have fun and let him know if you find some cool usage for it. Commenting at his blog is a good start.
I had to disable comments at my blog :(

A cool feature would be to write a small snippet that sends selected text to some rafb/etc pastebin and prints the url to the eclipse console view.

Share:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • digg
  • Reddit
Comments (0) Thursday, August 23, 1:36 pm

Forget the Procrastination

I’m writing this story while riding on a train to Tartu, moving at 70km/h. Where else could I have that much free time with 4KB/s internet. This time it’s not technology that gets my attention, it’s too old fashion. Today I want to share my thoughts related to Procrastination.

Procrastination is the new popular disease that threats everyone just like did stress years ago. Back then everyone admitted that stress is bad and people were trying hard to notice the stress in very early stages. Contrarily, Procrastination is taken as something to be proud of - like a habit of a genius.

John Perry at his website propagates Structured Procrastination to get over the unexisting productivity that you get from the Procrastination. The principle idea is to make something seemingly important your top priority task and just don’t do it - take next from the list. He claims it would cure the Procrastination and boost your effectiveness.

If you are hi-tech Procrastinator then you have probably also familiar with Paul Graham essay on Procrastination

I don’t believe any of this “tweak your lazyness” methodology that tells you Procrastination is something to be OK with. You don’t have to play with yourself and think out hacks to overcome Procrastination. You can do this but then you never get the effectiveness you are dreaming about.

You have to force your discipline, make effectiveness a habit! Start small, start planning your day.

Don’t start by making plans for a lifetime and next 2 years! If you don’t have the habit of acting small, how do you think you can make big actionable planning if you fail with one day planning? You need a plan for sure, but you have to fix the root first. As they say - think global, act local.

I’ll describe something that helped me to get out of this spiral when there was so much to do, so little time available and I still ended up by not doing anything.

Just take a paper and put down everything you want and could do tomorrow. If you are a real Procrastinator then you end up with a big list and everything seems feasible. At the end of the next day you probably notice that you managed to complete just a few tasks, or.. as a real Procrastinator.. you complete none.

Don’t worry, we know how to fix it! Take your list and calculate plan for tomorrow:

X = (y/a)*2+1
a - total number of tasks, y - number of completed tasks

Meaning, if you failed, just complete 1 task. If you finished 5 tasks out of 10, try to finish remaining 3 tasks tomorrow. Believe me, you’ll become extremely happy person after you manage the skill to complete at least 80% of your daily tasks for at least one month. After that it becomes natural habit and just keep practicing! :)

Let me know if any of this made sense to you!

Happy planning, work hard and take time to relax, dear Procrastinator :)

PS. Still, I think Paul Graham essay is excellent, he just tends to label everything as Procrastination and some of his examples are not signs of Procrastination!

PS. It finally makes sense why blogging is so popular in US - commuting takes a lot of time and train is the best place to blog.

Share:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • digg
  • Reddit
Comments (0) Saturday, June 16, 5:42 pm

Four is the Magical Number - and so is 5920

5920 is the number of pixels you get horizontally when being a Codehooper with serious need for more screen real estate. 6149440 pixels in total.

Featuring our widget-guru Ivar at his new workspace :)

PS. Sorry if someone has commented here over last few weeks. Almost thousand spam comments is just way too much to moderate - feel free to call or snail-mail me.

Share:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • digg
  • Reddit
Comments (0) Wednesday, April 11, 9:27 pm