Archive for December, 2010

QuikStock 0.6 and source code released — Google Finance AIR app

Six months ago I wrote an application called QuikStock, which lets you view your Google Finance porfolios, securities, and some various performance information. It can update in real time, and lets you have your portfolios open in separate windows. I created it to test out AIR 2 and some features of the Flex 4 framework, but I ended up developing it into a lightweight, standalone application, which I’ve made freely available online. Today I’ve released version 0.6 of QuikStock. It’s still in beta, but my other applications keep me from actively working on it.

QuikStock demonstration.

You can check out QuikStock 0.6 here: http://www.quikstock.com.

Today I also made the source code freely available. Feel free to download it, modify it, etc. Just pay attention to the source code license agreement in all of the source files.

Dealing with AS3’s ArgumentError: Error #2096 while pushing an innocuous URLRequestHeader

I’m working on a Flex mobile application that has me parsing SIDs and Auth values from Google’s client login. You may find yourself in this situation if you need to make requests to Google’s various APIs. In my case, I’m using Google Reader, and it requires that I pass in an Authorization header with all of my URLRequests, the value of which needs to be taken from Google’s client login response. This seemed like an easy task, but I kept hitting an annoying error, which turned out to be a red herring:

ArgumentError: Error #2096: The HTTP request header GoogleLogin auth=(long string)
cannot be set via ActionScript.
at flash.net::URLStream/load()
at flash.net::URLLoader/load()

This error strongly indicates that I was doing something that transgresses AIR’s security sandbox, which is simply not the case.

It turns out that I had grabbed the value of auth from Google’s response, but I had failed to notice that Google was putting a newline character on the end of the auth string. When I fixed this by stripping the newline and putting the modified String into the URLRequestHeader, the runtime had no problem with it.

Thus, if you have an error that sounds like what I’ve described, make sure you’re not trying to set the URLRequestHeader with a value that has a newline or similar character somewhere in it. You can strip it out any number of ways, including String‘s replace() function.