Better HN
topnewbestaskshowjobs
Log inSign up

nayuki

6,720 karma · joined May 31, 2011 (15y ago) · 2,160 submissions

I am a software developer.

Home page: https://www.nayuki.io/

Submissions

comment 1d ago · link · parent

So how does MRAM compare to FeRAM? I've used Texas Instruments that contain FeRAM, and they seem pretty good.

comment 2d ago · link · parent

I really enjoyed learning the different aspects of Fourier transforms from "The Scientist and Engineer's Guide to Digital Signal Processing", a free online book: https://www.dspguide.com/pdfbook.htm

comment 3d ago · link · parent

Don't fall for the illusion that manual memory is the pinnacle of control. Because raw pointers cannot be moved, you can end up with a lot of external fragmentation - i.e. holes between your allocations. Also, the bookkeeping cost of malloc() and free() are not free, which also means that the latency of calling those functions is unpredictable. There's a reason why embedded developers are very hesitant to use malloc()/free() for hard real-time programs with time and memory constraints.

And at least with GC, you are guaranteed to surrender the possibility of double-free and use-after-free.

comment 3d ago · link · parent

First of all, tax forms themselves might be primary sources. It's not clear to me that tax forms are an unambiguous translation of prosaic tax law into mechanical steps that a human can follow. (For example, if the law calls for "progressive taxation" but doesn't specify the brackets, then it requires extra information to turn it into a calculation procedure.)

Otherwise, if tax forms are translations of underlying laws, then how do you know the forms are themselves correct? It's the exact same problem that you're positing about whether code matches law.

Since the whole point of tax forms is to perform a calculation - and preferably perform it correctly and deterministically - it's much better to leave that task to a computer than to a human.

To give a concrete example of how tax forms could benefit from code, take the 2025 Canadian federal personal income tax form (T1), and I'll comment on some features. https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5006...

> Employment income (box 14 of all T4 slips)

This references another data structure (T4 slip) and asks you to sum all of them (implied by the word "all"). But it's ambiguous because in some programming contexts, "all" means returning a list of numbers or items.

> Elected split-pension amount (complete Form T1032)

This basically asks you to jump into a subroutine, do some calculations, and return the result here.

> Amount of dividends (eligible and other than eligible)

This is a filter operation followed by a sum.

> if negative, enter "0"

In math notation, this is x = max(y, 0).

> Use the amount from line 26000 to complete the appropriate column below.

This repeats something a few lines down and is only useful for clarifying for humans.

> Line 70 minus line 71 (cannot be negative)

This is a sanity check like assert(x >= 0).

> Enter whichever is less: $1,471 or line 1 plus line 2.

There are actually two line numbering systems happening simultaneously, one on the left of the money box and one on the right.

> Amount from line 42000

Some instructions merely copy numbers from other sections in order to get the data more local to the current problem being handled. Computers don't care about locality in this sense.

comment 3d ago · link · parent

Someone's repost of Vi Hart's video "Wau The Most Amazing, Ancient, and Singular Number": https://www.youtube.com/watch?v=IrqNIZC-U8M . (Spoiler: wau = 1)

comment 3d ago · link · parent

Have you tried filling out government tax forms? The math and logic (e.g. if-else) are described in natural language prose (e.g. English), not standard mathematical formula notation. And because of that, there are stylistic variations in how operations are described, and there are ambiguities sometimes and even things that you have to infer (e.g. certain amounts that cannot be negative, when to round numbers). And then there are fields that cross-reference other fields and you have to fetch those values manually too. All of this is much better described in a formal, executable, popular programming language like Python, JavaScript, C, etc.

comment 3d ago · link · parent

> Credentials that follow the C2PA standard, for example, attach a cryptographically signed manifest to a photo or video at the moment of capture; this metadata records the device, the time and location of the recording

This claim sounds like a tidy solution, but my gut feeling is that it doesn't really solve the problem. I struggle to articulate exactly why I think it's wrong, but I'll list some ideas:

* The camera presumably holds an asymmetric private key. The camera is in the user's hands, and chips could be removed and examined to extract the key with immense difficulty. Extremely few people in this world have the knowledge and equipment to do this, but it only takes one person to break the system for everyone.

* The camera maker might leak the key through negligence. Look at other examples where companies leaked TLS/SSL private keys or other cryptographic secrets.

* This scheme seems to give a lot of power to a small number of companies to define image authenticity in a proprietary way. This gatekeeping doesn't seem like a good direction for society.

* If someone is determined to break the system, eventually someone does. Look at the history of DRM and how countless schemes have been broken. Look at how Intel SGX was broken (it claims to allow a CPU to execute secret computations on behalf of someone else without the physical hardware owner being able to inspect those computations).

* Some image authentication schemes were cracked, such as ElcomSoft breaking an older version of Canon's scheme in the year 2010.

* What if a genuine camera takes a real photo of a real film slide or electronic monitor displaying utterly ridiculous imagery? (Analogous to the analog hole for DRM.)

* Does the private key have an expiration date? At any given point in time, is there an assumption that all photos older than a certain time have unreliable signatures? (Think of how the TLS certificate authority infrastructure comes with expiration dates.)

I don't have the answers to this problem. One thing I want to suggest, though, is that images coming straight off a camera have a lot of detail, and I think that is hard for AI to fake. Faking an image at Instagram resolution with relatively high JPEG compression seems plausible. Faking 6000×4000 pixels (24 MP) without leaving telltale seams and artifacts is a lot harder. I say this as someone who does digital photography and spends a lot of time pixel-peeping.

> The types of forensic analyses that I routinely perform do not currently operate at internet scale and speed.

Fair point. But I don't think you can tech-shortcut your way out of this problem.

> These provenance signals are often criticized as being only a partial solution or vulnerable to attack. This is true if we think of them as mechanisms for catching bad actors. But that’s not what they’re supposed to do. Their purpose is to let good actors prove that their audiovisual recording is what it claims to be.

You're being too charitable. It only takes one bad actor, one successful cracker to destroy the foundations of authenticity. One credibly signed fake image is enough to cast doubt on all the signed real images out there.

comment 2w ago · link · parent

> Since the missile will explode when it hits its target or at the end of its flight, the ultimate in garbage collection is performed without programmer intervention.

I would argue that the missile performs the ultimate in physical garbage creation at the end of its flight.

comment 2w ago · link · parent

Similarly, I don't like people who write code like `if 0`, because 0 is false in C and JavaScript and Python, but 0 is considered true in Ruby!

comment 2w ago · link · parent

Off-topic, but the looping GIFs of stock prices going up / going down remind me of the currently airing anime https://en.wikipedia.org/wiki/FX_Fighter_Kurumi-chan .

comment 2w ago · link · parent

I used to use FTP in Windows Explorer, Internet Explorer, and Mozilla Firefox about 15 to 30 years ago. It was convenient at the time. FTP was unceremoniously killed in mainstream browsers too. You can still use it through other software and raw libraries. Later, I read the protocol specification and realized it is badly designed - though at least simple and concise compared to the sprawling number of features in HTTP.

comment 3w ago · link · parent

The comment you replied to was: "The only good products Google has ever built in-house are [...]"

I don't have enough information to judge how much of Chrome was original work and how much was pre-existing work. Though I guess by now, after nearly 20 years, Chrome's codebase looks absolutely nothing like KHTML.

comment 3w ago · link · parent

Google Chrome didn't start from scratch. Blink came from WebKit which came from KDE's KHTML. https://en.wikipedia.org/wiki/Blink_(browser_engine) , https://en.wikipedia.org/wiki/WebKit , https://en.wikipedia.org/wiki/KHTML

comment 1mo ago · link · parent

I see some irony here. For a period of time, Google chose not to include JPEG XL in Chrome because vulnerabilities in the library could compromise the software - a legitimate concern. Yet, Google is the author of the Brotli data compression format a decade before the JPEG XL drama, and was happy to use it in Chrome and encourage others to use the library, despite the fact that it also increases the attack surface.

comment 1mo ago · link · parent

The server is getting overloaded, so here's the text for reference:

    Steal my Bitcoin
    0.65 hours without a successful hack
    
    There is a bitcoin key hidden on this server worth about $502.
    
    It is accessible to the PHP user account through the print-flag binary.
    
    This PHP version was selected from before the PHP2SHELL CVEs were released.
    
    First person to get the wallet wins. If you don’t need the money, consider donating it to those who do: givewell.org.
    
    All traffic is logged. This is a known vulnerable machine, so we cannot guarantee privacy. Other attackers may access or monitor activity and data beyond our control. Do not submit anything you want to keep private.
    Challenge wallet
    Explorer ↗
    
    bc1qlnu5…t3cxqy
    
    0.00625104 BTC
    
    ≈ $502.35 USD
    stealmybitcoin.com · Terms of participation

comment 1mo ago · link · parent

> About eMudhra / With over 17 years of expertise, eMudhra is a global provider of digital identity, trust, and security solutions, enabling secure digital transformation for banks and financial institutions (BFSI), enterprises, and governments across more than 35 countries worldwide. Its product suite spans CertiNext

I was hoping the statement at the bottom would be written in past tense: eMudhra was a global provider of digital identity ... had temporarily enabled secure digital transformation ... Its product suite spanned CertiNext...

comment 1mo ago · link · parent

You can't do that because an RSA private key contains two numbers - the modulus and the exponent. Even better, an RSA private key usually has the modulus stored as its two factors rather than their product.

Also note that using small numbers like 65537 for RSA public exponents is common practice.

comment 1mo ago · link · parent

> Bruh, you just literally went ——— BEGIN PUBLIC KEY ——— 4 ——— END PUBLIC KEY ———

No, their private key is 4. Moreover, you wouldn't see the literal number 4 because the PEM key file would have the cryptographic sections encoded in base64.

comment 1mo ago · link · parent

I'm impressed that Stack Overflow / Stack Exchange (presumably US-based) uses UTC for things like resetting daily vote limits.

comment 1mo ago · link · parent

> But yay, democracy? We can do anything as long as no one is subjectivly harmed.

Prospective residents and transit riders are harmed.

Rules and hearings overwhelmingly favor existing residents. If an existing resident opposes construction nearby due to noise, traffic, etc., the city will probably grant his wish. Because that piece of land is off limits for denser housing, now prospective residents face a smaller housing supply, higher prices, and longer commutes.

comment 1mo ago · link · parent

I use OpenSCAD as my primary design tool for 3D modeling. I get things done, but it isn't easy, and it's hard to recommend it to other people. OpenSCAD really requires the user to mathematics, trigonometry, mental visualization, and programming beforehand as prerequisites - unlike mainstream CAD programs which are more point-and-click friendly. Performing fillets and chamfers on corners is quite tedious, and describing a screw thread as a polyhedron is a nightmare, but I overcame these challenges.

On the plus side, I like these things about OpenSCAD:

* The software is open source, so price or pirating are not barriers, you can use it as much as you want on any computer you want for as long as you want, and it can never be taken away from you.

* The program is small and easy to download, not some multi-gigabyte sprawling software package.

* I think you learn to declare variables for parameters very early on, and it feels natural to make every design parametric from the start.

* The textual nature of 3D models means that I can use Git version control, diff between versions, and leverage similar developer-oriented tools that I use for general programming. I suspect that CAD programs that use binary file formats will have to come with their own diff tool and version control system.

* By reading source code, it's possible to follow the thought process of how a 3D model is constructed, and carefully make modifications in the middle of a chain of operations that later operations depend on. In point-and-click CAD, it's not clear to me if it's possible to change things in the middle of a chain.

* The Manifold renderer is so much faster than the old CGAL, resulting in reasonable human-interactive cycle times.

* I ended up writing my own library to cover a bunch of common shapes / use-cases. It does take some effort the first time, but then I keep reusing the results.

comment 1mo ago · link · parent

Good work! Your style of animated articles reminds me of the work of Bartosz Ciechanowski: https://ciechanow.ski/archives/ , https://news.ycombinator.com/from?site=ciechanow.ski

comment 1mo ago · link · parent

Some of your ideas have been covered before, e.g. https://www.youtube.com/watch?v=gNRnrn5DE58 , https://www.youtube.com/@machinethinking/videos . But I would love to see your take on the topic and see a more complete story.

comment 1mo ago · link · parent

This kind of activity has been repeated enough times to be an article: https://en.wikipedia.org/wiki/Hobby_tunneling

comment 1mo ago · link · parent

This project looks extremely ambitious. Are these applications coded by AI by any chance? I can't find any easy documentation about the development process.

comment 1mo ago · link · parent

It makes me think of https://xkcd.com/688/

comment 1mo ago · link · parent

> my superannuation fund (401k, ROTH, IRA, hard to know what people call this in other economies)

In Canada, the comparable funds are: Canada Pension Plan (CPP, mandatory contribution for all employees), employer-managed pensions (not all companies have one; policies vary such as defined benefit vs. defined contribution), personal RRSP (you make the contribution and you select the investments).

I guess the comparable funds in the USA are: Social Security (mandatory contribution for all employees), employer-managed pensions (not all companies have one; policies vary such as DB vs. DC), personal IRA such as traditional/Roth.

comment 1mo ago · link · parent

> Uber is another key villain in Gouged. Per Owens, Uber’s “greatest innovation wasn’t ‘disrupting’ the taxi industry—it was socializing and normalizing the very idea of dynamic pricing. They made us comfortable with the notion that prices could change at any moment.”

In my opinion, Uber has several key innovations over traditional taxi services:

* An accurate machine-provided fare quote that you can review at your leisure before agreeing to take a trip. (Instead of, like, calling a human dispatcher to ask for a quote.)

* The fact that the passenger can't screw over the driver by making fake requests and not showing up, or running off at the end of a trip - because the online platform is in charge of the payment collection.

* The fact that the driver can't screw the passenger over by driving extra distance, because the price is set ahead of time.

> roughly 75 percent of the items in identical Instacart baskets purchased at the same time varied in price from one shopper to the next

If the price differential is large enough, it sets up an opportunity for arbitrage. Maybe if 10 people cooperate and compare notes on each of their Instacart account's product prices, and then make group purchases using the account with the lowest prices...

In general, it's harder (though not impossible) to price-discriminate on goods rather than services. If seniors get a grocery discount for example, then it might be worthwhile to hire a senior to purchase things on your behalf.

comment 1mo ago · link · parent

This comes from mitxela, the same guy who made the fluid simulation on flipdots video that went viral a few days ago ( https://news.ycombinator.com/item?id=49854219 ).

30.

How SLR cameras work: Nikon F3 (2023) [video](youtube.com ↗)

4 points · by nayuki · 1mo ago · 1 comment

12345
72