#perl
30 October 2007
Total 29 pages. You are browsing page 5/29.
First :: Prev :: [...] [3] [4] [5] [6] [7] [...] :: Next :: Last
02:53 * JordiGH2 is still trying to get the joke.
02:53 <****> troubled: Why would int(rand $1) necessarily be 0?
02:53 <****> There's a small nonzero chance it could be 1. :-)
02:53 <****> jagerman: rand $1 is 0 - value
02:54 <****> And good god, why is that code operating on match capture variables instead of naming them?
02:54 * CPAN rating: DBIx-Class rated 5 stars by Jake
02:54 <****> they should have at least (int(rand $1) +1) * 60
02:54 <****> JordiGH2: Not if $1 is, say, 100.
02:54 <****> JordiGH2: Then there's only a 1% chance of it being 0
02:55 <****> jagerman, Statistically a 1% chance, assuming a perfect RNG.
02:55 <****> anyone know where I can find info about inserting/selecting bytea columns in postgresql? I can't find anything in the DBD::Pg perldoc
02:56 <****> apeiron: the problem here though is that someone along the way decided that its going to be using for random time()'s now, so they fixed it hehe
02:56 <****> This was in infobot, you say?
02:56 <****> and why aren't they just using rand() ?
02:56 <****> troubled, Do your maintenance programmer a favour and assign the capture variables to real names.
02:56 <****> jagerman: yes, in src/Misc.pl if your interested
02:57 <****> Looking at that code, I have no idea what $2 and $1 are.
02:57 <****> apeiron: There is so much fun for any maintainer in infobot, I hardly think it would make any difference.
02:57 <****> be sure to check out the src/IRC/Scheduler.pl as well to see the mayhem
02:57 <****> jagerman, heh
02:57 <****> The xkcd comic is such a ripoff of a Dilbert comic where they go check on the rng in the basement.
02:57 <****> And it's some monster forever saying "six".
02:57 <****> At least there was 6 or 7 years ago when I last looked at it. But those filenames make me think it hasn't changed.
02:57 <****> apeiron: it does a /^(\d+)-(\d+)$/
02:57 <****> jagerman: Ah, is that how rand works in Perl? :-)
02:58 <****> troubled, That still doesn't mean much.
02:58 <****> e.g., 10-29 could be today's date.
02:58 <****> Oh, so you provide "5-100" and it's supposed to give you back some int from 5 to 100?
02:58 <****> apeiron: its mean to be called with an upper and lower limit. so say "10-20" so give me a rand int between 10 and 20 (prolly inclusive, although thats undef)
02:58 <****> troubled, Your code, as provided, doesn't say that.
02:59 <****> jagerman: yes, thats what it _should_ do. :)
02:59 <****> troubled: Is infobot still non-modularized?
02:59 <****> apeiron: i know that :)
02:59 <****> troubled, Thus my "name your capture variables!" statement.
02:59 <****> troubled: yeah, it really should be int ((upper-lower)*rand)+lower
02:59 <****> jagerman: its a mishmash of everything hehe
03:00 <****> dondelelcaro: yes, but all the scheduler woes are because of that damn sub. you should see the single param call for it. if its < 10, return what you gave it!
03:00 <****> troubled: heh
03:00 <****> while i got you here, sec, pastebin incoming
03:01 <****> http://pastebin.ca/754536
03:01 <****> troubled: The paste 754536 has been copied to http://erxz.com/pb/5027
03:01 <****> "i"; $commandlineoptions_h{OPT_INPUTFILE}++; This sets a key pair with the key as "OPT_INPUTFILE" and not "i", ie the hash seems to be taking the literal rather than replacing the constant. Am i doing something wrong, or is there a way around this? Thanks
03:01 <****> troubled: so int(rand($2-$1))+$1
03:01 <****> dondelelcaro: theres the new rss feed tracker. although i think im gonna add a seperate refresh interval per chan instead of a global config default. that is, until i ran into the scheduler bugs :(
03:02 <****> Why on earth would a scheduler sub use something that takes a string of numbers concatenated with a - to generate a random number?
03:02 <****> "baz"); \%hash;
03:02 <****> 'baz'}
03:02 <****> Why on earth would a scheduling sub *need* a random number?
03:02 <****> jagerman: total insanity
03:02 <****> iFatman: you mean that?
03:02 <****> (I know there are some schedulers relying on randomness, but I thought those were all just academic toys)
03:03 <****> jagerman: well, lenzo was in school at the time
03:03 <****> dondelelcaro: i think im going to put getRandomInt back to its "proper" form, see what breaks and manually fix all the schedular values from the conf to be min/sec depending on what makes sense. should solve some problems hopefully
03:03 <****> 10}?
03:04 <****> troubled: Good god, troubled, don't you dare.
03:04 <****> iFatman: uh, no..
03:04 <****> jagerman: ;)
03:04 <****> troubled: The PROPER way to fix it is to add ANOTHER sub. Call it getRandomInt2.
03:04 <****> troubled: sounds reasonable
03:04 <****> lol
03:04 <****> troubled: And have it work the way you want ;)
03:04 <****> iFatman: is my example what you were asking about?
03:05 <****> jagerman: you know what killed me laughing though, tim's commit -r969 "mess with scheduler" "if ($i < 10) { return $i } :)
03:05 <****> Has anyone tried porting infobot to some reasonably modern architecture?
03:05 <****> yes, i didnt understand it and wondered if there is an alternative hash syntax i dont know about. Newbie. I know $myHash{"a"} = 10;
03:05 <****> i.e. maybe POE + modularized?
03:05 <****> jagerman: there have been some work on turning it into POE
03:05 <****> jagerman: but it tends to eat develolpers
03:05 <****> quotes its left side, if you want the constant to fill in you need to use parens
03:05 <****> "baz"); \%hash;
03:05 <****> 'baz'}
03:06 <****> jagerman: POE is planned, but first I would like to get a feel for the code and get it running stable, release a tag, clean it up etc, while the POE stuff goes on
03:06 <****> Amethyst on CPAN.
03:07 <****> dondelelcaro: It was sort of fun to run one on IRCnet and, I think, DALnet for a while way back when, but that was when I was still in my experiment-with-perl stage. Now, the thought of maintaining such a thing would scare me.
03:07 <****> POE is basically gonna be, start an empty dir, get it on irc, then add whats missing from scratch, it seems
03:07 <****> Somni: ok thanks! i didnt know about that syntax.
03:07 <****> Apparently infobot was ported to POE years ago, and nobody noticed.
03:07 <****> dngor: it was sort of half ported, actually
03:07 <****> dngor: i noticed a poe dir, although im not sure how well it worked. plus it would be missing 90% of what blootbot had added
03:08 * jagerman always found an infobot in non-stfu mode to be rather annoying.
03:08 <****> infobot.org is showing a development version that plans to add POE, but currently has no IRC support
03:09 <****> at least that's what the description says
03:09 <****> actually, tim added a +silent flag that works nice. i added a +s user flag to bypass it. makes for a good chanop approved chatter only bot
03:09 <****> Somni: It's said that for *years*
03:10 <****> Somni: thats the original www page. not sure if we have access to the domain yet
03:10 <****> I was mostly talking to dngor, thinking that's what he meant
03:10 <****> ah
03:11 * CPAN upload: DBIx-DBSchema-0.35 by IVAN
03:11 <****> I was talking about Amethyst. As I said, it's on CPAN. http://search.cpan.org/~shevek/Amethyst-1.00/Amethyst.pm
03:13 <****> anyone know how to store a binary file in postgres with DBD::Pg?
03:13 <****> that is a horrible idea
03:13 <****> i hate that people do that
03:13 <****> why?
03:13 <****> use the filesystem ;p
03:13 <****> why would you do that
03:13 <****> traiani: It isn't the sort of data that is usefully stored in a databases.
03:14 <****> why would you add extra load on the sql server, it's entirely unnecessary
03:14 <****> pretty sure there is some sort of lo_import or something for blobs though in pg. been ages :(
03:14 <****> Is there a reason you can't just store the path to the file, stored somewhere on disk?
03:15 <****> I could. Is there a best practice for doing that? I cringe at the thought of thousands of files just dumped into a single directory, but I can't think of a good way to compartmentalize it
Total 29 pages. You are browsing page 5/29.
First :: Prev :: [...] [3] [4] [5] [6] [7] [...] :: Next :: Last
