HOME


Learning to program in Delphi
Pascal Tutorial and source code
Introduction and Index page


Updated May 11, 2003

If you are looking for a beginners tutorial to programming in general and Delphi in particular, and you wound up here, you might want to consider visiting one of the following sites instead...

Delphi Lessons ... a site that attempts to cut through the details and cut to the chase...

Teach Yourself Delphi in 21 days ... an online version of the older Delphi 4 Book...

The Delphi Dolphin

Essential Pascal

About.com's Beginners Delphi Tutorial


I have some Software on line on this page ...

IMPORTANT NOTE : someone has just sent me an email pointing out that when you use FindFirst to scan a disk, you should conclude the function or procedure by including FindClose which frees the memory that FindFirst uses. The disk scanning examples included below often include FindFirst and you should remember to add FindClose at the end of these procedures and functions to avoid MEMORY LEAKS. When I get some free time I will have to update those pages, but for now I post this notice...


Most of this site has nothing to do with Delphi, so I have posted zip files which are quicker to download than spidering a site...Note that if you download an earlier zip file, it will overwrite the index page in the later file. To correct this problem you can save this index page you are currently viewing to disk, which will always be up to date...If you download this page the following is a link back to this page on the Web Delphi Index page (the page you are currently viewing)



Zip Files


Download a zip file of this folderPart one (75 KB)

Download a zip file of this folderPart two (64 KB)

Zip file number 3 (175 kb)

delphi4.zip 131 KB (January 25, 2003)

The Developers image library zip files ... including the Dlls opend.zip 377 KB or with only the project and header files openh.zip 97 KB...

Part One


Use a simple recursive function to scan a disk and subdirectory for files - Delphi Pascal Source Code, June 25th, 2001

Insert values in a binary tree using a scan for disk files as an example - Delphi Pascal Source Code, June 25th, 2001

Using Selection sort on array and TStrings type - Delphi Pascal Source Code, June 30th, 2001

Batch loading numbered filenames - Delphi Pascal Source Code, July 9th, 2001

Implementing a LIFO stack using a linked list - Delphi Pascal Source Code, July 9th, 2001

Destroying a linked list using a recursive procedural call - Delphi Pascal Source Code, July 9th, 2001... Note that the correct way to dispose of a linked list is by using an iterative procedure...Using an iterative procedure to delete a linked list

Converting a hexadecimal number in string format to a valid integer - Delphi Pascal Source Code, July 11th, 2001

Creating a Sorted Linked List, popping items off the list, destroying the list with dispose - Delphi Pascal Source Code, July 11th, 2001

Converting Windows font sizes to HTML font and headers sizes - Chart and source code - Delphi Pascal Source Code, July 11th, 2001

Recusively search for all directory and subdirectory folders from a given starting point and insert the results into a binary tree - Delphi Pascal Source Code, July 20th, 2001

Using recursion to dispose of a binary tree and free its memory - Delphi Pascal Source Code, July 27th, 2001



Part two - January 6th, 2002


The Bitmap file format, directly loading a bitmap

Using the API to extract and then display icons ...icon_extract.txt or you can download the source as Delphi 3 / Delphi 5 project file ... icon_extract.zip (8 KB)

Extracting the Icon associated with a certain file extension from the Windows registry. The Delphi 3 version as a text file ... icon_registry_d3.txt ... The Delphi 5 version as a text file ... icon_registry_d5.txt or you can download the code as a Delphi 3 / Delphi 5 project file ... icon_registry.zip (11 KB) ... In the file above the routine is implemented as a procedure with Error message dialogs popping up in the codee to indicate where you need to handle errors. However I have rewritten this routine as a function. When the Icon extraction from the Registry fails, the function returns '0', which indicates that you need to extract the default icon (icon number 0) from the Shell32.dll. icon_registry_function.txt - Delphi 5 or ... icon_registry_function_d3.txt

Reading an icon file from disk, the Icon File Format

Saving an Icon, bypassing Delphi's save and load functions



Part three - Updated March 9th, 2002


Creating an Icon Cache file for a program

A brief discussion of how AND / XOR operations are combined to paint images (like Icons) transparently to the screen.

Using recursion to scan a disk for folders and files and adding them to a Delphi TreeView

Using an array to quickly index and quickly search a large linked list - using a divide and conquer strategy code can be written that emulates how people search for things in phone books to quickly search large linear data structures.

Using Shell sort to sort an Array

Converting 16 color pixel data between images of different resolutions

Resizing a graphic

Creating thumbnail graphics

Using an iterative procedure to delete a linked list

Resizing a graphic



Part four - Posted June 15, 2002


Understanding C++ Code for programmers in Delphi Pascal - Index page

In addition to the discussion of C++ on this page, I have also included some examples of programs translated from C++ source code to Delphi to illustrate some of the points made in the articles linked to from this index page, and I post links to them below as they appear...

Translating C++ code to create a grey scale histogram June 16th, 2002

Part five - Mathematics for computer programming - Begun June 22, 2002


Vectors - June 22, 2002

Summation mathematics - June 22, 2002

Matrix Algebra - June 22, 2002



Part six - more assorted code


How to enumerate all registered file types in the Windows registry ... Added November 30th, 2002

Changing the default program used to launch a certain file type based on the file association in the registry ... Added January 25, 2003...In this simple example the application will become the default for text files, displaying any text file clicked in Windows Explorer in a simple Memo component. You will need to drop two buttons and a memo onto a form and then paste in the code from this text file (remembering to click the buttons to initialize the click event code).

A project which implements a single purpose calculator to do the linear algebra involved in calculating the CIE Color Matching Function. ... April 21, 2003


Components


Using the Open Source Developers Image Library with an inherited OpenDialog ... Added October 13th, 2002

Emulating the Windows XP look using standard forms ... May 11th, 2003


Code samples index page



Home




A Unified Field Theory

failed_gravity_theory.gif - 10361 Bytes



The Unified Field Theory
is also available as a zip file ->
unified.zip

Introduction :The Pioneer Effect and the New Physics. A brief description of the new physics required to explain the 'Pioneer Effect', which is the constant deceleration of space craft as they fly through space.




Principles of Evolution: A Study in the Evolution of Bedbugs



A couple of years ago my bedroom was invaded by bedbugs. There were two variant genetic lines. One type of bedbug was an enlongated, thin, tubular insect, and the second genetic line was a flat, perfectly circular insect. The result of the cross breeding of these two genetically distinct variants was the production of a bedbug with charcteristics of both, an enlongated, flat bedbug with a central bulge (such that the shape of the bedbug was somewhere between 'long' and 'circular'). The long skinny bedbugs were such strange and unfamiliar looking insects that at first I did not recognize them as being bedbugs, and considered them to be a seperate species of insect. However, as the photographs of bedbugs above indicate, enlongated and skinny bedbugs are not uncommon, and the photographs also show the variants that are produced by genetic combinations that result in an insect somewhere in between 'circular' and 'enlongated'.

Therefore it is my hypothesis that evolution occurs by means of the transfer of dominate genes, with the production of such dominant genes being the product of 'biological algorithms', a genetic software program that brings physical characteristics into harmony with behavior, such that when behavior changes, and a conflict then exists, this acts as a trigger and causes the release of dominant genes. The result is rapid evolution of species. The bedbug is a relatively new insect, not the product of millions of years of evolution but rather an insect that is evolving in real time. The newly emerging dominant form of the insect is the flat, round ciruclar insect, well adapted to living in human bedrooms (it is flat, rather than tubular, thus allowing it to hide in the smallest cracks, living a stealthy lifestyle, and it is round, which gives the insect a maximum storage capacity such that it must endanger itself only a few times a month by emerging to feed.

Other examples of rapid evolution include the development of long legs in an invasive species of toad in Australia. As the toads move into the mountainous regions of Australia, and their behvaior changes, making them 'climbing toads', over the course of just a couple of decades the toads in the highlands have grown long legs specially adapted to climbing. It is worth noting here that the toads are poisonous, and are a successful invasive species because they have no natural predators in Australia, and so it would not be the case that the toads with long legs were 'the fittest survivors', because all the toads are survivors, and therefore predation does not explain the rapid emergence and spread of such well adapted, long legged toads. Once again we see evidence for the existence of biological algorithms and the rapid spread of dominant genes through a population, which once introduced proceed to overwhelm the older genes which are being replaced (making toad long legged and a bed bug round and flat).


A Theological Experiment

My interest in pursuing the Unified Field Theory is spurred on by my need to discover the theoretical explanation of a new form of propulsion (as explained on this page: Why the Unified Field Theory?). The experiment involving the bedbugs came out of nowhere.

I also believe that it is possible to justify theological propositions using experimental methods. If a thing is an objective truth then it can be verified and proven true by means of experimentation. Such a theological proposition is of more value than a ‘divine revelation’, since such revelations depend upon nothing more than establishing authority figures which requires the creation of artificial hierarchies, for the only reason why I might be encouraged to believe an authority figure who orders me to believe unsubstantiated opinions is if I could somehow be convinced that this authority possessed a mind that was somehow superior to mine, and thus was fit to express opinions as though opinions were unquestionable facts and thus worthy of being elevated to the status of absolute dogma.

There is a self evident human inequality which is visibly apparent. Some people are ‘beautiful’ and thus are the true elite on this planet, and some people are not. It is this sexual inequality and the degeneration that follows upon beauty that is the true driving force behind all the evil that happens on earth. The need for ruthless oppression and the pursuit of wealth and the consequent creation of suffering and poverty which must follow upon this practice is for the purpose of creating an artificial alpha elite.

The true elites are the young and the beautiful. The artificial elite are the rich and the wealthy. The elite aging rich artificial alpha male has no good looks, for he is physically degenerate, but he will be found escorting beauty because he has a beautiful wallet. If he loses his wallet he will be found at home with all the other unattractive aged beta males sitting in a rocking chair watching reruns of Bonanza. No money, no sex. It is for this reason that the alpha males are found to be so ruthless and so violent in pursuit of their goal. The alpha male has fallen. The beta male has arisen and now the whole planet is full of ruinous destruction for it.

We see in religion a confused and contradictory reaction to this reality. On the one hand religion preaches a sexless heaven where castration and the clitorectomy create ‘pure spirits’. Muslims throw women under sacks. On the other hand religion supports hierarchy and is the prop of the elite alpha male. It is for this reason that religion is incoherent when it comes to speaking about sex.

Now we see this same principle at work in all of nature. Guppies dance and show off their colorful tails and the guppy who dances with the most colorful tail is the sexually successful guppy. Therefore it is the doctrine of the ruthless oppressor which teaches that the solution to human sexual violence is to be found in castration and the creation of pure ghosts. This would be equivalent to damning an aardvark for having the ‘sinful aardvark nature’ or prosecuting an anteater for the high crime of ‘ant genocide’.

Therefore it was my theological hypothesis that the correct solution to this problem is to give every guppy a beautiful colorful tail. I compare this solution to the classic religious solution which is to cut off every tail since having a tail is ‘sinful’. If having a tail is sinful then God must be sinful for no human being has any choice in deciding whether or not they would be born with a colorful tail, or whether they would not.

When I was young I was a beautiful guppy with a lovely tail. So everyone seemed to think. I am older now. My nose became very badly sunburned and destroyed. It seemed good to me to test my hypothesis by using these ‘biological algorithms’ to correct this problem. I healed half my nose as you can see by the line separating the still very dark patch on the side in the photograph below.





I documented my experiment on these pages. one two t hree four fi ve six


I have confirmed to my own satisfaction that my theological proposition is correct and that religious dogma is erroneous, being based as it was upon nothing more than ‘divine revelation’ which is just a form of opinionated speculation. For the time being I am not continuing this experiment, for I must wait until the weather on this planet improves, and the dark clouds of ruthless oppression break letting a little sun shine come through so that I can show the world the truth about God, by showing people how God goes about giving an old guppy back his beautiful colorful tail.


Until then I will have to sit on the sidelines, while all my scientific breakthroughs are deliberately ignored, while I wonder to myself what ever in the world could be wrong with the human race, because what this all will prove at the end of it all is that there definitely was something wrong with the people on this planet.