Programming Leftovers
-
Introducing yahoofinancer - Rsquared Academy Blog - Explore Discover Learn
We are excited to announce the yahoofinancer package. The yahoofinancer R package allows the retrieval of nearly all data visible via the Yahoo Finance front-end and aims to reduce the pre-processing steps needed in analyzing such data.
yahoofinancer is inspired by and a port of the Python package yahooquery. yahoofinancer is not affiliated, endorsed, or vetted by Yahoo, Inc. It’s an open-source tool that uses Yahoo’s publicly available APIs, and is intended for research and educational purposes.
-
Software Accessibility: Back-End Developers Play a Major Role
Front-end developers aren't the only ones responsible for building accessible apps; back-end developers can also help improve software accessibility.
-
Early speed optimizations aren’t premature
As you code, you might have a coworker, or friend, or a little voice in your head, reminding you of Knuth’s famous saying: “premature optimization is the root of all evil.” But what makes an optimization premature, anyway?
The short answer is that this aphorism is a tautology. “Premature” means “too early,” so we can rephrase the point as “doing things at the wrong time isn’t ideal.” Can’t argue with that!
The problem with this saying is that many people wrongly interpret it as “early optimization is the root of all evil.” In fact, writing fast software from the start can be hugely beneficial.
In order to reduce the scope a bit, I’m going to focus on one particular problem domain: data processing pipelines or batch jobs. This is the kind of software you often write when doing data science, or scientific computing: you load in some data, process them, spit out a result.
-
How to communicate effectively as a developer
-
Good old-fashioned code optimization never goes out of style
Sometimes, making your Python data processing software faster doesn’t require libraries like NumPy or Pandas, or specialized techniques like vectorization. In fact, if you’re doing string processing, libraries like Pandas won’t help.
Pushing calculation down to a faster implementation is just one way to speed up software. Another way to get faster results is to remove code that is redundant, repetitive, superfluous, needless, or otherwise does unnecessary work. The fastest software, after all, is software that doesn’t run at all.
In short, sometimes all you need is some good old-fashioned speed optimization.
-
The type system is a programmer's best friend
I am tired of primitive obsession and the excessive use of primitive types to model a domain.
A string value is not a great type to convey a user's email address or their country of origin. These values deserve much richer and dedicated types. I want a data type called EmailAddress which cannot be null. I want a single point of entry to create a new object of that type. It should get validated and normalised before returning a new value. I want that data type to have helpful methods such as .Domain() or .NonAliasValue() which would return gmail.com and foo@gmail.com respectively for an input of foo+bar@gmail.com. Such useful functionality should be embedded into those types. It provides safety, helps to prevent bugs and it immensely increases maintainability.
-
Performance Musings - Kai Uwe’s Blog
Sometimes while using my computer I notice random slowness when launching a certain application or some feature that just doesn’t run very well. That’s always reason enough for me to take a deeper look.
My tool of choice for analyzing performance issue is Hotspot, KDAB’s excellent perf visualizer. It comes with an easy to use GUI for browsing the results collected by it. Particularly its flame graph view lets you detect, well, hotspots during execution quickly. Just launch an application through Hotspot or attach it to an existing instance, and look at the graphs. Depending on your system configuration you might need to adjust the perf_event_paranoid kernel setting in order for it to inspect other processes.
-
Dirk Eddelbuettel: RcppEigen 0.3.3.9.3 on CRAN: Maintenance
A new release 0.3.3.9.3 of RcppEigen arrived on CRAN moments ago (and just went to Debian). Eigen is a C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms.
This update is again mostly maintenance. To accomodate one small aspect of the Fortran interface, we now require R 3.6.0 or later. Jonah Gabry spotted a really old typo and fixed it. The fastLm support code now uses the unabbreviated df.residual. We accomodated clang-15 in one signature as is common with many recent uploads, and also updated one aspect of GitHub Actions.
-
Reproducible Builds, Read-only FS and How a Persistent QML Cache then Can Ruin Your Day - cordlandwehr
Long title, but the combination is important. Recently, I had an embedded device on my desk, which drove me to claiming quite strongly that “this is not possible what is happening in front of me!!!” If you are familiar with setups of all the points above, this article might be interesting to you.
Starting from the very strange effects I had. The device itself in question has a read-only root file system, as it is common for embedded devices. On this device a QtQuick application is running and, because I have not the most efficient processor, QML cache is enabled. Instead of going the build-time cache generation route, I have a persistent writable partition on the device, on which the QML cache is generated and stored at first start of the QtQuick application after first boot. Note that the cache needs to be persistently stored since otherwise the whole performance improvement on startup is moot.
So far so good, everything works well… until we are starting to update the software or more precisely the root file system. For this example, and this will be important later, the update of the root file system just updates my QtQuick application and its QML file but not the Qt version. What I then see after the update and the following boot is a system where the QML application still looks like before the update. Looking deeper at the file system, everything seems fine, files are updated, even QML files are updated, but the application just ignores them. But even worse, the application now randomly crashes because the executable and the shared libraries apparently do not match to the QML code being executed. — I will shorten this up, because with the intro the problem is quite obvious: the QML cache is not being invalidated even if it should and old versions of the QML files are used to run the applications. But how can this be?!
-
Not Quite Emoji Domain Names
That's "Unicode Power Symbol Dot Gabon". Because why not.
Regular readers will know that I helped get ⏻ and several power symbols into Unicode. When I do talks about this, I usually refer to them as Emoji because, to most people, Emoji are simply little pictures in text. But that is a gross oversimplification. You know the meme that real Champagne must be from the Champagne region of France - otherwise it is merely sparkling wine? Well, Emoji must come from the Supplementary Multilingual Plane of Unicode otherwise they're just ✨sparkling✨ characters.
Except... That's not quite true. There are a bunch of symbols stuffed in the Miscellaneous block of the Basic Multilingual Plane which are also Emoji.
The Power Symbol appears in the block Miscellaneous Technical. The symbol itself is not an Emoji, but it is in a block which has 18 Emoji. Confused? Good1!