World: r3wp
[Rebol School] Rebol School
older newer | first last |
Graham 5-Jan-2009 [1326] | I think I'll have a go at my first idea which was to create a stack of functions |
Maxim 5-Jan-2009 [1327x3] | if you can do it within view... then you problem seems pretty simple to me... I did a 4 way async system with on-demand buttons, loading data from the net and bg transfers syncing all running clients with a central cerver. |
one of the threads was using google as a meta-engine. | |
so... can the graph data be viewed within a rebol window? | |
Graham 5-Jan-2009 [1330x3] | no |
yes .. | |
the data only ... not the graph | |
Maxim 5-Jan-2009 [1333x3] | using gabriel's async (fixed for close port bug ) I built an async xfer context. |
each context had an init, a buffer collection and an on-close event . | |
(on close function) | |
Graham 5-Jan-2009 [1336] | So, how did you know when all the data was collected? |
Maxim 5-Jan-2009 [1337x7] | and I used a simple face timer to poll through the async contexts to see if the xfer was finished. then call the on-close event. and remove it from the list of "pending" xfers. |
in the async port, you can react to the close port event directly. | |
so I would just do done?: true | |
and the polling would immediately call the on-close | |
using view's port stack, instead of the network stack which was effectively closed by then. | |
view's port event stack | |
I set the face timer to 30 times a second, and really.... cpu useage was at 0% on my system. | |
Graham 5-Jan-2009 [1344] | presumably when one transfer finishes, it could check the others and then render if they were all finished. Do I need to poll? |
Maxim 5-Jan-2009 [1345x2] | the checkup loop was something like you can do it that way too... but you might get into some strange stack issues, cause you end up handling port messages from one port to another within the messaging stack... but I guess a simple test sould suffice to see if its stable or not. in my case, the gui had to stay responsive, since the xfer-contexts had cancel methods, which interrupted any xfer in real-time, and the whole gui had to still handle events smoothly, like scrolling a huge list, while it was adding items to that list, as it parsed the return value from the google search engine :-) |
oops hehe missing some lines there... | |
Graham 5-Jan-2009 [1347] | Does seem straight forward when you explain it like that :) |
Maxim 5-Jan-2009 [1348x3] | you verification could be something like: unless all [ctx1/done? ctx2/done? ...] [ ;all done, do whatever ] |
or using an integer with bit handling, it could be as simple as ; a four bit setup unless done-bits = 7 [ ] | |
and to set individual "done" bits xfer-context: [ set-done: does[ done-bits: done-bits OR power 2 index? find port-list self ] ] :-) | |
Steeve 5-Jan-2009 [1351x2] | usualy, when dealing with bits, it's better to use bitset!, all operations are faster (insertion, modification, search) |
i noted that bitset! are mostly under rated by rebolers | |
Graham 5-Jan-2009 [1353] | I think it's about language compactness. |
Steeve 5-Jan-2009 [1354] | what do you mean ? |
Graham 5-Jan-2009 [1355] | for non-compact languages like Rebol, users form their own compact subsets and tend to use them exclusively. |
Maxim 5-Jan-2009 [1356] | the bit example is just a 20 year old programming habit... hehehe I do find the bit sets a bit awkwards... but I use them profusely in parse... go figure... hehehe |
Graham 5-Jan-2009 [1357] | So, better programmers will use more of the language than others. Which is why it's a good idea to read other people's code :) |
Steeve 5-Jan-2009 [1358x2] | i use them not only in parse |
i use them to build fast indexes for examples | |
Graham 5-Jan-2009 [1360x2] | So, C and Python are considered semi-compact languages, and C++ an anti-compact language. |
I expect languages like REBOL and forth that expand their own dictionaries are not as compact as Python. | |
Maxim 5-Jan-2009 [1362x2] | define compact. |
cause syntactically, rebol has extremely few rules. | |
Graham 5-Jan-2009 [1364] | Compactness is a measure of how easily a design can fit inside one's head. |
Graham 8-Jan-2009 [1365] | Well, I've got it working mostly. sometimes it doesn't kick off an async function ... and seems to need a wait here and there :( |
Maarten 8-Jan-2009 [1366] | REBOL is very compact. Everything is either a word or a value, and even words can be values. |
BrianH 8-Jan-2009 [1367x2] | Graham, by your standards REBOL 3 is more compact than REBOL 2, but maybe that is just to me. |
Once you start adding Draw into it though, I lose the whole. With R2 there is also the broken port model, design flaws and legacy stuff, so I lose the big picture a lot quicker. Python I don't know much about, and C is getting more complex all the time. I guess it depends on the head. | |
Maarten 8-Jan-2009 [1369] | LOL.... the toplogy of the head determines if you can wrap it around a language... |
Graham 10-Jan-2009 [1370] | Yes I would put view as part of REBOL. |
[unknown: 5] 11-Jan-2009 [1371] | Here is a post about the read-io function for newbies. http://www.tretbase.com/forum/viewtopic.php?f=8&t=55&p=128#p128 |
Chris 12-Jan-2009 [1372] | Paul, what are the issues with 'read-io on network ports? |
[unknown: 5] 12-Jan-2009 [1373] | The only think I recall is that Holger use to express (this was obviously years ago) that we shouldn't use read-io for network ports and instead use copy instead. |
sqlab 13-Jan-2009 [1374] | I remember Carl writing, that here is no need anymore to use read-io and write-io after a certain version. But I use it still sometimes to see when data could not be written, because there is no space anymore left on disk |
Maxim 13-Jan-2009 [1375] | IIRC, for a server I did, I had to use read-io, don't rememeber why but it made it simpler in a complex and timed server multi-port management loop (direct tcp socket handling). |
older newer | first last |