Looks so promising, what's the timeline for something like MUI?
HN user
rurabe
It's not perfect or painless but I think jsonapi-serializer is pretty good
Big fan of raw sql, but practically speaking (as it relates to developing with rails) CTEs can be rewritten as subqueries, the advantage being that they are linear instead of nested in SQL.
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)The problem here is that you are loading all the votes as AR instances which is fine at small scale, but as your app gets larger, loading and instantiating thousands of Vote instances just to then break them down into an integer will start to drag on your controller.
If you can count in the database itself it's a big win. Although no doubt your solution is cleaner code.
One neat trick that I think is relatively lesser known is that you can select arbitrary sql expressions in ActiveRecord and those values are made available on the instances.
(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
What about incorporating Ukraine, Belarus, Georgia, and Russia into NATO?
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
Honestly, I fear the resistance being too effective.
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.
The military endgame sadly is somewhere between a destroyed Ukraine in perpetual conflict and regime change, depending on the efficacy of Ukrainian resistance.
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.
H3 cell indexes are just integers so you can easily make a compound index of (cell_index,timestamp). This would be easy in SQL and I'd have to imagine just about anything else that supports a compound index.
Yeah each user gets the choice right now as a consequence of LinkedIn's product design.
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.
Note that LinkedIn could make this whole issue moot by putting their data behind a login tomorrow. The 9th circuit decision pretty clearly stated that.
The only reason the data is public is for marketing purposes, to sign up more users.
This is a pretty bad headline. I don't know that i would characterize this as revived.
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
i mean he doesn't seem like he's gonna launch this as a startup so cynically why else would he go to all the trouble?
i mean thats actually fine, i think it's the copying + victimization thats irking me
yeah i mean same argument about why they shot harambe because some kid wanted to climb the fence into the gorilla exhibit.
i actually agree that corporations have too much power versus individuals in society. but it's a bit much to jump into the gorilla exhibit and then write a clickbait post about whether it was unethical.
dude literally emailed the ceo and was like yeah i used this component, but what else could i have used, and yeah i used this other thing i learned about from working there but its popular! and i used yet another thing but you guys werent using it when i worked there.
im not saying any of this is illegal. just weird to copy your previous employer's tech stack, open source it, and try to play the victim and clickbait HN.
i mean you're right, he doesn't have to. but i'm pointing out that he's not being personally persecuted for no reason. doing literally anything else than open sourcing his employer's tech stack makes the whole concern about needing protection pretty unnecessary.
ianal but absent some nda seems like it's probably legal for him to do it.
it just seems like kind of a dick move. i could mentor new engineers, wait until someone told me about a really cool idea, then steal it from them and build it myself. there's no law against it, it's just is kind of a dick move and seems kind of wrong.
as noted above, ceo is acting like a dick as well. but i think the way this dude is trying to play the victim through clickbaiting HN is a bit much. just my opinion.
overbroad patent trolls: yeah i agree
this case: build literally anything else except for the thing that he paid you to learn how it works.
with regard to ethics, two plausibly valid options:
either you believe that people should act ethically even if that means forgoing actions that they are legally allowed to make. if you believe that, isn't it wrong to build a free, open source competitor using all the knowledge you just got from working inside a company?
or:
you believe that business is the law of the jungle, and everyone is free to do whatever they can get away with legally. in which case why is it a problem for amasad to get lawyers involved?
it seems this dude's victimization relies on holding amasad to a higher standard of ethics than he holds himself. maybe he should because he has more money and power. or maybe not?
yeah patent trolls and frivolous lawsuits are definitely a problem, but this doesn't really smell the same.
and i see your point, he seems to be within his rights to do this. even if i would be pretty irritated if someone ripped off my idea after working with me, it's problematic if he is being bullied from doing so.
i don't know how that extends to ethics though, which seems to be the theme of his post. either there's a moral code and i think he's shading the wrong side, or its the law of the jungle and then the ceo is free to use a lawsuit to stop him.
i think it's just the general sense of thirst and drama that i get from his blog and emails that make me think he's really after the publicity instead. which he has accomplished.
agree the ceo was pretty arrogant but you can still be petty if someone is asking for it.
pretty weird/low class move to build a free clone of the product you just worked on.
pretty petty decision to threaten to sue your former intern for his weird move.
also, threatening someone with money is a pretty surefire way to look like an asshole.
similarly petty decision to spend hours documenting everything to post on HN and start throwing mud in public.
everyone seems well within their legal rights but ethically seems like there were a lot of off-ramps for someone to be the bigger person and none were taken.
Thanks for posting this, I didn't realize there was a such a tangle of definitions as to what was accessed.
That said, doesn't this pretty much include anything on the web?
(a)Whoever— (2)intentionally accesses a computer without authorization or exceeds authorized access, and thereby obtains— (C)information from any protected computer;
where a "protected computer" is:
(e)As used in this section— (2) the term “protected computer” means a computer— (B) which is used in or affecting interstate or foreign commerce or communication
seems like that would catch an awful lot of webservers.
The CFAA is a law about how you access systems, so this ruling defines "authorization" under the CFAA as "had legitimate access to this system" only.
There are many other laws that you can still be charged with that govern what you access, irrespective of how, ie copyright, child porn, confidential information.
The people who view this as a win are worried that if "authorization" is defined as "against any rule, made by anyone" then the CFAA could be used to criminalize almost anything online. Note that restriction of the CFAA does not let you off the hook of other laws.
The people who worry about this are worried that judges had to use a fair bit of extrapolation and guessing as to the intent and effects of the law because the wording is pretty vague, and probably problematic for internet activity if interpreted very narrowly.
There are so many things going on here it's easy to conflate them but here's how I read it:
The CFAA is a law about how access is attained not what is accessed. There may or may not be other laws that have penalties for what is accessed given the nature of what is accessed, but that is a separate issue from the CFAA.
For example, I am sure that there is some statue I would be in violation of for walking out of a CIA office with a binder of classified information. This should be illegal regardless of how it's accomplished.
By contrast I think it should probably be a crime to gain access to a system through either technical exploits or social engineering, even if all you do is access cat memes that were public anyway.
Layered on these issues is whether you think judges should stick to literal textual interpretations or rule based on the projected impacts of their decisions.
Personally, as many have laid out, a strict textual approach opens the door to let private companies write felony law for literally anything they want, which seems an unworkable way to run a society.
I think it's much more prudent to restrict this law to methods of access and allow other laws dictate what can and can't be accessed or used (copyright law, state secrets etc).
A final question is how to test for whether methods are authorized or not. Someone here suggested the test should be the inclusion of "material deception". This I think falls short because a lot of behavior that we would not want to criminalize would satisfy the test. Should it be illegal to use a VPN? Because I can see that being construed as material deception. Sacha Baron Cohen dressed up as Borat is unquestionable material deception but I don't think it should be illegal for him to use a computer when doing so.
Ultimately I don't know that there is a bright line definition, but that's okay because we use a "reasonable person" standard a lot in law, (and we should seek to seat judges that are the most reasonable of us).
- No reasonable person would impersonate another to customer service to steal their phone and thus password. - A reasonable person might want to use a VPN to avoid being tracked by private corporations. - No reasonable person would exploit a zero day bug on a major corporation. - A reasonable person might change their user agent to see how a site looks on a phone. - A reasonable person might look up and save articles from a database they have access to.
As is usually the case, it's complicated.
The government has actually taken steps to push us down that road by mandating that all generation is renewable by 2045. Of course that's easy to say and harder to do, but I'm not sure it should be up to the government on how we get there.
The entity with the most responsibility to get there is HECO, which has a bit of a mixed record.
On one hand they have been pretty good about encouraging customer generation with net metering, and later grid supply options. Unfortunately there is a bit of an engineering problem there as we have pretty much reached the saturation of customer solar such that in the middle of cold sunny days, there is more electricity being produced than consumed (see duck/nessie curve). This would sound like a good thing, but with an extremely old grid and no utility level storage, it's kind of not.
A more reactive utility perhaps would have done a better job upgrading the grid to allow for distributed generation, but HECO spent the better part of the last 5 years trying to get themselves sold to a mainland utility to drive returns to shareholders instead of placing institutional focus on solving current or future problems for ratepayers. Serving two masters, etc.
Kauai has a much more interesting situation as their utility went through that whole sale to the mainland thing in the 90's, which failed and provided the opportunity for the ratepayers to buy the owners out and created a cooperative utility. I don't live there but from the outside looking in it looks like they are being much more proactive about renewables and more importantly, storage.
Absent some kind of massive game changer in wave or wind generation, the whole game is really storage. I know a lot of people who would love to install solar, but HECO is already at max capacity absent a way to store electricity at scale.
Finally the part that gets talked about the least is economic inequality. Hawaii's real estate is expensive, but it is driven by investment from outside the state, making it almost impossible for people who live here to afford homes. That interacts with the energy piece because you have to be a homeowner to benefit from solar, so solar contributes to wealth inequality as people who are fortunate enough to own homes also reap the benefits of government subsidies and cheap electricity, while people too poor to own homes are left paying the retail rates. And this is before we even get into the distortions of behavior that net metering encourages when you treat a kwh of solar in the day as equal to a kwh of petroleum at night.
hypotheses (not in any order)
1. economic concerns 1.a. not having a job is not an ideal situation for attracting potential partners 1.b. having less disposable income means less ability to take people on dates 1.b.i covid has made this much harder 1.c. much harder to live alone 1.c.i. you might have roommates and feel it awkward to have sex with them in the house 1.c.ii. you might live with family and feel it awkward to have sex with them in the house 1.d. hard to pay for sex regularly 1.e. might not feel ready for even the chance of having a child 1.e.i might not feel like you can afford a child 1.e.ii having a child might have detrimental effects on careers (especially for women) i.e.iii you would think that increased birth control efficacy would reduce this? 2. health concerns 2.a increased awareness and fear of stds in the post aids era 2.b. more recently, covid 3. social issues 3.a. social media has provided an alternative and to varying degrees replaced some in-person interaction 3.b. porn is free and incredibly prevalent 3.c. slut shaming 3.d. fear of stigma of teen pregnancy 3.e. abstinence education 3.e.i but hasn't this always been the case? 3.f. video games are a lot of fun and less work 3.g. tinder 3.g.i must be attractive on looks (and profile wit) alone 3.g.ii winner take all dynamics
Thrown under the bus? Asians have by far the highest household income of all racial groups in the US[1]. Where's the beef?
Is it fair to be born into a racial group thats 50% or 25% less likely to earn a degree?[2] Perhaps taking a person's circumstances into consideration, while narrowly and individually unfair, is actually fairer in a broader sense. That goes for race, socio-economic status, and whatever else impairs your opportunities.
It's just disappointing to see the victimization being thrown around here, especially in contrast to the groups being vilified. The sad truth is that a sense of empathy and being able to see the bigger picture will get you a lot farther in life than the words on your diploma.
[1] https://en.wikipedia.org/wiki/List_of_ethnic_groups_in_the_U... [2] https://en.wikipedia.org/wiki/Educational_attainment_in_the_...
I mean you're half right here, but who do you really think in American society is doing that much better than Asians? Hispanics? African Americans? Women? The poor? The middle class for that matter?
The reality is that rich, white men have been entrenched in power since long before American society was a thing. You might consider whether retreating into tribalism and picking a fight over affirmative action is eroding or entrenching that advantage by dividing the consensus to change it.
https://www.vox.com/2018/3/28/17031460/affirmative-action-as...