my recent reads..

Quick NLB Catalogue Lookups

Postscript: I've given up all ambitions of hacking NLB now that I have discovered Bookjetty - a bookshelf site with library integration. Check it out!

OK, so this post won't mean diddly unless you live in Singapore, or have a local library using the CARLweb system.

But say you are browsing one of the book retailers on the web - like amazon - and you want to know if the book is available in your local library?

Here's a little trick to help you find that out in one-click (not patented;-). It is inspired by some posts over at The Box Factory.

Below is a link that you save to your bookmarks (Firefox)/favorites (IE). Once saved, when you are on a book page at amazon etc, just select the bookmark/favorite and it will pop-up a window to Singapore's National Library Board catalogue system and try and find the book in the library for you.

NLB Book Lookup <-- Bookmark/Favorite this!

Simple steps: How to Use It

  1. Right-click on the link above, and select Bookmark This Link.. (Firefox) or Add to Favorites.. (IE)

  2. Go thru the steps to save the link. you may get a warning about "javascript:" links not being recognised. Ignore/proceed .. trust me!

  3. Check you Bookmarks/Favourites menu - should now find NLB Book Lookup in the list.

  4. Navigate over to a book retailer and find a book (try the Ruby Cookbook (O'Reilly) at Amazon for example)

  5. While viewing the book page, select NLB Book Lookup from your Bookmarks/Favorites menu

  6. A new window will open to display the NLB Library Catalogue record (if there is one)

Grumpy Stuff - But Looking Forward

The NLB is still using CARLweb, which is an ancient product from TLC.

Once of the really nasty features of this system is that it using session tracking in the URL query string of your request. Not only does this prevent deep-linking (so you can't easily email a catalogue link to a friend for example), it makes the catalogue un-indexable by web search engines like google.

It also means that the Bookmark/Favorite link I gave you above has to go in the front-door, and creates a new session each request. So unfortunately that means that if you use this a few times in quick succession, you may get a maximum sessions exceeded error. Sorry, for now you'll just have to close the windows and wait a while for sessions to expire.

Yes, CARLweb sux. It truely belongs to an earlier era of computing!

The good news: I've heard whispers that the NLB have a project running to upgrade their catalogue search facilities. Hopefully we'll soon have a much better service to use. My top wishes:
  • Support for deep-linking. No user/session-related information in URLs.

  • A nice robots.txt that allows the search engines to fully index the catalogue

  • Flexible RSS feeds - as well as the usual "latest acquisitions" etc, a flexible and published approach to parameterising the feed e.g. by library location, by subject and any other search criteria. Or another way to express this would be "get any search result as RSS"

  • Getting ambitious now ... a published Web Service/REST API

  • A mashup developer's guide - encourage people in Singapore to exploit the NLB catalogue! A competition even?


Originally posted on tardate
read more and comment..

Explaining Regular Expressions

Unless you get to work with regular expressions everyday, the details can easily blur. You remember enough to know when a regex could be useful, but not enough to write it without reaching for a reference manual.

There are a few tools out there to help you write and understand regular expressions, including some IDEs that can provide assistance (like Komodo).

Sometimes you just want a quick explanation of a regular expression you might have seen in some code. The YAPE::Regex::Explain perl module is one tool that helps you do just that. Turning the module into a simple command-line tool is a simple one-liner:

#!/usr/bin/perl -w
print YAPE::Regex::Explain->new($ARGV[0])->explain;
I've also turned it into a simple CGI utility for those times when my regex memory fails me. You can use it here: regexplainr (sorry, you may find that site offline but here's the source code).

In a previous post, On Parsing CSV and other Delimited/Quoted Formats, I used the following regular expression to parse a whitespace-delimited string:
"([^"]+?)"\s?|([^\s]+)\s?|\s
Regexplainr produces the following commentary:
The regular expression:

(?-imsx:"([^"]+?)"\s?|([^\s]+)\s?|\s)

matches as follows:

NODE EXPLANATION
----------------------------------------------------------------------
(?-imsx: group, but do not capture (case-sensitive)
(with ^ and $ matching normally) (with . not
matching \n) (matching whitespace and #
normally):
----------------------------------------------------------------------
" '"'

----------------------------------------------------------------------
( group and capture to \1:
----------------------------------------------------------------------
[^"]+? any character except: '"' (1 or more
times (matching the least amount
possible))
----------------------------------------------------------------------
) end of \1
----------------------------------------------------------------------
" '"'
----------------------------------------------------------------------
\s? whitespace (\n, \r, \t, \f, and " ")
(optional (matching the most amount
possible))
----------------------------------------------------------------------
| OR
----------------------------------------------------------------------
( group and capture to \2:
----------------------------------------------------------------------
[^\s]+ any character except: whitespace (\n,
\r, \t, \f, and " ") (1 or more times
(matching the most amount possible))
----------------------------------------------------------------------
) end of \2
----------------------------------------------------------------------
\s? whitespace (\n, \r, \t, \f, and " ")
(optional (matching the most amount
possible))
----------------------------------------------------------------------
| OR
----------------------------------------------------------------------
\s whitespace (\n, \r, \t, \f, and " ")
----------------------------------------------------------------------
) end of grouping
----------------------------------------------------------------------
(Permalink to this regexplanation)

Book tip: (thanks to Tony) O'Reilly's Mastering Regular Expressions. Available on google books, and also from Amazon.

read more and comment..

Silverfish New Writing 1


New Writing was published in 2001 by silverfishbooks. It is a collection of works in English by writers from around Singapore and Malaysia.

At the time it was quite a risky business proposition. Was anyone going to buy a book like this? Mainstream sentiment was generally quite negative towards works in English (either because the national languages held more prestige, or a perverse expectation that local writers by definition couldn't be any good if they used English).

Well, with six editions now in print, I think the critics have been silenced and the series has I think given the local writing scene more self-confidence.

I recently went back to read some of the stories in the first edition. I like the little sketches of life. Either contemporary such as Hong Wee's The Drive Home, or reminiscing on the past as in 14 Leech Street by Bernice Chauly.

Of course must pay homage to the local fascination with ghost and zombie stories with Kaysidayat bin Ishak's The Last Train. Or something a little more tender and juicily experimental like Plat du Jour by Muslin Abdul Hamid.

And much more. Pick any book in this series to try something new and different. Its a bit like nasi padang - get to sample a whole range of small dishes with great local flavour.

read more and comment..

Mars


After Jupiter, I went back to start with the first book in Ben Bova's series - Mars.

It is a gripping page-turner of the first manned mission to Mars, and the hopes of making the most startling of discoveries - life on another planet. The book's tension comes from a great balance of the personal story of the astronouts, the hard-science of the mission, and the all-too-realistic dimension of earthly politics. Real drama cloaked in a scifi setting.

Looks like I'll be reading the whole series now!

read more and comment..