HNHacker News
TopNewBestAskShowJobs

rand_r

484 karma · joined February 2, 2011

Programmer, @ghedsouza on Github. Personal Blog: https://dsouzaman.net
submissionscomments
rand_r··on Techniques used by developers to bypass App Store review
It’s a free market because buying an iPhone is a choice. It happens to be an incredible product, so may not feel like a choice, but the experience was designed by one company and put into the market as an offering.

Apple has no control over your bank account and you have no control over Apple. You are both free to engage with each other or not.

rand_r··on Techniques used by developers to bypass App Store review
I’m not a fan of the control, but this is the free market at work. Nothing stops you or any other company from creating a competing phone with its own app ecosystem. It’s really not for the government to dictate to companies how their products can work. It’s up to consumers to choose the products they want to use.
rand_r··on Don't Return Err in Go
If done comprehensively, this strategy has the potential to be much better than a traditional stacktrace because you can embed local variables within each additional error context string.

The main problem with traditional stacktraces is that, while you get line numbers, local variables at every stack frame are not preserved. So unless the error is obvious like FileNotFound, you’re left guessing as to how the error happened.

While still being hella verbose and probably too much effort for most code, the upfront investment would obviate the need for adding debug print statements or dropping into a breakpoint to inspect the code after an exception.

That said, the post does feel like copium for the ridiculous verbosity in Go and re-inventing chained exceptions.

rand_r··on Tesla Cybertruck deliveries halted for 7 days
Creating a profitable car company is a crazy high bar though. Hasn’t been done for over a hundred years in the USA, and that too, with a new kind of engine and single-handedly making EVs viable through its supercharger network (all other options are literally ass in terms of reliability). So I can give him a break for some panel issues.

When you include SpaceX and Starlink, it’s pretty obvious he is successful beyond anything we’ve witnessed before, but people take his accomplishments for granted somehow.

rand_r··on Why No IPv6?
Amen, brother. Fact is, all critical limitations with IPv4 were hacked around by necessity, so the average user doesn’t care.

The main failure case is that it’s a painful or possibly impossible to setup your own public internet server from home, but ISPs are probably happy about that and games have figured out a work-around.

If IPv6 was a project at work, it would probably get killed as not a priority.

rand_r··on Show HN: PostgreSQL index advisor
How would an index mess up another query? AFAIK indexes would only hurt write performance marginally per index, but most slow queries are read-only. I’ve tended to just add indexes as I go without thinking about it and haven’t run into issues, so genuinely curious.
rand_r··on How we communicate
Information overload. There’s tons of info on our Slack, but the vast majority is noise. If you saved transcripts from all Zoom meetings it would be mostly noise too. The benefit of meetings is that they be chaotic. Creating something succinct and sharable from them should be done later as a singular focused activity and stored in a wiki.
rand_r··on Features I wish PostgreSQL had as a developer
Good point, that’s a better approach. I guess for a multi-repo situation at work, you would need to create a base project like “postgres-lock-ids” so you can synchronize the lock across everything.
rand_r··on Features I wish PostgreSQL had as a developer
That is the way, but the UX is pretty ass because the lock ID is a 64 bit number instead of a string. How the heck are you supposed to keep track of what lock ID you should be checking in a given situation across multiple client apps?
rand_r··on Memray – A Memory Profiler for Python
I use “breakpoint()” a lot for debugging. It’s by far my #1 tool for figuring out why something isn’t working. Recommend you learn how to use it.
rand_r··on I worked in Amazon HR and was disgusted at what I was seeing with PIP plans
Depending on your perception, x.get is either error recovery (good) or a silent failure (bad). One is not necessarily better than the other; it depends on what you want. In my experience, x[] is usually the better choice because failing fast makes debugging easier.

I hope no one is recommending x.get as a general practice, because that is pretty naive.

rand_r··on Mypy 1.6
Did you manage to get MyPy + Django to work together usefully? I tried the plugin you mentioned but it still seemed stymied by the dynamic nature of Django (reverse relations, etc), so I gave up on it.

If it’s actually possible to live in typed nirvana with Django I’ll bang my head against the wall some more.

We’re using Django 3.2 btw + FactoryBoy.

Actually there’s a number of annoyingly dynamic Python libraries out there where methods are created dynamically that it feels a bit like playing whack-a-mole. Is the situation like TypeScript where you need a MyLibrary.types.ts for each library?

rand_r··on I got robbed of my first kernel contribution
Based on what? Discounting credit as motivation is a bit naive and motivation is the only way shit gets done.
rand_r··on I got robbed of my first kernel contribution
Receiving credit is important to the vast majority of people, and giving credit where it’s due is a leadership quality and ethical standard today. The rules of the game are established and not following them should be frowned upon.
rand_r··on Ask HN: Could you share your personal blog here?
https://www.dsouzaman.net

Only a few posts; never really had the time after the initial batch. Would like to update it at some point.

rand_r··on Migrating Netflix to GraphQL safely
The original motivation was to reduce the number of network requests made on cellular network-connected mobile devices, both to save on power consumption and reduce latency for the user. It off-loads a lot of complexity and computation from the client to the server, and make sense if want to create as good a mobile experience as you can.

In terms of code architecture, it drastically simplifies frontend code, and overall reduces backend code and boilerplate. It's extremely elegant and nice to use over creating custom endpoints for every use-case, but the N+1 SQL query problem is a giant thorn.

rand_r··on Migrating Netflix to GraphQL safely
Yes, this is the biggest problem with GraphQL that I haven't addressed anywhere.

The architectural beauty of GraphQL is that you can write isolated, functional nodes that only have to know about their object type. For example, the User node only has to know how to get the user's last_login, active status, and return a reference to another node type like a profile Image.

Inside the User node, you are free to write code (e.g. Java or Python) that can compute which Image node is the right one to return. i.e. you can write:

  class UserNode:
      def get_user_profile_image() -> ImageNode:
          return some_arbitrary_function()

There is no way I've seen to square this kind of arbitrary node computation with the desire to write an optimized SQL query that selects all needed information in one big-ass statement.
rand_r··on Reddit Threatens to Remove Moderators from Subreddits Continuing Blackouts
I take your point, but to a large extent the value of the subreddit is in the name since it makes it easy for people to organically find the right space for the content they want. Domain names are the same. For example, for content local to New York City, going to /r/nyc was my first guess.

/r/UncleBens can claim to have developed their own thing, but not the obvious ones like /r/Apple, etc.

rand_r··on No, you can’t manufacture that like Apple does (2014)
Unfortunately, it causes acute liver failure so getting “high” from it isn’t something you even want to think about doing. I wish the danger of it was better known though.
rand_r··on No, you can’t manufacture that like Apple does (2014)
A pain medication that didn’t cause organ damage wouldn’t be legal due to the legacy of the War on Drugs. Drug policy isn’t the most logical. Cannabis still isn’t legal in most of the world.

Even if GPs wanted to prescribe a safer painkiller, they are hamstrung by drug policy. So, they choose something that is a short term solution but has long term consequences because there are NO alternatives that aren’t a headache (i.e opioids).

rand_r··on Don’t mock what you don’t own
We started employing this pattern in our code at work recently. Using the Facade pattern to create a simpler interface around a couple of things:

- Feature Flag service, wrapping LaunchDarkly

- Remote Storage service, wrapping S3

The application code uses the simplified services, with little knowledge of the underlying providers (e.g. S3 or LaunchDarkly). The tests use a test implementation of the simplified services.

This pattern simplifies both the application code and test code and is an all-around win.

It's been a game changer personally, and made me excited about software architecture and coding.

rand_r··on Judge rejects Purdue Pharma's $4.5B opioid settlement
Withdrawal from opioids is overrated. It’s unpleasant, but that’s it. Unlike alcohol or benzodiazepine withdrawal, which can literally kill you, opioid withdrawal is like a bad cold.

So, yes there’s adaptations, but it’s way overrated compared to the media hype.

rand_r··on Judge rejects Purdue Pharma's $4.5B opioid settlement
The idea that opioids are addictive is a myth. People taking them are treating “pain” that isn’t diagnosed in the medical system. For example, joblessness. It’s an easy scapegoat for politicians to let them avoid dealing with harder structural problems.
rand_r··on Loopless Code (2006)
That does look pretty nice for this example. I think the problem with it is that introduces too much new syntax that you have to memorize. The beauty of a for loop is that you can do _anything_ with it. And it all works with the same syntax.

  for item in array:
      item.foo = bar

  for item in array:
      item.foo = item.foo * 2

  for item in array:
      my_bar_func(item.foo)
If you special case certain uses of a for loop and add language syntax around it, of course you can make code terser. But it's nice to rely on a small set of very generally useful syntax.
rand_r··on Loopless Code (2006)
This seems perfectly clear.

  for item in array:
      item.foo = bar
rand_r··on Adults who microdose psychedelics report lower levels of depression and anxiety [pdf]
Which ones?
rand_r··on Stop using Zoom, Hamburg’s data protection agency warns state government
Two words: Gallery view.

Like what in the actual fuck. How are they unable to do a simple grid properly? It’s just rectangles. The UI is there to copy from Zoom even.

rand_r··on Stop using Zoom, Hamburg’s data protection agency warns state government
I'm sorry, but Hangouts is terrible. It sucks on every level. The UI is so bad it's hard to believe. I wish I could sit down with their product team to get an explanation for how badly Hangouts is designed. Takes about 10s to see all the problems with it compared to Zoom.
rand_r··on No Code Reviews by Default
assert add(2, 3) == 5

Seems simple enough :)

rand_r··on Stage 3 Proposal: Array.prototype.at
You might well be right! Would be fun to see them go head-to-head over the title.
← PreviousPage 2 of 5Next →