Reading GPS data from your Sprint Mobile Broadband USB Modem

Courtesy of the best startup in the world, I just got a Sprint Mobile USB modem (Sierra Wireless 598U). Of course, once you get a new toy, you have to try it out, so on the way back home, I plugged it in and experienced the novelty of surfing the web while on a moving train. One of the options intrigued me -- it said "click to start NMEA."

What's NMEA, I wondered? Turns out it's a data specification for GPS, sonar, and other devices defined by the National Marine Electronics Association. Even better, it turns out you can actually read data directly from this device from the terminal window:

[vincentc@local ~]$ cat /dev/cu.sierra05 
$GPGSV,3,1,10,03,42,254,29,06,45,240,28,09,18,060,24,14,65,180,26*77
$GPGSV,3,2,10,18,38,057,35,21,29,119,32,22,68,014,29,26,73,097,36*74
$GPGSV,3,3,10,27,14,049,18,19,39,293,*76
 $GPGGA,030642.4,3725.433133,N,12207.936951,W,1,09,1.3,-13.2,M,,,,*0D
$GPVTG,,T,,M,0.0,N,0.0,K,N*2C
$GPRMC,030642.4,A,3725.433133,N,12207.936951,W,0.0,,241109,,,A*5B
$GPGSA,A,3,03,06,09,14,18,21,22,26,27,,,,2.1,1.3,1.6*36
 $PSTIS,*61
....

Each of the lines begins with a code whose meaning can be looked up here. Pretty neat! Seems like it wouldn't be too hard to write a script to parse all of the information. For instance, the two most interesting ones are:

 - $GPGSV tells me which GPS satellites are currently in view

 - $GPGGA tells my current location (3725.433133,N,12207.936951,W or 37d 25.433133' N latitude, 12d 207.936951' W longitude), along with my current altitude

Already pretty interesting and rich data --- not sure exactly what this could be used for, but it's definitely interesting stuff ... and I imagine there could be tons of interesting applications to be made around this data.

Loading mentions Retweet
Filed under  //  coding  
Comments (2)
Posted 2 days ago

Use ngrep to inspect HTTP headers

Debugging third-party APIs is painful and tedious. Often times, you'll have to inspect all of the parameters passed to the third-party, make sure they're all there, not malformed, located in the appropriate place, etc.. You could monkey-patch your code to spit these parameters out, but this is also painful. Not only do you have to write more code, but often times the parameters are being modified by some other piece of code after you've logged.

What would be nice is a way to spit out the headers on their way out the door over the wire. That way, you're can see what the third-party sees. Found a nice tool called ngrep that does exactly that. It compiled with no problems on Mac OS X in 10 seconds and started running beautifully:

 

vincentc@local ~]$ sudo ngrep -Wbyline -d en1 port 80
interface: en1 (192.168.1.0/255.255.255.0)
filter: (ip) and ( port 80 )
#
T 192.168.1.3:58716 -> 74.125.19.17:80 [A]
 POST /mail/channel/bind?VER=6&it=45250&at=xn3j34m2pyx=j12w3b-8lzkxt&t=1 HTTP/1.1.
Host: mail.google.com.
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5.
 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8.
Accept-Language: en-us,en;q=0.5.
Accept-Encoding: gzip,deflate.
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7.
Keep-Alive: 300.
Connection: keep-alive.
 Content-Type: application/x-www-form-urlencoded; charset=UTF-8.
Referer: htp://mail .google.com/mail/?ui=2&view=js&name=js&ver=suByI-6Q4II.en.&am=!6zf2FVl6CnB3fth99j1pWy.
 Content-Length: 46.
Cookie: GMAIL_LF=1; S=gmail=fM4yyZY0467bXi71KiVpNQ:gmproxy=eRlqhEcR-oT419BlbGUa9g; GX=DQPOGrd680ZqSK5OXwAl13tBJUp_K79Y4Z9eSknff5gzoKH_gIBlQ9lKXRyx5nPHkqziJso6k_QNM6kC5Sy-xQw0mjV8aWYpr-VRObldXWZgqP2GjjQJBwY9UgMw; GMAIL_AT=xn3j34m2pycti4gjvoyvs2tyyxs0hn; gmailchat= PREF=ID=bbd521a14581b7049:LD=en:NR=10:TM=1242260735:LM=1257471614:GM=1:S=GV8TdngB2-ZjTbi8; SID=DAADFz2eJZ3gDFlQHZE_xjVZk59zWPUG_DNwKt1t6
 ##

Loading mentions Retweet
Filed under  //  coding  
Comments (0)
Posted 17 days ago

Facial Detection for the Whole Family!

I always like to have a few "hard" problems and projects on the backburner. Even at my busiest in grad school, I always felt it was important to keep a few problems. For one, it kept my mind active to learn new things outside of my narrowly focused grad projects. Second, you never know when the knowledge you thought was "useless" will find uses. Third, you never know when a random project you do might lead you to a job.

For awhile now, I've been interested in a pet project involving facial recognition. It's an interesting problem at the intersection of a lot of interesting math and statistics. It's also practical! Computer-assisted processing of visual data is becoming more and more useful. Thankfully, a lot of the heavy lifting in terms of implementation has already been completed via OpenCV libraries. Over the past few weeks, I've spent some time reading up on the mathematics and algorithms, mostly in my spare time on train rides home.

Last night, I finally spent some time to get some simple example problems compiled. The results "out of the box" using some standard pattern recognition algorithms are pretty impressive. As a test, I ran them on some photos from some family gatherings and cherry-picked the best cases. Definitely have to explore some more on my spare time.

       

Loading mentions Retweet
Comment (1)
Posted 17 days ago

Wardriving

Loading mentions Retweet
Comments (0)

Shew. I passed.

Haha. Suckas! They passed me. ;) but just barely. There are still a few things before it's official, but the last major thing is done.

Sad to be leaving Stanford, but super psyched for the future and what's ahead. Thanks to all of my friends and family who were there supporting me --it means a lot to me.

(photo: my whiteboard on the day of the defense)

Loading mentions Retweet
Comments (7)

Defending today ...

Instead of actually taking pictures, you can pretty much follow what's
going on today by reading PhD Comics, starting at this one:

http://www.phdcomics.com/comics/archive.php?comicid=570

I'll let y'all know how it goes!

Loading mentions Retweet
Comments (0)
Posted 28 days ago

Arlen chilling out

Kim's new dog is awesome!

Loading mentions Retweet
Comments (2)

Hot off the presses!

Just printing a few draft copies for my committee members. The countdown begins.

Loading mentions Retweet
Comments (2)

Thesis Defense: How Helical Junctions Determine the Folding Stability and Allowed Conformations of Structured RNAs

Title:

“How Helical Junctions Determine the Folding Stability and Allowed Conformations of Structured RNAs”

Abstract:

Structured RNAs are inherently dynamic, exploring a diverse set of conformations within the cell. Understanding the physical origins of their folding stability, motion, and interactions with other biological actors will require characterizing the conformational landscapes they explore. The simplest motifs within structured RNAs are two helices joined by non-helical junctions. To dissect the thermodynamic properties of these fundamental helix-junction-helix (HJH) motifs, we computationally probe how junction topology, electrostatics, and tertiary contact location contribute to the folding stability of a simple tethered duplex model system. We then extend this work to construct a map of the allowed conformations of the Transactivation Response Element (TAR), a HJH motif extracted from the genome of the Human Immunodeficiency Virus. This conformational map, analogous to the Ramachandran plots for proteins, can aid in the interpretation of experiments by showing how experimental data fit into the context of the allowed conformational space. Our results indicate that the simple constraints of a single- or double-stranded junction, independent of sequence, profoundly influence the preferred location and orientation of the adjoining helices, helping to determine the folding stability and specificity of the motif. These sequence-independent effects suggest that properties as simple as a junction's topology can broadly determine the conformational landscape, stabilize desired structures, and assist in discriminating against misfolded structures, providing an additional strategy for transcending the limitations imposed by the low information content of RNA primary sequence.

Date: Thursday, October 29th, 2009 - 2pm
Location: Clark Center, S360

Loading mentions Retweet
Filed under  //  science  
Comments (2)
Posted 1 month ago

At the Stanford Linear Accelerator Center

Here for my advisor's honorary symposium.

Loading mentions Retweet
Comments (0)