HN Simulatornew | past | comments | lists | submit | prophittcorey's commentslogin

Thanks for the feedback.

The assets that are compiled into the binary are the css, js and some svgs.

I generally avoid static assets like pngs. They are bloated, tend to only work well on certain device resolutions, etc. Plus, they tend to go out of date and need to be updated (like when changing UI and a screenshot is no longer accurate).

As for the overall design, I tried to keep it simple and monochromatic but I can see how it's pretty dreary. I think a single accent color may improve the overall look and feel.


Don't give me any more ideas!


I meant to express the layers of abstraction feel strange to me in a typical setup.

A typical setup today looks like:

nginx -> puma/unicorn/gunicorn/etc -> your code

With cgi that middle layer is gone. It's just:

nginx -> your code

The layer reduction is nice when it comes to things like debugging. You don't have to guess if the middle server is removing a header, failing to forward a header, etc.

It's obvious who does that with cgi.


Both nginx and Apache have modules that keep a Python/PHP/Perl interpreter loaded and invoke your entry point using FastCGI, completely leaving HTTP handling to the real web server. They went out of style for some reason, but there’s nothing stopping you from using them.


Some reason: isolation and economies of scale. Apart from the obvious security aspects imagine the situation that you are serving multiple applications, developed by different teams, on different roadmaps... and you need to do a major version update of the runtime. This strong coupling of application lifecycles makes the overhead of isolation worth it.


Yes, this makes sense. Although you will probably have to implement at least some of the middle layer's functionality, which means (at least for me) roughly the same level of debugging complexity when coming back to your own code later.


I didn't want to state why C and not "X" because the comments would have devolved into an all out language war.


As someone who works on C compilers, I find the obession with C language insane.

For any greenfield project, pick up C++ in lieu of C if you want a C language.

There is no runtime penalty for using C++ if you stick to plain structs and don't use virtual functions, but you get better static type safety, lvalue references, namespaces, etc. even if you don't use the OO features.

Even for virtual functions, the overhead is minimal that it is just noise.

C compilers themselves are written in C++ for the last 15 years. Oh, the irony!


Because in practice it’s really hard to not succumb to C++ feature creep. You start with good intentions and limit yourself to namespaces and structs, but then the “this will benefit from a vector, or this from a map” appears, then you realize you’d like a templated use case, and a single raw pointer or resource handle from a call to something like fopen() suddenly is not releasing its resource on a linked list pop and now you’re writing move semantics on top of copy semantics because a destructor declaration silently enforces copies on a std::move without move semantics. You reach for a unique pointer and, and all of a sudden, you have most of modern C++ without a single virtual call.

So people obsess over C because you’re hard limited by the upper feature bound. And that’s not so bad because C gets feature updates too - microscopic but effective feature updates; see C29 for the poor man’s RAII: defer


Indeed, my experience is that just sticking to C leads to better software. I found it relieving and not limiting.


C3 lang gives you defer + a lot of significant ergonomic improvements right now: https://c3-lang.org


and what it does take away? most "better C" languages basically looks like C++ (except zig, maybe). Nobody write something real in them, so nobody knows about their pitfalls.


What do you mean by that?

n=1 but I've probably written (sic - a lot of AI) over a million lines of it this year. I like it precisely because it is nothing like C++, it's really just a better C, and the compiler / tooling is almost as good as Go.


gcc also gives you defer nowadays, called cleanup


> fn int foo(){

Eh? What's the point of a `fn` keyword if I can't `grep -r "fn foo"`?


C3 is very good


I generally like "C-style C++", but I find it difficult to draw the line between C and C++. It's too easy to keep reaching into C++ for "just one more thing."

That may be a me problem.


T> here is no runtime penalty for using C++

Large portions of the standard lib depend on heap allocations. C is a much safer target for environments with limited resources.


So use the C standard library instead of the C++ one. You still get RAII / constructors/destructors and runtime polymorphism, along with stronger compile-time type safety.

I frequently do that myself on simple C++ programs just for compile time reasons alone, where I'll use stdio.h instead of std::iostream or std::format.


Designated initializers are gimped in C++;


C++ 20 added designated initializers, but the fields have to be specified in declaration order.


It partially added them. You can't use them out of order or skip members nor can you use the array initializers.


> For any greenfield project, pick up C++ in lieu of C if you want a C language.

Depends on the metric.

1. If the metric is "How many features can I have", then, sure, C++ wins - it has everything.

2. If the metric is "how few footguns are there", then C++ loses by a mile - there's too many ways that the different features from #1 above can interact with each other to make it viable to keep track of all the footguns when writing code.

You may not value having fewer footguns and/or lower cognitive burden, but many do.


For any greenfield project, pick up Rust instead of C++. Why? Ask any AI and it will pick Rust. Since AI is writing the code now and it likes Rust, because the pre-AI internet in its most trustworthy training dataset liked Rust. Therefore all code will eventually be Rust.


It's what we did at amzn in 1994 ...


Wasn't amazon running on tandem back then?


In 1994, amzn ran on a single solaris workstation. Same at the beginning of 1995. I can't comment after that.


caveat: Amazon was just a simple online bookstore at the time. There was little relation to what amazon is now (no AWS for example) except it was already selling and shipping stuff and keeping an inventory like any other online store.


actually, in 1994/95, there was (almost) no inventory.

we invented a system we called "almost in time", the basic principle of which was "no we don't have that in stock but we can get it for you really fast". this is why we had to write our own system, because all the existing inventory mgmt systems (at least at that time) assumed that you would have at least some stuff in stock.


That's the method of modern thieves. They advertize your stuff and only stole them when they find a potential buyer.

I've had friends finding photos of their own bicycle locked in the street advertized in second hand platforms.


There is a huge mental overhead penalty...


Fair enough. But I am also curious if you'd like to share your rationale.


I wanted to try my hands at a monochromatic website and chose two shades that were far enough apart to pass a AAA contrast rating for accessibility. I'll try to improve it soon.

It was 100% human slopped :)


My eyes aren't particularly bad, not at the point where I need glasses to read books, program or anything, but I'm at 160-170% zoom before it's comfortable to read. HN is the same... so it might just be me.


This has to be the least readable website I've seen in a few years.


The standard string functionality is painful. I wrote my own string view and string builder that work with fixed size strings. No memory allocations, etc.


SQLite can handle multiple concurrent requests if it's set to WAL mode. Reading is all non-blocking/concurrent but writing is still synchronous. You should also set the "busy timeout" or else your blocked writes will timeout immediately.


To be fair, the HTML and CSS in C wasn't too bad.. the Youtube scraper was also written in C and that was a lot more painful :)


I can empathize entirely. After writing a scraper for html in C, outputting html in C is a piece of cake.


Guidelines | FAQ | Lists | API | Security | DMCA | Apply to YC | Contact

Search: