Virgo
Members-
Content Count
106 -
Joined
-
Last visited
Everything posted by Virgo
-
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....
-
Getting started with Ubuntu 18.04. Error Could not open DLL
Virgo replied to J. Robroeks's topic in Python4Delphi
If UseLastKnownVersion is True, then try installing also libpython3.X-dev package. Or set UseLastKnownVersion to false and assign DllPath and DllName -
struggling while importing c-function with multiple dereferenced pointers
Virgo replied to Daniel's topic in RTL and Delphi Object Pascal
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; -
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.
-
Micro optimization: use Pos before StringReplace
Virgo replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
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. -
Micro optimization: use Pos before StringReplace
Virgo replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
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. -
Micro optimization: use Pos before StringReplace
Virgo replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
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
-
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.
- 28 replies
-
- firedac
- calculated fields
-
(and 1 more)
Tagged with:
-
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.
- 28 replies
-
- firedac
- calculated fields
-
(and 1 more)
Tagged with:
-
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 cTaxYear But that does gives 2006-7 instead of 2006-07....
- 28 replies
-
- firedac
- calculated fields
-
(and 1 more)
Tagged with:
-
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)...
- 28 replies
-
- firedac
- calculated fields
-
(and 1 more)
Tagged with:
-
In original SQL query?
- 28 replies
-
- firedac
- calculated fields
-
(and 1 more)
Tagged with:
-
How is this field calculated? Because if it is calculated in OnCalcField event, then it is not really InternalCalc field.
- 28 replies
-
- firedac
- calculated fields
-
(and 1 more)
Tagged with:
-
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; before finally Py_XDECREF(pResult); end; P will be reference to internal buffer in pResult and Py_XDECREF(pResult); frees that memory.
-
Right, there was or, so p value was red herring. Although (p=nil) check is invalid anyway, because value of p is undefined there.
-
Looking original code in unit1.pas from git: value of P is undefined there, because it is never initialized. What happens, if you add p := nil; at the beginning of Button2Click?
-
Barcode scanner? Those are usually just USB keyboards. Or are Zebra ones different?
-
THttpCli get request fail with 404 Bad Request result
Virgo replied to drazde's topic in ICS - Internet Component Suite
Since it is plain http you can use Wireshark to check, what is different in network request comparing browser and you program. -
Right... Did not check the FMX part.
-
But what about TButton.DropDownMenu ? I think, that this is intended for what you are trying to achieve.