« first day (2939 days earlier)      last day (2232 days later) » 

user8871181
00:38
Out of curiosity, is there a native Javascript function that achieves something similar to this:
user8871181
var boolean = false;
setTimeout(function() { boolean = true }, 5000);

function getStatus() {
  if (isLoaded() === true) { // Some other function to continue with.. }
  else { setTimeout(getStatus, 3000); }
}

function isLoaded() { if (boolean === true) { return true; }}

getStatus();
user8871181
I feel like this sort of function would be useful, however what I've done above seems a bit clunky.
Man do people have a hard time understanding async
Rob
Rob
@demonhunter24 Yes, you're wanting promises
user8871181
@Rick You just put me on another JS path :D
00:42
You should rethink what you are attempting
user8871181
I'm not attempting anything, rn - I was curious
Your function is an attempt to side step something which is built into js for your convenience
Rob
Rob
@demonhunter24 The equivalent with promises would be:
const myPromise = new Promise(resolve => setTimeout(resolve, 5000));

async function getStatus() {
	await myPromise;
	console.log('Doing work...');
}

await getStatus();
Gah, I hate chat code formatting.
user8871181
The problem with being self-taught is that I don't find out about certain JS features until either I want to achieve something specific or if someone mentions something I have not heard of before (like Promises)
You should learn callbacks if you want to understand promises
Rob
Rob
00:51
I'd replace 'promises' with 'async' with that recommendation, because you can use promises entirely with callbacks (the then syntax) :)
Otherwise you're code will be faulty irrespective if you achieve the the desired behavior with promises.
user8871181
When would you use promises?
Rob
Rob
Making a web request, for example
Whenever you need to wait or you are dealing with side effects
01:25
hmm
this thing just survived a crazy fast reentry
"survived"
what is it
it's a probe core with 4 burnt antenna, 4 batteries, and a docking port jr
cool
it used to be stage 2 of a rocket putting 3 relays into orbit
Why even use relays anymore?
use the DSN
01:29
i have teh additional locations disabled, so all coms have to go into KSC
is that your kermit space game
even then, two relays is enough
just unlocked relays that will allow me to send probes to minmus
how far away is that
01:32
big far
ok so not double big far
was kinda surprised how terrible the first tier relays were with this difficulty setting
02:33
!!>[({} === {} ? 'triple true' : 'triple false'), ({} == {} ? 'double true' : 'double false'), ({} = {} ? 'single true' : 'single false')]
@david ["triple false","double false","single true"]
02:58
!!>1
@KevinB 1
 
1 hour later…
04:01
04:30
hi, I made a js module (npm) for scrolling in the page, can anyone share its toughs about it? thanks
i hate smoothscroll :(
@KevinB you hate this npmjs.com/package/smoothscroll ? or just all smoothscrolls ?
all
no offense to your code specifically
@KevinB oh, you mean the feature, or the avaliable implementations?
just in general, i find it jarring to have the page scrolling instead of me
04:45
@KevinB but there are times where you'll want that the page scrolls for you, like when you're answering a questionnarie/formulary, you woudn't want to be switching from mouse to keyboard at every question
tab tab tab
this people do the scroll well typeform.com
and even support the "tab tab"
i understand that adding smooth scroll to the page its not a feature
just as adding css isn't a feature asswell
but it looks nice, and that's the idea
yeah i don't like it
@KevinB that's ok
05:34
 
2 hours later…
07:34
is there any way i could save the value of previous key pressed in keydown event?
@Feeds Still waiting.. how long is it going to take to load? sheesh
07:50
Hello, I have this type of javascript array A and convert it to like B .
A: ["Leg", "Crown", "Box SKU", "Pcs./ Box", "Boxes/ Shipping Carton"]

B: [
{ name: "Leg", type: "text" },
{ name: "Crown", type: "text" },
{ name: "Box SKU", type: "text" },
{ name: "Pcs./ Box", type: "text" },
{ name: "Boxes/ Shipping Carton", type: "text" }
]

Please help me
!!> ["Leg", "Crown", "Box SKU", "Pcs./ Box", "Boxes/ Shipping Carton"].map(i => { return {name: i, type: "text"} });
@Neil "SyntaxError: unexpected token: ':'"
@Neil [{"name":"Leg","type":"text"},{"name":"Crown","type":"text"},{"name":"Box SKU","type":"text"},{"name":"Pcs./ Box","type":"text"},{"name":"Boxes/ Shipping Carton","type":"text"}]
@JigneshVagh
yo
\o
07:55
hey neil!
what's up?
@CapricaSix hey sexy
she doesn't say much
i hear she's a bit cold in the hay
I can't get RDP working for AWS EC2. Such a stupid issue. No idea what i'm doing wrong
Ports are open for RDP
firewall?
antivirus?
07:57
hmm, there's a firewall?
you tell me :P
ha, oh
multiple locations, laptop fw is off
no av
and i've worked for datacenters building 100's of dedicated servers
so hopefully it's not pebcak
lol
wouldn't it also depend on the server firewall as well?
possibly?
shrug
07:59
I'm using marketplace ami's
I'm no expert in this by any means, but the types of problems I get with ports always inevitably return to antivirus and firewalls
yeah...
hmm yeah should probably test network instead of poking around
not pinging on public ip....
@Neil Thanks
i rebooted it.... let's see
at my old job, our systems administrator taught me everything I know about networks, which is quite little compared to most
but still, he often had to correct NATs and reconfigure firewalls
in our case it was particularly complicated as we had VPNs setup with almost all of our clients
08:06
yeah, you're right. i should be going that route
I'm old school hands on, been ignoring cloud for a while but its basically the same as dedicated servers i imagine
I'm about to lose a massive passive income project if I don't get this working :/
maybe I should setup a vpn and see if that works
hmm, but then vpc needs to be checked. so still a network issue
still not pinging. :shrug:
08:54
sup @SterlingArcher
09:16
I wish the .net chat would be so active like js
I wish .net was js
How to navigate user to localhost:3000/username from localhost:3000
This code is not working:
 onSubmitHandler(e){
    e.preventDefault();
    this.props.createUser(this.state)
    {<Redirect to={this.state.username}/>}
    console.log(this.state)
  }
you're obviously not using vanilla js
do you expect people to guess
@taco See the code
@funjoker so the answer is yes. got it.
09:29
It is not navigating why so ? I have imported Redirect from react router don
haha taco
@funjoker try return <Redirect to={this.state.username} />
@funjoker what happens with your actual code? where does it redirect?
return in onSubmitHandler ?
no
what happens now with you code
@funjoker just do this: {this.props.history.push('/'+this.state.username)}
09:35
I have to import history from react router dom ?
yes try it
just try
I have never done react
Yes it works
Thanks :)
09:59
10:14
Hahah :)
How can I use existing mongoose collection with other collection ? Similar to SQL join
you have to be more specific about your question
10:53
7
Q: Mongoose - query to get data from multiple collections

laxmanI want to get query of the mongoose in nodejs application as describe bellow out put. user.js, comment.js and post.js are the model files. user.js var mongoose = require('mongoose'); var Schema = mongoose.Schema; var ObjectId = Schema.ObjectId; var userSchema = new Schema({ n...

Hello anyone somewhat fluent in react?
@taco Any idea how to pass props from child to parent ? I am confused :(
I want to pass username string from child to parent component how can I do that ?
11:12
I have an Array of Objects:
const citi= [{pc: 13000, city: 'Berlin', population: '10million'}, {pc: 81000, city: 'Munich'}];

Then I do the following with the users input:
this.setState({value: event.target.value.toString()});

This returns undefined. If the pc values in the Array are strings, everything works , though
codepen is here
https://codepen.io/damPop/pen/ReXwoo?editors=0010
11:33
Hello I have a piece of code which reads json from text file. How could I execute some code only after reading from file is totally completed?
1 message moved to Trash can
@Žilvinas 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
      reader.onload = (function(theFile) {
        return function(e) {
          vue.graph.fromJSON(JSON.parse(e.target.result));
          resultData = JSON.parse(e.target.result);

          e.target;
        };
      })(event.target.files[0]);
11:46
Before I post some code, could someone tell me how I format it?
I always seem to mess it up.
paste in box at the bottom, but don't press enter until first doing ctrl + k
var myItems = (function() {
    let foodItems = [
        "Pizza",
        "Chicken",
        "Soup",
        "Curry",
    ];

    return {
        foods: foodItems
    }
});

console.log(myItems.foods[0]);
well done, sir :)
Okay, could someone help me, and explain my myItems.foods is undefined?
Haha thanks.
I'm just learning module pattern and not sure why it is undefined.
because you're assigning myItems to a function
You probably meant to execute that function
11:48
Oh wait I forgot the ();
Sorry silly mistake, thanks for pointing that out.
no problemo
I have a pen here , I cannot figure out how to pass the parents state to the child component(react)
https://codepen.io/damPop/pen/ReXwoo?editors=0010
12:11
pass it as a prop
TypeError: $('.videoWrapper')[0].css is not a function. (In '$('.videoWrapper')[0].css("{'top': 10, 'left' : 5}")', '$('.videoWrapper')[0].css' is undefined)
 $('.videoWrapper')[0].css("{'top': 10, 'left' : 5}");
:(
look up what [0] returns from a jQuery object
that error is expected
<div id="test" class="videoWrapper ui-resizable ui-draggable ui-draggable-handle" style="left: 430px; top: 177px;">
</div>
yes, does that look like a jQuery object to you?
I guess not
5
Q: .css() is not a function [jQuery]?

KO12I have the following custom tag/directive : <tile class="ng-scope gridster-item" tilevalue="1" gridster-item="tile" row="0" col = "0" ng-repeat="tile in selectedTiles"> </tile> I've created a keyboard control where the goal is to focus on each tile ("tile" directive) in the selectedTiles array...

But that doesn't work either
Error: Syntax error, unrecognized expression: .
$('.videoWrapper'[0])
12:25
lol
yea don't just randomly hammer code at it
figure out what you want to do, then search for that.. at the most basic level
I'll give you a hint tho. [0] is the same as .get(0)
it returns the underlying element at that index
there is a jQuery object returning method you can use
I can't find on google
:(
11
A: What does $(selector)[0] mean in jQuery?

TusharBy appending [0] to the jQuery object will return the first DOM element. As you're using id selector here, there will be only one element in the array so using [0] makes sense. If you are selecting multiple elements you can also use any number which is between 0 and number of elements you can ge...

yea, stop looking for [0]
the hint I gave you was that [0] is short hand for .get(0)
@rlemon yes. Both return the same....
okay, how about this.. go to google.com -- start typing "jquery get vs" and see what auto completes :P
Ah
12:38
sure, I could just tell you. but now I'm determined to get you to find this on your own
> Retrieve the DOM elements matched by the jQuery object.
sorry, forgot the 'vs'
there is an alternative method to get which gives you back the jQuery object at that index of the collection. not the dom element
$('.videoWrapper').eq(0).css("{'top': 10, 'left' : 5}");
No error but doesn't seem to work
\o/
because you're passing an object as a string
now go look up the jQuery css docs
posted on November 02, 2018 by Michaël Zasso

Notable changes deps Updated ICU to 63.1. #23715 repl Top-level for-await-of is now supported in the REPL. #23841 timers Fixed an issue that could cause timers to enter an infinite loop. #23870 Commits [2c2e2b53ab] - benchmark: fix bench-mkdirp to use recursive option (Klaus Meinhardt) #23699 [787e13b41c] - build: expose more openssl categories for addons (Jonathan Cardoso Machado) #23

12:43
yay it works
thanks
now after all that painful googling, you won't likely make this mistake twice.
lol
Yeah, but I'll probably make a different stupid one XD
it's all a process.
13:37
just found out that laptops with windows 10 have a nice feature where if the battery drains completely, before shutting down, it'll save the current computer state and restore it completely when you power it back up
I mean maybe that seems like an obvious feature, but for someone growing up in the 90s where pressing the power button resulted in immediate switch-off of a computer, this is really nice
MVS
MVS
Hi guys
@MVS 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.
hola
MVS
MVS
Kindly check out the link, I have explained everything in detail there:stackoverflow.com/questions/53115753/…
I would really appreciate your help.
14:26
@MVS you should never be repeating ids, ever
you expect jQuery UI to work properly with duplicate ids? I admire your optimism
he's gone.
Hi, is it possible to improve the performance of this foreach?
@qd0r 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
$(".UnixTs").each(function () {
  var dateUnformatted = new Date(parseInt($(this).attr("date") * 1000));
  var options = { month: "2-digit", day: "2-digit" };
  var formattedDate = dateUnformatted.toLocaleDateString(undefined, options) +" " + date.toLocaleTimeString().replace(/(:\d{2}| [AP]M)$/, "");
    $(this).text(formattedDate);
});
nothing in there is that expensive.
14:32
okay
you could remove jQuery. and idk what date is, but if it's defined outside of that loop you should be doing the replace there
the replace outside of the loop? sorry i dont understand how that can work
date.toLocaleTimeString().replace(/(:\d{2}| [AP]M)$/, "");
date isn't defined in the loop
so running this N times during the loop doesn't change the output
ah soryy. date is dateUnformatted
i changed the code a bit before posting here and forgot to rename it :)
When you spend 5 min figuring out why border-size won't work
14:37
the foreach is taking 700 ms so i thought there is some room for improvements :)
@JBis lel
@qd0r maybe a bit :)
could even be optimized and take 700ms, but usually that's not the case
it would have to be a lot of items
there is literally nothing in that loop that would be a performance suspect, besides the loop itself.
then it is just the sheer number of items
but if you have that many items, memory becomes an issue
yes. it contains ~800-900 items. i will improve the logic to convert less dates on document.ready and trigger the function when the dates are visible for the user
but at first my hope was that the loop itself can be improved too. haha :)
@Neil yes! on mobile phone the page takes 6-8 seconds to load! most of the time is spent on js
14:45
the user rarely ever needs 800-900 anything
if they are doing a search, if anything you show them an indication of pages based on how many you've found, but you don't send them all to the client. You can just load them later
most don't bother clicking on page 2 in my experience
yes you are right. it's my mistake.
I mean I do this too. It's easier to get a working solution by doing it this way. Afterwards you need to consider scale
that's all
15:06
@Neil In fact SharePoint sucks so badly that it will just flat out break if you try to show more than 5,000 items in a single list
It has a built-in error page for that
I don't know why the heck their lists aren't paginated by default
user1596138
lol
you'd think paginating lists would be a pretty basic and easily applicable thing by now
15:19
@taco did you open the port that allows pinging? (in the security group)
iirc, by default you can't ping it, but you should be able to rdp
just make sure you're using the external ip and not the internal ip
user1596138
Fake text is fake
user1596138
Man iOS used to be fugly
was gonna say that's like an iphone 4
user1596138
That's the same theme it had last time I owned an iDevice
user1596138
15:22
WHich was a iPhone 4
sheesh, tough audience
i mean
user1596138
I think I am an adult now. It's payday and I'm just excited to pay off my car
> Jan 1, 2011
user1596138
@KevinB It came from a post in 2014, but the screen shows 2011 haha
user1596138
15:23
URL anyway says 2014
If I define a typescript interface for a component that looks like this:
```
interface OwnProps {
  children: React.ReactElement<(HTMLAnchorElement | HTMLButtonElement)>[];
}
```
why does this not require that the children for this component to be `<a>`s or `<button>`s?
I feel like I'm really close to getting transpiling to work. When I create a new project in VS2015, it puts it in \MyProject\MyProject\... When I install an ES6 library, it gets put in \MyProject\node_modules. In webpack.config.js, I need to reference the ES6 library in node_modules in 'entry', and put the output in the project's Scripts folder. Right? And I transpile from there and I'll have an ES5 version that I call from my own pages?
Is this right?
user1596138
Transpiling should be a 5min thing
user1596138
If you're having trouble nuke your project and grab a working one
If you know what you're doing, sure.
user1596138
15:28
If you know how to copy/paste :P
user1596138
You could always create a projwct on codesandbox.io
user1596138
Then you can show us the actual project and we can help.
I've created about a dozen new test projects to get it to work.
user1596138
I think they have 1 click transpiled projects tho
look for any boilerplate with the tools you use
user1596138
15:30
I'd be happy to look at what you've got but I don't want to jump through hoops.
wait... you're trying to transpile someone else's code to es5?
user1596138
Be aware that transpiling isn't the same as polyfill. Just in case
I barely understand what polyfill means. I only first heard of the term last week.
user1596138
Like String.includes function. If that doesn't exist (IE, etc) you have to polyfill it
15:33
only if you use it
user1596138
Right just if you use it.. Idk it'd be nice to see what you're actually trying
^
if you're trying to transpile something that is in node_modules into a folder in your project so you can then <script src it into your html file...
There's a table module specifically for Vue that I'm trying to use.
user1596138
I know you asked this a few days ago because when I went to find a good resource for you I found the same ones I found a few days ago
that's not quite how this works
15:34
@KevinB Ok, how is it supposed to work?
i mean... it can work that way, but that's out of the ordinary and would explain why you're having so much trouble
That is what I was trying to do.
I only first started trying to do that today.
what library is it
ag-grid
and how do you want to use it
user1596138
15:36
Oct 18 at 20:02, by Hypersapien
Check me on this, there's no way to get ECMA6 to work in IE, right?
user1596138
I was just referring to this convo :P
I have no idea to answer that question. What different ways are there to use it?
importing it into an existing es6 project for example
or just script src like an ordinary jquery website
There is currently no working es6 in this project.
I was thinking I was just going to <script> it.
user1596138
Isn't ag-grid that silly paid grid framework
15:39
My manager suggested it
user1596138
Managers always want to spend money on JS libraries it seems haha
Do you know of a better one?
user1596138
I don't know what you want to do
user1596138
So no
and what browser are you supporting
user1596138
15:40
Yea I know nothing here but that es6 isn't transpiling for you.
user1596138
Not even sure to which browsers :P
Do I need to transpile if I'm not worrying about IE?
user1596138
I would suggest you pick 1 single thing that doesn't work in X browser. Try to get that one specific example to work. Not a whole framework with a Vue specific connector etc
yes
The docs indicate no.
you can literally just scrpt src it in and start using it in "modern browser"
modern browsers support es6, so...
so you're using vue?
I had asked him a few weeks ago if I needed to worry about IE and never got an answer. I just now asked him again and he said no.
Yes
user1596138
You know codesandbox probably has a working Vue ag-grid project on it
did you use the vue cli?
user1596138
Ah it does not. Has plenty of ag-grid projects tho
15:43
which would give you a project with a already setup build process?
I have it installed. I'm not sure how it's actually used, though.
npm install -g @vue/cli
vue create my-project    # accept the defaults for all prompts
cd my-project
npm run serve
Yeah, but I need to incorporate this into an existing project
that's fine
following this process shows you how you can modify your existing project to have a proper build process
user1596138
So just skip vue create my-project
user1596138
15:47
Go right into your-project
skipping create project skips creating the build process that you need to look at...
user1596138
Also a good way to learn is to bite off small chunks. Maybe you should just do the example
user1596138
@KevinB Sort of assumed he did that in his existing project
What does create do? Does it create webpack.config.js, packages.jason or something else?
user1596138
Try it?
15:48
^
i have no idea, i haven't used it
but it does create a project that has a build process
whether that be gulp grunt or webpack
user1596138
> packages.jason
user1596138
packages.@loktar
$750
does that come with lifetime dev support, or just the right to use it
package.json
1 year
lol
15:51
@KevinB I tried that with a new test project and got errors on npm run serve
what kind of errors
sounds like a bargain. they might teach you some js
user1596138
@KevinB Per developer.
npm ERR! missing script: serve
did you cd into the project
15:52
yes
when the performance of a website is bad on mobile, should i focus on reducing the time of "parse HTML" or "javascript execution"? i'm not sure what it's causing it :o
the correct project?
user1596138
@qd0r Use your devtools to find out
... yes
15:52
@LuckyKleinschmidt on a phone?
user1596138
Yep!
user1596138
Use Chrome remote debugging
wow i didnt know that works!!!
amazing, thanks so much :)
user1596138
You can use your desktop devtools but connect them to the mobile device Chrome. The same exists for Safari, but you'll need a Mac and a iDevice
15:53
I don't actually have to worry about IE. Does that make this simpler?
yes
just use the plain js installation.
just link to the cdn
if you aren't using a build process for your curent project
but not using a build process is a mistake
user1596138
I mean they are charging you $750. You could probably just call them and ask for help lmao
user1596138
$750 minimum
15:55
Do any of you know of a good table library that supports grouping and can integrate into Vue?
user1596138
Oh wait it's MIT if you don't want support?
no, i always build my own.
he probably needs the support
user1596138
I build my own. No sense having 3,000 features when I need 12
user1596138
15:57
Seems like any time I use a framework I end up having to make my own fork to add the features I want. Suddenly I have to maintain and update someone else's library with my changes in it.... Shit sucks
just pay LuckyKleinschmidt to set up the whole thing for you. I am sure he will charge you a fair hourly rate.
user1596138
Yeah I want two bottles of Jose Cuervo per hour
if the code gets so much better then? :D
user1596138
Patron if I have to support IE
the silver is 9.99 that is a bargain

« first day (2939 days earlier)      last day (2232 days later) »