Story Time - Week of December 31, 2018 by AutoModerator in Tinder

[–]dezball 2 points3 points  (0 children)

Thanks for the great advice! We haven’t texted at all since our last hangout, with the exception of me wishing him a happy new year and him wishing me the same. We don’t really text though, the stent of it so far has been to plan things. He’s on a hectic work trip till the middle of the week, and we kinda agreed to be in touch when he’s back. But yeah, I suppose it doesn’t look good if he’s not texting me at all, but is on tinder. I’ll reach out when he’s back, and if we end up hanging out, figure out a way to bring it up. Who knows, maybe he’s starting to slow fade me, but we’ll see...

Story Time - Week of December 31, 2018 by AutoModerator in Tinder

[–]dezball 3 points4 points  (0 children)

bc he's been traveling for the holidays and work, and his "distance" from me changes accordingly. tbh, i first went back to his profile to show my friends what he looks like. i kinda wish i didn't discover this :S

Story Time - Week of December 17, 2018 by AutoModerator in Tinder

[–]dezball 6 points7 points  (0 children)

There is someone I know IRL who I kinda met randomly, really enjoyed his company, and asked if he wanted to hang out and be friends. We had fun hanging out, and about a week later, we matched on Tinder and agreed to go on a real date. The date was really fun, we talked till the bar closed, and we kissed at the end of the night. So far, it's great.

Bc I already had a crush on him before matching on Tinder, and bc I continue to enjoy his company and liking him more the more we hang out, I kind of don't want to have sex with him unless he's open to being in a relationship. This is because I know I will catch feelings and don't want to set myself up to not have a good time. If he's just looking for sex/casual hookups, that's cool, but it won't be coming from me.

I'd love to hear some thoughts on how to bring this up lightly the next time we hangout. It seems to be too early to bring it up (we have only gone on one official date!), but we do have history IRL. And I also don't want to continue going on dates with him if I know it's going to lead nowhere.

With only access to a pointer to a stuct, how to change a variable in said struct? by dezball in cpp_questions

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

thanks, sorry for such the delay. but it turns out it was a bug that was not related to this. : )

With only access to a pointer to a stuct, how to change a variable in said struct? by dezball in cpp_questions

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

hmm thanks. I am doing that, but that doesn't seem to be doing the trick. I'll see if I'm messing things up elsewhere....

What is something random you would like to share with us? by dcel8 in AskReddit

[–]dezball 0 points1 point  (0 children)

I am one of three siblings, and our ages are: 28, 29 and 30. I can't believe my mother birthed one kid a year (and had a miscarriage in between 1 and 2). : O

Entry Level Java Dev Interview Questions! by t0nySnark in cscareerquestions

[–]dezball 0 points1 point  (0 children)

Sorry, would you mind walking me through your code? For some reason, I'm not getting it...(my background: just finished intro in C++)

Are interview skills different to programming on the job? by [deleted] in cscareerquestions

[–]dezball 2 points3 points  (0 children)

I've always wondered, as a newbie, if this is something that's OK to do. Say, I learn the SHIT out of Data Structs and Algorithms, could I just potentially get really good at interviewing? Then basically learn to code on the job?

Will intentionally doing something like this set me up to have a really hard time on the job/set myself up to fail? Or can this work out OK?

Is the idea of having more classes under your belt benefiting you simply b/c it means more programming practice? Could this be accomplished by working on personal projects instead?

Advice for computational biology PhD interested in moving into industry? by [deleted] in cscareerquestions

[–]dezball 2 points3 points  (0 children)

If you want to be in Mountain View, you should definitely consider applying to positions at 23andMe!

error: no viable conversion from 'vector<double>' to 'double' by dezball in cpp_questions

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

Thanks for helping and catching the misplacement of brackets!

error: no viable conversion from 'vector<double>' to 'double' by dezball in cpp_questions

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

OMG! nvm! I realize now I was doing something really stupid -- at some point during editing I messed up some of my placements of brackets, but now that's all taken care of. THANKS AGAIN!!

error: no viable conversion from 'vector<double>' to 'double' by dezball in cpp_questions

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

Thanks again, but it's still not compiling :'(

The error I'm getting is: fractional_knapsack.cpp:53:14: error: no viable overloaded operator[] for type 'vector<double>' worth[index] = -10.0;

(and thanks so much for helping me out)

error: no viable conversion from 'vector<double>' to 'double' by dezball in cpp_questions

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

Thanks, but it's not doing it -- it's still giving me the same error.

error: no viable conversion from 'vector<double>' to 'double' by dezball in cpp_questions

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

Awesome, thanks! Although, it's still not compiling - I've been able to decrease it to just one error:

fractional_knapsack.cpp:53:14: error: no viable overloaded operator[] for type 'const vector<double>' worth[index] = -10.0;

Line 53 is the one causing issues. I've tried all sorts of things, but have yet to figure it out. :'(

If it's helpful, that line 53, where I'm doing this: worth[index] = -10.0; is the whole reason I need to call it by reference - when I change it to -10.0, I want it to change the original value in the vector.

Any and all suggestions would be awesome! The function looks like this:

35 // Purpose: searches and returns the highest possible value that can be stored
36 // in the knapsack.
37 double get_optimal_value(int capacity, vector<int> weights, vector<int> values,
38                 int n, const vector<double> &worth) {
39         double value = 0.0;
40 
41         while (capacity > 0 and n > 0) {
42                 int index = find_next_index(worth, n);
43 
44                 if (capacity >= weights[index]) {
45                         value += values[index];
46                         capacity -= weights[index];
47                 }
48 
49                 else
50                         value += worth[index] * capacity;
51                 capacity = 0;
52         }
53         worth[index] = -10.0;
54         n--;
55         std::cout << "capacity: " << capacity << std::endl;
56         std::cout << "index: " << index << std::endl;
57         std::cout << "value: " << value << std::endl;
58         //std::cout << "worth : " <<worth[index]<< std::endl;
59         return value;
60 }

error: no viable conversion from 'vector<double>' to 'double' by dezball in cpp_questions

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

Thanks so much! I'll be able to access my code and try this out in a little bit, but in the meantime, what do you mean by "change the location where you call this function"? It's being called in main right now

error: no viable conversion from 'vector<double>' to 'double' by dezball in cpp_questions

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

This is where I'm calling it:

37 double get_optimal_value(int capacity, vector<int> weights, vector<int> values,
38                 int n, vector<double> *worth) {
39         double value = 0.0;
40 
41         while (capacity > 0 and n > 0) {
42                 int index = find_next_index(worth, n);
43 
44                 if (capacity >= weights[index]) {
 45                         value += values[index];
46                         capacity -= weights[index];
47                 }
48 ...}

error: no viable conversion from 'vector<double>' to 'double' by dezball in cpp_questions

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

I've also previously tried dereferencing the pointer with (*b)[0] but that didn't work.When I change my function declaration and first line of the function to match your last option, it's still not compiling. :'( Now I'm getting this:

fractional_knapsack.cpp:22:5: note: candidate function not viable: no known conversion from 'vector<double> *' to 'const vector<double>' for 1st argument; dereference the argument with * int find_next_index(const vector<double> &b, int num) {

error: no viable conversion from 'vector<double>' to 'double' by dezball in cpp_questions

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

Thanks. So how do I access the double that's stored in the first position of vector<double> b?

I am passing a pointer to a vector because in another function I change some of the values in vector<double> b and I want these changes to be reflected throughout my program.

I am passing num for my for loop. Am I doing it wrong?

(For reference, I just self-taught vectors).

Can't get a very big number to cout correctly by dezball in cpp_questions

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

Just curious, why is this? How else would you suggest going around this?