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:

package com.varaneckas.utils;

import java.io.UnsupportedEncodingException;
import java.util.Enumeration;
import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;

/**
* UTF-8 friendly ResourceBundle support
*
* Utility that allows having multi-byte characters inside java .property files.
* It removes the need for Sun's native2ascii application, you can simply have
* UTF-8 encoded editable .property files.
*
* Use:
* ResourceBundle bundle = Utf8ResourceBundle.getBundle("bundle_name");
*
* @author Tomas Varaneckas <tomas.varaneckas@gmail.com>
*/
public abstract class Utf8ResourceBundle {

/**
* Gets the unicode friendly resource bundle
*
* @param baseName
* @see ResourceBundle#getBundle(String)
* @return Unicode friendly resource bundle
*/
public static final ResourceBundle getBundle(final String baseName) {
return createUtf8PropertyResourceBundle(
ResourceBundle.getBundle(baseName));
}

/**
* Creates unicode friendly {@link PropertyResourceBundle} if possible.
*
* @param bundle
* @return Unicode friendly property resource bundle
*/
private static ResourceBundle createUtf8PropertyResourceBundle(
final ResourceBundle bundle) {
if (!(bundle instanceof PropertyResourceBundle)) {
return bundle;
}
return new Utf8PropertyResourceBundle((PropertyResourceBundle) bundle);
}

/**
* Resource Bundle that does the hard work
*/
private static class Utf8PropertyResourceBundle extends ResourceBundle {

/**
* Bundle with unicode data
*/
private final PropertyResourceBundle bundle;

/**
* Initializing constructor
*
* @param bundle
*/
private Utf8PropertyResourceBundle(final PropertyResourceBundle bundle) {
this.bundle = bundle;
}

@Override
@SuppressWarnings("unchecked")
public Enumeration getKeys() {
return bundle.getKeys();
}

@Override
protected Object handleGetObject(final String key) {
final String value = bundle.getString(key);
if (value == null)
return null;
try {
return new String(value.getBytes("ISO-8859-1"), "UTF-8");
} catch (final UnsupportedEncodingException e) {
throw new RuntimeException("Encoding not supported", e);
}
}
}
}

2008-12-08

How to restore grub after Windows installation

There's nothing magical about it, you can easily Google it up, but I always forget the "find /boot/grub..." part and there are many other ways people explain this procedure, so I'm adding a screenshot as I'm doing it yet another time.

This is a best and easiest way to fix MBR after Windows f*ck it up.



In short:
1. boot from Ubuntu live CD (or any other live cd)
2. start a terminal
3.

sudo grub
find /boot/grub/stage1
root (hdX,Y)
setup (hdX)
quit


If you've got several drives you should check if your Windows partition is bootable and the other ones are not, otherwise if you install grub into linux partition, Windows will "fix" itself by changing bootable flag. To view and change bootable flags in Ubuntu Live go to System > Administration > Partition Editor (or run sudo gparted in terminal). The rest is illustrated below.






If grub loads but boot fails, it means grub detected your partitions incorrectly. Hit 'e' on linux entry, change the "root (hd1,0)" to "root (hd0,0)" or vice versa and press 'b' to attempt a modified boot. Repeat the "sudo grub" procedure when booted, but choose "setup (hdX)" target the oposite of your "root", i.e., if you did "root (hd1,0)", do "setup (hd0)" instead of "setup (hd1)". You should also edit /boot/grub/menu.lst afterwards and change all (hd0 to (hd1 and (hd1 to (hd0 to fix the boot menu.

Does all software have to suck?..