January 12, 2010
filed around lunchtime by dirk husemann in: hacking
technorati tags:
QR code for this entry · average time to read 0:56 minutes

in one of our projects we are using maven to build our web application. part of our build process involves maven resource filtering, in particular, we need to insert path names into resources controlling the build process. since our team uses both linux and windows, we need to be able to generate file: URLs that work irrespective of the underlying platform.

using a construct like

file://${project.build.directory}/path/to/stuff

didn’t really work: on linux the resulting file: URL was usable, on windows it was not: there was a / missing plus all \ occurences had been escaped.

after trying a couple of variations, i came across the available variables section of the maven documentation which listed project.baseUri — which seemed just the ticket!

alas, it turns out that maven’s resource plugin currently does not know about ${project.baseUri} — doh. yet, not all hope is lost: by adding the following property definition to the project’s pom.xml file did the trick:

    <properties>
      ...
      <projectBaseUri>${project.baseUri}</projectBaseUri>
      ...
    </properties>

instead of ${project.baseUri} we use ${projectBaseUri} in the resource file, which gets translated to the desired file: URL. bingo.

all content posted on these pages is an expression of my own mind. my employer is welcome to share these opinions but then again he might not want to.
December 9, 2009
filed in the early evening by dirk husemann in: hacking,linux
technorati tags:
QR code for this entry · average time to read 0:57 minutes

i just switched over from thunderbird 2 to the new sparkly thunderbird 3 — and i like it very much. particularly the tabbed user interface is quite nice but also lightning 1.0 seems to cope much better with those lotus notes generated calender invites :-)

what did bother me was that i couldn’t find an easy to use function for keyconfig to bind the page left and page right keys (aka F19 and F20) of my X200 keyboard to “previous tab” and “next tab”. after some digging i stumbled across the mozilla thunderbird 3 tabmail page which then allowed me to figure out how to create the code for keyconfig:

// next tab
var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1'].
    getService(Components.interfaces.nsIWindowMediator);
var winId = windowManager.getMostRecentWindow("mail:3pane");
var tabmail = winId.document.getElementById('tabmail')
tabmail.switchToTab((tabmail.tabContainer.selectedIndex + 1) % tabmail.tabInfo.length)
and
// previous tab
var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1'].
    getService(Components.interfaces.nsIWindowMediator);
var winId = windowManager.getMostRecentWindow("mail:3pane");
var tabmail = winId.document.getElementById('tabmail')
tabmail.switchToTab((tabmail.tabContainer.selectedIndex + tabmail.tabInfo.length - 1) % tabmail.tabInfo.length)

copy & paste the code snippets and use keyconfig’s “add key” feature to bind the code to whatever key you’d like to use.

all content posted on these pages is an expression of my own mind. my employer is welcome to share these opinions but then again he might not want to.
November 23, 2009
filed mid-afternoon by dirk husemann in: hacking,linux
technorati tags:
QR code for this entry · average time to read 1:41 minutes

i recently switched all my systems from running kubuntu hardy heron 08.04.02 to xubuntu karmic koala 09.101 — a rather pleasant switch over. the only thing that was bothering me was the really crappy fonts in firefox and emacs. in firefox, no matter what i configured in firefox itself or in the appearance settings dialog of xubuntu (tried both gnome-control-center and XFCE’s appearance dialog) the fonts would still be blurry and below a certain size unreadable almost. in emacs i was suffering from the blurriness plus humongous menu fonts (i am getting older, i know, but so far i don’t need that large a print, really).

after a lot of research i finally managed to track it down to the following:

  1. firefox doesn’t seem to be really interested in what the user’s desktop settings say, the only guy it will listen to is fontconfig configured via /etc/fonts/conf.d!
  2. to get rid of the blurry fonts i needed to drop the 10-hinting-{full,medium,slight}.conf from fontconfig’s /etc/fonts.conf.d directory

that fixed the blurry fonts in firefox and emacs.

to get emacs menu’s back to a more sensible size i had to edit $HOME/.emacs.d/gtkrc — changing the default face via M-x customize-face only affected the buffer and modeline fonts but not the menu itself. i’m using the DejaVu Sans fonts, so my gktrc file looks like this:

style "user-font"
{
    font_name="DejaVu Sans 8"
}
widget_class "*" style "user-font"
gtk-font-name="DejaVu Sans 8"

style "default"
{
    font_name="DejaVu Sans 8"
    bg[NORMAL] = { 1.0, 1.0, 1.0 }
}

that one fixed emacs.


  1. yes, i did try kubuntu 09.10 in the hopes that the KDE 4 gang had gotten their act together and had produced by now something as usuable (as opposed to blinky, flashy, sparkly) as KDE 3.5 — alas, that hope was in vain: a lot of the features that i’d valued in KDE 3.5 were still missing, usability was still not on par with KDE 3.5′s usability — but, hey, it’s blinky, flashy, sparkly, surely that counts for something? no, not really. i’m less interested in being an onlooker in the continuing GUI-blinky, flashy, sparkly pissing contest with windows/mac osx, and rather interested in a desktop that i can adapt to my needs without having to go on an archaeological expedition into the innards of KDE 4. sorry about that.

    and, also, yes, i know about the KDE 3.5 repo for karmic — tried that, in fact, it mostly works, but with producing “cannot contact session manager” (no matter which session manager i tried) that was no longer usable either. really sorry. 

all content posted on these pages is an expression of my own mind. my employer is welcome to share these opinions but then again he might not want to.
September 1, 2009
filed mid-afternoon by dirk husemann in: from the grid,hacking,linux
technorati tags:
QR code for this entry · average time to read 2:04 minutes

a colleague of mine in japan contacted us asking whether our in-world collaboration tools could be extended to support japanese characters — he had tried our internal, public sametime 3d servers and had noticed that while in-world chat and instant messaging worked just fine, our flipcharts, brain storming boards, calendar, and voting tools did just display rather boring little rectangles :-(

not good. even worse when it means lost leads. so i set out to investigate. since OpenSim is being used in japan, it was a fair assumption that we might have a font problem here. this was confirmed by a twitter from adamfrisby:

@DrScofield so it should load fine.Only issue you need to be aware of is fonts – you need to use a font with the correct charset availible.

so, first port of call: how are we specifying the font to use for text rendering? digging through the OpenSim source i ended up in the VectorRenderModule:

    private void GDIDraw(string data, Graphics graph, char dataDelim)
    {
        Point startPoint = new Point(0, 0);
        Point endPoint = new Point(0, 0);
        Pen drawPen = new Pen(Color.Black, 7);
        string fontName = "Arial";
        float fontSize = 14;
        Font myFont = new Font(fontName, fontSize);
        SolidBrush myBrush = new SolidBrush(Color.Black);
        ...

gulp: we’ve got it hard coded :-(

so, next question: can we change it dynamically? looking through the code, it seems like we might:

    ...
    else if (nextLine.StartsWith("FontName"))
    {
        nextLine = nextLine.Remove(0, 8);
        fontName = nextLine.Trim();
        myFont = new Font(fontName, fontSize);
    }
    ...

except, hmph, there is no osSetFontName() OSSL function :-(

a couple of SMOPs later, we had osSetFontName() and could also configure the default font name in OpenSim.ini, good. now to figure out which linux font would do the trick.

i tried:1

  • Arial — no good: doesn’t have japanese script support
  • DejaVu Sans/Serif — again, no good, no japanese script support
  • Kochi Mincho — works!

— the configuration for that one is:

[VectorRender]
    font_name = "Kochi Mincho"

my next quest was to see whether i could find a font that would support the whole range: european scripts as well as japanese and also chinese.

…unfortunately, while windows users have Arial Unicode MS there is no such complete beast available to linux users — yes, there are fonts such as bitstream cybit, but their license conditions either don’t allow commercial use or only for a single user. so, if you are running under linux you need to localize your OpenSim installation via OpenSim.ini.

but! at least we figured out how to get japanese character sets supported in OpenSim on linux and can now configure one of our sametime 3d servers to support japanese OpenSim users properly! :-)


  1. lest you get the wrong impression: i know no japanese, instead i’m using google translate to produce suchs gems as “OpenSimは岩!”2 

  2. and hoping that the good folks at google don’t do a “Έχω τρεις όρχεις” on me… 

all content posted on these pages is an expression of my own mind. my employer is welcome to share these opinions but then again he might not want to.
August 25, 2009
filed in the late evening by dirk husemann in: hacking
technorati tags:
QR code for this entry · average time to read 1:41 minutes

for almost 10 days i’ve been the proud owner of a new mobile phone, the htc hero, an android and, thus, linux based mobile phone! over the past year or so i had become increasingly fed up with my apple ipod touch — yes, i had jail-broken it, yes, i had amarok synchronizing via ssh with it, but at what “speed!” ridiculous!1

when my trusted nokia n95 started acting up and started crying for power more and more often the writing on the wall was quite legible: “get a new phone” — so i did :-D

after a bit of research — the palm pre looked sexy but is not available on the continent for some time to come and also lacks the standard API set of the android platform — i settled on the android based htc hero.

copying music over, sync-ing those podcasts i love to listen to — it’s all just a matter of plugging in the USB data cable to the htc hero and my thinkpad, telling the hero to offer the SD card as a USB drive to linux and we are in business: gone are the hour long transfer times for those ARD radio tatort radioplays or the swiss SF TV dok vidcasts — it all happens in a flash now, sweet :-)

the only thing i was missing: vidcasts :-( turns out the hero can play those, but you need to – install the video player application via the android market, and – “hack” amarok’s config file so that amarok would be cool with sending .m4v vidcasts to the hero

for the latter you need to locate the line that reads

supportedFiletypes=mp3

in your .kde/share/config/amarokrc file and change it to read:

supportedFiletypes=mp3, m4v

voila! amarok will now transfer those vidcasts to the hero and the video player application will play them :-)


  1. don’t get me wrong: i like the user interface of the ipods and iphones. what i don’t get, though, is the early-1990s mindset of apple: a locked platform??? why on earth would you try to exclude customers from your platform? oh, never mind… 

all content posted on these pages is an expression of my own mind. my employer is welcome to share these opinions but then again he might not want to.
June 18, 2009
filed in the early evening by dirk husemann in: from the grid,hacking
technorati tags:
QR code for this entry · average time to read 0:25 minutes

for stress testing i needed to create 100 avatar accounts quickly. instead of going via opensim’s console i started ipython and entered the following python script:

import xmlrpclib
os = xmlrpclib.Server('http://127.0.0.1:9000/')
for i in range(100):
    os.admin_create_user(dict(password = 'SECRET', 
                              user_firstname = 'Bot%d' % i,
                              user_lastname = 'Dude', 
                              user_password = 'b0tb0tb0t', 
                              start_region_x = 1000, 
                              start_region_y = 1000, 
                              model = 'Bot Dude')) 

a couple of minutes later i had successfully created 100 avatar accounts, ”Bot0 Dude” to ”Bot99′, all wearing the same outfit as ”Bot Dude”, an avatar i had prepared earlier.

voila! avatar machine :-)

all content posted on these pages is an expression of my own mind. my employer is welcome to share these opinions but then again he might not want to.
June 4, 2009
filed mid-morning by dirk husemann in: hacking
QR code for this entry · average time to read 0:30 minutes

i’ve been a big fan of the syntax highlighter aka syntaxhighligher evolved wordpress plugin for quite a while now. after updating to the syntaxhighlighter evolved version, my code sections started looking funny, like this:

a = None
b = 1</p>

<p>if all((a, b)):
    print 'yes!'

instead of like this:

a = None
b = 1

if all((a, b)):
    print 'yes!'

the problem seemed to be that syntaxhighlighter’s shortcodes confuddled markdown (or markdown confuddled syntaxhighlighter?). this morning i realized that the solution might be actually quite simple: instead of not indenting, indent the code by 4 space (as you usually do with markdown to tag code sections, sigh) and all might be well…

…and it was. sigh. quite easy.

all content posted on these pages is an expression of my own mind. my employer is welcome to share these opinions but then again he might not want to.
filed in the early morning by dirk husemann in: from the grid,hacking
technorati tags:
QR code for this entry · average time to read 2:02 minutes

recently i was in need of being able to send inventory items (well, a whole folder full of stuff) to the inventory of a logged-in avatar.

just copying the the inventory items to the avatar inventory (for example, using Scene.GiveInventoryItem() or Scene.GiveInventoryFolder()) will not cause your avatar to notice that there is additional junk in her inventory all of a sudden — once the avatar is logged out and logs in again, she will find the stuff in her inventory. kicking the avatar out every time you want to send some inventory her way is a tad bad on the user experience side1. clearly not something we want to do.

after trying a 101 ways of sending inventory to the avatar and none of them catching, i finally remembered that avatars can give inventory to one another, even whole folders!2 taking my favorite tool to the OpenSim source tree3 i found code in the InventoryTransferModule that seemed to take care of this process. the first attempt of just sending a GridInstantMessage via the usual means was not producing the right result: the avatar would get the pop-up that a folder was being given to her and would she like to keep it? looked good but checking the inventory revealed it to be a big blue lie.

here’s what i finally figured out. you need:

  • a ScenePresence object representing the avatar
  • the UUID of the sending “avatar”
  • the name of the sending “avatar”
  • the InventoryNodeBase object (actually you would pass in a subclass such as InventoryItemBase or InventoryFolderBase or similar)

here’s the “pseudo-code”:


// pseudo code: send inventory content to a logged in avatar's
// inventory 
//
// avatar: ScenePresence object
// src: struct containing &quot;UUID&quot; and &quot;Name&quot; of the source &quot;avatar&quot;

// get the CachedUserInfo object for the target avatar
CachedUserInfo cuiAvatar = 
    m_commsManager.UserProfileCacheService.GetUserDetails(avatar,UUID);
if (!cuiAvatar.HasReceivedInventory) cuiAvatar.FetchInventory();

// target folder is the Clothing folder (type 5)
InventoryFolderImpl dstFolder = cuiAvatar.FindFolderForType(5);

// copy source folder from src avatar to dstFolder
copyFolder = scene.GiveInventoryFolder(avatar.UUID, src.UUID, 
                                       dstFolder.ID);

// content is in the target folder, ping target avatar and let her
// know about it: we do this through a GridInstantMessage

// GridInstantMessage: prepare bucket byte array first byte is asset
// type, remaining bytes are the UUID of the InventoryItem
byte[] idBytes = item.ID.GetBytes();
byte[] bucket = new byte[1 + idBytes.Length];

if (item is InventoryFolderBase)
    bucket[0] = (byte)AssetType.Folder;
else if (item is InventoryItemBase)
    bucket[0] = (byte)(item as e).AssetType;

Array.Copy(idBytes, 0, bucket, 1, idBytes.Length);

GridInstantMessage im = 
    new GridInstantMessage(scene, src.UUID, src.Name, avatar.UUID,  
                           (byte)InstantMessageDialog.InventoryOffered,
                           false, item.Name, item.ID,
                           Vector3.Zero, bucket);

// send bulk update inventory message and GridInstantMessage
avatar.ControllingClient.SendBulkUpdateInventory(item);
avatar.ControllingClient.SendInstantMessage(im);
[/c-sharp]

  1. though, i was reminded of windows’s tendency of asking you to reboot ever time you installed some piece of software…4 

  2. yes, i’m a bit dense sometimes…or…too focused! :-)  

  3. no, not that one. emacs’s M-x grep-find

  4. on second thoughts, that just proves the earlier point about this not being very user friendly… 

all content posted on these pages is an expression of my own mind. my employer is welcome to share these opinions but then again he might not want to.
May 24, 2009
filed in the early afternoon by dirk husemann in: hacking,void
technorati tags:
QR code for this entry · average time to read 0:48 minutes

while researching the german word “wallen” i bought the universalwörterbuch from duden, a respected and well-known dictionary publisher in german speaking countries. the download page offers a debian–ubuntu package of officebib, the underlying application for a series of dictionaries from duden and other publishers. running kubuntu i naturally chose that one to install — and it worked…

…it worked but in contrast to all other applications was using pixel fonts instead of truetype fonts, rendering all text rather ugly. today i did a bit of searching around whether other folks had encountered this issue and had perhaps found a way around it. eventually i came across a post on the {} blog (sic) which recommended not to use the .deb package but instead to one of the .rpm packages:

% sudo apt-get install fakeroot alien

will install the pre-requisites. then download the SuSE .rpm package and turn it into a debian package like so:

% fakeroot alien officebib-5.0.4-1-suse.rpm

and install it:

% dpkg -i officebib_5.0.4-2_i386.deb

voila! no more ugly fonts.

now, why doesn’t duden do this instead of providing a flawed .deb package? puzzled.

all content posted on these pages is an expression of my own mind. my employer is welcome to share these opinions but then again he might not want to.
May 11, 2009
filed just before lunchtime by dirk husemann in: from the grid,hacking
technorati tags:
QR code for this entry · average time to read 0:56 minutes

a couple of weeks ago i added the regioninfo REST call to OpenSim. here is a little python script that shows you how to use it:

#!/usr/bin/python
# -*- encoding: utf-8 -*-

import sys
import urllib2
import xml.etree.ElementTree as ET

def RegionInfo(url):
    if not url.endswith('/'):
        url = '%s/' % url
    regionInfoUri = '%sadmin/regioninfo/' % url
    print '== OpenSim server %s ==' % url

    riXml = ET.parse(urllib2.urlopen(regionInfoUri)).getroot()
    print 'regions (curr): %d' % int(riXml.attrib['number'])
    print 'regions (max):  %d' % int(riXml.attrib['max'])

    totalAvatars = 0
    totalObjects = 0

    for region in riXml:
        print '- region %-20s: avatars: %d' % (region.attrib['name'], int(region.attrib['avatars']))
        print '         %-20s  objects: %d' % (' ', int(region.attrib['objects']))

        totalAvatars += int(region.attrib['avatars'])
        totalObjects += int(region.attrib['objects'])

    print 'total avatars: %d' % totalAvatars
    print 'total objects: %d\n' % totalObjects


if __name__ == '__main__':
    for opensim in sys.argv[1:]:
        RegionInfo(opensim)

invoke it like this:

% osinfo http://opensim.zurich.ibm.com:9000

and you will get output similar to this:

== OpenSim server http://opensim.zurich.ibm.com:9000/ ==
regions (curr): 6
regions (max):  10
- region ST3D theatre        : avatars: 0
                               objects: 494
- region ST3D collaboration  : avatars: 0
                               objects: 283
- region ST3D boardroom      : avatars: 0
                               objects: 243
- region Zurich ISL          : avatars: 0
                               objects: 0
- region IBM ACVWS 2009      : avatars: 0
                               objects: 283
- region Sametime 3D         : avatars: 0
                               objects: 16
total avatars: 0
total objects: 1319

quite useful.

all content posted on these pages is an expression of my own mind. my employer is welcome to share these opinions but then again he might not want to.
« previous pagenext page »