Ramblings of a techie

Archive for May, 2005

When you have ever worked with Lucene you know that, to index your documents, you have to convert your documents to text. This text is used by Lucene to create the index for the document.For most formats there are convertors which are either written in Java or native. The problem is that you need to write indexing classes for a lot of different documents; you have to use a lot of different libraries and you have have to make sure your deployment machine contains those libraries…

OpenOffice is capable of opening most productivity tool formats and even more formats are in the making as we speak. Opening Word, Excel, Powerpoint, Access, dBase, WordPerfect, all StarOffice and OpenOffice formats, Lotus 1-2-3, HTML, XML and much more are no problem for the latest version of OpenOffice.

Now only to get a document converted for indexing with Lucene. This is extremely trivial. I assume you have installed OpenOffice 1.9+ Beta.

Open Writer

Goto Tools -> Macros -> Organize Macros

Click on the Libraries tab

Select ‘My Dialogs & Dialogs’

Click on New

Type ‘MyLibraries’

Click on ‘Modules’

Click on ‘MyLibraries’

Click on New

Type ‘Conversion’

Select ‘Conversion’

Click on Edit

Copy/paste the following code into the editor:

Sub ConvertWordToTxt( cFile ) cURL = ConvertToURL( cFile )

‘ Open the document. ‘ Just blindly assume that the document is of a type that OOo will ‘ correctly recognize and open — without specifying an import filter. oDoc = StarDesktop.loadComponentFromURL( cURL, “_blank”, 0, Array(_ MakePropertyValue( “Hidden”, True ),_ ) )

Meaning that john can read and write the entire repository so far. You can add more users if you want ofcourse; read the SVN book to see the syntax.

Start Apache:

/etc/init.d/httpd start

To make sure it starts at the start of the OS:

chkconfig httpd on

Now it should work; make sure you have the firewall open for Apache port 80, if you do not know or have this yet, type;

system-config-securitylevel

and set Apache to the list of allowed services.

From another computer, try;

http://your.ip/svn/

This should ask your for a name and password; this is the aforementioned and created user ‘john’.

If you enter the user and it does not work, look in the /var/log/httpd/error.log file for clues. If there is something wrong with permissions, you problably mounted the repository on another drive and have SELinux security on. To fix this, either turn SELinux off or give the repository the right credentials (Google this).

[TODO: howto switch on SSL for this service]

How I made the search I will put somewhere here later, because it appeared my network card was broken and network switched off automatically after 30 minutes of use on the system.

As I am currently building a cross platform file-manager for our document management tool in Java, I am in need for a way to have files executed by the Windows (and other OSes, but for most clients; Windows) shell as they would be executed when clicking on them in the Windows file explorer.

Doing this in Java is quite easy and a lot of people already figured that out, you simply use the rundll32 command to execute the following:

rundll32 url.dll,FileProtocolHandler URL

where URL can be something on internet or on your local drive. Say you want to ‘run’ a .txt file on your c: drive:

rundll32 url.dll,FileProtocolHandler file:///mytextfile.txt

opens, on my system with notepad.

The problem with this method is, that if there is no handler, nothing will happen…

After playing around a bit with the registry I found the following;

reg query HKCR.ext

gives you information about the extension and what Windows will do with it.

In general, as I have discovered (correct me if I am wrong please!), if is in the result, the file can and will be executed by Windows. You can even use it to extract the file type. Example:

C:>reg query HKCR.dot

! REG.EXE VERSION 3.0

HKEY_CLASSES_ROOT.dot<NO NAME> REG_SZ OpenOffice.org.dot

HKEY_CLASSES_ROOT.dotPersistentHandler

So the code for running a file with the default associated application under Windows would be:

I recently got to pick new notebook at my work to program Java on; because I like gadgets and because I have been wanting to test out those nice 64 bit processors for a long time already, I pick the Acer Ferrari. The Ferrari logo is a bit of shame (not enough money to buy the car, but still have a Ferrari is kinda sad). The red colour is nice though, and the system is thin and not too heavy.

Windows 64 bit is too new and not included. And why would I want to use Windows anyway?Lazy as I am, I did not check if any Linux would run on it. I just assumed it would. After a bit of websearching I decided to try some distributions: Ubuntu 64 bit, Knoppix 64 bit and, last but not least Fedora Core 3 64 bit.

FC3 was the only Linux which installed nicely and detected almost everything. Be sure to start the install with “linux nofb”, otherwise you’ll see a very black screen during the install. The install will go flawless.

To use the wireless lan which is integrated under a 64 bit system, you’ll need the 64 bit Windows driver for this Broadcom chipset. You can pick up the driver here; http://ubuntuforums.org/attachment.php?attachmentid=186Then you should install ndiswrapper (http://ndiswrapper.sourceforge.net). Getting it to work is trivial;

now you should see a list of detected networks; if not, something is wrong.

If your computer hangs after the modprobe command, you probably have more than 1 gb of memory and not the latest version of ndiswrapper. I fixed the ndiswrapper together with the guys maintaining the wrapper (long live Open Source!); it took 1 day to figure out what it was and fix the bug (https://sourceforge.net/tracker/?func=detail&atid=604450&aid=1169978&group_id=93482).

After the wireless station is detected, you should make the network work;

ifconfig wlan0 some_ip uproute add default gw some_gw up

When using WEP or other encryption, some more steps are required (Google for iwlist, iwconfig etc).

I work happily with a 64 bit Linux system now, but I still have one problem; the battery overview is incorrect. I use FC3 with KDE and the default notebook app which shows battery status, but the status is actually wrong. If anyone has a fix, please comment on this post!