not idle

Archive for the 'programming' Category

Netbeans Classloaders

Tuesday, September 29th, 2009

Netbeans classloader system consists of three types of classloaders, namely module classloader, system classloader and original classloader. Usually, module classloaders are used to load classes and resources from within the module itself. However, there are situations when you need to access classes and/or resources from other modules.
Imagine two modules, A and B. Class Ca from [...]

Read the rest of this entry »

Boolean state menu items in Netbeans

Monday, September 28th, 2009

Netbeans platform supports different kinds of actions (always enabled, CallableSystemAction, CallbackSystemAction etc). However, it was not clear to me how to create an action that could be used for toggling the state of the system. Initially, I experimented with Presenter.Menu interface and provided my own implementation of the JCheckMenuItem but couldn’t get the platform to [...]

Read the rest of this entry »

multitouch, part II

Tuesday, September 15th, 2009

A short briefing about what’s going on with Xlab’s multitouch screen. So:

we developed a screen that actually works – still a prototype, but a good one! All we  need to do, is to mount it in some good looking box. Besides the looks this will also help improving the screen’s performance,
by using CCV tracker and [...]

Read the rest of this entry »

Problem using SC create under windows

Sunday, July 26th, 2009

When you want to create a new service under windows, the most obvious way is usage of sc.exe
A “normal” user will read a help, and write:

sc create MyService binPath=C:\path\my.exe

The sc.exe only displays help, but does not do anything. The solution is another space after the “=”, so the right command is

sc create MyService binPath= C:\path\my.exe

Enjoy….

Read the rest of this entry »

Maildrop & .mailfilter resending

Tuesday, July 21st, 2009

Spending long unnecessary time on the web searching for solution, how to resend or forward an email by maildrop in delivery mode, I finally found a solution, which is now shared with you…

if(/^To: blue@bla.com/)
{
xfilter “/usr/bin/reformail -I’Reply-To: blu@bla.com’”
cc ‘!test@bla.com’
to “$HOME/Maildir”
}

This sample will do the following: for each mail send to blue@bla.com it will first rewrite the [...]

Read the rest of this entry »

Java: dynamically adding jars at runtime

Wednesday, January 28th, 2009

If you’re using factory pattern and want to separate factory from the implementations (so you only load the implementation you need) I recommend using Jar Class Loader.
Here’s what the author has to say:
JCL is a simple Java API that allows loading classes from Jar files. It uses a custom class loader to [...]

Read the rest of this entry »

Microsoft Solution Framework

Monday, January 19th, 2009

What is Microsoft Solutions Framework (MSF)? “MSF is a deliberate and disciplined approach to technology projects based on a defined set of principles, models, disciplines, concepts, guidelines, and proven practices from Microsoft.” In other words MSF provides specific how-to guidance to manage people and processes in an IT infrastructure or development lifecycle. It helps teams [...]

Read the rest of this entry »

Force .NET to run in 32-bit mode

Monday, November 3rd, 2008

I have recently installed 64-bit Vista on my computer and was trying to run Visual Studio project with dependency to some library that runs only in 32-bit mode – there was BadImageFormatException thrown at runtime.
After calling Ldr64.exe from command prompt, everything was working fine:
C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\Ldr64.exe setwow
Note: You have to run command prompt as administrator (on Vista) [...]

Read the rest of this entry »

Writing custom Python metric modules for Ganglia

Wednesday, October 29th, 2008

First you have to make sure Python development package is installed on your system

# apt-get install python2.5-dev

I recommend adding –with-python=PATH parameter to the configure script when building Ganglia

# ./configure –with-python=/usr/bin/python2.5

To write a Python module you have to follow a template (sample below) and put the resulting Python module (.py) in ganglia/python_modules. A corresponding Python configuration [...]

Read the rest of this entry »

ActiveMQ in connection with jetty

Wednesday, October 29th, 2008

Well, this is just a dummy example how to start with ActiveMQ and jetty. Of course the two applications are independent, but I decided to write a very simple sample which uses both of them.
First you need (no doubt) to get installed and running ActiveMQ and jetty. There are detailed instructions on ActiveMQ and jetty. [...]

Read the rest of this entry »