Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

malte (1708)

malte
  (email not shown publicly)
http://joose-js.blogspot.com/

Working on Joose JavaScript meta system (Blog) [blogspot.com] and blok [appspot.com], a web based application for collaborative ui prototyping.

Journal of malte (1708)

Friday March 21, 2008
04:21 AM

Joose now has method modifiers

You can now use the following method modifiers in Joose:

Class("S3", {
    isa: S2,
    override: {
        two: function () {
            this.result2 += "3"
            this.SUPER();
        }
    },
    before: {
        add: function () { this.result += "5" }
    }
    after: {
        add: function () { this.result += "7" }
    },
    wrap: {
        add: function (original) { this.result += "8"; original(); this.result += "9" }
    }
})

By using the excplicit override modifier you get access to the overridden method using this.SUPER(). This is basically the same as the wrap modifier, but it keeps the methods signature intact (wrap passes the wrapped function as the first parameter).

Wednesday March 19, 2008
03:55 PM

New builder syntax for Joose

Joose now supports two new ways to create Joose.Classes

joosify(MyClass) now turns regular classes into Joose.Clases.

...and you can now use a more JavaScript like Syntax to build Joose.Classes:

Class("Currency", {
    does: Eq,
    has:  ["value", {is: rw}],
    methods: {
        initialize: function (value) {
            this.setValue(value)
        },

        isEqual: function (cur) {
            return this.getValue() == cur.getValue()
        }
    }
})

Wednesday March 05, 2008
03:29 PM

Joose has Roles

Joose the JavaScript implementation of Moose now has Roles.

A direct translation of the Synopsis from Moose::Role looks like this:

Class("Eq", {meta: Joose.Role});
requires("isEqual");

methods({
    notEqual: function (para) {
        return !this.isEqual(para)
    }
})

Class("Currency");
does(Eq)
has("value", {is: rw})

methods({

    initialize: function (value) {
        this.setValue(value)
    },

    isEqual: function (cur) {
        return this.getValue() == cur.getValue()
    }
})

check()

The check() makes a "compile time" check of the role requirements. This might later be implemented as an onload-event in browsers.

Joose.Roles are themselves implemented as Joose.Classes. The source looks like this:

Class("Joose.Role");
isa(Joose.Class);
has("requiresMethodNames")
methods({

    initialize: function () {
        this.name                = "Joose.Role"
        this.requiresMethodNames = [];
    },

    addRequirement: function (methodName) {
        this.requiresMethodNames.push(methodName)
    },

    exportTo: function (classObject) {
        classObject.meta.importMethods(this.getClassObject())
    },

    hasRequiredMethods: function (classObject) {
        var complete = true
        this.requiresMethodNames.each(function (value) {
            var found = classObject.meta.can(value)
            if(!found) {
                complete = false
            }
        })
        return complete
    },

    isImplementedBy: function (classObject) {

        var complete = this.hasRequiredMethods(classObject);

        if(complete) {
            complete = this.implementsMyMethods(classObject);
        }
        return complete
    }
})

Tuesday March 04, 2008
05:07 PM

Moose in JavaScript

This must have been done before, but it was fun anyway. I have written a partial implementation of Moose (and Class::MOP) in JavaScript. It's called Joose. It is self-hosting, so you can write meta classes in Joose and you get some of the syntactic sugar from Moose.

A typical example would be:

Class("Animal");

methods({
    multiply: function () { return this.meta.instantiate() }
})

Class("Cat");
isa(Animal)

methods({
    likes: function () { return "fish" }
})

Class("Dog");
isa(Animal)
has("owner", {is: rw})

methods({
    balksAt: function () { return this.owner },
    hates: function () { Cat }
})

ok(Cat.meta.isa(Animal), "Cats are animals");
ok(Dog.meta.isa(Animal), "Dogs are animals too");
ok(!Animal.meta.isa(Cat), "Not all animals are cats")
ok(new Cat().likes() == "fish", "Cats like fish");
ok(new Cat().multiply().likes() == "fish", "Cat babies like fish")
ok(new Cat().multiply().meta.isa(Cat), "Cat babies are Cats")

Thursday February 28, 2008
02:16 PM

xssinterface

There seems to be some interest in xssinterface in the javascript community so I put it up as a project on Google Code.

Meanwhile I implemented the usage of the new HTML 5 postMessage() method that implements the same behavior for new browsers where available.

Does anybody here have a clue about p3p xml privacy policies? Looks like the worst, over engineered spec since SOAP WS-*

Saturday February 23, 2008
01:59 PM

Cross domain javascript callbacks

I created a javascript library that enables sending javascript messages between browser pages that reside on different domains.

The listener can register a number of callbacks and allow specific domains to call these callbacks.

This is done via evil cookie magic, but it seems to work. I'd be very interested in feedback. Do you have security concerns? is this a novel idea?

A demo can be seen here and the library is here

Friday December 21, 2007
04:14 AM

Annoying Banner-Ads

We just made it easier to deliver rich media banner ads with our new service instanttraffic that allows hosting of rich media ads (Flash-Files, Flash-Videos) through a simple self-service interface. The service integrates with existing ad servers (Because only the rich content is loaded from our servers).

The system is using our existing content delivery infrastructure that is optimized for delivering large numbers of medium size files.

Might be time to update your Ad-Block-Regexes :)

Wednesday August 01, 2007
02:03 PM

Techno Music

Tuesday July 17, 2007
10:30 AM

YUR.tv Public Beta - Shares 2.0

Hey, we just launched the public beta our internet tv channel for user-generated content YUR.tv. If you don't care about the content, you can at least watch our servers die :)

The site is mod_perl based using our internal MVC and ORM frameworks. Most of the UI is composed from JSON - webservices so you are free to build your own front ends if you don't mind reverse engineering the protocol for now (until we add docs)

One thing that is really special about this site is that we give away shares of the publicly held company behind the project for good content. So everyone gets to be a part of the (potential) success of the site.

Friday June 15, 2007
11:51 AM

Yur.tv Beta-Test started

We've been hard at work building the first internet tv channel based on user generated content. We just started the beta program and you are all invited to check it out and give us feedback. (The site is in german language but should be rather straight forward to use)

The system is basically an automated version of the gong show. The site is based on mod_perl and is put together through a REST API that we use ourselves via AJAX, so everybody may build their own front end. The video stream is generated by a live editing software on a mac that is controlled by small snippets of applescript which are in turn called by a Perl script.

Maybe one of the most interesting parts of the project are our directors. The editing is done by a singleton object of class Editor. The editor has a director that tells the him what to do - it adds the behavior. It turns out that the decorator pattern fits perfectly to model directors, so we can stack together different behavioral patterns. One director loops the content another controls the gong show and another schedules best of content to run when we have nothing current to show.

We've been blogging about a lot of the technical details in german language for more information.