F.A.Q.

 

Dear readers

your questions are deserving of our attention. I also delight me for the received compliments. After all, who writes Articles, on internet or other bases directed to the enjoyments of a heterogeneous public, amuse inspires him verve on the accondiscendenzes of his/her own readers. The success of my Articles is so shown by the interest of a vast public and by the continuous stream of questions that you/they are set me regarding the database. It is always clearly not possible to answer, or to reenter in acceptable times: I apologize to the readers, but, as I already had the opportunity of participating in other good buys, the time, for the one who attends our work, it is an inflexible despot. I am delighted me however and always of your polite attention, that honors my job and it pushes our staff to be always to disposition of the public. How to reciprocate your attentions? Answering to the questions, that are an entitlement of whom reads and they impose to have to answer for the one that writes! To your service therefore, humble servant of mine vast and impassioned public. Premised this we pass to the answers.

 

 

I have an application type managerial fact in delphi 6 and use of the charts paradox. If I wanted to bring networked the program thing would you advise me to do????I am some in confusion on thing to do in the sense that I don't know how to take a decision at the end the application it will have to turn on three pc with windows networked xp to 100...
Some have told me that I owe mappare the route of the file server others that there is no need it is of it because the files paradoxes manage the net but me I have tried and a lot of plan sincerely goes I don't know whether to do... have I read your manual on the database then it has me incuriosito what you call "my system" further explanations can be had by the way?

 

Unfortunately the information from her you delay to respect of the problem they are indeed little. The slowness caused in its program can justify him in varied ways. Generally, an usual bug, in the programs type Client-Servere, above all if necessary experience is not had, it is due to the connection of a chart or a query to a control type DBGrid. In fact the operations of scanning to the back of aforesaid chart they result to exaggeratedly be lens. In the case of database local, the charts are of the sequential files whose order is of physical nature or subordinate to an index. The file servers SQLs, operate instead with logic data sets that are not absolutely reported to a structural sorting order type physical. A file server for database report it manipulates them the data in base to the model report her, that  is drawn by a belonging mathematical model to the theory of the whole. It is important to understand that the tuples or record of a chart are identified not in univocal way from the position but from a based primary key on one or more fields. When the file server gets a whole record, it adds, to each of them, a reference that stings to the following one: this makes the move very high-speed in before, but of an infuriating slowness that to the back. This is the reason for which we say that a RDBMS uses one-way I-beam pointers. The BDE resolves this problem preventively entertaining in a local cache the loaded records in the chart. In this way for the following records are asked to the file server, while the BDE takes care of him of those already examined, making in such way, the I-beam pointers above sued, totally bidirezionali.

Ripeto, the causes can be indeed so many, generally, how much above described, it is one of the most frequent bugs but not the unico!

Per how much it concerns the "My system", it is the birth of about ten years of study regarding the development of applications database. It faces a whole series of problem list owed to the concept of storage, visualization, manipulation of the data. I have decided to make it publishes a small part of it, since convinced champion of the concept "it is well that people are erudite! ". I will expose, however, in the I continue of my lessons, other abstractions riguardanti the "My system", so that, who wants, can use with success these theories of mine!

Mariano.

Interest me to know the difference that passes between a procedure and a function and eventually as I do to come true themselves her before the second and above all as to initialize her.

The substantial difference between the procedure and the function and that the second returns a result ( can return an integer, a float, a string, a boolean depends on what has to make our function), while the procedure performs the part of code in it written without returning nothing.
Here is a small example of Function that doubles the number inserted in the edit1 showing the result in the edit 2:

unit Raddoppia;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
X :integer;
implementation

{$R *.dfm}
function Raddoppia_X (X: Integer): Integer;
 begin
  X := X * 2;
  Result := X;
 end;
procedure TForm1.Button1Click(Sender: TObject);
 begin
  edit2.Text := inttostr (Raddoppia_X(Strtoint(edit1.Text)));
 end;
end.

The on-line help of delphi to the voice: Procedures declarations and Function declarations seems me very exhaustive besides making some clear examples available however, good job.
DelphiRuby (Mauro).

I have used the following code to do so that it returned me a naturally determined quantity of numbers casuali,servendomi of a form, of a button and of a listbox:

procedure TForm1.Button1Click(Sender: TObject);
var

 I: Integer;
  begin
   ListBox1.Items.Clear;
    Randomize;
    I := 0;
   while I <= 1000 do
    begin
     I := I + Random (100);
     Listbox1.Items.Add ('Numero Casuale: ' + IntToStr (I));
   end;

The motive for my question is in the fact that I receive a superior quantity of numbers to that that I expected me and above all a superior cut of numbers to the hundreds. Does say this, as can I calibrate the code in examination to allow the application to return only me a certain quantity of numbers and solo the numbers that for example go from 50 to 100? Certainly of one ready answer of his I send kindest regards.

I don't know how many numbers it was waited for to receive. but reading the lines of code immediately skips me to the eye that with the command:
while I <= 1000 do
  begin 
  ....
 end;

the compiler will keep on producing numbers random up to that there won't be a greater or equal number to 1000 (therefore you cannot be foreseen how many generations will be made, to have a precise number we have to plan us a routine as for es. for I := 1 to 10 gdo begin.... end; in such way 10 numbers will be produced).
Instead for the cut of produced numbers all it takes is resorting to the function "RandomRange" that it allows us to decide the range in which the numbers will be produced.

Here is a small example that produces 10 inclusive numbers among 100 and 250.


procedure TForm1.Button1Click(Sender: TObject);
 var

 I, Num: Integer;
  begin
   ListBox1.Items.Clear;
   Randomize;
    for I := 1 to 10 do
     begin  
      Num := RandomRange(100,250);
      Listbox1.Items.Add ('Numero Casuale: ' + IntToStr (Num));
     end;
  end;
Good work DelphiRuby (Mauro).

I am interested to the study of SQL as after all you mention in his/her guide database, but I don't know from whether to begin. Could you advise me? In the bookstore I have given a glance and they exist various types of sql but I don't know whether to purchase. What do I have to ask to the retailer? which type of sql do I owe best man for delphi?
P.S.

Does an on-line guide exist?

On Internet it is practically found of everything, they miss only the magic bean and the wand of the good Merlino. Let's show up us the essays on SQL. Dear Paul and Roberto, suggestion two really effective exposures: "The hand-feed SQL" written by Stephen Cannon and Gerard Otten. Cinquecentoottanta pages to be tasted in loneliness, preferably in front of the computer. A noteworthy book indeed, that will gradually introduce you in the world SQL, applying to him very valid examples. Not to lose. If then this text not fiaccherà your perspicacity to instruct you in this field, purchases without delay "The hand-feed SQL" written by Ryan K. Stephens, Ronald R. Plew, Bryan Morgan and Jeff Perkins: based on an iron didactic formulation and a management spartana, rich of examples, exercises and the whole rest. It will bring, to your technical baggage, of the noteworthy benefits. A good book! Personally I have studied them both, to trust, and not only for cultural motives exquisitely. If to survive you to the arduous probation, write he/she anchors me, over that to compliment me for the spirit of abnegation, will introduce you to of the essays that can complete your preparation in subject.
Mariano.

In the third lesson on the database you mention the component TScreen that works, as it teach me, to suit the application for qualsivoglia resolution video also maintaining suitable proportions, font etc. I would Like to know if the aforesaid component is native in delphi or you/he/she deals with a you compose additional? Could I receive information about it and above all as to shape him/it and from where eventually to download it?
In the same lesson it highlights us the potentiality of the component ActionListEditor: could I know how to use it?

The component TScreen is born with Delphi, it belongs to his genetic patrimony. She is created, as I have explained in a lesson published on the site to the startup of every application. It contains, among so many other things, the information related to the dimensions of the screen through the proprietorships Whidth and Size. We see an example: a denominated form FrmChiama positions a denominated form FrmProva.

procedure FrmChiama.FormCreate(Sender: TObject);
 var
 WM: Integer;
  begin
   WM := FrmProva.Width;
   if Screen.Width >= 2 * WM then
    Left := WM
    else
    Left := Screen.Width-WM;
     ….
end;
In the applications that turn in operating systems as those actual, varied ways exist for imparting some commands, as for instance a voice of menu, a button and other. With the purpose to be able to attribute a proper specification to each of these commands, above all as it regards the interactivity man - car, Delphi, from the version 4, have introduced the concept of "Action", stupendously glorified by the version 6. In practice it is possible to create an user interface whose based activity on Action view results totally. Also it is possible to submit the assignment to modify the interface of the application to the trailing really liking. Delphi boasts a rather open architecture of the events, this allows to write a single handler and to link him/it to the events OnClick, for instance, of a slash pulsating englobed in a menu. The same event can also be managed by different buttons or bawls of menu, simply resorting to the yardstick Sender. It becomes instead more difficulty to manage the synchronization between buttons and bawls of menu: if we have in fact a button and a voice of menu that manage the same event, every whenever these you will be recalled, it is necessary to add a check mark to the voice of menu and to modify the state of the button so that is pointed out that he has been pressed. To obviate the component ActionList or List of actions to this problem was born, that is of commands. An action or command, point out therefore the operation in progress when he resorts to the events OnClick, determining him operational of all the elements (buttons and bawls of menu) to them linked. I have realized an example that I sufficiently hold instructive in the program Alice, seating the relative component in the central form of the program. The component manages the actions related to the navigation of the records in a chart database, but you can be predisposed, as just explained, to the management him events OnClick related to the necessary actions to sovrintendere the commands of buttons and bawls of menu among them logically correlated.
Mariano.

In the lessons on the database, I have read that her ago reference and use of the component 'Query.' Could I know the specific use and the relative benefits brought by this component?

Simply I say that, without the use of SQL it is not possible to realize application database of a certain level. In the specific case, the component Query is the medium toward this language. I have described with abundance of details the functions of the component Query and the benefits that this language involves during the lessons published on the site. Insofar, respectfully, rhyming you to the mentioned lesson. To every way, the realization of applications type managerial, therefore provosts to the manipulation of great quantities of data, debbono obligatorily to use this language, since specific problems can exclusively be resolved applying to SQL. The component Query, in our case, it acquits, to quote some of it, spells tied up to the visualization, accounting, updating and change of the data. Silently, behind the scenes. Indefatigable worker, with his operated, burden on itself big part of the hidden job that allows the good operation of an application interfacciato with motor database!
Mariano.

I would like so much to know if in delphi 7 exist a function that allows me to verify if the code from me worded introduces imperfections.

Don't result me that a function of the kind hesitates even if the question leaves space to manifold interpretations, but we says that as surely you will already have happened to each of us if there are some errors of syntax in the code the compiler it doesn't allow us the compilation signalling us to that line of the. PAS is found the error, if for example in our code we want to use a variable but he has not preventively been declared (to es. varying_A):
procedure TForm1.Button1Click(Sender: TObject);
 var
  a :integer;
   begin
    A := variabile_A;
   end;

the compiler returns us the following message:
[Error] Unit1.pas(31): Undeclared identifier: 'variabile_A'
[Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas'
in this case we are told that in the program we have tried to use a variable (to the line N°31) without preventively having her declared.
Besides the signaling of the real errors we are able there can be of the notices given by the compiler to Es,:

procedure TForm1.Button1Click(Sender: TObject);
 var
  A, variabile_A :integer;
   begin
    A := variabile_A;
    inc(A);
   end;
in this case the notice is the following:
[Hint] Unit1.pas(32): Value assigned to 'A' never used
[Hint] Unit1.pas(31): Value assigned to 'A' never used

the compilation is regularly effected but she is signalled us that the value assigned to the varying Á. is not used in our program.
We could also be some warnings (warning), the compilation as in the preceding case he is effected, but to the comparison of a (Hint) in nosto Delphi asks us to pay greater attention. In the on-line manual to the voice Delphi compiler error messages is listed all the messages that we can meet.
They exist then, of the rules of beautiful syntax that can be that to go to head after a semicolon, in the nested loops to move us than at least a space for every cycle of for - next or while - do etc. To use some different colors for the comments, parts in assembler, laces etc. and to use a color that jumps to the eye for the reseveds word, in short a pochino of order doesn't hurt never.
To conclude I care to specify that these are alone of the suggestions not rules but in the years to me personally they have given some positive comparisons, especially in case of maintenance or changes of the code and surely it helps to read the list in more flowing way.
Good work DelphiRuby (Mauro).

Could you tell me as to convert a hexadecimal lace in decimal?

Taking advantage of the question and considered that other readers you have asked questions on the DEC conversion HEX I have thought about creating a function that the problem can resolve and youcan be found her in the page of the TIPS (it converts from hex to decimal)    VAI 
or in the TIPS \ MISCELLANEA there is an example with the complete project.
Good work DelphiRuby (Mauro).

I am curious to know whether to install the BDE Administrator in the computer recipient (end user of the application) it is had only to resort to the software "InstallShiel" or there are in worth of the makeups or the techniques that you allow to omit the potentialities of this program.
I could know anchor, if other softwares exist similar to InstallShied and that therefore they allow alias the installation and the configuration of the in the p.c. recipient and eventulamente where to retrieve them? 
Thanks

Any program can manually be installed, also the BDE Administrator. A good knowledge of the register of Windows and the files of configuration is necessary that accompany the product. However it is a problem that doesn't have motive to be, since the program InstallShield in endowment with Delphi is really a good product. So many other similar applications exist (to visit the site www.pcwdirect.it), more valid, some expensive others less. Also it is possible to create a custom designed installer, but to have a great preparation is necessary. In the gross, InstallShield offers the necessary one to create a setup worthy of this name. And then, to given caval..!

  
In the question that I have done: "A system exists for making only an usable application for a determined time period, overdue which the application won't be more usable, if not with the use of a code seriale that serves from unblocking? " in which you answer me that "Of systems exist different of it, more effective. he could plan her Application with a counter that keeps in mind of the throwing of the program. Also, if the application him interface with motor database, can plan, for instance, for one determined chart, done a certain number of record, reach which, does the program come to a basic blocco.In to how much from her kindly recommended me in the FAQs I would desire to know how to implement a code that monitorizzi the number of times in which the software is launched? or, as to do so that my application containing charts (database) you can contain only a certain number of record.

In the phase of opening of the program, therefore in the principal form, it is necessary to implement a counter that increases of one his own value to every explosion of the executable one. A variable type Integer uses him marvelously to the scopo.Suddetto value must have hidden in the system of windows, or if prefers, in a string of the log, or anchors where she holds both to the shelter from the fury hidden ache of the software raiders! To realize this alchemy can use the component Memo, that, among his opulences, it sets a great deal in beautiful show two functions toste: SaveToFile and LoadFromFile. Says this it will have to have care to transfer the value from the counter inside the component memo and vice versa (the functions StrToInt and IntToStr, of which we have already spoken, are lent that more he is not able), to apply therefore to the function SaveToFile in sued precedence. It will go therefore to hide, the first time when the program will be exploded, the value of the counter where more it will hold opportune. Example:memo1.Lines.SaveToFile ('C:. Dat);
If then it has familiarity with some techniques of criptazione of the files, still better.
Fact this is necessary to predispose the code that will go to recall the value of the counter and, to every exploded of the application, it will care him/it in the component Memo. Example:
memo1.Lines.LoadFromFile ('C:. Dat);
This value will be compared hourly with a procedure by her predisposed and that it will determine when the program will have to extinguish. If the values coincide the application, to the next restart, it will display the sad messaging. Keep in mind that this is a good technique, but must be implements with some rather elaborate shrewdness, so that the enemies don't have of what portar by the flag!
As it regards the charts database, the procedures concernenti the safety they are made a tantino more delicate. But it is as many true that can be applied to of the stratagems that give so much thread to twist to the those pumpkins illuminated by the lightnings of Jupiter that so much enjoyment they draw in to furtively penetrate other people's systems. Once predisposed the procedure of comparison (this could fish the data from some well hidden files and fed by every event of storage Post that will have to establish the number of necessary record so that the application has to stop working, it will resort to the function RecordCount, that returns, inside a whole variable, the number of present record in a chart. Example:

var
I: Integer;
begin
 I:= Miatabella.Recordcount;
 If I = 30 then
  begin
   //confronto con procedura
   //se il confronto è positivo allora...... 
   Showmessage(‘Il programma è scaduto!’);
     ……
    ……
 end;
end;

In the specific case I have supposed a maximum of 30 records. You remember that, whoever has a copy of the Paradox it is able to modify the values of a chart. Without summoning that programs type disassembler that, in the hands of experienced people, they bring back to the procedure of comparison and even they modify the results of it. That's why the procedures of comparison should reside, in small portions, inside more DLLs preceded to such assignment, also them well you hide. If she succeeds in melting together the two techniques just exposed, you/he/she can get some good results. Hold I count that, planning a counter of comparison with the records of a database, is necessary to predispose at least about ten charts flirts, with the tallest I number of live possible, all operational ones, that develop in appearance the function of counter, in such way that, who will have to attack his computer alchemies, have to whether to have a good time him! It is not so much at all simple, in a sea of one hundred and it passes fields to understand what develops the basic assignment. In these cases is very important the imagination and the to know how to predispose code ghost, that is apparently useless! I abort recommending to experiment her with passion how much above statement, above all if has intention to produce programs of a certain level!

NEXT PAGE

Rreturns to the principal page