Tuesday, March 09, 2010

This has to be one of the most productive uses of twitter I ever saw!

http://www.longestpoemintheworld.com/

Sampler - The first page

And now for some time in the new Japanese soaking tub.

Done and done. Liking the new haircut. Now to get some grub ^_^

In the hospital, and going to be a first time dad soon!

Today can stop what it's doing already and chang its tune.

Yet you follow and you'll watch you bitch.

we're beautiful and dirty rich

biting off all my nails, and painting them white.

:O Oh and Life of Ryan ... What a great TV night ???

The more we do here and now, the more it'll matter then and there.

I left without my sock hat and i miss having longer hair!

And of course - Varghese Bush. The world suddenly makes a lot of sense.

And I?m leaning on this broken fence between past and present tense.

Work work work and no play!

its toot and boot it day

Monkeys live in trees, grasslands, mountains, forests and on high plains.

No matter the circumstance God is still good and He reigns!

now im running and screaming.

good night and pleasant dreaming ...

Wrapping my hair, and off to bed! :-)

Bang and you are soo very dead. :)

Installing Haskell Platform (with GHC 6.10.4) in Ubuntu Karmic

From http://gist.github.com/326372
#!/bin/bash

# Install dependencies
sudo apt-get install ghc6 ghc6-prof ghc6-doc haddock libglut-dev happy alex \
libedit-dev zlib1g-dev checkinstall libghc6-mtl-prof libghc6-network-prof

# Get haskell-platform
wget http://hackage.haskell.org/platform/2009.2.0.2/haskell-platform-2009.2.0.2.tar.gz
tar -xzf haskell-platform-2009.2.0.2.tar.gz
cd haskell-platform-2009.2.0.2

# Build & Install
./configure

# Before doing a make, install this patch from http://trac.haskell.org/haskell-platform/ticket/84
# Patch appended at the end of the post

make
sudo checkinstall -y

cabal update


------------------------>8---------------------------
PATCH FOLLOWS
------------------------>8---------------------------
A quick(-and-dirty) hot fix: -- code copied from build.sh

---
scripts/install.sh | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)

Index: haskell-platform-2009.2.0.2/scripts/install.sh
===================================================================
--- haskell-platform-2009.2.0.2.orig/scripts/install.sh
+++ haskell-platform-2009.2.0.2/scripts/install.sh
@@ -34,13 +34,23 @@ install_pkg () {
fi
}

+# Is this exact version of the package already installed?
+is_pkg_installed () {
+ PKG_VER=$1
+ grep " ${PKG_VER} " installed.packages > /dev/null 2>&1
+}
+
# Actually do something!
cd packages
for pkg in `cat platform.packages`; do
- cd "${pkg}" || die "The directory for the component ${PKG} is missing"
- echo "Installing ${pkg}..."
- install_pkg ${pkg}
- cd ..
+ if is_pkg_installed "${pkg}"; then
+ echo "Platform package ${pkg} is already installed. Skipping..."
+ else
+ cd "${pkg}" || die "The directory for the component ${PKG} is missing"
+ echo "Installing ${pkg}..."
+ install_pkg ${pkg}
+ cd ..
+ fi
done

echo

------------------------>8---------------------------

Installing GHC 6.10.4 on webfaction

It was surprisingly easy!

Install the generic Haskell 6.10.4 package from http://haskell.org/ghc/download_ghc_6_10_4.html#x86linux
  1. wget http://haskell.org/ghc/dist/6.10.4/ghc-6.10.4-i386-unknown-linux-n.tar.bz2
  2. bunzip2 ghc-6.10.4-i386-unknown-linux-n.tar.bz2
  3. tar -xvf ghc-6.10.4-i386-unknown-linux-n.tar
  4. cd ghc-6.10.4
  5. ./configure --prefix=$HOME/applications
  6. make install
Proceeded smoothly.

Monday, March 08, 2010

Ruby one liner for array splitting

The expressiveness of Ruby can surprise you sometimes. And unlike something ultra powerful like Haskell where the expressiveness can fry your noodles, in Ruby the expressiveness comes naturally for real world code.

Here's a good example -

I needed a quick function to split an array into sub arrays of fixed sizes. It was very quick and painless and the brevity of the code did surprise me!

class Array
def chunk(sizen=2, chunks=[])
(0...self.length).step(sizen) { |n| chunks << self[n,sizen] }
chunks
end
end


It's effectively a one liner, if you ignore comments and the cruft for declarations and return values.

Gnome IPMessenger replacement

Just now saw http://code.google.com/p/iptux/

It supports messages and ultra fast file transfers over LAN. Plus! It comes bundled with Ubuntu (Use Ubuntu Software Manager to install).!

L better than IPMessenger because it supports multiple networks and also behaves much more like a traditional messaging client (chat windows, profile avatars etc.), But the tiny downside is that it doesn't support sealed messages.