World: r4wp
[Rebol School] REBOL School
older | first |
Pekr 17-Jul-2013 [2043] | you should know, that 'end is just a reference to still the same str, which can be proven, by inserting new element into str .... |
Kees 17-Jul-2013 [2044] | Yes, index? does it! Thanks Pekr |
DideC 17-Jul-2013 [2045] | end: find str "d" ==> search for "d" in the "abcdef" series in memory, then create a word! 'end that hold the position of "d" in this same serie. |
Pekr 17-Jul-2013 [2046] | >> insert str "0" == "abcdef" >> str == "0abcdef" >> end == "cdef" |
DideC 17-Jul-2013 [2047] | so 'str and 'end just hold different position in a unique string! |
Pekr 17-Jul-2013 [2048] | good point, DideC |
Kees 17-Jul-2013 [2049] | Tried that myself, but no change in end, which Rebol version are you using? |
DideC 17-Jul-2013 [2050] | Then, the 'for loop can work as it's positions in a unique serie! |
Pekr 17-Jul-2013 [2051x3] | 2.7.8 |
Kees - beware - rebol series concept needs really carefull aproach - it caused me a headache when working with series, till I became accustomed to it. And still, sometimes, I use trial and error aproach in console ... | |
Kees - better start with a fresh session, fresh series .... | |
DideC 17-Jul-2013 [2054] | If I replace the text in str, end still equals to def", so it does not point at str any more." How do you replace the text in 'str ? If it's like this: str: "new text" then you have created a new string! in memory and point 'str to this new serie. 'str and 'end does not point anymore the same string! |
Pekr 17-Jul-2013 [2055x3] | try on one line in console: >> str: "abcdef" end: find str "d" print end insert str "0" print end def cdef |
Kees: there are 'replace and 'change functions .... | |
or: >> str/3: #"1" == #"1" >> str == "0a1cdef" | |
DideC 17-Jul-2013 [2058] | to change the content of the "abcdef" string! you create in first place you have to change it in some way. Pekr used 'insert to add a character in the begining. You can change all its content like this: insert clear str "new content" then probe end give " content" So we have acted on the same string in memory. |
Kees 17-Jul-2013 [2059x2] | Yes I see that now |
Thank you both! | |
DideC 17-Jul-2013 [2061] | You may read the series page http://www.rebol.com/docs/core23/rebolcore-6.html |
Kees 17-Jul-2013 [2062] | Thanks DideC, I will |
Pekr 17-Jul-2013 [2063] | Yes, that chapter is kind of ... essential imo :-) |
Geomol 17-Jul-2013 [2064] | If the two words represent the same string (but different position), then this will return true: >> same? head str head end == true |
DideC 17-Jul-2013 [2065] | The key with series programming in Rebol is always "Is this the same serie or a new one ?" Sometimes you want to act on the same. sometimes you want to act on another. FUNDAMENTAL |
Ladislav 17-Jul-2013 [2066x4] | #[[DIdeC str: "abcdef" ==> Create a string! in memory, put "abcdef" as its content, create a word! 'str an make it point to its head. ]] - that is not true, in fact. The proper description is as follows: str: "abcdef" is a Rebol source (or a part of it). That source is first processed by LOAD. LOAD creates the Rebol value representing "abcdef". Also, LOAD does *not* set the 'str value (yet). Later on, when the DO function evaluates the (already LOAD-ed code), it just makes the 'str variable to refer to the string value not creating anything at all (this difference is crucial). |
Dide, you should make sure you understand this difference. | |
There is even a possibility to write: end: #[string! "abcdef" 4] | |
I can give you a similar description as above even for this case, if you like. | |
DideC 17-Jul-2013 [2070] | Yes you are right. |
Endo 18-Jul-2013 [2071] | Ladislav: "this difference is crucial" Could you please explain why this difference is important? Or better why it is important to understand? I understand there is a big difference, but why it is important to know? |
Ladislav 18-Jul-2013 [2072] | Endo, you may know this case: my-code: [s: "" append s #"x"] do my-code do my-code ; == "xx" my explanation is accurate for this case as well. You can see that the string (the "" value following the s: set-word) was created by LOAD only once, while append occurred twice expanding the string to contain "xx". |
Endo 18-Jul-2013 [2073] | created by *LOAD* only once , Ok I got it now. Thanks for the explanation. |
Janko 18-Jul-2013 [2074x2] | I have a question about timezones. I need to make a selector for workonomic where user can set the TimeZone Like "Europe/Ljubljana" instead of TZ offset which changes between summer/winter time depending on the timezone etc.. |
I assume rebol doesn't have "Labeled Timezon => current offset" capability so I am wondering if anybody had to do this and what (s)he found the best solution was? I see two ways, using external service in a lang that has such database/library (like php's ) or using the OS below (from bash) "TZ=":Pacific/Auckland" ; date +%z" ... also is there anything still I can do inside rebol, like getting some prefilled sqlite db using some lib I don't know of.. | |
Gregg 18-Jul-2013 [2076] | QTask may have solved this, and the source should be available somewhere. It might have been Bolek that worked on it, but I can't remember. |
Gabriele 20-Jul-2013 [2077] | Yes, it's in Qtask source. I used a script to translate the TZ database to REBOL, then made a REBOL function to convert between timezones. Note, if you are using MySQL, you can have it handle timezone conversions too. |
Janko 20-Jul-2013 [2078] | Thanks Gabriele, I found by googling that mysql can have timezone database installed and has the functions to handle it then. http://stackoverflow.com/questions/805538/in-mysql-caculating-offset-for-a-time-zone (the second answer, with a link of how to install if anyone else will be looking) |
Reichart 21-Jul-2013 [2079] | :) |
Gerard 27-Jul-2013 [2080] | I always found I was missing some foundation about this Rebol's behaviour. I have to note it elsewhere in my own documentation system as to be able to report it someday when I'll be publishing some formal learning material about Rebol, Red and other Rebol-inspired languages. Thanks. |
Kaj 28-Jul-2013 [2081x7] | >> import %./cURL-binding.so ** access error: cannot open: %./cURL-binding.so reason: "not found or not valid" |
Sujoy, I've also had problems loading my cURL extension library | |
It seems to depend on the R3 version and the Linux system | |
Have you tried the latest community R3 build? If that doesn't work, perhaps Carl's last release? | |
These problems seem quite random, so I don't feel like doing more work on R3 extensions in C. I'm having similar problems with Red extensions for different R3 versions, but at least it solves most of the dependency problems with different Linuxes | |
If all else fails, you need to compile the cURL extension on your system from the C source code | |
You have a better chance of me seeing such a question if you pose it in !R3 Extensions | |
caelum 2-Aug-2013 [2088] | When R3 was open sourced, I presume the SDK was not also open sourced? I am looking for the 'C' source code for the RSA, AES and Blowfish encryption functions. |
PeterWood 2-Aug-2013 [2089] | The SDK is only for REBOL2, which was not open sourced. |
Arnold 2-Aug-2013 [2090:last] | To find source codes, you will need to search with google or so. "blowfish source code c" first result looks promising http://www.schneier.com/blowfish-download.html |
older | first |