--- Log opened Fri Feb 15 00:00:04 2008 |
00:04 | <@McMartin> | Heh. |
00:05 | | * McMartin finds some old Swing code he wrote. |
00:05 | <@McMartin> | "Written by Michael Martin. Hurled into the Public Domain so that people can use it and not produce hideously ugly code. Yay!" |
00:14 | | * Vornicus returns. |
00:14 | < Vornicus> | So, looking back |
00:14 | < Vornicus> | Is your own code hideous? |
00:16 | <@McMartin> | Not really |
00:16 | <@McMartin> | This was a plug-and-play widget that adds a menu to (a) automatically set a proper look and feel and (b) provide a radio-button menu for changing the look and feel at will. |
00:17 | <@McMartin> | http://www.stanford.edu/~mcmartin/misc/LookAndFeelMenu.java |
00:18 | < Vornicus> | That's actually pretty sane. |
00:21 | <@McMartin> | Should be compilable and runnable directly with a mostly-do-nothing application |
00:21 | <@McMartin> | Note that to get it to truly work right under OS X you need java -Dapple.laf.useScreenMenuBar=true LookAndFeelMenu, though. |
00:41 | | Syloqs-AFH [Syloq@NetAdmin.Nightstar.Net] has quit [Connection reset by peer] |
01:19 | <@McMartin> | Hmm. Hey Vorn, still around? |
01:20 | <@McMartin> | If you could grab and see if http://www.stanford.edu/~mcmartin/Blorple.app.tar.gz will expand out to a working-on-10.4 app bundle? |
01:28 | | AnnoDomini [AnnoDomini@83.21.50.ns-3298] has quit [Quit: Don't trust the skull.] |
01:28 | < C_tiger> | I'm a moron. Can I get some advice? |
01:29 | < C_tiger> | Ok, I have a bunch of ranges, 1-234, 567-678, etc |
01:29 | < C_tiger> | How do I check to see if a given number is in one of these ranges? |
01:29 | < C_tiger> | or, better, how would I best store these ranges? |
01:29 | < Vornicus> | low < a < high |
01:30 | < C_tiger> | yes. |
01:30 | <@McMartin> | low <= a < high is actually the traditional one. |
01:30 | < Vornicus> | well, with the appropriate of <= and < depending on the way the ranges are. |
01:30 | <@McMartin> | How many continuous ranges, and what's the maximum range? |
01:30 | <@McMartin> | It'll either be some kind of list of low-high pairs, or it will be a single-lookup bitmask array. |
01:30 | < Vornicus> | And, just two numbers is usually the way you do it. If you're working in Python, xrange will handle it. |
01:31 | < C_tiger> | I mean if I have, say, an indeterminate number of ranges and I just need to return a bool of if it's in or out. |
01:31 | <@McMartin> | Are you expecting a ridiculous number of ranges? |
01:31 | < C_tiger> | ~ 100? |
01:31 | <@McMartin> | And are the ranges guaranteed to not overlap? |
01:31 | <@McMartin> | OK, at 100, linear search won't be too bad. |
01:31 | < C_tiger> | no, not guaranteed not to overlap. |
01:32 | <@McMartin> | OK, just test them all in sequence, then. |
01:32 | < C_tiger> | but this function gets called a lot. |
01:32 | <@McMartin> | And if they can overlap you can't do a partition. |
01:32 | < C_tiger> | Ok, if they can't overlap? |
01:32 | < C_tiger> | I can test for overlap when I add to them. |
01:33 | <@McMartin> | Sorted list based on low value, then do a binary search to find the range to test. |
01:33 | <@McMartin> | Well, sorted list based on range, rather. |
01:33 | <@McMartin> | And if you end up at a leaf, then the answer is "no, not in range" |
01:34 | < C_tiger> | Ok. |
01:34 | <@McMartin> | Well |
01:34 | <@McMartin> | If you end up at a fractional index. |
01:34 | < C_tiger> | I get the general idea. |
01:34 | <@McMartin> | That makes a test be log(n) instead of (n) in the number of ranges. |
01:35 | < C_tiger> | Ok. |
01:35 | <@McMartin> | Do you have a bound on lowest low and highest high? |
01:35 | < C_tiger> | yes. |
01:35 | <@McMartin> | If those are "reasonable" you can make an array of booleans, and then just look up by index. |
01:35 | < C_tiger> | It's of seconds in a week. |
01:35 | < C_tiger> | not that reasonable, that was my first thought. |
01:35 | <@McMartin> | Yeah, that's a bit much for an array. |
01:36 | <@McMartin> | Unless the ranges are so sparse and so numerous that it's still cheaper that way |
01:38 | < C_tiger> | My gut says probably 6-8 switches a day or so, so really I could just do a O(n) search. But it has the potential to balloon if people start putting in their schedules on a minute-by-minute basis. |
01:39 | < C_tiger> | Ok, I know how you all hate perl, but is there an already-implemented binary search in perl? |
01:41 | <@McMartin> | Probably. Check CPAN. |
01:41 | < C_tiger> | Ok. |
02:05 | <@Reiver> | http://reaverta.livejournal.com/28306.html - Fun with Fractals on a wet afternoon! |
02:08 | <@McMartin> | Fimo! |
02:19 | | Derakon[AFK] is now known as Derakon |
02:26 | < C_tiger> | Ugh, this binary search module confuses me, linear search time :P |
02:27 | <@Derakon> | Then celebrate Viking's Day instead. |
02:27 | <@Derakon> | Er, wrong channel. |
02:28 | < C_tiger> | Oh, nevermind, it takes as one of its arguments a function, I think. |
03:03 | < C_tiger> | Hmmm... which is more efficient: return (1-($i%2)) or return !($i%2) |
03:04 | < C_tiger> | probably ! |
03:04 | <@Derakon> | I think if you have to care, you wouldn't be using a language with variable dongles. |
03:07 | < Vornicus> | What Der said. |
03:07 | < Vornicus> | Anyway "more efficient" isn't what you should be thinking about. What makes more /actual sense/? |
03:15 | < C_tiger> | the ! makes more sense. |
03:15 | < Vornicus> | ok then. |
03:16 | | Raif [~corvusign@67.161.90.ns-4200] has joined #Code |
03:16 | < C_tiger> | the 1- is probably better though since I can use test($time)*4+$status |
03:17 | < C_tiger> | although logically, $status+=4 if test($time) makes more sense. |
04:40 | | GeekSoldier|bed [~Rob@91.18.78.ns-27262] has joined #code |
04:40 | | Derakon is now known as Derakon[AFK] |
05:44 | | gnolam|away is now known as gnolam |
05:52 | | gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has quit [Quit: Z?] |
05:59 | | Derakon[AFK] is now known as Derakon |
06:37 | | Derakon is now known as Derakon[AFK] |
07:57 | | GeekSoldier_ [~Rob@91.18.78.ns-27262] has joined #code |
07:58 | | GeekSoldier|bed [~Rob@91.18.78.ns-27262] has quit [Ping Timeout] |
08:31 | | Vornicus is now known as Vornicus-Latens |
08:38 | | You're now known as TheWatcher |
09:00 | | AnnoDomini [AnnoDomini@83.21.50.ns-3298] has joined #Code |
09:00 | | mode/#code [+o AnnoDomini] by ChanServ |
09:20 | | * Serah hugs AnnoDomini |
09:25 | | * AnnoDomini hugs Serah |
11:08 | | Raif [~corvusign@Admin.Nightstar.Net] has quit [Quit: A trebuchet is not a marital aid. Many bothans died to bring us this information.] |
12:37 | | gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has joined #Code |
12:37 | | mode/#code [+o gnolam] by ChanServ |
13:00 | | AnnoDomini [AnnoDomini@83.21.50.ns-3298] has quit [Ping Timeout] |
13:07 | | AnnoDomini [AnnoDomini@83.21.49.ns-4142] has joined #Code |
13:07 | | mode/#code [+o AnnoDomini] by ChanServ |
13:12 | | You're now known as TheWatcher[afk] |
14:00 | | You're now known as TheWatcher |
14:26 | | GeekSoldier_ is now known as GeekSoldier |
15:24 | | Reiver [~reaverta@Admin.Nightstar.Net] has quit [Quit: Rebooting.] |
16:15 | | Reiver [~reaverta@Admin.Nightstar.Net] has joined #Code |
16:16 | | mode/#code [+o Reiver] by ChanServ |
17:06 | | You're now known as TheWatcher[afk] |
19:06 | | You're now known as TheWatcher |
20:27 | | Vornicus-Latens is now known as Vornicus |
20:44 | | Vanilla [~Lips@217.168.67.ns-23583] has joined #Code |
20:45 | | Vanilla [~Lips@217.168.67.ns-23583] has quit [Quit: (в тюрьме столько не сидят,сколько вы в интернете...)] |
21:23 | | GeekSoldier [~Rob@91.18.78.ns-27262] has quit [Ping Timeout] |
21:25 | | GeekSoldier [~Rob@91.18.127.ns-3984] has joined #code |
23:39 | | JeffL [~JPL@Nightstar-764.dsl.sndg02.pacbell.net] has joined #code |
--- Log closed Sat Feb 16 00:00:11 2008 |