« first day (3392 days earlier)      last day (1539 days later) » 
00:00 - 23:0023:00 - 00:00

12:26 AM
@krikara Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. 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
@krikara Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. 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
 
I'm not sure if I'm using the right verbiage when googling, but I was wondering how I can use an observable callback to handle multiple lines of code. It works when I used next: but isn't working when I use next() .

https://hastebin.com/hugomivihu.http
this.productService.getProducts().subscribe({
next: products => {
this.products = products
this.filteredProducts = products
},
error: err => this.errorMessage = err

// next(products) {
// this.products = products
// this.filteredProducts = products},
// error(err) {this.errorMessage = err}
 
Pie
Hi everyone
 
 
6 hours later…
6:38 AM
Hey, anyone thinks it is a good idea to create "local" mobx stores?
 
7:26 AM
@paul23 you know what you're saying right?
Let me take this massive local file on my computer, and I'll store it on my own computer in some temporary folder
 
No I mean local as in opposite of global store state.
 
then I'm not familiar with the terms "local" and "global" in this context..
 
So that instead of having stores part of the main app.js a subcomponent has its own store which it provides to further substores?
uh, local vs global variables?
 
ok so like in node.js
 
IE I have multiple search bars, but instead of storing the history in a state I wish to store them in a mobx store.
 
7:29 AM
the handling of storage should probably be done in a single subcomponent, even if you use local or global storage
 
And for each search bar I obviously have its own store.
 
but otherwise, I don't see why each subcomponent having its own storage would be a bad thing
 
But are mobx stores suited for this?
 
it avoids collisions
No idea
under the hood, it's just using native methods isn't it?
 
Well I don't know how it interacts with react and observer pattern.
 
7:41 AM
well clientside, it's using native for sure
unless there's native support for separating stores, then it's all getting saved in the same place just the same
maybe they add prefixes or something to the name to distinguish, I have no idea
 
8:17 AM
@JBis that the data is either internal or external does not matter for a data scientist tbh. The only question he can ask at himself is that if it is ethical or not.
 
> It should be noted that no ethically-trained software engineer would ever consent to write a DestroyBaghdad procedure. Basic professional ethics would instead require him to write a DestroyCity procedure, to which Baghdad could be given as a parameter.
 
πŸ˜›
I like that. What's the source/origin?
 
Nathaniel Borenstein
 
never heard of him
 
8:33 AM
it's the only mention of that guy that I know him by
still, one of my favorite programming quotes
> Code is like humor. When you have to explain it, it’s bad. -Cory House
 
Or you just have a terrible audience
 
 
2 hours later…
10:15 AM
 
congrats, @JBis :)
 
10:29 AM
hy , anyone uses bootstrap 4 ?
I'm working on some form and I've added couple of input and labels , for some reason all inputs are defined as "required" without adding this property , not sure why ... some of those are optional
 
You got an example?
 
<div class="form-group ">
      <label for="AA">Enter Name</label>
      <input type="text" class="form-control" id="AA" placeholder=" Name here...">
    </div>
 
@diamond Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
 
10:45 AM
@diamond maybe there's some css styling that adds required attribute
 
@Neil I've never seen anything like that.
in bootstrap 3 we use required="true" to define it .
 
@diamond it depends of what you mean with "defined as". If there is - for example - a star to the input box making it having a "this is required" visual then it could be a css issue. Or did you mean that you get a message that the above input is required when trying to submit it
 
@diamond do you see a required attribute on the page if you inspect it?
 
@KarelG yes i can't move on to the next set of inputs without filling up those fields
@Neil nope , the input's bg turns to pink and refuses to submit the forum .
 
Are you using any JS frameworks that might automatically add these?
 
10:52 AM
^
 
this is the behavior you'd typically get if there were a required attribute
which is why I asked if there was one
but you can get the same behavior if your javascript attempts to validate all the fields anyway
 
@BenFortune nope JS vanilla

i think it might be blocked by the steps forum that i've implanted a month a go.
if not i will remove all bootstrap classes and try again .
Thanks for the tips guys , i will look into it through the js side, sorry for bothering u.
 
If anyone is experienced with hooks & react, I wonder who to emulate the "do x after the state has finished changing" part of setState..
 
@paul23 useEffect
 
@BenFortune Well the problem is: I cannot see "where" the setState happens. so in case of having two different functions upon changing state (depending on where it happens) I have difficulty translating the object.
 
11:12 AM
@paul23 Does this help? reactjs.org/docs/…
 
That would allow me to split based on the new state.. But the new state is the same in both cases, it's just a side-effect from the state change that needs to differ.
IE, in a calendar to prevent loading multiple times I have a state "isLoading", and if that's true the next/previous button are grayed out. However the loading should hence only start upon the state becoming "true", otherwise a race condition might happen and loading can still happen multiple times at once.
yet loading 'previous' and 'next' are obviously different actions, thus the action to happen upon isLoading -> true is different based on the original click.
 
i couldn't find what is a JSX
where is the exact description that i can find
 
Google it, first result.
 
well i was reading the react and doing execrises
and i found it
JSX . so i googled to know it... the same tutorial was listed first result
 
You were reading the react tutorial and didn't get what jsx is?
oO
 
11:20 AM
so its says... the const keyword with a declaration and the html tag with values in it inside a constant is JSX
 
Consider this variable declaration:

"const element = <h1>Hello, world!</h1>;"
This funny tag syntax is neither a string nor HTML.

It is called JSX, and it is a syntax extension to JavaScript.
 
as it says...
yes... i red it
 
yes that's what it is.
 
@pau
oh.. ok... thanks and sorry for being silly
 
It's an extension to javascript to have html-like structures directly in your code.
 
11:43 AM
var input_s = document.querySelectorAll(".required");
          var butns = input_s.getAttribute("type") === "button"
          if (at least one of them has attribute "active")
how can i say that ?
if (at least one of them has attribute "active")*
nvm got it . butns.includes("active");
 
12:20 PM
ayyy thanks @BenFortune
Morning o/
 
hey, just curious, but am I able to search between two Index Values with indexOf();
not just searching a term
so like if between e.indexOf(1) and e.indexOf(4) == "comm" do this:
 
anyone know a polyfill for Symbol?
 
I know you can use "fromIndex" in an indexOf, but I cant find the info on getting a LENGTH of text between two indexes
 
@TaylorS simply make sure the length of the substring is the range and that it starts at a certain index
e.indexOf(1) && e.length === 4
 
Well, Im using it for a command system. So this wouldnt work
 
12:32 PM
Wdym by "command system"? What are you trying to do?
 
So like, first I use charAt(0) to detect for the command prefix, then I detect if indexOf(1) through whatever is == any of the command Texts in the variable Commands
I wanted to create a basic Command Chat system for a side project Im doing with bots
Eventually Ill move into Python and try out AIs and such, but Im just doing basic chat and return things with JS
 
For a simple command bot you can check out how James parses messages, but the basic idea is you split based on a delimiter, usually a space. Once its an array, its much easier to work with.
 
a command-based chat bot is miles apart from an AI chat bot just so you know
 
@TaylorS i guess you need a substring search
 
Substrings sound like a good plan, but I DID have a few little issues with em at first, thats why Im trying a few different Ideas
JBis, thats smart. I had a similar idea, except I used a more basic plan for Configs in commands, like in command shell, I could use String.includes() for basic configs, and then a more complicated regex search for configs with return values
 
12:36 PM
if you can elaborate i may help
you can you a trie
 
?
 
I mean TRIE data structure
 
Never heard of it, but whats with it
 
that's way more sophisticated than it needs to be
 
Also, JBis Ill try out the delimiter idea, I like it
 
12:38 PM
unless you're dealing with thousands of commands, a trie is overkill
 
@user123 don't over-engineer it
 
^
 
Not thousands Lolus
Just a small thing that I may make bigger
I actually plan to convert this to python and try doing some research on REALLY basic AI, and I want to create my own python based bot that can input basic messages and reply based upon them
not planning to create a speaking robot, just a slightly more complex discord bot if I may use it as an example
 
Alright maybe you might need it later .. (^_^)
 
Well everyones talking about getting into AI, and it sounded fun
Although I dont see how I could create Neural connections in JS, as they need to be recorded, and Im not going to record neural connections in Localstorage or something lol
Im overthinking it, anyways Ill continue work and come back if I reach any walls I cant climb again
 
12:42 PM
AI is hard
 
everybody : AI, ML
me :
 
There are existing NLP api's fyi
 
don't let anyone tell you otherwise
there's a lot of tweaking involved that really, you only get after many trial and error attempts
 
ML is hard, AI is just regular stuff. James is arguably AI.
 
by AI I mean ML
responding to commands is just if else.. I wouldn't even classify that as AI
 
12:43 PM
right
 
Well, the kind of AI I mean, kindof between the AI you mean, and ML, Its going to respond to commands (obviously) and a basic "chat"
 
ML is just a bunch of if statements
 
so like, I want it to interpret basic small phrases
Thatll be work though
 
ML is just a bunch of if statements, except you didn't write them
 
and I dont know how to record neural writing, so Ill get to that bridge when Im there
Thats what I mean
written by learning
 
12:45 PM
@Neil exactly :)
 
;)
 
Switching to world history brb
 
genetic algorithms are fun
you have some data that you can punch into some simulation or formula and get a performance rating
then you take two high performing solutions and you create two new ones that are a mix of the two
like, say two parents creating two children
then mix and repeat
 
Also, is it normal that whenever I think about programming AI, it sounds like Im one of those "fake pretend programmers"... maybe its just because I watch WAYY too many unrealistic AI movies
 
good for situations where optimization is not obvious and when you don't care about having 100% accurate solutions
 
12:47 PM
Makes sense
 
AI has a lot of rubbish associated with it
 
make a function for Reward and Loss
teach it to reach for reward, not loss
And write complex statements based upon it
 
well the performance rating is just a number
the higher the better (or the lower the better, however you prefer)
 
Pretty much, its all interpreted by the ai later on
or outputted as performance to you
 
what you describe is more like neural networks than genetic algorithms
but yeah, I think you get the general idea
 
12:50 PM
yup, Ive done my bit of research over the years... ive watched more videos and research on AI then javascript by now, but I have yet to put it into use
I guess its always that big wall of "Trying to apply a concept of idea to a random programming language" is always the hardest for me to pass
 
well don't be discouraged if you have difficulty with ML
my point was just that. It's what a lot of programmers have difficulty with
 
Lol, sometimes I get tired, but I always wound up coming back to the project
anyways class is starting, gtg
 
o/
 
cya
 
neil must have a different thought on "AI"
 
12:58 PM
different than what?
 
I see jbot as a task bot. nothing more.
> by AI I mean ML
AI is just a field with its own sub-fields
U KNOW IT
 
because I would hardly call artificial intelligence something which I would normally call "every freakin' program that ever existed"
checking conditions and taking actions based on those conditions is literally a program, nothing more
otherwise, I invite you to give me an example of something you wouldn't consider a normal program that is AI according to you, but not machine learning
 
ai & ml are dynamic programming with large memoization ;D
 
V.7
1:15 PM
@TaylorS What do you mean by that word?
 
for (let i = 1; i <= 100; i++) {
  setTimeout(() => {
    if (!speechCompleted) {
	  progressBar.value = i / 100;
	}
  }, initialDelay + (level.description.length * variableDelay) * i);
}
I've done the above to simulate a progress bar when using TTS, is there a better way to do that?
 
V.7
CSS?
 
Good idea, as I do know roughly how long it'll take to read out. Still have to deal with the initial 250ms delay however
 
That should make it a bit smoother too, thanks
 
1:35 PM
Guten Morgen
 
V.7 which word
 
nice. ⩊ is &cupcup;
 
gtg? lol? sorry, its shorthand, "got to go" "laugh out loud"
 
= "bewbs"
 
UwU
 
1:37 PM
OwO
You used Uwu
 
Oh no. Are you a weeb!?
 
1:51 PM
yes
Yes I am
I watch boku no hero and hunter x hunter like a pro
 
V.7
2:14 PM
@TaylorS "Kinda ..." why?
 
2:24 PM
@V.7 thanks for the CSS suggestion, progress bar is much smoother now
 
2:37 PM
Hi every body is there a transformation plugin that transform this:
{
 
why would anybody write a table without a freakin' primary key
I can't ever imagine it being a good thing..
 
addNumbers(a,b) { }
}
into this:
{
randomName: addNumbers(a,b){}
}
 
What is addNumbers(a,b) { } }?
 
I am looking for a transformer that look inside each objct and transform {value} into {'value':value}
@Neil just some example of a random value
I now in javascript you may not write a key in the object if the value and the key rae the same, unfortuanatelly there are still brosers that d'ont support this Syntactic sugar
 
const matched = '{value}'.match(/\{(\w+)\}/g)[0];
console.log('{\'' + matched.substring(1, matched.length - 1) + '\':' + matched.substring(1, matched.length - 1) + '}');
though ideally it would be better to change it at the source
not have to deal with it client-side
 
C4d
2:55 PM
Hey guys. I assume I'm also allowed to talk about TS in here? There seem not to be a fully suitable room for that.
 
Well it depends on what do you intend under TS XD
 
Yes, we do allow talking about Toy Story here
 
I wasn't a huge fan of the last one
 
C4d
:D. Sorry, I ment Typescript.
 
I know, just messing with ya :)
 
V.7
3:05 PM
 
C4d
Yeah got that, but that made the complete answer not serious for me ^^.
I take that as a 'yes it is'.
 
V.7
Any ideas? ^
 
@C4d sorry I couldn't resist either XD
 
C4d
@V.7 .value?
No need to apologize for it guys. I there's a change to muck around with a not clear sentence I am normally one of the first guys. So fully deserved ^^.
 
but it was clear, so it was just mucking around :)
 
C4d
3:10 PM
Hmm. Then lets call it not clown-safe.
 
NCSFW
 
V.7
@C4d value for radiobutton?!
 
C4d
@V.7 I just realized I dont even fully understand your problem..
Thats one kind of problems with just pictures.
 
@V.7 is it something that MDL is doing under the hood? I see the parent element has the 'is-checked' class
 
V.7
3:15 PM
The strange part is that DevTools does not show "checked" attribute for <input> tag while query shows
@KostyukRostyslav @C4d why would I need a value for radio button when checked attribute is being checked?
 
isn't check attribute a sort of alias for value?
I mean value=1 isn't checked?
 
@KostyukRostyslav nope
 
@BenFortune I learn something new
thx
 
Back, in EE Science, I finished before everyone else, so I can program for like 45 mins lol
 
really they should have made it so that a checkbox would have a value attribute with true or false as acceptable input
 
C4d
3:20 PM
No. The value is the value the checkbox has been set to. It is not representing the checked-state of it.
 
having a "checked" attribute is asymmetrical and a little flimsy
 
Neil if you want a true false one, take the "default" checkbox from dat.gui for example
true and false are its main and really only values
 
C4d
@Neil Just what I think of it.
 
But if you really dont like the checked attribute, you can make a prototype and/or customElements mod as a JS library to do it
dont think itd be hard
 
but now you're bound by which browsers support custom elements
it's an unacceptable solution to use just because you don't like checked attribute
 
3:22 PM
Why would you go around browser standards
 
Because Im crazy.
Hasnt this been established like a billion times that Im a crazy person who overwrites default code and prototypes in JS lol
 
C4d
It should've stayed consistent across inputs with a different type. Value should be the attribute to get the primary value of the type (which is text => text, number => number, checkbox => checked-state).
 
but customElements isnt bad practice
 
C4d
My 2 cents.
 
you can add more attributes to default elements or create plain new ones
 
3:24 PM
@BenFortune it will be just a little bit readable and consistent
 
Well, if enough people, including the devs notice the failure of an attribute like checked on a checkbox, surely itll just get deprecated and fixed in HTML6
 
C4d
Hmm. Would be a risky step.
 
speaking of which, Im new to this, when exactly do they make "updates" to web APIs and frameworks like CSS and HTML, and for languages like JS
will it just pop out one day and web browsers update their interpreters?
 
No it's a very lengthy and complicated process. Pretty much the reason we need transpilers
 
transpilers?
 
3:26 PM
Oh boy
 
lol. I made a mistake. Shouldnt have asked. Woopsie.
 
- compiler|transputer}} A source-to-source compiler (S2S compiler), transcompiler or transpiler is a type of compiler that takes the source code of a program written in a programming language as its input and produces an equivalent source code in the same or a different programming language. A source-to-source compiler translates between programming languages that operate at approximately the same level of abstraction, while a traditional compiler translates from a higher level programming language to a lower level programming language. For example, a source-to-source compiler may perform ...
 
oh... so its basically a language converter..
can convert old to new, and old/new to different...
 
it can convert also to the same language, but yeah
typescript is an example of this
 
Typescript is a language, but it also has a compiler
Babel is a transpiler
 
3:29 PM
oh, where I see em theyre just called compilers or pre-proccessors
 
Compilers are more low-level
 
Never seen the point to typescript.
in my eyes I always saw it as another pre-proccessor and never bothered "checking it out"
And besides, the only time Ive ever used pre-proccessors are those like SCSS and Stylus, because they allow more Power and Use to basic syntax
 
a preprocessor would be like something which operates on pragmas and macros in C++
 
idk, thats what they call the ones on codepen
 
at least that's how I think of them
 
3:35 PM
Always sorta trusted most content I saw there, as its where I first started all my forms of IT and webdev
Its actually a universal concept
you can have em for any language really
 
V.7
Why would ripple effect disappear after first press of FORWARD?
 
ive even seen pre-proccessors for C# that can convert all those old VB tutorials to working C# code
@V.7 works for me
Also I really like the effect
 
follows the mouse cursor.. Beautiful
Well thats strange. Perhaps when you stop Forward from running anything after it makes that "yes/no" form appear, your also canceling the function that runs the ripple
hence why it might only be working on the first click
not sure dude
Also, quick mention, I would reccomend adding "user-select: none" to your yes/no form buttons, as sometimes when clicking them, it selects the text, ruining the clean look. @V.7
 
V.7
Of course, this is just a test snippet @TaylorS
Curious why effect disappears
 
3:42 PM
Well, Ive never actually used JS on button styles, nor have I ever made cursor-specific animations like that, I really dont know
I only do CSS animations and little canvas projects most of the time
What I like doing, place a console.log in the very function that starts your animation, and if needed, inside the animation
see if it logs to the console when you click
and keep placing "confirmation logs" anywhere you think might be the problem, find the issue, and create a solution, thats the basic way I go first
 
V.7
 
🚽
 
 
1 hour later…
5:20 PM
Hello
 
@Marc 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.
 
o/
 
5:35 PM
How are you?
 
amazing
 
Glad to hear :)
 
6:04 PM
Just curious, anyone know of a Javascript-friendly way to overwrite the console.log function? And yes, Im actually looking for a non-aggressive way to do it because the API Im writing is going into a professional work environment
Currently Im using a system like this:
got your variable holding the past log
exLog : console.log, (part of a larger variable)
and then a function using it
 log : t => {
  if (NMSLConfig.defLogDisabled == true) {
  } else {
   NMSLref.exLog.apply(this);
  }
 
@TaylorS Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
 
Good god bot...
NMSLref.exlog is the variable I mentioned above
 
For JS modules, is there any way to dynamically export all under a named alias?
Such as export * as AppointmentActions from './appointment.actions';
import * as AppointmentActions from './appointment.actions';
export { AppointmentActions };
That's the closest I've gotten, which works fine.
 
6:25 PM
 
Anyone in the mood to criticize some JS code :D?
https://codereview.stackexchange.com/questions/236364/javascript-validation-class-functions
 
it sucks ;)
 
I could use some feedback :)
That is the response i need!
Delete everything
 
I wouldn't use one regex expression. You can split up for readability and probably efficiency.
here's my validation:
if (!req.body.password || !ValidateRegex.Password.every(reg => reg.test(req.body.password))) {
        errors.push("Empty or Invalid Password.");
    }
 Password: [
        /^.{8,100}$/,
        /^.*[A-Z].*$/,
        /^.*[a-z].*$/,
    ],
 
Oke thank you
 
6:30 PM
3 simple easy to read to check lowercase uppercase and length. Although length should prob not be checked with regex.
 
Right now i am following OWASP
 
You can also name them. Password.hasUpperCase, Password.hasLowerCase, etc.
 
That is a good one, makes it more readable
You still have docblock to check what it is
 
 
2 hours later…
8:50 PM
when are async constructors coming to node?
 
9:01 PM
||magic8ball
 
Invalid command! Did you mean: magic2, magic, magic3? Try help for a list of available commands..‍.‍.‍.‍.‍.‍
 
hey guys
i want to solve this problem
i have a incoming json payload with property values that are the property values... I want to map each property value to another text name.
now is that basically a DTO
and would I just use map to do that?
like men = mens
and women = womens
 
ok?
 
well i issue is they incoming data is dynamci
 
some of that work (if not all of it) can be done by the json reviver function
 
9:10 PM
meaning it could be a man or women randomly
 
well, actually i misunderstood. the reviver just alters values.
 
well if it can turn men into mens
 
only if that's a value
not a key
 
or men into someothertext
yes it is a value
 
then the reviver can do it
 
9:12 PM
that is apart of the parse function
 
yes, you said you were working with json, so presumably you'd need to use the parse function, right?
unless you meant you're working on an object, in which case you'll need to iterate over it.
potentially recursively
 
well hmmm i already got out of it so now it's an object
well what if it weren't json
 
then it's an array and/or object
and you'll need to use methods related to that to iterate over the keys/values and alter them.
 
ahhh ok so it would be a filter/match type thing. but nothing pretty like the reviver function
 
right
though, probably not filter/match
more... forEach if you want to change it in place, or map if you want to replace
 
9:17 PM
ok give me 10 and I i'll show you what i've come up with
its weird because i feel like it's a dto type thing but no direct way of doing it in JS
ok so what I need to transform isn't an array it's just an object
 
9:54 PM
@ChristianMatthew Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. 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
 
switch(this.restroomDetails['restroomTypeSelection']) {
                case 'women':
                    this.restroomDetails['restroomTypeSelection'] = 'womens';
                    break;
                case 'men':
                    this.restroomDetails['restroomTypeSelection'] = 'mens';
                    break;
                default:
                    this.restroomDetails['restroomTypeSelection'] = 'both'
            }
 
1 message moved to Trash can
 
this is what I came up with @KevinB
I think this addresses what I am looking for
 
10:47 PM
what do you think?
 
de vertical lin isn't necessary
created -> asked
 
you right, remove verticle
I'm still deciding on the language. I'm not sure if every post is going to be a question yet.
 
00:00 - 23:0023:00 - 00:00

« first day (3392 days earlier)      last day (1539 days later) »