npm install socket.io on gentoo

9. März 2012 Keine Kommentare
> npm install socket.io
npm http GET https://registry.npmjs.org/socket.io
npm http 304 https://registry.npmjs.org/socket.io
npm http GET https://registry.npmjs.org/socket.io-client/0.9.0
npm http GET https://registry.npmjs.org/policyfile/0.0.4
npm http GET https://registry.npmjs.org/redis/0.6.7
npm http 304 https://registry.npmjs.org/policyfile/0.0.4
npm http 304 https://registry.npmjs.org/socket.io-client/0.9.0
npm http 304 https://registry.npmjs.org/redis/0.6.7
npm http GET https://registry.npmjs.org/uglify-js/1.2.5
npm http GET https://registry.npmjs.org/ws/0.4.0
npm http GET https://registry.npmjs.org/xmlhttprequest/1.2.2
npm http 304 https://registry.npmjs.org/ws/0.4.0
npm http 304 https://registry.npmjs.org/uglify-js/1.2.5
npm http 304 https://registry.npmjs.org/xmlhttprequest/1.2.2

> ws@0.4.0 preinstall /home/shoan/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws
> make

node-waf configure build
Traceback (most recent call last):
  File "/usr/bin/node-waf", line 14, in
    import Scripting
  File "/usr/bin/../lib/node/wafadmin/Scripting.py", line 146
    except Utils.WafError, e:
                         ^
SyntaxError: invalid syntax
make: *** [all] Error 1
npm ERR! error installing ws@0.4.0
npm ERR! error installing socket.io-client@0.9.0
npm ERR! error installing socket.io@0.9.0

npm ERR! ws@0.4.0 preinstall: `make`
npm ERR! `sh "-c" "make"` failed with 2
npm ERR!
npm ERR! Failed at the ws@0.4.0 preinstall script.
npm ERR! This is most likely a problem with the ws package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     make
npm ERR! You can get their info via:
npm ERR!     npm owner ls ws
npm ERR! There is likely additional logging output above.
npm ERR!
npm ERR! System Linux 3.2.6-gentoo
npm ERR! command "node" "/usr/bin/npm" "install" "socket.io"
npm ERR! cwd /home/shoan
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! code ELIFECYCLE
npm ERR! message ws@0.4.0 preinstall: `make`
npm ERR! message `sh "-c" "make"` failed with 2
npm ERR! errno {}

npm ERR! Error: ENOENT, no such file or directory '/home/shoan/node_modules/socket.io/node_modules/socket.io-client/node_modules/___uglify-js.npm/package/tmp/app.js'
npm ERR! You may report this log at:
npm ERR!
npm ERR! or email it to:
npm ERR!
npm ERR!
npm ERR! System Linux 3.2.6-gentoo
npm ERR! command "node" "/usr/bin/npm" "install" "socket.io"
npm ERR! cwd /home/shoan
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! path /home/shoan/node_modules/socket.io/node_modules/socket.io-client/node_modules/___uglify-js.npm/package/tmp/app.js
npm ERR! fstream_path /home/shoan/node_modules/socket.io/node_modules/socket.io-client/node_modules/___uglify-js.npm/package/tmp/app.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! message ENOENT, no such file or directory '/home/shoan/node_modules/socket.io/node_modules/socket.io-client/node_modules/___uglify-js.npm/package/tmp/app.js'
npm ERR! errno {}
npm ERR! fstream_stack Object.oncomplete (/usr/lib64/node_modules/npm/node_modules/fstream/lib/writer.js:204:26)
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /home/shoan/npm-debug.log
npm not ok

The solution is just to set Python 2.7

> eselect python list
Available Python interpreters:
  [1]   python2.7
  [2]   python3.2 *

> sudo eselect python set 1

KategorienDefault

Recursively Create MD5-Hashes

1. Juli 2011 Keine Kommentare

If you want to compute MD5 hashes for an directory, you can use following script. I added some exclusions needed for my projects.

#!/bin/bash

DIR="$1"
MD5="file.md5"

if [ -z "$DIR" ]; then
 DIR="."
fi

rm -f "$DIR/$MD5"

find \
    "$DIR" \
    -type f \
    -not \( \
        -path "*.svn*" -o \
        -path "*.cache*" -o \
        -path "*.settings*" -o \
        -path "*.metadata*" -o \
        -name ".buildpath" -o \
        -name ".buildpath" -o \
        -name ".project" -o \
        -name "$MD5" \
    \) \
    -print0 | \
xargs -0 md5sum >> "$DIR/$MD5"

After that you can check the directory against this file.

md5sum -c file.md5

Share and Suffer

15. Juni 2010 2 Kommentare

Hey guys,

I’m honestly starting to get fed up with this sharing / bookmarking overkill on every single fucking blog. How about to agree to one or maybe none provider?

shareandenjoy

Please don’t share this post ;)

Kategorienblog

Allen & Heath Xone 92 unpacking

27. April 2010 1 Kommentar
Kategorienmusic

Allen & Heath Xone 92 bestellt

23. Februar 2010 1 Kommentar

Ich habe mich heute (23.02.2010) dazu entschieden meinen alten Pioneer DJM 400 gegen einen Allen & Heath Xone 92 einzutauschen.

günstiger.de verweist mich, als finanzbewusster Käufer, an GSM-Multimedia GmbH, die unter dem Decknamen recordcase.de operiert. Die Kaufentscheidung ist schnell gefallen: Sie sind günstig, aktzeptieren PayPal und bei Lieferzeit steht “sofort lieferbar”. “Alles klar! Dann ist das Teil vielleicht diese Woche schon da”, dachte ich mir. Dann nehm ich mir auch gleich das Case mit.

Die Bestellprozedur verläuft ohne Probleme. Bis zu der Stelle, wo man die Zahlungsart angibt. Der erste Schock: 45 Euro Gebühr für PayPal??!! Na gut, dann eben nicht PayPal! Und Sofortüberweisung? Schon klar, ich gebe meine TAN und mein PIN an Fremde … die sammeln wohl Abmahnungen wie anderer Leute Briefmarken! So langsam werde ich stutzig – lasse mich aber nicht beirren. Dann wohl doch wieder die langwierige Tour: Standardüberweisung.

Nach einem Klick auf Bestellen flattert auch schon gleich eine E-Mail rein:

Dies ist die Bestätigung ihrer Bestellung bei www.recordcase.de! .. blah, blah.

Die Bankverbindung steht auch drin. Also mache ich auch gleich die Überweisung.

Drei Stunden später kommt noch eine E-Mail:

Wir freuen uns, Ihnen mitteilen zu können, dass wir Ihre Zahlung erhalten haben.

Das ging ja schnell – sehr ungewöhnlich. Zumal Überweisungen zwischen ein und drei Tage dauern. Doch dann die eigentliche Überraschung:

Leider kommt es bei einem oder mehreren Artikeln noch zu kleineren Lieferverzögerungen. Wir bitten dies zu entschuldigen und danken Ihnen schon jetzt für Ihre Geduld.

Na super! Wollen die mich verarschen? Das war eines der Hauptargumente warum ich bei denen bestellt habe.

Folgende E-Mail habe ich zurückgeschrieben:

Sehr geehrter xxxx,

das wundert micht ein wenig, da bei beiden Artikeln (Xone92 und Case) unter Lieferzeit “sofort lieferbar” steht. Können Sie mir denn den voraussichtlichen Liefertermin nennen?

Mit freundlichen Grüßen
Dominik Winter

Daraufhin bekomme ich am nächsten Tag diese E-Mail:

Hallo,

vielen Dank für Ihre E-Mail.
Das kommt daher, dass die Lieferung schon laut Hersteller längst eintreffen hätte sollen.
Ist aber noch nicht bei uns eingetroffen und unser System arbeitet mit eingetragenen Lieferterminen.
Der aktuelle Liefertermin des Xone 92 ist in leider erst 4 Wochen. KW13.
Der Mixer ist direkt beim Hersteller nicht lieferbar.
Wir versuchen aber unser Bestes, um den Mixer so schnell wie möglich zu Ihnen zu senden.
Ist die Lieferung erst einmal da. haben Sie ihn am nächsten Tag schon.

Bitte entschuldigen Sie die kleine Verzögerung.

Vielen Dank

Schade, es hätte so schön sein können. Dann muss ich mich wohl doch noch vier Wochen gedulden :(

[update]

Nach über vier Wochen (13.04.2010) schreibe ich mal eine Erinnerungsmail.

Sehr geehrter xxx,

haben Sie mich vergessen? Ich wollte noch mal nachfragen, wann mein Xone und das Case kommt, denn die 4 Wochen sind schon lange verstrichen.

Mit freundlichen Grüßen
Dominik Winter

Eine Stunde später ist wieder Hoffnung in Sicht:

Guten Tag,

nein. Natürlich habe ich Sie nicht vergessen.
Leider ist der Xone noch nicht eingetroffen.
Der aktuelle Liefertermin ist aber “schon” nächste Woche.
Das heißt, das lange Warten hat ein Ende.
Wir schicken Ihre Bestellung dann natürlich sofort los.

Bitte entschuldigen Sie die lange Wartezeit.

Vielen Dank!

[update]

Nach einer nochmaligen Erinnerungsmail (am 26.04.2010) wird mir mitgeteilt, dass der Xone jetzt auf Lager ist – allerdings das Case nicht. Um es kurz zu machen, habe ich mir erst einmal den Xone schicken lassen, welcher auch endlich am 27.04.2010 (also nach über zwei Monaten) ankommt.

Kategorienmusic

Apple iPad

28. Januar 2010 Keine Kommentare

Gestern war es soweit. Endlich, die heiß ersehnte Pressekonferenz in San Francisco im Yerba Buena Center of the Arts mit Apple-Chef Steve Jobs.

Ein iPad hat das Licht der Welt erblickt. Man kann sagen Alwasys Online statt Always Ultra. Vorausgesetzt man will für das gute Stück (16 GB und W-LAN) 500$ ausgeben. Wer mehr haben will (64 GB, W-LAN und 3G) muss 830$ tief in die Tasche greifen.

Nicht nur diese Flunder ist dünn, sondern auch die Ausstattung: Ein Gerät für unterwegs ohne Möglichkeit zu telefonieren bzw. SMS zu verschicken? Also doch wieder Handy mitschleppen. Kein Multitasking, kein USB-Anschluss, kein UMTS, kein Flash, keine Kamera. Die Tatsache eine Tastatur via Bluetooth anzuschließen, ist nichts Weiteres als ein Eingeständnis, dass das TouchPad unbrauchbar ist. Denn wie viel bleibt vom eigentlichen Display übrig, wenn man mit dem TouchPad schreibt?

Alles im Allem ein größerer iPod Touch. Schade, ich hätte mehr erwartet.

Kategorienhardware

Multiple Inheritance in PHP

20. Dezember 2009 Keine Kommentare

With the magic of __call() it is possible to do multiple inheritance in PHP. This example is more then a mixin pattern. It can also call protected and private methods from inherited classes.

<?php

abstract class Inheritance {
    private $_inheritances = array();

    public function __call($method, array $arguments = array()) {
        // Here you can handle the calls. Maybe you don't want to call
        // every found method but only the first or the last ...
        foreach ($this->_inheritances as $inheritance) {
            $inheritance->invoke($method, $arguments);
        }
    }

    public function invoke($method, $arguments) {
        if (method_exists($this, $method) === true) {
            return call_user_func_array(array($this, $method), $arguments);
        }
    }

    protected function _addInheritance(Inheritance $inheritance) {
        $this->_inheritances[get_class($inheritance)] = $inheritance;
    }
}

That’s all! Now the usage:

We have two simple base classes, Bird and Horse, which have some methods.

/**
 * first base class
 */
class Bird extends Inheritance {
    public function chirp() {
        echo "<br/>chirp ..";
    }

    public function fly() {
        echo "<br/>fly ..";
    }

    protected function _eat() {
        echo "<br/>eat worms ..";
    }
}

/**
 * second base class
 */
class Horse extends Inheritance {
    public function whinny() {
        echo "<br/>whinny ..";
    }

    protected function _eat() {
        echo "<br/>eat hay ..";
    }
}

Now we want a new class named Pegasus that implements all methods from Bird and Horse. The only thing we have to do is to inherit from Inheritance and add the two base classes with _addInheritance().

class Pegasus extends Inheritance {
    public function __construct() {
        // bind extented classes
        $this->_addInheritance(new Bird);
        $this->_addInheritance(new Horse);
    }

    public function eat() {
        // works with protected methods, too
        $this->_eat();
    }
}

$pegasus = new Pegasus;
$pegasus->chirp();
$pegasus->fly();
$pegasus->whinny();
$pegasus->eat();

Output:

chirp ..
fly ..
whinny ..
eat worms ..
eat hay ..

Kategorienphp

On the Road

15. November 2009 Keine Kommentare
Kategorienprivate

Naming of Classes, Methods and Member Variables

18. Oktober 2009 Keine Kommentare

This article is not about syntax style. It’s only about right naming of classes, their methods and their member variables. Because there’s nothing better for other programmer (ie. like me) to see a constant name schema.

General Provisions

  • leave out articles like ‘a’ and ‘the’ – these are totally unnecessary (TheCar)
  • don’t use ‘my’ in the name – it’s not yours (myVar, MyClass)

Classes

  • try to use a noun or a short phrase with a noun (Tree, SubTree)
  • always use singular instead of plural
  • avoid imperatively ‘object’ in class names – classes are not a objects. You can find bad examples everywhere: stdObject, ArryObject, Zend_Date_DateObject

Methods

  • the name should simply describe what does the method do
  • try to use a verb or verb with a noun, like save(), build(), getTitle()

Member Variables

  • if type of boolean, then prepend ‘is’
  • avoid variables like ‘x’, ‘i’ – use for example ‘index’

jCharacterfall

15. Oktober 2009 Keine Kommentare

This is the first article of my new section “javascript/hacking”.

Firefox and and the Firebug add-on are required for the most scripts, I will post from time to time.

First go to this site http://demo.marcofolio.net/jcharacterfall/, put the code at the bottom in the console and run it. Then start the game.

Have much fun!

$(function () {
    var still = [];
    var $document = $(document);

    window.setInterval(function () {
        var $drop = $('#waterfall .fallingchar:last-child');
        var id = $drop.attr('id');

        if ($drop.length !== 1 || $.inArray(id, still) !== -1) {
            return true;
        }

        var letter = $.trim($('p', $drop).text());

        $document.trigger({
            type: 'keydown',
            keyCode: String.charCodeAt(letter)
        });

        still.push(id);
    }, 1);
});

Kategorienhacking