« first day (2755 days earlier)      last day (2207 days later) » 

10:00 PM
Intro on TypeScript interface. Hope it helps somebody!!!
 
idarray ["1", "2",... mainarray.filter(x => x.ID == idarray).map(return array)
 
See you all tomorrow
 
filter main array so that only the id's not in 'idarray' are returned
 
eh, yeah, you can do that, but... i don't see what you need the map for
 
me neither im a monkey
 PurchasesDataList = PurchasesDataList.filter(x => x.ID.contains(idList))?
 
10:23 PM
General question, so a 'noop' "npm i" (basically everything is already installed) is taking me like 12s. Is this normal? I was considering adding this to my 'run' task but it adds a lot of time. Yarn seemed to take 1s/2s instead, but haven't used that before. Is it possible that I'm doing something wrong with npm? Should try yarn instead?
 
that doesn't sound normal
 
using npm 5.8 btw
 
takes 1.5s for me in the project i have open now
 
hmm, might be time to dig into the details of this project then
 
what OS?
 
10:25 PM
oh, windows 10
 
wrong room
 
@FredyTreboux Are you using WSL (e.g. Ubuntu for Windows)?
 
@Jhawins its a chrome extension so i would debug via dev tools in chorme .. i found out the zip code is a span class so i need to use this code to find and replace span clas
 
I am not, I might have it enabled, but this is directly on Windows
 
ohh, ok. Nevermind then. I notice npm/yarn are slow when on WSL.
but normally fairly fast on direct windows.
 
10:27 PM
I see, thanks. There's a big difference with yarn, but I guess there shouldn't be
 
yea, yarn is crazy slow on WSL.
 
ugh
how do i tell my statement that i want only 'this' array of things?
objectArray.ID (contains 1-100 id's), but the id's i need are only (1-6), how do i specify 'range' when filtering an object array?
 
@Luggage running create-react-app takes forever
 
array.filter(x => x.ID == "1"), cool i grabbed one , how do i do (x => x.ID == idList)?
 
@DavidKamer you use WSL on windows? I thought you were rabid anti-windows and all about linux?
 
10:30 PM
@Traitor you do realize you're using = right?
 
@Traitor Do you know how to check if a value is in an array?
On top of that, is it a specific range you want? Like 0 < id && id < 100?
 
i cant do 0 < id < 100 because it looks like [1, 3, 5, 6, 8]
and it's contained in a list
 
@Luggage I was referring exclusively to create-react-app and assumed it would be even slower in that situation. npm on Ubuntu is slow enough
 
1 min ago, by Zirak
@Traitor Do you know how to check if a value is in an array?
 
yes
i need a range of values
not '1' value
 
10:32 PM
Filter?
 
He means, "see if a value is in your idList array"
 
statement x = objectArray.filter(x => x.ID <--> idArray (1, 3, 5, 6, 8))
return objectArray with only the id's IN idArray
 
Then you have your value, x.ID, and your array, [1, 3, 5, ...]
 
@Traitor use includes
 
If you know how to check that a value is in an array, your problem is solved
 
10:33 PM
@SterlingArcher yes
 
He wants a range though, don't you?
 
!!> const a = [1,2,3,4,5]; const b = [1,2]; const c = a.filter(x => b.includes(x)); c;
 
'includes'
 
@SterlingArcher [1,2]
 
:3
BINGOOOOOOOO!
 
10:34 PM
Google is your friend, bud stackoverflow.com/questions/34901593/…
"filter array with array"
 
Oi @Zirak some activity is present in discord, do check when you are around ;)
 
I use find inside of a filter for that
Can't say it's the best approach
 
@KamilSolecki I want to go to bed but I haven't eaten
 
ohh, i need to get food. thanks for reminding me.
 
If I go to bed I'll be hungry, if I eat I will no longer be tired. What to do
 
10:36 PM
yes daddy
 
@Zirak poptards my dude
I meant... nevermind
@DavidKamer why use create react app over boilerplate tho
 
why not. so many boilerplates. How do you know which one?
 
You make your own, with blackjack and routers!
 
I like a fresh canvas
 
@SterlingArcher wait that's wrong
 
10:40 PM
You can achieve exactly the same with a boilerplate, + tailored to your own likings
 
PurchasesDataList = PurchasesDataList.filter(x => x.ID.includes(idList));
returns: 'uncaught typeerror: x.ID.includes is not a function'
 
Lol, more because it's usually faster once it finishes and my internet is fairly slow so download is annoying
 
@Traitor Look that over a few times
I'm sure you can figure it out
 
am i forgetting to map?
is my filter still shitty?
 
Nope, just a small typo
 
10:42 PM
I feel like I could set up the boiler plate in the time I search for it and know my code better.
 
read the error message
 
@Traitor You're doing value.includes(array). If it were up to you, where would you declare the includes function? On the value or on the array?
 
I remembered why I used find instead of includes. I needed a call back because it was an array of objects filtered by an array of objects lol
 
const idList = [1, 3, 5, 6, 8];
const idToFind = 5;
console.log(  idToFind.includes(idList)  ); //what you are doing, to break it down
 
idtoFind is an object array
 
10:44 PM
x.ID is? are you sure it's not a number or string?
 
it's a string
xID is a string
 
and how about idList? are those strings?
 
they are numbers/ints
 
well, then that's another problem. let's start with this (one sec):
const idList = ["1", "3", "5", "6", "8"];
const idToFind = "5";
console.log(  idToFind.includes(idList)  ); //what you are doing, to break it down
actually, being a string makes that behave differently..
are you sure x.ID is a string?
 
but id to find is actually ["1", "2",... "100"], idList = ["1", "3", "5"]
we have 2 arrays
i didnt select '1' value, i selected an array to compare another array
 
10:47 PM
weren't you just saying you loved how c# told you when your types are wrong? and you literally just got a 'your type is wrong' error in javascript >_>
 
I know you have two arrays, but I've breaking the problem down to where you have trouble.
 
why does .ID choose 1 value to compare though?
 
That's a good question.
 
MAMMALS ARE A ROUNDING ERROR OH MY GAAAAAAAH 😂😂😂 https://twitter.com/ericmetz/status/991801663353696257
 
Can it know of more values? idList can.
 
user1596138
10:49 PM
Finding out if an array contains values from another array is going to be performant af.
 
user1596138
Refactor if possible lol
 
i want to filter an object array to return it's objects only where the ID matches the id's in another array
 
turns over the mic
 
@Jhawins O(n+m)
 
i usually deal with this shit with a lot of 'for loops'
but i want to get better and use 1 statement using filter/map
so that i stop wasting time playing with for loops
 
10:51 PM
Traitor, have you read the MDN article for Array.prototype.includes or Array.prototype.filter?
 
i know how to use filter to get single values
not an array of values
xID == "3", ez
 
Have. You. Read. The. MDN. Article?
 
x.ID == idArray , i dont know
not yet
 
I'll just tell you what I was trying to get you to see: You are using includes backwards. You want to see if the id is in the list of IDs you have, not the other way around.
 
1 sec
 
10:52 PM
@Jhawins but what about an array of objects and another array of objects lol. Mine won't grow exponentially and it's a client side event that runs in the redux store to avoid duplication.. I honestly can't remember
 
user1596138
@KendallFrey yum
 
i love chorne extensions
 
hmm thinking
 
user1596138
It's one of those areas where you're better off building a lookup table once and using that instead of cotinuing to iterate.
 
user1596138
For either side. Whichever is larger preferably
 
10:55 PM
2 messages moved to Trash can
@FredMcgiff We told you earlier to stop posting the same thing over and over, please stop
 
@Jhawins kinda but tried would up wth more sublime editor tabs open confusion
 
HAMMERTIME!
 
@Luggage  PurchasesDataList = idList.includes(PurchasesDataList.filter(x => x.ID));
 
@copy srry i thought i ask night crew
 
That's not what I meant.
 
10:56 PM
@FredMcgiff You can ask again next week
 
@FredMcgiff I read your pasted thing, and I have no idea what you're trying to do. If you want people to help you then you need to find a way to accurately describe the problem you're having.
 
my thing i dont get is having [] finds everything on page without then does not but if i know the xpath cause its the same on each page could i add this somehow as the match.replace
 
user1596138
@FredMcgiff either you pinged wrong person or I'm.more lost than u
 
I think I'm still the only one using sencha here?
 
@Luggage what if i use reduce?
 
10:59 PM
just look at all the examples and code snippets shows that alot of ways about this and its confusing for me at least stackoverflow.com/questions/5797661/…
 
@Luggage @Traitor Watching your conversation is causing me physical pain
 
Me too.
 
im learning
 
I just realised that, even when I set the singleton: true flag for a datastore, the store might actually have multiple different copies if used by multiple models.
Created implicitly
 
@Traitor it looks to me like you're trying your hardest to avoid having to learn anything
 
11:02 PM
@Jhawins I've been trying to read along what Fred wants, but I'm not sure what he's asking either. He needs to parse an entire page with a chrome extension.
 
please look up filter and includes and have a play with them
it will teach you more than having someone hand you code
 
yea this is a cool little thing could apply often if we get it working in different ways.. it a side load dev chrome extension and find and replaces thing on bage load many great examples for example if you want to copy a page but has bunch of so when you highlight it selects all the data in the table using this method be able to remove everything to highlight quickly links or one col of data
 
Open up the console.
Type in do stuff
 
@Luggage will using 'includes' reach me to the solution? can 'reduce' do it aswell? or both?
 
Usually works
 
user1596138
11:03 PM
@DavidKamer he wants to make Find. Control F. He wants to highlight all the instances of a string on a page. I don't know why he's having such trouble tho
 
@Jhawins maybe he should make a question? I think we need example code.
 
You are filter ing the PurchasesDataList, by what idList includes .
 
Not just small snips
 
reduce() would just replace one or both of those. You can forget about it for this task, in my opinion.
 
user1596138
@DavidKamer he just needs to give up and pay someone since he doesn't know how any of it works and doesn't want to learn.
 
11:06 PM
8
Q: Finding the DOM element with specific text and modify it

rk1sI'm trying to figure out how to, in raw javascript (no jQuery, etc.), find an element with specific text and modify that text. My first incarnation of the solution... is less than adequate. What I did was basically: var x = document.body.innerHTML; x.replace(/regular-expression/,"text"); docum...

 
ok
this is what i want to do
   for (var sam = 0; sam < idList.length; sam++) {
            PurchasesDataList.splice(x => x.ID == idList[sam], 1);

        }
i want to learn how to code better and not use a 'for loop'
i hate for loops so much
they make me want to gauge my eyes out
so i google 'js filter object array with array'
and i get these functions filtering stuff and it's not what im looking for
i want 1 statement, nice and clean
 
@Jhawins pay me lol. I'll do anything for money... Anything
Even pascal
Or Ada
 
my objective is to print out catalaog to pdf , server is lockdown the address has changed but the zip is wrong . i would need to go in and edit the span class then go to print page select pef and do this all day . what i trying to accomplish here is to automate this because there are more the 8 thousand pages that i need to print to pdf when a customer ask for certain products i am told to build a pdf packet .. but i always have to change the zip .. srry for grammer
tired
 
@Traitor you were SO CLOSE with PurchasesDataList = PurchasesDataList.filter(x => x.ID.includes(idList));
go back to that
and think about what it is doing
and where you got it wrong
 
i am
 
11:10 PM
no you're not! you're talking about reduce!
 
i keep debugging with errors
 
user1596138
@DavidKamer offer him not me lmao
 
@FredMcgiff you are trying to webscrap with a chrome extension?
 
ima search google for 1 simple example
 
So basically steal a text book or some kind of paid data lol
I mean
 
11:12 PM
holy shit @Traitor you're infuriating
 
I'm not judging lol
 
Take this: PurchasesDataList = PurchasesDataList.filter(x => x.ID.includes(idList));
you do not need to add or remove any characters, just rearrange it
 
hi guys
 
@Cows Welcome to the JavaScript chat! Please review the room rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
hi @Cows
 
11:13 PM
(idList.includes(x => x.ID))?
 
But I'm fairly certain that what you are trying to do is difficult because that is what people use a similar setup to do. Try using Java's robot library and/or selenium
 
@David can you point me to some resources where I can learn about TOC
theory of c. . .
 
or idList.includes(purchasesdatalist.filter(x=>x.id))?
 
@david preferably easy to learn resources
 
@DavidKamer i got this all set up and been trying different code snippets from the question link
 
11:14 PM
THINK traitor, think about what you're doing
don't just pick random combinations and ask us if it will work
 
basically this is all you need and dev tools on unzip it .. open the js file and now we can add code to search and replace zip code number everywhere
 
@Cows I don't know anything about that so all I can really suggest is googling it
 
well what i originally posted is saying 'match all ids onto each id in idlist'
and that's absurd
 
i been just getting lost even more more complicated if then and strings . while i find its prob missing something
 
so i dont know how to say 'match all ids from idlist onto x.ID'
so i have to move stuf around till it clicks
 
11:17 PM
@FredMcgiff What are you trying to reformat?
 
@Traitor I'm not sure where you're getting matching from...
 
well i give up, ima stick with the for loop
thanks though
 
yea find the zip code on page replace it with correct one so print to pdf is correct
 
What you originally posted was 'Take PurchasesDataList and filter it. Use the check 'Does the item's ID include the entire idList?''
You need to change that to 'Take PurchasesDataList and filter it. Use the check 'Does the entire idList include the item's ID?''
 
yea: idList.includes(x => x.ID)
 
11:21 PM
very close, except you're confusing the signatures for filter and includes
 
will the zip is in a span class and also has a xpath but for example if i added this script qaru.site/questions/367989/… cant seem to figure out even searchiing w3schools a way to find numbers only , i either get it changes every number on page
 
you're now asking if idList includes a function (x => x.ID)
 
var replaced = $("body").html().replace(/text/g,'replace');
$("body").html(replaced);
error
 
When you call filter you pass in a function that gets checked against every item in your array. When you call includes you just pass it a value that it looks for
 
It looks more like you are just re-arranging code and asking if it's right instead of going and trying.
 
11:23 PM
na i gave up already
thanks though
 
@Luggage how did this happen? how did I end up in your place?
now we have both got brain damage from banging our heads against a wall
 
The ol' switcheroo.
 
i appreciate the help, thanks
 
@Traitor you are your own worst enemy. I don't know what you're doing but you need to learn how to learn
 
i been but i having major brain farts and and not working on every site
 
11:24 PM
The code you want is most likely: PurchasesDataList = PurchasesDataList.filter(x => idList.includes(x.ID))
 
sometimes, im hungry af and my head hurts
 
every page
 
unless you're right that one list has strings and the other has numbers
 
they are strings, thanks man
 
if they were strings you shouldn't have gotten x.ID.includes is not a function
 
if i wanted to test this on jsfiddle the last code snippet qaru.site/questions/367989/…
 
11:46 PM
I think ive won the prize for the most baffling code bug. When i emit this twice, the client only recieves it once. When either of these are commented out so theres one left, the client wont receive anything. They both need to be present to send it once.
    user.emit('incomingChatMessage', messageDetails);
	user.emit('incomingChatMessage', messageDetails);
 
do a .wait
promise?
 
its not in a promise its just a normal function
i dont think emit is async
even if it was it should send twice
 
11:58 PM
Emit isn't async unless you make the connection async
The call back for the connection.
Learned that today lol
 
@RachelDockter If you do it 3 times does it send 2 messages?
 

« first day (2755 days earlier)      last day (2207 days later) »