[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Case sensitivity in glob revisited

Trans

7/30/2007 7:09:00 PM

Dir.glob( pattern, [flags] ) => array
Dir.glob( pattern, [flags] ) {| filename | block } => nil
------------------------------------------------------------------------
Returns the filenames found by expanding _pattern_ which is an
+Array+ of the patterns or the pattern +String+, either as an
_array_ or as parameters to the block. Note that this pattern is
not a regexp (it's closer to a shell glob). See +File::fnmatch+
for
the meaning of the _flags_ parameter. Note that case sensitivity
depends on your system (so +File::FNM_CASEFOLD+ is ignored)

"case sensitivity depends on your system"

Ruby's cross-platform, so Ruby should trump the system. Of course if
the system is case insensitive, to won't matter wither way. But
otherwise without this, to get case insensitivity we have to do:

Dir.glob("[Ss][Oo][Mm][Ee][Th][Ii][Nn][Gg][Ss][Tt][Uu][Pp][Ii][Dd]")

T.


15 Answers

Robert Dober

7/30/2007 7:26:00 PM

0

On 7/30/07, Trans <transfire@gmail.com> wrote:
> Dir.glob( pattern, [flags] ) => array
> Dir.glob( pattern, [flags] ) {| filename | block } => nil
> ------------------------------------------------------------------------
> Returns the filenames found by expanding _pattern_ which is an
> +Array+ of the patterns or the pattern +String+, either as an
> _array_ or as parameters to the block. Note that this pattern is
> not a regexp (it's closer to a shell glob). See +File::fnmatch+
> for
> the meaning of the _flags_ parameter. Note that case sensitivity
> depends on your system (so +File::FNM_CASEFOLD+ is ignored)
>
> "case sensitivity depends on your system"
>
> Ruby's cross-platform, so Ruby should trump the system. Of course if
> the system is case insensitive, to won't matter wither way. But
> otherwise without this, to get case insensitivity we have to do:
>
> Dir.glob("[Ss][Oo][Mm][Ee][Th][Ii][Nn][Gg][Ss][Tt][Uu][Pp][Ii][Dd]")
>
Tom what would you expect it to do in the following case:

touch SomeThingStupid
touch somethingstupid
touch SOMETHINGSTUPID # no, I am not shouting, sorry ;)

I am afraid Ruby can not overcome some limitations of the cruel,
physical world :(.

Cheers
Robert

--
[...] as simple as possible, but no simpler.
-- Attributed to Albert Einstein

Nobuyoshi Nakada

7/30/2007 7:34:00 PM

0

Hi,

At Tue, 31 Jul 2007 04:08:49 +0900,
Trans wrote in [ruby-talk:262505]:
> not a regexp (it's closer to a shell glob). See +File::fnmatch+ for
> the meaning of the _flags_ parameter. Note that case sensitivity
> depends on your system (so +File::FNM_CASEFOLD+ is ignored)

> Ruby's cross-platform, so Ruby should trump the system. Of course if
> the system is case insensitive, to won't matter wither way. But
> otherwise without this, to get case insensitivity we have to do:
>
Dir.glob("somehingstupid", File::FNM_CASEFOLD)

--
Nobu Nakada

Trans

7/30/2007 8:01:00 PM

0



On Jul 30, 12:34 pm, Nobuyoshi Nakada <n...@ruby-lang.org> wrote:
> Hi,
>
> At Tue, 31 Jul 2007 04:08:49 +0900,
> Trans wrote in [ruby-talk:262505]:
>
> > not a regexp (it's closer to a shell glob). See +File::fnmatch+ for
> > the meaning of the _flags_ parameter. Note that case sensitivity
> > depends on your system (so +File::FNM_CASEFOLD+ is ignored)
> > Ruby's cross-platform, so Ruby should trump the system. Of course if
> > the system is case insensitive, to won't matter wither way. But
> > otherwise without this, to get case insensitivity we have to do:
>
> Dir.glob("somehingstupid", File::FNM_CASEFOLD)

Yea it works now! |-) So the docs just need to catch up to reality.
Okay.

Sorry for the noise,
T.


Trans

7/30/2007 8:04:00 PM

0



On Jul 30, 12:25 pm, "Robert Dober" <robert.do...@gmail.com> wrote:
> On 7/30/07, Trans <transf...@gmail.com> wrote:
>
> > Dir.glob( pattern, [flags] ) => array
> > Dir.glob( pattern, [flags] ) {| filename | block } => nil
> > ------------------------------------------------------------------------
> > Returns the filenames found by expanding _pattern_ which is an
> > +Array+ of the patterns or the pattern +String+, either as an
> > _array_ or as parameters to the block. Note that this pattern is
> > not a regexp (it's closer to a shell glob). See +File::fnmatch+
> > for
> > the meaning of the _flags_ parameter. Note that case sensitivity
> > depends on your system (so +File::FNM_CASEFOLD+ is ignored)
>
> > "case sensitivity depends on your system"
>
> > Ruby's cross-platform, so Ruby should trump the system. Of course if
> > the system is case insensitive, to won't matter wither way. But
> > otherwise without this, to get case insensitivity we have to do:
>
> > Dir.glob("[Ss][Oo][Mm][Ee][Th][Ii][Nn][Gg][Ss][Tt][Uu][Pp][Ii][Dd]")
>
> Tom what would you expect it to do in the following case:
>
> touch SomeThingStupid
> touch somethingstupid
> touch SOMETHINGSTUPID # no, I am not shouting, sorry ;)
>
> I am afraid Ruby can not overcome some limitations of the cruel,
> physical world :(.

Oh, I just meant for Dir#glob. Where the docs said "(so
+File::FNM_CASEFOLD+ is ignored)" -- I didn't want it to be ignored.

T.


Robert Dober

7/30/2007 9:44:00 PM

0

On 7/30/07, Trans <transfire@gmail.com> wrote:
>
>
> On Jul 30, 12:25 pm, "Robert Dober" <robert.do...@gmail.com> wrote:
> > On 7/30/07, Trans <transf...@gmail.com> wrote:
> >
> > > Dir.glob( pattern, [flags] ) => array
> > > Dir.glob( pattern, [flags] ) {| filename | block } => nil
> > > ------------------------------------------------------------------------
> > > Returns the filenames found by expanding _pattern_ which is an
> > > +Array+ of the patterns or the pattern +String+, either as an
> > > _array_ or as parameters to the block. Note that this pattern is
> > > not a regexp (it's closer to a shell glob). See +File::fnmatch+
> > > for
> > > the meaning of the _flags_ parameter. Note that case sensitivity
> > > depends on your system (so +File::FNM_CASEFOLD+ is ignored)
> >
> > > "case sensitivity depends on your system"
> >
> > > Ruby's cross-platform, so Ruby should trump the system. Of course if
> > > the system is case insensitive, to won't matter wither way. But
> > > otherwise without this, to get case insensitivity we have to do:
> >
> > > Dir.glob("[Ss][Oo][Mm][Ee][Th][Ii][Nn][Gg][Ss][Tt][Uu][Pp][Ii][Dd]")
> >
> > Tom what would you expect it to do in the following case:
> >
> > touch SomeThingStupid
> > touch somethingstupid
> > touch SOMETHINGSTUPID # no, I am not shouting, sorry ;)
> >
> > I am afraid Ruby can not overcome some limitations of the cruel,
> > physical world :(.
>
> Oh, I just meant for Dir#glob. Where the docs said "(so
> +File::FNM_CASEFOLD+ is ignored)" -- I didn't want it to be ignored.
so you would just get three entries with the same name, right?
Sorry I failed to understand that this was what you wanted <blush>.

Cheers
Robert

--
[...] as simple as possible, but no simpler.
-- Attributed to Albert Einstein

Anim8rFSK

9/6/2012 10:14:00 PM

0

In article
<1942707565368657444.918625atropos-mac.com@news.giganews.com>,
BTR1701 <atropos@mac.com> wrote:

> cloud dreamer <reduce@reuse.com> wrote:
> > On 06/09/2012 3:45 PM, Mason Barge wrote:
> >> On Wed, 05 Sep 2012 19:18:11 -0700, anim8rFSK <anim8rfsk@cox.net> wrote:
> >>
> >>> In article
> >>> <26a41fb2-fe83-49c5-a846-a3c537814b0d@o19g2000vbo.googlegroups.com>,
> >>> Ed Stasiak <estasiak@att.net> wrote:
> >>>
> >>>>> Obveeus
> >>>>>> Ed Stasiak
> >>>>>>
> >>>>>> A spark from the metal plane impacting a concrete
> >>>>>> road would do it.
> >>>>>
> >>>>> Aren't sparks electrical in nature?
> >>>>
> >>>> No, they're tiny bits of glowing hot metal that was chipped
> >>>> off by the impact.
> >>>>
> >>>> Take a wood file and whip it down the (concrete) street
> >>>> and it'll make a shower of sparks as it slides along.
> >>>
> >>> But that's artificial sparkage.
> >>
> >> Maybe nerve impulses from scattered brain tissue set it off.
> >>
> >
> >
> >
> > Holy cow. Artificial sparkage???
> >
> > Okay, okay. Obviously, Animalfucker was home schooled. That's the only
> > explanation for such utter stupidity.
>
> He was making fun of you, dumbshit, and your previous idiotic assertion
> that this EMP somehow singles out artificial electricity from 'real'
> electricity like lightning-- as if there's any qualitative difference
> between the two.

Seriously, how did Clodreamer go from being amusingly ignorant to
aggressively stupid?

--
"Every time a Kardashian gets a TV show, an angel dies."

Mason Barge

9/6/2012 10:51:00 PM

0

On Thu, 06 Sep 2012 15:14:21 -0700, anim8rFSK <anim8rfsk@cox.net> wrote:

>In article
><1942707565368657444.918625atropos-mac.com@news.giganews.com>,
> BTR1701 <atropos@mac.com> wrote:
>
>> cloud dreamer <reduce@reuse.com> wrote:
>> > On 06/09/2012 3:45 PM, Mason Barge wrote:
>> >> On Wed, 05 Sep 2012 19:18:11 -0700, anim8rFSK <anim8rfsk@cox.net> wrote:
>> >>
>> >>> In article
>> >>> <26a41fb2-fe83-49c5-a846-a3c537814b0d@o19g2000vbo.googlegroups.com>,
>> >>> Ed Stasiak <estasiak@att.net> wrote:
>> >>>
>> >>>>> Obveeus
>> >>>>>> Ed Stasiak
>> >>>>>>
>> >>>>>> A spark from the metal plane impacting a concrete
>> >>>>>> road would do it.
>> >>>>>
>> >>>>> Aren't sparks electrical in nature?
>> >>>>
>> >>>> No, they're tiny bits of glowing hot metal that was chipped
>> >>>> off by the impact.
>> >>>>
>> >>>> Take a wood file and whip it down the (concrete) street
>> >>>> and it'll make a shower of sparks as it slides along.
>> >>>
>> >>> But that's artificial sparkage.
>> >>
>> >> Maybe nerve impulses from scattered brain tissue set it off.
>> >>
>> >
>> >
>> >
>> > Holy cow. Artificial sparkage???
>> >
>> > Okay, okay. Obviously, Animalfucker was home schooled. That's the only
>> > explanation for such utter stupidity.
>>
>> He was making fun of you, dumbshit, and your previous idiotic assertion
>> that this EMP somehow singles out artificial electricity from 'real'
>> electricity like lightning-- as if there's any qualitative difference
>> between the two.
>
>Seriously, how did Clodreamer go from being amusingly ignorant to
>aggressively stupid?

Yeah, well, I was the stupid one about the sparks. I thought they were
electric but they aren't (unless we get down to the level that atoms
depend on electricity to function).

In fact, how sparks are made is actually pretty interesting. Iron
automatically ignites and burns when exposed to air!

The only reason you can have exposed iron is that the surface immediately
gets a molecule-thick layer of something on it -- rust, if there's no
contaminant. But when you shred off itty-bitty pieces so that the surface
area to volume gets large enough, it self-ignites.

Too bad, it made for a funny snark.

Anim8rFSK

9/7/2012 12:22:00 AM

0

In article <fq9i48lllttejo72ocilvjssl8a0j04m05@4ax.com>,
Mason Barge <masonbarge@gmail.com> wrote:

> On Thu, 06 Sep 2012 15:14:21 -0700, anim8rFSK <anim8rfsk@cox.net> wrote:
>
> >In article
> ><1942707565368657444.918625atropos-mac.com@news.giganews.com>,
> > BTR1701 <atropos@mac.com> wrote:
> >
> >> cloud dreamer <reduce@reuse.com> wrote:
> >> > On 06/09/2012 3:45 PM, Mason Barge wrote:
> >> >> On Wed, 05 Sep 2012 19:18:11 -0700, anim8rFSK <anim8rfsk@cox.net> wrote:
> >> >>
> >> >>> In article
> >> >>> <26a41fb2-fe83-49c5-a846-a3c537814b0d@o19g2000vbo.googlegroups.com>,
> >> >>> Ed Stasiak <estasiak@att.net> wrote:
> >> >>>
> >> >>>>> Obveeus
> >> >>>>>> Ed Stasiak
> >> >>>>>>
> >> >>>>>> A spark from the metal plane impacting a concrete
> >> >>>>>> road would do it.
> >> >>>>>
> >> >>>>> Aren't sparks electrical in nature?
> >> >>>>
> >> >>>> No, they're tiny bits of glowing hot metal that was chipped
> >> >>>> off by the impact.
> >> >>>>
> >> >>>> Take a wood file and whip it down the (concrete) street
> >> >>>> and it'll make a shower of sparks as it slides along.
> >> >>>
> >> >>> But that's artificial sparkage.
> >> >>
> >> >> Maybe nerve impulses from scattered brain tissue set it off.
> >> >>
> >> >
> >> >
> >> >
> >> > Holy cow. Artificial sparkage???
> >> >
> >> > Okay, okay. Obviously, Animalfucker was home schooled. That's the only
> >> > explanation for such utter stupidity.
> >>
> >> He was making fun of you, dumbshit, and your previous idiotic assertion
> >> that this EMP somehow singles out artificial electricity from 'real'
> >> electricity like lightning-- as if there's any qualitative difference
> >> between the two.
> >
> >Seriously, how did Clodreamer go from being amusingly ignorant to
> >aggressively stupid?
>
> Yeah, well, I was the stupid one about the sparks. I thought they were
> electric but they aren't (unless we get down to the level that atoms
> depend on electricity to function).
>
> In fact, how sparks are made is actually pretty interesting. Iron
> automatically ignites and burns when exposed to air!
>
> The only reason you can have exposed iron is that the surface immediately
> gets a molecule-thick layer of something on it -- rust, if there's no
> contaminant. But when you shred off itty-bitty pieces so that the surface
> area to volume gets large enough, it self-ignites.

Cool
>
> Too bad, it made for a funny snark.

Somewhere along the line we've missed the part where Clodreamer is
completely wrong, and neither natural nor artificial sparkage is going
to set off a jetliner on impact.

--
"Every time a Kardashian gets a TV show, an angel dies."

Mason Barge

9/7/2012 5:07:00 PM

0

On Thu, 06 Sep 2012 17:22:07 -0700, anim8rFSK <anim8rfsk@cox.net> wrote:

>In article <fq9i48lllttejo72ocilvjssl8a0j04m05@4ax.com>,
> Mason Barge <masonbarge@gmail.com> wrote:
>
>> On Thu, 06 Sep 2012 15:14:21 -0700, anim8rFSK <anim8rfsk@cox.net> wrote:
>>
>> >In article
>> ><1942707565368657444.918625atropos-mac.com@news.giganews.com>,
>> > BTR1701 <atropos@mac.com> wrote:
>> >
>> >> cloud dreamer <reduce@reuse.com> wrote:
>> >> > On 06/09/2012 3:45 PM, Mason Barge wrote:
>> >> >> On Wed, 05 Sep 2012 19:18:11 -0700, anim8rFSK <anim8rfsk@cox.net> wrote:
>> >> >>
>> >> >>> In article
>> >> >>> <26a41fb2-fe83-49c5-a846-a3c537814b0d@o19g2000vbo.googlegroups.com>,
>> >> >>> Ed Stasiak <estasiak@att.net> wrote:
>> >> >>>
>> >> >>>>> Obveeus
>> >> >>>>>> Ed Stasiak
>> >> >>>>>>
>> >> >>>>>> A spark from the metal plane impacting a concrete
>> >> >>>>>> road would do it.
>> >> >>>>>
>> >> >>>>> Aren't sparks electrical in nature?
>> >> >>>>
>> >> >>>> No, they're tiny bits of glowing hot metal that was chipped
>> >> >>>> off by the impact.
>> >> >>>>
>> >> >>>> Take a wood file and whip it down the (concrete) street
>> >> >>>> and it'll make a shower of sparks as it slides along.
>> >> >>>
>> >> >>> But that's artificial sparkage.
>> >> >>
>> >> >> Maybe nerve impulses from scattered brain tissue set it off.
>> >> >>
>> >> >
>> >> >
>> >> >
>> >> > Holy cow. Artificial sparkage???
>> >> >
>> >> > Okay, okay. Obviously, Animalfucker was home schooled. That's the only
>> >> > explanation for such utter stupidity.
>> >>
>> >> He was making fun of you, dumbshit, and your previous idiotic assertion
>> >> that this EMP somehow singles out artificial electricity from 'real'
>> >> electricity like lightning-- as if there's any qualitative difference
>> >> between the two.
>> >
>> >Seriously, how did Clodreamer go from being amusingly ignorant to
>> >aggressively stupid?
>>
>> Yeah, well, I was the stupid one about the sparks. I thought they were
>> electric but they aren't (unless we get down to the level that atoms
>> depend on electricity to function).
>>
>> In fact, how sparks are made is actually pretty interesting. Iron
>> automatically ignites and burns when exposed to air!
>>
>> The only reason you can have exposed iron is that the surface immediately
>> gets a molecule-thick layer of something on it -- rust, if there's no
>> contaminant. But when you shred off itty-bitty pieces so that the surface
>> area to volume gets large enough, it self-ignites.
>
>Cool
>>
>> Too bad, it made for a funny snark.
>
>Somewhere along the line we've missed the part where Clodreamer is
>completely wrong, and neither natural nor artificial sparkage is going
>to set off a jetliner on impact.

I actually don't have a problem with the idea that a vertical airliner
crash might eventually cause a massive explosion, possibly even in the
absence of inorganic electricy. My problem is a) the crash itself, and 2)
my general theory that the quality of any production is directly inverse
to the number of fireballs. Same thing for car chases. I think there
have only been two good (or less than horrible) car chases in the history
of cinema. At least, modern cinema.

But on the other hand, fireballs are a good in and of themselves. I
always yell "fireball" when I see one on tv and, unlike most of my jokes,
my wife actually thinks it's funny.

Thanatos

9/8/2012

0

In article <53ak4891g1dmsbii1774utntl36jfkrnk1@4ax.com>,
Mason Barge <masonbarge@gmail.com> wrote:

> I actually don't have a problem with the idea that a vertical airliner
> crash might eventually cause a massive explosion, possibly even in the
> absence of inorganic electricy. My problem is a) the crash itself, and 2)
> my general theory that the quality of any production is directly inverse
> to the number of fireballs. Same thing for car chases. I think there
> have only been two good (or less than horrible) car chases in the history
> of cinema. At least, modern cinema.

Bad Boys 2 had the best car chase ever. (Well, maybe second best. Blues
Brothers is a classic.) Nothing much else to recommend BB2 except
Gabrielle Union, but they sure pulled off a helluva chase sequence.