Better HN
topnewbestaskshowjobs
Log inSign up

s_gourichon

556 karma · joined Jan 12, 2017 (9y ago) · 260 submissions

Software guy, unique combination of theory and practice, capable of debugging even on-site when everyone thinks a project is doomed, or maintaining/writing excellent software.

ParisTech engineer (École Polytechnique), Ph.D. in robotics, 15+ years industrial experience (including transportation and premises receiving general public). Missions for demanding contexts: consultancy, interim CTO, all missions dealing with software source code, with a strong bias towards very high quality. Freelanced for 10 years, now doing something else.

* Longer summary on https://www.linkedin.com/in/gourichon/ * Long list of experiences and technologies on https://fidergo.fr/expertise (French) * CV https://gourichon.org/stephane/cv (French) * Languages: English/French * Contact https://fidergo.fr/contact

Submissions

comment 9mo ago · link · parent

Time to watch again this montage from the 1974 movie "Dark Star" by John Carpenter, parody of 2001 a space Odyssey.

Topic: "talking to the bomb"

https://www.youtube.com/watch?v=h73PsFKtIck (warning this is considered to spoil the movie).

comment 1y ago · link · parent

Not sure it really has huge benefits, but I guess something like this should work:

``` #!/bin/sh N=20 msg_len=$(git log -1 --pretty=%B | wc -c) if [ "$msg_len" -lt "$N" ]; then exit 125 fi # Here you would run your actual test and report 0 (good), 1 (bad) as needed exit 0 ```

comment 1y ago · link · parent

Be wary about using an AI that rejects a simple PR (change "return str;" into "return ptr;") based on false statements ("Your PR contains a critical error — the complete removal of return statements from the u_utoa function."). Details on https://github.com/Ferki-git-creator/Uprintf/pull/3#issuecom...

I encourage you to continue working on your projects.

comment 1y ago · link · parent

Maybe the rabbit hole is much deeper than it seems.

Is it really possible to reconcile "no bloat" with "fully standard compliant"?

Maybe have a look at https://github.com/eyalroz/printf, if only for the test suite, which looks pretty comprehensive and still fails.

Maybe "key features" does not mean the same in all projects, making every project appear "unnecessarily bloated while missing key features" in every other context?

comment 1y ago · link · parent

Created

https://github.com/Ferki-git-creator/Uprintf/issues/1

https://github.com/Ferki-git-creator/Uprintf/issues/2

https://github.com/Ferki-git-creator/Uprintf/pull/3

https://github.com/Ferki-git-creator/Uprintf/pull/4

comment 1y ago · link · parent

Also floats seem to "forget" the integer part, and also have two minus signs when negative.

comment 1y ago · link · parent

Nice. Comprehensive unit tests are indeed welcome. Even a simple test code that tests all features, flags combinations, etc, and outputs a log. It will make easy for anyone to run it and compare the logs.

I had a bug:

    u_printf( my_output_cb, NULL, "%d" NL, -42 );
prints:

--42

I may have found an explanation. In u_parse_format(), case 'i': calls u_itoa( value, buffer, 10, false ); which outputs minus sign.

Then if ( number ) does if ( sign ) { output_cb( '-', ctx ); chars_written++; } which outputs another minus sign.

8.

Pale Blue (Supernova) Dot(esa.int ↗)

1 points · by s_gourichon · 1y ago · discuss

comment 2y ago · link · parent

> visual programming

25 years ago when I read that Microsoft has a software development environment named "Visual Studio" I imagined, well, something with graphs and nodes and flow and... Well something visual, right? Now it's 2024 and VS is still not visual.

Of course things are not as simple. Flyde (along with many alternatives mentioned) is visual IMHO. Keep up the good work!

comment 2y ago · link · parent

> the 2-color limit per 8x8 block. It's already a big issue with just lights and shadows as it is :-/

Well, you impressed me (and others) with your simple bet that "hey, what if I simply choose the two most popular colors" and just code that in simple BASIC. The same could be done with the shading. It would probably pick a good compromise when bright yellow meets dark red: by choosing to have the few should-be-red pixels become yellow, you avoid a bigger obviously-square-grid-based clash of colors.

Next step: error diffusion dithering would IMHO be a good bet. But maybe that becomes really to much for Basic.

I've been considering doing Raytracing on the Amstrad CPC, but in C. Perhaps using integers only, for speed.

Done that instead: https://cpcitor.itch.io/just-get-9

Hey, found this https://bbcmic.ro/?t=9ctpk via "BBC BASIC raytracer in 432 characters (mastodon.me.uk)" https://news.ycombinator.com/item?id=39023056#39023768

comment 2y ago · link · parent

Excellent! A similar program, apparently from 3 years ago, did similar things, in Basic also, on the Amstrad CPC, a machine with the same processor, a little more RAM and more (27) colors or shades of green, depending on the screen it was hooked to.

* colored spheres (like you did)

* (one) checkerboard surface

* self-shadowing (like you did)

* cast shadows (like you did)

* partial or total specular reflection!

See https://www.cpc-power.com/index.php?page=detail&num=19283

The webpage displays the color (left) and green (right) versions on hovering your pointer over the ribbon (above). Image 1 and 2 are okay in both cases, image 3 is clearly tuned for color screen, image 4 for green screen.

Or direct links to the relevant variants:

https://www.cpc-power.com/extra_lire_fichier.php?extra=cpcol...

https://www.cpc-power.com/extra_lire_fichier.php?extra=cpcol...

https://www.cpc-power.com/extra_lire_fichier.php?extra=cpcol...

https://www.cpc-power.com/extra_lire_fichier.php?extra=cpcol...

https://www.cpc-power.com/extra_lire_fichier.php?extra=cpcol...

https://www.cpc-power.com/extra_lire_fichier.php?extra=cpcol...

comment 2y ago · link · parent

You mean, like this? https://www.youtube.com/watch?v=SJ79CdUMfVA

Also, not exactly the same type or rendering, but basically word for word what you wrote: the full-screen fully animated parts appear to be "a set of frames rendered out and stitched together to make an animated sequence"

https://www.youtube.com/watch?v=o59LrpzGUaE

comment 3y ago · link · parent

In my opinion, you're spot on: being deprived of hearing the lowest frequencies typically occurs only when there's a pressure imbalance between the inner and outer ear. Therefore, when you experience silence at these lowest frequencies due to noise cancelling, your brain may assume a pressure imbalance must be the cause.

I've had the opportunity to use a variety of noise cancelling headphones over the years, from various brands, both in-ear and over-ear, and they all had this effect.

The good news is that you can become completely accustomed to it: after a while, the brain understands that there's no pressure imbalance, and it becomes a non-issue. Not hearing low frequencies is exactly what we expect from the product.

The article goes further to discuss some slope in a graph around 500Hz, which might be true, but I don't subscribe to that. It seems unnecessary to explain the observed facts and adds nothing.

What is not addressed at all is why all models seem to emit a subtle continuous shhhhhhh across a broad range of high frequencies. It's so subtle that you can only notice it when the outside environment is already quiet. I've never been certain whether it's just noise from the signal processing. My intuition is that it's artificially added to prevent inducing tinnitus in some users.

comment 3y ago · link · parent

IMHO this is the effect expected by the people who named the function, and the reason why the name is very well chosen.

Yes, it's funny but that's not the point. The important thing is that the name clearly conveys the message that you really shouldn't be calling it, as explained in the comments above the function definition.

The "funny but there's a real reason behind" aspect is a bit like https://xkcd.com/radiation/ : "It's for general education only. If you're basing radiation safety procedures on an internet PNG image and things go wrong, you have no one to blame but yourself." The sentence is funny but has a real purpose: protect readers and author.

comment 3y ago · link · parent

* Context: const and compile-time constants

Constructs fully determined at compile time have some benefits. But const in C is weaker than constexpr that C++ has.

As prog-fh summarizes on https://stackoverflow.com/questions/66144082/why-does-gcc-cl...

> "The const means « I swear that I won't change the value of this variable » (or the compiler will remind me!). But it does not mean that it could not change by another mean I don't see in this compilation unit; thus this is not exactly a constant."

One example of invalid C:

const int mysize = 2; const int myarray[mysize];

gcc: error: variably modified ‘myarray’ at file scope

clang: warning: variable length array folded to constant array as an extension [-Wgnu-folding-constant] const int myarray[mysize];

* Good news: C can do compile time constant structs and array with deep self-references.

Yes, in C you can define and fully declare complex data structures that are accepted as compile-time constants, including pointers to parts of itself.

See "self-contained, statically allocated, totally const data structure with backward and forward references (pointers)?" for a previous example at https://stackoverflow.com/questions/47037701/can-c-syntax-de...

-----------------

I used this for a game on a retro machine where such a data structure avoids code which would have been several times (perhaps 10 times) bigger: https://github.com/cpcitor/color-flood-for-amstrad-cpc/blob/...

Here's another take showing two variants: where overall construct is an array then a struct: https://gist.github.com/fidergo-stephane-gourichon/792c194e1...

comment 3y ago · link · parent

> Welcome to Counterexamples in Type Systems, a compendium of horrible programs that crash, segfault or otherwise explode.

Many interesting quirks in type systems, surprising interference between separately innocuous type system features, but don't expect too many explosions.

Indeed, many of the tricks are years old (e.g., 2006) and are fixed in current versions of the language (or even are research paper involving experimental systems that were never released, e.g. Privacy violation in C# doesn't even use a syntax that released C# compilers use).

Mutable matching in Ocaml can be reproduced with ocaml 4.13, still, and cause a segfault.

comment 3y ago · link · parent

With a nod to https://en.wikipedia.org/wiki/Ward_Cunningham#Cunningham's_L...

> it is possible to shadow the BASIC ROM on the Amstrad CPC 464 (1984).

The ROM and RAM run at the same speed on that machine, so speed gain is not a motivation.

> You could copy the ROM to the RAM and permanently switch in the RAM.

Permanently? In principle you might be able to do that, but it's certainly not easy. The firmware switches ROMs/RAM all the time (lower ROM 300 times per second, higher ROM often when BASIC runs). You would need to patch the routines that perform ROM switching to make them switch only lower ROM. Fortunately those routines are already copied in central RAM because they need to operate whatever the ROM configuration, so it is possible to patch them. Still, the patched version would probably be more complex, so you'd need to borrow some more bytes elsewhere. Also make sure that no change is needed to the first 64 bytes (address range 0x0000-0x003F) because when ROM is enabled there they don't have your RAM-based changes.

> That ROM is normally located at C000h, shared with bank-switched RAM storing the display at the same address.

Beware, the optional external disk drive on the CPC464 adds another ROM at the sames address. So, if you want to keep compatibility, do patch the routine right, so that they do bank-switch that ROM, but when targeting BASIC ROM they actually re-enable RAM (not the same hardware registers as explained on the reference you posted).

> Which allowed you to do stuff like modifying the error messages in BASIC to say rude words,

After all that hard work is done, yeah you could replace some strings with other strings of the same length, keeping the most significant bit set as separator, why not. But most strings aren't even stored as is, they are encoded in various ways to save bytes (Basic instruction names, for example), typically only portions of words are in plain 7-bit ASCII.

> You had to do another trick to move the display RAM elsewhere too

More than one trick as shown above.

The welcome message is in lower ROM, so hey, let's go crazy like "I don't need a reason, let's shadow all the ROM". The simplest bet would be to start with a CPC464 without a disk drive, copy both ROMs to RAM, tell firmware to use screen at 0x4000 instead of 0xC000 (easy compared to the rest), patch all areas that define low addresses to shift these by 0x8000 more (much less easy). Then you'd have a system running, with your free RAM for Basic programs around 10k instead of 42k. But hey, the welcome message on system "reset" would be yours.

> not that we would have ever done that.

Definitely. Thanks for the ride.

comment 4y ago · link · parent

This page is about memory-mapped hardware registers, not CPU registers.

It explains pitfalls in accessing these through low level C definitions, proposes a C++ encapsulation class and summarizes pros and cons.

comment 4y ago · link · parent

These points are only weakly in favor of such a web app. Don't like CLI? Use gimp or similar. Don't want to install anything? On some OS it might make sense. On that OS consider Paint. It probably does not support webp, but if you're serious about webp you have tools. Smartphone/tablet? Is there even a need to do conversion on those? Privacy? Use an operating system that has some reputation, like Debian stable, not a web app. IMHO this web app is a nice exercice for its author.

comment 4y ago · link · parent

Similar project? https://www.flying-whales.com/

(Not saying if any of those is viable, just mentioning in case it makes the conversation more interesting.)

comment 4y ago · link · parent

? It doesn’t even allow non-integer numbers.

comment 4y ago · link · parent

That fixes the problem of a buffer content after allocation by the language/runtime/platform. When a buffer is reused at the library/application level, no zeroing is done.

comment 4y ago · link · parent

> This page will only work with JavaScript enabled

I guess the average HN user has Javascript enabled by default, yet I expected a longer and more informative page than that. ;-)

comment 4y ago · link · parent

And even if the region-humidity thing was true, the printer could just print a warning. That would not justify a plain refusal to print, would it?

comment 4y ago · link · parent

It can do similar things: https://hackaday.com/2020/04/15/logging-into-linux-with-a-19...

comment 4y ago · link · parent

From the photos and videos, the guy is indeed a 2CV hacker. I think the contraption is real.

Source: my father owned several cars of the 2CV family and we rode in them for years.

Did he actually build it in the desert? Without tools it seems rather difficult.

Here's the central point of https://sahara-overland.com/tag/emile-leray/

> I believe the 2CV bike was indeed built in the desert, much as Leray claims, but he set out from France with the explicit intention of performing this task. Otherwise he’d have walked out like any normal person in a similar situation.

> His claimed unease about leaving his stricken car doesn’t ring true, let alone the spontaneous idea of making it into a two-wheeler. Tellingly, in 2006 Leray went on to build a ‘2CV boat’ in Mali. He clearly likes mucking about with 2CVs. Fair play to him!

comment 4y ago · link · parent

Generally not the point. Depending on your video player you might only get aliasing artifacts (and virtually always higher resource consumption).

The point of selecting a higher definition video stream can be to circumvent bandwidth limitation, if the platform happens to compress too much what it sends by default.

comment 4y ago · link · parent

Interesting article.

> Warning: this page has about 72MB of Gifs! Medium also has a tendency to not load them properly, so if there’s a large gap or overly blurry image, try reloading the page. Ad blockers may cause problems, no script may make it better. It’s also broken in the official Medium app. Sorry, Medium is just weird.

There may be a fix: vote with your choice, stop publishing on Medium, publish elsewhere?

This content is worth it.

comment 4y ago · link · parent

SimpleWall is open-source but Windows-only

> Platform architecture: 32-bit/64-bit/arm64 > Supported OS: 7 SP1, 8, 8.1, 10, 11

while Portmaster https://safing.io/portmaster/ is open-source, offers precompiled packages for Windows 10/11, Debian/Ubuntu and Fedora and is reported to work (sometimes not perfectly) on many kernel/desktop environment combinations, see https://docs.safing.io/portmaster/install/linux .

12345
9