Am definitely on the steep part of the ruby learning curve. I've programmed a bit in several other languages. Now I need something like a random disk file, so I can have a large hash or something like it available for random access. I've looked in Programming Ruby II, and the Ruby Cookbook. No info there. I then tried to search the arhives at http://blade.nagaokaut.ac.jp/ruby/ruby-talk/index.shtml - the search tool seems not to be working. I then tried to find something with Google. No go.
I must be thinking about this wrongly, somehow.
So...how does one handle indexed (random) access to a large file - one too large to have in memory? I can't believe that random/like disk I/O is not possible in ruby.
Thanks in advance...
t.
···
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tom Cloyd, MS MA, LMHC
Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< tc@tomcloyd.com >> (email)
<< TomCloyd.com >> (website & psychotherapy weblog) << sleightmind.wordpress.com >> (mental health issues weblog)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It works just like in C....
$ echo thisisatest > test.fil
$ irb
>> f = File.open('test.fil')
=> #<File:test.fil>
>> f.seek(3, IO::SEEK_SET)
=> 0
>> f.read 3
=> "sis"
/dh
···
On 4 Jan 2008, at 12:14, Tom Cloyd wrote:
Am definitely on the steep part of the ruby learning curve. I've programmed a bit in several other languages. Now I need something like a random disk file, so I can have a large hash or something like it available for random access. I've looked in Programming Ruby II, and the Ruby Cookbook. No info there. I then tried to search the arhives at http://blade.nagaokaut.ac.jp/ruby/ruby-talk/index.shtml - the search tool seems not to be working. I then tried to find something with Google. No go.
I must be thinking about this wrongly, somehow.
So...how does one handle indexed (random) access to a large file - one too large to have in memory? I can't believe that random/like disk I/O is not possible in ruby.
Thanks in advance...
t.
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tom Cloyd, MS MA, LMHC
Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< tc@tomcloyd.com >> (email)
<< TomCloyd.com >> (website & psychotherapy weblog) << sleightmind.wordpress.com >> (mental health issues weblog)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Oh, man, I really DID miss something. What great news. You've made my day, even though it hasn't really started yet.
Tks,
Tom C.
Denis Hennessy wrote:
···
It works just like in C....
$ echo thisisatest > test.fil
$ irb
>> f = File.open('test.fil')
=> #<File:test.fil>
>> f.seek(3, IO::SEEK_SET)
=> 0
>> f.read 3
=> "sis"
/dh
On 4 Jan 2008, at 12:14, Tom Cloyd wrote:
Am definitely on the steep part of the ruby learning curve. I've programmed a bit in several other languages. Now I need something like a random disk file, so I can have a large hash or something like it available for random access. I've looked in Programming Ruby II, and the Ruby Cookbook. No info there. I then tried to search the arhives at http://blade.nagaokaut.ac.jp/ruby/ruby-talk/index.shtml - the search tool seems not to be working. I then tried to find something with Google. No go.
I must be thinking about this wrongly, somehow.
So...how does one handle indexed (random) access to a large file - one too large to have in memory? I can't believe that random/like disk I/O is not possible in ruby.
Thanks in advance...
t.
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tom Cloyd, MS MA, LMHC
Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< tc@tomcloyd.com >> (email)
<< TomCloyd.com >> (website & psychotherapy weblog) << sleightmind.wordpress.com >> (mental health issues weblog)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tom Cloyd, MS MA, LMHC
Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< tc@tomcloyd.com >> (email)
<< TomCloyd.com >> (website & psychotherapy weblog) << sleightmind.wordpress.com >> (mental health issues weblog)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~