This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Webmaster forum > August 2006 > Just admit it





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Just admit it
Karl Groves

2006-08-17, 6:41 am

Who doesn't love a good ole infinite loop every so often?
Nothing like chasing one down for 90 minutes to keep your brain sharp.

--
Karl Groves
www.karlcore.com
Blinky the Shark

2006-08-17, 6:41 am

Karl Groves wrote:
> Who doesn't love a good ole infinite loop every so often?
> Nothing like chasing one down for 90 minutes to keep your brain sharp.


Not me. <twitch> Not me. <twitch> Not me. <twitch> Not me. <twitch> Not
me. <twitch> Not me. <twitch> Not me. <twitch> Not me. <twiNO CARRIER

MGW

2006-08-17, 6:41 am

On 17 Aug 2006 05:31:27 GMT, Blinky the Shark <no.spam@box.invalid>
scrawled:

> Karl Groves wrote:
>
> Not me. <twitch> Not me. <twitch> Not me. <twitch> Not me. <twitch> Not
> me. <twitch> Not me. <twitch> Not me. <twitch> Not me. <twiNO CARRIER


Lather
Rinse
Repeat

--
MGW (Note: my Hotmail address is seldom checked)
Hofstadter's Law: It always takes longer than you expect, even
when you take into account Hofstadter's Law. - Douglas Hofstadter
Jamie

2006-08-17, 6:41 am

In <Xns98227AC53F3Akarlkarlcorecom@216.196.97.136>,
Karl Groves <karl@NOSPAMkarlcore.com> mentions:
>Who doesn't love a good ole infinite loop every so often?
>Nothing like chasing one down for 90 minutes to keep your brain sharp.


Not quite as fun as recursive subroutines that consume all available resources
(because you don't have limits set for yourself) making it impossible to
actually access the computer and shut down the program.

But..

It's a close second. :-)

Jamie
--
http://www.geniegate.com Custom web programming
guhzo_42@lnubb.pbz (rot13) User Management Solutions
Toby Inkster

2006-08-17, 6:41 am

Karl Groves wrote:

> Who doesn't love a good ole infinite loop every so often?
> Nothing like chasing one down for 90 minutes to keep your brain sharp.


I'm currently writing a simple scripting language, with the interpreter in
PHP. I've run into several of these. :-(

(It's usually a typo in the tokeniser which ends up confusing the parser.)

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

SpaceGirl

2006-08-17, 6:41 am


Karl Groves wrote:
> Who doesn't love a good ole infinite loop every so often?
> Nothing like chasing one down for 90 minutes to keep your brain sharp.
>
> --
> Karl Groves
> www.karlcore.com


uh huh. I do this one more often than I want to admit in ASP... I
always forget to increment the array...

do while not data.oef
name=data("name")
response.write(name)
loop


....now without a data.movenext, that would completely lock the ASP
server for about 30 seconds! :s

Phil Payne

2006-08-17, 6:41 am

> Not quite as fun as recursive subroutines that consume all available resources
> (because you don't have limits set for yourself) making it impossible to
> actually access the computer and shut down the program.


Ah. One well remembers the time when IBM shipped their very first
dual-processor in history. And it is way back in history.

For the first time you could watch one of these swines completely
sucking up a processor and blocking you out - and _NAIL_ the little
bastard from the other processor!

Ah - the satisfaction!

Charles Sweeney

2006-08-17, 6:41 am

Karl Groves wrote

> Who doesn't love a good ole infinite loop every so often?
> Nothing like chasing one down for 90 minutes to keep your brain sharp.


lol! I don't recall having an ifinite one (that I'm aware of) but only
yesterday I was messing around with a mysql query. I was expecting about
100 results, but the script kept on chugging away and eventually gave me
about 55,000! (A little bit rusty with my syntax when joining tables.)

Doesn't the timeout setting in PHP stop runaway scripts?

--
Charles Sweeney
http://CharlesSweeney.com
Karl Groves

2006-08-17, 6:47 pm

"SpaceGirl" <nothespacegirlspam@subhuman.net> wrote in
news:1155803381.384527.165320@p79g2000cwp.googlegroups.com:

>
> Karl Groves wrote:
>
> uh huh. I do this one more often than I want to admit in ASP... I
> always forget to increment the array...
>


Yup, that is pretty much what I did in PHP.

foo=0;

while(foo <= bar){do stuff;}

Well of course foo was always less than or equal to bar because foo was set
to zero and I never incremented it.

It is usually always these little dumb errors that take up the most time
chasing them down.


--
Karl Groves
www.karlcore.com
CJM

2006-08-17, 6:47 pm


"SpaceGirl" <nothespacegirlspam@subhuman.net> wrote in message
news:1155803381.384527.165320@p79g2000cwp.googlegroups.com...
>
> uh huh. I do this one more often than I want to admit in ASP... I
> always forget to increment the array...
>


I normally do it when iterating through a recordset.

I forget the .movenext instruction and then wonder why my otherwise simple
query is taking 15 mins to complete...

CJM


CJM

2006-08-17, 6:47 pm


"Charles Sweeney" <me@charlessweeney.com> wrote in message
news:Xns98226DC509C62mecharlessweeneycom@130.133.1.4...

> Doesn't the timeout setting in PHP stop runaway scripts?
>


Timeouts are a double-edged sword. Set them too low and you are in equal
trouble. As soon as you lower them, you come across a script that just needs
to run that bit longer.

CJM


William Tasso

2006-08-17, 6:47 pm

Fleeing from the madness of the jungle
Karl Groves <karl@NOSPAMkarlcore.com> stumbled into news:alt.www.webmast=
er
and said:

> "SpaceGirl" <nothespacegirlspam@subhuman.net> wrote in
> news:1155803381.384527.165320@p79g2000cwp.googlegroups.com:
p.[color=darkred]
>
> Yup, that is pretty much what I did in PHP.
>
> foo=3D0;
>
> while(foo <=3D bar){do stuff;}
>
> Well of course foo was always less than or equal to bar because foo wa=

s =

> set
> to zero and I never incremented it.



Well I can honestly say that I've been making these same 'errors' for ma=
ny =

years and it's about time the goddamn compilers/interpreters started to =
=

learn. Along with common typos and an inability to remember which order=
=

the parameters are needed in instr() for any given implementation.

> It is usually always these little dumb errors that take up the most ti=

me
> chasing them down.


oh no - I usually know within nano-seconds <g>
-- =

William Tasso

http://williamtasso.com/words/what-is-usenet.asp
Jerry Stuckle

2006-08-17, 6:47 pm

Jamie wrote:
> In <Xns98227AC53F3Akarlkarlcorecom@216.196.97.136>,
> Karl Groves <karl@NOSPAMkarlcore.com> mentions:
>
>
>
> Not quite as fun as recursive subroutines that consume all available resources
> (because you don't have limits set for yourself) making it impossible to
> actually access the computer and shut down the program.
>
> But..
>
> It's a close second. :-)
>
> Jamie


Hee hee... Just did that one (again) yesterday :-)

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
mbstevens

2006-08-17, 6:47 pm

On Wed, 16 Aug 2006 23:45:16 -0500, Karl Groves wrote:

> Who doesn't love a good ole infinite loop every so often?
> Nothing like chasing one down for 90 minutes to keep your brain sharp.


The only cure is to switch to a language that does lazy evaluation.
;)

Haskel anyone?

GreyWyvern

2006-08-17, 6:47 pm

And lo, Charles Sweeney didst speak in alt.www.webmaster:

> Karl Groves wrote
>
>
> lol! I don't recall having an ifinite one (that I'm aware of) but only
> yesterday I was messing around with a mysql query. I was expecting about
> 100 results, but the script kept on chugging away and eventually gave me
> about 55,000! (A little bit rusty with my syntax when joining tables.)


Once, whilst testing a small PHP script which would email me when certain
errors occurred at my website, a small mistake in loop syntax resulted in
me spamming myself with 5,000 emails in the space of five minutes.

Luckily my mailbox is on the same network as my website, so the messages
didn't go out over the internet, but my host got a kick out of it when I
told them. Mailwasher even died a few times while I tried to delete them
from the server.

Grey

--
The technical axiom that nothing is impossible sinisterly implies the
pitfall corollary that nothing is ridiculous.
- http://www.greywyvern.com/orca#search - Orca Search: Full-featured
spider and site-search engine
nj_dilettante

2006-08-17, 6:47 pm

Karl Groves wrote:
> Who doesn't love a good ole infinite loop every so often?
> Nothing like chasing one down for 90 minutes to keep your brain sharp.


Back in the 70's when IBM's OS for mainframes wasn't too robust and I was a
very young programmer, I did my first bubble sort on Johnson & Johnson's
mainframe - it didn't stop until it sorted the operating system! And they
didn't fire me!

--
nj_dilettante
in the words of the immortal Sgt Schultz:
~~ I know NOTH-THING ~~


GreyWyvern

2006-08-17, 6:47 pm

And lo, Karl Groves didst speak in alt.www.webmaster:

> Who doesn't love a good ole infinite loop every so often?
> Nothing like chasing one down for 90 minutes to keep your brain sharp.=



My favourite (and I do this all the time) is when I decide to switch the=
=

direction of a for loop for some reason. Often I will forget to change =
=

the increment operator to a decrement, or vice versa. What this means i=
s =

that the syntax looks fine, but the ending condition will never happen. =
=

Something like:

for ($x =3D count($array) - 1; $x >=3D 0; $x++) {
...
}

Grey

-- =

The technical axiom that nothing is impossible sinisterly implies the =

pitfall corollary that nothing is ridiculous.
- http://www.greywyvern.com/orca#search - Orca Search: Full-featured =

spider and site-search engine
SpaceGirl

2006-08-17, 6:47 pm


GreyWyvern wrote:
> And lo, Karl Groves didst speak in alt.www.webmaster:
>
>
> My favourite (and I do this all the time) is when I decide to switch the
> direction of a for loop for some reason. Often I will forget to change
> the increment operator to a decrement, or vice versa. What this means is
> that the syntax looks fine, but the ending condition will never happen.
> Something like:
>
> for ($x = count($array) - 1; $x >= 0; $x++) {
> ...
> }


Hmm I do that too. I mostly get confused when switch between languages.
ActionScript, which is super-duper sexy obejct based, and ASP VBS and
PHP which are lame, and .net which is great... *sigh*

AS2 loop:

for (var i:Number=1; i < someObject.property; i++) { //do something }

MGW

2006-08-17, 6:47 pm

On Thu, 17 Aug 2006 13:47:55 +0100, "William Tasso"
<SpamBlocked@tbdata.com> scrawled:

> Fleeing from the madness of the jungle
> Karl Groves <karl@NOSPAMkarlcore.com> stumbled into news:alt.www.webmaster
> and said:
>
>
>
> Well I can honestly say that I've been making these same 'errors' for many
> years and it's about time the goddamn compilers/interpreters started to
> learn. Along with common typos and an inability to remember which order
> the parameters are needed in instr() for any given implementation.
>
>
> oh no - I usually know within nano-seconds <g>


I find the best way to find them is to ask someone for help. Not that
I get the help from them - it's that as soon as I start trying to
explain the problem, the bad code leaps out at me and I get to stammer
red-faced with embarassment "Oh, never mind, I found it." It's faster
than the other way, but harder on the ego ;-)

--
MGW (Note: my Hotmail address is seldom checked)
Hofstadter's Law: It always takes longer than you expect, even
when you take into account Hofstadter's Law. - Douglas Hofstadter
CJM

2006-08-17, 6:47 pm


"MGW" <mgw1979@hotmail.com> wrote in message
news:ae29e2p4a1vanedd5q9dhp02sel9v7k8o7@4ax.com...
>
> I find the best way to find them is to ask someone for help. Not that
> I get the help from them - it's that as soon as I start trying to
> explain the problem, the bad code leaps out at me and I get to stammer
> red-faced with embarassment "Oh, never mind, I found it." It's faster
> than the other way, but harder on the ego ;-)
>


You explain the problem, but then spot the glaring noob error that you've
made, so you say 'Never Mind...', but by then they have had their interest
piqued, so they want to know what the solution was. So you either have to
confess to being an idiot or waste even more time & effort inventing a fake
face-saving solution.

Ahem... so I've been told, anyway.

Chris


Toby Inkster

2006-08-17, 6:47 pm

mbstevens wrote:

> Haskel anyone?


Haskell is lovely for rapid prototyping of algorithms, but it's rather
weak on I/O, so can't really compete as a general purpose programming
language.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

mbstevens

2006-08-17, 6:48 pm

On Thu, 17 Aug 2006 17:35:31 +0100, Toby Inkster wrote:

> mbstevens wrote:
>
>
> Haskell is lovely for rapid prototyping of algorithms, but it's rather
> weak on I/O, so can't really compete as a general purpose programming
> language.


That's ok. I love to prototype.

There's also
http://www.gnu.org/software/guile/guile.html




Charles Sweeney

2006-08-17, 6:48 pm

GreyWyvern wrote

> And lo, Charles Sweeney didst speak in alt.www.webmaster:
>
>
> Once, whilst testing a small PHP script which would email me when
> certain errors occurred at my website, a small mistake in loop syntax
> resulted in me spamming myself with 5,000 emails in the space of five
> minutes.
>
> Luckily my mailbox is on the same network as my website, so the
> messages didn't go out over the internet, but my host got a kick out
> of it when I told them. Mailwasher even died a few times while I
> tried to delete them
> from the server.


LOL!

I did a similar thing. The trouble is, it went out to customers!

I had a script for emailing. I made an option on it to send only me an
email for testing, or send the mail to the list. I was testing it, but
hadn't set it to send the email just to me, so it went out to the list!

I ended up sending several like "ljhk lkjlk"

In fact it was documented in here. What got me was the reaction of some
people. You could clearly see it was a mistake.

--
Charles Sweeney
http://CharlesSweeney.com
Ken Sims

2006-08-17, 6:48 pm

Hi -

On Thu, 17 Aug 2006 11:24:17 -0400, MGW <mgw1979@hotmail.com> wrote:

>I find the best way to find them is to ask someone for help. Not that
>I get the help from them - it's that as soon as I start trying to
>explain the problem, the bad code leaps out at me and I get to stammer
>red-faced with embarassment "Oh, never mind, I found it." It's faster
>than the other way, but harder on the ego ;-)


I find it helpful to explain the situation to an imaginary person
first. If doing it silently, I still speak the complete sentences in
my head just as if I were speaking out loud to a real person.

If it doesn't jump out at me, then it's time to get a real person who
can not only listen to the problem but also actually look at the code.

--
Ken
http://www.kensims.net/
MGW

2006-08-17, 6:48 pm

On Thu, 17 Aug 2006 13:46:57 -0700, Ken Sims
<ng3122@kensims.#nospam#.net.invalid> scrawled:

> Hi -
>
> On Thu, 17 Aug 2006 11:24:17 -0400, MGW <mgw1979@hotmail.com> wrote:
>
>
> I find it helpful to explain the situation to an imaginary person
> first. If doing it silently, I still speak the complete sentences in
> my head just as if I were speaking out loud to a real person.
>
> If it doesn't jump out at me, then it's time to get a real person who
> can not only listen to the problem but also actually look at the code.


You don't understand - it's the embarassment factor that triggers
finding the error. Talking to myself doesn't give me that. And I've
almost never (since first learning to program, that is) gotten to the
point where the person actually looked at the code.

--
MGW (Note: my Hotmail address is seldom checked)
Hofstadter's Law: It always takes longer than you expect, even
when you take into account Hofstadter's Law. - Douglas Hofstadter
Karl Groves

2006-08-17, 6:48 pm

MGW <mgw1979@hotmail.com> wrote in
news:ae29e2p4a1vanedd5q9dhp02sel9v7k8o7@4ax.com:

>
> I find the best way to find them is to ask someone for help. Not that
> I get the help from them - it's that as soon as I start trying to
> explain the problem, the bad code leaps out at me and I get to stammer
> red-faced with embarassment "Oh, never mind, I found it." It's faster
> than the other way, but harder on the ego ;-)
>


Too true. I was halfway through a post to comp.lang.php when this one
jumped out at me.

--
Karl Groves
www.karlcore.com
Charles Sweeney

2006-08-17, 10:39 pm

Ken Sims wrote

> Hi -
>
> On Thu, 17 Aug 2006 11:24:17 -0400, MGW <mgw1979@hotmail.com> wrote:
>
>
> I find it helpful to explain the situation to an imaginary person
> first. If doing it silently, I still speak the complete sentences in
> my head just as if I were speaking out loud to a real person.


It wouldn't be the first time I had started to write out a post here, when
the very act of writing and explaining the problem produces the answer!

--
Charles Sweeney
http://CharlesSweeney.com
CJM

2006-08-18, 6:39 am


"Charles Sweeney" <me@charlessweeney.com> wrote in message
news:Xns982356ED7C4Dmecharlessweeneycom@130.133.1.4...

>
> It wouldn't be the first time I had started to write out a post here, when
> the very act of writing and explaining the problem produces the answer!
>


I find that *a lot* too. I decide I'm stuck so I start to write the post,
but the act of explaining the problem succinctly often reveals the solution.

One one occasion, although I figured out the problem, I made my post anyway
because I figured it was novel enough to be interesting (I hoped).


Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews