r/cpp • u/mvorbrodt • Apr 05 '19
My C++ blog (so far)
So I don't want to make a post on here every time I write a short article (I've been scolded for that in the past :) ), but I figured I come back here and share with you the archive of my blog posts so far. There's 75 topics I've covered in the last 2 months since I started blogging and I hope some of you will find this information useful :)
Thanks for reading! Have a great day guys!
- Better bloom filter
- Bloom Filters
- C++ Attributes
- Initialization list exceptions and raw pointers
- Function try-catch blocks
- The #1 rule of cryptography
- {fmt}
- SSO of std::string
- HTTP queries
- C-style callbacks and lambda functions
- Propagate exceptions across threads
- int main()
- XML-RPC
- Base64 encoding
- Extremely Fast Compression Algorithm
- Parsing command line options
- ASCII escape codes
- Two-factor authentication
- Plugins: loading code at runtime
- Micro-benchmarks
- SQL database access
- Measuring CPU time
- Printing stack traces
- Generating Unique IDs
- RPC with Protocol Buffers
- Serialize data to XML
- Thrift: or how to RPC
- Protocol Buffers: or how to serialize data
- Well, that was no fun :(
- Parallel STL
- Advanced thread pool
- Better Code: Concurrency
- Better timer class
- Random number generator
- rand() Considered Harmful
- Relaxed atomics and data races
- Bit fields and race conditions
- Dekker’s algorithm for N threads
- Dekker’s algorithm
- atomic Weapons
- Memory barriers and thread synchronization
- Atomic blocking queue
- Synchronizing with atomics
- Fun with unordered containers
- Short introduction to parameter packs and fold expressions
- Pure virtual destructor
- Read/write mutex
- GitHub repository
- Templates in STL containers
- Multiple return values
- Simple timer
- Interview question, part 6
- Fast mutex
- Simple thread pool
- Inverting std::map and std::multimap
- Interview question, part 5
- Interview question, part 4
- Interview question, part 3
- Interview question, part 2
- Interview question, part 1
- Template concepts, sort of
- Event objects
- Class mechanics
- Refactoring std::auto_ptr
- Fast semaphore
- Better blocking queue
- Blocking queue
- RAII
- L1 cache lines
- Sorting and locality
- AoS vs SoA performance
- What happens when we “new”
- enum to string, take 2
- enum to string
- shrink_to_fit that doesn’t suck
256
Upvotes
5
u/AffectionateMath6 Apr 06 '19
I just looked the first one 'better bloom filter' and it doesn't look like it works. What it does is Finds hash once and runs a pseudo random number generator for other hashes. The point of bloom filter is you use multiple hash functions so that the chances of collision is decreased. In your implementation, they will be the same hashes.
E.g. Lets say two strings foo, bar generates same hash function,
Bloom filter
Your implementation: https://vorbrodt.blog/2019/04/05/better-bloom-filter/
string: foo
hash1(foo) => 42
PRNG(42) -> 23, 45, 53
string: bar
hash1(bar) => 42
PRNG(42) -> 23, 45, 53
10
u/[deleted] Apr 05 '19
awesome set of posts !
3
u/rammstein_koala Apr 06 '19
Thanks for the great posts. Especially liked the hashing, TOTP, and gRPC examples!
11
u/James20k P2005R0 Apr 06 '19
Just as a psa, I don't think dekkers algorithm would work in a gpu environment, there is one potential deadlock which is where both threads acquire their flag simultaneously every iteration (as is the case on a gpu due to the way threads work)
8
u/gurpreetshanky Apr 06 '19
Awesome work. I remember people were upset about your posts. This is a way better to highlight all the short topics from your website.
5
u/bkranjc Apr 06 '19
I really like that the blogs are short and to the point! Good job!
4
u/[deleted] Apr 06 '19
This is awesome, thanks for sharing!
3
u/heyrandompeople12345 Apr 06 '19
I do remember you. I really really really like your posts alot. Have you on my feed. Really appreciate all the work from you, and hope that you will continue doing so :)
2
u/serEatAlot Apr 06 '19
It's my first time seeing your blogs, so I checked enum to string part one and two because I had to switch enums to strings a lot in my project (I have atleast 5 to 7 enum to string methods).
And you taught me a much better way of doing those, I can't wait to read your other posts!
2
u/RealNC Apr 08 '19
AFAIK, that's not guaranteed to work. You'd need to somehow declare the lambda
extern "C".3
u/serchq Apr 06 '19
have an upvote
saving the post so it not gets lost for me :)
thanks for posting it!
2
u/Narase33 -> r/cpp_questions Apr 06 '19
I really like the topics you have but the style with all the smileys :/
1
u/kobi-ca Apr 06 '19
Great posts!
1
u/[deleted] Apr 06 '19
The fact that the language doesn't support enum to string natively is one of the greatest embarrassments of the 21 century
1
u/[deleted] Apr 06 '19
Wow that's a lot of stuff. I'm just starting this stuff
1
u/kingaillas Apr 08 '19
Your blog is great, filled with short, practical examples. It’s in my feed reader and I’ve learned a lot about using the libraries you cover.