News for hackers. Stuff that matters.

kag0

Re:Don't DRY Your Code Prematurely on Thursday May 30, 2024 @03:08PM (#40527485)
In my experience DRY and many (any?) other coding principles are only problematic when misused. They're typically misused because the user doesn't understand the motivation or underlying value of the principle in the first place.

I think the example in the article does a bit of that as well. The example sets a deadline on a thing (a task or payment) by validating the deadline against the current time, and then presumably doing something else that isn't shown. The article argues that in the future a task might have different validation requirements than a payment, and they're only coincidentally the same today; so it would be foolish to abstract the deadline setting logic today. BUT, the reality is that the real coincidence is that payments and tasks have the same set of validations, not that the logic to validate a deadline is coincidentally the same. In my opinion "good" code would be fine to have separate set_task_deadline and set_payment_deadline methods, but only one validate_deadline_is_in_future (or whatever) method, alongside other validation methods which can be called as appropriate by each set_x_deadline implementation.

Disclaimer: the code is so short and trivial that it doesn't matter, I think we can all assume that this concept is extrapolated onto a bigger problem.

Re:Don't DRY Your Code Prematurely on Thursday May 30, 2024 @02:51PM (#40527325)
I've never heard this one before, but I love it. Unfortunately we've also got "Don't Abstract Methods Prematurely" and "Descriptive And Meaningful Phrases".
Re:What even is a JSON number? on Wednesday April 03, 2024 @10:02PM (#39925748)
Yeah I disagree.

As the article said

> RFC 8259 raises the important point that ultimately implementations decide what a JSON number is.

Any implementation dealing with money or monetary rates should know that it needs to deal with precision and act accordingly. If you want to use JavaScript to work with money, you need to get a library that allows you to represent high precision numbers. It's not unreasonable to also expect that you get a JSON parsing library that supports the same.

oh, TIL that you can support large numbers with the default JavaScript JSON library https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

Re:Database Fundamentals on Friday December 15, 2023 @05:19PM (#38659534)
I agree, but in the context of this conversation I think we're just talking about databases/state. So "is M a distributed system on its own?"
No. A rolling shutter deals with different parts of the sensor being exposed at different times within one frame. It generally requires a much faster object (think airplane propeller or light with PWM). This is effectively multiple frames captured normally and a mistake in the algorithm stitching them into one frame.
This is exactly what I think of when considering actual remote work expenses for myself. I live in 600sqft which is not bad for a place to live. But not great for one, let alone two people to work. In terms of quality of life, I think having to work a) within 10 feet of my bed , b) on the kitchen table, having to clean the table of work before every meal, or c) on the couch which is not at all ergonomic; are all huge steps down from the office.

If you already have an office/den to work from, I can see how it's not a big deal. But if you're looking at buying a first home and your requirements go from one or two bedrooms to three bedrooms/1 bedroom & two offices, that's brutal.

From the link

> Although the law regarding these expenses is not yet decided, remote California workers may also be entitled to reimbursement for: > * the cost of dedicated home office space (reimbursement is more likely if the employee was renting or had plans to rent the space to a third party prior to beginning remote work). (Cal. Lab. Code § 2802 (2022).)

If that actually happens I would be very shocked/impressed. But I'm highly cynical of how wants vs needs are going to be interpreted there. To me the mental health benefit of being able to physically leave work is a need, but I know not everyone is likely to see it that way.

Re:Oxide: The Cloud Computer on Thursday October 26, 2023 @07:51PM (#38033124)
It would have been wild if you'd built what you did with founders + 3
Re:Was Rust Worth It? on Wednesday October 25, 2023 @07:33PM (#38019721)
disclaimer: I'm not a big rust programmer, but I appreciate it.

I think it's a matter of perspective/background. Depending what language you're coming from you might appreciate a lot of the more modern language features, or binary size, or performance. On the other hand, you might already be working with a pretty cutting edge language with a garbage collector or other and decide that Rust has some cool benefits but not worth the switch.

There are a lot, the most mainstream are going to fall under "socialism". But to give you a specific answer, check out "Alternatives to Capitalism: Proposals for a Democratic Economy". It's a debate between Robin Hahnel and Erik Olin Wright around their personal ideas.

More broadly speaking, any number of systems could compensate people for innovation and problem solving (note I don't think competition should be rewarded in its own right, and risk taking isn't necessary in many systems) by providing them an elevated quality of life. The main difference to our capitalist system today is that rather than trying to accumulate as much personal capital as possible, value created from innovation would only go to the individual as needed to incentivize them. The rest would go to improving the world and lives of the people around them. Of course this requires the individual have some agency in that improvement, which we find lacking in the Soviet Union or other failed communist states.

Re:How to Lose Functional Programming at Work on Monday January 30, 2023 @08:47PM (#34589777)
> Immutable data does not necessarily let you answer the "what state does this value hold" question easier than mutable data.

Yes, it does. You're right that you still have a chain of operations to figure out first. But with mutable data you need to do that, as well as know when you're looking at the data, and what else is running in the system that has access to that data.

It doesn't grant superhuman insight into program state, but it is orders of magnitude simpler than mutable data (perhaps several orders depending on the scope of the data).

Re:The Window Trick of Las Vegas Hotels on Monday January 30, 2023 @08:20PM (#34589502)
This is a false dilemma. There's no need to choose between ugly buildings with climate control and attractive buildings with poor climate control. It can be very hot in Las Vegas and the buildings shown in the article have climate control more than capable of making you cold in the summer.
Re:Apple CEO Tim Cook requests and receives a 40% pay cut on Tuesday January 24, 2023 @02:58PM (#34509339)
Losing your job is a big deal to the average person, but a salary cut is immaterial to a big tech executive. An executive salary cut would save hundreds of jobs. People are laid off because the company is trying to spend less. There are multiple people in the same role and the headcount can be decreased to decrease spend on overall salary without decreasing the salary of individuals. But just because there is only one person in each executive role does not mean that money can't be saved on executive salaries.
Hardware like TVs are especially insidious because unlike a service you don't simply decide to stop using it one day and the ad revenue stops. Rather ad revenue continues for the lifetime of the TV and there is very little chance that a company will forgo that recurring ad revenue in exchange for an increase in up-front MSRP
> change patentable subject matter to (effectively) exclude computer software

I don't necessarily disagree with you, but what makes software unique in that it would be effectively excluded by changes while other subject matter (presumably) wouldn't be affected?

It's A

But once users spend a lot of time in an area wearing the device, they have a better ability to navigate that area even with the device removed. I imagine it's similar to how you would be able to navigate your home in low light

Re:Amazon “suicide kits” have led to teen deaths on Sunday October 09, 2022 @01:22PM (#33143271)
> a book with instructions on how to use the chemical to attempt suicide

I'm not an Amazon apologist. But if someone is adding a book on how to commit suicide to their cart then my first worry is not going to be what an online vendor suggests to bundle with that.

> “knowingly assisting in the deaths of healthy children by selling them suicide kits.”

I think it shows a wild conception of health if we think someone buying a book on how to commit suicide and tools to go with it is healthy

it can be good / a relief to find out you've been doing it wrong the whole time, because it means that now you can do it right and you may yet reach your objective
Valid question, the article has a footer

> JSON5 is in the top 500 by both dependents and PageRank

that probably confirms the project is significant but doesn't answer your question.

Re:Zipcar will charge your credit card for no reason on Tuesday July 26, 2022 @12:12AM (#32234167)
Did you contact them or get any response back?

Zipcar will charge your credit card for no reason

Zipcar will charge your credit card for no reason and would rather have you dispute with the credit card company than refund you.I encountered this and thought it was interesting. If my company had charged someone and found there was no trace of it in our system, I would be very concerned. But at Zipcar they seem to play it off as not a big deal. I wonder how much revenue they make from...

( Read More... | 20 comments | 65 points | on HN )
Re:Log4j: The pain just keeps going on Sunday July 24, 2022 @01:33PM (#32215699)
is this ML workload an "I trained a model, pickled it, and now we ship that around in production" type situation?
Re:The Lightning Network: Turning Bitcoin into Money on Friday July 15, 2022 @05:21PM (#32112938)
Thanks for the recap. That sounds pretty familiar. I found https://en.bitcoin.it/wiki/Block_size_limit_controversy to refresh myself as well, but there's clearly a lot of detail missing.
Re:The Lightning Network: Turning Bitcoin into Money on Wednesday July 13, 2022 @04:00PM (#32088046)
I've stopped following bitcoin at a deep level for some time. Could someone summarize for me what changes/problems led current bitcoin to need lightning?
Re:The Lightning Network: Turning Bitcoin into Money on Wednesday July 13, 2022 @03:51PM (#32087926)
running an actual server on your phone would absolutely execute your battery life.

if we hadn't had NAT and reverse tunneling then things might have evolved differently. maybe a way to push data to phones over UDP or low power servers that could wake up to handle single requests. but it didn't play out like that.

Re:How to organize yourself as a solo founder on Thursday April 07, 2022 @03:46PM (#30949499)
I think manual copying would kill it for me. I'm just back and forth between multiple devices throughout the day and it seems like that would amount to a lot of copying. Although there's only one of me, so there's never a need to merge. So it's not really multi-directional syncing, it's more like broadcast from whatever I'm using currently to everything else.
Re:How to organize yourself as a solo founder on Wednesday April 06, 2022 @12:46PM (#30934484)
How do you keep this synchronized between devices? I had tried this with a git repo but pull/pushing before/after jotting down a note on my phone got tedious.
Re:Why coding interviews aren't all that bad on Saturday March 19, 2022 @05:08PM (#30737593)
The author asserts that simple coding interviews

> involving nothing more than simple and fundamental data structures

is the objective way to evaluate a candidate. Because those

> do require a good understanding of programming fundamentals

But in my experience, someone who can memorize those basics can also memorize their implementations. So it is quite possible to have someone code a perfect BFS, but have no grasp of programming fundamentals.

Re:How Zillow's homebuying scheme lost $881M on Saturday March 19, 2022 @04:43PM (#30737428)
not the original commenter, but I think they said it

> we currently build condos but don't build the public spaces that serve to supplement them and make them comfortable for, e.g., families with kids.

you need

* several bedrooms

* some utility space (for things one would have otherwise done in the garage)

* nearby [safe] parks and playgrounds

* nearby recreation centers

* good schools

etc

Re:Fuchsia IDL Overview on Thursday March 17, 2022 @08:51PM (#30717501)
Odd they reference optional types (note it seems to be a type-level optional rather than field-level) and use this `:optional` syntax. But I don't see a section that explicitly describes what optional is. Or how it's recommended to integrate with different languages.

I'm very happy to see the concept does crop up somewhere. It's always a shame to see IDLs that don't leave much room for languages to leverage null-safety features. Especially ones that don't make the distinction between the concept of optional and default (looking at you proto3).

Re:The day Steve Jobs dissed me in a keynote (2010) on Wednesday March 09, 2022 @02:37PM (#30619006)
cryptocurrency is to banks/paypal as itunes was to traditional music buying/licensing

I'm not saying I agree (or disagree) but the analogy is fairly clear to me

Older »