Jump to content

Skyp

uniGUI Subscriber
  • Posts

    75
  • Joined

  • Last visited

Posts posted by Skyp

  1.  

    The solution does not work.

    When switching to the last entry in the page, switching occurs (immediately and not when pressing down again).

    But I corrected this as follows:

    1.We add two fields to the grid class (if there are several of them, then for each) (in section private, strict private):

    TmyClass=class(TUniForm)

    ...

    strict private

    FlastRecNoPrev, FlastRecNoNext: Integer;

    ...

    end;

    2. We add processing to the onKeyDown - DBGrid event (next code):

    if ((Sender as TUniDBGrid).WebOptions.Paged) and
        ((Key = VK_DOWN) or (Key = VK_Up)) then
      begin
        if (Key = VK_DOWN) and
          (((Sender as TUniDBGrid).DataSource.DataSet.RecNo mod
          (Sender as TUniDBGrid).WebOptions.PageSize) = 0) and
          (not(Sender as TUniDBGrid).DataSource.DataSet.Eof) then
        begin
          if FlastRecNoNext <> (Sender as TUniDBGrid).DataSource.DataSet.RecNo then
            FlastRecNoNext := (Sender as TUniDBGrid).DataSource.DataSet.RecNo
          else
          begin
            (Sender as TUniDBGrid).DataSource.DataSet.Next;
            FlastRecNoNext := (Sender as TUniDBGrid).DataSource.DataSet.RecNo;
            FlastRecNoPrev := FlastRecNoNext;
          end;
        end;

        if (Key = VK_Up) and
          ((((Sender as TUniDBGrid).DataSource.DataSet.RecNo - 1)
          mod (Sender as TUniDBGrid).WebOptions.PageSize) = 0) and
          (not(Sender as TUniDBGrid).DataSource.DataSet.bof) then
        begin
          if FlastRecNoPrev <> (Sender as TUniDBGrid).DataSource.DataSet.RecNo then
            FlastRecNoPrev := (Sender as TUniDBGrid).DataSource.DataSet.RecNo
          else
          begin
            (Sender as TUniDBGrid).DataSource.DataSet.Prior;
            FlastRecNoPrev := (Sender as TUniDBGrid).DataSource.DataSet.RecNo;
            FlastRecNoNext := FlastRecNoPrev;
          end;
        end;
        exit;
      end;

    3.We add processing to the onSelectionChange - DBGrid event (code):

     FlastRecNoNext := (Sender as TUniDBGrid).DataSource.DataSet.RecNo;
     FlastRecNoPrev := FlastRecNoNext;

    That's good, thanks for the tip.

    On 12/20/2023 at 7:38 PM, Sherzod said:

    ?

     

    What should I do with scrolling (mouse scroll -grid)?

    (when the user scrolls down the page (to the end) and tries to scroll down again, you need to switch the page)
    *Down - up

    Example:

    image.thumb.png.7af21859e311274810e82e576677a54a.png

    Again scroll: 

    image.thumb.png.25c66334837453615435a3a185ec4268.png

     

    how to do it?

     

     

  2. Hi, everybody.

    UniDBGrid, with a PageSize:=25 setting in a TDataSet of 50 records

    Being on the 25th line of the first page and pressing the down button (or scrolling the mouse) I want to get to the next page (the first line).

    Being on the first line of the 2nd page, pressing the button on the keyboard (or scrolling the mouse) up to get to the last line of the first page.

    Has anyone done this? (Paging must be enabled - i.e. it's not about infinity scroll)

  3. 22 hours ago, claudio.piffer said:

    Great! Thank you.

    In fact I could replace the Apache project with a standalone project and add HyperServer. Are you using quicklogger in your solution?

    Yes, it work with files and Opensearch(elasticSearch).

    • Like 1
  4. On 11/23/2023 at 11:33 AM, claudio.piffer said:

    Hi Skyp

    thank you very much for your answer. I forgot to indicate that module is a (linux) apache module and I have already tried with quicklogger but when I active the logger the server is no longer responding.

    In httpd.conf I tried to "tile" the log file but after some time the console block the server, probably because the rotation is active

    I have to investigate

    Best regards

     

     

     

    I use it on Linux - in HyperServer StandAlone and it works. I can't say what will happen with ISAPI

    • Like 1
  5. I ran into a problem that in version 1.95.0.1576 the WS does not work on the Login form.
    Of course, this is possible and correct, because the user has not yet logged in, but there are ReceiveSocketsEvents in the form properties, but there is no Delphi event BroadcastMessage(this handler is an illusion, because in fact WS listens only to the frontend and it sends an ajaxRequest to the backend).

    I have solved this problem (through a crutch😞

    1. property form ReceiveSocketsEvents - in True

    2. I add in ClientEvents - for event form.socketmesssage it code 

    image.png.f2d61d2a7e49e6d0a897bd1cf4c2408c.png

    3. And added a handler on onAjaxEvent...  (with my procedure, here will be your handler)

    image.png.7f729038792322962fc0e40ef589fbd9.png

    4. Next.. i add in Delphi Event - OnCreate (LoginForm) call:

      UniServerModule.WebSocketStack.CreateWebSocket(unisession, self.WebForm);

    this opens WebSockets in the browser - Ok 

    But if after that you try to log in (and on the main form you will listen to the WS channel) then you will get an error in the browser console:

    "WebSocket is closed before the connection is established"  - https://stackoverflow.com/questions/12487828/what-does-websocket-is-closed-before-the-connection-is-established-mean

    for Example:

     image.png.caeb909c180b0d87222d60cfb457ea48.png

    Okay not a nice mistake...  - We understand that we need to close the connection on the login form (before initializing the main form) because the connection is global... (We go to the JS part of the framework and look at everything in WS)

    5. Writing in Delphi class Helper:

    TUniWebSocketStackHelp = class helper for TUniWebSocketStack

      public

        procedure TerminateWS(const aForm: TUniBaseJSForm);

        procedure CloseWS(const aForm: TUniBaseJSForm);

      end;

    //...

     

    procedure TUniWebSocketStackHelp.CloseWS(const aForm: TUniBaseJSForm);

    begin

      with aForm.JSInterface do

      begin

        JSCallGlobal('uniWebSocketObj.closeSocket', []);

     

      end;

    end;

     

    procedure TUniWebSocketStackHelp.TerminateWS(const aForm: TUniBaseJSForm);

    begin

      with aForm.JSInterface do

      begin

        JSCallGlobal('uniWebSocketObj.terminateSocket', []);

      end;

    end;

    6. Before closing the login form (ModalResult.mrok), we perform:

    "UniServerModule.WebSocketStack.TerminateWS(self.WebForm);"

     

    - I hope this is useful to someone!! 

    • Thanks 1
  6. On 11/24/2023 at 3:01 PM, Farshad Mohajeri said:

    Can you please share the exact error message in the log file?

    Ok. 

    I Send bigData from WS to front-end (ExtJS) - and I see that I have an error on the child server of the cluster (only there - I have only one)

    image.thumb.png.0efb3e15b2e8204bee7a50b93623c2e9.png

    to send big data and bypass the limitations of the 65535 bytes protocol, I split the message into several small ones on the backend and collect them on the frontend.. it for information: 

    UWSHelper.pas

    (I have written a whole mechanism for transferring large volumes via WS and interrupting executions on the backend if the data is no longer relevant for the front-end (add requestid + for each request))

    Everything worked for me in a StandAlone build for Linux and Windows (not HyperServer), on the master (hyperServer), but it did not work on the child node.. I've been looking for a bug in my application for a very long time.

    Until I went to log hyper_server and saw:

    image.thumb.png.ed1dc1c7360f3b7fdf70b5f70f050b18.png

    I noticed that a couple of minutes after this error appears, hyperServer shuts down.. 

    Log hyper_server: 

    A2023-11-26.log

    After that, in my UWSHelpers module, I reduced the length of the chunk to 30,000 bytes (CDefMasWsMesSize constant) and everything worked for me (this error is gone).

     

  7. Good afternoon.


    Hi, there is a bug with websockets under hyperserver.
    When I try to send messages about 40,000 bytes long to the master where the websockets server is located, the messages arrive, but on the child node I get an error in the hyperserver logs (this error message occurs only on the child node, the message does not reach the application)- EIdMaxLineLengthExceeded.


    The cluster is configured for Linux.


    Unigui version 1.95.0.1575

  8. On 11/6/2023 at 8:18 PM, claudio.piffer said:

    Hi,

    I need to deploy uniGUI app in k8s and the request is that log generated of the app written only to standard output and not to files. Is it possible to configure the log in such a way that it no longer writes any files but directs the log only to stdout?

    App is compiled for Linux!

    Thank you very much

    Hi. You may use simple Writeln or QuickLog with console provider:

    https://github.com/exilon/QuickLogger

    it's simple. try it)

  9. On 9/15/2023 at 6:55 PM, schliack said:

    I use devart unidac and MS SQL / Connection is in datamodule (will be created on function call ( test( ARequestInfo)) and query will bee created on Call) like this:

        datamod := Tdb1_frm.create(nil);
        getcon_sql := TUniQuery.create(nil);
        getcon_ds := TUniDataSource.create(nil);
        getcon_sql.Connection := datamod.sqlcon;
        getcon_ds.DataSet := getcon_sql;

     

     

    Hi. Not long ago I gave a detailed answer on connecting to a DBMS and working with connection: 

     

    (it example)

    remember one connection can only return one set of data at a time, use a connection pool

  10. On 10/11/2023 at 3:11 PM, rhazell said:

    Can anyone suggest a good approach for debugging & tracing form creation, please?

    On a relatively simple form, I am experiencing large periods of time from the time I create the form until it is displayed & ready to use by the user - pauses in the magnitude of 10 seconds.

    My form has a table and a UniDBGrid so there's many things that can happen here, however, my table operations (opening, filtering) only appear to account for a 1-2 seconds of the delay.

    Right now, I've added a logging in many critical UniDBGrid, Table & Form events, however, even when I have a suspicious gap in time between 2 logged events, I really don't know what else has happened in between. Combine this with ajax communications between browser and server, and it's very difficult to pinpoint the cause.

    At this point, I'm just trying to understand where the root cause is... my use of tables/ queries... my misunderstanding of the rendering to browsers... event handlers taking too much time etc...

     

    Any ideas, tips, or tricks of things I can do to zero in on a cause?

     

    Thanks in advance.

    To measure performance on the server side please use TStopWatch - system.diagnostics. You can view the speed and data download flows in the browser console (Network tab).

     

    Maybe it will help...in the mainmodule there is a handleRequest event which receives (see unigui Demos (Request log)) the component identifier and the name of the method from ajaxRequest (there you can also get a pointer to the component on the server and compare the Click(js)-onClick events (Delphi )).

    • Thanks 1
  11. 1 hour ago, JDDEV said:

    Я хотел бы видь локальный каталог без загрузки, просто чтобы иметь путь.

    Например, выдал нажимает на кнопку униспед, открываэця диалогове филеселектор со спойском катол.

    Затем ползователь выбирет например 😄 / users / toto / table, и видранный путь отбражается в унилабеле.

    это понятно ?

    Спасибо

    Привет. Пожалуйста, смотрите

    File on server.

    If we are talking about files on the client (not on the server), then unfortunately browsers hide the source paths (on default ) (from the dialog) - https://stackoverflow.com/questions/4851595/why-do-browsers-present-selected-files-as-coming-from-c-fakepath-instead-of-th 

    this solution is just a crutch until the loopholes are closed

  12. On 9/4/2023 at 12:11 PM, Graziano Paesani said:

    I set up a Firedac connection and a FDMoniFlatFileClientLink for each uniGui session. In the firedac connection I added the parameter 'MonitorBy=FlatFile'. I then configured FDMoniFlatFileClientLink to generate a log file whose filename depends on the session id. When starting the first session it works correctly, if I launch a new session the uniGui application crashes and generates the access violation error. How can I solve the problem? Is there a best practices and a demo for using a firedac sql monitor on uniGUI applications?

     

    I use:

    Embarcadero® Delphi 10.3 Version 26.0.33219.4899 

    uniGUI Professional Edition v1.90.0.1564

    I answer for information (for everyone):
    It will work if -
    For each session, create a separate monitor instance(example in mainmodule)(a unique log file) (for connections used by this session).

     

    Create connection:

    1. If you are trying to create a single pool of connections (fd, unidac - the pool code already has synchronization methods) per process, then you need to unbind the connections from the owner Connection.Create(nil) and control the life cycle of connections and dependent components yourself..


    2. If you are not ready to resort to such control, then create connections + pool(a pull will be created for each session.. it bad..) for each session in the mainmodule address space.... and in the case of using Task, Threads within a unigui session, you will have to wrap the constructor and destructor in a monitor:
    lcmpown:= con.owner;
    if assigned(lcmpown) then
    begin
    Tmonitor.enter(lcmpown); freeandnil(con); tmonitor.exit(lcmpown);
    end;
    this is due to the operation of notifications and mechanisms for creating and clearing components.

     

    both options imply SQL monitor for session (in mainmodule)

  13. On 9/12/2023 at 1:33 PM, irigsoft said:

    ОК, 

    When every user login into my application , application check and create, if not exist this temp table (temp..##tablename).

    this is my sql script:

    IF OBJECT_ID ('tempdb..##WorkCard') IS NULL begin
        CREATE TABLE tempdb..##WorkCard (
            ArtID numeric (18,2), Kol real, Price real, SN varchar (150)
            , OperName varchar (70), StoreID varchar (100), TermID smallInt
        ) 
    END;

    SELECT ##WorkCard.* FROM ##WorkCard

    When this table is created every user can add data on it.

    Problem: With this application work 2 users (or more). When one of users close session (or session expires) this temp table is deleted and all other users get message from MS SQL "##tablename is not exist".

    Is it possible that this temporary table is not destroyed when the session is closed?

    Привет. Странный запрос...

    Если Вам постоянно нужна эта таблица, то почему не использовать постоянную сущность?

  14. Our company already has the development of GUI applications for Android, development for Linux (fmxLinux) is being prepared, I am putting together unigui projects for RHEL and Astra, at first glance it looks more complicated and you catch SegFault and similar errors, over time, withstanding the requirements of Linux, you get used to everything and it looks ok.
    There are no bad instruments, there are people who do not yet know how to prepare them-)

    • Like 1
  15. Hi... maybe this is not a cool mechanism, but it could be very useful for people who do not know JS..  on problem .. (this is not a problem, but a limitation) - 

    There are extensions for the browser that allow you to remove these restrictions, and on the js side there seem to be solutions for tracking the status of file downloads.... Maybe it’s worth adding an option that would allow more than 5 files to be downloaded at the same time (despite the limitations of the browser, it won’t allow this will give), stand in line or use the limited option. What do you say?

  16. On 8/25/2023 at 6:30 PM, Roberto Nicchi said:

    Hello,

    in the login form probably you have a button to confirm. In this button enable the ScreenMask property.

     

    Roberto

    Good afternoon.

    Probably misunderstood, while the code is running on the backend, this mask works.

    Ie, the code has already worked on the backend, but there is no render in the browser, and while the browser renders, a white screen is visible.

     

×
×
  • Create New...