--- Log opened Wed Feb 20 00:00:28 2008 |
--- Day changed Wed Feb 20 2008 |
00:00 | | You're now known as TheWatcher[T-2] |
00:06 | | You're now known as TheWatcher[zZzZ] |
00:25 | | Reltzik [Reltzik@Nightstar-15817.dsl.pltn13.sbcglobal.net] has joined #code |
00:27 | < Reltzik> | Okay, Vorn? NOW you can accuse me of crossing into mad-scientist territory. |
00:28 | <@EvilDarkLord> | You made it dependent on a strong AI already? |
00:29 | < Reltzik> | No, not that bad, but I AM looking really hard at designing a pseudo-language for it. |
00:30 | < Reltzik> | The food processor is another story. |
00:31 | <@Vornicus> | Relt: You need professional help. |
00:31 | < Reltzik> | ... for the coding or for my psychology? |
00:33 | <@Vornicus> | both. |
00:34 | < Reltzik> | Oh, come on, what's the worst that could happen? |
00:35 | <@Vornicus> | Look, just, don't blame me when gibbering troglodytes from the dungeon dimensions decide that your mind is probably tasty. |
00:36 | < Reltzik> | ..... I thought they'd already decided that about all of us. |
00:36 | <@McMartin> | Minilanguages often make life easier. |
00:36 | <@McMartin> | That said, you should start with a simple set of key-value pairs because many languages have autoparsers for them. =P |
00:37 | | Serah [~Z@87.72.35.ns-26506] has quit [Ping Timeout] |
00:37 | | * Reltzik wrote a compiler from scratch once as a school project, has a LITTLE idea of what he's getting into. |
00:37 | <@Vornicus> | use json if you don't need actual code. |
00:38 | < Reltzik> | McM: Expand on "key-value pairs"? I've got about half the concepts I need, but I only know the right vocabulary for about half of those. |
00:39 | <@McMartin> | Map<String, String>, in Java terms. |
00:39 | <@McMartin> | Or java.util.Properties, for the way they exist on the filesystem. |
00:39 | < Reltzik> | Okay, got it. |
00:40 | < Reltzik> | Vorn: Does it make you think of me as MORE or LESS crazy to hear that I finally decided not to go with the listenable variables? |
00:40 | < Reltzik> | ((Well, LESS, obviously, but coupled with this...)) |
00:40 | <@Vornicus> | Less. |
00:43 | | * Reltzik will keep the code he wrote for that, though, might come in handy later. |
00:48 | < Reltzik> | *reading* Doesn't look like you can do more than declare the equivalent of portable C structs with this. |
00:49 | <@McMartin> | Well, yes. |
00:49 | < Reltzik> | Which I will admit is handy, but I might need a smidge more. |
00:49 | <@McMartin> | That's often all you need. |
00:49 | <@McMartin> | In particular, don't use something bigger unless you can prove you need it. |
00:50 | | * Reltzik thinks about whether he can hack something out with this, but he's pretty sure he needs logical conditionals, basic arithmetic comparisons, and the ability to modify data. |
00:50 | | Derakon[AFK] is now known as Derakon |
00:51 | | Vornicus is now known as Vornicus-Latens |
00:52 | | Serah [~Z@87.72.35.ns-26506] has joined #Code |
00:54 | | * Reltzik thinks he scared Vorn away. |
00:59 | | Serah [~Z@87.72.35.ns-26506] has quit [Ping Timeout] |
01:15 | <@gnolam> | Hmm. When you start naming destructor helper functions "Kill_With_Righteous_Fire(...)", it's /probably/ time to go to bed... |
01:16 | | Bellamy [Jennet@Nightstar-20631.216-254-250.iw.net] has joined #code |
01:16 | < Reltzik> | That or switch to sexual euphamisms. |
01:16 | <@gnolam> | Too late. I already named a file "lab1a.cpp". |
01:21 | <@Derakon> | http://www.penny-arcade.com/comic/2003/11/28 |
01:32 | | gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has quit [Quit: Z?] |
02:05 | <@McMartin> | Hmm. |
02:05 | <@McMartin> | Apparently Sokoban is PSPACE-complete. |
02:05 | <@Derakon> | Indeed. I should look up what that means. |
02:05 | <@Derakon> | Or is that the new term for NP-complete? |
02:06 | <@McMartin> | PSPACE is strictly larger than NP. |
02:06 | <@McMartin> | PSPACE is the set of problems solvable in a polynomial amount of space. |
02:06 | <@McMartin> | It has been known for some decades that PSPACE=NPSPACE. |
02:06 | <@McMartin> | NPSPACE being problems verifiable in a polynomial amount of space. |
02:06 | | * Derakon nods. |
02:07 | <@McMartin> | (In brief, all you need to keep track of for an NPSPACE problem is which solutions you've already tried, and you can encode this in a manner that is the square of the space required by the problem, which is still polynomial) |
02:14 | <@Derakon> | So basically, Sokoban can be solved in polynomial time and verified in polynomial time. Right? |
02:14 | <@McMartin> | space. |
02:14 | <@McMartin> | PSPACE problems can be, I think, guaranteed to require exponential time. |
02:14 | <@McMartin> | They can be solved and verified in polyspace. |
02:15 | <@McMartin> | I'm not sure what verification means in this context, though, honestly. |
02:15 | <@Derakon> | Oh, right. Okay. |
02:15 | < Reltzik> | Doesn't it mean, "I have a potential solution, how long will it take me to test it?" |
02:16 | <@McMartin> | Yes, but this leaves both "solution" and "size of problem" undefined |
02:16 | <@McMartin> | Number of crates? Size of room? Cap on moves? |
02:17 | <@McMartin> | I imagine a solution is a series of moves which, from the start state, will get you to an end state |
02:17 | <@Derakon> | So verifying it should just be a matter of playing it back. |
02:18 | <@McMartin> | Yup. |
02:18 | <@McMartin> | But using the NPSPACE trick to use this to solve stuff is guaranteed to take exponential time. |
02:18 | <@McMartin> | Since it's a brute-force search through all possible sequences of moves. |
02:18 | <@McMartin> | "Did just pressing up once solve it? No." |
02:18 | <@McMartin> | "How about up twice?" |
02:18 | <@McMartin> | "Up, then left?" |
02:18 | <@McMartin> | etc. |
02:18 | <@Derakon> | How about left? Right? Down? |
02:19 | <@McMartin> | Right. |
02:19 | <@McMartin> | First all one-move sequences, then all two-move sequences, etc. |
02:19 | <@Derakon> | Mmm, quad-branching trees. |
02:19 | <@McMartin> | Well, no, that'll eat too much space. |
02:19 | <@McMartin> | You can probably map all sequences to Z. |
02:19 | <@Derakon> | That's how fast the search space grows, even if you encode it differently. |
02:19 | <@McMartin> | Oh. Yeah. |
02:19 | <@McMartin> | Just saying you won't want to directly encode it that way. |
02:19 | <@Derakon> | Unless you have way too much RAM, no. |
02:20 | < Reltzik> | So, monkeys at typewriters recreating the entire works of Shakespeare. |
02:20 | <@Derakon> | Better than that, as it can be assumed that the monkeys repeat each other a fair amount. |
02:20 | <@Derakon> | Additionally, you can eliminate branches off of moves that do not change the game state. |
02:21 | <@Derakon> | (i.e. bashing your head into a wall) |
02:21 | < Reltzik> | ((And somehow denied the moves of "break typewriter", "smear feces on works", so forth.)) |
02:21 | < Reltzik> | Dammit, you beat me to it. |
02:22 | | * Reltzik thinks this is probably similar to a neat proof that he -- though probably some much brighter person much earlier, originally -- came up with about how humans will never be able to describe more than a countable set of numbers. |
02:23 | < Reltzik> | ... unless you bring in the many-worlds model of time travel. |
02:23 | <@McMartin> | Derakon: And yes, there are heuristics that will help. |
02:23 | <@McMartin> | The fun bit is, if it turns out there are heuristics that dramatically improve Sokoban solutions, that means you can solve arbitrary logic problems by encoding them as Sokoban levels. |
02:24 | <@McMartin> | And then those strategies will help on those logic problems. |
02:24 | <@Derakon> | Indeed. :) |
02:25 | <@McMartin> | That said, if it works out like Minesweeper's NP-Completeness, they won't actually help much, becuase the heuristics will translate to "Don't make A and B both false when (A or B) is part of your CNF problem" |
02:47 | | Reiver [~reaverta@Admin.Nightstar.Net] has quit [Ping Timeout] |
02:55 | | Reiver [~reaverta@Admin.Nightstar.Net] has joined #Code |
02:55 | | mode/#code [+o Reiver] by ChanServ |
03:19 | | Derakon is now known as Derakon[AFK] |
03:35 | | Derakon[AFK] is now known as Derakon |
03:45 | <@Chalain> | Okay, I need your help calling names again. |
03:45 | <@Derakon> | Pug-nosed slug for a butt! |
03:45 | <@Chalain> | heh |
03:46 | <@Chalain> | A common idiom for collection/list/array classes is to have a "head" or "first" method that returns the first element. |
03:46 | <@Chalain> | Likewise, "tail" or "last" for the final element. |
03:46 | <@ToxicFrog> | tail is usually "everything but head" |
03:46 | <@Chalain> | I just came across a snippet of Ruby that's pretty straightforward and meaningful: module Enumerable; def rest; self[1..-1]; end; end |
03:46 | <@Chalain> | Ah, good point to clarify, then. Let's go with "last". |
03:47 | <@Chalain> | That definition of "rest" is equal to your definition of tail, ToxicFrog. |
03:47 | <@Chalain> | Also, now that I think about it, I've only ever seen tail implemented as the final element. But anyway, it's called "last" in Ruby so you and I can sleep at night on that definition. :-) |
03:47 | <@Chalain> | Anyway. |
03:48 | <@Chalain> | I want the name of the thing that is everything but "last". |
03:48 | <@Chalain> | E.g. self[0..-2] |
03:49 | <@Chalain> | I thought about calling it the "lizard", see, because it doesn't have a tail... but that's overly cutesy and not intuitive to read. |
03:49 | <@ToxicFrog> | I don't know of a name for that. |
03:49 | | Bellamy is now known as Simone |
03:50 | <@ToxicFrog> | Same problem here as push-pull-pop-??? |
03:50 | <@Chalain> | I hate to go PHP in Ruby, but right now the best term I've come up with is "rrest". (In PHP r* methods usually imply "reverse". E.g. if you saw "rhead" you would know it was the "tail", etc.) |
03:50 | <@ToxicFrog> | (btw, Haskell tail is everything-but-first, as is Lisp cdr) |
03:50 | <@Chalain> | Mmm, no, the opposite ends of push and pop are shift and unshift. |
03:50 | <@ToxicFrog> | (which is where I first ran into it) |
03:50 | <@Derakon> | Chalain: what about car/cdr? http://en.wikipedia.org/wiki/CAR_and_CDR |
03:51 | <@ToxicFrog> | Derakon: car is first. Cdr is everything but first. |
03:51 | <@ToxicFrog> | He wants everything but last. |
03:51 | <@Chalain> | ANd I always remember them as follows: "If you're driving a truck, and the load SHIFTS, something has fallen off the back of the truck. If you get out and put it back on, that's UNSHIFTing the load." |
03:51 | <@Derakon> | Oh, right. |
03:51 | <@ToxicFrog> | Chalain: so, wait. If you have a queue, you push items into it, and unshift them off it? |
03:51 | <@Chalain> | unshift is "put on tail" |
03:51 | <@Chalain> | You'd shift them off. |
03:52 | <@Chalain> | of a dequeue. |
03:52 | <@ToxicFrog> | Ok. Every queue I've ever used or written uses "push" to add things to the tail and "pull" to take them from the head. |
03:52 | <@ToxicFrog> | (well, or "next", but that's more of a generic-iterator thing - the next operator is still said to be "pulling from the queue") |
03:53 | <@Chalain> | I've seen push/pop get blurred in the case of queue/stack. If there's only one place to put on and only one place to take off, you can push/pop even if it's a FIFO (queue). But that's my experience talking, not doctrine. I.e. that may be my |
03:53 | <@Chalain> | experience of seeing lots of really bad code. :-) |
03:54 | <@ToxicFrog> | Well, that I can see. But I mean, for a double ended thing. |
03:54 | <@ToxicFrog> | Push is put on top. |
03:54 | <@ToxicFrog> | Pop is take from top. |
03:54 | <@Chalain> | Yes. |
03:54 | <@ToxicFrog> | Pull is take from bottom. |
03:54 | <@ToxicFrog> | ??? is put on bottom. |
03:54 | <@Chalain> | Or shift. |
03:54 | <@ToxicFrog> | See, I have never seen shift or unshift. |
03:54 | <@ToxicFrog> | And it conflicts with pull. |
03:54 | <@Chalain> | If you're in perl/php/ruby land, shift is take from back/tail/foot/bottom, unshift is put on back/tail/foot/bottom |
03:54 | <@ToxicFrog> | You either end up shifting a queue, or pulling and unshifting a queuestack. |
03:54 | <@Chalain> | That is so crazy. |
03:55 | <@ToxicFrog> | None of these are languages I use much or like at all, so~ |
03:55 | <@Chalain> | :-) |
03:55 | <@Chalain> | $:.unshift File.dirname(__FILE__) |
03:55 | <@Chalain> | That's idiomatic Ruby for "put this file's directory at the end of the include path." |
03:55 | <@Chalain> | ( $: is shorthand for the include path ) |
03:56 | <@ToxicFrog> | And this is one of the reasons why I don't like ruby. |
03:56 | <@Chalain> | Okay, stop. |
03:56 | <@Chalain> | I've just had about 20 flamewars about that already today. I'm done. :-) |
03:56 | <@Chalain> | I'll just accept that you don't like Ruby and respect your opinion. Deal? |
03:57 | <@ToxicFrog> | Alright. |
03:59 | <@Chalain> | Hah! I could call in the "unrest". |
04:00 | <@ToxicFrog> | Pfft |
04:00 | <@ToxicFrog> | To me that implies head, but it would be amusing. |
04:00 | <@Chalain> | Ah, true. |
04:00 | <@Chalain> | unlast? Ewww. Heh. |
04:03 | | * Chalain gets back to building his very own Ruby gem. |
04:03 | <@Chalain> | Aside from the fact that it's in Ruby, TF, you'd probably like it. |
04:03 | <@Chalain> | It's called "kitchen_sink", and you and I have scrabbled out big pieces of it in Lua in the past. |
04:04 | <@Chalain> | I.e. it's a bunch of microtweaks to the language in general. |
04:05 | | * ToxicFrog nods |
04:05 | <@ToxicFrog> | I suspect that every programmer comes up with an equivalent for their favoured language. |
04:07 | <@Chalain> | There is an astonishingly large number of them in Ruby. Nobody bothers to gather them together, though. |
04:07 | <@Chalain> | UNTIL NOW, MUHUHAHAHA |
04:44 | | GeekSoldier|bed [~Rob@91.18.102.ns-3831] has joined #code |
04:45 | | GeekSoldier|bed is now known as GeekSoldier|work |
06:13 | <@jerith> | Chalain: Doe you need to do anything special to make utility_belt work? |
06:13 | <@jerith> | I installed it and required it in .irb and didn't notice any difference. |
06:18 | | Reltzik [Reltzik@Nightstar-15817.dsl.pltn13.sbcglobal.net] has quit [Quit: DEATH TO THE UNDEAD!] |
06:43 | <@Chalain> | jerith: do you mean .irbrc? |
06:43 | <@Chalain> | try a blatant "require 'utility_belt'" and SWH |
06:43 | <@Chalain> | It should be obvious if/when it works. The prompt changes, and you get syntax coloring. |
06:43 | <@Chalain> | wait |
06:44 | <@Chalain> | by syntax coloring I mean "colored output" |
06:44 | <@Chalain> | Input text is not syntax-colored, and output is colored by some theme or scheme other than syntax. |
06:45 | | Derakon is now known as Derakon[AFK] |
06:46 | <@Chalain> | In other news, this seems like it should be a functional one-liner rather than a grunty procedural 5-liner: http://pastie.textmate.org/private/tvnxtjj64wmoafbktyakhg |
06:47 | <@Chalain> | Essentially it means: if opts has the :conditions key, append "AND (conds)" to it. Otherwise, assign "conds" to opts[:conditions] |
07:14 | | AnnoDomini [AnnoDomini@83.21.64.ns-27289] has joined #Code |
07:14 | | mode/#code [+o AnnoDomini] by ChanServ |
07:51 | | gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has joined #Code |
07:51 | | mode/#code [+o gnolam] by ChanServ |
08:32 | | gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has quit [Quit: #@гд&! construction workers.] |
08:40 | | You're now known as TheWatcher |
12:02 | | Vornicus-Latens is now known as Vornicus |
12:04 | <@C_tiger> | So the bottom is the lowest numbered? wow I'd have called that the top :( |
12:04 | <@C_tiger> | or front. |
13:00 | | AnnoDomini [AnnoDomini@83.21.64.ns-27289] has quit [Ping Timeout] |
13:07 | | AnnoDomini [AnnoDomini@83.21.46.ns-26640] has joined #Code |
13:07 | | mode/#code [+o AnnoDomini] by ChanServ |
14:33 | | gnolam [lenin@85.8.5.ns-20483] has joined #Code |
14:33 | | mode/#code [+o gnolam] by ChanServ |
15:08 | | gnolam [lenin@85.8.5.ns-20483] has quit [Ping Timeout] |
15:29 | | gnolam [lenin@85.8.5.ns-20483] has joined #Code |
15:29 | | mode/#code [+o gnolam] by ChanServ |
15:34 | <@jerith> | Chalain: Try this one: |
15:34 | <@jerith> | opt[0][:conditions] = (((opt[0].key? :conditions) ? [opt[0][:conditions]] : []) + opts).join(" AND ") |
15:34 | <@jerith> | Ruby makes that very messy, though. |
15:36 | <@jerith> | You can probably wrap the much-parenthesised thing in its own little function if it's going to be reused for some other bit of functionalness. |
15:38 | <@jerith> | Oops, s/opts/["(#{conds})"]/ |
15:39 | <@jerith> | Better yet, pastebinned next to the original: http://pastie.textmate.org/private/csjesxqzp3abjjhhm3ehw |
16:14 | | Derakon[AFK] [~Derakon@Nightstar-8000.hsd1.wa.comcast.net] has quit [Operation timed out] |
16:43 | | GeekSoldier|work is now known as GeekSoldier |
17:03 | | You're now known as TheWatcher[afk] |
17:21 | | William__ [~JPL@Nightstar-3116.dsl.sndg02.pacbell.net] has quit [Ping Timeout] |
17:30 | | JeffL [~JPL@Nightstar-12251.dsl.sndg02.pacbell.net] has joined #code |
17:38 | | Jeff [~JPL@Nightstar-12251.dsl.sndg02.pacbell.net] has joined #code |
17:39 | | JeffL [~JPL@Nightstar-12251.dsl.sndg02.pacbell.net] has quit [Ping Timeout] |
17:41 | | * gnolam unleashes his fury upon OpenOffice and then hugs SciLab. |
18:08 | | AnnoDomini is now known as Pete |
18:30 | | You're now known as TheWatcher |
18:42 | <@Chalain> | jerith: http://pastie.textmate.org/private/gvlep49q7hgrtrgigs7e1w |
21:01 | <@jerith> | Chalain: Nice! |
21:01 | <@jerith> | Much cleaner than mine. |
21:05 | | GeekSoldier is now known as GeekSoldier|bed |
21:22 | <@Chalain> | Mennh. It's pretty cryptic, though. |
21:22 | <@Chalain> | Not to say that I didn't use it. :-) |
21:25 | <@jerith> | I don't find it any more cryptic than mine. |
21:25 | <@Chalain> | well, the [opts[0][:conditions] || []].flatten is a bit bizarre. |
21:25 | <@Chalain> | It's spoonfeeding the join, essentially, to turn join into a ? : method. |
21:26 | <@jerith> | The other day I had to write the comment: "# Warning: the following is Clever Code. Touch at your own mortal peril." |
21:26 | <@Chalain> | lol |
21:26 | <@jerith> | The code in question came from the internet. |
21:27 | <@jerith> | It's an interesting exercise, actually. |
21:27 | <@Chalain> | while seems_like_a_good_idea(@time) { ... } |
21:27 | | * EvilDarkLord realizes after some good time spent debugging that feeding the same string into both compared pointers is not a Good Thing. |
21:28 | <@jerith> | I have a class that instantiates two other classes. All three need their own options. |
21:28 | <@jerith> | I wanted to be able to write something like the following: |
21:29 | <@jerith> | mm = MuchMagic.new(:foo => "opt1", :class1_server => "mumble.com", :class2_timeout => 17) |
21:31 | <@jerith> | Such that class1 would then be initialised with {:server => "mumble.com"} and class2 with {:timeout => 17} |
21:31 | <@Chalain> | k... |
21:31 | <@Chalain> | This seems like standard factory stuff... |
21:31 | <@Chalain> | Or rather, that it could be reduced to same, possibly at the cost of elegance...? |
21:31 | | * Chalain waits to see what you did with it. |
21:32 | <@jerith> | I don't actually have the code handy. |
21:32 | <@jerith> | And it's clever enough that I'd have to look it up. |
21:33 | <@Chalain> | ah, k. |
21:33 | <@Chalain> | well.... |
21:33 | <@Chalain> | if the inittors are mutually exclusive, you could do def initiliaze(*args); child1 = Child1.new(*args); child2 = Child2.new(*args); end |
21:34 | <@jerith> | I wrote an extract_opts() function that took a prefix and mm's options hash and returned all entries with keys starting with the prefix with the prefic removed. |
21:35 | <@jerith> | Chalain: child1 and child2, in this case, are both service clients to different services. |
21:35 | | Pete [AnnoDomini@83.21.46.ns-26640] has quit [Ping Timeout] |
21:36 | <@jerith> | They take some parameters that are the same (server, port, etc.) and some that are different. |
21:36 | | GeekSoldier|bed [~Rob@91.18.102.ns-3831] has quit [Ping Timeout] |
21:37 | <@Chalain> | Oooh. An even better version for you, jerith: |
21:37 | <@Chalain> | opt[0][:conditions] = [opt[0][:conditions], conds].reject(&:nil?).join(" AND ") |
21:37 | | AnnoDomini [AnnoDomini@83.21.46.ns-26640] has joined #Code |
21:37 | | mode/#code [+o AnnoDomini] by ChanServ |
21:38 | <@jerith> | Ooh, nice! |
21:39 | <@Chalain> | s/for you/for me/ :-) |
21:39 | <@Chalain> | There it's a lot more clear what we're doing in the array context. |
21:39 | <@jerith> | http://pastie.textmate.org/private/7tphd2guxq9vhqpjcphrw <-- Found my code. :-) |
21:39 | <@jerith> | s/reject(&:nil?)/compact/ |
21:40 | <@jerith> | Although the two are semantically equivalent. |
21:40 | <@Chalain> | Ooooh. Go you with the knowing of the class references. |
21:41 | <@jerith> | I've used it a couple of times. |
21:41 | <@jerith> | I keep having to look up .select() because everything esle I've used calls it .filter(). |
21:45 | <@Chalain> | Yeah |
21:46 | <@McMartin> | Don't forget to escape those strings |
21:48 | <@jerith> | Which strings? |
21:48 | <@jerith> | In my s///? |
21:48 | <@McMartin> | opts looks suspiciously like user data. |
21:48 | <@McMartin> | You don't want to let some string made out of them go somewhere sensitive, or pwnz0rsh1p ensues |
21:48 | <@jerith> | Oh, that. |
21:48 | <@AnnoDomini> | "Strings? In my s///?" It's more likely than you think! |
21:49 | <@jerith> | No, I'm writing all the code that uses it. |
21:49 | <@jerith> | It's going away, anyway, because the new iteration makes it more convenient to pass in whole opts hashes for the inner classes. |
21:52 | <@jerith> | BTW, Chalain, nice to see you back on IRC. |
21:57 | | * jerith gives up on the day and goes to sleep. |
21:57 | <@jerith> | 'Night all. |
22:00 | | AnnoDomini is now known as Pete |
22:27 | <@Chalain> | McMartin: I am reminded of little Bobby Tables. (http://xkcd.com/327/) |
23:09 | <@McMartin> | Chalain: Yes, that general class of attacks has been beating buffer overruns for severity and prevalence for something like four years running now |
23:14 | <@Chalain> | Yup. |
23:14 | <@Vornicus> | Woo injetion |
23:14 | <@Chalain> | Happily, that particular bit of code is used by programmers. conditions is a straight pass-through to an sql WHERE clause. |
23:17 | <@Chalain> | Happily for me, at any rate. I don't need to sanitize, because if I get called with an injected string, it means some programmer gave me an injected string. |
23:18 | <@Chalain> | This type of error is of the DWH class. |
23:18 | <@Chalain> | class DeserveWhatHappens < Error; end |
23:19 | <@Chalain> | Also, if a programmer gets clever with their SQL string, the expectation is that it should work rather than be refused. |
23:19 | <@Chalain> | class DoNotStickHandInMeatGrinder < DeserveWhatHappens; end |
23:20 | | Simone is now known as Julia |
23:21 | | * McMartin actually tends to consider that a fundamental API flaw, but. |
23:21 | <@McMartin> | See also: Hibernate 2, and the many papers it got me |
23:21 | <@McMartin> | Because its own query language was actually a regexp transformation of/to SQL |
23:21 | <@McMartin> | And people would happily pass user strings to it. |
23:22 | <@McMartin> | Becuase hey, it's not like it's Connection.execute, right~ |
23:23 | | Reltzik [Reltzik@Nightstar-15817.dsl.pltn13.sbcglobal.net] has joined #code |
23:23 | <@Chalain> | Heh |
23:24 | <@Chalain> | Actually, as it stands, conditions is already sort of the escape hatch in Rails. |
23:24 | <@McMartin> | Worse, a lot of automatic tools would mistake the transform for sanitization. |
23:25 | <@Chalain> | E.g. :limit => 3 and :order => 'last_name, first_name' are great, but there is no :like clause, so you have to go with :conditions, which essentially accepts sql. |
23:25 | <@McMartin> | Hibernate 3 deals with this by replacing the query language with a chain of programmatic filters. |
23:25 | <@Chalain> | I told you about the Resmark hibernate debacle, didn't I? |
23:25 | <@McMartin> | I don't recall it if so |
23:25 | <@Chalain> | (And/or Vornicus may have told it.) |
23:25 | <@McMartin> | (Also, Rails is largely beyond me, but duly noted as per what the primary injection vector for rails apps will be~) |
23:26 | <@Chalain> | Resmark decreed Hibernate to be Of The Devil because "we lost 6 months to it before we had to remove it". |
23:26 | <@Chalain> | But you have to understand that "it" in that sentence should expand to "our astonishingly improper use of it" |
23:27 | <@McMartin> | Did they do anything of particularly epic fail? |
23:27 | <@Chalain> | I don't remember any of the details (it was already a Past Legend by the time I hired on), but they were running hibernate on the *client* computers to leverage its most excellent object caching. |
23:27 | <@Chalain> | Oh yes. |
23:27 | <@Vornicus> | |
23:28 | <@McMartin> | Awesome. |
23:28 | <@Vornicus> | |
23:28 | <@Vornicus> | FLEE |
23:28 | | * Chalain DID, Vornicus. Chalain DID. |
23:28 | | * Vornicus never saw that bit, but would have fled if he had. |
23:28 | <@Chalain> | The Brandomizer took me to lunch in December of 2006 to talk me out of resigning. |
23:29 | | * Vornicus still occasionally gets a chuckle out of "schedule things at random times" |
23:29 | <@Chalain> | Best exchange from that lunch: <Brandon> Is there anything we can do to convince you to stay? <Chalain> I'm not really sure. To be honest, I'm still pretty pissed at you. |
23:29 | | Vornicus is now known as Finerty |
23:30 | <@gnolam> | Heh. |
23:30 | <@Chalain> | I'm not sure when I became a Crotchety Bastard. |
23:30 | <@McMartin> | I, uh, assume this was not a basic distributed app |
23:30 | <@McMartin> | Because there clients are the only things that exist, so it would be there to handle persistence back to the core server. |
23:30 | <@Finerty> | This was a client-server app. The server was, um. It was PostgreSQL |
23:30 | <@Chalain> | I think it was on or before my birthdate. (See definition of "bastard") |
23:31 | <@Chalain> | It was an [n-2]-tier app. |
23:31 | <@McMartin> | OK |
23:31 | <@McMartin> | (But then, if you had it on the client in a 2-tier app, you wouldn't be complaining) |
23:31 | <@Chalain> | E.g. the server tier was PostgreSQL and the middle tier was Ethernet |
23:31 | | Pete is now known as AnnoDomini |
23:32 | <@McMartin> | The idea of jamming Hibernate into an applet, though... |
23:32 | <@Chalain> | oh, this was a full-blown desktop app. |
23:33 | <@McMartin> | Aha. |
23:33 | <@Chalain> | When you double-clicked Resmark.lnk on your desktop, it called java.exe on a SWT monstrosity. |
23:33 | <@McMartin> | I think I can still come up with excuses to put it there, but it's tricky. |
23:33 | <@Chalain> | So yeah, they were a bunch of college kids who figured they could grab Hibernate and get a bunch of stuff for free. |
23:33 | <@Chalain> | Concurrency against n other instances of Hibernate? Not one of them. |
23:34 | <@McMartin> | How much stuff was it pushing out? |
23:34 | <@Chalain> | I bet it could still be done, and I further bet that the solution would look and act a lot like the homegrown DbCache class that got written in response: it cached objects for a variable amount of time. |
23:35 | <@Chalain> | stuff? |
23:35 | <@McMartin> | I was just thinking of giving each client its own table, defined by some negotiated UUID. |
23:35 | <@Chalain> | You mean like queries/second ? |
23:35 | <@McMartin> | "Was data that should have always been local going to the server instead for persistence purposes" |
23:36 | <@Chalain> | oh |
23:36 | <@Chalain> | No, it cached everything locally until you were ready to update. |
23:37 | <@McMartin> | Oh dear |
23:37 | | * Finerty doesn't think there was anything that was properly local anyway. |
23:37 | <@Chalain> | Which led to some interesting errors when somebody deleted an inventory item while you were selling it. |
23:37 | <@McMartin> | hee |
23:37 | <@Chalain> | Yeah |
23:37 | <@Chalain> | Aside from ephemeral form data, everything was database-bound. |
23:37 | <@McMartin> | OK, so this was something where it should have just been throwing form data around with one copy of Hibernate -- maybe -- on the server side |
23:38 | <@McMartin> | Because it honestly sounds like the clients had no business talking directly to the DB anyway |
23:39 | <@McMartin> | Though, uh, all I know of this application is what you've mentioned in the past 10 minutes, so~ |
23:43 | <@MyCatVerbs> | "Nowadays, when you see someone wandering down the corridor at work with his hand to his ear talking, apparently to himself, and laughing sporadically for no apparent reason, you know he's on his mobile phone. In the days before mobiles, one used to shrug and assume he was a programmer. |
23:43 | <@MyCatVerbs> | Great quote. It'd help things in general if I was able to resist the urge to laugh at it at silly times of night. |
23:45 | <@MyCatVerbs> | McMartin: do there exist client-side database caches, out of curiosity? (The "client" in this case being the DB client, which might well itself be, say, a webserver, not necessarily an end user's machine.) |
23:49 | | Reltzik2 [Reltzik@Nightstar-15817.dsl.pltn13.sbcglobal.net] has joined #code |
23:50 | | * MyCatVerbs presumes that for systems involving lots of ORM and other stuff bumf, they must be in use, but raw query cacheing? |
23:50 | <@McMartin> | Seems like a bad idea, though. |
23:50 | <@McMartin> | The whole point of a shared db is to influence one another. |
23:50 | | Reltzik [Reltzik@Nightstar-15817.dsl.pltn13.sbcglobal.net] has quit [Killed (NickServ (GHOST command used by Reltzik2))] |
23:50 | | Reltzik2 is now known as Reltzik |
23:51 | <@Finerty> | One of the issues Resmark had to deal with was groups of clients that had to be able to act without an internet connection. |
23:53 | <@MyCatVerbs> | McMartin: fair 'nuff. 'Spose you're better off memoizing in the application you're writing anyway, if it really is terribly important. |
23:54 | | Thaqui [~Thaqui@Nightstar-11575.jetstream.xtra.co.nz] has joined #code |
23:54 | | mode/#code [+o Thaqui] by ChanServ |
--- Log closed Thu Feb 21 00:00:43 2008 |