Jump to content

Abaksoft

uniGUI Subscriber
  • Posts

    1558
  • Joined

  • Last visited

  • Days Won

    87

Posts posted by Abaksoft

  1. On 11/10/2023 at 3:00 PM, erich.wanker said:

    Hi Abaksoft,

     

    Thanx for your PERFECT work .. i tried a lot! of things and found a solution for the Android Problem 😉

    The maion problem is the "-extensions v3_req"

    1. change in delphi:

      //A.2.2  root.pem
      stDays:=intToStr(365 * upYrears.Position);
      param:='req -x509  -days ' + stDays + ' -new -nodes -key root.key -out root.pem -config san.cnf -extensions v3_req';
      ShellExecute(Application.Handle ,PChar('RunAs'),PChar(Fichier),PChar(param),PChar(Dossier),SW_HIDE);
      sleep(300);


      //A.2.3  cert.pem
      param:='req -x509 -nodes -days ' + stDays + ' -newkey rsa:2048 -keyout key.pem -out cert.pem -config san.cnf -extensions v3_req';
      ShellExecute(Application.Handle ,PChar('RunAs'),PChar(Fichier),PChar(param),PChar(Dossier),SW_HIDE);
      sleep(300);

     

    2. change in san.cnf

     

    [req]
    default_bits  = 2048
    distinguished_name = req_distinguished_name
    req_extensions = v3_req
    x509_extensions = v3_req
    prompt = no
    [req_distinguished_name]
    countryName = XX
    stateOrProvinceName = N/A
    localityName = N/A
    organizationName = Self-signed certificate
    commonName = Self-signed certificate
    [req_ext]
    subjectAltName = @alt_names
    [v3_req]
    subjectAltName = @alt_names
    basicConstraints = critical,CA:true
    [alt_names]
    IP.1 =10.0.0.10

    3. Export CA in Windows - and import it as CA in Android

     

    .. Works 🙂

     

     

     

     

    Oh...Super !

    Many Thx Erich

    That works fine :)

     

    Just for our friends, when importing the Certificate on Android, depending on your Android ;

    1. Go to Parameters

    2. Wifi

    3. Additional settings

    4. Certificates Installation

    5. Explore your directory to select your Certificat

    5. Using Certificate as :  VPN & Application   (not Wifi)

    That' all  :)

     

    NB:  I will post soon here, the program "Certificate in 3 secondes"  updated  with your great bring.

    Thx again Erich

     

    • Thanks 1
  2. 2 hours ago, Muhammad Idris said:

    what technique do you use and how many sessions can it handle?

    - A simple Unigui as Service,  HyperServer.

    - No more than 10 users 

    I would have really wanted to launch a new project with 1000 users in real time and exploit farm server for load balancing (what you are currently using with your 3 servers) but my plan failed.

    Maybe you should review the structure of your program.

    - use frames that open and close.

    - Free up Dataset resources (RAM) immediately.

    - minimize size of exe file 

    - use Pool connection to avoid braking RDB system

    _ etc...

     

  3. On 7/19/2023 at 11:28 PM, Abaksoft said:

    @Farshad

    Sorry if i come back again.

    uniGUIApplication.BroadcastMessage can reach all active (live) sessions. So the new websokets you have coded knows, for sure the total of these active sessions.

    If it's not hard, could you add please, a function that would give this number?

    n:=GetTotalActiveSessions;

    This will simplify many things.

    Thx

    Hello Farshad,

    Hoping all is good.

    Any update of this ?

    Function GetTotalActiveSessions

    With the new websocket

    Thx

  4. 17 hours ago, Ario.Paxaz said:

    @Abaksoft

    Hi,

    SSl_Error.jpg

    Hello Ario,

    Good.

    1. For PC client ( intranet), you have to export your new certificate from your server with :

    Win + R

    MMC

    Then import it to your PC client. That works fine for me.

     

    2. For Android....Hummm... i did'nt succeed. I gave up.

    I just say to my customers to continue with this not secure site, when runing the url from mobile browser.

     

     

    • Upvote 1
  5. 18 minutes ago, Bimmer said:

    So when the user selects one of the three databases - I can just setup the TFDConnection on my datamodule for the users session?

    Yes :)

    But, when you say "...and is accessed via rest-ap"

    can you explain more (from an other application. Not unigui ?)

  6. 38 minutes ago, Bimmer said:

    Hi all.

    I'm currently looking into how we can build an application where users are to login (via rest call to our existing user database) - and when granted authorization the user should get a selection of databases to choose from.

    In case that only one database is available for the user loging in - then no selection is needed and the user is just granted access to the database.

    How can this be implemented with the example : http://www.unigui.com/doc/online_help/small-login-form.htm

     

    There is no difficulties on this.

    OK Step by Step:

    1. Create an Unigui Project

    2. Add a login form

    3. In login form, when user click on Buton OK, then test here his acces in your existing user DB.

    3.1  If he is registred then :

     • 3.1.1. Send a local session variable on UniDataModule , for example --> nbDataBase :=3  (this user has 3 DB )

     • 3.1.2   If he is registred then ModalResul:=MrOk

    If he is not registred then

    ModalResul:=MrCancel

     

    4. On MainForm Activate event test this :

    if UniDataModule.nbDataBase<= 1 THEN  Form1.ShowModal

    else 

    Form2.ShowModal

     

    Form1 : is your working form

    Form2 : is a selected DataBase form.

    _____________

    Kind Regards

  7. 16 hours ago, Luciano França said:

    Delphi 10 up to the latest 11.3 is horrible every day that passes, it's a terrible IDE, I have to close it at least 6 times a day due to crashes and freezes

    Just want to confirm this.

    Yes i realized that Delphi 10.4 is

    - more stable

    - and faster

    Then D11.3

     

    I wonder if I'm not going to come back to D10.4

    ✔️

  8. On 8/5/2023 at 10:31 PM, MVakili said:

    And finaly

    for this 

    image.png.72743b2839fae5b49514111d05c1006f.png

    you can use this function + Unitimer

    function TDMT.Ping2(const AHost: string): Integer;
    var
      ICMP: TIdICMPClient;
      Started: Tdatetime;
    begin
       Result:=-1;
      Started := Now;
      ICMP := TIdICMPClient.Create(nil);
      try
        ICMP.Host := AHost;
        ICMP.ReceiveTimeout := 2000;
        ICMP.Ping();
        If  (ICMP.ReplyStatus.ReplyStatusType = rsEcho) Then
          Result:=MilliSecondsBetween(TDateTime.Now, Started);
    
      finally
        ICMP.Free;
      end;
    end;

    in timer

    procedure TMainForm.UniTimer1Timer(Sender: TObject);
    Var
       T : Integer;
       
    begin
       T:=Ping2('1.1.1.1');
       if T>=0 then
          LPing.Caption:=T.ToString+ ' ms'
       Else
          LPing.Caption:= ' Error';
    end;

     

    and for program server as @Sherzod guide me we can use this code

    Function UniServer(Var RetParams : Tstringlist):Integer;
    begin
      With RetParams Do
         Begin
            Add('Memory Used:'+UniServerModule.ServerResources.MemoryUsed.ToString+'/'+UniServerModule.ServerResources.PeakMemoryUsed.ToString);
            Add('Process Memory Used:'+UniServerModule.ServerResources.ProcessMemoryUsed.ToString+'/'+UniServerModule.ServerResources.PeakProcessMemoryUsed.ToString);
            Add('USER Objects:'+UniServerModule.ServerResources.USERObjects.ToString+'/'+UniServerModule.ServerResources.PeakUSERObjects.ToString);
            Add('GDI Objects:'+UniServerModule.ServerResources.GDIObjects.ToString+'/'+UniServerModule.ServerResources.PeakGDIObjects.ToString);
            Add('CPU Usage:'+FloatToStr(UniServerModule.ServerResources.CPUUsage)+'/'+FloatToStr(UniServerModule.ServerResources.PeakCPUUsage));
            Add('Handles:'+UniServerModule.ServerResources.Handles.ToString+'/'+UniServerModule.ServerResources.PeakHandles.ToString);
         End;
    end;

     

    Great !

    Thx

  9. On 8/3/2023 at 2:32 PM, Mossy said:

    I would like in a TuniEdit box when for example 4 characters typed to send an ajax request to the server and return a response, the response need to be shown to the user so they can select one of the choices.

    Hello Mossy,

    TUniedit has a property, delay time, on each Keystoke, before the event is gone (wich is by default 250 ms)  if i remember.

    Try to increase this property.

  10. 7 hours ago, irigsoft said:

    Hello, 

    I will share my code for draw in canvas on mobile and desktop devices:

     

    <div class="wrapper">
      <canvas id="myCanvas" width="840px" height="900px"></canvas>
    </div>

    <script type="text/javascript">

    $(function() {
      var mousePressed = false;
      var lastX, lastY;
      var canvas = $('#myCanvas')[0];
      var ctx;
      ctx = $('#myCanvas').get(0).getContext("2d");

      var color = '#000000';

      function log(str) {
        $(".status").html("<div>" + str + "<div>");
      }

    /*
      $('#skinModal').click(function() {
        $(".spectrum-input").change(function() {
          color = $(this).val();
        });
      })

      $("#skin-condition-save").click(function() {
        document.getElementById('right_side_face_canvas').value = document.getElementById('myCanvas').toDataURL('image/png');
        document.getElementById('left_side_face_canvas').value = document.getElementById('myCanvasTwo').toDataURL('image/png');
      });
    */

      function getCoords(evt) {
        var coords = {
          x: 0,
          y: 0
        };
        if (evt.type.indexOf("touch") != -1) {
          /*alert (evt.originalEvent.touches[0].pageX);*/
          coords.x = evt.originalEvent.touches[0].pageX;/*evt.changedTouches[0].pageX;  // not work on mobile*/
          coords.y = evt.originalEvent.touches[0].pageY;/*evt.changedTouches[0].pageY;  // not work on mobile */
        } else {
          coords.x = evt.pageX;
          coords.y = evt.pageY;
        }

        return coords;
      }


      $('.wrapper').on("mousedown touchstart vmousedown vclick", "canvas", function(e) {
        e.preventDefault();
        log(e.type);
        var second = $(e.target).attr("id") === "myCanvasTwo";
        mousePressed = true;
        var c = getCoords(e);
        Draw(c.x - $(this).offset().left, c.y - $(this).offset().top, false, second);
      });


      $('.wrapper').on("mousemove touchmove vmousemove", "canvas", function(e) {
        e.preventDefault();
        log(e.type);
        var second = $(e.target).attr("id") === "myCanvasTwo";
        var c = getCoords(e);
        if (mousePressed) {
          Draw(c.x - $(this).offset().left, c.y - $(this).offset().top, true, second);
        }
      });

      $('.wrapper').on("mouseup mouseleave touchstop vmouseup", "canvas", function(e) {
        log(e.type);
        mousePressed = false;
      });

      function Draw(x, y, isDown, isSecond) {
        if (isDown) {
            ctx.beginPath();
            ctx.strokeStyle = color;
            ctx.lineWidth = $('#selWidth').val();
            ctx.lineJoin = "round";
            ctx.moveTo(lastX, lastY);
            ctx.lineTo(x, y);
            ctx.closePath();
            ctx.stroke();
        }
        lastX = x;
        lastY = y;
      }

      function clearArea() {
        // Use the identity matrix while clearing the canvas
        ctx.setTransform(1, 0, 0, 1, 0, 0);
        ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
      }

    });

    </script>
     

     

    Thank you Irig,

    If you don't mind, can you send a sample, showing how to and where to put your script ?

    Thx again...

×
×
  • Create New...