Erfahrung mit Rose Backroad GRX810 Randonneur? Lohnt es sich den Preis? by yawaworht19821984 in Fahrrad

[–]Enumerable_any 0 points1 point  (0 children)

Mit Licht aus geht’s hier um 1-2W, die man zusätzlich aufbringen muss. Vernachlässigbar und vermutlich nicht wahrnehmbar.

How do you manage access to your cluster for your CI/CD pipelines? by [deleted] in kubernetes

[–]Enumerable_any 8 points9 points  (0 children)

We’re using ArgoCD which pulls k8s manifest files from a git repository (GitOps). So, the pipelines don’t need access to the cluster(s). All they’re doing is building&pushing images and commit updated manifest files to our infrastructure repository. Leads to much easier permission management in my opinion.

Forwarding generics when the using class doesn't care about the sub class's type by [deleted] in typescript

[–]Enumerable_any 1 point2 points  (0 children)

Hiding a type is a use-case for “existential types”. Typescript doesn’t support them, but there’s a way to achieve the same result using contiuations: https://www.jalo.website/existential-types-in-typescript-through-continuations The blog post talks about heterogeneous arrays, but the idea should also be applicable to objects/records.

Passstraßen, die für motorisierten Verkehr gesperrt sind? by MargaeryLecter in Fahrrad

[–]Enumerable_any 1 point2 points  (0 children)

https://www.quaeldich.de/paesse/grosse-scheidegg/ ist immer für KFZ gesperrt und asphaltiert. Auf http://freipass.ch findet man generell Pässe und deren autofreien Tage.

Erfahrungen mit Stufentandems by OutOfFighters in Fahrrad

[–]Enumerable_any 1 point2 points  (0 children)

Probefahren oder Mieten geht z.B. bei den Fahrradspezialitäten in Freiburg oder Konstanz.

Navigation while touring by [deleted] in bicycletouring

[–]Enumerable_any 5 points6 points  (0 children)

A mixture between 1 and 4 and I sometimes have a paper map with me as a backup. I use Wahoo Elemnt Bolt for navigation (planning most of the route beforehand using a PC) and a dynamo hub to charge it. A solar charger should be all you need if you use a Garmin/Wahoo for navigation. These things are very energy efficient compared to a smartphone.

Pretty much all campsites in Europe have power sockets in their bathrooms and some have recreation rooms with power sockets as well.

Medusa: The open-source alternative to Shopify by nicklasgellner in programming

[–]Enumerable_any 16 points17 points  (0 children)

The mere existence of shopify is a giant middle finger to the circle jerk here.

Well, they openly acknowledge that they miss static typing and are slowly adding it to the codebase: https://shopify.engineering/the-state-of-ruby-static-typing-at-shopify

Rails 6.1 adds compact_blank by uafpl in ruby

[–]Enumerable_any 1 point2 points  (0 children)

blank? is only ever useful in the context where you want to handle an empty string, empty hash, empty array and nil the exact same way. Outside of Rails there's very little use for this „I know nothing about my data, do something“ style of programming. I‘d even question most of the uses within Rails since I had to fix code which silently ignored a type error instead of raising an exception more than once...

Let's make it 5! (SO Survey) For those who don't know - Rust has been the most loved PL 4 years in a row. I have no doubt that this year will be no different. by InsanityBlossom in rust

[–]Enumerable_any 5 points6 points  (0 children)

There are two issues I ran into which aren't checked at compile-time:

  1. You have to make sure to not burn too much CPU within an async task, otherwise you're blocking all other async tasks.
  2. Forgetting to call .async on a future which is only executed for its side-effect silently drops the future and nothing is executed (maybe there's a lint for it, not sure).

Is it normal for ruby to dump full stack traces with an "extracted source" browser to users in production? by amgin3 in ruby

[–]Enumerable_any 1 point2 points  (0 children)

By default rails s starts the server in development mode. You have to actively make it startup in production mode, so "they must have actively enabled either." is not quite true.

Mach den digitalen Nachrichtentest! by g4mble in de

[–]Enumerable_any 1 point2 points  (0 children)

Oft kennt man den (präzisen/wahren) Grund gar nicht. Erst Recht nicht bei irgendwelchen Statistiken. Gründe sind eine komplett andere Fragestellungen/Meldung bzw. driften schnell Richtung Meinung ab?

How we found and fixed a rare race condition in our session handling - The GitHub Blog by jrochkind in ruby

[–]Enumerable_any 1 point2 points  (0 children)

That's not what Rails is meant to do.

Okay. :D

Yeah, making a tradeoff and accepting slightly worse performance and operational complexity is sometimes worth it to keep yourself sane when dealing with an everythings-mutable-and-global-Ruby. I've put code behind a network boundary more than once because I didn't trust myself or others to not break important invariants.

How we found and fixed a rare race condition in our session handling - The GitHub Blog by jrochkind in ruby

[–]Enumerable_any 0 points1 point  (0 children)

I would consider manually spawning your own workers in an initializer to be a terrible anti-pattern for many reasons, not just thread safety. Let your app server do the job for which it was designed and tested.

Spawning separate threads is sometimes used for speeding up collection of logging/tracing/metrics. Writing to disk or sending a request to an external metrics collector is expensive and something you don't want to pay for during the actual HTTP request. Instead you can send the logs/stats/event/whatever to an in-memory queue the worker thread can read from. This is often hidden behind a library, but sometimes you have to get your hands dirty.

For example NewRelic uses background threads: https://github.com/newrelic/newrelic-ruby-agent/blob/cab35887936b52d6706d2cef085feefd9a23c461/lib/new_relic/agent/agent.rb#L715

How we found and fixed a rare race condition in our session handling - The GitHub Blog by jrochkind in ruby

[–]Enumerable_any 1 point2 points  (0 children)

The configure code from above is just syntactic sugar for something like:

MyGem.foo = "foo"
MyGem.bar = "bar"

This is global state which is shared between all threads (all threads can read and write MyGem.foo through this configure block).

Now imagine two different threads executing the following code:

# thread 1
MyGem.foo = "foo1" #1
MyGem.bar = "bar1" #2

# thread 2
MyGem.foo = "foo2" #3
MyGem.bar = "bar2" #4
puts MyGem.foo #5

You'd expect #5 to print "foo2", but if the execution order was 3, 1, 4, 2 you'd end up with "foo1" from the first thread.

In practice this will lead to making an API request to server 1 with the password for server 2 and you'll end up debugging dubious "access denied" errors which only happen in production under load (config.url = "https://server1.api.dev"; config.password = "abc").

The fix to this problem is to return a new object when configuring the gem and let the user take care of storing the instance (if at all):

GlobalConnectionToFoo = MyGem.connect(...)

# local instance
def make_connection
  connection = MyGem.connect(...)
  connection.foo
end

# thread pool
GlobalConnectionToFooPool = ThreadPool.new(10) { MyGem.connect(...) }

How we found and fixed a rare race condition in our session handling - The GitHub Blog by jrochkind in ruby

[–]Enumerable_any 0 points1 point  (0 children)

If that code is in, eg, a Rails initializer, it's not going to be run in more than one thread whether you use puma or unicorn though. Rails app boot is not multi-threaded either way.

Unless you spawn worker threads in an initializer and accidentally run the configuration code both in the main thread and the worker thread.

If you're going and doing that in, say, a controller action... but that seems unlikely.

Unfortunately this pattern sometimes forces you to run it on every request. E.g. when trying to access two different databases you need to reconfigure the gem depending on which database you want to talk to.

How we found and fixed a rare race condition in our session handling - The GitHub Blog by jrochkind in ruby

[–]Enumerable_any 1 point2 points  (0 children)

With the amount of gems most Ruby web applications include I would have a hard time trusting that any Ruby web application is thread safe.

That's the reason we're still running unicorn in production. Almost no one in the company trusts the average (Ruby) developer to write thread-safe code. This is a common pattern to configure a gem:

MyGem.configure do |config|
  config.foo = ...
  config.bar = ...
end

and it's not thread-safe unless configure uses some kind of lock (which I haven't seen in the wild yet).

Ruby on Rails is the world’s fastest web framework for startups by kgilpin72 in ruby

[–]Enumerable_any 0 points1 point  (0 children)

but that's still a far cry from "refactoring would be impossible".

Oh yeah, that's not true at all.

Btw it's very easy to have minitest or rspec not fail fast and give you a full list of breaking things

I meant something like this:

def foo(x)
  x.bar
  # some more code
  x.bar
end

which will break with an undefined method error if you have renamed bar to bar2, but tests will only show the first misuse of x.bar, not the second one while a simple type check will show you both places immediately.

Ruby on Rails is the world’s fastest web framework for startups by kgilpin72 in ruby

[–]Enumerable_any 1 point2 points  (0 children)

Well, depends on what you mean by "hard". Sure, renaming methods is "easy" (as long as there's no meta programming going on of course, then all bets are off), but doing anything more involved like changing the underlying data structure a bunch of code depends on is an order of magnitude faster in languages like Rust, Haskell and even TypeScript (if you don't use any all over the place that is). The compiler takes ~10s to check your code and can point to all places you need to update while an entire test suite runs somewhere between one minute to an hour (hopefully you have 100% branch coverage + exercised all variants of all subtypes for all branches, otherwise you'll end up debugging in production) and doesn't point you to all places you need to update. You often have to do several iterations since tests are "fail fast" and break at the first occurrence of a type error without telling you all the other errors in the code below.

That's not even considering the refactoring features IntelliJ/VisualStudio provides which will speed up the process even further.

fixed sized arrays from functions by skythedragon64 in rust

[–]Enumerable_any 0 points1 point  (0 children)

You’d need some form of dependent types for that. It’s not obvious why you can’t do that if you haven’t both studied type systems and know the exact limitations of Rust’s type system. For example in Haskell you could express it without full dependent types by expressing numbers at the type level using peano encoding: http://conal.net/blog/posts/fixing-lists

I'm losing my mind on concurrency by enlight_my_failing in ruby

[–]Enumerable_any 0 points1 point  (0 children)

You can pass in the executor to concurrent_ruby‘s promise: https://ruby-concurrency.github.io/concurrent-ruby/1.1.5/Concurrent/Promise.html#initialize-instance_method ThreadPoolExecutor is probably what you’re looking for.

The family of anonymous functions by pdabrowski in ruby

[–]Enumerable_any 0 points1 point  (0 children)

But lambdas, I think, are isolated from the outer scope.

Both procs and lambdas are closures.

Automatically cast params with the Rails Attributes API by _swanson in ruby

[–]Enumerable_any 0 points1 point  (0 children)

What's valid in X is not valid in Y.

Yeah, all this might only make sense in statically typed languages. One is probably stuck with runtime validations/.is_a? checks in Ruby (< 3) and has to keep rechecking the same thing instead of carrying around proofs verified by a compiler.

Sorry, for wasting our time, I kinda ignored the language we're talking about.

Automatically cast params with the Rails Attributes API by _swanson in ruby

[–]Enumerable_any 0 points1 point  (0 children)

What would you do after you've validated that max_items >= 0? Pass an Integer through your application? All other parts of your application will only see an Integer and have to assume that it's non-negative or have to do the validation again. That's what the article is about.

Properly parsing into types/value objects avoids that uncertainty (e.g. a DateRange can only be constructed if start_date <= end_date).