From: Jorge on
On Jan 30, 11:01 am, "Richard Maher" <maher...(a)hotspamnotmail.com>
wrote:
>
>       var eventsMgr = function()
>       {
>         var AST = 0;
>
>         var setAST =
>           function(entryPoint,timer){
>             AST = setTimeout(entryPoint,timer);
>             empsCnt.value = AST;
^^^^^^^^^^^^^^^^^^^^

Sure ?

>           };
>
>         var cancelAST =
>           function(){
>             fadeSecs.value = AST;
^^^^^^^^^^^^^^^^^^^^^

Why ?

>             clearTimeout(AST);
>           };
>
>        return {
>               setAST    : setAST,
>               cancelAST : cancelAST
>               };
>       }();
>
--
Jorge.
From: Lew on
Richard Maher wrote:
> Fair enough, but as they say in the movies "it's complicated"! Please see
> below for randomator.html (<500 lines). This is a next to useless random
> employee picker that is designed just to work my Applet's socket while a
> more useful employee lookup page/tab is handling user requests.
....
> Randomator uses an Applet to connect back to the codebase via a TCP/IP
> socket.

Could you show the applet code? Those of us reading from clj.programmer are
probably in a much better position to discuss Java issues than Javascript issues.

> This Socket, along with much other stuff, is held in static variable that is
> common among all like-minded applets accross any number of tabs in a browser
> instance.

There an awful lot of risks to static variables, mainly with respect to
concurrency collisions.

....
> 3) Because the Async flag on the SEND was set to false the Applet instance
> will now wait in JAVA [sic] for the reader thread (well, actually, the Javascript
> this.rendezvous() function) to tell it to proceed.

Seeing the Java code will really help us here in clj.programmer.

> *4) Upon receiving the server response the Reader thread calls
> myJSObject.call("dispatcher", args)
> 5) The "dispatcher" tries to call your callback "positionDiv" which works
> many times before failing

All this back-and-forth between Java and Javascript seems complicated. Well,
you did say that, but I imagine there must be a more straightforward way to
deal with it.

> ...
> Should I make positionDiv() static and pass it the EmpPicker instance or
> Index as an argument? (Is "this" causing problems?)

Redux on warning about static variables.

> PS. I'm really not in the mood for the regular self-appointed newsgroup
> sheriffs or incurable wankers

Pot, meet kettle. Kettle, meet pot.

> spelling, cross-posting, overall strategy or design philosophy. Please find
> someone else to annoy for today!

Right back atcha.

--
Lew
From: Jorge on
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=
"31abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz";
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.
From: "Michael Haufe ("TNO")" on
On Jan 30, 7:24 am, Jorge <jo...(a)jorgechamorro.com> wrote:

> Nor a <meta http-equiv="Content-Type" content="text/html;
> charset=ISO-8859-1">

The interwebs demand utf-8!
From: Jorge on
On Jan 30, 7:42 pm, "Michael Haufe (\"TNO\")"
<t...(a)thenewobjective.com> wrote:
> On Jan 30, 7:24 am, Jorge <jo...(a)jorgechamorro.com> wrote:
>
> > Nor a <meta http-equiv="Content-Type" content="text/html;
> > charset=ISO-8859-1">
>
> The interwebs demand utf-8!

Yes, but there's this in his code:

t3Client = new Tier3Client( "Demo", "http://192.168.1.159/Applets/",
2048, 1022, "ISO-8859-1", "N", Tier3Client.GUIAWT, null,
Tier3Client.WARNING);
--
Jorge.