Grrr getting a seemingly impossible array out of bounds error on this report.
The same report I was asking about a few pages ago. I had to restructure a lot of the code the contractor who originally put this together did because some hidden inner joins among a pile of outer joins (which she'd also done in a many years old, terrible performance, all current training from the vendor says "Don't do it this way. It's not needed anymore and it's bad.") was causing some information to be dropped that was required. So I rewrite it in a more explicit way.
One of the things I had to do when modifying it, was use a function they provide to look up the index of a value in a list inside a record structure. Somehow, it's giving me an index 1 larger than the size of the list.
Is that just how they signal "not in the list"?
-1 is a better sentinel since it doesn't, you know, vary with your data. But "I'm pointing to the end of the list because I got there, you should know that means I didn't find it" is logical, if not the most practical.
Mystery solved!
I was referencing the wrong list! One that was very similar, but subtly different in such a way that it only failed near the end instead of way early on.
Grrr getting a seemingly impossible array out of bounds error on this report.
The same report I was asking about a few pages ago. I had to restructure a lot of the code the contractor who originally put this together did because some hidden inner joins among a pile of outer joins (which she'd also done in a many years old, terrible performance, all current training from the vendor says "Don't do it this way. It's not needed anymore and it's bad.") was causing some information to be dropped that was required. So I rewrite it in a more explicit way.
One of the things I had to do when modifying it, was use a function they provide to look up the index of a value in a list inside a record structure. Somehow, it's giving me an index 1 larger than the size of the list.
Is that just how they signal "not in the list"?
-1 is a better sentinel since it doesn't, you know, vary with your data. But "I'm pointing to the end of the list because I got there, you should know that means I didn't find it" is logical, if not the most practical.
No, they use 0 or a negative number depending on the way in which it was not found (smaller than the smallest item, bigger than the biggest item, etc). It's a somewhat surprising instance of them doing something a sensible way.
The gratuitous packaging makes some sense though. It's really a symptom of JS's standard library being barebones. In the rest of the programming world we'd just put together some sort of kitchen-sink type standard library replacement ala boost, but that's not a good option in the browser world because the library would be too big to send every time someone visits a web page.
Yeah, I understand why you have very tiny specific packages like "is this a positive int?" when you're going to bundle it up into a minified JS file anyway, but it still feels pretty silly to look at.
It's pretty rare for modules to be nested that deep if you're running NPM 3, which is bundled with Node 5. It's been nothing but stable for me, so maybe give that a try.
+1
admanbunionize your workplaceSeattle, WARegistered Userregular
everything about modern JS and Node and NPM just looks like a bunch of dumbass teenagers tried to reimplement the C / GNU / *NIX universe of open source software and did the worst conceivable job of it
Turns out it's really fuckin' hard to update a language that depends on a minimum of three different implementations to agree on (Chrome, Firefox, IE, arguably Safari, Opera, mobile browsers...) in order for it to function correctly in production. And when you can't update your language you have to implement those features in packages instead.
Also yeah that's about 90% Windows' fault. The rest goes to NPM for ever building a package system without tree flattening.
There's a maximum file path length in Windows?
I feel like such a n00b.
It's present on a lot of platforms. Linux/Unix has one, BSD has one as well, I think.
They're a bit bigger than the 260 ANSI Windows limitation, but typically around 1-4k, I think.
Unfortunately, once someone defined MAX_PATH as 260 for Windows, there was no real good way to change it without some serious binary magick to keep things compatible.
Also yeah that's about 90% Windows' fault. The rest goes to NPM for ever building a package system without tree flattening.
There's a maximum file path length in Windows?
I feel like such a n00b.
There is a maximum path length of 256 characters when using ANSI APIs (due to the definition of the MAX_PATH macro and for compatibility it cannot change)
Unicode versions of the APIs can accept up to 32k characters (though you may need the \\?\ prefix? Not sure)
Linux has one around 4k
Grrr getting a seemingly impossible array out of bounds error on this report.
The same report I was asking about a few pages ago. I had to restructure a lot of the code the contractor who originally put this together did because some hidden inner joins among a pile of outer joins (which she'd also done in a many years old, terrible performance, all current training from the vendor says "Don't do it this way. It's not needed anymore and it's bad.") was causing some information to be dropped that was required. So I rewrite it in a more explicit way.
One of the things I had to do when modifying it, was use a function they provide to look up the index of a value in a list inside a record structure. Somehow, it's giving me an index 1 larger than the size of the list.
Is that just how they signal "not in the list"?
-1 is a better sentinel since it doesn't, you know, vary with your data. But "I'm pointing to the end of the list because I got there, you should know that means I didn't find it" is logical, if not the most practical.
Of course, if you want to get clever about it,
d:\dev\redux-~1\node_m~1\babel-~1\node_m~1\babel-~1\node_m~1\babel-~1\node_m~1\babel-~1\node_m~1\babel-~1\lib\path\infere~1\inferer-reference.js is probably a valid path due to the short name thing
I'm using Chocolatey as a package manager for stuff in Windows, turns out it has npm 1.4.9.
This package uses an older NPM which is no longer offered as a standalone package separately from NodeJS. It is recommended that you uninstall this package and the package nodejs.commandline in favor of nodejs.install (which nodejs package now points to).
This version of npm is known to have issues on Windows.
*recombobulates*
edit: there, uninstalled the npm package and now it uses the one that apparently came with the nodejs package, which is 3.something.
'use strict';
module.exports = function (str) {
var isExtendedLengthPath = /^\\\\\?\\/.test(str);
var hasNonAscii = /[^\x00-\x80]+/.test(str);
if (isExtendedLengthPath || hasNonAscii) {
return str;
}
return str.replace(/\\/g, '/');
};
Could I write my own for every project? sure, but...why? why waste even the smallest amount of time or effort in doing that when someone has already proven a stable, efficient version that covers every use-case?
With an ecosystem like the Browser, and then also bringing in operating system compatibility stuff now with node, I don't want to think or worry about "well, i know it should just be this one regex thing, but what about NonAscii characters or the ExtendedLengthPath check? Would I have just thought of those use cases the 1st time i hand implemented it, or would I have had to wait until someone filed an issue and then go fix it?
These micro packages also have the ability to evolve as the system and technologies evolve, thus potentially updating automatically if say a new browser (hello https://www.brave.com/ ) or javascript engine ( hello https://github.com/Microsoft/ChakraCore ) handles these use cases differently. And I don't have to worry about it.
I'm focused on building a product, not stupid shit like having to hand write regex to fix my slashes. Same thing with left-pad and million other micro modules out there.
everything about modern JS and Node and NPM just looks like a bunch of dumbass teenagers tried to reimplement the C / GNU / *NIX universe of open source software and did the worst conceivable job of it
Turns out it's really fuckin' hard to update a language that depends on a minimum of three different implementations to agree on (Chrome, Firefox, IE, arguably Safari, Opera, mobile browsers...) in order for it to function correctly in production. And when you can't update your language you have to implement those features in packages instead.
Ugh. Yeah, I've been banging my head on that a few times this month - there's a perfect function for what I want to do in ES6 or whatever, except whoops I have to have multiple browser compatibility and one of them hasn't bothered to implement it.
Hell, Promise only got added to mobile Safari with iOS 9 iirc.
Needing to move a couple fields around on this ASP.net site I maintain. Can't figure out why it breaks complaining that it can't generate a control because one of label fields on it is already used in another control.
Turns out when I commented it out ,instead of ASP comments
<%-- stuff -->
I used HTML/XML style comments
<!-- stuff -->
which Visual Studio "helpfully" syntax highlights as comments (because I guess the page is still technically HTML) but if there's ASP type stuff inside it has to have ASP comments or it will still try and generate it.
Had to have a coworker point it out to me because I so rarely work in the ASP world.
0
admanbunionize your workplaceSeattle, WARegistered Userregular
Posts
Is that just how they signal "not in the list"?
-1 is a better sentinel since it doesn't, you know, vary with your data. But "I'm pointing to the end of the list because I got there, you should know that means I didn't find it" is logical, if not the most practical.
I was referencing the wrong list! One that was very similar, but subtly different in such a way that it only failed near the end instead of way early on. No, they use 0 or a negative number depending on the way in which it was not found (smaller than the smallest item, bigger than the biggest item, etc). It's a somewhat surprising instance of them doing something a sensible way.
Yeah, I understand why you have very tiny specific packages like "is this a positive int?" when you're going to bundle it up into a minified JS file anyway, but it still feels pretty silly to look at.
Turns out it's really fuckin' hard to update a language that depends on a minimum of three different implementations to agree on (Chrome, Firefox, IE, arguably Safari, Opera, mobile browsers...) in order for it to function correctly in production. And when you can't update your language you have to implement those features in packages instead.
This one's easy -- character limits on paths in an operating system in 2016 are a fucking joke.
That said, npm 3 flattened dependencies so you should update if you can.
You can technically support path lengths of up to 32k in Windows by using the "\\?\" prefix, if you're using the Unicode API.
Is node using the Unicode API?
I don't know.
There's a maximum file path length in Windows?
I feel like such a n00b.
It's present on a lot of platforms. Linux/Unix has one, BSD has one as well, I think.
They're a bit bigger than the 260 ANSI Windows limitation, but typically around 1-4k, I think.
Unfortunately, once someone defined MAX_PATH as 260 for Windows, there was no real good way to change it without some serious binary magick to keep things compatible.
There is a maximum path length of 256 characters when using ANSI APIs (due to the definition of the MAX_PATH macro and for compatibility it cannot change)
Unicode versions of the APIs can accept up to 32k characters (though you may need the \\?\ prefix? Not sure)
Linux has one around 4k
Yeah, you won't come across much in normal circumstances.
d:\dev\redux-~1\node_m~1\babel-~1\node_m~1\babel-~1\node_m~1\babel-~1\node_m~1\babel-~1\node_m~1\babel-~1\lib\path\infere~1\inferer-reference.js is probably a valid path due to the short name thing
*recombobulates*
edit: there, uninstalled the npm package and now it uses the one that apparently came with the nodejs package, which is 3.something.
Oh my glob, I'm crying over here.
a) what the fuck
b)
https://github.com/kevva/is-positive/commits/master
for those that are interested in this crazy journey
Oh and if you want to consider 0 as positive good news! Yet another module will do that... https://github.com/sindresorhus/positive-zero
Why isn't it as simple as a >= 0?
Is this something akin to type traits in C++?
Edit: oh I see that the code does contain a > 0 comparison. So is it handling the type system of JavaScript?
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign
There's already a mostly built in function for this.
I haven't looked at it but maybe the integer part? Like, it checks both sign and integerness.
You got it, but yeah, it's probably a bunch of stuff to go "is it actually a number, are we sure of it's sign, etc" before it does "val > 0"
'use strict'; module.exports = function (n) { return toString.call(n) === '[object Number]' && n > 0; };hell, I use https://www.npmjs.com/package/slash all the time because i develop on windows. This is the entire codebase:
'use strict'; module.exports = function (str) { var isExtendedLengthPath = /^\\\\\?\\/.test(str); var hasNonAscii = /[^\x00-\x80]+/.test(str); if (isExtendedLengthPath || hasNonAscii) { return str; } return str.replace(/\\/g, '/'); };Could I write my own for every project? sure, but...why? why waste even the smallest amount of time or effort in doing that when someone has already proven a stable, efficient version that covers every use-case?
With an ecosystem like the Browser, and then also bringing in operating system compatibility stuff now with node, I don't want to think or worry about "well, i know it should just be this one regex thing, but what about NonAscii characters or the ExtendedLengthPath check? Would I have just thought of those use cases the 1st time i hand implemented it, or would I have had to wait until someone filed an issue and then go fix it?
These micro packages also have the ability to evolve as the system and technologies evolve, thus potentially updating automatically if say a new browser (hello https://www.brave.com/ ) or javascript engine ( hello https://github.com/Microsoft/ChakraCore ) handles these use cases differently. And I don't have to worry about it.
I'm focused on building a product, not stupid shit like having to hand write regex to fix my slashes. Same thing with left-pad and million other micro modules out there.
PARKER, YOU'RE FIRED! <-- My comic book podcast! Satan look here!
http://left-pad.io/
PARKER, YOU'RE FIRED! <-- My comic book podcast! Satan look here!
Ugh. Yeah, I've been banging my head on that a few times this month - there's a perfect function for what I want to do in ES6 or whatever, except whoops I have to have multiple browser compatibility and one of them hasn't bothered to implement it.
Hell, Promise only got added to mobile Safari with iOS 9 iirc.
3DS: 0473-8507-2652
Switch: SW-5185-4991-5118
PSN: AbEntropy
// This can never happen.
Turns out when I commented it out ,instead of ASP comments I used HTML/XML style comments
which Visual Studio "helpfully" syntax highlights as comments (because I guess the page is still technically HTML) but if there's ASP type stuff inside it has to have ASP comments or it will still try and generate it.
Had to have a coworker point it out to me because I so rarely work in the ASP world.
I would never write a comment like that.
See?
is one of my "this shouldn't happen" comments
// we're fucked if we get here, just exit
I have written almost exactly that comment before in ancient code I was trying to debug
like, "I have no fucking clue how this state occurs, but it does sometimes and it fucks everything up, so just error out"