Jump to content

Serge_G

Members
  • Content Count

    311
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Serge_G

  1. Ah, I was not so clear. FDPhyFBDriver is not compatible with Android and IOS. It's not a FB version problem. I use only FBclient on Android (Firebird 4 or 3 no matter) and connect to a Fb 2.5 server (without any problem) but only with ZEOSDBO components. Vandrovnik change some part of IBX.IBIntf.pas to access Firebird instead of Interbase (see this discussion) I am not so optimist I think (and really prefer Firedac)
  2. Serge_G

    Syntax error in From clause

    There are 2 ways to use Firebird : Firebird Client/Server - You have to deploy the DB and Firebird on the other pc Firebird Embedded - You have to put some files and directories in the same directory than application For a multi user Firebird app, it's quite the same approach except you deploy only client part, with the Firebird Setup it's easy, embedded you need at least fbclient.dll and perhaps firebird.msg files in the same dir that the app. Recommendation : Don't copy the DB file, uses backup/restore. Use a GUI Tool like Flamerobin
  3. Serge_G

    Syntax error in From clause

    Hi one parenthesis to delete in the first line dmTaS.query_JobCard.SQL.Add('Insert into JobCard'); Lacking of a parenthesis after 'Values' dmTaS.query_JobCard.SQL.Add('Values (:ID :OrderNo, :JobName)'); Consider other solutions to write SQL to be more clear, i.e. const ISQL = 'INSERT INTO JobCard (ID ,OrderNo ,JobName) VALUES ( :ID :OrderNo, :JobName)'; // the "good" SQL for INSERT begin dmTaS.query_JobCard.Close; dmTaS.query_JobCard.SQL.Text:=ISQL; dmTaS.query_JobCard.Parameters.ParamByName('ID').Value := lb_ID.Text; dmTaS.query_JobCard.Parameters.ParamByName('OrderNo').Value := lb_OrderNo.Text; dmTaS.query_JobCard.Parameters.ParamByName('JobName').Value := lb_JobName.Text; dmtas.query_JobCard.ExecSQL; // dmTaS.query_JobCard.SQL.Clear; // unnecessary you use SQL.Text dmTaS.query_JobCard.SQL.Text := 'Select ID ,OrderNo ,JobName from JobCard'; // let's say I prefer list of columns needed rater tha a * dmTaS.query_JobCard.Open; Under this form, it's easier to maintain IMHO
  4. Serge_G

    CDATA Woocommerce component

    Hi, still in experimentation. We have one woocommerce site, but traffic is low and interfacing (integrating orders/updating stocks) with my Delphi ERP is not a high priority. So I only made some connection and query tests
  5. Interesting, I certainly prefer Firedac (why is the FDPhysFBdriver is not compatible is to me largely incomprehensible) and never think to use IBX instead 😲! I have tried other third party components to reach a Firebird DataBase like ZEOSDBO or UNIDAC, succesfully (even if deploying firebird on Androïd is really challenging the firsts times )
  6. Serge_G

    TSpeedButton - how to change the background color

    Yes, acting so even if you change stylebook at run time this custom style is independent Yes, even if it's not so easy, you have to change about three PNG images (dpi necessity) . I remember a video by Sarina Dupont about using Adobe and Stencils to change colors (see this tool) sorry, I don't found the link and many others interventions (videos, blogs) about bitmap designer tool Basically, using bitmap designer tool : save image , edit images with whatever tool you have, and then return to bitmap designer, load the new image (hoping this should not change regions defined, I never check this) Yes, you should say : "but bitmap designer is for VCL" (VSF file) but it's easy to save it as a FMX style I guess increasing the size of the image, putting the desired drawing outside the already defined areas will do the trick
  7. Serge_G

    TSpeedButton - how to change the background color

    Well, it's FMX, so you can change the style (creating a custom one or modifying existent) Here I delete initial background, put a TRectangle (aligned contents), sending it background (control/background) and set property stylename to background too. Advantage you can "easily" change color of a Trectangle. Inconvenient : - if you want to use all other buttonstyles, you have to do the same thing ! - if you use dark colors, take care of the fontcolor Notice, same as always, if you use it for all platforms change default style not the "Windows" default one
  8. Serge_G

    [FMX] Dll not found

    Hi, I was testing D11 and Python4Delphi components (Getit version) With VCL 32 bits and 64 bits application execute, 👍 good job Same program FMX but, if 64 bits is OK, 32 bits raise an exception. Any explication ?
  9. Serge_G

    [FMX] Dll not found

    Hi, thanks. UseLastKnownVersion is/was checked (by the way it's the 3.10.2) I was not aware of this property, unchecking it raise an "could not open Dll "python310.dll" exception (always and only on 32 bits)
  10. Hi, in my application I offer to the user the possibility to change style (light/dark) procedure TStartForm.SwitchThemeSwitch(Sender: TObject); begin Datas.StyleBookLight.UseStyleManager:=false; Datas.StyleBookDark.UseStyleManager:=false; if SwitchTheme.IsChecked then MainForm.StyleBook:=Datas.StyleBookDark else MainForm.StyleBook:=Datas.StyleBookLight; datas.parametres.blacktheme:=SwitchTheme.IsChecked; Datas.StyleBookLight.UseStyleManager:=not SwitchTheme.IsChecked; Datas.StyleBookDark.UseStyleManager:=SwitchTheme.IsChecked; {TODO -obug -cGeneral : TListview style don't apply on first lines} end; All is working except on my TListView, as you can see. Here I change from light to dark, font text color is still black on these lines, scrolling down the color is the "normal" white I remember I bang this bug another times, I override this by deactivating and then reactivating the link, but this is time-consuming when there are many records! Is there another way ?
  11. Serge_G

    Changing Style at runtime and TListview

    Hi, this "bug" is corrected in version 11 (and perhaps 10.4, I don't check that)
  12. Serge_G

    64 bit PostgreSQL and Embarcadero ???

    Hi, first you have to install the two versions of PostgreSQL (32 and 64) the first for the IDE the second when running/debugging 64 apps On the other hand, at runtime you can change library path (before connecting ) for this you need to put a FDPhysPgDriverLink (give it a DriverID, id to be used by FDConnection) and then you will be able to change Vendorlib
  13. Serge_G

    Grayscaling an image (memory leak)

    HI, I wrote this unit to grayscale an image unit ImageUtils; interface uses System.SysUtils, System.UITypes, System.UIConsts , System.Math, FMX.Types, FMX.Graphics, FMX.Utils; type Talgorithm = (algnone,algluminosity,algaverage,alglightness); function ConvertToGrayscale(const aBitmap: TBitmap; const aMethod : TAlgorithm=algnone) : TBitmap; overload; function ConvertToGrayscale(const FileName : String; const aMethod : TAlgorithm=algnone) : TBitmap; overload; implementation function Colortogray(const aColor : Talphacolor; const aAlgo : TAlgorithm=algnone) : Talphacolor; var H,S,L : Single; C : TAlphacolorRec; // https://www.johndcook.com/blog/2009/08/24/algorithms-convert-color-grayscale/ begin RGBToHSL(aColor,H,S,L); c.Color:=acolor; case aAlgo of algluminosity: begin H:=Trunc(0.2126*c.R) + Trunc(0.7152*c.G) + Trunc(0.0722*C.B); Exit(HSLToRGB(H,S,L)); end; algaverage: begin var mean : integer := (c.R + c.G + c.B) div 3; c.R:=mean; c.G:=mean; c.B:=mean; Exit(c.Color); end; alglightness: begin H:=(maxvalue([TAlphacolorRec(aColor).R,TAlphacolorRec(aColor).G,TAlphacolorRec(aColor).B]) + minvalue([TAlphacolorRec(aColor).R,TAlphacolorRec(aColor).G,TAlphacolorRec(aColor).B])) / 2; Exit(HSLToRGB(H,S,L)); end; else Exit(HSLtoRGB(0,0, L)); end; end; function ConvertToGrayscale(const aBitmap: TBitmap; const aMethod : TAlgorithm=algnone): TBitmap; var X, Y: Integer; bd1, bd2: TBitmapData; p1, p2: PAlphaColorArray; begin Result := TBitmap.Create(Round(aBitmap.Width), Round(aBitmap.Height)); if (aBitmap.Map(TMapAccess.Read, bd1) and Result.Map(TMapAccess.Write, bd2)) then begin try for Y := 0 to (aBitmap.Height - 1) do begin p1 := PAlphaColorArray(bd1.GetScanline(Y)); p2 := PAlphaColorArray(bd2.GetScanline(Y)); for X := 0 to (aBitmap.Width - 1) do begin p2[X] := Colortogray(p1[X],aMethod); end; end; finally aBitmap.Unmap(bd1); Result.Unmap(bd2); end; end; end; function ConvertToGrayscale(const FileName : String; const aMethod : TAlgorithm=algnone): TBitmap; var X, Y: Integer; bd1, bd2: TBitmapData; p1, p2: PAlphaColorArray; Source : TBitmap; begin Source:=TBitmap.Create; try Source.LoadFromFile(FileName); Result := TBitmap.Create(Round(Source.Width), Round(Source.Height)); if (Source.Map(TMapAccess.Read, bd1) and Result.Map(TMapAccess.Write, bd2)) then begin try for Y := 0 to (Source.Height - 1) do begin p1 := PAlphaColorArray(bd1.GetScanline(Y)); p2 := PAlphaColorArray(bd2.GetScanline(Y)); for X := 0 to (Source.Width - 1) do begin p2[X] := Colortogray(p1[X],aMethod); end; end; finally Source.Unmap(bd1); Result.Unmap(bd2); Source.Free; end; end; except Source.Free; result:=nil; end; end; end. But I don't understand where I miss something because I have some memoryleaks --------------------------- Unexpected Memory Leak --------------------------- An unexpected memory leak has occurred. The unexpected small block leaks are: 29 - 36 bytes: TD2DBitmapHandle x 1, TBitmapImage x 1 45 - 52 bytes: TBitmap x 1 61 - 68 bytes: Unknown x 1 --------------------------- OK ---------------------------
  14. Serge_G

    Grayscaling an image (memory leak)

    Thanks, I was looking for an error in the bad unit !
  15. Serge_G

    Grayscaling an image (memory leak)

    Sorry, I tried to edit my first message but don't work procedure TfrmMain.btnGriserClick(Sender: TObject); begin if OpenDialog1.Execute then begin Image1.Bitmap.LoadFromFile(OpenDialog1.FileName); image2.Bitmap:= ConvertToGrayscale(image1.Bitmap); // image3.Bitmap:= ConvertToGrayscale(image1.Bitmap,TAlgorithm.algluminosity); // image4.Bitmap:= ConvertToGrayscale(image1.Bitmap,TAlgorithm.algaverage); // image5.Bitmap:= ConvertToGrayscale(image1.Bitmap,TAlgorithm.alglightness); end; end; result Well, I try this ones // https://www.johndcook.com/blog/2009/08/24/algorithms-convert-color-grayscale/
  16. Serge_G

    FB3 Get Connected Users List

    Hi, and happy new year. As far as I know about Firebird the system tables are prefixed MON$, RDB$ and (SEC$ starting with FB 3.0) not TMP$ to get privilege(s) on a table you can use select RDB$USER,LIST(RDB$PRIVILEGE) from rdb$user_privileges where RDB$RELATION_NAME=<tablename> GROUP BY 1 but some fields can be involved too so in this "list" you can find some repetitions Here is the result of a SELECT a.RDB$USER, a.RDB$RELATION_NAME,-- a.RDB$FIELD_NAME, LIST(a.RDB$PRIVILEGE) RIGHTS FROM RDB$USER_PRIVILEGES a WHERE a.RDB$RELATION_NAME='LLANCEMENT' GROUP BY 1,2; But this don't give the "reality" of the rights user FOURNISSEUR (supplier) don't have the same field access than USINE (factory) And take in mind you can change ROLE. I never really looked into the possibility of changing the access to the editing areas of a shape from the rights declared in a Firebird database, Interesting challenge for my future retirement
  17. Serge_G

    SQLite to MySQL

    FDBatchmove, yes a good tool and if it is a one shot operation you don't need to run the program you can make all your ops during design time, changing tables or querys and using context menu to run it but at runtime with these conditions should be esay too
  18. Serge_G

    Which version BDE

    I don't agree you can use ADO driver, even if I agree with your second remark Not necessarily Firebird : Paradox = Mon User so SQLite is sufficient FDTable have these functions, personally I prefer FDQuery but ...
  19. Serge_G

    error on Interbase 2020 server

    WITH dt2 AS ( select goods_id, sum(qty) as inc, cast(0 as float) as sale, cast(0 as float) as writeoff from income where cast(recdate as date) <= :d group by goods_id union all select goods_id, cast(0 as float), sum(qty) as sale, cast(0 as float) from sales where cast(recdate as date) <= :d group by goods_id union all select goods_id, cast(0 as float), cast(0 as float), sum(Qty) as writeoff, from writeoff where cast(recdate as date) <= :d group by w.goods_id) ) select G.Goods, G.Goods_id, coalesce(dt2.incomes,0)as incomes, coalesce(dt2.sales,0) as sales, coalesce(dt2.writeoffs,0) as writeoffs, coalesce(dt2.endqnts,0) as endqnts From Goods G JOIN dt2 on G.Goods_id=dt2.Goods_id on G.Goods_id=dt2.Goods_id order by G.Goods I think that, if CTE is really effective in Interbase 2020, this one is more clear Some notes : - Using alias in a union is not useful - I change the where clause in the last part of the union : where cast(recdate as date) <=:d ( hoping that this column exists in the table "writeoff") Question the JOIN between Goods and dt2, it shouldn't rather be a LEFT JOIN
  20. Serge_G

    Which version BDE

    You spoke about Database Desktop not Delphi 7, I am confused 😲 D7 works on Windows 10, I install/uninstall it about once a month
  21. Serge_G

    Which version BDE

    You mean DBD32.Exe and the 2 errors about directories? Well, I don't use, it but you have to know some clues The location of the BDE "Working" and "Private" directories are stored in HKEY_CURRENT_USER\Software\Borland\DBD\7.0\Configuration\WorkDir and HKEY_CURRENT_USER\Software\Borland\DBD\7.0\Configuration\PrivDir respectively. Each directory default value stores the data containing So my first suggestion is to check this. Other solution is to install D7 with the same hints as BDE (but you will get some trouble with coexistence, I ran into during a demo, TClientDataset) and use the DBD32.exe of this version. But, I have a doubt, if you need this old program, did you mean that you still use Paradox/DBase tables?
  22. Serge_G

    Which version BDE

    But BDE 5.2.0.2 is one of the last versions (remember deprecated for 20 years an not updated) It's easy to install BDE on Win 10 if you respect some hints. - don't install in the default directory (c:\progran files (x86)) but in a non-secured by UAC windows directory - run BDEAdmin as administrator - change NETDIR of paradox (see picture, from my w10 pc) - change memory size and address (depending on tour computer) - save IDAPI32.CFG to a non-secured by UAC windows directory and confirm it should be the default configuration file dialog when you exit BDE Even so, you will run into some problems from time to time (I suspect windows update) By the way, it's first time I check my version is
  23. Serge_G

    Which version BDE

    Yes You have a tool to migrate from BDE Components to Firedac ones : "refind" (C:\Users\Public\Documents\Embarcadero\Studio\22.0\Samples\Object Pascal\Database\FireDAC\Tool\reFind) You will find some step to step migration in docwiki (https://docwiki.embarcadero.com/RADStudio/Sydney/en/ReFind.exe,_the_Search_and_Replace_Utility_Using_Perl_RegEx_Expressions) But, before this, you have to go on your registered product portal and download BDE for your version. By experience even if it works, I prefer to create new Firedac components (connection, table and query) because Firedac is more powerful than BDE (i.e. macros)
  24. Serge_G

    error on Interbase 2020 server

    Well, in fact Interbase 2017 had non recursive CTE possiblities (named derived table) Good news to have now recursive ones, and can we expect in a near future, windows functions?
×