RSSAmplifier

Blog

The Blog of Alex Harsányi: The Blog of Alex Harsányi

alex-hhh.github.ioRSS feed ↗59 posts

Latest posts

Elevation Correction

From having a nice and consistent elevation plot and an accurate total ascent/descent for an activity, to calculating effects of slope on performance, such as Grade Adjusted Pace for running, it is important to have accurate elevation data. Unfortunately, elevation data is one of the measures most prone to errors during an activity. On-line elevation services can be used to correct this data, but…

A Racket Array Tutorial

If you are unfamiliar with NumPy or Matlab, Racket’s arrays can look strange and unusual, and we’ll try to figure out some use cases for them in this tutorial. More…

Pumpkin Plot

Inspired by the Digital Arts with MATLAB project, I wanted to check out if the Racket 3D Plot package could be used for a similar purpose, so I decided to plot a pumpkin… More…

The Wolf, the Goat, and the Cabbage

… in which we revisit miniKanren and use it to solve a planning puzzle about ferrying some items safely across a river. More…

Timezone Lookup Revisited

… in which we look at how to really speed up the lookup of geographic locations in a large number or regions covering the entire Earth surface. This is the problem that the tzgeolookup package has to solve: given a geographic location it needs to determine which one among the 425 time zones it belongs to, and it has to do it quickly. More…

Synchronizing FIT files using a Raspberry Pi

I wrote the ActivityLog2 as an application to analyze training data on the local computer, to avoid using a cloud service, and I also wanted a convenient way to download data off my Garmin watch without having to hook up USB cables to my laptop. The result is the PiFitSync project which I had running for several years now, evolving to download data from three generations of Garmin devices.…

Heat Maps Revisited

The Heat Map visualization in ActivityLog2 has been updated to handle large amounts of data, making it possible to show all 11 years worth of GPS points that I have, and still being able to show an interactive map, where the user can zoom and move the map while data is loading. More…

Asteroids (Gameplay)

… having spent most of the first blog post on writing a small game engine to be able to handle the Asteroids game, in this post we’ll look at how to implement the actors to actually make the game playable. More…

Asteroids (Game Engine)

… in which we look how we can implement the classic Asteroids game game using only the Racket language and its graphics facilities. We’ll implement a basic game engine, a basic physics engine and the game itself, and manage to do it in about 1000 lines of code. More…

Screenshots

Can you write GUI applications in Racket ? Different versions of this question shows up periodically on various Racket forums, and, of course, Racket does have a GUI Library . However, usually the person asking the question implies a bit more, and it is not always clear what this “a bit more” is… Rather than attempting to answer the question myself, I decided to just put…

Who Owns the Fish?

… that is the question. To find the answer will use a logic programming DSL embedded in Racket, named miniKanren . By the way, if you are in a hurry: the German owns the Fish. Twice. More…

Shaded Area Plot

… in which we explore using interval renderers and color maps to create a plot where the area under the line is shaded based on data from a second data series. More…

Box and Whiskers Plot

The Box and Whiskers plot is a method for depicting groups of numerical data through their quartiles and it is a popular way to depict statistical information about data sets, yet the Racket plot package does not support such a plot type. In this blog post we’ll explore how to add this plot type to the plot package without having to modify the package itself, and we’ll look at some…

Climb Analysis Tool

As part of preparing for a bicycle race in my local city I wanted to look at the climbs of the bike route and evaluate their difficulty. Since all the (free) online tools only provided basic analysis tools, I decided to write my own. More…

Plot Animations

There is no specific animation function in the Racket plot package, but animations can be build by repeatedly plotting individual frames onto a canvas or image using plot/dc . The technique requires drawing the entire plot every frame, which will be inefficient for complex plots. In this blog post we explore how to construct plot animations using the set-overlay-renderers method of a plot snip,…

Space Invaders

… in which we attempt to recreate a classic game using the Racket graphical facilities and exploring classes and objects. More…

Rendering the World Map Using the Racket Plot Package

As part of writing the geoid package, I needed to visualize some geographic projections and I discovered that the 3D plotting facilities in the racket plot package can be easily used for this task. The geoid package and the projection it uses is somewhat complex, so, to keep things simple, this blog post covers the display of the country outlines on a globe loading the data from the GeoJSON file…

Barometric Altitude Measurement

While analyzing the data from my latest indoor trainer ride, I noticed that my FR–920 records altitude while running in “Indoor Trainer” mode. This means that I have a lot of altitude measurements at what is effectively the same elevation, so I had a look at how good altitude measurement really is. More…

Automating Tests for the Plot Package

A few weeks ago I accepted to become maintainer of the plot package and one of my first objectives was to setup an automated build and test runs using Github Actions. The plot tests were changed to verify automatically that they pass (previously they had to be visually inspected for correctness), and the technique may be useful in writing tests for other graphical packages and applications.…

Ishido

… in which we attempt to recreate a game from the nineties using the Racket graphical facilities and we manage to do it in less than 1000 lines of code. More…

Markdown View using the Racket editor%

The Racket text% editor class can be used to display multi line text with formatting, such as fonts and colors; it is however, somewhat difficult to set it up and use its formatting capabilities. This blog post shows how to build a text view which allows inserting markdown text and the result will be formatted, with headers, links and images. More…

Dependency Management in Racket Applications

.. in which we look at how to manage the versions of packages used by a Racket application, and ensure that the correct package versions are used when building the application. More…

Threshold Analysis in ActivityLog2

A dashboard for ActivityLog2 which allows determining threshold power, pace and heart rate for a running or cycling activity, and can set sport zones based on these values. To make things a bit more interesting, the dashboard also allows inspecting the activity interactively to see where the “best” segments are. More…

A Game of Tetris (user interface)

The previous blog post introduced the Tetris game mechanics and made the game playable. In this blog post we’ll look at how to build an actual GUI application around the game mechanics: we’ll keep score, increase difficulty, peek at the next block and more. As we do that, we’ll explore some more interesting things you can do with the Racket pict library, and look at some of the…

A Game of Tetris (gameplay)

.. in which we implement a Tetris game step-by-step in Racket , exploring pict graphics, contracts and unit tests. More…

Dual Axis Plots

… in which we explore how to show on the same plot two data series that have different data ranges. The Racket Plot package does not support this functionality directly, but with the help of some data transformation, we can still achieve good results. More…

Custom Rackunit Test Runner

As the number of tests for a program continues to increase, it is no longer sufficient to know that all tests passed or which test failed. Other questions start to become important: were some tests inadvertently disabled? which tests were skipped? how did the duration of a test evolve over several versions of a program? Existing build platforms, such as Azure Devops, can help with test management,…

Timezone Aware Local Time

I wanted ActivityLog2 to show that my New Zealand skiing run started at 10am, rather than showing 6am, which is the local time in Western Australia, where I live. This feature took a long time to implement, plus it required a surprising amount of effort, and this blog post describes some of the implementation details. More…

Interactive Heat Maps

A HeatMap chart allows displaying a collection of GPS activities on a map and it is a nice way to visualize GPS data. On-line tools provide this functionality, but I wanted to implement my own, displaying heat maps using data from my own computer, without having to upload it to another website. More…

Racket Binary Packages

The Racket source code is distributed under LGPL and this means that any proprietary Racket application distributed must also provide a way for the user to re-link an updated Racket runtime and produce a new executable for that application. In this blog post we’ll explore how to achieve this. More…

Interactive Maps in the DrRacket REPL

I updated the map-widget package to allow map objects to snip% ’s so it can be inserted into a pasteboard% and a side benefit of this work is that maps can now be embedded in the DrRacket REPL — while this was not why I did these modifications, it does make for a cool demo. More…

More Timezone Lookup (loading and saving data)

… in which we explore how to write internal Racket data structures to disk and read them back, and use these features to improve load times for the GeoJSON data, so the program does not have to spend 20 seconds in the initialization step. More…

Timezone Lookup (an adventure in program optimization)

… in which we use GeoJSON data for timezone boundaries to determine the time zone for a given location, and learn a few things about the performance of Racket programs. More…

Timezone Visualization

The timezone-boundary-builder project publishes GeoJSON files with timezone boundaries based on OpenStreetMap data, and I though it would be an interesting project to load this data in Racket, build some map visualizations with it and explore some of the Racket drawing facilities. More…

Build Racket Packages with Azure Pipelines

With the future of Travis uncertain, I started looking for a Continuous Integration alternative and since Microsoft advertised Azure DevOps everywhere I went on the web, I decided to give it a try. I now moved all my Racket packages to Azure Pipelines, plus have a Racket application built with it, so I decided to write up some notes about my experience. More…

Building a GUI Application for the Password Generator

In the previous blog post , we built a password generator and packaged it as a command line utility, in this blog post we’ll look at how to build a GUI application with the same functionality and look at some of the techniques of building GUI applications in Racket. More…

Writing a Simple Password Generator in Racket

There are many places in todays world where you need to provide a password and, since it is not recommended to reuse them, you will need to come up with many such passwords, all of them preferably secure. This blog post shows how to build a simple password generator. You may already use a password manager and may not have a need for a new one, still, this blog post might show you a few useful…

An Overview of Common Racket Data Structures

The Racket language provides a variety of ready-to-use data structures and containers, however each such container has advantages and disadvantages when it comes to performance. The “everything is a list” approach makes things simple when you are learning Racket, but if you start using it for more complex programs, you need to be aware that lists are not always the best data structure…

Building a Data Visualization Dashboard in Racket

When experimenting with a new data visualization or data analysis method, it is simpler to write a prototype as a separate application, to evaluate if it is worthwhile investing the effort of adding a full feature to ActivityLog2 , this post illustrates the process used to write a “training load” dashboard application in Racket. More…

An enhanced text-field% GUI control for Racket

The Racket GUI library provides a text-field% control which allows input of arbitrary text, but only basic functionality by default. However, the class is designed to be extensible and in this article we’ll look at how to extend this control to provide a more modern input control with a cue text and input data validation. More…

Chess Game Using Racket's Pasteboard (part 3)

The pasteboard% object is an editor of snip% objects and it implements some features that make sense for an editor: for example, you can select multiple snips and drag them around with the mouse, and you can move selected snips using the keyboard, you can also add any kind of snip, not just chess pieces to the pasteboard. Since none of these features are useful or desirable for a chess board game…

Chess Game Using Racket's Pasteboard (part 2)

This is a continuation of the previous blog post , where the racket pasteboard% features are explored by implementing a Chess Game Board. In this blog post we look at how to restrict piece movements to chess board squares, permit only valid moves and implement turn based game play. More…

Chess Game Using Racket's Pasteboard

The Racket GUI library provides an “editor toolkit” which can be used to implement programs that use an interactive graphical canvas where objects can be moved around with the mouse. This toolkit has good reference documentation , however this documentation can be somewhat overwhelming, and it is not always clear how to begin writing such interactive application, or how to achieve some…

Racket Data Frame Package

A Racket implementation of a data frame structure, which allows efficient manipulation of data that is organized in rows and columns. It was originally written as part of the ActivityLog2 project, than moved into its own Racket package. More…

A Racket GUI Widget to display maps based on OpenStreetMap tiles

This is a Racket GUI Widget which can display maps based on Open Street Map tiles — it allows embedding maps in Racket GUI applications. I originally wrote this code as part of the ActivityLog2 project and, since I wanted to use it in other projects, I decided to move it onto a separate package and publish it to the Racket package server. More…

Running and Cycling Workout Editor

A Garmin fitness device can use workouts during a bike or run activity: they are a collection of steps with a duration and intensity (such as heart rate, pace or power). While running or biking, the device keeps track of the duration and will sound an alarm if the intensity is too high or too low. Workouts can be created on the Garmin Connect website, but I decided to write my own application for…

Arduino 433Mhz Receiver -- Reading Keyfobs

I bought a 433Mhz receiver shield for Arduino as I wanted to experiment with wireless communication, and, as the first application, I built a receiver that can read serial numbers and button status from my garage door opener remote. More…

Interactive Overlays With the Racket Plot Package -- Update

I announced my original plot overlay implementation on the Racket Users mailing list and the Racket developers were enthusiastic about these improvements and they suggested that I contribute them to the main plot package. They also suggested a different approach for implementing this feature, which results in more flexibility for implementing overlays. More…

Arduino Inclinometer Improvements

After using the inclinometer for a while, it became apparent that the functionality was too basic. I extended it, so the unit tracks maximum pitch and roll values seen, displays the pitch and roll direction and can perform calibration on demand, so the unit does not have to acquire its orientation each time it is started up. I also built a better enclosure for it. More…

Interactive Overlays With the Racket Plot Package

The Racket plot package produces interactive snip% objects which allow zooming of the plot area. While this is a cool and sometimes useful feature, the functionality is hard coded in the plot-snip% class inside the package. I extended the package to allow the user to customize the interactive features of the plot, to display additional information when the user hovers the mouse over the plot.…