Delphi For Fun Newsletter #44

Home  |  Introduction  |  Newsletters  |  Programs  |  Feedback


Search WWW



Support DFF

 If you benefit from the website,  in terms of knowledge, entertainment value, or something otherwise useful, consider making a donation via PayPal  to help defray the costs.  (No PayPal account necessary to donate via credit card.)  Transaction is secure.

If you shop at Amazon anyway,  consider using this link. 


We receive a few cents from each purchase.  Thanks



The index page for all Programs on the site?

The DFF Play CD?

Zipped file DFF Play contains  executable version of about  75 of the 200+ programs from the site, mostly those I particularly liked or thought would be of widest interest for non-programmers.  The file is rather large, about 20mb..

Anything else?




Search WWW



Not a programmer (yet)?

 That's OK -  the executable version for any puzzle or  game you find here is available for download.  Just scroll down to the bottom of most any description page and you'll find a "Download executable" link. Downloaded programs are in "zipped" format to reduce size and may require an "unzipper" program unless you are running Win XP or later.  Here's a link to a free one. 

Check  out  the Most Popular  Downloads from DFF   (updated weekly)

First time visitor?

Take a look at the Introduction page to see what this site is about

Notes for Teachers




                                                             December 17, 2006      

Delphi For Fun Newsletter #44 


Merry Christmas!


If you celebrate a different  holiday this time of year, have a merry one of those too.  We have had a busy fall season without accomplishing much, but enjoying "most" of it.   One of the advantages of growing older I guess.  


We changed web site hosts in September, and all went relatively pain free.     One of the things lost in the transition was a mail list manager, so this is the first newsletter under an alternative program.  We'll see how in goes.   


Most of the programming activity this fall has been "fix-ups", but there were a couple of new programs, Bug Time Trials and Word Squares.  I'm three problems behind in Project Euler, but haven't yet felt like dedicating the hours necessary to find the solutions.  Finding the 7 unique solutions to "Kirkman's 15 Schoolgirls" problem is still on my to-do list.  And 2007 is the year I plan to  finally explore the ins and outs of Delphi 2006/Delphi Turbo Explorer and ".NET".   There are several web based programs  needed to automate the maintenance procedures for our AR Booksearch  project and the mailing list for this newsletter.    Other projects may go on the back burner for awhile but I'll try to post whatever interesting things I run across.   



Here’s what was posted in the spare hours between wood cutting, deer hunting, and doctor visits since last August:  


August 8, 2006: An enhancement suggested by a viewer was made to our two demo string grid sort programs: GridSort and Grid Quicksort.  They now consider multiple column widths when determining which column header was clicked.  As usual, a few other small bugs were corrected in the process.

August 11, 2006.Good news for Delphians and and those who might like to be.   Borland has just announced Turbo Explorer versions of several of its languages including Turbo Delphi Explorer will be available free of charge in September!    Professional versions will be sold, but free Explorer versions will give many more programmers and  potential programmers a chance to learn what Delphi is all about.   Their new website, has more information.  Check it out.

August 13, 2005:  Last year, I wrote a "Clear Blank Lines" program to fix a particular web page file that somehow had had thousands of extra short blank lines inserted.  A surprising number of users apparently have had similar problems including a recent viewer with hundreds of such files to fix.  Version 2, posted today, allows multiple files to be selected and processed in a single run.    

August 21, 2006:  Here's one just for the programmers in the crowd.  I needed to draw some information on TShape controls, but TShape does not support the OnPaint event. The  Paint on Shape demo program shows how do add the capability.  The image at left shows "nozzles" for a fountain simulator which needed identifying numbers painted on them.


August 29, 2006:  Windows rules!  The next time a friend gives you a hard time about being "stuck" in Windows,  or you see one of those Apple TV adds dissing Microsoft,  whip out this table:

The  8 most popular operating systems on the web are:


1. Windows XP 86.80%
2. Windows 2000 6.09%
3. Windows 98 2.68%
4. Macintosh 2.32%
5. Windows ME 1.09%
6. Linux 0.36%
7. Windows NT 0.24%
8. Macintosh Power PC 0.15%

Based on a global sample taken by   web analytics company of 2,000,000 customer's web page visits.   

August 31, 2006:  I posted a card shuffle test program yesterday.  A viewer had pointed out an error in the Shuffle procedure used in our Cards control.  If you were to shuffle a deck of cards, in  52 steps, by taking the top card from a deck and exchanging it with a random card in the deck, would it matter if you placed this new top card in another pile or moved it to the bottom of the deck?   Shuffle test answers the question.

OK, the answer is yes, there is a small bias using the 2nd method (my old way).  I updated the DFF library to DFFLibV07 with a corrected version of the UCardComponentV2.   This new library version also includes two other changes: The dictionary component unit, UDict,  used in a number of DFF word programs is now included in the library file.  And the Dijkstra Shortest Path search procedure  in the TGraphSearch unit can now call a "GoalFound" exit procedure when a shortest path is found.

September 11, 2006: We are almost back in business after being down for a week.  The old host had moved the web site to a new server which broke it and they did not seem able to get it fixed.  We are up today on a new host so we'll see how it goes.  Please use the feedback link to let me know if you see things that look strange or broken.  Note: The  Booksearch site requires a small update for each school which I will be doing today.

 September 12, 2006: 

Back to work.  Here's a little program , "Monitor Off" that  blanks the screen when the "Pause" key is pressed within any running program.  I use it to turn off the weather display on my  laptop before going to bed in the evening.  The weather program continues to collect data overnight.   A mouse wiggle in the morning  restores the screen.   It uses a Windows facility called Global Key Hook  which allows checking every key press.  I couldn't decide whether it was a "Utility" or a "Delphi-Technique", so it appears in both indices. 

September 23, 2006:  I posted a program to answer a viewer's  "Card Probability Question"  today..  The question: What is the probability of one or more occurrences of  two given card rank values being adjacent or with only one intervening card in a well shuffled standard 52 card deck?  The  program answers the question experimentally, I'll let one of you viewers send me the analytical solution.

September 29, 2006:    BugTimeTrials evolved from a vehicle simulation experiment.  When my prototype vehicle looked more like a ladybug, I decided to make a course and run time trials.    You can too.

October 4, 2006:  

A revision to our Cutlist program  (Version 3.3.1) was posted today to improve the handling of the popup menu used to maintain project data.  Cutlist calculates (or allows you to decide) how to fit a set of required rectangular parts for a project from an available list of supply pieces. 

October 9, 2006:  Spam at DFF is up to about 100 per day recently,  so I finally decided it was time to address the problem.   Spam-bots read website source html and harvest email addresses they find.   The two big offenders at DFF were the Newsletters and Feedback pages, both of which generate emails and previously contained email addresses in plain text.   They now use Delphi "server-side" programs to   build and submit the email.   The Feedback page  program also addresses one of my pet peeves - form email that does not send the submitter a copy.  Now, if you provide an email address when you submit feedback, you will be "cc'd" with what you sent me.   Subscribe/Unsubscribe options on the Newsletters page will also send you a confirmation when the "Submit" button is pressed after entering a valid email address.        

October 13, 2006:   Since publishing the Wind Triangle program in February, 2005,  I have had several pilots inquire about implementing an Excel spreadsheet version.   The triangle describes the correction necessary to offset  the effect of the wind on an airplane's desired  track and and to calculate groundspeed based on indicated airspeed.   

The typical problem they had was not realizing that the trig functions require  angles to be specified in radians instead of degrees.   Patrick C. recently sent his "Flight Planning Worksheet"  Excel file and I  fixed his calculation for True Heading and Ground Speed..  With his kind permission, I posted the spreadsheet file today as a prototype for the  next pilot  working on the problem.      





October 22, 2006:  Last month the question was  concerned the  the probability of one or more occurrences of  two given card values being adjacent or with only one intervening card in a  shuffled standard card deck?   The follow-up question is

Is it possible to make a deck where every card value is adjacent to or within one intervening card of every other value?

The answer is "Yes".  Program "Perfect deck" addendum posted today will find thousands of them.  Here is one:

With rows laid end to end , every card value is within two cards of every other value

October 31, 2006:  A  "CopyFolderTest" program was posted today which copies files in one specified folder to another with a fair number of options:

  • Filter the file names to be copied with a user supplied  file name mask.

  • Copy or ignore files in folders within the specified input folder. 

  • Choose one of several actions if the file already exists in the output file,

  • Reset the "readonly" attribute for files copied to the  target folder

November 6, 2006:  I finally got around to post an update to the DFF Play CD file, DFF Play  today.  The file is quite large, about 20 mb..     It has been a year since the last update to this collection of executable versions of my favorite DFF programs.   I added several more programs (75 now) and rewrote the "program loader" program  so it may work more smoothly if anyone actually runs the program from a CD.  

The original idea was to make a set of programs portable by burning them to a CD, but  the problem arises for those programs which want (or need) to write data to disk.   The new version uses the CopyFolder procedure posted last week to copy those programs and associated data to a user specified hard drive folder and runs them from there.  I confess that I have not rigorously checked all 75 for this condition, so use the feedback link if you find any that I missed.  

In the process, I corrected some typos in the documentation for a couple of  programs and reposted them:  Probability Distributions and BruteForce.    

November 8, 2006:  I exchanged an interesting series of emails recently with a fellow who used our Catapult Simulator program to help his daughter design a catapult for her high school Physics project.    Here is the story.


November 18, 2006:  Hunting season is open here which has taken time away from programming for the past week.  But I have been communicating with an 82 year old fellow who, among other hobbies, decrypts messages, "just for fun".   A good example (I hope) that "use it or lose it" applies to brain power!  He had questions about two which he had solved but which our Decryption program program didn't.  It turns out that in one case, encoding errors for "this", "that" and "the" stymied the program  (the human had filled in these words by context without bothering to do the character by character substitution).    The second case contained the plaintext word "northwards" which was not in my dictionary  but many other 10 letter words have the same letter in the 3rd and 8th positions so the search was long.  I'm not sure how Frank cracked that one.

I made a couple of program changes to help the user in cases where a message is not decrypted in a reasonable amount of time.   Words can be temporarily removed from the decryption by un-checking a checkbox entry.   Also specific plaintext words which appear to be leading the decryption down the wrong track can be added to an "Ignore Words" list.   Version 3 of Decrypt is now part of WordStuff2 program.  There is also an updated set of dictionaries, (including "northwards"), available from that page.

November 27, 2006:  With two deer in the freezer,  we now have enough venison for the coming year, so my wife says I'm through for this season.  We had a great Thanksgiving with most of the kids and grandkids here so, again, a week without much time for programming.   I did fix some documentation  errors for our write-up of the Mastermind program.  Thanks to sharp-eyed viewer Dave H. for spotting the errors.

December 2, 2006:  A new word puzzle is available today.  Word Squares is based on puzzles found several times a year in our  Mensa Page-A-Day Puzzle Calendar.   Player must complete a square grid of words, each word running both vertically and horizontally and using all of a given set of letters. A example is shown at right:  The starter word is "FIND" and three additional 4-letter words must be formed beginning with the letters  I, N, and :D and containing the 9 letters: "AADEEETTX".   The program will generate random puzzles, allow you to solve them or show show you the solutions when you get stuck.  Grids may be 4x4 or 5x5.  The 5X5 grid increases the chance that you will be using that "I give up" button!  

December 6, 2006:  Charles Doumar has done much of the follow-on development in our unit for very large floating point number arithmetic, UBigFloatV2.  His latest additions were posted today in a new version of the DFF library zip file, DFFLibV08.   The BigFloat Test program was also reposted with tests for some  of the new methods, specifically for calculating natural and base 10 logarithms, a Power function (xy) and Exp, to calculate ex for very large numbers.

The library file contains a number of units in addition to UBigFloatV2.  Its purpose is to provide a common location for units which are used in multiple programs posted on this site.   This centralized location concept simplifies maintenance when changes are made to library units.  A number of units in DFFLibV08 have had minor updates:


UDict  dictionary unit now has a  DIC.INI file  to retain default dictionary path information from run to run for programs which use it.


In the Mathslib math unit, the TPrimes object for finding prime numbers now has new "radical(N)" function returning the product of the unique prime factors of N


UComboV2, a unit with a class to compute combinations and permutations had a minor change change to return 0 instead of 1  as the Count if the number of items to be combined or permuted is 0.


In DFFUtils, utility routines,  procedures ReformatMemo and SetMemoMargins  now handle TRichedit in addition to TMemo components.


As described above, UBigFloatV2  adds several new functions including Log, Log10, Exp, Power, Floor, and Ceiling functions along with several support functions.

December 7, 2006: There are a number of word related programs here on DFF that use a compressed dictionary  format for fast word retrieval.  A program Dicmaint is provided to maintain the dictionary.  . A small fix to Dicmaint (included on the Wordstuff2 program page) was made today.  For programmers it is significant that  an older version of the dictionary unit was  being distributed with the Wordstuff and Dicmaint source code.  As of today, the version contained in the DFF  library unit will be the only one distributed.  See the above link for more information;

Gary Darby


"In a time of drastic change it is the learners who inherit the future.  " Eric Hoffer (1902-83), U.S. philosopher. Reflections on the Human Condition, .

"If a man empties his purse into his head, no man can take it away from him.  An investment in knowledge always pays the best interest." -- Benjamin Franklin

To subscribe or unsubscribe from this newsletter, visit

171,000 home page visitors since Sept 2000.      380,000 program downloads in the past 12 months!

  [Feedback]   [Newsletters (subscribe/view)] [About me]
Copyright 2000-2014 , Gary Darby    All rights reserved.