« first day (3014 days earlier)      last day (2159 days later) » 
00:00 - 18:0018:00 - 00:00

00:19
@OvieAdese You looking for front end JS, right?
user8729657
@JacobSchneider, any method possible
what kind of device are you looking into detecting?
any or USB devices?
user8729657
00:36
I was just wondering if it where possible to do that
01:00
morn tavo
I wouldn't really categorize those as "hardware", it's more just internal system information
To me anyway, maybe they're the same thing
is having no deadlines, no clear objective normal at work?
Sounds like you're lacking in basic management
@WilliamLee certain hardware are plugged in That can tell if the charger is "plugged" in.
We don't have deadlines, so I would say that's fairly normal.
01:30
If you don't have both, then I'd say it's definitely not normal
As for what counts as a clear objective, that's another issue entirely
Deadlines can be either way depending on company
@KendallFrey Non specific deadlines or none at all?
@JBis I suppose you're right about the battery charger being plugged in, but it doesn't tell you anything about the charger itself. Depends on how much information Ovie wants I guess
01:32
I'm not really assigned to any concrete project any more, just doing exploratory research type work and kind of feel weird about it..
@JBis We kind of have a general roadmap of what we want to do when, but that's on the timescale of months. There's no consequence for something taking longer than expected, and no reward for it being easier than expected.
Did they at least tell you what issue you're trying to solve with your exploratory research?
> Lets apps send and receive SMS text messages, as well as to access and manage the messages stored on the device.
@erotavlas That does sound weird. If that's new, might want to dust off the resume.
01:34
@WilliamLee Yeah. Not really what web was designed for. @OvieAdese should make a desktop app. Node?
well i kind of feel like an appendix ( you know ) its in your gut but no one knows what its for
you could cut it off and you will still digest food normally as if it wasn't there
:)
@KendallFrey No specific reward or none at all? (Consideration for raise?)
I don't know how that's decided, but it's not based on meeting deadlines for any specific projects
intresting
my new assignment is to do with ML....from what I used to work doing .net stuff
01:39
may I ask who you work for?
Maybe the company is just looking to getting into ML and they wanted to entrust you with paving the way?
Either that or they're just shifting you somewhere out of sight lol
at least with .net and c# it is more software eng. and I think its more structured and easier of course than ML...more building...ML is more experimentation
actually my company is all about ML and NLP... so it makes sense to focus on that.
01:51
is it possible to devolve into a junior software developer from senior given enough time away from the field (long enough time not practicing building software)?
hmmm
In the same company? Haven't heard of that happening. Switching companies? Probably, depending on how much you forget
But that'd be quite a feat I think
yeah true
sjs
sjs
02:19
actually its much worse, you will devolve into a primitive life form as in the episode Genesis of Star Trek TNG if you are absent six months or longer from a senior position
03:20
can you break a while loop inside a forEach.
from what I see you can't
Seems like you'll have to throw an exception if you really want a break
I'm not interested in breaking the forEach just the while
Surely you can just break it normally, no?
[1, 2, 3].forEach(x => { while(x < 10) { if (x === 3) { break; } x++; } });
Unless I'm misunderstanding you when you say a while inside a forEach
does not seem to be working as expected
is that working for you
Oh really? That's surprising. I haven't actually given it a run but I would've expected it to work.
03:31
try it and let me kow
I guess I'm missing some other quirk of javascript
Yeah let me try something
seems to work. I just tweaked it a bit and ran it in browser console
[1, 2, 3].forEach(x => { while(x < 10) { if (x === 3) { break; } console.log(x);x = x+1; } });
Should see the expected 1 2 2 being logged
It's breaking as soon as it sees a 3 correctly
don't console.log after the break console.log in front of the if check
Still working. I see 1 2 3 2 3 3
forget I'm probably doing something wrong
Which should be the expected output
03:36
or too complicated
Yeah, sounds like you've just got some bug that you're missing
 
2 hours later…
05:20
Can anyone answer this stackoverflow.com/questions/54204295/… ,Thanks in advance.
@rahuluday 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.
06:15
Hey all. I've acquired a font file and I'm trying to use it in a web page but it's not showing the updated font. It's using some hideous sans serif font.
here's the font file
https://drive.google.com/file/d/1i5OpQPntutNozLQ5Ixd3-OmH1VYKm3KA/view?usp=sharing
https://drive.google.com/file/d/1L7EvTqvfEzOnptAVBmdxRn3Gp-0F1xHm/view?usp=sharing
https://drive.google.com/file/d/1tWGiwPF7gPZXNO_yIfip1ZOg6bIItG-6/view?usp=sharing
yeah, so I need a bit of help
06:43
disregard the links, they won't work any more
https://drive.google.com/file/d/1jtDASu89z8QNIdAbPtiwTvNmORPvN543/view?usp=sharing
https://drive.google.com/file/d/1JE553954x49iMOglvPmPdJEjvzqPLgS_/view?usp=sharing
06:59
NVM I somehow got it to work!!!
No idea how
but I did
07:48
@BenjaminGruenbaum I would like to contribute for the nodejs project. Where do I start?
@OfirMeguri 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.
@OfirMeguri Find the Repo
@JacobSchneider I know where the github repo is, but I want someone experienced to give me an issue that fit me since it my first issue on this project.
@OfirMeguri you can start with small issues. But read the guidelines first. They have their own procedure
they have documented it AFAIK. *checks*
Node.js is flawless, I got nothing.
08:41
oof
09:36
Hey guys, I'm trying to make a footer, but i want it to be placed at the bottom of the screen or if the webpage overflows, for the footer to move down
in CSS of course
yeah, sorry
so I have a footer, I want it to sorta stick to the bottom of the screen, but not be fixed, so that if the content requires more space, the footer moves as well
if you just position it at the end of the document; does it not stay there, no?
(that is why it is called <footer>)
09:40
hang on, let me draw something up
you want it sticky until you scroll?
that's a good way of putting it
it's very close
I want to footer to scroll like a normal element, but I want it to essentially be constrained to bottom: 0 as though that were set
10:00
Hello Guys
ngbmodal popup is not working with me
 const options : NgbModalOptions={
      size : 'lg',
      windowClass :'modal-xl'
    }
    this.modalService.open(content ,options).result.then((result) => {
      this.saveTask(result);
    }, (reason) => {
      this.data = JSON.parse(JSON.stringify(this.originalList));
    });
  }
1 message moved to Trash can
@Bassem Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
@BenFortune I was going for a cross between these two
@CapricaSix my code is formatted
10:06
@JacobSchneider I still don't get it
the two squares signify a webpage
the blue bar is the footer
in the first example, the green (the content) does not fill the page and does not force the footer to move down, but in the second example, the green overflows the webpage, pushing the footer down
So you only want it fixed to the bottom if the entire page doesn't overflow?
can't you just set body to 100% height?
I'll give that a shit
shot*
10:12
why not position:fixed; bottom:0
because it's position is fixed
it won't scroll
also bottom: 0 doesn't work on relative position
how do I make it work for relative?
what will not scroll footer or body ?
the footer is inside the body, if the article overflows the webpage, the footer should go with it, otherwise, the footer sticks to the bottom
I still don't get your problem. Can you put a mvce?
did you see the pen?
10:21
so in that case you can calculate page scroll offset according to that you can set your position for footer
create a fiddle with your page and the styling relevant to the body, the first child elements of it (incl. the footer)
you already have a working example?
no
it's a demonstration showing two pieces that I would like to combine
@KarelG a clean slate, can I get the footer to stick to the bottom codepen.io/klaussmc/pen/dwLbba
guys
here it is
hmm. a sec
10:33
thanks every one!!
 
1 hour later…
11:37
Hi everyone, If a user opens my website (say on Browser Tab A) and there is already a tab with same website opened (say Browser Tab B), Can I write some JS so that Tab A automatically closes and focus goes to Tab B?
sure
you could use window.localStorage
when a user visits your page, update a value to true, and when the user leaves the page (window.addEventListener('unload', ...)) then set the variable to false
No but how to open Tab A?? I am not sure if you understood my query
yes, watch the variable, if something tries to change it, a script in Tab a will close the tab
I understood the logic when to show tab and when to hide. What I mean is that suppose there is Tab A in which that website is already opened and now I am on Tab B, how would Tab A get focus to itself????
why do you need to focus it if the aim is to close it, giving the focus back to tab B?
11:51
you wouldn't be on Tab B to begin with as soon as you enter the address, you'd know there was Tab A open and thus close Tab B
well assuming he closes the tab whenever a duplicate is open, no
I just realised how stupid my comment was
it shouldn't ever be the case to have two open unless say, you set your home pages in your browser to load two copies of the same site
it's possible nonetheless
probably a better question is, why is it so important to have only one page open?
smells like an XY problem to me
but it's a scenario that is not entirely impossible
11:57
Ok so my use case is: I have this editor on my website which can have multiple tabs, what I want is that whenever a user opens a new tab and opens editor, I should close this tab and open the already opened editor and create editor-tab in that
Sorry for bad english, I hope it is understandable what exactly my use case is..
no I get that
that's like what Atom does
that's a great idea
hang on, I'll pull up a quick sketch
Atom is desktop app, mine is not. It needs a browser tab and it loads inside a website
yes I was giving an example
@JacobSchneider oh yeah, sorry, I was just confirming if we are on the same page despite my bad grammar :P
haha, no worries
also, It's JS, there's a way
12:06
i'd think that it'd be configurable
sometimes you don't want a new tab, you just want the current page to update
but still there needs to be a solution to the above problem. Making it configurable is no big deal
yes, exactly Neil :p
well making your page close if another is already open would be a last resort to fix this problem
Closing the page is easy. I will do window.close() and broadcast this message across all the browser tabs but how would the tab in which the website is already opened would get focus on itself after getting the broadcasted message. I think there is no way to do that as told in other SO post.
no, you may be right on that one, I tried an alert but that did nothing
12:16
I don't wanna use alert, I'd better drop off all this functionality if I'd finally gotta rely on alert :P
and yes, now even alert boxes aren't working omg :P
12:27
oh ahahaha
@RahulJain You can only do it with a browser extension
nothing natively
i'm getting somewhere
12:43
o.o
waiting for some climax Jacob?
yeah, maybe not tonight
sorry
12:59
I GOT IT!!!!!!!!!!!!!!!!!!!!!!!!!!!
@JacobSchneider Salute!! Thanks bro.
Lol! I've never had such a passion for coding.
Thank you :)
Oh man, coding is something I will always love
user10844537
13:43
Hello. I'm not getting any answers or comments on this question (stackoverflow.com/questions/54195534/…). Any ideas on how to improve the question so it can be better received?
user10844537
I couldn't find any more specific angularjs room, I hope is ok to bring this up in here.
14:08
it is ok to bring it up here since Angular.js is javascript in essence
I enjoy coding but most of this job isn't
user10844537
Good. At least I didn't mess that up. Reading the rules it says that links to questions should be posted on its own message, not accompanied of more text. I'll post the link again, just to dot the 'i's.
user10844537
0
Q: Why are set-cookie headers received in $http.get() not being used for subsequent $http request?

poirotMy code performs a GET request, and then() after it's done, peforms an additional request (post). This is the code let app = angular.module('myApp', []); app.controller('controller', function ($scope, $http) { $http.get("http://localhost:8006/one.php", { withCredentials: true }) ...

most of it is just hassle and explaining relatively simple concepts to people who are adamant about not wanting to learn or remember
those cookies are sent by the PHP server.
user10844537
14:11
the cookies headers are sent by the PHP server
user10844537
but are set on the browser
user10844537
in this case, they end up being set. but not between first .get() and the post() that happens in the then() block.
@BinoyCherian 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.
did not press the "n" well. I was just pointing that angular does not have do to something with it
it is a normal behavior because those three request are three separate requests, they are not part/aware of each other
user10844537
14:14
no request is aware of each other
user10844537
but the POST happens after the GET
user10844537
and the GET response includes Set-Cookie headers
user10844537
why the POST request doesn't include Cookie headers?
user10844537
If I execute another GET request (e.g. by reloading the page), that GET request will also be "not aware of previous requests", but will include a "Cookie" header with the content of the previously received "Set-Cookie" response.
I have a question for Javascript. There is a div corresponding to a basket and I would like to show and hide the basket when the user clicks on the div. I have implemented it using a global variable that keeps count of the click and if the click is an even/odd i open and close the basket. I was hoping to know if there would be a better way to show and hide div's?
user10844537
14:18
I guess that my question boils down to: why the requests that happen inside the then() block are not sending the Cookie header, even if they happen after the first GET.
lmao...so true!
@poirot because including the cookie header of the previous request is something the browser is doing
It has nothing to do with http
If you want the same behavior, you have to manually add them yourself
user10844537
@Neil but on further requests, making get() requests through angular will include the cookies even if I do not include them manually.
user10844537
once the cookies are set, get()(or post()) will send the Cookie headers. I've verified this.
are those Responses in the .then not copies of the original one?
I am intrigued. I thought that there is a secure cookie flag enabled but even then
user10844537
14:29
the responses are not copies of the original one. each request receives it's own response.
user10844537
each set-cookie header is different
user10844537
They are not even handled by the same code. there is a pre-flight OPTIONS call made by the browser automatically, and then the POST request.
user10844537
Pretty sure is me being a moron. Mostly intirgued about how can I improve my question so it is answerable. Or closable as a dupe. Or something.
ok, so it's angular and not the browser
user10844537
Er... more or less, I guess? Angular asks for the requests, but it's the browser making the requests. As always. But for some reason the requests that happen in the then() block are not yet aware of a Set-Cookie header in the previous block.
user10844537
14:38
in this case, the cookie is rather important, because it is establishing the session, so the additional requests should send those cookies automatically. I guess I could cheat and send the cookie value in the first response body, and use it for further requests... but feels kinda backwards.
I don't think you have much of a choice
not pushing the header for each request is maximum flexibility, but it's also a bit of a hassle if you simply wanted to keep them each time
wow. just used mobx autorun without react for the first time. not sure if super cool or completely retarded
14:56
@poirot I don't know how angular does it under the hood, but went on their documentation and the withCredentials linked me to developer.mozilla.org/en-US/docs/Web/HTTP/…
user10844537
Thanks @KarelG. But I am making my requests {withCredentials: true}. And cookies are sent, when set. Again, if I just reload the page, the three requests will include the session cookie first received on the original GET...
> Since this is a simple GET request, it is not preflighted, but the browser will reject any response that does not have the Access-Control-Allow-Credentials: true header, and not make the response available to the invoking web content
user10844537
@KarelG The GET is not preflighted, the POST is
true. It is probably a bug from angular
because Access-Control-Allow-Credentials is on true in your pictures
user10844537
The access-control-* headers are set.
15:00
best to ask there
user10844537
Yes, CORS problems are already solved, I do get and send the cookies. It's only between the first GET and the requests happening on the then() that something uncool is going on.
user10844537
Well, I guess it's fine. Another day, another bug.
user10844537
I was mostly afraid that I was presenting a very stupid question. The lack of any kind of activity (comments, close votes, even down-votes) kinda bugged me.
user10844537
Thanks everyone. Hopefully some brave soul will bump into my question and share some extraordinary insight. I'll have to hack an unsightly workaround in the meantime.
If you're searching a two arrays looking for dup's using binary search that would be log n +n =logn
I
15:11
hmm? @Neil ^
I'll start playing the Jeopardy song. All answers should be in the form of a question :p
and left is right and right is yesterday
15:28
@KarelG hmm?
What's up with all the hmms?
just asking for his thoughts because he likes thinking about such things
Assuming both the arrays are sorted of course
@Neil think faster
if you run an algorithm that takes O(log n) time twice, it is still O(log n)
you don't really look at the constant factors (2 in this case)
Ya but one of the two has to run in linear time
15:33
What are you talking about?
Ok, so you run an algorithm that takes O(n) and another that takes O(log n)? They both resolve to O(n)
you grab the larger of the two
If you're checking two arrays for overlapping elements, the best you can do is O(m+n), but if you use a binary search, you're down to O(m log n)
I believe @KendallFrey is correct
it'd be O(m log n) because it's nested, not sequential
for every m, perform a binary search log n
m * log n
Now I'm conflicted, is it m*logn or m+logn
15:39
What makes you think it would be m + log n?
I take that back mlogn sounds solid
Remember, that's suboptimal
You only use a binary search if you wanted to save space. If you used how about if you used a hash table instead
A hash table would be the fastest way
Still, it should only really need O(n) extra space, and by the time that becomes an issue, m log n will also be an issue
Also, a hash table doesn't require sorted data
That's what I thought stupid kid gave Wong answer. I don't even think you save space with binary search
15:48
You don't need any extra space
With hash table you would need to duplicate one of the arrays
If both your arrays are sorted, you can get even better than binary search
(without extra space)
How without extra space
By iterating both arrays in parallel from start to finish, using a mergesort-like comparison
whichever array has the smaller value, step forward to the next larger value
if the values are equal, you found an overlap
You mean merge both arrys and stop at the shortest
15:52
You don't actually merge
you just step forward like you do in a mergesort
What would the time complexity of that be?
linear
m+n
And it would be optimal in both time and space
It's the best I know in time, and it takes constant extra space
I think it's optimal, since checking for dupes requires checking each item at least once, worst case
How about if we used segmented trees
15:58
What would that do?
We could look for overlaps and it would be logn
> A segment tree for a set I of n intervals uses O(n log n) storage and can be built in O(n log n) time.
n log n > log n
Let's say we don't care about space, and the savings in time was more important if we needed to run this a million times over
For the same arrays?
Let's say only one arry stays the same
16:03
In that case, a hash table beats a segment tree on all measures
O(n) vs O(n log n) space, O(n) vs O(n log n) creation time, and O(1) vs O(log n) lookup time
Good point, dammit
posted on January 16, 2019 by CommitStrip

How about if we needed to find the median of an array between intervals
Then a segmented tree would make sense
The what?
Of course segment trees make sense for applications where they make sense.
But the first problem is unrelated
I just want to talk about segmented trees. I don't care about the first problem anymore. I hate how well you know this stuff kindal it hurts my ego
16:10
I hadn't even heard of a segment tree 15 minutes ago
segmented tree = ... ?
Shut up, you stupid liar. We all know your parents read u physics books for bedtime stories as a child
3
segment trees have nothing to do with physics
wow, I'm tempted to screenshot that response lol
16:24
@Rick I know that it is for Kendall, but even then, physics is awesome. Especially when working with the universe. The powers man.
I'm sure this kind of question has been asked before... anyone know a good dupe? stackoverflow.com/questions/54221202/…
I forgot to mention $slideIndex was in the error. Declaring that fixed the issue, which makes sense. It is an arrow function because i needed a way to scope the contents when being pasted in with other components that use similar mechanics/variables. I understand not using strict in both is bad, but I didnt really have a use case until now lol. The docs mention something about Es6 modules being strict by default so why would this block not be in strict already? Half the javascript community seems to have thrown out semicolons and I think it looks cleaner soooo i did too. Any comments on that? — Kevin Grant 19 hours ago
As asked... i wouldn't dupe close that question @TylerH
If it was more specific, like, how can i allow the user to alter the site theme... maybe, if a good one exists
I was thinking about that
as written it's an X/Y problem.
@KevinB that's not Welcoming
16:31
that was the intent
> where are all the semi-colons?
<3
16:45
@rlemon hanging out with all the ass-pennies?
something something ass burgers
Cow rounds do make good burgers typically
16:55
lame
17:32
I have a value 'Jan 2018' stored in an object (chart.categories()[d.index]). When I do Date.parse('01 ' + chart.categories()[d.index]), I get an NaN. I also get an NaN when I concatenate '01 ' + chart.categories()[d.index] into a single variable and run Date.parse() on it. But when I type Date.parse('01 Jan 2018') into the Watch list, I get a numerical value.
17:45
Looks like a problem with chart.categories()[d.index]
Access to es6? String template? If so, try 01 ${chart.categories()[d.index]}
I put that object path into the Watch and it gives me 'Jan 2018'
I'm checking the values every step of the way
Template literal is what I mean, not String template
user1596138
@Hypersapien Could you toJSON the object for us
user1596138
Just so there's no ambiguity
user1596138
lol toJSON
user1596138
17:53
My guess would be you're concatenating undefined
user1596138
You could log it out to see.
If I do this:
var dateStr = '01 ' + chart.categories()[d.index];
I get this:
"01 ‎Jan 2018"
That's copied directly out of the VS Watch
user1596138
And then you do Date.parse(dateStr) and get NaN?
user1596138
!!> Date.parse("01 Jan 2018")
@Jhawins 1514782800000
17:55
Yes. Date.parse(dateStr) returns NaN
user1596138
Something is amiss.
Yet Date.parse("01 Jan 2018") returns 1514782800000
user1596138
The necessary information to solve it isn't here in the chat, it does work if you are getting the right string :/
user1596138
Probably a typo or something somewhere
user1596138
Scoping issues possible?
17:57
Date.parse is on the very next line after declaring and defining dateStr
user1596138
If you were passing "01 Jan 2018" to Date.parse you would get the numerical value
user1596138
But somehow you aren't. That's all that can be said for sure, at least not where you're looking at the output
00:00 - 18:0018:00 - 00:00

« first day (3014 days earlier)      last day (2159 days later) »