2009-01-28

Hawkscope on Mac. Finally.

Last week I have quit sleeping and did hell of a coding on Hawkscope. And there's a new version, with many significant changes and improvements. To name a few:

  • Works on Mac OS X! (Java 5, Tiger / Leopard)

  • Installer packages for Windows, Mac and Debian (Ubuntu).

  • Settings can finally be changed via Settings Window, like in most normal applications...

  • Speed! Especially noticeable when you have many network drives.

  • Check for updates. A new way to annoy the users!

  • Blacklist. Remove all the shit you don't want to see.



Download links:
hawkscope_0.4.0-1_i386.deb: Debian Package for i386 GTK Linux (Ubuntu)
hawkscope_0.4.0-1_amd64.deb: Debian Package for amd64 GTK Linux (Ubuntu)
Hawkscope-0.4.0.dmg: Mac OS X i386 Package (Tiger/Leopard)
hawkscope-0.4.0-installer.exe: Windows i386 Installer (XP/Vista)

2009-01-22

Hawkscope: Getting Better



Finally, I've managed to finish the SWT implementation of Hawkscope GUI. Along with some other minor fixes and improvements it ended up as a new Hawkscope version: 0.3.0.

A list of key points for this release:

  • Tray icon should work with Mac OS X (at least with 64-bit Leopard /w Java 6)

  • Hawkscope menu is more responsive and usable

  • Keyboard navigation through the menu is finally available

  • Each OS/Architecture has it's own build

  • Added -delay <milliseconds> startup parameter as a workaround for Java bug #6438179 that prevented Hawkscope from auto-starting in operating systems like Ubuntu. Read more in the User Guide

By the way, if you're on 64-bit Vista or 64-bit Leopard with Java 6 and you've got Maven in your hands, you could be helpful by providing the build for your OS. Thank You!

If Java is your cocaine, you are welcome to join the development - just contact me.

Download links for the new Hawkscope 0.3.0:

hawkscope-0.3.0-linux-gtk-32.jar - Linux GTK 32-bit Executable JAR
hawkscope-0.3.0-linux-gtk-64.jar - Linux GTK 64-bit Executable JAR
hawkscope-0.3.0-win-32.exe - Windows XP/Vista 32-bit Executable
hawkscope-0.3.0-win-32.jar - Windows XP/Vista 32-bit Executable JAR

2009-01-20

Dive into Java

Java Jump-start for experienced software developers. Another presentation I gave at work.

2009-01-06

Using Unicode in Java .property files

Using multi-byte characters in Java .property files? Forget the Sun's native2ascii application. Rather than doing the irritating conversions, create UTF-8 encoded .property files, edit them directly and use Utf8ResourceBundle to access them. The code:

  1. package com.varaneckas.utils;  
  2.   
  3. import java.io.UnsupportedEncodingException;  
  4. import java.util.Enumeration;  
  5. import java.util.PropertyResourceBundle;  
  6. import java.util.ResourceBundle;  
  7.   
  8. /** 
  9.  * UTF-8 friendly ResourceBundle support 
  10.  *  
  11.  * Utility that allows having multi-byte characters inside java .property files. 
  12.  * It removes the need for Sun's native2ascii application, you can simply have 
  13.  * UTF-8 encoded editable .property files. 
  14.  *  
  15.  * Use:  
  16.  * ResourceBundle bundle = Utf8ResourceBundle.getBundle("bundle_name"); 
  17.  *  
  18.  * @author Tomas Varaneckas <tomas.varaneckas@gmail.com> 
  19.  */  
  20. public abstract class Utf8ResourceBundle {  
  21.       
  22.     /** 
  23.      * Gets the unicode friendly resource bundle 
  24.      *  
  25.      * @param baseName 
  26.      * @see ResourceBundle#getBundle(String) 
  27.      * @return Unicode friendly resource bundle 
  28.      */  
  29.     public static final ResourceBundle getBundle(final String baseName) {  
  30.         return createUtf8PropertyResourceBundle(  
  31.                 ResourceBundle.getBundle(baseName));  
  32.     }  
  33.   
  34.     /** 
  35.      * Creates unicode friendly {@link PropertyResourceBundle} if possible. 
  36.      *  
  37.      * @param bundle  
  38.      * @return Unicode friendly property resource bundle 
  39.      */  
  40.     private static ResourceBundle createUtf8PropertyResourceBundle(  
  41.             final ResourceBundle bundle) {  
  42.         if (!(bundle instanceof PropertyResourceBundle)) {  
  43.             return bundle;  
  44.         }  
  45.         return new Utf8PropertyResourceBundle((PropertyResourceBundle) bundle);  
  46.     }  
  47.   
  48.     /** 
  49.      * Resource Bundle that does the hard work 
  50.      */  
  51.     private static class Utf8PropertyResourceBundle extends ResourceBundle {  
  52.   
  53.         /** 
  54.          * Bundle with unicode data 
  55.          */  
  56.         private final PropertyResourceBundle bundle;  
  57.   
  58.         /** 
  59.          * Initializing constructor 
  60.          *  
  61.          * @param bundle 
  62.          */  
  63.         private Utf8PropertyResourceBundle(final PropertyResourceBundle bundle) {  
  64.             this.bundle = bundle;  
  65.         }  
  66.   
  67.         @Override  
  68.         @SuppressWarnings("unchecked")  
  69.         public Enumeration getKeys() {  
  70.             return bundle.getKeys();  
  71.         }  
  72.   
  73.         @Override  
  74.         protected Object handleGetObject(final String key) {  
  75.             final String value = bundle.getString(key);  
  76.             if (value == null)  
  77.                 return null;  
  78.             try {  
  79.                 return new String(value.getBytes("ISO-8859-1"), "UTF-8");  
  80.             } catch (final UnsupportedEncodingException e) {  
  81.                 throw new RuntimeException("Encoding not supported", e);  
  82.             }  
  83.         }  
  84.     }  
  85. }