|
BURN![^]
I really hope I used it correctly.
"You'd have to be a floating database guru clad in a white toga and ghandi level of sereneness to fix this goddamn clusterfuck.", BruceN[ ^]
|
|
|
|
|
Skype? Really - do you think we want to see what you look like?*
Not just you - any of the grim characters that inhabit this arcane outpost. Yeeech - nightmares would be considered comic relief.
* Or become identifiable, ourselves?
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
So I've got this quicksort function in a JavaScript library.
It worked, got some tests, and all was well.
Then I changed the return smaller.concat([pivot], bigger); to a custom bit like return smaller.unionAll([pivot]).unionAll(bigger);
And then my tests started failing.
My tests for unionAll passed, no problem, but my sorting got messed up all of a sudden.
So somehow unionAll did not always return items in the same order as their source, which actually would've taken me a lot of work to accomplish.
Rather weird bug, that.
Hours of debugging later, no code changes (except lots of debugging variables), and all of a sudden everything starts to work
Had I forgotten a semi-colon? Did I accidentally overwrite some variable which was fixed by the declaration of debugging variables? Was the type of a variable not always what I expected it to be?
I guess I will never know...
Luckily, I'm not the only one with this problem[^].
The bug seems to be fixed, but I've got mixed feelings about it nonetheless...
|
|
|
|
|
I know that you are an experienced programmer, but...
Code that works because of "magic" is the work of the Devil. If I were you, I would debug the code until I understood why it is now working. Doing otherwise is a recipe for mysterious failures down the line.
If you have an important point to make, don't try to be subtle or clever. Use a pile driver. Hit the point once. Then come back and hit it again. Then hit it a third time - a tremendous whack.
--Winston Churchill
|
|
|
|
|
Quote: Code that works because of "magic" is the work of the Devil
Get me coffee and no one gets hurt!
|
|
|
|
|
I didn't know why it wasn't working in the first place!
And I did make that sacrifice to the dark lord Cthulhu, why would I question him now?
|
|
|
|
|
Writing Javascript doesn't count as a "sacrifice to the dark lord Cthulhu" - it's a punishment for evil deeds elsewhere in your life...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
My deeds were so evil that I was condemned to HTML/CSS a while ago
JavaScript seems like heaven in comparison, so that's the good news
I need the transition anyway, I don't think I could go from HTML/CSS back to C# just like that. The magnificence of C# would look to great in comparison and I'm only mortal, so my head could explode.
|
|
|
|
|
you will have to look at the differences on how concat and Union all work.
By adding debug routines you may have slowed it to allow parts to complete properly.
Or possibly it was the second "union all" that was added.
No Black Magic there.
|
|
|
|
|
I know how concat works, but obviously I don't have the source code.
unionAll is something I wrote, it works pretty much the same way, but lazy evaluated and it doesn't accept multiple parameters, hence the extra unionAll.
I wrote some tests on unionAll to check that it really adds the elements of a and b to a newly created c, and it does (in the order of a and b).
There is no multi-threading, so "slowing down" shouldn't be an issue (unless bits can jump, as well as fall over).
So there should be no difference between the two.
The weird part is that the sorting was off, but the algorithm itself didn't change.
But the REALLY weird part is that it started working after hours of debugging and no code changes (as far as I know).
There's probably a change somewhere, but after hours of debugging I can't find it.
All looks pretty much the same.
If everything was as easy as "look[ing] at the differences" I'd be out of a job
|
|
|
|
|
Could it be pulling the sort from memory then ?
If you reboot and try it again will it fail ?
|
|
|
|
|
Don't know, it's fixed now, so no point trying to break it again
|
|
|
|
|
Aww your no fun
|
|
|
|
|
Sort of looks the same? Hmm, don't you wish you had a checked in version to compare it to?
Do what thou wilt shall be the whole of the Law. - Liber AL vel Legis 1:40, Aleister Crowley
|
|
|
|
|
I have actually, but this wasn't my first change and I'm not a "one change per commit" kind of guy (well, not on private projects anyway)
|
|
|
|
|
I do several commits per change, unless it's a small, atomic change, which only gets one commit, and every five or so commits I do a push.
But then I'm the guy the that hits CTRL+S, for Save, nearly every time I hit enter.
Do what thou wilt shall be the whole of the Law. - Liber AL vel Legis 1:40, Aleister Crowley
|
|
|
|
|
Brady Kelly wrote: I do several commits per change I guess I'm not as committed to my work as you are
|
|
|
|
|
You could always explain any odd computer behavior this way:
"As the components of integrated circuit chips approach the limits of physics, random aberrant behavior becomes unavoidable in computer processors when the occasional random muons from the solar wind can become lodged in the silicon logic pathways and reroute electrons to the wrong paths. Thusly, while the correctly written code does not change, the application behavior does. It's truly odd."
Or, with javascript, you had a capital letter were it should have been lower case.
if (Object.DividedByZero == true) { Universe.Implode(); }
Meus ratio ex fortis machina. Simplicitatis de formae ac munus. -Foothill, 2016
|
|
|
|
|
And that's why I don't touch an interpreter since C64 BASIC anymore. Further negative points for the absence of a reliable debugger. Yes, yes, I know there are debuggers in the browsers, but like magic, they have different inaccurate results every time. Even if you get the same results several times it still does not mean that this id really what's happening.
My best guess is that this is some kind of caching and updating problem. A total waste of time.
The language is JavaScript. that of Mordor, which I will not utter here
This is Javascript. If you put big wheels and a racing stripe on a golf cart, it's still a f***ing golf cart.
"I don't know, extraterrestrial?"
"You mean like from space?"
"No, from Canada."
If software development were a circus, we would all be the clowns.
|
|
|
|
|
CDP1802 wrote:
My best guess is that this is some kind of caching and updating problem. A total waste of time. Wouldn't be the first time that happened
Although I remember to "Empty Cache and Hard Reload" most of the time.
If at first you don't succeed clear the cache, restart the browser, whatever my code is fine anyway
|
|
|
|
|
Sander Rossel wrote: whatever my code is fine anyway The only good part.
And now I must wipe the dust, grass and blood off my rotor blades.
The language is JavaScript. that of Mordor, which I will not utter here
This is Javascript. If you put big wheels and a racing stripe on a golf cart, it's still a f***ing golf cart.
"I don't know, extraterrestrial?"
"You mean like from space?"
"No, from Canada."
If software development were a circus, we would all be the clowns.
|
|
|
|
|
Sander Rossel wrote: So I've got this quicksort function in a JavaScript library.
Well, if you ask for troubles first place...
|
|
|
|
|
I'm confused.. you replaced a list operator with a set operator, right? Set operators don't have to preserve order, whereas list ones do. So now your sort breaks.. yeah, no surprise there.
Besides, you know better than to depend on implementation behavior, even if you've tested it.
We can program with only 1's, but if all you've got are zeros, you've got nothing.
|
|
|
|
|
patbob wrote: you replaced a list operator with a set operator, right? I replaced a built in operator with a custom operator that basically does the same thing (and yes, both preserve order)
And unionAll is not a set operator, unionAll is (as I don't want to lose elements).
|
|
|
|
|
"Should I laugh or cry?"
DEFINITELY a programming question!
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|