code logs -> 2010 -> Fri, 12 Mar 2010< code.20100311.log - code.20100313.log >
--- Log opened Fri Mar 12 00:00:26 2010
00:03 Taki^ [Meh@Nightstar-39d785ef.consolidated.net] has joined #code
00:05 Taki^ [Meh@Nightstar-39d785ef.consolidated.net] has quit [Connection reset by peer]
00:12 Taki^ [Meh@Nightstar-39d785ef.consolidated.net] has joined #code
00:13 SmithKurosaki [Smith@Nightstar-1a7d4505.dsl.teksavvy.com] has joined #code
00:13 Taki^ [Meh@Nightstar-39d785ef.consolidated.net] has quit [Client closed the connection]
00:15 ToxicFrog [ToxicFrog@ServerAdministrator.Nightstar.Net] has joined #code
00:15 mode/#code [+o ToxicFrog] by Reiver
00:20 Taki^ [Meh@Nightstar-39d785ef.consolidated.net] has joined #code
00:22 Taki^ [Meh@Nightstar-39d785ef.consolidated.net] has quit [Client closed the connection]
00:22
<@ToxicFrog>
Aaagh
00:22
<@ToxicFrog>
That wasn't fun
00:22
<@ToxicFrog>
Let's not do it again
00:24 * Reiver continues to wage war against the evils of Java and it's terrible minon, the constructor.
00:25
<@ToxicFrog>
Tree difficulties?
00:27 * ToxicFrog just finished waging war against nx, which had gone insane and created 250GB of log files
00:27 * McMartin meanwhile has been hacking Windows filesystem drivers.
00:28
<@ToxicFrog>
Fun things to come home to: "error creating session directory: no space left on device"
00:28 Taki^ [Meh@Nightstar-39d785ef.consolidated.net] has joined #code
00:30 Taki^ [Meh@Nightstar-39d785ef.consolidated.net] has quit [Connection reset by peer]
00:30<~Reiver> lovely
00:31<~Reiver> TF: Syntax difficulties. Trying to remember how you get a variable fed in by a Constructor into the object space for use.
00:31 Taki^ [Meh@Nightstar-39d785ef.consolidated.net] has joined #code
00:32 Netsplit *.net <-> *.split quits: @Attilla, Zed_, PinkFreud, Taki^, Tarinaky, RichardBarrell, @ToxicFrog, Syloqs-AFH, Rhamphoryncus, DiceBot
00:32 Netsplit over, joins: Zed_, Tarinaky
00:33 Netsplit over, joins: Rhamphoryncus
00:33 Netsplit over, joins: ToxicFrog, PinkFreud, DiceBot, RichardBarrell, Attilla
00:33 mode/#code [+o ToxicFrog] by Reiver
00:33 mode/#code [+o Attilla] by Reiver
00:34 Syloq [Syloq@NetworkAdministrator.Nightstar.Net] has joined #code
00:34
<@ToxicFrog>
Reiver: er? They're passed in as arguments like any other function
00:35 Syloq is now known as Syloqs-AFH
00:35
<@ToxicFrog>
class Foo { private int bar; public Foo(bar) { this.bar = bar } }
00:36 Kazriko [kaz@Nightstar-e09690fa.client.bresnan.net] has quit [Ping timeout: 121 seconds]
00:41 Taki^ [Meh@Nightstar-39d785ef.consolidated.net] has joined #code
00:41<~Reiver> http://pastebin.starforge.co.uk/145 is not quite what I want, then?
00:43
<@ToxicFrog>
...no.
00:43 Taki^ [Meh@Nightstar-39d785ef.consolidated.net] has quit [Client closed the connection]
00:43
<@ToxicFrog>
That assigns it to a function local.
00:44
< celticminstrel>
[7:31pm] Reiver: TF: Syntax difficulties. Trying to remember how you get a variable fed in by a Constructor into the object space for use.
00:44
< celticminstrel>
...what does that even mean?
00:45
<@ToxicFrog>
Reiver: anything declared as an object member is in scope to the class's methods. You can access and assign to them as normal.
00:46
<@ToxicFrog>
If you need to distinguish between a member and a function local with the same name, this is (in non-static methods) a reference to the current object, so this.foo will get you the member even if foo on its own gets you a local.
00:46
<@ToxicFrog>
Sensical?
00:46<~Reiver> Um. Possibly.
00:46
< celticminstrel>
Oh! You need to give constructors the same name as the class, and omit the return value.
00:46
<@ToxicFrog>
...yes, but he already has that part down
00:47<~Reiver> The bit I don't have down is getting Tree foo = new Tree(bar) to feed bar into the new Tree.
00:47
< celticminstrel>
Oh wait, I misinterpreted that code snippet.
00:47<~Reiver> So I can then use it.
00:47
< celticminstrel>
Um.
00:48
< celticminstrel>
Change "final char val = v;" (which declares a local variable and assigns to it) to "value = v;" (which assigns to the instance variable).
00:49 Kazriko [kaz@Nightstar-e09690fa.client.bresnan.net] has joined #code
00:49 mode/#code [+o Kazriko] by Reiver
00:49 * Reiver blinks. Huh.
00:50 Taki^ [Meh@Nightstar-39d785ef.consolidated.net] has joined #code
00:50<~Reiver> I thought there was some thingy where you needed to declare the variable before you used it, when playing with constructors.
00:51
<@ToxicFrog>
You always have to declare variables before you use them.
00:51
<@ToxicFrog>
However, all members count as declared before the constructor gets called.
00:51
<@ToxicFrog>
if you say 'Tree foo = new Tree(bar)', bar will be passed to the Tree constructor as its first argument.
00:51 Taki^ [Meh@Nightstar-39d785ef.consolidated.net] has quit [Client closed the connection]
00:52
< celticminstrel>
Even so, if you were actually worried about declaring before use, there's nothing to prevent you from putting the variable declarations above the constructor declaration.
00:54 * Reiver attempts to now code a seek command.
00:57
<@ToxicFrog>
Find, in a binary search tree (which is basically what you have here), is not hard.
00:57
<@ToxicFrog>
If the current node has what you're looking for, you're done.
00:57
<@ToxicFrog>
Otherwise, follow the left or right path depending on whether this node is > or < what you're looking for.
00:57
<@ToxicFrog>
If you end up trying to follow the null pointer, what you're seeking isn't in the tree yet.
00:59
<@McMartin>
Side note: Java exceptions are slow, so it's better to detect that you're *about* to follow a null pointer (via checking == or != null) than it is to check that you just tried to (by catching NullPointerException).
00:59 Taki^ [Meh@Nightstar-39d785ef.consolidated.net] has joined #code
01:01<~Reiver> hmm, ok.
01:01 Taki^ [Meh@Nightstar-39d785ef.consolidated.net] has quit [Connection reset by peer]
01:02
<@McMartin>
And actually, the only language where exceptions *aren't* expensive to the tunes of 100-10,000 instructions are the compiled functional languages like OCaml.
01:06 Attilla [Attilla@FBC920.174237.E2DF5D.3AFA0A] has quit [[NS] Quit: ]
01:07 Taki^ [Meh@Nightstar-39d785ef.consolidated.net] has joined #code
01:10 Taki^ [Meh@Nightstar-39d785ef.consolidated.net] has quit [Connection reset by peer]
01:16 Taki^ [Meh@Nightstar-39d785ef.consolidated.net] has joined #code
01:18 Taki^ [Meh@Nightstar-39d785ef.consolidated.net] has quit [Connection reset by peer]
01:24 Taki^ [Meh@Nightstar-39d785ef.consolidated.net] has joined #code
01:27 Taki^ [Meh@Nightstar-39d785ef.consolidated.net] has quit [Client closed the connection]
01:32 gnolam [lenin@Nightstar-38637aa0.priv.bahnhof.se] has quit [[NS] Quit: Z?]
01:43
< celticminstrel>
Meh, I use C++ exceptions whenever possible and sensible.
01:43
<@McMartin>
null checks aren't one of those places, though
01:55
<@Vornicus>
Null checks can possibly cause exceptions - File not Found in the middle of some huge thing is one example -- but you don't want to do it unless you would otherwise be in a lot of trouble.
02:15 * Vornicus declares the Excel chart thingy to be Filled With Fail
02:29
<@Vornicus>
What I'd /like/ to do is generate a chart from data so that "blank" locations - technically made blank by formula - do not appear.
02:29
<@ToxicFrog>
gnuplot?
02:30
<@Vornicus>
Difficulty: I want this chart to exist in a sheet or other semiportable thing that I can send to an average joe where he can manipulate the data.
02:31
<@Vornicus>
(specifically this chart shows probabilities from the binomial distribution, with n and p inputs.)
02:31
< celticminstrel>
True, null checks aren't a place to use exceptions in C++, since if you call a member function on a null pointer it actually just calls it with this = null.
02:38
<@Vornicus>
I can't convince Excel that blank-by-formula means the same thing as actually blank, though, so no matter what n is, it uses 1000 (the number I went up to) as the biggest available value, and sizes the columns appropriately. Which is kind of sill when n is 10.
02:59 Reiv [NSwebIRC@Nightstar-1055e8af.waikato.ac.nz] has joined #code
03:00 PinkFreud [WhyNot@NetworkAdministrator.Nightstar.Net] has quit [Ping timeout: 121 seconds]
03:17 * Reiv pokes McMartin and other Java-y types
03:17
< Reiv>
How do I get an if statement to check for nulls?
03:17
< Reiv>
Will "If(Foo != null) {stuff}" work?
03:18
<@ToxicFrog>
Yes.
03:18
< Reiv>
Ah, awesome. Hm.
03:18
< Reiv>
So, my partially completed code for seek so far:
03:19
< Reiv>
http://pastebin.starforge.co.uk/147
03:19
< Reiv>
Should my seek command make the next node if it's null?
03:20
< Reiv>
And is this system of New autosorting, Seek relying on things being sorted robust, or do I need to have a check?
03:21 * Reiv is pretty pleased with how this is going, but wanting to make sure he's not buggering things up.
03:23
<@ToxicFrog>
That general approach is robust, but the way you're doing it won't work
03:23
<@ToxicFrog>
Consider what happens if you create a tree "d", and then insert "e" and "f" into it
03:25
<@ToxicFrog>
(in general, insert/delete should do all of the "sorting" needed; insert has signature sorted tree -> object -> sorted tree, and delete likewise)
03:26
< Reiv>
Oh dear, you're right.
03:26
< Reiv>
Hrn. What does it do then?
03:26
<@ToxicFrog>
...what does your implementation do? Sketch it out: start with d (null,null), then follow your code to see where the e and the f will go
03:27
< Reiv>
If val > value && Right != Null, Right.New(val)?
03:27
<@ToxicFrog>
Yes.
03:27
< Reiv>
Ha!
03:28
<@ToxicFrog>
Basically: if you already have a subtree where you want to insert a value, recursively insert into that subtree
03:28
<@ToxicFrog>
Otherwise, create a new subtree there with the new value as its root
03:29
< Reiv>
if(Right == null) Right = new Tree(val); else Right.New(val);
03:30
< Reiv>
So! What should seek do if it finds the node you were looking for does not exist?
03:30
< SmithKurosaki>
o.0 What lang?
03:31
< Reiv>
Java.
03:31
<@ToxicFrog>
Traditionally, return null or some similar value indicating "the requested value does not exist in the tree"
03:31
< Reiv>
Hn
03:31
< SmithKurosaki>
Ahh, thought I recognized it
03:31
< Reiv>
Then how do you 'look for value, add if not present'
03:31
< SmithKurosaki>
I do that - return false and then error
03:31
< SmithKurosaki>
If null, call add?
03:32
<@ToxicFrog>
SmithKurosaki: return false,error isn't possible in Java.
03:32
<@ToxicFrog>
(I mean, without Wacky Object Tricks or similar)
03:33
< Reiv>
Oh dear.
03:33
< Reiv>
Seek is not happy with me returning Null when it expected a Tree.
03:33
< SmithKurosaki>
:(
03:33
<@ToxicFrog>
Reiv: well, you can have add just be a no-op if it's already in the tree, or raise an exception; you can seek first, and then call add if it's not already in the tree...
03:33
< SmithKurosaki>
TF: It's been a couple months of me crying... Of course I don't know the specifics
03:34
< Reiv>
TF: I see
03:34
< Reiv>
And I want a distinct command for Add, yes?
03:35
< Reiv>
Which does most of Seek, and if Seek returns Null on the local tree node, it Adds the new one?
03:35
<@ToxicFrog>
Probably?
03:35
<@ToxicFrog>
The typical operations on a tree are:
03:35
< SmithKurosaki>
(crying about mess of java +me)
03:35
<@Vornicus>
I wrote Seek to return the closest possible node.
03:36
<@ToxicFrog>
find: takes a key, returns all associated data if it's in the tree and nothing otherwise
03:36
<@Vornicus>
Then when I wrote Search I just checked the Seek result node against the search key.
03:36
<@ToxicFrog>
delete: takes a key, removes it from the tree if present
03:36
<@ToxicFrog>
insert: takes a key, inserts it into the tree if not present (and if present, might no-op or error depending on what your goal is)
03:36
<@Vornicus>
and Add checks the Seek result node against the search key, and adds /to that node/
03:37
<@Vornicus>
or rather it adds as a child of that node.
03:37 Netsplit *.net <-> *.split quits: Reiv, RichardBarrell
03:37
<@Vornicus>
arg fucking kak
03:38 RichardBarrell [mycatverbs@F67919.628980.376D93.82659C] has joined #code
03:52 * Vornicus floons
03:52 mode/#code [-o Kazriko] by ChanServ
03:53 Tarinaky [Tarinaky@Nightstar-3a16986c.adsl.virginmedia.net] has quit [Ping timeout: 121 seconds]
03:56 Orthia [orthianz@Nightstar-700e84a8.xnet.co.nz] has joined #code
03:56
< Orthia>
Er. My cunning plan of getting the answer on my return was thwarted by Orthias router packing a sad at lunchtime and not telling anyone.
03:56 * Orthia coff.
03:57
<@Vornicus>
"packing a sad"
03:57
< Orthia>
... never heard it before?
03:57
<@Vornicus>
No
03:57
< Orthia>
Roughly equivalent to throwing a tantrum.
03:58
< Orthia>
Only less complaining, more fail
03:58
< Orthia>
When the manager is packing a sad, they're in a bad mood and everythings gone wrong.
03:58
<@McMartin>
Packing a sad sounds like a weird cross between "Packing heat" and "haz a sad"
03:58
< Orthia>
When a vehicle or peice of equipment has packed a sad, it means it has broken.
03:59
<@ToxicFrog>
<ToxicFrog> Probably?
03:59
<@ToxicFrog>
<ToxicFrog> The typical operations on a tree are:
03:59
<@ToxicFrog>
<SmithKurosaki> (crying about mess of java +me)
03:59
<@ToxicFrog>
<Vornicus> I wrote Seek to return the closest possible node.
03:59
<@ToxicFrog>
<ToxicFrog> find: takes a key, returns all associated data if it's in the tree and nothing otherwise
03:59
<@ToxicFrog>
<Vornicus> Then when I wrote Search I just checked the Seek result node against the search key.
03:59
< Orthia>
Throwing a tantrum tends to imply 'noisily in failure mode'.
03:59
<@ToxicFrog>
<ToxicFrog> delete: takes a key, removes it from the tree if present
03:59
<@ToxicFrog>
<ToxicFrog> insert: takes a key, inserts it into the tree if not present (and if present, might no-op or error depending on what your goal is)
03:59
<@ToxicFrog>
<Vornicus> and Add checks the Seek result node against the search key, and adds /to that node/
03:59
<@ToxicFrog>
<Vornicus> or rather it adds as a child of that node.
04:00 * Orthia ponders Add, and how it knows whether to add to the current node or to continue down the rabbit hole.
04:00
< Namegduf>
Orthia: Is the side it wants to put the new child on free?
04:00
< Namegduf>
If there's already something there, it has to keep going.
04:01
<@Vornicus>
seek doesn't actually return until you get to either the actual correct node, or it is at the node that would be the parent if it weren't for the null on that side.
04:01
< Orthia>
Nameguf: ... aha, of course
04:01
< Orthia>
It sorts by looking, doesn't it?
04:01
< Orthia>
'cuz New has already sorted. Hrn.
04:02
<@Vornicus>
Seek has already gotten to the correct location, no need to go further down for Add.
04:02
< Namegduf>
It's inhertently "sorted".
04:02
< Namegduf>
As far as it gets sorted, anyway.
04:02
< Orthia>
Current code: http://pastebin.starforge.co.uk/148
04:02
<@Vornicus>
Delete is a different story: once you've found the correct node to delete, you must find one to replace it with, or you're accidentally Using The Saw.
04:02
< Orthia>
First, I need to figure out the error, then I will work on Add.
04:03 Tarinaky [Tarinaky@Nightstar-3a16986c.adsl.virginmedia.net] has joined #code
04:03
< Orthia>
Insert and Delete is rather terrifying. Good news is, Delete is not needed.
04:03
< Orthia>
Alas, Insert might be, not sure.
04:03
< Namegduf>
What's the difference between Add and Insert, as you're using them?
04:04
<@Vornicus>
Yeah, I'm not sure what's up there.
04:04
< Orthia>
Add snakes down the list and sticks something onto the end.
04:05
< Orthia>
Insert, I presume, squeezes a node in between two already existing ones?
04:05
<@Vornicus>
Um...
04:05
<@Vornicus>
No, they're the same.
04:05
< Orthia>
Oh! In that case, okay. That's not so bad then.
04:06
<@Vornicus>
The /hard/ one is delete.
04:12
<@Vornicus>
nd if you don't have to do that, then good - don't.
04:14
< Orthia>
OK, I won't.
04:16
< Orthia>
Oh, I see my problem in seek
04:17
< Orthia>
All my return statements are in conditional blocks. It needs a generic one in case the conditionals fail to fire.
04:17
< Serah>
This thingie is giving me a headache.
04:17 * Orthia tries to figure out what the general case should be.
04:25
<@Vornicus>
By the way, how are you doing this in general - a sentinel node? just plain Null?
04:33
< Serah>
Any of you guys have a working flash decompiler and five minutes spare?
04:33
< Orthia>
What do you mean by a sentinel node?
04:34 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has quit [[NS] Quit: *hums* Can't stay now!]
04:36
<@Vornicus>
A sentinel node is a "constant" node with nothing in it, but it still manages to allow things to set its children or parent. It is in some ways more convenient than using null, as you don't have to guard every single property setting on non-active nodes.
04:43 PinkFreud [WhyNot@NetworkAdministrator.Nightstar.Net] has joined #code
04:45
< Orthia>
Is a sentinel node also a leaf node?
04:46
<@Vornicus>
It works generally as a leaf node - anything without meaningful children has SENTINEL as its children; anything without meaningful parent has SENTINEL as its parent.
04:46
< Orthia>
... oh, is SENTINEL a global node?
04:46
< Orthia>
Or a static one, rather
04:46
<@Vornicus>
it's a single, static node.
04:47
< Orthia>
So I give things SENTINEL as their default children?
04:47
<@Vornicus>
so you end up doing stuff like this: if (parent == SENTINEL) { /* stuff I'd do if I'm at root, like updating the tree's root */ }
04:47
< Orthia>
And use that as a placeholder for null?
04:48
<@Vornicus>
Yes. Then you don't have to set guards on null everywhere everywhere everywhere.
05:00
<@Vornicus>
Note: my binary tree implementation uses sentinel. YOu can freely steal that code if you wish.
05:05
< Orthia>
Sentinel... hm. Gets made a child a hell of a lot
05:05
< Orthia>
Otherwise, has only one child itself - the first node.
05:07
<@Vornicus>
Right - oh, and when you start a tree you need to set the root to Sentinel -- but at the same time you must set sentinel's parent to sentinel.
05:07
<@Vornicus>
That's a bug in my implementation.
05:23
< Orthia>
Why does Sentinel need to know who its parent is?
05:30 Serah [Z@26ECB6.A4B64C.298B52.D80DA0] has quit [Ping timeout: 121 seconds]
05:36
<@ToxicFrog>
I just posted in a centralized vs distributed version control argument. Does this make me a bad person?
05:46
< jerith>
No.
05:47
< jerith>
But it does make you a target.
05:56 Serah [Z@3A600C.A966FF.5BF32D.8E7ABA] has joined #code
06:06 Rhamphoryncus [rhamph@Nightstar-8931f88f.abhsia.telus.net] has quit [Client exited]
06:24
< Orthia>
So, Vorn
06:24
< Orthia>
On struggling a little bit I have decided to ask - the Sentinel concept is pretty much compulsory, I guess? >_>
06:57 * Orthia wonders also, whether it should be /called/ Sentinel.
06:58 Serah [Z@3A600C.A966FF.5BF32D.8E7ABA] has quit [Ping timeout: 121 seconds]
07:07
<@Vornicus>
I call it SENTINEL, and it's not... compulsory, but it reduces the need for guard checks in many places. Makes the code cleaner that way.
07:08
< Orthia>
How does it do that, though? You then have to check for SENTINEL instead.
07:08
< Namegduf>
I assume you just let it happen and pray whatever just silently failed wasn't important.
07:08
< Namegduf>
Unless I misunderstand?
07:09
< Namegduf>
Well, I might be exaggerating the problem htere
07:10
<@Vornicus>
To give an example: when deleting a node, we replace it with something further down the tree; both that something further down and the node to be deleted may or may not have children, which we must update the parent of.
07:10
<@Vornicus>
By using sentinel instead of null, we don't need to check whether the children exist, we merely update the sentinel's parent.
07:10
< Namegduf>
Not quite true.
07:11
< Namegduf>
If you didn't check whether it was sentinel, you could end up shuffling sentinel into the tree.
07:11
< Namegduf>
By replacing a deleted node with it.
07:11
<@Vornicus>
Well, that's a different piece of stuff.
07:11
< Namegduf>
And the thing you replace it with can (as a rule) only have at most one child.
07:11
< Namegduf>
And if you need to replace it, it has to have two.
07:12
<@Vornicus>
We have chosen the replacement node as the last right-line child of the left child of the node to delete.
07:12
< Namegduf>
Okay, so... let's say your node to replace has a right, but not a left child.
07:12
<@Vornicus>
Then we can replace it with the right child and that's it.
07:13
< Namegduf>
Right; after a check for sentinel.
07:13
<@Vornicus>
And sometimes you do have to do that.
07:13
< Namegduf>
You still need to check whether it has children or not, and how.
07:13
< Orthia>
OK, confusing me now.
07:13
< Orthia>
I had understood Sentinel to be basically a cleaner way of declaring null
07:13
<@Vornicus>
Namegduf seems to think I'm preventing /all/ guard checks via sentinel.
07:14
< Namegduf>
Vornicus: Your example, not mine.
07:14
<@Vornicus>
This isn't true - it's actually preventing only those that don't factor into a "which node am i working on?" decision.
07:14
< Namegduf>
Hmm, actually... I don't think it prevents any.
07:14
<@Vornicus>
It does.
07:15
< Namegduf>
In the one bit of the example you gave, you're just propagating the right-most child's left child (if any) to the parent.
07:15
< Namegduf>
You can do that with null without a check as happily as with Sentinel.
07:16
< Namegduf>
I assume there's other examples where that isn't true?
07:16
<@Vornicus>
It's doubly linked, namegduf.
07:17
<@Vornicus>
You then have to set current.left.up -- and if current.left is null, well, whups.
07:17
< Namegduf>
Hmm.
07:18 gnolam [lenin@Nightstar-38637aa0.priv.bahnhof.se] has joined #code
07:19
<@Vornicus>
Meanwhile if the node to delete is the /root/, we have to set the above node's child -- and that above node is null or sentinel itself.
07:20
< Namegduf>
But you already have to special-case root to edit your pointer to root.
07:20
<@Vornicus>
True.
07:20
< Namegduf>
I suppose it makes sense. I find a magic node less clear than just checking for null in the appropriate places, myself, but it make sense.
07:21
<@Vornicus>
The primary disadvantage of sentinel is that it will fuck up silently where null will die and give you an NPE.
07:22
< Orthia>
OK, so when making a k-way multiway trie
07:22
< Namegduf>
Or where a null check might catch it first, if that's your inclination.
07:22
< Orthia>
Do I want the nodes inside the trie to be sorted?
07:22
< Namegduf>
Then again, that has mostly the same problem.
07:22
< Orthia>
Or can they just bung on anywhich way, given they're a linked list made of trees?
07:23
< Namegduf>
Once the programmer has failed, there's very little the progran can do BUT either die or carry on and risk breaking later.
07:23
<@Vornicus>
Orthia: How on earth are you making these nodes that "sorted" isn't something that just happens?
07:24
< Orthia>
Vorn: OK, instead of the usual
07:24
< Orthia>
B
07:24
< Orthia>
A C
07:25
< Orthia>
We're doing
07:25
< Orthia>
A - B - C
07:25
< Orthia>
| | |
07:25
< Orthia>
With A B C D Etc all being the one 'node' in a tree.
07:26
< Orthia>
Thus letting us have a variable number of branches to a tree.
07:26
< Orthia>
But in each tree, one branch links to the next inside the node, with the other linking to the /next/ node.
07:26
< Orthia>
Er.
07:26
< Orthia>
But in each trie, one branch links to the next inside the node, with the other linking to the /next/ trie.
07:37
<@Vornicus>
Aha
07:37
<@Vornicus>
So you have a linked list inside your trie nodes.
07:38
< Orthia>
Yeah, 'cept the linked list is kind of a tree itself.
07:38
<@Vornicus>
I would say... keeping them in order approximately halves the number of operations to /fail/ to find a node.
07:39
< Orthia>
Hn
07:39
< Orthia>
But to keep them in order requires some variety of Insert command, which looks to be spagetti given it requires a node to change Up as well as Down. I think?
07:40
< Orthia>
...No. You set up your tree so you have a second constructor that passes it the origional child, so you can go this.New.New(Left) or whatever, don't you.
07:40
< Orthia>
Or something. *tilts head*
07:52
<@Vornicus>
Good lord, man. Make a seek, use that seek to create a big-node-level add-little-node
07:54
< Orthia>
Hrn.
07:54
< Orthia>
Mostly I'm trying to find a way to make a seek able to Add without rewriting 3/4 of the function.
07:54
< Orthia>
At the moment if it fails to find a node it returns null.
07:55
< Orthia>
hn. Actually.
08:16
<@Vornicus>
By making a single seek that produces, say, the predecessor (or, easier, the successor) to the correct small node, and then making search check that node's value against the given one, you reduce duplication.
08:19
<@Vornicus>
Performance takes a small hit - one comparison for each add, search, and delete - but your seek code works in all three cases, and you only have to correct /that/ when you find a bug in seeking for something.
08:29
< Orthia>
hmhn
08:29
< Orthia>
So I have Seek, and then I have Search, Add, and Whatever that all call the Seek function?
08:41
<@Vornicus>
Yes
08:41
<@Vornicus>
seek is private.
08:44 Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has joined #code
08:44
<@Vornicus>
good god how did it become 3:45 AM
08:44 * Vornicus goes to bed, dammit
08:46 Vornicus is now known as Vornicus-Latens
09:06 You're now known as TheWatcher
09:45 RichardBarrell [mycatverbs@F67919.628980.376D93.82659C] has quit [Ping timeout: 121 seconds]
09:47 Attilla [Attilla@FBC920.A5C359.56522E.5E8306] has joined #code
09:47 mode/#code [+o Attilla] by Reiver
09:51 Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has quit [Connection closed]
10:42 AD[WarWalk] [Administrator@F67919.F326B3.98D923.BDA7B6] has joined #code
10:42
< AD[WarWalk]>
Is there something like AdBlock, but for Chrome?
10:43
< AD[WarWalk]>
I think I saw an ad for an Avatar MMORPG.
10:46
< Namegduf>
I believe so, try looking around at https://chrome.google.com/extensions
10:46
< Namegduf>
I don't use one, though, so that's about all the decent help I can give.
10:49
< AD[WarWalk]>
Hooray.
10:49
< AD[WarWalk]>
Thank you.
10:49
< Namegduf>
No problem.
10:52 Attilla [Attilla@FBC920.A5C359.56522E.5E8306] has quit [Connection reset by peer]
10:52 Attilla_ [Attilla@FBC920.A5C359.56522E.5E8306] has joined #code
10:54 AD[WarWalk] [Administrator@F67919.F326B3.98D923.BDA7B6] has quit [Ping timeout: 121 seconds]
10:57 Attilla [Attilla@FBC920.687A28.FAA73C.90BD28] has joined #code
10:57 mode/#code [+o Attilla] by Reiver
10:59 Attilla_ [Attilla@FBC920.A5C359.56522E.5E8306] has quit [Ping timeout: 121 seconds]
10:59 Attilla [Attilla@FBC920.687A28.FAA73C.90BD28] has quit [Connection reset by peer]
12:22 Attilla [Attilla@FBC920.480E8C.93028B.0DE757] has joined #code
12:22 mode/#code [+o Attilla] by Reiver
12:46 AnnoDomini [annodomini@Nightstar-8a71c7ba.adsl.tpnet.pl] has joined #code
12:46 mode/#code [+o AnnoDomini] by Reiver
13:20 Orthia [orthianz@Nightstar-700e84a8.xnet.co.nz] has quit [Ping timeout: 121 seconds]
13:28 AbuDhabi [annodomini@Nightstar-df343f00.adsl.tpnet.pl] has joined #code
13:30 AnnoDomini [annodomini@Nightstar-8a71c7ba.adsl.tpnet.pl] has quit [Ping timeout: 121 seconds]
14:23 Rhamphoryncus [rhamph@Nightstar-8931f88f.abhsia.telus.net] has joined #code
16:14 AbuDhabi [annodomini@Nightstar-df343f00.adsl.tpnet.pl] has quit [Ping timeout: 121 seconds]
16:56
<@ToxicFrog>
Ahaha
16:56
<@ToxicFrog>
prof has a graph of control vs. effort for various HDL and systems programming dialects
16:56
<@ToxicFrog>
It's titled "law of conservation of pain"
17:01
< jerith>
Nice.
17:53 Serah [Z@3A600C.A966FF.5BF32D.8E7ABA] has joined #code
18:19
< SmithKurosaki>
??
18:55 Serah [Z@3A600C.A966FF.5BF32D.8E7ABA] has quit [Ping timeout: 121 seconds]
18:58 Vornicus-Latens is now known as Vornicus
19:17 Serah [Z@26ECB6.A4B64C.298B52.D80DA0] has joined #code
19:24 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has joined #code
19:57 * celticminstrel stabs MySQL.
19:59
<@McMartin>
Now a fine product of Oracle
19:59
< celticminstrel>
It's reporting a syntax error on something that appears perfectly fine, and I can't see what';s wrong...
20:04
< celticminstrel>
Unless it doesn't like at-signs in identifiers, but removing them doesn't change anything so that can't be it, right?
20:10
<@Vornicus>
paaaaaaste iiiiiit
20:12
< celticminstrel>
"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'string) returns string deterministic
20:12
< celticminstrel>
begin
20:12
< celticminstrel>
declare var string;
20:12
< celticminstrel>
decla' " (This in a "create function" statement.)
20:27
<@Vornicus>
Okay, that ... have you tried dropping a after begin? And it's likely that this is actually an error a while earlier that the parser couldn't fix
20:27
<@Vornicus>
a ; after begin, that is?
20:29 Serah [Z@26ECB6.A4B64C.298B52.D80DA0] has quit [Ping timeout: 121 seconds]
20:30
< celticminstrel>
You mean like "begin;"?
20:31
< celticminstrel>
That still gives the same message. And the only thing before that is "create function FuncName(var".
20:32
< celticminstrel>
And I did change the delimiter.
20:32 Serah [Z@26ECB6.A4B64C.298B52.D80DA0] has joined #code
20:49
<@Vornicus>
So there is nothing at all in the entire file before this?
21:00
< celticminstrel>
I pasted it into the command line, so it's seeing only that one function definition.
21:05
<@Vornicus>
Ah
21:05
<@Vornicus>
Hm...
21:08 Serah [Z@26ECB6.A4B64C.298B52.D80DA0] has quit [Ping timeout: 121 seconds]
21:19 Serah [Z@5E691D.FC7C16.1B5DEF.FF044D] has joined #code
21:27
<@ToxicFrog>
Pastebin your input and the response?
21:30
< celticminstrel>
http://pastebin.starforge.co.uk/150
21:30
< celticminstrel>
(The relevant tables already exist, by the way.)
21:30
< celticminstrel>
(Actually, that's irrelevant. Never mind.)
21:31 Derakon [Derakon@Nightstar-1ffd02e6.ucsf.edu] has joined #code
21:31 mode/#code [+o Derakon] by Reiver
21:31 Derakon is now known as Derakon[work]
21:32 * Derakon[work] starts inflating his LOC count by adding documentation.
21:32
<@Derakon[work]>
Yay Doxygen!
21:32
<@Derakon[work]>
(This is also known as "What if our only person who has a clue how the code works dies in a freak hang gliding accident" insurance)
21:34
<@Vornicus>
Hang gliding accidents sound more exciting than bus accidents.
21:35 Serah [Z@5E691D.FC7C16.1B5DEF.FF044D] has quit [Ping timeout: 121 seconds]
21:36
<@Derakon[work]>
The only way I'm going to be in a bus accident these days is as a pedestrian.
21:38
<@Vornicus>
Well yes
21:42 Serah [Z@Nightstar-11344bdb.customer.tele.dk] has joined #code
21:46
<@ToxicFrog>
celticminstrel: http://dev.mysql.com/doc/refman/5.0/en/create-procedure.html -- looks ok to em
21:53
< celticminstrel>
Indeed.
21:53
< celticminstrel>
(Though I think the server is 5.1.)
21:53
< celticminstrel>
So if it's okay, why do I get an error?
21:55
<@ToxicFrog>
I haven't the first clue. 'string' is a legal type, right?
21:56
< celticminstrel>
I'm pretty sure it is?
21:56
< celticminstrel>
It turns purple in my text editor...
21:56
<@Derakon[work]>
I thought you needed a varchar in MySQL?
21:57
<@Derakon[work]>
See http://dev.mysql.com/doc/refman/5.1/en/string-types.html
21:58
< celticminstrel>
No, that's not it; I still have the same error.
22:01
<@Derakon[work]>
What's the error, and the code?
22:01
<@Derakon[work]>
I'm lacking context.
22:01
< celticminstrel>
http://pastebin.starforge.co.uk/150
22:05
<@Derakon[work]>
Are you sure the @ should be in the parameter name?
22:09
< celticminstrel>
No?
22:09
<@Derakon[work]>
I'm looking at the examples at http://dev.mysql.com/doc/refman/5.0/en/create-procedure.html and they don't have it.
22:09
< celticminstrel>
But again, taking it out gave the same error...
22:09
<@Derakon[work]>
Ah.
22:09
<@Derakon[work]>
Put a space after the function name?
22:09
<@Derakon[work]>
I'm just guessing here, really.
22:10
< celticminstrel>
There was one originally.
22:10
<@Derakon[work]>
Well, I'm out of ideas.
22:10
< celticminstrel>
Me too. :(
22:10
<@Derakon[work]>
Anything above that in the file?
22:11
< celticminstrel>
Yeah, but I copy-pasted to the command-line, so it's not seeing anything else in the file.
22:11
<@Derakon[work]>
Drat.
22:45
<@ToxicFrog>
Ask on freenode?
22:46
< celticminstrel>
Hm?
22:48
<@ToxicFrog>
There's a #mysql channel on freenode.
22:48
< celticminstrel>
Oh.
22:48
<@ToxicFrog>
Being a channel entirely devoted to MySQL, you're likely to find more knowledgeable people there.
23:26 Derakon[work] [Derakon@Nightstar-1ffd02e6.ucsf.edu] has quit [[NS] Quit: Leaving]
23:44 Attilla [Attilla@FBC920.480E8C.93028B.0DE757] has quit [[NS] Quit: ]
--- Log closed Sat Mar 13 00:00:27 2010
code logs -> 2010 -> Fri, 12 Mar 2010< code.20100311.log - code.20100313.log >