Mixins are great for “horizontal scaling” by adding functionality to a class over time. Reading mixed in code has an element of “gotcha” because the methods are scattered over multiple classes. Composition is great for handling complex functionality by insulating individual parts into their own classes and just exposing the bare interface to each other… Read More Mixins or composition?
I like to refactor. A lot. As I work on a problem I understand it better and I want to reflect this in the code. I was nearing the end of a pretty serious refactor. The tests had been failing for the last 60 commits or so. I wasn’t worried, I was expecting this. But… Read More Another short story, where unit tests save my butt
A live document, from the school of hard knocks … Get macOS to use a fixed width font: setFont(QFontDatabase.systemFont(QFontDatabase.FixedFont)) Get QTabWidget to have tabs on the left side and looking “professional” self.setDocumentMode(True) An epic can be written about the confusing behavior of menus on macOS, but the main reading material is https://doc.qt.io/qt-5/qmenubar.html#qmenubar-as-a-global-menu-bar menu.setNativeMenuBar(False) # We… Read More Some macOS + Pyside2 tips
Lying awake at night, existential questions cross your mind. What is my purpose? Is there a god? Can you subclass a Python3 int? Only the last one has an answer. You can indeed subclass an int, but there are a few subtleties. In short, in Python3 depending on whether the built in type is immutable… Read More Python3: subclassing int
Mixins are classes which are not meant to be used by themselves but instead are meant to be combined with other mixins on top of a base class to extend the functionality of that class. They are a great way to modularize code and make class features compose-able. Mixins are best explained using a simple… Read More Mixins!
Not only is Python a nice language but it has always had a lot of tooling around it. I’ve always taken advantage of Python’s tooling around testing (okay, not always …) and recently I began to pay attention to code coverage again. Python makes it all so simple and delicious. I have used nose in… Read More Tests and code coverage in Python
I was working on some C++ code, much like the one in this screen shot, when once again my IDE told me about some issue it had found with the code. The messages appear milli-seconds after I type some code in convenient tooltips placed in context. The messages are succinct, precise and usually contain enough information… Read More The wonder of c++ static analysis
An educational wild goose chase involving PDFs, beziers and perspective projections.… Read More Projections of Beziers in pdfs
I watched while the bulky machine swallowed my two oversized pages. My offspring had described my activity as “Daddy is drawing circles”. It looked like one of those older laser printers, but in reverse. I stared at it for a few seconds longer than necessary. I felt that I needed something to come out. An… Read More Receipts for votes, receipts as lottery tickets
I kind of dodged Greenspun’s tenth law, but then I didn’t: I think eventually the scripting language will be accidentally Turing complete in some weird domain, like where the space-time in the solar system is the tape with space ships writing on this tape.… Read More (Not) Dodging Greenspun’s tenth
Software with no documentation is like no software. If there is no description of how people can run your program, what kind of inputs and outputs it deals with and how you can interact with it most people will derive no benefit from your software. This goes both for “end user” programs as well as for… Read More Examples as documentation; documentation as specifications
(I used to put things like this in my assorted-experience blog, but life’s too short to have two blogs. Ok, three blogs. This will, most likely, not be of use to you.) My phone was complaining that it was running out of space. Somehow I had used up my 32 GB of memory. Anyone with… Read More Backing up Android photos
It’s been a few decades since a lab getting a laser printer was a bit of a status symbol. I remember the thrill of being in a lab that had it’s own laser printer (we perhaps shared it with a neighboring lab, but we thought of it more as us sharing it with them, rather… Read More Laser printer causes lights to flicker and also confuses cat.
The solar system simulator has a display and a compute part. I want to keep the display part minimal because I’m really interested in learning and coding up things that go into simulation and computation. The vast majority of commits since July 11th have been spent on the display so now I think is a… Read More Re-focusing on simulation
I got a check in the mail. I treated it with great suspicion. Most of the checks I get in the mail are fake. They are some kind of marketing. But this one was for $100. It said “Leung, et al. v. XPO Logistics, Inc.: Distribution of Settlement Benefit”. It sounded like Leung was taking… Read More Leung et al v. XPO Logistics
Yes, I learned how to draw text …
I didn’t think my code was running THAT slow, but it’s always nice to periodically take a break and think of performance. Now we all know that the right way to approach code optimization is to profile the code rather than rely on our intuition, but there are a lot of things we know are… Read More What’s that “new” doing in my inner loop?