Sunday, May 7, 2023

Pseudo Code File Logic: Open > New > Save > Save As

Just finished working out the logic for handling file logic:

File Open
File New
File Save
File Save As

This assumes you are keeping track of the following:

  • Current Filename
  • Changes to file data
I've been wrestling with this one for a few days. And then it finally hit me. "Hey, Exit can be your friend."

Exit can be your friend







Within the last year, my thinking has been influenced by Jeff Patton and his book "User Story Mapping". At work I have been involved in many meetings/discussions where everyone is in agreement that we need to implement "Solution X". However, everyone has their own interpretation of what "Solution X" is.

https://www.amazon.com/User-Story-Mapping-Discover-Product/dp/1491904909


Enjoy,
Semper Fi
Gunny Mike
https://zilchworks.com


Friday, March 24, 2023

Delphi FMX Desktop Development: Part 1

Question: Is FMX Desktop Development Worth It?

This is part 1 in a series dedicated to Delphi FMX Desktop development. I am in the process of converting an old VCL application to FMX. When I first started playing around with FMX I was excited because one code base could serve up all different platforms; desktop, mobile, tablet. FMX also let's you create Windows, Mac OSX, Android, iPhone apps from that same single code base.

It wasn't until recently that I discovered one code base doesn't easily translate between desktop and mobile. So I am focused solely on creating one desktop code base for Windows and Mac OSX. This is a conscious choice on my part to stay in the desktop market. 

Over the last 32 years I have had several Mac OSX users asking me when I would have a version of my software that would work on their computers. Delphi FMX will let me make this happen. 

This leads to a series of questions:

  • What does the desktop market share look like?
  • How many new Mac customers will this bring me?
  • Is it worth the effort to create a desktop application for both Windows and Mac?
  • How does geographical location influence the decision?

I would like to thank the people at statcounter GlobalStats for providing the information in this post. Visit https://gs.statcounter.com/ for more information.


"The Whole World's Gone Mobile!
Forget Desktop Development."



Let's start by looking at the Desktop vs Mobile vs Tablet market share. We are going to look at the past year and then look at the past ten years. This will show the huge growth in the mobile market.

Worldwide 1 Yr Mobile 60% Desktop 40%


Worldwide 10 Yr Mobile 16 → 60%↑ Desktop 82 → 40% ↓  


Looking at just this one graph you would think it's a waste of time to dive into the desktop market. On a world wide scale the mobile market has completely overtaken the desktop market. At first glance you might think, "Wow, it's not worth going after the desktop market. The whole world has gone mobile." 

"I Might be Ignoring 50% of the Users!"


What about the United States? Does geography play any part in my decision to create a desktop application? After all, the majority of my customers come from the United States.

USA 1 Yr Mobile 46% Desktop 52%



USA 10 Yr Mobile 15 → 46%↑ Desktop 82 → 52%↓


Because the majority of my customers are from the United States, and I'm only concerned with the Desktop market share, what do these numbers tell me?

Today, the Desktop market share in the United States is 52%. This tells me that 5 out of every 10 potential customers are desktop users. This also tells me that mobile use has skyrocketed over the past ten years, and my decision to only focus on desktop might be ignoring almost 50% of the users.

What about my decision to only focus on Windows and Mac OSX customers?

USA 10 Yr Windows 82 → 60% ↓ OSX 16 → 30%↑   

Here is what the Desktop Operating System landscape tells me looking at the past ten years. Windows is still the dominant operating system within the USA even though it has dropped 22%. On the other hand Mac OSX has almost doubled it's share of the market.

Overall, the prospects look good to invest some solid time and effort into creating a Desktop application that caters to both Windows and Mac users. As far as how many Mac OSX customers can I expect? 

These numbers tell me I can expect about 5 new Mac OSX customers for every 10 new Windows customers. And that sounds pretty good to me. 

Answer: It's worth it for me!

Use this link for all 32 videos from the Desktop First UX Summit 2021
https://www.youtube.com/playlist?list=PLDWPwIbHH6jldMmNDe99y9NDWiEl-B3jK

Enjoy!
Semper Fi
Gunny Mike
https://zilchworks.com



Sunday, February 19, 2023

DELPHICON 2023: Every APP Trick in Book with Ian Barker

DELPHICON 2023: Every APP Trick in the Book with Ian Barker 

Timestamp links have been added to each of the individual sections of this presentation.


Every App Trick in the Book
https://youtu.be/PJNnCP2JvIY?t=14829
https://github.com/checkdigits/Every_app_trick_in_the_book_-_Ian_Barker
https://blogs.embarcadero.com/delphicon-2023-every-app-trick-in-the-book/

Notifications
https://youtu.be/PJNnCP2JvIY?t=15208

Elevation Button (VCL Only)
https://youtu.be/PJNnCP2JvIY?t=15443

ShellAPI
https://youtu.be/PJNnCP2JvIY?t=15705

Settings Persistence
https://youtu.be/PJNnCP2JvIY?t=15857
TPath

User Authentication OAUTH2
https://youtu.be/PJNnCP2JvIY?t=16100
TMS SOftware Sphinx (€395 - €595)
https://tmssoftware.com/site/sphinx.asp
eSeGeCe OAuth2 Client (€349 - €649)
https://www.esegece.com/websockets/http/oauth2

NEW User BioMetrics
https://youtu.be/PJNnCP2JvIY?t=16484

Check for Internet Conncetion
https://youtu.be/PJNnCP2JvIY?t=16922

Splash Screens
https://youtu.be/PJNnCP2JvIY?t=17115

Adding Some Coolness
https://youtu.be/PJNnCP2JvIY?t=17317
http://tinyurl.com/delphiwowfactor

Themes and Styles
https://youtu.be/PJNnCP2JvIY?t=17350
http://tinyurl.com/delphiw11design

Detecting Dark Mode (and Reacting when it changes)
https://youtu.be/PJNnCP2JvIY?t=17369
https://blogs.embarcadero.com/modernize-your-app-are-you-handling-windows-themes-correctly/

Checking for Updates
https://youtu.be/PJNnCP2JvIY?t=17390
https://blog.marcocantu.com/blog/auto_updating_programs.html (2007)

In-App Scripting
https://youtu.be/PJNnCP2JvIY?t=17498
Python4Delphi
https://github.com/pyscripter/python4delphi
TMS Script Studio Pro (€190 - €630)
https://www.tmssoftware.com/site/scriptstudiopro.asp
DWScript
https://github.com/EricGrange/DWScript

Single Instance
https://youtu.be/PJNnCP2JvIY?t=17640
https://stackoverflow.com/questions/73023379

Manipulating Images
https://youtu.be/PJNnCP2JvIY?t=17767
https://skia4delphi.org

To the Web
https://youtu.be/PJNnCP2JvIY?t=17863
uniGUI ($395 - $890)
https://youtu.be/fN4m-a-C64o
IntraWeb (€399 - €2,399)
https://www.atozed.com/intraweb/
TMS WEB Core (€395 - €1,295)
https://www.tmssoftware.com/site/tmswebcore.asp
https://youtu.be/u-8yjKO3AyM

Let's Encrypt - Free SSL Certificates
https://youtu.be/PJNnCP2JvIY?t=17954
https://letsencrypt.org
Pault Toth Delphi ACME
https://github.com/tothpaul/DelphiACME

Reverse Proxy via NGINX
https://youtu.be/PJNnCP2JvIY?t=18086
https://mginix.org

Enjoy
Semper Fi
Gunny Mike
https://zilchworks.com

Saturday, February 18, 2023

DELPHICON 2023 - User Interface Design with Actions by Ray Konopka

Konopka does a fantastic job showing how to streamline the User Interface using Actions. This is a must see video from DELPHICON 2023.

He starts out showing the typical way of coding in Delphi by using onClick events on Buttons and Menus. He then shows how to build an ActionList from scratch, using Categories and Actions. He then ports all the onClick events to Action onExecute events. He also imparts the knowledge he's learned over the years as to why this is the best way to code a user interface. Absolutely brilliant.

Every time I watch Konopka give a presentation I learn something. It's amazing to watch a master demonstrate his craft. 


Video presentation link:
https://youtu.be/PJNnCP2JvIY?t=7483

Source code link:
https://delphibydesign.com/downloads/

Enjoy!
Semper Fi
Gunny Mike
https://zilchworks.com

Sunday, February 12, 2023

Use ChatGPT to Convert Other Language Source Code to Delphi

If you've read some of my previous posts you know how much I've struggled to make the paradigm shift from being a top-down, procedural programmer to an OOP programmer. I've purchased several books on OOP. And one book series I thought would hold some promise are "The Object-Oriented Thought Process" books written by Matt Weisfeld. I have four different editions on my book shelf.

I struggle with OOP for several reasons. One very frustrating reason is the lack of Delphi/Pascal examples used by authors. Most of the code examples are written in Java, or C, or C# or some language other than Delphi/Pascal.

The last bullet point on page 3 of Weisfled's fourth edition, listed under the heading of "What's New in the Fourth Edition", states:

  • Expanded code examples, for certain chapters, in Java, C# .NET, VB .NET, and Objective-C available online on the publisher's website

No Object Pascal or Delphi examples!

No Object Pascal or Delphi examples. I reached out to Weisfeld asking if he might include Object Pascal examples and received a negative response.

I love Pascal. It's elegant. It's easy to read and understand. I've been using Pascal/Delphi since 1985. (2023-1985=38 years). Besides SQL, it's my main programming language. Ok, I confess, I did Active Server Pages (APS) and VB Script for about 10 years.

I've tried loading Java onto my machine so I could follow along and learn the OOP concepts but I just can't wrap my head around the Java syntax.

Today, I discovered the answer that works for me. ChatGPT!

I asked ChatGPT to convert the following Java code from page 24 of "The Object-Oriented Thought Process" to Delphi and the results were very hopeful.

public class IntSquare {

  // private attribute
  private int squareValue;
  
  //public interface
  public in getSquare (int value) {
    
    squareValue = calculateSquare(value);
    return SquareValue
  
  }
  
  //private implementation
  private int calculation (int value) {
    return Math.pow(value,2);
  }
}

Here are the results returned from ChatGPT:

type
TIntSquare = class
private
FSquareValue: Integer;
function CalculateSquare(value: Integer): Integer;
public
function GetSquare(value: Integer): Integer;
end;

implementation

function TIntSquare.CalculateSquare(value: Integer): Integer;
begin
Result := value * value;
end;

function TIntSquare.GetSquare(value: Integer): Integer;
begin
FSquareValue := CalculateSquare(value);
Result := FSquareValue;
end;

end.

I know the results are not the indented and formatted code you would get from inside the IDE. This was my first attempt at using ChatGPT. I took several screen shots of my interaction with ChatGPT so I can show you what happened.

Here is my entire ChatGPT session:






Here is the final output from ChatGPT.

uses
  System.Math;
  
type
  TIntSquare = class
  private
    FSquareValue: Integer;
    function GetSquareValue: Integer;
    procedure SetSquareValue(const Value: Integer);
    function CalculateSquare(value: Integer): Integer;
  public
    property SquareValue: Integer read GetSquareValue write SetSquareValue;
    function GetSquare(value: Integer): Integer;
  end;

implementation

function TIntSquare.CalculateSquare(value: Integer): Integer;
begin
  Result := Round(Power(value, 2));
end;

function TIntSquare.GetSquare(value: Integer): Integer;
begin
  SquareValue := CalculateSquare(value);
  Result := SquareValue;
end;

function TIntSquare.GetSquareValue: Integer;
begin
  Result := FSquareValue;
end;

procedure TIntSquare.SetSquareValue(const Value: Integer);
begin
  FSquareValue := Value;
end;

end.

This looks very promising! Give ChatGPT a try converting code.
https://openai.com/blog/chatgpt/


Enjoy!
Semper Fi
Gunny Mike https://zilchworks.com

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 (https://calibre-ebook.com) 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)

Enjoy,
Gunny Mike
https://zilchworks.com

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. 
http://delphiexamples.com/systeminfo/envtrings.html

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
BDSAppDataBaseDir=BDS
BDSBIN=C:\program files (x86)\embarcadero\studio\22.0\bin
BDSCatalogRepository=C:\Users\Mike\Documents\Embarcadero\Studio\22.0\CatalogRepository
BDSCatalogRepositoryAllUsers=C:\Users\Public\Documents\Embarcadero\Studio\22.0\CatalogRepository
BDSCOMMONDIR=C:\Users\Public\Documents\Embarcadero\Studio\22.0
BDSINCLUDE=C:\program files (x86)\embarcadero\studio\22.0\include
BDSLIB=C:\program files (x86)\embarcadero\studio\22.0\lib
BDSPLATFORMSDKSDIR=C:\Users\Mike\Documents\Embarcadero\Studio\SDKs
BDSPROFILESDIR=C:\Users\Mike\Documents\Embarcadero\Studio\Profiles
BDSPROJECTSDIR=C:\Users\Mike\Documents\Embarcadero\Studio\Projects
BDSUSERDIR=C:\Users\Mike\Documents\Embarcadero\Studio\22.0
DELPHI=C:\program files (x86)\embarcadero\studio\22.0
DEMOSDIR=C:\Users\Public\Documents\Embarcadero\Studio\22.0\Samples
FPS_BROWSER_APP_PROFILE_STRING=Internet Explorer
FPS_BROWSER_USER_PROFILE_STRING=Default
IBREDISTDIR=C:\Users\Public\Documents\Embarcadero\InterBase\redist\InterBase2020
IB_PROTOCOL=developer_ib2020
InterBase=C:\program files (x86)\embarcadero\studio\22.0\InterBase2020
Path=C:\Users\Public\Documents\Embarcadero\InterBase\redist\InterBase2020\IDE_spoof
ProductVersion=22.0
SESSIONNAME=Console

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: 

https://www.scootersoftware.com/

Enjoy,
Gunny Mike
https://zilchworks.com