Unless you're the default `net/http` library and simply recover from the panic: https://github.com/golang/go/blob/master/src/net/http/server...
731 karma · joined August 11, 2023
Unless you're the default `net/http` library and simply recover from the panic: https://github.com/golang/go/blob/master/src/net/http/server...
I don’t mind playing with AI to help scratch together some code, but I do that using better models. Whatever model google is using for search results is too crappy for me to consider trusting.
For these cases I like to use the ‘suggest an edit’ feature on gitlab/github. Can have the change queued up in the comments and batch commit together, and takes almost no additional time/effort for the author. I typically add these suggestion comments and give an approve at the same time for small nitpicks, so no slow down in the PR process.
It also means you can completely leave out the package manager from the target machines, as it’s only used to bootstrap creation of the single deployable unit. Implementing that bootstrapping step is where nix and friends are helpful in this setup.
> Darwin - which consists of the XNU kernel, IOkit (a driver model), and POSIX compatibility via a BSD compatibility layer - makes up part of macOS (as well as iOS, tvOS, and others) includes a few subsystems (such as the VFS, process model, and network implementation) from (older versions of) FreeBSD, but is mostly an independent implementation.
The main reason I see new devs opt for extends, is because that was 99% of the content in their Java 101 programming course, not because it exists in the language. Imagine how many more `friend`s we would have in cpp if that was crammed down everyone's throats? :)
Consider this contrived example:
margin = (price - cost) / price
You can be reasonably sure what is being calculated, but it's hard to be exactly sure unless the surrounding context is very small. Having longer names allows you to keep more context for a line in isolation, meaning (personally) I require less backtracking while reading.e.g. the above could be rewritten as the following, removing a lot of ambiguity:
retail_margin = (retail_price - wholesale_cost) / retail_price
I find 80 character limits much too small in these cases. 100-120 characters is the sweet spot for me. I can still have 2 split panes of code on a single screen at once, and write more expressively without excessive linebreaks per statement.> I still boot it up to play occasionally
A large factor for the efficiency, is how “thin” you can make channels in the cable via frequency of the light. Multiple signals can be sent over a single fiber line if they use different frequencies. One system I was working on at the time was constructing 88 channels at 100gbs for a total throughput of 8.8tbs.
Another very interesting aspect, is that service providers might share a lease of the same underwater cable, not actually owning the cable themselves. The companies enter an agreement on the frequency ranges assigned to them. Any mess ups in settings can cause disruption in your neighbor on the cable, resulting in millions of dollars of fines.
This pattern when implemented with context vars in the context managers is a pretty nice way to reduce the boilerplate, without the downsides of traditional globals. The state can be safely contained to just the with block.
Usually these types of APIs also allow usage without it, using the context vars only to populate arguments not explicitly provided.
Perl is probably the most awkward due to context-sensitive casting. e.g. the string `"0"` in a boolean context evaluates as an integer, and the boolean interpretation for `0` is false.
Not even visible on the github org https://github.com/Flutter-Foundation
> This organization has no public members. You must be a member to see who’s a part of this organization.
There used to be a commercial that would play on Canadian TV stations. It showed the view of a river, once with calm and tranquil sounds and then played again with ominous sounds like from a horror movie. When you are presented the river with tranquil sounds, you are happy and calm. When you are presented the river with eerie sounds, you dislike it. The message at the end of the video was to inform Canadians to think more critically about the media they consume, and to question if they are being led down a forced narrative rather than being given facts to question for themselves.
When I see modern day Reddit, Instagram, Facebook, etc, almost all of the videos are backed by music which is trying to bias the user. It makes me uncomfortable.
I use this, and testing.postgresql for unit testing my api servers with barely any mocks used at all.
When a route is async, it gets scheduled on the main event loop, meaning that any blocking calls can block all requests in flight, and block unexpected things like start up and teardown of api handlers. `asyncio.to_thread()` can help here, but it's easy to forget (and there's no warnings in case you forget).
If you do mix the two, I would be very careful to monitor the timings of your requests to detect early if blocking is occurring. For adding these metrics, I suggest using something like statsd or open-telemetry libraries for adding reporting to the endpoints, which you can feed into telemetry dashboards.
I do see an advantage being in office with juniors and interns. I definitely learned a lot when I was junior being able to ask the senior staff questions without having to schedule a zoom meeting or wait slowly on slack replies.
5 day RTO would be insane tho.
Back in 2005 I figured out how to log in on multiple Habbo accounts at once. I would run casino rooms using the dice and use a mob of clones to make it look like real players are winning and betting big. If an actual real player ever bet and won, I would kick them, tear down the whole room, transfer the items to new accounts, and start it up fresh. I probably had a few dozen accounts banned.
Checked exceptions in Java. I both like and hate them.
They force the function to be explicit about what exceptions they can raise. If you call a function that raises a checked exception, you must either explicitly handle the exception, or mark that it is propagated up by adding the same exception to the calling method signature.
However, they cause a lot of pain for working with higher order methods (map, filter, flatmap, etc). Because they change the signature of the method (and therefore the interface it can satisfy), you need to use a lot of generic variants of higher order methods to accept them, or like a lot of libraries, you end up writing wrapper functions that convert the checked exceptions into unchecked runtime exceptions, such that they don't modify the method signatures. This then leads to a lot of weird code, and uncaught exceptions at runtime, taking down the application.
Would generally refer to this as a sunk cost dilemma
This is the common usecase, but types certainly are used at runtime by many libraries. Frameworks like FastAPI use the type annotations to declare dependency injection which is resolved during application startup. In other cases like Pydantic, they are used to determine marshalling/unmarshalling strategies.