[15:06] ***** Log started at 03:06 PM 03/06/2001
[15:06] *** Now talking in #topniche
[15:06] *** Topic is Buying Traffic on the Adult Net - we'll tell you everyting mon!
[15:06] *** Topic set by Snoops on Wed Feb 28 19:40:33 2001
[15:06] -HelpBot- Welcome to Topniche IRC Webmaster Chat. Webmasters only please!
[15:06] -HelpBot- Our url: http://www.weboverdrive.com/
[15:06] *** #topniche created on Sat Feb 24 11:11:57 2001
[15:07] *** TDavid [dontspam@206.133.238.Zr816=] has joined #topniche
[15:07] *** Itchy [itchmaster@24.70.215.xB93=] has joined #topniche
[15:07] *** Brujah [darksites@24.159.116.NR031=] has joined #topniche
[15:07] -> *HelpBot* op #topniche helpone
[15:07] * TDavid pounds on the walls ... yup we're here'
[15:07] *** HelpBot sets mode: +o FurBall
[15:08] *** FurBall sets mode: +o TDavid
[15:08] <Brujah> blah.. see why'd I think it was netsurprise channel ?
[15:08] *** Snikks [snikks@216.67.197.iV844=] has joined #topniche
[15:08] *** FurBall changes the topic to " :Week 4 Perl/CGI Class Tech Chat"
[15:08] *** TiBo [TiBoWeMa@172.147.250.cR62=] has joined #topniche
[15:08] *** WillyB [willyb@66.12.25.1y839=] has joined #topniche
[15:08] <WillyB> here we go :)
[15:08] <Snikks> 8))
[15:08] <FurBall> Ok... :)
[15:09] <TDavid> are the workshop logs rolling furball?
[15:09] <FurBall> Yes they are... (I think.. Let me go check. :))
[15:09] * TDavid wonders if it is like frame 234 in the zapruder film
[15:10] <TDavid> brujah - actually we did have tech chats in there on Tuesdays at noon during the PHP course
[15:10] <FurBall> Yup.. We are logging
[15:10] <Brujah> i got an icq msg said to meet TDavid in the netsurprise room. Sounded ominous.
[15:11] <TDavid> really?
[15:11] <FurBall> LOL...
[15:11] <FurBall> Yeah, the adult netsurprise ICQ went out
[15:11] <Brujah> lol yes, automatic i guess.
[15:11] *** FurBall changes the topic to " ::Week 4 Perl/CGI Class Tech Chat - This week, Logging"
[15:12] <FurBall> Ok... Are we ready?
[15:12] <WillyB> actually.. I think it's Kaiser behind the netsurprise icq
[15:12] <TDavid> yeah, kaiser rocks! :)
[15:12] <WillyB> nope.. I am not
[15:12] * FurBall thwaps WillyB...
[15:12] <WillyB> LOL
[15:12] <WillyB> ok ok.. I'm RDY :-))
[15:12] <TDavid> is this a loop is this a loop is this a loop
[15:13] <FurBall> This weeks tech chat is about looping... (or people driving you loopy)
[15:13] <WillyB> while willyb == bad; furball thwaps
[15:13] <WillyB> ;
[15:13] <WillyB> lol
[15:13] <FurBall> I see WillyB understands looping QUITE well... LOL Unfortunately, that's an example of an infinte loop... LOL
[15:13] <WillyB> rofl!
[15:14] <TDavid> http://www.webmastermatrix.com/tech/perl/week4.html
[15:14] <TDavid> also can be reached from:
[15:14] <TDavid> http://www.scriptschool.com/
[15:14] <TiBo> Spawn too many server processes WillyB and the server crashes. :(
[15:15] <TiBo> 'Sides, who wants to be thwaped on that many simultaneous connections?
[15:15] *** DrGuile [support@207.35.65.6i00=] has joined #topniche
[15:15] <WillyB> true TiBo
[15:15] <FurBall> Basically, there are 3 types of loops. The for loop, the while loop, and the do until loop.
[15:15] <WillyB> not me.. I'm being good now
[15:15] *** PhoneMistress [java@138.88.71.n105=] has joined #topniche
[15:16] <FurBall> The for loop is your basic counting loop... IE counting from 1 to 10 or from 50 down to 1 in steps of 5, etc.
[15:16] <DrGuile> ack! no! Basic programing!
[15:16] <FurBall> :)
[15:16] <TDavid> it has the iteration (counting) built into the execution line too
[15:16] <FurBall> A for loop looks like this:
[15:16] * DrGuile runs while screaming "Neeeeeeeever aaaaagain!"
[15:16] *** DrGuile has left #topniche
[15:17] <FurBall> for ($loop = 1; $loop <= 10; $loop += 1)
[15:17] <FurBall> {
[15:17] <FurBall> print "I am in step number $loop<br>";
[15:17] <FurBall> }
[15:18] <TDavid> poor drguile did not want to be caught in the loop it would seem
[15:18] <FurBall> On the first line, the $loop = 1 says that we are starting to count at 1.
[15:18] <FurBall> The $loop <=10 is our ending condition... We continue looping so long as our counter ($loop in this case) is less than or equal to 10.
[15:18] *** JP|HardcoreBox [JP@216.136.109.ZY382=] has joined #topniche
[15:19] <FurBall> And finally, the $loop += 1 increments our counter by 1 each time...
[15:19] <FurBall> If we didn't do this, we would have left dr guile stuck in an infinite loop... :)
[15:20] <FurBall> The code that is between the open curly brace '{' and the close curly brace '}' is the code that is executed each time through the loop.
[15:20] <FurBall> And that's about it to for loops. :)
[15:20] <TiBo> and don't increment by something that will never trigger your exitcond i.e. ($i=0;$i=10;$i+=7)
[15:20] <FurBall> Good point TiBo!!!
[15:21] <TDavid> you can also subsitute $i++ if you are only iterating by 1
[15:21] <TDavid> for($i=0; $i<=10; $i++) // same as for($i=0; $i<=10; $i+=1)
[15:21] <FurBall> Yes... :) $i ++ is a good shorthand for $i += 1
[15:22] <FurBall> So is $I-- a good shorthand for $I -= 1
[15:22] <TDavid> a shorter way of saying $i = $i +1; or $i = $i - 1;
[15:23] <FurBall> Any questions about for loops?
[15:23] <TDavid> programmers love shortcuts, like furball said last friday, we dont' like typing the same thing over and over again hehe
[15:23] <FurBall> Yup!
[15:23] <TDavid> redundancy must be avoided at all costs hehe
[15:23] <FurBall> *GROAN*
[15:23] <TiBo> I must be weird then.
[15:23] <TDavid> that is the basic premise behind a loop anyway. To avoid redundancy and streamline your code
[15:24] <FurBall> TiBo, we all KNOW you are weird... :D
[15:24] <TiBo> I still type out $Inc = $Inc + 1;
[15:24] <FurBall> Excellent point TDavid
[15:24] <TiBo> =)
[15:25] *** Abbyshewolf [louisewien@24.112.125.RU38=] has joined #topniche
[15:25] <TDavid> like if you needed to print all the nicks in this room, you could use 10 print statements or use a loop and print 1 time
[15:25] <FurBall> Welcome Abbyshewolf!
[15:25] <Abbyshewolf> Hi
[15:25] *** FurBall changes the topic to " :::Week 4 Perl/CGI Class Tech Chat - This week, Loopng"
[15:26] <FurBall> For loops are used a lot when it comes to arrays
[15:26] <TDavid> for($i=0; $i<10; $i++) { print "$nick[$i]<br>"; }
[15:26] <FurBall> Which we will get into next week... :)
[15:26] <FurBall> (but TDavid is providing an example of this week... :) )
[15:27] <TDavid> of course there is one for loop you didn't mention furball
[15:27] <TDavid> the foreach loop
[15:27] <FurBall> No, that we will talk about next week... :)
[15:27] <TDavid> which iterates through an array, i'm sure we'll get through that next week
[15:27] <FurBall> Yup.. It's a special case of the for loop...
[15:27] <FurBall> Any questions so far?
[15:27] <TDavid> does everybody understands what loops are for?
[15:28] <WillyB> nope.. you are a pretty thourough guy FurBall :)
[15:28] *** Abbyshewolf has quit IRC (QUIT: User exited)
[15:28] <FurBall> Hmm... Well... Either that's true WillyB or else I've put everyone to sleep... :)
[15:28] <WillyB> to avoid redundancy in code.. when you want things to happen more than once
[15:29] <TiBo> To eliminate redundancy so you don't have to type the same thing over and over again in order that you not repeat yourself and end up typing things only once?
[15:29] <FurBall> LOL
[15:29] <TDavid> and it streamlines your code, yup, TiBO :)
[15:29] <FurBall> Ok... The next type of loop is the while loop... It's similar to a for loop in concept... IE it loops over code many times.
[15:30] <FurBall> However, the for loop has a finite and known ahead of time end.
[15:30] <FurBall> IE the for loop will end after counting X times.
[15:30] <WillyB> and the while loop doesn't know when it will end
[15:30] <FurBall> The while loop on the other hand you do not know when exactly it will end...
[15:30] <FurBall> Here's a good example of a while loop which MIGHT take a LONG time to end... :)
[15:31] <TDavid> usually while a condition is true or false the loop continues
[15:31] <FurBall> While ($willyB == "bad")
[15:31] <FurBall> {
[15:31] <FurBall> Print "Willyb is VERY VERY BAD<br>";
[15:31] <FurBall> }
[15:31] <TiBo> wouldn't that be while (WillyB eq "bad") ?
[15:31] <TDavid> yikes, willyB is in a whirlpool!
[15:31] <FurBall> TiBO... You are correct!
[15:31] <TDavid> he may never get out!
[15:31] <FurBall> Sorry about that! :)
[15:32] <WillyB> lol
[15:32] <WillyB> $WillyB = good;
[15:32] <FurBall> There's a problem with this loop though...
[15:32] <TiBo> Ops, we are both wrong. How about while ($WillyB eq "bad)
[15:32] <FurBall> Which we will get into in a second...
[15:32] <WillyB> hmmm the <br> ?
[15:33] <TDavid> while($willyb eq "bad) { print "WillyB is really bad"; if(time()>999999998) { $willyb = "He'll be good in January 2029"; }
[15:33] <WillyB> lol
[15:33] <FurBall> The $WillyB == "bad" determines how long the while loop will run.. So long as that condition is true.. The while loop runs.
[15:34] <FurBall> Therefore, SOMEWHERE in the while loop, make sure to at some point, cause the logical expression to end...
[15:34] <FurBall> Otherwise, you've got an infinte loop...
[15:34] <TiBo> if ($WillyB_Gave_me_some_money == true) {$WillyB = "good";}
[15:34] * WillyB throws TiBo a quarter
[15:34] <TiBo> Put that inside your loop and you're set.
[15:34] <FurBall> So....what's the problem with that piece of code above? And rewrite it to fix the problem... :)
[15:35] <TDavid> furball think we should have willyB run that code in the background ... it would only have to run for 28 more years, that's a long while loop :)
[15:35] <FurBall> We've already determined that the first mistake was the == which should have been eq.
[15:35] <FurBall> lol@TDavid
[15:36] <FurBall> What is the other mistake with this while loop?
[15:36] <WillyB> eq is an operator?
[15:36] *** TDavid has quit IRC (Connection reset by peer)
[15:36] TDavid is offline
[15:36] <TiBo> eq is the string operator. == is the numeric operator.
[15:36] <FurBall> Yes... Did you do last week's lesson WillyB??? HMM??? :)
[15:36] *** Relik [4754@213.65.217.7Z51=] has joined #topniche
[15:36] *** TDavid [dontspam@206.133.235.Rw93=] has joined #topniche
[15:36] <Relik> heya guys
[15:36] *** FurBall sets mode: +o TDavid
[15:36] <WillyB> wb TDavid
[15:36] <TiBo> Not operator, comparison I mean.
[15:36] <FurBall> Welcome Relik
[15:36] <WillyB> ok
[15:36] <FurBall> W/b TDavid
[15:36] TDavid is online
[15:37] <TDavid> thx, what did i miss?
[15:37] <FurBall> What's the other mistake with the loop?
[15:37] <WillyB> no not yet FurBall... I have been trying to get my network back running correctly and doing all the other things I have to do to be able to come here each week and entertain everyone :)
[15:38] <FurBall> Ahh... :)
[15:38] <TiBo> WillyB, entertaining everyone here should be priority #1!
[15:38] <FurBall> Here's the code again... (with the eq fix)
[15:38] <TDavid> willyB you better get up to speed, aren't you teaching this in Chicago?
[15:38] <FurBall> While ($WillyB eq "Bad")
[15:38] <FurBall> {
[15:38] <FurBall> Print "WillyB is VERY VERY BAD!<br>";
[15:38] <FurBall> }
[15:39] <WillyB> you need to set $WillyB to something in the first place befor the loop FurBall
[15:39] <FurBall> Ok...
[15:39] <FurBall> Now, what if I hadn't?
[15:39] <TiBo> You have to put the thing in there where it assigns "good" to WillyB after he pays me enough.
[15:39] <FurBall> (that's not the problem I'm thinking of... :) though)
[15:39] <WillyB> hahaha TDavid.. only if you want a bunch of bad perl scripts loose on the net1
[15:39] <FurBall> Why TiBo?
[15:39] <TDavid> willyB is a built in environment variable, doesn't everybody know this?
[15:39] <FurBall> LOL@TDavid
[15:40] <WillyB> the would not have run even once FurBall
[15:40] <WillyB> the while loop that is
[15:40] <TDavid> good point willyB
[15:40] <FurBall> CORRECT WillyB! Now, why do I need to put TiBo's code in the while loop?
[15:40] <TiBo> It would have run because $WillyB would have been null.
[15:40] <WillyB> so it is not an infinate loop
[15:40] <TDavid> while(!$willyB eq "Bad") { blah blah }
[15:41] <FurBall> Correct again WillyB!
[15:41] <TiBo> Ops.
[15:41] <WillyB> :)
[15:41] <TDavid> oops perhaps like this instead without the assignment first
[15:41] <TDavid> while($willyB ne "Bad") { blah blah }
[15:41] <TiBo> You guys are right. I forgot that perl doesn't already know WillyB is bad when it starts.
[15:41] <FurBall> Ok.. So... We had an infinite loop BUT... It would not have run if the logical expression in the while loop (in this case $WillyB eq "Bad") was false.
[15:42] <TDavid> you know this is a great point because this can be a security hazard in some ways
[15:42] <FurBall> This is the MAIN difference between a while loop and a do until loop.
[15:42] <TiBo> That might be a flaw in Perl. We should tell Larry to let Perl know that WillyB is bad automatically.
[15:42] <FurBall> lol@TiBo...
[15:42] <FurBall> Nah... We'll just write a perl module...
[15:42] *** WillyB is now known as Willy_B
[15:42] <Willy_B> :)
[15:42] <FurBall> WillyB::Bad
[15:42] <TDavid> if willyB's value is being passed through say the query string and we wanted a while loop to iterate on it, we'd want to set to a specific value first
[15:42] <Willy_B> there.. problem solved hehehhe
[15:43] WillyB is offline
[15:43] <FurBall> TDavid, EXCELLENT point!!!!
[15:43] <FurBall> Any questions so far about while loops?
[15:43] <TDavid> willyb.cgi?willyb=Bad
[15:43] <Willy_B> you lost me TDavid
[15:44] <TDavid> query string is after the question mark
[15:44] <Willy_B> if you set it in a query string and in the script.. which would it be when it got to the loop?
[15:44] <TiBo> Gotta run to the bank. Later y'all.
[15:44] <TDavid> perl will convert this in the parsing to $ENV{'willyb'} .. so if you said $willyb= $ENV{'willyb'} the value would be "bad"
[15:44] <FurBall> Cya TiBo
[15:44] <Willy_B> see ya TiBo
[15:44] <Willy_B> watch out for cars
[15:44] *** TiBo is now known as TiBo-away
[15:45] <PhoneMistress> There is not a null set?
[15:46] <FurBall> If I understand you correctly PhoneMistress, no there isn't.
[15:46] <TDavid> cya tiBo
[15:46] <Willy_B> pl
[15:46] <Willy_B> ok
[15:46] <TDavid> this is how some hackers penetrate scripts and manipulate them
[15:46] <PhoneMistress> ok
[15:46] <FurBall> PhoneMistress what do you mean by null set?
[15:46] <TDavid> and one good reason to pass variables hidden or via cookies encrypted
[15:47] <TDavid> but if you do what Furball said and always initialize the variable before using, you won't have to worry about it
[15:47] <TDavid> i seem to recall we had a pretty long discussion about this during the PHP course in one of the chats
[15:47] <PhoneMistress> I thought the string would run as oppose to not running at all. I"m set now
[15:47] <FurBall> Yup... :)
[15:48] <FurBall> Any other questions on while loops?
[15:48] <TDavid> so key points furball. 1. make sure you initialize variable before using. 2. make sure there is an exit point inside the while loop.
[15:49] <FurBall> Thank you TDavid! :)
[15:49] <FurBall> Ok.... Then, let's look at the third type of loop...
[15:49] <FurBall> It's called a do - until loop... It's VERY similar to the while loop.
[15:50] <FurBall> However, it's one difference is that rather than checking to see if the loop should end at the beginning of the loop, it checks to it at the end.
[15:50] <FurBall> And here's what it looks like:
[15:50] <FurBall> do
[15:50] <FurBall> {
[15:50] <FurBall> print "WillyB is VERY VERY BAD<br>";
[15:50] <FurBall> $WillyB = "Good";
[15:51] <FurBall> } until $WillyB eq "Good";
[15:51] <TDavid> This is how you make sure the loop always has at least 1 iteration
[15:51] <FurBall> Even if we had set $WillyB to Good BEFORE the loop had ever started, it will run at LEAST once...
[15:52] <Willy_B> ok
[15:52] <Willy_B> that makes since
[15:52] <Willy_B> do - until will Always run once
[15:52] <FurBall> Yes....
[15:52] <Willy_B> at least
[15:52] <Willy_B> and tests the condition after it is run instead of before it is rn
[15:53] <FurBall> And that is it to loops...
[15:53] <TDavid> you are ready to teach WillyB in chicago!!! :)
[15:53] <Willy_B> LOL
[15:53] <FurBall> Correct WillyB. :) Go teach go! :)
[15:53] * TDavid looks for Kaiser and PD's phone number
[15:53] <FurBall> LOL
[15:53] <Willy_B> FurBall and TDavid will be in Chicago too???
[15:53] <FurBall> Nope... AZ...
[15:53] <Willy_B> I need moral support and maybe even physical support LOL
[15:53] * TDavid TDavid will not be in Chicago, but will be in Portland :)
[15:54] <Willy_B> :(
[15:54] <FurBall> Any questions about loops and looping?
[15:54] <Willy_B> Kaiser's phone is dead
[15:54] <Willy_B> so is PD's phone.. sorry TD hehehhee
[15:55] <TDavid> hehe :)
[15:55] <Willy_B> they will be fixed on march 19th though
[15:55] <Willy_B> :))
[15:55] <FurBall> LOL
[15:55] <TDavid> furball which do you prefer most of the time?
[15:55] <FurBall> Normally, I use a while loops
[15:55] <FurBall> Except when I'm dealing with arrays in which case I normally use for loops...
[15:56] <TDavid> i seem to use for() loops more than while loops because in long branches of code it can get difficult to know where to put the incrementing
[15:56] <Willy_B> it seems to me that there is one loop that works best for a given situation
[15:56] <FurBall> However, sometimes it makes more sense to use the do until...
[15:56] <FurBall> Willy_B, correct...
[15:56] <FurBall> (hey! I can do _'s now! YAH! :) )
[15:56] <TDavid> yes, that is absolutely correct, WillyB :)
[15:57] <TDavid> what was the story there furball with those missing underscores?
[15:57] <FurBall> I'm on a different IRC client now so... :D
[15:57] <FurBall> It works...
[15:57] <TDavid> im on a different machine .. yikes Windows ME is a different animal!
[15:57] <Willy_B> are you on a windows machine FurBall?
[15:57] <FurBall> Before I was running an addon to mirc called emicron which took OUT the _'s and replaced em with spaces. :(
[15:57] <FurBall> Yup!
[15:58] <TDavid> keeps making all kinds of noise, i'm going to have to go shut down all these preinstalled audio apps
[15:58] <FurBall> My IRC client is called dirc... www.dircchat.com.
[15:58] <FurBall> lol@TDavid
[15:58] <FurBall> The neat thing about dirc is that I can write scripts for it in vbscript, jscript, or even perl!
[15:58] <Willy_B> hmmm... I've always used mIRC
[15:58] <TDavid> this wizard guy keeps coming out of screen and trying to tell me what to do
[15:58] <TDavid> i'm going to nuke the wizard and take screen shots hehe
[15:58] <Willy_B> now I have ShowDowN pro added on to it
[15:58] <PhoneMistress> are the tech chats archived?
[15:58] <FurBall> Yes they are PhoneMistress
[15:58] <TDavid> yes, pm :)
[15:58] <Willy_B> rofl TDavid!
[15:59] <FurBall> Willy_B, I tried ShowDown pro... Didn't really like it...
[15:59] <Willy_B> I am still not used to to FurBall... I'll have to check out dIRC