Learning Go - version 0.2

This morning I’ve tagged version 0.2 of “Learning Go”. Among the larger changes is that “Interfaces” is now a separate chapter.

I have also removed/added/updated the text. Fixed mistakes in the text and code (and probably added new ones).

To get it:

Feedback is welcome.

Of course a lot of work still needs to be done:

  • (Finally) fix all the exercises;
  • Test/Retest if all the Go code works with the latest compiler;
  • Finish the last chapters (chapter 6,7 and 8);
Read more →

Git, $Id$ and file names

It is already possible to use filters in Git. But embedding the current file name in the expanded string is somewhat harder.

You can do this by some edit wrapper which inserts the file name “at the right time”, but I think it is much more cleaner to do this in the git-filter script.

For Puppet I want system administrators to see from which directory in the Git repository the file came from, like so:

Read more →

Precise float placement

If you know LaTeX, you know that precise float placement (I want this figure to positioned right here) is almost impossible. But what nobody told you is that there exists a float package (only since 2001 - maybe even earlier). With this package you get a new placement modifier: [H], which means: “Put this damn figure right here!”.

LateX users everywhere cheer.

Specifics are described in the pdf in the package. Using it on Ubuntu/Debian

Read more →

Go book update

I’m preparing a 0.2 version of the Go book I’m writing. There are lots of small tweaks in the text and in the layout. I still need to extend the number exercises (and enhance the answers a bit), but it is slowly coming together.

There is a new chapter on how to write programs that communicate with the outside world (via files, sockets, etc.).

Some infrastructure work includes an automatic code checker — sadly written in Perl.

Read more →

First post running Ubuntu 10.10

Well, the upgrade was easy enough, some weird LDAP database corruption that was fixed easily by running db4.7_recover in /var/lib/ldap.

There is something fishy going on in /etc/nsswitch and using ‘files’ instead of compat. Got lots of segfaults:

[90474.491264] zsh[5668]: segfault at bfcf07ef ip 001be398 sp
bfce4efc error 6 in libnss_files-2.12.1.so[1bc000+a000]

Not enough for a bug report (yet), I still need to examine this further.

Read more →

It is there

Congrats to SIDN

% dig +dnssec +multiline DNSKEY nl 

;; ANSWER SECTION:
nl.			6547 IN	DNSKEY 256 3 8 (
			    AwEAAbXfJH0LevocrgMOI62Y0+oD02AxPrsXja59z11c
			    cqgW527Ghac2f1aj32a4c1Wc+H6UhTy+daf6LkVytw0l
			    lMmzDDVn/YHcfh7B+9DdbVjdBHvY6q+YTnZbsU3wGwod
			    PMneYJZl8d47eFYmraKKl/endifNukan0z4GkaKYHuI1
			    ) ; key id = 37408
nl.			6547 IN	DNSKEY 257 3 8 (
			    AwEAAekt0eDh+EmOVQMh1av++d5F6eS3B85YkFW9OBQN
			    8X9EA1rG8vl9TRHFBUfpu/vIaUJeuXV9tm/PO+qhNyIL
			    WxI26W1t1/EKr1WhbaNsLXPMhjtuelPqpxuQL/onXvhB
			    83uPcF88pjnKmu73pcdhInLfYkf4JfARztj4e+xaddoL
			    5eJ0Fj3KMVd303NAsH0tmRPBi3EGMAOtM4Ic84Rn8ZkH
			    bwmVUQ3n4qRYaLpgvmpX82RUpEkgPxhrrJGENp1QYGPv
			    0oWPWkcJcSUGsEBgjLSal5IzTJmOEFm7nzbvyrfq/KJX
			    PZZRfJgPpFPwqNfY+GlTfb39kDEcB34z2LCNM2U=
			    ) ; key id = 38420
nl.			6547 IN	RRSIG DNSKEY 8 1 7200 20100902004149 (
			    20100819064254 38420 nl.
			    0/C52WJ2OjQZOrP8y7relQWGVS5gmJLnwnrbic7dGNeJ
			    PVjI7W2gXgt8vVTg36bQ6gVpX7GG2zwvNA/cYTGYnfvF
			    n+0HpA8oZLqeVh1rbQR3oU+iym5F4vX1pka7pbJk358x
			    O9B9KsMFXH9exCoHHXzu/SU3D/TPZ60imrNgvJp6iOci
			    kPeomSQhwKmyyKBUheaOocdV/XIMtzFwOnKYV6bu9wCq
			    PXtOj4Qhp8Ty7mGMnOSpgAzwWcksvqmSZeNpC/tLT/57
			    TxefWNNGlbdY7+fxvA0T+AQVn0xctsS1y194SAv92kZW
			    azVQ9+ZYxQLVZqwSl1/ZBo8spxT1aiwMnw== )
Read more →

Go number cruncher

Write a number cruncher that works as follows:

  • Pick six (6) random numbers from this list:

    1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 25, 50, 75, 100
    

    Numbers may be picked multiple times.

  • Pick one (1) random number (i) in the range:

    1 . . . 1000
    

  • Tell how, by combining the first 6 numbers or or subset with the operators +,-,* and /, you can make i;

Read more →

Learning Go - version 0.1

I’ve tagged an 0.1 version of the book I’m writing: “Learning Go”. It currently has 7 chapters. The first five are finished. Chapter 6 and 7 still need work. The exercises can also use some (more) love. The current chapter list of “Learning Go” is:

  1. Introduction
  2. Basics
  3. Functions
  4. Packages
  5. Beyond the basics
  6. Concurrency
  7. Communication

To get it:

If you have comments, text or exercises feel free to drop an email.

Read more →

Formatting Go code with Vim

There are no formatting rules when writing Go code, but there is an official style. If you pipe your code through gofmt, its output is the official style. So while writing you need to occasionally execute: %!~/bin/gofmt (which I’ve wrapped in a command, so I only need to type :Fmt).

But the trouble is that executing this code resets the cursor to the first line and you then have to jump back to whatever line number you were on.

Read more →

Go DNS online

The last couple of days I’ve been working on (better) DNS support in Go. I think it would be very nice to get something like ldns in Go, but then in less lines of code.

I’ve just published the first code on godns @github. This is heavily based on the DNS implementation currently in Go, in the net-package. Current additions consist of:

  • AAAA support;
  • Parsing rdata to hex or base64;
  • Groundwork for DNSSEC types (DS, DNSKEY, RRSIG);
  • Groundwork for EDNS0.

More info (well not a lot at the moment) can be found here.

Read more →

Computer Languages

I have done programming in (or at least looked at) the following computer languages during my live. Of course the world is not a perfect place, but some languages out there are just plain awful.

  • BASIC - with line numbers! At the time (I was 11) didn’t know there was something else out there. Fun and easy language, although I never programmed in it ever again.

  • Pascal - After BASIC, there is no going back to Pascal. Only briefly looked at it in my youth and discarded it in favor for BASIC…

Read more →

Tweets of June 30 2010

Warm welkom voetballers Noord Korea: http://tinyurl.com/2cz7l4c Warm lood wrs

Wed Jun 30 10:08:59 +0000 2010


Replying to @danielaukes

je moet gewoon veel drinken, dan komt het wel goed

Wed Jun 30 12:24:21 +0000 2010


En toen was het officieel: per 1 sept treed ik in dienst bij SIDN. Jeuh!

Wed Jun 30 14:28:47 +0000 2010


\(even algemeen\) dank. Ja, ik ga met DNSSEC pielen, maar ook nog \(veel\) andere zaken. DNSSEC is toch al bijna af :P

Read more →

Go Book Building

I’m still “writing a Go Book” which boils down to playing with LaTeX, Go and Vim.

Building the whole document might be a bit tricky, because of all the packages you may need.

Assuming you already installed TexLive on your system, you will further need to apt-get install:

  • texlive-xetex
  • ttf-droid
  • latex-cjk-common
  • latex-cjk-japanese-wadalab
  • latex-cjk-xcjk
  • latex-xft-fonts
  • latex-fonts-recommended
  • ttf-sazanami-gothic
  • inkscape (for .svg to .pdf conversion)

Which should make it build. If not, please let me know.

Read more →

Fuzzy fonts in Chromium Browser Under Linux

I did a small upgrade to the newest version of Chromium and all of the sudden the fonts in the browser area were all blurry and fuzzy…

After some searching it turned out that WebKit (which Chromium uses for the rendering) uses the settings from font-config instead of the whatever you click inside your DE’s configuration tools.

% fc-match -v Arial | egrep 'family|hint'
family: "Arial"(s)
familylang: "en"(s)
hintstyle: 1(i)(w)			<- '1' means slight hinting
hinting: FcTrue(w)
autohint: FcFalse(s)

And to remedy the situation:

Read more →

Remember text in LaTeX

After reading the Android Book from O’Reilly I saw some nice use of bullets alongside source code which allowed for extra explanation to be given after the code. I thought only one thing: I want to use that too, but then in LaTeX. After fiddling around for an evening it finally looked like this:

Nice bullets in LaTeX

There are two ways you can do this. The easy way is to write a few macros which create numbered bullets in the code and then use these numbers manually after the code to add your explanation. There are however problems with this approach; You need to manually keep the numbers in sync and thus it distracts you from focussing on the text.

Read more →

Go Book

I’m writing a book about Go. It is very much a work-in-progress, but I just wanted to mention this work and publish a snapshot. The aim is to explain Go and to provide many (many) exercises (and answers) so people may learn this wonderful language.

It is written using LaTeX (of course), see gitweb for the code.

Help is appreciated. The pdf of today (aka daily build) can be found here.

The title page looks like this:

Read more →

Hibernate and suspend with Ubuntu 9.10

I have an Asus EeePC on which I’ve installed Ubuntu 9.10. But now I wanted a working hibernate (suspend to disk) and suspend (suspend to memory).

Hibernate was working out of the box (well the going to sleep part, at least), but resuming took almost as long as a cold boot. Another thing was that my wireless was broken after a resume. On my happiness scale (range: 0-10) this scored a 3.

Read more →

Ubuntu Lucid Alpha-3

I want to upgrade my server to the new Ubuntu and switch to 64 bit on my main server. This is how I managed to get Ubuntu Lucid (Alpha 3) running on my (test) machine, with RAID1 + BTRFS and 64 bit. It is a running story on how I spend my Saturday afternoon, you might need some decent Linux knowledge to follow my lead.

Here we go.

The following lists sums up my needs and troubles:

Read more →

LaTeX Nirvana

I’m no fan of Word or OpenOffice for that matter, all that WYSIWYG stuff is not for me. For years now I’m using LaTeX for my editing needs. An added bonus for using LaTeX is that the output is stunning.

But for really nice looking output I wanted the following:

  • Fonts in images/graphics should match the font of the main document
  • TrueType fonts, instead of the standard TeX fonts. To avoid the “Heeh, that looks like a LaTeX document”-reactions;
  • UTF-8 support and international character support;
  • Easy integration of images (SVG based);
  • Automatic building.

I’m using the following tools for this:

Read more →