Hacker News new | past | comments | ask | show | jobs | submit | more durkie's comments login

reminds me of an anecdote from Le Ride (https://en.wikipedia.org/wiki/Le_Ride ) that talks about in one of the early Tours de France, a rider was disqualified because he broke his crank, hobbled to a nearby town, found the blacksmith, and the rider welded his own crank back together, but the blacksmith's son operated the bellows and this was seen as too much external assistance.


Looks to be this rider - Eugène Christophe:

https://en.wikipedia.org/wiki/Eug%C3%A8ne_Christophe


Eugene Christophe' story is actually a meme for French fans because almost every year on French TV, the History guy will tell the story.

No matter what happen and where the race goes.


My guess is that they're referring to how Rails will instantiate full objects for ActiveRecord database requests and this is often not what you want, because we often just want a single or a few attributes from the model.

So if you had a model Activity, and you wanted to get the names of some of them, the slower/higher memory approach would be something like:

Activity.where("id < 100").map(&:name)

This pulls results from the database, instantiates each as Activity objects, then iterates through each to get its name. You can see in the logs that it grabs the entire object:

Activity Load (133.7ms) SELECT "activities".* FROM "activities" WHERE (id < 100)

.pluck instead grabs just the field you're looking for without instantiating the entire object. So the better way to grab the list of activity names would be like:

Activity.where("id < 100").pluck(:name)

And you can see from the logs that it makes a more narrow query:

(3.8ms) SELECT "activities"."name" FROM "activities" WHERE (id < 100)


Awesome thanks for the reply, am making an effort to learn more activerecord and didn’t know pluck would function like this. Was playing around with it last night on a ruby hash and missed the memory advantages


yes, this exactly, thanks.


Not at all surprised that Laurenz Albe played a key role in figuring this out -- I've learned so much about postgres from his Stack Overflow answers over the years.


What material though? Nanosolar was also doing CIGS roll-to-roll cells, and that didn't work out too well for them.


Crunchy data (which can run on AWS/Azure/GCP) supports Citus: https://www.crunchydata.com/blog/announcing-citus-support-fo...


also the site is "protected" by dmca.com


any idea why postgis hasn't formally incorporated S2 cell functions? It seems like it'd be right up their alley.


So this is kind of tangentially related here, but is there a "state-of-the-art" or best practices on digging through big JS apps / frameworks / objects? Ultimately this is all code running on my machine, so it feels like it should be accessible in the console somewhere.

I've had to do a fair amount of this with a Chrome extension I maintain that hooks in to routing (creating bike / running routes) sites, and fortunately these mostly use React and I'm decently familiar with how to hook in to that.

But is there a limit here? Is there a way to actually keep code from being inaccessible to the console (aside from obfuscation / compiling to wasm)?


Not in a way that differs from old-fashioned web scraping. If the website you're targeting is built using a framework and is server-side rendered then it'll most definitely also send all the data it needs for hydrating on the client as JSON, usually attached to the window object as "window.__INITIAL_STATE__" or similar. There are no limits :–)


I'm working in vue, and get lost at the transition between my code and the framework stuff, when an error "falls through the cracks", and the call stack comes from the framework. What do you do for that, even?


Great question. Would love to know more about this from those with experience.


wow, thanks for the thorough reply. Atlanta's pawpaw population is taking off and they're fun to introduce to people, but I've been hesitant to do so more lately knowing that they may not be 100% good for you. seems like it's actually not so bad in moderation.


Yeah my personal rule of thumb is not to eat more than two per day and six per week, and to periodically check Google Scholar for new research. If you're going to cook with them, I'd recommend sticking to recipes that involve adding them to cooked food (e.g. as a layer on top of a cheesecake) rather than applying heat directly to them. And also to eat them only during the month or so per year that they're in season, rather than freezing them and eating them year round.

And if you haven't already seen it, here are Neal Peterson's recommendations for safe consumption:

https://www.petersonpawpaws.com/are-pawpaws-safe/

His recommendations are notable mainly because he's the one who kickstarted the pawpaw renaissance and released many of the most popular (and best) cultivars on the market today.


> Finally, and most importantly, do not inject pawpaw fruit directly into your veins.

Duly noted lol


Parents eat it at least once a week. They have a tree that bears so such it broke it's head off due to the load once when I was over there.The tree are hallow and not terribly strong. I think you're safe.

My wife hates the scent of the thing though.


I wonder if one might liken this to arsenic in apples. I tend to eat the whole apple, core, seeds, stem, but there's so little it's not a biggie.

Plants have to fight off bacteria after all.


even the stem??? and here i thought i was adventurous for not peeling carrots and potatoes


Oh I don't stop until I reach the root of the tree.


Gave me a good laugh.


Wait till you learn about the people that eat kiwi fruits with the skin on...


Surprised the efficiency is so low. Those Wh/mi numbers are comparable to a Tesla Model 3 or Model Y, vehicles that presumably weigh substantially more.


Because weight is surprisingly meaningless. It's all about drag.


And have way more cross-sectional area for drag.


But probably a much better drag coefficient


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: