Posts about technology and arts.

CCM Hudson Plugin

CCM is a tool developed by Jonas Blunck ( It’s able to calculate the cyclomatic complexity (McCabe) of a .NET Project or Solution.

I developed TestLink Hudson Plug-in, a Hudson Plug-in that lets you invoke CCM from hudson and have the results displayed in the console output. I chose CCM as CC tool for .NET instead of SourceMonitor after it gave me a CC value of 4 for a method I was sure was supposed to have 5.


Code to change your message in MSN messenger

I’ve always wanted to know how does the code to show what was I listening to looked like. I found it after installing XMPlay and XMPlay MSN Plug-in. The plug-in zip had the plug-in itself and its source code. And what a neat source code (-:.

Basically, you just send a message to the MSN UI API with a defined data structure. And to remove the message, just send again with an empty string.

Bruno de Paula Kinoshita
original src code:
XMPlay MSN Plugin (c) 2005-2006 Elliott Sales de Andrade

#include <cstdlib>
#include <iostream>
#include <windows.h>

using namespace std;

typedef struct {
BOOL showCues;
BOOL keepOnClose;
} MSNStuff;
static MSNStuff msnConf;

void setNowPlaying( char *title)
    wchar_t *lpMsn;
    int strLen = 20;
    HWND xmpwin;
    HWND msnui=0;
    lpMsn = (wchar_t*)calloc(1024,1024);
    // stuff for MSN before...
    memcpy(lpMsn, L&quot;\&#92;&#48;Music\&#92;&#48;1\&#92;&#48;{0}\&#92;&#48;&quot;, 17*2);
    // actual title...
    strLen=MultiByteToWideChar(false?CP_UTF8:CP_ACP,0,title,-1,lpMsn+17,492)-1;  /* 1024/2 - 20 */
    // stuff for MSN after...
    memcpy(lpMsn + 17 + strLen, L&quot;\&#92;&#48;&quot;, 3*2);
    strLen += 20;
    msndata.dwData = 0x547;
    msndata.lpData = (void*)lpMsn;
    msndata.cbData = strLen * 2;
    while ( msnui = FindWindowEx(NULL, msnui, &quot;MsnMsgrUIManager&quot;, NULL) )
        SendMessage(msnui, WM_COPYDATA, (WPARAM)xmpwin, (LPARAM)&amp;msndata);

int main(int argc, char *argv[])
    char *title;
    if ( argc == 1 )
        title = &quot;&quot;;
        title = argv[1];
    setNowPlaying ( title );
    return EXIT_SUCCESS;

Displaying Japanese characters in Java Swing

It’s not as complicated as I first thought.

Had to use this technique to develop an Swing application for the JLPT certification exam.

public static void main(String[] args) {
	JFrame frame = new JFrame();
	Container container = frame.getContentPane();
	JLabel japanese = new JLabel( "Kino\u304D\u306E" );
	japanese.setToolTipText( "This is Japanese" );
	Font f = new Font("Arial Unicode MS", Font.BOLD, 16);
	container.add( japanese );

All you have to do is to use the hexadecimal representation of the characters instead of using plain text. And here is the result.