Callum Stott

Posts

Netflix is making it hard not to just watch South Park all the time. Loving it.

Keeping me happy while struggling with Java’s Sound API (for project demos).

My top ten films this year according to IMDB.

My top ten albums according Last.fm.

your prof/favorite wizard/spirit animal is a co-creator of Haskell? /dies

Haha yeah. Phil is a pretty funny guy. I’m building an FRP library in Scala under his supervision. He was also on the Java Generics team with Odersky amazingly enough!

I love this and I don’t know why.

Hipster Website Greeting

If you have a hipster startup then you’re probably going to need to say ‘hi’ in a few different languages (Flickr, Soundcloud etc). Here’s a ruby method for ya so you don’t have to bother going to Google Translate:

def random_hi
    ['Hi', 'Salut', 'Ciao', 'Hola', 'Hallo', 'Hei', 'Hej'].sample
end

This is my favourite thing on the internet. Ever.

This just arrived. Now I just need a turntable…

Whisky Quest #5

Laphroaig (10 Year)


Why?

My good mate Dan and I were out having a drink and things took a turn for the whisky.

Verdict

Like I have heard, it tasted very smoky or “peaty” (a term that people who have never dug peat before seem to use) and I would describe it as having a nice ‘light’ texture. I would say it was quite similar to Talisker but with less kick to it as I felt it tasted almost watered down compared. All in all I liked it and it further cemented that I am leaning towards the island whiskies more and more.

An example of Java being annoying

So everyone is always like “JAVA SUX OMG”. But then again, everyone else is like “SHUT UP HIPSTER JAVA IS TEH WIN”. Here’s an example of why people express an opinion in correlation to the former:

So in Java we can do this:

Integer[] array = new Integer[] { 1,2,3,4,5 };

for (Integer i : array) {
System.out.println(i);
}

That makes sense right? We can think of this as “For each integer ‘i’ in array do…”. So far so good. Now lets think about it with something more complex. Suppose I replaced array’s definition:

ArrayList array = new ArrayList();
array.add(1);
array.add(2);

for (Integer i : array) {
System.out.println(i);
}

So this also works and it is very useful but for a moment lets think about how this works. In the first example the equivalent for loop would simply be:

for (i = 0; i < array.length; i++) {
System.out.println(i);
}

Here we see that the ‘for each’ is quite a nice syntactical sugar tool and can be very useful. But here’s the equivalent for the ArrayList:

for (Iterator iter = array.iterator(); iter.hasNext(); ) {
Integer i = iter.getNext(); System.out.println(i);
}

So if you already knew this you’re probably thinking “Who cares?”. And, if you didn’t you’re probably thinking “Wait.. what?”. For the latter here’s whats going on: all the data structures in Java’s standard library implement a ‘Collection’ interface that has an ‘iterator’ method. This method returns and Iterator instance that can be used to iterate through that collection. Here Java is taking advantage of this and allowing Collections to use the ‘for each’ construct.

This makes sense and it all works but here’s my problem: There is a language construct in Java that assumes implementation of features in Java itself. Not a problem to you? Cool. You can have a happy life and never worry about this but personally I hate this. I really detest the idea that a language has constructs that utilise code built with the language. Here’s a challenge for people who think I’m an idiot: Go and build a data structure in Java and don’t use the library. You can, but you can never use ‘for each’ - you’re going to need ‘Iterator’ and to implement ‘Collection’ to do so and then you’ve lost. Isn’t that just a little sad?

Sleigh Bells’ new album announced. These guys are almost too cool.

Kubrick, you were the man.

Rustie’s amazing Boiler Room set. Skip to 28 mins for awesome.

I wish Amy Poehler was my friend.

I always think I’ve gotten over how good this album is but I never do. This decade’s number one so far?

Delete all the PDFs

I get really annoyed because, being at uni, I download a .pdf roughly every 5-10 seconds. This means I have to delete them at some point so I can find that crappy movie I just torrented. So, I stuck this into a shell script and put it into my /usr/bin:

rm /Users/$USER/Downloads/*.pdf

Now I can just execute this any time I start to drown under exercises/lectures/papers etc. So far, this one line of shell script is feeling like it might the most useful thing I’ve ever typed…

Audio

  • Keeping me happy while struggling with Java’s Sound API (for project demos).
    26532 plays
abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz