|
By transforming it into a linked-list first instead? And would it be "middle down"?
|
|
|
|
|
Did you mean: embuggerance? Can't find the word "embuggerrement" with Google. I found the word "bugger" but I'm sure that is not what you meant.
|
|
|
|
|
bugger -- n. Software that is used to add bugs to software. See IDE
|
|
|
|
|
For those of us who don't have the faintest clue what Vilmos' gin-perfused mutterings are about: https://en.wikipedia.org/wiki/K-d_tree[^].
For what it's worth, I can't see a way of balancing a tree in-place. Any tree balancing algorithm I've ever seen traversed a source tree, dismantling it in the process, and created a balanced destination tree.
Software Zen: delete this;
|
|
|
|
|
If your tree is implemented using pointers you may be able to do it by swapping references. That is, if you find a branch that is unbalanced you may mount the branch to another node to make the tree balanced. Same applies to nodes that are unbalanced, just swap them with each other until the tree becomes balanced.
|
|
|
|
|
☂☃☧☃♈☂☃
Clue: Ground Zero
|
|
|
|
|
marasma?
PooperPig - Coming Soon
|
|
|
|
|
No... I will give it a bit and then post another clue if needed.
|
|
|
|
|
toronto
PooperPig - Coming Soon
|
|
|
|
|
And you are up....
Well done.
|
|
|
|
|
Dammit! What did I go and do that for
PooperPig - Coming Soon
|
|
|
|
|
Because you're a sucker for punishment?
|
|
|
|
|
I am little confused with the clue "Ground Zero" and the answer Toronto.
cheers,
Super
------------------------------------------
Too much of good is bad,mix some evil in it
|
|
|
|
|
super wrote: I am little confused with the clue "Ground Zero" and the answer Toronto. So am I. I had assumed that it was related to events 14 years less 2 days ago.
|
|
|
|
|
Ahhh.. I understand the potential source of confusion.
Personally, my wife was a nurse in Upstate New York when it happened; she was mobilized and sent there to assist with trauma. Because of that, we don't talk about it or really think about it... she'd rather than relive those memories.
|
|
|
|
|
Code Project is based out of Toronto, so Toronto is their ground zero.
|
|
|
|
|
Umm, I thought it was because most of Toronto(ians) believes it is the centre of the known universe
Ken
|
|
|
|
|
That might be... I've been there, but only for a season... never 'lived' there per se, and certainly not from there.
|
|
|
|
|
So not an actual programming question, but very much related to programming.
Maybe more of a rant something.
I'm working on a web project and I need to send some HTML back to the server, let's say "<p>HTML & ENCODING</p>"
So if I do that I get an error, potentially dangerous request... Fine.
How to fix this? I can disable the check, which isn't very safe.
I can escape the string so I get "& lt;p& gt;HTML & amp; ECODING& lt;/p& gt;", but there's no standard function for that.
I found the JavaScript escape function, but that's deprecated.
I found encodeURI or something, but that's, as the name implies, not for HTML.
So we web developers are left with a string replace...
But what to replace? Some people say replace < and >, others say you really need to replace & too and then there's people who say ' and " need replacement.
And then there are (non-standard) libraries that replace just about everything (!, @, #, $, Hebrew, Chinese... etc.).
Why is there no standard function for this?
It's ridiculous as it's indeed as simple as a string replace, but not so simple to know exactly what to replace...
Am I missing something or is ECMA/ISO/Eich (whatever) missing something?
For now I'll just replace <, >, &, ' and ", but I won't enjoy doing it...
|
|
|
|
|
In my opinion the cleanest way to do this is to disable the check.
You can disable it for a single control (.NET 4.5 +) or a single page if you don't want to disable it for everything.
The check is just there to prevent sending potentially malicious data to applications that don't need it (which probably covers most applications).
If you don't want to do that, I'd probably base64 encode the data.
|
|
|
|
|
Nicholas Marty wrote: If you don't want to do that, I'd probably base64 encode the data. Smart, haven't seen that one yet
So far I've got five unofficial and zero official solutions to this problem
|
|
|
|
|
I think jQuery can help you there (and even you had not ask a strict programming question I answer it as one)...
You can use a combination of text() and html() methods...
This will encode HTML (value):
return $('<div/>').text(value).html();
and this will decode:
return $('<div/>').html(value).text();
I left it for you too go and read the reference pages...
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
That helps and I just so happen to have jQuery available
|
|
|
|
|
Try
function htmlEncode( html ) {
return document.createElement( 'a' ).appendChild(
document.createTextNode( html ) ).parentNode.innerHTML;
};
for pure javascript.
|
|
|
|
|
That helps too, which is the fifth unofficial method to solving this problem
|
|
|
|