Jump to content

Oliver Morsch

uniGUI Subscriber
  • Posts

    356
  • Joined

  • Last visited

  • Days Won

    18

Posts posted by Oliver Morsch

  1. i had problems with "ZConnection1" placed in the uniMainModule ... the unigui-testapplication worked - but if i created a new record .. the new record was just visible on the machine, where the new record was created .. on a other machine no refresh  or some code was able to show the new record .. just a "load the uniGui.DLL new" showed the new record ...

    So i placed the "ZConnection1" on the uniservermodule and all ZQuerys on uniMainModule ... and new records where shown on all machines .

     

    Be sure there is no open transaction (make a "commit") and/or look how to set "transaction isolation level" in Zeos:

    - read commited: transaction sees new data by others only if data is commited

    - read uncommited / dirty read: transactions sees data before commit

    - snapshot: transaction makes a snapshot, changes by others are completly ignored

    - ...

     

    QUESTION: If i use the delphi intebase components .. where should i put the connection and the querys ?  have i a problem with new records again ?

    I have the connection in MainModule. Queries can be on MainModule or on other modules and forms.

    You can choose the isolation level you want.

     

    Schöne Grüße aus Deutschland nach Österreich...

  2. Question:

    ...what kind of components do you recommend in this case (uniGui webapplication and a Firebird Database) ..if possible: a cheap suggestion ;-) ?

     

    If the vendor does not explicitially say it is thread safe, you must use a own connection for each session (-> place connection  component in MainModule). I use the built in intebase components for firebird database.

     

    p.s.: this "thread-problem-thing" could explain a lot of "strange" foible.. you remind http://forums.unigui.com/index.php?/topic/3637-bug-unisessionaddjs-produces-access-violations/ ?   .. i tryed to reproduce the problem in a small testcase (for farshad..) .. but was not able to reproduce the error in a simple small demo ...

    Such problems are not really reproducable. Thats the biggest problem with testing of threaded applications. And: You test with 2 - 3 connections and may have luck, the customer "tests" with > 100 connections/threads...

  3.  

    This looks good:

     

    We're using Zeos in heavily multithreaded servers and it works excellently. The only thing we've noticed in regard to ZSqlMonitor is that it hooks into all possible ZConnection objects, regardless of thread, so you should only have one in your app.

     

    But this looks bad:

     

    I know that Zeos is a little bit sensitive (very sensitive, actually) if you access the same ZConnection from several different threads (i.e. you create Queries in different threads that link to the same global Connection object)

    As soon as you have two threads running, you either need to serialize access to queries/connections through critical sections, or instantiate one ZConnection per thread and tie the respective ZQuery objects to the thread-specific ZConnection.

  4. Delpi XE4  with  a Firebird 2.5 Database and ZeosLib-Components (7.1)

     

    • the ZConnection to the database is in the uniservermodule ( if not here - the database is not refreshing "to and from" other clients ! ..)
    • the ZQuerys and Datasource Components are in MainModule 

     

    Are you sure that ZesoLib/ZConnection is thread safe?

     

    If not, your problem is completely another...

  5. You can't prevent "go back", "refresh", "realod", "close", ... totally (see answer of zilav).

     

    But you can show a warning, which the user must confirm:

     

    Put this code in UniMainForm.script:

    onbeforeunload = function() { return "This will close the web app! Are you sure?"; };
    


  6. I would like to know how can I add this function to the client side.

     

    Different ways:

     

    - UniServerModule.CustomFiles (with external JS file)

    - UniForm.Script

    - UniHtmlFrame.HTML

    - UniSession.AddJS(...)

    - use a anonymous function / closure

     

  7. I see on ExtJS 4.1 documentation there is the 

     

    afteranimatethis, startTime, eOpts )  http://docs-devel.sencha.com/extjs/4.1.1/#!/api/Ext.fx.Anim-event-afteranimate

     

    How can I catch this on delphi code?

     

     

    Use the callback parameter/option of the animation to set a javascript(!!!) function called after animation has completed:

     

    http://docs-devel.sencha.com/extjs/4.1.1/#!/api/Ext.fx.Anim-cfg-callback

     

    In this JS function you can use ajaxRequest(...) to send updated data to the server (see forum).

  8. You can use this in an UniHtmlFrame:

    <div id="viddiv" style="display:block; width:100%; height:100%">
      <video id="livevideo" width="100%" height="100%" autoplay></video>
    </div>
    <div id="picdiv" style="display:none;">
      <div id="picdivbuttons" style="width:100%">
        <button onclick="upload();">Upload</button>
        <button onclick="tryagain();">Try again</button>
        <button onclick="closeapp();">Close</button>
      </div>
      <div id="picdivcanvas" style="width:100%;">
        <canvas id="takenpic"></canvas>
      <div id="picdivbuttons">
    </div>
    
    <script type="text/javascript">
      var video = document.getElementById("livevideo");
      var canvas = document.getElementById("takenpic");
      var context = canvas.getContext("2d");
         
      navigator.getMedia = (
        navigator.getUserMedia ||
        navigator.webkitGetUserMedia ||
        navigator.mozGetUserMedia ||
        navigator.msGetUserMedia
      );
      
      navigator.getMedia(
        {video: true},
        function(stream) {
          video.src = window.URL.createObjectURL(stream);
        },
        function(err) {
          alert("No camera access!");
        }
      );
      
      video.addEventListener('click', takepic, false);
     
      function takepic() {
        document.getElementById("picdiv").style.display = "block";
        canvas.width = document.getElementById("viddiv").offsetWidth;
        canvas.height = document.getElementById("viddiv").offsetHeight;
        context.drawImage(video, 0, 0);
        document.getElementById("viddiv").style.display = "none";
      }
      
      function upload() {
        alert('Upload the canvas here...');
      }
      
      function tryagain() {
        document.getElementById("picdiv").style.display = "none";
        document.getElementById("viddiv").style.display = "block";  
      }
    
      function closeapp() {
        ajaxRequest(frmMain.hfrWebCamPic, "closeapp", []);
      }
    </script>
    
    

    After that you have a picture on a Canvas. To upload the canvas (picture) see here:

    http://forums.unigui.com/index.php?/topic/2019-loading-unicanvas-and-native-canvas-to-db/

     

     

    Tested with FF and Chrome on Windows and Chrome on Android.

  9. If the UniPanel has the class "hoverpanel" and the UniImage has the class "hoverbutton" (And: UniImage.visible := true in UniGui !) then use the following CSS:

    .hoverpanel:hover {
      background-color:#00FF00;
    }
    
    .hoverpanel .hoverbutton{
      visibility:hidden;
    }
    .hoverpanel:hover .hoverbutton{
      visibility:visible;
    }
    
    

    i also have a problem with my tests: if i click the image witch is in the uniPanel, both funktions are starting - so i see the uniPanel.onClick AND the uniImage.onClick message ????

     

    With UniImage -> ClientEvents -> ExtEvents -> Onclick you can do the following:

    function Onclick(sender)
    {
      alert('delete');
      
      var e = window.event;
      if (e.stopPropagation) {
        e.stopPropagation();
        //alert('SP');
      } else {
        e.cancelBubble = true;
        //alert('CB');
      };
    }
    

    But works only with IE and Chrome. FF has no "window.event" and the onclick of a TUniImage has no event/e parameter.

  10.  

    a better solution would be a "ClassNames normal" and a "ClasNames_hover" property ...

     

      sender.cls='menupanel-normal';
      sender.overCls='menupanel-over';
    

     

    You can use ".manupanel-normal:hover" in css. Or is there a difference to this?

  11. 1.Component of the output html text for what to do, the following

     

    Function TUniXTinyMCE.GetPlainText: String;
    begin
      // Result:=  UniSession. Query['????????']; Or Other Solution
    End;

     

    Do you want something like this:

    UniSession.AddJS('ajaxRequest(MainForm.form, "mce", ["text="+encodeURIComponent(tinyMCE.get("ed1").getContent())])');
    

    ? (see here)

  12. Hi!

    With this app you can run a cmd or console app in an interactive way. Just like sitting in front of a "cmd" on a PC.

    This project is similiar to "PHP Shell" (http://www.tecmint.com/linux-shell-access-on-browser-using-php-shell/), but "WebCmd" is interactive and uses UniGui instead of PHP.

    It is also helpfull, if you use console apps on the server to perform something (creating PDF's, converting Files, ...). If such a process runs very long, the user get results (output) at every time with WebCmd; if you use a standard "CreateProcess()" instead the result is only available after process has finished.

    If you want to use interactive input (optional) you must enter the command / input into the edit field below and then press enter (no "inline" edit/ input possible).

    Use "exit" command to close a cmd, just like in a normal cmd.

    Regards
    Oliver
     

    post-147-0-33844900-1382056285_thumb.png

     

    WebCmd.zip

     

    • Like 2
    • Upvote 7
  13. If you have a html table you must add a javascript onclick event to a row or a cell:

    <table>
    <tbody>
    <tr onclick="alert('record number 1')">
    <td>1</td>
    <td>2</td>
    <td>3</td>
    </tr>
    <tr onclick="alert('record number 2')">
    <td>4</td>
    <td>5</td>
    <td>6</td>
    </tr>
    <tr onclick="alert('record number 3')">
    <td>7</td>
    <td>8</td>
    <td>9</td>
    </tr>
    </tbody>
    </table>
    <p> </p>
    

    But instead using alert() in example you must use ajaxRequest(...) (see forum) and then you can use the onAjaxRequest event on server side to catch the message.

  14. You have 4 alternatives:

     

    (1) UniHtmlFrame

    Your HTML code is now part of the UniGui. You can use javascript on click to send a message to the server: ajaxRequest(...)

     

    (2) UniUrlFrame (iframe), if server and port are the same

    You can access the iframe from UniGui html page and vice versa using javascript

     

    (3) UniUrlFrame (iframe), if server and/or port are different

    Alternative (2) doesn't work. But you can change the url (parameters) of the iframe and on change of the url do something

     

    (4) completely independent

    See my project "MessageServer"

    With this it is even possible to click on the php site on one pc and show the message on another pc in unigui (sure iframe also possible).

  15. use TUniForm.script property for a javascript:
     

    function myFunc() {
      alert('do Something after timeout');
    }
    
    myTimeout = window.setTimeout(function(){myFunc();}, 20000);

     
    and in onMouseMove:

    function window.Onmousemove(sender, x, y, 
    {
      window.clearTimeout(myTimeout);
      myTimeout = window.setTimeout(function(){myFunc();}, 20000);
    }

    (not tested ;)

  16. I would use javascript:

    myTimeout = window.setTimeout(function(){myFunc();}, 20000); // set new timeout (call myFunc() after 20 s)
    window.clearTimeout(myTimeout);  // clear last timeout (before set a new one)
    
×
×
  • Create New...