Jump to content

Abaksoft

uniGUI Subscriber
  • Posts

    1558
  • Joined

  • Last visited

  • Days Won

    87

Posts posted by Abaksoft

  1. Interesting !

    I am tchatting with ChatGpt 3.5 

    Q: Thank you. Is AjaxRequest client side in unigui ?

    A: I apologize for any confusion in my previous responses. I made an error in my explanation. The AjaxRequest function in UniGUI is indeed server-side and is used for making asynchronous requests to the server.

    To perform calculations on the client side in UniGUI, you can use UniSession.AddJS to execute JavaScript code directly on the client. I appreciate your understanding, and I'm here to assist with any further questions or adjustments you may need.

     

    Q: So, what benefits to use UniSession.AddJS instead of pascal code ?

    A: Using UniSession.AddJS to execute JavaScript code on the client side in UniGUI provides several benefits:

    1. Client-Side Interactivity: It allows you to enhance the interactivity of your UniGUI applications by directly manipulating the client-side (browser) behavior. This is useful for tasks that are more efficiently handled on the client side without requiring a round-trip to the server.

    2. Reduced Server Load: Client-side operations with JavaScript don't involve server round-trips, reducing the load on the server. This is beneficial for tasks that can be handled locally by the browser without the need for server-side processing.

    3. Dynamic Updates: You can dynamically update the client-side user interface in response to user actions without refreshing the entire page. This leads to a smoother and more responsive user experience.

    4. Asynchronous Processing: JavaScript code executed via UniSession.AddJS is asynchronous, allowing you to perform actions on the client side while other server-side operations may be ongoing. This can improve the overall responsiveness of your application.

    5. Access to Browser Features: JavaScript provides direct access to browser features and APIs, enabling you to utilize a wide range of client-side functionalities that may not be easily achievable with Pascal code alone.

    However, it's essential to strike a balance and use client-side code judiciously. Certain tasks are better suited for execution on the server side, especially when involving sensitive data or complex server interactions. Always consider the security implications and user experience when deciding whether to use client-side or server-side logic.

    User
    You
    Great !
    ChatGPT
    ChatGPT

    I'm glad you found the information helpful! If you have any more questions, whether they're related to UniGUI, web development, or any other topic, feel free to ask. Happy coding!

    ChatGPT can make mistakes. Consider checking important information.
  2. I asked:

    Great. How to translate this on unigui framework ?

    Answer:

    To achieve a similar functionality in UniGUI, you need to adapt the JavaScript logic within the context of a UniGUI application. UniGUI is a framework for developing web applications using Delphi Object Pascal. Here's an example of how you might translate the logic using UniGUI:

    Assuming you have three UniEdit components named UniEditA, UniEditB, and UniEditC on your UniGUI form:

     

    If you want to perform the calculation on the client side without involving server communication, you can use JavaScript directly in UniGUI. UniGUI allows you to execute JavaScript code from the server side.

    Assuming you have three UniEdit components named UniEditA, UniEditB, and UniEditC, you can attach the following event handlers to their client-side events:

    unit MainForm;

    interface

    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, uniGUIForm, uniGUIClasses, uniBasicGrid, uniDBGrid, uniButton, uniBitBtn,
      uniSpeedButton, uniGUIBaseClasses, uniPanel, uniLabel, uniEdit, uniGUIFrame,
      uniFrame;

    type
      TMainForm = class(TUniForm)
        UniLabelA: TUniLabel;
        UniLabelB: TUniLabel;
        UniLabelC: TUniLabel;
        UniEditA: TUniEdit;
        UniEditB: TUniEdit;
        UniEditC: TUniEdit;
        UniButtonCalculate: TUniButton;
        UniFrameController: TUniFrameController;
        procedure UniFormCreate(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;

    var
      MainForm: TMainForm;

    implementation

    {$R *.dfm}

    procedure TMainForm.UniFormCreate(Sender: TObject);
    var
      Script: string;
    begin
      // Attach the client-side events
      Script :=
        'function calculateFields() {' +
        '  var valueA = parseFloat(document.getElementById("' + UniEditA.JSName + '").value) || 0;' +
        '  var valueB = parseFloat(document.getElementById("' + UniEditB.JSName + '").value) || 0;' +
        '  var result = valueA + valueB;' +
        '  document.getElementById("' + UniEditC.JSName + '").value = result;' +
        '}' +
        'document.getElementById("' + UniButtonCalculate.JSName + '").addEventListener("click", calculateFields);';

      UniFrameController.ExecuteJSCode(Script);
    end;

    initialization
      RegisterAppFormClass(TMainForm);

    end.
     

    This code uses the UniFrameController component to execute JavaScript code on the client side. It attaches a client-side event to the button click, which performs the calculation in JavaScript without communicating with the server. Adjust the code based on your specific needs and UI structure in UniGUI.

     

    ________

    All this is from ChatGpt :)

  3. 21 hours ago, Stemon63 said:

    Have you a solution?
    Thanks

    Good morning Stemon,

    ChatGpt is your best friend.

    I asked :

    Hellow, Ho to calculate with javascript on client side, the Field C = Field A + Field B.

    Let say Field A and Field B are edit text on the browser ? Thx

     

    Answer :

    Hello! In JavaScript, you can perform calculations on the client side by accessing the values of the input fields, performing the addition, and then updating the value of the result field. Here's a simple example assuming you have two input fields (Field A and Field B) and you want to display the result in another input field (Field C):

     

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Calculate Fields</title>
    </head>
    <body>

        <label for="fieldA">Field A:</label>
        <input type="text" id="fieldA" />

        <label for="fieldB">Field B:</label>
        <input type="text" id="fieldB" />

        <label for="fieldC">Field C (Result):</label>
        <input type="text" id="fieldC" readonly />

        <script>
            // Get references to the input fields
            var fieldA = document.getElementById('fieldA');
            var fieldB = document.getElementById('fieldB');
            var fieldC = document.getElementById('fieldC');

            // Add event listeners to trigger the calculation when the input changes
            fieldA.addEventListener('input', calculate);
            fieldB.addEventListener('input', calculate);

            function calculate() {
                // Get values from input fields and convert them to numbers
                var valueA = parseFloat(fieldA.value) || 0;
                var valueB = parseFloat(fieldB.value) || 0;

                // Perform the calculation
                var result = valueA + valueB;

                // Update the result field
                fieldC.value = result;
            }
        </script>

    </body>
    </html>

     

    This example uses basic HTML and JavaScript to achieve the desired calculation on the client side. The calculate function is triggered whenever the input in Field A or Field B changes, and it updates the result in Field C accordingly.

     

    __________

    I am not in my office to test it. But i am sur, you can do something with these elements.

     

  4. On 12/2/2023 at 7:24 AM, Farshad Mohajeri said:

    It is available, but not public.

    @Farshad,

    Our Mobile manager inventory system for supermarkets is in production and works fine.

    A big thx to marlon's components, unimFsQrCodeScanner  

     

    • As we sell the solution with a licence which supports total Active Sessions,

    • As we are using classical  SessionList technic (from unigui Demo)

    When the total active sessions is reached, and an other user attempt to run the app from its mobile browser, 

    he has to wait for 5 min (timeOut session) to run again the app (asking a colleague to close his browser).

    it is a bit embarrassing.

     

    So, i come back to you :

    Would you be kind to open visibility on GetTotal active sessions with embeded websockets ?

    This will be the fastest way to get it.

    Thx

     

    Edited

    I have already tried to use @picyka technic, wich works fine on desktop browsers, but not on mobile browsers (as described in a topic above)

  5. A good news 😅

    Incredible !

    When opening the same app protected by our Self Signed Certificat, on a Customer   iphone , the secure padlock appears. Without importing certificate !

    "Wow...the secure warning did'nt appear... ". I said

    "Well it's an iphone..." He said.

    It seems that extensions v3_req'  

    Is a good recipe.

  6. On 12/22/2023 at 1:45 PM, diegojmap said:

    Is there a command to kill the Process in HyperServer?
     

    Edited : Sorry, this is avalable for service deployment, not for iis.

     

    Yes.

    Just stop your hyperserver Service :

    •  from comand line (cmd as admin)

    hyper_service.exe /uninstall myapp

    https://www.unigui.com/doc/online_help/hyperserver-windows-service-mo.htm

     

    • Or you can try this :

    http://forums.unigui.com/index.php?/topic/14896-a-windows-service-installer/

     

  7. On 12/22/2023 at 1:45 PM, diegojmap said:

    The problem is when creating the MainModule.
    I used a UniThreadTimer in the UniGUIMainModuleCreate event.

    • AFAK, Never use UniThreadTimer on a session units  (MainModule, UniDataModule, MainForm...or any session's UniForm).

    • UniThreadTimer is dedecated for ServerModule.

     

  8. 58 minutes ago, Fábio Matte said:

    Good Morning Norma, I'm going to do what you did in your application and try to see if I can get a result.

    Thanks.

    Hello Fabio,

    There is a difference between :

    • A Global variable inside a session (for all forms, units, frames,... attached to this session)

    http://forums.unigui.com/index.php?/topic/11974-global-variable/&do=findComment&comment=63879

     

    • And a Global variable for all sessions (var on ServerModule)

    Here, also there is an attention if you will go with Farm Server :

    http://forums.unigui.com/index.php?/topic/17463-global-object/&do=findComment&comment=95684

     

  9. Hello,

    Did you see the documentation :

    https://www.unigui.com/doc/online_help/linux64.htm

     

    I am asking my self : why should i go to linux ?

    Is windows environment not enough ? Not stable ? Not reliable ? Expensive ?

    Windows Server 2019 on ebay is about 50 €. 

    And keep in mind that deploying on linux requires an EMB Enterprise Delphi licence at $3000 (actually discount $2400).

    Can you explain your motivations to go for linux (pros / cons) ?

    Thx

     

  10. 15 hours ago, picyka said:

    This is complicated, I already did some tests a while ago, sometimes you have several browser tabs open, and you close the browser directly, and these events do not pass.

     @Picyka   and   @Farshad 

    I apologize for my False Alerte.

    Maybe a problem in my program.

     

    So, I created a new Empty Unigui Project and Tested (writing on an inifile time when closing Sessions) :

    • StandAlone 

    • As Service 

    • As Hyperserver

    in SSL mode and without SSL

    Both Client and Server Side

     

    Results :

    1. The good News :   On Desktop Browsers (intranet)

    - MainModule OnBeforeDestroy Event :  works fine   

      Don'nt use OnDestroy   

    - MainModule OnBrowserClose Event :  works fine !

     

     

    2. The Bad News :

    On Mobile Bowser (Chrome)  it does'nt fire Events   OnBeforeDestroy  and   OnBrowserClose

    This is the problem !  :(

     

     

  11. On 7/15/2023 at 5:37 PM, picyka said:

    MainModule event OnDestroy

    Humm...

    It does'nt work (build 1577).

    I came back to standard method (Demo / sessionList).

     

    Working with picyka tip

    I tried  :

    • StandAlone 

    • As Service 

    • As Hyperserver

    When closing the browser, MainModule event OnDestroy does'nt fire. So my session's table can not be upated (deleting current session).

    @Farshad :  MainModule OnCloseBrowser Event works only on server side. Not on Client side !

    why ?

    ________

    Edited :

    i am using intranet SSL

    https://192.168.1.11:8077

    Tested only with : Google Chrome

     

    • Happy 1
  12. On 12/9/2023 at 8:41 AM, Muhammad Idris said:

    Is MSOLEDB 19.3.2 installed on the database server or client side on the web server?

    and I use ADOConnection to connect to SQL Server

    image.png.b387485dc411a20c456f8fa3c88a12b3.png

    Muhammed,

    Avoid AdoConection (old technology)

    Use instead Devart components.

    They are much faster, stable and scalable. You have also pooling propertie for absorbing many open / close connections.

    - If you develop only with sqlServer then buy Sdac component 

    - If you develop with many RDBM, buy Unidac.

    Advise :

    Unidac has a global connection, but not specific to each rdbm. Sdac is more accurate and designed for SqlServer.

    https://www.devart.com/

  13. 3 hours ago, asapltda said:

    Is there a technical or commercial solution? Thank you for your input

     

    Hello asapltda,

    1- If you want to print directly on your portable printer ( from your mobile) you have some solutions here on forum:

    You can do a search with all  these words : "on local printer".

    See for example :

    http://forums.unigui.com/index.php?/topic/19052-unigui-printer-server-also-lite-version-coming-soon-release-i/&do=findComment&comment=107064

     

    2- if you want to print from a classical viewer (like unigui /  fastReport Demo) with your mobile, than just connect your portable printer to your mobile. That's all. There are many printers on market, wich can be installed on an Android mobile and communicate with Bluetooth.

    3- You don't need a Zebra PDA 

     

     

  14. On 10/13/2023 at 8:02 PM, rayhildebrant said:

    HI!

    Sometimes after we deploy a new version by deploy folder, when the user open the application, the older version is loaded, not the new one;

    Someone can help me to solve this pls ?

     

    unigui version: 1.90.0.1511

     

    image.thumb.png.3ae1ce54168d78a72dbf03a576dad78d.png

    Hi,

    1. Obviously, clean your browser (parameters > delete history)

    2. Not obvious:

    http://forums.unigui.com/index.php?/topic/18298-connection-issues/&do=findComment&comment=101078

    3. You can deploy the new version without stoping the hyperservice : just copy your new project.exe file to ...\deploy\project.exe

    And rename it with .dep extension

    ...\deploy\project.dep

     

    4. If all this not works, then change your port 8077

     

    • Thanks 1
  15. On 11/7/2023 at 5:03 AM, Muhammad Idris said:

    but why is it that when I divide the service into 3 hyperservers the application slowdown doesn't occur

    image.png.6a2cbac2a96acb423aebeb92b6389dc7.png

    image.png.caa9a6735d02872b8d16682f4c8c8700.png

    image.png.9c5dd1d8b0c02905aca513dadc2cb120.png

    Muhammad,

    1. Are you using your own technic for loadbalancing or official Server Farm hyperservers ?

    2. In the second case, did you follow step by step the doc :

    https://www.unigui.com/doc/online_help/hyperserver-server-farm.htm

     

×
×
  • Create New...