Dial from Address Book with X-Lite SIP Client

Thursday, August 24. 2006
0 comments
0 trackbacks

I created an installer for my old SIP Dialer.

Download here: DialSIP.zip

by Stefan LH

Recording sound with QuickTime?

Monday, August 14. 2006
0 comments
0 trackbacks

This is getting boring. I am investigating Sound recording in QuickTime since yesterday and it sucks. I usually like developing in c, but the QuickTime api is a dangerous beast for beginners. Not that it's not logical or something, but it's amazingly hard to find a starting point to get at least "Some" result. All I want to do is record a QuickTime Track and add that to a Movie. Sounds easy, ist hard. There is some sample code from Apple which usually does a lot of nested sound and video stuff or has amazingly huge structs.

How about:

mySoundTrack=[QTSoundTrack soundTrackWithSomeInitData:dada];
[mySoundTrack record];
...
[mySoundTrack stop];

Most of the time I would not need anything else... Thanks for listening :p

by Stefan LH

Testing screencasts: Make a tar.gz file

Tuesday, August 8. 2006
0 comments
0 trackbacks

Screencast on how to make a tar.gz (or tgz file)

This is primarily an experiment, take a look!

by Stefan LH

Serendipity Zooomr Plugin

Thursday, August 3. 2006
0 comments
0 trackbacks

The Box to the right: "New Photos" uses my brand new Zooomr plugin. It's my first public plugin and I am not sure if it's done 100% right. Check it out and use the comments to tell me what you think and where you are using it.

[EDIT] Updated to version 0.2

[EDIT] The plugin is now included in the "Unified Sidebar Image Display" plugin

serendipitypluginzooomr.tar.gz

by Stefan LH

Convert source to syntax-hilighted HTML in TextMate

Friday, July 28. 2006
0 comments
0 trackbacks

Here is a TextMate Command to convert JavaScript Source to syntax highlighted HTML. It does work with every language supported by enscript. Just change -Ejavascript to -Eyourlanguage. Below is the source as well as an example. (I used the php extensions for enscript) I have a list of all supported languages in the long version of this article!

Download SyntaxHilight.tmCom

#!/usr/bin/env php
<?
if ($fp=fopen("php://stdin","r")) {
    $text="";
    while (!feof($fp)) {
        $text.= fread($fp,4096);
    }
    fclose($fp);

    $command = '/usr/bin/enscript -q -Ejavascript -p - -Whtml --color=emacs';

    $descriptorspec = array(
       0 => array("pipe", "r"),  // stdin is a pipe that the child will read from
     1 => array("pipe", "w"),  // stdout is a pipe that the child will write to
     2 => array("file", "/dev/null", "a") // stderr is a file to write to
  );

    $process = proc_open($command, $descriptorspec, $pipes);

    fwrite($pipes[0], $text);
    fclose($pipes[0]);

    $result="";
    while (!feof($pipes[1])) {
        $result.= fread($pipes[1],4096);
    }
    fclose($pipes[1]);

    proc_close($process);

    $res = preg_match ('/<PRE>(.+)<\/PRE>/s',$result, $hits);

    $html=$hits[1];

    $clean = preg_replace ('/<font color="([^"]*)">/i','<span style="color:$1;">', $html);
    $clean = preg_replace ('/<b>/i','<span style="font-weight:bold">', $clean);

    $clean = preg_replace ('/<i>/i','<span style="font-style:italic;">', $clean);

    $clean = preg_replace ('/<\/[^>]*>/i','</span>', $clean);

    echo '<pre>'.$clean.'</pre>';
}
?>

[ continued ... ]
by Stefan LH

Smallest JavaScript AJAX library ever!

Thursday, July 27. 2006
5 comments
0 trackbacks

I have built the smallest, easiest and fastest JavaScript AJAX library ever. Inspired by moo.ajax, but without the need for prototype or any other external library - the file has 779 bytes without the comments, but with all formatting in place and some pretty long function and variable names. As presented here it only returns the responseText, but you could easily change that to the full XMLHttpRequest object.

Here is how it works:

  • create a callback function
  • call microAjax: microAjax("url", callbackfunction)
  • That's it, your callback function will be called with the response text as parameter

[edited] I have added a new function - you can now add a post Body as last parameter, but it's optional!

Download microAjax.js

Easy? No?

// microAjax by Stefan Lange-Hegermann
// this code is in the public domain
// you can do with it whatever you want!

function microAjax(url, callbackFunction)
{
    this.bindFunction = function (caller, object) {
        return function() {
            return caller.apply(object, new Array(object));
        }
    }

    this.stateChange = function (object) {
        if (this.request.readyState==4) {
            this.callbackFunction(this.request.responseText);
        }
    }

    this.getRequest = function() {
        if (window.ActiveXObject)
            return new ActiveXObject('Microsoft.XMLHTTP');
        else if (window.XMLHttpRequest)
            return new XMLHttpRequest();
        else
            return false;
    }

    if (arguments[2])
        this.postBody = arguments[2];
    else 
        this.postBody="";

    this.callbackFunction=callbackFunction;
    this.url=url;   
    this.request = this.getRequest();

    if(this.request) {
        this.request.onreadystatechange = this.bindFunction(this.stateChange, this);

        if (this.postBody!="") {
            this.request.open("POST", url, true);
            this.request.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
            this.request.setRequestHeader('Connection', 'close');
        } else {
            this.request.open("GET", url, true);
        }

        this.request.send(this.postBody);
    }
}
by Stefan LH

Using Zooomr

Tuesday, July 18. 2006
0 comments
0 trackbacks

kutter After some problems with getting Version 2.0 running today Zooomr (yes, that's three "o"s). I will migrate my photos from Flickr to Zooomr, because they are giving away free Pro-Accounts for Bloggers. I will post a Zoomr Review here ASAP.

by Stefan LH

Redesign in Progress

Thursday, July 13. 2006
0 comments
0 trackbacks

I am currently designing my own Serendipity Template (Theme) for blog.blackmac.de (you are currently seeing version 0.1). There are still some Bugs, but I think it looks pretty cool and you can even collapse the sidebar widgets!


[ continued ... ]
by Stefan LH