Strange Loops

No Matter Where You Go, There You Are

New Blog Redux

| Comments

Now playing around with Octopress for the new blog.

Previously I was using textile with jekyll. This one is generated by markdown with octopress. Builtin support for code snippets is way more impressive. More features! Less work!

Hello World in Python
1
print "Hello World"
Hello World in C
1
2
3
4
#include <stdio.h>
int main(void) {
    printf("Hello World\n");
}
Hello World in Java
1
2
3
4
5
public class Main {
    public static void main(String[] args) {
        System.out.println("Hello World");
    }
}

New Blog

| Comments

Not a new blog per se, The blog is in a new location. It’s hosted in the “cloud” with the use of Amazon S3 static website hosting.

Also I’m using Jekyll to render the various pages on the website. WordPress was an option but this is a simpler approach and potentially more fun. The only downside is I have to code features myself.

Here is a nice new feature (that came at almost zero cost): Syntax highlighting!

Some ruby code….

print foo
1
2
def foo
    puts 'foo'

Some haskell code….

generating combinations
1
2
3
4
5
-- This is a super elegant solution to the question found on the wiki. I got it after
-- tracing through it for awhile. My head hurts.
combinations1 :: Int -> [a] -> [[a]]
combinations1 0 _ = [ [] ]
combinations1 n xs = [ y:ys | y:xs' <- tails xs, ys <- combinations1 (n - 1) xs' ]

All the blog posts were migrated over. Comments didn’t get migrated over. Some images link will be dead going forward. This blog doesn’t have a large audience so it’s not a major concern.

New Beginnings

| Comments

There have been a bunch of changes in my life the last couple of weeks. Here is another one that has been in the works for a while. My blog is being moved to a new platform. More details to come.

Installing Haskell Platform on Ubuntu Lucid

| Comments

After a fairly vanilla install of Ubuntu Lucid 10.04, I wanted to install the Haskell Platform but the base Ubuntu install is missing some dependencies.

These were the packages I installed to complete the dependencies:

  • libzlib1g-dev
  • libgmp3-dev
  • freeglut3
  • freeglut3-dev
  • libglew1.5
  • libglew1.5-dev
  • libglu1-mesa
  • libglu1-mesa-dev
  • libgl1-mesa-glx
  • libgl1-mesa-dev

Rather than installing GHC from the Ubuntu repositories, I used the GHC 6.12.3 generic binary from haskell.org

Afterwards, I downloaded the source for the Haskell platform (see here) and followed the instructions for installing it.

 

New Machine

| Comments

These last couple of weeks I've been assembling a new desktop machine. It's a fairly hefty machine, core i7, Nvidia GTX 470, 12gigs of RAM.

The biggest annoyance right now is that the Nvidia GTX 470 graphics card is not 100% compatible with Linux (Ubunutu specifically). I can get Linux running but the resolution under X is hideous without the Nvidia driver and with the Nvidia driver I get random system freezes.

So for now, I'm living with Windows 7. It's not the most pleasant experience. However combined with VM player I'm able to get some of my Linux development environment goodness.

Hopefully the graphics issue gets resolved before or early in the new year.

Quick Thoughts on CUFP 2010

| Comments

I went to CUFP this year. I've been diving into Haskell the last year and I thought it would be interesting to see how Haskell (and functional programming in general) were being used.

A couple of quick thoughts:

1. Enjoyed the tutorial on "High Performance Haskell" (slides here). I've spent the last year learning about Haskell but I'm not completely comfortable with it yet. The level of this tutorial was just about right. None of the stuff was over my head.

2. F# shows a lot of promise. I don't use any MS developer products but I'm considering getting Visual Studio to try out F#. It looks like a functional programming language with the fit and polish of the mainstream programming languages e.g. Java, C#

3. Side effects, imperative style are not optimal but sometimes they are very useful. This was a comment that was made in different forms over various talks. It surprised me a little but it shouldn't have. Haskell has affected my day to day work by making me more mindful about side effects. Perhaps that is the biggest thing functional programming can teach working programmers, to understand the various trade offs you make when you apply the different programming language paradigms (functional, imperative, oo).

4. Lots of people appear to be using Scala, Erlang and Ocaml to do serious work even if they're not blogging about it.

5. Not much was said about Clojure. This was a little surprising. 

Overall, it was a worthwhile two days and I learnt a lot. Still digesting the conference material and will be doing that for awhile. 

iPad + Kindle Love

| Comments

It's a great time to be a computer technologist. The last 12 months feel like a new dawn in mobile computing technology. 

I recently picked up an iPad. Surfing the web and checking email has made my daily bus commute way more enjoyable. Rather than doing the morning email and web surfing from home, I can do it on the bus. This is a real time saver.

The iPad, like the smaller iPhone, is a fantastic device for taking on the move. The iPad may just be a bigger iPod Touch but the bigger screen, to me at least, makes the difference between night and day. I admit in the beginning I didn't see how the iPad could replace my Lenovo IdeaPad which was a portable device that I took almost everywhere. I could write code on my IdeaPad and it ran Linux after all! 

It came down to 2 things: 

1. 95% of what I did was surfing the web, writing and capturing ideas. 

2. Have you tried using a keyboard while standing? This makes difference when you're moving and want to check something. (I got used to the virtual keyboard. It's not the optimal solution for typing)

I still like my IdeaPad but all technology gets outdated by something newer and sleeker. I don't like it but I have no qualms about the engine of progress and a newer shinier version of the iPad in the future. 

Aside, I'm surprised by how much the Kindle gets dissed on though, that e-ink display is still the closest thing to paper I've seen on a display. I can use the iPad in hourly bursts but when I want to unwind for a couple of hours with a good story my first choice is still the kindle. Winnie and Alice are flashy but really distract me from reading the book. It's not new, sleek and shiny I guess and that makes sense.

 Sent from my iPad but edited on my desktop.

Quick Clojure: Understanding Dot Dot Macro

| Comments

user> (. "hello " trim)
"hello"
user> (. (. "hello " trim) toUpperCase)
"HELLO"
user> (.. "hello " trim toUpperCase)
"HELLO"
user> (.. "hello " trim toUpperCase length)
5
user> (.. "hello " trim toUpperCase (concat " world"))
"HELLO world"