World: r3wp
[Core] Discuss core issues
older newer | first last |
Steeve 27-Aug-2009 [14592] | well, it's just a shame to have to reconvert to a char! |
Graham 27-Aug-2009 [14593] | doesn't work with 0 for timezone |
Steeve 27-Aug-2009 [14594] | ahah, yes |
Graham 27-Aug-2009 [14595x3] | BY THE WAY, pick "+-" negative? now/zone fixes the 0 issue |
-1 => "-" , and 0, +1 => "+" | |
sorry ... it should be pick "-+" negative? now/zone | |
Sunanda 28-Aug-2009 [14598] | Is my understanding of find/part wrong, or is this a bug? series: ["a" "b" "c" "d" "e"] find/part series "c" at series 3 == none ;; fails to match using the [at series 3] part of 'series print mold at series 3 == ["c" "d" "e"] ;; but [at series3] does contain the match |
Dockimbel 28-Aug-2009 [14599x2] | The /part <range> argument (at series 3) is supposed to mark the end of the search range. So, here FIND is searching in ["a" "b"] only. |
>> find/part series "c" 3 == ["c" "d" "e"] >> find/part series "c" at series 3 == none >> index? at series 3 == 3 This looks like an inconsistency to me. | |
Steeve 28-Aug-2009 [14601] | what do you mean Doc ? It has been always like that. with /part you can specify a length or a terminal pointer to the serie. What's wrong with that ? |
Maxim 28-Aug-2009 [14602] | /part makes the compare a record. so its expecting a block to match I think. |
Steeve 28-Aug-2009 [14603] | ? find /part -- Limits the search to a given length or position length (number! series! pair!) It seems clear to me |
Dockimbel 28-Aug-2009 [14604] | /part -- Limits the search to a given length or position , you're right, I've missed the "length or" part.. |
Steeve 28-Aug-2009 [14605] | it should say "tail position" to be exact |
Maxim 28-Aug-2009 [14606] | doh.... sorry... my mind mixed-up /part with /skip... |
Sunanda 28-Aug-2009 [14607] | Thanks. What was confusing me is an inconsistency between R2 and R3 -- was not sure if R3 was the bug fix or the problem. R2: select/part series "c" at series 4 == "d" R3: >> select/part series "c" at series 4 == none *** Do we agree R3 is right in this case? |
Steeve 28-Aug-2009 [14608x2] | yep |
i use /part a lot, for example when i want to to find something in the first line of a text. >> find/part text "something" any [find text newline tail text] | |
Sunanda 28-Aug-2009 [14610] | Looks like its a RAMBO report then, rather than curecode :) |
james_nak 28-Aug-2009 [14611] | Bind. I often use blocks of field (column) names from a db table in functions. Trouble is when I add a field I have to go back and add that field name to every place where I am using my fields. I was thinking of just creating a block at the beginning of my code and then using "bind" to create a local context. I just can't seem to make it local. It behaves as a global. Is there some trick? |
Steeve 28-Aug-2009 [14612] | columns: [a b c d e f] >> c1: use columns copy/deep reduce [columns] == [a b c d e f] >> c2: use columns copy/deep reduce [columns] == [a b c d e f] >> set c1 1 == 1 >> set c2 2 == 2 >> reduce c1 == [1 1 1 1 1 1] >> reduce c2 == [2 2 2 2 2 2] >> c1 == [a b c d e f] >> c2 == [a b c d e f] C1 and C2 are locals |
james_nak 28-Aug-2009 [14613] | Thank you Steeve. Never used "use" before and Bindology 101 was like Bindology 596 for me. :-) (no offense Ladislav ) Thanks. I also didn't know you could set all the members of a block like that. Appreciate your help. |
Graham 28-Aug-2009 [14614x3] | James, in my functions that fetch sql data I just setup all the variables as local and do a set on the record eg. func: [ get-sql /local name dob address ][ foreach record records copy db-port [ set [ name dob address ] record ] ] |
>> name ** Script Error: name has no value ** Near: name >> get-sql: func [/local name dob ][ set [ name dob ] [ "Graham" now/date ]] >> get-sql == ["Graham" now/date] >> name ** Script Error: name has no value ** Near: name | |
ooops .. need a reduce in there .. but you get the idea. | |
james_nak 28-Aug-2009 [14617x2] | Yes, that's the way I do it. exactly. My problem is that I often add some field and have to go back and add it to all the functions. |
And so I was looking for a global way without the global (if you know what I mean) | |
Graham 28-Aug-2009 [14619x2] | well, you can create a context inside your functions |
nope .. that won't work. | |
james_nak 28-Aug-2009 [14621] | I looked at that and it creates an object. Would be ok then my laziness shows up and I don't want to have to use object paths. |
Graham 28-Aug-2009 [14622] | won't work anyway |
james_nak 28-Aug-2009 [14623] | Looking at "bind" it appears it should work. It even describes an example which is what I want to do: Binds meaning to words in a block. That is, it gives words a context in which they can be interpreted. This allows blocks to be exchanged between different contexts, which permits their words to be understood. For instance a function may want to treat words in a global database as being local to that function. |
Graham 28-Aug-2009 [14624x2] | unless you declare the variables as local , or use [ local-variables .. ] |
well, you still have to bind either using 'use or 'bind | |
james_nak 28-Aug-2009 [14626x2] | Graham, it's really about laziness on my part. |
BTW, sorry to hear about your site. | |
Graham 28-Aug-2009 [14628] | if you're lazy, your code will break! |
james_nak 28-Aug-2009 [14629] | I know. And when I do add things like new fields I'm just asking for trouble. |
Gregg 28-Aug-2009 [14630] | Graham, this should work. o: make object! [ page: "1" total: 4 records: "22" rows: reduce [ context [id: none cell: ["Quantum of Solace" "Marc Forster" "2008" "Daniel Craig" "200"]] context [id: none cell: ["Casino Royale" "Martin Campbell" "2006" "Daniel Craig" "150"]] context [id: none cell: ["Licence to Kill" "John Glen" "1989" "Timothy Dalton" "36"]] ] ] i.e. objects become objects and blocks become arrays. What exactly was breaking? |
james_nak 28-Aug-2009 [14631] | Gregg, Hello. He was trying to help me. |
Graham 28-Aug-2009 [14632x2] | I'll give it a go. |
Hmm. Seems to work .. but it help to have an example of how it is supposed to work! no docs. | |
Graham 1-Sep-2009 [14634] | Just wondering what it takes to write a "printer driver". If I pretend to be a network printer listening on port 9100 ... can I just capture all the data coming to me or do I have to respond to interrogation as well? |
Dockimbel 1-Sep-2009 [14635x2] | RFC covering Internet Printing Protocol are listed here : http://en.wikipedia.org/wiki/Internet_Printing_Protocol |
I'm not sure that IPP uses port 9100. | |
sqlab 1-Sep-2009 [14637] | http://tools.ietf.org/html/rfc1179 I remember that I did once a rudimentary lpd/lpr, but i forgot on which pc |
Geomol 1-Sep-2009 [14638] | Graham, because we can write to a printer with: |
Graham 1-Sep-2009 [14639] | Interesting .. I never bothered before to find out what IPP was. |
Geomol 1-Sep-2009 [14640] | write tcp://<ip-number>:9100 <some data> it should be straight forward to act as a printer listening on port 9100. |
Graham 1-Sep-2009 [14641] | Since you can dump to a port on a jet print server on port 9100 ... I assumed it was dumb. |
older newer | first last |