<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 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 href="http://onsmalltalk.com/smalltalk-concurrency-playing-with-futures" target="_blank">http://onsmalltalk.com/<u></u>smalltalk-concurrency-playing-<u></u>with-futures</a><br>
<br>
<br>
You probably want Futures if you&#39;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&#39;s ThreadPool:<br>
&gt; <a href="http://onsmalltalk.com/2010-07-28-a-simple-thread-pool-for-smalltalk" target="_blank">http://onsmalltalk.com/2010-<u></u>07-28-a-simple-thread-pool-<u></u>for-smalltalk</a> .<br>
&gt; I&#39;ve kept it working here: <a href="http://smalltalkhub.com/#!/~pdebruic/ThreadPool" target="_blank">http://smalltalkhub.com/#!/~<u></u>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:&#39;friendList&#39;<br>
&gt;     script: ((html jQuery id: &#39;friendList&#39;) call: &#39;loadFriendList&#39; 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&#39;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; &quot;I think this code &quot;____code example_____&quot; should do  &quot;____expected<br>
&gt; behavior____&quot; but instead it does &quot;____jumbly voodoo_____&quot; instead. What<br>
&gt; don&#39;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&#39;t leave the javacript world when i write javascript. i just<br>
&gt;&gt; can&#39;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&#39;t really even understand what the &quot;&lt;&lt;&quot; 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&#39;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 &#39;deep into pharo&#39;, 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; ______________________________<u></u>_________________<br>
&gt;&gt;&gt; &gt; seaside mailing list<br>
&gt;&gt;&gt; &gt;<br>
<br>
&gt;&gt; seaside@.squeakfoundation<br>
<br>
&gt;&gt;&gt; &gt; <a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.<u></u>org/cgi-bin/mailman/listinfo/<u></u>seaside</a><br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; ______________________________<u></u>_________________<br>
&gt;&gt;&gt; seaside mailing list<br>
&gt;&gt;&gt;<br>
<br>
&gt;&gt; seaside@.squeakfoundation<br>
<br>
&gt;&gt;&gt; <a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.<u></u>org/cgi-bin/mailman/listinfo/<u></u>seaside</a><br>
&gt;&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; ______________________________<u></u>_________________<br>
&gt;&gt; seaside mailing list<br>
<br>
&gt;&gt; seaside@.squeakfoundation<br>
<br>
&gt;&gt; <a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.<u></u>org/cgi-bin/mailman/listinfo/<u></u>seaside</a><br>
<br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://forum.world.st/Concurrent-Programming-tp4808376p4808475.html" target="_blank">http://forum.world.st/<u></u>Concurrent-Programming-<u></u>tp4808376p4808475.html</a><br>
Sent from the Seaside General mailing list archive at Nabble.com.<br>
______________________________<u></u>_________________<br>
seaside mailing list<br>
<a href="mailto:seaside@lists.squeakfoundation.org" target="_blank">seaside@lists.<u></u>squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.<u></u>org/cgi-bin/mailman/listinfo/<u></u>seaside</a><br>
</blockquote></div>