« first day (2957 days earlier)      last day (1998 days later) » 

user4639281
12:44 AM
Wow, the Stack Exchange chat blue is 180 degrees hue rotate from Stack Overflow orange did not realize that.
 
user8729657
I think I'm in love with this headless API for scraping
 
user4639281
1:04 AM
@ovie not sure if it would work for you or not, but there is also nightmare.js
 
user8729657
But does it run in a headless mode?
 
user4639281
var nightmare = Nightmare({ show: true }) //use false for headless testing (e.g. in Docker)
 
user4639281
Not truly headless
 
user8729657
:o
 
user8729657
1:09 AM
I've seen examples of Nightmare js I'm going to keep it in my pocket for any other projects that I have that will need it.
 
user4639281
This is what Magic Overflow currently looks like.
 
hey I know most people have left by now but I'm running into a Promises issue that's making me pull my hair out
 
user4639281
What's the problem?
 
function recurse(): Promise<string> {
  return Promise.resolve('foo')
  	.then(response => {

      if (true) {
      	return $timeout<string>(
      		() => {
      			return recurse();
  			}
  		);
	  }


      return Promise.resolve('bar');
  });
}
example code
this is TS by the way
 
user4639281
Love the indentation
 
user4639281
1:20 AM
this is why spaces > tabs
 
whatever, it's the chat window formatting it
 
user4639281
What's the issue?
 
one sec I'm gonna reformat
function recurse(): Promise <string> {
  return Promise.resolve('foo')
    .then(_ => {

      if (true) {
        return $timeout<string> (
          () => recurse()
        );
      }

      return Promise.resolve('bar');
    });
}
that's a little bit better ig
Okay so the issue is that Typescript won't allow this to compile
because of the return $timeout...
 
user4639281
return Promise.resolve('bar'); should be return 'bar', no?
 
user4639281
Yeah, that too.
 
1:23 AM
@TinyGiant No, it returns a Promise
 
user4639281
Nvm, I see now
 
@TinyGiant that one works either way
it can return a value or a promise<value>
 
Oh wait I misunderstood you
 
the issue is that () => recurse() does not fit $timeout's definition
() => recurse() needs it to be $timeout<Promise<string>>
 
What is $timeout?
 
user4639281
1:25 AM
Could you do:
 
user4639281
return Promise(resolve => $timeout<string> (
  () => resolve(recurse())
));
 
but then when I do that, the then(...) clause stops working, because now timeout is returning Promise<Promise<string>>
@KendallFrey it's an AngularJS thing
@TinyGiant hmm that might work, let me see
nah same issue
the problem is that recurse() returns a Promise<string>, but if it calls itself inside a $timeout then it gets back a Promise<Promise<string>>, which obviously can't be returned
(because the timeout function returns the value of the arrow function inside a promise, and the value of this arrow function is gonna be a promise to begin with)
 
user4639281
Doesn't $timeout return a promise?
 
it does
 
user4639281
can't you await?
 
1:30 AM
$timeout<T>: Promise<T>
await doesn't solve the problem
 
What about return $timeout<Promise<string>>(recurse).then(x => x);?
 
user4639281
return await $timeout<string> (
  () => recurse()
);
 
user4639281
That wouldn't work?
 
@TinyGiant tried it already
@KendallFrey I tried that I think but let me try again, because it looks like it should work
 
I like Tiny's better
what doesn't work about it?
 
1:32 AM
I'll give both another shot
 
user4639281
When you await it, is it a promise or a string?
 
Aside from the fact that the type is still wrong
maybe await await $timeout<Promise<string>>(recurse);
 
user4639281
should be a promise, but you've got $timeout<string> should be $timeout<Promise<string>>
 
hmm we're getting somewhere
 
and by making the whole thing async, you can return 'foo';
 
user4639281
1:33 AM
^ that
 
The real fucky thing is a nested promise, which ideally $timeout would handle
 
yes you're right, it definitely should be able to handle that
 
if it doesn't, await await should
 
It definitely could handle it
no indication that it does
 
1:37 AM
ok
function recurse(): Promise<string> {
  return Promise.resolve('foo')
    .then(async _ => {

      if (true) {
        return await $timeout<Promise<string>> (
          () => recurse()
        );
      }

      return 'bar';
    });
}
^ that works
 
Wait I missed the first .then
What's the point of that?
 
well the Promise.resolve('foo') is a placeholder
 
oh ok
 
it's actually making an http call there
 
I assume the if(true) is too
 
1:39 AM
yeah
it's a polling function
 
I suggest making the .then an await as well
 
if the result is available, pass it up; if not, set a timeout and run the function again
hmmm
 
user4639281
why not async the outer function, then you don't have to return a promise
 
precisely
 
user4639281
and you can await the XHR
 
1:40 AM
because that's just the method contract here
I don't want to refactor too much of this
 
user4639281
async functions return a promise
 
one sec, I'm getting in way over my head here
 
Mixing then and await is pretty pointless
they essentially do the same thing
 
well here's another issue, the reason I was really hoping to avoid using async/await
 
user4639281
async function recurse(): Promise<string> {
  const response = await Promise.resolve('foo')
  if (true) {
    return await $timeout<Promise<string>>(recurse)
  }
  return 'bar';
}
 
1:42 AM
the actual code is using Angular's IPromise, not the typical JS Promise type
and you can't await an IPromise without shimming it into a Promise
 
That seems really dumb
 
yes. it is
 
If angular doesn't provide a shim, it's probably worth making one yourself
 
I'm hesitant, it's not my codebase
 
Then... what are you doing in it? :P
 
1:45 AM
haha ok, I'm contributing to a large codebase and I'm hoping not to break their patterns too much
 
user4639281
oh wait, I forgot an await before await
 
picture it: IPromises everywhere
zero async/await
typescript files but almost nothing is typed
that's where I come in: I'm trying to type these functions
this function works fine as JS, JS doesn't care
 
user4639281
When I look up IPromise I get something about a school for at-risk children
 
that's the one yeah
 
user4639281
lol
 
user4639281
1:47 AM
Just replace all the IPromises with Promises/async-functions
 
user4639281
What could possibly go wrong? You should use regular expressions for that too.
 
user4639281
Some jQuery for good measure
 
user4639281
Yeah, so much cleaner to just async the whole function
 
I hate Kernel Panics
esp, because I know I can fix this one
😞
 
user4639281
1:54 AM
I hate it when the Colonel panics too
 
oh i am not done
 
how are you managing to get a kernel panic?
 
then I realized that the part that is panicking might be in Darwin and not proprietary
@david connect two thunderbolt 3 devices at the same time where one is just a dummy device with nothing on data port (Its an external cooler). It may be the thunderbolt dock or (a device connected on it) that I have but it is killing it every single time
 
ah... macs and dongles
 
@david not dongles just 1 tb3 cable
that connects to about 8 devices
 
1:57 AM
you'd think if that was their new business strategy they would have done a bit more quality control
 
I am not gonna permutate over everything
 
so a hub? i kinda feel like that's a dongle
all i have on my mac is an external monitor and a hub with a keyboard and mouse... and the mac still manages to lose its shit and require a reboot every now and again
 
@david its just as much as a dongle that you'd call a monitor, keyboard, mic, mouse, headphones, ethernet, iPad / iPhone over USB at the same time.
@david lol yeah xD, I got BSODs when running windows against this, so don't think its just a mac thing
 
maybe i have the wrong definition of dongle, because i thought those hubs WERE dongles
the ones that let you plug in more than the ports on the mac would otherwise allow
 
Dongle I think is an adapter
a Hub / Switch is different atleast to me because these are smarter devices
 
2:00 AM
it's still 'adapting' from the thunderbolt spec to usb/whatever your monitor is using
 
It's not adapting
its encoding decoding and splitting and muxing (if i understand it correctly)
Then again, thunderbolt lets you extend PCIE which can run into all sorts of tom-foolery
I like how Gnome from the first version it supported TB3 added a prompt that lets you deny connecting altogether.
That would have saved this issue
 
user4639281
Magic Overflow is getting less and less horrible every day
 
ok you guys I think the async/await thing solved the problem
good work soldiers
 
user4639281
2:16 AM
 
@forresthopkinsa lmao
 
@TinyGiant Nice
 
 
2 hours later…
4:02 AM
Hi
 
user8871181
4:16 AM
I was playing GTA4 when I was browsing through the statistics page. One of the statistics was ‘Average Travel Speed’. From a programming point of view I thought “easy enough I could just create an array and, at regular intervals, push() in the current travel speed - then all I have to do is ‘arrayTotal / array.length’ to determine average speed“
 
user8871181
..that array would get really long, though - and the code isn’t aesthetically pleasing to the eye..
 
user8871181
So my question is, could I instead do...
 
user8871181
    var avg = 0;
    var i = 0;

    // Each time we measure:
    avg = ((avg*i)+myNewValue)/(++i);
 
@demonhunter24 haha....math
 
user8871181
It's the avg*i that I'm questioning most. Wouldn't this make my calculations inaccurate in the long-run? Does this mean I HAVE to use that really long array?
 
4:21 AM
tbh I would ask in the Math chat.
 
user8871181
@JBis oh, that's a thing?
 
i need help with typegoose
 
8
Q: Adding to an average without unknown total sum

Jesse BrandsLet's say I know the following: Let A be the average value Let T be the number of values Assuming that A = 4.3 and T = 5, how would I add another value (let's say 10) and update the average correctly? Is this possible?

@demonhunter24 P.S. If you can't read complicated math notation, you are not alone.
 
user8871181
@JBis oh sweet! Perfect!
 
user8871181
tbh I dont know what he is going on about with '∑' - I'm just glad he proved the calculation.
 
4:24 AM
good luck converting that jumbled math into code!
 
user8871181
I love working with numbers - and I especially love putting them into logical programs :D
 
6:13 AM
@demonhunter24 that's just a sum of the numbers a_1 through a_k
the running total in other words
he's demonstrating that his formula is accurate by setting it equal to the sum of all the numbers plus a new number
 
hi
does safari really doesn't support fcm
or push notification
does anybody has info about this or any link
I found this
 
Hey guys, I would like a live MD renderer to update it's view every time the user inputs text. but i would like it to be markdown input and display the compiled output. so Kinda like MS word but with MD. so I thought what if I use an invisible textarea with a div to display the rendered result
would the textarea's value still change if it's a) invisible and b) not focused?
 
@JacobSchneider that would work
 
if the user sees that the text changes with each press, then they have the illusion that they're typing on the textarea itself
 
6:27 AM
yeah, that's what I'm after
 
you'll just need to assign focus whenever user clicks on the "preview" area
 
Yeah, that's what I'd do
but I also don't want to lose the editing functionality
 
you might consider having a toggle button
so you can actually see the markdown
it's difficult to type markdown if you can't see where it is
 
Oh I've got a different way of showing the MD in real time
reimplementing the cursor could be a pain
 
or you just make it so that when the backspace key is pressed and you're next to a <i>some text in italics</i> markdown
you automatically remove the tags
or you start removing the text inside.. really the behavior depends on you
just so long as it's intuitive to use
 
6:31 AM
I'm going for an MS word like feel
 
MS word would remove the text inside the markdown until there's no more content
 
well, for example, if the user inserts bold text CTRL+B, the textarea automatically recieves 4 asterisks and the cursor is placed in between them
 
but even then, if you type, it shows up in the markdown
 
Yeah, so the program keeps track of the original markdown and the renderer just shows it's output
 
what I meant was, if you're at the end of 4 asterisks and backspace, what happens?
 
6:32 AM
delete them all
 
if the user suddenly goes from seeing bold text to seeing ****some bold text***
it's going to be weird
 
when the user pressed * on the keyboard, what will actually be inserted is \*
 
so sort of like the markup here
though the textbox at the button really is a textarea :P
you write the markup yourself
 
yeah, if the user approaches unescaped markdown character sequences, the whole of it is deleted, should they press backspace or delete
but that would work, right?
 
could you give me an example?
 
6:35 AM
Okay, Thanks for you help, I'll go and try it and I'll report back to you when I have time.
 
see how MS word does it. Not that MS word does it in a simple way, but at least most people are familiar with how it works
and that's always a good thing to make it resemble something they've already seen
 
Yeah, that's why I chose to approach the task in this way
 
you'd have to parse the whole string all over again
after each backspace I think
 
or just after every keypress
 
Because if you're to the right of 4 asterisks and backspace, to know what to do, you have to know if it's the start or end of bold content
yeah
also people can just past content in the middle, so you have to be able to deal with that too
that's the only serious way to do it I think
 
6:40 AM
yeah, I'd just keep track of it by assuming the text is naturally plain, so when four unescaped markdown characters are ahead or behind, a single keystroke would place the character in the right location automatically
so ****| and user pressed a, the program moves the cursor back 2 spaces and then inserts the a
but again, I'll try this and report back.
I have to go now, kinda silly of me to start the convo now, but I'll talk again soon. thanks!
 
good luck :)
I want to see it when you're done
 
I'll show you alright!
Have a good one.
 
\o
 
hey guys, anyone workin on angulary7?
 
7:08 AM
I'm sure someone is
@mehmetakifalp Just not me, and most people aren't online at the moment
 
Wow, I just came across !!! in my codebase at work.
 
!!!
 
They did !! to convert to boolean, then added ! to make it false instead of just ! in the first place. Let alone that it's in typescript
 
hah
 
7:29 AM
There is a reason why there is something called as URL API I rather prefer to see users using this instead of that regex route because this answer is not useful if you have to include other extensions as well (eg .php or .asp). — KarelG 3 mins ago
did my good deed today.
bye
oh boy the OP suddenly changed his question.
 
@KarelG facepalm
 
whelp rollbacked it.
 
7:58 AM
Hello guys. I have a problem about echarts.js
There is a collapsed class in my page. When i press "A" button, this class is shown.
Everything is ok but There is a chart in this class that was built by echarts.js.
When i press to "A" button, class is shown but chart not.
how can i fix this problem ?
i dont know why this chart is not seen.
 
@JohnValdetine is the chart inside a container with this class?
or does this chart have the infamous class which is made visible?
 
check if you can draw the chart without collapsing the container
could be that it does not render
 
<div class="collapse" id="bayiCiroDetayi">
                                                <div class='col-12'>
                                                    <div class='card'>
                                                        <div class="card-body bg-light">
                                                            <h4 class="card-title">Tüm Cirolar</h4>
                                                            <div id="tumCiroChart" style="height: 400px; -webkit-tap-highlight-color: transparent; user-select: none; position: relative;" _echarts_instance_="ec_1535382577195">
I checked it.
This chart is built succesfuly without collapsed class.
 
how do you handle the collapse? making its height 0px or just hiding the div with display: none ?
I think that the canvas got crippled and needs a redraw after re-open
 
mmm wait a sec.
 
8:06 AM
@NathanJones thanks <3
 
.collapse:not(.show) {
  display: none; }

.collapsing {
  position: relative;
  height: 0;
  overflow: hidden;
  transition: height 0.35s ease; }
  @media screen and (prefers-reduced-motion: reduce) {
    .collapsing {
      transition: none; } }
@KarelG yes, i think so. how can i redraw after re-open? what is the jquery code?
var myCiroChart = echarts.init(document.getElementById('tumCiroChart'));
it's my generating echarts code.
i didnt write the others, its not need.
Also, i saw a little thing about this problem.
I pressed the button then collapsed class was opening.
after them, i used zoom function of chrome, surprissee!
echarts was shown.
 
the problem is you don't know how that chart is created
The chart library could determine the available size to make the chart, find that there's no space, and simply not do anything
It'd be worth your while to do a test to try to create the chart in such a way that it is immediately visible on your page
 
8:24 AM
here <a[^href]*+href=(?:'|")melt:\/\/
[^href] - matches any character in between the square brackets
what i would like it to do match anything thats not "href" not any of the characters
how do i go about doing that
 
@AlexanderSolonik hmm, that's what it does
 
@AlexanderSolonik Are you trying to summon Ia Shub Niggurath?
 
the carat symbol at the beginning of the square brackets means to match anything which isn't included in this set
 
Seriously, don't use regex for parsing HTML, I thought we got over that period in our lives.
 
the carat symbol at the beginning of the square brackets means to match anything which isn't included in this set - yes
 
8:33 AM
7 mins ago, by Alexander Solonik
what i would like it to do match anything thats not "href" not any of the characters
So how is this not satisfied?
 
@Neil He wants a negative lookahead. What he needs is a DOM parser.
 
@AlexanderSolonik it would surprise you how many ways an a tag can be written
I have to agree with @MadaraUchiha that this is probably an awful idea
 
But when i say [^href] , it will look for any alphabets that are not in the square brackets to match , what i want it to do is match anything that's not "href" .. so right now its checking for "h" "r" "e" "f" , not "href".
 
ok, so not any characters in href. the actual word href
 
Alright, if you're going to ignore the answers you don't like, I'm just going to disengage now.
 
8:36 AM
<a data="some" href="melt://navigatetoitem/RHEU-1218304-0000_html_0002.html"> - will not match
 
Good luck with your insanity.
 
<a data="som" href="melt://navigatetoitem/RHEU-1218304-0000_html_0002.html"> - will match
yes , the word "href" ..
Well i am working in an environment , where i know exactly what the input will be
 
@AlexanderSolonik That's what they all say.
 
so its not much of a risk
ok :)
 
@Beefo A Promise is an eventual value. Something that's not available now, but will be available in the future. An HTTP response is exactly that, you make a call now, and the response will be available in the future. That's why an HTTP response can be modeled with a Promise.
Also, the modern way to use "AJAX" is by using the fetch() function, which works with Promises out of the box.
The reason traditional AJAX (or XHR) is still in use is because IE is a thing.
 
8:43 AM
@MadaraUchiha heh, indeed. It's probably the only self-explanation I saw when people get questioned why they do that.
 
@KamilSolecki I honestly can't bring myself to care. If people want to shoot themselves in the foot and not listen to me rambling about gun safety, let them open fire.
 
One thing hasn't yet been done.
1324
Q: RegEx match open tags except XHTML self-contained tags

JeffI need to match all of these opening tags: <p> <a href="foo"> But not these: <br /> <hr class="foo" /> I came up with this and wanted to make sure I've got it right. I am only capturing the a-z. <([a-z]+) *[^/]*?> I believe it says: Find a less-than, then Find (and capture) a-z one or ...

Now. I'm done.
 
use regex to get information if you don't mind terribly if it messes up, or if you're guaranteed a certain input
or use regex to at least guarantee that the e-mail address has an @ symbol somewhere in it
But it would be a mistake to try to hope for more than this
 
nah lets fully validate that email
I already have a 3,2TB file with all corporate domains, now noone with non-corporate account will pass through!
 
/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
I gotchu fam
 
8:57 AM
I think the mistake with regexes is twofold. Either it's overly restrictive and you make the mistake of assuming it will match exactly what you need, or it's overly restrictive and you make the assumption that it won't allow invalid input
@MadaraUchiha that's relatively small for an e-mail regex too
 
The dev team is already building a web crawler to find and update my domain file with new ones that pop up, and we even have 2 microservices mirrored onto 7 servers to make sure that it never goes down and our list is always up to date!

In another news, we are going bankrupt.
 
Bankrupt?
 
That's a huge undertaking
 
@KamilSolecki What's the goal?
 
@BenjaminGruenbaum I set a hypothetical satirical scene
@MadaraUchiha to not let users without corporate emails register, of course!
 
9:00 AM
noob
 
oh dear
 
if (!email.isCorporate()) {
  user.dontLetEnter();
}
#ez
 
oh lord
 
holy crap I better escalate it to mr boss
 
using regex through html?
 
9:01 AM
The dream!
 
you should work for google, sir
 
aren't you the boss yourself ?
 
I am, again I was making a satirical scenario
of putting resources in wrong places
 
the sarcasm flew over hy mead
hah those typos... gotcha leave it as it is because it is so funny
 
@KarelG scary, since it could just as well be real, right
 
9:13 AM
 
Ok, I'll use the moment of silence to ask a question
 
user6718998
Hi. Can anybody tell me why passport and res.json won't work here? pastebin.com/MWwh5Ug9
 
Ok I already answered myself
 
9:47 AM
no no no no
My yesterdays work didnt push
 
10:12 AM
Huh.
 
ooh
I didnt get that
I can still reddit
 
10:31 AM
wut, I don't want to repeat trumpie but that seems fake news
 
Maybe it was yesterday? :D
 
maybe it's an AB test?
 
11:05 AM
it would be negative at me!
 
react native app icon is having a black background in ios, but I want a white background. How can I do that?
 
11:40 AM
is it friggin' possible to have contacted all 6 people from the scheduling department and not one will respond in chat for an urgency?
technically one responded that, in fact, the guy I'm trying to contact is here, but isn't responding to chat so I should write him an e-mail (did that 3 hours ago)
 
go to there?
 
11:58 AM
Well, it's a little inconvenient, seeing how their department is roughly 95 kilometers from my position
 
god. Did not see that coming.
 
ah, nevermind, he responded
I was starting to worry
He could have at least confirmed that he read it
 
12:24 PM
the mail or the chat?
 
either
or you know.. the freakin' Jira issue he was supposed to follow
take your pick, really.
 
 
1 hour later…
1:32 PM
hey who had worked with heroku?
since over a year I try to create a custom domain, but its not possible at all
 
I used heroku right up to the point when I realized I had no clue what to do with it
 
Sam
Any of you guys know of good packages for Atom which give me functionality such as code completion and ability to read the documentation of a function maybe?
I've downloaded a plugin to use with React but it sucks
 
I'd search for 'javascript' in plugins
I'd also change editors :P
 
@Sam vscode
The plugin you're looking for is vscode.
 
the truth hath beeneth spokeneth
 
Sam
1:47 PM
vscode is better?
 
imo, dramatically better.
 
Sam
@TravisWhite lol
OK I'll take your word for it and give it a go
 
That is funniest thing I've seen on the internet in a long time
 
@TravisWhite In today's civilized society, we film horizontally. We're not savages.
 
1:49 PM
I agree, I didn't film it though.. Still worth a view
 
and I'm sure she was thinking "How embarrassing is this? Well at least nobody I know will see me now."
 
Sam
In her defence that looks like a pretty high curb
 
2:20 PM
hi, i need help with typegoose someone knows about this
 
!!welcome FedericoFiaSare
Cap dead?
 
yea, probably since yesterday
 
3:03 PM
posted on November 20, 2018 by CommitStrip

 
3:29 PM
Hi everyone, does anyone here uses ui-grid?
I need some help
 

« first day (2957 days earlier)      last day (1998 days later) »