HNHacker News
TopNewBestAskShowJobs

chacham15

1,625 karma · joined October 28, 2011

submissionscomments
chacham15··on My favorite programming problem to teach: Digit length (2019)
Am I the only one who, in response to: "dont use loops" thought of the following:

   int numDigits(int num){
     if (num < 0){
       return numDigits(-1 * num);
     }
     if (num < 10){
       return 1;
     }
     if (num < 100){
       return 2;
     }
     if (num < 1000){
       return 3;
     }
     if (num < 10000){
       return 4;
     }
     if (num < 100000){
       return 5;
     }
     if (num < 1000000){
       return 6;
     }
     if (num < 10000000){
       return 7;
     }
     if (num < 100000000){
       return 8;
     }
     if (num < 1000000000){
       return 9;
     }
     return 10; // cant be more than 10 since sizeof(int) == 4, otherwise extend to 19
   }
chacham15··on Don't DRY Your Code Prematurely
I think it depends on how you deduplicate your code. Creating a DeadlineSettter as illustrated is definitely too much, but creating a function:

  def assert_datetime_in_future(datetime):
    if datetime <= datetime.now():
      raise ValueError(
        “Date must be in the future”)
and then calling that from both places seems fairly reasonable to me.
chacham15··on Veo
I dont think "turn the horse's head 90˚" is the right path forward. What I think is more likely and more useful is: here is a start keyframe and here is a stop keyframe (generated by text to image using other things like controlnet to control positioning etc.) and then having the AI generate the frames in between. Dont like the way it generated the in between? Choose a keyframe, adjust it, and rerun with the segment before and segment after.
chacham15··on Identifying Stable Diffusion XL 1.0 images from VAE artifacts (2023)
This logic has a key flaw: just the fact that the size of the space is different doesnt mean that every representable thing in the larger space is a thing we care about. E.g. a person with three hands may not have a representation in the smaller space, but we would never care about that. The actual question is: what is the difference in the amount of information encoded in a large image vs the small latent space and compare that to the difference in information between a large image and a small image. If those two differences are close enough together, being able to determine a legitimate difference between SD generated vs not becomes near impossible.
chacham15··on Oh shit, my app is successful and I didn't think about accessibility
Its not that they arent important when looked at by itself, but it just isnt as important as other things. Nobody cares if a car has poor ui if it doesnt actually work. Get it to run first, then make the ui nice. IIRC theres a phrase for this: make it work, make it right, make it fast.
chacham15··on On clock faces, 4 is Expressed as IIII, not IV
In the marketplace it was difficult to quickly discriminate between IIII and III as compared with II and III. When you get to 4, you have to start counting whereas with 3 or fewer, you can tell how many there are at a glance. That being said, this change was something that happened later in its history and as mentioned was more heavily done in specific use cases.
chacham15··on Apple hit with over 1.8B euro EU antitrust fine in Spotify case
I HATE these arguments. Peter Thiel talked about this in one of his lectures. He said: when you're a small company you define your market as small as possible in order to compete; when youre a large company, you define your market as large as possible in order to avoid antitrust. To illustrate the example, if you're the only grocery chain in California, you'd argue that "the united states has many grocery chains and we're just one of them!" thats true, but it doesnt mean that you arent acting monopolistically from within California. To bring this analogy back to Apple, we have to look at areas of competition: the area of competition that Apple meaningfully engages in is the apple app store. This would be the equivalent of california. Is any app in the apple app store prevented from meaningfully competing with Apple? Yes! 1. higher prices via app store fees 2. not allowed access to the same apis (e.g. files syncing in the background or no native messaging capabilities) 3. browser + messaging restrictions (e.g. cant link to a website which has any way of spending money). The reason I look at the "app store" as a place of competition is because apple is allowing competition in the space. If Apple removed the app store, or ONLY had Apple apps in the app store, then they would be acting perfectly fine IMO. But they allow this competition because it allows their platform to succeed, but they behave monopolistically wrt that competition to gain the upper hand over time.
chacham15··on How to be a good listener
I agree that I disagree with this as a blanket statement, but as a baseline, I would agree. The real issue here is why/how you're relating A lot of people relate poorly. The common mistake is as the author points out: to compare experiences. This comparison is almost never useful. Either your experience was worse, which feels invalidating to a listeners feelings or your experience was not as bad, which feels like an inauthentic relation.

IMO relating does a lot better when it serves a purpose useful to the listener. A few that I have found:

    1. when you're validating how they've already expressed how they feel. sometimes people doubt their own feelings and so you can use your own related experience to show them that you felt a very similar way when you were in a similar situation. caveat: dont ever tell them how they should feel, only validate what they've already expressed. also, if theyre not doubting their emotions, dont do this either...its not useful at best

    2. when you're trying to understand how they're feeling (e.g. one time my dog died and I would just always expect to see her around the corner, but she was never there...is that like what you're feeling?)

    3. when you're helping out with things that need to be done: (e.g. my parents passed away too, do you want help with sending out funeral invitations / finding a cemetery / etc)

    4. if they dont know what to do / what options are and you relate different experiences about how you may have dealt with a similar situation.
Caveats:

    1. Relating without a purpose will come off as a comparison, dont do it.

    2. Not every purpose is valid for every person. A lot of these reasons require that the person trust you to an extent. E.g. offering to help a stranger with their funeral obligations will come off very poorly.

    3. You have to have actual relevant experience with something, trying to shoehorn something tangentially related comes off very poorly.

    4. You have to know how to deliver the related experience

    5. They have to be ready to hear it: if someone is talking, dont interrupt. dont change the topic. only use the solutions above if the person seems like they are looking for it.

    6. tons more.
In sum, there are reasons to relate, but there are lots of potholes here so its very easy to get wrong. So, as a general statement I would agree, but if you can do these above things well, it can really help people when they may need it.
chacham15··on Common Mistakes in Modularisation
I disagree with most of the article. The author states that the reason we start at the bottom is because "it feels good". This is false. We start at the bottom because that's what a product spec is. The product spec can impact any node but will mostly be at the bottom. So, we must start there and work backwards to figure out what engineering choices will meet that product spec.

Second, the author talks about building "program families" instead of just a program. The problem with this concept is that it is essentially asking you to divine the future. Your success at divining in what way the program will change is what determines the success of this approach. That is to say, if you're in a space where you absolutely cannot predict in what way the requirements will change, the optional strategy is to just build for the requirements right now.

chacham15··on Apple broke iPhone web apps in the EU for anticompetitive reasons – Tim Sweeney
> it only talks about access to SDKs, specs of device ports, ability to make the same system calls

The Apple App store uses SDKs + system calls to install other apps, right? So, if you're allowed to sideload your own app store it should be able to do the same freely. So, the question then becomes about sideloading which I think you're supposed to be able to do freely as well.

chacham15··on EffVer: Version your code by the effort required to upgrade
Its an idealistic view which will almost certainly fail. Test suites, as much as we like to hope that they reflect real usage, mostly dont. A simple example: if function a gets changed from o(n) to o(n^2) but otherwise behaves identically, most test suites will still pass, but if a user has that function in its own inner loop you can go from o(n^2) to o(n^2^2) which can definitely break a lot of things (simple example: transaction was holding lock for too long and so the transaction was aborted). Being able to catch the above is a high bar for a test suite which I'm fairly confident most test suites are way below that.
chacham15··on Keeping code simple: moving fast by avoiding over-engineering
The main problem that I see in my years of experience is: "how well does what I design hold up to ACTUAL product design changes?"

Everything else comes second to that including this authors version of "build extensible systems around dependencies, this allows you to shift dependencies without shifting internal logic." That idea is good as long as you dont end up rebuilding an entire framework out of that extensible system, otherwise you shouldve used an existing one. If you have an extensible system, but dont use it, thats a lot of complexity that increases the maintenance burden.

All of these tradeoffs make sense in their appropriate circumstances, but those circumstances largely rely on predicting the future of the product IMO.

chacham15··on WA House bill would make it illegal for police to lie during interrogations
IMO the point of stopping police from lying shouldnt be to prosecute the police (as perjury is already illegal), but rather, to indemnify the person who was lied to for actions they took under false pretenses. So, if the police lie to you and say "we have you on camera at the 7/11" and as a result you say "I dont really recall..maybe I got a soda from there and dont remember?" that second statement shouldnt be used against you if they dont actually have you on camera whereas today that statement would be used to show that you couldve been there (because you said so yourself). This is easy to demonstrate in court and consequently toss out that secondary statement which would otherwise be evidence.
chacham15··on Open Source Doesn't Require Providing Builds
The title as written is obviously true. Obviously any project can be "open source" with or without builds. There is no requirement that "open source" even compiles! The real issue here is: "is it better for the project to provide builds?" and I think that the answer is almost certainly yes even if for nothing else other than the same reason as "should the project compile?" Now, as with all "good things" there are questions of whether its better to put effort into this good thing vs that good thing and that is a fair discussion, but having the project deliver builds is almost certainly "a good thing."
chacham15··on Huge proportion of internet is AI-generated slime, researchers find
The title is clickbait. The actual study[0] reads as follows:

> Multi-way parallel, machine generated content not only dominates the translations in lower resource languages; it also constitutes a large fraction of the total web content in those languages

This is talking specifically about text being translated into less common languages being done mostly by machine translation and that in those languages most of the content found was as a result of machine translation. This has nothing to do with English or more common languages overall.

[0] https://arxiv.org/pdf/2401.05749.pdf

chacham15··on EU Cyber Resilience Act: What does it mean for open source?
There is a lot of talk about who this regulation is supposed to cover, but not a lot about what it actually requires if it covers you. The best I could find after a couple quick searches was that you're supposed to provide information about the security mechanisms used and regular security updates over the lifetime of the product. Is there anything else? This doesnt sound terribly hard to comply with at first glance.
chacham15··on Cray-1 vs Raspberry Pi
I like telling dad jokes...he usually laughs
chacham15··on 'Like we were lesser humans': Gaza boys, men recall Israeli arrest, torture
Theres tons of evidence for this. Heres an example of pg furthering conspiracy theories: https://twitter.com/paulg/status/1733146138226614465 (note: Rashida Tlaib has extremist viewpoints and has even been censored by the house for those views). Here is a tweet with misinformation about Al-Shifa hospital that he retweeted: https://x.com/GhassanAbuSitt1/status/1722977553101562156?s=2... (and didnt correct the record). Here is him posting about Gaza not having fuel for hospitals (even though Hamas had copious stockpiles of it): https://x.com/Beltrew/status/1717247691455971742?s=20 Here is him reposting https://x.com/evanhill/status/1732567824160235800?s=20 which is an extremely unfair comparison (to be more fair, compare the casualties, and get better sources for the actual damage. using "high end estimate" is an obviously biased comparison). There are plenty more, but you can look at his twitter for yourself.

All of this, I'd be ok with saying may be coming from an entirely sympathetic perspective and trying to find a way back to peace...but where is the sympathy for the other side? There is certainly much to criticize when it comes to the actions of the israeli government, but where is the sympathy for its people? Where are the calls to return the israeli hostages? Where are the tweets denouncing Hamas for the murder and rape of civilians? Non-existant. This was a man I had deeply respected. I bought all his books, read all of his articles, been to startup school multiple times to hear him talk, but this incredibly unfair bias made me lose SO much respect for him. I really want to be wrong about this and would welcome another perspective, but at this point I've literally gone through all his tweets back to Oct 7 and there isnt a single one sympathetic to the israeli people. Please prove me wrong.

chacham15··on 'Like we were lesser humans': Gaza boys, men recall Israeli arrest, torture
I would disagree with that policy in this case. In most other articles, the reader has a much better ability to understand the quality of the article from reading it. This audience is primarily technical and not political. This topic has such a long history and so much nuance to it, that an article about this topic can uniquely spread a false narrative to a non political reader. That being said, not every reader has little political understanding which makes having a discussion even harder. Imagine a physicist, electrical engineer, mechanical engineer, and artist trying to have a discussion about "reflections in time." With that topic, while a discussion may be difficult, it at worst isnt harmful. In this case, a false narrative can and has been used to further hateful ideas, hate speech, and actual crime. With those negative possibilities here, I think we should be erring on the side of caution and not on the side of curiosity.

A smaller reason why I disagree with this is that the responses to this topic are uniquely capable of alienating large quantities of people which is counter to what we'd want for a community like this.

chacham15··on Beg Bounties (2021)
There are a few reasons.

1. The first is literally the first example of the article: real/important vulnerability disclosures get confused with beg bounties which dont need to be acted on / are not serious (most of the time). That can cause real harm.

2. The second reason is the approach that the beg bounty uses: that of fearmongering. If the beg-bountier disclosed the vuln and asked for the bounty that would be ok, but withholding the vuln until payment is assured is a scam.

3. How can one even properly valuate how much the vuln should be worth without knowing what it is / capable of doing?

chacham15··on Classes vs. structs in .NET: how not to teach about performance
The n^2 argument the author points at is a red herring. The reason this is an invalid criticism of the benchmark is that both benchmarks are using the same query structure, so theyre both n^2. The author himself admits later on that the real issue is allocations. However, they posit that allocating of structs is done using a different allocator than classes. I dont know enough about C# to know if this is true, but even so, the advice that "structs are more performant overall" still holds...so this article seems to be mostly clickbait.
chacham15··on Trying out C++20's modules with Clang and Make
IIRC the main point of header files was to make compilation 1 pass instead of 2. I.e. when the compiler is processing a function and sees `int a = foo(bar, baz);` how does it know what code to generate here? How do you call foo (i.e. what calling convention does foo have)? Furthermore, how do you know if the code is valid? Do the passed arguments match the declared arguments? What if there is function overloading? How does it know which actual function to call? A lot of other compilers will do two-passes where they scan the code once to compile all of that information, and then do it a second time to then actually write the code out. The optimization for c/c++ was to "cache" the declarations separately in a header file, so that you dont need to parse/scan twice.
chacham15··on Goodbye integers, hello UUIDv7
You're painting with way too broad of a brush. It is not always better and not always worse. E.g. "give me a list of users who made two posts where both posts were created within 1 second of each other" This query would likely blow up on a system which has all the data completely randomly sharded (because you'd have to aggregate all the data centrally, unless you had a complicated shuffle setup (which most dbs dont)) whereas would work fine on a system which has posts sharded by time.
chacham15··on Goodbye integers, hello UUIDv7
They can be bad for performance. It all depends on your access patterns. A common caching pattern is called "temporal locality" which means that theres a high likelihood that data created at the same time will be accessed at the same time. Therefore, if these pieces of information are on the same machine, they can be queried / returned much faster than if they were both on separate machines. This is doubly true if theres a data dependency between them. E.g. SELECT x + y or SELECT x WHERE y = 'foo'.
chacham15··on Farewell EC2-Classic, it’s been swell
My thought was that 10.2.0.0/16 is part of the 10.0.0.0/8 address range which is by default a private network address range (i.e. not routable by any other machines). I interpreted what the author wrote to say that your machine would be assigned an address in 10.2/16 but would still be able to route to other AWS services / machines in other 10/8 subnets (e.g. 10.1/16)
chacham15··on Apple supports right-to-repair bill
> Chamberlain explained that parts pairing is used by Apple to confirm whether parts were purchased through their authorized network and have a record of repairs, while console makers may use it to "assume that a disk drive is original and trustworthy."

> "To eliminate parts pairing entirely, they need to find new technical ways of meeting these goals without limiting repair," she told Ars. "Until then, our best compromise is in SB 244: If manufacturers use parts pairing, they need to make their pairing software tool available to the public."

This section seems a little vague...does this mean that Apple will still be able to block you from swapping in a part that they dont deem as "valid" for whatever reason? What does that software tool that theyre supposed to make public do? verify "authenticity"?

chacham15··on ‘I've got nothing to hide’ and other misunderstandings of privacy (2007)
The simplest retort I've heard to "I have nothing to hide" is "then send me a nude photo of yourself." Theres nothing wrong with nude bodies, but it is definitely private. I.e. privacy has nothing to do with hiding wrong/illegal things.

(obligatory disclaimer: a little inaccuracy saves a lot of explanation, but I think this gets the gist across)

chacham15··on Computer scientists discover limits of gradient descent (2021)
This still doesnt make sense to me. Imagine a continuous line whose positions map to the real numbers between 0 and 1. If I "move" the line over 0.1 wrapping the end back to the beginning (i.e. x2 = (x1 + 0.1) % 1), there will be no points that are in the same position as they were in before.

EDIT: If you need a continuous function, wouldnt expanding the space to a line from -Inf to +Inf and then using x2 = x1 + 0.1 do the trick?

chacham15··on Signal president says company will not comply with U.K. ‘mass surveillance’ law
I didnt read that as a technical argument, but as a sociological one. If there are two apps, one which is easy/legal to obtain, but has a backdoor and another which may be harder/illegal to obtain but has no backdoor, which is the bad guy going to choose? Unless you can somehow force every app to use the backdoor, you cant make the bad guy go through it. Therefore, "You cannot create a back door that only the good guys can go through"
chacham15··on UK Threatens End-to-End Encryption
> It would be essentially infinitely valuable as a cyberattack target.

While I understand what you mean, there are already keys which are "infinitely valuable": root CA keys. If you have those, you can essentially impersonate anyone. Therefore, we must have ways to protect these sort of keys.

That being said, a root CA key is probably locked up on an air gapped machine vs some machine which actively using the key to scan through traffic.

Mainly pointing out here that the idea of value vs cost has to have some point at which we protect it regardless of the value because thats how the hierarchy of trust works in our CA system.

← PreviousPage 2 of 20Next →