actionscript-q (as-q) integration

 

Flex vs Flash Disclaimer

Here I will be talking about Adobe Flex, which many confuse with Adobe Flash. Flash is a tool to design annoying banner ads. Flex is the powerful environment (ActionScript language+rich set or visual components+virtual machine) where one can build, for example http://examples.adobe.com/flex3/devnet/dashboard/main.html or http://examples.adobe.com/flex3/devnet/networkmonitor/main.html.

And, of course the fact that Adobe tried to rename Flex back to Flash not long ago doesn't help to avoid the confusion...

as-q Library

as-q is an ActionScript library that allows Adobe Flex applications to interact with kdb+ (like c.java or c.cs do). The idea behind this project is to be able to leverage UI capabilities of Flex in order to visualize historical and real time kdb+ data.

Calling q from ActionScript is very simple:

    var q:c=new c(host, port, user);
    q.ksync("select time, totvol, price from trade ...", this, "trades");

When response from kdb+ arrives, "trades" setter is called (note that Flex is an event-driven asynchronous environment):

    public function set trades(dict:Object):void {...}

Asynchronous call (response ignored):

q.kasync("x:1");

Below are two sample applications that use as-q library. I am also attaching binaries for each application. Binaries are not signed, so you may receive an "unknown publisher" certificate warning. You may also get a prompt to install Adobe AIR runtime, which you need to run these applications.

I will be releasing the source code for both application and the library soon.

If you find this project interesting, feel free to drop me a line at [email protected] (Alex Boudarov). Any feedback is welcome.

QUI

QUI is a q learning tool that uses as-q library. It is a basic q shell combined with q idioms' code. Log at the bottom shows IPC messages. Code edit view is separate from results view, CTRL+SHIFT execute current line or selection from code view.
Picture

TAQ

Trade and quote application is another use case for as-q library. It allows user to drill down into taq database (hope it works with your table schema). I was amazed by responsiveness of this app, which shouldn't come as a surprise considering that there is nothing between Flex and kdb+ except TCP pipe sending raw data. No message queues, no application servers, no frameworks - just data:)
Picture

In order to run applications you will need to have Adobe AIR runtime installed: http://get.adobe.com/air
Once you have AIR runtime installed, click on qui.air or taq.air to download and install it

NOTE that if you have originally installed application from *.exe package, then autoupdate feature doesn't work and you will get "An unexpected error occurred. Error# 16828" when trying to autoupdate to new version. In this case, click on the *.air version below and install the app. After that there won't be any issues autoupdating the app.
taq-update.xml
File Size: 0 kb
File Type: xml
Download File

taq.air
File Size: 1182 kb
File Type: air
Download File

qui-update.xml
File Size: 0 kb
File Type: xml
Download File

qui.air
File Size: 1073 kb
File Type: air
Download File