REBOL

REBOL3 - !REBOL3 Schemes (Implementors guide [web-public])

Return to Index Page
Most recent messages (300 max) are listed first.

#UserMessageDate
2351KajSounds like a trade-off between throughput and responsiveness23-Dec 23:59
2350Maximit has been reported as being as much as 50% faster though all the explorer reporting becomes totally wrong... i.e. instead of wasting time trying to determine how fast and how much time it takes, it just does its copy and reporting is completely off, but its actually much faster.22-Dec 22:48
2349Maximfunny thing is that single most effective way to increase disk I/O on windows 7 is to make all transfers non Async :-)22-Dec 22:45
2348SteeveNot only that, Altme has lot of rooms for speed improvements :)29-Nov 3:09
2347BrianHFile I/O can be pretty slow in some cases nowadays, particularly for accessing SD cards. I get freezes with AltME pretty often because of it waiting for blocking calls.29-Nov 3:07
2346BrianHFollowing the Win8 announcements, one of the interesting things is that WinRT, the new runtime, doesn't have blocking APIs. Only async.29-Nov 3:05
2345BrianHNice. I meant industry-wide, but it's good to hear that there's help for R3.29-Nov 3:04
2344SteeveIt increase the GC refreshing rate and makes the pauses shorter29-Nov 3:04
2343SteeveIn R3, I noticed that the GC combined with the BALLAST option can erase the pause syndrom29-Nov 3:02
2342Steevein R3, I noticed yh29-Nov 3:01
2341BrianHDisk I/O pauses are becoming something that people complain about, like GC pauses. Only if it's faster or easier to use though.29-Nov 3:00
2340BrianHIt makes sense for Node.js, and would make sense for other compiled languages like Red and World. I suppose Topaz could build an R3-style port model on top of Node.js as well.29-Nov 2:57
2339SteeveIt makes sense when dealing with network connections but not with the file system IMHO29-Nov 2:56
2338SteeveIt makes sense wh29-Nov 2:56
2337SteeveI think R3 is too slow to benefit of such non blocking API.29-Nov 2:55
2336BrianHI'm sure Linux, Mac and such have non-blocking I/O APIs too.29-Nov 2:52
2335BrianHIt would be interesting to see if there would be a way to make an async file scheme using the async or non-blocking file APIs of various operating systems. This would be needed to support WinRT-based applications for Windows 8, for instance.29-Nov 2:51
2334SteeveMy scheme only open regular files (not a messaging pipe)29-Nov 2:49
2333BrianHAsync was pretty limited in R2 because you had to start the GUI event loop, which only the View builds had. With R3, even core has an event loop, and a lot of stuff uses it.29-Nov 2:49
2332BrianHYour block scheme probably wouldn't have benefited from asynchronicity that much. Or would it have? That would be interesting to find out.29-Nov 2:45
2331BrianHNot the GUI event loop, the event loop. Which is as simple as WAIT port.29-Nov 2:43
2330Steevethe asyncrhonous stuff is doable only if one start GUI do-event loop. Quite limited29-Nov 2:42
2329BrianHYour rejection of R3 style is what your block scheme infamous, and fun too :)29-Nov 2:41
2328BrianHPlus, with R3-style you could write asynchronous stuff that the R2 style doesn't do.29-Nov 2:40
2327BrianHThe advantage of this is that you should be able to do really simple shortcuts for some operations.

R2-style: db: open odbc://server dbc: first db insert dbc "select * from catalog.schema.object" copy dbc

R3 style: read/lines odbc://server/catalog.schema.object

29-Nov 2:39
2326Steevethere's no r3-style scheme IMHO29-Nov 2:39
2325SteeveI don't agree, you can redefine the meaning of any native which supports port! as parameter. See my v-block scheme. R3 don't constrain the semantic of your scheme29-Nov 2:38
2324BrianHHowever, if you do FIRST of an R3-style dbconnection port, I was going to return a R2-style dbconnection port, or at least something that acts like one (in particular, it will act like ChristianE's odbc scheme). You should be able to use R2-style odbc code without change.29-Nov 2:36
2323BrianHThis scheme is not doing the R2-style two level db, dbconnection scheme, it's doing the one-level R3 style with the db connection being internal. COPY of a port copies the port itself, returning a new connection to the same database. COPY/part returns n new connections. The R3 style uses READ and WRITE, not COPY and INSERT.29-Nov 2:33
2322Steevesee if you can use COPY , COPY/part , COPY/deep as an alternative for READ29-Nov 2:31
2321BrianHQuick poll: Should READ of an odbc port return flat data, and READ/lines return nested blocks? I know it's the opposite of how it was in R2, but since we don't have READ/custom we have to make do with what we have. For WRITE/lines I've been leaning towards bulk inserts.29-Nov 2:22
2320BrianHI'm working on an R3-style odbc scheme, but the tricky part is figuring out how to make it behave in the best R3 style.29-Nov 2:18
2319SteeveSome frenglish comment inside. Should help29-Nov 2:17
2318BrianHInfamous indeed :)29-Nov 2:16
2317SteeveDon't know if it still works29-Nov 2:16
2316Steevemy infamous "virtual block" scheme. https://sites.google.com/site/rebolish/Home/idx.r?attredirects=0&d=129-Nov 2:15
2315BrianHHopefully after /string and such were added to READ :(29-Nov 2:14
2314SteeveI've done some years ago, let me check :)29-Nov 2:13
2313BrianHThis would help with people trying to implement the R3 port model on any of the REBOL spinoff languages, by comparing the results.29-Nov 2:13
2312BrianHHas anyone made an R3 scheme for testing? I mean a scheme that implements every possible port action, but just logs the values passed in. I want to get a better idea about how refinements are passed in to non-native schemes, if there are any potential security holes, etc.29-Nov 2:12
2311BrianHJust came up with a way to maintain R2 compatibility and still support the advantages of the R3 style. Just working through the details.9-Oct 0:31
2310KajIt did strike me as a kludge8-Oct 23:24
2309BrianHFor instance, do we really need to support the manual connection pooling that R2 does? By this I mean requiring you to open a database port and then doing a FIRST on that port to get the actual connection. Shouldn't it be possible to just open a port in one step, and have the connection pooling be internal or otherwise hidden?8-Oct 23:12
2308BrianHI've been starting to give some thought about how you would make an ODBC dialect more powerful by using R3-style scheme tricks. Has anyone else come up with some good ideas?8-Oct 23:06
2307GrahamCwhich would lead to the client timing out on a tcp port5-Mar-11 4:57
2306GrahamCI am wondering how one would implement the IMAP4 IDLE command .. see http://tools.ietf.org/html/rfc2177

It seems that once one sends an IDLE command, the server might then send a response back any time up to the server's inactivity timeout.

5-Mar-11 4:56
2305SteeveEvent handlers are basically functions, they can accept event! or object if they have the same properties.12-Jan-11 20:01
2304Steeveslip ?12-Jan-11 19:50
2303Pavelis it possible to slip object instead of event! ?12-Jan-11 19:43
2302Steeveyou can create objects instead of event12-Jan-11 17:01
2301Pekrah ... well then ... maybe Cyphre know more about custom events ...12-Jan-11 16:59
2300Pavelminimally it is included in "official" http scheme12-Jan-11 16:55
2299PekrI am not sure making custom events is supported?12-Jan-11 16:53
2298Pavelwhen I try to evt: make event! [type: 'custom code: 1] I got: == make event! [ type: 'custom offset: 1x0 ] ie code dissappears and the value is merged into offset curiously is it intended?12-Jan-11 16:46
2297Pekrwe can be in beta another xy months, then do few RCs, and then 3.0.12-Jan-11 16:40
2296KajThat's what I suggested12-Jan-11 16:40
2295PekrYeah, maybe Carl should put a beta moniker on it ASAP.12-Jan-11 16:39
2294KajIn other words, Core is usable, extensible and published now (since a few months)12-Jan-11 16:39
2293PekrThat is understandable, but it does not contradict my claim, that "being doing beta triage" is an still ongoing process, not something entirely new :-)12-Jan-11 16:39
2292KajFurther, I can see that most of the important restructurings have been done last year, and the source publication has been sorted out, so I am now able to fill in missing pieces with extensions, with a reasonable certainty that the interface is stable12-Jan-11 16:38
2291KajI also believe it because, when I first ported my CMS to R3 almost two years ago, it didn't fully work, so I decided not to use it; and now that I have ported it again I expected the same, but it has turned out that I'm using the R3 version now12-Jan-11 16:34
2290KajBrian is working on it, and if he says Carl is working towards a beta, I believe him12-Jan-11 16:31
2289PekrNo, it isn't - we just add new tickets imo. Changelog does not show any changes, nor Carl's notes, etc.12-Jan-11 16:16
2288Oldesis it?12-Jan-11 16:15
2287KajI know, but the bug database is being worked on right now12-Jan-11 16:06
2286PekrYou should not forget, that we plan to come into beta for almost 2 years :-)12-Jan-11 16:02
2285PekrKaj - you misunderstood. What BrianH imo means is just general note, not any recent activity :-) Last R3 activity of Carl is almost 3 months old imo ...12-Jan-11 16:01
2284KajHope I'm not adding new ones too fast ;-)12-Jan-11 15:47
2283KajCool!12-Jan-11 15:47
2282BrianHWe have been doing beta triage on the bug list already :)12-Jan-11 5:42
2281KajMy current gripes are mostly with the documentation12-Jan-11 1:20
2280KajAs far as I'm concerned, Core should be stamped 3.0 Release after another run through the bug list. It's basically only View that is not presentable yet12-Jan-11 1:18
2279KajNevermind, I was just being sarcastic :-)12-Jan-11 1:15
2278BrianHIf you need additional schemes for your own projects, contributions are welcome.11-Jan-11 23:47
2277BrianHSorry, TCP, DNS, probably UDP, and files/directories are also needed for beta.11-Jan-11 23:46
2276BrianHR3 may go beta before any additional schemes are added - "enough" is a matter of opinion, and for core functionality, HTTP is enough (only needed for CHAT and UPGRADE). HTTP should be improved before beta though.11-Jan-11 23:44
2275KajAh, and R3 goes beta when it has enough schemes...11-Jan-11 18:05
2274GrahamCI'll look at the schemes again when R3 goes beta.11-Jan-11 17:00
2273GrahamCPavel, I would not be surprised. I have not looked at this stuff for over a year. Yes, wik.is is now defunct and so my site is gone. See https://github.com/gchiu/Rebol3/tree/master/protocols11-Jan-11 16:59
2272PavelGraham, 1. where you put the R3 schemes (if so)? wik.is is definitely down. 2. I have to say your daytime scheme doesn't work for me (functionality commented out I think). 3. you can add prot-time into your collection if you like to.11-Jan-11 16:07
2271Pavelprot-time.r was uploaded to rebol.org, now works only synchronous way ie: read time://your.time.server, server must be RFC 868 (port 37). basically it returns number of UTC seconds from 1-Jan-1900/0:00:00. When refinement /lines it returns well formated local time (using local timezone)7-Jan-11 15:04
2270PavelChristianE the idea arises from the fact the time server send only response and close immediately, so I only implemented Read actor. The problem is that you may not create a new refinement but only redefine one existing. time scheme needs a little polishing and will be posted to script library. Anyway you are right the only possibility how to controll the scheme in wider borders is to write a command block and wait for reply. Another not so generall would be write into port state context and use this as switch for read actor.28-Dec-10 8:47
2269ChristianEWould you mind to show the interface/api or the actual implementation of your time scheme? You're probably (mis-)using the /LINES refinement of READ, but maybe you can instead use WRITE for that ...27-Dec-10 20:45
2268PavelFinally I've got it, so now I have a time scheme returning (RFC 868) integer number of seconds from 1-Jan-1900. I tried to define refinement /date to return well formated date!. But there is no possibility to define different refinement except of hadcoded one so I have to use /lines for that, silly.27-Dec-10 20:24
2267SteeveSure, they both share a cross reference in their locals, like in R2.24-Dec-10 8:28
2266PavelAnd from subport (tcp) to scheme level port? Can low level awake write directly to scheme locals?23-Dec-10 20:30
2265SteeveAn awake functions deals with events. An event has a port property. An actor takes a port as input parameter. Here the link. If the port contains locals vars, they can both (the awake and the actor) access the port's locals.23-Dec-10 17:05
2264PavelInterresting, when I write to global variable at awake level everything works OK. Somebody give me a hint how to send received data from awake to actor level please.23-Dec-10 16:24
2263KajI think Christian Ensel's ODBC scheme is the other current example21-Dec-10 19:10
2262PavelThere is missing the "; make something synchronous here" part :-)21-Dec-10 16:12
2261PavelI've tryed to make time scheme from your daytime scheme Graham, as I noted when I put print at awake level as You did for debug probably I can see the server response, but I'm not able to get response at the read time://server.site == somenumber21-Dec-10 16:09
2260GrahamCdaytime doesn't work??21-Dec-10 16:03
2259PavelThere is alot of doc in wiki, but the examples is to be written yet, that is why I asked. BTW all the simply schemes at Graham Chiu's site (il dottore :) simply doesn work for me, and yes I've upgraded make-scheme to sys/make-scheme for A110. Unfortunately the only scheme I know working is the http scheme, but it is too high class to I can understand the process.21-Dec-10 15:56
2258KajWow, lots of documentation on the wiki. That will be very helpful20-Dec-10 20:05
2257SteeveAnd you don't need to pass data, they both share the same context via the port parameter20-Dec-10 16:51
2256Steeve*only*20-Dec-10 16:49
2255Steeveyou just can stop it20-Dec-10 16:49
2254Steeveyou can't return data from the awake handler20-Dec-10 16:47
2253PavelHow to pass a received data from awake handler to actor level? I can do Print port/data it works, but I need return a value from read actor20-Dec-10 15:13
2252NickAOops - sorry, didn't see that this was R3 Schemes group.4-Sep-10 17:53
2251NickAIs this helpful?:

print "" q: open/binary/no-wait [scheme: 'console] count: 0 forever [ count: count + 1 if not none? wait/all [q :00:00.01] [ wait q qq: to string! copy q probe qq print ["^/loop count incremented to" count "while waiting^/"] insert s: open sound:// load %/c/windows/media/tada.wav wait s close s ] ]

4-Sep-10 17:50
2250SteeveI tried to launch a task! to wait for other port inputs and to keep the console safe. But WAIT seems not working inside a task!28-Aug-10 9:39
2249SteeveAny example how to process inputs from the console's port while processing other ports using WAIT ? I looked at the source of the input function, but it doesn't help....28-Aug-10 9:34
2248GreggDone.14-Aug-10 16:10
2247AntonI think the group name should be tweaked a bit more to remove the "Scheme" inside the bracketed part. I don't see the need to have it mentioned twice.14-Aug-10 14:02
2246Grahambasic: :rebol13-Aug-10 23:48
2245BrianHMetaphorically, yes. Literally, that will break REBOL :)13-Aug-10 23:43
2244Grahamget: :pick put: :poke13-Aug-10 23:42
2243BrianHPavel, you were right the first time in trying to implement GET/PUT actors, but you got the names wrong. Try again with PICK and POKE.13-Aug-10 23:22
2242Steevescheme on you13-Aug-10 22:53
2241GrahamWasn't this group orginally named "Graham's foray into scheme arcana" or something similar??13-Aug-10 22:49
2240AndreasYeah. And more approriate :)13-Aug-10 22:31
2239BrianHOK, cool. That is shorter :)13-Aug-10 22:30
2238Andreasintended*13-Aug-10 22:30
2237AndreasI guess you took the "!REBOL Schemes" too literally. It is "!REBOL3 Schemes" Graham intented, and in fact, already renamed this group to. (It was "!REBOL3 Network Schemes" previously.)13-Aug-10 22:29
2236BrianHWe created a bunch of spinoff groups because !REBOL3 was getting too busy.13-Aug-10 22:21
2235AndreasWe didn't have a separate !REBOL3 Schemes group.13-Aug-10 22:19
2234BrianHWe have a separate !REBOL3 Schemes group on purpose. Please don't rename it.13-Aug-10 21:58
2233BrianHPavel, the names for the get/put operations of key-value stores are PICK and POKE.13-Aug-10 21:56
2232GrahamAhh.... I can rename :)13-Aug-10 21:45
2231Grahamwe can use a proxy actor13-Aug-10 21:44
2230Steevebut we"re missing a rename actor13-Aug-10 21:41
2229Grahamwe should rename this group to !REBOL schemes13-Aug-10 21:40
2228Pavelgraham it is better thanks13-Aug-10 21:36
2227Grahamor

if empty? port/locals [ open port ] get-rif port number

13-Aug-10 21:36
2226Grahamcan't you

return get-rif either empty? ...

13-Aug-10 21:35
2225SteeveIt should be :-)13-Aug-10 21:32
2224PavelAnd second is more speed?13-Aug-10 21:32
2223PavelI hope close is in garbage collector as mentioned in wiki13-Aug-10 21:31
2222SteeveBtw Pavel, in my virtual-block scheme, the reason why I rebound the actors, is that I don't like to use nasty long path to acces my locals.13-Aug-10 21:31
2221PavelI made it read: func [port [port!] /seek number [integer!] ] [

either empty? port/locals [ open port return Get-RIF port number ][ return Get-RIF port number ]

and it works now

13-Aug-10 21:30
2220AndreasBut I think I'll refine the example and add an open? actor as well.13-Aug-10 21:28
2219Andreas(Refresh, if you have the page open. I just fixed the formatting.)13-Aug-10 21:27
2218PavelOK lets try it better, thanks guys for lesson learned!13-Aug-10 21:26
2217AndreasAh, all documented in the wiki :)13-Aug-10 21:23
2216Steevewhen you directly use read on a path, i'm not sure that your 'open function is called13-Aug-10 21:22
2215Steevetry to open the port at first and then call your read function with it13-Aug-10 21:21
2214Grahamhttp://www.rebol.net/wiki/Schemes:Notes#Actors13-Aug-10 21:20
2213PavelWatson <- me here13-Aug-10 21:15
2212PavelIt is elementary dear Watson :-)13-Aug-10 21:15
2211AndreasThis is the elementary principle to understand.13-Aug-10 21:12
2210AndreasIf you define custom schemes, you can implement how those actions behave for ports using your scheme by writing what we call "actors".13-Aug-10 21:11
2209AndreasThere are action!s in R3, which operate in port!s.13-Aug-10 21:11
2208Steevearghh... not here ;-)13-Aug-10 21:11
2207PavelRebol [ file: %prot-rif.r title: "RIF protocol" author: "Pavel" rights: 'PD date: 13-Aug-2010 ]

;; Local functions

Append-RIF: func [port [port!] record [binary!] ][

write/append port/locals/2 to-binary length? head port/locals/1 ;index port the end of data file will be beginning of new record write/append port/locals/1 record ;data port new record into data file

return shift length? head port/locals/2 -3 ;number of records 8 bytes per record ]

Get-RIF: func [ port [port!] i [integer!] /local numentry indexpos recpos recend value ][

numentry: shift length? head port/locals/2 -3 ;number of records 8 bytes per record

if any [i = 0 i > numentry] [return none] ;numbering starts at 1 ends at file end

indexpos: multiply subtract i 1 8 ;compute index offset recpos: to-integer read/seek/part port/locals/2 indexpos 8 either ( (8 * i) = length? head port/locals/2 ) [ ;last record special case recend: length? head port/locals/1 ][ recend: to-integer read/seek/part port/locals/2 add indexpos 8 8 ;internal record ] return read/seek/part port/locals/1 recpos subtract recend recpos ]

;; Scheme definition make-scheme [ name: 'rif title: "RIF Protocol" spec: make system/standard/port-spec-head [] awake: none

actor: [ open: func [port [port!] /local path ] [ parse port/spec/ref [thru #":" 0 2 #"/" path:] append port/spec compose [path: (to-file path)] port/locals: copy [] either (0 = length? port/locals) [ append port/locals open/seek rejoin [port/spec/path ".dat"] append port/locals open/seek rejoin [port/spec/path ".idx"] ][ port/locals/1 open/seek rejoin [port/spec/path ".dat"] port/locals/2 open/seek rejoin [port/spec/path ".idx"] ] return port ]

close: func [port [port!]] [ foreach port port/locals [close port] ]

read: func [port [port!] /seek number [integer!] ] [ Get-RIF port number ]

write: func [port [port!] record [binary!]] [ Append-RIF port record ]

] ]

13-Aug-10 21:10
2206AndreasThere is no magic.13-Aug-10 21:10
2205PavelThis automatic open close is not clear to me after Andreas there is no such automation? where is the magic? :-O13-Aug-10 21:09
2204Steevecan't you paste the whole code somewhere ?13-Aug-10 21:09
2203AndreasBut typically you'll also want to add code to close the port again, afterwards.13-Aug-10 21:08
2202Andreas(Within the read actor.)13-Aug-10 21:07
2201AndreasMaybe also a simple `if not open? port [open port]` will suffice in your case.13-Aug-10 21:07
2200PavelOK andreas13-Aug-10 21:06
2199Pavel>> read/seek rif://data/file 1 ** Script error: cannot access locals in path port/locals/2 ** Where: Get-RIF read ** Near: Get-RIF port number13-Aug-10 21:06
2198Andreasand in your read actor, you'll then simply do: either open? port [{read was invoked as `open rif:// + read`}] [{read was invoked directly as read rif://}]13-Aug-10 21:05
2197Gregg0 = length? port/locals

can be

empty? port/locals

13-Aug-10 21:05
2196PavelOK I'll try it13-Aug-10 21:04
2195Andreasbut based on that, your open? actor would simply be: `open?: func [port [port!]] [not none? port/locals]`13-Aug-10 21:04
2194Andreasyou'll most likley want `port/locals: copy []`13-Aug-10 21:03
2193Pavelisn't it the right way? : actor: [ open: func [port [port!] /local path ] [ parse port/spec/ref [thru #":" 0 2 #"/" path:] append port/spec compose [path: (to-file path)] port/locals: [] either (0 = length? port/locals) [ append port/locals open/seek rejoin [port/spec/path ".dat"] append port/locals open/seek rejoin [port/spec/path ".idx"] ][ port/locals/1 open/seek rejoin [port/spec/path ".dat"] port/locals/2 open/seek rejoin [port/spec/path ".idx"] ] return port13-Aug-10 21:02
2192AndreasAssuming you store port-local state in port/state, you can simply check port/state for not being none.13-Aug-10 21:00
2191PavelAndreas any simple example of open? ?13-Aug-10 20:59
2190PavelI use locales to stor opened files (I need two files )13-Aug-10 20:58
2189Andreasyou can easily make `read/seek rif://data/file 1` work, by creating a custom open? actor and using that in your read actor13-Aug-10 20:58
2188Andreaslocales?13-Aug-10 20:58
2187Pavelok i'll try to understand :-( my scheme works used port: open rif:// ... read/seek port 1 but don't work the easy way: read rif://data/file 1, cant access locales13-Aug-10 20:57
2186Grahamand if they don't take a port, you can't use them without redefining their behaviour13-Aug-10 20:56
2185Andreasaction!s, to be precise13-Aug-10 20:56
2184Steevethe allowed actors are the function with port! as parameter13-Aug-10 20:55
2183GrahamYou can use them as local functions .. just not as actors13-Aug-10 20:55
2182Grahamso they can't be used actors13-Aug-10 20:54
2181Graham;** MISSING !!! native FOREACH has not port! as parameter13-Aug-10 20:54
2180Pavelthe funtions defined in actor object aren't actually actors?13-Aug-10 20:53
2179Grahamwhich actor is that?13-Aug-10 20:49
2178PavelWhat? that is exactly what Steeve does if I understand13-Aug-10 20:46
2177GrahamLet me rephrase that .. you can't define an actor if that word is already in use13-Aug-10 20:46
2176PavelThe functions Steeve mimick for his virtual block scheme are not originaly actors but works for him13-Aug-10 20:45
2175GrahamWhen you use an actor like 'open, it checks to see if the actor is defined in the network scheme and invokes that.13-Aug-10 20:44
2174GrahamYou're limited to the ones defined ...13-Aug-10 20:43
2173GrahamI don't think you can define your own actors ...13-Aug-10 20:43
2172PavelAnyway when defined /seek refinement the sheme start to work as expected13-Aug-10 20:36
2171PavelAnother curriosity when I defined actors put/get when used port returns error message "no put actor"13-Aug-10 20:36
2170Pavelnothing sorry13-Aug-10 15:38
2169PavelOK I'll try to finish simple rif:// scheme and update rif.r in rebol.org thanks guys for hepl! Documentation should be improved in file schemes, there is almost nothink.13-Aug-10 15:37
2168Steevethere are lot of rooms for improvement in my code, perhaps some day...13-Aug-10 15:35
2167Steevetrue13-Aug-10 15:34
2166PavelSteeve your virtual block is more persisten block isnt it? ;)13-Aug-10 15:34
2165PavelSeems the standard functions are overloaded somehow even when you writes your own, (because you want different functionality of course) aah deep lake, deep lake13-Aug-10 15:31
2164SteeveMy convention is to simulate the behavior of a standard block (I called my schemle virtual-block). So it's the main reason why I don't use read or write but copy/append instead13-Aug-10 15:29
2163AndreasYou can also use the /seek and /part refinements to pass arguments to your READ actor.13-Aug-10 15:28
2162PavelAnyway many thanks Steve for hints!13-Aug-10 15:28
2161PavelFor RIF more suitable names would be PUT/GET as in basic key-value stores (memcache f.e.) I can try this convention13-Aug-10 15:26
2160Steevedeeper reason, you can't add refinement to existing functions (overlapped as actors). I just think copy is more suited to do so (because of /part)13-Aug-10 15:25
2159PavelInside is read/seek/part used of course13-Aug-10 15:24
2158PavelIt is only different name of function or has it some deeper reason? (read malfunction?)13-Aug-10 15:23
2157SteeveI don't use read as actor because of that13-Aug-10 15:22
2156SteeveI use copy and copy/part to real several records13-Aug-10 15:21
2155PavelAnyway I'm partially succesfull with rif:// scheme, I can open multiople files from port: open rif://data/file, I can close multi files with clos port, I can write port to-binary "some record". What is difficult is to pass argument (number of wanted record) to read actor. it seems read acor accept only port. Any hint?13-Aug-10 15:20
2154Steeveseveral reasons13-Aug-10 15:19
2153Pavelthanks steve for inspiration, may I know why you use actor* and not regular actor?13-Aug-10 15:16
2152SteeveCheck this http://sites.google.com/site/rebolish/Home/idx.r13-Aug-10 5:55
2151Pavelandreas your open wont do its job I'm sorry12-Aug-10 21:52
2150Pavelyou are right but then f cannot be unset (removed) but I can live with it12-Aug-10 21:38
2149PavelI'll check it12-Aug-10 21:35
2148AndreasPavel, not for me:

>> f: open %.vimrc >> open? f == true >> close f >> open? f == false

12-Aug-10 21:35
2147Pavelmy RIF needs to work with double files simoutaneously12-Aug-10 21:34
2146Pavelonly for open more files at once12-Aug-10 21:33
2145Grahamyou'd write your own 'open? actor12-Aug-10 21:32
2144Pavelexact12-Aug-10 21:32
2143Grahamwe can't wait for Carl to do everything .. just have to be prepared to discard our work if he rewrites it!12-Aug-10 21:32
2142Pavelandreas missunderstanding when f: open %file close f open? f returns true12-Aug-10 21:32
2141Pavelgraham I've commented it in DB chat , to be honest I thin Carl would do it better but I cannot wait more12-Aug-10 21:31
2140AndreasSame for OPEN?.12-Aug-10 21:30
2139AndreasCLOSE on a foo port will be a no-op, unless you implement a close actor.12-Aug-10 21:30
2138GrahamWhat's the current state of RIF?12-Aug-10 21:29
2137Pavelie port looks the same open or closed and open? returns true, more the port cannot be deleted/removed currious12-Aug-10 21:28
2136PavelOK thanks I'll try my own, anyway is there any distinction if fileport is open/closed? after close the information is still open12-Aug-10 21:26
2135Andreasif you want to keep a file open, you can keep port-local state in port/state12-Aug-10 21:25
2134Andreasyes. you can just use normal READ to read from a file within the read actor12-Aug-10 21:24
2133Pavelinto read actor12-Aug-10 21:23
2132Pavelshould a file to be implemented into read for real reading? (how to)12-Aug-10 21:22
2131GrahamThere's a typo there .. FOO should be RIF :)12-Aug-10 21:22
2130Pavelgood andreas muchas gracias you know I'm a beginner12-Aug-10 21:20
2129Andreashmm, ignore the first duplicate part of the paste12-Aug-10 21:18
2128Andreasmake-scheme [ name: 'foo title: "FOO Protocol" spec: make system/standard/port-spec-head [] actor: [ open: func [port [port!]] [ print 'open make-scheme [ name: 'foo title: "FOO Protocol" spec: make system/standard/port-spec-head [] actor: [ open: func [port [port!]] [ print 'open ] read: func [port [port!]] [ print 'read ] ] ]

f: open foo://bar.baz read f

12-Aug-10 21:18
2127PavelIe write number to port get record back, write record to port get number back for the very beginning12-Aug-10 21:17
2126Maximdirect DB table access using read/write would be VERY powerfull :-)12-Aug-10 21:14
2125PavelGraham I like to write a scheme for my mini RIF implementation yes maxim12-Aug-10 21:14
2124Maximaccess to RIF?12-Aug-10 21:14
2123GrahamI'm missing what is the point? the network schemes are written to try and emulate file io ...12-Aug-10 21:13
2122PavelHas anybody tried some file related scheme? zip// or somethink like was in disscussion?12-Aug-10 21:10
2121Maximbriging = bridging12-Aug-10 21:04
2120MaximI guess we'll need device extensions for briging the gap.12-Aug-10 21:03
2119GrahamI don't think so12-Aug-10 21:01
2118PavelThats what I ask, may the scheme be asynchronous when low level port is synronous and we dont use tasks yet?12-Aug-10 21:00
2117Grahamthe main port is just an abstraction .. to allow you to work on the real port12-Aug-10 20:58
2116Grahamwhy not?12-Aug-10 20:58
2115PavelBut ok sub port cannot be unleashed from above schema right?12-Aug-10 20:57
2114PavelThats what I wrote12-Aug-10 20:55
2113Grahamfile io is sync isn't it?12-Aug-10 20:55
2112HenrikRobert made an overview of how ports work a while ago. I'm not sure if it's available publicly.12-Aug-10 20:54
2111Pavelmay the sheme be asynchrnous alhough file scheme is synchronous (I presume)?12-Aug-10 20:54
2110Paveltypo all of them12-Aug-10 20:52
2109PavelI've looked at your shemes already, but all of the are network related. Some easy pedagogical example would help me :) how to ommit port numbers (maybe they are not neccesary) and especially how to manage subport in 'file. Anyway impressive bunch of schemes.12-Aug-10 20:51
2108GrahamYes, check my github site12-Aug-10 20:46
2107PavelAny simple protocol example available, something like the R2 one long time on rebolforces, but for R3? I'd like to implement protocol above 'file schema. Any help/hint welcome.12-Aug-10 20:28
2106Grahampop uses crlf.crlf .. sorry3-Jul-10 21:34
2105GrahamI guess I should try that ... sending a length3-Jul-10 21:34
2104Grahamhttp uses a content-length ...3-Jul-10 21:33
2103Grahampop uses .crlf ftp closes the data port3-Jul-10 21:32
2102Steevelike for any protocol, the server must send the length of the data at first3-Jul-10 21:32
2101GrahamWhat's the best way to determine whether the server has completed sending data if the server does not close the port?3-Jul-10 21:30
2100GrahamAnyone tried this out?30-Jun-10 2:44
2099Grahamgoing to think on the syntax to get the database metadata ... as I should be able to get column names, and types29-Jun-10 10:41
2098GrahamStill don't know if I can reuse the port after the server closes it .. or, whether i need to create a new subport29-Jun-10 10:30
2097GrahamOk, updated the protocol to remove the waits inside the handler ... and it is working now. I can now detect the close event from the server.29-Jun-10 10:30
2096GrahamOh yeah ... don't wipe the Db ... but I've made a backup anyway. It's the demo employee.fdb that comes with firebird. You can do this

db: open jdbcbridge://www.compkarori.co.nz:8020 insert db {select first 3 * from employee} result: copy db

29-Jun-10 9:24
2095Grahamyou don't need any db drivers installed on your side ... it's a tcp connection to the db server.29-Jun-10 9:21
2094GrahamI've setup a server at www.compkarori.co.nz:8020 to help debug the jdbcbridge protocol.29-Jun-10 9:20
2093Grahamand then clearing the client/data29-Jun-10 6:45
2092Grahamexcept I'm copying the data from client/data to client/spec/data ...29-Jun-10 6:43
2091SteeveLast but not least , there is problem in the close event.

>>client/spec/data: load enline to-string client/spec/data should probably be >>client/spec/data: load enline to-string client/data

29-Jun-10 6:37
2090GrahamIt's so long since I looked at this R3 network stuff ...29-Jun-10 6:25
2089SteeveThere are potentially several problems in that code. First, never use wait in the event handler. it's a good way to produce a stack overflow. Second, I have to go to work, sorry...29-Jun-10 6:21
2088SteeveI see no evidence in that test. What is the events trace ?29-Jun-10 6:16
2087Grahamhttp://github.com/gchiu/Rebol3/blob/master/protocols/prot-jdbcbridge.r29-Jun-10 5:03
2086Grahamdb: open jdbcbridge://localhost insert db [{select * from staff where fullname = (?)} "Graham Chiu" ] >> print length? db 1 result: pick db 1 >> print length? db 0 close db db: open jdbcbridge://localhost:8000 insert db {select first 2 * from staff} >> print length? result 2 >> result: copy db >> print length? result 0 close db29-Jun-10 4:55
2085GrahamHmm...but I get a close event if the server throws an exception29-Jun-10 3:45
2084GrahamNot sure what's happening here .. but my server closes the connection, and termintes the thread, but R3 is not getting a close event.29-Jun-10 3:20
2083NickAI'm very happy to see this being done with R3 :)28-May-10 13:53
2082Anton(DideC meant to thank Andreas.)28-May-10 7:21
2081DideCThank's Anton. Can be of some help.27-May-10 16:20
2080AntonAh, you just forgot the http header.27-May-10 14:26
2079AndreasYou might also want to have a look at: http://github.com/earl/rebol3/blob/master/scripts/shttpd.r26-May-10 17:59
2078NickAgreat!26-May-10 15:19
2077DideCREBOL []

print "Serving port 8080..."

open-subport: func [port] [ print "=== Creating sub-port" port/awake: func [event /local port data] [ print ["=== Subport event:" event/type] port: event/port switch/default event/type [ read [ print [" " data: to-string port/data] data: replace/all data newline <br> write port to-binary rejoin ["HTTP/1.0 200 OK^/Content-type: text/html^/^/<html><head></head><body>" data "</body></html>" newline] ] wrote [ close port ] ] [false] ] read port ]

server: open tcp://:8080

server/awake: func [event] [ print ["*** Server event:" event/type] if event/type = 'accept [ open-subport first event/port ] false ]

wait 30 close server print "Done serving" halt

26-May-10 14:36
2076DideCSeems I have found my way to make it working :26-May-10 14:36
2075DideCREBOL []

print "Serving port 8080..."

open-subport: func [port] [ print "=== Creating sub-port" port/awake: func [event /local port] [ print ["=== Subport event:" event/type] port: event/port switch/default event/type [ read [ print [" " data: to-string port/data] write port to-binary rejoin ["<html><head></head><body>" data "</body></html>" newline] true ] wrote [read port] close [close port] ] [false] ] ]

server: open tcp://:8080

server/awake: func [event] [ print ["*** Server event:" event/type] if event/type = 'accept [ open-subport first event/port ] false ]

wait 30 close server print "Done serving" halt

26-May-10 14:15
2074DideCI want to build a very very very simple web server in R3. I just want to be able to receive an HTTP request and send the response. But me and Rebol networking are two differents people !!

To begin, I just want to be able to display the full request in the response page. So far I have wrote this by peeking code in DocBase, but it does not work as I want : the browser stay awaiting the answer. Can one point me to what's wrong ?

26-May-10 14:15
2073Brockthanks for this Graham25-Apr-10 14:37
2072GrahamUpdated Feb 21 http://github.com/gchiu/Rebol3/tree/master/protocols/24-Apr-10 22:03
2071BrianHI -> A21-Feb-10 20:14
2070BrianHI client for R2, to be accessed through a CHAT mezzanine in R2.21-Feb-10 20:14
2069BrianHFor most people those distinctions don't matter, they can just call it chat. It matters to me because writing another DevBase client is on my immediate todo list.21-Feb-10 20:12
2068BrianHSo we have the datastore (DevBase), the server (DevBase server), a client (DevBase client) and the mezzanine wrapper (CHAT).21-Feb-10 20:11
2067BrianHIt's the only DevBase now. I just use the term to distinguish from CHAT, which is only a mezzanine that calls a DevBase client. Most people just call it chat.21-Feb-10 20:08
2066GrahamOk, we need to be more explicit and refer to DevBase3 now21-Feb-10 20:06
2065BrianHThe first was written by Carl to do /View development, way back when, and never released (afaict). DevBase 2 was derived from that, and DevBase 3 was based on the lessons learned from 2.21-Feb-10 20:06
2064BrianHTechnically, the one accessed through CHAT is the third DevBase. The other two have been retired.21-Feb-10 20:03
2063GrahamSo we now have two DevBases ?21-Feb-10 20:02
2062BrianHRight. The http scheme is due for a major revamp. What we have is not really all that we want.21-Feb-10 20:02
2061AndreasAh, nevermind. Upon re-reading, I think I misunderstood your message.21-Feb-10 20:01
2060AndreasBrian, I guess you are talking about changes that are also not yet in R3?21-Feb-10 20:00
2059BrianHI haven't posted changes to the http protocol yet, sorry.21-Feb-10 19:56
2058BrianHDevBase is the forum/filestore that you access withg the CHAT command in R3.21-Feb-10 19:55
2057GrahamAndreas and I did the same, doing a diff on the original prot-http and current and found no major changes. Suggest submit a bug report.21-Feb-10 19:01
2056ChristianEGraham, all changes to the prot-http sources seems to be authored by Carl, I've seen no traces of changes to the protocol introduced by Brian.21-Feb-10 17:06
2055ChristianE*pto-http = prot-http21-Feb-10 17:04
2054ChristianENo luck even with older R3 versions; version 2.100.33.3.1 dating back to 2009-01-28 being the oldest I have around.21-Feb-10 17:04
2053ChristianEI tried against Gabriele's original pto-http sources as from the *.rlp, not the *.r as touched by Carl. Only thing I changed was two replacements of THIRD with BODY-OF.21-Feb-10 16:59
2052ChristianEThat's my guess.21-Feb-10 16:57

Return to Index Page