« first day (3439 days earlier)      last day (1512 days later) » 
03:00 - 21:0021:00 - 23:00

3:40 AM
Hello. How are you all ?
 
@Roshimon 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.
 
I have a doubt regarding JavaScript's ag-grid component ?
How to enable filter while using custom column header component ?
 
4:02 AM
Hi All
im trying to find a repository on GIT, which is kinda sample project for nodejs and typescript with test cases implementation.
I have some implementation in my current project and want to make the best practice changes.
Can any share some project url of GIT if any for such reference.
 
5:03 AM
not sure what is wrong in the imports
Hi,
I have the below structure

controller/user/usersocialcontroller
controller/user/useraccountcontroller
routes/ userroute

export class userSocialController {
	constructor(){}
	//MyLogic
}

export class userAccountController {
	constructor(){}
	//MyLogic
}

//userRoute.ts
When in the user route im writing this line of statement

import { userSocialController, userAccountController } from '../../controller/user'

im getting the exception as
Cannot find module '../../controller/user'.ts(2307)
 
5:33 AM
@OakDev 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
 
user11867329
align: center > nogood
 
1 message moved to Trash can
 
5:54 AM
what does the <void> mean in Promise<void>
what is this syntax called?
 
 
1 hour later…
7:11 AM
hey, has anyone set up a react app on digitalocean?
i am having trouble with nginx.
the question is if i make my nginx configurtion and everything
after that can't i access the site with ip address?
 
7:42 AM
@RobertCalove seems Typescript?
 
 
2 hours later…
9:49 AM
hi gm
I have doubt in react, If I declare variables outside component in react, they are being treated as global variables.
And if I declare them inside component, they are reinitialized every time the component is updated
what is the good practice
 
you can pass variables to the component
so have a parent component (usually the App) and assign some "globals" to props
 
is there a way that i can have a generic object for the incoming request and response object for my nodeapi with express.
 
it can then be accessed from its child components
@SamSam define "generic object" with your own words?
 
req: express.Request, res: express.Response is the thing i should be using?
 
those are types, and yes
 
9:55 AM
@KarelG ok.
 
I suggest to not generify it :P
 
:48866056 public myFunction(req: express.Request, res: express.Response, next: express.NextFunction): any {
this is what im doing, is this the best practice?
 
10:12 AM
Hi all
Happy Monday!
 
10:23 AM
Hey guys Happy moneyDay to u ;)
I wonder if anyone would checkout this issue with me .
I don't know why the function keeps going after it returns.
I can see the log that It found the Id = 2 object but the loop didnt break and kept going till id 13
 
you have taken a recursive approach here
if the input is an array, there are recursive calls for each item item. There is no instruction to stop it.
 
Oh that make sense!
@KarelG thanks, I think that wont work for me because I'll need to send an error message if it couldn't find what I'm looking for, In this case it will replace the returned value all the time.
 
you need to restructure the code a bit
 
Tay
Morning.
 
it's possible ? ok I'll look into it.
@KarelG thx <3
 
Tay
10:34 AM
Hey did your guyses jobs and regions close down schools and stores too?
 
function myFunction(objX,idOfObj) {
  if (Array.isArray(objX)) {
    return findInArray(objX, idOfObj);
  } else {
    return findInObject(objX, idOfObj);
  }
}
 
Tay
We got corona here, and they closed down our classes and school for basically 2 weeks
 
then in both functions, have a stop clause if item got found.
return null if not found
like in findInArray
 
That's a great Idea! thanks a lot!!
 
let obj;
for...{
  const tmp = findInObject(...);
  if (idFound) {
    obj = tmp;
    break;
  }
}
return obj;
a similar approach can be used in the other function, findInObject
(it is just a name check)
 
10:41 AM
I'll test it out in fiddle first :)
looks lit to me !
Thxx a lot :):)
 
It's all about the base... condition in recursion
(Sorry, couldn't resist!)
 
@Alex ,please I appreciate it as i'm self learning ,but what do you mean?
 
In recursion, you have to have a base condition that then returns values.
A uni professor once described it so well. Wish I had recorded it
 
by base condition you mean a conditional if statement above the whole function?
 
A base case, I mean
In above code, base case is the if (idFound) {...}
 
10:52 AM
Oh i see that make sense, And only if it has a value, it returns it otherwise it should return a string or throw out an error maybe or even return null, right ?
 
Yup
 
not a fan of returning null or throwing errors
 
W/out the base case that starts to return a value, you'd have infinite recursion
 
see above, I have returned an empty object
 
^ that
 
10:53 AM
it's a fairly simple check to see if it is empty or not
|| mdn Object.keys
 
Thanks a lot, I feel like I've learned a lot today!
@Alex
@KarelG
 
^
 
Years ago, Macromedia had a really neat recursive findObject function in their auto gen Dreamweaver code
 
10:54 AM
using
if (Object.keys(objToTest)) {
  // has keys
} else {
  // empty
}
 
You're welcome but I didn't do anything. Karel got you fixed up
 
or check by properties, but that's not durable
 
I learned from both of you, Hopefully one day I can give back as well :D
 
|| stars
 
Invalid command! Did you mean: stars, smartass, restart? Try help for a list of available commands..‍.‍.‍.‍.‍.‍.‍.‍.‍
!stars {1}
 
10:56 AM
@JBis what's the command again?
😛
 
@JBis what do you use for the command recommendations?
> Did you mean: stars, smartass, restart?
^ that
 
Tay
Yall, gotta love when your dadass gets all pissed over waking up 10 minutes late.. and takes away your pc privaledges for 8 hours
 
@Wietlol seems that he's checking for Levenshtein distance.
 
Tay
I gotta fucking work with an ipad now... Corona knoced out school. Meaning I cant do ANYTHING
Ipads are a pain to program on, and most programs I rely on are sorta desktop, so Im really screwed XD
 
ah, I guess I do the same
 
Tay
10:58 AM
Yeah and the next 2 weeks are like this. FFS ima bouta ride through hell
 
but I might be using a different algorithm
 
@Wietlol or a similar string similarity algorighm
*algorithm
 
Tay
Building a word reccomendation system sounds fun. Perhaps Ill try it on an ipad XD. oh and apple has smart quotes, so its hella hard to write code that has quotes for strings
I can still sorta use repl on ipad, so its not the end of the world
 
ye, I use levenshtein in a bk-tree
@KarelG source?
 
idk jbis git account :P
|| info
 
11:02 AM
I'm a bot. I am owned and operated by @JBis. I am open source. I am written in JavaScript.
 
oh, I thought you had it open
 
check that repo then
 
Tay
You can actually find jbis by googlin him, surprisingly though, the only reason so is because of the wide use of his bot repository on github
 
@Wietlol levenshtein :P
 
Tay
11:04 AM
Im sad, cant google me anywhere lol, even if ya quote on quote my social account names exactly...
 
@KarelG ?
 
I'm at that page as well. But darn he named it incorrectly >:|
score: levenshtein.get(shortcut, msg.commandCall),
 
?
In information theory, linguistics and computer science, the Levenshtein distance is a string metric for measuring the difference between two sequences. Informally, the Levenshtein distance between two words is the minimum number of single-character edits (insertions, deletions or substitutions) required to change one word into the other. It is named after the Soviet mathematician Vladimir Levenshtein, who considered this distance in 1965.Levenshtein distance may also be referred to as edit distance, although that term may also denote a larger family of distance metrics known collectively as edit...
levenshtein
 
that yes
 
> But darn he named it incorrectly
0.o?
 
11:05 AM
the Levenshtein distance
bit OCD blink blink
 
as a variable, you dont use upper case starting letters
 
> then map them to an object with the shortcut as well as the levenshtein score
it's in his comments
 
Tay
Hey im having issues here, its saying there is no file/directory in the location specified for my users baseplate json file. repl.it/@skylerspark/RubyType
 
hmm
 
Tay
Agh, still gotta figure out how to tie the js and ruby together
 
11:06 AM
I dont talk about Levenshtein
I just use a DistanceMetric<String>
:D
 
Tay
Wietlol if its a builtin method, its probably got a similar internal structure to levenshtein anyways right? Unless theres other ways
 
there are many ways of doing distance mapping
 
@Wietlol if you mention it as a comment in that class, then I am fine
(it = the algo)
 
Levenshtein is easy, but not the best in our use case
 
I don't want to see a class A and figure out which algorithm is being used
 
11:09 AM
@KarelG there is a class DamerauLevenshteinMetric
or something like that
I copied that and made it use my interfaces
 
that's an extension of it AFAIK
 
Tay
Any of you guys somewhat fluent in ruby? Maybe file locations work differently in ruby versus javascript, but its not recognizing the location of my json file repl.it/@skylerspark/RubyType
 
and oddly enough very applicable for biology tmk :D
 
biology?
 
I remember it being used protein sequence variation
> Spelling error correction [9–11], data clustering and data mining [12], comparing packet traces [13], quantifying the similarity of DNA/RNA/protein sequences, gene finding, and gene function prediction [14] are some of the applications of the DL distance.
*DL distance = Damerau-Levenshtein distance
 
11:15 AM
my approach is a lot faster tho
mine is close to O(sqrt(n))
but it varies between O(1) and O(n) depending on the values
without really an easy way to track how much
unlike a hash map for example, which is mostly O(1) but varies between O(1) and O(log2(n)) where it uses log2(n) checks on equal hashes
 
you have a custom algo?
 
Tay
Ok i figured out my issue with the ruby file location (the server running the ruby file is executing it in its own unique directory) repl.it/@skylerspark/RubyType but now how do I fix my file reference so that it will find the base directory and open/edit the json file
 
@KarelG a special one, yes, not made by me, no
its a distance mapped collection
 
Tay
I feel like im behind a glass wall.
 
an n-tree with special things :D
it is called a bk-tree
iDunno why
 
11:22 AM
feel free to publish an article :P
 
A BK-tree is a metric tree suggested by Walter Austin Burkhard and Robert M. Keller[1] specifically adapted to discrete metric spaces. For simplicity, consider integer discrete metric d ( x , y ) {\displaystyle d(x,y)} . Then, BK-tree is defined in the following way. An arbitrary element a is selected as root node. The root node may have zero or more subtrees. The k-th subtree is recursively built of all elements b such that d ( a , b ) =...
 
I know what it is lol.
 
I also use it for my commands
 
just that L-dist is still a "not optimally good" algorithm
 
ye, I know
but it is what I have :D
 
11:24 AM
:P
 
but anyway, I also have it in my command matching
 
🤨
 
invoking a command can therefor have typos
@Wietbot evalnude "nsfw"
 
which command initiator does your bot have?
 
@Wietlol nsfw
 
11:25 AM
(which invoked "evalNode")
command initiator?
 
|| for jbot and !! for cap ect
 
Tay
Caprica is dead rem
 
btw, what will you do if you have two close commands? pick the first?
 
Tay
Very long ago
 
ik
jamesbot is listening at it as well
!! info
 
11:26 AM
I'm a bot. I am owned and operated by @JBis. I am open source. I am written in JavaScript.
 
its @Wietbot
 
@Wietbot evalqs let a = 100, b = 200, c = 300; a ** b ** c
 
I don't know this command, did you mean any of the following? evalsql, evalnode, join, leave, evaljs
 
try evalnode
evaljs is a special one
 
javax.script.ScriptException(<eval>:1:4 Expected ; but found a
let a = 100, b = 200, c = 300; a ** b ** c
^ in <eval> at line number 1 at column number 4)
 
11:28 AM
pfft
ASI importante
@Wietbot evalsq let a = 100, b = 200, c = 300; a ** b ** c;
 
me.wietlol.aws.lambda.LambdaException(org.h2.jdbc.JdbcSQLSyntaxErrorException: Syntax error in SQL statement "LET[*] A = 100, B = 200, C = 300; A ** B ** C;"; SQL statement:
let a = 100, b = 200, c = 300; a ** b ** c; [42000-200][
at org.h2.message.DbException.getJdbcSQLException(DbException.java:453),
at org.h2.message.DbException.getJdbcSQLException(DbException.java:429),
at org.h2.message.DbException.get(DbException.java:205),
at org.h2.message.DbException.get(DbException.java:181),
at org.h2.message.DbException.getSyntaxError(DbException.java:229),
 
ochot
are you really parsing the sql string instead of evaluating it ._. ?
better to have a syntax check only.
@Wietbot evalNode let a = 100, b = 200, c = 300; a ** b ** c;
 
@KarelG Infinity
 
it has a better output than jamesbot :D
anyways Imma stop with playing with the bots.
/back-to-work
 
also, it supports multiline
and formatted
@Wietbot evalNode
let a = 100, b = 200, c = 300;
a ** b ** c;
 
11:37 AM
@Wietlol Infinity
 
@KarelG it is executing the sql
@Wietbot evalsql
create table stackoverflowuser(
    name nvarchar(max) unique,
    points int
)
 
Success, 0 records affected.
 
@Wietbot evalsql
insert into stackoverflowuser
values ('Wietlol', 42), ('KarelG', 10), ('JamesBot', 0)
 
me.wietlol.aws.lambda.LambdaException(org.h2.jdbc.JdbcSQLSyntaxErrorException: Table "STACKOVERFLOWUSERS" not found; SQL statement:

insert into stackoverflowusers
values ('Wietlol', 42), ('KarelG', 10), ('JamesBot', 0) [42102-200][
at org.h2.message.DbException.getJdbcSQLException(DbException.java:453),
at org.h2.message.DbException.getJdbcSQLException(DbException.java:429),
at org.h2.message.DbException.get(DbException.java:205),
at org.h2.message.DbException.get(DbException.java:181),
at org.h2.command.Parser.readTableOrView(Parser.java:7628),
Success, 3 records affected.
 
@Wietbot evalsql
select *
from stackoverflowuser
 
11:40 AM
NAME, POINTS

Wietlol, 42
KarelG, 10
JamesBot, 0
 
tada
@KarelG poke
 
are there a periodical cleanups?
or using temp tables?
I hope that you don't have other tables that you are using on the same db :P
I cna create a table and join with the definition tables :o
to get an overview of tables
or just even show it? o.o?
@Wietbot evalSQL SHOW TABLES;
 
TABLE_NAME, TABLE_SCHEMA

STACKOVERFLOWUSER, PUBLIC
 
xD
 
it is running on an in-memory database (H2)
the only problem here is that they are containerized
when concurrent requests are being sent, the load balancer will wind up an additional container
each container has its own database
when multiple containers are running, it is up to the load balancer to decide which container gets the request
and I have no idea what algorithm it is using
so, at that point, the behavior is undefined
containers will shut down after 15-30 mins of no requests
(i forgot the real amount)
 
11:52 AM
you can use the room as identifier for your containers
queue it up if there are many to process
queue full = deny
 
I could use a queue and a concurrent invocation limit
but meh
queues are expensive
as compared to the event system
both €0,00
but I can use like 100 event systems but only 5 queues
or I have to figure out how to deploy non-polling queues
and I cant be arsed
 
> "queues are expensive"
MFW
 
what face?
(I assume you know what MFW means)
 
hi
when i do two setStates in react only one is working
 
Tay
12:13 PM
Love when a method states it can merge objects/hashes/arrays perfectly but it just overwrites the previous one.
Damn .merge() thing
Or im just an asstard here
2
 
 
2 hours later…
2:43 PM
Hey I'm sorry to bother you again.
@KarelG the loop doesn't break still even after returning and replaces the results
https://jsfiddle.net/fonamt18/7/
if you could take a look at it, I'd appreciate it greatly.
 
2:59 PM
which one
 
hi
Have a doubt in react
 
ask away
 
to use React.memo should I wrap component with React.memo
or it's ok to just do export deault React.memo(Componet)
 
@KarelG hmm, which command are you looking for?
@Wietlol levenshtein algo
 
4:00 PM
hi if I write useEffect(()=>{}). Is this(()=>{}) called callback function in js?
sorry for my silly doubts I am only working on js past 10months
and it is quite tricky language
 
usually a callback is a function that will be run after an async operation
just really semantics
 
eh,
not just async
the function you pass to a forEach is also considered a callback
essentially any function you'd pass to another function.
 
fair point
 
> semantics
 
@KevinB thanks
it's clear
 
4:12 PM
Hey guys, I'm unsure if it's appropriate to post this here, but I was wandering if there's a way to make my ASP.Net Core 3.1 MVC website (specifically the static web pages E.g. About / Contact us etc) changeable. Like a content management system, but for all the HTML elements to be drag and drop moveable etc.
 
Zadders, please post to one chat at a time.
Not cool cross-posting
 
it's... a pretty broad question too,.
unless aspnet or whatever has that functionality built in, what you're asking for is a pretty big poject that isn't just a drop in and it works kind of thing.
 
Nah, helping him in MVC room.
He needs to use HTML5/JS to do DND; then write to db on drop to store for that user
 
Sorry Alex, I asked here before I thought anyone would reply there
 
No worries.
I'm in both rooms. There are JS demi-gods in here and I'm learning from them
 
4:18 PM
So I guess the first step I'd need to take towards this, is to save all my elements into a database? E.g. the title, sub title, images, etc right?
 
Well, kinda. Depends on how dynamic you want it
For images, just store the path/name; no need to use BLOBs
 
I mean, I'd want it to be quite accurate to the point where it's more than just top-left,middle and right. Like i'd want it to be able to be dragged to literally any point of the page
 
Sure, store the coords
Then next time user loads, use coords to place the item there
 
Are there libraries that I can use for coordinates? since I'm not exactly sure how I'd find that out / manipulate it
 
The folks here can help with the d-n-d piece of it
You just need the top left coord (if element will always be the same size)
 
4:22 PM
oh so even if it's stored as "top-left" I can still move it within a varied chunk of space in the top left?
 
i mean... that'd mean positioning everything on the page with absolute position wouldn't it?
 
oh I get you,
 
What K is saying
 
that'd be a nightmare for responsiveness/mobile
 
It'll be ugly
 
4:22 PM
I'd eventually want people to be able to change font-size / colours etc as well
 
usually with these kinds of drag and drop setups you have... containers, you can drop things in
columns, rows, etc
and widgets that you can drop into them
 
What is it you want to achieve? What is your requirement
Listen to KB. These folks have yrs of experience
 
i have 0 experience actually building anything like this
i've just seen a lot of them
 
But you know best practices
Best to define your req's before looking for libraries to do the stuff
 
gotta also look at this from a higher level before you start thinking about adding the functionality
who needs to have access to it?
 
4:26 PM
So I'm basically building an e-commerce site, which I've finished making now. I have certain pages which I assumed would be almost impossible to make editable from the front-end given all the back-end data it's linked to.

So I was trying to start small, with basic pages that just have titles, sub titles and body's etc like any regular "about" page. But my goal is so that if one of the client's want to edit details of the page, they can do so without getting me (the developer) to re-code it for them and re-host the site etc
 
does the site already have a user/permission system that you can use with this to control who can change the page?
 
I have different roles, Customer, Employee and Admin. I'd probably make it so only the employee's and admin's have access to the "page editors"
 
that's good, one major problem down, :p
I think i'd keep it... simple-ish
give them very basic editable parts
 
So start off by just editing the text that's being displayed?
 
for example, the about page, really just needs one editable text section, a wysiwyg editor will handle that
 
4:28 PM
Start simple, as Kevin says
 
Is this an example of a wysiwyg editor? tiny.cloud/docs/demo/full-featured
 
Yeah, I think so
 
yeah, tinymce is a pretty popular one that has been around for 10+ years
i personally hate wysiwyg editors, but they are pretty popular. I don't like giving users that much control over font
 
But think of what you want the user to put into the field. If it's just the title, you won't need anything other than a textbox for them to type into. Then you apply your set styles to it
 
@KevinB I get what you mean about not wanting to give people that much control, especially when there's a chance that it could just mess up the styling / responsiveness etc. But it seems to be a feature that my boss really wants. so I'll find out what the best wysiwyg is to use
I'll start off with editing current elements that exist. I don't know how I'll go about adding new elements to the page. but I'll tackle this 1 step at a time
 
4:38 PM
I have a fixed nav bar, and then I offeset the <body> with a margin the height of the nav bar
How can I add a responsive banner easily?
I've tried something like this but I'm not sure how to make it responsive without a bunch of media queries jsfiddle.net/s16nj7bp/1
 
vh will help w/ responsiveness
And %'s
 
Oh I remembered I've actually implemented TinyMCE with my project anyway. I used it to edit the description of the products for my site. I noticed that when I edit the text, for example make the text red, or bald / italic etc. It changes the styling for it everywhere that I call for the description property. Although it's not specifically setting "bold" or "font colour" in the database
how is that working?
Like where / how does it store that the text is now italic and red?
 
hello, I want to make a toggle reactjs. button onclick toggle working but I want to toggle out when I click outside of the document but it's not working here the code below ```    function outSide(){
        setToggle(!toggle)
    }
    useEffect(() => {
    toggle ?  document.addEventListener('click', outSide) :  document.removeEventListener('click', outSide);

    }); ```
 
4:54 PM
posted on March 16, 2020 by Prudhvikumar Bommana

The beta channel has been updated to 81.0.4044.69 for Windows, Mac, and, Linux. A full list of changes in this build is available in the log. Interested in switching release channels?  Find out how here. If you find a new issue, please let us know by filing a bug. The community help forum is also a great place to reach out for help or learn about common issues. Prudhvikumar Bommana Goo

 
5:29 PM
 
5:54 PM
hello
 
o/ o/
🤧
 
user8729657
Sorry, I'm self isolating right now and others should take this more seriously.
 
i just stuck it under the nav bar
 
user8729657
Groups of 2 or more, don't even want to see that.
 
afaik i just have allergies. but man it's bad this year
usually i only have issues after cutting grass and a day or two after, but the last time i cut the grass was saturday before last and it's been non-stop since then
 
user8729657
6:00 PM
Yea @KevinB, sounds like a strain of covid-19. You might want to go into self-isolation just to be safe.
 
...
 
6:41 PM
github just bought npm
 
everyone should be self-isolating whether you have symptoms or not
kevin I hope you're not going out and about with those symptoms
 
i've been self isolating for decades
9
i do work in an office, but it's in a mostly empty room in a cubicle, so... probably good
 
Does anyone have a good resource to learn proper patterns for react/redux?
 
might start working remotely soon though
 
someone DDOSed Department of Health and Human Services
 
6:55 PM
someone also DDOSed POE servers. the heathens
 
7:16 PM
@KevinB any idea about my last question?
 
7:39 PM
No
 
user8729657
8:29 PM
@KevinB, is it a new season of POE?
 
it is
it's a even rippier league than metamorph
i'm up to 200 or so deaths O.o
though i'm also working on transitioning from a build that wasn't tanky enough to a new one, so i had a lot of deaths from being squishier than i expected to be at that point
mana guardian of last league would be ideal this league, if only they hadn't nerfed it
 
user8729657
:o, I might start playing right now that business is slow
 
don't go guardian
unless you reaaaaly know what you're doin
lol
this is a league where map clear + survivability is key, glass cannons need not enter
like, going berserker is probably a mistake
champ is good
inq/hiero is good
checked poe.ninja to see if there were any other guardians doing what i'm doing, and found none... that's when i decided a change was needed
all the pieces i needed to get my survivability an acceptable level either didn't exist on trade or were 5 or more ex, was crazy
 
8:50 PM
Ok. I am beginning attempt #3 to learn react.
Wish me luck.
 
03:00 - 21:0021:00 - 23:00

« first day (3439 days earlier)      last day (1512 days later) »