« first day (3415 days earlier)      last day (1516 days later) » 
01:00 - 22:0023:00 - 00:00

1:03 AM
@FélixGagnon-Grenier No remote, unfortunately. Target hasn't quite gotten there yet. Lots of flexibility to occasionally work from home, when needed, but generally are expected to be in-office, which I don't mind... yet
 
1:21 AM
Hello, I'm a bit curious... aren't both arrow functions and spread operators supposed to be ES6 features? For some reason my typescript file wont compile spread operators, but have no problems with arrow functions... (using babel loader), isn't that weird? or am I missing out something here?
 
 
2 hours later…
3:00 AM
@FelipeOliveira Yes both are es6
 
isn't it weird that babel can handle one of them but cant handle the other?
something as simple as:

export const state = {...initialState};
 
 
3 hours later…
6:11 AM
i have two dropdown one is country another is job role: when country is india i want to see all jobrole in the second dropdown
when country is not india i dont want to see the values which has "-ww" and "-geo" in them
can anyone help
 
@JayantKaushik 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.
 
6:33 AM
@JayantKaushik You can probably remove the "options" and store them in an array
 
@CaptainHere i am getting values from the DB..
 
try this SO
https://stackoverflow.com/questions/4398966/how-can-i-hide-select-options-with-javascript-cross-browser
 
it is not something i am looking for
i am looking for combination of dropdown... with this functionality
when country id = 1, i want to show all the dropdown values
when country id not equal to one I want to hide drop down value which has " - ww" and "- geo" in them
there are two dropdown one has country another has role... like application developer
 
7:25 AM
@CaptainHere do you need more info from my end ?
 
8:12 AM
@JayantKaushik if you are retrieving the values from the db, send another request if the dropdown gets changed again and ensure that the server is giving appropriate options
 
8:24 AM
@KarelG can you help me solve it.. will be much appericiated
 
9:05 AM
Hi By seeing this tutorial link vuemastery.com/courses/vue-3-essentials/… I am trying to print that capcity:3 in the web page using vue.js
I am getting error as:
[Vue warn]: Property or method "capacity" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.

found in

---> <App> at src/App.vue
<Root>
Please help me anyone
 
Do what it says, maybe?
Literally couldn't be more descriptive
 
What are you saying I didnt understand @BenFortune
 
That's not my problem
 
Please say clearly If you dont mind @BenFortune
 
> Property or method "capacity" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: vuejs.org/v2/guide/… .
have you tried that?
 
9:09 AM
Yes I read it but I didnt get it as I am very beginner to vue js
 
9:34 AM
it is explained in that guide, no?
@JayantKaushik it is just solving a problem? I told you how you can solve it, but without details. Seems simple filter checks at either query or when building up the list ...
please don't expect from me to write code for you. I am employed already
 
9:46 AM
Hey @BenjaminGruenbaum, how are you doing? So, you're a promises guru. I would love to know your answer to the following question about promises. stackoverflow.com/questions/60334819/…
-1
Q: Is there a better way to catch errors in asynchronous code within promises?

Aadit M ShahConsider the following code. const fact = n => n > 0 ? n * fact(n - 1) : 1; const foo = x => new Promise((res, rej) => { // promise is rejected if an error is thrown within the executor function if (typeof x !== "number") throw new Error("foo expected a number"); setTimeo...

 
@AaditMShah is the "quality standard" not subjective?
😀
 
Sure, but I have written enough questions and answers on stackoverflow to understand what constitutes a good question.
Here, I've described a problem, provided a minimal, complete, and verifiable example, shown my attempted solution to the problem and described why I'm not satisfied with it, and asked an objective question at the end.
I believe that that's what constitutes a good objective question.
Perhaps my question could be worded better. I feel like I'm not conveying my problem properly. So, when people read the question they feel like they're trying to solve a code review problem as all they see is a wall of code.
 
10:03 AM
ah a human is a weird being.
fyi new Promise should be rarely used
 
Sure, but some times you need to use it.
 
@AaditMShah we debated doing this when bluebird was very young, with domains
but - the whole point of promises as a dsl was throw safety and cleaner code so we decided not to
new Promise should not be used almost ever like Karel said :]
You should util.promisify setTimeout instead
 
10:19 AM
Got it. So, the best practice is to not write promise executor functions at all.
 
10:34 AM
@BenjaminGruenbaum that's only usable in Node.js tho
 
@AaditMShah and when you do - to write the shortest ones possible
 
AFAIK there is no promise wrappers for js
 
Mostly because executors can steal your exceptions if you both reject and throw
 
why dump promises into javascript and then decide to introduce async await shortly thereafter?
promises clearly fixed a major issue, but I have to think they didn't really take everything into consideration
 
10:58 AM
@BenjaminGruenbaum I kind of think of promises as the IO monad of JavaScript. You can't create new kinds of IO actions in Haskell. Similarly, it makes sense that you shouldn't create new kinds of promises directly either.
 
Sure you can create new kinds of IO actions in haskell?
 
I mean that the IO constructor is not available.
You can compose IO actions together to create new IO actions, but you can't create new kinds of IO actions.
The "vocabulary" of all the kinds of IO actions is fixed.
Does that make sense?
 
yes, though something something "escape hatch" something something unsafePerformIO, something something ffi, something something
thinking more about it - no - it doesn't. The only reason you need the promise constructor in JavaScript is to convert between other non-promise APIs and promises. In Haskell all the I/O is done with IO so it's just not needed.
 
unsafePerformIO is not an introduction rule. It's an elimination rule. FFI on the other hand could probably be used to create new kinds of IO actions.
 
That is - having it wouldn't add anything
@AaditMShah yes, but when I thought about it - the reason ffi can make new types of IO actions and only it is because unlike JS and C# everything already is IO
The only other thing people use it for is combinators and they never do it correctly anyway :D
 
11:06 AM
You know what I would like even more than promises and the async/await syntax? I would like it if the notion of promises was built into the fabric of the language.
 
well it is, isn't it?
a promise is anything that has a "then" function
in theory you could just pass an object with a property "then" assigned to a function
 
/* sync example */

const source = fs.readFile("example.txt"); // not readFileSync, no await

/* async example */

const getSource = fork(fs.readFile("example.txt"));
// do something in parallel
const source = getSource(); // fork join semantics
@Neil What I mean by built into the language is that it'll have language level support. New syntax and fork join semantics.
 
I think you can achieve something similar using async / await
syntax is just a little different is all
it's not clumsy like callbacks used to be at least
 
imho, sync and async should have identical source code
 
if everytime I wanted to have one line get run after another, I had to use promises, it would make everything incredibly lanky
 
11:15 AM
it should all look like sync code tho
only case where you need a difference is when you actually want to start two tasks and then await both of them
const aTask = getAAsync()
const bTask = getBAsync()
const a = await aTask
const b = await bTask
 
I had an idea for a language where you could declare a block of code to be run asynchronously simply by assigning it to a local variable
 
just any local variable?
so, val answer = 42 would run asynchronously?
 
yep, the act of assigning the block to a local variable meant it was a handle to the result of an async task
no, it has to be a code block clearly
 
oh, like this
val answer = {
    return 42
}
 
yep, basically
then you'd do answer() to force it to resolve
 
11:18 AM
or just val answer by async { 42 }
 
if it doesn't already have the answer, the current thread waits
 
(not sure if kotlin has that tho... iirc, it does)
 
I know similar concepts exist in other languages
that was just my take on it
 
I think fork/join is a lot cleaner than async/await.
Plus, you don't have to create a new function to use fork/join.
 
wouldnt fork have to take a lambda as argument?
 
11:23 AM
@AaditMShah async await is literally building it into the language
@Wietlol never write code like that if there is a chance getAAsync can fail
 
@AaditMShah js isn't a multi-thread application
 
I think it is better to move it from the language to a library tho
 
you know that I think
 
@BenjaminGruenbaum why not?
 
@KarelG ya don't say
 
11:24 AM
people is still saying that it is multi-threaded because of what you could "send in the background" (well let's ignore the background workers atm)
eg by ajax
but that's ... not true
Node.js is kinda unique in that
 
is wasm also single threaded?
isnt node also single threaded?
 
it combines both multi-thread and event driven paradigms
there you cna use fork and join
but promises aren't on a second thread
at least in js
 
@Wietlol because if it rejects and then the other promise rejects you get an unhandled rejection
 
and why is that bad?
 
@KarelG You don't need multithreading in order to use fork join semantics.
@BenjaminGruenbaum Yes, async/await is built into the language. However, I'm just saying that it's not as clean as fork/join.
 
11:30 AM
I'd argue it's cleaner because it means that a debugger stops after the async action has completed in "step over"
fork/join would make debugging (and reasoning) harder
 
you'd still have to pass a lambda to fork
or a promise
 
@AaditMShah eh
if a dev sees something.fork
is he not expecting "oh a new thread"?
if you mess up with the semantics, then I would quote tom hanks in Apollo 13
 
JavaScript doesn't have threads though. Why would he think that?
JavaScript doesn't have threads though. Why would he think that?
 
8 mins ago, by KarelG
people is still saying that it is multi-threaded because of what you could "send in the background" (well let's ignore the background workers atm)
go follow the js tag. You will see that many js devs are lacking the basics. So yeah
 
the engine uses threading, but it does so in a manner that would make the results the same as if it ran everything using one thread
don't ask me how it can determine that. maybe it considers the effect it has on global variables
 
11:39 AM
So, a fork function would have the type Promise a -> Promise (Promise a).
 
12:11 PM
@KarelG I would expect that something is tableware
 
1:06 PM
Good morning/afternoon/evening
 
@AaditMShah JS does have threads via the Web API workers developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/…
 
A dusting of snow and everything shuts down
Yeesh
 
@Alex where's that?
 
"Yeesh"? It's an informal expression of frustration in English
 
Sorry, the snow
 
1:18 PM
Oh, hah!
Snow is a form of frozen precipitation, made of individual icy flakes
:p
We don't get it often here
But just a bit of it... and it's the zombie apocalypse
Grocery stores are overrun, generators sell out
"Cats and dogs living together, mass hysteria"
 
Doctor: "We need to get this man to a hospital immediately!"
Stewardess: "Why? What is it?"
Doctor: "It's a large building with doctors, but that isn't important right now."
 
"Surely you can't be serious"
"I am serious. And don't call me Shirley"
 
classic :)
 
And here I am hoping for more snow
 
Actually, I love snow/cold rain
 
1:23 PM
Assuming you don't mean freezing rain?
 
Just the weird psychological effect on people affects me
Yeah, freezing rain too
The colder, the better
 
I like it until I have to scrape an inch off my truck's windshield
 
"We gotta get, milk, bread, eggs, meat. Anything else perishable we can buy?"
 
You're from Raleigh, so I understand that mentality
 
2 inches off my windshield this morning
 
1:24 PM
I was raised in South Carolina. As soon as there's snow, everyone rushes to the store and buys milk like it's the end of days
 
Yep, it's mass hysteria
 
They have fights in stores for bottled water when hurricanes come
People climb over each other to get some
All sense of humanity goes by the wayside
 
How else can you reach the top shelf?
 
True
 
1:27 PM
the funny thing is, there's probably enough water for everyone
there's always a shortage because of some who buy way more than they need
 
It would be fun to dress up as zombies and shamble into a store during these events
"Braiaaaans..."
Have someone take a picture and post to FB/twitter
[Breaking News] Zombies spotted in stores. National Guard called in. [Breaking News]
 
there was that guy missing legs that dressed up like a zombie and would like slide over to people in stores and basically scare the hell out of them
 
"Decision made to nuke city based on that photo."
 
spoilers: he succeeded
 
Wow, that's genius
 
1:33 PM
@Alex fastest way to get shot in a crisis lol
 
@SterlingArcher I would be surprised if he does not know about that :P
(but it could be that we were having a conversation in the context to ignore that :P )
 
@SterlingArcher First thing I thought, too. But hey, you'd have a great laugh anyway :)
 
2 hours ago, by KarelG
people is still saying that it is multi-threaded because of what you could "send in the background" (well let's ignore the background workers atm)
 
@Cameron For some reason, I read that as "what" not "where". Maybe my brain just wanted to have a few laughs
As Neil said, it's Raleigh, NC, U.S.A.
 
No worries, I've seen snow before up here in Ottawa, but still enjoyed the description
 
1:37 PM
That's snow central
 
Eh, the Maritimes are more snow central
 
Snow in Raleigh?
 
lol
 
@SterlingArcher That's Glenwood Ave., I think
From not that many years ago
 
I can only imagine the people on the other side be like "oh no, this is the third time already today, they better stop when I am going home"
 
1:42 PM
I just like how one car managed to catch on fire lol
 
Like something out of a bad movie
"I'm on my way. Get the kids and lock yourself in the basement. Do as I say. And.... don't open the door... for anyone"
The Blizzard
Michael Bay will direct
 
It's like a bad sequel to a worse movie like the Mist
 
A derivative of a bad derivative. But it'll only cost $180 mil to make
 
mist
🤔
are you sure Sterling?
just checked its rating
 
I thought it was decent
 
1:51 PM
idk
never have seen that movie. But that rating does not tell me that it's a "worse" movie
maybe Sterling has high standards
😀
 
2:16 PM
!active
 
@noob1k 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.
 
@KarelG it was a really crappy movie for me. It has decent reviews because Steven King's name is attached to it
 
that could influence it yes
there's another movie adaption from King's books: the dark tower
 
I liked the Mist
 
it was kinda mediocre. Idris could not even save the movie with his decent acting
 
2:22 PM
a lot of people didn't, mostly because of the ending
but I thought it was done well
maybe my expectations weren't high to begin with
 
are you talking about the mist or dark tower movie?
 
The Mist
the dark tower adaptation was a freakin' slaughter
it was way different than the books
 
The Dead Zone was one of his best adaptations
 
@Neil their mistake is probably trying to fit 7 books in a movie of 2 hours
a tv show like GoT would be more appropriate
max 5 seasons
 
@KarelG I think they meant for it to have a sequel and be similar but not exactly the same
 
2:27 PM
Same w/ Doctor Sleep. Best to have done that as a mini-series on NF
 
I did like the battle scene at the end, despite being not true to the storyline
@Alex that would have made a killing as a mini-series
so long as they didn't try to add filler and stretch out episodes as much as possible
they do that sometimes too
 
How does someone pitch an idea to a juggernaut like NF?
 
2:54 PM
Apparently it's really easy
 
Stand next to the Hollywood sign and yell really loudly?
 
there are microphones in the letters
 
The "Y" is a slingshot to Disney HQ. After you speak into the microphone, if they like your idea, it launches you directly at their building. Just be careful on sticking that landing. Can be tricky. A lot of folks go head first into the Paramount building instead
 
3:10 PM
but at least Paramount will listen to your ideas
 
Once/if you regain consciousness, yes
 
*if*, indeed
 
4:08 PM
Nice article on JS + TS and their histories: infoworld.com/article/3526447/…
[Requires email to see whole article]
 
scam
 
4:43 PM
After typing the parenthetical, same thought came to me
If it's free, it should be free; no strings attached
 
hi everybody
I'm a self taught javascript developer
 
aren't we all
 
i'm currently doing a project with electron
It's 9 programs/tools in one
they're tools
the first program is kind of gallery, it scrapes google images and shows it. also scrapes instagram accounts and shows them
image os folders too
the second program is an iptv list manager
there are websites that offer free iptv m3u lists with hundreds of channels to watch online
the app scrapes those websites for the lists
parses, detect groups, and shows them
like twitch.tv. it also shows previews of the channels thanks to ffmpeg
i'm currently developing this program
 
why
i mean, i can see how it can be useful to you,
 
the rest are a video downloader like 4k video download, a translator, a photo viewer, etc
for whoever
 
4:55 PM
but... it's not something you can distribute in any way because it's effectively stealing content, is prone to break often because scraping generally is,
 
this is the repo:
https://github.com/mangared/electronApps
but there isn't iptv list managers
neither instagram viewers
this programs are unique
you could join and contribute
i'll show you some captures
 
no thansk
 
Those above are instagram accounts
This is from google images scrapers. it saves the data in a sqlite db
This is the iptv manager
It scrapes from those websites on the top left
 
5:14 PM
jscripter, the friends here will help if you have a question. You don't have to share all these screenshots
 
I have a question
Where can i find javascript developers to colaborate in this project?
 
Spam/promotion isn't well liked on StackExchange
 
it's not spam
 
the chances of finding them in this specific room are low
as far as where else to look... no idea
 
^ that
 
5:16 PM
but again.,.. what are you goals with this project?
 
You want to sell this? Or offer it as a browser extension?
 
just to make useful apps
 
as it is currently, it's obviously breaking some legal boundaries, so... it can't really be sold,
or distributed
 
if it's profitable i can share
 
One of the downloaders you're using, seems to be primarily for porn
Saw it in your code and did a hit from work PC. Big mistake
 
5:18 PM
it's just a little aggregate
 
It's okay. Folks here talk JS technical issues mostly
 
the video downloader is like 4k video downloader
the code is beautiful except for the gallery app
ok i changed it to adult instead
 
5:52 PM
 
6:15 PM
This is the video downloader
 
6:54 PM
Hey, does anyone have an idea what exactly causes a css transition to start when I get a element's clientWidth, for example and then set a style property?
 
@janispritzkau 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.
 
This is the simplest example I could come up with:
document.body.style.transition = "background 1s"
document.body.clientHeight
document.body.style.background = "#000"
It took me quite a while to figure out what was happening. I'm sure this has to do with me triggering some layout code in the browser or something like that
 
7:15 PM
The transition here occurs on the background property when it changes and its duration is 1s
 
Anyone using puppeteer and Angular 7 with karma and Chrome?
 
You're setting background on the 3rd line, so it triggers the transition from the old bg to the new
 
I can get the browser to launch, but it's being a bitch to get it to actually connect to the browser and run the effing tests.
 
If you remove the line with document.body.clientHeight you wont get a transition
The script also has to be run synchronously with the page loading
 
Why does the clientHeight affect the transition if it's set on background?
 
7:28 PM
7
A: Temporarily bypass a CSS transition

jperezovIn order to make this work, you need to flush the CSS changes by reading them in the JS. The answer to this question explain how this works: Can I use javascript to force the browser to "flush" any pending layout changes? Working example below: var element = document.getElementById("theEle...

 
Neo
Can some please help me with this: jsfiddle.net/Lbtnqpkh
 
that's a jsfiddle
 
Neo
I would like to highlight row green it ping passes and orange if it fails
Instead, it is applying it to all rows instead of individually
In JS, I have a for loop, that is returning 'Pass' for even and 'Fail' for odd rows
I would like the table to be orange, green, orange, green, orange
sorry it is the other way around :)
but it is applying the last Pass -> green to all rows
 
i mean
$scope.ping is a single value
it's not per row
 
Neo
I was hoping with each loop, it will apply the $scope.ping to that row only which is i#
 
7:38 PM
yeah, it doesn't
best bet would be to modify the data the table is based on to hold that info
 
Neo
ahh ok .. I was hoping it would come to that
Anyway we can get rowIndex? I can set the color from JS if I have that and change color of that rowindex only
 
i would be the row index, wouldn't it?
or do you mean in the view
 
Neo
In Js so I can do something like
In for loop
 
in the for loop, you already have an index
 
Neo
I mean access the table rowIndex
something like if i == rowIndex
and ping = false
 
7:45 PM
$scope.result[i].ping = false
 
Neo
set that row only to orange
 
i is the index
 
Neo
yes you are right .. I dont need to do i == Index
 
i just injected .result[i] into the if statement actions and then altered the view to look at the new property
 
Neo
nice!!!!
thanks mate :)
 
 
1 hour later…
8:59 PM
89k
 
Neo
hi, does anyone know why something like this would happen:
//$scope.ip - array of 19 IP addresses
for (i = 0; i < 20; i++) {
  $scope.j = 0;
  console.log(i); // shows values from 0 - 19
  console.log($scope.j); // shows values from 0 - 19
  var formVar = $.param({ip_addr: $scope.ip});
  $http({
    url: 'http://' + location.hostname + '/api/ping',
    method: "POST",
    data: formVar,
    headers: {'Content-Type': 'application/x-www-form-urlencoded'}
  }) // If succuessful
  .then(function(response) {
    console.log(i); // shows 19 (the last val of i)
 
ajax is asynchronous
 
Neo
why is i and j (tried $scope for testing)
not incrementing after http
 
When the first http request finishes, the loop has already finished goign through all 20
so j will be 19
 
Neo
oh darn . one problem after another :(
I need to add for loop under .then right
 
9:04 PM
If you instead used a functional loop each iteration would have it's own i
or, you could use let/const for the same end-result
 
Neo
hmm .. I will have to do research on these
never used anything other than for
 
let/const would replace var
not for
 
Neo
for (cont i = 0; const i < 20; const i++)
like this/
const i*
 
in most modern js projects, we use const for everything we can, and where we can't, we use let
no, you use it just like you would var in most cases
also, you can't use const there, because i++
let should be used instead
 
Neo
so loop stays the same and I do below something like
let j = i
console.log(j)
It kinda works but counter is not in sequence
 
9:21 PM
because ajax is asynchronous
you might fire off all of the ajax requests in sequence, but there's no guarentee that they'll all be returned by the server in that order
some may take longer to complete than others
some may take longer to download
If you sent it all in one payload, you'd not only preserve the order, but also likely get a faster result.
but that'd require the server being written to support that
 
Neo
Ok, I did
$scope.result[j].ping = "Pass!";
and it seems to apply it to proper one
all IPs that dont ping vs ping are showing accurate color
not sure how with out of sequence j but it is working
 
9:52 PM
for (const i = {i: 0}; i.i < 20; i.i++)
boom, const in a for loop
 
ew
 
tell me thats not the most beautiful code you have ever seen
 
Reminder Added.
 
01:00 - 22:0023:00 - 00:00

« first day (3415 days earlier)      last day (1516 days later) »