Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
retoor110053dMy last rest service required sqlite3 and now i have a bit concept of a database implementation and added a native database function. The function 'bool' in this case. It converts true/1 to "true" and "true" to 1. bool(bool(true)) == "true". I can use "select bool(a) from where a = true form table". So I have learned that along the way too..
What's next: build own db but that's even for me too much work. It's more work than average general purpose programming language since it also includes a parser / interpreter, and that's only the start! I've watched a hour video about sqlite internals and decided, not writing a database myself, but am capable probably. But sqlite3 has too much extra's (e.g.: journal with serveral storage options) that you really want on top of the basic db implementation -
Hazarth94223d@cafecortado same! We also had to implement HTTPS so all the certificate negotiation stuff and it was super fun
-
retoor110053d@cafecortado did you use the preferred limits for header in total and header values? Had you build in protections so a user couldn't go to ."/../"?
What interesting assignments did you build more during university?
Cool about my server is that it supports http chunking. It can deliver a shitload of data with barely using memory and the client is happy because it gets data all the time. I do not first generate a request and THEN send, but I send when generating. So a stream. Very good for large datasets -
retoor110053d@Tounai that json library parsing was done in one very sharp evening. Not only building, also constructing. I check if serialize(deserialize(serialize())) equals to original content in the tests. Works flawlessy. The serializer and deserializer are both one single recursive function. between 70-80 lines. Total json library is 590 lines
-
@retoor I don't remember. Probably it was filled with vulnerabilities that I didn't care enough xD
-
Tounai11943d@retoor It’s 590 lines I would have hated to write. It is among the things I hate doing, especially that it has performances considerations
-
retoor110051d@UberSalt I really think so. Also, if you're lazy, after writing some C, not anymore. It's a good way to get rid of lazyness. But last night I've written python and damn, that goes fast but damn, what uses it a lot of resources. My C server handles three fully time requesting python clients with just 40% CPU while all python processes are on 100%. And that C application does even the heavy database stuff. Million requests, still on 0.3 memory usage or smth. Writing C is rewarding
-
AlgoRythm5079455mC is nice, but I think the architecture is lacking. That’s why I use Zig. The standard library is beefy enough - and optimized enough - where I can get machine language performance without pulling in tons of dependencies or losing performance by reinventing the wheel. Unless I want to.
Related Rants
-
xjose97x19Just saw a variable in C named like this: long time_ago; //in a galaxy far away I laughed no stop.
-
devoutpost14HTTP response code cheat sheet (From /r/Programmer humor)
-
elgringo41Student - Teacher renaming .c to .exe make the program executable ? Teacher - Yes A group of people stand up...
Why do I program everything myself in C, even a rest service? By writing everything yourself in C you make simple things complex to make complex things simple.
Writing a rest service for example learns you a part of http protocol, how sockets work, how to create a parser (in this case json). Three thing's you would miss if I used python.
On top, your rest service uses WAY lesser resource than written in python for example. Especially for CPU usage.
Allocating and free-ing still often have issues there, but I consider it a skill problem / discipline issue. Not blaming C for that. The rules are clear.
random
cpu
rest
sockets
blaming
allocate
c
python
service
http
json
free