|
|
Up |
|
|
  |
Author: Kerry.ConveryKerry.Convery
Date: Aug 29, 2008 17:04
HI All, I'm writting a raw low level data object. The data object
opens a table file which contains customer information (Code, Name,
Address, etc) and reads the file into memory.
Im using the windows API functions CreateFile to open the file and
ReadFile to read the file. Instead of using FileSeek to move the file
pointer im passing in a TOverlapped structure to allow multiple
concurrent reads from of the file using the same file handle. The
file handle is passed to a pool of threads that read from the file at
the same time.
I have observed the the time required to read in all the records using
threaded or non threaded code makes no difference at all. I expected
reading the file using many threads (one for each CPU core) would be
faster but its not. I guess the reason is because each thread is
waiting for the other to finish its read either at the OS level or the
hardware level. Can anyone confirm this? or does anyone know a better
was to approch this problem?
I Also found that by using a different file handle to the same file
for each thread did improve the access file but this is not practical
for me.
|
| |
|
| |
2 Comments |
|
  |
|
|
  |
Author: ElGeckoElGecko
Date: Aug 5, 2008 02:08
Hello all,
From what I heard and read, the answer to my question would be "no",
but just in case, I will ask it here: is there a generic way, in
Delphi, to have get a constant copy of an object or a record?
By "constant", I mean "such that the compiler guarantees that you
cannot change through the object/record interface". I'm looking for
something like the "const" type modifier in C++.
Here is a longer explanation of what I am looking for:
I have a type:
TypeMyRecord = RECORD
FField1 : INTEGER;
FField2 : STRING;
FField3 : BOOLEAN;
END;
And I would like to have functions, which would allow me to access
information from such a record, but which would guarantee that I can't
modify it through this function.
For this precise record, I could create the type:
|
| Show full article (1.88Kb) |
|
4 Comments |
|
  |
Author: howrubhowrub
Date: Aug 4, 2008 16:50
In one of my apps, the ClientDataSet CalcFields fires 4 times.
Once during the insertion of the records,
Again looking through the Clientdataset,
Again when the First is called ClientDataSetAfterOpen proc,
Again when the First is called after the Open of the ClientdataSet.
Basically the detail of the ClientDataSetCalfFields Proc is that a
number of fields are build up from other fields, etc.
So, to avoid setting the fields every time it goes through the
CalcField's Proc, I've put a check in that checks to set if the RecNo
is equal to -1 and if so update the fields in the Clientdataset.
I probably could have checked that the State of the clientdataset was
in dsInsert.
Does anyone see any flawed in this plan?
|
| |
|
no comments
|
|
  |
Author: MoralesMorales
Date: Aug 4, 2008 09:12
=======================================
Why PAY TOO MUCH for FUEL
Learn how to protect our
Environment and Reduce unnecessary
spending
=======================================
http://www.fuellegacy.com/dkokeefe
=======================================
@ldui
|
| |
|
no comments
|
|
  |
Author: dave.fobaredave.fobare
Date: Jul 29, 2008 17:18
Why can't I do something like the following?
procedure test(numArgs:integer; MyFormattingString:string);
var
v:variant;
i:integer;
begin
v:=VarArrayCreate([0,numArgs],varVariant);
for i:=1 to numArgs do
v[i-1]:=myDataSet.FieldByName(inttostr(i)).asstring;
memo1.lines.add(Format(MyFormattingString,[v]);
.........
I want to build the arguments I give to Format on the fly. Is there
any way to do this?
|
| |
|
1 Comment |
|
  |
Author: Tony.DeMarshTony.DeMarsh
Date: Jul 28, 2008 10:24
I'm having trouble understanding why the Item1 object isn't being set
to nil in the following example. After the Transaction.Free; line is
executed, the debugger shows that Item1's value is still set to ($20)
or sometimes ($C), but before this line, it is something like
($D53DC8).
Shouldn't the ItemList := nil; line in the TTransaction.Destroy
destructor be setting the Item1's value to nil as well?
unit Main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
Forms,
Dialogs, StdCtrls;
|
| Show full article (1.96Kb) |
|
1 Comment |
|
  |
Author: Sa¹a BistroviæSa¹a Bistroviæ
Date: Jul 22, 2008 11:13
SetEnvironmentVariable PROBLEM
How to get in SHOWMESSAGE dialog box CHAR 'A' ?
---->>>Project1.DPR BEGIN---->>>
program Project1;
uses
SysUtils, Dialogs, Math, Windows;
var I:integer;
begin
I:=FileCREATE('DATA.TXT');
FileWrite(I,'DATA.TXT',Length('DATA.TXT'));
FileSeek(I,1,1);
FileRead(I,PChar(SetEnvironmentVariable(PChar('DATA'),nil))^,1);
showmessage(GetEnvironmentVariable(PChar('DATA')));
end.
<<
----Project1.DPR END<<<----
PLEASE HELP.
THANK YOU.
|
| |
|
no comments
|
|
  |
|
|
  |
|
|
  |
Author: skeleton8skeleton8
Date: Jun 10, 2008 19:45
Hi I found one function which I want to use
code:
function DesktopColor(const x,y: integer): TColor;
var
c:TCanvas;
begin
c:=TCanvas.create;
c.handle:=GetWindowDC(GetDesktopWindow);
result:=getpixel(c.handle,x,y);
c.free;
end;
I know how to use this but I f I put it in loop (timer interval=1)
memory gets higher and higher up to 7666K then Delphi stops the
programm with error "Canvas does not allow drawing".
So probably is something wrong with memory, how can I "relase" not
used memory?
procedure TForm1.Timer1Timer(Sender: TObject);
var
i:integer;
begin ...
|
| Show full article (0.67Kb) |
|
no comments
|
|
|
|
|
|
|