Jump to content

zilav

uniGUI Subscriber
  • Posts

    573
  • Joined

  • Last visited

  • Days Won

    44

Posts posted by zilav

  1. Yes, I know this - but the "quite similar" is my problem: So I have to rewrite my source code and therefore I have to maintain 2 difference source bases.

    You don't have to rewrite your code, only "refactor" it a bit. Callbacks work in VCL the same way, so it is still 1 code base to maintain. And the lastest UniGUI version has a built-in support for anonymous callbacks, so you dont even need to create your own forms for dialogs and messages.

     

    I don't know exactly how UniGUI works but it seems to me, that there is a Delphi-Representation of the ExtJS-Objects. And therefor I am wondering, if it is not possible to solve these situations (above) in UniGUI: e.g. The MessageHandler is handled internal and maybe there is a second thread where my source logic is inside where I have to wait until the ShowMessage returns with the well known results.

    ExtsJS is representation library for JS (JavaScript), UniGUI is a library for ExtJS, so in general UniGUI is a library for JS too. JavaScript is asynchronous (no blocking code), so every library based on JS has the same asynchronous nature, be it ExtJS, JQuery, Dojo, ExtGWT, UniGUI or anything else.

    Why is JavaScript asynchronous? Would you like your browser to halt while browsing internet besause some js code called internally a blocking function?

    I guess no, user experience (no lags) is way more important than lazy programmers, isn't it? There are no threads in javascript, only callbacks. You either use them, or don't write for web at all.

     

    You propose to put all logic in a separate thread in UniGUI application and you can since Delphi (WinAPI actually) has threads, but here comes another problem of the Web. In ordinary desktop app when you say "I want to show a message" you just do it and BAM! it appears on the screen instantly, because you app and what user sees on screen is the same thing, or single layer.

    In web you have 3 layers: your app (server), web browser (client) and a network (internet/lan) beetwen them. When you say "I want to show a message" client browser doesn't give a fuck (excuse me for that, but it suites this perfectly) about what you want. You must somehow tell it to show message, and to do that you need to pass the network layer, and here comes another problem...

    HTTP protocol used for WWW is one-sided - client always initiates connections to server, not the other way. You can't connect to client browser from your app and say "I want to show a message". The technology to move some information from server to client is called "pushing", and there are only 3 ways known to execute that:

    1. Return information in the same connection. When user pushes some button in browser on web page, javascript generates a connection from browser to server, assignes a callback function to process any information that server may return, and returns without blocking so web page won't stall waiting for a response from server. This is called AJAX. And the first "A" letter stands for Asynchronous, the rest is pretty obvious. Thats how ExtJS works, how UniGUI works, how 99% of js libraries work in gereneral. Thats why ShowMessage in uniGUI doesn't block execution, or client browser will never know that he must show that damn message. You want UniGUI to handle it internally, but how? Can you imagine it? It must return from event or browser won't show a message, so it must assign some internal callback to force browser to make another connection when message is closed, and only then it somehow needs to find an entry point to code that is located after showmessage... Well, perhaps it is possible, I'm not that good at assembler since it requires some freaking machine code magic and mambo-jambo with CPU registers to do that, not worth it. By making anonymous function you tell UniGUI yourself "execute that code", and everyone is happy.

    2. Polling. Client browser has a timer that periodically calls server to get information about any updates. Your method of separate thread for business logic must use polling to inform client just about anything: appearing messages, forms, dataset changes etc. And all those updates will happen with a delay because you can't poll every 1ms and network also has a latency on top of that. Imagine - you add a row to dataset, and client will only see it 1-2 seconds later, that UI will be horrible. So polling is used only for updates that tolerate delays like chatting, messengers, notifications and other unnecessary stuff.

    3. WebSockets. Its a new technology, supported only by several browsers, has problems with network infrastructure (firewalls) and many more. However it can become the future of web, who knows. But not now.

     

    p.s. It was a brief and very simplified info just for you :rolleyes:

  2. Hi!

     

    I try to make one Main Form with toolbar (alignment- top) and few UniFrames in one application . I wont to, When I click on separate button load practical UniFrame in rest of Main form or UniPanel on a form. Please sample code...

    Please

    Did you know that UniGUI megademo uses frames? Anyway, here is an example app shamelessly ripped from it :rolleyes:

    FramedApp.zip

  3. But then I have to rewrite the existing logic. I don't like this, but do you think there is another way of solve this problem? I'mean do you have the chance to handle such calls in another way in your own framework?

    There are anonymous functions in Delphi, and you can utilize them in your own forms as callbacks. Make your own showmessage and showdialog forms, and the difference will be minimal.

     

    VCL code:

    ShowMessage('hello!');
    ProcessSomething; // executed after message is closed
    

     

    UniGUI code with anonymous callback:

    MyForm.ShowMessage('hello!', procedure
     begin
       ProcessSomething; // executed after message is closed
     end
    );
    

     

    Quite similar, isn't it?

  4. That's what I said. You use a UniMemo as a "bridge" for showing the content of file in the client's browser from server.

    Either my english is bad, or yours, because I don't understand what are you talking about. The request was to allow users to upload excel files and import them in database, noone is talking about showing them in browser. I even read his question again and still can't notice anything considering "show":

     

    1. Client open excel file.

    2. Import the excel file to database(dbx).

    3. over.

    I think "over" means "the end", not "output". Don't have anything else to say because english is not my native language and probably I got his question wrong.

    p.s. And yes, you can't show excel files in browser until your render it in html (either yourself or with third party tools) or user uses some sort of embedded Excel ActiveX in web page, which is very unlikely.

  5. I made a demo app which has encrypted login form and checklistbox together. Password is 'test'.

     

    To Farshad:

    However, there are some troubles with IE (in FF its ok). If I select any elements (call ajaxRequest) and close window, it won't open again and shows random ajax errors.

    I don't know what to blame - IE or some bug in UniGUI.

    Also I put md5 function in separate js file, because when I tried to paste it inside UniHTMLFrame it generates error in some core unigui js file, I guess it doesn't handle well several characters there.

    post-12-0-12588000-1322385441_thumb.jpg

    CustomAjax.zip

  6. 1) SSL

    2) Create custom HTML login form inside UniHTMLFrame, and then attach ajaxRequest call to submit button and/or onkeydown to password field, and pass the hashed password with it (there are plenty of md5 js scripts around). Use onAjaxEvent to receive it.

    Actually this works fine, I'm using the similar approach when making my own CheckListBox since UniGui doesn't have it's own yet.

  7. zilav,

     

    yes .. is the style i need to change, in this case is the underline.

     

    How can I include the "onmouseover" and "onmouseout" to the code below?

     

    <a href="mailto:falecom@modenadesign.com.br" style="text-decoration: none; color: #414141"> falecom@modenadesign.com.br </ a>

     

    thanks.

    Ok here is the full list of all available "this.style" properties to alter with javascript

    http://www.comptechdoc.org/independent/web/cgi/javamanual/javastyle.html

  8. Does anyone have any clock component derived from UNIGUI??? I have an app that is a monitor and I want to show it in the desktop of application.

     

    Hmm, you request made me very interested since UniGui already has some demos of jquery clocks, but I personally don't like them much. How hard or easy it'll be to adapt a random clock script for UniGui? I googled a bit, and quickly found this example CSS3 Clock. It looks nice and has a very simple script to control, so I decided to port it. A total time spent is around 30 minutes, and mind you I never did anything similar before, thats how easy it is :rolleyes:

    The clock has a SetClock procedure with TDateTime parameter.

    See demo app source code and screenshot.

    If clock is too big for you, the link above has a download package with photoshop PSD file, so you can rescale at will.

    post-12-0-76693600-1322058835_thumb.jpg

    UniGuiCSS3Clock.zip

  9. My WebMode project contains UniImage and UniTimer. Every 1 second new JPG image (few KB) is loaded and displayed in UniImage. Work's fine, but while changing pictures they flicker. How to avoid it ?

     

    You need to preload images, there are different ways to implement.

  10. Now, how to set the caption of UniLabel in JS onMouseOver event?

     

    You want to change the style or label's text on mouse over? Well, changing the text itself on mouse hovering is... unnatural, so I assume you want to change some style properties:

     

    <a onmouseover="this.style.color='#FF0000';" onmouseout="this.style.color='#000000';">test test test</a>

  11. How about uni runonce timer with 100msec delay? Start it in oncreate event, on timer event show login form. Try to hide main form in oncreate, onshow or ontimer events.

    Not sure if it would work however.

  12. You are using MSSQL as Paradox. Remove tables and queries from your project, use ADODataset or better kbMemTable+ADODataDriver from EhLib components. Avoid direct using of SQL queries in applications, instead write all data handling logic on server in stored procedures, correctly apply indexes to tables, optimize you SQL queries, use profiler and check query execution plans.

     

    If you don't understand what I'm talking about, you'd better read some books on DB administration and development first.

  13. 1. Everything about DBGrid, it is the main most important component for majority of web apps (with DB backend)

    2. Update ExtJS

    3. Perhaps integrate some jQuery sugar. It is possible to make it manually now with client-side scripting, but having it as a built-in framework features will make life much easier. jQuery masked input for example (and I mean input, not validation) or input text box with search (lookup).

  14. I have 4 uni apps as ISAPI modules running for 1 month on 2 different 2003 servers, no problems so far, no memory leaks, no loose files, and a peak amount of concurrent sessions was around 200 (I count subfolders inside cache folder). Apps work with SQL Server 2005 through standard ADO components. So Farshad is right "In first case (not much sessions) you will simply develop and deploy the app".

    My only complain is "session timeout" messages in log files, they are useless without IP (and even with IP too I guess). Is it possible to add periodical logging of concurrent sessions, like every hour... and perhaps have some log settings in ServerModule?

  15. ExtJS folder. When you only see a label, it is 100% you forgot about extjs.

    You need to change ServerModule.ExtRoot to "ext-x.y.z\" AND copy ext-3.3.0 folder from unigui installation to your application. The default value "[ext]\" means locate extjs folder in unigui installation path, thats why in your case fishfacts started to work only after you installed unigui.

  16. Use uniStringGrid instead of ListBox, way more functionality - columns, stripes coloring, custom draw handler, RefreshRow method etc. I tried ListBoxes earlier, but they feel "unreliable", so I replaced them with stringgrids, and after recent minor bugfixing they are simply brilliant.

  17. I think you first need to get your image in TStream with TUniFileUpload component, it has Completed event which provides a stream with uploaded file (your image)

    Completed(Sender: TObject; AStream: TFileStream);

     

    And then load it in the blob image field http://edn.embarcadero.com/article/27462

     

    procedure TMainForm.ImageFileCompleted(Sender: TObject; AStream: TFileStream);
    var
     BlobField: TField;
     BS: TStream;
    begin
     with Query1 do
     begin
       Insert;
       BlobField := FieldByName('picturefield');
       BS := CreateBlobStream(BlobField,bmWrite);
       AStream.SavetoStream(BS);
       Post;
     end;
    end;
    

  18. Hi Farshad!

     

    Is it possible to localize captions for ShowMessage and Message dialogs ('Message', 'Error', 'Information')? I can't use them now if I need full localization, and forced to create my own forms just to show simple messages.

×
×
  • Create New...