Programming Leftovers
-
Rlang ☛ Learning inferential statistics using R
Imagine you need to find the average height of 20-year olds. One way is to go around and measure each person individually. But that seems quite a bit of work, doesn’t it? Luckily, there’s a better way. Inferential statistics allows us to use samples to draw conclusions about the population. In other words, we can get a small group of people and use their characteristics to estimate the characteristics of the entire group.
-
Juha-Matti Santala ☛ Syntax Error #10: Debugging knowledge base
December also means I've been busy with Advent of Code puzzles that I solve with Python and share my solutions with explanations on my personal website. If you're not familiar with Advent of Code, let me get you in on the secret: it's a fun 25-day puzzle calendar with lovely Christmas lore and interesting puzzles to be solved. Each day, you'll get a puzzle in two parts and you need to solve it by any means necessary: usually people choose to write code.
-
Jacob Nowosad ☛ Simulating spatial patterns with the spatial kinetic Ising model
A two-dimensional Ising model is an idealized physical system that consists of a lattice of binary variables (magnetic spins) that can be in one of two states: up or down. Each spin’s state is influenced by its neighbors: the more neighbors in the same state, the more likely the spin will be in the same state. Thus, the change in the state of a spin impacts the state of its neighbors, which in turn affects the state of their neighbors, and so on. It is a simple model that can be used in physics to study, for example, phase transitions given by the temperature of the system.
-
Chris Wellons ☛ So you want custom allocator support in your C library
Users of mature C libraries conventionally get to choose how memory is allocated — that is, when it cannot be avoided entirely. The C standard never laid down a convention — perhaps for the better — so each library re-invents an allocator interface. Not all are created equal, and most repeat a few fundamental mistakes. Often the interface is merely a token effort, to check off that it’s “supported” without actual consideration to its use. This article describes the critical features of a practical allocator interface, and demonstrates why they’re important.
-
Chris ☛ Know Your Uncertainty
In estimation, it’s easy to accidentally spend a lot of time to improve the accuracy of an estimation or forecast based on data that is fundamentally very imprecise. It’s important to know how the uncertainty of the input data trickles through to the estimation and affects its accuracy. It is senseless to try to achieve greater accuracy than that, because it won’t happen even with the most heroic of efforts.
-
The Servo Blog: This year in Servo: over 1000 pull requests and beyond
Servo is well and truly back.
-
Nolan Lawson ☛ Rebuilding emoji-picker-element on a custom framework
In my last post, we went on a guided tour of building a JavaScript framework from scratch. This wasn’t just an intellectual exercise, though – I actually had a reason for wanting to build my own framework.
-
Python
-
James Bennett ☛ Don’t use class methods on Django models
The general advice for these is that when you’re writing a class, you almost always want plain instance methods, and you pretty much never want static methods (which are sort of a weird attempt to give Python an equivalent of Java’s static methods, except Java has to have them because it historically didn’t support standalone functions — everything had to be a method of a class — but Python doesn’t have that limitation). And sometimes you want class methods, but they tend to be pretty special case. Most often it’s so you can have alternate constructors. For example, suppose you’re writing a class that represents an RGB color. You might start with: [...]
-
The New Stack ☛ How to Use the Python slice() Function
When writing Python programs, you will often make use of a range of items (such as numbers, letters, etc.).
-