code logs -> 2011 -> Sun, 09 Oct 2011< code.20111008.log - code.20111010.log >
--- Log opened Sun Oct 09 00:00:55 2011
01:01 gnolam [lenin@Nightstar-260383cb.tbcn.telia.com] has joined #code
01:14 Vornicus-Latens is now known as Vornicus
02:10 Attilla [Some.Dude@Nightstar-f29f718d.cable.virginmedia.com] has quit [Ping timeout: 121 seconds]
02:29 gnolam [lenin@Nightstar-260383cb.tbcn.telia.com] has quit [[NS] Quit: Z?]
02:33 Stalker [Z@Nightstar-3602cf5a.cust.comxnet.dk] has quit [Ping timeout: 121 seconds]
03:09 Janus [NSwebIRC@Nightstar-f5a40c78.res.rr.com] has joined #code
03:36 Janus [NSwebIRC@Nightstar-f5a40c78.res.rr.com] has quit [[NS] Quit: faint]
03:56 Kindamoody[zZz] is now known as Kindamoody
05:10 Vash [Vash@Nightstar-f03c5637.sd.cox.net] has joined #code
07:22 Derakon is now known as Derakon[AFK]
07:39 Vornicus is now known as Vornicus-Latens
07:46 Vash [Vash@Nightstar-f03c5637.sd.cox.net] has quit [[NS] Quit: I <3Lovecraft<3 Vorn!]
07:49 celticminstrel [celticminst@Nightstar-5d22ab1d.cable.rogers.com] has quit [[NS] Quit: And lo! The computer falls into a deep sleep, to awake again some other day!]
08:59 Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has joined #code
09:17 Kindamoody is now known as Kindamoody|out
10:02 Stalker [Z@Nightstar-3602cf5a.cust.comxnet.dk] has joined #code
10:38 McMartin_ [mcmartin@Nightstar-a47b9f7a.pltn13.sbcglobal.net] has joined #code
10:41 McMartin [mcmartin@Nightstar-e2dd8f35.pltn13.sbcglobal.net] has quit [Ping timeout: 121 seconds]
11:01 gnolam [lenin@Nightstar-5b82023c.dialup.ice.net] has joined #code
11:23 Stalker [Z@Nightstar-3602cf5a.cust.comxnet.dk] has quit [Ping timeout: 121 seconds]
11:41 Attilla [Some.Dude@Nightstar-f29f718d.cable.virginmedia.com] has joined #code
12:29 Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has quit [Connection reset by peer]
12:30 * gnolam starts to wonder if the NSFS has forgotten about the proceedings.
12:30
< gnolam>
Srsly. It's been two months since the conference, and they were going to publish them electronically... so WTF?
12:31 Stalker [Z@Nightstar-5aa18eaf.balk.dk] has joined #code
13:07 Stalker [Z@Nightstar-5aa18eaf.balk.dk] has quit [Ping timeout: 121 seconds]
14:37 gnolam [lenin@Nightstar-5b82023c.dialup.ice.net] has quit [[NS] Quit: Je suis arrivé]
15:05 Kindamoody|out is now known as Kindamoody
15:17 gnolam [lenin@Nightstar-202a5047.priv.bahnhof.se] has joined #code
16:10 kwsn [kwsn@Nightstar-635d16fc.org] has quit [Ping timeout: 121 seconds]
16:18 kwsn [kwsn@Nightstar-635d16fc.org] has joined #code
16:44 cpux [cpux@Nightstar-c5874a39.dyn.optonline.net] has quit [[NS] Quit: Well, most things get better when I kick them!]
17:02 cpux [cpux@Nightstar-c5874a39.dyn.optonline.net] has joined #code
17:36 bob_work [NSwebIRC@Nightstar-f9f2b179.static.qwest.net] has joined #code
17:37 * bob_work is stuck on an assignment.
17:39
< bob_work>
Java class: I have a class given to us by the instructor. It is called AirData.java, and a text file called AirData.txt. Assignment is to take the AirData.txt information and pass it into AirData classes.
17:40
< bob_work>
Now, I've done the file reader, scanner, and even broken it down to arrays to seperate the information...my problem is sending it over to the AirData classes.
17:41
< TheWatcher>
Noes AirData's constructor take any useful arguments?
17:41
< bob_work>
It takes a string, int, int
17:41
< bob_work>
My main problem I'm running into is running the for loop to send data to the class(es) I'm creating
17:42
< bob_work>
For loop creates class object by "AirData Bob = new AirData(Name, RevMiles, PassMiles)" But...it's going to create a lot of Bob's unless I can figure out how to create more than one class from the loop
17:43
< bob_work>
So this is probably a first level problem, but I'm stumped on how to make a variable name for the class object.
17:43
< bob_work>
Unless that's bad and I'm doing it all wrong.
17:44
< Namegduf>
Objects aren't "attached" to the name of the variable you use to create them. A variable just references or is the current one being worked on by that piece of code.
17:44
< Namegduf>
If you want to store them outside the loop, use a list.
17:46
<@ToxicFrog>
Also, it's not a "class object" - it's an object of type AirData (where AirData is a class).
17:47
<@ToxicFrog>
Apart from that, Namegduf has it - create a list or similar container that can hold several objects (ArrayList is a good go-to container for this sort of thing), and as you create each AirData object in the loop, stuff it into the container.
17:47
<@ToxicFrog>
When the loop completes, now you have all of your AirDatas available and can do whatever you like with them.
17:48
< bob_work>
ArrayList is part of the assignment. But they throw my brain into a spin when I try to contemplate them. I will carry on in that direction though.
17:48
< bob_work>
Thank you
17:50
< Namegduf>
Think of objects and values as anonymous things you give a name to temporarily so you can refer to them in code.
17:51
< bob_work>
I...I think I've figured it out. WOO! (expect an "crap" in a few minutes if otherwise)
17:51
< Namegduf>
That statement will create a class each time, but as soon as the reference to it from the variable disappears at the loop end, the class gets lost and will eventually be collected.
17:52
<@ToxicFrog>
Namegduf: will create an object each time.
17:52
< Namegduf>
Right, sorry. Instance of a class, an object.
17:53
<@ToxicFrog>
(the distinction is especially important in languages where classes are themselves objects and/or can be created on the fly)
17:53
<@ToxicFrog>
(although this is not, as a rule, true of Java, barring reflection tricks)
17:56
< bob_work>
makes sense.
18:17
< bob_work>
Ok, so I can get the data into an array list
18:17
< bob_work>
But I have no frakking clue what happens to it in there.
18:18 cpux [cpux@Nightstar-c5874a39.dyn.optonline.net] has quit [[NS] Quit: Well, most things get better when I kick them!]
18:19
< bob_work>
I have a (class I think) level variable created at the top of my .java class for the ArrayList variable like so:
18:19
< bob_work>
ArrayList<AirData> Bob = new ArrayList<AirData>();
18:20
< bob_work>
In my for loop later, I have
18:20
< bob_work>
Bob.add(new AirData(Name, RevMiles, PassMiles) );
18:20
< bob_work>
But...yeah. No idea how I would reference individual AirData objects like which Name goes with which RevMiles
18:26 * bob_work goes for a walk and think
18:37
< Namegduf>
It's a list of AirData objects. You can access objects by index.
18:38
< Namegduf>
Look at the API for ArrayList.
18:41 Vornicus-Latens is now known as Vornicus
18:41 cpux [cpux@Nightstar-c5874a39.dyn.optonline.net] has joined #code
18:49
<@ToxicFrog>
bob_work: I believe the method you want is ArrayList.get(), but check the javadocs for ArrayList.
18:50
<@ToxicFrog>
Also, for iterating over everything in the ArrayList, just use a for loop: for (AirData ad: listOfAirData) { ...do stuff with ad... }
18:51 cpux [cpux@Nightstar-c5874a39.dyn.optonline.net] has quit [Connection closed]
19:03 RichardBarrell [mycatverbs@Nightstar-f68eb197.cable.virginmedia.com] has joined #code
19:11 * bob_work gives up; decides to go play somewhere more sane...like traffic
19:11
< bob_work>
thanks guys
19:19 bob_work [NSwebIRC@Nightstar-f9f2b179.static.qwest.net] has left #code [""]
19:38 Derakon[AFK] is now known as Derakon
19:41 celticminstrel [celticminstre@Nightstar-5d22ab1d.cable.rogers.com] has joined #code
19:45 Kindamoody is now known as Kindamoody[zZz]
19:49 RichardBarrell [mycatverbs@Nightstar-f68eb197.cable.virginmedia.com] has quit [Client closed the connection]
20:03 cpux [cpux@Nightstar-c5874a39.dyn.optonline.net] has joined #code
20:08 Stalker [Z@Nightstar-5aa18eaf.balk.dk] has joined #code
21:36 kwsn is now known as kw|GO_BREWERS
23:42 celticminstrel [celticminstre@Nightstar-5d22ab1d.cable.rogers.com] has quit [Client closed the connection]
23:42 celticminstrel [celticminst@Nightstar-5d22ab1d.cable.rogers.com] has joined #code
--- Log closed Mon Oct 10 00:00:19 2011
code logs -> 2011 -> Sun, 09 Oct 2011< code.20111008.log - code.20111010.log >

[ Latest log file ]