Virgo
-
Content Count
86 -
Joined
-
Last visited
Posts posted by Virgo
-
-
If application needs to be run at computer startup and even when user is not logged in, then I would suggest creating Windows service.
-
The reason I asked about how the program is started, that when it is started with Task Scheduler (sometimes programs use Task Scheduler to start program at user login) then there is check mark at trigger properties "Stop task if it runs longer than:" which defaults to 3 days. Maybe it is accidentally checked (it is not checked by default).
-
How is the program started originally?
-
12 minutes ago, Remy Lebeau said:I checked, and overload was added to TFileStream in Delphi 6, when the 3-parameter constructor for passing in Rights was introduced.
Right. And fpc allows in objfpc mode multiple constructors without overload, which explains why TFileStream in fpc has two constructors (2 parameters and 3 parameters), but does not allow creating TFileStream with THandleStream constructor.
-
QuoteA method can be redeclared using the overload directive. In this case, if the redeclared method has a different parameter signature from its ancestor, it overloads the inherited method without hiding it. Calling the method in a descendent class activates whichever implementation matches the parameters in the call.
So it appears, that calling TFileStream.Create with handle parameter works because, TFIleStream has constructors with overload;
That is something, that I newer knew.
Works in all Delphi ja FPC versions. Just in FPC TFileStream constructors are not with overload;
-
Strange. Passing handle to TFIleStream.Create does not work in Delphi 5, but works in Delphi XE. It also does not compile in FPC 3.2.0. And I do not understand, why it compiles with Delphi XE.
After all, TComponent.Create; does not compile....
-
If UseLastKnownVersion is True, then try installing also libpython3.X-dev package. Or set UseLastKnownVersion to false and assign DllPath and DllName
-
libvlc_media_tracks_release( LTracksPtr, LCount );
should be correct
In get function tracks is var parameter. Which is pointer. So that LTracksPtr itself is required parameter for release.
You can also always add types
Plibvlc_media_track_t = ^libvlc_media_track_t; PPlibvlc_media_track_t = ^Plibvlc_media_track_t;
and then functions would be
function libvlc_media_tracks_get(p_md : libvlc_media_t_ptr; var tracks : PPlibvlc_media_track_t ) : LongWord; cdecl; procedure libvlc_media_tracks_release(tracks : PPlibvlc_media_track_t ; i_count : LongWord ); cdecl;
-
1 hour ago, bazzer747 said:I'm aware that you can use a macro substitution in a select statement when you don't know some value until runtime (like a fieldname). If there a similar function that can be used in a Locate?
What is the actual question? That is what locate function does. You pass fieldname and search value at runtime and it searches.
-
Bpl is basically just dll file with different extension (Borland Pascal Library). You cannot edit those in notepad. If SQL is in resources, then you might be able to change that resource with resource editor (if bpl is not digitally signed). But then your query will only ever return first 100 records.
-
4 hours ago, Attila Kovacs said:System.SysUtils.StringReplace: "FoundPos := Pos(xOldPattern, Str, FoundPos);"
Fail.
So it is different in different Delphi versions.... In Delphi XE StringReplace does not use Pos... Instead it uses SysUtils.AnsiPos.
But on possible reasons why on negative cases (search string is not found) StringReplace is slower to return then checking with Post before (just in case sensitive version and on Delphi XE):
Multiple functions calls to find position of search string (StringReplace->AnsiPos->StrPosLen->StrLComp
String concatenation always.
- 1
-
22 minutes ago, Mike Torrettinni said:You are talking about pre 2009 versions?
Yes. Those used AnsiPos that calls AnsiStrPos, which has PChar parameters. And then ends up calling StrLen on both strings. Which basically means multiple full string scans. But Unicode version does not have such obvious problem.
-
That speed difference probably depends also on Delphi version. Looking at the code ansi versions of Delphi would have been much slower on those negative cases. In Unicode version I do not see any obvious problems.
-
You cannot join in delete statement.
-
There is not alias I on assignment... So the error is correct. Replace I.CURRATE with select to get correct value..
Maybe?
SELECT I.CURRATE FROM INVOICE I WHERE I.RNO = ID.RNO
-
23 minutes ago, Uwe Raabe said:According to the docwiki, InternalCalc fields are only supported in TClientDataSets:
Ok, so it is dependant of actual TDataSet descendant.
Anyway, did some reading and for Interbase/Firebirdsql fields declared in server as COMPUTED BY fields are also InternalCalc fields in Delphi (with IBX and components forked from it). Basically very specific usage.
-
I just managed to get InternalCalc field in my older version of Delphi and there it still behaves as normal calculated field in filters and sorting (not working). Maybe it depends on particular TDataSet descendant having support for this.
-
You could try adding somethin like following to select (example is for Firebirdsql, mod is different in MSSQL
CASE
WHEN EXTRACT(MONTH FROM DATEFIELD) < 4 THEN CAST(EXTRACT(YEAR FROM DATEFIELD) - 1 AS CHAR(4)) || '-' || CAST(MOD((EXTRACT(YEAR FROM DATEFIELD)), 100) AS CHAR(2))
WHEN EXTRACT(MONTH FROM DATEFIELD) > 4 THEN CAST(EXTRACT(YEAR FROM DATEFIELD) AS CHAR(4)) || '-' || CAST(MOD((EXTRACT(YEAR FROM DATEFIELD)+1), 100) AS CHAR(2))
WHEN EXTRACT(MONTH FROM DATEFIELD) = 4 THEN
CASE
WHEN EXTRACT(DAY FROM DATEFIELD) < 7 THEN CAST(EXTRACT(YEAR FROM DATEFIELD) - 1 AS CHAR(4)) || '-' || CAST(MOD((EXTRACT(YEAR FROM DATEFIELD)), 100) AS CHAR(2))
WHEN EXTRACT(DAY FROM DATEFIELD) >= 7 THEN CAST(EXTRACT(YEAR FROM DATEFIELD) AS CHAR(4)) || '-' || CAST(MOD((EXTRACT(YEAR FROM DATEFIELD)+1), 100) AS CHAR(2))
END
ELSE
NULL
END cTaxYearBut that does gives 2006-7 instead of 2006-07....
-
Ok, documentation seems to indicate, that InternalCalc fields are supposed to work, like you describe. But in my testing in older Delphi version I cannot manually add them to dataset (unlike calculated fields)...
-
3 minutes ago, bazzer747 said:Interesting. How would an InternalCalc field be calculated then?
In original SQL query?
-
How is this field calculated? Because if it is calculated in OnCalcField event, then it is not really InternalCalc field.
-
But also, from
if (P = nil) or (PyBytes_AsStringAndSize(presult, P, Len) < 0) then begin
"(p = nil) or" should be removed, because P is uninitialized, which only means, that it causes error, when P happens coincidentally initialize to nil.
-
After reading Python documentation I do not understand, how it can work in Delphi.
Move
_stream := TMemoryStream.Create();
try
_stream.Write(P^, Len);
_stream.Position := 0;
Image1.Picture.Graphic.LoadFromStream(_stream);
finally
_stream.Free;
end;
beforefinally
Py_XDECREF(pResult);
end;P will be reference to internal buffer in pResult and Py_XDECREF(pResult); frees that memory.
- 1
-
Right, there was or, so p value was red herring. Although (p=nil) check is invalid anyway, because value of p is undefined there.
MAP2PDB - Profiling with VTune
in Delphi Third-Party
Posted
Is map file format different in older delphi versions? With Delphi 5 and Delphi XP map files it always fails with "Overlapping segments".