« December 2009 | Main | February 2010 »

January 31, 2010

The Music of Chance

I had read this book awhile ago as part of a book group but due to a gag order around discussing books prior to meeting in person, I'm only now getting around to posting it. Minor spoiler alert.

The Music of Chance The Music of Chance by Paul Auster


My rating: 2 of 5 stars
The book started off great. I had visions of Rounders and Good Will Hunting in my head as the story started to unfold. Unfortunately once they lost the big poker game and voluntarily entered indentured servitude my suspension of disbelief was broken and I could no longer relate to the characters. As a result I found it a drudgery to complete the book.

View all my reviews >>

Tags: books

January 12, 2010

AIR 2.0 and Presentation Nightmares

Tonight I spoke at the Boston Flex User Group about AIR 2.0 with a focus on the new Native Process API and Networking APIs. Alas the talk didn't go as planned since I forgot my bag of video output adapters at home and didn't notice until I was setting up. The meeting was only a few blocks away from the Allurent offices so I ran (more like a sprint) back to find suitable replacements. Alas in my rush to borrow an adapter (only being able to find a mini display port to HDMI) I ran afoul of the old Mac VGA/HDMI mechanical virus issue. However, it wasn't until after sprinting back to the meeting and futzing with projectors for 15 minutes that I realized this issue. Thankfully a fellow attendee loaned me his computer and using the USB drive I did have on me, I managed to gave a modified version of the talk sans running demo code. I'd like to thank those in attendance for their patience, apologize for my forgetfulness, and hope that at least a little information was conveyed. A copy of the presentation is available in PDF format. The most import code snippets are below:

Define a Native Process Startup Information instance:

// _mxmlc, _cssFile, _brandFile, and _kitDir are of type File
var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
nativeProcessStartupInfo.executable = _mxmlc;
var mxmlcArguments:Vector.<String> = new Vector.<String>();
mxmlcArguments.push(_cssFile.nativePath);
mxmlcArguments.push("-output");
mxmlcArguments.push(_brandFile.nativePath);
nativeProcessStartupInfo.arguments = mxmlcArguments;
nativeProcessStartupInfo.workingDirectory = _kitDir;

Create and attach listeners to a Native Process:

// _nativeProcess is of type NativeProcess
_nativeProcess = new NativeProcess();

_nativeProcess.addEventListener(Event.STANDARD_ERROR_CLOSE, handleStandardErrorClose);
_nativeProcess.addEventListener(Event.STANDARD_INPUT_CLOSE, handleStandardInputClose);
_nativeProcess.addEventListener(Event.STANDARD_OUTPUT_CLOSE, handleStandardOutputClose);

_nativeProcess.addEventListener(IOErrorEvent.STANDARD_ERROR_IO_ERROR, handleStandardErrorError);
_nativeProcess.addEventListener(IOErrorEvent.STANDARD_INPUT_IO_ERROR, handleStandardInputError);
_nativeProcess.addEventListener(IOErrorEvent.STANDARD_OUTPUT_IO_ERROR, handleStandardOutputError);

_nativeProcess.addEventListener(ProgressEvent.STANDARD_ERROR_DATA, handleStandardErrorData);
_nativeProcess.addEventListener(ProgressEvent.STANDARD_INPUT_PROGRESS, handleStandardInputProgress);
_nativeProcess.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, handleStandardOutputData);

_nativeProcess.addEventListener(NativeProcessExitEvent.EXIT, handleNativeProcessExit);

Typical event handling code:

private function handleStandardOutputData(progressEvent:ProgressEvent):void {
    trace(_nativeProcess.standardOutput.readUTFBytes(_nativeProcess.standardOutput.bytesAvailable));
}

private function handleNativeProcessExit(nativeProcessExitEvent:NativeProcessExitEvent):void {
    trace(nativeProcessExitEvent.exitCode);
}

Create a new server socket that listens on an OS selected available port:

// _serverSocket is of type ServerSocket
_serverSocket = new ServerSocket();
_serverSocket.addEventListener(Event.CLOSE, handleServerClose);
_serverSocket.addEventListener(Event.CONNECT, handleServerConnect);
_serverSocket.bind();
_serverSocket.listen();

Handle a new incoming connection:

private function handleServerConnect(serverSocketConnectEvent:ServerSocketConnectEvent):void {
    var socket:Socket = serverSocketConnectEvent.socket;
    socket.addEventListener(ProgressEvent.SOCKET_DATA, handleSocketData);
    socket.addEventListener(Event.CLOSE, handleSocketClose);
    socket.addEventListener(IOErrorEvent.IO_ERROR, handleSocketIOError);
}

Handling socket data:

private function handleSocketData(progressEvent:ProgressEvent):void {
    var socket:Socket = Socket(progressEvent.target);
    var byteArray:ByteArray = new ByteArray();
    socket.readBytes(byteArray, 0, socket.bytesAvailable);

    socket.writeUTFBytes("HTTP/1.1 404 Not Found" + CRLF);
    socket.writeUTFBytes("Connection: close" + CRLF);
    socket.writeUTFBytes(CRLF);
    socket.flush();
    socket.close();
}

Tags: air flex

January 2, 2010

My Top 10 Spam Subjects from 2009

Doing some quick command line hacks I extracted the top 10 spam subjects (ignoring case) that I received in 2009 according to Postini. Each subject accounts for 0.25% of the spam messages I received with no subject accounting for 0.88%. All told just under half of the spam I got used a unique subject.

CountSubject
396[no subject]
127free cialis
124age is no longer a barrier for me in bed
123pay shipping and get your trials
119le_vrai_jeu_se_joue_seulement_lm-`_om-y_il_a_commencm-i:_m-`_las_vegas!_
115we know you want the free cialis
115pay shipping for your erotic nights
115don't pay anything for your pills for 15 days
114feel 10 years younger in bed today
114do not underestimate the value of free pills

Using space as a word delimiter and lowercasing everything, these were the top 10 words found in my spam subjects. Not nearly as interesting as the full subject lines.

CountWord
8854your
6988for
6031free
5426the
4851to
4666a
4600you
3587and
3504get
3014in

Tags: email spam

January 1, 2010

2009 Spam

Since I switched to Google for handling my email I don't have as fine grained tracking of spam as I did in years past. My first line of spam defense is Postini which caught 43,683 spam messages for 2009. I get very few false positives from Postini so that number is about spot on. My GMail spam folder currently holds 406 spams messages received in the last 30 days. If I do a rough calculation, I'd say GMail caught another 3,263 spam messages. Postini drops certain spam messages into the bit bucket before I see any trace of it which contributed to only 45% of my email for 2009 being spam. The number of spam messages a day though is marching upwards. Minus a few drops when a spam botnet is shutdown the trend for the year isn't pretty as the graph below shows.

Tags: google life spam