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: 37401 end: 37500]
world-name: r3wp
Group: Core ... Discuss core issues [web-public] | ||
Graham: 16-Dec-2006 | How about a /native refinement to return files in 'request-file to return files in the native file format? | |
Anton: 17-Dec-2006 | Why not just write a TO-LOCAL-FILES function to do that for all files in a block ? | |
Graham: 17-Dec-2006 | it's a switch to control what is being returned by a function | |
Graham: 18-Dec-2006 | I don't even have a feeling for assert | |
Chris: 18-Dec-2006 | I guess it's to do with usage: though it functions like 'case, it is more like 'all with a step-by-step fallback. | |
Gabriele: 19-Dec-2006 | chris: a trick i have seen: | |
Gabriele: 19-Dec-2006 | anyway, assert seems a good name to me. | |
Anton: 19-Dec-2006 | Gabriele, yes I've used this trick, but it's a little uncomfortable. | |
Dirk: 21-Dec-2006 | Hi, syntax question: i want to insert a row into a mysql db: string-block: [ "value1" "value2" insert db [ "insert into table values (?,?)" string-block ] this fails (string-block is not evaluated i guess), but i dont know how to generate the following insert db [ "insert into table values (?,?)" "value1" "value2" ] (which works) using rejoin, remold, join, .. whatever. | |
Dirk: 21-Dec-2006 | and happy xmas to you! this works! how to factor out the "insert into .." string into a variable? stmt: "insert into .." insert db compose [ stmt (vals) ] does not work, neither does insert db reduce [ stmt vals ] which puzzles me ... | |
Dirk: 21-Dec-2006 | hm, but: >> a == ["abc" "def"] >> compose [ "abc" (a) ] == ["abc" "abc" "def"] >> reduce [ "abc" a ] == ["abc" ["abc" "def"]] why is a block returned in reduce, but two strings (which i need) in compose. should be the same imho... | |
Maxim: 21-Dec-2006 | a common trick is to do this to unify a series as a block! which might also accept a string! : val: compose [(val)] this way, if val was originally a block, it stays that way, but if it was a string, its then inserted within one. Note that the above actually creates a new block... so that the original val (if it was a block) and the new one are not the same | |
Maxim: 21-Dec-2006 | nope, its a special case for compose... and is one of its differentiating features. | |
Maxim: 21-Dec-2006 | also note that compose has a /deep refinement which is very handy | |
Maxim: 21-Dec-2006 | ex: a-big-view-block: [ button "press me" [print rejoin ["You have pressed " (val)]]] val: "the button" view layout compose/deep a-big-view-block | |
Maxim: 21-Dec-2006 | note that in the above, if you didn't compose the block it would still work, since val would be evaluated on the fly... BUT if you have several windows opened at the same time and each new window displayed a different caption, then the above is necessary... otherwise changing the value of val will change ALL windows at the same time :-) which is a common error we all make at some point. | |
Dirk: 21-Dec-2006 | yeah, i see the difference. but i think the behaviour is a bit weird | |
Dirk: 21-Dec-2006 | one last question: a: [ "a" "b" ] how to write/append %to.txt a so that a b <- with whitespace inbetween gets written? | |
Maxim: 21-Dec-2006 | write/append %to.txt form a | |
Anton: 28-Dec-2006 | I want to speed up access to a block of objects (unassociated) for a search algorithm. Should I use LIST! or HASH! ? It's a growing list of visited objects, and I'm searching it each time to see if the currently visited object has already been visited. | |
Tomc: 29-Dec-2006 | perhaps the objects could just contain a visited field | |
Anton: 29-Dec-2006 | Search term is a word, but I want to support strings as well. | |
Gregg: 29-Dec-2006 | If lookup speed is primary, use hash!, if you're doing a lot of inserts and removes, use list! There is overhead to has items for lookup, but the speedup is enormous on lookups.. | |
Anton: 29-Dec-2006 | A quick test looks like using a hash didn't help in my case, the major work must be somewhere else. | |
Geomol: 31-Dec-2006 | Is it possible to turn off: ** Math Error: Math or number overflow ? My gcc compiler here warn me of integer overflow, but I can run the C program, and bits are lost. But that can be ok in some cases, for example to calculate noise. I'm wondering, if I can do that in a fast way with REBOL. Example: 46341 * 46341 will produce an integer overflow. I just want the result with the high order bits lost. | |
Robert: 31-Dec-2006 | Good question. I would like to avoid this error as well. A overflow would be OK in most cases. | |
Robert: 31-Dec-2006 | How do you do this when you have a lot of claculation that use user input? | |
Sunanda: 31-Dec-2006 | Not sure -- and of course it probably doesn't meet Geomol's request for a "fast way" | |
Geomol: 1-Jan-2007 | LOL Wow! That's nice, Gabriele! Also a fine solution, Sunanda! That might be one of the fastest way to do it. Maybe I'll just use RANDOM in my noise generating routine, but if that's not good enough, I'll probably use one of these suggestions. | |
Robert: 1-Jan-2007 | Cool. This trick could be used to implement intervall arithmetic. Using a PAIR to store the upper/lower bound of ranges. Than we only need special operator implementations for * / to handle all cases. | |
Robert: 1-Jan-2007 | Question: I have a block that represents several records (fixed size number of fields). Now I need to extend each record by one column. Inserting a new entry every X entries in the block. IIRC there is a special function to deal with fixed size blocks for such thing. Like remove-each but more generic. | |
Robert: 1-Jan-2007 | the simplest way I come up is: FORSKIP series record-size [ APPEND result COPY/PART series APPEND result new-value ] But this copies the series. Is there a nice inplace extension solution? | |
Volker: 1-Jan-2007 | parse series[any[ record-size skip p: (p: insert p new-value) :p ]] but that shifts a lot. would use insert clear series result and for speed there is insert/part to avoid all the small temp blocks. | |
Gregg: 1-Jan-2007 | I have a DELIMIT function that will do it, changing the series in place, with the exception of the trailing element. So the final result would look like this: append delimit/skip series new-value record-size new-value The basic idea you want is this: series: skip series size series: head forskip series size + 1 [insert/only series value] My DELIMIT func also works with list! and any-string! types correctly, which simple code above doesn't account for (the +1 part is simplified). | |
Geomol: 3-Jan-2007 | To move a file, one solution is: write/binary <destination> read/binary <origin> delete <origin> If you leave out the delete, you've got a copying file routine. | |
BrianH: 3-Jan-2007 | If you just need to move a file within the same hard drive, there may be some tricks with renaming or calling external commands that will likely be faster. Be sure to check those out too. | |
Anton: 9-Jan-2007 | Given some data which I might load from a file: data: [ [code description] ["CC" "Crazy Cuts"] ["DD" "Dreadful Dingo"] ] I can process it this way: format: data/1 ; get the format block, which is known to be first use format [ foreach blk next data [ ; skip over the format block set format blk if code = "CC" [print description] ] ] with the disadvantage that I set a word ('FORMAT). I could put that in another USE context but then I would have yet another level of nesting in the code. (There is already one level of nesting more than I want.) What I would prefer to write is something like: USE-FOREACH (data/1) (blk) (next data) [ if code = "CC" [print description] ] Therefore, an implementation is called for. Any comments before I begin an implementation ? | |
Gabriele: 9-Jan-2007 | Anton, you need a BIND there somewhere :) | |
Anton: 9-Jan-2007 | Chris, sorry it's supposed to be unparenthesized, as a word, to have access to the original data. | |
Anton: 9-Jan-2007 | Mmm... maybe USE-FOREACH better deserves your functionality, and USE-FORALL could be a function which steps through the DATA block, allowing access to it. | |
Anton: 10-Jan-2007 | Ladislav, a reference to Brazilian ju-jitsu, which is wrestling. | |
Anton: 10-Jan-2007 | It uses less words, is easier to understand, but it has a more brittle dependency chain via FORALL mezzanine which uses FORSKIP mezzanine which uses WHILE native. | |
Anton: 10-Jan-2007 | Chris' version does not support WORDS argument as a word! - but I don't think it's that important to support. | |
Volker: 10-Jan-2007 | i opt for chris version. its a loop, foreach is faster. but add a version with more lines, for explanation^^. | |
Chris: 10-Jan-2007 | Anton, would it add too much to change the 'forall loop to a 'while loop? | |
Anton: 10-Jan-2007 | It's a pity that it uses five more words, but the extra stability and simplicity of going direct to a native seems worth it. | |
Anton: 10-Jan-2007 | (Also, I think adding FRESH-LOCALS is not a good move.) | |
Joe: 12-Jan-2007 | has anybody used core async dns ? I am trying to resolve domains using a port per domain but I get a sequential behaviour. Ideally, this should be done with a single port, sending requests and getting replies in an async fashion. snippet below | |
Gabriele: 12-Jan-2007 | i never used it this way, so i can't say if it can be made to work. but by thinking about how this is implemented on unix (a second process that calls gethostbyname), i'd guess that it can only do one host resolution at a time. | |
Ladislav: 12-Jan-2007 | only now I noticed, that: even? 0.1 ; == true my understanding differs slightly, I would more likely expect a test like: zero? 0.1 // 2 any opinions? | |
Joe: 14-Jan-2007 | iirc there was a blog post mentioning that it would get added in 1.3.x . I hope so ! Async networking is a must for decent performance apps ! | |
Gabriele: 15-Jan-2007 | petr, it's not a cheap trick. r3 is going to be better than the async core. | |
Pekr: 15-Jan-2007 | Gabriele - I hope so - otoh - what is the expense of threads? I looked into my friends code programming server in Delphi - they used exactly that - simply new thread for each connection. I would like to know what is the overhead - speed, memory etc. I called it "a cheap trick", as my friend could not even imagine, how he would do a multiplexed scenario ... | |
Gabriele: 15-Jan-2007 | let's get on the first reason: why did I say that threading is worse? for the reason holger explained a lot of time ago on the mailing list. shared memory. | |
Gabriele: 15-Jan-2007 | that is, handling concurrency in a threaded app is hard, so they just fool you into thinking that threading is easier. | |
Gabriele: 15-Jan-2007 | that is, the user does not have to handle concurrency. you just talk with other "threads" (tasks would probably be a better term) with ports | |
Gabriele: 15-Jan-2007 | what you describe above, can be easily obtained by doing the dns resolution in one task. what you see is a port, that to you looks exactly like an async dns port. except that it is implemented in mezz code rather than being native. | |
Pekr: 15-Jan-2007 | Gabriele - we have async dns already, don't we? dns:/// .... but what is currently blocking without ability to set timeout is trying to establish a connection (SYN) ... or can we make it also a non-blocking? | |
Pekr: 15-Jan-2007 | If there is a way of how to do fully non-blocking communication, as for me, I don't need async ... if I need "async" behavior, I might use rebol tasks .... | |
Gabriele: 15-Jan-2007 | eg. when you make a connection with async:// or atcp:// there is no wait involved | |
Gabriele: 15-Jan-2007 | the point rather is, than normally, instead of delving into the complexity of an asynchronous event based interface, you just make a task and use read. | |
Gabriele: 15-Jan-2007 | Chord - problem number one, udp:// has bugs that make it inusable in async manner. problem number two, it just stopped working after a couple minutes, and figuring out why was incredibly difficult. (maybe it'd work on 1.3... but i haven't had time to try it) | |
Pekr: 15-Jan-2007 | as for R3 - networking layer is the one ported from 2.x, just plugged into tasking/threading model, or is it new implementation? (IIRC Carl said port model is going to be a bit reimplemented?) | |
Gabriele: 15-Jan-2007 | i would guess it is a new implementation. there are two reasons it must be: the os code has to be separate, and the internal model is probably very different. | |
Gabriele: 15-Jan-2007 | well, udp works, as long as you don't try to use it in a 100% async manner. | |
Pekr: 15-Jan-2007 | Joe - yes, that is how I understand it ... now how is rebol trying to establish a connection non-blocking? Can I set kind of timeout? hmm, maybe I will have to look into async:// protocol ... | |
Joe: 15-Jan-2007 | there is a great lack of information from RT ! The problem is core is still widely propietary and it is imposible to find out how things like async DNS work without RT publishing the info. I was interested in writing an async DNS using Gabriele's async as a reference but I now find that udp has bugs ! Another surprise to discourage me ! | |
Oldes: 16-Jan-2007 | I don't think if it's too important, if you are making history application, you should be awared of such a issues. But error would be probably better than this. | |
Volker: 16-Jan-2007 | it cant handle infinite ints too. Somewhere there hastobe a tradeoff^^ | |
Oldes: 16-Jan-2007 | IEEE 754 defines formats for representing floating-point numbers (including negative zero and denormal numbers) and special values (infinities and NaNs) together with a set of floating-point operations that operate on these values. http://en.wikipedia.org/wiki/IEEE_floating-point_standard | |
PeterWood: 16-Jan-2007 | Given that 1/1/0000 is a base is doesn't seem logical to me to able to subtract from it . I'd go with a script error or if that's not desirable return the base value ie 1/1/0000 | |
Ladislav: 16-Jan-2007 | Geomol: originally I felt this might be a viable POV, but I am against it, because it means, that some REBOL values are not LOADable/MOLDable making REBOL script preprocessing impossible | |
Maxim: 16-Jan-2007 | an integer really is a whole number... substracting 1 from the smallest value an integer can hold Must raise an error... in any weird twist. otherwise we end up with scripts which have no meaning... -100 - 1 = 100 makes no sense to anyone except the cpu, cause its stupid... why should such kind of logic end up in a language which does all it can to stray from that kind of logic in the first place. | |
Maxim: 16-Jan-2007 | Thus I second Ladislav's POV... a minimum must not be substractable... it makes no sense. fix your script, detect the error, create your own interpretation of out of bounds values, but don't act as if nothing is wrong, when its obvious... the intent of the operation has no relation with the meaning of the result. | |
Ladislav: 16-Jan-2007 | actually, I can imagine that a result of x - 1 may be a "useful" value, example: -2147483648x0 - 1x0 == 2147483647x0 , but I strongly object against obtaining an "illegal value" | |
Maxim: 16-Jan-2007 | maybe in C its ok, cause you (should) understand about CPU registers, binary calculus in finite space etc... but for a REBOL application. | |
Maxim: 16-Jan-2007 | an int is a number and substracting from a negative value should return a negative value, or error if the result is out of bounds. I really think that is the POV of REBOL itself... its meant to make programming simple... not complicate thing by re-introducing things like overflow causing the carry bit to roll number around, like in C... | |
Maxim: 16-Jan-2007 | there is a section on datatypes, but they do not go in depth at the limits, the conversion, the "expected" behaviours, the overall line of conduct on "strange events" | |
Maxim: 16-Jan-2007 | this is where objectivity is at loss. they are equal and not depending on what you consider equal, or rather if: - the evaluated human concept is equal (a space) - the rebol value can be converted to from two types symbiotically. - they obey a specified set of guidelines like (if converted to string both are equal) - they must be strictly equal (of same type, but not the actually same instance) - the same (actually two references to the same value) | |
Maxim: 16-Jan-2007 | (but you know that... hehe ... you did a thesis on REBOL equality ;-) | |
Ladislav: 16-Jan-2007 | yes, Rebolek, that is a good suggestion solving the issue | |
Geomol: 16-Jan-2007 | Good points here! :-) I now see the problem. It might be best to return an error, when subtracting 1 from the lowest value of a date. Make sure, you think it through as much as you can, and then be consistent. If one datatype return an error in such a situation, another might as well. | |
PeterWood: 16-Jan-2007 | On the subject of date! and values having meaning. I think that the zone refinement needs to be looked at again: >> dt: 17-Jan-2007/9:52+25:00 == 17-Jan-2007/9:52+25:00 but >> 17-jan-2007/9:55+5:45 ** Syntax Error: Invalid date -- 17-jan-2007/9:55+5:45 ** Near: (line 1) 17-jan-2007/9:55+5:45 To the best of my knowledge +25:00 is not a valid time zone offset but +5:45 is (Nepal). | |
Gabriele: 17-Jan-2007 | zone has a resolution of 30 minutes. it is indeed a problem for a couple zones (like the one you pointed out). | |
PeterWood: 17-Jan-2007 | Not handling the 45 minute zones (I don't think that there are any 15 minute zones) isn't a big problem. Its the inconsistency that bugs me - GMT +25:00 is a less correct value than GMT +5:45. | |
Gabriele: 17-Jan-2007 | yep, but rebol is not actually doing sanity checks on zones. the 45 problem is only due to a limitation of the implemetation. | |
Geomol: 17-Jan-2007 | A day no Mars is 24.6 hours, so I think, we're ok with -16:00 to +15:45 timezone. | |
Geomol: 17-Jan-2007 | A day *on* | |
Chris: 17-Jan-2007 | Although arguments for any 'uses based functions must be contained in a block, it does allow for optional arguments with preset values. | |
Chris: 17-Jan-2007 | Hmm, lost a close bracket in a VNC post... | |
Maxim: 17-Jan-2007 | a part for a little bit of excentricity on your part... do the trailing ^^ you add on most/all post mean something I have been missing? | |
Chris: 17-Jan-2007 | A quickie example, but illustrates the flexibility and readability. | |
PeterWood: 18-Jan-2007 | And a list of all the current (and a few old ones) at http://en.wikipedia.org/wiki/UTC%2B0 | |
Oldes: 19-Jan-2007 | I have a question, I have this code: >> b: "1234str" ri: func[b /local i][i: copy/part b 4 b: skip b 4 i] probe ri b probe b 1234 1234str Why the b string is not "str" ? | |
Cyphre: 19-Jan-2007 | Here is the explanation: >> a: "1234" == "1234" >> b: a == "1234" >> b: skip b 2 == "34" >> a == "1234" >> b == "34" >> | |
Ladislav: 19-Jan-2007 | as I said: you cannot change the index of a series, so the only possibility is to share the variable | |
Ladislav: 19-Jan-2007 | actually the error lies in the fact, that many users think, that SKIP changes the index of a series. It actually doesn't: b: "1234" index? skip b 2 ; == 3 index? b ; == 1 | |
Oldes: 19-Jan-2007 | but than it's quite useless... I wanted to do a function read-integer buffer and etc. and make it universal:( I know, I can set buffer as global variable (or in the context) and do just read-integer etc. | |
Oldes: 19-Jan-2007 | isn't it too many operations to just get a string? read-str: func[b [word!] /local s nb][ s: none nb: get b error? try [ i: index? nb s: copy/part nb i: (index? find nb #{00}) - i set b skip nb (i + 1) ] s ] | |
PeterWood: 19-Jan-2007 | As a function: >> b: "1234str" == "1234str" >> ri: func[b] [b: remove/part b 4] >> probe ri b str == "str" >> probe head b str |
37401 / 64608 | 1 | 2 | 3 | 4 | 5 | ... | 373 | 374 | [375] | 376 | 377 | ... | 643 | 644 | 645 | 646 | 647 |