Monday, 13 December 2010

Ugly Opera Fonts Under Linux - How To Fix It

The latest incarnation of the Opera Browser, version 11 is currently in Beta (at time of writing) and so far I have been really impressed with it. I may finally have found an alternative to the excellent, but increasingly sluggish FireFox. However, despite it's speed, overall elegant looks and ease of use the first thing I noticed upon installing it was how ugly most of the fonts looked (something that had previously been fine in earlier 10 releases) and no matter how much tweaking I made to my .fonts.conf file I couldn't improve things. I then discovered that during the 10.x cycle Opera switched from using .fonts.conf to xrdb. Adding the following into the .Xdefaults file in my home directory and re-starting X solved the problem and now the fonts look great again :

Xft.antialias: 1
Xft.autohint: 1
Xft.hinting: 1
Xft.hintstyle: hintslight
Xft.rgba: none


If you find after doing the above the fonts still look ugly, it may be that .Xdefaults on your system is not being read or honored. So, add xrdb -override .Xdefaults to your .bashrc script and try again! As you can see from the screen shots below - the fonts look much better after the config change.



Friday, 12 November 2010

Bye, bye Metal

My IDE of choice is NetBeans and my development platform, Mandriva Linux with a KDE desktop. During my time as a Java developer I have always run NetBeans (and Java Desktop applications in general) using the default Metal look and feel having found the GTK laf unusable on my KDE desktop; the fonts, tabs and menus look awful. So, when I learnt about a new look and feel called Nimbus that was to be introduced with JDK 6 u10 I was eager to try it out. However, my enthusiasm soon turned to disappointment when I discovered similar rendering problems I had found with the GTK laf, so, back to Metal I went.... Until a few days ago when, with my system on the latest updates of JDK 6 and NetBeans I decided to try it again. This time I was pleasantly surprised - it looked fabulous! The fonts, tabs, menu - all rendering perfectly. All of a sudden NetBeans looked less flat and more polished.



It was a shame to read in a recent post that Oracle has decided to keep Metal as the default laf for JDK 7 rather than switching to Nimbus. But for me, I think I will be making a permanent switch to Nimbus. Bye, Bye metal. You did a good job but now it's time to go...

Wednesday, 17 February 2010

Parsing SharePoint Metadata

The SharePoint Document libraries hold a lot of metadata against each document which is returned in the web services in the ows_MetaInfo field. This is a long string of metadata which, in the GetListItemChanges method is broken up into lines making it easy to pick out each key and value pair. However, the GetListItem methods returns this metadata as a plain string leaving it up to you to parse and turn in to something meaningful. After much head scratching and memory refreshing on regular expressions I have come up with a snippet of code that, for all my testing so far, successfully pulls out each key and value pair :

Pattern pattern = Pattern.compile("(\\w*):\\w{2}\\|");
Matcher matcher = pattern.matcher(ows_MetaInfo);

boolean fnd = matcher.find();

while (fnd)
{
    String key = matcher.group(1).trim();

    int start = matcher.end();

    fnd = matcher.find();

    int end = fnd ? matcher.start() -1 : ows_MetaInfo.length();

    String val = ows_MetaInfo.substring(start, end);

    if (val.length() > 0) 
    {
        System.out.println("Key: " + key + " - Val: " + val);
    } 
}