Simple code is easier to understand, easier to maintain and hard to write. Perhaps that’s why it’s so nice to find simple and elegant code every now and then.
Simple code is easier to understand, easier to maintain and hard to write. Perhaps that’s why it’s so nice to find simple and elegant code every now and then.
Very interesting thoughts on the influence of locality of reference and strategies of designing your data structures.
Stephan T. Lavavej explains: What does C++ do, even without the STL?
SQLite is a great project but even with the nicest library you can make mistakes. I created a single-header inspection wrapper, to quickly and easily detect the most common issues with code using SQLite.
And since I know from experience that it would be a major pain to instrument your code by hand, I decided to make this work with just a single #include. Please note that this is a C++ header.
All you have to do is download and extract sqlite_inspect_amalgamation.h and store it in the same folder where sqlite3.h lives.
Then open sqlite3.h and append the following line:
#include "sqlite_inspect_amalgamation.h"
There. All done. Just compile and run.
By the way, you’ll also find a readme file with some additional explanation in the archive.
This is the list of currently supported checks.
The check will not only tell you that a statement wasn’t closed but also which statements they were.
In case sqlite3_finalize is called a second time on a statement or with some garbage pointer.
Usually the reason for this is at least one unclosed statement. The report will tell you which database could not be closed along with the given error code. If open statements prevented the close-operation you’ll also get a list of those statements.
In addition to common errors you also get a report about executed statements and the number of times they were prepared. This should give you a good hint which statements should be handled by statement-caches.
By default a report named sqlite-inspect-report-{hex-value}.txt is automatically written into the working directory of the instrumented binary. The „random“ number at the end of the report is necessary to avoid collisions of reports when running code that has dynamic libraries which also uses SQLite.
This is in a alpha stage, meaning that you might encounter bugs, insufficient documentation or code comments and overall chaoticness.
But hey, it’s plug and play. So there’s Lille risk in trying it and a good chance that it’ll work fine for you.
The most recent version is 0.7
So if you find this interesting, give it a spin and please let me know your thoughts at inspect(funny a)thisdomain.
There’s some discussion about the morality of using ad-blockers. Matter of fact, it’s not so much the mindbendingly annoying or downright scammy ads that annoy me the most. It’s the ruthless tracking that’s my problem. Strange enough, I’m still using Google Analytics for this site. Quite the double standard. I guess I’ll have to do something about this…
But back to the topic at hand. Here’s a a nice collection of sites to block. All wrapped up nice and tidy to be added to your hosts file.
It will also block Google Analytics and therefore the GA site itself, so keep that in mind if you’re trying to take a look at your sites stats. ;)
The other day I was looking for a way to get easy coverage analysis for a C++ project. On Linux there’s gcov but on Windows there didn’t seem to be something like this. After some searching I came across OpenCppCoverage which looks quite good. Especially as it doesn’t require instrumentation.
I came across this great presentation of camera startegies in 2D games by Itay Keren. It’s quite surprising what tricks were used to ensure smooth game play. Especially since it all feels normal and you commonly don’t think, that someone explicitly planned how the view should move.
I came across a really nice article about pathfinding by Amit Patel. The great thing is that every example there is interactive so you can freely move start and end points or add, remove and modify obstacles.
It’s fun to play around with. Also take a look at his other articles.
Happy programmer’s day to everyone enjoying to code. :)
User experience is an important topic when you’re creating software products. It’s easy to frustrate users with incomprehensible interfaces or odd behavior. For a start on UX take a look at the UX crash course by Joel Marsh.