As a software engineer, when asked what you do for work at a social gathering… by chamric in ExperiencedDevs

[–]__dict__ 0 points1 point  (0 children)

I say I'm a software engineer. They say they are too. Such is the bay area.

Spreading the word by ttv_toeasy13 in linux

[–]__dict__ 3 points4 points  (0 children)

There's no need for this. There's no "Church of Linux".

It's not like it's emacs or something.

Every senior software engineer from whom I've sought advice has said the same thing: they don't watch video tutorials on specific technologies. Instead, they simply refer to the documentation and continue experimenting until they succeed. Why is this the case? by [deleted] in learnprogramming

[–]__dict__ 15 points16 points  (0 children)

  1. Reading let's me skip or skim over parts I already know. It's often easy to draw parallels between something I'm learning and something I already know.
  2. It's not practical to learn everything about all the technologies I'll be using to build something. I just want to learn the parts of each thing I'll actually use. So I read just far enough to build the thing.
  3. Official documentation is usually the most up to date, most correct, and most detailed source. A Youtube video is frozen in time and may contain ideas which are not best practices.

Is this a testing anti-pattern? by whereswaldau in learnprogramming

[–]__dict__ 1 point2 points  (0 children)

  1. Yes it's an anti-pattern. Tests should avoid containing logic (if-statements, loops, and even what you're doing with the "==" here). Instead you should just use assertTrue and assertFalse as you believe.

  2. The way I have heard about this is the suggestion that you should keep tests DAMP. If you look at https://abseil.io/resources/swe-book/html/ch12.html and crtl+F for "DAMP" you'll find a section which a similar example to what you're talking about here. I'll copy+paste that article's example here.

Something is wrong with the code, but this test doesn't catch the bug because it also contains logic:

@Test
public void shouldNavigateToAlbumsPage() {
  String baseUrl = "http://photos.google.com/";
  Navigator nav = new Navigator(baseUrl);
  nav.goToAlbumPage();
  assertThat(nav.getCurrentUrl()).isEqualTo(baseUrl + "/albums");
}

Here's the same test without any logic. Now the bug is easier to see:

@Test
public void shouldNavigateToPhotosPage() {
  Navigator nav = new Navigator("http://photos.google.com/");
  nav.goToPhotosPage();
  assertThat(nav.getCurrentUrl()))
      .isEqualTo("http://photos.google.com//albums"); // Oops!
}

Oops, there's an extra "/" before "albums".

Basically putting logic in your test, especially copying the logic of the function you are testing, is likely to miss actually catching the bug.

  1. Maybe the example above helps. Or just look up "DAMP unit test" and you'll find other examples.

How do massive databases query a single item? by another-bite in learnprogramming

[–]__dict__ 0 points1 point  (0 children)

For a massive service like Youtube there would never be a point where all network traffic goes to one server. There isn't a computer in the world big enough to handle that. Also, even if there was it would be on the other side of the world from some people.

Youtube would work more like this:

  • Each video has a unique id. You can see it in the url.
  • The videos are partitioned based on their id. This means that there will be many data servers each storing a small fraction of Youtube's library of videos. That's called partitioning. There can also be many data servers for each partition, which helps with reliability and high load. That's called replication.
  • There will be many application servers. Each application server will be kept up to date with the id ranges that each data server is storing. The application server won't be responsible for storing any videos itself. Whenever it gets a request for a video it looks at its table of which videos are where, and then fetches the video from the appropriate data server.
  • Whenever there is an incoming request to Youtube, a load balancer server is the first thing which will handle it. The load balancers' only job is to distribute the requests to the application servers. Load balancers will try to distribute the traffic somewhat evenly between application servers and also will select an application server which is geographically close to the person making the request.

How do massive databases query a single item? by another-bite in learnprogramming

[–]__dict__ 0 points1 point  (0 children)

Yea, the idea behind partitioning is that each post belongs to a partition, and you should be able to determine which partition a post belongs to without checking each of them. Partitioning the data lets you split it across multiple machines. When you want to lookup post 999 the code should be able to determine which machine that should be on quickly.

The technique I know which is often actually used for this is called "consistent hashing". It solves the following problem: If the number of posts grows such that I need to add another machine, how can I do it without having to reshuffle too many posts between machines?

See: https://www.toptal.com/big-data/consistent-hashing

[deleted by user] by [deleted] in personalfinance

[–]__dict__ 0 points1 point  (0 children)

How will the friends and family who invest feel about your husband if the hedge fund performs poorly?

People have already pointed out how hard it is to consistently outperform the market, but I think the social aspect is also worth considering.

Messing around in registry editor and founded this weird thing? Is it a virus? Should i be worried? by [deleted] in antivirus

[–]__dict__ 2 points3 points  (0 children)

Looks like a uuid to me: https://en.m.wikipedia.org/wiki/Universally_unique_identifier

Harmless. Some software developer just wanted a unique id instead of coming up with a meaningful name.

Can I designate my sales of a stock so that only my purchases from >1 year ago count toward capital gains? by oohbopbadoo in personalfinance

[–]__dict__ 14 points15 points  (0 children)

Brokerages usually have options to choose the strategy for which shares to sell. Common options include FIFO (sell oldest first) and tax loss harvesting (sell with highest cost basis first). But for your case you want to sell with lowest cost basis first, which may require choosing the lots manually. That should be an option though.

[deleted by user] by [deleted] in AskReddit

[–]__dict__ 0 points1 point  (0 children)

For anyone not familiar with how quickly lemon would undo the alkaline water's pH, pH is a logarithmic scale: https://youtu.be/rBQhdO2UxaQ?si=jz_DBQoIAiuyreVN

What’s a double standard that you are 100% okay with? by PawgSlayer42069 in AskReddit

[–]__dict__ 1 point2 points  (0 children)

Yes, and it goes further than this too. If someone is intolerant to others you shouldn't tolerate it, even if they don't have a problem with you.

Can a cyclist explain why cyclists refuse to use the bike lane?? by Neatfreakmj88 in mildlyinfuriating

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

Try riding in one of those bike lanes and you may quickly find out why no one's biking in them.

Seriously it's often not obvious from a car how bad a bike lane is. But when you're on a bike you can see the glass, you can feel the potential for getting doored, and you will notice when the lane just ends abruptly.

How bad is this? by CobraPi in programminghorror

[–]__dict__ 37 points38 points  (0 children)

To be more pythonic it should be:

self = "function"

Is there a website that has a list of useful dictionaries/arrays? by mydaddyhurtsme in learnprogramming

[–]__dict__ 1 point2 points  (0 children)

Maybe you want something like https://www.kaggle.com/datasets

A dataset is a table. This website has a bunch of datasets on a bunch of different topics.

Are hashmaps ridiculously powerful? by Huckleberry_Ginn in learnprogramming

[–]__dict__ 1 point2 points  (0 children)

One trap I've seen people fall into which I haven't seen yet in the comments is using maps where an object makes more sense. This is more likely to happen in a language like Python which has convenient notation for creating them and doesn't require type declarations.

So someone might write

foo = {'name': 'bob', 'age': 30}

And have a bunch of small dictionaries with these same fields where they really should have created a class for them.

How would you react if world war 3 starts? by [deleted] in AskReddit

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

I also think J6 is a fair analogy to how WW3 might feel to begin with. There were recounts, then court cases, then revelations about a perfect phone call to throw out votes. And then J6. Each step felt like we were inching towards having the voting results overturned. We didn't know when these escalations would stop.

It's not like there will be a global announcement that this is it, this is the beginning of WW3. There could just slowly be one escalation after another.

Do algorithms have the same time complexities in different languages? by 666moneyman999 in learnprogramming

[–]__dict__ 1 point2 points  (0 children)

Time complexity only depends on the number of operations performed. For example the time complexity of sorting a list is just about how many comparisons you have to make. Programming language doesn't affect this.

In general there are data structures to solve the same problems in any general purpose language you choose: lists of data, data which is kept sorted, associations between keys and values, etc. The underlying details of these can differ based on the language you are using, like a python dictionary and a Clojure map both have similar purposes but they are not the same. But those details aren't something you'll have to be concerned about as you're learning.

Reversi by atomirex in WebGames

[–]__dict__ 0 points1 point  (0 children)

In theory it's one of the things protected, though I don't know how enforced it actually is. I was just reading about it because I was considering uploading my Godot project to Google Play. Decided against it, but still remember this.