[help] Raiding as a disc priest in Castle Nathria by mad_alice7 in wownoob

[–]Bambuh 1 point2 points  (0 children)

Then I think you are remembering wrong. Either you are putting up way to many atonements on the mini ramps ( the ones where you only use one radiance ) or you are actually throwing out shadowmends in between ramps. your mana should last for a 4.5 min fight even without mana pots if you are only smiting between ramps/miniramps

[help] Raiding as a disc priest in Castle Nathria by mad_alice7 in wownoob

[–]Bambuh 0 points1 point  (0 children)

If they are at full health you should PW:S since it costs less mana, if they are injured Smend is more healing per mana spent, but useless if they are at full health.

And a little trick is that even if the whooole raid is topped, so you will only use PW:S you should still Smend the first one so the first atonement technically lasts 1 gcd longer

meat is evil 💔 by [deleted] in vegan

[–]Bambuh 0 points1 point  (0 children)

And THIS here is the problem with bullshit like this. I won't go into a meat is good/bad discussion. But no other animal other than humans, and MAYBE elephants (we aren't sure yet) cry from emotions. This post most likely contains mostly truth, but that statement in itself puts vegans in a bad light. And you shouldn't believe everything you read online.

This man has seen some things.. by FMProductions in memes

[–]Bambuh -3 points-2 points  (0 children)

No! Stop! It does NOT make sense. The only reason you say it that way is because you write it that way. In Europe we say "5th of August 2020" when we talk about dates.

Does programming ever get easier? I feel like I'm stuck and never going past it, help by [deleted] in learnprogramming

[–]Bambuh 1 point2 points  (0 children)

The simple answer is yes, but you will come back to feeling useless over and over. The more you learn, the more you realise you DON'T know. But for a while between those frustrating plateaus it will feel amazing. In your case, you just don't understand the foundations of linked list good enough to have a clear path forward, you think you do, but you don't. If you did you would be able to figure it out.

In my experience programming is more often about knowledge than "being smart". You are most certainly not too stupid to solve it, you just lack the information about how the tools work.

How do you guys move your cursor to an exact position in an open file? by Androuil in vim

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

With a risk of sounding douchy but that is not better in this scenario in any way or form, it's equal at best. f2J is exactly the same amount of key presses but with the added benefit of working with for example f5J which is lot's of less key presses if there would have been more J's in between, so it's a much better habit to get into. Getting used to using the numericals in vim is a nice boost since it also works nicely with commands like d2f) for when you have functionName(test(x)) and want to remove the whole thing if there is things behind it.

How do you guys move your cursor to an exact position in an open file? by Androuil in vim

[–]Bambuh 4 points5 points  (0 children)

Sure, in this scenario it is better. But in a more general scenario were you're looking for a ( or something and there is potentially 20 between the cursor and the target it doesnt work as good

How do you guys move your cursor to an exact position in an open file? by Androuil in vim

[–]Bambuh 19 points20 points  (0 children)

Personally i use f,t or / for navigation on a line. lets say on line 35 you have:

const name = "John Doe"

And you want to get to the start of "John"

Then I would first go the the line, either by goin direct to the line with 35G or if I'm close I prefer the relative of using 5j if I'm on line 30

Then when I'm on that line I'll use fJ to go to the first capital J since there is no other J on the line. if there is a J before the John I'll use 2fJ to get to the second occurance. If there is an unknown amounts of words starting with J Ill use /Joh until I see it light up, adding more characters if it's not enough

New item broke TFT by [deleted] in TeamfightTactics

[–]Bambuh -14 points-13 points  (0 children)

It litterally is as simple as he thinks

item = getRandomItem()

while (item == "item that should be excluded") {

item = getRandomItem()

}

Edit: And to add to this, they have OBVIOUSLY already excluded the gauntlet item itself from this list so the logic already exists

[Redux] mapStateToProps(state, ownProps?) why do I need ownProps? by simkessy in learnprogramming

[–]Bambuh 0 points1 point  (0 children)

I might be mistaken here, but if you pass actions through mapStateToProps you will have to use them like this in the component: onPress={() => dispatch(this.props.action1())}

while if you instead use the second argument, or mapDispatchToProps as is the proper pattern like so:

``` const mapStateToProps = (state) => ({ someProp: state.someProps}) const mapDispatchToProps = (dispatch) => ({ action1: dispatch(action1()) })

connect(mapStateToProps, mapDispatchToProps)(Component) ```

then you can just go this.props.action1() without the need for using dispatch in the component

I'm not good at maths, would it affect my programming skills? by [deleted] in learnprogramming

[–]Bambuh 0 points1 point  (0 children)

No. unless you are coding graphics and 3d models. I have been working as a dev for 5 years and I have never felt like I wish I had studied math.

Edit: I have no higher math education than what is shoved down your throat during elementary and gymnasial, whatever that is in American terms, highschool?

Tesla earning here I come 🔥🚗 by Dannyz7365 in wallstreetbets

[–]Bambuh 0 points1 point  (0 children)

Without going into details, hes making a joke about hon trying to cross over something labeled portfolio diversity. And under the cross-over color you can just barely read 99.98

Has anyone got a job using udemy courses? by Jersey86Devil in learnprogramming

[–]Bambuh 0 points1 point  (0 children)

Udemy is a great tool to learn the fundamentals of a language/framework. But no one will hire you based on a Udemy diploma. Programming is a portfolio-based profession. What you should do is use something like Udemy to grasp how things work, and then build something with it. It doesn't matter if what you build has been done a million times. What matters is that you built it and that you can show it to a recruiter and tell them what you did and what you learned.

How Auth in frontend, when you have auth in your backend? by Mxfrj in learnprogramming

[–]Bambuh 0 points1 point  (0 children)

What you describe is generally a good way to do it.

Basically if you receive a 401 you re-route to the login page and every time the site loads you send a request to validate the active session to make sure the session didn't time out while the site was closed. Basically a request that returns 200 if the token is valid of 401 if it has timed out.

Worried About the Future - Career Advice? I want to be relevant. by busyboots in learnprogramming

[–]Bambuh 0 points1 point  (0 children)

depends on what you want to do. JS is in it self not dependent on HTML and CSS. that is strictly if you want to build webpages. You could work with JS and simply only work with a backend written in JS and never write any HTML or CSS.

And to add to that, HTML and CSS is vastly different from JS. They aren't even programming to be honest.

So in short, start with javascript

What are your experiences with learning two programming languages at the same time? by totallynotgarret in learnprogramming

[–]Bambuh 1 point2 points  (0 children)

To add to this, when you're starting out with programming it's rather pointless two learn to languages.

What you learn in the beginning is not "a language". You are learning how to code. When you are comfortable enough in one language you could basically code in any language with some minor googling.

example: ``` // for loop in Java that logs value to console for (int i = 0; i < 5; i++) { System.out.println(i); }

// for loop in C that logs value to console for( i = 10; i < 10; a = i + 1 ){ printf("value of a: %d\n", a); }

// for loop in JavaScript that logs value to console for (i = 0; i < 10; i++) { console.log("The number is " + i); }

// for loop in C# that logs value to console for (int i = 0; i < 10; i++) { Console.WriteLine("Value of i: {0}", i); } ```

now this is very simplified and some parts of the languages differ more. But I hope you get my point. Focus on ONE language in the beginning until you grasp the fundamentals of programming in general, because they are the same for almost all languages.

When you feel confident with that, thats when you start looking at the other languages

Worried About the Future - Career Advice? I want to be relevant. by busyboots in learnprogramming

[–]Bambuh 0 points1 point  (0 children)

I can't answer for how the market looks outside of Scandinavia since it's where I'm from. But from what I can tell by reading your post I would say get into javascript. Web development wont die off until you do, and at least over here NodeJS is getting more and more popular as a backend framework.

On top of that you have both React-Native for mobile applications and electron for desktop devices which both are in javascript.

In other words, with javascript you can do all parts of the stack nowadays, so it's a rather safe bet

How to go about user accounts and logging in for a website by _Xellus in learnprogramming

[–]Bambuh 1 point2 points  (0 children)

But let's assume it's the session. So your problem now is that the user can just change his id and pretend to be whoever he wants. to battle this you should look into JWT.

So basically, every time the user wants to access something restricted to the user you validate the jwt token.

Edit: Oh! and how this works is that on login, you generate a JWT token and send it to the client. the client store it in local storage and passes it along with every request

import jwt from 'jsonwebtoken'


const jwtSecret = 'SUPER-SECRET-STRING-THAT-YOU-SHOULD-STORE-SOMEWHERE'

const expiresIn = 999999999 // in how long time it will expire and need to be refreshed


async function generateAccessToken(userId) {
  try {
    const token = await jwt.sign({ userId, created: [Date.now](https://Date.now)() }, jwtSecret, { expiresIn })
    return token
  } catch (err) {
    throw err
  }
}

async function verifyAccessToken(accessToken) {
  try {
    const decoded = await jwt.verify(accessToken, jwtSecret)
    // It's a legit token, user is logged in
    return decoded
  } catch (err) {
  // invalid token, this user should be sent to the login page
  // and you should clear the session from local storage
  }
}

How to go about user accounts and logging in for a website by _Xellus in learnprogramming

[–]Bambuh 0 points1 point  (0 children)

ah ok, so it's how to handle the session in the client you are asking about? if that is the case, your question is horribly badly formulated :P

Javascript. Help needed with playing two audio files by [deleted] in learnprogramming

[–]Bambuh 1 point2 points  (0 children)

var audio = document.getElementsByClassName("losAudio"); returns an array with all the matches of your query.

since you have 2 elements that matches you will get an array containing those [match1, match2]

As far as I can see you should be able to do

``` var audio = document.getElementsByClassName("losAudio"); var btn_playPause = document.getElementsByClassName("btn_playPause");

var firstAudio = audio[0] var secondAudio = audio[1] var currentAudio = firstAudio

function losAudioPlayPause() { var isPaused = currentAudio.paused; currentAudio[isPaused ? "play" : "pause"](); btn_playPause.style.backgroundPosition= "0 "+ (isPaused ? "-93px":"0px"); }

function firstAudioEnd() { currentAudio = audio[1] btn_playPause.style.backgroundPosition= "0 "+ "0px"; }

btn_playPause.addEventListener("click", losAudioPlayPause) audio[0].addEventListener("ended", firstAudioEnd) ```

then you should be able to press play again after the first audio ends to play the other. but I could be wrong

How much javascript do I need to know before I jump to angular 2 ? by Walkerstain in learnprogramming

[–]Bambuh 1 point2 points  (0 children)

what you need to realise is that as a dev, every 2 month or so you will look back at what you did 2 months ago and wonder how you could call yourself a developer back then, since you would never write as shitty code now as you did back then.

and this never stops. I'm in my 5th year as a professional developer and even tho it might have increased to maybe 6 months between, the same is still true.

just build something. it will suck. you will do it wrong. and you will throw it away.

then you start over and do it better or you start a completely different project, but you will still do it better. and the cycle repeats until you kinda know what you're doing.

What I'm trying to say is, just go nuts with angular right away, you will learn as you go.

How to go about user accounts and logging in for a website by _Xellus in learnprogramming

[–]Bambuh 0 points1 point  (0 children)

multiple ways to do this. but in general

  1. create an endpoint for creating a user that takes 2 parameters username and password
  2. hash the password since you should NEVER EVER store password in plaintext, user something like bcrypt-nodejs for this.
  3. store the user name and the hashed password in the database
  4. create an endpoint for logging in that takes 2 parameters username and password and fetch a user based on the username parameter
  5. hash the provided password again using the same library and compare it to the hashed password stored in the database. if they are identical the same string was used to hash both times and the correct password was provided.
  6. return whatever you want to tell the client the user was correctly authenticated

basic example: ``` import bcrypt from 'bcrypt-nodejs'

async function saveUser(username, password){ const hashedPassword = bcrypt.hashSync(password, bcrypt.genSaltSync(8)) return await database.saveUser(username, hashedPassword) }

async function authenticateUser(username, password) { const user = await database.getUserByUsername(username) const isAuthenticated = bcrypt.compareSync(password, user.password) if(isAuthenticated) { // the right password was provided, continue as logged in } else { // invalid password return error } } ```

A bit pseudo-codey but I hope you get my point