« first day (3534 days earlier)      last day (1638 days later) » 

04:27
        ***SERVICE TS****
          setUpAlarms(currentTime: number): void {
            this.savedAlarms
              .filter(alarm => this.checkAlarm(alarm, currentTime))
              .forEach((time: any) => {
                setTimeout(() => {
                  console.log('GISING!')
                  console.log(time);
                }, time)
              })

          }

          get savedAlarms(): number[] {
            let DATA = JSON.parse(this.localStorage.getItem(environment.appKey + '.' + 'postponed_alerts'));
@Panda 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
 
4 hours later…
08:04
Hello guys!
Do you guys know anything about CSS modules?
If you are to apply different background images in multiple different pages in a react file, how would you go about it?
Background images to the whole body.
And why does the CSS files for other different components overlap with each other even when using CSS modules?
hello @Saken
do you know anything about this css modules?
08:20
hmm I wish package.json would include information about the minimal node/javascript version required to run a program
not afaik
08:42
Do you know anything about CSS modules @paul23
?
Not particularly, we don't write css directly.
hmm...never heard of before
how would you add a background image using that JSS?
Well actually we use material-ui, and material-ui so happens to use JSS....
But a background image would just be:
08:46
yes..just be what?
Do you know anything about CSS modules @jeea
?
import * as React from 'react';
import { makeStyles } from '@material-ui/core/styles';

const useStyles = makeStyles({
  myDiv: {
    backgroundImage: 'url("./someimage.png")',
    width: 480,
    height: 480,
  },
});
export const SomeObject  = (props)  => {
  const classes = useStyles();
  return <div className={classNames(myDiv)}>
    content
  </div>;
}
@paul23 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
shush bot...
Thanks Paul

I tried css modules and got the background images of other components overridden the file that I was working
09:52
@paul23 Completely agreed. I'd also do one over - jQuery has some really good features. But there is a problem here - they are "hidden" because how easy it is to use it. You may never find out about some of the features it has. In some ways it's the same problem as hiding a feature against some form of inaccessability (many menus, or convoluted config to reach it). In some ways it's the opposite - it's so easy to use jQuery that you never dig deeper to find out more.
Here is an example: let's say you want to add an event listener. Easy, right? Just use .on("click", function() {/* something */} ). But did you know you can namespace events? You can just do .on("click.myNameSpaceHere", function() {/* something */} ) and that still works as a click event handler but you can more explicitly refer to them later on.
This is a feature that exists in the documentation but it's not easy to find purely because you don't need to read the documentation to use .on, so why would you find it out? And there are many other such things in jQuery - things masked because of how easy basic jQuery functionality is which leads to overall sloppiness when applying it.
I often read the documentation of a function when I use it.
@KarelG So do I, hence why I know about this feature. But the RTFM people seem to be the minority. When I work with others I often have to say "wait, let's look at the documentation" because other people just try to guess how something works.
I'm not suggesting everything should be super hard to figure out but the approach should be consistent. jQuery suffers from mixing very advanced concepts with a very simple ones and stuffing everything in a very concise interface that seems self-explanatory but often isn't for cases when you need anything other than the basics.
reading a manual is "overrated", you'll not going to remember it anyways if it is not intuititive.
@paul23 my history with Array#shift and Array#unshift...
I never remember which is which because the two words can be used as synonyms for both operations.
||> arr = [1, 2, 3]; arr.shift(5); arr
@VLAZ [2,3] Logged: `` Took: 0ms
10:03
OK, so shift will actually remove items from the front. This means that unshift does the opposite and adds to the front
||> arr = [1, 2, 3]; arr.unshift(5); arr;
@VLAZ [5,1,2,3] Logged: `` Took: 0ms
eh, a week ago, I was standing at my parent's washing machine with a manual in my hand. My one is broken and mom offered me to use it. I got a weird look from both my brother and mom why. Apparently there is a little issue with configuration programming (of which they complained a lot for years) and I was annoyed by that as well. So I decided to check the manual to fix it. And it is exactly in the manual how to resolve that. I had to listen to complaints for years while it's easy to fix...
In this spirit, I have to make a confession. I was getting some error when running a command line thing and couldn't for the life of me figure out why or how to fix it. I think I searched for a couple of hours. I finally just read the message completely. In the message itself it said "you can try running some command to fix it". I did it and it was fixed. It could have taken me 30 seconds...
reading the error message is a thing many doesn't able to grasp on. Really.
I see people coming here "code broken. Not delivering what I want. *dumps error code*. pls halp and there is in the error code "cannot read property x of undefined". IS THAT NOT CLEAR???
Well but then in a few years it'll turn out the washing won't work at higher temperatures anymore. And you'll have to figure out why. Only after even more digging you notice that this was due to the change of teh default settings, something you completely forgot since it wasn't intuitive to change and what the settings meant.
10:11
and there is a property name + possible line
@KarelG "But I don't have a variable called undefined!" /s
This (pastie.org/p/3S9wXQXF3HiC0w8zBkEcDp) is my 50-line long code. That <Form /> component renders 4 input fields. If you type in the 1st field, the code is supposed to update the value of the property of the corresponding object in the state array. The array is imported from context and looks like:
const [yourQuestions, setYourQuestion] = useState([
        {
            id: 1,
            question: 'question',
            answer_a: 1,
            answer_b: 2,
            answer_c: 3,
            answer_d: 4,
            correct_answer: ''
        },
    ])
So, when I type in 1st input field i am getting this error: "Cannot read property 'map' of undefined"
@paul23 had a "small " problem with my manager because I *ahem* temporarily changed a setting because of some problems with a service but forgot to revert it ... for four months 😅
Any suggestions?
@user36339 This is a joke right?
10:13
...
I am bafled
@paul23 No it is not. I reformatted it.
Hi, bafled, I'm dad.
😂
oh boy
@user36339 you are trying to use .map on a variable that is undefined. For example myArray.map(...) will throw that error if myArray is undefined. Please go through your code and check for usages of .map (the error should come with a line number, so check around that) and ensure that the array is defined...
Well from the pastebin: the problem is is useContext - why are you using a context "as a state".. This is asking for troubles.
@paul23 So, I should define that yourQuestions list in the Form.js right?
10:20
You'll have to look into the implementation of QuizContext as well as how you provide it in some higher level class --> but why are you using a context...
Any reason you can't use props? - And if you cannot I'd suggest first reading up on mobx/redux before continuing.
@paul23 Well, i just wanted to use more hooks in my project...
If the goal is to learn how to use useContext() - the problem is that the context isn't created. Either by not providing it or because the context itself isn't initialized.
Oh yes! I think it is because I have not written <QuizContext.Provider>!
yeah that would prevent it, did you use React.createContext() though?
|| mdn HtmlInputElement.form
@paul23 YeS i have! Here is the new code: pastie.org/p/0cj0fQueTT5wCEQrDnIfmG, but the problem is appearing again
I'm not a magician, I can't see code that's not visible.
@user36339 debug time :)
there are a lot articles how to. Please read one of them. It is basically adding an extension and use the dev console.
@paul23 Hmm... I should have provided the context file. Here is my QuizContext.js file: pastie.org/p/3egB8mGRm9eIfFQ194dG8j
@KarelG Ok, I will try!
1) Where is `React.createContext()`, how do you create it?
2) `<context.provider>` needs to be in a super-component of the component that has `useContext`. Right now it is inside the component where you use the context. (Which beats the whole idea).
3) What is the context even, what is the *content* of the context? -- How are `yourQuestions` and `setYourQuestions` initialized?
10:40
@paul23 Uh those 3 quesstions are hard for me to answer.... I think I had better read the documentation. thank you Paul for pointing out the problems!
Anyone versed with typescript compiler intracities?
I notice that whenever I select an output directory it sometimes removes teh base source directory but not always. It also doesn't seem to update relative imports towards javascript files. Breaking those.
@paul23 meaning? I am not well versed in type gymnastics but I know some stuff about types.
Oh, that's not even types, it's just compiler things. (still reading, I'll just wait for more info)
Well say I have as outDir: "build" then:
/
    src/
        somefile.ts
    src2/
        somefile.ts
    javascript/
        somefile.js
This gets compiled to:
/
    build/
        src/
            somefile.ts
        src2/
            somefile.ts
    javascript/
        somefile.js
but inside somefile.ts I would have:
var app: express.Application  = require('../app');
And ../app now refers to the wrong file?
Wich just becomes: var app = require('../app'); - but then refers to /build/app, and should hence be var app = require('../../app')
But whenver I remove src2/ it suddenly compiles to a "flat" structure..
10:55
OK, I think I understand your issue now.
Give me a moment to check something.
Oh, and don't bring your hopes up - not sure if I can solve it, that's what I'll check.
@paul23 OK, I'm sorry but I am not sure how to resolve it. I looked up a module issue I've seen before but it was different and not applicable.
However, maybe this would help - in tsconfig.json you can configure where your paths go. So instead of doing require("../utils/someUtility") in one file and require("../../utils/someUtility") in another file that happens to be in a different directory, you can just use require("utils/someUtility") in both.
So that could be a workaround for your case.
11:56
Hey guys, I am thinking of developing a website but I don't want to style any textfields or buttons or any form fields. So I am looking for a open source UI library ? Which ones do you suggest ?
I would look into React with something like Material UI
it is the first thing that comes up :D
not sure if Material UI works without react...
dhS
dhS
Hi
how can we write if statement for executing an event in js
have a event
onPageClick: function (event, page) {
i want to run it when page not equal to 1
12:12
just check it inside the function body?
or do you mean calling the event?
dhS
dhS
calling the event inside pagination
i want it to not run on when the page is open
@Wietlol material-ui library won't but there is this: material.io/develop/web
12:36
Anyone knows how to read a .cfg file
@SUMITKUMAR 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.
@SUMITKUMAR that's just some config file? It can be opened with notepad. So ...
(unless it's something different)
@dhS that's not clear to me.
@dhS Can't you check like if (page !== 1) {... execute my code ....}
@Wietlol Thanks, I will look into it
@paul23 Thanks. I like how the components look
13:31
-2
Q: how to call function once in jquery?

OptimusI was calling a function named showData() using setInterval method. But now I want to call the function only once when the page loads. ` $(document).ready(function(){ function showData() { $.ajax({ url: 'fetch.php', type: 'POST', data: {action : 'showLogs'}, dat...

Y'all, I have an open source app that I want to develop a premium closed source version. Whats the best way to do this git/version control wise?
@JBis get a private repo
Or do you want both an open source and a close source version?
@VLAZ So just clone and create private. I want to make it easier to import changes from free to premium versions.
@VLAZ both at same time
developed simultaneously
Ah, gotcha. Sorry.
Hmm, this probably needs some marketing strategy first.
What features would be close sourced and what would be open?
just add on features
13:41
You could have the open source "lag behind", so premium gets features first and you drip feed them open source with delay.
But there are certain features premium will have that free will never have
but for example, a bug fix on free should easily be ported to premium
And this is JS based?
TS but yes
Same thing in the end.
Does it go in a client? Or is it just backend features?
Yes and yes
13:44
OK, let me think for a bit and I'll come back to you. Also, I need to switch computers.
k thanks
git module?
ok thanks
so changes to free have to be replicated in two repos?
idk
dhS
dhS
@PremRamman not working
i have checked with this
14:27
@JBis OK, this is not going to be the best explanation but I'll try give you suggestions at least. You can set up a [public and private repo](https://24ways.org/2013/keeping-parts-of-your-codebase-private-on-github/) then use those as two remotes. You can then pull from and push two different locations. Each branch can track a different remote, e.g., `featureA` goes to `private`, while `featureB` goes to `public`.

This is not very useful by itself but at least allows for some measure of isolation.
So..., this is my suggestion. Make your application modular and have public and private modules
However, I understand that it's probably easier said than done.
Also, I haven't addressed the client-side features. Because I'm not totally sure yet how can you best protect them. I keep thinking WASM compilation should work here for protection. It's probably the best you can get. However, I'm not sure in what way you expose them so they work in a modular fashion.
Might be as simple as any private repos are WASM compiled automatically by your build system.
By the way, the best example of a modular software I can think of right now is Deluge. It's a torrent client and you can add stuff like tags or schedulers as plugins. It's open source but I think it's written in Python. I've not actually checked. This is the page about their repo which has some explanations and also a link to the repository itself. This is the master branch.
Maybe it can serve as inspiration, at least.
I can't think of another more accessible software that is modular. There are the Elder Scrolls games which allow for quite a deep customisation with mods but I've only made a single "mod" once but it was so basic that I may as well never have done it. Anyway, it's also not open source, so I guess not that useful even then.
🛵
@KevinB 🐴
15:15
15:49
Yo guys long time no see !
I'm working on a new project and for that I'm creating a whole set of basic components (buttons etc etc) the thing is that I'm extending sometimes bootstrap-vue and the only way I found out to override thoose is to scope my css.
(I can allways do .btn.myButton but I'm not found)
However is there no perf drawback ?
16:10
@DavidKamer Hai
its been long time
but I'd abstract it
16:34
wow this is ridiculous.
now the dutch football competition is suddenly all black lives matter, and refuse to work with tv stations that do not announce that. Really they ought to stop funding football from tax money.
16:57
Hi...I doing one page design where I have to parse .exp file which is comma separated and save it into xml.Any one have any idea how to parse .exp file?my .exp file looks like below:
@puspa 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.
abc,23
Ok thanks
 
2 hours later…
19:01
Does anyone who uses Vue ever have a problem with the Vue tab in dev tools not showing up?
Restarting the browser doesn't help. I have to completely restart Visual Studio.
19:50
what does the vue tab doo
When there is Vue.js active on the page it lets you explore the Vue objects, see the values and such.
20:12
Well those problems are actually quote common, can't say I noticed it with vue but there a lot of artifacts that happen in browsers when you "stop" a debugger.
I'd think restarting the browsers would also work? (make sure all browser processes are shutdown/killed though)
@VLAZ thanks! i will look into this
 
1 hour later…
21:16
Anyone ever heard of a SkiaPaintCanvas?
no
!!choose poe or poe
hmm
however, i also have basically 0 experience with canvas related stuff
i don't think its related to an html canvas but im not sure
21:52
@VLAZ I don't think the add on idea would work for this application. I'm going to instead just to the git thing you suggested.
Yeah, that's fair. It's a lot easier said than done.
thats difficult to do with the UI specifically
Whenever I try to use parseInt() on a binary string I get back something in scientific notation "2.8547035013120606e+23". Is there any way to have that not happen?
||> Number("2.8547035013120606e+23").toPrecision()
@JBis "2.8547035013120606e+23" Logged: `` Took: 0ms
21:57
perfect
||> (BigInt(2.8547035013120606e+23)).toString()
@JBis "TypeError: BigInt is not a constructor" Logged: `` Took: 0ms
@JBis "285470350131206064963584" Logged: `` Took: 1ms
@Nika there you go
Thank you!!
22:27
Is there anyway to get js to be able to deal with regular expression with recursive capabilities?
Not that I know of. Unless you use a library for regular expressions.
But I'm familiar with basicaly no regex libraries for JS, so no recommendation there.
Maybe I might not need recursion, but I cant think of another way. I have a string like {{1},{1,1}} and I want to turn the {1,1} into {1} (so that the whole thing becomes {{1},{1}}) but then I want to remove the duplicates again, turning {{1},{1}} into {{1}}. would this be feasible without recursion?
22:57
You need multiple passes to normalise each piece of data. Then you need another pass to normalise the top level structure. So, it could be done in a loop, doesn't need to be recursion. But it's generally the same idea and same complexity in the end.
Oh alright! Thank you
I'm not well versed in such operations but it seems to me there would be a good algorithm or approach for that. Seems like you can try to generate some representation of that data structure that is represented as a graph or tree and try to minimise it.
I know regexes can be represented as DFAs and then automata theory can be used to cut branches until you get a minimal representation. You can also compare two regexes as DFAs to understand if they express the same rule for matching but with different patterns.

« first day (3534 days earlier)      last day (1638 days later) »