P4/V~/_e2k( )/V57

Hello haXe/java!

/...

The java and c# compiler targets are already available in haXe's svn repository! Amazing!
Follow the instructions here to build haXe from source.

A small guide of how to create a hello world application using haXe/java and eclipse:

  • Right click in Package Explorer -> New -> Java project
  • Name the project as you want and click 'Finish'
  • Create main haXe class 'Hello.hx'
    class HelloJava {
        static function main() {
            trace("Hello world!");
        }
    }
  • To generate java source files into the 'src' directory run following command:
    haxe -java . HelloJava.hx
  • Right click the java project in the Package Explorer -> Run As -> Java Application
    Which prints:
    App.hx:3: Hello world!

Since i've done some android programming lately i am f* happy about the java target.
Java coding is ok, it simply works, but compared to haXe it feels very strict and like a oop disaster.
HaXe gives me much more freedom to express my ideas.

Also the possibility to run some of my haXe projects on google app engine is awesome!

1000x thanks to Cauê Waneck for developing this!

Cyberchrist blog engine

/...

This blog is now powered by cyberchrist, a small tool i've written (haXe/neko) to generate static html sites from template files.
The syntax is a (messy) mix up of haxe.Template and a fork of the wiki parser hxwiki is using.
The generated output does not use any serverside technologies, therefore can get hosted by providers which only allow static content like github-pages.
I've coded this because the wordpress installation felt so inflated for my lazy blogger ass.
First i've tried jekyll, but waiting seconds for generating some text files is ridiculous! ;-) I knew ruby is slow but fuuuk!
Currently it takes about 120ms to generate all content of this blog and i guess just a fraction of this if i compile the engine to C++. Source code will get published soon (or later, or never).
cyberchrist.jpg

Videocrank at WUK/Vienna

/...

The videocrank (called 'videokurbel' here), a experimental art project i've written the software for last year, will perform at the 'Zukunft war jetzt' happening at WUK on 28 of january.

The software running it is written in haXe/flash although i do have a NME version but this one is more or less unusable cause of extraordinary memory consumption and/or slow response on changing the video framesets (how sad!).

Votes of a next generation intoxicate us, before we end up in the middle of a climate conference.
A generator helps to define our future, even while we try to crank the wheel of time.
They reflect and compare us with their performances and production conditions.
Explore the next generation is in itself future was now, the future is yesterday, the future will have been.

http://www.wuk.at/event/id/15629

Mutter digital

/...

lineare muster werden zyklisch bedeutungslos bis die wahrnehmung ihren wohltätern verkauft wird,
zum preis des verlustes der möglichkeit zwischen bewusstsein und unbewusstsein zu unterscheiden.
das leben wird zu kunst, indem es zur realität wird.
es wächst völlig in abhängigkeit einer gekreuzten wahrnehmung, welche leichter zu manipulieren und zu verstehen ist.
endgültig überzeugt bricht die wissenschaft der möglichkeiten und logik in einer sensorischen halluzination der zuhörerschaft.

protagonisten verpflichten sich zu sadismus und verdrehter freude.
jemand krümmt sich gegen andere, bemüht sie zu übertreffen, während er eine stimmung daraus macht.
jemand wird zum anderen, dann wird jeder bedeutungslos im leben und unsterblich im tod.
gemeinsames leben, in medien, vorne und hinten; kollektive verfangen sich in der stimulanz des ganzen, hilflos,
ohne den unterschied zwischen ihnen selbst und ihren fernseh-familien zu kennen.

atmend wie ein heizkörper im kühlhaus;
geschlechtstrieb läuft amok in einer ungefesselten, kabelgesteuerten welt wo alles zu einer betet: mutter digital.
sinne werden von bildern des lebens überschwemmt: brutalität, penetration, sadomasochismus.
realität ist eine pure männliche umgebung beschädigter einzelteile der sinnlichkeit, die ultimative flucht vor der mutter.
angst vor der kastration wird extrem im sound welcher vom hochmut selbst spricht.

wir geben leichte spastiken und verdrehtheiten in das fleisch der kollektiven sinne;
erinnern uns eisern daran eine mutter oder eine gestapo haben zu wollen, welche sich nicht unterscheiden.

dieser weg führt uns zu einem platz wo das leben kunst nicht länger imitiert.
an diesem platz wird leben zur identifikation und identifikation lebt in ewigkeit immer neu wahrgenommenen fleisches.

super-egos überwiegen wenn wir sie betrachten, sehen uns, sehen unser eigenes leben und sterben wie königliche charaktere,
assosziationen mit einer joystick pistole schießend.
gerade geboren - atmend auf video ist ein patriachalisches ideal:
das der masse nicht anvertraut werden kann die realität zu gestalten.

ZOD 20

Google chrome omnibox extensions

/...

Two google chrome omnibox extensions for loved, free, open source projects i am dedicated to got released at the google webstore. Both are written in haXe/javascript using extern type definitions (we are maintaining) available at github and haxelib.

dox_promotional_small.jpg
DoX.chrome, for searching haXe's standard library.
Install | Source

xepsearch_promotional_small.jpg
XEP.search, for searching XEPs (XMPP Extension Protocols)
Install | Source | Video

For the extensions options pages, i developed a little tool to generate native looking user interfaces with search functionality and whatnot from structures (See the DoX options page for example).

Both extensions are already useable and in release state but there is a long list of features and ideas i wanna add. Stay tuned!

Peano (space-filling) curve

/...

peano_curve_small.png

Peano curve rendered with flash.

In mathematical analysis, a space-filling curve is a curve whose range contains the entire 2-dimensional unit square (or more generally an N-dimensional hypercube).

class Curve {
    public var posArray : Array<Point>;
    var pos : Pos;
    var fac : Point;
    var arl : Int;
    public function new() {
        pos = { x : 0.0, y : 0.0, angle : 0.0 };
        posArray = new Array();
        fac = { x : 3.0, y : 3.0 };
        arl = 11;
    }
    public function pea( g : Int, n : Int ) {
        if( g == 0 ) {
            pos.x += fac.x * Math.cos( pos.angle + n );
            pos.y += fac.y * Math.sin( pos.angle + n  );
            posArray.push( { x : pos.x, y : pos.y } );
        }
        if( n < 0 ) {
            pos.angle = pos.angle + g * Math.PI / 2;
        } else if( n > 0 ) {
            var a = new Array();
            for( i in 0...arl ) { a.push(0); }
            for( k in 0...arl ) {
                var v = a[k];
                var t : Int = bint( (k+1)%3 != 0 );
                pea(
                    g * t * ( 1-2*(k%2) ),
                    t * ( ( (3*bint(k>5))+(-2*bint(k>5)+1)*((k+1)%3)) * n - n - 1 )
                );
            }
        }
    }
    static inline function bint( b : Bool ) : Int return b ? 1 : 0
}

HXMPP 0.4.4 released

/...

HXMPP 0.4.4 introduces support for data/file transfers.
Two transports are implemented:

  • SOCKS5 Bytestreams
    Creates a socket server to which the recieving entity connects and handshakes using the SOCKS5 protocol.
    Full support on neko, cpp, nodejs, air; flash supports file recieving only.
    No support on php since it would block the XMPP stream.
  • Inband bytestreams
    Data gets split into chunks, base64 encoded and sent inband in the XMPP stream.
    Use this method as last ressort if the socks5 bytestream fails or is not supported by the recieving/sending entity only.
    Supported by all HXMPP targets.

SITransfer/SIListener classes are used to negotiate the transfer method.
An example i’ve used to test the implementation is available in the hxmpp.examples repository.

HXMPP 0.4.3 released

/...
  • Now available on github
  • Packet-ID-collectors are processed before others:
    Most XEPS do just single IQ packet get/set -> result/error requests, but cause of XMPPs pushing nature must also listen for requests from other entities. The new style allows to savely use id filters on outgoing packets and listeners in specific namespaces at the same time without conflict. The listeners won’t get called if the packets has a awaited id cause filterd and blocked before.
  • WebSocket support for flash using javascript glue
  • ChatState notification fix
  • Roster rewrite (was f* messy)
  • Added TLS dependencies for flash and neko
  • StartTLS (except neko, air)
    Use port 5222 for secure (and unsecure) connections. For flash you have to set the -D TLS compiler flag.
  • TLS flash socketbridge supports unsecure connections as well
  • Added a flashpolicy server class (needed for (socket based) filetransfers to flash entities.
  • fixes,fixes,fixes

HXMPP 0.4.2 released

/...
  • Added to haxelib
  • The ‘Stream’ class takes only one parameter now, a ‘Connection’ object … the JID of your account gets now passed into the Stream.open method.
  • Server components require -D ‘JABBER_COMPONENT’ compiler flag
  • TLS flash-socketbridge for javascript
  • TLS support for nodejs
  • Dirty hacks for flash to be compatible with haXe 2.06 (issue172)
  • Added a terminal tool to register client accounts by hand
  • Fixes and minor improvements

I’ve also created a repo at github to collect example usages and tests:
http://github.com/tong/hxmpp.examples

Open source updates

/...
  • HXMPP updates
    • Full adobe air2 support (including native, secure air2 socket connections).
    • Added support for websocket connections (javascript only)
    • Minor fixes
  • HXMPP.lop test implementation
    The LOP stuff is in the HXMPP repo since months, this is just an example usage.
    The application consists of a javascript villein (a anonymous XMPP client) living in the browser and a farm running on the nekoVM.
    The villein:
    • Spawns hscript virtual machines on the farm
    • Sends some (h)script
    • Farm computes the script and sends back the result.
      Variables live as long until the VM gets killed by the villein.
  • OWL, a nodejs XMPP server
    The project is in a very early state but already doing basic internal instant messaging (no S2S). I am f* enjoying the development process, since i got a good overview on the XMPP protocol over the last couple of years (time goes by in ludicrous speed) while developing the client library and don’t have to read XMPP specs that much .. straight forward coding .. this will change when i get to the S2S stuff. brrr.
    Of course written in haXe using the nodejs type signatures from blackdog and (currently only) a redis backend.
    This project accepts and encourages contributions!
  • Tsunami
    A small framework for navigating on websites without reloading using #s (hashes). This is forked from the serverside mtwin templo library (example).
    What sux is that webkit browsers destroy pending XHR requests on hash tag URL changes therefore it breaks BOSH connections -> fail! Firefox does it right.

ROAR 1000

/...

ROAR, our public, XMPP powered media micro blog, broke the 1000th post barrier some days ago. My plan was to write a new version before that, but busy as (n)ever ..
The XMPP roboter seems to be pretty stable .. didn’t get down since months (runs on nekovm using a sqlite database).
You can add roar@jabber.spektral.at to your roster to post non-anonymously and directly from you jabber client.
The bot accepts your presence subscription automagically.

Currently following input is supported:

  • Image links (URL has to end with .png, .jpg or .gif)
  • YouTube videos (simply copy URL from the browser bar)
  • Vimeo videos (simply copy URL from the browser bar)
  • Ogg audio files ( .ogg -> html5 audio tag)
  • Ogv video files ( .ogv -> html5 video tag)
  • HTTP links

http://roar.disktree.net

Open source updates

/...
  • Extern classes for adobe air2 (fork of the adobe-air haxelib project to support runtime version 2 (javascript+flash))
  • Extern classes for the android scripting environment SL4A (formerly known as ASE)
  • HXTLS
    Not really open source, just external haXe classes for a proprietary flash TLS library, but fully functional. Already added to HXMPP.
  • Wikileaks-in-realtime
    HXMPP/Collecta powered website for updates on term ‘wikileaks‘.

Open source updates

/...
  • HXRTP, ORTP bindings for the nekoVM
    Allows you to stream timecoded data using UDP (just single streams right now). Implemented this to toy with jingle-RTP in the future.
  • HXSSL, updated the neko-openssl-wrapper in need of secure socket connections.
  • HXMPP0.4.1
    • nodejs support using hxNode
    • Adobe AIR2 support (compiled to javascript)
    • SSL support for neko
    • LOP (linked process protocol)
    • Avaiable on haxelib
      HXMPP.collecta, a simple class for the HXMPP library to use the collecta XMPP (pubsub) API.

Open source updates

/...

ROAR version 7

/...

A new version of ROAR, our public microblogging web app is now online.
Its a complete haXe/javascript rewrite using BOSH (no SWF bridge for the socket connection anymore).

http://roar.disktree.net

HaXe/XMPP remoting

/...

I have added a (async) haXe remoting remix to the HXMPP library using XMPP as transport, and created following example to test it:

The app:

  • embeds the same SWF twice in a HTML site
  • the SWF logs into the jabber server with passed account information using SASL-MD5 authentication (password is hidden)
  • creates an instance of the application
  • create a haXe remoting host in context of the instance to listen for incoming calls.
  • create a haXe remoting proxy in context of the instance for outgoing calls.
  • on button click:
    • creates random values for the next circle to add to the other entities canvas
    • adds a circle to the remote entities canvas by calling a function on the proxy

A great benefit of HXR (haXe-remoting) over XMPP is that EVERY entitiy/target (also clients) can act as remote host. Which means i can call methods on a client from any other entity (a server or another client). Pretty cool for round based games and stuff.

Important thing missing is a access model for the remote host.
Currently every entity is allowed to call methods.
(Workaround would be be to add a IQ/HXR filter to block remaing packet collectors)

99 bottles of beer

/...

Here is my haXe submission to the 99 bottles of beer song collection.
( The website holds a collection of the song ‘99 bottles of beer’ in 1311! programming languages. )
I got annoyed of a comment on the previous haXe version claiming that its twice as long as the COBOL version.

It builds the complete song/string before output, so i was able to do some performance measurements:

Run program 100 times:

  • neko: 0m0.618s
  • cpp: 0m1.106s
  • php: 0m2.292s
  • js (rhino): 0m41.954s

Run 1000 times in a loop (internal):

  • flash-standalone(10.0.32.18): 0m0.277s
  • flash-plugin(10.0.32.18,firefox3.5.5): 0m0.294s
  • php: 0m0.291s
  • js (rhino): 0m0.474s
  • neko: 0m0.529s
  • cpp: 0m8.793s

Apache/Openfire BOSH setup

/...

Since HXMPP supports BOSH connections (flash/js) it’s time to write a little setup instruction….
In my (local) case for apache2/openfire 3.6.4 on ubuntu 9.04.
What has to be done is to be able to connect your client to the BOSH adress of your jabber server. Default on openfire is http://localhost:7070/http-bind/

Your apache server doesn’t know about your jabber server, so you have to setup a proxy to forward requests:
http://localhost/jabber/ > http://localhost:7070/http-bind/

Here we go:

  • Activate the mod_proxy apache module if required
    sudo ln /etc/apache2/mods-available/proxy.load /etc/apache2/mods-enabled
  • Add following line to proxy.load for loading the module

    LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so
  • Add the proxy directive to the host settings in your http.conf

    ProxyRequests Off
    ProxyPass /jabber http://localhost:7070/http-bind/
    ProxyPassReverse /jabber http://localhost:7070/http-bind/
    ProxyPass /jabbers http://localhost:7443/http-bind/
    ProxyPassReverse /jabbers http://localhost:7443/http-bind/
  • Restart apache

    sudo /etc/init.d/apache2 restart

Thats it!
Using HXMPP, you can now create a connection by passing in the path in the constructor, like:

var cnx = new BOSHConnection( “myjabberserver.net”, “127.0.0.1/jabber/” );

HTML5 audio/video .ogg extension quirks

/...

While adding support for wrapping media files into the according html5 tag (audio or video) to my realtime microblogging application at roar.disktree.net i discovered a nasty situation as follows:
How to know if a file with the ‘.ogg’ extension is video rather than audio from within javascript ?

Possible workarounds to distinguish (in case of my application):

  • Read the file header serverside and save the result somewhere. Ok, but requires extra work.
  • Try to discover filetype from the ID3 tag. Not save.
  • Read the file header in flash (which is able to read data at byte level). Ok for files served from same domain only.

Anyhow, no solution for javascript, so it would be good to agree on:
Name audio files ‘ogg’, video files ‘.ogv’ and tell everybody to do so!

Or am i overlooking something ?

Push style microblogging

/...

A small project i am lately working on is a microblogging service, utilizing jabber/XMPP to push new messages (sent from a jabber client) to the users browser in realtime without need of page reloading.
It uses anonymous authentication, which allows to consume it without logging into a jabber account.

HaXe really unfolds its power for this project since i target 4 different platforms from one language and use the same jabber library clientside and for the commandline bot. Flash for the jabber client, JS for printing html, PHP for delivering HTML and nekoVM for the jabber bot.

Go test it: http://roar.disktree.net

The site uses the css3 font-face feature, .. a compatible browser is needed to view the site correctly!
(displays nice in firefox3.5 and safari, shitty in opera)

Rare spektral server photo

/...

spek_9_9.jpg

One of the very rare shots of our shitty, energy unfriendly hardware, hosting the public jabber.spektral.at service, taken by zmo at the last crash/reboot some days ago (someone drilled a electric cable, no USV!).
(computer left/below runs the openfire jabber server)

DJ mix on air

/...

A fresh electro-house dj-mix of mine will be aired at the substral show on radio helsinki tonight (starting 22:00 CET).
Listen 92,6FM (graz/austria only), internet stream or download.

Playlist:

  • Soulwax - Most Of The Remixes - Gravity’s Rainbow
  • ? - Leisure - Armageddon_Edit
  • Soulwax - Most Of The Remixes - Lovelight
  • Boys Noize - Lava Lava - My Head (Para One Remix)
  • D.I.M. - Is You (JFK Remix)
  • Teenage Bad Girl - Cocotte - Cocotte
  • Teenage Bad Girl - Cocotte - Hands of a stranger
  • Justice - Waters of Nazareth (Erol Alkan’s Durrr Durrr Durrrrrr Re-Edit)
  • Fake Blood - Little Boots - Stuck on Repeat
  • Masterkrft - Goose - Bring It On (JFK)
  • Shadow Dancer - Landlines Original Mix
  • Buraka Som Sistema - Kurum (Dj Manaia Remix)
  • Shadow Dancer - Lower Left
  • Guns n Bombs - Riddle Of Steel
  • ? - Unstoppable - Tom Wrecks Remix

Enjoy!

DOWNLOAD

WeFeelFine jabber bot

/...

wefeelfine.gif

I’ve created a jabber bot for the WeFeelFine API.
We Feel Fine is an exploration of human emotion on a global scale.
Since August 2005, We Feel Fine has been harvesting human feelings from a large number of weblogs.
Every few minutes, the system searches the world’s newly posted blog entries for occurrences of the phrases “I feel” and “I am feeling”. When it finds such a phrase, it records the full sentence, up to the period, and identifies the “feeling” expressed in that sentence (e.g. sad, happy, depressed, etc.)
You can add wefeelfine@jabber.spektral.at to your contact list and request the bot with chat (or normal type) messages like:
returnfield, returnfield,… $ option=value+option=value+…
.. where the returnfields specifiy the data which should get loaded (sentence is default).

  • imageid
  • feeling
  • posttime
  • postdate
  • posturl
  • gender
  • born
  • country
  • state
  • city
  • lat
  • lon
  • conditions

Key-value pairs after ‘$’ specify optional settings, which are:

  • limit=0-1500 (num feelings to return)
  • feeling=a-z (specify feeling)
  • gender=0/1 (0=female,1=male)
  • conditions=1-4 (1=sunny, 2=rainy, 3=snowy, 4=cloudy)
  • counry=a-z
  • state=a-z
  • city=a-z
  • postdate=date (YYYY-MM-DD)
  • postmonth=1-12
  • postyear=0-2009

The bot will return 5 values if no ‘limit’ option is specified.
Type ‘help’, ‘fields’ or ‘options’ to display the possible request fields.

Here are some examples:

"Give me the most recent 5 sentences from vienna":
$city=vienna

"Give me the last two sentences from people in canada who feel loved":
$limit=2 + feeling=loved + state=canada

"Give me the last 3 sentences plus city, gender, latitude and longitude from people in paris who feel angry":
city,gender,lat,lon $ limit=3 + city=paris + feeling = angry

HXMPP Personal Event Protocol

/...

The latest XEP HXMPP implementes is the Personal Eventing Protocol.
This specification defines semantics for using the XMPP publish-subscribe protocol to broadcast state change events associated with an instant messaging and presence account. This profile of pubsub therefore enables a standard XMPP user account to function as a virtual pubsub service, easing the discovery of syndicated data and event notifications associated with such an account.

You can communicate following information:

  • Tune, Communicate information about music to which a user is listening
  • Mood, User moods, such as whether a person is currently happy, sad, angy, or annoyed
  • GeoLocation, Information about the current geographical or physical location
  • Activity, Extended presence data about user activities

HXMPP Publish Subscribe

/...

Today i’ve added PubSub support to our XMPP library.

Pubsub is a notification system like web syndication (RSS, Atom, ..) for the XMPP protocol with some great advantages:

  • Realtime. Unlike regular web syndication, pubsub is a pushing system.
    As soon as a new item is published at a node, the service notifies all registered subscribers. This is the last hurdle (in terms of time) evolution of global information technology is overcoming by delivering information for human unrecognizeable delays (millisecondes). Unlike rss, email,.. more like global smoke signals. )
  • Bandwith. New information is pushed only once.
    Assume you have 50 feeds on your watchlist and every feed is about 10k in size and gets polled every 30 mins (the default configuration time in my RSS-reader), .. you end up having 1mb polled in 1h (720mb/month) mostly for /dev/null space since a lot of feeds just update in day intervals. This produces unecassery cost$ if you don’t have a flatrate connection (keyword mobile). Not to mention the extra costs for network transfer at servers (and power consumption)!
  • Configuration is built into the service itself, not in the software you use for.
    Publishers are able to config their service to their needs (like: manage subscription requests, cache items, not routing events to offline storage, block users,..).
    Subscribers can config their subscriptions, for example: to get just the title of the published data (bandwith again!) or to set the presence types which are allowed to receive notifications.

Overall the current system (RSS stuff) is doing it completely wrong and hopefully gets dropped and replaced by pubsub like systems very soon!

Fax mayhem

/...

Tape together a few sheets of black construction paper and start faxing to the targets. When the first page goes through, roll it back and tape it to the other end of your sheet to form an infinite loop of black construction paper.
Then sit back and watch the mayhem begin.
Use any and all fax machines at your availability - the more the merrier!

LOL! I hope to get access to an analog fax machine soon.

Tong defined

/...

A Tong can perhaps be defined as a mutual benefit society for people with a common interest which is illegal or dangerously marginal—hence, the necessary secrecy.

If a Tong is organized around a special interest (especially an illegal or risky or marginal interest) it certainly has the right to compose itself according to the “affinity group” principle. If secrecy means (a) avoiding publicity & (b) vetting possible members, the “secret society” can scarcely be accused of violating anarchist principles. In fact, such societies have a long & honorable history in the anti-authoritarian movement…

Many non-authoritarian organizations have foundered on the dubious principle of open membership, which frequently leads to a preponderance of assholes, yahoos, spoilers, whining neurotics, & police agents.
Some will call this an elitist attitude, but it is not—at least not in the C. Wright Mills sense of the word: that is, a small group which exercises power over non-insiders for its own aggrandizement. Immediatism does not concern itself with power-relations;—it desires neither to be ruled nor to rule. The contemporary Tong therefore finds no pleasure in the degeneration of institutions into conspiracies. It wants power for its own purposes of mutuality. It is a free association of individuals who have chosen each other as the subjects of the group’s generosity, its “expansiveness” (to use a sufi term). If this amounts to some kind of “elitism,” then so be it.

HXMPP 0.2.1 released

/...

... introducing a lot of fixes and minor additions.
Sadly there are some important things on my TODO list missing for the planned version 0.3.

Currently i am using 3 experimental applications based on the library:

  • A git respository bot, which sends me ( and just me.lol ) a message after a succesful commit. (neko)
  • A multi user chat bot. (neko)
  • A multi user chat service at jabber.spektral.at. (flash9)

For now this is just an testing ui for hxmpps muc implementation. Theoretically you can use any jabber account for this, practically not, since most jabber servers does not provide a flash policy server to allow connections to a different domain.
Please bother your jabber server administrator to install one !!
You can test your host for this with: python -c ‘print “%c” % 0′ | nc HOSTNAME 843

[ source ][ git://83.64.208.21/hxmpp.git ]

Everyday eclipse

/...

With todays release of an open soure eclipse plugin for the haXe language i thought it might be useful to list some eclipse shortcuts i use everday.

CTRL + SHIFT + R
Quickly open file

CTRL + Q
Jump to last edit location

ALT + Up/Down Arrow
Move current line(s) up/down

ALT + Left
Backward history

CTRL + E
Open list of current opened files in the editor

CTRL + F6
Show ‘jump to file’ menu

CTRL + M
Maximize/minimize active editor

CTRL + SHIFT + L
Shows you a list of your currently defined shortcut keys.

Array sort performance

/...

Some performance comparisons on sorting arrays( 100 x random float array with length of 1000 ).

  • nekoVM
    • haXe Array.sort: 5.4
    • Quicksort: 0.3
    • Insertionsort: 7.5
  • firefox 3.0.3 js
    • haXe Array.sort: 6.4
    • Quicksort: 0.2
    • Insertionsort: 4.2
  • flashplayer10
    • haXe Array.sort: 0.2
    • Quicksort: 0.1
    • Insertionsort: 7.5
  • php 5.2.4
    • Fatal error: Maximum execution time of 30 seconds exceeded on all tests so i tried with just 10 arrays instead of 100:
    • haXe Array.sort: 15.3
    • Quicksort: 4.6
    • Insertionsort: exceeded
class Quicksort {
    static var arr = [4,8,0,3,9,1,5,2,6,7];
    static function quicksort( lo : Int, hi : Int ) : Void {
        var i = lo;
        var j = hi;
        var buf = arr;
        var p = buf[(lo+hi)>>1];
        while( i <= j ) {
            while( arr[i] > p ) i++;
            while( arr[j] < p ) j--;
            if( i <= j ) {
                var t = buf[i];
                buf[i++] = buf[j];
                buf[j--] = t;
            }
        }
        if( lo < j ) quicksort( lo, j );
        if( i < hi ) quicksort( i, hi );
    }
    static function main() {
        quicksort( 0, arr.length-1 );
        trace(arr);
    }
}

HXMPP 0.2

/...

I am very pleasant to announce version 0.2 of our jabber/xmpp library for building xmpp based clients and components. Its written in haxe and cross targets flash9+, js, php and nekoVM.

Haxe seems to be the a superb platform for this kind of thing, since it targets 2 very attractive platforms in the browser (flash, js), but can also create command line based applications like server-components or bots with very little to null difference in code. The only thing that changes from platform to platform is the socket implementation.
I dont have implemented BOSH so far, but you can use the included (invisible) flash9-socket-bridge for connecting to the server with js applications through “regular” sockets. Which has the drawback of the flash player dependency but gives a small (13k), stable connection manager that often feels much more reliable than hakish BOSH connections, at least in firebug;) And…, since disktree.net uses flash in most web based applications anyway, the dependency drawback is kinda irrelevant.

Check the demos in /demos/*.hx for usage.
Hope to see some nice applications! The possiblilities are endless!

[ README ]
[ DOWNLOAD ]
[ API-DOC ]
[ 83.64.208.21/home/tong/git/hxmpp.git ]

Example of usage from plain javascript (without the need of the haxe compiler).
http://paste.disktree.net/34

I am currently working on a programable mutliuser chat bot named ZOD.
Visit haxe@conference.jabber.org, with luck, you may experience the impregnation of an artificial intelligence, live and in realtime.

Flash policy nekoVM server written in neko

/...

A simple nekoVM flash-policy-server written in neko, for all minimalists :-)

default_host = "127.0.0.1";
default_filepath = "flashpolicy.xml";
default_port = 843;
// READ CMD ARGS
args = $loader.args;
host = if( args[0] != null ) args[0] else default_host;
port = if( args[1] != null ) $int( args[1] ) else default_port;
filepath = if( args[2] != null ) args[2] else default_filepath;
// READ POLICY FILE
try 
    policyfile = $loader.loadprim( "std@file_contents", 1 )( filepath )
catch e {
    $print( "Cannot find policyfile at: " + filepath );
}
if( regexp_match( regexp_new( "cross-domain-policy" ), policyfile, 0, $ssize( policyfile ) ) == false ) {
    $print( "Invalid policy file: "+filepath+"\n" );
}
// RUN SERVER
$print( "Starting flash-policy server ...\n" );
socket = socket_new( false );
socket_bind( socket, i32_new( host_resolve( host ) ), port );
socket_listen( socket, 10 );
while( true ) {
    client = $loader.loadprim( "std@socket_accept", 1 )( socket );
    info = $loader.loadprim( "std@socket_peer", 1 )( client );
    ip = $array( host_to_string( info[0] ), info[1] );
    buf = $smake( 23 );
    try
        numbytes = socket_recv( client, buf, 0, $ssize( buf ) )
    catch e {
        $print(e);
    }
    input = $ssub( buf, 0, numbytes-1 );
    if( input != "<policy-file-request/>" ) {
        $print( "Invalid request from: "+ip+"\n" );
        try socket_write( client, "FuckYou\n" ) catch e {}
        socket_close( client );
    } else {
        try socket_write( client, policyfile ) catch e {}
        try $loader.loadprim( "std@socket_send_char", 2 )( client, 0 ) catch e {}
        socket_close( client );
        $print( "Policy sent to: "+ip+"\n" );
    }
}

fpserver.neko

Flash policy nekoVM server

/...

The changed security settings in flash player >= 9,0,124,0 does not allow you to make a socket connection directly to a server without first obtaining explicit permission from that server in form of a policy-file-request. Follow this article for more information and the flash-policy servers written in perl and python adobe is providing.
I thought it would be nice to have a neko one, so it shall be developed ( using haXe of course ). Thanks to the neko.net.ThreadServer class writing a multi threaded socket server is an easy task.
[flash-policy-server-source.zip]
This could easy be extended with db-logging, .., whatever.
Follow this link for a neko.net.ThreadServer tutorial.