Splitting headache

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Splitting headache

Post by jayshields »

I've just spent over an hour trying to work out why Javascript refused to work with

Code: Select all

$msg .= 'There are not enough ingredients in stock to prepare your order, please
reduce the quantities of the following menu items:';
but would work with every other permutation under the sun! As soon as I found out this worked

Code: Select all

$msg .= 'There are not enough ingredients in stock to prepare your order, please reduce the quantities of the following menu items:';
I almost chucked my computer out of the window! I have debugged absolutely everything and it turns out it was the line break...

My head is killing now! Anyone else had a similar experience recently? Might make me feel better!
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Splitting headache

Post by pickle »

Not recently, but a couple years ago I had this problem. Now I know not to put line breaks in my quoted strings.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Re: Splitting headache

Post by RobertGonzalez »

At times like these I like to curse profusely at my computer then go eat (or drink).
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Splitting headache

Post by califdon »

I find that drinking is usually more effective. :drunk:
User avatar
swiftouch
Forum Commoner
Posts: 80
Joined: Sun Dec 10, 2006 7:35 am
Location: Salt Lake City, Utah

Re: Splitting headache

Post by swiftouch »

Whenever I have a problem like this I call my congressman and complain because I KNOW they can fix the problem for me.
User avatar
Bill H
DevNet Resident
Posts: 1136
Joined: Sat Jun 01, 2002 10:16 am
Location: San Diego CA
Contact:

Re: Splitting headache

Post by Bill H »

I recall back in the days when I was programming in C for DOS. (Everyone else was programming for DOS too, as MS had not yet released Windows #1, and C++ had not yet been invented. I am quite old.) I had a place where the screen sometimes would go blank for about one second and then the program would resume normally. I debugged like crazy and could not find it. Weeks went by with no luck. I got a couple other programmers to look for it. No luck. It seemed to be doing no harm, but a full second of blank screen is a long time, and certainly something was going on.

It was me that finally found it, which saved me from having to advertise my stupidity until I was old enough to not mind advertising my stupidity.

I was telling a string input function to finish out an input by printing spaces. The variable was an unsigned integer, but I was not testing to be sure that no negative value ever reached the variable. We all know how an unsigned integer interprets a -1, don't we?

it required the technology of that time about one second to print 32,672 spaces to the screen. Blush.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Re: Splitting headache

Post by RobertGonzalez »

Dude, that needs to be on the daily WTF. That was awesome.
User avatar
Bill H
DevNet Resident
Posts: 1136
Joined: Sat Jun 01, 2002 10:16 am
Location: San Diego CA
Contact:

Re: Splitting headache

Post by Bill H »

I should mention, I joined AA about three years later.
Post Reply