code logs -> 2008 -> Sun, 23 Nov 2008< code.20081122.log - code.20081124.log >
--- Log opened Sun Nov 23 00:00:42 2008
00:22 You're now known as TheWatcher[T-2]
00:24 You're now known as TheWatcher[zZzZ]
01:28 Derakon is now known as Derakon[AFK]
01:33 Serah [~Z@Nightstar-5401.atm2-0-1041217.0xc329e232.boanxx12.customer.tele.dk] has quit [Connection reset by peer]
01:59 Serah [~Z@Nightstar-5401.atm2-0-1041217.0xc329e232.boanxx12.customer.tele.dk] has joined #Code
01:59 mode/#code [+o Serah] by ChanServ
02:05 crem [~moo@Nightstar-28703.adsl.mgts.by] has joined #code
02:05 Reiver [~reaverta@Nightstar-11199.xdsl.xnet.co.nz] has quit [Nick collision (older nick overruled)]
02:06 Reiver [~reaverta@Admin.Nightstar.Net] has joined #Code
02:06 mode/#code [+o Reiver] by ChanServ
02:08 jerith [~jerith@Nightstar-21563.slipgate.za.net] has joined #code
02:37 Derakon[AFK] is now known as Derakon
05:19 Bob_work [c6b3e33a@Nightstar-14595.mibbit.com] has joined #code
05:22
< Bob_work>
ping
05:23
< Bob_work>
Ok, so I figured out why some of you probably wanted to brow beat me for my code earlier. (And rightfully so).
05:24
< Bob_work>
I've worked it out with your comments and examples from the book to string together something that ALMOST works...
05:24
< Bob_work>
ALMOST because it keeps printing addresses instead of the values in the structures.
05:25
<@Derakon>
What do you expect should happen if you take a pointer to an object and try to print it?
05:25
<@ToxicFrog>
Quibble: shouldn't PrintList just call PrintPart() on each node, which does the actual output?
05:25
<@ToxicFrog>
Derakon: actually, his print code looks fine
05:25
<@ToxicFrog>
It's all printf(fmt, node->field
05:26
<@Derakon>
Okay.
05:26
<@ToxicFrog>
http://rafb.net/p/JWZAWj67.html
05:26
<@Derakon>
Sounds like you might not be storing the right values in the first place, then.
05:26
<@ToxicFrog>
How do you know it's displaying addresses instead of, say, random garbage?
05:27
<@ToxicFrog>
Oh, and incidentally, a way to get around all that "struct Parts" tedium...
05:27
<@ToxicFrog>
typedef struct _Parts { ...struct body... } Parts;
05:27
<@ToxicFrog>
And now you can just say "Parts" instead of "struct Parts" everywhere.
05:27
<@Derakon>
Okay, take a look at your InsertPart function.
05:27
<@Derakon>
Specifically, look at your arguments, and what you do with them.
05:27
<@ToxicFrog>
(also works: struct _Parts { ... }; typedef struct _Parts Parts;)
05:28
<@Vornicus>
or typedef struct { ... } Parts;
05:28
<@Serah>
struct kitten[] foo()
05:28
<@Serah>
!
05:28
<@Serah>
I learned something new today.
05:28
<@Serah>
Kitten structures.
05:28
< Bob_work>
heh
05:29
<@Derakon>
struct kitten {struct kittenPart head; struct kittenPart body; struct* kittenPart limbs; int rating};
05:29
<@Vornicus>
though you'll need one of the two ways TF gave to make recursive structures.
05:29
<@Vornicus>
assert(my_kitten.rating == 10)
05:31
<@Serah>
What language are we structuring kittens in?
05:31
<@ToxicFrog>
C, at the moment.
05:31
< Bob_work>
I'm at a loss for my arguments. I've tried sending pointers and values down the program, and still keep getting strings of numbers (that I'm assuming are addresses)
05:31
<@ToxicFrog>
Bob_work: look closely at InsertStruct.
05:32
<@Derakon>
You mean InsertPart.
05:32
<@ToxicFrog>
Err, yes.
05:32
<@ToxicFrog>
Specifically, look at the place where it fills in the newly created Parts with the values it was passed.
05:32 * Derakon coughs.
05:33
<@Serah>
If I were to be wanting to be picking up PHP, would this be the entirely wrong channel to be in?
05:33
<@ToxicFrog>
There's a few people in here who like/know PHP.
05:33
<@Derakon>
I use it at work.
05:33
<@ToxicFrog>
Expect some amount of people asking why with horrified looks on their faces, though~
05:33
<@Serah>
Ah, not entirely wrong, and pretty right too. Great.
05:33
<@Serah>
But I'll have to get my laptop back first.
05:34
<@Serah>
Got a better alternative?
05:34
<@Serah>
That in't python.
05:34
<@ToxicFrog>
Depends on what you're doing.
05:34
<@Serah>
Homepages.
05:34
<@Derakon>
Perl is perfectly adequate at CGI.
05:34
<@Serah>
I already know CSS and html, I want to know more.
05:34
< Bob_work>
Ok, calling InsertPart, I'm sending the values of PartNum, Qty, and Price...no?
05:34
<@Derakon>
Remember that PHP, perl, python, PHP, etc. are all for server-side scripting.
05:34
<@ToxicFrog>
Hardcore string processing? Awk, perl. Dynamic page generation? Python, Ruby, Lua, Bash for small stuff.
05:35
<@ToxicFrog>
Bob_work: yes, you are. Now, what does InsertPart do with them?
05:35
<@Derakon>
If you just want to have interactive pages, you should probably look at Javascript.
05:35
< Bob_work>
InsertPart drops them into new addresses.....ah hell.
05:36
<@Serah>
I know enough Jscript.
05:36 * Bob_work re-examines that line
05:36
<@Serah>
I need more.
05:36
<@Derakon>
More javascript, or more capability?
05:37
<@ToxicFrog>
Incidentally, why "not Python"?
05:38
< Bob_work>
ok, that was a fail. Dammit.
05:39
<@Derakon>
It happens to all of us. All the time.
05:39
<@Derakon>
In other words, get used to making stupid mistakes. They don't mean you yourself are stupid.
05:40
<@Derakon>
(In fact, most of my debugging these days is "Okay, what stupid thing have I done this time?")
05:40
< Bob_work>
Ok, my logic (wrongly) keeps telling me that I'm sending the values of PartNum, Qty, and Price to InsertPart. InsertPart is putting those values in as Addresses somehow. But I can't seem to figure if or how I should use pointers to go back to the actual values
05:40
< Bob_work>
Sorry, still haven't figured it out.
05:41
< Bob_work>
Just kicking myself because I KNOW it's gonna be something lame that I'll smack my forehead for.
05:41
<@Derakon>
Pointers are hard.
05:44
< Bob_work>
As in, Pointers are the hard way to do it?
05:44
<@Derakon>
No, as in, pointers are hard to understand.
05:44
<@Derakon>
They're a common big stumbling block.
05:45
< Bob_work>
ok
05:45
< Bob_work>
I thought I understood them. Now...not so much.
05:45
<@Serah>
<ToxicFrog> Incidentally, why "not Python"? <- Python is made of woe.
05:46
<@Serah>
<Derakon> More javascript, or more capability? <- More power.
05:46
<@Derakon>
Serah: well, I'm a fan of Perl myself.
05:46
<@Derakon>
Just be aware it's very easy to make write-only code in Perl.
05:46
<@Serah>
<Bob_work> Just kicking myself because I KNOW it's gonna be something lame that I'll smack my forehead for. <- If something doesn't work and you can't figure out what it is for longer than ten minutes, my experience tells me to rewrite it.
05:46
<@ToxicFrog>
"python is made of woe" is not an answer, although I agree with the sentiment.
05:47
<@Serah>
Python will break my head.
05:47
<@Serah>
I need something I mostly already understand.
05:47
<@Derakon>
What in Python got you into trouble?
05:47
<@ToxicFrog>
Bob_work: well, first of all, everything up to line 128 is fine.
05:47
<@Serah>
I wrote aspex through c-sharp once, mostly by book.
05:47
<@Serah>
Oh I haven't written python.
05:47
<@Serah>
Me and the arcane doesn't mix well.
05:48
<@Derakon>
Python's generally considered to be as non-arcane as programming languages get.
05:48
<@ToxicFrog>
Although the cast on NULL isn't required; if (newaddress == NULL) is perfectly legal.
05:48
<@ToxicFrog>
PHP is more arcane than Python.
05:48
<@ToxicFrog>
Perl much more so.
05:48
<@ToxicFrog>
Bob_work: actually, everything up to 133 is fine.
05:48
<@Serah>
Python is easy to understand?
05:48
<@Serah>
I can read ruby better than I read python.
05:49
<@ToxicFrog>
o.O
05:49
<@Serah>
If ROR was more widely supported I'd pick that up.
05:49
<@Vornicus>
the only language I can read more easily than Python is Inform 7, and That Hardly Counts.
05:51
< jerith>
Serah: You only think you can read Ruby better.
05:51
<@Serah>
Of course.
05:51
<@Serah>
I only think.
05:51
< jerith>
I've been writing Ruby code professionally for nearly three years and I can't figure out what's going on about 10% of the time.
05:52
< jerith>
Mostly because it's so easy for random things to completely change standard behaviour.
05:52
<@Serah>
I don't know Ruby, so I'll take the professional's (Your) word for it.
05:54
< jerith>
Rails is particularly bad about that. It's almost a different language. Certainly a different dialect.
05:54
< Bob_work>
ToxicFrog: I've tried Here = Locate(PartNum), but I keep getting invalid argument
05:55
<@ToxicFrog>
-> PM
05:55
<@Serah>
Were you on the debate team?
05:55
<@Serah>
You don't need to go to PM, I will shut up.
05:55
<@Serah>
This is me, shutting up, and down at the same time.
05:55
<@Serah>
Goodnight.
05:55 Serah [~Z@Nightstar-5401.atm2-0-1041217.0xc329e232.boanxx12.customer.tele.dk] has quit [Quit: Be right back, got some smiting and righteous justice to attend to.]
05:55
<@ToxicFrog>
Er
05:55
<@ToxicFrog>
That was directed at Bob
05:55
< jerith>
Um.
05:55 * Derakon facepalms.
05:55
<@Derakon>
Oooh, well.
05:55 * Vornicus shrugs
05:56
<@ToxicFrog>
Aah well, I guess we can bring the conversation with Bob_work back in here.
05:56
<@ToxicFrog>
Bob_work: you still haven't said what the desired behaviour is.
05:56
<@Derakon>
I actually take that to be Serah saying "Oh, I'm talking too much, so you can't hold your actually important discussion? Okay, I'll leave."
05:56
< Bob_work>
Well, that's exactly what I want it to do....
05:56
<@ToxicFrog>
The actual behaviour is:
05:56
<@ToxicFrog>
Er
05:56
< Bob_work>
in that part.
05:56
<@ToxicFrog>
Yes, but after line 33
05:56
<@ToxicFrog>
*133
05:56
<@ToxicFrog>
The else branch
05:57
< Bob_work>
yes?
05:57
<@ToxicFrog>
You haven't said what it's meant to do there.
05:57
<@ToxicFrog>
I'm fairly sure that you didn't want the behaviour you have there, which is:
05:57
<@ToxicFrog>
(1) copy the part number into a pointer
05:57
<@ToxicFrog>
(2) follow that pointer to god knows where
05:57
<@ToxicFrog>
(3) probably segfault
05:58
< Bob_work>
Ah. I was trying to follow the books examples. I thought that said "Ok, here's the Part Number, it's not moving, so link it's addresses up to last known position and make it the last structure
05:58
<@ToxicFrog>
Aah, but the part number is not the structure
05:58
<@ToxicFrog>
The structure contains a part number, along with some other stuff
05:59
< Bob_work>
well, the actual line from the book is: here = Locate(PartNum); (Variable name PartNum inserted instead of book's example of here = Locate(name);
06:00
<@ToxicFrog>
If we use the analogy of a pile of index cards, the card itself is the struct; written on it is a part number (PartNum), a quantity (Qty), a price (Price), and where in the pile the next card is (Next).
06:00
<@ToxicFrog>
It should say somewhere what Locate does.
06:00
<@ToxicFrog>
I suspect from context that the signature is:
06:01
<@ToxicFrog>
struct Parts * Locate(int PartNum); // return a pointer to the location in the linked list where a new Parts with the given part number should be inserted to keep things in order
06:01
< Bob_work>
one sec, gotta put tapes in the machine.
06:01
<@ToxicFrog>
Which in turn implies that the behaviour you want is "if none of the above are true, insert the new Parts somewhere in the list such that the list is ordered by part number"
06:02
< Bob_work>
damn machine holds a few thousand tapes, but always wants the ones from the shelf.
06:08
<@ToxicFrog>
Anyways, if that is in fact the behaviour you want, you'll have to write Locate :)
06:10
< Bob_work>
which I've tried, and keep getting the error "undefined reference to Locate"
06:11
<@ToxicFrog>
No
06:11
<@ToxicFrog>
I mean, you will have to write the Locate function
06:12
< Bob_work>
oh. dammit.
06:12
<@ToxicFrog>
"undefined reference to X" means exactly what it says: you are referring to X - using it as a value, or assigning to it, or calling it, or what have you - but the compiler can't find a declaration or definition for it, typically because you either forgot to write it (if it's yours) or forgot to #include the right headers.
06:15
<@ToxicFrog>
At the moment, I would suggest deferring sorted lists, and just getting all inserting and printing working properly.
06:15
<@ToxicFrog>
Once you have that working and tested, upgrade the insertion function to keep the list sorted.
06:16
< Bob_work>
Yeah, that sounds like a smart idea.
06:16 * Bob_work appreciates your time
06:16
< Bob_work>
I hate being a newb.
06:17
<@ToxicFrog>
(there is a relevant saying here: "large programs that work start out as small programs that work, not large programs that don't work")
06:18 gnolam [lenin@79.136.60.ns-4387] has quit [Quit: Z?]
06:20
< Bob_work>
makes sense
06:42 * ToxicFrog ponders Chrome. I think there's a bug in my code.
06:42
<@ToxicFrog>
I was trying to make cloaking devices useful.
06:42
<@ToxicFrog>
I appear to have turned them into infinite-usage perfect invisibility devices.
06:45
<@Vornicus>
what is Chrome here?
06:45
< Bob_work>
Chrome - What Google calls it's sorry excuse for a browser
06:46
<@Vornicus>
That's not the Chrome TF is talking about though, obviously.
06:46
<@ToxicFrog>
Video game, 2003, Techland/Gathering of Developers. Notable for then: implants, user-selectable loadout, large outdoor maps, vehicles. Notable for now: all game logic is Java, installer (and patches) provides both source and binaries.
06:47
<@ToxicFrog>
They're even well commented, albeit in Polish.
06:49
<@Vornicus>
sweeeet.
06:56 * ToxicFrog picks his loadout for the game's most exacting stealth mission: the biggest, noisiest rifle in the game; 100 rounds of 14mm long HE for it; four frag grenades; two cluster grenades; and a cloaking device ??
06:57
< Bob_work>
holy hell I figured it out
06:57 * Bob_work dances.
06:57 * Bob_work grabs TF and dances faster
06:58 * Bob_work then wanders off in a stupor
06:58
<@ToxicFrog>
This calls for grilled cheese sammich.
06:59
< Bob_work>
Honey Bun!
06:59
< Bob_work>
(Had one in my pocket.)
07:14 AnnoDomini [~farkoff@Nightstar-29878.neoplus.adsl.tpnet.pl] has joined #Code
07:14 mode/#code [+o AnnoDomini] by ChanServ
07:18 Derakon is now known as Derakon[AFK]
07:20 himizzzz is now known as SandraLaptop
07:35
< Bob_work>
heh
07:36
< Bob_work>
So, testing what I've got so far. If I put part numbers in 1 then 2, it errors out.
07:36
< Bob_work>
If I put them in reverse order, it works.
08:04
<@ToxicFrog>
And the error is?
08:04
<@ToxicFrog>
...also, have you received any training in debugger usage?
08:05 SandraLaptop is now known as himi
08:06
<@AnnoDomini>
I have a question. I'm converting some Verilog code to VHDL, and there's some always@ statements. I can do the same with an if within a process, right?
08:20
< Bob_work>
segfault memory error. I'm just playing around right now, practicing debugging
08:21
<@ToxicFrog>
Nod
08:21
<@ToxicFrog>
Your go-to debugging commands, assuming you're using gdb:
08:21
<@ToxicFrog>
file <file> - load a program executable
08:21
<@ToxicFrog>
run [arguments] - run the loaded program, with optional command line arguments
08:22 Vornicus is now known as Vornicus-Latens
08:22
<@ToxicFrog>
core <corefile> - load a program core left behind after a crash
08:22
<@ToxicFrog>
where - display a stack trace
08:22
<@ToxicFrog>
up/down - navigate the call stack
08:22
<@ToxicFrog>
print <expression> - display a value; can be anything that would be valid in your current stack frame, ie, any globals and anything local to that frame, including complicated C expressions
08:22
< Bob_work>
Yeah, random tidbit: It definitely helps if you insert the information into a struct BEFORE you start swapping them around. >.>
08:22
<@ToxicFrog>
And don't forget to compile with -g!
08:23
<@ToxicFrog>
Ehehehehe.
08:23
<@ToxicFrog>
Yes.
08:23 * Bob_work moves a few lines up a bit.
09:51 Bob_work [c6b3e33a@Nightstar-14595.mibbit.com] has quit [Quit: http://www.mibbit.com ajax IRC Client]
10:04 You're now known as TheWatcher
11:41 gnolaptop [~lenin@Nightstar-10456.8.4.180.static.se.wasadata.net] has joined #Code
11:52
< gnolaptop>
Well, this is annoying.
11:54
< gnolaptop>
wxMaxima refuses to start if .wxMaxima (a file it creates on startup) exists in your home dir.
12:26 gnolaptop [~lenin@Nightstar-10456.8.4.180.static.se.wasadata.net] has quit [Quit: Freedom!]
12:32 gnolam [lenin@79.136.60.ns-4387] has joined #Code
12:32 mode/#code [+o gnolam] by ChanServ
16:38 Vornicus-Latens is now known as Vornicus
17:02 Derakon[AFK] is now known as Derakon
17:51 C_tiger [~c_wyz@Nightstar-5282.hsd1.ca.comcast.net] has quit [Ping Timeout]
17:56 C_tiger [~c_wyz@Nightstar-5282.hsd1.ca.comcast.net] has joined #code
17:56 mode/#code [+o C_tiger] by ChanServ
21:06 Vornicus is now known as Finerty
21:41 You're now known as TheWatcher[T-2]
22:15 Serah [~Z@Nightstar-5401.atm2-0-1041217.0xc329e232.boanxx12.customer.tele.dk] has joined #Code
22:15 mode/#code [+o Serah] by ChanServ
22:18 You're now known as TheWatcher[zZzZ]
22:42 * McMartin actually fires up UQM again for the first time in a very, very long time.
22:54 AnnoDomini [~farkoff@Nightstar-29878.neoplus.adsl.tpnet.pl] has quit [Quit: If nothing we do matters, all that matters is that we do.]
22:58
<@McMartin>
Man. Sun may be moribund but their wholly-owned subsidiaries sure aren't. VBox 2.0.6 just shipped.
22:59
< himi>
McMartin: on that #define bool char issue, is this something I can just comment out or wrap in a test to make sure it's not used in C++?
23:42
<@McMartin>
There's a #define you can test; I believe it's __cplusplus
23:51
< himi>
Cool
23:52
<@McMartin>
... let me check the VControl source on this.
23:53
<@McMartin>
Yeah.
23:53
<@McMartin>
#ifdef __cplusplus
23:53
<@McMartin>
extern "C" {
23:53
<@McMartin>
#endif
23:53
<@McMartin>
At the top of every header.
--- Log closed Mon Nov 24 00:00:53 2008
code logs -> 2008 -> Sun, 23 Nov 2008< code.20081122.log - code.20081124.log >