Jump to content

Abaksoft

uniGUI Subscriber
  • Posts

    1558
  • Joined

  • Last visited

  • Days Won

    87

Everything 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: 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. 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. 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. 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. 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. 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. 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 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. Thank you very much @irigsoft I really appreciate your help and trust in your method. But as you can see, all the gymnastic you have done for getting Total Active Sessions (users) in Live, can be done by a simple magic function from websockets. This is why i have asked Farshad to open this public function.
  5. @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)
  6. 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.
  7. 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/
  8. • AFAK, Never use UniThreadTimer on a session units (MainModule, UniDataModule, MainForm...or any session's UniForm). • UniThreadTimer is dedecated for ServerModule.
  9. 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
  10. 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
  11. Don'nt lost your time. It's difficult to detect mobile closing browser or tab. https://stackoverflow.com/questions/30403050/how-to-detect-closing-of-mobile-browser-android-chrome-with-javascript So, to get total opened sessions, use the classical method (unigui \ Demo \ SessionsList). (Yes, this is valid also for mobile closing tab and browser).
  12. @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 !
  13. 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
  14. Yes. But for a specific use like backup/restore or other funtionality SDAC is well designed for sqlServer. https://www.google.com/url?sa=t&source=web&rct=j&opi=89978449&url=https://forums.devart.com/viewtopic.php%3Ft%3D34699%23:~:text%3DUniDAC%20allows%20working%20with%20a,prices%20were%20made%20the%20same.&ved=2ahUKEwiFnsTwnIiDAxVQUqQEHSjeBY8QFnoECA0QBQ&usg=AOvVaw02z76CrctcIgZ9baYuIGBy The same for IBDAC : https://www.google.com/url?sa=t&source=web&rct=j&opi=89978449&url=https://forums.devart.com/viewtopic.php%3Ft%3D54310&ved=2ahUKEwi5qM-FnoiDAxVxX_EDHdlqAtwQFnoECBoQAQ&usg=AOvVaw2ZXw7sVXUw8SBZ_fXUoewD
  15. 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/
  16. 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
  17. Great ! So the 1578 will be eagerly awaited Thx. "What will be the usage for this function?" http://forums.unigui.com/index.php?/topic/23950-server-broadcast-all-other-open-sessions-and-queue-an-fmain-ajaxevent-how/&do=findComment&comment=136755
  18. Easily with embedded websockets server ? Do we have to develop this function or it already exists ?
  19. Good afternoon FMsoft Team, Thank you for the new release 1577. It will be a great feature for unigui : http://forums.unigui.com/index.php?/topic/23950-server-broadcast-all-other-open-sessions-and-queue-an-fmain-ajaxevent-how/&do=findComment&comment=136932 Many Thx
  20. Hi Israel, 1. Check begin and end block of your two files : certificate.crt ca_bundle.crt They must contain only one block. 2. The Key.pem must be proceed and obtain from your Customer Server, not yours.
  21. 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
  22. Definitivly, this is not a good way for absorbing much incoming sessions. Can you take time to read the doc and deploy correctly your project on a true and conventional farm servers. Consider this is a real chalenge this week
  23. 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...