Skip to content

Monthly Archives: February 2008

Answer to “Sing a Song”

This puzzle came about a couple weeks ago when I was in a church. I looked at the hymn board and discovered that there were so many "1"s on the board that they had run out, and someone had turned a "7" upside-down and covered the horizontal part with masking tape. I thought, [...]

Sing a song

You've been hired by a company that creates hymn boards - a plaque that goes on the wall of a church showing which songs are to be sung during a church service:
Your task is to create an algorithm to determine the minimum number of each digit card (the little cards with a single digit, 0-9, [...]

Answer to “Through the eye of the needle”

Steven pointed out that Ray's code did not gracefully handle the application closing. If the application closed while there were still transactions processing, the application would simply appear to hang, with its user interface frozen, until either all the transactions were processed, or the user killed the process.
The solution is to check Application.Terminated in [...]

Through the eye of the needle

Ray was a junior developer at a large, nameless bank. One of the applications his group maintained was one that settled certain transactions. Ray was tasked with seeing if he could make the application run any faster. He discovered that the major bottleneck was processing on a network server, and decided that [...]

The puzzle has the week off

Delphi Puzzles is taking the week off this week.
The site is being moved to a new server, and to make sure that we don't lose any comments in the process, there is no puzzle this week. It will be back in full force, better-than-ever, next week.
--Jacob

Solution to “Bluff the Programmer”

The valid code is option #1:

Memo1.Lines.Add(Format('1: %s' + ^M + '2: %s', [Edit1.Text, Edit2.Text]);

^M is a Delphi code construct that compiles, but I haven't found it documented anywhere. The ^M is character - analogue to #13#10 (or \n in c parlance). The + operators aren't even necessary. You can do 'string1'^M'string2' [...]