Thursday 3 December 2009

Linux desktop adventures: Trying out Loxomo - 'Password Safe V3 compatible Password Vault'

I've been using Password Safe for a while, but my new workplace uses
Linux desktops (fedora 11), so I've found this compatible substitute,
as Password Safe is Windows-only.

http://www.christoph-sommer.de/loxodo/

But first, I had to install wxWidgets, which was easy enough:

sudo yum install wxWidgets

then another 9.5Mb installation later, created a launcher for the app,
pointed to the loxomo.py file, then voila.

The interface seems a bit limited, and you don't have options like
changing the encryption method or the rules it uses for password
generation but it's functional enough. I'll see how it goes in the
next few days.

Friday 20 November 2009

Linux app install FAIL - TrueCrypt Suse RPM on Fedora 11

Trying to install truecrypt Suse RPM on Fedora 11, as I don't want to
waste my time compiling source. Ironic, cos I end up wasting time
trying to install dependencies anyway!


1. Failed after install attempt. Missing dependencies.

Do you accept and agree to be bound by the license terms? (yes/no): yes

Running package installer...
error: Failed dependencies:
libfuse2 is needed by truecrypt-6.3-0.i586
xorg-x11-libSM is needed by true


2. Hmmm.. okay, try and get dependencies:

sudo yum install libfuse2
Loaded plugins: refresh-packagekit
Setting up Install Process
No package libfuse2 available.
Nothing to do

3. SHIT! I give up.

Friday 30 October 2009

Monitor SOAP traffic with tcpdump, a crude alternative to TcpMon if you're really desperate

I've started working with SOAP again, using Axis2, and I've been
trying to use the TcpMon application to monitor XML traffic to and
from webservices. However, it performs like shit, and I'm not sure if
it's because of the app or because my machine only has 1Gb.

Anyway, I looked for something more lightweight, and came across a
blog post for tcpdump.

http://mdzyuba.blogspot.com/2008/02/how-to-debug-soap-on-mac-with-tcpdump.html

So to monitor the Axis2 webapp running on Tomcat at port 8080, I type
in this as root (or use sudo! i know i know..)

/usr/sbin/tcpdump -i lo -A -s 8080 -l 'dst host localhost and port
8080' | tee dump.log

this creates a file called dump.log which contains the packets going
over the loopback interface on port 8080


I wouldn't want to do it very often, but in a pinch, it works, and
doesnt take over my machine.

Of course, you'd only want to do it on a machine where *you* control
what requests come in. On a production box the best you can do is
create a log and process it later to find what you want. No humanly
way of eyeballing the logs in real-time in that scenario. =)

Wednesday 16 September 2009

Recruiters aren't very smart, are they: #1938743982749 in a long series

Why is it that unless you explicitly point out that "I have attached
my resume to this email", a recruiter will not be able to notice the
resume attached, and will instead reply asking you to send in your
resume?

Sunday 6 September 2009

Safari annoyance: not remembering page history for tabs

This is a common situation for users like me who always have a lot of tabs open:

For one reason or another, you find yourself having to restart Safari.
Maybe AdBlock has updated its adserver list, or you find that Safari's
consuming too much memory and needs a kick in the bum. Whatever. The
nasty nasty thing about this is that you'll now have to work at making
sure all the tabs in all the windows you currently have open are
saved. The usual thing I've done in Safari is to create a bookmark for
each window containing all the tabs I have. Or if I only have one
window open, I just close it and then select "History" then "Reopen
All Windows From Last Session".

So fine, you reopen Safari, but then find yourself going at a
particular tab, "I'd like to go back to the page I was looking at
before I got to this one." But no, you can't! The Back button is
greyed out. I suppose you could look at the History menu and try to
find it there, but the problem is that in History, they are all just
grouped according to the time the site was opened, without any regard
for the particular tab you were on. When you restart Safari, you are
unable to trace the "route" you took to get to a particular page in a
tab.

This is not the case with Firefox and Opera. Now given that they *all*
use internal databases to retain info about the pages they've gone
through, I'd have thought Safari should be able to work similarly to
the other browsers. The question is: does Apple really give a shit?
For some unknown reason, I've actually started using Safari as my
default browser, despite the appeal of having umpteen zillion plugins
available in Firefox. It turns out that that having just the AdBlock
plugin is quite good enough for my normal usage patterns.

Monday 24 August 2009

General rant on the HP NC6400. Oh, and "Tap To Click" on trackpads suck.

(this was in my Drafts folder, and I don't remember if I have anything
to add to it, so I'll just post it)

I've started bringing the work laptop home and trying to do - uh -
stuff in it. Its a Hewlett Packard HP NC6400, with CoreDuo CPU, 2Gb
RAM, 80Gb hard drive.

A few comments about it:

* The keyboard's not too awful, though I find the keys a bit slippery,
as if coated with Teflon. And yes, it does what it should, but it
still feels and looks cheap.

* It's got a blue "nipple" pointer controller between the G, H and B
keys. It's there, it's weird, and it's staying unused. Never liked it,
and never will.

* The button to turn of the wireless card had me stumped for a few
days, since I had turned it off and forgot what the button was for.
Then I spent an entire weekend trying to figure out why the Windows
system tray icon for the Wireless Network Connection wasn't detecting
any Wi-Fi networks! I didn't get it - this was a new laptop that I
took home the week before, and it detected mine and my neighbours'
networks. It was only when I got back to work that I realised what was
going on: no blue light on the button, no WiFi. A shame that they
didn't have small labels in addition to the button icon, just to make
things clearer.

Having had a Powerbook as my first laptop, I was used to having the
Airport icon in OS X as my main interface to WiFi. Apple laptops don't
have a button for Wi Fi. Actually, they don't have *any* buttons,
aside from the Power button. Okay, there's the Eject CD/DVD button on
the top right, but that's integrated into the keyboard layout.

<#include: usual fanboi rave about how Apple design is elegant,
uncluttered and all that.>

<#include: While mostly true for the hardware design (except that
Super Mouse.."oh, it's got 2 buttons, but we don't actually show it to
you. we like to unclutter it and keep you guessing". fktards.)>

<#digress-heavily: as for OS X... boy, the Finder is such a pitiful
excuse for a file manager. And why the hell is it so difficult to move
a bloody file? Why do I have to copy and *then* delete?>

* The screen is too dim. fn+F9 and fn+10 *look* like they're meant to
control screen brightness but don't have any effect. And coming from a
17" Powerbook, the 14" screen is taking some getting used to. No way
can you have more than one app displayed at a time.

* And then there's the trackpad. By default, two taps in close
succession are treated as a double click. This behaviour has caused me
no small amount of grief.

Saturday 15 August 2009

Dickhead recruiter conversation #1

Recruiter: So when did you finish work?

Me: End of May, it's in the resume I sent you.

Recruiter: So you've been out of work for FIVE MONTHS!

Me: That's just a bit over two months. (you moron)

Recruiter: And what have you been doing since then?

Me: I've been looking for work. That's why I'm contacting you. (NOOO, i've been working on my tan in the French Riviera - what the hell do you think?)

and the clincher:

Recruiter: Your resume looks pretty good. So why haven't you found a job yet?

(At which point I found myself promising to disembowel him at the first chance I got.)

Friday 7 August 2009

When it rains.... (job hunting chronicles continued)

Had a bit of a productive week in job hunting! I've had a break in active job hunting for the previous 2 weeks because I was studying for my Java certification exam. Got 70%, (65% was the pass score) so my hard work paid off.

Today, did an interview with a recruiter for a contract role with my old company, but in another division. The project, which is just in
the initial stages, post-design, is to build a workflow system to handle news reports so they go to the website and to the print systems at the same time. Funny enough, another part of the organisation already has something like this in place, so why they don't just build on it, I don't know. Possibly a NIH (not invented here) attitude? Anyway, as long as I get paid. LOL. Interview went well, and recruiter said he'll contact the manager and check if they want my resume sent forward. The other funny thing about this is that a friend just rang me last week and said he's already working there! Fun times if I get in, though it'll be such a bitch having to walk 20 minutes from the train station. Apparently there are buses but they are infrequent.

Around lunchtime, got a call from a recruiter I've been dealing with for about 2 months now, but still no interviews from her. She finally tells me the name of the company she sent my resume to, and it's quite a big one. Makes annoying software that I really haven't installed or used in about 10 years. Antivirus crap that fucks up your system, causes unknown or untraceable problems, resource f*ing hog.

They used to make really cool system utilities back in the DOS days, but their main product now is seen by a lot of people as a total pain in the ass, and one to avoid. But, they've got market share, and people still pay for their stuff. They must be doing something right. Anyway, the recruiter says she'll send me a set of questions to work on during the weekend. Insists that I get it in by Monday, even though earlier in the conversation she says I can work on it at my own pace. Then why the fuck does she say I must hand it in by 4pm Monday, even though I asked if I could just hand it in on Tuesday. What part of "at your own pace" don't you understand, you saucy minx/btch? (she looks fit, reminds me of Riot Becki when her glasses are on, so I still keep in touch)

Then in the afternoon, it was with a more recent former employer. This time, the role is to work on the ad-serving system for the entire media network, which comprised of quite a number of sites. Back to working with my old friend SQL Server! (much nicer than MySQL, at least) It's a humongous task, and I was a bit shocked that at the moment, there are only two developers working on this system. For a system that is used by more than a dozen websites, you'd think it would have a bit more resources devoted to it. Anyway, interesting work, looks painful, exciting, not really that sexy (and everyone hates you so they just AdBlock what you create), but it's a definite money-spinner, so it's on the radar of people who matter, like that old guy who used to be Australian but is now American. Couldn't help noticing that the interviewer kinda gave of vibes of the under-appreciated. Twice he mentioned that "this is the part of the company that never gets mentioned in emails sent to the staff".

Opened my Gmail. Oooh, that really shit hot software house that makes "developer tools that you actually use" have sent me a problem assignment to work on. Yay, my resume didn't get knocked back! I was starting to get worried. I'll have to ace this because this company is pretty much #1 on my wishlist. I've so drunk their kool-aid already.

Then in another email I see the set of questions mentioned by the recruiter. Hmm... can I read .docx files? Oh, good, TextEdit can open them. I start reading and it's nearly as vile as their software. Some of it is bullshit - "name all the Software Methodologies you've worked with." WTF? - some are more reflective of the stuff I might end up working on - "how can you implement a licensing system that does bla bla bla..." and "Provide a high-level system architecture that protects against piracy and misuse." WTF? This is a developer role, right? I'm having my doubts about this company already. I don't really want to work for a company that I can't be proud of. And it's in North Sydney! But then, the company is a big one, and might send me in another direction, career-wise. But all software should be free, right? Hahahhaha...

On Monday, I have a 2nd interview with world-famous software consulting firm. Mainly world-famous because of their chief scientist who wrote a great book about 10 (?) years ago, but I'm not really sure what he does now. This company is #2 on my wishlist, but I'm not really sure if they're as fun as #1. I guess that's why they're #2, hahah. Anyway, it's got these super geeky, quite top notch people, allegedly, and friend of a friend who works there always raves about the company. Maybe it's good. I've invested quite a bit of time already with them - first the phone interview (which was really casual and fun), then stage 2 was the programming problem (killed me for a few days, but got it in, though they didn't get back to me til a month
later), and now stage 3 is a battery of tests and an interview (3 hours in total). I'll have to do some studying on the weekend, just so I don't embarrass myself and look like a dill. Good thing is that it's casually attired.. not a lot of interviews in jeans so far; this'll be my first.

Something's gotta come out of all this!!

Sunday 21 June 2009

Formatting a hard drive > 32Gb in FAT32

It shits me no end, to think that even now, FAT32 is the best that we
have, in terms of a near-universal file system. FAT32 is good enough,
except for those cases where you have >4Gb files. This will probably
happen more often, now that Virtual Machines are becoming more normal,
and people are dealing with BlueRay extracted media files and DVD ISO
files.

I got a new LG 500Gb portable drive, and now have to format it for use
with my WD TV HD Media Player. It's formatted NTFS by default, but I
have a Mac, so I can't write to the damn thin without installing
something like NTFS-3G, which *should* be stable enough these days,
but I've no experience with it, so I'll do more research before going
NTFS on my external drives. I'll just keep my virtual machines on my
local drive for now. (they're going to be faster that way anyway)

For large drives, previously I've had to go through crap like creating
a small partition because Windows format command only supports drives
up to 32Gb for FAT32, formatting in FAT32, and then expanding the
partition using PartitionMagic.

Someone has written a free utility to format a large drive quickly in
FAT32. Incredible speed - formatted my 500Gb drive in seconds!

http://www.crapcontrol.com/content.php?article.14

Doing our bit to stimulate the economy... buy buy buy!

What an expensive week this has been.

What have we bought?

1. Media Player and
2. 2.5" HDD - Bought this online on Tuesday from mwave.com.au. They
had a sale on the Western Digital WD TV HD Media Player, at around
$175. And I also got an LG 500Gb 2.5" portable hard drive, at $140.
Went to the Mwave offices in Lidcombe (it's local!) to pick it up. The
place is pretty much a warehouse, with a small room for a "public
shopfront". It's not really a retail outlet, since there's no items
there to look at and buy directly. Finally I'll be able to watch the
backlog of DivX files I've had over the past 2 years, and clear out
space on my main computer (only 4Gb available!).

3. Netbook - OMG, the perils of getting a redundancy, having $$$ in
the bank, and being at home browsing those "one bargain a day" sites.
At catchoftheday.com.au on Thursday they had a sale on the ASUS EEE
1000HE laptop, which is a new model with Atom N280 1.6Ghz, 1Gb RAM,
160Gb HDD, Wireless-N, Bluetooth, 10" screen, 92% size keyboard. Very
very nice. Couldn't resist a bargain at $619 (after $40 discount if
you used Paypal)! Current retail is around (according to Shopbot)
"Price range: $669.00 to $934.95 at 55 stores". So I got it, thinking
if it doesn't work out between us - I fear the small screen could be a
problem when working with an IDE - I can always sell it *and make a
profit*, but still way below retail prices!

4. Lanwmower - our GMC lawnmower carked it about a month ago, so got
ourselves to Bunnings on Friday and bought a Flymo lawnmower. I think
it's by Husqvarna, since that's the name on one of the stickers on the
box. Or maybe they're the importers? Anyway, it looks quite
"Scandinavian".. my son said "Big Red Car" when I carried the box
inside. My brother says it looks like a race car. It's the kind of
lawn mower that'd fit in at IKEA, if they sold em there. Was thinking
of getting this other, much smaller lawnmower also from Flymo, but
this was different because it was like *a hovercraft lawn mower*! It
floated on a bed of air, and cut the grass, but didn't have a
container for storing the clippings. I guess the clippings just stayed
on the ground and you had to rake it. Which means I'd have to get a
rake, and do more work? No thanks. Someday, I *will* get a
hovercraft-something. Hovercraft food processor? Hovercraft vegetable
slicing julienne tool. Yeah, someday, my hovacraft will come, boiee..

5. Steam Iron - Also on Friday, we got the Philips GC4420 steam iron
from Good Guys for $95, to replace our steam iron which I stupidly
dunked in a pail of water. People - *never* iron your clothes in the
bathroom. Stupid ironing board had a board cover that was oversize,
and covered that metal tray on the right side where you place the
iron. Anyway, I placed it there, but on its rear, so it was unstable
and fell in the bucket of water. And - this is what I moron you get
when you're sleep-deprived - I almost put my hand in the water to
retrieve the iron! All while it was plugged in to the outlet. Good
thing I stopped and thought, "Yeah, I should probably turn off the
power outlet first!" By which time the safety switch kicked in anyway
and all the electricity in the house turned off. So got on the forums
- thanks whirlpool.net.au forums - and word on the street is that
Tefal and Philips are the brands to go for. Also learned about this
extremely expensive - but allegedly excellent - brand called
LauraStar. Holy shit, their "systems" can cost up to $1400!! The irons
themselves are selling for $500+, after heavy discounting already. I
don't wanna know the "normal" price. Anyway, another brand name I can
fake and claim that I own, just like Lexus, Miele, Dyson and Apple.
Oh, I do have the latter two. Anyway, it has auto-stop (so it turns
off if you accidentally forget it lying around) and anti-calc system
(so you don't get that yucky particulate flakes coming out of the
steamer when you iron, thereby fucking up your just ironed clothes),
which are the most important features for me. Also had to be light,
since my mother-in-law does an unfair majority of the ironing around
here, so that kicked the GC 4630 out of the running (that had the
Ionic Steam feature). And this model also has Steam boost, so giving
out 100g instead of 40g of steam. Awesome.

6. Running shoes - Friday too, wife and I bought new running shoes at
Paul's Warehouse, Homebush. The bargains are not that extreme as the
ads make it out to be. Tons of stuff were selling for $100+ anyway.
How the fuck can they justify these prices for running shoes? It's not
like they now have cpus and memory foam and teflon. My old ones are 4
yrs old anyway, and looking ratty, so was a good time to get. Total
cost - $170.

All through the week I've been checking out deals on the iPhone
(unlimited broadband for $50 on Optus... please please) and the Nokia
E63 on 3 ($29/mo for 12 mos.. wow). Must forget all this and realise
I've survived this far without this anyway.

Okay, economy, get better!! I just paid you to do so. =)

Wednesday 17 June 2009

500 Days of Summer - International Trailer

I've just fallen for Zooey Deschanel. Who wouldn't?

I'm really looking forward to this film! :) Nothing's made me feel like this in a while.

Tuesday 16 June 2009

Rapid SVN for OSX - doesn't work at all

RapidSVN 0.9.8 for OSX doesn't work at all. Running on OSX 10.5.7 and can't even run it. What a piece of shit.

Friday 12 June 2009

Removing .svn directories and getting "Operation not permitted" on OSX

I had some code that I'd checked out, but now wanted to check back
into another repository. The cleaner way to do this would have been to
export the directories I wanted, so that .svn directories didn't get
created. But I no longer had access to the original repositories, so I
have to remove the .svn directories recursively.

And I found this bit of shell scripting would work on OSX (currently
on 10.5.7) after moving to the top of the directory tree where i
wanted to delete .svn:

find . -name .svn -exec rm -rf {} \;

Source: http://codesnippets.joyent.com/posts/show/104

most of the time.

Except when I would get "Operation not permitted" with some directory
trees. Turns out these files under .svn had the immutable flag set on
them, and we have to use the 'chflags' command with the 'nouchg' to
remove the immutable flag.


chflags -R nouchg [name of directory containing .svn directories]


eg: chflags -R nouchg MyProject/


Source: http://www.osxfaq.com/tutorials/learningcenter/AdvancedUnix/ugp2/page2.ws

Yay!

Tuesday 12 May 2009

Spring FAIL - incomplete documentation on JibxMarshaller from spring-oxm library

This issue is prevalent in a lot of open source projects: inadequate
documentation and non-existent examples.

<bean id="jibxMarshaller"
class="org.springframework.oxm.jibx.JibxMarshaller">
<property name="targetClass" value="au.com.company.JOB"/>
<property name="indent" value="4" />
<property name="bindingName" value="jibx_binding" />
</bean>


The javadoc for setBindingName() in JibxMarshaller simply says:

/** Sets the optional binding name for this instance. */

There is no indication what it actually means - is the bindingName the
same as the binding file? Should I be indicating the location of the
file??

I try this:

<property name="bindingName" value="classpath:jibx-binding.xml" />

and I get

Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'jibxMarshaller' defined in class path
resource [batchContext.xml]: Invocation of init method failed; nested
exception is org.springframework.oxm.jibx.JibxSystemException: Binding
'classpath:jibx-binding.xml' not found for class
au.com.careerone.xmlbinding.adicio.JOB; nested exception is
org.jibx.runtime.JiBXException: Binding 'classpath:jibx-binding.xml'
not found for class au.com.careerone.xmlbinding.adicio.JOB
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1337)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:269)
... 32 more
Caused by: org.springframework.oxm.jibx.JibxSystemException: Binding
'classpath:jibx-binding.xml' not found for class
au.com.careerone.xmlbinding.adicio.JOB; nested exception is
org.jibx.runtime.JiBXException: Binding 'classpath:jibx-binding.xml'
not found for class au.com.careerone.xmlbinding.adicio.JOB
at org.springframework.oxm.jibx.JibxMarshaller.afterPropertiesSet(JibxMarshaller.java:137)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1368)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)
... 42 more
Caused by: org.jibx.runtime.JiBXException: Binding
'classpath:jibx-binding.xml' not found for class
au.com.careerone.xmlbinding.adicio.JOB
at org.jibx.runtime.BindingDirectory.getFactory(BindingDirectory.java:180)
at org.jibx.runtime.BindingDirectory.getFactory(BindingDirectory.java:197)
at org.springframework.oxm.jibx.JibxMarshaller.afterPropertiesSet(JibxMarshaller.java:130)
... 44 more


I then tried putting in the mapping name, even though it doesn't
really make much sense:


<property name="bindingName" value="JOB" />

Still no dice.

I look in the source for JibxMarshaller, and find this line where
bindingName is used:

bindingFactory = BindingDirectory.getFactory(bindingName, targetClass);

I look in the Jibx class BindingDirectory, and find:

public static IBindingFactory getFactory(String name, Class clas,
ClassLoader loader) throws JiBXException {
String list = getBindingList(clas);
String match = GENERATE_PREFIX + name +
BINDINGFACTORY_SUFFIX + '|';
int index = list.indexOf(match);


where GENERATE_PREFIX and BINDINGFACTORY_SUFFIX are:

/** Prefix used in all code generation for methods and classes. */
public static final String GENERATE_PREFIX = "JiBX_";

/** Suffix of binding factory name. */
public static final String BINDINGFACTORY_SUFFIX = "Factory";


Then I look around in my /target directory (I am using Maven), and see
that there is a class called:

JiBX_jibx_bindingFactory.class

Opening this in Notepad++, I find a string:


au/com/careerone/xmlbinding/adicio/JiBX_jibx_bindingFactory

So it looks like Jibx first converts the name of the binding file into
Java class format, and the '-' in jibx-binding becomes an underscore.

So we get: jibx_binding

But was this documented anywhere? No!

This Jibx bug helped me figure it out:

https://svn.sxc.codehaus.org/browse/JIBX-210

Oh well.

Monday 27 April 2009

Maven: replace a shell script with a Groovy script run by gmaven-plugin

I've never even heard of the gmaven-plugin before and just though this
looks quite awesome.

Text below is just cut and pasted from the Maven mailing list.

================================================================

PROBLEM:

At a customer site there is a custom, company-wide dictionary available for
spellchecking. This dictionary is managed in an proprietary application from
where you can export it. For the webapp we're building we need to transform this
dictionary into a very simple format: a single file with one
dictionary entry per line. The export format is somewhat special as
its spread over a bunch of files (one for each letter of the
alphabet), contains additional syllabication info, which we don't need
and also has some comments that have to be removed. The specifics of
the format aren't really that important here though...

After some testing I came up with the following short bash-script that fullfills
all my needs:

8<-----------------------------------------------------------
tmp_folder=target/dict
cls_folder=target/classes
mkdir -p $tmp_folder
mkdir -p $cls_folder

cat src/main/dictionary/*.lst > $tmp_folder/tmp1.dict
sed "s/[~?]//g" $tmp_folder/tmp1.dict > $tmp_folder/tmp2.dict
sed "s/ .*$//g" $tmp_folder/tmp2.dict > $tmp_folder/tmp3.dict
sort -u -o $cls_folder/my.dict $tmp_folder/tmp3.dict
8<-----------------------------------------------------------

(In other words: Take all files src/main/dictionary/*.lst, concat them into one
single file, match some strings with simple regexes and remove those, and
finally sort the dictionary entries and remove all duplicates.)

This script is then called from within maven with exec-maven-plugin. Afterwards
maven-jar-plugin wraps the file in a simple jar, so the dictionary can
be easily consumed in Java using
getClassLoader().getResourceAsStream().

Now all is well & nice and this script even performs sufficently given about 1.6
million dictionary entries (~38MB). But of course it's not really the
Maven way to do things, especially because it's not portable. You need
to have some kind of Unix-like enviroment in place for this script to
work.


SOLUTION:

Assuming the dictionary source files are already broken down by letters
of the alphabet, then the following 5 lines of code does most of it.
(Note that the sed scripts are pretty close to just a line by line
trim() and, of course, you may need to sort the file names.)

<plugin>
<groupId>org.codehaus.groovy.maven</groupId>
<artifactId>gmaven-plugin</artifactId>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<source>
<![CDATA[
new File( "target" ).mkdirs();
def resultfile = new File( "target/dictionary" );
new File("src/main/dictionary").eachFileMatch(~/.*\.lst/){ file ->
file.readLines().sort().each(){resultfile << it.trim() + "\n";}
}
]]>
</source>
</configuration>
</execution>
</executions>
</plugin>

Saturday 18 April 2009

Wednesday 18 March 2009

Gmail fixes "mark as unread" annoyance - you can now mark individual messages instead of the whole thread

Great to see that Google have fixed that issue where "Mark as unread"
marks *the whole thread* instead of just the specific message that you
wanted to mark as unread. I'm just surprised it took so long to get
it fixed.

http://gmailblog.blogspot.com/2009/03/small-but-helpful-change-to-mark-as.html

Tuesday 17 March 2009

Jaxb notes: specifying a package for a classes generated from a schema

Use the <package> element of the <schemaBindings> binding declaration
to define the package name for the schema.

For example, the following defines the package name for all JAXB
classes generated from the simpleservice.xsd file:

<jaxb:bindings
xmlns:xs="http://www.w3.org/2001/XMLSchema"
schemaLocation="simpleservice.xsd"
node="/xs:schema">
<jaxb:schemaBindings>
<jaxb:package name="examples.jaxb"/>
</jaxb:schemaBindings>
</jaxb:bindings>


Taken from http://edocs.bea.com/wls/docs103/webserv/data_types.html#wp223112

Saturday 7 March 2009

Getting a replacement power supply for Western Digital external drives - easy as pie

I very rarely get to actually praise a company for doing something beyond my expectations of service so here goes.

I've owned a 500GB WD Elements external hard drive for a little more than a year, and it stopped working about a month ago. I suspected the power supply was faulty, because I would plug it in, it would light up for half a second, then die out.

I was running out of disk space on my computer so I finally got around to looking for all the paperwork for it to make a warranty claim - the receipt, the warranty documents, etc. I went online, registered the product, adjusted the warranty dates by sending them a photo of my receipt, since there were a few weeks between the time of manufacture and the time of sale.

Then I rang Western Digital support and told them about my problem. The conversation went something like this:

Me: I've got a problem with the power supply of my external hard drive. It lights up for a moment after plugging in then goes out.

WD support: So what is the plug for your power supply. Is it 5-pin or something else?

Me: 5 pin. (I'd read on their support site that models made after sometime in 2008 used a different power supply and pin)

WD support: Okay, give me your name and address. You should get it in about two weeks.

Me: Do you need my registration number, or the model of hard drive I have.

WD: No, it doesn't matter what size of drive, it's just the plug that's different.

So they didn't even check if I actually had a registered drive. I could have been anyone or the item could have been out of warranty and would still have received a replacement power supply! Not that I'm complaining. Probably the chances of people doing that are quite unlikely anyway, so they decided to simplify the procedure.

The power supply arrived yesterday, Friday, 6 March. It was sent by FedEx from Singapore on 3 March. No questions, no rego check, no hassles. Just send it out when requested. WD support are f*king excellent!