Fulltext in Python

Got request to include some fulltext search to application written in Python. Using wrapper around Lucene emerged as impractical - requires to install Lucene and two intermediate layers, patching one of them on the way.

Luckily my colleague told me about Whoosh - fulltext engine written in pure Python. Although in alpha stage of development, it's usable. I hit some bugs but the workarounds were simple.


WOLips Working

I've managed to get WOLips working last month. Finally. There are some visual problems with lines drawn during drag and drop. Also EO model for Derby is not working - I've tried and ended using PostgreSQL. The worst was when during work the model got damaged and I had to redo several classes :(. But I can see the light at the end of the tunnel.


Eclipse 3.5 - Galileo

First Encounter

  • new, more useful and prettier welcome screen
  • some extensions working that had problems in current 3.4
bugs and strange things
  • "what's new" link on welcome screen does not work
  • there is no update site set after instalation butafter installation of first extension (subclipse) the updates started to work
  • new cogwheel icon in task bar (or window list) is quite undistinguishable


The good news are, that the my favourite extensions all seem to work. Here is a short list of succesfully installed plugins, these with asterisk I've not yet tested too much:
  • subclipse
    - on project page there is already information that it works with 3.5
  • android
    - works terribly in 3.3, not installable in latest 3.4
  • wolips*
  • ocaide*
  • pydev


Java Best IDE is ...

Java developers frequently discuss about what IDE is BoB (best-of-breed). Well, I don't think it's possible to choose one, to be honest.

Eclipse is feature-rich but the GUI in som areas is horrible and it tends to brake up with updates, also support for amd64 linux was missing for some time. It has support for Android, it has Wolips and much more. There are also project for non-Java developers like PyDev, although this one lacks the comfort and power of Java toolset.

Intellij Idea has best productivity for the things it supports. The set of supported refactorings and some other tools make development a joy. Some plugins tend to throw exceptions but IDE is usually not affected. Great GUI. Does not support so wide scale of technologies as Eclipse but it's worth the money. JetBrains has to be customer oriented to stay in business ans they do they job well.

Netbeans I know not so much. I like its support for JSF. I think in version 6.5 it really started to be usefull. I hope Orcale won't toss it up trying to force people to JDeveloper.

Conclusion - I use the IDE on wihich I can do the job best. Sometimes its Eclipse with Idea for refacoring, sometimes it's only Eclipse or only Idea - if both support the desired technology well, I use Idea.


Java and Spring - Property Editor for InetAddress

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.regex.Pattern;

* Custom property editor for java.netInetAddress class
* Author: Rostislav Matl
* Date: Feb-2009
public class InetAddressEditor extends PropertyEditorSupport
private static Pattern ipv4 =
Pattern.compile( "(([01][0-9][0-9]|2[0-4][0-9]|25[0-5])\\.)

private static Pattern ipv6 =
Pattern.compile( "([0-9a-fA-F]{4}:){7}[0-9a-fA-F]{4}" );

/** Converts String IP address to InetAddress object.
* @param textValue "" e.g.
public void setAsText (String textValue)
InetAddress address = null;

// IPv4 address
if ( ipv4.matcher(textValue).matches() )
String[] addressParts = textValue.split("\\.");
assert addressParts.length == 4;

byte[] addressBytes = new byte[addressParts.length];
for (int i=0; i<addressParts.length; i++)
addressBytes[i] = (byte)Short.parseShort( addressParts[i] );

address = InetAddress.getByAddress(addressBytes);
// IPv6 address
else if ( ipv6.matcher(textValue).matches() )
String[] addressParts = textValue.split(":");
assert addressParts.length == 8;

byte[] addressBytes = new byte[addressParts.length*2];
for (int i=0; i<addressParts.length; i++)
addressBytes[i*2] = Byte.parseByte( addressParts[i].substring(0,2) );
addressBytes[i*2+1] = Byte.parseByte( addressParts[i].substring(2,4) );

address = InetAddress.getByAddress(addressBytes);
// host name
address = InetAddress.getByName(textValue);
catch (UnknownHostException ex)
throw new IllegalArgumentException(ex);


/** Get text representation of the value.
* @return InetAddress text.
public String getAsText()
return ((InetAddress) getValue()).getHostAddress();

Excerpt from Spring config file with example of usage:

<bean class="org.springframework.beans.factory.config.CustomEditorConfigurer">
<property name="customEditors">
<entry key="java.net.InetAddress">
<bean id="inetAddressEditor" class="net.bithill.InetAddressEditor" />

<bean id="mpingData" class="net.bithill.mping.MPingData">

<property name="hosts">
<list value-type="java.net.InetAddress">