<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 <<a href="mailto:pdebruic@gmail.com">pdebruic@gmail.com</a>> 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're gonna poll from the client.<br>
<br>
<br>
<br>
<br>
<br>
<br>
Paul DeBruicker wrote<br>
> Hmmmm.<br>
><br>
> In your plain English example is what you want happening in the client<br>
> browser or in your smalltalk image, ideally?<br>
><br>
><br>
> If you want the friends data in your image then you should consider using<br>
> Ramon Leon's ThreadPool:<br>
> <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>
> I've kept it working here: <a href="http://smalltalkhub.com/#!/~pdebruic/ThreadPool" target="_blank">http://smalltalkhub.com/#!/~<u></u>pdebruic/ThreadPool</a><br>
> You could use it to get the friends data from Facebook into the image.<br>
> Then poll for results from the client to update any divs/views. You can<br>
> queue the thread pool requests in your login callback before you even<br>
> begin rendering things.<br>
><br>
><br>
><br>
> If you just want to load the friends into a div only in the client its<br>
> probably easier to write a JS function in an external file and call it<br>
> from Seaside using the info specific to the user. e.g.<br>
><br>
> html div<br>
> id:'friendList'<br>
> script: ((html jQuery id: 'friendList') call: 'loadFriendList' with:<br>
> self userFacebookID).<br>
><br>
><br>
><br>
> Look at the JSScript class for the definition of #<< . It just<br>
> concatenates the scripts. The #script: method passes a stream into the<br>
> block, and the << writes whatever you've written onto that stream. Check<br>
> the senders and implementors to get your bearings.<br>
><br>
><br>
> When you have time please send things like:<br>
><br>
> "I think this code "____code example_____" should do "____expected<br>
> behavior____" but instead it does "____jumbly voodoo_____" instead. What<br>
> don't I understand?<br>
><br>
><br>
> Hope this helps.<br>
><br>
><br>
> Paul<br>
><br>
> sergio_101 wrote<br>
>> i think i am having alot of difficulty understanding out to phrase ajax<br>
>> and<br>
>> jquery calls in seaside.. everywhere else, i use jquery etc<br>
>> unobtrusively..<br>
>> so i don't leave the javacript world when i write javascript. i just<br>
>> can't<br>
>> seem to find anything that makes sense on how to do something as simple<br>
>> as<br>
>> this using pure seaside/smalltalk.<br>
>><br>
>> i can't really even understand what the "<<" in:<br>
>> script: [ :s | s << (s jQuery: #logger) html: DateAndTime now<br>
>> ]);<br>
>> does..<br>
>><br>
>> in plain english, i would like to do this:<br>
>><br>
>> - when the page loads, call the url as an ajax function<br>
>> - set the variable -> currentUser friendsList: (from the above)<br>
>><br>
>> but i am not understanding how to even code this..<br>
>><br>
>> thanks!<br>
>><br>
>><br>
>><br>
>><br>
>><br>
>> On Fri, Feb 27, 2015 at 3:27 PM Sebastian Sastre <<br>
<br>
>> sebastian@<br>
<br>
>>> wrote:<br>
>><br>
>>> why the fork that way?<br>
>>><br>
>>> I’d think more into make it a normal render page that has a little piece<br>
>>> of javascript that will do an ajax hit to a server callback to do<br>
>>> whatever<br>
>>> you want, no?<br>
>>><br>
>>><br>
>>><br>
>>><br>
>>> > On Feb 27, 2015, at 1:45 PM, sergio_101 &lt;<br>
<br>
>> sergio.rrd@<br>
<br>
>> &gt; wrote:<br>
>>> ><br>
>>> > i am currently writing a facebook application in seaside. one of the<br>
>>> most important pieces of data i need to retrieve is the user's friends<br>
>>> list. unfortunately, this could end up being a substantial amount of<br>
>>> data.<br>
>>> fortunately, the load time for this data is not horrible, just a few<br>
>>> seconds.<br>
>>> > i am making the assumption that while interacting with my app, the<br>
>>> user<br>
>>> will not be adding new friends mid stream, and that during each session,<br>
>>> the friends list will be static.<br>
>>> ><br>
>>> > what i would like to do is make this happen completely behind the<br>
>>> scenes, so that when the user logs in, the request for the friends list<br>
>>> is<br>
>>> fired off RIGHT AFTER the page is rendered.<br>
>>> > i read the section on concurrency in 'deep into pharo', and while<br>
>>> incomplete, it makes enough sense for me to try it.<br>
>>> > my question is.. i am going to do something like:<br>
>>> ><br>
>>> > [currentUser updateData] fork<br>
>>> ><br>
>>> > 1. if i want to do that RIGHT AFTER rendering, can i put that at the<br>
>>> end<br>
>>> of renderContentOn: html ?<br>
>>> > 2. when i want to work with the data, how would i know if it was done<br>
>>> updating? i was thinking of using a semaphore.. but how would i let the<br>
>>> next process know to keep waiting until the process was done? i would<br>
>>> want<br>
>>> to do something like: getFriendsList (but make sure process that<br>
>>> populates<br>
>>> it is done before running the request).<br>
>>> ><br>
>>> > thanks!<br>
>>> > ______________________________<u></u>_________________<br>
>>> > seaside mailing list<br>
>>> ><br>
<br>
>> seaside@.squeakfoundation<br>
<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>
>>><br>
>>> ______________________________<u></u>_________________<br>
>>> seaside mailing list<br>
>>><br>
<br>
>> seaside@.squeakfoundation<br>
<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>
>>><br>
>><br>
>> ______________________________<u></u>_________________<br>
>> seaside mailing list<br>
<br>
>> seaside@.squeakfoundation<br>
<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>
<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>