Programming Leftovers
-
Fossil Files: My .Emacs
Last week, I wrote about cargo culting in a much more general context, so this week I’m going to come clean. The file that had me thinking about the topic was the worst case you’ve probably ever seen: I have a .emacs file kicking around that I haven’t really understood since I copied it from someone else – probably Ben Scarlet whose name is enshrined therein – in the computer lab in 1994! Yes, my .emacs file is nearly 30, and I still don’t really understand it, not exactly.
-
Flipper Zero Hacker Tool Gets UI Editor For Custom Apps
[Mikhail] released a handy GUI editor/generator tool for the Flipper Zero multipurpose hacker tool, making layouts and UI elements much easier and more intuitive to craft up.
-
Code coverage for your AWK programs
I also thought that it would be cool to be able to say that GoAWK is the only AWK implementation we know with code coverage support.
Thanks to Volodymyr’s efforts, GoAWK version 1.21.0 includes the code coverage feature. There was some refactoring that needed to happen before the main code change – thanks again, Volodymyr, for having the patience to see this through.
-
[Old] A Brief Introduction to Icon
Icon is a very high-level imperative language with a rich repertoire of string and structure processing facilities. It is available on a wide range of computers and is in wide use.
In Icon, values, not variables, are typed. Built-in data types include numerics, character sets, strings, sets, lists, associative tables, records, and procedures. The aggregate types - sets, lists, tables, and records - can hold values of any type. Tables can be indexed by values of any type. Numerics, character sets, and strings are atomic values; operations on them produce new values. Aggregates use pointer semantics; operations on them can change existing values as well as produce new ones. Strings and aggregates can be of arbitrary size, and their sizes can change during execution. Memory management is automatic.
Icon has an expression-oriented syntax; even control structures are expressions. Procedures consist of zero or more expressions separated by newlines or semicolons. Icon programs consist of one or more procedure definitions, and execution begins by calling the procedure named main.
-
Day 8 (Advent of Code 2022)
This is a 5x5 grid, and every number denotes the height of a tree. For part 1, we must find out how many trees are visible from the outside of the grid.
-
What’s the Term for a Filename Without Its Extension?
Today someone asked in OCaml’s Discord “How do you call a variable that refers to a filename without its extension?”. I always thought there was no specific term for this and I always named such variables filename-sans-extension (or similar), but it turns out I was wrong. It’s never too late to learning something new! But first a bit of (subjective) terminology: [...]
-
Keep test code and application code separate
Sometimes you’ll be tempted to add things to your application code that don’t affect the functionality of your application but do make testing a little easier.
The drawback to doing this is that causes your application code to lose cohesion. Instead of doing just one job—making your application work—your code is now doing two jobs: 1) making your application work and 2) helping to test the application. This mixture of jobs is one straw on the camel’s back that makes the application code just that much harder to understand.
-
Spam Filtering AI Content
As generative AI becomes more advanced, it's likely that we will see an increase in spam that is difficult to distinguish from human-generated content. Some ways that we can combat the next wave of AI-generated content.
-
Some comments on delimiter-first code
That doesn't look half bad, I thought. It could make for smaller diffs in some cases. For instance, I have this: [...]
-
[Old] Advent of Code 2022: Twelve Days of Chapel
To kick off the Chapel blog and gain some experience with the site during this month’s “soft launch”, we plan to spend the next few weeks writing daily articles about participating in Advent of Code 2022 (AoC 2022) using Chapel.
-
How to use Axios interceptors, a step-by-step guide with example
Axios is one of the most popular JavaScript libraries to perform HTTP requests. Axios interceptors are powerful mechanisms built into Axios for making changes to requests and responses in a non-intrusive way. In this guide, you will walk through the basics of Axios interceptors and step through a useful example of how they can be used. By the end, you should have a good understanding of how to use Axios interceptors in your own applications.
-
A Programmer-Friendly I/O Abstraction Over io_uring and kqueue | TigerBeetle
Consider this tale of I/O and performance. We’ll start with blocking I/O, explore io_uring and kqueue, and take home an event loop very similar to some software you may find familiar.
[...]
When you want to read from a file you might open() and then call read() as many times as necessary to fill a buffer of bytes from the file. And in the opposite direction, you call write() as many times as needed until everything is written. It’s similar for a TCP client with sockets, but instead of open() you first call socket() and then connect() to your server. Fun stuff.
In the real world though you can’t always read everything you want immediately from a file descriptor. Nor can you always write everything you want immediately to a file descriptor.
You can switch a file descriptor into non-blocking mode so the call won’t block while data you requested is not available. But system calls are still expensive, incurring context switches and cache misses. In fact, networks and disks have become so fast that these costs can start to approach the cost of doing the I/O itself. For the duration of time a file descriptor is unable to read or write, you don’t want to waste time continuously retrying read or write system calls.
-
Lisp Runs This Microcontroller Pendant
As a programming language, Lisp has been around longer than any other active language except for Fortran. To anyone who regularly uses it, it’s easy to see why: the language allows for new syntax and macros to be created fluidly, which makes it easy to adapt it to new situations, like running it on a modern Atmel microcontroller to control the LEDs on this star pendant.
-
Google's Dart language soon won't take null for an answer • The Register
When the third major release of the Dart programming language debuts in mid-2023, null values will no longer be allowed where they're not expected.
Null in this context is an assignment value indicating the absence of a value or referenced object. Null references date back to around 1964 when British computer scientist Tony Hoare introduced the concept in the ALGOL family of languages. He considered them his "billion dollar mistake" for the amount of time and money they've cost in error repairs – an issue to this day.
Dart, an object-oriented, garbage-collected C-like language that once aspired to replace JavaScript, supported sound null safety – a way to prevent errors from accessing variables set to null – as of version 2.12. But it maintained modes for running code without null safety or with partial null safety.
Dart 3 will no longer entertain those suboptimal possibilities.
-
How to Calculate Ratios in R - Data Science Tutorials
How to Calculate Ratios in R? The following two techniques can be used in R to determine the ratio of values in two columns.
The following data frame, which displays the total number of shots taken and attempted by different basketball players, is used to demonstrate how each strategy should be used in practice.
-
Spreading a Passion for R with the Münster Community in Germany - R Consortium
Dr. Shirin Elsinghorst recently shared her great experience with the R language, motivating her to start the Münster R useR Germany. Shirin shared how R has become a very important part of her life, from her first contact with the language while receiving her Bachelor’s degree, in the workplace, and even as part of her spare time activities. She also emphasizes how significant is the presence of women in the IT world, describing herself as a staunch supporter of the R-Ladies.
-
30 Day Map Challenge 2022 | Nicola Rennie
The #30DayMapChallenge is a month-long mapping, cartography, and data visualization challenge aimed at the spatial community. Here are the things I've learnt from participating in the challenge for a second time.
-
Autocorrelation and Partial Autocorrelation in Time Series
The correlation between two values in a time series is known as autocorrelation. In other words, the name comes from the fact that the time series data are self-correlative.
We use the term “lags” to describe these connections. By measuring a feature at regular intervals, such as daily, monthly, or yearly, analysts collect time-series data.
The lag is the total number of time gaps between the two observations. For instance, there is a one-observation lag between the current and previous observations.
The lag increases by one if you go back one more interval, and so on.
The observations at yt and yt-k are mathematically separated by k time units.
-
Lighting: A Low-code and Admin Dashboard for Django
Lighting is a fairly new project that adds a low-code flavor into your Django project in a matter of minutes. It allows you to generate a comprehensive admin panel for your data models, with minimal configuration.
It uses Django, React and Ant Design frameworks to create a smooth user experience. However,
Lighting requires Python 3.6, and Django 2.2.x. However, Django 3.x is not yet supported, but it may be in the near future.
-
Python version upgrades and deprecations
Recently I read Itamar Turner-Trauring's It’s time to stop using Python 3.7 (via). On the one hand, this is pragmatic advice, because as the article mentions Python 3.7 is reaching its end of life as of June 2023. On the other hand it gives me feelings, and one of the feelings is that the Python developers are not making upgrades any easier by slowly deprecating various standard library modules. Some of these modules are basically obsolete now, but some are not and have no straightforward replacement, such as the cgi module.