Better HN
topnewbestaskshowjobs
Log inSign up

lscharen

522 karma · joined Jul 16, 2010 (16y ago) · 146 submissions

Submissions

comment 2mo ago · link · parent

No, because the point is that the branch version does not touch "total" when the branch is taken, but the non-branch version will always multiply "total" by something.

comment 2mo ago · link · parent

Maybe something (contrived) like this providing no-op defaults?

  total = calculateOrderTotal(user.order);
  if (user.isPremiumMember) {
    total = total * 0.9;        // 10% discount
versus

  total = calculateOrderTotal(user.order);
  discount = calculateDiscount(user);  // Returns 0.9 or 1.0
  total = total * discount;

comment 5mo ago · link · parent

> If you ask permission for spending, it's a very onerous and frustrating process. If you just deploy stuff and get billed for it, it's much easier!

This point is underappreciated as it appears in many forms and can really help reconcile things that seems obviously wasteful (they may actually be wasteful, but sometimes financial structure makes this hard to determine in an honest capacity).

Capital costs and operational costs are a similar dichotomy. When I was in graduate school, the university was breaking ground on new buildings at the same time that staff layoffs were underway. On its face this seems grossly unreasonable, but staff salaries were paid from one funding bucket and capital improvements (new buildings) were funded by a completely independent state-level allocation process and those buildings that were breaking ground had essentially been locked in 5 to 10 years prior.

comment 5mo ago · link · parent

I’ve used Claude to help write development utilities to support my retro computing interests.

The most complete tool being this unit testing support library for Apple IIgs assembly language development.

https://www.npmjs.com/package/iigs-unit

comment 6mo ago · link · parent

An interesting property of DAWGs is that the compact/compressed variation (CDAWG) can be built in linear time.

https://moodle2.units.it/pluginfile.php/718375/mod_resource/...

comment 6mo ago · link · parent

I was halfway through the article and began thinking that his described data structure sounded very familiar to something I used about 20 years ago.

Sure enough, the first paragraph on the Wikipedia entry for DAFSA is:

DAFSA is the rediscovery of a data structure called Directed Acyclic Word Graph (DAWG)

comment 9mo ago · link · parent

An aside, but I recently learned -- if one is willing to use a very modest amount of memory -- summing floating-point numbers with no loss of precision is effectively a solved problem with the XSUM algorithm.

https://glizen.com/radfordneal/ftp/xsum.pdf

comment 1y ago · link · parent

> Notice I have changed the extension from .js to .mjs. Don’t worry, either extension can be used. And you are going to run into issues with either choice

As someone that has used module systems from dojo to CommonsJS to AMD to ESM with webpack and esbuild and rollup and a few others thrown in ... this statement hits hard.

comment 1y ago · link · parent

I can see the point of trying to make a distinction, but it is muddy.

An emulator can operate on many different levels of trying to match the behavior of the underlying hardware. CPU emulators can emulate at the opcode level (easier) or try to increase accuracy by emulating the CPU pipeline cycle by cycle (harder).

In this particular case, the distinction between an "emulator" and a "hardware emulator" seem apt because the article discusses that the required fixes needed to start tracking the state of individual pins of the hardware chips. This, to me, represents that the emulation needed to "go down another level" and model the physical hardware to a certain degree to gain the needed accuracy.

Having a way to mark that difference is useful.

comment 1y ago · link · parent

  The states decided to add one digit to these numbers to further subdivide
  them. They did it differently, of course, and some didn't subdivide at all.
  Some of them have typos with "O" in place of "0" in a few places. Some
  states dropped the leading zeroes, and then added a suffix digit, which is fun.
Any identifier that is comprised of digits but is not a number will have a hilariously large amount of mistakes and alterations like you describe.

In my own work I see this all the time with FIPS codes and parcel identifiers -- mostly because someone has round-tripped their data through Excel which will autocast the identifiers to numeric types.

Federal GEOIDs are particularly tough because the number of digits defines the GEOID type and there are valid types for 10, 11 and 12-digit numbers, so dropping a leading zero wreaks havoc on any automated processing.

There's a lot of ways to create the garbage in GIGO.

comment 1y ago · link · parent

There are 8 screen hole bytes in the bottom 8 text rows (64 bytes total) and 8 expansions slots, so the screen hole byte at offset "N" was often used to store up to 8 bytes of data[1] (one byte in each of the rows' screen hole area) by the expansion card's firmware in Slot "N". Overwriting those bytes could result in system crashes and hardware hangs.

[1] https://retrocomputing.stackexchange.com/a/2541/3653

comment 1y ago · link · parent

I thought that SmoothLife was fascinating when I found it.

At the time I was doing a lot of simulation work, so methods for bridging discrete and continuous domains were interesting.

https://github.com/duckythescientist/SmoothLife

comment 1y ago · link · parent

I just recently did a website conversion that used vite and took a look at both vitest and playwright.

Ended up going with playwright for the “batteries included” browser support and because we use .Net Core for the backend.

dotnet doesn’t always get the best support from pure JS/TS projects, so it seemed like a reasonable hedge.

comment 2y ago · link · parent

Reminds me of Intellectual Venture's Optical Fence developed to track and kill mosquitoes with short laser pulses.

As a side-effect of the precision needed to spatially locate the mosquitoes, they could detect different wing beat frequencies that allowed target discrimination by sex and species.

comment 2y ago · link · parent

I was not aware of this (2015) work -- very nice!

A couple of pull-quotes from the paper to summarize:

Much work has been done on trying to improve the accuracy of summation. Some methods aim to somewhat improve accuracy at little computational cost, but do not guarantee that the result is the correctly rounded exact sum.

Many methods have been developed that instead compute the exact sum of a set of floating-point values, and then correctly round this exact sum to the closest floating-point value. This obviously would be preferable to any non-exact method, if the exact computation could be done sufficiently quickly

Exact summation methods fall into two classes — those implemented using standard floating point arithmetic operations available in hardware on most current processors, such as the methods of Zhu and Hayes (2010), and those that instead perform the summation with integer arithmetic, using a “superaccumulator”.

I present two new methods for exactly summing a set of floating-point numbers, and then correctly rounding to the nearest floating-point number. ... One method uses a “small” superaccumulator with sixty-seven 64-bit chunks, each with 32-bit overlap with the next chunk, allowing carry propagation to be done infrequently. The small superaccumulator is used alone when summing a small number of terms. For big summations, a “large” superaccumulator is used as well. It consists of 4096 64-bit chunks, one for every possible combination of exponent bits and sign bit, plus counts of when each chunk needs to be transferred to the small superaccumulator.

On modern 64-bit processors, exactly summing a large array using this combination of large and small superaccumulators takes less than twice the time of simple, inexact, ordered summation, with a serial implementation

comment 2y ago · link · parent

Surprisingly there are different algorithms for doing something as simple as summing up a list of numbers.

The naïve way of adding numbers one-by-one in a loop is an obvious way, but there are more sophisticated methods that give better bounds of the total accumulated error; Kahan summation[1] being one of the better-known ones.

Like most things, it can get complicated depending on the specific context. For streaming data, adding numbers one at a time may be the only option. But what if one could use a fixed-size buffer of N numbers? When a new number arrives what should be done? Take a partial sum of some subset of the N numbers in the buffer and add that to a cumulative total? If a subset if chosen, how? Are there provable (improved) error bounds for the subset selection method?

Fun stuff.

[1] https://en.wikipedia.org/wiki/Kahan_summation_algorithm

comment 2y ago · link · parent

Agreed, the differences aren't as stark as the map seems. Almost all of the states fall between 15% and 25% percent of the population.

Wisconsin stands out at 25.29% of the population labeled as excessive drinkers due to the large amount of dark red, but South Dakota is at 22.43% -- less than 3% difference, but that state is mostly orange.

For a county example, Hardin, TX is 19.13% and Rusk, WI is 20.82%. A difference of just under 1.7%, but the Wisconsin county is bright red and the Texas county is orange.

comment 2y ago · link · parent

This is giving strong "Using TDD to build a Sudoku solver" vibes[1].

Let's use some hot tools to solve a problem. Sorta solve a problem. Well, AI doesn't actually know abstract strategy, so maybe it'll work later with a different AI. But it autogenerated some basic logic that only had a few bugs!

[1] https://ravimohan.blogspot.com/2007/04/learning-from-sudoku-...

comment 3y ago · link · parent

> Also, I think some iPhone models have emergency satellite communications already, no?

Yes, Emergency SOS. This was the feature that allowed a family to be located and rescued recently during the Hawaii fires.

https://www.macworld.com/article/2027967/iphone-14-emergency...

comment 3y ago · link · parent

This guy just (like a few weeks ago) started to put together a decentralized newsgroup toolset based on the NNTP protocol.

https://dialup.cafe/@vga256/110609250159276517

comment 3y ago · link · parent

This is similar the the (old) trick of adding a Uniform distribution component to a Mixture of Gaussians model. It doesn't really change the math wrt parameter optimization and probability evaluation, but provides a place to capture "background" or "unimportant" data points and improve the model robustness to outliers.

The motivation follows from the same problem the author points out in the original softmax formulation that it always "forces a choice" when it may be more useful to put a "Not Applicable" option into the model itself.

https://link.springer.com/article/10.1007/s10260-021-00578-2

comment 3y ago · link · parent

If SVB were originating mortgages then, yes, that should have helped because then, like every other originator, they would have immediately sold the mortgage into the secondary market where it would be turned into a Mortgage-Backed Security and SVB would have cash on-hand and unloaded the long-duration risk.

Instead, they were the ones buying the MBSs and taking on the long-duration risk.

comment 3y ago · link · parent

Esri’s Calcite Component library is another.

https://github.com/Esri/calcite-components

comment 3y ago · link · parent

That’s a great point. Seeing lots of mocks and assertions that certain functions are called is often much ado about nothing since no actual code functionality is exercised. I do sometimes see the return value functionality of mocks used as a stub, just because the dev hasn’t internalized the distinction and can “make it work” with a mocking library.

One of the only legit use cases for mocks that I have personally come across is validating things like a sequence of API calls to an external service, or queries to a database where there is a check that certain efficiencies are guaranteed, e.g. verify that an N+1 select problem doesn’t creep in, or knowing that a app-level caching layer will prevent redundant API calls.

comment 3y ago · link · parent

I think even more so than “If I can put things eloquently enough, perhaps they'll understand why I did what I did.", it can be motivated as “I don’t think I’m a bad person and I didn’t intend to cause harm; if people are still mad at me, it must be because they don’t understand and I should explain harder.”

comment 3y ago · link · parent

I mean, who didn’t?

comment 4y ago · link · parent

We replaced a 25+ year-old propane furnace with a high-efficiency natural gas furnace two years ago. The difference in waste heat is astonishing.

The old furnace vented through a vertical chimney vent and the exhaust was so hot that touching the metal pipe would burn your hand.

The new furnace is direct vented with PVC pipes and the exhaust outside the house feels barely warm — that’s a lot of additional heat that stays in the house instead of being wasted.

Between the cost difference of propane vs natural gas, better efficiency and a programmable thermostat, we easily reduced our fuel bill $$ by 50% with no noticeable change in comfort level. I did not track the difference in therms.

comment 4y ago · link · parent

It was useful in single accumulator processor architectures since it could avoid one memory store.
12345