Contact Me

Firstly, if you want to respond to a post, just add a comment.

Otherwise, here you go, my contact details:
Contact details for Julian M Bucknall

Julian with sundial

Loading similar posts...   Loading links to posts on similar topics...

31 Responses

#1 Petter Mattsson said...
17-Dec-08 2:49 PM

Hi !

I just read one of your earlier posts about a recursive version of the selection sort. I've been having a bit of a hard time getting the recursive thinking in to my head, but after reading trough your way of reasoning how to rebuild the sort it just "clicked". So.....thanks!!


julian m bucknall avatar
#2 julian m bucknall said...
17-Dec-08 3:29 PM

Petter: Cool, I'm glad the article helped.

Cheers, Julian

#3 Nasser Wahby said...
11-Oct-09 7:15 AM

Hallo their,

I have a question about a book , if you have any book about the data structures for starter.

From the beginning , i mean the beginning sequention and selection , iteration, of cours the book must include a lot of case and the soulations.

And then the rule of pascal, or Delphi , dosn't matter.

Please , and again please if you have any paper work als it be suseful,.

My name is Nasser Wahby

im living in Belgium , so i am wating your replay.

Best Regardes


#4 Mick said...
11-Nov-09 5:33 PM

Hi Julian,

just a quick one to say thanks for an old article and program on ISO 8601 for Week number. I spend more time testing and figuring out why other implementations where not working and stubbled across yours in a small thread in a response to one that didnt work. Nice piece of work and thanks.

On a side note.. I brought Telerix controls into a few client companies that I worked in, a few years ago. At first it worked well but once we tried something not out of the box... duh! I then moved to dev express and we pushed those controls to the limit also. Some cool stuff, modal dialogs on ASP etc ... all great. Yeah ok I coming to the 'But' bit :-) just remember in designing to keep it simple stupid. I did notice after each release that the functionality grew to such a size that it was like learning a hole new programming skill. So if you can in there... keep it simple as the controls are great...

thanks again... Mick

#5 DoctorGauss said...
25-Dec-09 6:17 AM

Hello, Mr. Bucknall.

I'm from Russia and Yesterday I have buy your book The Tomes of Delphi Algorithms and Data Structures (in translate for russian language). It's fantastic book, thank for your job. I'm begining non-professional programmer and this book very useful for me.

With best wishes!

P.S. Sorry for my bad English.

julian m bucknall avatar
#6 julian m bucknall said...
26-Dec-09 4:38 AM

DoctorGauss: Good luck with the book! Glad you like it. I also have a Russian translation of it, although I can't read it. By the way, your English is just fine.

Cheers, Julian

#7 Dave said...
18-Mar-10 6:25 PM

Hi Julian,

I'm using an older version of your lock free queue and I'm occasionally an NullReferenceException in Dequeue() thrown from the line

item = oldHeadNext.Item;

Is this ( the latest version you've posted? It's newer than the version I used so hopefully the issue I'm experiancing is the thing you fixed.



julian m bucknall avatar
#8 julian m bucknall said...
19-Mar-10 8:17 AM

Dave: The code shown on that page is pretty much the latest version. However you can get the really 100% up-to-date :) version here:

Cheers, Julian

#9 Dave said...
21-Mar-10 3:02 PM

Hi Julian,

The zip file is the same code which I'm experiancing the exception.

In the code below, oldHeadNext is tested for null if oldHead == oldTail, but not if it isn't. I'm seeing it null inside the else statement, NullReferenceException is thrown from the line where item is assigned oldHeadNext.Item.

if (oldHead == head) {
  if (oldHead == oldTail) {
    if (oldHeadNext == null) {
      return false;
  else {
    item = oldHeadNext.Item;
    haveAdvancedHead = 
julian m bucknall avatar
#10 julian m bucknall said...
22-Mar-10 12:01 PM

Dave: I can't reproduce this at all. I've written a multithreaded app that uses two threads to enqueue, and two to dequeue, and run it on my four-core desktop enqueuing 100,000,000 integers. No problem. I added 4 more dequeuers. No problem.

I've reviewed the code as well, going back to my original source (the Michael and Scott paper). It's good.

So, have you got a reproducible test case? If so, please email me on I promise to take a look, asap.

Cheers, Julian

#11 Dave said...
22-Mar-10 2:54 PM

Hi Julian,

I've not been able to reproduce outside the production application (I used ints like you). I'll keep trying, I'm using the lock free queue in a Producer / Consumer scenario. Any number of thread can enque an object but since the source is a WCF MSMQ endpoint generally it always seems be the same thread. There is only ever 1 thread dequeuing.



#12 caoweimin said...
07-May-10 12:14 AM

Hi Julian,

I have read your book-The Tomes of Delphi Algorithms and Data Structures several times. It deserves reading really. Today I test TtdSkipList using 10,000,000 Pointers and I found a bug in TtdSkipList.Add procedure.

// Source begin=================
procedure TtdSkipList.Add(aItem : pointer);
  i, Level    : integer;
  NewNode     : PskNode;
  BeforeNodes : TskNodeArray;
  {search for the item and initialize the BeforeNodes array}
  if slSearchPrim(aItem, BeforeNodes) then
    slError(tdeSkpLstDupItem, 'Add');
  {calculate the level for the new node}
  Level := 0;
  while (Level <= MaxLevel) and (FPRNG.AsDouble < 0.25) do
  {if we've gone beyond the maximum level, save it}
  if (Level > MaxLevel) then
//Source end ===============

The last line increment FMaxLevel, so it is possible that FMaxLevel exceed tdcMaxSkipLevels, 12. This situation's probability is very low, but it happened while testing with large data volumn.

Best Regardes Caoweimin 再次感谢您.

#13 Ken Beaudrie said...
30-Oct-10 4:21 PM

I purchased the second printing of your book "Algorithms and Data Structures." I tried to download the source code from the book at but the file to be downloaded appears to be corrupted. I can neither open the file online or sucessfully download a copy that can be opened. Can you help?

Thanks for the great book!

julian m bucknall avatar
#14 julian m bucknall said...
30-Oct-10 4:58 PM

Ken: Very puzzled. I just downloaded the zip file from the link on that page and it was fine (I could open the zip file and open one of the files in the zip archive). So email me (the address is above) and I'll email the file to you.

Cheers, Julian

julian m bucknall avatar
#15 julian m bucknall said...
30-Oct-10 5:00 PM

caoweimin: Sorry about that: I missed the notification email that said you'd commented. You are correct: I should have put in some code to throw an exception if the level was incremented past the tdcMaxSkipLevels value.

Cheers, Julian

#16 Scott said...
23-Nov-10 6:05 PM

Hi Julian,

I stumbled across your old blog whilst researching a lock-free FIFO queue and Hazard Pointers.

I am using the Michael-Scott algorithm for a lock-free queue, but I'm trying to do a presentation that demonstrates the ABA-prone CAS operations in the enqueue method, and I'm not too sure how to actually implement the hazard pointers.

Since I enjoyed your old blog and appreciated the coding explanations, I was hoping you could point me to the "Next time we'll be looking at the actual implementation in C# of the hazard pointer system. " portion, referenced from

Specifically, I see you're using some (presumably unimplemented) call to MagicMemoryManager.MarkAsHazardPointer.

I need some magic in my memory management =)

I appreciate any help and keep it up!



julian m bucknall avatar
#17 julian m bucknall said...
23-Nov-10 8:07 PM

Scott: I wrote something for hazard pointers in Delphi around about that particular time, but never went further with converting that to C#. I was never particularly happy with it in Delphi (it was, to put it mildly, pretty junky code -- I seem to remember you had to state up front how many hazard pointers you wanted to use and TLS was in there somewhere) so put it aside for the day I would reconsider it in C#. That day never really came.

Cheers, Julian

#18 Laurent said...
06-Dec-10 8:12 AM

Hi Julian,

First of all, I would like to say that, I am a fervent admirer of resolutions whom you offer by yours articles, book or by your DevExpress commercial way.

I've read some months ago (maybe some years ago), a very nice article from you. This one displayed a very clever principle used under ExpressEditor and concerns, the Properties property (Tcx...Properties). You had explained how to implement and unfortunatly, I cannot retrieve this/these articles. Could you help me to point me in right direction ?

Thank you very much for your precious contribution in the Delphi's world.

Best regards,


julian m bucknall avatar
#19 julian m bucknall said...
06-Dec-10 5:22 PM

Laurent: It wasn't me, I'm afraid. Possibly it was Richard Morris -- I know he did a couple of talks for CodeRage in 2009 on behalf of DevExpress and posted the code. It's a two-parter and you can find it here:

and here:

Cheers, Julian

#20 Laurent said...
07-Dec-10 1:01 AM

Y E S Y E S Y E S .....

Thank you very much.

I'm very disappointed, you would really have been able to be quicker than Richard to write them. ;-)

Best regards and très bonne continuation.


#21 PeteK said...
12-Jan-11 12:08 PM


I'd be interesting in seeing a TOC of your algorithms book ,if you have one at hand. Failing that, was it reviewed in the Dlephi Magazine ? What a fine resource that was (is).

Pete K

#22 Stefan Mauerhofer said...
23-Aug-11 11:20 PM

Hi Julian

I'm a swiss programmer working at a bank and interested in lock-free algorithms. I have a minor understanding problem with your queue implementation. In the enqueue method you write

if (SyncMethods.CAS<SingleLinkNode<T>>(ref tail.Next, null, newNode)) {...

The point is the tail.Next reference. Isn't it possible that tail variable changes after the parameters are pushed on the stack and before SyncMethods.CAS is called? Is it possible to replace this peace of code with the following without breaking the algorithm?

if (SyncMethods.CAS<SingleLinkNode<T>>(ref oldTail.Next, null, newNode)) {...

Please excuse my disturbance, I'm not shure if I'm completely wrong.

PS: I like the out campaign very much

julian m bucknall avatar
#23 julian m bucknall said...
24-Aug-11 7:40 AM

Stefan: The whole point of that statement is to attach the new node onto the end of the queue (that is, tail.Next). So if it's null, the new node gets attached and everything is fine. Remember that CAS compares the first parameter (it's a ref parameter so it's CAS that will dereference it, not the call) with the second, and sets it equal to the third if the comparison is equal. As an atomic operation.

The problem with oldTail is that it may have been dequeued a while back and oldTail.Next may be null by bad luck. If that is the case we've just successfully attached the new node onto an orphaned tail. Not what we want.

BTW: make sure you are using the latest code here.

Cheers, Julian

#24 Stefan Mauerhofer said...
25-Aug-11 3:08 AM

Hi Julian

Thanks for the explanation. Now I do understand your code and the error in my thoughts. Thank you very much!

#25 bosjo said...
19-Sep-11 5:44 PM

Opera complains that the pages on this site are not well-formed XML:

XML parsing failed

XML parsing failed: syntax error (Line: 6, Character: 105)

I suppose this is because one of the links in the header is missing the "/" at the end.

/Bo S

julian m bucknall avatar
#26 julian m bucknall said...
19-Sep-11 6:51 PM

@bosjo: Thanks for the heads-up. Actually it was because a link tag was badly formed (it had a quoted string with an ampersand in it). The moral of the story is, always read code you add to your site, especially if it comes from Google.

I've now checked the site with the XHTML validator to make sure it validates correctly. Must add note to self to do this periodically...

Cheers, Julian

#27 bosjo said...
30-Nov-11 1:58 PM

Again, Opera is complaining about the XML -- I think it is the "<" in "if node.precedence < priorPrecedence" it doesn't like...

/Bo S

julian m bucknall avatar
#28 julian m bucknall said...
30-Nov-11 5:34 PM

@bosjo: Thanks again. This time I had to take a short cut to publishing the post because of issues I was having with GoDaddy's hosting and the MetaWeblog interface.

Again: must add note to self to check this periodically.

Cheers, Julian

#29 Hardee Mahoney said...
16-Apr-12 10:50 AM

Dear Mr. Bucknall,

I was wondering if you were going to upgrade EZDSL for 64bit Delphi. I believe in one of your posts you indicated that you would and it would be the last update.

I am going to update an application to Delphi 64 bit and hope to continue to use your EZDSL controls.

Thank you,


#30 Joe Hicks said...
27-Jul-12 7:24 AM

Just bought ebook from Amazon and would like to comment. Content is very interesting even though I've been programming Delphi since D3 & pascal before that. As for the ebook format, I find sorely lacking:

  1. Hot linked table of contents.

  2. Hot linked index of terms.

I don't know if ebook formats permit this, but it would make them truly usable if it was added. Because of the user selected font sizes, it would require a hard page index of offsets into the document which certainly would not be hard to create. I would guess that some form of bookmarks would then need to be inserted into the document.

#31 Chris Walton said...
14-May-15 10:14 AM

Many years ago I started building a fairly extensive system based on your two articles for TDM on combinatorial parsers. I have now had a catastrophic data loss (all my backups are inaccessible) and am trying to recreate some of the work I then did. Could you please point me to any sources for these two articles?

Leave a response

Note: some MarkDown is allowed, but HTML is not. Expand to show what's available.

  •  Emphasize with italics: surround word with underscores _emphasis_
  •  Emphasize strongly: surround word with double-asterisks **strong**
  •  Link: surround text with square brackets, url with parentheses [text](url)
  •  Inline code: surround text with backticks `IEnumerable`
  •  Unordered list: start each line with an asterisk, space * an item
  •  Ordered list: start each line with a digit, period, space 1. an item
  •  Insert code block: start each line with four spaces
  •  Insert blockquote: start each line with right-angle-bracket, space > Now is the time...
Preview of response