Generating plots with pgfplots

Plotting results is often needed in Computer Science.
Say, you have a program that generates data which you want to plot.

A normal approach to this would be:

  1. Write your results to a csv-file
  2. Importing that file into a spreadsheet application like Excel
  3. Clicking around to generate a plot
  4. Saving the plot as an image
  5. Putting the image into a LaTeX report

In case you change something in your program, this entire process would have to be repeated in order to get your fresh results plotted and into your report.

How cumbersome. This is a stupid problem we can solve with programming.
If our program already generates data and writes it to disk in text format, we can just add functions that write that data as LaTeX!
Continue reading “Generating plots with pgfplots”

A (not so comprehensive) guide to git

To learn git, you need to commit. (git it?)

This is meant as a quick start guide to git, not as a tutorial on git. For a tutorial i would look here or here.

Following along with this post, you will hopefully learn how to start using git, including:

  • Creating git repositories
  • Commiting changes
  • Setting up a remote repository (with github)
  • Pushing your changes to github
  • Pulling changes from github

The post will not cover merging.
Continue reading “A (not so comprehensive) guide to git”

Why do your assignments when you can make python do them for you?

I have gotten into writing my own tools, whenever I realize it’s an option.

I will try to document my process of doing this, starting with one of my favourite projects. It’s not pretty, but it did the job for me.

Anyone who has taken a good course on linear algebra knows row operations. They’re fun, they’re easy to program and you can solve systems of equations with them. It’s all great, up until the point where you have to write them.

If you’re an unlucky fellow, you will do this by hand, and no amount of petting the wildebeest will help you. If you’re a, until now, little less unlucky fellow, you will do this with \LaTeX. It’s cumbersome and boring and I grew tired of it within 10 minutes. I guess it’s time for a tool, huh?
Continue reading “Why do your assignments when you can make python do them for you?”

Shun the IDE, OpenGL with Make for me!

For long I’ve been wanting to get into OpenGL, hopefully this time being able to understand what is going on. I last looked into Java and LWJGL back when minecraft was peaking. It seems millennia has passed since then.

So, my current situation, techwise:

I’m running OS X (well, macOS, but the unnecessary new name can go to Redmond), and as an avid user of BASH and Emacs, IDEs give me the creeps. I prefer languages where a “test program” can be written in one, maximum two files. I want to be able to compile my program by hand, especially if it’s only one or two files. By hand I of course mean through my shell, using make.
Surely the cascading hellscapes of modern IDEs, with all their fancy buttons, web news feeds, package managers and Microsofty ways to fuck up git integration is unnecessary. At least if I’m only trying to do something simple and stupid, say, like using my graphics card for drawing a triangle. Right? Riiight?
Continue reading “Shun the IDE, OpenGL with Make for me!”