AltME groups: search
Help · search scripts · search articles · search mailing listresults summary
world | hits |
r4wp | 5907 |
r3wp | 58701 |
total: | 64608 |
results window for this page: [start: 37701 end: 37800]
world-name: r3wp
Group: Core ... Discuss core issues [web-public] | ||
Ladislav: 9-Apr-2007 | (or change a default keyword?) | |
Ladislav: 9-Apr-2007 | yes, that is a good suggestion, putting it in | |
Ladislav: 9-Apr-2007 | >> help trim USAGE: TRIM series /head /tail /auto /lines /all /with str DESCRIPTION: Removes whitespace from a string. Default removes from head and tail. TRIM is an action value. | |
Henrik: 9-Apr-2007 | don't you get a list of arguments with accepted datatypes? | |
Ladislav: 9-Apr-2007 | ah, sorry, it does not check whether the argument is an ANY-STRING! or a PORT! , but instead it allows SERIES! | |
Henrik: 12-Apr-2007 | I noticed this: >> to-url [http b c] == http://b/c >> to-url [http b 125] ** Script Error: Invalid argument: 125 ** Where: to-url ** Near: to url! :value Couldn't it be useful to have 125 accepted as a port number since it's the first integer in the block? | |
Maxim: 12-Apr-2007 | why isn't 125 valid anyways? http://b/125 is a valid url AFAIK no? | |
Sunanda: 12-Apr-2007 | Yes it is - completely valid as a URL. | |
Henrik: 12-Apr-2007 | I came up with my own: >> to-url [http a 125] == http://a:125 or == http://a/125 so probably not a good idea to autmatically assume it's a port number. | |
Henrik: 12-Apr-2007 | stupid question: how do you form a readable error message from an error object, such as it appears in the console? | |
Sunanda: 12-Apr-2007 | Hope this is not a stupid answer...... xx: disarm try [0 / 0] probe xx check out xx, and see what bits you want to print......You'll need to translate the 400 into "math error" ...Not sure about that bit....Can you find anything in the system object for that? | |
Henrik: 12-Apr-2007 | hmm... I don't know. I thought there was a simple method to convert such an error object into a console style error. | |
Henrik: 12-Apr-2007 | I get an error in Rugby: make object! [ code: 302 type: 'script id: 'no-arg arg1: none arg2: 'obj-a arg3: none near: [request-sync/action [] func [obj-a obj-b][ all [ obj-a obj-b insert probe obj-a/results probe obj-b/results unique/skip obj-a/results 3 obj-b/results: obj-a/results ] ]] where: 'safe-exec ] which I'm not sure how to read | |
Sunanda: 12-Apr-2007 | Compare do with probe xx: disarm try [do] Both get you a 302/no-arg message. Just the console message is chattier. You can of course print out a terser form using the parts of the disarmed error object: print ["error: " xx/id "near" xx/where] Is that what you mean? | |
Graham: 12-Apr-2007 | doesn't it mean you didn't supply the argument obj-a ? | |
Maxim: 12-Apr-2007 | I Henrik is wonder if there is a call to transform the error object into the "official" error Message. AFAIK there is no such official stub... maybe someone knows this func? after 8 years I still have not come across this. | |
btiffin: 12-Apr-2007 | Hi, I saw a pretty good error parser in Cyphre's rebsite vconsole.r script a long time ago... The code is copyright 2001 Cyphre but if you ask nice I'll bet he shares it, then again maybe not. So please ask. Check REBOL/Public/Sites/Cyphre/vconsole.r from the Viewtop. | |
Henrik: 13-Apr-2007 | graham and maxim are both right. I don't know what the error message really means and was hoping to clear that up by translating it to a standard console message. | |
Henrik: 13-Apr-2007 | trying form-error.r gives: none is missing its obj-a argument OK. :-) It would mean that the function I'm passing directly is missing an argument. I was confused by the none! part. | |
Oldes: 13-Apr-2007 | (a good way) | |
Sunanda: 13-Apr-2007 | You might be able to fiddle with the http scheme for this condition..... If you do this: zz: open http://www.aving.co.kr probe zz find mold zz "response-actions:" You'll see there is a tale of acceptable reponse codes. So (just an idea) patch that to include 500, and then check if the in-buffer field has any <html> content | |
Sunanda: 13-Apr-2007 | Good point -- he has to check with some care what's there. Usually, it's a text string, so no HTML. I'm only sugesting he patch the port for *this* website, not all sites; and some eyeballing should help him decide what is a real 500 and what is a faked one.....Maybe, anyway. | |
Gabriele: 13-Apr-2007 | hard to say, maybe the 500 would turn to a 404 if the error went away... | |
Maxim: 15-Apr-2007 | I just had a language flash... what if we used the comma as a stop word for variable argument enabled funcs... ex: sum 1 2 3 4 , sum would be defined as sum: func [**] [ result: 0 foreach value ** [result: result + item] result] | |
Steeve: 15-Apr-2007 | but i agree for one thing, the comma should be loaded as a valid token in rebol | |
Maxim: 15-Apr-2007 | darn I hate object oriented development... I've come to a point where I need multiple inheritence in rebol (which I can hack) but some methods overlap and I need both for the object to be compliant... again, I can hack most of this ... but the fact that I just came to this point reminds me of the down sides of using objects (in any language)... | |
Maxim: 15-Apr-2007 | overall a big can of worms :-( the slightest little mistake in the future (forgetting a detail in a year from now) could lead to a 2 day bug fest... even if documented, some side-effects can't be pre-identified. | |
Steeve: 15-Apr-2007 | i think it's a problem when any type of source becomme huge | |
Oldes: 16-Apr-2007 | Native functions are functions that are hardwired into the kernel of REBOL. So you cannot see source of such a functions. http://en.wikibooks.org/wiki/REBOL_Programming/Internals | |
Gregg: 16-Apr-2007 | If you mean the NATIVE func that you can see in REBOL, I think that's used only to document native funcs; to create a REBOL spec for use with HELP. | |
Maxim: 17-Apr-2007 | any one ever encountered an error in REBOL's binding? yesterday I stumbled for hours on a bug in REBOL's interpretation... really. | |
Maxim: 17-Apr-2007 | for some reason, it seems that binding does not handle sub objects very well. strangely, it seems that in a circumstance I cannot determine (and cannot reproduce) when you have a series of nested objects at some point, even if you remake all parts of the inner objects, you still end up with functions which call previous bindings, thus calling the wrong functions! I had to explicitely call the paths from the supplied outermost object back to the current object in order to reach my own local function: ex: within the body of a function in objc, I had to call this: instance/ctx/other-function instead of only 'other-function. yet they are defined in the same make ! | |
Maxim: 17-Apr-2007 | I tried recreating the error and somehow it happens only in a circumstance which I can't determine... but its a strange issue cause its the first time I hit this in all my years as a reboler. | |
Henrik: 17-Apr-2007 | I fortunately got one of those crashes drilled down to a few lines of code, but it has not been fixed yet, sitting idly in RAMBO. | |
Maxim: 17-Apr-2007 | you know, you and I in the same room will make some space-time continuum bubble, which will make R3 even more crash prone ;-) all of that negativity swirling around like a maelstrom. | |
Graham: 17-Apr-2007 | If you have a series of nested objects, how do you get the value of say, the nth nested object? is there something like : get in object 'obj1/obj2/obj3/obj4/....objn/parameter | |
Henrik: 17-Apr-2007 | perhaps if you convert the path to a block? | |
Graham: 17-Apr-2007 | Just wondering if there will be a shortcut method of accessing an object | |
Henrik: 17-Apr-2007 | >> mold/all to-email "" == "" Is there a problem here or am I putting too much faith in mold/all? | |
Henrik: 17-Apr-2007 | or use it if you consider data loss a feature :-) | |
Maxim: 17-Apr-2007 | this is a big bug.... even a proper email doesn't get serialized. :-( | |
Ashley: 18-Apr-2007 | I've had a mental lapse. How do I get the follwing to work: >> a: func [b /local v] [v: 1 do b] >> a [print v] | |
Oldes: 18-Apr-2007 | is there any better way how to make from nasted block flat one than this one: >> a: [] b: [[1 2][3 4]] forall b [append a b/1] a == [1 2 3 4] | |
Oldes: 18-Apr-2007 | no.. I cannot use it... load reform [["a" 1][b c]] == [a 1 b c] ;;;I need ["a" 1 b c] | |
Anton: 18-Apr-2007 | >> a: copy b == [[1 2] [3 4]] >> while [not tail? a][a: change/part a a/1 1] a: head a == [1 2 3 4] | |
Oldes: 18-Apr-2007 | I choosed Anton version which is as fast as the load version (but I somehow don't know if it's good just to convert to string and load).. and I don't need recursive (which is fine, but slower).. and maxim... yes.. just speed (it's a shortcut for forskip anyway)... on the 'while version is good that the 'change is automatically skiping to the position after change. | |
Maxim: 18-Apr-2007 | parse is screaming fast. I'm using it as the front-end for a commercially used tcp service and it beats the server (in spead) which it speaks with (and I mention its a 1200 line rule too ;-). I had to throttle my service so the other end can keep up with how fast I can i/o things comming and going. | |
Anton: 18-Apr-2007 | Ladislav, maybe Oldes meant "slower to write" ? I guess I was aiming for less typing too. Parse always seems to win in speed of operation. Yes, CHANGE is becomes terribly bad for large blocks. I must think of a better suggestion. | |
Anton: 18-Apr-2007 | b: [[1 2][3 4]] ; REPEAT-based a: [] repeat i length? b [append a pick b i] ; PARSE-based (non-recursive) a: [] parse b [any [pos: block! (insert tail a first pos)]] | |
Anton: 18-Apr-2007 | time-it: func [code /local t][t: now/precise do code print difference now/precise t] ; Ladislav's big block block: head insert/dup/only copy [] [1 2] 200000 a: [] time-it [repeat i length? block [append a pick block i]] ;==> 0:00:01.062 a: [] time-it [parse block [any [pos: block! (insert tail a first pos)]]] ;==> 0:00:00.691 | |
Anton: 18-Apr-2007 | a: [] time-it [repeat i length? block [insert tail a pick block i]] ;==> 0:00:00.651 | |
Henrik: 19-Apr-2007 | anton, repeat can use block elements directly: a: [] time-it [repeat b block [insert tail a b]] what does that give? | |
Henrik: 19-Apr-2007 | >> a: [] time-it [repeat i length? block [append a pick block i]] 0:00:01.211413 >> a: [] time-it [parse block [any [pos: block! (insert tail a first pos)]]] 0:00:01.103395 >> a: [] time-it [repeat i length? block [insert tail a pick block i]] 0:00:00.80709 >> a: [] time-it [repeat i block [insert tail a i]] 0:00:00.623597 | |
Henrik: 19-Apr-2007 | Same results for a here, but also more limited: >> time-it [a: load reform block] 0:00:00.765842 >> time-it [a: load form block] 0:00:00.514864 | |
Henrik: 19-Apr-2007 | >> time-it [a: load trim/with form block "[]"] 0:00:00.637554 >> time-it [a: to block! trim/with form block "[]"] 0:00:00.588652 | |
Oldes: 19-Apr-2007 | tm: func [p act [block!] /local t][t: now/time/precise loop p :act print now/time/precise - t] flat-while: func[b][a: copy b while [not tail? a][a: change/part a a/1 1] a: head a] flat-repeat: func[b][a: copy [] repeat i length? b [insert tail a pick b i] a] flat-parse: func [b][a: copy [] parse b r: [any [ p: block! :p into r | skip (insert/only tail a first p)]]a] flat-load: func[b][load form b] b1: [[1 2 3 4 5][6 7 8 9 0]] tm 10000 [flat-while b1] ;== 0:00:00.062 tm 10000 [flat-repeat b1] ;== 0:00:00.063 tm 10000 [flat-parse b1] ;== 0:00:00.172 tm 10000 [flat-load b1] ;== 0:00:00.046 b2: head insert/dup copy [] [a b c d] 300 b3: head insert/dup copy [] b2 100 tm 1000 [flat-while b3] ;== 0:03:03.985 tm 1000 [flat-repeat b3] ;== 0:02:11.125 tm 1000 [flat-parse b3] ;== 0:02:43.704 tm 1000 [flat-load b3] ;== 0:00:52.344 | |
Graham: 19-Apr-2007 | I like that ... have a "whatever [ .. ] " | |
Terry: 19-Apr-2007 | if you have a block like so.. aaa: [bbb[ccc "string"]] do the 'words take up memory? is there a limit to the number of 'words in a block? | |
Terry: 19-Apr-2007 | hmm, so that's not very practical way of storing a large flat DB ? | |
Terry: 19-Apr-2007 | yeah.. i just need a simple hash table | |
Terry: 19-Apr-2007 | a dictionary , for example.. cat ["def of cat" ] dog ["def of dog"] run out of words real quick | |
Terry: 19-Apr-2007 | given they would act as keys.. that would be more than a 'slight' problem | |
Sunanda: 19-Apr-2007 | There's always a design trade-off. I have various systems where real keys (usually strings) are mapped to surrogate keys (usually integers). It's a good compromise in many cases. | |
Terry: 19-Apr-2007 | What is THE best way to store a large hash table in memory like a dictionary, .. and access the data? | |
Henrik: 19-Apr-2007 | terry, about accessing data, there is a speed issue with doing so with using indexes with paths, so data/2 is much slower than second data or pick data 2. that should solve at least that aspect. | |
Sunanda: 19-Apr-2007 | Not sure there is one best way.....I have a structure that has 158,000 keys indexing 120,000 documents. All in memory. The index (when loaded) is nearly 6meg. The code uses nested tables, hashes, surrogate keys and a couple of other tricks devised for the purpose. It's worth playing with approaches. You can normally expect a ten fold improvement between initial ideas and later improvements. | |
Terry: 19-Apr-2007 | Just thinknig that even Carl's tiny web server, that loads the www content into a hash table would be a very fast server | |
Terry: 19-Apr-2007 | I've been working with Apache and PHP quite a bit, and it just feels really bloated. | |
Gabriele: 19-Apr-2007 | make block! 100 means that you can insert at least 98 values before a reallocation is needed | |
Oldes: 19-Apr-2007 | it looks, that the copy is faster a little bit, at least if I don't know how big the block can be, so it's probably better to use copy [] (if I don't know precise size): >> tm 1000 [b: make block! 20000 loop 5 [insert/dup tail b 0 1000]] 0:00:00.907 >> tm 1000 [b: make block! 200 loop 5 [insert/dup tail b 0 1000]] 0:00:00.453 >> tm 1000 [b: copy [] loop 5 [insert/dup tail b 0 1000]] 0:00:00.437 >> tm 1000 [b: make block! 5002 loop 5 [insert/dup tail b 0 1000]] 0:00:00.343 | |
Graham: 20-Apr-2007 | Is there a rebol based wiki that has versioning? | |
Gabriele: 20-Apr-2007 | oldes: i would guess that make block! n also clears the allocated memory, so it may be slower than a reallocation if you are using something like insert/dup etc. i think that when reallocating, the size is always doubled, up to a limit after which it is increased linearly. | |
Maxim: 20-Apr-2007 | I have a deep question, when we use clear, does it clear the pre-allocated space (shrinking back a series) or does it only set the series termination to the specified index? | |
Gregg: 20-Apr-2007 | I believe it keeps the allocated space, so it's more efficient to reuse a series, rather than always starting a new one with copy. | |
Ladislav: 20-Apr-2007 | Max: you can easily check: >> a: make string! 1100 == "" >> string-address? a == 17267856 >> string-address? clear a == 17267856 | |
Ladislav: 20-Apr-2007 | >> a: "this is a string" == "this is a string" >> adr: string-address? a == 17496432 >> len: length? a == 16 >> clear a == "" >> as-string memory? adr len == "^@his is a string" | |
Sunanda: 23-Apr-2007 | a: make object! [b: 445 c: 444] b: make object! [b: 999] b: construct/with third a b ;; set b to a's values and fields | |
Anton: 23-Apr-2007 | I have a further requirement; the object should be modified in place. | |
Sunanda: 23-Apr-2007 | You beat me to it with a better solution -- I was going to suggest a loop: foreach v next first f [set in f v get in f2 v] | |
Anton: 23-Apr-2007 | Yes, I was hoping for a bulk-set operation. | |
Henrik: 28-Apr-2007 | >> a: [1 2 3] == [1 2 3] >> b: a == [1 2 3] >> same? a b == true >> b: next b == [2 3] >> same? a b == false Is there a way to check that b is the same block as a, just at a different position? | |
Henrik: 28-Apr-2007 | >> same? head a head b == true I guess that is the solution | |
Maxim: 29-Apr-2007 | btw... I assumed anton was confirming that the above path was usefull or part of plugin use... in that circumstance, the browser type would be usefull to know if the browser is mozzilla or IE based... but now... I'm a bit perplex! | |
Geomol: 2-May-2007 | random I was checking out the random function, and it seems to only produce random numbers related to the integer datatype. Even if input is a decimal, a whole number comes out. So random can produce 2 ** 31 - 1 different outputs. Is that correct? Would it be an idea to ask for 32 bit or 64 bit random numbers in REBOL v. 3? Maybe if input was 1.0, it could produce a 32 or 64 bit number between 0.0 and 1.0? Any ideas? | |
Geomol: 2-May-2007 | A little related: It seems, that the largest whole number in REBOL is 10 ** 15 - 1 = 999999999999999.0 But using random on that number will only produce output from 1 to 2 ** 31 - 1 = 2147483647, which is the largest integer. The implementation in REBOL is probably related to the ANSI C rand function, which produce output from 0 to RAND_MAX, which is at least 32767 (probably cpu related). | |
Gabriele: 2-May-2007 | however, random/secure on a series might produce more than 2^31 combinations - in principle the generator should be able to, but if it's used or not i don't know. | |
Sunanda: 2-May-2007 | Random also works on dates and times, so that _may_ get a wider range: random now.precise | |
Gabriele: 2-May-2007 | with BASE being a string with 64 1s and 64 0s, this is a way to get 64 random bits: | |
Geomol: 3-May-2007 | Anton, for an astronomy exercise at university. Actually it's about the distribution of galaxies, but the exercise goes like this: Suppose that in the Sherwood Forest, the average radius of a tree is 1 m and the average number of trees per unit area is 0.005 m^-2. If Robin Hood shoots an arrow in a random direction, how far, on average, will it travel before it strikes a tree? I'm making a simulation about this problem and need a good random generator to place the trees. | |
Maxim: 3-May-2007 | IIRC, you can ask for their service to return a set of random numbers generated by the random.org server. They have very good analysis of their numbers to prove their system is very random. | |
Geomol: 4-May-2007 | Anton, based on my simulation, I think the answer is below 100 m. The distribution of the trees is a Poisson distribution, the space between the trees is an Erlang distribution. | |
Brock: 4-May-2007 | something on the trivial side.... I've been trying to get the below command to work in a dynamic fashion, | |
Pekr: 4-May-2007 | why not simply use: either condition [write/append %test.txt "This is a text"][write %test.txt "This is a text"] | |
Henrik: 4-May-2007 | do [to-path [write all [append? 'append]] %test.txt "this is a text"] | |
Henrik: 4-May-2007 | if append? is a flag, that is | |
Brock: 4-May-2007 | checking out the options provided, may take a while to respond... thanks for the responses | |
Anton: 4-May-2007 | I use the empty paren to generate an unset! value. Compose then dissolves a false condition to nothing. | |
Anton: 4-May-2007 | Thankfully a path! with only one word ('write) in it still works just like a word! ('write) does. | |
Brock: 4-May-2007 | Pekr, regarding not simply doing this in an either statement. I have this scenario in a couple of locations and wanted a be a little more elegant. I know it wouldn't add alot of space, just was trying to be more elegant. | |
Brock: 4-May-2007 | Henrik, your solution is nice as well. Pekr, I see the err in my ways with the to-path command. That and enclosing the entire command in a block made all the difference. |
37701 / 64608 | 1 | 2 | 3 | 4 | 5 | ... | 376 | 377 | [378] | 379 | 380 | ... | 643 | 644 | 645 | 646 | 647 |