Live data from Hacker News

Building a Website with C++

blog.sourcerer.io

91–100 of 122 posts

Re: Building a Website with C++

#91
post #83
post #81

Earlier quoted context omitted.

Oh hey, you are still using Vultr? How have they been? I'm pretty sure I'm the one who suggested it some years ago on the forum and have wondered ever since if the at least then-unproven VPS company ended up being reliable. It looks like their prices have stayed competitive at least!

I’m using vultr now and I vastly prefer it over Linode (I’ve yet to fully try DO). It’s super simple UI to start an instance with a basic script (like update distro and developer tools etc). Lastly, you can pass in your pub keys and just ssh directly without doing it yourself the moment you log in for the first time. All in all highly recommend it!

Friendly note: they modify the stock install to enable root SSH login via password. I'd strongly recommend disabling that. Go to RSA key login as user only.

In an absolute emergency, their GUI portal will let you log in as root via password.

Re: Building a Website with C++

#92
post #36

Earlier quoted context omitted.

It's futile battle though to achieve both performance and safety in C++: as an example, safety requires avoiding moves, using reference counting, while achieving performance means avoiding copies and passing occasional references around, among other things. That's why advertising C++ solution as fast does not work well with "but C++ can be safe too!".

Not sure I necessarily agree with all your examples, but yes, this trade-off between safety and performance does exist in C++. It is particularily acute whenever you're forced to work with third party libraries that don't agree on a single approach to memory management. Rust is essentially a bet on the impossibility of working around that trade-off in C++. And they are right, it is impossible to close that gap comple…

Rust is more than just safety though. We had a huge community discussion last year: https://brson.github.io/fireflowers/

Re: Building a Website with C++

#94
Some other libraries I have seen for http protocol based applications:

https://github.com/Qihoo360/evpp - network library for developing high performance network services in TCP/UDP/HTTP protocols

https://github.com/rep-movsd/see-phit - C++ HTML template engine that uses compile time HTML parsing

https://github.com/boostorg/beast - HTTP and WebSocket built on Boost.Asio in C++11

https://github.com/emweb/wt - Wt, C++ Web Toolkit

Re: Building a Website with C++

#95

Earlier quoted context omitted.

Not sure I necessarily agree with all your examples, but yes, this trade-off between safety and performance does exist in C++. It is particularily acute whenever you're forced to work with third party libraries that don't agree on a single approach to memory management. Rust is essentially a bet on the impossibility of working around that trade-off in C++. And they are right, it is impossible to close that gap comple…

Rust is more than just safety though. We had a huge community discussion last year: https://brson.github.io/fireflowers/

I know it's more than that. But what you can't do, in my opinion, is love Rust for its other modern features and merely tolerate the new approach to memory management.

Memory management in Rust is so dominant in terms of syntax and in terms of restrictions imposed on common idioms that it must be either embraced or rejected wholeheartedly.

This is just my personal opinion obviously, not any sort of truth or prediction.

Re: Building a Website with C++

#96

Using CGI is silly and slow, for all but the simplest, stateless servers. If one wishes to avoid the overhead of learning a new framework, at least FastCGI should be considered. A relevant (but dated) discussion about web frameworks in C++ can be found in [1]. I am personally a big fan of CROW [2] and have used it many times in the past. [1] https://softwareengineering.stackexchange.com/questions/5362... [2] https://…

+1, FastCGI is the way to go for web services in C/C++: not only because cause of avoiding to spawn a process for each request, but because of having web services state in memory. Also, for avoiding heap fragmentation in long lived processes I recommend avoiding the STL library, and avoid using C++ strings, too.

Re: Building a Website with C++

#97

Pion[0] is a fairly robust and well-written HTTP server implementation in C++. You can spin up a server very quickly and reverse proxy through Apache or Nginx. Microsoft has a cross-platform offering of some sort in the works using C++11, now I don’t remember the name but I think Herb Sutter has a write-up in it from a couple years ago. It’s definitely possible to write modern web applications in C++, I feel like the…

> Microsoft has a cross-platform offering of some sort in the works using C++11

Casablanca, but I'm not sure how active is the project nowadays.

Re: Building a Website with C++

#98
post #78

Earlier quoted context omitted.

I too like to dabble in masochism

I also write my own cryptography implementations: https://gitlab.com/higan/higan/blob/master/nall/elliptic-cur... It's fun. We learn and better ourselves by making mistakes. My idols are the folks breaking through the security of the Switch et al. They had to learn somewhere: by doing things everyone else told them not to. Don't worry, I would never use this stuff in production at a company.

As someone who's been helping lead the charge on Switch hacking, you're one of my idols, haha. Come join us! You would fit in well.

Re: Building a Website with C++

#99

Earlier quoted context omitted.

Rust is more than just safety though. We had a huge community discussion last year: https://brson.github.io/fireflowers/

I know it's more than that. But what you can't do, in my opinion, is love Rust for its other modern features and merely tolerate the new approach to memory management. Memory management in Rust is so dominant in terms of syntax and in terms of restrictions imposed on common idioms that it must be either embraced or rejected wholeheartedly. This is just my personal opinion obviously, not any sort of truth or predictio…

Yeah, I totally hear you. I shared that opinion too, but, surprisingly enough, it seems to some degree that that's in the minority. Or at least, there's a pretty significant number of people who do "love Ruts for its other modern features and merely tolerate the new approach to memory management."

I feel that way myself now, but figured that I was just too close to have a mainstream opinion about it :)

Re: Building a Website with C++

#100
post #40

Really? Escaping, people! This code isn't practical or useful; it's dangerous and sloppy. cout \n"; ... cout \n"; FWIW I wrote an article about HTML escaping and shell here: http://www.oilshell.org/blog/2017/09/19.html Followup: http://www.oilshell.org/blog/2017/09/29.html Also if you want to use a native language for web sites (which I don't), Go is a better choice, as the standard library has html/template which pr…

> In this article, I’ll explain how you can use C++ to develop a website and some concrete reasons why you might consider doing so.

I dont find any reasons at all. That article ist just a clickbait nonsens.

Post reply on HN