published on 18.03.2009 06:10.

Mindmap for Software Craftsmanship Talk

I’m currently preparing a talk on Software Craftsmanship for Euruko 2009 in Barcelona. It’s the first time I try out a mind map for structuring everything related to a topic, and I really like it. By looking at the whole at once, you’re able to see new connections, redundancy, overlap, etc. And it’s more fund to draw stuff than putting everything in nested bullet lists.

I’ve also become a fan of Big Visible Charts, so I prefer creating it by hand instead of using a computerized tool, like MindMeister. Don’t get me wrong – MindMeister is very cool – it’s just that I don’t need it’s advantages of collaboration, change tracking etc. since I’m working on my own.

Two learnings already:

  • always start with a really big sheet of paper on a big wall. You never know in which direction you’re gonna need more space! I failed with that, and it’s probably limiting me currently.
  • use stickies to dump ideas that come to your mind when you’re not really working on the preparation. You don’t waste much time drawing and sorting, but you don’t forget and can pick up or discard the ideas later.

By the way, the Euruko conference artwork is the best I have ever seen. It’s a beautiful blend of Barcelona’s omnipresent Gaudi tiles and color tones and the Ruby logo.

Posted in ,  | Tags , , , , , ,  | no comments | no trackbacks

published on 14.03.2009 16:05.

Trying out zsh

Have you consciously decided to use bash as your shell? I haven’t.
How often do you use the shell? For me, it’s one of the tools I use most.

So while bash does the job, why not find out if there’s something better? I’ve heard zsh mentioned a couple of times, and it seems to be smarter and more modern, while maintaining good compatibility with bash. So I’ll give it a try.

zsh Features selection

  • tab completion is programmable and depends on the command it is used with. examples:
    • cd<TAB> shows a list containing only directories
    • tab completion for options: `ls -<TAB>` shows a menu of available options, selectable with cursor
    • cd -<TAB> shows you a list of recently visited directory, select with cursor where to go. instead of pressing <TAB>, you could also have typed cd -2 to go to the 2nd last dir.
    • ssh<TAB> shows a list of all known hosts
    • kill<TAB> gives you a list of processes. another example: kill memca finds the correct pid and inserts it
  • cd-less directory switching (just type name of directory)
  • all shell windows share one history, i.e you can access a command from window A’s history in a new window B
  • can shorten the path shown in the prompt (“Resources/Styles/Marble $” instead of ”/Applications/Chess.app/Contents/Resources/Styles/Marble $”)
  • more powerful globbing. example: ‘ls \\*/\_helper.rb’ lists all *_helper.rb files in the current tree
  • temporary aliases for directories, using ~dirname: ~ $ work=`pwd` ~ $ cd / / $ cd ~work ~ $ pwd /Users/phillip
  • bash-compatibility
  • optional prompt at the right top side

How to start using it on OS X

  • OS X already ships with zsh installed. Type zsh to try it out! It’s pretty dumb without proper configuration, so …
  • get a .zshrc config file, like from here for example. That page is also a good intro and contains more links to useful resources.
  • to use zsh permanently (OS X Leopard): go to System Preferences > User, click the lock and authenticate, right-click on your user and select “Advanced Options”, then select /bin/zsh. Open a Terminal. To check, type echo $SHELL.
  • if your like using Ctrl-A/Ctrl-E/Ctrl-K … to go to the start or end of your command or delete to the end of the line, you’ll need to add ‘bindkey -e’ to the .zshrc file.

A tip, independent of zsh, if you create a .hushlogin file in your home dir, the shell will not display the “Last login …” blah on startup.

Posted in ,  | Tags , ,  | no comments | no trackbacks

published on 30.08.2008 11:57.

eBoy pixel art

click the image to start the storm.

<script type="text/javascript"> //<![CDATA[ var villageImages = ['prestorm-16k-1', 'poststorm-11k', 'reconstructed-05k'].map(function(name) { // too lazy to use regexes ... return 'http://me.phillipoertel.com/files/shp-village-' + name + '-tm.jpg'; }); // preload images villageImages.each(function(url) { (new Image()).src = url; }) Event.observe('eboy-village', 'click', function() { var img = $('eboy-village'); var currentImageNr = villageImages.indexOf(img.src); var newImage = villageImages[currentImageNr + 1] || villageImages[0]; img.src = newImage; }); //]]> </script>

Posted in ,  | Tags ,  | no comments | no trackbacks

published on 17.08.2008 23:36.

Teach Yourself Programming in Ten Years

… and be prepared to suck in the process.

Two excellent – and classic – articles on how to become an expert programmer:

on your way, be prepared to create lots of prime examples of coding horror. below are some of mine.

to put it differently: the best you can do is to suck less as a programmer, year by year. i recently talked to a guy who had lots of architecture knowledge, knew rails’ activerecord inside out, said he counted Scheme as his favourite language, and in general seemed a top coder. it turned out later on he barely could handle simple regular expressions.

 
(warning, coding horror)
product catalog (first tries with ruby on rails, 2005)
class ProductsController < ApplicationController

    #before_filter :authenticate

    layout 'shopAdmin'

    helper :sort
    include SortHelper

    def initialize
        super
        @categories = Category.find_all
        @materials  = Material.find_all

    end

    def index
        list
        render_action 'list'
    end

    def list
          sort_init 'category_id'
        sort_update
        @session['cart'] = 'A SHOPPING CART' 
        @products = Product.find(:all, :order => sort_clause)
        @category = @params['category']
    end
...
end
webshop (2000)
function layout_head($proj_name,$pid) {
    echo '<table width=600 border=0 cellspacing=2>';
    echo "<tr><td>projektomat v 0.013</td><td align=right rowspan=2><a href=http://rmltk.weinbau-jauk.at/index.php?pid=$pid>[übersicht]</a><br/><a href=http://rmltk.weinbau-jauk.at/protected/upload.php?pid=$pid&proj_name=$proj_name>[neue datei hochladen]</a></td></tr>";
    echo "<tr><td>aktuelles projekt: <b>$proj_name</b></td></tr></table>";
}
online calendar (1999)
<?php

if (!defined(INCLUDES)) include("./includes.inc.php");
if (!defined(HEADER)) include("./header.inc.php");
$class = "termin".$func;
$termin_head = "<title>Termin</title>\n<body class='$class' onload=self.focus();document.termin.stunde.focus();>\n<link rel='stylesheet' href='$templatepath/style.css'>";

$datum = mysql2dmy($datum[3]); ## killdatumarrayhere....

if (@$func=="edit") {
    bearbeiten($id);
    exit;
}
if (@$eintrag_neu) {
    echo submit("neu");
} elseif (@$eintrag_update) {
    echo submit("update");
} else {
    neu(0);
}
online calendar, snippet 2 (1999)
function submit($typ) {  ### NEUEN und UPGEDATEDEN termin add_info und eintragen in db 

    global $jahr,$monat,$tag,$stunde,$minute,$dauer,$text,$projekt,$protrack,$projekt_id,$teambox,$id;

    $datum =  "20$jahr-$monat-$tag";
    $zeit = "$stunde:$minute:00";        
    $text = nl2br($text); 
    $nr=1;
    $i=1;
    @end($teambox);
    $lastelementnr =  @key($teambox);        # hier werden die werte der checkboxes (per get übergebenes array teambox[$id]) , werte  yes oder unset
    while ($i <= $lastelementnr) {        # nach $team_id[$nr] = teambox gewandelt  und dann weiter in brauchbare db-query-teile umgewandelt
        if (@$teambox[$i] AND $nr <= 5) {    
            $$teambox[$i] =$i; # yes wird durch den entsprechenden zählerwert ersetzt
            $team_id[$nr] = $$teambox[$i];
            # echo "<pre>team_id[$nr] = $team_id[$nr]</pre>"; ## mal echo einschalten und die ausgabe ansehen
            @$team_cols .= ",team_id$nr";
            @$team_vals .= ",'$team_id[$nr]'";
            @$team_update .= ",team_id$nr='$team_id[$nr]'";
            $nr++;
        }
        $i++;
    }
online questionnaire application (2001)
class radQuizBase 
{
  var $dbName, $form;
  var $debugFlag = false;
  var $quiz = array();
  var $quizForm;

  // variablen für fragen
  var $questionTypes = array (
    'free' => 'Freie Antwort',
_continues ... file has ~1.200 lines ..._

class radQuizAdmin extends radQuizBase 
{
  var $task;

  # variablen f¸r fragebogen administration
  var $qSetName, $insertBeforeQuestionId, $qSetType;

  var $transDifficulty = array(
    'n.a.',
    'leicht', 
    'mittel', 
    'schwierig'
  );
_continues ... file has ~2.000 lines_ [...]
a self-written cms (2000)
################################ / logic start

if($func=='newEntry')
{
    $newId = newEntry($pid);
    eingabeseite($newId);
}
else
{
    // classic logic based on $pid and $aenderung
    if (!$pid)
    {
        echo auswahlseite($category);
    }
    else
    {
        if($showMulti == 'true')
        {
            echo showMulti($pid);
        }
        elseif (!file_exists(WA_ROOT.'/xml/'.$pid.'.xml')) 
        {
            $parms['title'] = $navititle;
            $parms['id'] = $pid;
            neue_seite($parms);
            eingabeseite($pid);
        }
        else // bearbeite bestehende seite
        {
            if(!$aenderung)
            {
                eingabeseite ($pid);
            }
            else
            {
                aenderung ($pid);
            }
        }

    }
}

Posted in  | Tags  | no comments | no trackbacks

published on 21.07.2008 00:19.

loading data from mysql into couchdb with rest and ActiveRecord

$KCODE = 'u'

require 'rubygems'
require_gem 'activerecord'
require 'rest_client'

class MyModel < ActiveRecord::Base
end

ActiveRecord::Base.establish_connection(
  :adapter => "mysql", 
  :database => "hello_world", 
  :encoding => 'UTF8'
)

MyModel.find(:all).each do |record|
  p RestClient.post('http://localhost:5984/hello_world', record.to_json)
end

Posted in ,  | Tags , , , , ,  | no comments | no trackbacks

published on 13.07.2008 16:17.

perl needs no obfusciation ...

interestingly, you can be just as obscure in ruby.

Posted in  | Tags  | no comments | no trackbacks

published on 12.07.2008 22:28.

Too bad Zed left ...

»When the burning husks of your startups warm
the last of your bones, remember I told you so.«

— Zed, in Rails is a Ghetto

Posted in ,  | no comments | no trackbacks

published on 22.06.2008 16:23.

Ruby on Rails developers use Macs? You must be kidding!

taken at the Rails Konferenz 2008 by patrick lenz.

Posted in , ,  | Tags , , , ,  | no comments | no trackbacks

published on 12.05.2008 11:33.

Allowed Interactions in Robustness Analysis Diagrams

i think these are the sexiest uml diagrams by far :-)

Posted in  | Tags ,  | no comments | no trackbacks

published on 23.04.2008 18:03.

Firefox 3 uses sqlite to store bookmarks (and most other things)

ever wanted to search your bookmarks with

SELECT * FROM moz_bookmarks WHERE title LIKE "%ruby%";

now you can:

in your firefox profile directory (~/Library/Application Support/Firefox/Profiles/xxxx.default on a Mac), type:

# open db file
$ sqlite3 places.sqlite

# show available tables
sqlite> .tables

# set output to sql insert statements
sqlite> .mode insert

# send output to file "firefox_bookmarks" 
sqlite> .output firefox_bookmarks

sqlite> SELECT * FROM moz_bookmarks WHERE title LIKE "%ruby%";

# list other available commands & options
sqlite> .help

Or, if you want JSON output you can export all bookmarks via the GUI. Use Bookmarks > Organize Bookmarks, click the rightmost icon in the top navigation and choose Export.

Posted in ,  | Tags , , ,  | no comments | no trackbacks

Older posts: 1 2 3 4 ... 6