Using Goatcounter on NearlyFreeSpeech.net

Here's some quick and dirty notes on setting up GoatCounter on Nearly Free Speech dot net. There are some rather opaque hoops you need to jump through in order to setup the service. I make no claim that this tutorial is perfect, but hopefully it helps someone else who is …

more ...

Hunting for a Link

There you are, browsing the web, maybe using a popular search engine. You enter your query and scan the results for a title that answers your question. There it is! You see it, the third result. You move your mouse to click.

And what's that? what's happening? You've clicked on …

more ...

Python string concatenation

I spent a little bit of time looking into Python string concatenation times. I learned that newer versions of Python implement an optimzation for the plus equals operator. In the future I'd like to know what this optimization is. It seemed simple enough to escape by introducing an intermediate variable …

more ...

Real World Awk: Fastlaning localizations

What is Awk?

Awk is a weird mix of command-line tool and programming language. It's a language specifically designed for text processing. By default it has a notion of rows and separators. Think CSV but without support for quoted separators.

Problem

Fastlane is a tool for automating iOS app development …

more ...

Map a function or predicate in Mercury lang

Mapping a function in Mercury lang is pretty simple. First you need a function:

:- func myfunc(string) = string.

myfunc(In) = Out :- 
  append(In, In, Out).

Then you map it

:- import_module list.

NewList = map(myfunc, OldList)

We can do the same thing with a predicate.

:- pred mypred(string::in, string::out …
more ...

How to convert a predicate from multi to det in Mercury lang?

So you're learning Mercury lang and you have a predicate with multi determinism. Maybe it looks something like this:

:- pred school(string:: in, string:: out) is multi.

fish(Fish, ParticularFish) :-
  ( append("One ", Fish, ParticularFish)
  ; append("Two ", Fish, ParticularFish)
  ; append("Red ", Fish, ParticularFish)
  ; append("Blue ", Fish, ParticularFish)
  ).

Which has four solutions …

more ...

Print a list of strings in Mercury lang

Here's a quick gist for printing a list of strings out in Mercury lang. I found that I needed this when learning the language. Maybe you do too.

Is there a better way to do this? Of course there is, I just haven't learned it yet. For example there is …

more ...

How to install Mercury lang?

Installing Mercury can be an intimidating process. Here are the steps I followed to get Mercury lang up and running.

  1. Download the latest ROTD. This tutorial uses a ROTD dated 2018-04-30, you should replace this date throughout.

  2. Uncompress the source archive

    $ tar -xzf mercury-srcdist-rotd-2018-04-30.tar.gz
    
  3. Configure the installation to …

more ...

Adding an XFCE4 terminal color scheme

This may not be the 'correct' way of doing something, but you can place your xfce4 color scheme in the following folder:

/usr/share/xfce4/terminal/colorschemes

Look at the existing files for inspiration and add a [Scheme] and Name= line to the top.

I successfully renamed terminalrc.jellybeans to …

more ...

My Program runs faster in Eclipse than on the Command line

Today in the Sunlab a student ran into a problem. His program ran faster in Eclipse than on the command line. Actually, to clarify the program initially didn't run at all on the command line. Only after increasing the heap size did it run (this should give you a hint …

more ...