« first day (3317 days earlier)      last day (1853 days later) » 
00:00 - 22:0022:00 - 23:00

00:00
o/
if you use a re-select selector..do you not have to subscribe to the store? As the selector will add a listener for state changes? I don't that explained in their docos
actually looks like there re Chrome extensions to verify that - github.com/reduxjs/reselect
@TaylorS Regx is a mini-language well supported by every major language. Like CSS selector, but for text, and waaaay more powerful. You'll do well to lean it. After js fades out, you'll still be writing regx.
@TaylorS Everyone have their life is shit story. Right now, my toddler haven't been to school for 7 consecutive days, and I haven't been to office for 8, because of the ongoing civil unrest in Hong Kong. I am lucky to have a job where I can remote work (with a toddler on my lap, but still), but many don't. And having a job is kind of the secondary concern; our road out is blocked, south by students and north by police, so we can't go out and get food.
00:16
You're in hong kong? I wish you and other Hongkongers luck in your fight :) Unfortunately you seem to be suffering the consequences of the fight :(
Wish US and others would help you guys more
I understand that, as many do. We don't have a future if the China's approach does not change. The sad part is just two days ago a top ranking government official tell the councilors that he doesn't know what we are angry about. I am not sure whether he is ignorant, pretending to be ignorant, or simply incompetent.
US is in deep enough water, as does UK. That is the #1 reason why I am holding of deciding where to move to...
That's the fearsome part. Technically, they are not. But if you are not pro-China, you won't be appointed to any important government positions. China let us go our way as long as we don't try to be independent, but in recent years they are trying to force laws to align our system with China. Like the law that triggered the current unrest.
I personally think this is the last chance we got; if we fail, the world may as well give up on Hong Kong. It'll become just another China city sooner rather than later.
00:54
The world may have already given up on Hong Kong...
 
4 hours later…
04:24
I for one gave up on Hong Kong a long time ago
Where did you come from? Where did you go?
05:02
Hello
@Sheepy @JBis Yes I agree with you for this.
05:37
evening guys
at last i finished the book i was studying the past 5 months
it was about javascript, i taught me some nodejs and html/css as well
i was wondering if i should learn html5/css3 or if i should jump straight into react
@JDCH, Great, So now You can start developing demos using HTML 5, CSS 3, JavaScript.
@ParthRaval i've done some things, both front end and back end, like, i know how html and css works (or at least i do), i even learned some canvas, how to do dom and even manipulation as well
but i don't know if i should learn html5 and css 3 or jump straight into react
because i haven't, the book taught me enough about html and css to do dom and event manipulation
but i don't know if im missing important stuff i don't know about html and css
05:56
you won't know till you need them
The important thing is to know what you know, and be ready to hit up MDN when you find something you don't
and... off to bed
Good night and good morning!
@KevinB thanks for the advice, good night
06:21
@JDCH, You need to start development otherwise you never know how to apply the theoretical concept to practical. & I agree with @KevinB because ho has 9+ years of experience.
So start development.
 
2 hours later…
08:40
@JDCH If you know html4, you know html5 basically
It has some improvements, but overall mostly the same
css, you only truly get good at through experience
I would recommend you create a simple demo using pure javascript before jumping into other libraries like react, but only so that you know how javascript works
frameworks like react tend to have a very different way of doing things and if you don't know ultimately what is going on under the hood, then that's not good either
I'd like to add that that little demo should probably contain some DOM manipulation. You will get a bunch of experience with "normal" JavaScript (as in syntax and conventions and stuff) when doing React or Node.js.
09:02
learning how to crawl before you walk
09:13
@Neil, Yo :-)
yo
09:54
I wonder what an efficient algorithm for this is: app.codility.com/programmers/challenges/niobium2019
I got 65%, timed out 2 of the performance tests
Hey
I'm wondering if this question is following the correct premise that Angular needs to bind to an Observable variable in the view?
0
Q: How can you cast Redux state to an Angular view Observable?

Brian JI'm using a Redux Store within an Angular app to hold application state. But in my view I want to assign this Redux store state to an Observable$ variable that the Angular view can bind to and update as state changes. import { of } from 'rxjs'; ..... // Using RxJS operator to cast Redux store...

As when I supply the state to the view without being an Observable , it doesn't re-render the view
In Angular 1.x you could do this by creating a scope$.variable
Not the same in Angular 8
@towc how do you handle the flips?
best I could come up with was go through every row, flip all the columns with ones to zeros, check the score, then repeat with all columns with zeros to one, and check again
my initial try: https://app.codility.com/demo/results/trainingRRQ4XJ-B86/
a bit more non-algorithmic optimization: https://app.codility.com/demo/results/trainingKKEZT8-V4E/
I'm not sure how you could optimize for the diagonal test (other than checking that it's a diagonal...)
also, I don't actually modify the original matrix, I just do a check to see what it would look like after modification, and add to the count if appropriate
too much loops
well, I'm curious how it could be done better
oh, I think I have a way
10:16
hmm I am stuck at that shiffle
keep a tally of one-count changes for every column, so instead of checking every time you redo a column, you just add that change
🤔
but actually no, the algorithm for going through every change would be the same as going through every bit of column
so it would just end up using more storage and more setup time
I got nothing
keep track of rows that are the same, and instead of incrementing the score by one when every one of them passes, increment by that number of rows? Would require some setup, and the chances of 2 random rows being similar are quite slim (and it will do nothing for the diagonal case)
when user visit a website cookie stores the user information ,what this stored cookie will do with the user info ?
@swaroopbabaleshwar 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.
10:24
@towc I don't know a good means to track my "valid" rows ;_;
got another loop. I DO NOT WANT THAT
@KarelG take a look at rowOnes in my sample. I think that's somewhat efficient
I only keep track of the count of ones for each row, and a row is valid only if that count is 0 or M
- START FUNC
dict = {}; // dictionary or object ... not sure if okay
// it must be {0 => 0, 1 => 0, 2 => 0, 3 => 0, ... MxN permutes) - not sure about permutes. Can be optimized

LOOP r = 0..rows
  is0 = []
  is1 = []
  LOOP c = 0..columns
    IF cell == 0 THEN is0.add(c);
    ELSE is1.add(c);

  dict[is0]++ // need to figure out defaults...
  dict[is1]++ // same problem

RET max(dict.values)
- END FUNC
are you doing fortran...?
dict is a map that is an integer (index) -> integer (count)
you know what we call an int → <any> dictionary? An array
10:30
try to turn that in js 😀
maybe yes
Array.fill(o->maxInt, 0) is simple to set that dict
that Array(N*M).fill(0)
wait
no
I'll admit I'm very confused
max number you get is col
so Array(M).fill(0)
the max max is N
no that is rows. I am looking at the cols
the maximum value the function can return is N, trust me
10:33
maybe I am using a different approach than yours
huh
but you can flip in opposite
eg
1 1 0 0
// can become
1 1 1 1
// and become
0 0 0 0
so if N=1 is max then how can I get 2?
you don't get 2
I see 2
not in the same matrix
either flip those first 2 cols or those last 2 cols
in parallel universes, sure
10:35
._.
IT EXISTS
the question is asking "after you flip some cols, what is the maximum number of rows that are filled with the same value"
OINK
I'm having trouble wording what question were trying to answer, but I get what it is
*yells the office "no no, please god no. No..."*
gotcha check it later ._.
but basically, think of it as you're looking at one end matrix at a time, not at the sum of all the "unique" possibilities for rows
10:39
I just count up the "level of permutability" (cannot word it correctly)
God dammit
you can press the up arrow to edit a previous message
you can press it multiple times
So, what I was going to say was: Something I have been thinking about lately, is using ES6 classes for my models. So my calls to an API or database would return classes instead of plain objects. To me, this seems like a no-brainer, the model is then clearly defined and simpler to use. But I don't seem to see this being done very often. Am I missing something? Or is this already best practice that I've been missing out on?
11:22
you cannot "return" classes
well, you can eval a generated string containing class code
it might work fine, but I'm not sure why you would do this. How different are your classes?
towc please ._.
@geisterfurz007 stop procrastinating
and let me procrastinate in peace
I am home already. No work no more today
what about your thesis?
have you cured cancer yet? Didn't think so, get back at it!
11:25
That went to 51 pages still without graphics.
And as I got my weekly hours at work done, I think I put quite a bit of effort into it already :)
btw geist:
2 hours ago, by towc
I wonder what an efficient algorithm for this is: https://app.codility.com/programmers/challenges/niobium2019/
maybe you can help
I can never help :)
maybe you can pretend to
I'm preparing for a job interview
@KarelG I don't see how this is true. If my async getUser(id) function can do return response.json(), then surely it can do something like return new User(response.json())?
@tobloef so you mean the handler returns stuff? What does it return it to? That's not standard
we're going to need more context
11:29
@tobloef There is a big difference between "returning a class" and "returning an instance of a class".
also, returning new X is returning an object, not a class
ninja'd :')
Yes of course, my bad. An instance then.
||> function X() { return class Y {} }; console.log(new X())
@towc Invalid command! Try help for a list of available commands..‍.‍.‍.‍.‍.‍
11:30
unless that happens
@towc undefined Logged: ``
For context, I was thinking that async getUser(id) was a function to get a user from the DB (if it's on the backend) or from a REST API (if it's on the frontend), it doesn't matter in this case.
The main point is that a using classes instead of plain objects gives you a nice definition of your model
@tobloef then yep, you often return something with built-in methods
look at bookshelf's examples (the library)
you could also use TypeScript and define the shape of objects as interfaces c:
personally I'm not a fan of over-OO-ing things
but it can help
11:32
Bookshelf, as in the ORM?
aye
Yeah, ORMs helps with this problem as well
over-object-orient-ing?
@geisterfurz007 aye
11:33
aye
oof
But is this the recommended way of doing thing? Defining your models with ES6 classes. If not, what is? ORMs? What if you don't use an ORM?
ORMs are just the general case of a single db type
you can use the exact same patterns
maybe optimized for usage with your specific case
for large codebases, I think it's encouraged
Dunno if this works because my brain is a little mush currently:
Check how many rows are good in the beginning.
Flip the first column
Check again. If the number of good rows is smaller than in the beginning, discard flipping the first row, start again with the second.
If the number is larger, leave the first column as flipped, check the second and so on.
11:40
@geisterfurz007 if flipping a column will put some in the right state, flipping another column will be guaranteed to undo that
maybe I can try the opposite tactic
If the efficient wasn't in bold I would've suggested bruteforcing, idk :P
But see: I cannot help with smart stuff ._.
@geisterfurz007 I have a working version in a link, look a few messages down
It's cause I'm stoooooopid
I think it's more to do with experience than smarts
1 min O-o
11:43
well, the original was done in 16
then I changed some code locally, restarted the challenge, pasted it, submitted, and I guess that counts as 1 min
Current top 1 has 9 minutes
I think only the first submission counts towards the leaderboard
that's a shame
or something
I've literally only learnt about codility challenges this morning
I learnt about it about 20 minutes ago
11:44
then you can call me senpai
I'd rather not thanks :D
ok young padowan
12:10
@towc you have disappointed me
12:30
@towc got 100%
nice, how?
dict as object was sufficient to keep track matching rows
whelp. meeting
(oh to speed up, I just string'ed the row)
I am super confused
The code is on that same page is it not?
you're basically returning the highest count of a row, from what I understand
and that shouldn't work
oh actually, it does
only rows that are the same will be full when you flip a column, duh
wow, thanks
but how does that account for opposite rows? Like the second example
oh, the count is for both a row and its opposite version
12:41
that belgian twat is smart...
Hello people,
Let me know if anyone has an idea as to what the issue is in this code.

https://stackoverflow.com/questions/58864728/to-set-radio-button-in-the-modal-from-a-value-using-jquery
btw KarelG, I think stringifying the array (adding 0/1 rather than the index) would be faster anyway
I have a feeling you got the solution by accident :P
(as indices are longer than 0/1, and you save an if statement)
huh, interesting, bit negation with bigints results in -(x+1)
oh wait, that's true for floats too
@TaylorS I am by no means an expert, but the basics aren't too difficult. Try using regexr.com and looking at the cheat sheet.
 
1 hour later…
14:10
Well, I could write Regex if I actually tried, Im just not going to bother learning it.
@TaylorS learn it
it's worth it to you, I promise
start off slow and go from there
@TaylorS see it as a swiss pocket knife
you eventually need to use it someday in your software development life
it's one of those few things that you learn as a programmer that do keep coming up over and over again
true. But be careful of overusing it
we'll teach you if you want :)
14:17
I still get gray hair if I see people asking for regex string to check emails.
I don't even bother with that one
or finding something in a HTML document.
it's not good when used as validation unless you're finding out what doesn't work
I think that's the key here
@KendallFrey someone's reluctant to learn regex. Show them the way
@TaylorS it's actually a lot of fun
14:20
I very often use regex to do code quick code analysis / searches, actually. Very useful in vim, or look with ag (github.com/ggreer/the_silver_searcher)
I use it in the browser too, with an extension, to jump to portions of the page or find stuff. You often don't actually need regex, but sometimes it's the simplest way
or with grep
(a more primitive, but more available, version of ag)
although I'm guessing you don't use linux machines
that's another thing that you'll want to learn about later on
@towc interesting
especially
> Literal string searching uses Boyer-Moore strstr.
ag is a godsend
I have seen many "searchers" that even doesn't use that algorithm
14:28
my favourite feature has to be:
> The command name is 33% shorter than ack, and all keys are on the home row!
had to smile at that yes
I need the weekend guys
@Neil dunno, they are easy
this week had 4 days and it feels like it had 40
14:35
oh
@BartekBanachewicz eh by coincidence I read an article where 3 days long weekends does improve productivity with 40% in Japan
@KarelG MS did that, didn't they
yes
but not sure if it would occur here, we have a different work culture
@BartekBanachewicz it had so many days you can't even count to 5 anymore
Oh lol! I just saw that the crosswords actually spell something
14:41
@KarelG if you cut out dypical dev slacking, you could reduce the week to two days anyway
:P
ppshhh was on reddit this morning instead of working
@KarelG wow.. how unprofessional of you..
Use stackoverflow chat like a real professional.
2
 
2 hours later…
16:41
how are u doing ?
I'm trying to solve the regex crossword
it's not going well
I wish there was an easy way to keep track of some assumptions/notes
I don't have a printer, so my only option is to redraw it on paper
and nope
or use on-screen annotations, but urgh
Have not worked with regex crossword )
@geisterfurz007 it does?
I'd like to know what word could fit xDFBx
I guess it doesn't spell stuff in all directions
ok, you must be messing with me
my dog's walk is getting delayed because of that, I hope you're happy @geisterfurz007
17:06
NO!
Get him out!!!
I just saw it spelled something on one of them. I guess it isn't true for all but I think it was intermediate 4, where it spelled something.
Four and Five definitely did.
In fact all the intermediate one spell something related to their name :D
17:57
@geisterfurz007 oh, I was only looking at the linked one
18:39
Checking if anyone can help me with this.

https://stackoverflow.com/questions/58864728/to-set-radio-button-in-the-modal-from-a-value-using-jquery
Your id's aren't unique.
fix it, or ignore that they exist (because they're useless)
19:22
(censored by Stack Exchange)
eh no
regexp is garbage
it's only used to work around poor solutions
@KevinB [citation needed]
does TS seriously not have real pattern matching
define real
@KevinB the one where the object access is defined by what type of the ADT you match
e.g. if you match on Success a | Failure b, you can only access a in case you get success and b in case you get a failure
19:36
it's an ecma proposal
@KevinB because... that's how ADTs work?
or more specifically, that's how tagged unions work
if you have an edgy enough transpiler, it might be there
@towc I'm talking about TS right now
Got an example?
function failable<T, U, E>(
    r: Failable<T, E>,
    f: (_: Success<T>) => U,
    g: (_: Failure<E>) => U
): U {
    switch (r.tag) {
        case "success": return f(r);
        case "failure": return g(r);
    }
}
19:37
well, right, I guess no matching by type, only by value
@KevinB straight from a tutorial. You could conceivably swap calls to f and g and it'd still compile
sounds like you're asking for typescript to alter how it functions at runtime
maybe i'm not understanding the question?
@KevinB I'd like to only allow calling f once I prove that r is a Success<T>, not on any Failable<T,E>
kevin is right, types can't affect anything during runtime, as far as I know
for example, you can't use typescript to validate user input
19:39
matching by type would break that
that's simply not what it is for
I'm not talking about how that would be implemented really, I don't know enough about TS implementation
testing whether a result was a success or failure would fall under that same rule
I'm talking about static analysis, not anything in runtime
1 min ago, by Bartek Banachewicz
@KevinB I'd like to only allow calling f once I prove that r is a Success<T>, not on any Failable<T,E>
I can prove that statically
how?
19:40
I need to prove that I'm on the "Success" path first
e.g. that I'm doing some sort of a check that verifies that
yeah, TS doesn't do that
I find that woefully inadequate
it's more or less a linter.
This just goes to show that a language needs a real ADT support, not just something cobbled together from different features that doesn't play well together
¯\_(ツ)_/¯
19:45
welp, need to reevaluate the language choice I guess
19:56
is this your game?
@towc yes
I have narrowed down the design somewhat
aiming for a playable MVP right now
how 'bout plain JS?
the old way. No ES6+ features except lambdas
@towc why would I ever do that
could be fun going down horrible horrible hell and everything is on fire lane
"fun"
I did that before you learned to code
the first browser I targeted could well be IE 5
19:58
sometimes I'm finding that I spend a lot of time when trying to get classes and interfaces set up, and I wonder if doing it ad-hoc would be so bad
we just had a discussion about that here
it was fun to be so confused in what you were doing, but finding out that things work
I suggest you look for it
tl;dr?
@towc it's sometimes fine to write small prototypes without static typing
20:00
I might have been part of that conversation
or lurking, anyway
you can always add the typing later
that was also mentioned
every program has "types" in it
just not every one is explicit about it
I don't believe in types. They're just a social construct
just like your mom
20:04
do you believe in plants?
@BartekBanachewicz what about rust/kotlin?
@towc for the clientside web?
I don't know what components your game needs
is it a server game?
and you can webassembly it
if you want to have fun with that
@towc prolly but I really want to focus on the end result now
so if I can wing it with serverless decentralized websockets
or firebase
or whateverthefuck is the latest trend for semi-realtime apps
coldfusion
20:08
ha ha
@BartekBanachewicz what's a realtime app?
@towc with timing constraints
and yours has timing semi-constraints?
20:11
you could say that
that tooltip, +1
21:12
LOL
21:29
Hi, I have a quick react redux question
|| welcome Euridice01
@Euridice01 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.
omg I finally finished that regex crossword: regexcrossword.com/playerpuzzles/59e565c95008d
it took multiple hours (but I didn't use external tools, so no annotations and so on)
21:50
@KevinB You can find a way to disagree with everything. I guess thats a skill in it self (but I assume you would disagree) ;)
meh
I think of it as more of an art
it's called procrastinating
@towc thats beautiful
I challenge you to finish it in under 2hrs, ideally without external tools
I bet it's veryy possible, but I've shown I'm not good enough 😀
How do I submit a virtual form that is not displayed in the UI without using ajax?
it is a Content-Type: application/x-www-form-urlencoded
kinda form
21:58
@RahulDesai form.submit()? .click() a submit button?
I gotta go sleep
its not in the DOM though
doesn't matter
00:00 - 22:0022:00 - 23:00

« first day (3317 days earlier)      last day (1853 days later) »