Thanks, Eric. There's lots of ideas here to play with -- and I must
now roll up my sleeves and do so. I'll report back soon, probably with
sample code in the wiki.

On Thu, Jan 5, 2012 at 8:17 PM, Eric Iverson <eric.b.iver...@gmail.com> wrote:
> Just realized wd'timer' keeps firing and if that is what you want then you
> might be able to ignore the block and simply get the next one. Somthing
> like the following:
>
> jjs'intervaltimer=setInterval("if(0==rqstate)jdoajax([],\"\",\"jev_timer[0\");",4000);'
>
>
> The rqstate test avoids the block. The intervaltimer handle can be used to
> kill the timer. That is,
>
> jjs'clearInterval(intervaltimer)'
>
> Note that if the timer event is doing output it may be hard to get run the
> line to clear the timer. In this case you can open another jijx window and
> do it from there.
>
> Maybe this is enough for you current requirements.
>
> On Thu, Jan 5, 2012 at 2:32 PM, Eric Iverson <eric.b.iver...@gmail.com>wrote:
>
>> Ian,
>>
>> A bit more complete (but without the blocking problem fixed) follows:
>>
>>    jev_timer=: 3 : 'i.5'
>>    jjs'setTimeout("jdoajax([],\"\",\"jev_timer[0\");",4000);'
>>
>> Note that the name jev_timer input line is not shown as lines that start
>> with jev_ are assumed to be events and are not logged.
>>
>> Let me know if you'd like the blocking problem fixed.
>>
>> On Thu, Jan 5, 2012 at 2:18 PM, Eric Iverson <eric.b.iver...@gmail.com>wrote:
>>
>>> Here is a very rough start on showing how to do a timer event for JHS.
>>>
>>> jjs'setTimeout("jdoajax([],\"\",\"a=: 123\");",4000);'
>>>
>>> Verb jjs executes javascript sentences. The setTimeout javascript
>>> sentence runs its first arg (a javascript sentence) when 4 seconds has
>>> elapsed. The \" sequence escapes the " and allows "s inside the quoted
>>> string.
>>>
>>> The next step is to replace the a=: 123 J sentence with a call to your
>>> timer event handler.
>>>
>>> This solution is not complete because the ajax execution of the J
>>> sentence is blocked if a J sentence is already running. This can be
>>> detected and dealt with. This could be done by a more complicated jjs
>>> sentence that requeues the setTimeout until it is allowed to execute. A
>>> better solution would be that the core ajax framework recognize a blocked
>>> timer event and to run it immediately after the blocking sentence has
>>> finished.
>>>
>>> If the above meets your requirements except for the blocking problem I
>>> will clean things up and enhance the ajax request framework to run a
>>> blocked timer event.
>>>
>>>
>>>  On Thu, Jan 5, 2012 at 2:03 PM, Eric Iverson 
>>> <eric.b.iver...@gmail.com>wrote:
>>>
>>>> cd (calls to external libraries) works on all platforms and specifically
>>>> J can use cd to call dylibs on Mac. However, the timer routine you referred
>>>> to is windows only and I don't know of the mac equivalent. A dylib call is
>>>> probably not the way to provide timer events for JHS regardless of server
>>>> platform.
>>>>
>>>>
>>>> On Thu, Jan 5, 2012 at 1:45 PM, David Mitchell 
>>>> <davidmitch...@att.net>wrote:
>>>>
>>>>> You are welcome, Ian.
>>>>>
>>>>> I am a bit curious about J support for dylibs.  I currently do not have
>>>>> any way
>>>>> to try it myself, but the J DLL documentation does say:
>>>>>
>>>>> J can call procedures that are compiled in a shared library file. In
>>>>> Windows
>>>>> these files are called DLLs (dynamic link libraries) and have a .dll
>>>>> extension.
>>>>> In Linux they are called shared libraries or shared objects and have a
>>>>> .so
>>>>> extension. In Mac they are called dynamic libraries and have a .dylib
>>>>> extension.
>>>>> The term DLL is used here for all platforms. A procedure in a DLL is
>>>>> called by
>>>>> its name and filename.
>>>>>
>>>>> It is true that there may not be dylib functionality for Darwin that
>>>>> matches
>>>>> what Windows has for timer usage, but I saw a function
>>>>> "dispatch_source_set_timer" in the GCD reference from Apple that seemed
>>>>> as if it
>>>>> might be a start.
>>>>>
>>>>> On 1/5/2012 12:54, Ian Clark wrote:
>>>>> > Thanks, David.
>>>>> >
>>>>> > But this uses 'dll'. AFAIK there's no comparable way of calling dylibs
>>>>> > in Darwin.
>>>>> >
>>>>> > On Thu, Jan 5, 2012 at 5:44 PM, David Mitchell<davidmitch...@att.net>
>>>>>  wrote:
>>>>> >> Here is a version that works with J602 and J701 jconsole.  It does
>>>>> not work with
>>>>> >> jhs or jgtk.  I have not tested it extensively and it may have side
>>>>> effects or
>>>>> >> bugs that I haven't found yet.
>>>>> >>
>>>>> >> http://www.jsoftware.com/jwiki/Scripts/WindowsTimer
>>>>> >>
>>>>> >> On 1/5/2012 8:27, Ian Clark wrote:
>>>>> >>> How do I get a timer in j701 jhs (or jconsole)?
>>>>> >>>
>>>>> >>> I've been assuming wd (11!:0) doesn't work at all in j701 (in j602
>>>>> >>> you'd do: 11!:0 'timer 3' for a callback in 3 secs).
>>>>> >>>
>>>>> >>> BTW J701 help (
>>>>> http://www.jsoftware.com/docs/help701/dictionary/dx011.htm)
>>>>> >>> still refers to 11!:0 but I assume that's just because it's been
>>>>> >>> overlooked...?
>>>>> >>>
>>>>> ----------------------------------------------------------------------
>>>>> >>> For information about J forums see
>>>>> http://www.jsoftware.com/forums.htm
>>>>> >>>
>>>>> >>
>>>>> ----------------------------------------------------------------------
>>>>> >> For information about J forums see
>>>>> http://www.jsoftware.com/forums.htm
>>>>> > ----------------------------------------------------------------------
>>>>> > For information about J forums see
>>>>> http://www.jsoftware.com/forums.htm
>>>>> >
>>>>> ----------------------------------------------------------------------
>>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>>>
>>>>
>>>>
>>>
>>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to