Slimy Vim

Since taking a look at clojure again I was looking
over at Emacs thinking, even though it feels unusable to me it has the nice
feature of evaluating an expression right here and now. Since I’m kind of
invested in both Vim as well as Textmate, with Vim being my current favorite,
I was looking around to get similar. What I came across first was running the
VimClojure Plugin which includes the Nailgunserver, running a single clojure instance evaluating the code you sent to it.
Even though it feels nice to use it mainly works for clojure and is kind of
heavy weight to set up. A simpler solution was described in a post about setting
up clojure on Vim and uses slime to pass
code to a screen window running some interpreter. The nice thing is it works the
same for ruby, python, nodejs, clojure, etc.. My current setup is available found at
Github

Simple git work flow

Simple git work flow

The concept of having multiple branches of code and merge them when needed is
a complicated concept to many people. When SVN was first introduced it started
with the premise to be a “CVS done right”. This means cheap branches, as well as
what is supposed to be easy merging. Actually SVN is a great hassle to use especially
when working with branches, which is why a lot of developers are actually
not really fund of branching and merging all the time. But git is different,
really, honestly… well at least to me ;)!

After working with git for some time now I got in the habit of a pretty basic
usage pattern which works quite well for me, so let me introduce you to it. Whenever I
want to work on a new feature I first branch of the current master to have my
own little sandbox to work and explore in.


$git checkout -b feature_XYZ

Now I got an unchanging environment, in which I can work and there is no one
else changing stuff except me (or maybe a small team). Commits only happen to
this branch.

After the feature is done the code needs to be merged in the master again.
Since the master probably changed during the implementation, I first rebase the
feature branch so I can actually do the merge inside the branch and don’t break
the master. So first pull the newest master and than rebase.


$git pull
$git rebase master

If there is a conflict I resolve it and create a commit describing the merge and
continue the rebase


$git add CONFLICTINGFILE
$git commit -m
$git rebase --continue

After rebase is done I switch to the master and do a merge which should not have
any conflicts now


$git checkout master
$git merge feature_XYZ

Now the whole thing can be pushed, while the master was working all the time,
and therefore a real parallel work on multiple features is possible. This is
possibly not suitable for work in large teams but for me as a single developer
working in small teams most of the time it works amazingly well.

Set DNS servers in NodeJS on a per channel bases

In NodeJS DNS request are handled in the background via the ares library to enable asynchronous requesting. Ares allows the DNS server to be used set on a per channel bases, but this is not exposed in NodeJS, but is is quite simple to enable it by patching node_cares.cc. In essence this enables setting the DNS server via the parameter CHANNEL_NS on creation. To expose this towards NodeJS there needs to be an extension on the default dns.js module. The reason for me to enable this was to use different nameservers on each request, so the extension creates a new channel each time a new nameserver is needed.
I packed everything in a Github repository including some examples.

Me can haz IPv6 with Airport Extreme at Home

Me can haz IPv6 with Airport Extreme at Home

Ok so since I really like to have access to my home machine, and also like to be able to server
some web stuff for testing proposes it decided to setup IPv6 at home. After all the process took
about 10 minutes and using my Airport Extreme as a Tunnel endpoint was rather painless to my
surprise.

Setup an account with tunnelbroker and create a tunnel

This is really easy, just go to the tunnelbroker-page and create an
account. Afterwards create a so called “Regular Tunnel”

Configure the Airport Extreme

Open the Airport Utility and go to Advanced and IPv6. There you configure IPv6 as Manually and enter the
configuration presented by tunnelbroker when creating the tunnel. The configuration mapping is:
Server IPv4 -> Remote IPv4; Server IPv6 -> IPv6 Default Route; Client IPv6 -> WAN IPv6, Routed /64 -> LAN IPv6.

Airport Extreme IPv6

Now set the IPv6 DNS Server under internet TCP/IP to the server provided by tunnelbroker as well,
to get more of the IPv6 goodnessm, which isn’t really much after all so… take what you can get ;).

Try it

To confirm that everything works check in the terminal via a simple

ping6 ipv6.google.com

ping6 ipv6.google.com

Yay you can now use IPv6, at least whats out there, which isn’t much after all. The good thing is you get a lot of
addresses accessible so no more “Port 1337 forwards to fu, 4848 forwards to bar”-mapping.

BTW: I blacked out some numbers just because everybody else does it ;)

EDIT: To make setting the IPv4 endpoint easier I created a script to do that for you. It can be found on
github. This is especially useful if you are on a dynamic IP connection
like normal DSL or Cable.

Introduction to Git and how to using it

Recently git gained a large userbase, and is quickly becoming the default standard for version managment. So for me it
was time to get a larger understanding of it besides just “using it like I think it works”. So to get up to speed
quickly I decided to search for some talks on it. So here my quick introduction worth watching.

GoogleTechTalk: Git

Great talk by Randal Schwartz about Git. Even though it’s not the newest it really is a great explanation of the concepts. Since embedding sadly is disabled check it out at youtube. Like with pretty much everything Randal does the talk is really worth it.

O’Reilly Webcast: Git in One Hour

For an introduction to actually using git the O’Reilly Webcast is a great resource

Cheat Sheet

Nice command overview

Git Tower

For those not really that familiar with the command line, or people like me who keep forgetting the command, Git tower is quite a nice app to use with Git.

Palm Pixi and Salling Media Sync

Ok so I got all my Music and Movies in iTunes, and I’m using a Palm Pixi. So far
I only knew of one pretty, let’s just say not that well engineered solution
doubleTwist. I know a lot of people like it but
to me it’s slow as molasses and as reliable as … oh well.
Now I found a solution, Salling Media Sync,
I actually gotta admit “Yes I found it on the App Store” but I’m still not a fan ;).

So what about the tool, it works great as well as fast and syncs my Palm with
my iTunes library. Everything without any big configuration and such, it just
works.

So if you are looking for a great tool to manage your Palm or any other Phones
Media, check out Salling Media Sync there is a Demo Version on the
Website FYI.

Setting up Django on Snowleopard

I found this tutorial to setup django on Snowleopard. Since I realized it is a little outdated I decided to document the steps I took based on it to get this up and running.

Install

As far as package managers on the Mac go, Homebrew is the new kid on the block, but in my opinion it outperforms Macports in many ways. So for all my installs I tend to use it as much as possible, if anything is not available it is easy to build it using it as well.

So for this tutorial we need the following:

  • Git
  • Mercurial
  • libjpg
  • pip
  • virtualenv
  • virtualenvwrapper

Installing all this is pretty straight forward:

brew install git
brew install pip && pip install mercurial
brew install libjpg
sudo easy_install virtualenv
sudo easy_install virtualenvwrapper

Configuration

Virtualenv changed a little since the original tutorial so setup is done by first of all creating the directory for the environments

mkdir ~/.virtualenvs

Now the directory needs to be exported and the virtualenvwrapper.sh needs to be sourced, this is done by adding

export WORKON_HOME=$HOME/.virtualenvs
source /path/to/this/file/virtualenvwrapper.sh

to .bashrc and running

. ~/.bashrc

Now let’s create an environment by running

workon
mkvirtualenv magicalenvironment
workon
workon magicalenvironment

Now you are running in the magicalenvironment.

Django and the Firstapp

Finally it is time to create a file containing some basic setup

nano django-basic-requirements.txt
# Docutils for admin documentation.
docutils
# Latest Django version
-e svn+http://code.djangoproject.com/svn/django/trunk#egg=Django

Thats it, now it’s time to setup the app using pip and switch in the environment

pip install -E testapp.com -r django-basic-requirements.txt
workon testapp.com

Time to get Django up and running

django-admin.py startproject testapp
cd testapp
python manage.py runserver

Now we can visit http://127.0.0.1:8000 an should see this

Django Testapp

Here we go a running Django development environment. Next on the agenda integrate MongoDB with Django.

ChromeOS Notebook Cr-48

Yesterday (This is now some days ago ;)) I got the chance to take a quick look at the Google Chrome OS Notebook, and I gotta say I’m really impressed. Even though I could not take a look at the OS itself really, thanks to no available wifi, on first glance it looks quite nice. It mainly is a Chrome browser running fullscreen so I don’t expect much of a difference from the experience than running it on my Macbook. To me, at the right price, this would be an awesome machine. When I take a look at the apps I use most of the time, almost all are browser based anyway, and through my Palm offering a wifi hotspot everywhere there is a cell signal, I can live with that. The power of HTML5 will also increase the usability even without connectivity in the near future. But the OS is really not what I’m lusting for… Sell me the hardware!

The hardware

I know that the machine will most likely not be available to a broad audience, but really this is a machine I would buy. The design is simple yet functional, the keyboard has a good touch to it at first glance, while the touchpad feels right as well. The machine is light, but feels sturdy and the outer shell has an almost leather like touch, similar to my Palm Pixi. There are no annoying stickers, or crazy amount of LEDs bagging for attention. The battery life is supposed to be close to 8h which is enough even for a long meeting-, or travel-day. So please manufactures take a good look at this! I bet I’m not the only one looking for such a machine. Currently there seems to be no PC manufacturer left offering at least a decent design, bundled with a nice machine, the only one coming close is Lenovo I guess.

I still got some hope left that maybe I’ll be able to beta test the machine, but I guess there a probably 1.000.000 people hoping the same. So to the guys who build the machine, just build more an sell them, kthxbye.

Growling from Node … or why is Array.pack missing from Javascript?

Since it came out I’ve been really interessed in Node. So I decided to do something with it, and to get me started I hacked together a little module to allow me to do what every good programming environment should allow: Sent me some Growl notifications :D…

Nodejs growl.png

This involved some rather low level UDP packet construction, but for now it works. Maybe somebody will find it useful, I put the code up on Github.

While writing the module I realized I was missing one piece coming from network coding using ruby, Array.pack(format) why is this missing? Is there an alternative? How do I turn an Array into a buffer following some custom format? Well for now I solved this by a little hacked function extending Array, this is neither clean nor well tested but it works for me while looking for a way to this right. For anyone interested here it is, and don’t kill me cause it’s ugly

https://gist.github.com/734947.js

Enjoy.

Coding for the caffeinatedcoders

A couple weeks ago me and a friend decided to get our projects together and from
now on publish under the caffeinatedcoders. From now on I can focus on doing what I love, develop web applications using the bleeding edge of technologies. This will include my love for Ruby (on Rails), as well as Javascript coding. Stay tuned our first project in on it’s way, the code is just flowing from my fingers right now ;). I can say so much the web apps we build follow the Unix way, do one thing and do it right!