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 20.08.2008 20:34.

how to explain a clementine to an extraterrestrial

waste 1.000 words. or just show him this picture.

found while trying to figure out what the following lyrics by regina spector mean: »hey, remember that month when i only ate boxes of tangerine«.

Posted in  | 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