[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: String hashing code

Subject: Re: String hashing code
From: Deborah Pickett <debbiep-list-xsl@xxxxxxxxxx>
Date: Sat, 15 Dec 2007 17:32:50 +1100
Re:  String hashing code
Abel Braaksma wrote:
> If you looked carefully, you must've seen it also uses a timestamp.
> Together it should provide uniqueness, both within one run and between
> runs. Unless of course you have a system where all are runs run
> simultaneously in the same microsecond (which is not likely since
> starting a processor alone takes somewhere between 20 and 400 ms).

I didn't see anywhere that specified the minimum precision of the
timestamp in the spec, so knowing my luck I'll encounter the one system
that gives integer-second-level granularity while still being able to
run an XSLT 2.0 processor.

> If the problem you are facing is the possibility of names of files
> already existing, you can combine two methods. One: try the most
> randomizing way of creating a filename, two: use
> unparsed-text-available(...) to check whether a previous run already
> created that file, or better, let it loop with a counter until it finds
> a free "slot" (use the high significant bit of the random number of the
> UID or simply add another counter yourself).

True, though years of multithread programming has taught me a strong
aversion to the inherent race condition in non-atomic test-and-create
operations like this.  It can't possibly be as big a risk as hash
collision, but it doesn't stop me feeling any less dirty.

As always, perfection is impossible, so ultimately it comes down to how
much effort I am willing to go to for that extra nine of reliability.

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.