« first day (3194 days earlier)      last day (1770 days later) » 
01:00 - 15:0015:00 - 23:00

1:59 AM
@JRick they look completely different to me though i'm no expert.. but your first example xyz is the name of the function and has no parameters. The second example xyz is a parameter for a function that has no name
Q- Is it correct that when you do settimeout(passing settimeout a procedure), it goes to the webapi, does the waiting, sends the procedure to the task list, then the event loop pushes it onto the stack and then the procedure gets executed. (that's what I gathered from a video by philip roberts on the event loop).. not sure if that's right?
 
 
4 hours later…
6:26 AM
@barlop well if by "does the waiting" you mean the thread sleeps, sure
it doesn't execute a for loop until enough time has passed
ultimately it simply has to wait for something to happen, or lacking that, until the next timeout occurs
 
6:52 AM
1 message moved to Trash can
@SamuraiJack Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. For posting large code blocks, use a paste site like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
 
Guys what would you unit test in this function:

  getBomDetailsByItemId(itemId): Observable<any> {
        let url = this.dmConstants.URLs.GETBOM_BY_ITEMID + "/" + itemId + "/GetBomDetails";
        let headers = {
            "Content-Type": "application/json",
            "UserExecutionContext": JSON.stringify(this.appConstants.userPreferences.UserBasicDetails)
        };
        return this.baseService.getData(url, headers);
    }
` return this.baseService.getData(url, headers);` returns an observable
 
What happens if getData faces a status 500?
 
@geisterfurz007 it just gets logged to console
 
@geisterfurz007 end of the universe
oh, nevermind
 
@SamuraiJack Still returns an observable?
Hey Neil :)
 
6:55 AM
hola \o
 
How was your weekend?
 
@geisterfurz007 yes
 
@geisterfurz007 blue
 
I wouldn't test it then. Because in that case it's just assignments and they should work.
@Neil dabadee?
 
@geisterfurz007 Yeah I guess you are right but stupid code coverage.. management wants 90% code coverage so what you gonna do?
 
7:00 AM
nah, blue skies. Wonderfully sunny weather this weekend
 
Tell them that numbers ain't everything.
Dunno :D
 
I managed to mount the new vacuum cleaner my wife bought also, which is nice
she's been bugging me to do it for a while, but I wasn't sure where the power cables ran behind the wall
 
Nobody here gives a shit about the developers. We could write our stuff in batch files if it worked.
 
^
 
@geisterfurz007 yeah like that will work lol I guess I will just check if this.baseService.getData() was called in the function
 
7:01 AM
Noice!
 
that will cover the code
 
And make sure that the params are still the way you assigned them, lol
 
"So I booted up the docker on my raspberry pi to use MS-DOS 5.6 on one partition and linux on the other. Then they cross communicate via batch script at regular intervals..." "But does it work?" "Well, yeah.." "Good job."
 
My manager still didn't tell us how we are going to use Java with the new licensing model.
Because "there wasn't an official statement by Oracle yet".
I looked up his address. Looks like he is living under a rock.
 
@geisterfurz007 quick question: wouldnt it be right to check if tthis.baseService.getData(url, headers); was called with correctly formed headers and ur?
 let headers = {
            "Content-Type": "application/json",
            "UserExecutionContext": JSON.stringify(this.appConstants.userPreferences.UserBasicDetails)
        };
 
7:04 AM
1 message moved to Trash can
@SamuraiJack Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
 
@geisterfurz007 ...
 
I guess? But given that they are assigned right above them... What you could do it to check if for example the params contain a Content-Type and that other stuff.
 
@SamuraiJack this isn't a slack or github environment
 
A wonderful morning to you KarelG :)
 
> hit Ctrl+K before sending
good morning geisterfurz
don't ask me to write your digits sir James.
 
7:05 AM
Are we in good mood, Sir?
 
@KarelG looks at sealed envelope, walks to keyboard and presses ctrl + k. Walks downstairs and puts envelope into postbox
 
@geisterfurz007 would I make a 007 joke then?
 
Also: geis is perfectly fine ;)
Oh shit, I missed that one entirely O-O
In my defense: It's monday morning and I have no idea where the last 2 hours went.
 
@geisterfurz007 got it.. thanks
 
I'm normally in this chatroom and in java chatroom, but it just occurred to me that perhaps you two have never spoken to each other. Suddenly weird
 
7:07 AM
yeah same here. I have been looking at schedules atm because I forgot the plans to do this week
 
you and KarelG
you'd probably get along famously
 
Huh? He was in Java too
 
was he?
 
Or someone else was it O-O
 
7:08 AM
@geisterfurz007 It was my script-less brother
 
I know who I'm familiar with of course, but it's a lot more difficult to know who my contacts' contacts know
 
@SamuraiJack Take it with a grain of salt... I am not writing tests a lot but wondering what could possibly go wrong in such things (as in: "stuff people could accidentally break"), those are possibilities that might come to mind. You could also check if Content-Type is a valid MIME type for example, I guess.
 
@geisterfurz007 umhm gotcha
 
7:40 AM
1 message moved to Trash can
@Thewise Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
1 message moved to Trash can
@Thewise Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
 
user6718998
Hi. Anyone knows why this wont work in safari ? app.use(helmet({contentSecurityPolicy: {directives: {frameAncestors: ['https://mydomain.eu.auth0.com',]}},}));
 
Maybe safari does not allow trailing comma? Would be my first guess.
 
@MadaraUchiha It should be good
 
@Thewise developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/… Might be worth a try to remove them and try again. According to MDN they are not supported indede.
indeed*
Good morning, Mr. Fortune :)
 
user6718998
You mean the comma after the link ?
 
user6718998
7:45 AM
I removed it
 
user6718998
no difference
 
you need to remove them all
 
user6718998
I keep getting: refused to load somelink.com because it does not appear in the frame-ancestors directive of the Content Security Policy.
 
that is a different problem :P
 
user6718998
 
user6718998
7:47 AM
how ?
 
check the headers
is that domain listed in x-frame-options and/or content-security-policy header
 
user6718998
in the response I get : Content-Security-Policy: frame-ancestors mydomain.eu.auth0.com
 
Constantly getting: "Cannot read property 'getComponentFromError' of null"
The above snapshot is of Angular framework
 
user6718998
All the headers: pastebin.com/8S7CZFCb
 
7:50 AM
@Thewise you need to add the https protocol as well
lol, did not saw your pastebin before that
 
user6718998
I add https always
 
user6718998
the actual url has a lot of parameters in it, but anyway the frameancestors in helmet wont accept question mark or equals
 
Any ideas of a situation where when running this.hostElement.parentElement
returns null instead of Body? This is occuring almost randomly for me, but it never happens when I am debugging this line

this.hostElement = document.createElement("DIV");
document.body.appendChild(this.hostElement);
 
@Thewise what do you mean with that?
 
I can confirm that the element is added and displayed fine, could it be a chrome bug?
 
7:54 AM
also, your x-frame-options is set on same origin while yours csp is allowing from that other domain
 
user6718998
@KarelG the url safari is blocking is like: mydomain.eu.auth0.com/login?state=B121fqf1iobd...
 
user6718998
what should x-frame be set to ?
 
X-Frame-Options: ALLOW-FROM that-auth0-domain
(add it below the existing x-frame-options)
 
@BenFortune I'll test and review it later this evening then
<3
 
!!afk meething
 
user6718998
8:06 AM
@KarelG pastebin.com/SaPx2B7v I did this without success. The x-frame-options will change, but still doesn;t work
 
@Thewise KarelG is afk: meething
 
user6718998
nvm, fixed it
 
8:38 AM
@Thewise good
what was the fix?
 
 
1 hour later…
9:47 AM
I hate chrome
 
/inb4 rule34
 
btw I work for Auth0 @KarelG feel free to ping me
😀
@Thewise why are you trying to iframe auth0?
 
prolly using login pop-ups
 
there is a toggle but usually you shouldn't need to iframe it
 
(which I am not fan of)
 
9:48 AM
@KarelG we do support embedded login without iframes
@KarelG edited
Basically I absolutely hate having to deal with chrome extension apis 😐
they are so weird Win32 seems more usable
@KarelG there is also the part where we do create an iframe but we handle most of the creation etc (to kinda implement sessions)
Bad day, I accidentally opened reddit at work
it's all because of these awful chrome apis
 
10:12 AM
hi
 
@johnsmith Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
 
i have a script with the following code: imgur.com/SZUJfIQ but everytime i fill in the form, the page doesn't get updated and the value of the input element doesn't change. Can anyone help me pls
 
10:31 AM
Do you have to separate var assignment with "+=" operation with something other then a ";"
 
@jAndy o/
 
@IsraelObanijesu you got a collection, should you not loop through it?
 
10:56 AM
@KarelG oh yeah, thank you....i keep forgetting that class is a collection. I changed the code to " $('.comment-body')[0].value='' "; and now that works but the page is still not updating (unless i refresh), pls do you have any idea what could be wrong with the line where i used "history.pushState()"
 
Why is this invalid?
168
A: Is it possible to use vh minus pixels in a CSS calc()?

Alexander KimIt does work indeed. Issue was with my less compiler. It was compiled in to: .container { min-height: calc(-51vh); } Fixed with the following code in less file: .container { min-height: calc(~"100vh - 150px"); } Thanks to this link: Less Aggressive Compilation with CSS3 calc

It should work according to the answer..
nvm
I figured it out.
 
Assuming you're using less
 
11:26 AM
// const har: IntrospectableHARRecord = (record as unknown)as IntrospectableHARRecord;
such a fix!
 
@IsraelObanijesu uhm what do you expect exactly?
 
@KarelG after a new comment is added successfully, then i expect the page to show the new comment without reloading, i didn't want to go through any stress of receiving and appending a response to the div using jquery so i thought if i use "history.pushState()", that the page would update and show the new comment without reloading but it doesn't
 
just add it to the DOM ?
don't play with the history API if you don't understand it.
and about adding to the dom, just use .append
 
oh well, i was just being lazy.....adding to the DOM takes more code and history API is just one line
i will just add it to the DOM since the API didn't work
 
11:41 AM
hey guys, i've got me a repo that within it clones and pulls other repositories that are lambdas. These lambda repositories have an .nvmrc for 8.10 as lambda node is 8.10. If i do npm install within one of these repositories do need to run nvm install each time?
 
hii
I was talking about a Table component here yesterday..here is a gist - https://gist.github.com/BrianJVarley/b51afa817209f2a4f8995a53ba5b3a35

The problem I'm seeing at the moment is that the props values tableData are not being rendered as rows
although when logging this.props.tableData at runtime shows the props are populated. It looks like its a timing thing as I init the table in componentDidMount it renders before the props value is available I think?
Should I be hooking onto a different react lifecycle event to init the table or perhaps conditional render? thanks
 
12:14 PM
@Neil thanks.. what about if you do a $.ajax async GET request, would that execute in the webapi and get a response put on the task queue which gets pushed onto the js stack when the js stack is empty? (so the request itself is executed in the webapi)?
 
@barlop I'm not sure, but I'm fairly sure that it isn't waiting via a loop or something
not sure specifically regarding the details of the ajax response though
 
you can mark XMLHttpRequest as async in the open method
jQuery is most likely using that
if it isn't, they're being dumb.
 
Woohoo
 
12:31 PM
@rlemon ActiveXObject? 😀
(they do lol)
 
@KarelG when? version 0.8?
 
12:51 PM
hey I've always wondered how do you pass the outer this into a nested call on an array..like a .slice followed by a .map
in that case when I try to access the outer this its always undefined
so I try to hack around it by creating a _this before that code block which works but its fugly
 const _this = this;
    const tableRows = this.state.localTableState.length
      ? this.state.localTableState
          .slice(
            this.state.paginationState.page *
              this.state.paginationState.rowsPerPage,
            this.state.paginationState.page *
              this.state.paginationState.rowsPerPage +
              this.state.paginationState.rowsPerPage
          )
          .map(function(row, index) {
            return (
              <tr key={index} data-item={row}>
 
You can use .bind() on the function and assign the value of this as the first arg to bind
 
arrow functions
bind works, but arrow functions would be easier. less overhead
arrow functions don't rebind their own this
so everything JustWorks ™️
 
right, more intrinsic w/ arrow functions
 
zum biespiel?
 
you can also pass this to the map
little know argument
which is insane to me (that people just don't use it)
 
12:55 PM
ok so like
.map((row, index, this) -> {
 
no
 
ha
 
.map( ( row, index ) => {}); // this is the parent scopes this
.map( handlerFn, this ); // second argument of a map is the thisArg
 
@rlemon 1.11 still has old IE support
(with activeXObject stuff)
 
12:58 PM
I thought they trimmed support a bit more than that. ohh well
 
.map((row, index) => {
            return (
              <tr key={index} data-item={row}>
                {/* filter out columns not not in props.tableHeaders */}
                {Object.keys(row)
                  .filter(key => _this.props.tableHeaders.includes(key))
                  .map((key, index) => (
                    <td data-title={key}>{row[key]}</td>
                  ))}
              </tr>
            );
          })
 
yes, now you no longer need _this = this; crap. just use this
 
yeah
now I can code!
 
never knew that about map, or other array functions
 
this is pretty damn cool → github.com/dessant/buster
 
1:25 PM
 
1:42 PM
@BrianJ now remove the {} and the return statement
arrows have implicit returns
😉
.map( (row, index) =>
  <tr ...> ... </tr>
);
is valid
 
not sure about that
 
2:08 PM
hmm anyone exprienced with jss? - I really can't find a real documentation other than snippets everywhere. -- I'm now looking for a way to "style all a elements, not using classes".
 
2:26 PM
window.location = "http://www.yoururl.com";
by doing that the broswer will make a new request, how can i set headers to that request?
and what is the difference with
 window.location.replace("http://www.yoururl.com")
 
@Aurelius difference is that the first one adds the url to the local history and the second does not;
effect of not adding = back button cannot be used.
 
you should also be using .assign instead of over writing the location object. iirc
 
true. but a lot people is doing that (or using window.location.href instead)
oh, about the custom headers: you cannot.
(lol, the security horror if it is possible)
 
okay I am using
document.cookie
in the place of headers
at the moment
the result is almost the same
 
uh oh
You do know about gdpr? - You just put a tracking cookie on your website, exactly the thing gdpr's motivation wishes to prevent sites from doing.
 
2:41 PM
Okay then they should tell us how the hell we can authenticate users
 
You use a cookie, but why would you set the window location?
 
Anyone here familiar with setting up a Javascript unit test framework within MS Visual Studio?

I've looked at the documentation and something isn't clear to me.
 
Or are those two things different? In that case using cookies is the way to go (though fore safety I would keep the session cookie as html only). - I was thinking you were sharing the cookie information with another, redirected, website.
 
Basically, it says that you're supposed to use the NPM package manager, but I thought that it only applies to node.js projects. I have some JS in a WebForms project I want to apply some unit tests to, if there's a reasonable way to do that.
 
@DanielAllenLangdon For frontend nodejs is used to "run and test, and manage" your project.
 
2:45 PM
I'm prototyping a small project and I want to make sure I can unit test the Javascript code.
I've never done JS unit testing with such a project before.
Would I then create a separate JS project to unit test my WebForms project?
 
I am prototyping a large project and haven't written a single test yet
 
Well you need nodejs to "run" the javascript (and a unit test package). Then packages.json can define (for npm) different ways to run it: one of which should be the unit tests.
@ShrekOverflow blashphemy!
 
@ShrekOverflow, I am singularly responsible for coding this project right atm, and I want this done right.
 
I just add the tests at the end 😛
but yes adding it to package.json would be a good way
`scripts: {
"test": "node run-the-test.js"
}`
 
I've written a thousand or so lines of code that will draw graphs based on user input. That code is going to grow a lot, and I don't want it to break every time a slight breeze blows.
 
2:48 PM
Though I find unit testing javascript code notoriously difficult compared to say Java/c# and even python.
 
Then that does sound like a right time for tests :D
@DanielAllenLangdon have you looked into mocha / ava ?
their are full end to end guides they have about this :)
 
@paul23, do I then need to put the JS that I want to test inside the node.js project and then reference it from the C# project?
 
Well as I said: the general workflow is to have nodejs as "manager", which will call (using npm - npm should be consider part of nodejs) the unit tests.
 
@DanielAllenLangdon no
if your project is C# you'll have some way to run the tests
depending on if your tests are in the browser
you'll probably be able to use some kind of webdriver from C# (look into phantomjs or karma)
I am out of depth on C# but the concept should be the same
 
I googled for MS's documentation, and found this:
https://docs.microsoft.com/en-us/visualstudio/javascript/unit-testing-javascript-with-visual-studio?view=vs-2019

It looks like they expect that I want to test in a node.js application.
Maybe I'm looking in the wrong place.
 
2:50 PM
Yes
From what I understand you have client side js in a c# project -- right?
 
@shrekoverflow, correct!
 
Wait, but if you have that: how do you transpile your code with babel anyways?
 
Peace
 
transpile what code?

My server side code is C#/SQL and client-side code is JS.
 
2:53 PM
I mean to make sure the javascript is converted to the least common denominator for browsers?
 
The curse of JS is that there can never be a single version
older browsers will have outdated javascript
 
I guess I'm old-fashioned. I'm writing plain ES5.
 
unless you are using ES5 you'll need to transpile
 
oO
 
I work for a large organization that makes we target IE10 anyways.
 
2:53 PM
@DanielAllenLangdon I'd strongly recommend checking that
 
checking what?
 
we had a prod outage once because someone added` =>` to code
just 1 😃
Taht you are using ES 5 and testing in IE 😀
I'd recommend a transpiler by default -- it ends up in much cleaner and easier to follow code
in-fact, since you are using Microsoft tech anyway, might I suggest TypeScript :)
 
Years ago, I worked for this large gov't contracting agency, and then I broke free for several years, and then offered to let me work at home as an hourly contractor for an attractive rate, and so they lured me back in.
 
It's easy to opt-in 😃, It won't touch your JS but you can start writing code moving forward
 
Well writing "es5" and "I've written a thousand or so lines of code that will draw graphs based on user input. That code is going to grow a lot, " seem to be two clashing things.
 
2:55 PM
and since you are coding C# you'll feel home
just a humble suggestion
 
I'm actually relatively lucky. Working outside, I can use pretty much whatever tools I want, but inside the hive, they have to use laptops with full-disk encryption and a version of VS that is at least several years out of date.
Well writing "es5" and "I've written a thousand or so lines of code that will draw graphs based on user input. That code is going to grow a lot, " seem to be two clashing things.

^^^ What do you mean by this?
I'm doing an Angular 1.x project.
I have some code that spits out coordinates for lines to be drawn on an SVG canvas.
 
That the tools brought by newer version of javascript really really really help with scalability of said javascript.
 
I must sound like a dinosaur fossil at age 36.
 
@DanielAllenLangdon Ouch
@DanielAllenLangdon I am 26 😀 in the same boat :P
 
I'm actually experiencing some health issues right now. Insomnia, exhaustion, and fatigue set in from time to time and being able to work remote and not spend time and effort commuting and dealing with office stress is an absolute godsend.
But I still am fascinated by technology and I feel a great sense of gratitute that code is my living.
It's almost like getting to play with Lego blocks and get paid for it.
 
2:58 PM
Ha :D
 
@DanielAllenLangdon yea you old
 
I work for a fully-remote company, love it -- although here I am sitting in an office cause I like the office life lol. (I was working from home for 3 years)
 
It's just on my mind because for some reason, my exhaustion and insomnia have been particularly bad the last several weeks, and every time it happens, I'm afraid it's the end for me.
 
@rlemon eh , then you're older, no?
 
paranoia on my part
 
2:59 PM
@KarelG No
 
nahh I'm 33
he's old
 
I'm 36. I'm OLD!
 
I'm a spring chicken
 
Who is the eldest here?
 
Denys
 
2:59 PM
Dystroy?
 
01:00 - 15:0015:00 - 23:00

« first day (3194 days earlier)      last day (1770 days later) »