Prev: closing an app
Next: Lol Pharmacy Jocker Street Google
From: Jorge on 31 Jan 2010 06:45 On Jan 31, 2:47 am, "Richard Maher" <maher...(a)hotspamnotmail.com> wrote: > "Jorge" <jo...(a)jorgechamorro.com> wrote in message > > news:fcb5c641-a4e7-4d7a-afb9-1aca2c3d1d6f(a)v25g2000yqk.googlegroups.com... > On Jan 30, 11:01 am, "Richard Maher" <maher...(a)hotspamnotmail.com> > wrote: > > > It's not a good idea to do this in iE: > > > var positionDiv = function positionDiv (respMsg) {... > > Ok, why not? > > > I would either remove the var or use an anonymous f(). > > I'm not sure I'm following the desired outcome or remedy that you're > recommending here. I just need a reference to the EmpPicket > instance-specific positionDiv function that I can pass as my "callback" > parameter. Are you suggesting making it a static method and pass in the > EmpPicker instance or just in-line an anonymous function to my SEND call for > some reason? It's not a good idea to inline named function expressions like that - in IEs- because there's this bug -that M$ has not fixed in over a decade- : var b= function a () { alert(a===b); }; b(); -> false It's not only that a !== b *inside the function*, it's that -in addition- IEs define "a" in the wrong -in the outer- scope: typeof a -> "function" The bug is still there, even in IE8s. -- Jorge.
From: Richard Maher on 31 Jan 2010 06:59 Hi Jorge, OK thanks for the heads-up. Cheers Richard Maher PS. Top post not to antagonize anyone but because Jorge's quoting doesn't seem to be automatic. "Jorge" <jorge(a)jorgechamorro.com> wrote in message news:d5a48239-34e3-4119-8935-47b403d945ee(a)n33g2000yqb.googlegroups.com... On Jan 31, 2:47 am, "Richard Maher" <maher...(a)hotspamnotmail.com> wrote: > "Jorge" <jo...(a)jorgechamorro.com> wrote in message > > news:fcb5c641-a4e7-4d7a-afb9-1aca2c3d1d6f(a)v25g2000yqk.googlegroups.com... > On Jan 30, 11:01 am, "Richard Maher" <maher...(a)hotspamnotmail.com> > wrote: > > > It's not a good idea to do this in iE: > > > var positionDiv = function positionDiv (respMsg) {... > > Ok, why not? > > > I would either remove the var or use an anonymous f(). > > I'm not sure I'm following the desired outcome or remedy that you're > recommending here. I just need a reference to the EmpPicket > instance-specific positionDiv function that I can pass as my "callback" > parameter. Are you suggesting making it a static method and pass in the > EmpPicker instance or just in-line an anonymous function to my SEND call for > some reason? It's not a good idea to inline named function expressions like that - in IEs- because there's this bug -that M$ has not fixed in over a decade- : var b= function a () { alert(a===b); }; b(); -> false It's not only that a !== b *inside the function*, it's that -in addition- IEs define "a" in the wrong -in the outer- scope: typeof a -> "function" The bug is still there, even in IE8s. -- Jorge.
From: Richard Maher on 5 Feb 2010 22:53
Hi Jorge, Thanks for the reply and taking the time to attempt a Java-free reproducer. .. . "Jorge" <jorge(a)jorgechamorro.com> wrote in message news:c68468b5-3b99-44e6-9654-2a620f355683(a)e37g2000yqn.googlegroups.com... ****FROM HERE**** On Jan 30, 11:01 am, "Richard Maher" <maher...(a)hotspamnotmail.com> wrote: (...) Removing the applet and the back-and-forth between Java-JS the resulting java-less version seems to run fine: http://jorgechamorro.com/cljs/095/ <script type="text/javascript"> function Tier3Client () { (this.chan= {}).rendezvous= function () { console.log("this.chan.rendezvous(), "+ (+new Date())); }; this.chan.send= function (msgCandidate, msgBody, async) { var r= "31abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstu vwxyz"; if (async) { setTimeout(function () { console.log("this.chan.send(async===true)"); msgCandidate.dispatcher(r, 0, 0); }, (2e3*Math.random())|0); } else { console.log("this.chan.send(async===false)"); msgCandidate.dispatcher(r, 0, 0); } }; this.chan.appendConsoleMsg= function (p) { console.log("appendConsoleMsg: "+ p); }; } (Tier3Client.prototype = {}).send= function (msgBody, callback, async) { var chan = this.chan; var callbackArgs = []; var i = 0; var msgCandidate = { dispatcher : function (responseMsg, msgSlotId, msgSeqNum) { callbackArgs[0] = responseMsg; callback.apply(this, callbackArgs); }, rendezvous : function () { console.log("msgCandidate.rendezvous(), "+ (+new Date())); return chan.rendezvous(); } }; for (i=3; i<arguments.length; i++) { callbackArgs[i - 2] = arguments[i]; } return chan.send(msgCandidate, msgBody, async); }; Tier3Client.prototype.appendConsoleMsg= function (msg) { console.log("Tier3Client.prototype.appendConsoleMsg(), "+ (+new Date())); this.chan.appendConsoleMsg(msg); }; </script> -- Jorge. ****TO HERE**** Sadly, I'm not much further down the track (away last week) but I have narrowed the offending line down to be in the Randomator.html file and the positionDiv function in the EmpPicker object. Specifically it is where I reset the innerHTML of the DIV to the new employee details: - case "31" : targetDiv.innerHTML = '<table border="0" cellpadding="1px" '+ ' align="center" id="empDetails"> '+ ' <caption>Totally Random Employee</caption>'+ ' <tr><td class="promptItem">Employee Id: </td>' [and so on. . .] '</table><br>'; break; Before I start clutching at straws, and doing things like instantiating a whole new DIV each time the timer expires, can anyone offer any half-educated guesses here as to what might be causing the problem? Look, I know it'd be a lot easier if I could show th JAVA code or at least a web-link but I can't. On the useful side of the ledger though let me say that the DOM-collision theory is backed-up by the failures appearing to occur in pairs, i.e.: Mesages 19/20 failing followed later by 31/32. To me it screams out "attempted multi-threaded manipulation of the DOM" but all available evidence (inclusing anecdotal :-) says otherwise. They are/should-be exclusive updates to distinct objects. I believe there are some quite useful LiveConnect debugging/logging options out there that someone told me about and I've subsequently forgotten. Can anyone help me with that? (I've set the JAVA console to "5" but that didn't up the verbosity much) Is there a sleep(3) function in Javascript so that I can introduce the same/similar delay to Jorge's JAVA-free t3client.send() method as I have with my Applet<->Server version? IOW, setTimeout(myCallback, somethingLessThanWhatImAbout to SleepFor)? Cheers Richard Maher |