--- Log opened Sun Oct 01 00:00:04 2006 |
00:54 | <@Chalain> | Okay, reportedly a common interview question at Microsoft: without calling an existing string reversal function, write a C function to reverse a string in place. Minimize the amount of extra memory you need. |
00:55 | < Vornicus-Latens> | This is a null-terminated string? |
00:55 | <@Chalain> | I can do it with one char* that does double-duty as the loop index and pointing to a character in the string. |
00:55 | <@Chalain> | It's C, so yes. |
00:57 | <@ToxicFrog> | You also need a char, since C doesn't let you do a,b=b,a |
00:57 | <@Chalain> | ToxicFrog: YOU might need a char. I don't. :-P |
00:57 | < Vornicus-Latens> | Okay, I need a single pointer; the a ^= b ^= a ^= b thing works because we're working with things that we know aren't 0; start the loop index as the /end/ of the string (str + len - 1) |
00:57 | <@Chalain> | Vornicus-Latens: did you see the function I wrote on the whiteboard yesterday? It used 2 char pointers, no loop index, and no swap space. I have since reduced it to 1 char*. I just can't figure out how to get rid of that last variable. |
00:58 | <@Chalain> | TF: The a^=b^=a^=b thing vorn just posted is the trick I was just about to tell you. It swaps two variables without a swap buffer. |
00:58 | <@Chalain> | Vornicus-Latens: The ^= trick will swap zeroes just fine. |
00:59 | <@ToxicFrog> | Chalain: post the code, then. |
00:59 | < Vornicus-Latens> | ...oh, yeah, it's two refs to the same thing that breaks it. |
00:59 | <@ToxicFrog> | Aah. |
00:59 | | * Vornicus-Latens fiddles with his own code. |
01:00 | <@Chalain> | void strrevip(char *dst) { |
01:00 | <@Chalain> | char *e = dst + strlen(dst); /* danger, no safety check! */ |
01:00 | <@Chalain> | dst--; /* evil, reusing our stack var */ |
01:00 | <@Chalain> | while ( ++dst < --e ) { |
01:00 | <@Chalain> | *dst ^= *e ^= *dst ^= *e; |
01:00 | <@Chalain> | } |
01:00 | <@Chalain> | } |
01:01 | <@Chalain> | I want to figure out a way to get rid of e. |
01:01 | < Vornicus-Latens> | Stop stealing my stuff. :) |
01:01 | <@Chalain> | ? |
01:01 | | * Vornicus-Latens was going to do just that. |
01:01 | <@Chalain> | Ah. |
01:01 | <@Chalain> | Well, get rid of the e. |
01:01 | <@ToxicFrog> | You know, if this is the kind of thing MS looks for in its interviews, it really explains a lot~ |
01:01 | <@Chalain> | TF: heh. |
01:01 | < Vornicus-Latens> | well, except that I was going to start by using e = dst + strlen(dst+ - 1 |
01:02 | < Vornicus-Latens> | s/dst+/dst)/ |
01:02 | <@Chalain> | Actually, I think it's just an interview question to see how you can think through arbitrary problems. I would have a flaming row with the interviewer if he thought my solution was cool. |
01:03 | < Vornicus-Latens> | ...I can't figure out a way to get rid of the e. |
01:03 | <@Chalain> | Me either. |
01:04 | <@Chalain> | Thing is, there's THREE bits of data you need, and the 3rd can be generated from the other 2. |
01:04 | < Vornicus-Latens> | I don't think there is a way; you need to have /something/ to hold on to to get that swap to work. |
01:04 | <@Chalain> | You need two fixed known positions in the string and a moving point. |
01:05 | <@Chalain> | If you knew the midpoint of the string you could run p forward until you hit the \0, and swap p with mid-p at each step. |
01:06 | <@Chalain> | But you have to record the midpoint to do that. |
01:06 | <@Chalain> | But here's an evil thought: that terminal \0 is memory that we know needs to contain a \0 when we're done. Could we use it somehow? |
01:07 | < Vornicus-Latens> | it's only one byte of \0 though. |
01:07 | | * Chalain nods. |
01:08 | < Vornicus-Latens> | We can't use it for indexing unless we can guarantee the string is shorter than that, and using it for swap space isn't necessary. |
01:08 | | Janus [~Cerulean@Nightstar-10302.columbus.res.rr.com] has joined #code |
01:09 | <@Chalain> | You could use the terminal \0 as swap space, but we've already dispensed with the swap space, and you'd have to sacrifice a pointer to store its address so you could restore it when you were done. |
01:10 | <@Chalain> | Stop stealing my stuff! :) |
01:11 | < Vornicus-Latens> | I don't think you can get lower than one pointer's worth. |
01:12 | <@Chalain> | Me either. And yet, it gnaws at me. I want to find a way to do it with zero memory overhead. |
01:12 | <@Chalain> | Hah! We could require the caller to pass in a second buffer variable, since we're cheating by re-using dst anyway.... |
01:14 | <@Chalain> | If we allow ourselves to call strlen() repeatedly, that would free us from having to have a loop variable. But without a loop var, you have no way of swapping the next variable. |
01:15 | < Vornicus-Latens> | ...would using a bubble-like algorithm help? |
01:15 | <@Chalain> | We could slide dst through the string until it hits the \0, but now you've lost the head of the string so you don't know how far back to reach to find the byte to swap with. |
01:15 | <@Chalain> | Dono. Maybe. |
01:16 | <@Chalain> | Ohhh, sumbitch. I can do it. |
01:17 | <@Chalain> | Technically it's another cheat. Using recursion, we can have as many copies of dst as we want. |
01:17 | <@Chalain> | It ends up putting half of the string onto the stack (along with function frames, heh). |
01:18 | <@Chalain> | ...wait, no. The recursive function will need to pass 2 reference points in. It might as well pass in the two pointers, so it really is just the original cheat of having two vars in your signature. |
01:18 | <@ReivZzz> | That doesn't count as memory overhead? |
01:18 | <@Chalain> | Like I said, it's a cheat. |
01:19 | <@ReivZzz> | Incidentally, I am crushed. |
01:19 | <@Chalain> | TECHnically, re-using dst doesn't lower the memory overhead to 1 variable, it leaves it an 2 and just reuses a handy stack var. |
01:19 | <@ReivZzz> | It turns out a Raedon 9800 Pro can't run DEFCON |
01:19 | <@ReivZzz> | :( |
01:19 | <@Chalain> | What's a defcon? |
01:20 | <@ReivZzz> | http://www.everyone-dies.com/ |
01:20 | <@ReivZzz> | You ever see that old movie Wargames? |
01:20 | <@ReivZzz> | Uh. |
01:20 | <@Chalain> | Yeah |
01:20 | <@Chalain> | I'm familiar with what Defcon 0-5 are. |
01:20 | <@ReivZzz> | You get to play WWIII. |
01:20 | <@Chalain> | But not in the context of a video card. |
01:21 | <@ReivZzz> | The winner is the one with the most forgien civilians = dead |
01:21 | | * ReivZzz coughs. |
01:22 | <@ReivZzz> | "In thermonuclear war, everybody loses. But maybe, just maybe, you can lose the least." |
01:22 | <@ReivZzz> | It's Global Thermonuclear War, and nobody wins. |
01:22 | <@ReivZzz> | But maybe - just maybe - you can lose the least. |
01:22 | <@Chalain> | THe one with the most foreign civilians dead? |
01:23 | <@ReivZzz> | Chalain: It's a computer game. |
01:23 | <@ReivZzz> | You get to control a nuclear war-room. |
01:23 | <@Chalain> | I know, I'm DL'ing the demo now. |
01:23 | <@Chalain> | I'm just trying to grok that sentence. |
01:23 | <@ReivZzz> | Er. |
01:23 | <@ReivZzz> | He who kills more people than the other guy = winner? |
01:23 | <@Chalain> | So, um, if I'm playing USA and I have 50,000 frenchies living in NY and it gets nuked, my score goes up? |
01:24 | <@ReivZzz> | Nah. |
01:24 | <@ReivZzz> | You have to bomb france for it to count. >.> |
01:24 | <@ToxicFrog> | Foreign == lives in enemy territory for these purposes. |
01:24 | <@Chalain> | Oh, okay. See, THAT makes sense. The winner is the person who nukes the most people? |
01:24 | <@Chalain> | Dude, I AM IN |
01:24 | <@Chalain> | Eh ho ho! Le Nuque! |
01:24 | | * Chalain sighs. |
01:25 | <@Chalain> | I am *this* close to buying a new desktop PC. |
01:25 | <@ToxicFrog> | By default, score = 2(number of enemy civilians killed) - (number of your own civilians killed) - 2(number of your own civilians killed with your own nukes) |
01:25 | <@ReivZzz> | You get radars, airfeilds, and nuke silos. And then bombers, fighters, and cruise missiles. And then carriers, battleships, and submarines. |
01:25 | | * ReivZzz snerks. |
01:25 | <@Chalain> | Oblivion is a game that very nearly may cost me $1500 for a sweet gaming 'chine. |
01:25 | <@ReivZzz> | Don't go bombing yourself, huh. |
01:26 | | MahalAFK is now known as Mahal |
01:26 | <@Chalain> | I figure for $1100 I can get a 3GHz machine with 2GB RAM and all the trimmings. Then throw in another $400 for a graphics card. |
01:26 | <@Chalain> | "Our Servers are likely to experience extremely high load on the day of launch." |
01:26 | <@Chalain> | That sentence really, REALLY needs s/experience extremely high load/get nuked/ |
01:27 | | * ReivZzz snerrrrrk |
01:27 | < Vornicus-Latens> | Considering that like every gamer I know is drooling on this game... |
01:28 | | * ReivZzz wonders just how many sales they will make. |
01:28 | <@ReivZzz> | They're certainly playing nice about IP. |
01:28 | <@Chalain> | Vornicus-Latens: sentence fragment. No suggestions. Consider revising. |
01:28 | | * Vornicus-Latens eats Chalain and Word's grammar checker. |
01:29 | | Janus is now known as Jan[general] |
01:31 | | * Chalain toddles off to play Morrowind. |
01:31 | | ReivZzz is now known as zzZvieR |
01:31 | <@Chalain> | The DEFCON demo is about 71% downloaded. I am only so-so hopeful that it will run. I think your Radeon 9800 beats whatever this laptop has. |
01:32 | <@ToxicFrog> | Reiv's experience is, I think, an anomaly. |
01:32 | <@ToxicFrog> | Something is clearly wrong with his system. |
01:32 | <@Chalain> | GeForce Go 7600. |
01:33 | | zzZvieR is now known as Reiver |
01:34 | <@Chalain> | It's wild, a coworker and I bought identical HP Pavilion 8313CLs, and mine fried (*cough* when I spilled diet coke on it *cough*) so I took it back to CostCo and got the current model, the 8333CL. Physically they are identical. Under the hood they could not be more different, it's bizarre. |
01:34 | | * Reiver sigh. |
01:34 | <@Reiver> | Something is always wrong with my system... ;_; |
01:35 | <@Chalain> | Athlon64, 120GB, Radeon *mumble*800 --> Intel Core Duo, 200GB, NVidia Go 7600. |
01:35 | <@Chalain> | PEBKAC, Reive? |
01:36 | <@Reiver> | ? |
01:36 | <@Chalain> | http://www.google.com/search?q=define%3APEBKAC |
01:36 | | * Reiver has Chalain shot. |
01:36 | | * Chalain flees. |
01:36 | <@Reiver> | But yes, you're right. |
01:36 | | * Chalain dies fleeing, shot in the back. |
01:36 | <@Reiver> | The problem is between the chair and the keyboard. |
01:37 | <@Reiver> | It's my wallet, and it continues to be too bloody empty. |
01:37 | <@Reiver> | :p |
01:37 | <@Chalain> | Heh |
01:37 | <@Chalain> | Anyway. Gametime now. |
01:37 | <@Reiver> | Have fun! |
01:37 | <@Reiver> | Try not to die. |
01:37 | <@Reiver> | ...Well, too much. |
01:39 | | Jan[general] [~Cerulean@Nightstar-10302.columbus.res.rr.com] has quit [Ping Timeout] |
01:47 | <@ToxicFrog> | I've been plotting an upgrade for a while...P4 2.6 HT, R9800Pro AGP -> Ath64 X2 4200, RX800 or RX16000 PCIe, and of course associated new motherboard. |
01:48 | | MahalWork [~Mahal@Nightstar-4219.worldnet.co.nz] has quit [Connection reset by peer] |
01:52 | | Janus [~Cerulean@Nightstar-10302.columbus.res.rr.com] has joined #code |
01:53 | < Janus> | It seems nuclear holocaust can cause a computer to crash, violently. |
02:35 | | MahalWork [~Mahal@Nightstar-4219.worldnet.co.nz] has joined #Code |
02:35 | | mode/#code [+o MahalWork] by ChanServ |
02:36 | | Mahal [~Mahal@Nightstar-4219.worldnet.co.nz] has quit [Quit: brb] |
02:39 | | Mahal [~Mahal@Nightstar-4219.worldnet.co.nz] has joined #Code |
02:39 | | mode/#code [+o Mahal] by ChanServ |
02:44 | | Mahal [~Mahal@Nightstar-4219.worldnet.co.nz] has quit [Quit: It's hard to be mad at someone who misses you while you're asleep. ] |
02:47 | | MahalWork [~Mahal@Nightstar-4219.worldnet.co.nz] has quit [Ping Timeout] |
02:48 | | Mahal [~Mahal@Nightstar-4219.worldnet.co.nz] has joined #Code |
02:48 | | mode/#code [+o Mahal] by ChanServ |
02:58 | | Janus [~Cerulean@Nightstar-10302.columbus.res.rr.com] has quit [Quit: Ping Timeout] |
02:58 | | Janus [~Cerulean@Nightstar-10302.columbus.res.rr.com] has joined #code |
03:02 | | Janus is now known as Jan[bathipoo] |
03:21 | | Vornicus-Latens is now known as Vornicus |
03:31 | | Jan[bathipoo] is now known as Janus |
03:39 | | MahalWork [~Mahal@Nightstar-4219.worldnet.co.nz] has joined #Code |
03:39 | | mode/#code [+o MahalWork] by ChanServ |
03:48 | | Chalcy [~Chalceon@Nightstar-869.bitstream.orcon.net.nz] has joined #code |
03:48 | | mode/#code [+o Chalcy] by ChanServ |
03:48 | | Chalcy is now known as Chalcedon |
03:49 | | Chalc [~Chalceon@Nightstar-869.bitstream.orcon.net.nz] has quit [Ping Timeout] |
04:57 | | Raif [~corvusign@Nightstar-7918.hsd1.mn.comcast.net] has joined #Code |
04:57 | | mode/#code [+o Raif] by ChanServ |
05:50 | | Syloqs-AFH [Syloq@NetAdmin.Nightstar.Net] has quit [Connection reset by peer] |
06:11 | | Janus [~Cerulean@Nightstar-10302.columbus.res.rr.com] has quit [Quit: Jouets de Dieu, jouets de jouets, et les jouets de me, fait naître Clair voire.] |
06:12 | | Chalcedon is now known as ChalcyF0d |
06:29 | | Mahal is now known as MahalFood |
06:39 | | Netsplit DeepThought.NY.US.Nightstar.Net <-> Troika.TX.US.Nightstar.Net quits: @Pi, @Raif, ThaquiWork, @ChalcyF0d, @jerith, @MahalFood, @Chalain |
06:41 | | Raif [~corvusign@Nightstar-7176.hsd1.wa.comcast.net] has joined #Code |
06:41 | | mode/#code [+o Raif] by ChanServ |
06:41 | | Netsplit over, joins: ChalcyF0d |
06:44 | | Chalain [~chalain@Admin.Nightstar.Net] has joined #Code |
06:44 | | ServerMode/#Code [+o Chalain] by Troika.TX.US.Nightstar.Net |
06:44 | | mode/#code [+o Chalain] by ChanServ |
06:44 | | jerith [~jerith@IRCop.Nightstar.Net] has joined #code |
06:44 | | Pi [~sysop@Nightstar-6915.hsd1.or.comcast.net] has joined #Code |
06:44 | | mode/#code [+o Pi] by ChanServ |
06:45 | | jerith is now known as NSGuest-218 |
06:46 | | ThaquiWork [~Thaqui@Nightstar-8486.adsl.xtra.co.nz] has joined #code |
06:46 | | MahalFood [~Mahal@Nightstar-4219.worldnet.co.nz] has joined #Code |
07:01 | | ThaquiWork is now known as Thaqui |
07:56 | | MahalFood is now known as MahalCrash |
07:56 | | NSGuest-218 is now known as jerith |
08:01 | | takyoji [~caleblang@Nightstar-25427.dhcp.roch.mn.charter.com] has joined #code |
08:02 | < takyoji> | Anyone know of a good php merchant software that is entirely free and doesn't need a link to the creator, yet has a lot good features? |
08:03 | < takyoji> | I've tried the one from http://shop-script.com but you require a link to thier site.. |
08:03 | < Vornicus> | no. |
08:03 | < jerith> | The only one I know of is oscommerce -- does that meet your requirements? |
08:03 | < takyoji> | hmm |
08:03 | < takyoji> | one sec |
08:03 | < Vornicus> | Oh noes linking to the writer of your software. |
08:04 | | ChalcyF0d is now known as ChalcyMeringues |
08:05 | < takyoji> | oh, i've seen that before on a competitors website |
08:05 | < takyoji> | it can be entirely reformatted though, right? |
08:05 | < jerith> | No idea. |
08:06 | < jerith> | As I said, I only know of it. |
08:06 | < jerith> | A friend was toying with it a bit. |
08:06 | < takyoji> | ahh |
08:06 | < jerith> | Is linking to them really an issue, though? |
08:06 | <@Chalain> | ZenCart is based on oscommerce, and was very robust when I looked at it a year ago. |
08:07 | < jerith> | Usually that kind of thing is a "powered by foo" link in the footer next to the webmaster mailto: link. |
08:10 | < takyoji> | it just makes us look like n00blets like we just used something else and didn't make it ourself |
08:10 | < Vornicus> | wah wah wah |
08:10 | < Vornicus> | Do you know what a Make Or Buy decision is? |
08:12 | < jerith> | takyoji: Not at all. |
08:12 | | McMartin[adventures] is now known as McMartin |
08:12 | < jerith> | Hey McMartin. |
08:12 | <@Reiver> | McM! |
08:12 | <@Reiver> | How are you, sir. |
08:12 | < jerith> | Lots of very, very professional sites run on platforms that they didn't write. |
08:13 | < Vornicus> | And all of them run on a protocol they didn't write. |
08:13 | < takyoji> | well yea |
08:15 | <@McMartin> | As for how I am: |
08:15 | <@McMartin> | Fearless was released in theaters in the US last week. I saw it today. It was ehn. |
08:15 | <@McMartin> | The IFComp 2006 has started, and I am now torrenting down the competition entrants. |
08:16 | <@Reiver> | Woo? |
08:16 | <@McMartin> | Sure. |
08:17 | < Vornicus> | Do I look unprofessional for running Apache? |
08:19 | <@Reiver> | Yes, Vorn. |
08:19 | <@Reiver> | You freakin' ametuer. |
08:19 | | mode/#code [+oooooo ChalcyMeringues Ev3 jerith MahalCrash Thaqui Vornicus] by Reiver |
08:21 | < takyoji> | Next thing I eventually need to do, is get a book on server-side programming in PHP, because all I've used is the online documentation |
08:21 | < EvilDarkLord> | You makin' a point or something, Reiver? :) |
08:21 | <@Reiver> | Me? |
08:21 | <@Reiver> | Never. |
08:21 | | * Reiver sets mode -o EvilDarkLord |
08:21 | <@Reiver> | :p |
08:21 | <@jerith> | takyoji: The online php docs are really rather good. |
08:22 | <@jerith> | And I haven't yet seen a decent book on the subject. |
08:22 | <@jerith> | Then again, I try to avoid php where I can, so I haven't really been looking. ;-) |
08:24 | < takyoji> | ahh |
08:24 | < takyoji> | yay for 2:24 AM |
08:26 | | The-Librarian [~user@ServicesAdmin.Nightstar.Net] has joined #code |
08:27 | <@Reiver> | 'Allo. |
08:27 | < The-Librarian> | hiya |
08:27 | <@jerith> | Ook! |
08:27 | | * jerith hands The-Librarian a banana. |
08:28 | | * The-Librarian grabs with a foot and nroms happily |
08:30 | < takyoji> | well, night folks |
08:30 | | takyoji [~caleblang@Nightstar-25427.dhcp.roch.mn.charter.com] has left #code [] |
08:34 | | ChalcyMeringues is now known as Chalcedon |
08:37 | <@jerith> | http://scienceblogs.com/goodmath/2006/09/programming_without_control_sm_1.php <-- O_o |
08:37 | | * jerith pilfers a meringue. |
08:39 | < The-Librarian> | weird. |
08:50 | <@Vornicus> | ...madness |
08:57 | <@Chalcedon> | who said you could have a meringue jerith ? |
08:58 | <@Reiver> | No-one. |
08:58 | <@Reiver> | This is why it was /pilfered/ |
08:58 | <@jerith> | Nobody. Which is why I pilfered it. |
08:58 | <@Reiver> | ..heh |
08:58 | <@Vornicus> | ..."Because I'm a thoroughly insane person, I'm actually working on a brainfuck interpreter in SMITH. If I ever manage to get it working, I'll be sure to post it." |
08:58 | | * Chalcedon gives meringues away to everyone /exept/ jerith |
08:59 | < The-Librarian> | lucky people have way more free time than I do |
08:59 | <@Chalcedon> | ? |
09:00 | <@Chalcedon> | Free time you say |
09:00 | | * Chalcedon wonders if this myth exists in any dimension |
09:00 | | * Reiver nrom merangue! |
09:00 | | * jerith pilfers more meringues. |
09:00 | < The-Librarian> | well apparently it does |
09:01 | < The-Librarian> | if this guy's making a brainfuck interpreter in SMITH |
09:01 | < The-Librarian> | I want to see an Ook! interpreter in SMITH |
09:01 | < The-Librarian> | dammit. |
09:01 | | * Chalcedon gives The-Librarian another meringue |
09:02 | | * The-Librarian grabs with a spare foot and nroms happily |
09:02 | < The-Librarian> | great thing about being an orangutan is that you can type with both hands and still eat goodies |
09:02 | | * Chalcedon giggle |
09:03 | | * jerith sneaks past The-Librarian and pilfers Octavo. |
09:13 | | You're now known as TheWatcher |
09:18 | | * jerith glares at his broken python. |
09:19 | <@jerith> | I fixed the db connectin oand suddenly chat logging is broken. :-( |
09:19 | <@TheWatcher> | ... |
09:19 | <@TheWatcher> | weir |
09:19 | <@TheWatcher> | +d |
09:20 | <@jerith> | It seems logging works, but it's not being sent to stdout or the db. |
09:22 | <@jerith> | Yay! Fixed. |
09:23 | <@TheWatcher> | What was wrong? |
09:23 | <@jerith> | Turns out the bot was swallowing an exception. |
09:23 | <@TheWatcher> | ech |
09:23 | <@jerith> | The "msg" object I was being passed is actually a unicode string and not a jabber entity. |
09:24 | <@jerith> | So getFrom() is not a method. |
09:29 | <@jerith> | Ugh. |
09:29 | <@jerith> | By the time the "send to user" function (the one that does the logging) gets the message, it has already been flattened. |
09:30 | | Chalcedon is now known as ChalcyZzz |
09:30 | <@jerith> | G'night Chalcy. |
09:30 | <@ChalcyZzz> | night! |
09:30 | <@ChalcyZzz> | (TV first, but I likely wont be back) |
09:39 | < EvilDarkLord> | Hm. I am trying to get the whole url, including GET parts, as a value so I can redirect to it after processing. Any ideas on how to do this? |
09:40 | < EvilDarkLord> | Oh, er. I use PHP. |
09:41 | | You're now known as TheWatcher[afk] |
09:43 | <@jerith> | Hmm... |
09:43 | <@jerith> | Perhaps something Apache gives you? |
09:43 | <@jerith> | Try looking at the superglobals you get. |
09:52 | | Ev3 [~Shemhazai@Nightstar-8502.ds1-ba.adsl.cybercity.dk] has quit [Ping Timeout] |
09:56 | | Ev3 [~Shemhazai@Nightstar-8502.ds1-ba.adsl.cybercity.dk] has joined #Code |
10:09 | | * EvilDarkLord fiddles. |
10:13 | | The-Librarian is now known as The-Librarian-Away |
10:14 | | * jerith takes the opportunity to cavort in the library and subtlely move some books around to less than optimal positions. |
10:18 | < EvilDarkLord> | Okay, the variable is there. It's just a matter of figuring out which variable it is. |
10:32 | <@jerith> | It's the purple one. :-P |
10:36 | < EvilDarkLord> | Meanie. |
10:39 | < EvilDarkLord> | Whee, success. |
10:39 | < EvilDarkLord> | array_keys() to the rescue. |
10:48 | <@jerith> | :-) |
11:08 | | You're now known as TheWatcher |
11:11 | | EvilDarkLord [althalas@Nightstar-17046.a80-186-184-83.elisa-laajakaista.fi] has quit [Ping Timeout] |
11:22 | | EvilDarkLord [althalas@Nightstar-17046.a80-186-184-83.elisa-laajakaista.fi] has joined #code |
11:23 | | mode/#code [+o Ev3] by Reiver |
11:23 | | mode/#code [+v The-Librarian-Away] by Reiver |
11:33 | | Thaqui is now known as ThaquiWork |
11:34 | | ThaquiWork is now known as ThaquiSleep |
11:50 | <@jerith> | I have just written a particularly cunning chunk of code. |
11:51 | <@jerith> | def filterlog(fn, format): |
11:51 | <@jerith> | try: |
11:51 | <@jerith> | time.strptime(fn[:-4], format) |
11:51 | <@jerith> | return True |
11:51 | <@jerith> | except ValueError: |
11:51 | <@jerith> | return False |
11:51 | <@jerith> | logfiles = [f for f in glob.glob("*.log") if filterlog(f, general['logfileformat'])].sort() |
11:52 | <@jerith> | general[] is a dict of config parameters. |
11:52 | <+fhtagncaps> | I was just going to ask that. |
11:52 | <@jerith> | And the logfileformat is specified as an arbitrary strftime() string. |
11:53 | <+fhtagncaps> | So, you only get logfiles with valid timestamps, essentially? |
11:53 | | * jerith nods. |
11:53 | <@jerith> | And as long as you use the same format string as when you created said logs, everything's shiny. |
11:54 | <@jerith> | This is a little utility to import text logs to the new db-based log my confbot is now using. |
11:58 | <@jerith> | So, since I can no longer trust the logs to sort in the correct order and I don't want to slurp everything into memory before sorting, I need another way. |
11:58 | <@jerith> | Probably best to sort by mtime. |
11:59 | <@jerith> | Except that doesn't help. |
11:59 | <@jerith> | Since they may have been copied. |
11:59 | <@jerith> | Or otherwise had their times adjusted. |
12:00 | <@jerith> | Perhaps grab the first line of each. |
12:01 | <@jerith> | Since the log timestamp format is hardcoded I'll just assume that it hasn't changed. |
12:48 | | EvilDarkLord is now known as David |
13:16 | <@jerith> | I've just gone blank, and google isn't helping. |
13:16 | <@jerith> | How do I test for EOF in python? |
13:33 | <@jerith> | Ah, by catching EOFError. |
13:42 | <+fhtagncaps> | Python likes its exceptions, yes. |
14:49 | | ChalcyZzz [~Chalceon@Nightstar-869.bitstream.orcon.net.nz] has quit [Ping Timeout] |
14:49 | | Chalcedon [~Chalceon@Nightstar-869.bitstream.orcon.net.nz] has joined #code |
14:49 | | mode/#code [+o Chalcedon] by ChanServ |
14:50 | | Reiver is now known as ReivZzz |
15:52 | < David> | I hate IE so much when doing CSS. I tried using the /exact same/ div styles on two different pages with the same kind of functionality, and it only worked on one of them. |
15:52 | | David is now known as EvilDarkLord |
15:56 | < EvilDarkLord> | I realise this sentiment wasn't new or anything, but yay rant. |
16:33 | | Neal [~Laptop@Nightstar-7924.dsl.chcgil.ameritech.net] has joined #Code |
16:33 | < Neal> | Pi = 4(1/1 - 1/3 + 1/5 - 1/7 + 1/9 - ...) |
16:33 | < Neal> | Therefore, pi = 3 + 1/6 + 9/6 + 25/6 + 49/6 ... |
16:33 | < Neal> | Pi ~ 3.141592653589793238462643383279502884197. |
16:33 | | Neal [~Laptop@Nightstar-7924.dsl.chcgil.ameritech.net] has left #Code [] |
17:08 | | aoanla [~sam@Nightstar-18783.range81-157.btcentralplus.com] has joined #code |
17:09 | | fhtagncaps [~scs105@Nightstar-20994.york.ac.uk] has quit [Quit: leaving] |
17:23 | | You're now known as TheWatcher[afk] |
18:52 | | EvilDarkLord is now known as Thokk |
18:58 | | You're now known as TheWatcher |
19:09 | | Janus [~Cerulean@Nightstar-10302.columbus.res.rr.com] has joined #code |
19:10 | | Janus [~Cerulean@Nightstar-10302.columbus.res.rr.com] has quit [Quit: Jouets de Dieu, jouets de jouets, et les jouets de me, fait naître Clair voire.] |
19:50 | | MahalCrash is now known as Mahal |
19:50 | | Chalcedon [~Chalceon@Nightstar-869.bitstream.orcon.net.nz] has quit [Ping Timeout] |
19:50 | | Chalcedon [~Chalceon@Nightstar-869.bitstream.orcon.net.nz] has joined #code |
19:50 | | mode/#code [+o Chalcedon] by ChanServ |
20:30 | | Chalcedon is now known as ChalcyOutInRain |
20:30 | | ChalcyOutInRain is now known as ChalcyUni |
20:33 | | Raif [~corvusign@Nightstar-7176.hsd1.wa.comcast.net] has quit [Connection reset by peer] |
20:35 | | Mahal is now known as MahalEarning |
20:35 | | The-Librarian-Away is now known as The-Librarian |
21:03 | | ChalcyUni [~Chalceon@Nightstar-869.bitstream.orcon.net.nz] has quit [Ping Timeout] |
21:03 | | Chalcedon [~Chalceon@Nightstar-869.bitstream.orcon.net.nz] has joined #code |
21:03 | | mode/#code [+o Chalcedon] by ChanServ |
21:14 | | Janus [~Cerulean@Nightstar-10302.columbus.res.rr.com] has joined #code |
21:42 | | The-Librarian is now known as The-Librarian-Away |
21:45 | | Thokk is now known as EvilDarkLord |
22:31 | | Chalcedon is now known as ChalcyBook |
22:33 | | The-Librarian-Away is now known as The-Librarian |
22:47 | | ThaquiSleep is now known as Thaqui |
22:54 | | Janus is now known as Jan[dinnery] |
23:04 | | EvilDarkLord is now known as EvilSLEPLord |
23:15 | | ReivZzz is now known as Reiver |
23:16 | | You're now known as TheWatcher[T-2] |
23:21 | | You're now known as TheWatcher[zZzZ] |
23:22 | | Jan[dinnery] is now known as Janus |
23:43 | | aoanla [~sam@Nightstar-18783.range81-157.btcentralplus.com] has quit [Quit: Leaving] |
23:50 | | Reiver is now known as ReivClass |
--- Log closed Mon Oct 02 00:00:04 2006 |