Prev: FAQ Topic - Internationalisation and Multinationalisation in javascript. (2010-03-23)
Next: FAQ Topic - How do I format a Date object with javascript? (2010-03-28)
From: David Mark on 28 Mar 2010 20:28 David Mark wrote: > Sean Kinsey wrote: >> Consider this my last post on this thread, you are clearly unable to >> grasp the real topic of this discussion, nor bring anything >> constructive to it. > > Promises, promises. :) > >> On Mar 29, 1:03 am, David Mark <dmark.cins...(a)gmail.com> wrote: >>> Sean Kinsey wrote: >>>> On Mar 29, 12:11 am, David Mark <dmark.cins...(a)gmail.com> wrote: >>>>> Claims is the operative word. ;) Once again, give me any specific use >>>>> case that you think calls for a design that begs for the use of your >>>>> script (or the like), and I'll give you a design that does not require >>>>> such a script. Good thing too as such scripts are clearly a bad idea. >>>> I can give you several :) >>>> Mashups, widgets that can communicate with it's hosts javascript >>>> program. >>> That's not specific enough. >> So read into it, use that big brain of yours. > > The nead (sic) is for you to cite a specific example that you think > requires a bunch of cobbled together hacks. > Oops, tired eyes. So many lame comments, so little time. Disregard the sic.
From: johnwlockwood on 29 Mar 2010 00:48 > >>>> On Mar 29, 12:11 am, David Mark <dmark.cins...(a)gmail.com> wrote: > >>>>> Claims is the operative word. ;) Once again, give me any specific use > >>>>> case that you think calls for a design that begs for the use of your > >>>>> script (or the like), and I'll give you a design that does not require > >>>>> such a script. Good thing too as such scripts are clearly a bad idea. Ok, here is the request from the guy I am consulting for, our application needs to scrape the content of a website article by invoking a capture tool as the user visits the page in question. We need to capture and populate a standard set of fields for each article (source-website, headline, byline, date, body text). This needs to work across many websites. I was thinking, without writing a browser extension, to have the user click a bookmarklet, to initiate the capture. Now, barring that we know how to parse the content out from any specific site, I was thinking to have the user select the corresponding text on the site, and then pass that to the application. The bookmarklet would load a script that would display some kind of minimal interface requesting an action by the user. So I'm thinking of using JSON and dynamic <script> tags as described on http://developer.yahoo.com/javascript/howto-proxy.html to pass this text, then the JSON response would do the callback thing initiating the code that requests the next part of the content. If the content was too long to be passed in one piece via a get request, it could be broken up and after each round trip, it would add another script element pushing the next piece. The application would use a session cookie to connect the pieces with a user and an id code to connect the pieces together. -John
From: David Mark on 29 Mar 2010 01:10 johnwlockwood wrote: >>>>>> On Mar 29, 12:11 am, David Mark <dmark.cins...(a)gmail.com> wrote: >>>>>>> Claims is the operative word. ;) Once again, give me any specific use >>>>>>> case that you think calls for a design that begs for the use of your >>>>>>> script (or the like), and I'll give you a design that does not require >>>>>>> such a script. Good thing too as such scripts are clearly a bad idea. > > Ok, here is the request from the guy I am consulting for, �our > application needs to scrape the content of a website article by > invoking a capture tool as the user visits the page in question. We > need to capture and populate a standard set of fields for each article > (source-website, headline, byline, date, body text). This needs to > work across many websites.� Okay. > > I was thinking, without writing a browser extension, to have the user > click a bookmarklet, to initiate the capture. > > Now, barring that we know how to parse the content out from any > specific site, I was thinking to have the user select the > corresponding text on the site, and then pass that to the application. > The bookmarklet would load a script that would display some kind of > minimal interface requesting an action by the user. Okay. > > So I'm thinking of using JSON and dynamic <script> tags as described > on http://developer.yahoo.com/javascript/howto-proxy.html to pass this > text, then the JSON response would do the callback thing initiating > the code that requests the next part of the content. If the content > was too long to be passed in one piece via a get request, it could be > broken up and after each round trip, it would add another script > element pushing the next piece. Using a proxy seems like the sensible approach. > > The application would use a session cookie to connect the pieces with > a user and an id code to connect the pieces together. > I wouldn't do it quite that way and unfortunately a confidentiality agreement prohibits me from telling you how I would do it. Ask me about any other application. :)
From: Tim Down on 29 Mar 2010 05:19 On Mar 28, 8:30 pm, Hans-Georg Michna <hans- georgNoEmailPle...(a)michna.com> wrote: > On Sat, 27 Mar 2010 16:41:41 -0700 (PDT), johnwlockwood wrote: > >Mahdi, we were just talking about this in another thread. Sean Kinsey > >has a library to help with this sort of thing easyXDM (http://easyxdm.net/ > >) > > Just looked at the web site and found it liberally sprinkled > with a picture of a JavaScript routine for String.prototype.trim > that embarrassingly uses two .replace calls where one would > suffice. > > Hans-Georg I haven't been able to find this trim method in a very quick look at the site, but this is a pretty silly thing to criticize. Firstly, it doesn't follow that a trim using a single call to a string's replace method will be quicker than one with two calls (see http://blog.stevenlevithan.com/archives/faster-trim-javascript). Secondly, it's unlikely that the speed of a trim method will have any noticeable impact on the overall speed of the script, unless it's being used very heavily. Tim
From: Tim Down on 29 Mar 2010 06:44
On Mar 29, 10:19 am, Tim Down <timd...(a)gmail.com> wrote: > On Mar 28, 8:30 pm, Hans-Georg Michna <hans- > > georgNoEmailPle...(a)michna.com> wrote: > > On Sat, 27 Mar 2010 16:41:41 -0700 (PDT), johnwlockwood wrote: > > >Mahdi, we were just talking about this in another thread. Sean Kinsey > > >has a library to help with this sort of thing easyXDM (http://easyxdm.net/ > > >) > > > Just looked at the web site and found it liberally sprinkled > > with a picture of a JavaScript routine for String.prototype.trim > > that embarrassingly uses two .replace calls where one would > > suffice. > > > Hans-Georg > > I haven't been able to find this trim method in a very quick look at > the site, but this is a pretty silly thing to criticize. Firstly, it > doesn't follow that a trim using a single call to a string's replace > method will be quicker than one with two calls (seehttp://blog.stevenlevithan.com/archives/faster-trim-javascript). > Secondly, it's unlikely that the speed of a trim method will have any > noticeable impact on the overall speed of the script, unless it's > being used very heavily. > > Tim OK, I understand now. The fact that it's in an image used all over the site changes things and I at least understand why Hans-Georg made that criticism. Tim |