news
Programming Leftovers
-
Tony Finch ☛ performance of random floats
A couple of years ago I wrote about random floating point numbers. In that article I was mainly concerned about how neat the code is, and I didn’t pay attention to its performance.
Recently, a comment from Oliver Hunt and a blog post from Alisa Sireneva prompted me to wonder if I made an unwarranted assumption. So I wrote a little benchmark, which you can find in pcg-dxsm.git.
-
[Old] Computer History Museum ☛ Folklore.org: -2000 Lines Of Code
I'm not sure how the managers reacted to that, but I do know that after a couple more weeks, they stopped asking Bill to fill out the form, and he gladly complied.
-
Ruben Schade ☛ Error-driven development
I wrote the pseudocode with recursion for brevity, but you get the point. As you can see, it would check if writing to a location returned an error, and if it did, it would increment the location and try again.
-
[Repeat] Jussi Pakkanen ☛ Custom C++ stdlib part 3: The bleedingest edge variant
Implementing a variant type in C++ is challenging to say the least. I tried looking into the libstd++ implementation and could not even decipher where the actual data is stored. There is a lot of inheritance going on and helper classes that seem to be doing custom vtable construction and other metaprogramming stuff. The only thing I could truly grasp was a comment saying // "These go to eleven". Sadly there was not a comment // Smell my glove! which would seem more suitable for this occasion.
-
Alex Ewerlöf ☛ Wardley Maps & Pace Layering for Senior Tech Leads and Engineering Leaders
You're thinking about architecture, tech bets, team direction, influencing product roadmaps, and ensuring your technical initiatives deliver real strategic value for the business.
-
Alisa Sireneva ☛ Fast limited-range conversion between ints and floats | purplesyringa's blog
How this works(1u32 << 23) as f32 is an IEEE-754 number with the (unbiased) exponent set to +23 and a zero mantissa.
-
[Old] Lucas Scharebroch ☛ Lucas's Page
The better we get at coding, the more we become aware of the fine-grained structural details of our programs. As programmers (whose nature it is to put everything in its right place), we are inclined to focus quite heavily on these details, often to the point of obsession1.
Obsessing over these details can be quite fruitful: restructuring code almost always leads to some sort of tangible result2 (even if it is partially subjective or imagined). This is what makes it so alluring (and addicting).
-
Perl / Raku
-
[Repeat] Perl ☛ Introducing DBIx::Class::ResultSet::PrettyPrint
The original impetus for DBIx::Class::ResultSet::PrettyPrint came from wanting to pretty print result sets in a Perl project I’ve been working on. I find that by seeing the data within a result set, I can get a feeling from what the data looks like and what kinds of information it contains. Searching for a pretty printing module, I stumbled across an answer on StackOverflow about pretty printing DBIx::Class result sets. I remember thinking that the proposed solution looked nice and I used the pattern a couple of times in my work. I eventually realised that the approach would be easier to use as a module. Since then, I’ve found it handy as a way to get an idea of the shape of the data that I’m playing with.
-
-
Python
-
[Repeat] Didier Stevens ☛ Python Requirements for Didier Stevens Suite
Although many of my tools have zero or a just a few dependencies (it’s a design decision), I’ve had requests to create a requirements file.
-
University of Toronto ☛ Adding your own attributes to Python functions and Python typing
Every so often I have some Python code where I have a collection of functions and along with the functions, some additional information about them. For example, the functions might implement subcommands and there might be information about help text, the number of command line arguments, and so on. There are a variety of approaches for this, but a very simple one I've tended to use is to put one or more additional attributes on the functions. This looks like: [...]
-