free hit counter

Monday, October 21, 2013

The Four Hundred Sixty Five Million Dollar Software Bug

I love the story of a really good bug, and this one is a $465M whopper:
"While processing 212 small retail orders that Knight had received from its customers,
SMARS routed millions of orders into the market over a 45-minute period, and obtained over 4
million executions in 154 stocks for more than 397 million shares. By the time that Knight
stopped sending the orders, Knight had assumed a net long position in 80 stocks of approximately
$3.5 billion and a net short position in 74 stocks of approximately $3.15 billion"
http://www.sec.gov/litigation/admin/2013/34-70694.pdf 

Labels:

Wednesday, April 24, 2013

Leveraging Existing Sensor Drivers in Embedded Linux

Here are the slides from my talk "Leveraging Existing Sensor Drivers in Embedded Linux" at Design West.

Thursday, April 18, 2013

speaking at Design West 2013

I'll be speaking at Design West next week with a talk entitled


"Leveraging Existing Sensor Drivers in Embedded Linux"



The proliferation of sensors in Android devices has greatly increased the availability of sensor drivers available for Linux. This is a boon to embedded systems developers who want to take advantage of sensors, but the lack of sensor driver interface standards and documentation can make them daunting to use.

The good news is that most sensor drivers utilize the Linux Input Event framework or the Linux IIO framework user mode APIs. Once you become familiar with the APIs for these frameworks you will be able to integrate many sensors into your system.

Through demos and code examples this session will walk you through the command line utilities and user mode APIs to debug if sensors are working, connect them directly to user mode code, or bridge into higher level frameworks such as Android.

http://www.ubmdesign.com/sanjose/2013/speaker-list/?speaker=rian-sanderson

Monday, February 18, 2013

"Sent from my windows phone"

So I've been using a Nokia Lumina 920 since Christmas as my primary mobile phone.  That's a lot to say.  Like Woz, I think it's got a beautiful user interface - but more than that, it's a *useful* interface.

One my biggest complaints is that they made the "Sent from my windows phone" signature difficult to turn off.  This helpful blog post explains how you can only turn it off through the email app's mail settings and not through the global settings for mail where I had been looking.

My other predictable complaint: lack of quality apps. I didn't use or download many apps.  But I didn't realize how much I relied on the few I used: Flight Tracker Pro and the NPR News topping the list.

Wednesday, November 21, 2012

ssh-agent script for git on windows

For the past week I've been back in Windows to do some embedded development and I couldn't stand having to type in my passwords when for contacting git repos and updating submodules.

MySysGit doesn't come with ssh-copy-id, but this script I found at http://gabrielsomoza.com/server-administration/ssh-copy-id-implementation-for-mingw-and-msys/ works every bit as well.

Then to get an agent to keep those keys available there's this little script somewhat hidden in a github help page: https://help.github.com/articles/working-with-ssh-key-passphrases

I call it from my .profile and it works like a charm, asking for my key's passphrase just once when I launch my first mingw shell.


SSH_ENV="$HOME/.ssh/environment"

# start the ssh-agent
function start_agent {
    echo "Initializing new SSH agent..."
    # spawn ssh-agent
    ssh-agent | sed 's/^echo/#echo/' > "$SSH_ENV"
    echo succeeded
    chmod 600 "$SSH_ENV"
    . "$SSH_ENV" > /dev/null
    ssh-add
}

# test for identities
function test_identities {
    # test whether standard identities have been added to the agent already
    ssh-add -l | grep "The agent has no identities" > /dev/null
    if [ $? -eq 0 ]; then
        ssh-add
        # $SSH_AUTH_SOCK broken so we start a new proper agent
        if [ $? -eq 2 ];then
            start_agent
        fi
    fi
}

# check for running ssh-agent with proper $SSH_AGENT_PID
if [ -n "$SSH_AGENT_PID" ]; then
    ps -ef | grep "$SSH_AGENT_PID" | grep ssh-agent > /dev/null
    if [ $? -eq 0 ]; then
  test_identities
    fi
# if $SSH_AGENT_PID is not properly set, we might be able to load one from
# $SSH_ENV
else
    if [ -f "$SSH_ENV" ]; then
  . "$SSH_ENV" > /dev/null
    fi
    ps -ef | grep "$SSH_AGENT_PID" | grep ssh-agent > /dev/null
    if [ $? -eq 0 ]; then
        test_identities
    else
        start_agent
    fi
fi

Friday, August 24, 2012

awk gsub turns json into csv


I thought json would be a great sensor data collection format.  But since no one (chief among them myself) at work has spent the time to investigate and craft really good tools to manage the json data I often just end up converting it into comma separated values.

After losing this nice little one liner in my .bash_history and reconstructing it again I figured I would record it for next time.


grep accel sensor-data.json | awk 'gsub(/[,:[\]]/ , " ")' | awk '{printf("%s, %s, %s, %s\n", $2, $4, $5, $6)}' > accel-data.csv

Technically you don't need the grep at the front and could put it within its own /accel/ matching statement in one of the awk commands, but for 80MB files I figured this might help things go a little faster.

Thursday, April 19, 2012

cmake and distcc on x86


Lately builds have been taking in excess of 4 minutes on my 3 year old Core2-DUO laptop, but I finally I got around to figuring out how to use distcc with cmake.

Now those 4 minute builds are taking about 50 seconds thanks to distcc. If I ssh into the build server and run the locally, they take 45s.   That's a huge productivity increase for me, but I still need to set it up to do arm cross compiling.

Here's how I did it:

setup on the build server 

install and configure distcc daemon:
sudo apt-get install distcc sudo dpkg-reconfigure distcc

Answer the prompts during reconfigure. Important answers

  • start on startup
  • Allowed client networks: 127.0.0.1 developer-1 developer-2
  • Listen Interfaces: inet address of your internal facing network card
  • Maximum number of concurrent jobs: 2x number of cores for dedicated build machine, 1x for shared workstations



setup on the developer machines

install distcc
sudo apt-get install distcc sudo dpkg-reconfigure distcc

In this case, only allow clients from localhost, and to keep the local host humming I like to set the max number of jobs to .5x the number of cores.

running a build on a developer machine

export DISTCC_HOSTS='build-server-1 localhost'
distccmon-gnome &
CC="distcc gcc" CXX="distcc g++" cmake ../src
make -j8