Jump to content

Serge_G

Members
  • Content Count

    311
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Serge_G


  1. 2 hours ago, Jasonjac2 said:

    Hi Serge, thanks for replying.  I didn't understand: "why is the FDPhysFBdriver is not compatible is to me largely incomprehensible" - do you mean it doesn't work at all or on certain versions of FB? 

    FB on android - I wasn't sure that people were doing this - which version did you use?

    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)

     

    3 hours ago, Jasonjac2 said:

    Thanks for the vote of confidence in them.

    I am not so optimist I think (and really prefer Firedac)


  2. 8 hours ago, taariq said:

    If I want to use program on another pc can I just like in Access copy the DB into correct folder and use or do I need to install something ells on that pc...
    Thanks for all the reply's and help...appreciate it...

    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. 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. On 2/13/2022 at 3:33 PM, Vandrovnik said:

    Hi,

    I am using IBX on Windows (32 and 64bit) and Android (32 and 64bit). Database = Firebird (2.5 and 3.0). In Delphi 11, I have not found any problem.

    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 :classic_biggrin:)


  5. 16 hours ago, alank2 said:

    Are you saying you replaced the background TButtonStyleObject with a TRectangle?

    Yes, acting so even if you change stylebook at run time this custom style is independent

     

    16 hours ago, alank2 said:

    Can the bitmap graphics that NormalLink points to be edited? 

    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

    16 hours ago, alank2 said:

    What if I wanted to add something to that bitmap?

    I guess increasing the size of the image, putting the desired drawing outside the already defined areas will do the trick

    Capture_1.PNG

     


  6. 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

    Capture_1.PNG


  7. 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) 

     

     

     


  8. 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 ?

     

    Capture_1.PNG


  9. 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 :classic_wink:) 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 

    • Like 1

  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 
    image.thumb.png.a4b28f776030924e6048f57cac717de1.png

    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. 50 minutes ago, Anders Melander said:

    You haven't shown how you're handling the bitmap returned from ConvertToGrayscale

    Sorry, I tried to edit my first message but don't work :classic_ohmy:

    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

    image.thumb.png.927e844acdad69409811f2ae59e74b90.png

    54 minutes ago, Anders Melander said:

    Apart from that your grayscale algorithm is horribly inefficient (and wrong).

    Well, I try this ones

    // https://www.johndcook.com/blog/2009/08/24/algorithms-convert-color-grayscale/

  12. 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   
    ---------------------------

     

     


  13. 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;
    Quote

    RDB$USER        RDB$RELATION_NAME    RIGHTS
    FOURNISSEUR  LLANCEMENT                         S     ,U     ,U     ,U     ,U     ,U     ,U     ,U     ,U     ,U     ,U     ,U     ,U     
    SYSDBA            LLANCEMENT                         D     ,I     ,R     ,S     ,U     
    USINE               LLANCEMENT                         S     ,U     ,U     ,U     ,U     ,U     ,U     ,U     ,U     ,U     ,U     ,U     

    But this don't give the "reality" of the rights user FOURNISSEUR (supplier) don't have the same field access than USINE (factory)

    Quote

    RDB$USER    RDB$RELATION_NAME    RDB$FIELD_NAME    RIGHTS
    FOURNISSEUR                        LLANCEMENT                         [null]    S     
    FOURNISSEUR                        LLANCEMENT                         COLIS                              U     
    FOURNISSEUR                        LLANCEMENT                         COMPLEMENT                         U     
    FOURNISSEUR                        LLANCEMENT                         DATE_DEPART                        U     
    FOURNISSEUR                        LLANCEMENT                         DATE_DEPART1TIMESTAMP              U     
    FOURNISSEUR                        LLANCEMENT                         DATE_DEPART2                       U     
    FOURNISSEUR                        LLANCEMENT                         DATE_DEPART2TIMESTAMP              U     
    FOURNISSEUR                        LLANCEMENT                         DATE_DEPART3                       U     
    FOURNISSEUR                        LLANCEMENT                         DATE_DEPART3TIMESTAMP              U     
    FOURNISSEUR                        LLANCEMENT                         DATE_LIV                           U     
    FOURNISSEUR                        LLANCEMENT                         LAST_MODIF                         U     
    FOURNISSEUR                        LLANCEMENT                         NOTE2                              U     
    FOURNISSEUR                        LLANCEMENT                         REMARQUE                           U     
    SYSDBA                             LLANCEMENT                         [null]    D     ,I     ,R     ,S     ,U     
    USINE                              LLANCEMENT                         [null]    S     
    USINE                              LLANCEMENT                         COMPLEMENT                         U     
    USINE                              LLANCEMENT                         DATE_DEPART                        U     
    USINE                              LLANCEMENT                         DATE_DEPART1TIMESTAMP              U     
    USINE                              LLANCEMENT                         DATE_DEPART2                       U     
    USINE                              LLANCEMENT                         DATE_DEPART2TIMESTAMP              U     
    USINE                              LLANCEMENT                         DATE_DEPART3                       U     
    USINE                              LLANCEMENT                         DATE_DEPART3TIMESTAMP              U     
    USINE                              LLANCEMENT                         FIN_FABS                           U     
    USINE                              LLANCEMENT                         LAST_MODIF                         U     
    USINE                              LLANCEMENT                         NOTE1                              U     
    USINE                              LLANCEMENT                         REMARQUE                           U     

    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


  14. 1 hour ago, emileverh said:

    Batchmove

    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

    Quote

    The datamodel is for both exact(!) the same on logical level, so all the indexes, foreign keys and constraints are the same. The model contains about 70 tables.

    should be esay too


  15. 1 hour ago, Frickler said:

    FireDAC doesn't support Paradox at all.

    I don't agree you can use ADO driver, even if I agree with your second remark

    Quote

    You have to port to another Database,

    Not necessarily Firebird : Paradox = Mon User so SQLite is sufficient 

    1 hour ago, Frickler said:

    no more SetRange and Filter,

    FDTable have these functions, personally  I prefer FDQuery but ... 


  16. 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

     

    • Like 1

  17. 11 hours ago, audi30tdi said:

    Database Desktop

    You mean  DBD32.Exe and the 2 errors about directories? 

    image.thumb.png.521cd8423369b91ac6f97355ad88fbe0.png

     

    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?


  18. 22 hours ago, Serge_G said:

    You have to go on your registered product portal and download BDE for your version.

    But BDE 5.2.0.2 is one of the last versions (remember deprecated for 20 years an not updated)

    44 minutes ago, audi30tdi said:

    that I can't install in Win10

    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)

    image.thumb.png.fb73aced24e0da6b8f2a11a6fba3c367.png

     

    - change memory size and address (depending on tour computer)

    image.thumb.png.816135a7c121bac5820047c4fe069318.png

     

    - 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

    image.png.c1c85c95a3c1f2b6aa735c6247a00331.png

     

    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 :classic_biggrin:

    image.thumb.png.2ffcddc7ef4144d35c82661a83422bf6.png

    • Like 1

  19.  

    29 minutes ago, audi30tdi said:

     

    Is FireDAC included with the latest Delphi version?? 

    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)

     

×