10-13-2003, 10:56 AM | #1 (permalink) |
Darth Papa
Location: Yonder
|
Tiny mistake, BIG problem
Just in case any of you were wondering, when you're working in Perl, building a select box of shipping rates, there's a HUGE difference between this:
<code> foreach my $key (sort {$rates->{$a} <=> $rates->{$b}} keys %$rates) { $option_list .= '<option value="' . $ups->servicenames($key) . $rates->{$key} . "\">$key - $rates->{$key}</option>\n"; } </code> And:<code> foreach my $key (sort {$rates->{$a} <=> $rates->{$b}} keys %$rates) { $option_list .= '<option value="' . $ups->servicenames($key) . $rates->{$key} "\">$key - $rates->{$key}</option>\n"; } </code> One dot makes all the difference between "runs" and "not runs". That dot is the difference between "happy customer" and "SAD customer". What obnoxious little spelling errors have YOU programmed recently? |
10-13-2003, 04:11 PM | #3 (permalink) | |
The GrandDaddy of them all!
Location: Austin, TX
|
Quote:
case sensitive bastards.
__________________
"Luck is what happens when preparation meets opportunity." - Darrel K Royal |
|
10-13-2003, 04:27 PM | #5 (permalink) |
Junkie
|
Programmers scare me.
I don't have a very "structured" mind that can look at things in a "logical" manner. My mind is all over the place, jumping from topic to topic, trying to understand the Big Picture etc. Makes me a good PM, but I would be crap at programming... Mr Mephisto |
10-13-2003, 07:45 PM | #7 (permalink) |
Huggles, sir?
Location: Seattle
|
Oh man. You have no idea how wonderful that syntax highlighting in vim is until you try to work without it. I used to find it irritating to begin with, but now I can't work without it.
__________________
seretogis - sieg heil perfect little dream the kind that hurts the most, forgot how it feels well almost no one to blame always the same, open my eyes wake up in flames |
10-13-2003, 11:57 PM | #8 (permalink) |
Rookie
Location: Oxford, UK
|
I still have a habit of leaving out semicolons, which always seems to throw up random entertaining errors.
__________________
I can't understand why people are frightened of new ideas. I'm frightened of the old ones. -- John Cage (1912 - 1992) |
10-14-2003, 12:14 AM | #9 (permalink) |
paranoid
Location: The Netherlands
|
Debugging?
Try any program in Miranda... It keeps throwing up errors like Code:
type [[[[[[[[]]]]]]]] is unequal to [[[[[[[]]]]]]]
__________________
"Do not kill. Do not rape. Do not steal. These are principles which every man of every faith can embrace. " - Murphy MacManus (Boondock Saints) |
10-14-2003, 01:20 AM | #10 (permalink) |
Cracking the Whip
Location: Sexymama's arms...
|
O vs 0.
I spent a day tearing out my hair (much thicker then) over this one.
__________________
"Of all tyrannies, a tyranny exercised for the good of its victims may be the most oppressive. It may be better to live under robber barons than under omnipotent moral busybodies. The robber baron's cruelty may sometimes sleep, his cupidity may at some point be satiated; but those who torment us for our own good will torment us without end, for they do so with the approval of their own conscience." – C. S. Lewis The ONLY sponsors we have are YOU! Please Donate! |
10-14-2003, 04:12 AM | #11 (permalink) | |
Huggles, sir?
Location: Seattle
|
Quote:
__________________
seretogis - sieg heil perfect little dream the kind that hurts the most, forgot how it feels well almost no one to blame always the same, open my eyes wake up in flames |
|
10-14-2003, 05:07 AM | #12 (permalink) | |
Crazy
Location: Reading, UK
|
Re: Tiny mistake, BIG problem
Mine wasn't really a spelling error. But I started crying when after 2 days of debugging and no sleeping I finally found the "//FJD" remark in the code. (Just For Debug).
After removing couple of lines after the remark everything worked like a charm... Quote:
In the "foreach" line when you use the when you use "keys" it's not necessary to write %$. The % is enough. Like this: <code> foreach my $key (sort {$rates->{$a} <=> $rates->{$b}} keys %rates) </code> |
|
10-14-2003, 05:29 AM | #13 (permalink) | |
Darth Papa
Location: Yonder
|
Quote:
Try running the following code: Code:
#!/usr/bin/perl my $hashref; my %hash; %hash = ( a => 1, b => 2); $hashref = \%hash; print "Foreaching through \%hash:\n"; foreach my $key (keys %hash) { print "$key -> $hash{$key}\n"; } print "\nForeaching through \$hashref:\n"; foreach $key (keys %$hashref) { print "$key -> $hashref->{$key}\n"; } print "\nForeaching through \$hashref treated like a hash:\n"; foreach $key (keys %hashref) { print "$key -> $hashref->{$key}\n"; } print "\nDone!\n"; exit(0); |
|
10-14-2003, 05:35 AM | #14 (permalink) | |
Crazy
Location: Reading, UK
|
Quote:
|
|
Tags |
big, mistake, problem, tiny |
|
|