Archive for October, 2005

Next Safari Browser written in Python?

Friday, October 28th, 2005

Go to http://nightly.webkit.org/builds/ and download WebKit++SVG, then do this:

$ cat /Volumes/WebKit+SVG/WebKit+SVG.app/Contents/Resources/main.py
#!/usr/bin/env python

import os, sys
from Foundation import NSBundle
from LaunchServices.Launch import LSFindApplicationForInfo
from Carbon.CoreFoundation import kCFURLPOSIXPathStyle
kLSUnknownCreator = '\x00\x00\x00\x00'

def pathForName(appName):
    """
    Returns the file system path for an application by name.
    NOTE: You should include the suffix, as in "Python.app".
    """
    fsRef, cfURL = LSFindApplicationForInfo(kLSUnknownCreator, None, appName)
    return cfURL.CFURLCopyFileSystemPath(kCFURLPOSIXPathStyle).toPython()

frameworkPath = NSBundle.mainBundle().resourcePath().encode('utf8')

safariPath = pathForName('Safari.app')
if safariPath:
    safariPath = NSBundle.bundleWithPath_(safariPath).executablePath()
    os.environ['DYLD_FRAMEWORK_PATH'] = frameworkPath
    os.environ['WEBKIT_UNSET_DYLD_FRAMEWORK_PATH'] = 'YES'
    os.execve(safariPath, [safariPath] + sys.argv[1:], {'DYLD_FRAMEWORK_PATH': frameworkPath, 'WEBKIT_UNSET_DYLD_FRAMEWORK_PATH': 'YES'})

So the nightly builds are coded in Python ;-)

apache and lighttpd auth with Ruby on Rails

Thursday, October 20th, 2005

If you run a Ruby on Rails Web Application and in addition a trac or an subversion repository on the same host you might want to use a shared authentication database. With Apache you might use mod_auth_mysql and friends but that does not work with lighttpd. But you can create a htpasswd file on the fly. Let’s say your Person Object does the authentication and the people table has columns like username, passwd and csalt:

class Person  e
      logger.error(e)
    end
  end

  #protected
  def realpasswd
    read_attribute("passwd")
  end
end

Now, whenever a Person object is updated a htpasswd file should be created in the directory set by AUTHFILE. Now you can set in lighttpd 1.4.6 authentication rules like this:

auth.backend = "htpasswd"
auth.backend.htpasswd.userfile = AUTHFILE
auth.require = ("/trac" => ("method"  => "basic",
                            "realm"   => "Pi1 Web",
                            "require" => "valid-user"),
                "/svn"  => ("method"  => "basic",
                            "realm"   => "Pi1 Web",
                            "require" => "valid-user")
)

The same file also works in Apache. E.g.


   DAV svn
   SVNPath /var/svn/pi1
   # Limit write permission to list of valid users.

      AuthType Basic
      AuthName "Pi1 Web"
      AuthUserFile AUTHFILE
      Require valid-user

HackerX sux

Thursday, October 20th, 2005

Monday, October 17th, 2005

Saturday, October 15th, 2005

Reproduzierbarer Crash in http://twoday.net/nemesis/stories/1060585/

Friday, October 14th, 2005

Network breakage :-(

Tuesday, October 11th, 2005

autoconf on FreeBSD

Tuesday, October 11th, 2005

I recently created an autoconf enabled application on MacOS. When I wanted to recreate the configure script (”autoreconf”) on a FreeBSD Box it failed miserably. Turns out that you have to jump through some hoops to get a reasonable preformance out of autoconf. First you have to get some decent autoconf installation. Don’t rely on that stuff installed as dependencies by other ports:

(cd /usr/ports/devel/gnu-autovonf/ ; sudo make package)
(cd /usr/ports/devel/gnu-automake/ ; sudo make package)
(cd /usr/ports/devel/gnu-libtool/  ; sudo make package)

No ensure, that you use the newly installed autoconf (e.g. with bash):

export PATH=/usr/local/gnu-autotools/bin:$PATH

Now you should be all set:

$ autoreconf -v -i
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal
autoreconf: configure.ac: tracing
autoreconf: running: libtoolize --copy
libtoolize: `config.guess' exists: use `--force' to overwrite
libtoolize: `config.sub' exists: use `--force' to overwrite
libtoolize: `ltmain.sh' exists: use `--force' to overwrite
autoreconf: running: /usr/local/gnu-autotools/bin/autoconf
autoreconf: running: /usr/local/gnu-autotools/bin/autoheader
autoreconf: running: automake --add-missing --copy --no-force
autoreconf: Leaving directory `.'

Tuesday, October 11th, 2005

Fefe is blogging!

Tuesday, October 11th, 2005