Delphi For Fun Newsletter #78
October 7, 2015
Delphi For Fun Newsletter #78
We are seeing signs that Winter is on its way; no frost yet but the Whitetail deer have changed their red summer coats to the gray winter versions while the maples are changing from green to red, orange and yellow. We survived 24.9 inches of rain in 10 days from September 25. Living on even a small mountain has it's advantages when it comes to flood damage. What rain didn't soak in just flowed downhill to the creeks. Unfortunately, some of that water likely ended up in someone else's basement but they have convenience advantages we don't have so maybe it (almost) balances out J.
Programs this quarter included a few puzzle solvers, a couple of utility programs and some programming related postings. I've cracked the solving algorithm for the "Double Word Squares" program (see August 30 post) that I've worked on for two months, but I didn't like the user interface, so maybe it will get posted this month.
July 8, 2015:
Chess PGN (Portable Game Notation) is a widely used format for recording chess games for historical or study purposes. There are many playback programs available and the world didn't need another. However a DFF viewer requested it about 10 years ago and I couldn't locate an existing one in Delphi, and it sounded like (and was) an interesting project. Chess PGN Version 5,2 posted today has a small change which doesn't change the executable results but prevents aborted execution after recompiling with data range checking.
July 17, 2015: A couple of years ago I posted a bulk Find and Replace program which would scan text files in a given folder which match given file name mask and change all occurrences of a given string to a new replacement string. I recently needed to process a set of files of email addresses and replace all "@" characters with commas (",") so that Excel could automatically break out the website address parts into a separate column. The files happened to be in Unicode character format (2 bytes per character) which my program didn't handle correctly. Find and Replace Version 2 posted today corrects that. Both ANSI and Unicode character files can now be processed correctly.
July 28, 2015: A fellow Delphian recently asked if it was possible to highlight a particular word wherever it occurred in a DBGrid. I gave him some suggestions but didn't hear, back so I decided to try it for myself. I used a StringGrid to create a demo in our Delphi Techniques section which should transfer to DBGrids. As usual (and thankfully), there were a few unexpected complications to sharpen problem solving skills and keep programming fun. Check out the GridWordHighlight page for more information and downloading the code.
August 23, 2015: Most of this month has been spent on outdoor activities. Due to generous rainfall and moderate temperatures this summer, trees and shrubs have tried to take over driveways, trails and yards. With my trusty chainsaw and a new wood chipper, I have almost broken even in reclaiming the space that nature is trying to confiscate. Of course, she will always win in the long run.
Which reminds me, my book-of the-month is The Canon by Natalie Angier. It really is "A Whirligig Tour of the Beautiful Basics of Science".. She is something of a wordsmith, but the knowledge conveyed here reminds us of what an infinitesimal part of the universe we represent. For example, our rather small sun is one of billions but still converts 700 million tons of hydrogen to helium every second, has done so for 5 billion years, and will do so for 5 billion more before it runs short of fuel and starts its expansion to a giant red star! Highly recommended.
Of course, I have also kept up this month with the daily Mensa Calendar puzzles. Here's an interesting one from August 18, which can be solved with the aid of our Brute Force algebraic equation solver.
Nine Knights numbered 1 through 9
are seated at the Round Table in such
a way that every knight's number is
at least 3 higher or lower than its
adjacent neighbor. Also, the two
knights at the end of the horizontal line
sum to an even number. With knights
2, 6, and 8 seated as shown, seat the
rest of the knights,
The unique solution can be found by assigning variables to the missing positions and defining equations using Absolute Value (abs) and Modulo (mod) functions. The puzzle file is now included in the Brute Force downloads as Mensa-08-18-15.prb
August 30, 2015:
I have been working without success on an upgrade to our Square Word Grids program to improve the search algorithm for 5x5 double word squares. "Word Squares" are N x N square word grids consisting of the same N words each containing N letters running horizontally and vertically. "Double Word Squares" are similar except that the words in each direction need not be the same. The program search for the solution to the puzzle illustrated here ran for 10 hours without success. My September project will be to crack this nut.
In the interim, I updated the "Crossword Helper" (aka "Word Completion") to version 2.21 to allow completing partial words using only letters provided. This allowed me to complete this puzzle with a little extra effort. The Wordstuff wrapper download includes the revised Crossword Helper program.
September 8, 2015: No joy yet on the Double Word Squares Solver described last time. In the meantime though, today's calendar puzzle is a logic problem about 3 girls and the ordering of number of train rides taken and countries they visited. I worked on it for about 15 minutes before deciding to revisit my Logic Problem Solver program. Another 15 minutes entering the problem and encoding the facts and rules produced the solution. The problem is now included in the Logic Solver downloads as Girls_Visiting_Europe.prb. The program by default runs in User mode, providing you with the problem and variable names and possible values predefined. It's up to you to enter facts and rules using program templates. (For example: from the given statement "Betty has not taken the most train rides", we can deduce and enter the fact "Betty isn't T3" where T3 is shorthand for the person with the most train rides.) The program's "Author" mode will give you the 3 facts and 2 order rules that I fed the program to produce the solution.
September 13, 2015: The anagram feature of the Word Completion section of our Wordstuff wrapper program was preciously only available if no words were found when filling a single missing letter. A recent puzzle required finding anagrams even when there were words found without anagramming. Word Completion Version 2.3 adds a check box to force anagram searches in either case.
September 20, 2015:
We have more trees on our
property than I can ever use for firewood. A small sawmill has long been
on my wish list, but its cost makes it a toy that's hard to justify. A
horizontal band mill (bandsaw laid on it's side and mounted on a
track) is the most common type for small operators and prices start at a few
thousand dollars. For this mill type, logs lie on the bed and are rotated
as required to cut boards and beams. As a substitute for a mill, I wrote a program
several years ago to display log sawing patterns for use on on my non-existent
horizontal band mill. Requests from two real saw mill owners this week led
me to revisit the program. Log Saw
Patterns V1.2 posted today fixes a small bug which subtracted blade
thickness twice for some cuts when
cutting around a fixed width cant. I also added the ability to save and reload
setup parameters by name reference. The guys have more good ideas for
improvement which will appear in a future version.
September 24, 2015: A fellow Delphi programmer recently inquired about writing code to control the master volume level on a Windows PC. I searched online and found the key unit (MMDevAPI) connecting the Delphi code to the Windows internal volume control routine online. Here's a Master Volume Demo which includes the MMDevAPI unit and a demonstration program to verify that it works.
DFF News #1, September 17,2000: "God gives every bird his worm, but He doesn't necessarily throw it into the nest." (P. D. James, British mystery writer)
DFF News #2, September 27,2000: I think, at a child's birth, if a mother could ask a fairy godmother to endow it with the most useful gift, that gift would be curiosity. -- Eleanor Roosevelt
DFF News #3, October 8, 2000: If you find something you love doing as you're growing up, look hard to see if you can make a living at it instead of giving it up for something more sensible. -- Jennifer Lamb (stuntwoman)
#4, October 16, 2000:
My favorite Latin quote: Quidquid latine dictum sit, altum
(If it's in Latin, it's obviously important )
310,000 site visits and 347,000 program downloads in the past 12 months!
Copyright © 2000-2017, Gary Darby All rights reserved.