r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Core] Discuss core issues

Ladislav
25-Oct-2010
[126]
Yes, that is what I was afraid of. (this is problematic, if you are 
not allowed to create new files) OK, Robert and I have agreed, that 
we keep INCLUDE case-insensitive (for file comparisons), and put 
the information into the documentation.
Henrik
25-Oct-2010
[127x3]
Ladislav, how about reading the root directory, find a camel-cased 
file, lower/uppercase it and ask if the file exists?
of course depending if the file doesn't happen to exist.
(not totally reliable)
Ladislav
25-Oct-2010
[130x2]
again, this may not work if you are not allowed to read the root 
directory
nevermind, the solution we use for INCLUDE looks like sufficient, 
I will document how it works.
Henrik
25-Oct-2010
[132]
I guess also it's a problem for networked drives. The file sharing 
mechanism might offer incorrect information as to what the case sensitivity 
for the file system being shared, is.
Ladislav
25-Oct-2010
[133]
Right, it is a complicated matter, that is why it looks better to 
use an "acceptable" solution instead of trying to implement a "perfect" 
solution
Sunanda
25-Oct-2010
[134]
Could you try a variant on....
    all [exists? uppercase what-dir exists? lowercase what-dir]

....At least it does not require reads/writes outside of the current 
folder.
Ladislav
25-Oct-2010
[135]
That is possible, but, unfortunately, not perfect as well. (Does 
not solve the case when the file system is case-sensitive, but contains 
both upper as well as lower case variants)
Sunanda
25-Oct-2010
[136]
What I meant to write was:

all [exists what-dir? exists? uppercase what-dir exists? lowercase 
what-dir]

Plus then you need to check if info? is the same on all three.

I think that covers your case......But is not perfect either .... 
It fails If the what-dir path happens to contain no case sensitive 
characters.

It's tricky!
Ladislav
25-Oct-2010
[137]
Agreed
PeterWood
25-Oct-2010
[138]
Can't you infer whether the file system is case sensitive, case insensitive 
 or case insenstive but case preserving from system/version?
Henrik
25-Oct-2010
[139]
not if the includes are grabbed from a network resource, such as 
when running your R3 in a VM inside another OS and the source is 
stored in that other OS.
Maxim
25-Oct-2010
[140]
actually there is a way to know if the destination filesystem is 
case sensitive, but it requires a write operation.
PeterWood
25-Oct-2010
[141]
Thanks for the explanation, Henrik.
Maxim
25-Oct-2010
[142x2]
you write two files with different case, using different data.  then 
read the first one, and making sure it doesn't give you the value 
of the second.
hehe... just saw sundanda's original post... which basically a play 
on my above post... it was out of scroll on my view.
Izkata
25-Oct-2010
[144]
Ladislav: I was going to suggest something similar as Sunanda, except 
by using [sort read %.] instead of [what-dir], then checking the 
first file with alphanumeric characters.  That way, if both upper 
and lowercase do exist separately, they'd show up in the list and 
can be adjusted for
Sunanda
25-Oct-2010
[145]
Can you not assume, Ladislav, that you will have read access to user.r?
And use reads/info? for variants on that to check?
james_nak
25-Oct-2010
[146]
Graham, did you figure out the object issues? And are you using or 
have you tried the xml-object.r script?
Oldes
25-Oct-2010
[147x2]
Is this prefered result?:
>> sort [748x430 68x206 748x194 305x147]
== [305x147 748x194 68x206 748x430]
I take it back.. REBOL cannot have any idea what I want to do, so 
better to use compare function, like:
sort-pairs: func[block-of-pairs][
	sort/compare block-of-pairs func[a b][
		either a/x < b/x [
			1
		][
			either a/x = b/x [
				either a/y < b/y [
					1
				][
					either a/y > b/y [-1][0]
				]
			][ -1 ]
		]
	]
]

sort-pairs [748x430 68x206 748x194 305x147]
;== [748x430 748x194 305x147 68x206]
GrahamC
25-Oct-2010
[149]
What object issues?
james_nak
25-Oct-2010
[150]
XML to objects from SUnday
Steeve
25-Oct-2010
[151]
get-obj-value: func[o [object!] p [path! word!]][attempt[do append 
to-path 'o p]]

Not optimized for speed though...
GrahamC
25-Oct-2010
[152x2]
hmm... clever
So why am I walking the path?  lol
Steeve
25-Oct-2010
[154x2]
Oldes, exactly the use case to use case... 

case [
	a/x < b/x [-1]
	a/x > b/x [1]
	a/y < b/y [-1]
	a/y > b/y [1]
	'equal 0
]
(except I reversed some stuffs...)
Oldes
25-Oct-2010
[156]
yes, that's nice example where to use case:)
james_nak
25-Oct-2010
[157]
Steeve, that's sweet. "Case" doesn't show up in the dictionary and 
I had no clue we had such a thing. Very cool.
Steeve
25-Oct-2010
[158]
not in the dictionnary ? strange...
james_nak
25-Oct-2010
[159]
http://www.rebol.com/docs/dictionary.html
Henrik
25-Oct-2010
[160]
I use it a lot. CASE/ALL is also useful.
Sunanda
25-Oct-2010
[161]
CASE is in the R3 dictionary:
   http://www.rebol.com/r3/docs/functions.html
But you are right -- it should be in the R2 dictionary too.
Maxim
26-Oct-2010
[162]
anyone know how to submit args when using 


r2.exe --do "probe what-dir probe system/script/args" --args  "r3.exe"

the above prints none
Izkata
27-Oct-2010
[163]
The help says this:
    -- args          Provide args without a script

There's a space between the -- and the word args, so I tried this 
and it worked:

   rebol --do '? system/script/args q' -- 'arguments here'

The help should probably say something like:
   -- <args>
to make it more obvious
Maxim
27-Oct-2010
[164x2]
doh... ok, I get it.
thanks.
GrahamC
27-Oct-2010
[166]
Isn't this a rather erroneous message ?

>> now - 365
== 27-Oct-2009/23:03:45+13:00
>> now - 365.25
** Script Error: Cannot use subtract on date! value
** Near: now - 365.25
Anton
27-Oct-2010
[167]
Yes.. Better might be "Cannot subtract decimal! from date! value."
amacleod
27-Oct-2010
[168]
email? [name-:-domain-:-com]
== true
>> email? [name-:-domain]..com
== true
>> email? [name-:-domain]...com
== true

Is this a bug?
Henrik
27-Oct-2010
[169]
The email parser is not very good.
Rebolek
27-Oct-2010
[170]
You can convert anything to email.
amacleod
27-Oct-2010
[171]
I was going crazy trying to send to a long list getting errors...finally 
found the faulty address...how do you validate email then?
Rebolek
27-Oct-2010
[172]
You should write your own parse rule, it should be failry simple. 
Probably there's already something on http://www.rebol.org
Pekr
27-Oct-2010
[173]
Amacleod - there was a discussion on ML or elsewhere, about how useless 
email dtype is, if it can't work as email RFC suggests. I was told, 
that I should not mistake datatype, with complicated parser for possible 
correct emails. I still insist - the datatype is useless that way. 
I found some grammar, I even posted it back at that time, but I think 
that someone at RT was simply too lazy to implement it :-)
Henrik
27-Oct-2010
[174]
the email datatype is not useful for different reasons: it can't 
be serialized properly.
GrahamC
27-Oct-2010
[175]
either write your own parser ... or use my smtp challenge :)