rurabe
Joined 14 years ago
Joined 14 years ago
imo the analogy would be like to eg https://www.macrumors.com/roundup/iphone-17-pro/ what you are presenting is "when was this last released" as opposed to a forward looking "should you buy this now"
but even thats not true because you are considering future stuff, so maybe its jus the framing of "done" vs "should i get into it now" not being the same thing when the definition of done is more stuff is coming
i love the recommendation engine though!!! make it more prominent!
With AR queries you can do the same and make it linear in ruby (and then the computer doesn't really care if your sql is nested)
last_three_posts = Post.limit(3).order(created_at: :desc)
@posts = Comment.where(post_id: last_three_posts)If you can count in the database itself it's a big win. Although no doubt your solution is cleaner code.
(Also I think the above sql needs to be tweaked since you need the votes count grouped by comment not by post)
A one to many relationship in pure SQL is an awkward fit with a Rails app as it requires serializing (at least) the many as json. Then there's this weird conceptual gotcha where one resource is an AR instance and another is a pure hash.
I'd probably make a scope and association to help out here:
class Comment
scope :with_vote_count, ->{ joins(:votes).select('comments.*').select('count(votes.*) as vote_count') }
end
class Post
has_many :comments
has_many :comments_with_vote_counts, ->{ with_vote_counts }, class_name: 'Comment'
end
# in controller
@posts = Post.includes(:comments_with_vote_counts).limit(3).order(:created_at: :desc)
# in view/serializer, posts and comments are both AR instances
@posts.each do |post|
post.comments.each do |comment|
comment.vote_count # => Integer
end
end
This should give you 2 queries, one to load the posts, then one to load the comments and vote counts for the relevant posts. Controller stays nice and slim and the complexity is delegated to sql via the join scope, without any other dependencies.* edited for HN code block syntax
Ukraine gets the Donbas back in return for international recognition of Crimea as Russian territory.
Fanciful, I know. And questionable whether Article 8 would hold up. But advantages:
1. End to the conflict 2. Security guarantees for all of Europe 3. Repurposing of NATO from anti Russia alliance to anti China alliance, ie pivot to Asia
Russia is on the offensive when viewing this conflict in isolation. Zoom out to geopolitics and it is very much on the defensive.
They are locked in this conflict and if they cannot achieve their goals they will escalate. They also own the most nuclear weapons of any country on earth.
This is what the Art of War says when it says not to put enemies in a corner.
This is also a very realpolitik take on this. It goes without saying that all of this is a humanitarian disaster.
Sorry to say, autocrats do not withdraw from a conflict like this regardless of attrition. Their power is their legitimacy and defeat is a threat to both their rule and probably their life. I mean look at how much flak Biden took withdrawing from Afghanistan despite being able to say that it was a horrible idea and someone else's fault.
This is a little different from Afghanistan and Iraq though, Russia's security concerns are valid and probably ameliorated by Ukraine as a failed state (as opposed to a NATO aligned state) so conquering and pacifying the country is not necessary.
The only real humanitarian solution is a diplomatic solution. I wonder if written guarantees that Ukraine and Georgia will never join NATO would be enough now honestly.
As far as I know, there's no reason it couldn't be "Log in to see this profile".
I believe the injunction bars LinkedIn from blocking hiQ specifically from accessing the publicly available information (which again is public by LinkedIn's choice). They made a point to draw a distinction between the public stuff and stuff behind a login/password.
The only reason the data is public is for marketing purposes, to sign up more users.
The same 9th circuit who held last year that LinkedIn could not block hiQ from scraping public data, just got asked to reconsider the same case, except now there is additional precedent that SCOTUS says if you had permission to access the computer then it's not a violation of the CFAA (even if you are a shady corrupt cop).
Hard to see this turning out any other way than the 9th circuit reaffirming their decision (or even strengthening it) and then it's up to LinkedIn to try SCOTUS again