Prestwood eMagazine
Subscribe to our popular FREE monthly eMagazine.

Enter your email:

Subscription Center
Prestwood Tip Jar
Finding something useful?

Add to the
Tip Jar!

New KB Comments

The new kb comments ordered newest to oldest. 

To view comments to your KB Articles, go to your My Knowledge Base page. To view user contributions to your blogs, go to your My Blog page.
Mike Prestwood
Prestwood Software
Send mprestwood a Private Message Visit mprestwood's Home Page
PS Staff
Moderator
Rank: Fleet Admiral

Joined: Oct 2000
Visits: 21681
MB Posts: 1006

KB Articles: 993

Location: Citrus Heights, CA USA
Friday, November 14, 2008 Read | +Add Comment

Thanks Daniel. I added your info on (* *) to the multiple-line comment section and I combined the single line comment info with this post and deleted the single line comment. Originally I wanted to document single line comments from multiple line comments. In hindsight, that was a dumb idea.

Since compiler directives are also embedded in comments, I added a bit of introductory info about that too.



Regarding...
Object Pascal Comments (// and { } or (* *))

Commenting code generally has three purposes: to document your code, for psuedo coding prior to coding, and to embed compiler directives. Most languages support both a single line comment and a multiple line comment. Some languages also use comments to give instructions to the compiler or interpretor.

Commenting Code
Delphi uses // for a single line comment and both {} and (**) for multiple line comments. Although you can nest different types of multiple line comments, it is recommended that you don't.

Compiler Directives - $
A special comment. Delphi compiler directives are in the form of {$DIRECTIVE}. Of interest for comments is using the $IFDEF compiler directive to remark out code.


Mike Prestwood
Prestwood Software
Send mprestwood a Private Message Visit mprestwood's Home Page
PS Staff
Moderator
Rank: Fleet Admiral

Joined: Oct 2000
Visits: 21681
MB Posts: 1006

KB Articles: 993

Location: Citrus Heights, CA USA
Thursday, November 13, 2008 Read | +Add Comment

You're welcome and thanks for the kind words. By the way, a few months ago you suggested we improve the look and make it a bit simpler and cleaner. Based on your input (and others) I made quite a few changes. Is the website better looking now? Or, do I have more work to do. I do have some ideas I haven't had time to implement but if you have any suggestions, they are welcome.



Regarding...
Mike Prestwood will present UML 1.4 at the Nov VB user group
Mike Prestwood will speak on the Universal Modeling Language (UML) at the November 19th meeting of the Sacarmento Visual Basic user group. Tek Systems will be providing dinner.

Dr. Arti Mehta
Datamatics
Send aartimehta a Private Message Visit aartimehta's Home Page
Rank: Cadet 3rd Year

Joined: Jul 2007
MB Articles: 0

KB Articles: 0

Location: Mumbai IN
Thursday, November 13, 2008 Read | +Add Comment

Mike,

You are an encyclopedia of knowledge. So if no the session, even if the extracts of the session on UML 1.4 in th eform of knowldege base article would help us learn a lot.

Request you to evaluate the possibility.

And, thank you very much for so much knowledge sharing!

Regards

Arti



Regarding...
Mike Prestwood will present UML 1.4 at the Nov VB user group
Mike Prestwood will speak on the Universal Modeling Language (UML) at the November 19th meeting of the Sacarmento Visual Basic user group. Tek Systems will be providing dinner.

Mike Prestwood
Prestwood Software
Send mprestwood a Private Message Visit mprestwood's Home Page
PS Staff
Moderator
Rank: Fleet Admiral

Joined: Oct 2000
Visits: 21681
MB Posts: 1006

KB Articles: 993

Location: Citrus Heights, CA USA
Wednesday, November 12, 2008 Read | +Add Comment

Although I still like Paradox, I guess I should add that if you want to explore switching to MS Access, check out my ObjectPAL and Access VBA Cross Reference Guide.



Regarding...
WPO X4 Ships! Paradox Still Does Not Support Vista!
According to current information on the official Corel X4 home page, WPO X4 ships with Paradox 11 SP2 and still does not support Vista. Yet.

Steve Green
Diamond Software Group, Inc.
Send greens a Private Message Visit greens's Home Page
Rank: Cadet 4th Year

Joined: May 2008
Visits: 37
MB Posts: 37

KB Articles: 0

Location: Myrtle Beach, SC USA
Tuesday, November 11, 2008 Read | +Add Comment

> It's over six months since it was revealed that Corel still did not support Paradox under Vista in WPX4...have they fixed this yet?

to be honest, it's doubtful that Corel will ever touch Paradox again.. all the people that were associated with it have been gone since 2002..



Regarding...
WPO X4 Ships! Paradox Still Does Not Support Vista!
According to current information on the official Corel X4 home page, WPO X4 ships with Paradox 11 SP2 and still does not support Vista. Yet.

Mike Prestwood
Prestwood Software
Send mprestwood a Private Message Visit mprestwood's Home Page
PS Staff
Moderator
Rank: Fleet Admiral

Joined: Oct 2000
Visits: 21681
MB Posts: 1006

KB Articles: 993

Location: Citrus Heights, CA USA
Tuesday, November 11, 2008 Read | +Add Comment

No new info. I agree that they should fix this especially if they want to make good software and be known as a quality software company. I'm hopeful they will find the money to fix these errors. Until they find the money, it's just not going to happen. Paradox 9 works fine on Vista though so you might want to revert to that version. In my opinion, Paradox is the best desktop database available. It's only real competitor is Microsoft Access and even though Microsoft has continued development of Access and it does have some neat features, it's still not as easy to use as Paradox.



Regarding...
WPO X4 Ships! Paradox Still Does Not Support Vista!
According to current information on the official Corel X4 home page, WPO X4 ships with Paradox 11 SP2 and still does not support Vista. Yet.

vinylsol
Vinyl Solution
Send vinylsol a Private Message Visit vinylsol's Home Page
Rank: Cadet 4th Year

Joined: Sep 2007
Visits: 12
MB Posts: 12

KB Articles: 0

Location: Cheltenham AU
Tuesday, November 11, 2008 Read | +Add Comment

It's over six months since it was revealed that Corel still did not support Paradox under Vista in WPX4...have they fixed this yet? I'm particularly concerned about the BDE initialization problem and the 'Paradox has stopped' error on exiting. It seems to me that Corel shouldn't be selling the product as a Vista compatible package with these kinds of errors but I can't find any reviews of X4 that indicate that the problem has been fixed (the reviews only seem concerned with WP itself) and I don't want to pay for an upgraded version if the problem is still there. Any new info out on this?



Regarding...
WPO X4 Ships! Paradox Still Does Not Support Vista!
According to current information on the official Corel X4 home page, WPO X4 ships with Paradox 11 SP2 and still does not support Vista. Yet.

Mike Prestwood
Prestwood Software
Send mprestwood a Private Message Visit mprestwood's Home Page
PS Staff
Moderator
Rank: Fleet Admiral

Joined: Oct 2000
Visits: 21681
MB Posts: 1006

KB Articles: 993

Location: Citrus Heights, CA USA
Monday, November 10, 2008 Read | +Add Comment

Hi Arti,

No, we didn't capture that event. I'm hoping to capture some in the future and post them to the website. Until then, I'm mainly focusing on knowldge base articles and responding to message board Q&A.



Regarding...
Mike Prestwood will present UML 1.4 at the Nov VB user group
Mike Prestwood will speak on the Universal Modeling Language (UML) at the November 19th meeting of the Sacarmento Visual Basic user group. Tek Systems will be providing dinner.

Dr. Arti Mehta
Datamatics
Send aartimehta a Private Message Visit aartimehta's Home Page
Rank: Cadet 3rd Year

Joined: Jul 2007
MB Articles: 0

KB Articles: 0

Location: Mumbai IN
Monday, November 10, 2008 Read | +Add Comment

Mike, will you be sharing the session content on this site?

Regards

Dr. Arti Mehta



Regarding...
Mike Prestwood will present UML 1.4 at the Nov VB user group
Mike Prestwood will speak on the Universal Modeling Language (UML) at the November 19th meeting of the Sacarmento Visual Basic user group. Tek Systems will be providing dinner.

Dr. Arti Mehta
Datamatics
Send aartimehta a Private Message Visit aartimehta's Home Page
Rank: Cadet 3rd Year

Joined: Jul 2007
MB Articles: 0

KB Articles: 0

Location: Mumbai IN
Monday, November 10, 2008 Read | +Add Comment

I always admire the simplistic text you use to explain any concept.

Regarding introduction to DFD, a small diagram, if possible, would have helped to relate description with the visualization.

Regards

Dr. Arti Mehta



Regarding...
A 10 Minute Data Flow Diagrams (DFD) Quick Start
DFDs document a process by documenting the flow of data throughout the process. They depict how data interacts with a system. They can be used to engineer a new process, document an existing process, or re-engineer an existing process.

rdkram
Send rdkram a Private Message Visit rdkram's Home Page
Rank: Cadet 3rd Year

Joined: Oct 2008
Visits: 12
MB Posts: 4

KB Articles: 0

Tuesday, November 04, 2008 (Updated 11/4/2008 11:47:24 AM)
Read | +Add Comment

Another form of a multiple line comment

(*

  some comments go here

*)

Speaking of comments:

// I am a Single line comment

Multiple levels of comments. You can nest comments like the example below

(*

  I am a comment

  {

    I am a comment within a comment

  }

*)

The hierarchy of comments:

(* comment *) = highest precedence

{ comment }

// comment

To mark or unmark a series of lines of code with a comment

1) Highlight the lines of code you wish to comment out - hold down the shift key and move cursor up or down.

2) Hit Ctrl + / and the lines will be commented out. If they already were commented out, they will no longer be commented

Before:

if (something) then

begin

  ShowMessage('I did it.');

end;

After:

//if (something) then
//begin
//  ShowMessage('I did it.');
//end;



Regarding...
Object Pascal Comments (// and { } or (* *))

Commenting code generally has three purposes: to document your code, for psuedo coding prior to coding, and to embed compiler directives. Most languages support both a single line comment and a multiple line comment. Some languages also use comments to give instructions to the compiler or interpretor.

Commenting Code
Delphi uses // for a single line comment and both {} and (**) for multiple line comments. Although you can nest different types of multiple line comments, it is recommended that you don't.

Compiler Directives - $
A special comment. Delphi compiler directives are in the form of {$DIRECTIVE}. Of interest for comments is using the $IFDEF compiler directive to remark out code.


Wes Peterson
Prestwood Software
Send Wes a Private Message Visit Wes's Home Page
PS Staff
Moderator
Rank: Commander

Joined: Jan 2004
Visits: 918
MB Posts: 71

KB Articles: 106

Location: Citrus Heights, CA USA
Friday, October 31, 2008 (Updated 10/31/2008 10:33:22 AM)
Read | +Add Comment

Whether to use Free, or FreeAndNil, is an interesting topic.  It depends on the circumstances.

My rule of thumb is that if an object is local (that is, it's reference variable will soon go out of scope) just use Free.  But if the object is more "global," use FreeAndNil.

A classic example is a form that will create and show another form.  This is often done within the scope of a button click handler, or an ActionItem's Execute method:

procudure MyForm.Button1Click(Sender : TObject);
var 
  StudentForm : TStudentForm;
begin
  StudentForm := TStudentForm.Create(Self);
  StudentForm.ShowModal;
  StudentForm.Free;
end;

In the above snippet, the local variable, StudentForm, isn't accessible outside of the click handler, and it will go out of scope fairly soon.  In this case, I think Free is sufficient.

However, if I'd made my reference variable more "global," say as a private member, FStudentForm, of TMyForm, any and every method of that class has access to it. In that case, I'll use FreeAndNil:

procedure MyForm.Button1Click(Sender : TObject);
begin
  if (FStudentForm = nil) then
    FStudentForm := TStudentForm.Create(Self);
  FStudentForm.ShowModal;
  FreeAndNil(FStudentForm);
end;

Just to play it safe, you'll probably want to set FStudentForm to nil in TMyForm's OnCreate event.

Of course, it does no harm to use FreeAndNil wherever it's legal (As Mike says, the argument to FreeAndNil must be a TObject, or descendant thereof).



Regarding...
Object Pascal Destructor (Free or FreeAndNil)

Object Pascal uses a standard virtual destructor named Destroy which is called by the standard Free method. All objects are dynamic, so you need to call MyObject.Free method or the FreeAndNil(MyObject) routine for each object you create.


Mike Prestwood
Prestwood Software
Send mprestwood a Private Message Visit mprestwood's Home Page
PS Staff
Moderator
Rank: Fleet Admiral

Joined: Oct 2000
Visits: 21681
MB Posts: 1006

KB Articles: 993

Location: Citrus Heights, CA USA
Thursday, October 30, 2008 (Updated 10/30/2008 7:07:30 PM)
Read | +Add Comment

Hmmm...sure, that's a good rule of thumb and thanks for adding the info here (I added it to the flashcard above too). Bottom line.

However, to further the discussion I guess it depends on the situation. It is a routine and not a class method so using Free "feels" more OOP to me so I tend to use it with simple OOP examples when giving demos. ((I know, that's a pretty weak excuse but I think it helps with new coders.)) You do have to be careful to only pass TObjects to this routine too. My own rule of thumb with larger applications is that I use Free when doing simple controlled tasks and FreeAndNil with more complicated things.

Also, when do we stop writing extra checks? You could be even more complete and do something like the following:

If Assigned(MyObject) then
FreeAndNil(MyObject)
Else
MyObject := nil;

If by some chance MyObject was not assigned to begin with, then FreeAndNil() will never get called and therefore MyObject will never get set to nil.

Should Be NilAndFree

Finally a minor point but because we're getting into it a bit, I thought it might be important because FreeAndNil actually does the opposite. You can run into problems accessing the object variable while it's being destroyed.

For reference, here are the three VCL code routines in discussion:

In System Unit:

//TObject.Free
procedure TObject.Free;
begin
  if Self <> nil then
    Destroy;
end; 
 
//TObject.Destroy
destructor TObject.Destroy;
begin
end;

In SysUtils unit:

//FreeAndNil
procedure FreeAndNil(var Obj);
var 
  Temp: TObject;
begin 
  Temp := TObject(Obj); 
  Pointer(Obj) := nil; 
  Temp.Free;
end;

 



Regarding...
Object Pascal Destructor (Free or FreeAndNil)

Object Pascal uses a standard virtual destructor named Destroy which is called by the standard Free method. All objects are dynamic, so you need to call MyObject.Free method or the FreeAndNil(MyObject) routine for each object you create.


Mike Prestwood
Prestwood Software
Send mprestwood a Private Message Visit mprestwood's Home Page
PS Staff
Moderator
Rank: Fleet Admiral

Joined: Oct 2000
Visits: 21681
MB Posts: 1006

KB Articles: 993

Location: Citrus Heights, CA USA
Thursday, October 30, 2008 Read | +Add Comment

Hi Daniel:

I just wanted to welcome you and say your post is just fine right here. We welcome your input.



Regarding...
Associative Arrays in Delphi/Object Pascal (Use TStringList)

TStringList Example
Object Pascal doesn't have a native associative array, but you can use a TStringList the same way. (Alternatively, search the Internet for TStringHash and THashedStringList classes for implementations of a true associative array).


Mike Prestwood
Prestwood Software
Send mprestwood a Private Message Visit mprestwood's Home Page
PS Staff
Moderator
Rank: Fleet Admiral

Joined: Oct 2000
Visits: 21681
MB Posts: 1006

KB Articles: 993

Location: Citrus Heights, CA USA
Thursday, October 30, 2008 (Updated 10/30/2008 4:07:37 PM)
Read | +Add Comment

Hi Francis,

Yeah, I have one developer notebook in the same state. All my other boxes either worked just fine, or I had a few problems but were able to work around them. On the box of mine that isn't working, I'm having some Windows install issues I just haven't had time to address. It thinks Word 2007 is installed when actually Word 2003 is installed, I'm going to uninstall 2003 and install 2007 and try again.

You can open a support ticket with Microsoft. It's free but typically you deal with someone in India who just wants to get rid of you so he or she can keep their support numbers up and make money. I sure miss the days when I got someone in America to work with. Nothing against foreign countries, but techinical stuff is hard enough as it is and the culture differences sometimes make it even harder! Plus, we Americans built Microsoft with American money. It sure would be nice to keep that money here in America.

Anyway, try exploring your Installation History in Windows Update to see what install failed or open a MS support ticket.



Regarding...
Vista SP1 Missing ACPI.SYS file w/ error code of 0xc0000098
Missing critical file ACPI.SYS (error code 0xc0000098).

fgunnis
Send fgunnis a Private Message Visit fgunnis's Home Page
Rank: Cadet 2nd Year

Joined: Oct 2008
MB Articles: 0

KB Articles: 0

Thursday, October 30, 2008 Read | +Add Comment

Mike I did exatly as you suggested but it still will not load SP1. I am perplexed by this as my wife has the same system and computer as mine and on hers it loaded fine.

Francis



Regarding...
Vista SP1 Missing ACPI.SYS file w/ error code of 0xc0000098
Missing critical file ACPI.SYS (error code 0xc0000098).

rdkram
Send rdkram a Private Message Visit rdkram's Home Page
Rank: Cadet 3rd Year

Joined: Oct 2008
Visits: 12
MB Posts: 4

KB Articles: 0

Wednesday, October 29, 2008 (Updated 10/30/2008 5:45:19 PM)
Read | +Add Comment

Newbie posting, so please revise or move if desired:

What Wes was referring to about freeing objects within a list manually is shown below using a combo box, for example, as a list type item holding objects within itself.

class procedure TUtils.FreeAndNilComboBoxObjects(p_cboWork: TComboBox);
{
  Pass in the combo box, and this will clear any objects
  within the combo box
}
var
  nCount: integer;
begin
  for nCount := 0 to (p_cboWork.Items.Count - 1) do
  begin
    if (p_cboWork.Items.Objects[nCount] <> nil) then
    begin
      p_cboWork.Items.Objects[nCount].free;
      p_cboWork.Items.Objects[nCount] := nil;
    end;
  end;
end;
String Grids can hold objects too, here is sample code
  for nCount := 0 to (p_sgdWork.RowCount - 1) do
  begin
    if (p_sgdWork.objects[0,nCount] <> nil) then
    begin
      p_sgdWork.objects[0,nCount].free;
      p_sgdWork.objects[0,nCount] := nil;
    end;
  end;


Regarding...
Associative Arrays in Delphi/Object Pascal (Use TStringList)

TStringList Example
Object Pascal doesn't have a native associative array, but you can use a TStringList the same way. (Alternatively, search the Internet for TStringHash and THashedStringList classes for implementations of a true associative array).


rdkram
Send rdkram a Private Message Visit rdkram's Home Page
Rank: Cadet 3rd Year

Joined: Oct 2008
Visits: 12
MB Posts: 4

KB Articles: 0

Wednesday, October 29, 2008 Read | +Add Comment

WIth Delphi 5 and later, it is my understanding it is better to use

FreeAndNil(objMyObject);

Thoughts and comments?



Regarding...
Object Pascal Destructor (Free or FreeAndNil)

Object Pascal uses a standard virtual destructor named Destroy which is called by the standard Free method. All objects are dynamic, so you need to call MyObject.Free method or the FreeAndNil(MyObject) routine for each object you create.


Mike Prestwood
Prestwood Software
Send mprestwood a Private Message Visit mprestwood's Home Page
PS Staff
Moderator
Rank: Fleet Admiral

Joined: Oct 2000
Visits: 21681
MB Posts: 1006

KB Articles: 993

Location: Citrus Heights, CA USA
Sunday, October 26, 2008 (Updated 10/26/2008 3:15:03 PM)
Read | +Add Comment

Today I updated this article as follows:

  • Removed references to Linux.
  • Updated presentation of OOP concepts.
  • Embedded links to related information.


Regarding...
Introduction to OO for the Paradox Community
Compromise OO implementation strategies for Paradox developers.

Mike Prestwood
Prestwood Software
Send mprestwood a Private Message Visit mprestwood's Home Page
PS Staff
Moderator
Rank: Fleet Admiral

Joined: Oct 2000
Visits: 21681
MB Posts: 1006

KB Articles: 993

Location: Citrus Heights, CA USA
Wednesday, October 22, 2008 Read | +Add Comment

Hey Francis. Got it. Have you tried the full Vista SP1 installation yet? If not, "hide" the SP1 update in Windows Update then download and install the full 453MB Vista SP1.



Regarding...
Vista SP1 Missing ACPI.SYS file w/ error code of 0xc0000098
Missing critical file ACPI.SYS (error code 0xc0000098).

fgunnis
Send fgunnis a Private Message Visit fgunnis's Home Page
Rank: Cadet 2nd Year

Joined: Oct 2008
MB Articles: 0

KB Articles: 0

Wednesday, October 22, 2008 Read | +Add Comment

Vista SP1 is not installed ( under copyright notice say it says upgrade windows vista). Also I have downloaded the manual install and have tried three times. Same problems as before everytime.



Regarding...
Vista SP1 Missing ACPI.SYS file w/ error code of 0xc0000098
Missing critical file ACPI.SYS (error code 0xc0000098).

Mike Prestwood
Prestwood Software
Send mprestwood a Private Message Visit mprestwood's Home Page
PS Staff
Moderator
Rank: Fleet Admiral

Joined: Oct 2000
Visits: 21681
MB Posts: 1006

KB Articles: 993

Location: Citrus Heights, CA USA
Tuesday, October 21, 2008 Read | +Add Comment

Today I updated this article with minor updates to reflect changes in the industry (the popularity of C#) and some further clarifications (class based vs object based languages).



Regarding...
An Introduction to Object Orientation
Overview and introduction to object orientation.

Mike Prestwood
Prestwood Software
Send mprestwood a Private Message Visit mprestwood's Home Page
PS Staff
Moderator
Rank: Fleet Admiral

Joined: Oct 2000
Visits: 21681
MB Posts: 1006

KB Articles: 993

Location: Citrus Heights, CA USA
Tuesday, October 21, 2008 Read | +Add Comment

You can know for sure if Vista SP1 is installed by right clicking on My Computer and clicking Properties. If you have it installed, it'll say so right under the Copyright notice.

If you're having trouble with Windows Update installing SP1, try installing SP1 manually. It requires you download the FULL SP1 (434 MB) but that might work for you. Go to Microsoft.com and search for "download Vista SP1".



Regarding...
Vista SP1 Missing ACPI.SYS file w/ error code of 0xc0000098
Missing critical file ACPI.SYS (error code 0xc0000098).

fgunnis
Send fgunnis a Private Message Visit fgunnis's Home Page
Rank: Cadet 2nd Year

Joined: Oct 2008
MB Articles: 0

KB Articles: 0

Tuesday, October 21, 2008 Read | +Add Comment

I have done this proceedure on a number of occasions. It has certainly reboots my system ok but Windows keeps advising me that I have an update (Vista SP1)

How do you actually  install SP1 if this constantly happens?



Regarding...
Vista SP1 Missing ACPI.SYS file w/ error code of 0xc0000098
Missing critical file ACPI.SYS (error code 0xc0000098).

Mike Prestwood
Prestwood Software
Send mprestwood a Private Message Visit mprestwood's Home Page
PS Staff
Moderator
Rank: Fleet Admiral

Joined: Oct 2000
Visits: 21681
MB Posts: 1006

KB Articles: 993

Location: Citrus Heights, CA USA
Thursday, October 16, 2008 (Updated 10/25/2008 10:13:59 PM)
Read | +Add Comment

>>...can we have multiple LEVEL 0 diagrams?

...hmmm....not usually. The level 0 diagram is supposed to show the context of the data-system you are documenting and if you're tempted to create two, then I would think you are either trying to document two systems or are not thinking at a high enough "level" for the level 0 context diagram. In other words, you need to continue leveling.

However, to me, documentation is strictly for the purpose of communication. So, if one of my analysts came to me with two level 0 diagrams, I would simply ask, "how does this communicate better than a single level 0 diagram?"

Does that make sense? Can you think of a reason why you would want to use two level 0 context diagrams?



Regarding...
A 10 Minute Data Flow Diagrams (DFD) Quick Start
DFDs document a process by documenting the flow of data throughout the process. They depict how data interacts with a system. They can be used to engineer a new process, document an existing process, or re-engineer an existing process.

Mike Prestwood
If you have any questions, please
email me at .
--Mike Prestwood

www.prestwoodboards.com is part of the Prestwood Family of Websites.
Development by Mike Prestwood (ASP, ASP.Net, and Delphi to MS-SQL 2005).
Knowledgebase powered by ASPSuite KB module (programming by Mike Prestwood).
Copyright 1995-2008 Prestwood Software.
All rights reserved.

[Security & Privacy]
 

Attention Developers!
Join the Prestwood Programmer Community (PPC)

OO, UML, DotNet, ASP.Net, C++, Java, PHP, ASP, J