Delphi Basics – worth a look!
Posted by jpluimers on 2010/10/27
Quite a while ago, Neil Moffat started the Delphi Basics site.
It is aimed at beginners, but since it has such a wealth of information (for instance a comprehensive list of compiler directives).
So even if you are a Delphi pro, it is worth to give Delphi Basics a look.
The cool thing: Neil originally is not even a programmer, nor a writer.
Maybe that is his strength: he learned by doing, step by step, now giving us a peak on what he learned.
–jeroen
via Delphi Basics.
Neil Moffatt said
Jeroen,
Go is indeed a fabulous game, far exceeding Chess in its multi-dimensional nature. Chess starts to look like a battle and Go a war of battles.
You should try the KGS Go Server, a free and brilliant piece of software that connects Go players around the World. There are thousands of players logged on at any one time. There are teachers on there also. My id is CardiffGo – I can offer you a game if you see me there.
Neil
Neil Moffatt said
Hi. I am the author of the Delphi Basics web site and thought it prudent to correct some misunderstandings.
I was and am a programmer. I was just not familiar with Delphi. I wrote the site as I learned its syntax.
And I am a writer now (search for Neil Moffatt on Amazon), mostly for the game of Go.
But I am also an artist and cabinet maker … see my personal web site.
Thanks
jpluimers said
Hi Neil,
Thanks for the correction.
The game of Go is lovely! I learned it at high school, but haven’t played it for years: I wish there were more people around me that could play it :)
–jeroen
my 2010 blog in review « The Wiert Corner – irregular stream of Wiert stuff said
[…] The busiest day of the year was October 27th with 1 views. The most popular post that day was Delphi Basics – worth a look!. […]
Dorin Duminica said
@jpluimers “sth” means “something”…
@Norb depending on what your aiming to achieve with records you have to set the length of the string, for example if your trying to create a custom “database” you need to have a fixed size for strings BUT not necessarily, example:
type
TMyAwesomeRecord = record
FirstName: string[150]; // allocate 150 characters for First name
LastName: string[50]; // allocate 50 characters for Last name
szDescription: Integer; // this holds the length of the Description field
Description: string; // the description itself
end;
NOW in order to write/read this record to/from a file you need helper methods which takes into consideration that szDescription field holds the length of Description(string) field and the description will be written after the record itself, NOTE that when you need to seek in the file the process is slower because you need to read the record structure FIRST and after that the Description field which has dynamic length.
Norb said
Record “must” contain fixed size string?? Wow, sth. new to me ;) I’ve used fixed-size string more than 10y. ago for some ‘stupid’/small projects at school (to save records to file – phone book, library, etc ;). Now I would use sth. like that kblib.googlecode.com
So far I’ve never need to use fixed-size String (only for some NT/Win API calls).
Some time ago I’ve also saw on site that looked almost exactly like that one, saying that WideString’s are reference counted types…
I see that “Neil originally is not even a programmer, nor a writer.”, but don’t let people learn Delphi Basics about such ‘basic things’ ;) so maybe it’s time to write sth. in Delphi to learn it in ‘real life’ =)
jpluimers said
What’s “sth.”?
You can use non-fixed strings in records, but you will have problems writing those records as blocks to a file.
–jeroen
Norb said
Of course you cannot write record with String’s to a file/stream directly (copy one continuous piece of memory), but you are able to write it for example by that lib. from 1st. comment.
At http://www.delphibasics.co.uk/RTL.asp?Name=Record there is nothing about saving to file, and also if I would be a new at Delphi, I could think (because of “must” word) that only way to use string in record is to use fixed-size string’s/ShortString, but it’s obviously not true.
See also: http://www.delphibasics.co.uk/RTL.asp?Name=WideString
var
string1, string2 : WideString;
begin
// Assign a famous sentence to the first string
string1 := 'Hello World';
// Assign to the second string
// This simply points string2 at string1
// The 'Hello World' string storage has a reference count of 2
string2 := string1;
This would be true, but only for String/AnsiString/UnicodeString, but *NOT* for WideString (as they are allocated by ‘Windows’ – SysAllocString, and they are not reference counted – commonly used in OLE/ActiveX as a BSTR’s).
PS. “sth.” -> “something” http://en.wikipedia.org/wiki/Sth – I’m noob in English grammar/language… I could use that word/shortcut in ‘bad-meaning’, so sorry :(