HNHacker News
TopNewBestAskShowJobs

cjg

3,858 karma · joined March 31, 2009

submissionscomments
cjg··on Ask HN: How to make server side code atomic?
What happens when the REST server accepts your POST to /api and starts processing it but then, before the response can be sent, the connection drops? This code would see an error from the POST to /api due to a connection failure / timeout, and the transaction rolls back.

Now you've got the /api invoked, but no DB write.

cjg··on I'm a scam prevention expert and I got scammed
Calling on the official number is a good rule. But my neighbour followed that and was still scammed for tens of thousands.

The critical extra step that they missed was to check that the line was disconnected before calling out. They were using a landline.

The scammers called them, but didn't hang up. Then, when my neighbour called out to their bank, they pretended to be answering that call - going through security, etc.

My neighbour then did whatever the scammers said - because they couldn't possibly be scammers.

cjg··on $625M worth of ETH drained on Axie Infinity's Ronin Network
And then when two of the nodes die at the same time...?
cjg··on Ask HN: How do you define the singularity?
It's predicated on accelerating technological progress, which can perhaps be seen to be true by looking back at how quickly society has moved through different technological regimes. Once change becomes too fast, it's impossible to predict what is about to happen. It's called "the singularity" with a loose analogy to black holes where a big curvature means that light cannot escape - with fast enough technological progress, the immediate future is highly uncertain.

The most commonly expected way that this might happen is via AGI - perhaps with self-improving AI - where a sudden increase in AI abilities might drive extremely rapid technological change.

cjg··on Polylith is a functional software architecture at the system scale
That was the video I watched and I just don't get what is different about polylith.

The video spends too long telling me things I already know - e.g. what are functions / objects / layers / etc.

Tell me something I don't know - such as what makes Polylith unique. The video says this is "Components". Well what's so different about those? They sound like microservices or perhaps high-level objects. Or perhaps interfaces.

Show an example!

cjg··on Sleep Is Death – a storytelling game for two players (2010)
Try this link from that page: http://www.sleepisdeath.net/slideShow/
cjg··on The most important thing to understand about queues (2016)
Yes.
cjg··on The most important thing to understand about queues (2016)
429 is only applicable if it's the same user sending all the traffic.

503 explicitly mentions server overload.

cjg··on CXX – safe interop between Rust and C++
Most of the answers to this question seem to make the argument that you could not automatically generate safe Rust wrappers for an existing C library because it would be impossible to automatically know the safety requirements for a C API.

That's also true, in general, for C++, but CXX is nevertheless attempting to solve that problem.

CXX requires you to give some extra information when declaring the bridge. Presumably that can allow things to be less automatic.

I'm guessing that the reality is that if your C++ code is relatively idiomatic then CXX will work with it, but stray too far from idiomatic C++ - i.e. towards a C-style interface and CXX won't be able to do such a good job.

But it would be good to hear something more definitive.

cjg··on CXX – safe interop between Rust and C++
I meant generating a safe Rust API for existing C code rather than calling an existing Rust API from C.
cjg··on CXX – safe interop between Rust and C++
Given that C is a subset of C++ (meh), can you use this to generate safe bindings for C?

Most C integration recommendations I've seen suggest using bindgen, but that doesn't give safe bindings.

cjg··on Stainless steel leaches nickel and chromium into foods during cooking (2013)
Iron pans are not the best for those with hemochromatosis (iron overload).
cjg··on The most important thing to understand about queues (2016)
The idea is that it's not a sudden hard failure. Instead only a few things fail which helps in two ways: reducing the load by discarding some work and alerting that the system is beginning to be overloaded.
cjg··on The most important thing to understand about queues (2016)
It's probabilistic.
cjg··on The most important thing to understand about queues (2016)
I just finished implementing a simple backpressure algorithm. Once the queue is more than a certain percentage full, it rejects new items. These rejections get turned into HTTP 503s.
cjg··on This shouldn't have happened: A vulnerability postmortem
Do you have a link to an article / report about that 138 byte program? I'd be interested how to achieve that.
cjg··on Why I Have Settled on XChaCha20+Blake3 for AEAD
"8. Source: My Ass" :-)
cjg··on A Tale of Three Codebases
> While Rust does have a steep learning curve, nearly all the engineers we've worked with have experienced a productivity increase from using it. Freedom from type errors and data races is a huge productivity boost on complex projects.
cjg··on Time Travel: Probability and Impossibility
We can already see how the laws of physics might accommodate energy not being conserved - and from there a small hop to perpetual motion machines.

Energy conservation relies on time translation symmetry. In other words, that the laws of physics do not change over time. Well, perhaps they do change slowly.

A prime example of this is the expansion of spacetime, which can reduce the energy of a photon travelling through empty space - it's redshifted. This has been experimentally observed.

See https://www.preposterousuniverse.com/blog/2010/02/22/energy-... for more details.

cjg··on Rust fixes bidirectional Unicode CVE
More details here: https://blog.rust-lang.org/2021/11/01/cve-2021-42574.html
cjg··on Ask HN: Who wants to be hired? (November 2021)
Location: Cambridge, UK

Remote: Yes - preferred

Willing to relocate: No

Technologies: Rust, Java, Linux & lots more

CV: I will send it to you, if I'm interested in a role

Email: It's in my HN profile

I've got decades of experience as a software engineer. Most recently I've been doing a lot of Rust - picked it up in 2015 - and that's a technology I want to keep in my next role.

cjg··on Code quality: a concern for businesses, bottom lines, and empathetic programmers
What does it mean for a novel to be of high quality? It's not easy to define and it's somewhat subjective, but equally there are definitely things that are not acceptable.

Some things that can help move towards higher quality code: - avoid duplicated code - especially when it's similar but subtly different - variable names that mean something useful - lower code nesting - shorter functions - fewer parameters

Many of these things are focused on improving how understandable / maintainable the code is.

But, as for novels, there aren't just rules you can follow blindly.

Perhaps this helps: https://garywoodfine.com/what-is-clean-code/

cjg··on A Computer in the Game of Life (2020)
Game of Life has the hashlife algorithm that can provide exponential speed-ups but with increased memory usage.

A computer in the Game of Life therefore implies there is an algorithm that can exponentially speed up arbitrary computation - again at the cost of memory overhead.

Does this say anything towards P=NP or other complexity questions?

cjg··on What's Wrong with Tech Hiring
It also refers to https://chrisparnin.me/pdf/Debugging-Hiring.pdf
cjg··on OpenSSL 3.0
Well our product was already something that included the openssl library, so we would have had to release a new version of our product when there's a patched version of openssl anyway.

At least updating it is easy now - we've put a lot of effort into that process recently.

cjg··on OpenSSL 3.0
Yes - used rustls on a new project rather than the openssl wrapper which we used before. The experience has been pretty good. The problems of shared library version inconsistency have gone. No noticeable downsides.
cjg··on Ask HN: Why don’t you use Linux as your daily driver OS?
I'm on Windows.

For me it's the comms apps (e.g. Teams). These tools are selected at the team or corporate level. Whilst they typically have Linux support, the Linux implementations tend to have many more bugs and fewer features. If I'm in a call and someone's screen is frozen or they drop off unexpectedly, they are usually using something non-Windows.

But I do my day to day development in a Linux-like environment - either docker, WSL or a VM.

I would prefer to be linux native, but not at the cost of being a second-class citizen when interacting with the rest of my team.

cjg··on How mindfulness could make you selfish
Minor nitpick - kamma and karma are the same thing, but different languages. Kamma is Pali and karma is Sanskrit.

To be even more detailed, karma is the action rather than the effect, which is called karma vipaka. The English word karma means something more fluid - depending on context.

cjg··on Automating programming: AI is transforming the coding of computer programs
https://archive.is/bTkFX
cjg··on WD My Book users wake up to find their data deleted
I agree with your conclusion of increasing the length of support. But your half-life analysis isn't really the right choice. Hard drives tend to have a bath-tub failure rate: https://en.wikipedia.org/wiki/Bathtub_curve
← PreviousPage 3 of 14Next →