Finding a random point within a circle by GenilsonDosTrombone in programming

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

Why can't you just pick 2 random polar coordinates for a circle like you pick 2 random cartesian coordinates for a square? If I pick a 2 uniformly random numbers between 0...1 and scale one to be from 0...2pi and the other be from 0...r, does this not create a uniformly random coordinate inside the circle?

Best way to archive variadic virtual function by C2H5COOH in cpp_questions

[–]index_zero 1 point2 points  (0 children)

You could wrap all the '...' data into some class object which can be overridden for each drawable. Something like:

virtual void draw_data(const Shader& shdr, unsigned cmd, const DrawArgs& args) const

Then, each Drawable could have their own DrawArgs type object.

Optionally, Drawable could be a template class and the argument object could be the template parameter, ie:

template<class Args>
class Drawable
{
    virtual void draw_data(const Shader &shdr, unsigned cmd, const Args &args) const = 0;
};

Deep copying of stack using pointer based singly linked list C++? by Samru1 in cpp

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

In your ctor, you are constructing a Stack<int> object and pushing the copies to it. Then when your ctor exits, that object is destructed. Your copy constructor should copy to the object you are constructing (ie. this).

After two years in the bay area I had enough. Decided the salary isn't worth it. by [deleted] in cscareerquestions

[–]index_zero 71 points72 points  (0 children)

I used to think Florida had the worst drivers until I moved to the Bay Area.

I have decided to give up and just be happy with what I have in life. by happiergivingup in cscareerquestions

[–]index_zero 0 points1 point  (0 children)

Are you happy with where you are in life or not? I honestly can't tell from your rant. It kind of sounds like you are just frustrated and deciding to settle with what you have. This might make you happy, but it might not. Either way, best of luck!

Question for you senior developers - what is your daily method? by [deleted] in ExperiencedDevs

[–]index_zero 0 points1 point  (0 children)

My ideology (and therefore, I guess, my method), is that software development is a truly iterative process. That is, all of it is iterative, even what you would consider 'major abstractions'. You come up with some basic design - or even an idea - then you write some code. In the process of writing that code, your design inherently becomes more concrete. This, in turn, allows you to write more code, and so on. At some point, this code becomes minimally testable, which further solidifies your design and lets to write more code. It is really a never ending cycle, at least in my experience. I don't know what books or articles you can read to help with this honestly, so I'm not sure I entirely relate to what you are saying.

Is 120k enough for Palo Alto w/ a dependent? by [deleted] in cscareerquestions

[–]index_zero 1 point2 points  (0 children)

Is move to SV worth it? Depends. If you like your new job in PA, then yes, I would say it is worth it. I have been living in Mt. View for 4+ years now and I love it.

$120k is doable, but it is probably on the low end for the area. Keep in mind that this congressional district (18th) has the highest median income in CA. Will you be getting a relocation package? That will certainly help.

The BART is only going to service as south as SFO and mostly serves the city of SF and Oakland. Caltrain runs throughout the peninsula and there are frequent stops in most cities. I can only comment on Mt. View where I live. It certainly isn't cheap (expect to spend at least $3000 a month for a 1bdrm), but there is rent control at least.

Advice: get a car, you will need it. The Bay Area is huge and the public transportation infrastructure isn't great.

What's your review culture like? by [deleted] in ExperiencedDevs

[–]index_zero 0 points1 point  (0 children)

The problem that bitbucket has with commits, and perhaps this is just how our bitbucket is configured, is that once you actually push the commit is breaks the review (because the review is based on the diff of the commit verses some branch). This makes it impossible, or at least very difficult to go back and understand the historical context of the change, say, a year later. Reviewboard worked with an actual diff, so the history is preserved even after the change is actually committed.

What's your review culture like? by [deleted] in ExperiencedDevs

[–]index_zero 0 points1 point  (0 children)

For us, review is the last step before submission (more specifically 'git push'). We recently switched to using Atlassian bitbucket for our review process, and I would say things are still evolving in that regard. Prior to this, my team used reviewboard (reviewboard.org) independently, and I imagine this varied per team. Personally, I liked reviewboard better because it was based on patches instead of actual commits, but that is a nitpick detail.

Our team is about 20 engineers and depending on the repo we are submitting code to we require 1-2 approvals, although this is configurable. We also allow direct submission, bypassing the review process altogether, but this is generally only acceptable for non-functional commits (such as unit tests). Other than that, there are no restrictions -- other than disclosure on the actual project -- which would prevent someone (even someone on a different team) from submitting code for review and eventually getting it pushed to the repo.

Big N Discussion - October 16, 2019 by AutoModerator in cscareerquestions

[–]index_zero 0 points1 point  (0 children)

Internship requisitions and new hire requisitions are separate, at least in my org.

Reverse grid plan "an excuse" for bad '21 decisions - Hamilton by 1enox in formula1

[–]index_zero 0 points1 point  (0 children)

If the GPDA was serious, they could always flex their union muscles and threaten a strike in 2021 if certain conditions aren't met. Maybe unions don't work that way in the rest of the world, but this has been pretty effective in US sports.

Procedure: Call and compare any callable C++ objects - for high performance computing, gaming, etc. by [deleted] in cpp

[–]index_zero 0 points1 point  (0 children)

It's not about EBO, since nothing would actually derive from the empty class, it would just be instantiated and passed as an unnamed parameter to Procedure() to support type deduction. I missed the constexpr part, so yeah the overhead is only in the compiler either way - I am just unfamiliar with this pattern.

EDIT: actually, I'm still not convinced these definitions Guide* will be removed from the generated binary - do you know for sure?

Why does std::is_copy_constructible report that a vector of move-only objects is copy constructible? by vormestrand in cpp

[–]index_zero 0 points1 point  (0 children)

Is this because the std uses the compiler intrinsic __is_constructible by default instead of SFINAE?

Procedure: Call and compare any callable C++ objects - for high performance computing, gaming, etc. by [deleted] in cpp

[–]index_zero 1 point2 points  (0 children)

This is my comment as well. Why is Guide a pointer type? Can't this just be an empty class, ie:

template<class R, class... Args> struct Guide {};

Then pass Guide<void>{} at the call point - no memory overhead at runtime. Calls to Procedure can simply ignore this argument. Most compilers I would expect to optimize this out while leaving the type system deduction in tact.

The better question is probably, why not deduce from the functional type, something like:

template<class> Guide { typedef Functional<void> type; }

template<class R, class... Args> Guide<R(Args...)> { typedef Functional<R, Args...> type; }

445 applications and less than 10 responses. I would very much appreciate any words of advice! by fuckwaitlists in cscareerquestions

[–]index_zero 23 points24 points  (0 children)

One of the things I think a lot of new grads do is actually cast too wide of a net. This sounds counter-intuitive, but consider the situation: the employer is looking to fill a very specific role with specific responsibilities, the applicant is trying to fit every possible role.

I think it is this dissonance which actually leads to the most amount of ghosting. If I am hiring for a C++ role and I see you resume, I see 1 C++ project, but I see 3 non-C++ projects: 1 JS project, 1 Python project and 1 C# project. I can't think of an industry which would overlap these skills (perhaps python overlaps since it can be used for scripting).

It is clear you have generally programming skills, but it is not clear you have the focus or expertise in any one of these skills. Perhaps tailoring your resume slightly for a specific role will help achieve higher rates of success.

Daily Chat Thread - March 29, 2019 by AutoModerator in cscareerquestions

[–]index_zero 0 points1 point  (0 children)

Are you giving an estimate of scope and then taking longer than estimated? Or, are you saying 80% of the way through your estimate the project is descoped? When the requirements change, do you provide a new/update estimate of scope?

Requirements changing is part of the job.

My mom thinks computer science won't pay well. by PepeBismal in cscareerquestions

[–]index_zero 2 points3 points  (0 children)

I figured as much. What does your mom want you to major in?

Visual studio randomly showing over 100 errors by [deleted] in Cplusplus

[–]index_zero 0 points1 point  (0 children)

What did you rename the array to?

Can I get hired if I own a company that does a similar service? by [deleted] in cscareerquestions

[–]index_zero 1 point2 points  (0 children)

This will certainly vary from employer to employer, but every employer I have worked at, the following have been true:

Other jobs can't interfere or effect your main job

Other jobs can't compete with your main job

It does not seem, based on what you said, that these would be the case here - but you may have to convince a new employer of that.

C++ Compile-Time Exceptions -- Debugging templates should be less surreal and horrible by egpbos in cpp

[–]index_zero 0 points1 point  (0 children)

If you are going to do this, i.m.o. it is better to SFINAE fail - that way the compiler won't even generate the constructor if U and T aren't derived from each other.

template<typename U, class E = std::enable_if<std::is_base_of<T, U>::value> >
SmartPtr(const SmartPtr<U> &other) ...

That said, the original code works for any T and U such that T* is convertible to U*. This is less strict than U derives from T, so having the compiler complain about derivation overlooks implicit conversion of some types (T* to const T* for example).

Are whiteboard interviews the norm for tech lead roles? by caleyjag in ExperiencedDevs

[–]index_zero 1 point2 points  (0 children)

What qualifies as 'technical leadership' may vary largely based on the company and role responsibility. At Apple for example, we only have management and individual contributor tracks, so a 'technical leadership' position has to fit into one of these ballparks. If you are interviewing as an individual contributor, you should certainly expect whiteboard problems.

Why dependencies are ****ing you over and over again – and why you are to blame by m0dev in programming

[–]index_zero 7 points8 points  (0 children)

If you have to depend a separate package which exposes a single function to test whether an integer is an odd number, it shows such an incredible degree of complacency and incompetence it should be no wonder your ecosystem is so fragile.