« first day (2852 days earlier)      last day (2321 days later) » 

00:37
ProTip to All Managers Here: Whatever you are making your highly trained people log manually can in 99.9% case can be automated with better results, or is not even needed. Please treat your peoples time as you'd treat requesting the CFO for a blank check (cheque) to acquire an extremely expensive new vendor.
01:10
Can I get some regex help
!!welcome @ManishGiri
@@ManishGiri 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.
@ShrekOverflow @CapricaSix ty
I have this regex using which I'm trying to match numbers (including negatives and decimals) in a given string
function isDigit(s) {
  return /^-?\d+\.(?=\d+)\d*$/.test(s.trim());
}
but it fails for -0, most likely because the positive lookahead expects a . (followed by more numbers)
I was thinking if there's no ., it should be fine
01:42
@towc maybe your sort of thing
@ManishGiri /\-?\d+\.?(\d+)?/
02:56
VSCode went nuts and replaxced all my imports with - import NavItem from "../../../../Library/Caches/typescript/2.9/node_modules/@types/react-bootstrap/l‌​ib/NavItem";
as in added the ../../../../Library/Caches/typescript/2.9/node_modules/@types part
03:47
how helpful
 
2 hours later…
06:00
I am currently using something ugly like this to get any remaining props that are not otherwise related to my component to pass them to the child: const {images, onImagePress, containerStyle, onLongImagePress, ...restProps} = this.props; and then use {...restProps} on one of the child components (eg an Image). Is there a cleaner way to do that?
Anyone feel like stopping by the html room? I've got a real stumper in there.
Request cross-posted in the Java room as well.
Yes I did. Sorry, is that against the rules?
It is discouraged, yes.
I see. So what is the correct action to take when the correct room is empty?
Trying to do the right thing
06:06
Ask a question on the main site, for example :)
The main site has a room?
Nej but the main site has an "Ask new question" button
Oh, that one
I got one too many down votes which got me a 6 month ban. Wasn't malicious, I'm just genuinely bad at asking questions that fit the rules.
Taking a look at that question, chances are that there is something about that already. I would be very surprised if noone else hit that same issue before and asked about it.
I've been googling it for a while now
I've found similar questions and I've read the solutions
But none so far have worked for me
Yet
06:10
Something like "css prevent div stretch" might get you some results.
It's more complex than that. The first div is the container. The second div shares the width with another item and has to stretch to fill the remaining space. The item inside the second div needs to fill that div.

If I stop the second div from stretching, it will lose the correct behaviour.
Thanks for trying anyway. Points for effort.
Rob
Rob
@JonathonPhilipChambers Your account doesn't look like it's blocked from asking questions, but.. it's likely to be very close
If you do ask that question, you might have luck if you're able to provide a working demonstration of the problem with the snippets
Ha! The block has been lifted
Thanks rob. Will add snippets. Any other advice?
I genuinely want to ask a good question. I just lack the skill, not the intent
Rob
Rob
The most important thing, I think, is providing a small amount of code that people can copy & paste to reproduce your issue (or using the snippets to run in their browser). Also, if possible, showing any other research/links to similar issues is usually well received
Other than that.. there's no hard and fast rule, as people are free to vote as they wish
But if you provide a clear explanation of 1) What you want to happen, 2) What is actually happening, and 3) All the relevant code - you should do okay.
I'll also make sure I run my code snippet before sending it. Make sure it too contains the error of my main project.
06:30
there is a built-in tool to have an interactive code that acts like jsfiddle. Click on that "add snippet" button or do Ctrl+M
nice, I'll try that
Hello Guys,

Any postman user here
Need one help regarding the same ... know its bit off topic
Postman (API testing tool)
Rob
Rob
07:03
@JonathonPhilipChambers Well, there you go. Question looks like it was pretty well received :)
Thanks rob
I'll keep your edit in mind next time
Rob
Rob
No problem. We just generally keep that kind of stuff out of the questions as it's a bit unrelated. And.. despite asking for leniency with voting, it usually has the opposite effect on people
we are negatives. We only know the !. So a vote request leads to ! request vote which is equal to down vote. Yeeeaaah
Ah, good thing you saw it first then
I wonder if anyone has ever asked for down votes to exploit this
or is it the absolute value multiplied by the negative?
It got the right answer pretty quick! And some, well, other answers too.
The first question I ever asked here was my most popular. So I got cocky and asked a whole heap of shitty ones after.
More accurately, my first one should have been shitty too. It was pure luck that it turned out good.
Any help guys ?
:-(
07:16
sorry jamesorc, the only postman I know drives a motor cycle, so I don't think I'll be any help
My reputation doubled today! Yay!
@KarelG Please give me downvotes.
hahaha (y) NO issues :-P
@geisterfurz007 ! please give me downvotes equals to "fuck give me downvotes".
no. You are not honest.
<link rel="stylesheet" href="tapmodo-Jcrop-1902fbc/css/jquery.Jcrop.css" type="text/css" />

<script src="tapmodo-Jcrop-1902fbc/js/jquery.Jcrop.js"></script>
<script>
$(document).ready(function(){
$('#img-to-be-cropped').Jcrop();
});
</script>

I am using this code in two different pages, placed at the same directory, it works in one page fine but in the other it says jcrop is not defined. what can be the issue
@KarelG Ah, dangit.
07:22
I'm honestly surprised no one found a duplicate of my question. I mean I couldn't either, but I rarely can.
azam khan, sadly if the pages are the same, they should get the same result. If I were you, I'd start with the working page, keep editing it to look like the other page until it breaks. If it never breaks, that is your new page. Delete the old page.
But chances are, you've got a punctuation mark out of place somewhere
Keep in mind, when referencing something else via directory, you need to account which directory you are in currently. So what works in one folder may not work in another folder
@JonathonPhilipChambers I have just copied and pasted the same code ..
are both files in the same folder?
What happens if you copy and paste the entire page?
no i mean I copy and paste the links and script
not the entire page.
07:29
Exactly. So the problem is not inside the links and the script. The problem is outside it.
It works on one page, it doesn't work on the other page. It's time to play the game "spot the difference"
I would copy the entire page that works, then try to break it so it stops working
Once I broke it, I'll know what happened
I can unbreak it for the other page
ok.. I have tried copying the page in steps.. its lengthy php page
Yup, welcome to troubleshooting
lets see where the problem is.. this will take a while
That's why people pay programmers big bucks
Look above the working code. Code has a tendency to hurt the code below it.
@azamkhan seems a weird error. Can you copy/paste the error message here?
the wording of it is just ... not familiar
07:34
profile.php?userid=8โ€ฆ0da-c8a5f0d55c2f:17 Uncaught TypeError: $(...).Jcrop is not a function
at HTMLDocument.<anonymous> (profile.php?userid=8โ€ฆ0da-c8a5f0d55c2f:17)
at j (VM2794 jquery.min.js:2)
at Object.fireWith [as resolveWith] (VM2794 jquery.min.js:2)
at Function.ready (VM2794 jquery.min.js:2)
at HTMLDocument.I (VM2794 jquery.min.js:2)
(anonymous) @ profile.php?userid=8โ€ฆ0da-c8a5f0d55c2f:17
j @ VM2794 jquery.min.js:2
fireWith @ VM2794 jquery.min.js:2
ready @ VM2794 jquery.min.js:2
I @ VM2794 jquery.min.js:2
@karelG
there is no image element with id img-to-be-cropped in your html
so check the ID and if it is present in your html
How does one import the ´catch´ from RXJS nowadays? I know it changed the import, but upon updating the ´catch´ does not exist, only catcherror. Catcherror keeps saying that the property does not exist on the observable
import { catchError } from 'rxjs/operators';
import { Observable } from 'rxjs';

deletePosts(id) {
    return this.http.delete(this.url + '/' + id)
    .catchError((error: Response) => {

    });
  }
@KarelG @JonathonPhilipChambers .. it was caused by double inclusion of jquery library via header include file..
Thanks for helping me out
07:56
@azamkhan "Spot the difference" is a really annoying game to play, but I'm glad you won it.
Found it myself. For those who want to know, you have to pipe it in rxjs 5.5+
yes.. it gets way too messy when the php page gets too long and inclusion of multiple files
08:08
!!summon 7
Uhhhh
I need an adult
How about a childish 25 year old?
mhmm ?
god. That seems a confirmation on what you said ben
*shakes fist*
I'll take what I can get
you got bot banned. So no
Cap isnt in this room either...what's going on guys...
08:13
rlemon's pc might be offline
squiggs?
@Squirrelkiller
@Squirrelkiller You don't need her, she's better off with out you
Squiggle is not here
@rlemon cap's master controller (pc) got offline
Can you pm me the slack link again?
I lost it
08:15
Plz halp mr rlemon
Cap is on slack too?
I'm not sure
Haven't been on slack since my laptop broke down and I forgot which email was attached to that workspace :/
@ShrekOverflow Maybe you should take the hint.
dayum
@jamesorc don't ask to ask, just ask
And I know a bit of postman, so shoot
Wes
Wes
08:48
i heard caprica is gone
Wes
Wes
she's gone... except for gaius baltar obviously
09:00
Hmm? Where's caprica actually?
@rlemon
already have pinged him. I think that the pc is offline or shut down
or browser crashes ;o
She's having a well earned rest
Can someone tell me if my block of code is completely async? Thanks in advance.
const user_reset = (request, response) => {
  const { token } = request.params;
  const pw = Math.random().toString(36).slice(2, 10);

  jwt.verify(token, secret, (err, t) => {
    if (err) return response.status(404).send({ error: 'invalid request' });

    User.findByIdAndUpdate(t._id, { $set: { password: pw } })
      .then((u) => {
        const mailOptions = {
          from: username,
          to: u.email,
          subject: 'Password Reset',
          text: `Your password has been reset as requested. You should now use the password ${pw} to login.`,
You'll get a headers already sent error if your sendMail function returns an error
How come?
09:06
@Andrรฉ Because the 500 response is in a callback
Because you'll be sending a 500 response aswell as a 200 response
:For this reason, once you "uplift" one part of your code to Promises, you should "uplift" anything that touches that code, so that the flow is controlled by Promises, and not mixed.
We do have a .callbackify method for "other way interop" by the way
@BenjaminGruenbaum There's no util.promisifyAll yet, right?
For easily promisifying transporter.sendMail and jwt.verify?
I mean, you could just use util.promisify() and .bind(), but that's meh
Also that password reset method is highly insecure
You should never send passwords via email
09:11
It is not sending via e-mail.
It sends a link with a jwt token to the e-mail.
Oh wait, yes, it is.
@BenFortune Eh, if it's a temporary password, it's OK
After all, a reset token is equivalent to a one-time password in that fashion.
Yeah, it's a temporary and it only triggers once you click the link with the jwt token.
@Andrรฉ What you should probably do is make a password reset token, and send that
I didn't really get what you tried to explain @MadaraUchiha, will it trigger both 500 and 200 even though I'm returning the 500?
When the user accesses the token from their email, you allow them to pick a password.
@Andrรฉ Yes, it will trigger the 200 first, then if the email sending fails, it will try to trigger 500, but you'll get an error saying you've already sent the headers.
Because it's a callback.
setTimeout(function() { return console.log(42); }, 0);

console.log(43);
Logs 43 then 42.
Even though you return inside of the callback.
09:16
@MadaraUchiha no, I don't think that ever got traction
perhaps moving the 200 inside the callback would do the job as well since I want to send the 200 if everything goes well?
Does the user need to know if there's an email sending error?
I'd log that internally
though I suppose if they're expecting it
const passwordReset = async (request, response) => {
  const { token } = request.params;
  const pw = Math.random().toString(36).slice(2, 10);

  try {
    t = await util.promisify(cb => jwt.verify(token, secret, cb));
    let u = await User.findByIdAndUpdate(t._id, { $set: { password: pw } }); // please god don't set passwords to Math.random() in production and use crypto
    const mailOptions = {
      from: username,
      to: u.email,
      subject: 'Password Reset',
      text: `Your password has been reset as requested. You should now use the password ${pw} to login.`,
@André
Thank you Benjamin and I'll do even though those passwords are temporary. I'm using crypto when storing them on the database.
09:33
@KendallFrey those dums dums! that's not a circle!
@BenFortune whistles unsuspeciously
@towc that radix LSD in-place sort is surely LSD worthy
09:50
@BenjaminGruenbaum Oh god it was you wasn't it
@BenFortune well, I proposed it and specified the api, refack wrote the code :D
@KarelG that's the backport, but close enough
you can follow the PR to go to the discussion thread
I like that each thread (let it be PR, issue, thread) has references/commits to each other
the CRM of my company has a GH repo but no commits gets refs to issue, issue became "solved" while there is no commit added ect
that was a nightmare once I discovered that when my team took it over
what is the terminology for "timed storage"?
(eg storing in session/cookie/cache)
temporal storage?
Is it possible to debug the written JS of a React Native app in the sense of me setting a breakpoint somewhere and then running it step by step to see where it fails?
I cannot even seem to find the JS files in the React Native Debugger and I guess that is because RN bundles the JS but I would be super happy if I could see what is going on in my code :D
Oh nvm! I found it. I am dumb :)
10:15
@BenjaminGruenbaum I've read that try catch isn't a very good practice with async await. Is it true or not?
Not at all
It's the recommended way to catch errors.
also, why this t = await util.promisify(cb => jwt.verify(token, secret, cb)); instead of t = await jwt.verify(token, secret); ?
10:32
you can only do await on a promise
jwt.verify does not return a promise. Or it does. You have to check the docs. If it does not, you can make it returning a promise by calling util.promisify
if you use await on a function that does not return with a promise, you get the return value of that function immediately. It does not wait when the callback is being handled. So your code could call User.findByIdAndUpdate before the jwt.verify(token, secret, cb) is done with its tasks
I could only make it work by removing both util.promisify.
const user_reset = async (request, response) => {
  const { token } = request.params;
  const pw = Math.random().toString(36).slice(2, 10);
  try {
    const t = await jwt.verify(token, secret);
    const user = await User.findByIdAndUpdate(t._id, { $set: { password: pw } });
    const mailOptions = {
      from: username,
      to: user.email,
      subject: 'Password Reset',
      text: `Your password has been reset as requested. You should now use the password ${pw} to login.`,
    };
    await transporter.sendMail(mailOptions);
Both util.promisify were stopping the code from working.
jwt.verify needs a callback to be async though
or does await already do that?
10:50
what await does is "wait when this promise is pending (doing processing) until it reaches the fulfilled/rejected state". You need to comprehend how Promise works to grasp the functionality of await. Using await on a regular function (eg that does a timeout) does not wait.
I have checked the docs of jwt on node.js
since you were not using a callback, the function operates in synchronous mode
I see, thank you for explaning. Using it with callback and using util.promisify isn't working though.
@Andrรฉ ?
Yes?
11:10
What is "THE GAME!" under the rules?
I just realized that maybe I just lost it....
@BenjaminGruenbaum the code you sent me isn't working. I suspect that it something related to util.promisify, I've tried tuning it but I'm doing it synchronously by not calling util.promisify().
@Andrรฉ I wrote it in chat, I didn't test it obviously :D
I know but do you know what could possibly be wrong?
Are there any errors?
it goes directly to the catch and it's completely empty.
11:28
@Andrรฉ add console.error(e) in the catch block
Thanks, @MadaraUchiha
TypeError: Cannot read property 'email' of null
Well then, there you go.
user is null
please be welcoming to user. User, don't listen to madara's negative comments
Thing is, the user isn't null. That's something I'm sure of.
The token payload carries the userid and that userid is correct since I just generated it.
@Maartenw Thanks for responding
I just wanted to know if we can do addition of variables in Postman.

For example I have a global variable "a" already having value 0
when I try and do this var x = a+1 and then again set the value of "x" to gobal vairable it simply has the value as 01 but the desired one should be 0+1 that is only 1
it simple
11:37
@Andrรฉ Errors don't lie.
Use a debugger and step through the code, or add console.log() calls as needed to see what the values are.
As I call t(), it gives me a promise with the payload.
It is not being able to get the _id value inside the payload.
@Andrรฉ t()?
t isn't a function
Well, it is showing as a function.
I found it odd as well.
What is jwt? Where does it come from?
jwt is jsonwebtoken, it is a module.
11:44
@Andrรฉ When called without a callback, jwt.verify() is synchronous
const t = await util.promisify(cb => jwt.verify(token, secret, cb));
I'm calling it asynchronously.
@Andrรฉ That's not the code you posted
    const t = await jwt.verify(token, secret);
Also, util.promisify() does not return a Promise
It returns a function (which when called, will return a Promise)
So don't await on that.
I made those changes when I thought that the problems was with util but unfortunately that makes the code synchronous, which isn't really what I'm looking for here.
@MadaraUchiha So you would have to await util.promisify()()?
@geisterfurz007 Correct
11:51
That looks rather counter-intuitive... Thanks!
How would I keep that code asynchronous then, @MadaraUchiha? Sorry for the overload of questions, I'm in js/node for 3 weeks max and some concepts are still very raw.
const { promisify } = require('util');

const verifyAsync = promisify(jwt.verify);

const user_reset = async (request, response) => {
  const { token } = request.params;
  const pw = Math.random().toString(36).slice(2, 10);
  try {
    const jwtPayload = await verifyAsync(token, secret);
    const user = await User.findByIdAndUpdate(jwtPayload._id, { $set: { password: pw } });
    const mailOptions = {
      from: username,
      to: user.email,
      subject: 'Password Reset',
      text: `Your password has been reset as requested. You should now use the password ${pw} to login.`,
Something like that, I think
@geisterfurz007 make sure you actually understand how and why it works
@Andrรฉ start with reading stackoverflow.com/questions/14220321/… and then work through some async/await tutorials
Definitely worth your time
@geisterfurz007 Try to write a simple promisify function yourself
Oh, I have absolutely no experience in that stuff and I am sure it wouldn't look like that if it was possible to get around it! I just wanted to mention it ^^
11:54
The requirements: Takes any function whose last argument is a callback of the form of (error, value) => void, and returns a function that takes the same arguments, except the callback, and returns a Promise for value
I was avoiding async/await for now, my entire project is written with promises but since your code was await/async, I googled for some information.
@Andrรฉ async await is so nice, it's definitely worth learning
hiho guys, do you know how i can tell my video with js: when the video lags(needs to load) it should show a loadingcircle or something similair.
Newb question: I want to allow touching anywhere on the screen to cancel a selection mode. I wrapped the whole view with a TouchableWithoutFeedback however the onPress method is not called (I put a console.error there). I did bind it to this and I cannot figure out why that method is not called. Any ideas?
Closing my question as exact duplicate of: github.com/facebook/react-native/issues/10180
12:20
So basically I can only use await on Promises so in order to use await on both jwt.verify and transporter.sendMail, I need to turn them into promises first with promisify (since both of them respect the error-first callback rule of node), right?
@BenjaminGruenbaum no clue, pc was off when I got to work
aaaand that's not good.
yea, she's not coming back any time today (probably)
12:36
@rlemon Oh goody
oh no, cap is blackscreen
there's a chance it's just a loose connector
this pc gets abused
(for your computer, I do get that cap can just run whenever by running her on another computer)
12:37
I had the same issue when I connected a new HDD and my UEFI thought it would be a great idea to try and use that as boot device instead of the SSD that worked perfectly fine before that.
@Delidragon clappr, most likely
@Andrรฉ right
obligatory rant about server-side cap
@rlemon what are her spec's ?
@MadaraUchiha hasn't cap been server-side for a while now?
@MadaraUchiha afaik ben was working on it
12:41
@BenjaminGruenbaum No
it's been worked on dozens of times by like a dozen people
it never goes anywhere
@KarelG was being the key word here, I think it's not under active development
you need time for that
damn keyboard latency copying too slow
12:41
when you type so fast that 4ms is not enough
I barely have that. Benjamin appears to have more time than I do ._.
he contributes to a lot OSS projects
@benjamin you mean this: github.com/clappr/clappr ?
@MadaraUchiha or you just have a shitty keyboard :D
@KarelG no I'm just loud lol
@KarelG Benji simply has an internal clock tick speed approx 5 times faster than the rest of us.
@Delidragon yeah, it's probably my go to
12:42
ha that is possible
@MadaraUchiha hey! I told you I poop a lot in confidence!
his cmos died, it's forever 1990 for him
but that means that he ages faster than we do ? :O
thx i try it
@KarelG No, it just means that he experiences the world in slow motion
12:43
isn't that the booze
he is pretty resistant to such things if he is capable to write nice code while being on booze then
that is literally what he does
resisting pain of huge brainstorms plaguing his mind and the heat generated when typing on the keyboard ๐Ÿ˜‰
@KarelG I think that your and my definition of "nice code" is differs vastly. >:)
you are in strict mode. I am kinda lenient on that
12:46
Ha! Never thought of it like that. That's a fairly apt description.
although ... towc's code sometimes shiver me
2
๐Ÿ˜ฌ
13:01
fixed
13:12
rlemon, is there a means to track if a user is bot banned or not?
that squirrel dude was here again trying to spawn cap and teaching a command (see sandbox)
IIRC he is bot banned but it could be that it got lifted
there is 5 squirrels
at least
squirrel in training, captain squirrel, squirrel killer, squirrel and some other
@KarelG are you basing that on any facts?
I'm open to criticisms
sure. Those that you have posted here and where we did comment about your coding style/behavior
or did you forgot those already? :o
question
why is there any reason to use strict mode in JS? Whats the advantage?
13:28
What would I do if I wanted to have a View in React Native that overlays an Image which when selected turns white-ish? I tried backgroundColor: 'white' and a variable opacity based on the select state of the component but I don't see any changes.
the mdn docs about use strict should give you an overview of advantages/disadvantages of that mode. Here developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/…
@KarelG thx
Ah, rubbish. I think I can just use opacity on the image and let the background shine through.
Yeah.
@geisterfurz007 you can do it all single element with a background image
.img {
  background: white;
  .. other shit
}
.img::after {
  background: url(img.png);
  opacity: 0.314;
  // other shit
}
That doesn't work in ReactNative though I think (I haven't seen pseudoclasses there)
13:40
Hi. I'm not bot banned, I use her regularly, for things she was made to do like holding my afk status and insulting Wietlol. Thanks Mr rlemon!
Hah! I love the last part :D
posted on August 07, 2018 by Mathias Bynens

Every six weeks, we create a new branch of V8 as part of our release process. Each version is branched from V8โ€™s Git master immediately before a Chrome Beta milestone. Today weโ€™re pleased to announce our newest branch, V8 version 6.9, which is in beta until its release in coordination with Chrome 69 Stable in several weeks. V8 v6.9 is filled with all sorts of developer-facing goodies. This post

@geisterfurz007 I don't see why not. it's not a new feature
I have no idea what engine React Native uses, but I'd be willing to bet it does work
You pass an Object into StyleSheet.create() :/
okay
that doesn't mean it isn't possible.
13:48
Anyway, I got it working by letting the background shine through (I tried that before but didn't use enough opacity so I though it wouldn't do what I wanted)
@MadaraUchiha @BenjaminGruenbaum I posted a question after working on my code with what we discussed here, you might find it interesting to take a look. stackoverflow.com/questions/51728542/…
you're awaiting the .promisify call
not the async function you're promisifying
those snippets don't do the same thing
await whatever.sendMail() // awaits the result of sendMail()

await util.promisify(a => someShit(a)); // awaits the promisify call, which is returning the new async function. it isn't calling that function.

« first day (2852 days earlier)      last day (2321 days later) »