My personal webspace

A webspace for innovation, free thinking, and procrastination

Blogs

Rust and Pico -- getting started

I was gifted a Raspberry Pi Pico a few days ago; this is a very small embedded chip, with no OS. It is very different than anything I’ve worked with before, which has mostly been Linux-based (with the occosional Arduino). This seemed like an awesome place to use Rust, so I decided to make a small ‘simon says’ type blinking game. To program this chip, you hold a physical button and plug it into your PC.

Google App Engine Made Easy

Google App Engine made easy Turns out, GAE can run a Docker container, which makes life super easy. Some basic rules: EXPOSE 8080 # GAE will only talk to port TCP/8080 to serve web traffic All build files (i.e., everything in the folder app.yaml is in) gets uploaded and built So its very limited in what it can do, but basically with the structure . ├── app.yaml └── Dockerfile You can easily make an app.

Paxos Algorithm, in English

The Paxos Algorithm The Paxos algorithm is used to handle decision making in a decentralized way, which is tolerant of faults and other such problems. It is usually applied to network programming and distributed systems. (For background, see the Background section at the end of this post.) High-level The thing that tripped me up most was understanding how to apply this algorithm to an actual problem. Part of the difficulty is that it is usually thought about as a single ‘round’ in a larger machination; that is, when people describe the Paxos algorithm, they describe the algorithm that is used to accept a single value.

Chef Client on Ubuntu ARM (arm64)

We use some arm boxes at work for testing, and do our provisioning with Chef. Chef bootstrap doesn’t work because ARM is not an official supported platform for Chef. To work around this, I installed a few packages: apt install ruby apt build-dep ruby-yajl Then Installed Chef as a Gem: sudo gem install chef With this done, I could use knife boostrap as normal :).

Rust crate for OpenSSL on Arch Linux

Attempting to build a Rust package on Arch, I ran into a problem that the version of the openssl crate depended on by one of the dependencies didn’t correctly detect the latest OpenSSL, 1.1.1. To solve this, I ensure a previous version (OpenSSL 1.0) was installed, and setup my environment with: #!/bin/bash # Only needed on Arch to use an older openssl version export PKG_CONFIG_PATH=/usr/lib/openssl-1.0/pkgconfig/ export OPENSSL_LIB_DIR=/usr/lib/openssl-1.0 export OPENSSL_INCLUDE_DIR=/usr/include/openssl-1.0 And then things built :).

FindYOTTADB.cmake Example

To use libraries with CMake, its much easier if there is a package for it. Below is a script which can be used to locate YottaDB using CMake, and make it much easier to build with. In your CMakeLists.txt, add: SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/") find_package(YOTTADB REQUIRED) In cmake/FindYOTTADB.cmake: # This is free and unencumbered software released into the public domain. # # Anyone is free to copy, modify, publish, use, compile, sell, or # distribute this software, either in source code form or as a compiled # binary, for any purpose, commercial or non-commercial, and by any # means.

Using Eclipse with CMake Projects

For a long time, I was using the cmake CDT generator to make cmake projects. I started getting very strange errors in the most recent version of Eclipse, and stumbled upon this thread which explained the CDT generator was super old. To do this with a modern Eclipse version, you basically want to: File -> New -> New C/C++ Project Select “Empty or Existing CMake Project” Uncheck “Use default location”, and navigate to your project Then things should magically work.

Performance Testing: Threads vs. Processes

Recently, I spotted a line in Distributed Systems: Principles and Paradigms that caught my interest because it ran counter to my understanding of thread performance on a Linux system. Instead of using processes, an application can also be constructed such that different parts are executed by separate threads. Communication between those parts is entirely dealt with by using shared data. Thread switching can sometimes be done entirely in user space, although in other implementations, the kernel is aware of threads and schedules them.

Doing Elixir Development in Windows using Docker

This guide documents the steps I took to setup my Elixir/Phoenix/Docker environment on my Windows 10 machine. It might be worth nothing that I’m running Windows 10 Educational, which includes the Hyper-V supervisor; this is required for Docker. Install Docker Rather than repeat stuff here: go search Google, and follow the official guide. This will probably require a restart. Setup a Dockerfile and docker-compose file To get started, we need a Dockerfile to build the web host.

dex auto start search list

This doesn’t seem to be documented anywhere, but just a quick tadbit; the dex autostart program (https://github.com/jceb/dex) looks in: $XDG_CONFIG_HOME/autostart or $HOME/.config/autostart for dir in $XDG_CONFIG_DIRS; $dir/autostart or /etc/xdg/autostart/ For things to run. You can look for yourself at github link

Getting Started with GT.M

GT.M is a high performance, NoSQL database coupled with a MUMPS runtime. In this guide, we will install it on a fresh Ubuntu system, verify that it works, and build a sample database. Installing GT.M through the package manager The easiest way to install GT.M is using the Ubuntu package manager; apt. chathaway@blaze:~$ sudo apt install fis-gtm Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: fis-gtm-6.

arXiv, Arch Linux, biblatex, biber

For the first time in years, an update was published to the biblatex package. This is quite exciting, but presents a problem for those of us who use “bleeding edge” software, like Arch Linux, and need to submit our papers to sites like arXiv, which use more stable packages. This is a quick work around. The Problem At the time of writing, there is a new version of biber and a new version of biblatex on my Arch system, which produces a .

When Visiting India

Do NOT plug an American power strip into the wall using an adapter; they power strip is made for 120 VAC, the wall outputs 240VAC, and cheap adapters just change the shape of the plug. It will go PZZT and the magic smoke will escape. DO bring toiler paper DO expect spicy food; it’s delicious, but not what we eat in the US Dress well; button down shirts and blue jeans.

Compiler Development 101

Many sites offer tutorials on how to use things like flex, bison, and LLVM. However, these sites give code examples, with no links to the source documentation. Below I explain what each of these tools does, and explain how to access the documentation (which, with the exception of LLVM, is fairly well written). flex Documentation can be accessed via “info flex” on a system with the flex-doc package installed. On ubuntu, run:

Using Git to files outside the repo

I decided that I wanted to keep a few files in my home directory in version control (.vimrc, .bashrc, .config/awesome), but don’t like making that directory a git repo because then the shell prompts always say I’m in a branch. To fix this, I init’d a repo in my normal place then ran: git config --local --add core.worktree $HOME And now I can add things like “git add ~/.

Forcing Diablo II to be "big" when running in window mode on KDE

As we all know, you can get Diablo II to run in Windows mode by passing it the “-w” option, for example: charles@Bender:~/Games/Diablo II$ wine Diablo\ II.exe -w On windows, you can then get it to go “big” by maximizing you. It’s not possible to do this in Linux, since it’s told that it doesn’t support this feature. You can override this in KDE by: Right clicking on the window bar, More Options > Special Window Settings Checkmark “Size”, Force, and enter a resolution that’s an aspect ratio on 4:3 Obey Geometric restrictions, Force, No Click “Appearance and Fixes” Block Compositing, Force, Yes And tada!

A quick note about Phoenix Framework Channels

Just a quick note which frustrated me quite a bit on Thursday; intercepting messages (which should call handle_out) in Phoenix Framework’s channels does not cause the handler to get called if you are using “send” instead of broadcast. I suppose this actually makes sense, since you wouldn’t want to stuck in an infinite loop (filtering a send, which sends something), but it wasn’t obvious why Phoenix was ignoring my handle_out function.

Research progress, week of 2017-05-03

This past week: Grading. Final exam grading Monday-Wednesday morning Setup server to store list of projects to be indexed Continued work on code; considering investigating Luigi Next week: If internet is setup, provide link to list of projects Continue working on fetching data (long overdue) Other: Last Friday was “first” day at FIS; starting this Friday, my schedule is: M, W, F = FIS, T, Th = RPI Internet troubles; I can’t host things until they get resolved Working on migrating from RPI email to personal email (not sure how long I will continue to have RPI email)

Research progress, week of 2017-04-26

This past week: Continued working on code; encountered issues getting project versions (API didn’t respond how I expected, internet suggests pulling all issues (which we need anyway) and scanning them for unique tags) Worked on making the list of projects easy to access Still need to put it somewhere public with all current projects Tried to talk with Barb on Slack; some response, then nothing Next week:

Docker Compose Hint

If you are having trouble installing the correct version of docker-compose on Ubuntu, here’s my hint: do not run “apt install docker-compose”. Instead, follow the directions on their site (https://docs.docker.com/compose/install/). Yes, I know it’s super lame and stops you from getting automatic updates. But I mean, at least it works.

Research progress, week of 2017-04-19

This past week: Paperwork Worked on pulling data from Jira APIs; hit issue with rate limits Next week: Revamp code to be more robust Start manually identifying Maven projects

What does it mean to make something?

At what point can I say “Yeah, I made that thing” and claim ownership over something I did? It seems like a simple problem, but I keep getting caught in a (metaphorical) recursion loop whenever I try to answer it; if I take a video from youtube and play it fast, did I make it? What if I take a hundred videos, and play them faster then stickem together? What if I take the source material (3d models, Flash files, etc), and re-render them?

Research progress, week of 2017-04-12

This past week: Looked at Maven repos to find a way of extracting bug tracking information; no luck Continued work on scripts to pull in and analyze Maven repositories for interactive complexity; progress, but work is unfinished due to grading Next week: Finish scripts to analyze Maven repos Test scripts Last attempt at finding pattern to Maven repos; if that fails, search by hand Other: Conversation with James and Ryan about making the CSDT development community more friendly Work with Bill on getting static pages Grading.

Circling an Object in Blender

Create a curve with your object at the center; scale it to size Create an empty at the center of the curve (in object mode) select camera, shift-select curve, ctrl+p, and “Follow curve” Of course, the camera will just kinda stare in some direction. You need to add a “Track-to” modifier, which behaves weirdly. Select the camera Constraints -> Add Object Constraint -> Track To Select the target Adjust “To” to be -Y, and Up to by Y Tada!

The Secret Santa App

This is a fun one; my stepmother walks in and says “I have a great idea! Why don’t you make a little app that randomly assigns people for secret santa!” I think she was just trying to be nice; include my hobby in the a family tradition. She thought it sounded easy enough, and it shouldn’t take me more than 5 minutes. But let’s take a minute, and explore another case of “That should be easy, right?

The RTS Struggle

During all my free time, which as a graduate student, which I totally have a ton of (no, sarcasm, of course), I’ve been searching for a good RTS game to play. If you know if one, please leave it in the comments! This blog post documents my attempts at playing various games; I will record what impressions of the game were, how it compared to the “gold standard”, and whether or not I returned the game before Steam’s grace period was up.

Anonymous Fibonacci in Haskell

We all know how to write the Fibonacci function; but can we do it using only anonymous functions? It’s easy enough in something like Javascript; we make the Fibonacci function take in the function as an argument, then our normal variables. i.e. (function (x, n) { return x(x, 1, 0, n) }) (function(m, a, b, n) {if (n == 0) { return a } else { return m(m, a+b, a, n-1) }}, 5) Or, if you want to use ES6:

Some Unwritten Django Rules

These are just patterns which I’ve observed while working on various Django projects; they are not all-inclusive, and not actually rules, but all the same. Regarding Templates Your base template should define a ‘content’ block; this is where most of the page content goes. It should also have ‘breadcrumbs’, ’title’, ’extrajs’, and ’extrastyle’ blocks. The last of those goes in the section of the page, and is where apps can put references to stylesheets.

Good Games need LAN

I’ve been known to dabble in video games every now and then; I play all types of games, from turn-based strategy games (like Chess) to first-person shooters (like Paintball), role-playing games and turret defense games. One of the most important part of gaming, to me, is the social element. Playing these games with my friends, have a good game that makes everyone shout in rage when someone wins by hitting an air transport with a tactical missile (for those of you who play Forged Alliance, you know that that is nigh impossible).

A Brief Discourse on Software Complexity Metrics

Software Complexity is the measure of how difficult software is to conceptualize, comprehend, and through extension, create and maintain. Despite having the word “complexity” in the title, this domain of computer science has nothing to do with time or space complexity that people often think of (Big-O notation, omega time, etc.). More interestingly, there doesn’t seem to be any connection between high time complexity and higher software complexity. From the time of the first computer programs, written in assembly language or hard-coded into the machine, measuring the size of these programs has been a subject of debate.

On The Topic of Multiplication Tables

During a routine evening visit with my Mom last week, the topic of multiplications tables was broached. She expressed some fear that upcoming generations, now surrounded by these devices that took on the simple mathematics operations that used to by done by hand or in the heads of children, will not learn mathematics the same way she had. Whether this is true or false is not something I am qualified to answer; it has been years since I was in grade school.

How-to Git

This article gives a pretty simple workflow for Git that allows you to take advantage of the distributed nature, ease of branching, and awesomesauce that is Git; for now, I assume you use Github. This can easily be adapted to other Git-systems, such as Atlassian Stash or Gerrit. This article is a little bit… sarcastic. It’s intended for people who are good with the command line (or willing to learn); although pretty, the Github UI is somewhat limited.

Installing VICE in Ubuntu

Although this should be as easy as an apt-get command, there is a trick to installing VICE for use as a Commodore64 emulator in Ubuntu. It took me a while to figure it out, and I kept getting the error: ?DEVICE NOT PRESENT ERROR when attempting to autoload a rom. Step 1: Install VICE through the package manager sudo apt-get install vice Step 2: Download the VICE source package You can search around for this if you can’t find it handy; VICE is open source, so it should be easy to find.

Gerrit Configuration Issues

Hi all! So I just spent a few minutes getting frustrated at Gerrit, but finally figured out what was going on. Since Google was of no help with this issue, I figured I would document it here The Symptoms A Git repo in Gerrit shows no branches in the Gerrit Web UI The Git repo has branches when inspected manually Cloning the repository gives an error about HEAD not being found The Solution You need to verify that the user (you, in this case) has read permission to refs/*; in my case, this permission was defined in a group that I didn’t think applied, so I didn’t inherit from it, only to find that problem hours later.

Adding fortune to email signatures

This is a very quick post! I decided today to start putting a signature in my emails, which are sent by Thunderbird, and wanted to include a fortune (output from the fortune program, http://en.wikipedia.org/wiki/Fortune_%28Unix%29) into the footer of my signature. Turns out that Thunderbird only allows you to add a static message, attach a file, or a v-card (not THAT v-card, silly you). So there’s no easy way to attach the output from a script.

Compiling opentracker on OpenBSD

My goal is simply; compile and run the opentracker software on an empty OpenBSD box. I ran into one particularly cryptic problem, and came up with a short-term fix (short term because it wouldn’t be accepted into their source tree, but it’s simple and gets the job done. If you see the error message… .... <span>opentracker.o(.text+0xeae): In function `main': : warning: srandom() seed choices are invariably poor trackerlogic.o(.text+0x123): In function `trackerlogic_init': : warning: random() isn't random; consider using arc4random() trackerlogic.

Process for creating 3d Adrinka stamps

This article will guide you through creating 3d stamps (using a 3d printer) from Adrinka patterns generated using the Adrinka tool on community.csdt.rpi.edu (https://community.csdt.rpi.edu/applications/17). This assumes the following: You have a 3d printer configured and working that can handle STL files You are familiar with the 3d printer software you are using You have created a stamp in the Adrinka software and are ready to print it There are 3 primary steps; converting the image to grayscale, inverting the colors, and converting grayscale image to .

Fixtures in Play 2.2.x

I decided to use the Play Framework (version 2.2.x) for a school project, just to see how well it worked. I ran into an issue not long after starting; I wanted to test some of my models, and needed to have data in the database for this purpose. The solution to this problem is usually fixtures (see https://docs.djangoproject.com/en/dev/howto/initial-data/ and http://guides.rubyonrails.org/testing.html#the-low-down-on-fixtures), but I couldn’t find any up-to-date documentation on Play for this feature (there were plenty of documents for older versions, but that was useless to me).

Grub2, fakeraid, and Arch Linux

This one took me the better part of a day. The challenge; get Grub 2 working on my desktop, which has two 1TB drives in RAID 1 via fakeraid (and the Windows virus!). It’s really not as hard as it sounds, if you know all of the steps. Step 1: Install Grub2 Simply run… sudo pacman -S grub-bios If you have grub-common (the legacy one), you will need to replace it.

Accessing a SQL Server (MSSQL) database from Django

MS SQL does not play well with others, and getting to work well with Django is difficult. This article will document the steps needed to setup FreeTDS and ODBC, and then get Django (version 1.4!) to play well with these programs. Everything will be done a fresh install (LiveCD actually) of Ubuntu 12.04. It shouldn’t be too much trouble to replicate these steps on others operating systems Installing FreeTDS and ODBC We will need FreeTDS, ODBC, and some basic development tools (yea, we’re going to have to compile something).


Content © 2022 Charles Hathaway