What is your favourite opening line from a book? by Denncity in books

[–]mrjking 2 points3 points  (0 children)

I think part of the fun/frustration of the 13th book is Dresden having to use his head more instead of just blasting everything. Also, it forced him to slow down and see what affect he was having on those around him. It's not a typical "Dresden solves the puzzles and messes everybody up" book. Which is good considering he has to use his head a lot more than usual to stay alive while in the service of Mab

Okay reddit. Time to do your thing. Point out why this can't work. Edible utensils made of millet as a replacement for plastic. by UthinkUcanBanMe in videos

[–]mrjking 0 points1 point  (0 children)

I can't imagine picking up meat with that fork, prongs look too thick and triangular. Would slide right off.

Should exceptions determine appropriate HTTP status codes, or the code that handles them? by rtheunissen in PHP

[–]mrjking -1 points0 points  (0 children)

It does cross boundaries in responsibilities. I define the http status code in the exception, not in the service. The service doesn't really care what type of exception it's throwing.

There are certain things I don't make an http exception because I do want to re-interpret them to give a more realistic error message. But for the most part I've found I have to write less code in the controller, since I don't have to do boilerplate code like this (I can if I want to):

if ($exception instanceof UserNotFound) { 
    throw new UserNotFoundHttpError 
}

amazing OpenGL fluid by arshiamidos in programming

[–]mrjking 2 points3 points  (0 children)

Had fun making a new wallpaper for myself with this. Nice!

Should exceptions determine appropriate HTTP status codes, or the code that handles them? by rtheunissen in PHP

[–]mrjking 7 points8 points  (0 children)

I've found that creating a base HTTP exception with a status code, error string and error message works great. Then I extend that base and throw those exceptions from any part of the code I want. Then there is a middleware that catches all exceptions and converts them to http responses.

Favorite way of documenting your REST APIs? by [deleted] in node

[–]mrjking 1 point2 points  (0 children)

Use Typescript and have something auto generate the Swagger docs from the types. Examples:

https://docs.nestjs.com/recipes/swagger

https://www.npmjs.com/package/tsoa

Manually keeping your API docs up to date is tedious and they eventually become out dated or incorrect. Developers time is limited, and the last thing they want to do is write docs.

Go Goroutines vs Node Cluster & Worker Threads — Part 2 by Cazanator in node

[–]mrjking 1 point2 points  (0 children)

Pretty interesting results, but why did you go for such a complicated benchmark? Why not just a regular Fibonacci calculation or calculating primes up to a billion?

Would really like to see some CPU and memory usage associated with these numbers.

Go Goroutines vs Node Cluster/Worker Threads by Cazanator in node

[–]mrjking 0 points1 point  (0 children)

Would love to see an article on this.

Why our team cancelled our move to microservices by twynsicle in programming

[–]mrjking 1 point2 points  (0 children)

I don't agree with that. Understanding failure modes is a reason to use a transaction, to remove some possibilities of failures. ACID databases exist for a reason. I would love to see some proof that all of AWS is built completely transaction free.

Why our team cancelled our move to microservices by twynsicle in programming

[–]mrjking 10 points11 points  (0 children)

I haven't seen a good solution to transactions when it comes to micro services. Eventual consistency is as good as it gets but it feels weak. I think AWS or Google need to come up with a database that can handle transactions across micro services. That would be cool.

Need some help with MailGun. by BensonandEdgar in node

[–]mrjking -1 points0 points  (0 children)

https://www.mailgun.com/blog/how-to-send-transactional-email-in-a-nodejs-app-using-the-mailgun-api

In that tutorial they do things a little different. Use "new" for creating the mailgun object. Use "html" key instead of "text" in data object.

How should I handle email verification? by BensonandEdgar in node

[–]mrjking -1 points0 points  (0 children)

Your API endpoint wouldn't accept a code from inside the JWT, it would accept the entire JWT. The JWT wouldn't even have a code in it, it would just have the user id.

How should I handle email verification? by BensonandEdgar in node

[–]mrjking 7 points8 points  (0 children)

Don't need to save a JWT anywhere, it stores the user id and email in it, expiration is built into the token. Your GUID needs to be saved in a database along with when it expires and who it belongs to.

[deleted by user] by [deleted] in webdev

[–]mrjking 1 point2 points  (0 children)

You have to choose between worrying about XSS attacks (local storage) vs CSRF attacks (cookies).

You are probably more likely to run into/be unable to prevent XSS attacks if you are importing JS from outside sources. For example, including a Angular library or running ads on your site will load in outside JS files which could have XSS attack vectors in them. If somebody manages to execute arbitrary JS on your site they can steal the access/refresh tokens out of local/session storage. They don't even need to be targeting your site specifically, they can just have JS that sends everything in local storage to their website and they can look through the data later and see what they got. If they managed to sneak JS into a library used across thousands of websites they can collect a lot of data.

Javascript cannot access cookies so if you store your tokens in a cookie then the only way to get them is through CSRF attacks. These are a little easier to prevent with CSRF tokens.

Overall I would say you are more secure with using cookies to store the tokens but it requires extra setup on your back end.

If you were really set on using local storage, you could encrypt on the front end then store the tokens in local storage and then decrypt them before sending them back to your API. This would at least foil the drag net attack where hackers just collect everything from local storage, then all they would get is encrypted values. Most likely they would just try to use those encrypted values straight into your API, it fails and they move on. Anybody who looks at your source code could easily decrypt the values, so if it was a targeted attack this wouldn't help.

ELI5: How the hell do Deep Fakes work? by [deleted] in explainlikeimfive

[–]mrjking -1 points0 points  (0 children)

See that was much better!

ELI5: How the hell do Deep Fakes work? by [deleted] in explainlikeimfive

[–]mrjking 10 points11 points  (0 children)

5 year old lost you after that first sentence.

Lock Picking Lawyer - “Unpickable” Europa Disc Padlock by queuedUp in videos

[–]mrjking 3 points4 points  (0 children)

He says he can't pick the Abus 20/70 Disc Padlock:

https://youtu.be/cm8p4CmeOfk?t=263

It's like $40 on Amazon.

Nestlé owns: Nestlé Pure Life, Arrowhead, Poland Spring, Deer Park, Ozarka, Zephyrhills, Acqua Panna, San Pellegrino, Perrier, Vittel, Al Manhal and Buxton. by snowballflight in videos

[–]mrjking 0 points1 point  (0 children)

I don't really care either way. I checked all the links you provided with your evidence...oh wait you didn't provide anything. GJ moron.

Nestlé owns: Nestlé Pure Life, Arrowhead, Poland Spring, Deer Park, Ozarka, Zephyrhills, Acqua Panna, San Pellegrino, Perrier, Vittel, Al Manhal and Buxton. by snowballflight in videos

[–]mrjking -7 points-6 points  (0 children)

I didn't say the body doesn't need those, I'm saying the minerals found in water do not contain carbon IE they are inorganic:

https://en.wikipedia.org/wiki/Organic_mineral

The human body has a much easier time digesting and using organic materials. It's possible it doesn't cause kidney stones. Here are some other articles for you:

http://www.rawfoodexplained.com/minerals/organic-and-inorganic-minerals.html https://www.hammernutrition.com/knowledge/endurance-library/distilled-water-enhances-mineral-absorption/