From skatoulininis at yahoo.com Mon Mar 3 09:49:10 2003 From: skatoulininis at yahoo.com (Antonis Faragitakis) Date: Mon Aug 2 21:22:58 2004 Subject: [Athens-pm] infitinite loop (yeap i made it :P) Message-ID: <20030303154910.73774.qmail@web40611.mail.yahoo.com> Hi can someone tell me why this crappy code, run into an infinitive loop!? i've broken my head and still CAN'T find what the problem is. The crappy code is attached. Antonis (O apelpismenos) -------------- next part -------------- A non-text attachment was scrubbed... Name: htdocs.zip Type: application/x-zip-compressed Size: 10742 bytes Desc: htdocs.zip Url : http://mail.pm.org/pipermail/athens-pm/attachments/20030303/e0c702f3/htdocs.bin From mark at dreamzpace.com Mon Mar 3 11:07:40 2003 From: mark at dreamzpace.com (Mark Pors) Date: Mon Aug 2 21:22:58 2004 Subject: [Athens-pm] infitinite loop (yeap i made it :P) In-Reply-To: <20030303154910.73774.qmail@web40611.mail.yahoo.com> Message-ID: <5.1.0.14.2.20030303190219.04efe4a8@pop.dreamzpace.com> At 07:49 03-03-03 -0800, Antonis Faragitakis wrote: >Hi > >can someone tell me why this crappy code, run into an >infinitive loop!? i've broken my head and still CAN'T >find what the problem is. > >The crappy code is attached. > >Antonis (O apelpismenos) This looks a bit strange: open (USERCOUNT, $times_been_here_file) or die ("Cannot open $times_been_here_file. perl reports: $!"); while () { $times_been_here = $_ + 1; close USERCOUNT; }#while The open function should have a '<' in front of the filename (but it should die there the, so maybe that is default?). The other thing is the close statement inside the while loop, that maybe leaves USERCOUNT in a 'true' value? Mark -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/athens-pm/attachments/20030303/b6b6be0a/attachment.htm From nacos at eureka.edu.gr Mon Mar 3 12:17:21 2003 From: nacos at eureka.edu.gr (Michael K. Nacos) Date: Mon Aug 2 21:22:58 2004 Subject: [Athens-pm] In-Reply-To: <5.1.0.14.2.20030303190219.04efe4a8@pop.dreamzpace.com> References: <20030303154910.73774.qmail@web40611.mail.yahoo.com> <5.1.0.14.2.20030303190219.04efe4a8@pop.dreamzpace.com> Message-ID: <20030303181721.GA1532@eureka.edu.gr> most of the time I spend trying to debug my own scripts, so I haven't really looked at your code, Antoni. the following loop, however, is a little strange. > open (USERCOUNT, $times_been_here_file) or die ("Cannot open > $times_been_here_file. perl reports: $!"); > while () { > $times_been_here = $_ + 1; > close USERCOUNT; > }#while i'm guessing $times_been_here_file is a user-specific file, to which a new line is appended each time this user logs on. so you're trying to count newlines in the file to determine $times_been_here. am i right? why would you want to close your filehandle USERCOUNT every time the loop is repeated? IMHO, close USERCOUNT goes after the end of the loop. in addition, doesn't the spaceship operator read a line into $_ ? what's the point of adding 1 to a string? why don't you just write $times_been_here += 1; then again, maybe I have totally misunderstood what you are trying to do. anyways, you sound a little stressed. Χαλάρωσε! I suggest you get some quality time away from the screen ;-) From nacos at eureka.edu.gr Mon Mar 3 13:20:08 2003 From: nacos at eureka.edu.gr (Michael K. Nacos) Date: Mon Aug 2 21:22:58 2004 Subject: [Athens-pm] In-Reply-To: <5.1.0.14.2.20030303190219.04efe4a8@pop.dreamzpace.com> References: <20030303154910.73774.qmail@web40611.mail.yahoo.com> <5.1.0.14.2.20030303190219.04efe4a8@pop.dreamzpace.com> Message-ID: <20030303192008.GA1910@eureka.edu.gr> just had a look at the code. if $times_been_here_file is only meant to contain a number in the first line, there's no need for while. you could write something like: $times_been_here = + 1; close USERCOUNT; # line 160 i suppose i was thinking in terms of server logs. for example, you could add a new line with data such as date, IP address etc. everytime a user logs on then count the lines to find out how many times they've had access. does your script create the right files, e.g. $times_been_here_file? is the data ok in these files? how do you know it's an infinite loop? do you test using the command line or a browser? please supply more info. #line 99: please consider $times_been_here = times_been_here(); instead. namespaces get out of hand real fast. michael From pjlees at ics.forth.gr Tue Mar 4 04:21:56 2003 From: pjlees at ics.forth.gr (Philip Lees) Date: Mon Aug 2 21:22:59 2004 Subject: [Athens-pm] infitinite loop (yeap i made it :P) In-Reply-To: <20030303154910.73774.qmail@web40611.mail.yahoo.com> Message-ID: <000d01c2e237$e2b1b190$44be5b8b@ics.forth.gr> > can someone tell me why this crappy code, run into an > infinitive loop!? i've broken my head and still CAN'T find > what the problem is. I can't see why it's getting stuck in a loop, unless it's the strange placement of close USERCOUNT; that others have already pointed out. You might want to run a short test script to find out what while() returns if the file has been closed, or just maybe. I have a more general piece of advice: do yourself a favour and use DBI with a comma separated text file, one line for each user, containing all the data you're interested in (e.g. username, password, number of visits, etc.). Using separate files for each of these is already getting insanely complicated and can only get worse. It will also make it _much_ easier when you decide to move your data into a proper database. Philip -- Philip Lees Working Group on Cardiology ICS-FORTH, Science and Technology Park of Crete Vassilika Vouton, P.O. Box 1385, GR 711 10 Heraklion, Crete, GREECE tel.: +30-2810-391680, fax: +30-2810-391601, e-mail: pjlees@ics.forth.gr 'The aim of high technology should be to simplify, not complicate' - Hans Christian von Baeyer From skatoulininis at yahoo.com Mon Mar 10 13:47:32 2003 From: skatoulininis at yahoo.com (Antonis Faragitakis) Date: Mon Aug 2 21:22:59 2004 Subject: [Athens-pm] just wanted to say hi! Message-ID: So... Hi everyone! There's been many time since the last pm e-mail. Antonis From pjlees at ics.forth.gr Tue Mar 11 02:23:47 2003 From: pjlees at ics.forth.gr (Philip Lees) Date: Mon Aug 2 21:22:59 2004 Subject: [Athens-pm] just wanted to say hi! In-Reply-To: Message-ID: <001001c2e7a7$8a26aba0$44be5b8b@ics.forth.gr> Antonis Faragitakis wrote: > So... Hi everyone! And hi from me. How's your CGI app getting along? Here's another piece of weird Perl code from the comp.lang.perl.misc newsgroup: @1=a..c;$;=4;{push@2,map[$;--,@1[0,2,1]=@1 ],2..$;x--$|;print"$1[0]=>$1[2]\n";--$;?@1 =@1[1,0,2]:(($;,@1)=@{pop@2||last});redo} Philip -- Philip Lees Working Group on Cardiology ICS-FORTH, Science and Technology Park of Crete Vassilika Vouton, P.O. Box 1385, GR 711 10 Heraklion, Crete, GREECE tel.: +30-2810-391680, fax: +30-2810-391601, e-mail: pjlees@ics.forth.gr 'The aim of high technology should be to simplify, not complicate' - Hans Christian von Baeyer From skatoulininis at yahoo.com Wed Mar 26 23:18:42 2003 From: skatoulininis at yahoo.com (Antonis Faragitakis) Date: Mon Aug 2 21:22:59 2004 Subject: [Athens-pm] use charnames Message-ID: xoxoxo hello everyone! log time no seen! It's 7:12 in the morning and i wake up to go and get my new perl book. It is called "Programming the Perl DBI" and I am really happy. Anyway this is not the only thing I wanna share with you. I wake up and start reading about charnames function and I've tried to run the following program from ActiveState's documentation examples. The program is as follows: #!perl use charnames ':full'; print "\N{GREEK SMALL LETTER SIGMA} is called sigma.\n"; use charnames ':short'; print "\N{greek:Sigma} is an upper-case sigma.\n"; use charnames qw(cyrillic greek); print "\N{sigma} is Greek sigma, and \N{be} is Cyrillic b.\n"; ## This line is for pause purposes $a =; and i get this output: Name "main::a" used only once: possible typo at Noname1.pl line 9. #ok this line is not a problem Wide character in print at Noname1.pl line 4. ?? is called sigma. #### Er, where is my greek Sigma!? Wide character in print at Noname1.pl line 6. ?? is an upper-case sigma. ##### Or, my uppercase Sigma!? Wide character in print at Noname1.pl line 8. ?? is Greek sigma, and ?? is Cyrillic b. ##### What about this one!? Antonis! From pjlees at ics.forth.gr Thu Mar 27 01:47:50 2003 From: pjlees at ics.forth.gr (Philip Lees) Date: Mon Aug 2 21:22:59 2004 Subject: [Athens-pm] use charnames In-Reply-To: Message-ID: <000301c2f435$2b23dd90$44be5b8b@ics.forth.gr> Hi Antonis and all. When I ran your script in a Win2K command window I got slightly different output, but no sigmas. A look at the documentation for charnames.pm suggests that what's being printed is the unicode form of the characters, i.e. two bytes, not one. You need to direct the output to a display that understands unicode, I think. How about this one: #!perl $==$ARGV[0] or die "Usage is $0 integer\n"; {$_=($=&1).$_;redo if$==$=>>1}print Philip -- Philip Lees Working Group on Cardiology ICS-FORTH, Science and Technology Park of Crete Vassilika Vouton, P.O. Box 1385, GR 711 10 Heraklion, Crete, GREECE tel.: +30-2810-391680, fax: +30-2810-391601, e-mail: pjlees@ics.forth.gr 'The aim of high technology should be to simplify, not complicate' - Hans Christian von Baeyer