From kennetha at stud.ntnu.no Thu Sep 20 02:59:55 2007 From: kennetha at stud.ntnu.no (Kenneth Juul) Date: Thu, 20 Sep 2007 08:59:55 +0200 Subject: [fxruby-users] Updating GUI while doing slow IO-operations Message-ID: Hi, I am noob struggling with a problem and hope some of you guys can help. I believe it is a matter of concept, not code errors, so I am not posting the code: I have made a rather large program in Ruby for use in Windows. The user interface is made with fxruby, of course. The program is "talking" to a small embedded computer over both serial and ethernet interfaces. Some of this communication is taking a while, several minutes actually, and this is when my problem occurs: During slow, time consuming operations, the GUI freezes / hangs. Sometimes it just turn "windows-white" and stays like this until the IO is done, other times it just freezes the last window until IO is done. I have done some vague attempts on starting of the IO withing separate threads without any improvement. I also have tried some calls to flush(), forceRefresh(), refresh(), update() and so on, without any improvement. Enlighten me please! Regards, Kenneth Juul From fxrbu1 at gi2.herzkes.de Fri Sep 21 02:59:44 2007 From: fxrbu1 at gi2.herzkes.de (fxrbu1 at gi2.herzkes.de) Date: Fri, 21 Sep 2007 08:59:44 +0200 Subject: [fxruby-users] Updating GUI while doing slow IO-operations In-Reply-To: References: Message-ID: <46F36BE0.5050504@gi2.herzkes.de> Kenneth Juul wrote: > Hi, > I am noob struggling with a problem and hope some of you guys can > help. I believe it is a matter of concept, not code errors, so I am > not posting the code: > > I have made a rather large program in Ruby for use in Windows. The > user interface is made with fxruby, of course. The program is > "talking" to a small embedded computer over both serial and ethernet > interfaces. Some of this communication is taking a while, several > minutes actually, and this is when my problem occurs: > > During slow, time consuming operations, the GUI freezes / hangs. > Sometimes it just turn "windows-white" and stays like this until the > IO is done, other times it just freezes the last window until IO is > done. > > I have done some vague attempts on starting of the IO withing separate > threads without any improvement. I also have tried some calls to > flush(), forceRefresh(), refresh(), update() and so on, without any > improvement. > > Enlighten me please! It has been a while since I have looked at ruby's sources, but I think the explanation goes like this: The ruby interpreter itself is single-threaded. The threads that you see in ruby are provided by the ruby interpreter, not the operating system. Whenever I/O occurs, or at other times when threads are switched, the ruby interpreter tries to select a thread that will most likely not block. For this purpose, it uses the unix-ish "select" system call. Even on windows systems. Windows provides a "select" API function, but, it only works with network sockets. And even there, it works differently for checking writeability than on Unix. So for IO objects on windows that are not network sockets, the ruby interpreter assumes that any IO operation on them will not block. If this assumption is false, then the whole ruby interpreter will be blocked until the IO operation completes. Therefore, no GUI updates. Your way out of this dilemma: Not easy. You need to decouple the Gui from the Communication layer. 2 Options: 1) Separate processes for GUI and IO. Then you can either use TCP sockets (and "select") or disk files (periodical polling) for communication between them. 2) Do your IO in C/C++: use a Ruby extension that starts a dedicated thread for the communication with your device. This new thread must never call any function of the ruby interpreter. Instead, your ruby program has to call some checking function in your extension periodically to check if the IO operation has completed yet. T. From lyle at lylejohnson.name Fri Sep 21 11:08:02 2007 From: lyle at lylejohnson.name (Lyle Johnson) Date: Fri, 21 Sep 2007 10:08:02 -0500 Subject: [fxruby-users] Updating GUI while doing slow IO-operations In-Reply-To: References: Message-ID: <7BC6C321-B704-4601-A54B-5A431257C628@lylejohnson.name> On Sep 20, 2007, at 1:59 AM, Kenneth Juul wrote: > I have made a rather large program in Ruby for use in Windows. The > user interface is made with fxruby, of course. The program is > "talking" to a small embedded computer over both serial and ethernet > interfaces. Some of this communication is taking a while, several > minutes actually, and this is when my problem occurs: > > During slow, time consuming operations, the GUI freezes / hangs. > Sometimes it just turn "windows-white" and stays like this until the > IO is done, other times it just freezes the last window until IO is > done. > > I have done some vague attempts on starting of the IO withing separate > threads without any improvement. I also have tried some calls to > flush(), forceRefresh(), refresh(), update() and so on, without any > improvement. > > Enlighten me please! The problem with using Ruby threads for the I/O is that they'll block the whole application. You might be able to use the FXApp#addInput API (see the input.rb example program), although I've never tried to use it with network I/O. From kennetha at stud.ntnu.no Sat Sep 22 07:42:26 2007 From: kennetha at stud.ntnu.no (Kenneth Juul) Date: Sat, 22 Sep 2007 13:42:26 +0200 Subject: [fxruby-users] Updating GUI while doing slow IO-operations In-Reply-To: <7BC6C321-B704-4601-A54B-5A431257C628@lylejohnson.name> References: <7BC6C321-B704-4601-A54B-5A431257C628@lylejohnson.name> Message-ID: Thanks for your answers guys, I have not yet tried your suggestions, but I will. I'll let you know as soon as I do. K. On 9/21/07, Lyle Johnson wrote: > > On Sep 20, 2007, at 1:59 AM, Kenneth Juul wrote: > > > I have made a rather large program in Ruby for use in Windows. The > > user interface is made with fxruby, of course. The program is > > "talking" to a small embedded computer over both serial and ethernet > > interfaces. Some of this communication is taking a while, several > > minutes actually, and this is when my problem occurs: > > > > During slow, time consuming operations, the GUI freezes / hangs. > > Sometimes it just turn "windows-white" and stays like this until the > > IO is done, other times it just freezes the last window until IO is > > done. > > > > I have done some vague attempts on starting of the IO withing separate > > threads without any improvement. I also have tried some calls to > > flush(), forceRefresh(), refresh(), update() and so on, without any > > improvement. > > > > Enlighten me please! > > The problem with using Ruby threads for the I/O is that they'll block > the whole application. You might be able to use the FXApp#addInput > API (see the input.rb example program), although I've never tried to > use it with network I/O. > _______________________________________________ > fxruby-users mailing list > fxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/fxruby-users > > -- Mvh Kenneth Juul mob/tlf 99008269 / 73514449 From jontyjont at btinternet.com Sat Sep 22 15:43:01 2007 From: jontyjont at btinternet.com (Jonty) Date: Sat, 22 Sep 2007 20:43:01 +0100 Subject: [fxruby-users] FXlist.sortItems Message-ID: <46F57045.3060808@btinternet.com> Hi, From the API docs this appears to be an empty method. I am looking for a way to sort items in a list. Any suggestions? From kennetha at stud.ntnu.no Sun Sep 23 04:26:49 2007 From: kennetha at stud.ntnu.no (Kenneth Juul) Date: Sun, 23 Sep 2007 10:26:49 +0200 Subject: [fxruby-users] FXlist.sortItems In-Reply-To: <46F57045.3060808@btinternet.com> References: <46F57045.3060808@btinternet.com> Message-ID: It sounds like this is a ruby question, not a fox question, depending on what kind of elements you have in your list. If your list contains numbers or letters, array.sort and array.sort! will do. The former returns a new sorted array, the latter sorts self. You can find the Ruby core reference at http://www.ruby-doc.org/core/ K. On 9/22/07, Jonty wrote: > Hi, > From the API docs this appears to be an empty method. I am looking for > a way to sort items in a list. Any suggestions? > _______________________________________________ > fxruby-users mailing list > fxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/fxruby-users > > -- Mvh Kenneth Juul mob/tlf 99008269 / 73514449 From jhery_it at yahoo.com Sun Sep 23 21:59:58 2007 From: jhery_it at yahoo.com (Jerry Pasaribu) Date: Sun, 23 Sep 2007 18:59:58 -0700 (PDT) Subject: [fxruby-users] ruby service Message-ID: <783910.9882.qm@web36708.mail.mud.yahoo.com> hi all how to make desktop application with service / background running? thanks regards jerry --------------------------------- Got a little couch potato? Check out fun summer activities for kids. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/fxruby-users/attachments/20070923/7889edce/attachment.html From meinrad.recheis at gmail.com Mon Sep 24 01:34:56 2007 From: meinrad.recheis at gmail.com (Meinrad Recheis) Date: Mon, 24 Sep 2007 07:34:56 +0200 Subject: [fxruby-users] ruby service In-Reply-To: <783910.9882.qm@web36708.mail.mud.yahoo.com> References: <783910.9882.qm@web36708.mail.mud.yahoo.com> Message-ID: <43d756720709232234x42f4c682l1955d7376d3bbb6@mail.gmail.com> take a look at daniel bergers ruby win32 libraries hth, -- meinrad On 9/24/07, Jerry Pasaribu wrote: > > hi all > how to make desktop application with service / background running? > > thanks > > > regards > > jerry > > ------------------------------ > Got a little couch potato? > Check out fun summer activities for kids. > > > _______________________________________________ > fxruby-users mailing list > fxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/fxruby-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/fxruby-users/attachments/20070924/698545f2/attachment.html From jhery_it at yahoo.com Mon Sep 24 07:42:27 2007 From: jhery_it at yahoo.com (Jerry Pasaribu) Date: Mon, 24 Sep 2007 04:42:27 -0700 (PDT) Subject: [fxruby-users] ruby service In-Reply-To: <43d756720709232234x42f4c682l1955d7376d3bbb6@mail.gmail.com> Message-ID: <34182.13220.qm@web36714.mail.mud.yahoo.com> i try to install win32-service-0.5.2 but this is an error, what should i do? Microsoft (R) Program Maintenance Utility Version 1.50 Copyright (c) Microsoft Corp 1988-94. All rights reserved. cl -nologo -I. -I. -Ic:/ruby/lib/ruby/1.8/i386-mswin32 -I. -MD -Zi -O2b2 xg- -G6 -c -Tcservice.c 'cl' is not recognized as an internal or external command, operable program or batch file. NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return code '0x1' thanks jerry Meinrad Recheis wrote: take a look at daniel bergers ruby win32 libraries hth, -- meinrad On 9/24/07, Jerry Pasaribu wrote:hi all how to make desktop application with service / background running? thanks regards jerry --------------------------------- Got a little couch potato? Check out fun summer activities for kids. _______________________________________________ fxruby-users mailing list fxruby-users at rubyforge.org http://rubyforge.org/mailman/listinfo/fxruby-users _______________________________________________ fxruby-users mailing list fxruby-users at rubyforge.org http://rubyforge.org/mailman/listinfo/fxruby-users --------------------------------- Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/fxruby-users/attachments/20070924/8cc9db68/attachment.html From meinrad.recheis at gmail.com Mon Sep 24 09:44:03 2007 From: meinrad.recheis at gmail.com (Meinrad Recheis) Date: Mon, 24 Sep 2007 15:44:03 +0200 Subject: [fxruby-users] ruby service In-Reply-To: <34182.13220.qm@web36714.mail.mud.yahoo.com> References: <43d756720709232234x42f4c682l1955d7376d3bbb6@mail.gmail.com> <34182.13220.qm@web36714.mail.mud.yahoo.com> Message-ID: <43d756720709240644m4dac5952m358b38abf3ba58a4@mail.gmail.com> the compiler "cl" can not be found. you should run vcvars32.bat from your visual studio installation directory first so that the environment variables are set correctly. then run the makefile from the same shell. if you have further questions it is maybe best to ask on the ruby-talk ML because I have not yet used win32 service myself. hth, -- henon On 9/24/07, Jerry Pasaribu wrote: > > i try to install win32-service-0.5.2 > but this is an error, > what should i do? > > Microsoft (R) Program Maintenance Utility Version 1.50 > Copyright (c) Microsoft Corp 1988-94. All rights reserved. > > cl -nologo -I. -I. -Ic:/ruby/lib/ruby/1.8/i386-mswin32 -I. -MD -Zi > -O2b2 > xg- -G6 -c -Tcservice.c > 'cl' is not recognized as an internal or external command, > operable program or batch file. > NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return code > '0x1' > > thanks > > jerry > *Meinrad Recheis * wrote: > > take a look at daniel bergers ruby win32 libraries > hth, > -- meinrad > > On 9/24/07, Jerry Pasaribu wrote: > > > > hi all > > how to make desktop application with service / background running? > > > > thanks > > > > > > regards > > > > jerry > > ------------------------------ > > Got a little couch potato? > > Check out fun summer activities for kids. > > > > > > _______________________________________________ > > fxruby-users mailing list > > fxruby-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/fxruby-users > > > > _______________________________________________ > fxruby-users mailing list > fxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/fxruby-users > > > ------------------------------ > Looking for a deal? Find great prices on flights and hotelswith Yahoo! FareChase. > > > _______________________________________________ > fxruby-users mailing list > fxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/fxruby-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/fxruby-users/attachments/20070924/956866d0/attachment.html