From: Bruce T. <blu...@ya...> - 2003-10-07 19:00:39
|
I was wondering what the point of the init function is in the FileReader? And what would be the best way to get at the string returned by filereader. My other question is this. What would be the best way to build a page and have only part of the page update from content on a server? In particular, I'd like to have elements in a table update every 30 seconds or so, based on an SQL DB. If there is a change in value, I'd like to do some kinda of fancy graphic thingy to point it out (secondary issue). Will FileReader be the best approach? I figured I'd need to access some kind of cgi(perl) or php function that would return a plain text file, maybe javascript code, with the new data, triggering the fetch from javascript every 30 seconds or what have you. Is filereader the best way to do this or should I try to use one of the IOElements directly? Does anyone know of any issues with Apache and cgi scripts that might cause this to fail? I'd prefer to stay w/perl over php because of the much more elegant DBI module in perl. Thanks in advance for any advise. -Bruce www.bluewolverine.com --------------------------------- Do you Yahoo!? The New Yahoo! Shopping - with improved product search |
From: Leif W <war...@us...> - 2003-10-07 20:32:30
|
Hello, see below. > ----- Original Message ----- > From: Bruce Tennant > To: DynApi-Help > Sent: Tuesday, October 07, 2003 3:00 PM > Subject: [Dynapi-Help] FileReader, init function, and advice > > > I was wondering what the point of the init function is in the FileReader? > And what would be the best way to get at the string returned by filereader. I also think it looks a bit confusing at first, at least not intuitive. I believe it's just illustrating two things. First, you have a "hook" in the FileReader constructor so you can pass a function as an argument. Second, I think it shows that you can get the contents of the url using the read function. But it's hard for me to absorb, even though there's barely 1kb of code alltogether. You are declaring an instance "fl" of FileReader. You're passing a function "init" which hasn't been defined at this point. In the constructor, you're calling this undefined "init" function, which refers to "fl" which hasn't even been declared yet. Somehow it works. I'm missing some basic understanding of how JavaScript is parsing this. Hopefully someone can explain this to us? > My other question is this. > > What would be the best way to build a page and have only part > of the page update from content on a server? > > In particular, I'd like to have elements in a table update every 30 seconds > or so, based on an SQL DB. If there is a change in value, I'd like to do > some kinda of fancy graphic thingy to point it out (secondary issue). > > Will FileReader be the best approach? I figured I'd need to access some > kind of cgi(perl) or php function that would return a plain text file, maybe > javascript code, with the new data, triggering the fetch from javascript > every 30 seconds or what have you. This I'm not too sure of. > Is filereader the best way to do this or should I try to use one of the > IOElements directly? > > Does anyone know of any issues with Apache and cgi scripts that might > cause this to fail? I'd prefer to stay w/perl over php because of the much > more elegant DBI module in perl. > > Thanks in advance for any advise. The main problem I'd see is the ioelmsrv.pl file isn't fully tested for robustness, so please use it and find any bugs and fix them and post a patch. :-) There's currently no ioelmsrv.soda.pl file. Feel free to translate from one of the other languages. I've sort of been working on these (ASP -> PHP/PL) but have been busy with other little projects and haven't gotten back to these in a while. Leif > -Bruce > > > > www.bluewolverine.com > > > Do you Yahoo!? > The New Yahoo! Shopping - with improved product search |
From: Raymond I. <xw...@ya...> - 2003-10-08 14:33:06
|
See below: --- Leif W <war...@us...> wrote: > > I also think it looks a bit confusing at first, at > least not intuitive. I > believe it's just illustrating two things. First, > you have a "hook" in the > FileReader constructor so you can pass a function as > an argument. Second, I > think it shows that you can get the contents of the > url using the read > function. But it's hard for me to absorb, even > though there's barely 1kb of > code alltogether. > Well I guess your correct not much thought was put into it's design. Maybe something like: var fl = new FileReader(); fl.OnInit(function(){ // this function is called // once the filereader object has been // initialized var url = 'mypage.html'; var rt = this.read(url); }) How about the above? Is it more intuitive? -- Raymond Irving __________________________________ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com |
From: Leif W <war...@us...> - 2003-10-08 18:23:27
|
That's more intuitive. Is the init function mandatory or optional? Looking at the code it seems like it's required otherwise it doesn't do much. ;-) Just a note in the docs about the required init would also be helpful. Leif ----- Original Message ----- From: "Raymond Irving" <xw...@ya...> To: <dyn...@li...> Sent: Wednesday, October 08, 2003 10:33 AM Subject: Re: [Dynapi-Help] FileReader, init function, and advice > > See below: > > --- Leif W <war...@us...> wrote: > > > > I also think it looks a bit confusing at first, at > > least not intuitive. I > > believe it's just illustrating two things. First, > > you have a "hook" in the > > FileReader constructor so you can pass a function as > > an argument. Second, I > > think it shows that you can get the contents of the > > url using the read > > function. But it's hard for me to absorb, even > > though there's barely 1kb of > > code alltogether. > > > > Well I guess your correct not much thought was put > into it's design. Maybe something like: > > var fl = new FileReader(); > fl.OnInit(function(){ > // this function is called > // once the filereader object has been > // initialized > var url = 'mypage.html'; > var rt = this.read(url); > }) > > How about the above? Is it more intuitive? > > -- > Raymond Irving > > __________________________________ > Do you Yahoo!? > The New Yahoo! Shopping - with improved product search > http://shopping.yahoo.com > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Dynapi-Help mailing list > Dyn...@li... > https://lists.sourceforge.net/lists/listinfo/dynapi-help > > |
From: Raymond I. <xw...@ya...> - 2003-10-08 18:55:40
|
It's kinda optional. If you setup a timeout and wait until the page has been loaded then you would not require the init function as the object would have already been initialized -- Raymond Irving --- Leif W <war...@us...> wrote: > That's more intuitive. Is the init function > mandatory or optional? Looking > at the code it seems like it's required otherwise it > doesn't do much. ;-) > Just a note in the docs about the required init > would also be helpful. > > Leif > > ----- Original Message ----- > From: "Raymond Irving" <xw...@ya...> > To: <dyn...@li...> > Sent: Wednesday, October 08, 2003 10:33 AM > Subject: Re: [Dynapi-Help] FileReader, init > function, and advice > > > > > > See below: > > > > --- Leif W <war...@us...> wrote: > > > > > > I also think it looks a bit confusing at first, > at > > > least not intuitive. I > > > believe it's just illustrating two things. > First, > > > you have a "hook" in the > > > FileReader constructor so you can pass a > function as > > > an argument. Second, I > > > think it shows that you can get the contents of > the > > > url using the read > > > function. But it's hard for me to absorb, even > > > though there's barely 1kb of > > > code alltogether. > > > > > > > Well I guess your correct not much thought was put > > into it's design. Maybe something like: > > > > var fl = new FileReader(); > > fl.OnInit(function(){ > > // this function is called > > // once the filereader object has been > > // initialized > > var url = 'mypage.html'; > > var rt = this.read(url); > > }) > > > > How about the above? Is it more intuitive? > > > > -- > > Raymond Irving > > > > __________________________________ > > Do you Yahoo!? > > The New Yahoo! Shopping - with improved product > search > > http://shopping.yahoo.com > > > > > > > ------------------------------------------------------- > > This sf.net email is sponsored by:ThinkGeek > > Welcome to geek heaven. > > http://thinkgeek.com/sf > > _______________________________________________ > > Dynapi-Help mailing list > > Dyn...@li... > > > https://lists.sourceforge.net/lists/listinfo/dynapi-help > > > > > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: SF.net Giveback > Program. > SourceForge.net hosts over 70,000 Open Source > Projects. > See the people who have HELPED US provide better > services: > Click here: http://sourceforge.net/supporters.php > _______________________________________________ > Dynapi-Help mailing list > Dyn...@li... > https://lists.sourceforge.net/lists/listinfo/dynapi-help __________________________________ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com |
From: Raymond I. <xw...@ya...> - 2003-10-08 14:18:02
|
The FileReader is basically for opening files on the server without any server-side scripting. The init function is called once the filereader object has been initialized. This is because it can use either the XMLHttp object or a Java Applet. Applets can only be accessed after the page has been loaded. As for what object to use for your page I would have to say it depends. Both objects have their advantages and disadvantages. The FileReader is mainly for reading files (or pages) from the server in a synchronous form. -- Raymond Irving --- Bruce Tennant <blu...@ya...> wrote: > I was wondering what the point of the init function > is in the FileReader? And what would be the best > way to get at the string returned by filereader. > > My other question is this. > > What would be the best way to build a page and have > only part of the page update from content on a > server? > > In particular, I'd like to have elements in a table > update every 30 seconds or so, based on an SQL DB. > If there is a change in value, I'd like to do some > kinda of fancy graphic thingy to point it out > (secondary issue). > > Will FileReader be the best approach? I figured I'd > need to access some kind of cgi(perl) or php > function that would return a plain text file, maybe > javascript code, with the new data, triggering the > fetch from javascript every 30 seconds or what have > you. > > Is filereader the best way to do this or should I > try to use one of the IOElements directly? > > Does anyone know of any issues with Apache and cgi > scripts that might cause this to fail? I'd prefer > to stay w/perl over php because of the much more > elegant DBI module in perl. > > Thanks in advance for any advise. > > -Bruce > > > > www.bluewolverine.com > > --------------------------------- > Do you Yahoo!? > The New Yahoo! Shopping - with improved product search __________________________________ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com |