Monday, December 5, 2022

The Kinetic Technique by H. A. Overstreet (1925)

Influencing Human Behavior by H. A. Overstreet was published in 1925. I purchased an old hardcover copy of his book over a year ago because, some other book I was reading referred to it as a master work. Overstreet's book has been sitting on my oak book shelf, which was built by a very nice Mennonite man in Maryland, ever since it arrived.

I spent the weekend of November 26th and 27th entering all my "print books" into a software program called Calibre ( which by the way, is mainly for managing E-books.

After saving the information from an ISBN import, I began reading. I stopped on page 12 after reading what Overstreet wrote about capturing one's attention using "The Kinetic Technique".

I stopped reading because this piece of wisdom so grabbed ahold of me, I wanted to let it seep into my mind.

Two days later on Tuesday morning at 1:45 AM I woke to a racing mind. "What book talked about a dot on the wall?" I kept searching, and searching my thoughts. Nothing.

"Ah, the influencing human behavior book."

Why was this so important that it woke me up? My website (read that as I) totally violated the principle of movement. Every page on my website has the same big-ass banner. I was making all my visitors (read that as potential customers) stare at a dot on the wall. How boring is that.

I jumped out of bed right then and there and started working on removing the dot from my website. It took me a few days, but I managed to get rid of that dot. But more importantly, I learned a valuable lesson from some ink that was printed nearly 100 years ago.

Thank you Mr. H. A. Overstreet. I can't wait to see what else of yours seeps into my mind.

Influencing Human Behavior - H. A. Overstreet (page 12)

Gunny Mike

Monday, July 11, 2022

Delphi Tip of the Day - Environment Variables used only by the Delphi IDE

 I wanted a quick, down-and-dirty, reference to only those variables used by the Delphi IDE. Inside the IDE you can navigate to Tools > Options > IDE > Environment Variables. This will list all the Environment Variables currently in use. Those belonging to Delph and those outside of Delphi. However, that is not what I was looking for. I just wanted the Environment Variables specific to the Delphi IDE.

Generating this list was a three step process which involved some code I found here.

Step 1. I entered and ran the code from the above link. I then copied and pasted the contents of the memo to a separate text file called EnVars-Delphi-IDE.txt.

Step 2. I closed Delphi and ran the program again from the saved location. I then copied and pasted the contents of the memo to a file called EnVars-Without-Delphi-IDE.txt.

Step 3. I then navigated to the Delphi BDSBIN location and ran the Beyond Compare utility BCompareLite.exe. I did a text compare of  EnVars-Delphi-IDE.txt and EnVars-Without-Delphi-IDE.txt looking only for the differences.

I simply copied all the text from the left-had side and saved it as EnVars-Delphi-IDE-Only.txt. And know I have my quick down and dirty list of Delphi IDE Environment Variables.

Here the list generated from my computer. YMMV

BDS=C:\program files (x86)\embarcadero\studio\22.0
BDSBIN=C:\program files (x86)\embarcadero\studio\22.0\bin
BDSINCLUDE=C:\program files (x86)\embarcadero\studio\22.0\include
BDSLIB=C:\program files (x86)\embarcadero\studio\22.0\lib
DELPHI=C:\program files (x86)\embarcadero\studio\22.0
InterBase=C:\program files (x86)\embarcadero\studio\22.0\InterBase2020

Beyond Compare is a fantastic tool written with Delphi. The lite version is included with your purchase of Delphi. For more information about Beyond Compare visit their website:

Gunny Mike

Saturday, June 4, 2022

Delphi Tip of the Day - Auto Adjust FMX StringGrid Column Widths

 I've been playing around with the FMX StringGrid for the past three weeks. And I thought... 

"Wouldn't it be nice if there was a way to automatically resize the column widths based on the values in each of the columns. Just like the way Excel works when you highlight the entire sheet and double-click the thin line between two columns."

In today's Delphi tip of the day I present a simple routine that evaluates the data in each of the column headings and the columns of each row to determine how wide to make the cells. And the best part is, it automatically adjusts all the columns widths in one go.

"Just like the way Excel works..."

It's fairly straight forward using two for loops. It loops through each column looking at every row and determining the width that column needs to be based on the data in each cell.

procedure AutoAdjustColumnWidths(const Grid : TStringGrid);
  col : Integer;  //Grid Column
  w   : single;   //New Width
  s   : string;   //Grid Column value
  l   : Integer;  //Lenght of Grid Column value
  row : Integer;  //Grid Row
  r   : Single;   //Result of TextWidth calculation
  for col := 0 to Grid.ColumnCount-1 do
    w := 0;
    s := Grid.ColumnByIndex(col).Header;
    l := length(s);
    w := Grid.TextWidthToColWidth(l,s) * 1.05; //add a little padding
    for row := 0 to Grid.RowCount-1 do
      s := Grid.Cells[col,row];
      l := length(s);
      r := Grid.TextWidthToColWidth(l,s) * 1.05; //add a little padding
      if r > w then
        w := r;
    Grid.Columns[col].Width := w;

I'm sure this can be improved upon so it only evaluates the first 50 or 100 rows. I'll leave that up to you to figure out.

Gunny Mike

Monday, February 21, 2022

Book Review: The Hungry Brain

The Hungry Brain points out how the brain works. The brain (your brain) is conditioned by past food choices and conditions you to make future choices. There are strong cues at play and the stronger ones win. Most of what happens is nonconscious. The author credits Daniel Kahneman, author of "Thinking, Fast and Slow" for the two brain systems. System 1 which is fast, effortless, intuitive, and nonconscious. System 2 which is slow, effortful, rational, and conscious. System 1 usually wins when it comes to food choices.

I was surprised by how food decisions are made in the brain and how the brain continuously reinforces those decisions. I was also stunned to discover how irrational our/my thinking can be. This supports the two systems Kahneman describes. For example; "The 1970 Stanford Marshmallow Experiment" gave children the option of one marshmallow now (which sat on a table right in front of them) or two marshmallows in 15 minutes. The kids were basically given a choice of a small reward now or a larger reward in the future. Most kids ate the one marshmallow right away. We/I tend to value the now more and the future not so much. This is a psychological trait called "delay discounting".

This book is a very technical read

I know I am one of those people who do/did not value my future self. I started smoking cigarettes when I was twelve. As an adult I smoked two and one-half packs of cigarettes a day. One day, after 32 years of smoking, I finally quite "cold turkey". As a smoker I totally discounted my future health. I've been smoke-free for 20+ years. For me, it's time to refocus on my future self and lose the weight. While a brown sugar cinnamon pop tart will definitely give me a 10 minute pleasure high it does not help my future self one bit. 

This book is a very technical read. You could probably get away with reading only chapters 10 and 11. However, you would miss out on some of the little stories sprinkled throughout the other chapters. 

This book has caused me to want to read two other books. The first book, which I purchased, is "Thinking, Fast and Slow" by Daniel Kahneman. I was originally introduced to Kahneman a few years back. I'm very much interested in storytelling and Kahneman links effective storytelling to emotions not rationale. So I am very interested in learning more about the two brain systems. 

The second, which I checked out from the library is "Salt Sugar Fat" by Michael Moss. I've had a tacit understanding that processed foods are the new crack cocaine. I figure by reading this book two things will happen: 

  1. I will change my perspective on processed food and see them for what they truly are. 
  2.  By learning exactly how food scientists tweak the salt, sugar, fat ratios every so slightly to keep their food irresistible, I will view these foods as traps, and see myself for what I really am... nothing more than a commodity (a tick mark on the balance sheet).

Please use the comments to give your recommendations for other, related books worth reading.

Semper Fi
Gunny Mike 

Sunday, January 16, 2022

Book Review: Delphi GUI Programming with FireMonkey (Part 1)

I purchased the book Delphi GUI Programming with FireMonkey by Andrea Magni on November 7, 2020. I dove in head first with great enthusiasm only to get derailed early on. It happened when I tried to follow the topic Understanding the Style Designer in chapter 2.

As someone who knows almost nothing about FireMonkey these four and one-half pages soured my learning and turned me against this book and it's author. I tried reaching out to the author directly and received a curt response basically telling me that the examples in his book were not meant to be step-by-step. From that moment on I let this book sit on the shelf and collect dust.

That was a foolish mistake on my part. 

The Style Designer is a central part of FireMonkey and FMX. It is my opinion, that the author introduced this complex topic much too early in the book. It was presented with just a small smattering of knowledge and guidance. Leading me to three days of frustration because I could not make the Style Designer match what I saw in the book. The style designer is much too complex a topic to simply be glossed over in this fashion. A more fitting title for this topic would be First Glance at the Style Designer.

Don't Judge a Book by Only 4 Pages

If you are new to FMX and FireMonkey, and you want to get the most out of this book, I highly recommend you skip the topic Understanding the Style Designer in Chapter 2 (print: 34-38, pdf: 31-35). No understanding will happen. Instead, I recommend you watch this 50 minute YouTube video by Ray Konopka called Customizing Controls with FMX Styles.

After you have a better understanding of the FMX Style Designer, you may want to come back to the topic Understanding the Style Designer in this book.

You can best sum up my attitude about this book (and it's author) by the phrase "Don't judge a book by only 4 pages". I owe Magni an apology for holding a grudge against him because of 4 stinkin pages (and one email) in a book. 

"Andrea, I'm sorry."

I finally picked up Magni's book (again) last week. Actually I did a search for "Live Bindings" of my digital Delphi books which lead me to pick up Magni's book of the shelf. I opened up to Chapter 4, Discovering Lists and Advanced Components to a huge surprise. The printed copy of my book went from page 104 to page 157. Pages 105 through 156 are missing.

I contacted Packt Publishing to let them know of the misprint. All is good, a new printed copy is on the way.

At this point I was committed and had to fall back on reading the PDF version of Magni's book. I recently had cataract surgery on both eyes so I was very hesitant. Reading PDF books and manuals always leads to eyestrain at best or headaches at worst. That's when I discovered you can customize the background and font colors of a PDF document. See my post "Tip of the Day - How to change the text color of a PDF document" for instructions on how to do this.

I'm only part way through Chapter 4: Discovering Lists and Advanced Components and so far, Magni had done a fairly descent job. I have downloaded the source code for this book. I find it very helpful to have Delphi up and running along side reading the customized PDF. I open the example projects and play along with the reading to get a better understanding. 

Magni has done a a great job organizing the source code for this book. There is a separate chapter containing projects for each chapter. Each project within a given chapter has it's own folder. It is very well organized. The folders seem to be named intuitively. However, I find it very helpful to rename each folder and preface each folder name with the page number. That way I can quickly associate which project goes with with page or section of the book. As a plus, any un-numbered folders means I haven't opened that project and most likely haven't read that section of the book in detail.

I'm not sure when or if I will get finished with Magni's book. I'm just glad I overcame my stubbornness and opened his book back up again. I do know I have a need to and look forward to learning the following:

  • Chapter 4 Discovering Lists and Advanced Components
    •  ListBox
    •  ListViews
    •  Treeviews
    •  Grids
  • Chapter 5 Using FireDAC in FMX Applications
  • Chapter 6 Implementing Data Binding
  • Chapter 7 Understanding FMX Style Concept
  • Chapter 8 Divide and Conquer with TFrameStand (Maybe)

Bottom Line: Buy this book. Skip pages 34-38 (print), 31-35 (pdf).

Semper Fi,
Gunny Mike

Saturday, January 15, 2022

Tip of the Day - How to change the text color of a PDF document.

I was reading Andrea Magni's book Delphi GUI Programming with FireMonkey and realized I am missing pages 105-156. Packt Publishing is having a new print copied sent to me. Anyway, the PDF copy of the book is 100% complete.
I've always dreaded having to read PDF books for two reasons:
  • I don't like the way the pages jump from one page to another
  • The standard black text on a white background hurts my eyes and makes them tired.
I recently discovered two things you can change about PDF books (documents) that have made a huge difference for me. 

One is smooth scrolling. I thought that all pdf's jumped from the bottom of the page to the top of the next page. Not true. This is a setting. 

The second thing I discovered is the ability to change the color of the text within a pdf document. The standard black text on white background rally hurts my eyes. By changing the background and text color it is much more enjoyable to read.

This video shows you how to set smooth scrolling and change the text and background colors within a PDF document.

Gunny Mike