« first day (2803 days earlier)      last day (2370 days later) » 
00:00 - 13:0013:00 - 22:00

00:04
return role.update({ permissions }).then(() => {
  Store.state.set(id, permissions);
  return { id, permissions };
});
Is it safe to assume that a sequelize hook that appears to be running early is just running before the callback is finished?
 
2 hours later…
01:56
@SomeGuy how do you handle/sandbox against xinput test <yourkeyboardidhere> (iirc you are using linux)?
Hey guys??
how can i look after array change using watchers
wha
like, angular?
vue?
flex?
yep I want watchers to alert me when I push something in array in raw js no frameworks
326
Q: Listening for variable changes in JavaScript

rashcroft22Is it possible to have an event in JS that fires when the value of a certain variable changes? JQuery is accepted.

I know this but this dosn't work in the cash of array
02:12
why not
sure seems to work on arrays for me
This mainly works at object
?
it works on arrays too.
I am trying my best
Please wait... @KevinB
This works on array but I want do do something like this??
// Demo
var myVar = [];


Object.defineProperty(this, 'varWatch', {
  get: function () { return myVar; },
  set: function (v) {
    myVar = v;
    console.log('Value changed! New value: ' + v);
  }
});

  varWatch.push('hello');
How can I do something like this get notify when I use Push on array
what is this?
var targetArr = [];
var targetProxy = new Proxy(targetArr, {
  set: function (target, key, value) {
    console.log(`${key} set to ${value}`);
    target[key] = value;
    return true;
  },
  get: function(target, property) {
    console.log(`${JSON.stringify(target)} and ${property}`);
    // property is index in this case
    return target[property];
  },
});

targetProxy.push('hi');
console.log(targetArr)
Can't I do this using Object.defineProperty instead of proxy ?? @KevinB
02:24
never tried
no, because you'd need to define a catch for every single number
if people do targetArr[7] = 'something'
so it IS possible, just not convenient?
you'd also need one for push, unshift, concat etc
i... guess? There's only a limited number of ints
02:25
how is it?
unless the new arbitrary precision numbers can be used as indices...
srsly though just use a proxy, it's what this is meant for
that doesn't seem to be related to your question
I will try 1 more time .. the answer that @KevinB gave me worked fine but I need to edit me whole code
That's pain on ass
if you only manipulate the array using a very limited number of methods, you could monkeypatch those methods for this particular array
I just one to do array.push(newdata) only nothing more then this .
02:56
🚽
 
1 hour later…
04:02
If I'm trying to implement rate-limiting to an API I'm building..
where I'd have to prevent additional requests if there had been more than 1000 in the last 60 minutes.
Is there an efficient way to do that?
I'm looking for a data store that's appropriate for something like this. Preferably in-memory.
Maybe something that's good at looking up the 1000th-from-last row.
just store the timestamps for the last 1000 requests
so you only ever have 1000 entries
and then check the last timestamp, if it was more than 60 minutes ago you're good
if you want super efficient then do it as a circular buffer
04:30
Thanks, I'll use Redis Sorted Sets.
that is... not the correct way to do it
sorted sets use a skiplist to give you log(n) insertions at any position... you don't need that
you just need to append things to the end
you're only ever going to sort by time, and you get them in order because of how time works
just use a normal list
and cap it at 1000 entries
 
2 hours later…
06:35
@ShrekOverflow Never knew about xinput, so I don't, I guess
Let me know what you settle on
07:16
hmm google sheets uses ctrl+enter for new lines within cells. why not shift+enter (which moves the focus to the cell above the current one after submit)
@KarelG well that's probably why.. they don't want to make context-sensitive hotkeys which change behavior according to the situation
shift+enter has been used for new lines in the same context like
in this chat field
same for word if you want to start a new line without creating a paragraph space
had to google it to figure out that ctrl+enter is used instead
google's not going to take a cue from stackoverflow chat
though it would be nice if there were somewhat of a standard
there's already somewhat of a "markup" standard at least.. I've seen some markup language used here get used on other sites as well
it is not the chat that does it. All browsers supports that functionality for textareas
otherwise you end up with form submit half-way
07:33
ok, fine, then browsers in general
you can still override that if you want
you won't let me rant about a silly thing right
not if you don't want to :)
07:54
https://gyazo.com/2eac2947b3ff3a325e762e2b21bc2e0a

Can anyone tell me why that returns an observable<observable<Response>> instead of observable<Response> ?
> screenshots of code
> 2018
I'll make a gist :p
https://gist.github.com/erwinokken/29f2c4b4320f333c02dd7ef5e87399f2

The addAuthorizationHeader seems to be working fine, atleast no transpile errors. The post() uses it, but it returns Observable<Observable<Response>> instead of Observable<Response> and I can't seem to figure out why.

I tried a flatMap, but for some reason that doesn't fire the observable, even though I subscribe to it.
08:11
@BenFortune i could have starred it if both were on one line
I need to refresh my TypeScript skills because there is a plugin that got updated: full javascript to full typescript D:
@SterlingArcher *pats* sleep bro. sleeeeeeeep
08:22
var array1 = [1, 4, 9, 16];

// pass a function to map
const map1 = array1.map(x => x * 2);

console.log(map1);
// expected output: Array [2, 8, 18, 32]
This is what map function does to an array...
same thing goes even for observable
@ShivTavker 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.
But in your case you return an observable from http post request and that is the problem
At this moment I used a flatMap inbetween, transpiler is not complaining but it's still not executing the observable undearneath.
Map is something that happens after the request is being done. I need to do an observable before the request is being done. I'm frustrated :-P
So in that case I would say flatMap is not the answer either. But what is? :S
you should use observable<Response>.create(s=>{
this.http.post(options.url, body, options).subscribe(res=>s.onNext(res)
})
or you can directly return this.http.post(options.url, body, options) this
08:40
But the problem is the other observable (addAuthorizationHeader)
I first need to do addAuthorizationHeader and then do the post, based on the new headers.
this.tokenService.currentToken is observable?
Yes
For every request, I need to get the token from the tokenService, and include it to the headers. At first I used a static var, but now I want to use subjects and observables (which already works in other cases) but in this case I cannot get it to work
then use flatMap in addAuthorizationHeader and return return Observable.on(options); this
in post also flatMap and return this.http.post(options.url, body, options) this
I cannot find an "on" method. observeOn, subscribeOn are valid
08:55
you are using rxjs correct ?
Yes
Typescript
sorry it's Observable.of()
subscribe
You are confusing me. Observable.of, or subscribe?
use Observable.of()
for addAuthorizationHeader
09:00
yes
And then something like this? (Does not work because addAuthorizationHeader does not return response
return this.http.post(options.url, body, options)
			.flatMap(res => this.addAuthorizationHeader(options))
			.map(res => this.extractPost(res))
			.catch(function(error:any, caught) : ObservableInput<Response> { return that.handleError<T, Response>(error, null, that); });
no
this.addAuthorizationHeader(options).flatMap(option=>{
.....................

return this.http.post(options.url, body, options);
})
then you can do post().map(res=>res.json()).subscribe(res=>{});
return this.addAuthorizationHeader(options).flatMap(options => {

			options.method = "POST";
			options.url = endpoint + url;
			options.body = body;

			return this.http.post(options.url, body, options)
				.map(res => this.extractPost(res))
				.catch(function(error:any, caught) : ObservableInput<Response> { return that.handleError<T, Response>(error, null, that); });
		});
I am subscribing, but the post is not being done..
extractPost this is observable ?
 private extractPost(res: Response): Response {
		console.log("dataservice.extractPost.1");
		return res;
    }
Not doing anything (for now)
09:07
what i'm saying don't use map for post
Still not doing anything :)
that could be return this way hastebin.com/ogewazogiz.coffeescript
also
print res inside flatMap
how are you using post ?
this.accountService.loginWithRefreshToken(refresh_token).subscribe();
return this.login(body);
return this.dataService.post<Token>("token" + appendUrl, body, options).map(..);

This chain of commands. But this always have worked.
My view does the first one, the loginWithRefreshToken returns a private method, and that one returns the post. They all return observables.
I empty my cache every time I try.
The flatMap(res =>) console.log is not being printed.
Why is it so hard to just do 2 observables. First do the first one, then do the second one based on the first one. And then return the last one. Why is it so hard :S
But now it's observable<response>
Not observable<observable<response>> correct?
Hello,
Good morning
Can anyone help me?
https://jsfiddle.net/7z2k39o0/1/
09:18
Correct @ Rahul. But I think I see a flaw in it. Hold on :p
If you click the first button you can choose which squares will be green.
Then if you click the third button in the rest squares will draw a circle
The problem is that it draws circles and in the green squares.
1 message moved to Trash can
@ChrisP Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
Hey how can I make make function which does exactly same thing like like push() of array??
I found the mistake
@AlishaSharma What's wrong with using push?
09:21
One more condition in line 129 or ~129
@AlishaSharma what part are you stuck with?
Push is basically just array[array.length] = value
thanks @BenjaminGruenbaum for response finally I found idea in google
@BenjaminGruenbaum uhm.
hi
why wouldn't you use push instead?
@KarelG what?
09:25
smells to homework in here
that is not complete to be exact :P
@Rahul I'm 1 step further. My addAuthorizationHeader waits for an observable based on a Subject. That subject never get's fired so I use a BehaviorSubject now. I'm sorry for wasting your time man :(
@KarelG which is why I said 'basically'
You can do array = array.concat(...values) if you really want or a loop or whatever
I would add "and doing array.length++ "
09:30
@KarelG huh? Why?
length is auto-updating.
no. it gets incremented during the push function
!!> var arr = []; arr[0] = 3; arr.length;
@BenjaminGruenbaum 1
!!> var arr = []; arr.length++; arr.length;
@rlemon free me!
!!> var arr = []; arr[3] = 3; arr.length;
09:32
@BenFortune 4
^* 3 that creates an array with 0 elements and a hole at index 0 and not an array.
@BenjaminGruenbaum that sounds like C
@Neoares no, that's how JavaScript arrays work
it stills sounds so C
much malloc
09:36
Really nothing like C
Or like malloc
             much malloc
  very realloc
                       such free
        wow
there must be a check to incr length when assigning a variable to a given index of the array object
did not know that
I just checked the specs 22.1.3.17 Array.prototype.push ( ...items ) and there at step 8.d. you have Let len be len+1.
hence I thought to add "and doing array.length++ "
but seems wrong
Basically:
Proxy that checks if Number.isInteger(prop) && prop < MArray.MAX_SIZE and if it does set the length to the max value
@Wietlol you can use the bot for that
I hate when my coffee gets cold
and it happens every morning
09:59
he is still muted :P
oh
then it was cute :P
ssube put me in mindjail
and he promised to get me out when i stopped being an asshole
but he didnt
and now ssube is gone
and you did?
occasionally :D
but im not an asshole to cap any more
you have to try harder to find him
10:05
he renamed?
he ded
we need a priest to resurrect him
that is why i keep bumming rlemon (since iirc, he made cap)
in my defense, @Neoares you committed the same crime as I (me?)
i was put in mindjail, you werent
zirak made cap
i call discrimination
zirak doesnt visit chat?
10:11
Not for a while
Zirak, Hveragerði, Iceland
24.4k 10 64 85
ha zirak has a bronze jquery tag
i would be ashamed if I had a jquery tag at all
hi guys.
global_rates.find({
  include: 'masterRates',
  where: {
    typeId: data.typeId
  }
}, function (err, obj) {

  cb(null, obj)
});
i'm using loopback
where clause doesn't filter by typeId
typeId is in the globalRates model
any ideas ?
10:18
@Zirak free me!
Mar 19 at 11:30, by Neoares
/ban Wietlol
hmm...
10:34
you can go back to the java room and use oakbot there
but that wont make me be able to tell kendall he is wrong
you do not need cap for that
true
but then kendall wont believe me
kendall is an atheist.
10:58
@Wietlol prove it
@Wietlol :(
Apr 12 at 15:13, by Neoares
!!forget forget
11:24
@Wietlol why would I ever be wrong
eh kendall, if you are never wrong then you are not human
or a pseudo-trump.
trump is a pseudo-kendall
11:41
he is too stupid for that
that would be an insult for kendall
12:08
@KarelG I disagree
why would you think that?
well, you're familiar with the expression, "we're only human"?
for me, there are two groups of beings: machines and biological creatures. the former does not make errors because it does its actions by instructions. Errors caused by them are results of the mistakes that the creators made when creating such machines. Then the latter, which only survive by learning from mistakes since making mistakes is a part of evolution.
even animals make mistakes
"we tend to make mistakes" doesn't mean "we have to have wrong ideas"
what are you trying to say?
12:19
it's actually quite easy to never be wrong
can a machine ever make a mistake? And if it can't, is it because to do so would make them no longer machine?
do you claim to never be wrong?
you might think that if someone says "trump is a compassionate genius", they're wrong, right?
@GNi33 gosh no
why not?
if it's so easy
@towc well, statistically, saying "I tend to make mistakes" is the same thing as saying "I have and I will make mistakes"
12:20
if I said "there's a chance trump is a compassionate genius", I wouldn't be wrong
So admitting you tend to make mistakes means you can and will be wrong
just saying vague shit doesn't make you "not wrong"
@GNi33 it's easier to just be wrong
> it's actually quite easy to never be wrong
never
I think I never heard a more wrong statement tbh
in a more practical scenario, you might have a bug somewhere, and a dev comes up to you and says "oh, it's because of this function", while instead they could have said "assuming you're doing this for this reason with these environment, it's probably because of this function. It might also be because of these other things we haven't tested in a while, but we haven't had problems with them before"
12:23
you are only seeing from a developer perspective
look at this side: you see a cooking plate. You just removed the cooking pot with boiled potatoes to throw away the water. Would you touch the hot plate now or not?
@towc So you're saying the way to never be wrong is to never claim anything?
You know that it is a good idea to not touch it because you would burn your fingers
@KendallFrey it's an easy way
I don't think so
honestly, I respect people who never claim anything, than ones that do
12:26
because someone has made that mistake to touch it.
People who never claim anything are useless
I prefer to move forward with my life
then ofc there's very closed claims, like "within real numbers, order is defined"
*pre-defined
@KendallFrey the dev in the example didn't claim anything, but was still very helpful
Actually he did
> it's probably because of this function.
12:27
> "oh, it's because of this function"
> It might also be because of these other things we haven't tested in a while
ok ninja'd
> we haven't had problems with them before
three claims
well, I wasn't generic enough on the last one
but if you consider those claims, then no, you can be always right and make claims
how are the first two generic?
12:28
"I can't remember ever having problems with this"
he said "maybe"
@KarelG "probably" and "might"
if you say "it's because of this function", it better be that function or I'm not going to trust you again
that is why people is using maybe ...
@towc If you say "probably X" and X is not probable, you are wrong
you do not know exactly but you think it might cause it
probably is also that kind of verbatism
12:30
@KendallFrey how about "my first guess would be X"
point is, I think you can reach some wording that is really helpful and can't be wrong
Any statement of truth or fact can be wrong
including that one
:^
well, my first guess might not be X, but then your job is to actually what your first guess is
if I say "my first guess would be X" and X would actually be my first guess, then the truthiness of that statement doesn't depend on the truthiness of X
Right, which is why it's less helpful than just stating X
12:33
might be slightly less helpful, but it's more reliable, and makes you not wrong
It's actually not helpful at all without come other factual context that would indicate this person is likely to guess the correct answer.
that's how it should be
@towc There's a motto that goes "I want to believe as many true things and as few false things as possible." And there's a reason it's not just "I want to believe as few false things as possible."
It applies to statements of fact too
where do you use that motto?
What do you mean "use"?
12:36
just curious of a context in which you'd say it
When explaining your epistemology to someone, perhaps.
hmmm
I don't see how you're connecting this to what we're discussing
It applies as well to statements of fact as it does to beliefs
because that is epistemology
better to open a dictionary and search for that word
@KendallFrey I'm lost
12:38
You can easily never be wrong by not believing anything and not stating anything
@KarelG I did. But it didn't make the connection much clearer
But that is not a local maximum of usefulness
@KendallFrey I agree
It's far more useful to believe/state things that you have 99.999999% confidence in
you might be more useful actively lying to everyone too, but I'm not going to do that
12:40
More useful still to include things you have 99.999% confidence in
@KendallFrey that's how we get wrong science/maths
It's also how we get any science and maths.
That's my point
a lot of modern science starts with saying what the assumptions are
What about the confidence in those assumptions?
old science didn't seem to do that, from what I know, and we got that the sun is revolving around earth and that god exists
@KendallFrey you don't need any
12:41
Sure you do
you can make science that doesn't apply to this world, because it has made up assumptions
Plenty of modern scientific assumptions have turned out to be false
it's up to who uses that science to decide how much they trust the assumptions
@KendallFrey and that's completely fine. That's good
@towc The problem is that you can still try to apply it to this world
we might have had a high confidence in them before, and it's good we didn't just state them as fact
12:42
science isn't worth doing unless it applies to our world
@towc What makes you think we didn't?
@KendallFrey if we didn't then it's bad
I don't follow
if a study doesn't state the assumptions, that's a bad thing. If they did, and some of them turn out to be wrong, it means we can immediately identify that the results of that study will also be wrong, then that's good
some people can make a business out of the results of that study
and it means they bet on the assumptions
> if a study doesn't state the assumptions, that's a bad thing.
I don't agree
> we can immediately identify that the results of that study will also be wrong
you should absolutely be doing studies even if you're absolutely sure of the assumptions
12:45
I disagree
ok, sorry, that results will have to be rechecked
It's impractical to state all assumptions of a study or theory
you see, I claimed something, it turned out to be wrong, and it might have confused someone, but if I said "the results have a chance of being wrong", that would have made the discussion much better
@KendallFrey you usually only need to base it on other studies, which themselves include other assumptions, and so on, so you only assume that those studies are correct
I'm mainly thinking of maths
@towc The question is, at what level of confidence is it appropriate to simply state something without the qualifier?
how a theorem assumes another theorem and so on
12:49
@towc maths has significantly fewer assumptions than science, so much so that they're barely comparable
Also, math derives purely from assumptions, science derives from assumptions + hypotheses
@KendallFrey I'd say never, but it really depends on your goals
And I'd say that's impractical
if practicality is a goal, then it's different
What other goal is there?
truth, happiness, love
money
12:51
Are those not practical goals?
I'd think truth is very impractical
being practical means betting on the right assumptions
I guess truth is different, yeah
I think truth is just an intermediate goal though
a goal might be to achieve complete trust
and for that, you can't ever give wrong advice
Only worth having for happiness, love, money, etc.
@towc You're assuming everyone has morbid trust issues
I can trust someone who's made mistakes
but you might trust someone who makes less mistakes more
also, there's very different levels of trust
well, rather than never being wrong, you can try to minimize the amount of times you were wrong, and how wrong you were, and how important the thing was
but if you get something wrong and someone knows about it, you'll lose some trust, and you can't get complete trust
12:58
Does always being right merit complete trust?
can't think of reasons it wouldn't
Oh you're gonna get so fucking scammed
as long as you're confident they also won't be wrong in the future
Do you know Matt Parker/standupmaths?
@KendallFrey examples?
@KendallFrey sure
the psychic pets thing?
a pet might not ever be wrong
but it's because of chance rather than wisdom
12:59
@towc exactly
00:00 - 13:0013:00 - 22:00

« first day (2803 days earlier)      last day (2370 days later) »