Showing posts tagged as "coding"

Annoying gotcha—LaTeX AMS Matrix

Wow… I couldn’t really be more cheesed off :|

I’ve just spent the best part of an hour trying (and failing) to typeset a 16x16 matrix using the matrix environment—well, pmatrix but whatever.

I constantly got the following error message:

! Extra alignment tab has been changed to \cr.

There was me searching for this elusive ‘extra’ alignment character (it’s an & by the way). I Vim’d my ass off with macros and eventually came to the conclusion that I was right and the compiler was wrong! This is very rarely the case but this is one of those rare occurances.

Take a look at the AMS documentation[1] and what’s that, a footnote to §4.1?! :

The maximum number of columns in a matrix is determined by the counter MaxMatrixCols (normal value = 10), which you can change if necessary using LATEX’s \setcounter or \addtocounter commands.

That’s right: some numpty thought it would be helpful(?!) to set a maximum matrix dimension. So why couldn’t I typeset my 16x16 matrix? Simply because you can’t… (by default).

One word to you Mr. AMS man: Lame.

[1] : User’s Guide for the amsmath Package (Version 2.0)

Nice to see my work being used…

Just found out today that the work I did over the summer for Akai Professional and Numark Industries is actually being put to good use—shock horror!

Built a new (supposedly) extensible and flexible production test framework and… it’s now being used on their new flagship product: the MPC Renaissance!

Hope they like it enough to use it on their next big-seller too!

MPC-Renaissance

Git Branch and Status in Bash PS1 Prompt

Over these last few weeks I’ve really started getting into Git. Everyone has their favourite VCS but for me, what I’ve seen of Git so far makes me think it’s gotta be on of the best and most flexible.

So if you love Git then maybe you’ll appreciate this. A bit of Googling and I stumbled upon a way to have your Bash PS1 prompt tell you what branch of a repository you’re on (if applicable) and give a dirty flag as well…

Git in Bash PS1

It involves a few functions in your .bashrc and here they are:

git_dirty_flag() {
  git status 2> /dev/null | grep -c : | awk '{if ($1 > 0) print "⚡"}'
}

parse_git_branch() {
  git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \1/'
}

Just call these within your PS1. I like to know if the branch I’m working on is clean or not so I get it to append the branch name with a ‘⚡’ if there are uncommitted changes.

Compile-time error? (via Burn baby burn | THE CROSSED COW)

Compile-time error? (via Burn baby burn | THE CROSSED COW)

My office of toys for the summer…

My office of toys for the summer…

Ask