Reddit Programming
201 subscribers
1.22K photos
126K links
I will send you newest post from subreddit /r/programming
Download Telegram
MySQL and PostgreSQL: different approaches to solve the same problem
https://www.reddit.com/r/programming/comments/1r90loc/mysql_and_postgresql_different_approaches_to/

<!-- SC_OFF -->Both DBs solve the same problem: How to most effectively store and provide access to data, in an ACID-compliant way? ACID compliance might be implemented in various ways and SQL databases can vary quite substantially how they choose to go about it. MySQL in particular, with the default InnoDB engine, takes a completely different approach to Postgres. Both implementations have their own tradeoffs, set of advantages and disadvantages. In theory, the MySQL (InnoDB) approach should have an edge for: partial updates of tables with more indexes - not all indexes but only of changed columns have to be modified querying tables by the Primary Key - index is the table so it should be as fast as it gets, since data is read from a single place previous row versions are stored in a separate space on the disk, therefore active transactions are less affected by the potentially large older row versions Postgres advantages are: uniform search performance for all indexes - there is no primary/secondary index distinction, performance is the same for all of them smaller penalty for random inserts because tables are stored on a heap, in random order, in contrast with sorted MySQL Clustered Index (table) previously started transactions have better access to prior row versions, since they are stored in the same disk space there is less need for locking (virtually none) to support more demanding isolation levels and concurrent access - previous row versions are stored in the same disk space and can be considered or discarded based on special columns (xmin, xmax mostly) In theory, theory and practice are the same. But, let's see how it is in practice! <!-- SC_ON --> submitted by /u/BinaryIgor (https://www.reddit.com/user/BinaryIgor)
[link] (https://binaryigor.com/mysql-and-postgresql-different-approaches.html) [comments] (https://www.reddit.com/r/programming/comments/1r90loc/mysql_and_postgresql_different_approaches_to/)
Lessons learned building a cross-language plot capture engine in R & Python
https://www.reddit.com/r/programming/comments/1r93zyo/lessons_learned_building_a_crosslanguage_plot/

<!-- SC_OFF -->I spent a lot of time trying to build a "zero-config" plot capture system for both R and Python. It turns out the two languages have fundamentally different philosophies on how pixels get to the screen which make this easy in Python and super hard in R. I wrote a deep dive comparing the display architectures in both languages, including some admittedly hacky ways to find figure objects through stack inspection. Hope it helps someone avoid our mistakes! <!-- SC_ON --> submitted by /u/mpacula (https://www.reddit.com/user/mpacula)
[link] (https://quickanalysis.substack.com/p/capturing-plots-in-r-and-python-a) [comments] (https://www.reddit.com/r/programming/comments/1r93zyo/lessons_learned_building_a_crosslanguage_plot/)
Most Developers Don’t Build New Things
https://www.reddit.com/r/programming/comments/1r94m2g/most_developers_dont_build_new_things/

<!-- SC_OFF -->I wrote this after noticing how much framework discussion focuses on greenfield work. In practice, most teams I see are inside 10 or 12-year-old systems, evolving them under real constraints. The piece is about that “second act” of software. After launch. After early growth. When reliability and discipline matter more than novelty. Curious how others here think about this. <!-- SC_ON --> submitted by /u/robbyrussell (https://www.reddit.com/user/robbyrussell)
[link] (https://robbyonrails.com/articles/2026/02/18/most-developers-dont-build-new-things/) [comments] (https://www.reddit.com/r/programming/comments/1r94m2g/most_developers_dont_build_new_things/)
AWS suffered ‘at least two outages’ caused by AI tools, and now I’m convinced we’re living inside a ‘Silicon Valley’ episode
https://www.reddit.com/r/programming/comments/1r9xd58/aws_suffered_at_least_two_outages_caused_by_ai/

<!-- SC_OFF -->"The most efficient way to get rid of all the bugs was to get rid of all the software, which is technically and statistically correct." <!-- SC_ON --> submitted by /u/squishygorilla (https://www.reddit.com/user/squishygorilla)
[link] (https://www.tomsguide.com/computing/aws-suffered-at-least-two-outages-caused-by-ai-tools-and-now-im-convinced-were-living-inside-a-silicon-valley-episode) [comments] (https://www.reddit.com/r/programming/comments/1r9xd58/aws_suffered_at_least_two_outages_caused_by_ai/)
I built the same PostgreSQL REST API in 6 languages — here's how the database libraries compare
https://www.reddit.com/r/programming/comments/1r9xv1x/i_built_the_same_postgresql_rest_api_in_6/

<!-- SC_OFF -->I've been building an identical CRUD API backed by PostgreSQL in six languages to compare how each ecosystem handles database access in practice. Covered: TypeScript, Python, Java, C#, Go, and Kotlin. <!-- SC_ON --> submitted by /u/davideme (https://www.reddit.com/user/davideme)
[link] (https://davideme.com/articles/crud-postgres/) [comments] (https://www.reddit.com/r/programming/comments/1r9xv1x/i_built_the_same_postgresql_rest_api_in_6/)
Snake game but every frame is a C program compiled into a snake game where each frame is a C program...
https://www.reddit.com/r/programming/comments/1ra9p5k/snake_game_but_every_frame_is_a_c_program/

<!-- SC_OFF -->Source code on GitHub (https://github.com/donno2048/snake-quine) This project demonstrates a concept called quine, or "self-reproducing program". The main problem I faced, which I guess anyone is facing when making such a program is that every print you do has to be printed by itself so at first glance you'd think the code size has to be infinite. The main trick that allows it to work abuses the fact that when strings are passed into a formatting function they are formatted only if they are passed as the first argument but not when passed through %s, so formatting "...%s" with string input of "..." will give you both a formatted version and an unformatted version of the string. So if you want a string containing "a" you can do char *f="a"; and then sprintf(buffer, f), which is obvious but then, extend the logic we described and you can get "char *f=\"achar *f=\\\"a%s\\\"\"" into the buffer by defining char *f="a%s"; and using sprintf(buffer, f, f), and you can use any formatting function not just sprintf. Another problem I faced was when I wanted to make it possible to run the program from windows, so I had to make the main formatted string way longer which I didn't want, so the trick I used was to make the first program to run unidentical to the rest as a sort of "generetor". Another small trick that I thought of for this purpose is defining #define X(...) #__VA_ARGS__, #define S(x) X(x), which together with platform specific macros I defined help make the main formatted string suitable for the platform it was preprocessed on. As a result of using a generator anything that can be generated at runtime we do not need to define for the compiler to do at compile time e.g. we can make the game's rows and cols calculated at runtime of the generator to make the C code more elegant and more importantly easier to refactor and change. The rest is a couple basic I/O tricks you can read in the code yourself as it's easier to understand that way IMO then reading without the code. <!-- SC_ON --> submitted by /u/Perfect-Highlight964 (https://www.reddit.com/user/Perfect-Highlight964)
[link] (https://youtu.be/gvF7rWfcFD8?si=PzvURvL-WofvB8UH) [comments] (https://www.reddit.com/r/programming/comments/1ra9p5k/snake_game_but_every_frame_is_a_c_program/)