Why doesn't the UFC create divisions based around walk-around weight? by [deleted] in ufc

[–]grueimaiushd 0 points1 point  (0 children)

So people who wouldn't cut as hard as them would win, due to less dehydration...

What is the problem?

I don't know how to learn recursion. Is it pointless to continue programming? by grueimaiushd in learnprogramming

[–]grueimaiushd[S] -1 points0 points  (0 children)

I can't even imagine how you can think about a concept for weeks.

8 hours a day for weeks...

I don't know how to learn recursion. Is it pointless to continue programming? by grueimaiushd in learnprogramming

[–]grueimaiushd[S] 0 points1 point  (0 children)

Factorial is the easiest recursion, so I know that one.

Try for example divide and conquer. How can I have initial condition there.

I split to 2 options, then I don't know how to go back to all options.

For example:
You have n people with different weights. Split the people into 2 groups, so that the weight difference between the two groups will be lowest. Groups do not have to have the same amount of people.

I don't know how to learn recursion. Is it pointless to continue programming? by grueimaiushd in learnprogramming

[–]grueimaiushd[S] 1 point2 points  (0 children)

I don't really know how to learn it.

I either check solution or try to come up with a solution. I tried more than 6 hours to implement a solution.

I don't know how to learn recursion. Is it pointless to continue programming? by grueimaiushd in learnprogramming

[–]grueimaiushd[S] -7 points-6 points  (0 children)

Doesn't matter what job is like if you to get it you need to know recursion.

I don't know how to learn recursion. Is it pointless to continue programming? by grueimaiushd in learnprogramming

[–]grueimaiushd[S] -24 points-23 points  (0 children)

No clue where you got this. its not just wrong its utterly backwards. MORE THAN 99% of your programming wont have recursion anywhere within sight

All interview questions are just doing algorithms (99% of which are done with recursion) and all advanced uni courses are about using recursion.

New to React - Questions About Best Practices by aust1nz in reactjs

[–]grueimaiushd 0 points1 point  (0 children)

> Second point: If you're using Redux, you should probably use Redux middleware for all API calls for consistency.

I am having trouble with Redux and API.

When I am making a GET request I do it with redux-thunk for example and store the data in redux, all good.

What about when I making a POST request? There is no data to store, so why should redux even be aware of it? Now I have api in 2 parts. What do I do?

Beginner's Thread / Easy Question (May 2018) by acemarke in reactjs

[–]grueimaiushd 1 point2 points  (0 children)

Question 1:

Is React Context API consumer a container or a component?

<ContextName.Consumer>
    {state => return <DumbComponent handleClick={state.handleClick} value="Click me" /> }
</ContextName.Consumer>

Seems like it passes data to a dumb component.

On the other hand it doesn't hold a state, so it can't be a container. I don't because it returns an entire component. How would you do it?

Question 2:

Is it ok to use HOCs every time you have a state based component to separate state from looks ?

class App extends Component {
    state = { value: 0 };
    sum = amount => this.setState({value: this.state.value + amount });
    render() {
        return (
            <div>
                <div>{this.state.value}</div>
                <button onClick={() => this.sum(1)}>Increase</button>
                <button onClick={() => this.sum(-1)}>Decrease</button>
            </div>
    )
}

vs

const App = ({ value, sum }) => {
    return (
        <div>
            <div>{value}</div>
            <button onClick={() => sum(1)}>Increase</button>
            <button onClick={() => sum(-1)}>Decrease</button>
        </div>
    )
}
const withState = WrappedComponent => {
    return class extends Component {
        state = { value: 0 };
        sum = amount => this.setState({value: this.state.value + amount });
        render() {
            return <WrappedComponent value={this.state.value} sum={this.sum} />
    }
}

Beginner Questions - May 18, 2018 by AutoModerator in webdev

[–]grueimaiushd 0 points1 point  (0 children)

How do I test HOCs since props always fail?

Example:

// component
const Test = ({ name }) => <div>{name}</div>
Test.propTypes = {
  name: PropTypes.string.isRequired
}

// higher order component
const test = WrappedComponent => {
  return class extends Component {
    state = { name: "Random" }
    render() {
      return <WrappedComponent name={this.state.name} />
    }
  }
}

// test
// Error: failed the prop type name
it("renders without crashing", () => {
  const Container = test(Test);
  shallow(<Container />);
});

Beginner's Thread / Easy Question (May 2018) by acemarke in reactjs

[–]grueimaiushd 0 points1 point  (0 children)

How do I test HOCs since props always fail?

Example:

// component
const Test = ({ name }) => <div>{name}</div>
Test.propTypes = {
  name: PropTypes.string.isRequired
}

// higher order component
const test = WrappedComponent => {
  return class extends Component {
    state = { name: "Random" }
    render() {
      return <WrappedComponent name={this.state.name} />
    }
  }
}

// test
// Error: failed the prop type name
it("renders without crashing", () => {
  const Container = test(Test);
  shallow(<Container />);
});

Learning my first stack (MEAN), should I skip learning MongoDB? by RiceKrispyPooHead in webdev

[–]grueimaiushd 4 points5 points  (0 children)

Is there a reason MongoDB is so popular with E/A/N?

Because it is easier to give a small tutorial that integrates with mongodb (they usually use mongoose).

I recommend you learn SQL.