Friday, 20 December 2013

Top 10 of 2013

One of the things a fan of music must do is put themselves through the annual trial of trying to figure out which of the albums they bought/borrowed/stole this year are the best. It took me until about March last year. This year I have been a little more proactive and have produced a list already.

I bought 55 albums this year. I also acquired a further 58 through freebies, promos, borrowings and artists giving me stuff. That's a lot of stuff to choose from. I was considering limiting my self only to stuff released this year, but decided that some things were too good to leave off despite them being discovered by me this year, although released some time in the past. This didn't end up making the job any easier.

Anyway, after much deliberating, thinking, changing of minds and giving up in disgust, I have produced a list of 10 albums split evenly across "metal" and "non-metal", as well as a handful of "honourable mentions." So, without further ado, and in no particular order, the top several albums of 2013!

Metal

Be'lakor - Of Breath And Bone (melodic death metal, 2012)

First up, Australia's Be'lakor with their third album, Of Breath And Bone. I reviewed this one on The Mix Eclectic and said how much I liked it. And I still do. It's one of those albums that's accessible on the surface (depending on your appetite for melodeath, I guess), but has plenty of depth for those who want to look for it.

Dark Tranquillity - Construct (melodic death metal, 2013)

Ah, Dark Tranquillity. Another album, another top 10 mention. This album has split opinion; it is doomier, gloomier, and less hooky than previous albums. But that doesn't take away from the excellent song-writing, musicianship and immersion. And it's a doomy death metal album you can actually sing along to without having to follow along with the lyrics booklet thanks to Mikael Stanne's typically excellent vocal delivery.

Parasite Inc. - Time Tears Down (melodic death metal, 2013)

More melodeath! This time from Germany. Unlike Construct, this album does have hooks. It is catchy, it is heavy, it is mind-pummelling and brain melting and it's brilliant. Melodeath has oft been called "samey" and "tired", but this is the third release in this list that proves otherwise. Thoroughly enjoyable.

Tribulation - Formulas Of Death (ostensibly death metal, 2013)

Ostensibly? Yes. Tribulation's new album sounds more to my ear like some kind of blackened jazz gone haywire. There is never a dull moment, even during the 13 minute closing track, thanks to some excellently positioned riffs, grooves and jazzy moods.

Mael Mordha - Damned When Dead (doom/folk metal, 2013)

A doomy folk metal record about Irish history of invasions and war. What more could a folk metal fan ask for? The liner notes include historical passages explaining the context and content of the songs, and the songs themselves are hard and heavy and educational all at the same time. Having seem them live at Warhorns festival I can conclude that they are a force to be reckoned with in the world of folk metal.

Non-metal

Ancient VVisdom - Deathlike (trippy rock, 2013)

I have no real idea what genre Ancient VVisdom (with two Vs) fall under. They're not really "metal", hence them appearing in this list, but they have metal-ish themes. The sound is almost post-shoegaze rock but with the reverb turned up to 111 and the ominousness slider at maximum. Anyway, it's really good even if they can't spell.

Sigur Rós - Kveikur (post rock, 2013)

Iceland's greatest musical export (sorry, Bjork) are back with a new album that harks back to earlier outings like Takk... and Ágætis byrjun in mood, darkness and crunchiness, rather than the rather lighter whimsy of recent albums. The opening track has an epic base boom that the juices flowing and the mood continues apace throughout the whole album, giving it a certain uncomfortable edge while engaging the listener and drawing them in.

Editors - Weight Of Your Love (alt rock, 2013)

Certainly the most "pop" record on my list, Editors take the new direction introduced with In This Light And On This Evening and run with it. The melancholy is piled on (sometimes too) thick but it has an enduring charm and strong enough music that it maintains interest. It's like doom metal sentiments for the indie rocker.

Steeleye Span - Wintersmith (folk rock, 2013)

If you like folk rock or Discworld, there's something for you on this album. If you like both, then it's a must-have. The music swings wildly from the whimsical to the energetic, the melancholy to the balladic. From the utterly silly The Wee Free Men to the heart wrenching Love Enough it's a whole lot of emotion all wrapped up in a package that is amusingly sinister.

Paul Leonard-Morgan - Dredd: Original Film Soundtrack (electronic post-industrial? 2012)

A soundtrack? On a top 10 list? Surely it must be utterly amazing to have got this far? Yes, it is. If you liked the film, or if you like the sort of ambient post-industrial noise of NIN and the like, you'll like this. It is even somewhat similar to Sigur Rós's album, also in this list, but with less Icelandic oddities and much crunchy Dreddness.


Honourable Mentions

It is traditional to mention a few albums that almost made the cut but had to be dropped because I'm not doing a top 100. Noumena is first up with Death Walks With Me; another melodeath album, this time incorporating female vocals and surprisingly coherent growling. Gormathon, another melodeath band discovered at BOA 2013, get a mention for their 2010 album Lens Of Guardian, a death metal album with almost pop-like structure and catchiness.

Next up is Entropia for their latest atmospheric black metal outing Vesper, with tracks named after famous philosophical and artisan types and a cameo from David Bowie in his role of Nikola Tesla in the film The Prestige on the track cunningly titled Tesla. Thy Light also have an atmospheric black metal album in No Morrow Shall Dawn, although this time incorporating other aspects such as ... spanish guitar? Sort of, yes. A very interesting and thorough relaxing experience.

Last up is Riverside with their album Shrine Of New Generation Slaves (or S.O.N.G.S. for short. Yes, I know ...) It took me a good while to get round to listening to this one, but when I finally did I was glad to have.

And that's it for 2013. If you disagree with my selections for the year, then ... good? I guess. It's good to hold your own opinions.


Tuesday, 12 November 2013

Feeling Puddled

A bit of a change of pace on the blog. I've not posted anything remotely nerdy for ages, so here is a post containing four very nerdy things: functional programming, Haskell, Scala and Twitter interview questions. The Twitter interview in question was not mine, but instead was one posted about by Michael Kozakov on his blog post "I Failed a Twitter Interview."

So, interview questions, eh? This Michael fella thinks he failed the interview by getting the question wrong, but you and I know that's not how it works. The interviewer is more interested in finding out how you go about solving problems than whether you get this particular problem right. After all, unless they have some nasty leaky roof scenario, I can't imagine there being a particular pressing need for Twitter to need their interview candidates to get this one spot on.

That all being said, I don't much care about the problem solving technique. I care about figuring it out and making a really expressive, concise version that looks like awesome code. Because I'm vain.

My first attempt, I will admit, sucked. It was an imperative, state-machine based algorithm that tried to calculate puddles by walking the landscape and figuring out if it was in, out, or around about a puddle. It was awful. It was messy, hard to grok, and about 1000 lines long. Terrible, terrible, terrible. I even fell into the "local maxima" trap described in the blog post, but didn't notice until it was too late.

But of course, a little niggly bit of me knew there must be a good, functional way to do it using a good, functional language. Seeing a pretty elegant faux-functional solution done with PHP's awful array manipulators made me even more determined that there must be a really nice way to do this.

The problem itself is simple; for a given landscape defined by integers, calculate what volume of water would stay in any puddles left due to run-off being impeded. I decided to solve it using Haskell (a safe, useless language) because that's what nerds do, and also using Scala because I happen to be messing about with it. Scala has the advantage of allowing both the imperative and functional versions to work side-by-side. Some may not see this as an advantage.

Consider the following landscape, as defined by an array of integers:

My random landscape. Stunning.
It should be fairly obvious where the puddle should end up. The problem is how to calculate it. From the imperative solution I knew that the trick lay in calculating cumulative maxima, both starting at the left and working right, and also starting at the right and working left. This would give me the "shape" of the puddle.

Haskell:

maxl w = scanl1 max w

Scala:

def maxl(w: List[Int]) = w.scanLeft(0)(max(_,_)).tail

Hmm ... it's already evident that Haskell is at least more brief than Scala, and that Scala's scanLeft function needs a tweak or two. However, the resulting list is the same for each:

Cumulative maxima, as seen from the left.

Good. This is the shape of the landscape, from the perspective of the left hand end. Not terribly useful on its own. We need its brother, maxr:

Haskell:

maxr w = scanr1 max w

Scala:

def maxr(w: List[Int]) = w.scanRight(0)(max(_,_)).init

Haskell's code looks very similar to the previous function. So does Scala's, but there are a couple of weird things about it. The use of "init" to strip the trailing 0 left over by the binary nature of the function, as opposed to the cleanliness of Haskell's unary scanr1 function. Still, the results are, again, the same:

Cumulative maxima, as seen from the right.

Stunning. It's evident that in each of the shapes the side we start at is shaped to the landscape, and the opposite side is largely flat. We can make use of this by fitting the shape to the landscape by calculating the intersect of the two shapes. Due to the nature of the shape (a list of positive integers) we can just use "min" to calculate the intersect. This gives us the maximum water levels for each column.

Haskell:

levels w = zipWith min (maxl w) (maxr w)

Scala:

def levels(w: List[Int]) = (maxl(w), maxr(w)).zipped map(min(_,_))

The code isn't terribly hard to understand, but Haskell's brevity is growing on me. But did it work? What shape do we see now?

An intersect of the left/right maxima showing the puddle.

Aha! The shape now conforms, mostly, to the shape of the ground. There is one clear exception, though. The puddle in the middle is still filled in. So what is the difference between the shape we see and the shape we want? The ground, of course. If we subtract the ground, we should be left with just the shape of the puddle.

Haskell:

water w = zipWith (-) (intersect w) w

Scala:

def water (w: List[Int]) = (levels(w), w).zipped map(_-_)

Again with the brevity, here, Haskell. Scala's weird anonymous function syntax crops up a few times, this time with the weird looking operator _-_. For the uninitiated, it means "subtract the 2nd anonymous argument from the 1st anonymous argument." So there.

Subtract the ground to just leave the puddle we wanted.

And that's it! We have the shape of our water. All we need to do is calculate the volume. Easy peasy.

Haskell:

sum $ water [ 2, 4, 5, 4, 2, 3, 4, 6, 5, 2 ]

Scala:

water(List(2, 4, 5, 4, 2, 3, 4, 6, 5, 2)).sum

Not much in it in terms of brevity, here. And the result of both, as you can probably guess, is 7.

The full listings of the two programs are here:

Haskell:

import System.Environment

main :: IO ()
main = print (sum $ water [2, 4, 5, 4, 2, 3, 4, 6, 5, 2])

maxl w = scanl1 max w
maxr w = scanr1 max w
levels w = zipWith min (maxl w) (maxr w)
water w = zipWith (-) (levels w) w

Scala:

import math._

object Water {

    def maxl(w: List[Int]) = w.scanLeft(0)(max(_,_)).tail
    def maxr(w: List[Int]) = w.scanRight(0)(max(_,_)).init
    def levels(w: List[Int]) = (maxl(w), maxr(w)).zipped map(min(_,_))
    def water(w: List[Int]) = (levels(w), w).zipped map(_-_)

    def main(args: Array[String]) {
        println(water(List(2, 4, 5, 4, 2, 3, 4, 6, 5, 2)).sum)
    }
}

Pretty similar, all in all. A nice, elegant solution that still looks elegant when written down. Arguably Scala's proliferation of types, dots and parentheses looks a bit messier.

Extra bonus content!

I did wonder if I could get the program to output an ASCII representation of the resulting ground and water. Turns out it's pretty easy. Here I've added a line and render function to the Scala version.

import math._

object Water {

    def maxl(w: List[Int]) = w.scanLeft(0)(max(_,_)).tail
    def maxr(w: List[Int]) = w.scanRight(0)(max(_,_)).init
    def levels(w: List[Int]) = (maxl(w), maxr(w)).zipped map(min(_,_))
    def water(w: List[Int]) = (levels(w), w).zipped map(_-_)

    def line(g: Int, w: Int, m: Int) = ("#" * g) + ("~" * w) + (" " * (m-w-g))
    def render(g: List[Int], w: List[Int]) = {
        val graph = (g,w).zipped.map(line(_,_,g.max+1))
        graph.transpose.reverse.map(_.mkString(""))
    }

    def main(args: Array[String]) {
        val g = List(2, 4, 5, 4, 2, 3, 4, 6, 5, 2);
        val w = water(g)
        render(g, w) foreach println
        println("\nTotal volume of water: " + w.sum)
    }
}

And the output:

$ scala Water.scala

       #
  #~~~~##
 ###~~###
 ###~####
##########
##########

Total volume of water: 7

I'll leave working out what it does as an exercise for the reader, as well as a modification to allow it to accept a list of integers on the command line.

Extra, Extra bonus content!

I just rediscovered this post after a long time of not posting anything at all. I should sort that.

Anyway I've been messing about with Python for the first time in forever and have been playing with functional style in a language that doesn't do immutable or checked types (except via maybe the wonderful Pyrsistent package). So here is my solution to this problem in Python.

from operator import sub
from itertools import izip

def _scanl(fn, xs, a):
    for x in xs:
        a = fn(a, x)
        yield a

def _scanr(fn, xs, a):
    xsl = list(xs)
    s = _scanl(fn, reversed(xsl), a)
    return reversed(list(s))

def water(xs):
    maxl = _scanl(max, xs, 0)
    maxr = _scanr(max, xs, 0)
    levels = (min(x) for x in izip(maxl, maxr))
    return (sub(*x) for x in izip(levels, xs))

Not bad, eh? The only reason it's longer than 5 lines is because Python doesn't seem to have scanl (or scanr) built in. They are trivial to build, though. Just doubles the line count.

I have, of course, added calculation of the sum of volumes and a renderer. Why wouldn't I? Here is that bit:

def render(landscape):
    depth = max(landscape) + 1
    line = lambda l, w: ["#"] * l + ["~"] * w + [" "] * (depth - w - l)
    graph = [line(l, w) for l, w in zip(landscape, water(landscape))]
    return ["".join(row) for row in reversed(zip(*graph))]

if __name__ == "__main__":
    from sys import argv

    landscape = map(int, argv[1:]) if len(argv) > 1 \
                else [2, 4, 5, 4, 2, 3, 4, 6, 5, 2]

    for line in render(landscape):
        print line

    print "Volume is %d" % sum(water(landscape))

Again, how it actually works is left as an exercise for the reader. Oh, and of course, the output:

$ python puddle.py 2 4 5 4 2 3 4 6 7 9 8 8 5 4 3 3 3 3 4 5 6 5 4 3 1 1 2 4 3 1

         #
         ###
        ####
       #####~~~~~~~~#
  #~~~~######~~~~~~###
 ###~~########~~~~#####~~~~#
 ###~###################~~~##
########################~~###
##############################
Volume is 34

Thursday, 24 October 2013

Autumn!

It's Autumn! Autumn is awesome. Autumn is the season of dark mornings, dark evenings, dark ... daytimes. Dark, generally. And damp. And generally ick. I love it. It's my favourite season. Not least because taking pictures of the lovely golden autumn light is an absolute delight and being out in the cold, fresh air actually makes me feel alert and awake, unlike the muggy, heavy sluggishness that comes with a hot summer.

The best thing about everything being dark, and damp, and ick, is that mushrooms grow. I've had a long-standing love of photographing mushrooms and other fungi, and this year is no exception. The first of many is right here:

IMG_5231

Lovely. Here are a few more, just for good measure.

IMG_5234 IMG_5235
IMG_5238 IMG_5249

Tuesday, 27 August 2013

Bridge 27

Bank holiday Monday saw us walking around the Shropshire Union Canal. Well, a very small portion of it near the Grindley Brook Staircase Lock, anyway. One of the bridges on that stretch of the canal (bridge 27, if you hadn't guessed, which is actually more of a tunnel) has an unusual architecture in that the brickwork is built into a spiral along the length of the tunnel rather than a more traditional cylinder. The effect of the light hitting the bricks gives the whole thing a wormhole-like appearance, like a swirling vortex to another realm. All very Whovian.

Portal
Looking under the bridge
Bridge 27
The effect of the swirling brickwork inside

Sunday, 18 August 2013

Patterns in Nature

A study of patterns and interesting things in nature around Stainborough, near Barnsley. All pictures taken in monochrome rather than converting. See the full gallery.

Sunday, 4 August 2013

Favours

Favours by craigand
Favours, a photo by craigand on Flickr.

005/365

A nice little selection of wedding favours

Balls

Balls by craigand
Balls, a photo by craigand on Flickr.
004/365

A selection of watery balls used in a table centre at a wedding. They are very brittle and explode easily, but are also bouncy. Weird. They are all transparent. The varying shades and colours are purely from reflected background detail.

Wednesday, 31 July 2013

Love handles

Love handles by craigand
Love handles, a photo by craigand on Flickr.

003/365

The brief today was to use direct, on-camera flash and still make a good picture. Not sure if I actually managed that, but the shapes and shadows I find pleasing. The hint of a very subtle heart shape formed by the handle and its own shadow adds another bit of depth. Or maybe I'm just waffling? Either way, here it is. Number 3.

Tuesday, 30 July 2013

Life … Don't talk to me about life

002/365

Number 2. Today's theme is "emotion", so what better emotion that paranoia?

Monday, 29 July 2013

1337

1337 by craigand
1337, a photo by craigand on Flickr.
The first of my new Project 365 attempt. A silly picture combining the modern computing world with what I consider a true throwback to proper text-based computing; Vim. I still use Vim on a daily basis at work. In fact, my computer screens are pretty much covered with tiled terminals and vim instances. No pointing devices, no touchable screens, no cursor keys (if you're a purist). Just you and a ridiculously powerful, expressive editor. None of your ham-fisted multi-touch hand mashing, anyway.

Vim for iOS is real. I didn't make it up just for this shot. You can get it here: applidium.com/en/applications/vim/

Be warned; it's blooming horrible. Escape is mapped to \ so it's 3 presses just to exit insert mode ...

So, anyway, yes,  I decided to give this Project 365 thing another go. May as well, eh? I haven't done one for two years now and I need to keep practicing, so it seems a good way.

Of course, the coincidence with my recent acquisition of a Sigma 18-35mm f/1.8 DC has nothing to do with it ... *ahem* More on that in a different post.

So what's new? Well, I'm trying to be organised this time. Not just wandering around aimlessly getting frustrated at my own lack of inspiration. I made a list of 52 "themes" from a range of subject types, situations, techniques and styles, made 4 copies of that list, and then kindly asked my computer to randomise the order. This makes 364 "tasks" for my Project 365. The last one is a treat for me; pick whichever one I like. Hopefully by then I'll be able to do that.

So here we are, picture number 1. Here's hoping I make it past 193 this time!

Monday, 15 July 2013

Lanzarote, July 2013

For the first time in my life thus far I went to one of those "hot holiday" type places. The thought has never appealed to me, not being a fan of people, resorts, package deals or *shudder* tourists. However, go we did, and very nice it was. It was before high season, so there were few people, no queues and, somewhat unexpectedly, a reasonable amount of natural history and culture around. Here are a few snaps to commemorate the occasion.










Tuesday, 2 July 2013

Helios 44M f/2 58mm

Helios 44M f/2 58mm by craigand
Helios 44M f/2 58mm, a photo by craigand on Flickr.

My first SLR lens. Still one of my favourites. Especially on Fuji Velvia film.

Sunday, 30 June 2013

Flowers in the garden

Nothing particularly special, except for the fact that these are in my garden. The garden of a man who can kill a cactus.