[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

array of arrays

Divya Badrinath

7/20/2007 4:38:00 PM

i have a database with some 10 records each containing 2 columns,
sno,name,city.

I want to push this into an array of arrays.
i see that Ruy doesnt support multi-dimensional arrays.
Any ideas of how to do it?

--
Posted via http://www.ruby-....

32 Answers

dblack

7/20/2007 4:42:00 PM

0

Divya Badrinath

7/20/2007 8:26:00 PM

0

unknown wrote:
> Hi --
>
> On Sat, 21 Jul 2007, Divya Badrinath wrote:
>
>> i have a database with some 10 records each containing 2 columns,
>> sno,name,city.
>>
>> I want to push this into an array of arrays.
>> i see that Ruy doesnt support multi-dimensional arrays.
>> Any ideas of how to do it?
>
> Just use arrays as array elements:
>
> [ [1,2,3], [4,5,6], [7,8,9] ]
>
> for example.
>
>
> David

Thank you.

I will try it.


--
Posted via http://www.ruby-....

Divya Badrinath

7/25/2007 9:44:00 PM

0

I didnt get it.
I am new to Ruby.

i want it to be like this.
row = { " "a","b","c" ",
" "d","e","f" ",
" "g","h","i" "}
sow that
row[0] gives "a","b","c"
and row[1] gives "d","e","f"

say if
col is an array and
col = "a","b","c"

can i do
row.push(col)
?
--
Posted via http://www.ruby-....

Stephen Ball

7/25/2007 9:54:00 PM

0

Try this,

irb(main):001:0> row = [["a","b","c"],["d","e","f"],["g","h","i"]]
=> [["a", "b", "c"], ["d", "e", "f"], ["g", "h", "i"]]
irb(main):002:0> row[0]
=> ["a", "b", "c"]
irb(main):003:0> row[1]
=> ["d", "e", "f"]

For your push operation you can use <<, as in:

irb(main):004:0> addition = ["j","k","l"]
=> ["j", "k", "l"]
irb(main):005:0> row << addition
=> [["a", "b", "c"], ["d", "e", "f"], ["g", "h", "i"], ["j", "k", "l"]]

On 7/25/07, Divya Badrinath <dbadrinath@dash.net> wrote:
> I didnt get it.
> I am new to Ruby.
>
> i want it to be like this.
> row = { " "a","b","c" ",
> " "d","e","f" ",
> " "g","h","i" "}
> sow that
> row[0] gives "a","b","c"
> and row[1] gives "d","e","f"
>
> say if
> col is an array and
> col = "a","b","c"
>
> can i do
> row.push(col)
> ?
> --
> Posted via http://www.ruby-....
>
>

Mason Barge

9/5/2012 7:37:00 PM

0

On Wed, 5 Sep 2012 13:22:52 -0400, "Obveeus" <Obveeus@aol.com> wrote:

>
>"Mason Barge" <masonbarge@gmail.com> wrote:
>
>> I'm a lot more patient with Java (which is about 100% better anyway as a
>> platform), which has also been having problems. I imagine that they are
>> going to find a better fix than Microsoft has done for Silverlight.
>
>One nice thing about Silverlight, as opposed to Java or Adobe Flash is that
>it isn't trying to update itself on a near weekly basis.

It updates automatically in the background. The difference is, because
Silverlight belongs to Windows, it does so by default. Whereas, you have
to play with stuff for Java to update automatically.

Adobe, I don't know. My computer is so crammed with Adobe software that I
want to see the upgrades.

Anim8rFSK

9/5/2012 7:38:00 PM

0

In article <k288pg$cu2$1@dont-email.me>,
Arthur Lipscomb <arthur@alum.calberkeley.org> wrote:

> On 9/5/2012 10:41 AM, anim8rFSK wrote:
> > In article <ke1f48lt8iekvbeo1555abelqlk36dmunc@4ax.com>,
> > Mason Barge <masonbarge@gmail.com> wrote:
> >
> >> On Wed, 05 Sep 2012 08:55:29 -0700, Arthur Lipscomb
> >> <arthur@alum.calberkeley.org> wrote:
> >>
> >>> On 9/5/2012 8:24 AM, Mason Barge wrote:
> >>>> On Wed, 5 Sep 2012 07:37:28 -0400, "Obveeus" <Obveeus@aol.com> wrote:
> >>>>
> >>>>>
> >>>>> "David Barnett" <dbar3518@bigpond.net.au> wrote:
> >>>>>
> >>>>>> masonbarge@gmail.com says...
> >>>>>>>
> >>>>>>> Unfortunately, Microsoft Silverlight will not install on my Windows 7
> >>>>>>> machine. This has to be the most screwed up streaming platform
> >>>>>>> available.
> >>>>>>> It's just given me all kinds of fits. I already have a gazillion
> >>>>>>> Silverlight files and I can't uninstall it without watching a video on
> >>>>>>> how
> >>>>>>> to go about it.
> >>>>>>
> >>>>>> It appears to be installed on my computer (Windows 7), but
> >>>>>> I don't know how to use it!
> >>>>>
> >>>>> Silverlight is just a driver for video streaming. Like Java or Adobe
> >>>>> Flashplayer, it should startup and run automatically as needed.
> >>>>
> >>>> Yes, It should.
> >>>>
> >>>
> >>>
> >>> Is it up to date? Try running Microsoft update. I'm one of those
> >>> people who *actively* keeps his computer up to date. But I've seen
> >>> computers that haven't been updated since the first day they were turned
> >>> on...
> >>>
> >>> This was a Netflix problem right? You may also try using a different
> >>> web browser, IE instead of Firefox or Chrome. Netflix has had some
> >>> known problems with their website. They finally put a notice up a few
> >>> days ago that they were aware of the problem. I don't use their
> >>> streaming service but whatever was messing with their rental site may
> >>> have also affected their streaming site.
> >>
> >> Thanks for trying to help, but Netflix uses the same streaming technology
> >> for all browsers, Microsoft Silverlight. (Maybe Mac users signing in on
> >> Safari get something different, I don't know.) It's a plugin that has to
> >> be installed on your computer.
> >
> > No, we're stuck with Silverlight too.
> >>
> >> I know what the problem is, I know how to fix it, I even know some of why
> >> it exists. I'm just putting my foot down.
> >>
> >> The same reason I used to use Firefox exclusively, back when IE ignored
> >> web standards and tried to force Windows users to use it. The same reason
> >> I won't have an iPad, because they just decided "we won't support Flash".
> >
> > Reason enough to get an iPad. :)
>
> I remember thinking an iPad was one of the dumbest ideas ever. Who
> needs an extra large iPhone. Then I got an iPad...Honestly, in all the
> time I've had it, there's only been one maybe two occasions there I
> couldn't access something because of flash.

I thought it was dumb too. And then a friend loaned me hers so I'd have
something to do while I was with Mom in the hospital, and when I gave it
back I was jonesing so bad I had to have my own (and the iPad3 came out
that week) and now I carry the silly thing everywhere. :)

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

Obveeus

9/5/2012 7:47:00 PM

0


"Mason Barge" <masonbarge@gmail.com> wrote:
> On Wed, 5 Sep 2012 13:22:52 -0400, "Obveeus" <Obveeus@aol.com> wrote:
>
>>"Mason Barge" <masonbarge@gmail.com> wrote:
>>
>>> I'm a lot more patient with Java (which is about 100% better anyway as a
>>> platform), which has also been having problems. I imagine that they are
>>> going to find a better fix than Microsoft has done for Silverlight.
>>
>>One nice thing about Silverlight, as opposed to Java or Adobe Flash is
>>that
>>it isn't trying to update itself on a near weekly basis.
>
> It updates automatically in the background. The difference is, because
> Silverlight belongs to Windows, it does so by default. Whereas, you have
> to play with stuff for Java to update automatically.

Windows prompts for updates as well, but seemingly less often than Java or
Adobe Flashplayer. Maybe Windows is doing other updates that are not
prompted...that I do not know. I do know that most of what Windows says it
is updating seem to be system components that I do not use.



David Barnett

9/5/2012 9:44:00 PM

0

In article <k27dhp$l4a$1@dont-email.me>, Obveeus@aol.com
says...
>
> "David Barnett" <dbar3518@bigpond.net.au> wrote:
>
> > masonbarge@gmail.com says...
> >>
> >> Unfortunately, Microsoft Silverlight will not install on my Windows 7
> >> machine. This has to be the most screwed up streaming platform
> >> available.
> >> It's just given me all kinds of fits. I already have a gazillion
> >> Silverlight files and I can't uninstall it without watching a video on
> >> how
> >> to go about it.
> >
> > It appears to be installed on my computer (Windows 7), but
> > I don't know how to use it!
>
> Silverlight is just a driver for video streaming. Like Java or Adobe
> Flashplayer, it should startup and run automatically as needed.

Thanks.
I am now enlightened.

I don't know about Java, but I do have both Silverlight &
Adobe Flashplayer on my computer. Do they clash?
--
David Barnett

Obveeus

9/5/2012 9:47:00 PM

0


"David Barnett" <dbar3518@bigpond.net.au> wrote:
> In article <k27dhp$l4a$1@dont-email.me>, Obveeus@aol.com
> says...
>>
>> "David Barnett" <dbar3518@bigpond.net.au> wrote:
>>
>> > masonbarge@gmail.com says...
>> >>
>> >> Unfortunately, Microsoft Silverlight will not install on my Windows 7
>> >> machine. This has to be the most screwed up streaming platform
>> >> available.
>> >> It's just given me all kinds of fits. I already have a gazillion
>> >> Silverlight files and I can't uninstall it without watching a video on
>> >> how
>> >> to go about it.
>> >
>> > It appears to be installed on my computer (Windows 7), but
>> > I don't know how to use it!
>>
>> Silverlight is just a driver for video streaming. Like Java or Adobe
>> Flashplayer, it should startup and run automatically as needed.
>
> Thanks.
> I am now enlightened.
>
> I don't know about Java, but I do have both Silverlight &
> Adobe Flashplayer on my computer. Do they clash?

No clashing as they all serve as drivers for different internet surfing
tasks.


David Barnett

9/5/2012 9:57:00 PM

0

In article <k27slh$oi5$1@dont-email.me>,
arthur@alum.calberkeley.org says...
>
> On 9/5/2012 8:24 AM, Mason Barge wrote:
> > On Wed, 5 Sep 2012 07:37:28 -0400, "Obveeus" <Obveeus@aol.com> wrote:
> >
> >>
> >> "David Barnett" <dbar3518@bigpond.net.au> wrote:
> >>
> >>> masonbarge@gmail.com says...
> >>>>
> >>>> Unfortunately, Microsoft Silverlight will not install on my Windows 7
> >>>> machine. This has to be the most screwed up streaming platform
> >>>> available.
> >>>> It's just given me all kinds of fits. I already have a gazillion
> >>>> Silverlight files and I can't uninstall it without watching a video on
> >>>> how
> >>>> to go about it.
> >>>
> >>> It appears to be installed on my computer (Windows 7), but
> >>> I don't know how to use it!
> >>
> >> Silverlight is just a driver for video streaming. Like Java or Adobe
> >> Flashplayer, it should startup and run automatically as needed.
> >
> > Yes, It should.
> >
>
>
> Is it up to date? Try running Microsoft update. I'm one of those
> people who *actively* keeps his computer up to date. But I've seen
> computers that haven't been updated since the first day they were turned
> on...

I used to update regularly until an update apparently
froze one of my favorite web sites, using IE.

I then downloaded Firefox which had no trouble with that
web site. Strangely, after several weeks, IE has now
unfroze it, but I now prefer Firefox as it blocks ad-ware
better, (using an add on).

I no longer Microsoft update, on the principle "if it is
not broke, don't fix it". So far, no problems.

--
David Barnett