Monday, 19 December 2011

Guardian: Voices of Finance article

The environment described by this developer sounds very familiar to
anyone who's worked practically *anywhere*. :(

Wednesday, 9 November 2011

Senseless corporate doublespeak sample #001

Original text:

"Through these discussions, we have also identified opportunities to
change the role of PC&S in ways that will better support the execution
of the IT strategy. By specifically leveraging the discipline and
framework of the SMO, as well as accelerating the decision to combine
this function with the PMO function, we can focus on our sourcing
strategy and continue the emphasis on agile roll out and our people
leadership program."

What I think it means:

This role will be abolished. Some of its functions will be done by someone else.

Wednesday, 19 October 2011

Steve Jobs on customer experience (WWDC 97)

(the quote starts from 1:55)

You've got to start with the customer experience and work backwards to the technology. You can't start with the technology and try to figure out where you're gonna try to sell it.
It started with "What incredible benefits can we give the customer? Where can we take the customer"? Not starting with "Let's sit down with the engineers and figure out what awesome technology we have and how are we gonna market that?" And I think that's the right path to take.

Thursday, 13 October 2011

Note to self when using java regex - always call Matcher.matches() so that text matching actually happens

The general pattern of usage is:

1. regexString = [REGEX]
2. final Pattern p = Pattern.compile(regexString);
3. final Matcher matcher = p.matcher(text_to_match);
4. matcher.matches() 

DO NOT FORGET to call Matcher.matches().

Otherwise you will get messages like:

java.lang.IllegalStateException: No match found

and you'll be wondering why because you have confirmed that the regex itself is correct. ( and are useful tools for doing this quickly)

REMEMBER: call .matches() so that our Matcher actually performs the matching!

Just wasted 10 minutes wondering what I was doing wrong.

Tuesday, 13 September 2011

Use Windows path separators if you're using the JDK keytool in Windows - backslash "\" not forwardslash "/"

This error "keytool error: Keystore was tampered
with, or password was incorrect" may not really mean a password or
keystore problem.

Here's my story:

Kept trying various passwords to add a certificate to my JRE CA using
this command:

./keytool.exe -v -alias certalias -import -file <DomainRootCA>.crt
-keystore ../jre/lib/security/cacerts

And I kept getting

keytool error: Keystore was tampered with, or
password was incorrect Keystore was tampered with, or password was incorrect
Caused by: Password verification failed
... 5 more

I tried various passwords. My usual default passwords. "changeit" -
which is usually default for these certs. Nothing worked.

Then remembering how bad these java exceptions are, I changed the
keystore parameter, to see if it would complain about not seeing the

Just remove the "s" from "cacerts"

[everything to the left of this is still the same] -keystore

And still got the same error. Bloody JDK! So maybe it was failing
because it couldn't find the file, but it wasn't being shown in the
error message.

So I changed my path references to backlash "\" instead of "/", even
though I was doing all these under cygwin bash shell.

./keytool.exe -v -alias certalias -import -file <DomainRootCA>.crt
-keystore ..\jre\lib\security\cacerts

Using the first password I tried, "changeit"

And it worked.

The lesson:

1. JDK error messages suck!
2. When using keytool.exe on Windows, make sure your path separators
are "\" and not "/". The fact you're running under bash shell doesn't
affect it.
Remember: Use Windows-based path separators if you're using the JDK
keytool in Windows

Saturday, 10 September 2011

Are you using iPhoto by *its* rules? Make sure your understanding of iPhoto terms is correct.

AAARGH!! Almost buggered up my iPhoto library. Was using "Flagged
photos" to mark favourite photos. Then accidentally selected "Create
Event From Flagged Photos" while trying to split an Event.

Result? An event containing 1000 photos from 2008 to today. And good
thing I Googled it first, because an event is actually like a folder
of photos. So deleting an event would have deleted all the photos in
it. All my favourite photos from my entire library, going back to
2008. Dammit.

But thank <deity> that "Edit -> Undo" can also reverse that operation.

Be careful of "Create Event From Flagged Photos" if you're treating a
"Flagged photo" to indicate a Favourite photo. This is not really what
it's for. Flagging a photo is probably meant for short-term
operations, in the context of creating an event or album going across
multiple windows of photos.

This is where following the rules and reading a bit more would have
helped. The model I *think* I should have been following was:

Event - Physical directory of photos.
Album - Virtual collection of photos.
Album - can have photo from any events
Smart Album - can have photos based on search criteria
Folder - a collection of Albums or Smart Albums


Deleting an Event will delete the photos.
Deleting an Album will not delete the photos.

You should only Flag a photo to maintain a temporary list before
either moving them to an Event or Album. Normally I should put them in
an Album, since I like to keep photos grouped by date on the
filesystem. When I was on Windows using Picasa my workflow was to
first rename any new photos in a photo_upload directory using the
program "jhead" then running a Ruby script to move them into
date-based folders using each photo's EXIF metadata.

Don't keep them for longer than that, lest you mistakenly create an
Event and shove photos from different times into the same folder. If
that happens make sure to go to Edit -> Undo before doing anything

This link cleared things up for me:

Friday, 26 August 2011

Just discovered SVN switch command - switch to a different branch instead of doing a full checkout

I've been doing complete checkouts whenever our branches get renamed,
instead of using "svn switch". Not a small pain considering it takes 8
minutes to do a full checkout. Good thing this doesn't happen that
often (and probably the reason I haven't discovered the command. not
painful enough). How embarrassing!

Quick example of using SVN's "switch" command

$ cd calc

$ svn info | grep URL

$ svn switch
U integer.c
U button.c
U Makefile
Updated to revision 341.

$ svn info | grep URL

Only fewer files need to be updated. More time to read Hacker News. =)


Changes to Macbook Pro - installing Homebrew, RVM, Ruby 1.9.2, Rails, MySQL

I've been meaning to try out Rails 3.0 for a while, and finally got
around to installing it, but I wanted to use Homebrew for managing
packages and RVM so I could easily make use of multiple versions of
Ruby, since Snow Leopard default is Ruby 1.8.7

Every now and then I still have nightmares of what I went through with
getting Ruby to work on Tiger on my Powerbook. I didn't need to do as
much Googling this time around and getting into various dead-ends. And
with the i7 CPU compilation is way quicker than before. =)

1. Installed Homebrew:

/usr/bin/ruby -e "$(curl -fsSL"

2. Install Git and Wget

brew install git

brew install wget

3. Installed RVM

bash < <(curl -s

reloaded .bash_profile:

> source .bash_profile

4. Check that RVM is running

rvm notes

5. Install Ruby 1.9.2

rvm install 1.9.2

6. Install Rails

gem install rails

7. brew install mysql

(during make CPU usage goes way up to 80% and the fan kicks in for the
first time i've seen)

Wednesday, 24 August 2011

How to do a git clone through a NTLM proxy

I've already set up CTNLM - - and have
already used it with Ruby gems yesterday, so I definitely know it's
working. We now have to configure GIT so it uses this proxy (running
on localhost:3128 by default)

>git config --global http.proxy localhost:3128

I've been looking at how to use workflows in Ruby on Rails recently,
and came across this project:

And the install instructions are here:

But looks like the GIT protocol can't be used through our proxy,
because if we try it we get this:

>git clone git://
Cloning into ruote...
fatal: Unable to look up (port 9418) (No such host is known. )

So replace git:// with http:// and see if we can do a git clone

>git clone
Cloning into ruote...
remote: Counting objects: 22048, done.
remote: Compressing objects: 100% (5796/5796), done.
remote: Total 22048 (delta 16305), reused 21864 (delta 16134)Receiving objects:

Receiving objects: 100% (22048/22048), 4.04 MiB | 304 KiB/s, done.
Resolving deltas: 100% (16305/16305), done.

Yay, it works!!

Tuesday, 23 August 2011

Ruby gems error: "Could not find a valid gem 'sqlite3' Possible alternatives: sqlite3" WTH?? Gems could be having network issues.

Installed rails and trying to get a test project running:

Created a new project and tried to get it running:

D:\Development\testrails>rails server

Error was:

D:\Development\testrails>rails server
←[31mCould not find gem 'sqlite3 (>= 0)' in any of the gem sources listed in you
r Gemfile.←[0m
←[33mRun `bundle install` to install missing gems.←[0m

Now trying to install sqlite3, based on advise here:

But I got:

D:\Development\testrails>gem install sqlite3
ERROR: Could not find a valid gem 'sqlite3' (>= 0) in any repository
ERROR: Possible alternatives: sqlite3

And trying 'sqlite3-ruby' doesn't work either:

D:\Development\testrails>gem install sqlite3-ruby
ERROR: Could not find a valid gem 'sqlite3-ruby' (>= 0) in any repository
ERROR: Possible alternatives: sqlite3-ruby

I came across this:

which advised to download sqlite3 for Windows and copy the file
sqlite3.dll into the directory [RUBY_INSTALL]\bin

No dice, still getting the same error

I also copied the file sqlite3.def to the same location - still
failing! Could it be because my version of sqlite is too new (current
one I downloaded is

Then I realised that I forgot to use the proxy settings. At work, we
go through a Windows proxy, and to get Ruby gems to work, I had to
install CTNLM - which requires username and password - and then
access the proxy like this:

gem install --http-proxy http://localhost:3128 rails

Now it works!!

D:\Development\testrails>gem install --http-proxy http://localhost:3128 sqlite3-
Fetching: sqlite3-1.3.4-x86-mingw32.gem (100%)
Fetching: sqlite3-ruby-1.3.3.gem (100%)


Hello! The sqlite3-ruby gem has changed it's name to just sqlite3. Rather than
installing `sqlite3-ruby`, you should install `sqlite3`. Please update your
dependencies accordingly.

Thanks from the Ruby sqlite3 team!

<3 <3 <3 <3


Successfully installed sqlite3-1.3.4-x86-mingw32
Successfully installed sqlite3-ruby-1.3.3
2 gems installed
Installing ri documentation for sqlite3-1.3.4-x86-mingw32...
Installing ri documentation for sqlite3-ruby-1.3.3...
Installing RDoc documentation for sqlite3-1.3.4-x86-mingw32...
Installing RDoc documentation for sqlite3-ruby-1.3.3...

And Rails works now:

D:\Development\testrails>rails server
=> Booting WEBrick
=> Rails 3.0.9 application starting in development on
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2011-08-23 16:27:11] INFO WEBrick 1.3.1
[2011-08-23 16:27:11] INFO ruby 1.9.2 (2011-02-18) [i386-mingw32]
[2011-08-23 16:27:11] INFO WEBrick::HTTPServer#start: pid=4908 port=3000


So the lesson here is:

When you see a nonsensical error like this

ERROR: Could not find a valid gem 'sqlite3' (>= 0) in any repository
ERROR: Possible alternatives: sqlite3

It could mean that Ruby gems is having network problems, and can't
access *any* repository.


Friday, 29 July 2011

Fairfax Subscriber login page FAIL

Trying to get my subscriber number from Fairfax subscriber login and
at the bottom there's a message with a number to call in case you need

"Please contact us at [blank] or [blank]"

Friday, 22 July 2011

I hate HP QC (Quality Centre).

Holy f*. HP QC (Quality Centre) is such a piece of shit. One of our QA
teams is on QC 9.2, so I don't know if this has been fixed in more
recent versions.

So I wanted to update a bug today and had to go through this.

1. Wait for IE to re-download CAB files and got error message about
not being able to download and "Close all connections to server and
try again"

2. Restart IE.

3. Log into QC and open bug.

4. Update Status to "Ready to Test" and reassign to the tester. Tried
to type in Comment area after clicking "Add Comment" but I can't seem
to type in it!

5. Close dialog box, reopen bug and try again. Still not displaying what I type.

6. Looks like the text box for comments in the dialog box doesn't
work. But if you just view the listing of all bugs, and select the bug
you want, you can click on "Add a Comment" on the lower right box and
it accepts text input.

Our company has started using JIRA, but it looks like all the testers
will remain on QC. And there doesn't seem to be a way for QC and JIRA
to communicate both ways. QC can probably create a corresponding bug
in JIRA, but JIRA isn't able to go and update the same test in QC.

Ah, enterprise-y crap.

Friday, 3 June 2011

Hey Google: No love for Opera?

"As of August 1st, we will discontinue support for the following
browsers and their predecessors: Firefox 3.5, Internet Explorer 7, and
Safari 3."

"So if it's been a a while since your last update, we encourage you to
get the latest version of your favorite browser. There are many to
choose from:
• Chrome
• Firefox
• Internet Explorer
• Safari

I felt a teeny tiny disturbance in the Force... as if all 50 Opera
users suddenly cried out in terror at their favourite browser once
again being ignored and they can't shut up about it.

Randoms adding you on LinkedIn

You gotta wonder - "Bosnia and Herzegovina -
Transportation/Trucking/Railroad" - why would you even think of adding
me as a Friend?

How to export iPhone geolocation data

How to export iphone geolocation data so you can play around with the
data. I tried using some python scripts but they didn't work. Once I
exported the data, tried to use sqlite but the Firefox plugin is
really the best way to deal with sqlite.

* Get iPhone backup extractor from

* Run backup and export your iOS Files - I had 2 backups and the older
backup was the one with all the geolocation data.

* Using Firefox, install the SQLite Manager plugin. Using this
plugin, open the file /iOS

* Export the data - you can export as CSV, SQL, or XML

Now do an update of iphone to iOS 4.3.3 so it doesn't keep your retain
data anymore! (not too long anyway. they might keep it for a week,

Wednesday, 18 May 2011

JSTL not working? Check that you have the correct servlet version in web.xml!!!

This is a pretty silly gotcha, but this normally wouldn't have
happened since most of the time I'm working on updates to existing
deployed webapps running on Tomcat 6.

Anyway, this sucked up about 1 hour of my life, trying to find out why
my JSP 2.0 style tags weren't working. Even things as basic as c:out
weren't working either.

Finally stumbled upon a forum post that pointed to this.

Aha!! The webapp I'd created using the Maven archetype
maven-archetype-webapp has Servlet 2.3 declared in it's web.xml. A
version that is pretty bloody old, considering the ref implementation
for that is Tomcat 4! Seriously, an upgrade for the built-in web.xml
wouldn't be that hard to do, Maven plugin people!

Anyway, all's well.

For now.

Wednesday, 23 March 2011

Coding WTF: Throw an exception to trace callers of a method

I found an interesting bit of code at work:

try { // This will allow us to debug future cache reloads
throw new Exception("Issuer Security Cache was Reloaded");
} // Stack Trace gives context to see where it was initiated from
catch(Exception e) {
log.debug(e, e);

It was a bit of a WTF, and it probably still is from a performance
point of view, but I can see why they did this.

I guess this was written before they had IDEs that could find out the
callers for a particular method. But couldn't they have just done
that anyway by grepping through the code base? Oh, right, inheritance
4 levels deep can leave you unable to find out which actual class
you're looking at.

Tuesday, 22 February 2011



In your life there's someone waiting,
lost on streets that no one travels
In my dream I see this meeting,
we're a knot that fate unravels

But beyond our shameless sorrow,
catch me if I'm with the wind
We may be the sky tomorrow,
we're a branch that will not bend

The world is spinning through my head
Your gravity won't let me go,
You're holding me together,
No one ever has to know

I'm a dream and you're fading away, 
I'm a dream and you're fading away 

In your face there's someone sleeping,
lost in years that no one's counting
The only way to hear the weeping,
suffering is like a fountain

Everything is far away now,
held beyond our nameless sorrow
Shifting streets that no one wanders,
lose the days, we only borrow

Thursday, 13 January 2011

Coding WTF of the Week

I think I'll start a new segment for this blog, ala - DailyWTF.. hey,
I should submit this...

Task: Get a list of all securities that have prices.

Instead of doing a join between two tables (SECURITY, SECURITY_PRICE),
the developer did this

1. Get all securities.
2. Get all security prices.
3. Loop through all the securities.
4. Inside that loop, loop through all the prices.
5. Where price.securityId =, put them into the container class

Not too big a deal on dev database, but problematic on UAT database
which had 7000 securities and 1000 security prices.

Removing this code and replacing it with code that used a join,
brought down a method call from 50 seconds to 2 seconds.