Checking hash key's and values, with case insensitivity

“Philipp Meier” meier@meisterbohne.de wrote in message
news:20020920191041.GF1528@o-matic.net

The way to deal with this is to create a hashtable that is indexed by
normalized keys i.e. all uppercase or all lowercase characters. Upon
lookup
you map the search key the same way. The actual hash lookup is still case
sensitive. You may then store the original key as a value and you may also
want to maintain two hashes - one with the original keys and one with the
normalized keys.

And do what if you have two keys in the original hash if they are equal
when ignoring the case?

I wasn’t thinking clearly that day. You should choose either case sensitive
or insensitive.

Mikkel

Hello Wai-Sun,

Wednesday, October 30, 2002, 10:27:54 AM, you wrote:

    "baz"=>["fee","fi","fo","fum"],

I want to be able to sort them in the order of the array size

What is the scalable way to do this? I’m looking at scaling these hashes
beyond 50K…

maximum size of this arrays (in real world)?

···


Best regards,
Bulat mailto:bulatz@integ.ru

Bulat Ziganshin wrote:

Hello Wai-Sun,

Wednesday, October 30, 2002, 10:27:54 AM, you wrote:

    "baz"=>["fee","fi","fo","fum"],

I want to be able to sort them in the order of the array size

What is the scalable way to do this? I’m looking at scaling these hashes
beyond 50K…

maximum size of this arrays (in real world)?

Anything between 100K to 200K

···


Wai-Sun “Squidster” Chia
Consulting & Integration
Linux/Unix/Web Developer Dude

Hello Wai-Sun,

Wednesday, October 30, 2002, 2:15:00 PM, you wrote:

    "baz"=>["fee","fi","fo","fum"],

I want to be able to sort them in the order of the array size

What is the scalable way to do this? I’m looking at scaling these hashes
beyond 50K…

maximum size of this arrays (in real world)?

Anything between 100K to 200K

50k hash entries each sized up to 200k? good :slight_smile:

hash.to_a.sort {|a,b| a[1].size <=> b[1].size}

···


Best regards,
Bulat mailto:bulatz@integ.ru

Hi,

···

In message “Re: Sorting HUGE hashes” on 02/10/30, “Bulat Ziganshin” bulatz@integ.ru writes:

hash.to_a.sort {|a,b| a[1].size <=> b[1].size}

Or

hash.sort_by{|a|a[1].size}

if you’re using 1.7.x.

						matz.

Hello Yukihiro,

Wednesday, October 30, 2002, 3:22:28 PM, you wrote:

Hi,

hash.to_a.sort {|a,b| a[1].size <=> b[1].size}

Or

hash.sort_by{|a|a[1].size}

btw, sort_by definition is only one line so he can decide on base of
speed/memory tradeoff instead of seeing at ruby version he can use

···

In message “Re: Sorting HUGE hashes” > on 02/10/30, “Bulat Ziganshin” bulatz@integ.ru writes:


Best regards,
Bulat mailto:bulatz@integ.ru