xkcd-Bucket icon indicating copy to clipboard operation
xkcd-Bucket copied to clipboard

loadlog.pl, uninitialized values

Open izzy84075 opened this issue 14 years ago • 12 comments

After taking over issue #6 for a while, it was suggested to move this to a new issue. I've been attempting to get the "band names" thing working. I hadn't realized that loadlog.pl was involved before, and after being told how to feed it data, it doesn't seem to be working, even with the log snippet from the end of the file itself.

izzy@Veda2:~/xkcd-Bucket$ ./loadlog.pl < loadlogtest.txt Use of uninitialized value $max in concatenation (.) or string at ./loadlog.pl line 27. max timestamp: Date = 2006-08-15 Use of uninitialized value $stats{"added"} in concatenation (.) or string at ./loadlog.pl line 111, <> line 42. Use of uninitialized value in concatenation (.) or string at ./loadlog.pl line 111, <> line 42. Use of uninitialized value in concatenation (.) or string at ./loadlog.pl line 111, <> line 42.

lines added, new words, pointers.

That's the output I get, with loadlogtest.txt containing the log snippet from loadlog.pl, everything between and including the "Log opened" and "Day changed" lines.

izzy84075 avatar Sep 09 '11 04:09 izzy84075

does your table now have data?

halkeye avatar Sep 09 '11 23:09 halkeye

No.

izzy84075 avatar Sep 10 '11 00:09 izzy84075

xkcd-Bucket (master)$ mysql xkcd < bucket.sql xkcd-Bucket (master)$ mysql xkcd < sample.sql xkcd-Bucket (master)$ ./loadlog.pl < log.txt Use of uninitialized value $max in concatenation (.) or string at ./loadlog.pl line 27. max timestamp: Date = 2006-08-08 Date = 2006-08-15

27 lines added, 71 new words, 84 pointers.

xkcd-Bucket (master)$ cat log.txt --- Log opened Tue Aug 08 17:12:18 2006 17:12 -!- xkcd [[email protected]] has joined #xkcd 17:12 [Users #xkcd] 17:12 [@xkcd] 17:12 -!- Irssi: #xkcd: Total of 1 nicks [1 ops, 0 halfops, 0 voices, 0 normal] 17:12 -!- Channel #xkcd created Tue Aug 8 17:12:16 2006 17:12 -!- Irssi: Join to #xkcd was synced in 2 secs 17:22 -!- blorpy [[email protected]] has joined #xkcd 17:22 < blorpy> gar! 17:22 @xkcd FUCKER 17:22 < blorpy> where?! 17:23 @xkcd over there, next to the guy with tourette's 17:25 < blorpy> oh, john stossel 17:28 @xkcd No, the other one. 18:04 < blorpy> so do i get to be your 2nd in command 18:04 < blorpy> because i really want to haze some nerds 18:07 -!- mode/#xkcd [+ntr] by ChanServ 18:09 @xkcd sure, why not 18:15 -!- davean [[email protected]] has joined #xkcd 18:57 -!- blorpy [[email protected]] has quit [Ping timeout] 19:00 -!- blorpy [[email protected]] has joined #xkcd 20:35 < blorpy> hi 21:28 @xkcd :D 21:44 -!- stu [stu@hide-8ACFF8D] has joined #xkcd 21:44 < stu> n00bs 21:45 < blorpy> st00bs 21:46 < stu> waddup blorpy 21:48 < blorpy> stu: i heard this neat song, is what 21:49 < blorpy> http://zork.net/~spork/dead_prez-hell_yeah-diplo.mp3 21:50 < stu> blorpy: heh 21:50 < stu> blorpy: yeah 21:50 < stu> i have that song 21:50 < stu> its great 21:50 < stu> great 21:51 < blorpy> yeah it rocks 21:51 < blorpy> he had a concert here a couple weeks back 21:51 < blorpy> and i didnt go 21:51 < blorpy> this diplo fellow 21:51 < blorpy> who does the mix 21:51 < stu> blorpy: http://isomerica.net/~stu/mp3/

--- Day changed Tue Aug 15 2006

halkeye avatar Sep 10 '11 05:09 halkeye

If i run the same line a second time I get the same error you do: xkcd-Bucket (master)$ ./loadlog.pl < log.txt max timestamp: 2006-08-08 21:51:00 Date = 2006-08-08 Date = 2006-08-15 Use of uninitialized value $stats{"added"} in concatenation (.) or string at ./loadlog.pl line 111, <> line 42. Use of uninitialized value in concatenation (.) or string at ./loadlog.pl line 111, <> line 42. Use of uninitialized value in concatenation (.) or string at ./loadlog.pl line 111, <> line 42.

lines added, new words, pointers.

halkeye avatar Sep 10 '11 05:09 halkeye

What are the outputs of: select max(stamp) as m from mainlog

and

select count(1) from mainlog

halkeye avatar Sep 10 '11 05:09 halkeye

mysql> select max(stamp) as m from mainlog; +------+ | m | +------+ | NULL | +------+ 1 row in set (0.00 sec)

mysql> select max(stamp) as m from mainlog; +------+ | m | +------+ | NULL | +------+ 1 row in set (0.00 sec)

izzy84075 avatar Sep 10 '11 06:09 izzy84075

Does your log file start with --- Log opened Tue Aug 08 17:12:18 2006

That line controls what day it thinks it is parsing for. It'll ignore any data until the first time it finds a date line.

See https://github.com/zigdon/xkcd-Bucket/blob/master/loadlog.pl#L55 https://github.com/zigdon/xkcd-Bucket/blob/master/loadlog.pl#L62

halkeye avatar Sep 10 '11 06:09 halkeye

It does. Looks to be an exact match to your log.txt. ...Unless line endings might be the problem?

izzy84075 avatar Sep 10 '11 06:09 izzy84075

chomp (line 53) should take care of line endings, but just incase, you could use "fromdos" command to fix line endings.

You could also modify the script to use your log format. The one it mentions is irssi, which I use, and I assume zigdon uses, so hasn't really been an issue.

halkeye avatar Sep 10 '11 06:09 halkeye

Fixed the line endings, still errors out in the same way. Once I get it working with the log format it's supposed to work with, I'll worry about getting my logs usable with it. Any other ideas?

izzy84075 avatar Sep 10 '11 08:09 izzy84075

I got no idea. I did a fresh checkout. Created a new db Imported the 2 sql files Pulled out the log from the sample file Updated the connect() statement at the top of the file Ran the import

I had 0 issue. Its weird that you are having one. My only thought left is that you might be importing to one db, and you are checking a different db.

halkeye avatar Sep 10 '11 15:09 halkeye

The connect() statement looks to match what it should, so I don't think that's it... Quite strange, this problem.

izzy84075 avatar Sep 10 '11 17:09 izzy84075