JSLIB e IPC

View: New views
7 Messages — Rating Filter:   Alert me  

JSLIB e IPC

by Claudio Bizzarri :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ciao,

my jslib equipped application is shipped and operative.
Now I've (another) problem:

my blax application replace a VisualBasic executable (and Windows98 clients), this is the schema (use fixed space font, here)

----------192.168.1.1-----------   |   --192.168.1.100--
PrgA      BLAX(jslib)    SER2Net   |     Server (php)
             d? -----------> 3     |
            d=3 <-----------       |
d?  -------------------------------|---------->
                <------------------|-----------  d?
           d=3! -------------------|---------->
3 <--------------------------------|-----------  3

On client machine, blax application get value of d from serial port using jslib socket and ser2net program. Same client is connected to server via http, so in a form the user must have value of d: there is an XMLHttpRequest from Javascript to Server, server send a msg to BLAX, send value to php page and server send back value to javascript.

Now, the whole application is three years old and my work was only replace visual basic application with xul one: this task is done and blax.xpi works.

But...   there is some way to remove server call? Can I define a function in my blax application, pheraps using jslib module, that PrgA (Javascript coming from 192.168.1.100 in a html page) can use on 192.168.1.1 machine for ask value of d variable? I want only a simple function

I'm a newbie on xul and javascript, but for now I've found only methods to exchange datas from chrome to chrome: can you help me (another time!)?

I hope there is a simple and elegant solution for this task that I haven't found, but anyway I want tank you for you jslib, without this piece of software my blax was not

Regards,
Claudio
_______________________________________________
Jslib mailing list
Jslib@...
http://mozdev.org/mailman/listinfo/jslib

Include Paths

by Gordan Bobic :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I'm trying to use jslib in XPCShell. I'm trying to write a CGI application
using it. The problem I have is that it only seems to work from the
directory where xpcshell is installed (e.g. /usr/local/lib/firefox-1.0.8).

>From there, I can do:

$ ./xpcshell
js> load ("/usr/local/lib/firefox-1.0.8/chrome/jslib/jslib.js");
xpcShell loading ... chrome/jslib/debug/debug.js
xpcShell loading ... chrome/jslib/modules.js
js>

But from anywhere else, I get:

$ /usr/local/lib/firefox-1.0.8/xpcshell
js> load ("/usr/local/lib/firefox-1.0.8/chrome/jslib/jslib.js");
xpcShell loading ... chrome/jslib/debug/debug.js
/usr/local/lib/firefox-1.0.8/chrome/jslib/jslib.js:224: can't open
chrome/jslib/debug/debug.js: No such file or directory
js>

Can anyone suggest a way to work around this? Is there a default include
path that can be specified, either in the environment or on the xpcshell
command line? Would this necessitate putting a code hack into jslib.js to
check the environment and set the base include path?

Thanks.

Gordan

_______________________________________________
Jslib mailing list
Jslib@...
http://mozdev.org/mailman/listinfo/jslib

Re: Include Paths

by Pete Collins :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



Gordan Bobic wrote:

>Hi,
>
>I'm trying to use jslib in XPCShell. I'm trying to write a CGI application
>using it. The problem I have is that it only seems to work from the
>directory where xpcshell is installed (e.g. /usr/local/lib/firefox-1.0.8).
>
>>From there, I can do:
>
>$ ./xpcshell
>js> load ("/usr/local/lib/firefox-1.0.8/chrome/jslib/jslib.js");
>xpcShell loading ... chrome/jslib/debug/debug.js
>xpcShell loading ... chrome/jslib/modules.js
>js>
>
>But from anywhere else, I get:
>
>$ /usr/local/lib/firefox-1.0.8/xpcshell
>js> load ("/usr/local/lib/firefox-1.0.8/chrome/jslib/jslib.js");
>xpcShell loading ... chrome/jslib/debug/debug.js
>/usr/local/lib/firefox-1.0.8/chrome/jslib/jslib.js:224: can't open
>chrome/jslib/debug/debug.js: No such file or directory
>js>
>
>Can anyone suggest a way to work around this? Is there a default include
>path that can be specified, either in the environment or on the xpcshell
>command line? Would this necessitate putting a code hack into jslib.js to
>check the environment and set the base include path?
>
>
>  
>
Yes, you'll have to load each individual jsLib file using load:

const pre = "/usr/local/lib/firefox-1.0.8"

load(pre+"/chrome/jslib/debug/debug.js");

--pete

--
Pete Collins - Founder, Mozdev Group Inc.
www.mozdevgroup.com
Mozilla Software Development Solutions
tel: 1-719-302-5811
fax: 1-719-302-5813

_______________________________________________
Jslib mailing list
Jslib@...
http://mozdev.org/mailman/listinfo/jslib

Re: Include Paths

by Gordan Bobic :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, 30 May 2007, Pete Collins wrote:

> >I'm trying to use jslib in XPCShell. I'm trying to write a CGI application
> >using it. The problem I have is that it only seems to work from the
> >directory where xpcshell is installed (e.g. /usr/local/lib/firefox-1.0.8).
> >
> >>From there, I can do:
> >
> >$ ./xpcshell
> >js> load ("/usr/local/lib/firefox-1.0.8/chrome/jslib/jslib.js");
> >xpcShell loading ... chrome/jslib/debug/debug.js
> >xpcShell loading ... chrome/jslib/modules.js
> >js>
> >
> >But from anywhere else, I get:
> >
> >$ /usr/local/lib/firefox-1.0.8/xpcshell
> >js> load ("/usr/local/lib/firefox-1.0.8/chrome/jslib/jslib.js");
> >xpcShell loading ... chrome/jslib/debug/debug.js
> >/usr/local/lib/firefox-1.0.8/chrome/jslib/jslib.js:224: can't open
> >chrome/jslib/debug/debug.js: No such file or directory
> >js>
> >
> >Can anyone suggest a way to work around this? Is there a default include
> >path that can be specified, either in the environment or on the xpcshell
> >command line? Would this necessitate putting a code hack into jslib.js to
> >check the environment and set the base include path?
> >
> >
> >  
> >
> Yes, you'll have to load each individual jsLib file using load:
>
> const pre = "/usr/local/lib/firefox-1.0.8"
>
> load(pre+"/chrome/jslib/debug/debug.js");

Yes, but that doesn't suppress the warnings. Either way, I made a change
to jslib.js to check for the default path in the environment and use that
instead of the chrome:// path. That fixes it nicely. :-)

On a separate but related note:
It would seem that xpcshell segfaults when run in the Apache CGI mode, but
the same script works as expected from the command line. I checked all the
obvious things like permissions (if I run it as the apache user, it still
works fine), so it seems that it's something in the Apache environment
that seems to trigger it.

Has anyone come across this before, or have any ideas where to look?

Gordan

_______________________________________________
Jslib mailing list
Jslib@...
http://mozdev.org/mailman/listinfo/jslib

Re: Include Paths and File Execution

by Gordan Bobic :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, 30 May 2007, Gordan Bobic wrote:

> > >I'm trying to use jslib in XPCShell. I'm trying to write a CGI application
> > >using it. The problem I have is that it only seems to work from the
> > >directory where xpcshell is installed (e.g. /usr/local/lib/firefox-1.0.8).
> > >
> > >>From there, I can do:
> > >
> > >$ ./xpcshell
> > >js> load ("/usr/local/lib/firefox-1.0.8/chrome/jslib/jslib.js");
> > >xpcShell loading ... chrome/jslib/debug/debug.js
> > >xpcShell loading ... chrome/jslib/modules.js
> > >js>
> > >
> > >But from anywhere else, I get:
> > >
> > >$ /usr/local/lib/firefox-1.0.8/xpcshell
> > >js> load ("/usr/local/lib/firefox-1.0.8/chrome/jslib/jslib.js");
> > >xpcShell loading ... chrome/jslib/debug/debug.js
> > >/usr/local/lib/firefox-1.0.8/chrome/jslib/jslib.js:224: can't open
> > >chrome/jslib/debug/debug.js: No such file or directory
> > >js>
> > >
> > >Can anyone suggest a way to work around this? Is there a default include
> > >path that can be specified, either in the environment or on the xpcshell
> > >command line? Would this necessitate putting a code hack into jslib.js to
> > >check the environment and set the base include path?
> > >
> > >
> > >  
> > >
> > Yes, you'll have to load each individual jsLib file using load:
> >
> > const pre = "/usr/local/lib/firefox-1.0.8"
> >
> > load(pre+"/chrome/jslib/debug/debug.js");
>
> Yes, but that doesn't suppress the warnings. Either way, I made a change
> to jslib.js to check for the default path in the environment and use that
> instead of the chrome:// path. That fixes it nicely. :-)
>
> On a separate but related note:
> It would seem that xpcshell segfaults when run in the Apache CGI mode, but
> the same script works as expected from the command line. I checked all the
> obvious things like permissions (if I run it as the apache user, it still
> works fine), so it seems that it's something in the Apache environment
> that seems to trigger it.
>
> Has anyone come across this before, or have any ideas where to look?

Sorry, I know it's bad form to answer one's own emails, but I've found the
solution. For some reason xpcshell segfaults if the HOME environment
variable is not set. That was the problem.

Now for a different question - is there a way to execute an external file?
As in run it, rather than open it for reading/writing?

Thanks.

Gordan

_______________________________________________
Jslib mailing list
Jslib@...
http://mozdev.org/mailman/listinfo/jslib

stdin?

by Gordan Bobic :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Does JSLIB provide means for reading things from stdin?

Thanks.

Gordan

_______________________________________________
Jslib mailing list
Jslib@...
http://mozdev.org/mailman/listinfo/jslib

Re: Include Paths and File Execution

by Pete Collins :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


>
>Now for a different question - is there a way to execute an external file?
>As in run it, rather than open it for reading/writing?
>
>
>  
>

Sure:

fileutils "run()"

  http://jslib.mozdev.org/libraries/io/fileutils.js.html

Or if the OS supports it, you can use nsILocalFile.launch();

  http://lxr.mozilla.org/seamonkey/source/xpcom/io/nsILocalFile.idl#156

var f = new File("/tmp/fubar.exe");

f.nsIFile.launch();

--pete

--
Pete Collins - Founder, Mozdev Group Inc.
www.mozdevgroup.com
Mozilla Software Development Solutions
tel: 1-719-302-5811
fax: 1-719-302-5813

_______________________________________________
Jslib mailing list
Jslib@...
http://mozdev.org/mailman/listinfo/jslib
LightInTheBox - Buy quality products at wholesale price