« first day (3597 days earlier)      last day (1573 days later) » 

 
2 hours later…
02:17
sorry i didnt do ur challenge jbis, i learned javascript 2 weeks ago lmao
anybody upgrade their project to ts4? lmk if yall get build errors so i can watch out
Do you guys know if the browser will get slown down if it keeps throwing file not found errors? I'm loading external websites into a div and it throws millions of errors for resources not found that i cna't do nothing about...
in my exp yeah console logging slows the crap out of my browser
just update your URLs bro
@user5014677 why are you getting errors? What sites are you loading into a div?
external that do not belong to me
i' mscrapping it
why
are you proxying stuff?
02:29
Because i'm using it for stuff :)
ok well thats a shitty way of proxying stuff
i'm not proxing stuff
i'm gathing info from a website
ok
thats fine, no reason to render it into a div
i don't render it
i have a variable div i load into it
when ever i access it it triggers the load and tries to load every single resource
resulting in images not found
and polluting my console
im confused
what are you trying to do?
can you show some code please
02:32
@user5014677 Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
$.get( "somewbesite/search?q=one+piece", function( data ) {
let aaaaa= $(data);

let id = $(aaaaa.find(".similardd")[0]).text();
});
ok i don't see an issue with that
Did i edit i see no difference
this will trigger the load
see the issue now? :<
02:34
|| mcve
If you would like assistance, please create a Minimal, Complete, and Verifiable Example
jsfiddle please
again, couldn't this just happen with a 404
try loading some of the links manually in your browser
i don't want these links and i don't care about these links
they are being loaded because of the $.get
the info is there and i get what i need
problem is i have errors in my console i don't care about
rip... i can clear the console ggs
03:14
Hi there!
04:05
04:40
@Jay But what's the point of it. If you want to represent it in ui u can just modify there.
 
4 hours later…
08:34
Hello. I have a javascript code in which I've later added a react component (a sidebar) and now my app runs on localhost:3000.

Now I want to include another react component (a log in screen) that runs on localhost:9000 but I don't even know what to search to help me do this integration.

So the question is, how can I merge two separate react apps that run on different port and also use different package (one uses npm and other yarn)?
hey leute!
        let nodes = [{
            id : "node_0",
            data: nodeData,
            threshold: 0,
            feature: 'Petal_Length',
            children: ['node_01', 'node_02']
        },{
            id : "node_01",
            data: nodeData,
            threshold: 0,
            feature: 'Petal_Length',
            children: ['node_011', 'node_012']
        }
        ]
I am very lost. (more than jack shephard in lost)
I try to build a tree structure
how can I iterate over this structure?
hm ok I'll try myself first.
sh*t its not easy at all
09:30
hi guys
I have a llittle but annoying question,
How am i suppsed to use hooks in stackverflow interactive examples

useState // reference Error
React.useState // reference Error
how will i use it ??
??
10:22
@Suisse you can just use .forEach or a normal loop. Depends on what you're after. If you want to traverse the tree then you might need a different solution but I'm not sure.
js is so much better than py
@aDeveloper 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.
@aXuser264 See if this example helps
@aXuser264 Oh, also I somehow overlooked How do I create a React Stack Snippet with JSX support? which seems a lot more helpful. I hope that between the two of those you can find what you need. I personally don't know.
Jay
Jay
10:42
@Ankit I'm starting to wonder the same thing. momentjs promises locale aware date formatting and that's what I'm after, I want the dates to look nice for everyone no matter where they're from but so far it's just not working
is anyone familiar with formatting dates with momentjs?
0
Q: Formatting a Date with momentjs in an ejs file

JayI'm making a simple blog app for practice and I'm using momentjs for the first time. I'm trying to use moment() to timestamp each new database entry and then display that timestamp on an ejs page. I have all my packages installed and required and have the appropriate app.use() defined for each as...

11:18
@VLAZ I want to traverse - there are already solutions for this thx : )
But I don't know how to create such a Tree in a loop
Node1
    --node11
         ---node111
         ---node112
    --node12
        ---node121
        ---node122
each "node" creates 2 new child nodes - i should do it recursive
but how does the current node know where it belongs hmm
@Suisse can you explain? Do you mean you have this data you showed above, and you want to create a tree structure?
no ... actually I am trying to create this structure
Usually, you can do recursion or loop but in both cases you can just make sure the children are created after the parent node.
        let nodes = [{
            id : "node_0",
            data: nodeData,
            threshold: 0,
            feature: 'Petal_Length',
            children: ['node_01', 'node_02']
        },{
            id : "node_01",
            data: nodeData,
            threshold: 0,
            feature: 'Petal_Length',
            children: ['node_011', 'node_012']
        }
        ]
OK, so what do you want to create from this? Another object or something more specific?
11:22
*it is simplified.. the childrens should also be objects
oook I am trying to implement Random Decision Forest algorithm in javascript. Thats the main goal. but now:
I have data (just an array of numbers)
I wrote a split(data,parent) function
so: for the first node, the root node I call:

split(data, null);
the split function (lets simplify it) just splits the data into 2 new arrays

data_left, data_right

and now since parent was null, it knows that these are the first nodes.


now for those data_left, data_right I call again split(data_left, 'root'); split(data_right,'root');
now each of the split() calls, creates again 2 new data arrays, and NOW they should know who their parents are => Here I stuck
Why is while and await looked down upon?
@Suisse If you're doing this recursively, I'd just add the parent element as an optional parameter to split so, you'd do something like split(newArray, label, parentElement) and then you can use the parent after the recursive call.
You can do a similar thing with a loop and keep the parent and child together.
But I'm not really familiar with random decision forests, so I'm not sure what the algorithm is doing and how best to do it.
@VLAZ the algorithm is not important for this problem
 split(newArray, label, parentElement)
I will try that
thx
@ShrekOverflow Most of the time, you are working with a known number of things to await, hence we have for await of. It's quite rare that we need while await and even then we don't need a separate construct to handle it while(condition) condition = await doSomething(); should be fine.
Should be mentioned that for await of does handle indeterminate number of promises as well, if you have something like an async generator function.
12:21
stackoverflow.com/questions/63178405/… new bounty if you can help please take a look
12:59
https://repl.it/@skylerspark/Another-Monocircular-Tapemeasure#script.js

Im getting a strange error
saying that tapeType is undefined
but Ive defined it inside the class
Ive tried linting it
its just giving me ES6 warnings
nothing useful
13:34
ok I gave up
let data = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20];
13:50
$(document).ready(function () {
            $('#delivTab').DataTable({
                "ajax":"data.json",
for the AJAX, why is the url a file? I keep seeing this and I am trying to pull from multiple URLS, not a file
In that example, the data for the DataTable is in a file called data.json. If you want to pull from a URL, you should supply that URL
Is there a way to call multiple URLS in the same AJAX call?
would something like this work? and then call the variable
var urls = ["url1","url2","url3"];
Not for DataTables, that I know of. Why not get all the data and then create a DataTable with whatever data you have?
Because I am pulling from three different subsites and displaying in a table on a single landing page
I was able to call multiple urls to append to an HTML table, but the HTML Table is so buggy and ugly that is why I want to switch to DataTables
0
Q: How to create a tree structure in javascript

SuisseI have an array of data: let data = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]; I want to map it into a tree structure: let tree = { name: "node_0", data : [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20], children: [ ...

*should I post my tryings? It is sooo messed up :S
13:57
So take all the data you used for the HTML table, and create the DataTable with data: myData.
sooo angry that I am not able to solve this simple problem
what a dumb kid.
Suisse how do you think I feel
I can't even hide the pain anymore
1
Q: Convert HTML Table to DataTable

zgoforthFor a work project I have created an HTML table that pulls information from different SharePoint subsites and populates it to one table on a certain landing page. I took a few looks at the DataTables AJAX manual, but don't quite understand it? It seems as if the AJAX is writing to a file wear as ...

Cameron, check that out that is my HTML Table
@zgoforth What's your data look like? Does something like this work for you? live.datatables.net/gowekane/1/edit
14:00
@zgoforth just make 3 different calls.. there is no possiblity of combining the http calls - if you can change the backend and supply all the data you want into one endpoint - then you require only 1 call - and can split the data in frontend
 .then((data) => data.d.results) // unwrap to get results array
        .then((results) => {
            results.forEach((r) => (r.source = source)); // add source to each item
            return results;
        });
would I use data or results
results correct.
Assuming results is an array of objects, yes.
And that link look sharp, it is just that all of that data is written to an array (static)
Right, in your question where you loop through sortedObj is the same thing, pretty much.
@KevinB did you ever end up buying a new truck?
14:04
no
and now there's rattling on every bump because the sway bar ends are shot
That'd drive me nuts, my moonroof was rattling over bumps for a while, had to keep it covered all the time to keep it quiet
Thinking of waiting for the 2021 F150, or just waiting in general?
just lazy
FORD
Found On Road Dead
Fix or Repair Daily
I'd think even now would still be a good time to shop around, if the dealerships aren't running at full capacity yet - easier to email several and not waste time driving around
i still want a ranger, but none of the dealerships here actually keep much of a selection, so i'd be calling/ordering online anyway
though, i'd be happy with a F150 v6 XLT if i could get one at a decent price
14:11
Could definitely get a 2020 for a good price when the new ones come out, I'd think. 2.7/3.5 or the NA v6?
havn't looked that deeply at it yet, but the V6 turbo
i've driven both the v8 and the v6 turbo, and from what i'm hearing the v6 is generally better
Just don't want to end up with what i have now, an underpowered engine for the truck size
I'd lean towards the 3.5, most sales managers told me to stay away from the 2.7.
Funnily enough, the only dealership that suggested the 2.7 had that in about 80% of their trucks and offered an unbelievable deal on them, didn't really add up
Right now i have a 4.0 V6 from 08
the 2020 rangers have better get up and go
Yeah, that seems not fun
No complaints with my 5.0, but only towed max ~3,500 lbs so far. Driving up to go camping (with no trailer) gets me 20.5 mpg as well
From what i was seeing, the rangers even have better towing than my sport trac
which i guess is expected, it's been 10 years, hopefully they've made improvements since then
:p
oh, 12 years
time flies
14:18
I'd sure hope so, the rangers are probably closer to my 05 F150 in towing capacity
14:53
Get a super duty
yeah, no
Bringing back the 7.3 best engine ever made
Whats the difference between a Promise and AJAX is there one?
well
they're two different things entirely
They both are asynchronous with similar functionality it seems though
The only thing they have in common is they’re both JavaScript concepts
14:59
So my DataTable may not work because I used Promise instead of AJAX?
That doesn’t make any sense
How?
You don’t use promises instead of ajax
guys
I did.
15:01
0
A: How to create a tree structure in javascript

Yevgen GorbunkovYou may expand your input array recursively, like that: const src = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20], getTree = (inputData, parent=null, idx=0) => { const name = (!parent ? 'node_0' : parent+(idx+1)), halfLength = inputData.length/2, ...

And it worked
this answer.. wow
I’m fairly certain you used both.
I need to understand this.. who write code like that? why does it need to be so complex?
The promise would be literally useless without the ajax
15:03
 branch = {
                name,
                data: inputData,
                ...(halfLength>4 &&
                    {children: Array(2)
                      .fill()
                      .map((_,i) =>
                        getTree(
                          inputData.slice(i*halfLength, (i+1)*halfLength),
                          name,
                          i
                        ))}),
                ...(parent && {parent})
              }
what happens here with ... ?
What are you calling a tree?
Is a nested object or array not a tree?
Or nested ordered or unordered lists? Or nested dom elements in general?
oo
ehm
yes no ehm ye.
what?
what is the different? I mean there is no such a thing like "tree" anyways in javascript
it is just an array with multiple objects with arrays with multiple objects
right
so what's so complex about that code?
but what is he doing there with the spread operator?
wait what?
the spread operator is documented
15:07
in the beginning of ...(halfLength>4)
and then ...(parent && {parent})
hmm so you really think it should be possible for me to understand this?
The return of everything within () is spread
I don't really get it yet
I will try for several hours.. I don't give up.. but ...
...(true && bar) will spread bar
hm ok
aha
because true was true
15:08
ahaa
...(parent && {parent})
it's a pretty awful way of coding imo
this means if parent exist, spread it?
but it's not really that complex
hm for me it is at the moment IMPOSSIBLE to understand what is happening there.. also because of the recursive thing
(parent && {parent}) will spread {parent:parent} if parent is truethy
it's just a shortcut
I would consider that entire answer "clever" code that i wouldn't ever use
shortcuts on top of shortcuts, ternaries, nope. i'll take code without all that even if it's 10x longer
15:20
Why wont my datatable work on JSFiddle but it works on live.datatables.net
""Script error."
"<a class='gotoLine' href='#70:1'>70:1</a> Uncaught ReferenceError: $ is not defined""
$ is not defined
fix it
Nvm it was because I was running under the JS file I wasnt using a framework had to add jQuery
jsfiddle.net/#&togetherjs=PEiCcONODK what can I do to call into the data array if it already exists Im so damn confused still boys my brain feels fried
GET before the function initialization? posting results or data.d.results as my variable data?
can someone help me with my issue please. i have a dropdown with checkboxes and im having trouble with the logic if a checkbox is checked it opens a bottom dropbox for example the first dropbox the user selects a vehicle make and the second dropbox has the models for the vehicle make.
the issue is that when i check 2 different makes the button dropdown doesnt show only when i check one
im using angularjs
15:42
@VLAZ I mean while (true) await somethingLong();
AirBNB guide suggested that's wrong
Shrek
get out me swamp
@ShrekOverflow What is the use of that code? It's going to be infinitely launching tasks but that should be quite a rare thing to need if at all.
can someone help with my issue please
LuDev post some code
15:57
@VLAZ read from redis (stream)
its calling redis.xreadgroup
Basically the only correct way to do that is to use await there
Someone pls take a look jsfiddle.net/L0287qeu
@LuDevGon Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
And if this will work jsfiddle.net/xfo3bu4k
@LuDevGon Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
1 message moved to Trash can
||suicide
16:00
@zgoforth You are not authorized to administer this command
1 message moved to Trash can
<label>makes:</label>
<md-select ng-model="vm.filter.make" multiple>
<md-option value="{{lineKey}}" ng-repeat="(lineKey, make) in vm.cars">{{lineKey}}</md-option>
</md-select>
<label>models:</label>
<md-select ng-model="vm.filter.models" ng-show="key == vm.filter.make" ng-repeat="(key, value) in vm.cars" multiple>
<md-option value="{{modelsid}}" ng-repeat="(modelsid, models) in value.models">{{modelsid}}</md-option>
</md-select>
<md-button ng-click="vm.saveView">SAVE</md-button>
@zgoforth wat?
what
Im trying to get this datatable to work with ajax request not static data idk what to do
@JBis great one.
16:04
it wasn't a joke
put enough product in your hair
what?
1. Stop looking at my profile pic
2. There was no hair product
Mans said "http://jeffhendricks.net/wp-content/uploads/2015/01/Megamind.jpg"
16:08
@zgoforth do you need help or you just gonna continue shitposting?
You are the only one that chooses not to help and instead calls me a "vampire" when I have a actual problem I can't solve.
ok, i didn't call you a vamp but ok
Aug 7 at 16:14, by LetTheWritersWrite
@zgoforth dude you're a help vampire.
?
that's not jbi
but i do agree with it
16:11
> Aug 7 at 16:14, by LetTheWritersWrite
it's why i stopped helping you.
Good for you.
we're all volunteers here
@zgoforth heres an idea, instead of complaining about not being helped. Look at the doc I sent you and reask your question properly.
if you're going to make it annoying to interact with you, we're not going to, lol
Today alone you've insulted both of us on two separate occations for no reason that i could see
not even programming related
why
16:15
And how did I insult you?
You took offense to a Ford joke...
Oh. my. god.
and there you go again
lol
@zgoforth What's you goal? Why are you here?
Im sorry you were talking about trucks with Cameron, I figured people with trucks enjoy friendly Chevy/Ford Banter. Not take it to heart...
16:19
If it's to get help, follow the doc I directed you too. If it's not, and you are just going to make fun of people/annoy people, we will ban you from the room. This is your final warning.
In other news, I've started to learn C++. Trying to get into it. Not easy coming from JS.
16:33
<label>makes:</label>
<md-select ng-model="vm.filter.make" multiple>
<md-option value="{{lineKey}}" ng-repeat="(lineKey, make) in vm.cars">{{lineKey}}</md-option>
</md-select>
<label>models:</label>
<md-select ng-model="vm.filter.models" ng-show="key == vm.filter.make" ng-repeat="(key, value) in vm.cars" multiple>
<md-option value="{{modelsid}}" ng-repeat="(modelsid, models) in value.models">{{modelsid}}</md-option>
</md-select>
<md-button ng-click="vm.saveView">SAVE</md-button>
 
2 hours later…
18:35
C++ is too dang big
also i keep reading everywhere that switch case is bad code practice but idk what else to use in my situation
basically i handle MouseEvent objects differently based on what key they're pressed
so isn't this fine?
```
switch (event.button)
case 0: {} break
case 1: {} break
case 2: {} break
```
it's fine
i would avoid it just for the sake of not using switch, but that's just my opinion
in your case, i'd just have different functions on an object/array
foo[event.button]()
ive been thinking about ditching the switch statements bc ive already experienced 2 bugs in my dev cycle of 1 week with forgetting the "break" statement at the end of each block
and also my code looks so damn ugly when the body of my code is indented 4 tabs to the right
19:09
does anybody notice a bug where typescript doesn't type-check the this keyword?
whenever I hover over this in the Atom text editor, it shows typescript casting it as any
is this intentional? or am i doing something stupid
it's really hard to google this error bc this is obviously a pretty common english word
@KevinB whats wrong with switch?
you rather have a bunch of if/else?
@hydro this can be type checked
@Jbis do i have to explicitly specify it
again im sorry for asking to be spoonfed but i legit have spent 20 min trying to google it ;__;
19:25
if it can be detected it will be
otherwise you explicitly specify
dang. i see. so tsc ain't perfect i suppose.
class Whatever {
   method(){
         // this will be of type Whatever implicitly
   }

}
im like 90% sure of that
yeah my setup is a bit more complicated
i have this Tool object from the library i'm using and i needed to add some additional properties to it
whats your setup
|| mcve
If you would like assistance, please create a Minimal, Complete, and Verifiable Example
19:27
if you great a gist or something i maybe able to see
basically I have to add some additional properties to share data between the methods of the Tool object. however, I couldn't just create an extension like class BetterTool extends Tool because it would break the visual rendering provided by the library (it's a HTML5 canvas lib)
oh no it's fine i resolved the issue by explicitly specifying
i was just curious what i was doing wrong earlier
basically i had to make betterTool a typescript interface that extended the Tool class, and it seems typescript wouldn't detect the type of this implicitly as betterToolinside of the methods of betterTool
48 mins ago, by Kevin B
it's fine
49 mins ago, by Kevin B
i would avoid it just for the sake of not using switch, but that's just my opinion
i don't like it
:shrug;
19:58
@JBis ok i can't reproduce my weird typechecking issue in the TS playground. thanks for recommending me to try creating a MCVE; i've narrowed the issue down to the following tsconfig option:
noImplicitThis

Raise errors when 'this' would be any
turns out my (default) tsconfig wasn't strict enough to warn me about these errors
figured out the error. if noImplicitThis isn't set to true in tsconfig, then if you assign a value to an undefined property, then typescript quietly casts this as any.
reproducible example: hover over `this` in the last block
typescriptlang.org/play?noImplicitThis=false&ts=4.0.2#code/…
20:48
Hey can I talk to someone about gutenberg blocks on nodejs for Wordpress?
dunno how useful i'll be in such a conversation, but sure why not
Is this safe?
@jdgregson Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
For posting large code blocks, use a paste site like like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
1 message moved to Trash can
    const sanitizeString = (string) => {
      const p = document.createElement('p');
      p.innerText = string;
      return p.innerHTML;
    };

    >> sanitizeString('test')
    << "test"
    >> sanitizeString('test<img src=x onerror=alert(1)>test')
    << "test&lt;img src=x onerror=alert(1)&gt;test"
Or is there a better/safer way to do it in the browser without libraries?
21:09
@KevinB thanks
It was unsafe, I should have taken the innerText back out too, not the innerHTML:
>> sanitizeString(sanitizeString.toString())
<< "(string) =&gt; {<br> const p = document.createElement('p');<br> p.innerText = string;<br> return p.innerHTML;<br> }"
21:30
@VishalSholkay Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
For posting large code blocks, use a paste site like like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
@VishalSholkay 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.
1 message moved to Trash can
I am trying to figure out which version of the below code, the 1st one, or the 2nd one is best practice?
The one where I deleted the app (app.delete()) inside the first then or should I use nested then?

https://gist.github.com/sholkay/05816fc8ce12ca7d2f87c9662a6e8df9.js
22:20
@VishalSholkay look at the link you sent

« first day (3597 days earlier)      last day (1573 days later) »