Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

filepath and slash problem

 [1/8] from: sabufrancis::rediffmail::com at: 15-Jul-2007 20:41

Hi Rebol gurus I would appreciate the answer to the following mystery. I wracked my brains for the last 5 hours .... and narrowed my problem down to this... I am trying to do what is otherwise a really simple thing.... which is to convert some slashes and dots in file paths into "-" (After spending 5 hours, I think I can get a work around for it, by extracting the components of the path, but having wasted so much time; I really want to know why this caused a problem: *Scenario 1* tempSeparator: "-" comlist: [1 'TestEdu/Test.txt 2 'TestEdu/Hello.text] forskip comlist 2 [ fnm: second comlist print [ "type: " type? fnm "First: " fnm/1 " Sec: " fnm/2] mfnm: copy to-string fnm print ["After conversion: " fnm] ;;;step aaa mfnm: replace/all mfnm "/" tempSeparator mfnm: replace/all mfnm "." tempSeparator print mfnm ] *The results of above are:*
>>type: path First: TestEdu Sec: Test.txt
After conversion: TestEdu/Test.txt TestEduTest-txt type: path First: TestEdu Sec: Hello.text After conversion: TestEdu/Hello.text TestEduHello-text /Notice that it gobbled up the slash/ on the other hand, if I directly give step aaa manually using a string then it works fine tempSeparator: "-" mfnm: "TestEdu/Test.txt" mfnm: replace/all mfnm "/" tempSeparator mfnm: replace/all mfnm "." tempSeparator print mfnm *The results of above is: *
What gives? Regards Sabu Francis

 [2/8] from: gregg::pointillistic::com at: 15-Jul-2007 13:40

Hi Sabu, TO-STRING removes the path separator.
>> to-string 'TestEdu/Test.txt
== "TestEduTest.txt" -- Gregg

 [3/8] from: gregg:pointillistic at: 15-Jul-2007 13:42

Hi Sabu, Addendum: FORM will do what you want, and you don't need to copy the result of either TO-STRING or FORM; they do it automatically. -- Gregg

 [4/8] from: santilli::gabriele::gmail::com at: 16-Jul-2007 8:31

2007/7/15, Sabu Francis <>:
> I would appreciate the answer to the following mystery. I wracked my > brains for the last 5 hours .... and narrowed my problem down to this...
[...] One small note, please remember that a PATH! value does not represent a filesystem path, it represents a REBOL path (eg. object/word and so on). You want to use FILE! values for filesystem paths. %path/to/something not 'path/to/something. HTH, Gabriele.

 [5/8] from: sabufrancis:rediffmail at: 17-Jul-2007 13:57

Hi Thank you all of you for clarifying this. I was not accessing my emails so I couldn't reply earlier. I wonder which is that central place where I can read all this. I get an impression that the real nuggets of Rebol knowledge are squirelled away in small nooks and corners. I wonder if we can take an initiative to put them all together at one place. I've started a Facebook group on Rebol. I don't want to start more such things lest it may scatter Rebol knowledge even more... I would rather join something that is already on. I tried the Alt-Me group but I got an impression that it is not easily searchable, and it is more of a one-to-one kind of thing. Moreover it looks like I've lost my password to it (when I changed computers) Even the rebolist tends to break once in a while.... and I feel a threaded discussion is not really suitable for cross-referenced information. If a wiki is not going on, I can start such an effort ... maybe at or some place like that. I think we need tags desperately so cross-referencing is possible... and also a central ontology so that everyone can tag using the same concepts. Regards Sabu Gabriele Santilli wrote:

 [6/8] from: pwawood::gmail::com at: 17-Jul-2007 18:18

Hi Sabu Currently the most complete central repository is which, mainly due to Sunanda, includes the script library, the mailing list archive, a handful of articles (more are always welcome) and now the complete archive of the AltME Rebol3 World web-public conversations. The library and mailing list are fully searchable and the mailing list has a full topic based index. The search of the AltME archive is currently being developed. Regards Peter On Tuesday, July 17, 2007, at 04:27 pm, Sabu Francis wrote:

 [7/8] from: chd:1staccess:ca at: 17-Jul-2007 8:02

Hi Sabu, Peter I agree, little pieces of code like this are worth 100 times their wait in gold. I would love to see them added to the core dictionary word definitions. I learned PHP a few years ago studying the example included with the PHP function index docs.(see below) It is the code samples that really made PHP accessible for me and I think REBOL would greatly benefit from this type of code library, included with the word definitions.(see below) On the Mac there is a small program that lists the PHP functions in a list and by clicking on any one, it displays the definitions with one or two pieces of good sample code on the right side of the window. Trivial, but very useful and powerful. Since I'm new to REBOL, something like this would go a long way to increase user access to the language. Mind you it would take a tremendous commitment from seasoned REBOL users to make this happen. Cheers Chris ------------------------------------------------------------------------ ------------------------------------------------------------------------ -------------------- dbase_create (PHP 3, PHP 4 , PHP 5) dbase_create -- Creates a dBase database Description int dbase_create ( string filename, array fields ) dbase_create() creates a dBase database in the file filename, with the fields fields. The fields parameter is an array of arrays, each array describing the format of one field in the database. Each field consists of a name, a character indicating the field type, a length, and a precision. The types of fields available are: L Boolean. These do not have a length or precision. M Memo. (Note that these aren't supported by PHP.) These do not have a length or precision. D Date (stored as YYYYMMDD). These do not have a length or precision. N Number. These have both a length and a precision (the number of digits after the decimal point). C String. Note: The fieldnames are limited in length and must not exceed 10 chars, 0 < chars <= 10. If the database is successfully created, a dbase_identifier is returned, otherwise FALSE is returned. Example 1. Creating a dBase database file <?php // "database" name $dbname = "/tmp/test.dbf"; // database "definition" $def array( array("date", "D"), array("name", "C", 50), array("age", "N", 3, 0), array("email", "C", 128), array("ismember", "L") ); // creation if (!dbase_create($dbname, $def)) echo "<strong>Error!</strong>"; ?>

 [8/8] from: gregg::pointillistic::com at: 17-Jul-2007 9:42

Chris, Allesandro, et al RT knows how important docs are, and that the ongoing framgmentation is a problem. Someday DocBase will appear, and be the "official" site for documentation. Until then, I think is the best candidate (thanks to Sunanda's ongoing efforts). RT hosts the official dictionary right now, which will probably also be part of DocBase, but that doesn't mean couldn't have a section where code snippets are uploaded, and tagged based on their context or what funcs they are an example for. -- Gregg