Programming Leftovers
-
An Intro-To-Rust Course
Lars Wirzenius generously offered to teach Rust basics in a few free trainings for programmers who already contribute to free and open source projects via code. I got a lot out of an intro-to-Python workshop many years ago (curriculum), and I've been meaning to get going learning Rust, so I decided to sign up, and I participated in one today. Lars asked that participants "tell others what you thought of the course" even if it was highly critical, so here's my report.
-
Floating point NaNs as map keys in Go give you weird results
The last time around I learned that Go 1.21 may have a clear builtin partly because you can't delete map entries that have a floating point NaN as their key. Of course this isn't the only weird thing about NaNs as keys in maps, although you can pretty much predict all of them from the fact that NaNs never compare equal to each other.
-
An SVG path data library for Chicken Scheme
This library can turn SVG path data to tagged sexp format (compatible with SXML). You can switch between absolute and relative coordinates, and turn it into a minified string.
The procedures work on both this library’s own tagged format and on path data strings.
-
Go 1.21 may have a clear(x) builtin and there's an interesting reason why
Recently I noticed an interesting Go change in the development version, which adds type checking of a 'clear' builtin function. This was the first I'd heard of such a thing, but the CL had a helpful link to the Go issue, proposal: spec: add clear(x) builtin, to clear map, zero content of slice, ptr-to-array #56351. The title basically says what it's about, but it turns out that there's a surprising and interesting reason why Go sort of needs this.
On the surface you might think that this wasn't an important change, because you can always do this by hand even for maps.
-
Add Significance Level and Stars to Plot in R
Add Significance Level and Stars to Plot in R, In this article, I’ll show you how to use the R programming language’s ggsignif package to annotate a ggplot2 plot with significance levels.
-
Saturn Elephant - The missing lazy numbers: implementation
In Haskell, for any type T (for example Double), there is a corresponding type Maybe T. An object of this type either has form Just x, where x is of type T, or is Nothing. Thus one can use the Maybe T type to extend the type T to a type allowing missing values. One can test whether a Maybe T object y is not “missing” with isJust y, and, if so, one can extract its T value with fromJust y, which returns the object x of type T such that y equals Just x. There is also the function isNothing, whose name is explicit.
There is something similar in C++, available since C++ 17: the type std::optional
. I used it with Rcpp to allow missing values in vectors of lazy numbers. -
Marketing Mix Modelling using data from Windsor.ai - Data and Marketing Attribution Modelling | Windsor.ai
In this guide you will learn how to fetch your marketing data and apply a Marketing Mix Model to elucidate which source presents the best marketing performance. Marketing Mix Modelling is a statistical analyses such as multivariate regressions on sales and marketing time series data to estimate the impact of various marketing tactics on a given variable related to reward (e.g., number of clicks).
Our aim will be to elucidate which marketing platform presents the highest number of clicks per spend for the last year. More concretely, we will consider Facebook and Google Ads data.
-
optimal leap year
A riddle about leap years: a solar year consists of approximately 365.24217 mean solar days, which is why there is a leap year approximately every four years. Approximately because the Gregorian calendar plans 97 and not 100 leap years over 400 years. Is this the optimal solution? No, since the Gregorian difference is 3.3 10⁻⁴ day per year, or 0.132 day per 400 years, while using 85 leap years over every 351 years leads to a difference of 4.76 10⁻⁶ day per year, or 0.002 day per 400 years… (With a further gain by a factor 4 with 116 leap years every 479 years.)
-
Data Types in R
-
Rounding modes: std::from_chars versus strtod/strtof - Daniel Lemire’s blog
A recent C++ standard (C++17) introduced new functions to parse floating-point numbers std::from_chars, from strings (e.g., ASCII text) to binary numbers. How should such a function parse values that cannot be represented exactly? The specification states that the resulting value rounded to nearest. This means that 1.0000000000000000001 and 0.999999999999999999 become exactly 1.0.
The C language has its own functions (strtod/strtof). I could not find a reference in the standard as to how it should round, but the source code suggests that the functions round according to the current floating-point rounding mode, as determined by the fegetround() function. One can round toward zero, up, down or to nearest. I wrote a small command-line utility to test it out.
-
arp-scan 1.9.8 compiled in OE
It was a long time ago that I added a recipe to build arp-scan in OpenEmbedded.
[...]
Have changed the package-list in woofQ so now will build with the arp-scan from OE.
-
What is a Research Summer School?
If I say "summer school" to you then you'll probably think of extra sessions in summer holidays for children; depending on where you grew up, you might expect such sessions to be either exciting non-academic activities or catch-up lessons. What about summer schools for research students (what I'll call "research summer schools" for the rest of this post, though in research circles they're unambiguously referred to as just "summer schools")?
I've co-organised four in-person research summer schools, most recently as part of the Programming Language Implementation Summer School (PLISS) series, and spoken at two others, and one thing that I've realised is that many people don't really know what they involve. Indeed, I didn't fully realise what they are, or could be, even after I'd been involved in several! This post is my brief attempt to pass on some of what I've learnt about research summer schools.
-
Recent Projects I Didn't Finish — Andrew Healey
I played around with 0x, a command-line tool for producing an interactive flamegraph from a Node process. I wanted to write about how to profile code and look for bottlenecks but I wanted to show a real-life example by finding an optimization in an open source library.
I profiled the svelte compiler and found a potential micro-optimization. Specifically the clone utility adapted from lukeed/klona. In my tests it was slower than both JSON stringifying and parsing, and structuredClone. But making the code change isn't straight forward as the clone utility "[skips] function values in objects when cloning, so we don't break tests". I also didn't want to waste a maintainer's time by opening a PR without confidence it was actually a good idea.
-
Learn Git: 3 commands to level up your skill
When I talk to people about Git, almost everyone has a strong reaction to the git rebase command. This command has caused many people to change directory, remove the repository, and just re-clone to start over. I think this comes from misconceptions about how branching actually works, a pretty terrible default interface, and some merge conflicts mucking things up.
-
7 Git tips for technical writers
As a technical writer working for ATIX, my tasks include creating and maintaining documentation for Foreman at github.com/theforeman/foreman-documentation. Git helps me track versions of content, and to collaborate with the open source community. It's an integral part of storing the results of my work, sharing it, and discussing improvements. My main tools include my browser, OpenSSH to connect to Foreman instances, Vim to edit source files, and Git to version content.
This article focuses on recurring challenges when taking the first steps with Git and contributing to Foreman documentation. This is meant for intermediate Git users.
-
How to install Tailwind CSS and Flowbite inside a Django Project – NextGenTips
Tailwind CSS is an open-source CSS framework. The difference between Bootstrap is that Tailwind does not provide predefined classes for elements such as tables or buttons. It makes it easier to write and maintain the code of your application. You don’t have to switch back and forth between CSS and your main HTML template.
Flowbite enables us to build websites faster with components on top of Tailwind CSS. It’s open-source and it’s built with utility classes from Tailwind CSS that can be used as a starting point when creating user interfaces.
In this tutorial, I will show you how you can create a beautiful Django UI using Tailwind CSS and Flowbite.
-
How to perform CRUD functionalities on Rails – NextGenTips
Rails CRUD processes is very easy to create, this makes it easy to work on something else. Compare to Django CRUD operation, I can say for Django you need to have sort of a hacking mentality to go through it, but for Rails its just one command and everything is created on a fly.
-
Linear Classifier in Tensorflow
In this article, we will be using tf.estimator.LinearClassifier to build a model and train it on the famous titanic dataset. All of this will be done by using the TensorFlow API.