<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Here's something you might consider. In this case, I render a page
    and then start gathering data to fill it. The "action" script gets
    fired when the page loads and then fires again every time
    "tinyThing" is clicked.<br>
    <br>
    <br>
    <font face="Georgia">renderMiningOn: html<br>
          | action myLoops buildFinished currData prevData |<br>
          <br>
          LOOPER := OrderedCollection new.<br>
          myLoops := 0.<br>
          miningPriceSelector ifNil: [miningPriceSelector := 2].<br>
          self renderMiningPriceSelectorOn: html.<br>
          prevData := currData := nil.<br>
          buildFinished := false.<br>
          html div id: 'incompleteTable001'; with: [].<br>
          [<br>
              self buildMiningData: [ :data :flag |<br>
                  prevData := currData.<br>
                  currData := data.<br>
                  buildFinished := flag.<br>
              ].<br>
          ] forkAt: Processor activePriority.<br>
      <br>
          action := html jQuery ajax<br>
              script: [ :s | <br>
                  myLoops := myLoops + 1.<br>
                  myLoops &gt; 100 ifTrue: [self halt].<br>
                  [currData == prevData &amp; buildFinished not]
      whileTrue: [<br>
                      (Delay forMilliseconds: 300) wait<br>
                  ].<br>
                  currData ifNotNil: [<br>
                      s &lt;&lt; (s jQuery: #incompleteTable001) html: [
      :h | <br>
                          self renderMiningFrom: currData on: h<br>
                      ].<br>
                  ].<br>
                  buildFinished ifTrue: [<br>
                      s &lt;&lt; ((s jQuery: #moretocome) html: [ :h | h
      text: 'done']).<br>
                  ] ifFalse: [<br>
                      s &lt;&lt; ((s jQuery: #moretocome) html: [ :h | h
      text: '...']).<br>
                      s &lt;&lt; ((s jQuery: #tinyThing) trigger:
      'click').<br>
                  ]<br>
              ].<br>
          html div id: 'moretocome'; with: [].<br>
          html div <br>
              id: 'tinyThing';<br>
              onClick: action;<br>
              with: [].<br>
          html document addLoadScript: action</font><br>
    <br>
    <div class="moz-cite-prefix">On 2/28/15 2:01 PM, sergio_101 wrote:<br>
    </div>
    <blockquote
cite="mid:CABOFMNnSKYj8E3jkiLEKrUiBet7UCWJaCDxEyU6xTDq2AUa=tg@mail.gmail.com"
      type="cite">
      <div dir="ltr">ahhh.. i need to get this info for processing into
        my image.. it will not be passed into the browser until much
        later in the game. the reason i want to do it this way is so
        that all this stuff is happening without the user having to wait
        on it..<br>
        <div><br>
        </div>
        <div>i will take a look at threadpool and futures..</div>
        <div><br>
        </div>
        <div>thanks!<br>
          <br>
        </div>
      </div>
      <br>
      <div class="gmail_quote">On Fri, Feb 27, 2015 at 10:12 PM Paul
        DeBruicker &lt;<a moz-do-not-send="true"
          href="mailto:pdebruic@gmail.com">pdebruic@gmail.com</a>&gt;
        wrote:<br>
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">Oh, and
          futures:<br>
          <br>
          <a moz-do-not-send="true"
            href="http://onsmalltalk.com/smalltalk-concurrency-playing-with-futures"
            target="_blank">http://onsmalltalk.com/smalltalk-concurrency-playing-with-futures</a><br>
          <br>
          <br>
          You probably want Futures if you're gonna poll from the
          client.<br>
          <br>
          <br>
          <br>
          <br>
          <br>
          <br>
          Paul DeBruicker wrote<br>
          &gt; Hmmmm.<br>
          &gt;<br>
          &gt; In your plain English example is what you want happening
          in the client<br>
          &gt; browser or in your smalltalk image, ideally?<br>
          &gt;<br>
          &gt;<br>
          &gt; If you want the friends data in your image then you
          should consider using<br>
          &gt; Ramon Leon's ThreadPool:<br>
          &gt; <a moz-do-not-send="true"
href="http://onsmalltalk.com/2010-07-28-a-simple-thread-pool-for-smalltalk"
            target="_blank">http://onsmalltalk.com/2010-07-28-a-simple-thread-pool-for-smalltalk</a>
          .<br>
          &gt; I've kept it working here: <a moz-do-not-send="true"
            href="http://smalltalkhub.com/#%21/%7Epdebruic/ThreadPool"
            target="_blank">http://smalltalkhub.com/#!/~pdebruic/ThreadPool</a><br>
          &gt; You could use it to get the friends data from Facebook
          into the image.<br>
          &gt; Then poll for results from the client to update any
          divs/views.  You can<br>
          &gt; queue the thread pool requests in your login callback
          before you even<br>
          &gt; begin rendering things.<br>
          &gt;<br>
          &gt;<br>
          &gt;<br>
          &gt; If you just want to load the friends into a div only in
          the client its<br>
          &gt; probably easier to write a JS function in an external
          file and call it<br>
          &gt; from Seaside using the info specific to the user. e.g.<br>
          &gt;<br>
          &gt; html div<br>
          &gt;     id:'friendList'<br>
          &gt;     script: ((html jQuery id: 'friendList') call:
          'loadFriendList' with:<br>
          &gt; self userFacebookID).<br>
          &gt;<br>
          &gt;<br>
          &gt;<br>
          &gt; Look at the JSScript class for the definition of 
          #&lt;&lt; .  It just<br>
          &gt; concatenates the scripts.  The #script: method passes a
          stream into the<br>
          &gt; block, and the &lt;&lt; writes whatever you've written
          onto that stream.  Check<br>
          &gt; the senders and implementors to get your bearings.<br>
          &gt;<br>
          &gt;<br>
          &gt; When you have time please send things like:<br>
          &gt;<br>
          &gt; "I think this code "____code example_____" should do 
          "____expected<br>
          &gt; behavior____" but instead it does "____jumbly
          voodoo_____" instead. What<br>
          &gt; don't I understand?<br>
          &gt;<br>
          &gt;<br>
          &gt; Hope this helps.<br>
          &gt;<br>
          &gt;<br>
          &gt; Paul<br>
          &gt;<br>
          &gt; sergio_101 wrote<br>
          &gt;&gt; i think i am having alot of difficulty understanding
          out to phrase ajax<br>
          &gt;&gt; and<br>
          &gt;&gt; jquery calls in seaside.. everywhere else, i use
          jquery etc<br>
          &gt;&gt; unobtrusively..<br>
          &gt;&gt; so i don't leave the javacript world when i write
          javascript. i just<br>
          &gt;&gt; can't<br>
          &gt;&gt; seem to find anything that makes sense on how to do
          something as simple<br>
          &gt;&gt; as<br>
          &gt;&gt; this using pure seaside/smalltalk.<br>
          &gt;&gt;<br>
          &gt;&gt; i can't really even understand what the "&lt;&lt;"
          in:<br>
          &gt;&gt; script: [ :s | s &lt;&lt; (s jQuery: #logger) html:
          DateAndTime now<br>
          &gt;&gt;      ]);<br>
          &gt;&gt; does..<br>
          &gt;&gt;<br>
          &gt;&gt; in plain english, i would like to do this:<br>
          &gt;&gt;<br>
          &gt;&gt; - when the page loads, call the url as an ajax
          function<br>
          &gt;&gt; - set the variable -&gt; currentUser friendsList:
          (from the above)<br>
          &gt;&gt;<br>
          &gt;&gt; but i am not understanding how to even code this..<br>
          &gt;&gt;<br>
          &gt;&gt; thanks!<br>
          &gt;&gt;<br>
          &gt;&gt;<br>
          &gt;&gt;<br>
          &gt;&gt;<br>
          &gt;&gt;<br>
          &gt;&gt; On Fri, Feb 27, 2015 at 3:27 PM Sebastian Sastre &lt;<br>
          <br>
          &gt;&gt; sebastian@<br>
          <br>
          &gt;&gt;&gt; wrote:<br>
          &gt;&gt;<br>
          &gt;&gt;&gt; why the fork that way?<br>
          &gt;&gt;&gt;<br>
          &gt;&gt;&gt; I’d think more into make it a normal render page
          that has a little piece<br>
          &gt;&gt;&gt; of javascript that will do an ajax hit to a
          server callback to do<br>
          &gt;&gt;&gt; whatever<br>
          &gt;&gt;&gt; you want, no?<br>
          &gt;&gt;&gt;<br>
          &gt;&gt;&gt;<br>
          &gt;&gt;&gt;<br>
          &gt;&gt;&gt;<br>
          &gt;&gt;&gt; &gt; On Feb 27, 2015, at 1:45 PM, sergio_101
          &amp;lt;<br>
          <br>
          &gt;&gt; sergio.rrd@<br>
          <br>
          &gt;&gt; &amp;gt; wrote:<br>
          &gt;&gt;&gt; &gt;<br>
          &gt;&gt;&gt; &gt; i am currently writing a facebook
          application in seaside. one of the<br>
          &gt;&gt;&gt; most important pieces of data i need to retrieve
          is the user's friends<br>
          &gt;&gt;&gt; list. unfortunately, this could end up being a
          substantial amount of<br>
          &gt;&gt;&gt; data.<br>
          &gt;&gt;&gt; fortunately, the load time for this data is not
          horrible, just a few<br>
          &gt;&gt;&gt; seconds.<br>
          &gt;&gt;&gt; &gt; i am making the assumption that while
          interacting with my app, the<br>
          &gt;&gt;&gt; user<br>
          &gt;&gt;&gt; will not be adding new friends mid stream, and
          that during each session,<br>
          &gt;&gt;&gt; the friends list will be static.<br>
          &gt;&gt;&gt; &gt;<br>
          &gt;&gt;&gt; &gt; what i would like to do is make this happen
          completely behind the<br>
          &gt;&gt;&gt; scenes, so that when the user logs in, the
          request for the friends list<br>
          &gt;&gt;&gt; is<br>
          &gt;&gt;&gt; fired off RIGHT AFTER the page is rendered.<br>
          &gt;&gt;&gt; &gt; i read the section on concurrency in 'deep
          into pharo', and while<br>
          &gt;&gt;&gt; incomplete, it makes enough sense for me to try
          it.<br>
          &gt;&gt;&gt; &gt; my question is.. i am going to do something
          like:<br>
          &gt;&gt;&gt; &gt;<br>
          &gt;&gt;&gt; &gt; [currentUser updateData] fork<br>
          &gt;&gt;&gt; &gt;<br>
          &gt;&gt;&gt; &gt; 1. if i want to do that RIGHT AFTER
          rendering, can i put that at the<br>
          &gt;&gt;&gt; end<br>
          &gt;&gt;&gt; of renderContentOn: html ?<br>
          &gt;&gt;&gt; &gt; 2. when i want to work with the data, how
          would i know if it was done<br>
          &gt;&gt;&gt; updating? i was thinking of using a semaphore..
          but how would i let the<br>
          &gt;&gt;&gt; next process know to keep waiting until the
          process was done? i would<br>
          &gt;&gt;&gt; want<br>
          &gt;&gt;&gt; to do something like: getFriendsList (but make
          sure process that<br>
          &gt;&gt;&gt; populates<br>
          &gt;&gt;&gt; it is done before running the request).<br>
          &gt;&gt;&gt; &gt;<br>
          &gt;&gt;&gt; &gt; thanks!<br>
          &gt;&gt;&gt; &gt; _______________________________________________<br>
          &gt;&gt;&gt; &gt; seaside mailing list<br>
          &gt;&gt;&gt; &gt;<br>
          <br>
          &gt;&gt; <a class="moz-txt-link-abbreviated" href="mailto:seaside@.squeakfoundation">seaside@.squeakfoundation</a><br>
          <br>
          &gt;&gt;&gt; &gt; <a moz-do-not-send="true"
href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside"
            target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
          &gt;&gt;&gt;<br>
          &gt;&gt;&gt; _______________________________________________<br>
          &gt;&gt;&gt; seaside mailing list<br>
          &gt;&gt;&gt;<br>
          <br>
          &gt;&gt; <a class="moz-txt-link-abbreviated" href="mailto:seaside@.squeakfoundation">seaside@.squeakfoundation</a><br>
          <br>
          &gt;&gt;&gt; <a moz-do-not-send="true"
href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside"
            target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
          &gt;&gt;&gt;<br>
          &gt;&gt;<br>
          &gt;&gt; _______________________________________________<br>
          &gt;&gt; seaside mailing list<br>
          <br>
          &gt;&gt; <a class="moz-txt-link-abbreviated" href="mailto:seaside@.squeakfoundation">seaside@.squeakfoundation</a><br>
          <br>
          &gt;&gt; <a moz-do-not-send="true"
href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside"
            target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
          <br>
          <br>
          <br>
          <br>
          <br>
          --<br>
          View this message in context: <a moz-do-not-send="true"
href="http://forum.world.st/Concurrent-Programming-tp4808376p4808475.html"
            target="_blank">http://forum.world.st/Concurrent-Programming-tp4808376p4808475.html</a><br>
          Sent from the Seaside General mailing list archive at
          Nabble.com.<br>
          _______________________________________________<br>
          seaside mailing list<br>
          <a moz-do-not-send="true"
            href="mailto:seaside@lists.squeakfoundation.org"
            target="_blank">seaside@lists.squeakfoundation.org</a><br>
          <a moz-do-not-send="true"
href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside"
            target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
        </blockquote>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
seaside mailing list
<a class="moz-txt-link-abbreviated" href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a>
<a class="moz-txt-link-freetext" href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>