[14:46] ***** Log started at 02:46 PM 03/13/2001
[14:46] *** Now talking in #topniche
[14:46] *** Topic is ::Week 4 Perl/CGI Class Tech Chat - This week, Loopng
[14:46] *** Topic set by HelpBot on Mon Mar 12 02:15:37 2001
[14:46] -HelpBot- Welcome to Topniche IRC Webmaster Chat. Webmasters only please!
[14:46] -HelpBot- Our url: http://www.weboverdrive.com/
[14:46] *** #topniche created on Mon Mar 12 02:14:37 2001
[14:47] -> *helpbot* helpone
[14:47] -HelpBot- Valid commands are identify, invite, and op
[14:47] -> *HelpBot* op #topniche helpone
[14:47] *** HelpBot sets mode: +o FurBall
[14:49] *** FurBall changes the topic to " :Week 5 Perl/CGI Class Tech Chat - This week, Arrays and Advanced Looping"
[14:56] *** Itchy [itchmaster@24.70.215.Yr38=] has joined #topniche
[14:57] *** FurBall sets mode: +v Itchy
[14:57] <FurBall> Afternoon Itchy!
[14:57] <Itchy> FurBall :o) What time is class today?
[14:57] <FurBall> 3 PM
[14:57] <FurBall> In about 5 minute.
[14:57] <Itchy> Est
[14:57] <FurBall> yup
[14:57] <Itchy> cool hehe'
[14:58] <Itchy> check out my cry for help???? hehe
[14:58] <FurBall> :)
[14:58] <FurBall> Not yet... Sorry. :(
[14:58] <FurBall> I'll go over there now..
[14:58] <Itchy> then look at what i was able to do after reading a script hehe
[14:59] <FurBall> K
[15:01] <FurBall> Ahh... I see the problem...
[15:01] <FurBall> You get a 500 error yes?
[15:01] <Itchy> yup
[15:02] <FurBall> Ok...
[15:02] <Itchy> i'm missing something and i bet it's small
[15:02] <FurBall> The 10 second summary... Get rid of this line: $#array_var
[15:02] <FurBall> And this line: $array_var[$index_num]
[15:02] <FurBall> You don't need them.
[15:03] <Itchy> ok they be gone in sec here
[15:03] <FurBall> k
[15:05] <Itchy> $index_num = 0;
[15:05] <Itchy> that one stays ?
[15:06] <FurBall> No
[15:06] <FurBall> It's not really doing anything there.
[15:06] <FurBall> But that's not what is causing your problems...
[15:07] <Itchy> someting else ;O( ?
[15:07] <FurBall> nope
[15:07] <FurBall> Those 2 lines I showed you above are it.
[15:07] <Itchy> ok all are gone and still 500
[15:08] <FurBall> Hmmm
[15:09] <FurBall> What's the URL to the script itself? And can you upload a new version of the script as .txt?
[15:09] <Itchy> ok will do that right now
[15:12] <Itchy> http://www.assfrenzies.com/cgi-bin/scriptschool/week5.cgi
[15:12] <Itchy> http://www.assfrenzies.com/scriptschool/week5.txt
[15:12] <FurBall> K.. Let me go look again
[15:13] <Itchy> http://www.assfrenzies.com/cgi-bin/scriptschool/server.cgi for looking at the paths I guess somethiing i loaded
[15:14] <FurBall> Hmm...
[15:14] <FurBall> I see the problem....
[15:14] <FurBall> You have < = . Change that to <= and see if it works.
[15:14] <Itchy> no space
[15:15] <FurBall> correct
[15:15] <FurBall> No space
[15:15] <Itchy> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxaalentttttttt
[15:16] <FurBall> :)
[15:16] <FurBall> Did you write that server.cgi yourself by the way?
[15:16] <Itchy> nope it was on a cgi site
[15:16] <FurBall> Hmmm... Interesting...
[15:16] <FurBall> Ok....
[15:16] <Itchy> oohoh whats that mean ?? hehe
[15:17] <FurBall> So do you understand arrays? :)
[15:17] <Itchy> some what better now :O)
[15:17] <FurBall> Ok..
[15:17] <FurBall> Now, rewrite your script using the foreach statement. :)
[15:17] <Itchy> that space had me going in circles
[15:17] <FurBall> :)
[15:17] <Itchy> ok
[15:18] <FurBall> Remember on that, ALL of the operators do NOT allow spaces in between them.
[15:19] <Itchy> Lesson is well learned most times you just have to tell me once hehe <= >= != hehe
[15:19] <FurBall> :)
[15:19] <FurBall> Have you rewritten it yet with the foreach statement?
[15:19] <FurBall> :)
[15:20] <Itchy> ooo yea hehe did you look at this one :o) http://www.assfrenzies.com/cgi-bin/scriptschool/mysites.cgi
[15:20] <FurBall> Yes I did... I LIKED that one!
[15:20] <Itchy> See if i can see the code i can ripp it and put it back together and learn too hrehe
[15:21] <FurBall> :)
[15:23] <Itchy> Joe is next door is it here or in scriptschool?
[15:23] <FurBall> Do you have any questions about arrays or the foreach statement?
[15:23] <FurBall> (What do you mean?)
[15:24] <Itchy> class is in topniche or scriptschool
[15:24] <FurBall> Class is in topniche.
[15:26] <Itchy> the foreach all i could see was it made the 31 boxs when like this
[15:26] <Itchy> print start_form;
[15:26] <Itchy> foreach (1..31)
[15:26] <FurBall> That's one way of using a foreach...
[15:26] <FurBall> It's a shorthand for (for $loop = 1 ; $loop <= 31; $loop ++) ...
[15:27] <FurBall> The other way to use it is to replace your for loop in your week5.cgi.
[15:27] <FurBall> You say this: for ($loop = 0; $loop < = $#urls; $loop ++) { print ("$urls[$loop]
[15:27] <FurBall> "); }
[15:28] <FurBall> You could replace it with this:
[15:28] <FurBall> Foreach my $url (@urls)
[15:28] <FurBall> {
[15:28] <FurBall> Print "$url<br>";
[15:28] <FurBall> }
[15:28] <FurBall> It's a little bit shorter than your for loop.
[15:29] <Itchy> lot shorter
[15:29] <FurBall> Yup...
[15:29] <Itchy> does capital letters matter?
[15:29] <FurBall> And a little bit cleaner to read too...
[15:29] <FurBall> Umm.. The foreach and the print shouldn't have been capped.. sorry
[15:30] <FurBall> So no they don't. :)
[15:30] <Itchy> so what ever you name your @home it will always become $home
[15:30] <Itchy> well more like $home(@home)
[15:31] <FurBall> No...
[15:31] <Itchy> no......
[15:31] <FurBall> You HAVE to use 2 different variable.s
[15:32] <FurBall> If you have an array of @home, $home has no value.
[15:32] <FurBall> And it can get VERY confusing if you have @home and $home in the same script.
[15:33] <FurBall> Let me rewrite that foreach script.
[15:33] <FurBall> foreach my $url_to_print (@urls)
[15:33] <FurBall> {
[15:33] <FurBall> print "$url_to_print<br>";
[15:33] <FurBall> }
[15:33] <FurBall> Does that make more sense?
[15:34] <Itchy> ok in the foreach you told the $url_to_print that it was to get it's $ from @home right ?
[15:34] <FurBall> Yes..
[15:34] <Itchy> ok that works
[15:34] <FurBall> What happens is that the foreach loops over the array @url and then assigns each value of the array into $url_to_print.
[15:35] <FurBall> So the first time through, it's $urls[0]. The next time through, $urls[1], etc.
[15:35] <Itchy> [0] = the first thing in the array
[15:35] <FurBall> Yup.
[15:35] <Itchy> everything starts at 0 just about then
[15:36] <FurBall> Normally they do.
[15:36] <FurBall> They DON'T have to though.
[15:36] <Itchy> always thought 1 was the starting point hehe
[15:36] <FurBall> Computers always start at 0. :)
[15:36] <FurBall> Now, are you ready to have your mind blown away? :)
[15:36] <Itchy> ok..........
[15:37] <FurBall> I can make that foreach statement even shorter... :)
[15:37] <FurBall> foreach (@urls)
[15:37] <FurBall> {
[15:37] <FurBall> print "$_<br>";
[15:37] <FurBall> }
[15:37] <FurBall> What I did here is used a "trick" of perl...
[15:37] <FurBall> Perl has a special variable called $_.
[15:37] <Itchy> thats where that $_ comes in
[15:37] <FurBall> Yup!
[15:38] <FurBall> MANY of the statements and functions use $_ as a "default" variable.
[15:38] <FurBall> I haven't gotten into this in the class and I don't think that I will either...
[15:38] <Itchy> hehehe can see why
[15:38] <FurBall> But... If you understand $_ then it helps you code immensly...
[15:39] <Itchy> that can be used several times in one code and mean different things then right ?
[15:39] <FurBall> Yup!
[15:39] <Itchy> $_
[15:40] <Itchy> you just tell it where to get it's $_ just before you use it then
[15:40] <FurBall> And if you didn't want to have a line break between each element of the array, you could have just said on the print statement:
[15:40] <FurBall> print
[15:40] <FurBall> Yes and no...
[15:40] <FurBall> Sometimes, a function will set $_ to a value...
[15:40] <FurBall> So it might not contain the value you're expecting...
[15:41] <Itchy> so it can be used freely but carefully at the same time
[15:41] <FurBall> Yes...
[15:41] <FurBall> :)
[15:42] <FurBall> Read up on the docs of a function when you go to use it and it will tell you how it will affect $_.
[15:42] <Itchy> Mannnnnnnn I love these one on one sessions thing sink in better hehe
[15:42] <FurBall> :)
[15:42] <FurBall> Yes, if more people were here, I wouldn't have delved into $_ at all.. :)
[15:43] <Itchy> doc thats like at perl.com when I'm looking for what a array is and you get a page that explains it and then kinda shows you how it works ?
[15:44] <FurBall> Yup.. Sorry, docs is short for documentation...
[15:44] <FurBall> Oh and for more reading on $_, go here: http://www.perl.com/pub/doc/manual/html/pod/perlvar.html
[15:45] <Itchy> hehe :O) I've been here reading it's a bit of a confuseing site at the same time too
[15:45] <FurBall> Yeah, I know... ;)
[15:46] <FurBall> What you might want to do if you can, is get the O'reilly books on Perl.
[15:46] <Itchy> will have to go to libarby for that :O)
[15:46] <Itchy> And Flash is starting to make more sence to mee now
[15:46] <FurBall> The Learning Perl and the Programming Perl books.
[15:46] <FurBall> Kewl!!
[15:47] <FurBall> Get the 2nd edition of learning perl and the 3rd edition of programming perl.
[15:47] <Itchy> the if else was burning me before but know i kinda know what they do so it's getting easier
[15:47] <FurBall> Good... :)
[15:48] <FurBall> And THEN after those 2 books, get as many from here as you want: http://perl.oreilly.com/
[15:48] <FurBall> :)
[15:48] <FurBall> They have just a few books... LOL
[15:49] <Itchy> how do i put the count down clock into a cgi script? so it shows on the same page that is printing our assignments
[15:49] <Itchy> is that a little ways out yet ?
[15:50] <FurBall> Umm... Which countdown clock?
[15:50] <FurBall> The one on scriptschool?
[15:50] <Itchy> yup :O)
[15:51] <FurBall> Ahh.. He's doing it via javascript...
[15:51] <FurBall> :)
[15:51] <FurBall> What you would have to do is use print statements to print out the javascript code.
[15:51] <Itchy> harder ?
[15:51] <FurBall> Nope...
[15:51] <Itchy> statments?? not just one
[15:52] <FurBall> Well, you could use 1... :)
[15:52] <FurBall> That brings up something else I wasn't going to mention...
[15:52] <Itchy> see true programer
[15:52] <FurBall> Ready for another mind blowing experience? :)
[15:52] <Itchy> yup
[15:52] <FurBall> OK....
[15:52] <FurBall> Say you have 5 print statements like this:
[15:52] <FurBall> Print "1<br>"
[15:52] <FurBall> Print "2<br>"
[15:52] <FurBall> Print "3<br>"
[15:52] <FurBall> Print "4<br>"
[15:52] <FurBall> Print "5<br>"
[15:53] <FurBall> (ignore the missing ;s :))
[15:53] <FurBall> That's a PIA to have to type...
[15:53] <FurBall> Perl has a concept called a "here" document... What it does is let you embed text inside of normal perl code...
[15:53] <FurBall> So those 5 print statements could be rewritten as:
[15:54] <FurBall> print <<EOF;
[15:54] <FurBall> 1<br>
[15:54] <FurBall> 2<br>
[15:54] <FurBall> 3<br>
[15:54] <FurBall> 4<br>
[15:54] <FurBall> 5<br>
[15:54] <FurBall> EOF
[15:54] <FurBall> And that would do the same thing as those 5 print statements above.
[15:54] <Itchy> whats eof stand for
[15:54] <FurBall> Now the EOF can be whatever you want.
[15:54] <FurBall> It's the delimiter for the end of the here document.
[15:54] <FurBall> I could have also said:
[15:55] <FurBall> print <<END_OF_HERE_DOC;
[15:55] <FurBall> ...
[15:55] <FurBall> END_OF_HERE_DOC
[15:55] <Itchy> but EOF is shorter
[15:55] <Itchy> and quicker to write
[15:55] <FurBall> Yup. :)
[15:55] <FurBall> But it MUST not appear in the text that you want printied out.
[15:55] <FurBall> Otherwise it'll break. :)
[15:56] <FurBall> I use EOF because in ascii, there's a control code called EOF which stands for End of File.
[15:56] <FurBall> And that is used to signal the end of a text file...
[15:57] <FurBall> So it's just kind of a "standard" that I use...
[15:57] <Itchy> and easy to remember too
[15:57] <FurBall> Yup!
[15:57] <FurBall> I've also used EOSQL for end of sql. :)
[15:58] <FurBall> So.. What you COULD do is "borrow" Tdavid's java script code and then have one print statement with a here doc that contained all of his javascript code.
[15:58] <FurBall> It would look something like this:
[15:59] <FurBall> print <<EOJS
[15:59] <FurBall> <script LANGUAGE="JavaScript">
[15:59] <FurBall> <!--
[15:59] <FurBall> var now = new Date();
[15:59] <FurBall> var external = new Date("Mar 13 2001 14:49:33");
[15:59] <FurBall> var event = new Date("Mar 16 2001 16:00:01");
[15:59] <FurBall> var offset = external - now;
[15:59] <FurBall> var seconds = (event - now) / 1000;
[15:59] <FurBall> var minutes = seconds / 60;
[15:59] <FurBall> var hours = minutes / 60;
[15:59] <FurBall> var days = hours / 24;
[15:59] <FurBall> var flag = 0;
[15:59] <FurBall> ID=window.setTimeout("update();", 1000);
[15:59] <FurBall> function update() {
[15:59] <FurBall> now = new Date();
[15:59] <FurBall> external = ne
[15:59] *** Excess flood
[15:59] Disconnected from server
[15:59] erika is offline
[15:59] WillyB is offline
[15:59] Annieb is offline
[15:59] ***** Log ended at 03:59 PM 03/13/2001
[15:59] ***** Log started at 03:59 PM 03/13/2001
[15:59] *** Now talking in #topniche
[15:59] *** Topic is :Week 5 Perl/CGI Class Tech Chat - This week, Arrays and Advanced Looping
[15:59] *** Topic set by FurBall on Tue Mar 13 15:26:40 2001
[15:59] -HelpBot- Welcome to Topniche IRC Webmaster Chat. Webmasters only please!
[15:59] -HelpBot- Our url: http://www.weboverdrive.com/
[15:59] *** #topniche created on Mon Mar 12 02:14:37 2001
[15:59] <FurBall> Whoops. :)
[15:59] <Itchy> wb what was that
[15:59] -> *HelpBot* op #topniche helpone
[15:59] *** HelpBot sets mode: +o FurBall
[15:59] <FurBall> I umm... Flooded out... :)
[15:59] <FurBall> K let me try again... LOL
[15:59] <FurBall> print <<EOJS
[16:00] <FurBall> Restart..
[16:00] <FurBall> print <<EOJS;
[16:00] <FurBall> <script LANGUAGE="JavaScript">
[16:00] <FurBall> <!--
[16:00] <FurBall> var now = new Date();
[16:00] <FurBall> var external = new Date("Mar 13 2001 14:49:33");
[16:00] <FurBall> var event = new Date("Mar 16 2001 16:00:01");
[16:00] <FurBall> var offset = external - now;
[16:00] <FurBall> var seconds = (event - now) / 1000;
[16:00] <FurBall> var minutes = seconds / 60;
[16:00] <FurBall> var hours = minutes / 60;
[16:00] <FurBall> var days = hours / 24;
[16:00] <FurBall> var flag = 0;
[16:00] <FurBall> ID=window.setTimeout("update();", 1000);
[16:00] <FurBall> function update() {
[16:00] <FurBall> now = new Date();
[16:00] <FurBall> external = new Date("Mar 13 2001 14:49:33");
[16:00] <FurBall> offset = external - now;
[16:00] <FurBall> if(flag != 1) {
[16:00] <FurBall> event = event - offset;
[16:00] <FurBall> flag = 1;
[16:00] <FurBall> }
[16:00] <FurBall> seconds = (event - now) / 1000;
[16:00] <FurBall> seconds = Math.round(seconds);
[16:00] <FurBall> minutes = seconds / 60;
[16:00] <FurBall> minutes = Math.round(minutes);
[16:00] <FurBall> hours = minutes / 60;
[16:00] <FurBall> hours = Math.floor(hours);
[16:00] <FurBall> if (hours >= 24) {
[16:00] <FurBall> days = hours / 24;
[16:00] <FurBall> days = Math.floor(days);
[16:00] <FurBall> }
[16:00] <FurBall> if (hours < 24) {
[16:00] <FurBall> days = 0;
[16:00] <FurBall> }
[16:00] <FurBall> if (hours < 1) {
[16:00] <FurBall> hours = 0;
[16:00] <FurBall> }
[16:00] *** Excess flood
[16:00] Disconnected from server
[16:00] erika is offline
[16:00] WillyB is offline
[16:00] Annieb is offline
[16:00] ***** Log ended at 04:00 PM 03/13/2001
[16:00] ***** Log started at 04:00 PM 03/13/2001
[16:00] *** Now talking in #topniche
[16:00] *** Topic is :Week 5 Perl/CGI Class Tech Chat - This week, Arrays and Advanced Looping
[16:00] *** Topic set by FurBall on Tue Mar 13 15:26:40 2001
[16:00] -HelpBot- Welcome to Topniche IRC Webmaster Chat. Webmasters only please!
[16:00] -HelpBot- Our url: http://www.weboverdrive.com/
[16:00] erika is online
[16:00] WillyB is online
[16:00] Annieb is online
[16:00] -NickServ- This nickname is owned by someone else. Please choose another.
[16:00] -NickServ- If this is your nickname, please use /NickServ IDENTIFY <password>
[16:00] -NickServ- You have 60 seconds to comply before your nickname is changed.
[16:00] *** #topniche created on Mon Mar 12 02:14:37 2001
[16:01] -> *helpbot* op #topniche helpone
[16:01] *** HelpBot sets mode: +o FurBall
[16:01] <FurBall> Well, you get the idea... :)
[16:01] <Itchy> it don't like you hehe
[16:01] <FurBall> I just keep pasting too much...LOL
[16:01] <FurBall> One thing...
[16:01] <Itchy> I'll have it up and working later today hehe
[16:01] <FurBall> A here doc must ALWAYS look like this... :)
[16:01] <FurBall> print <<DELIMITER;
[16:01] <FurBall> ...
[16:01] <FurBall> DELIMITER.
[16:01] <FurBall> IE... After the delimiter you MUST have a ;
[16:02] <FurBall> While the delimiter doesn't have to be uppercase, that's a convention I always follow.
[16:02] <Itchy> <<secertcode;
[16:02] <FurBall> Gotta include the print statement. :)
[16:03] <Itchy> print <<sercertcode;
[16:03] <FurBall> yup
[16:04] <Itchy> when is fridays radio show going to up? heard i missed a good one too
[16:04] <FurBall> It's on the archives now...
[16:05] <Itchy> then at the end of what i wanted printed i just put secertcode
[16:05] <FurBall> yup
[16:05] <Itchy> and that breajs it
[16:05] <Itchy> breaks it hehe
[16:05] <FurBall> Stops the printing... :)
[16:06] <Itchy> right stops hehe
[16:06] <FurBall> But make sure of course that if you say "print <<sercertcode" that you end with sercertcode. :)
[16:06] <FurBall> Or else it will break... :)
[16:06] <Itchy> not like this
[16:06] <Itchy> pprint<<secertcode:
[16:06] <Itchy> secert
[16:07] <FurBall> Right...
[16:07] <FurBall> That'll get you a 500 error...
[16:07] <Itchy> I wish you could edit in here hehe
[16:07] <FurBall> :)
[16:07] <FurBall> Ok... Well.... That ends this week's chat... :)
[16:07] <Itchy> hehe
[16:07] <FurBall> We went kinda far away from arrays but that's OK... :)
[16:08] <Itchy> hey when you sent me e-mail do you remember what addy it was ?
[16:08] <FurBall> Umm... No...
[16:08] <FurBall> You mean which email addy I emailed to?
[16:08] <Itchy> never got any and one e-mail came in 6 days after it was sent to dr-itchy@home.com weird
[16:08] <FurBall> What was I emailing you about?
[16:09] <FurBall> Oh the htaccess stuff yes?
[16:09] <Itchy> .htaccess
[16:09] <Itchy> on thec board
[16:09] <FurBall> Did I answer that on the board finally?
[16:09] <Itchy> yup but i got one more hehe
[16:09] <FurBall> Ok...
[16:09] <FurBall> Then I might not have emailed you after all...
[16:09] <Itchy> you want me to ask over there
[16:09] <FurBall> Sure... :)
[16:10] <Itchy> you answered the n said you sent mail hehe
[16:10] <Itchy> ooooooo
[16:10] <FurBall> Hmm... OK...
[16:10] <FurBall> I'll have to look...
[16:10] <Itchy> Do you know what url i look at when i'm user #3 on the school srever
[16:10] <FurBall> What might have happened is that I was gonna send it and then realized that I answered it on the board so didn't send it... :)
[16:10] <FurBall> No idea...
[16:10] <Itchy> hehe
[16:11] <FurBall> Don't know anything about the school server...
[16:11] <Itchy> will ask princeapal then hehe
[16:11] <FurBall> :)
[16:11] <FurBall> Ok...Well, I've got to leave so I'll see you later...
[16:12] <Itchy> ok thanks for today
[16:12] *** Itchy has left #topniche
[16:12] <FurBall> Yw!
[16:12] ***** Log ended at 04:12 PM 03/13/2001