Posts Tagged ‘code’

C10CK modes

Tuesday, April 29th, 2014

It’s been a long time in the works. I’ve wanted to add modes to my binary clock app since the initial planning. Figuring out the interaction design for changing modes and setting the time while honoring the simple UI took some work. I’m not sure if I’ve got the mode switching quite right, but I’m really happy with being able to tap the bits directly to tinker with the time. It also becomes an additional learning aid when the bit labels are displayed; toggle the bits and check the value.

Maybe a demo is in order.

Stopwatch mode is simply the opposite; it counts up from zero. Much less interaction to deal with but still a nice addition to the clock. I’ve been using these additional modes for over a year and am really excited to get these released.

moar Fusion!

Tuesday, December 18th, 2012

Fusion Tables is neat. Google describes it as ‘an experimental data visualization web application to gather, visualize, and share larger data tables’. Last year I tried out their API which was mostly based on sending SQL statements to create and manipulate tables. Recently, I looked at Fusion Tables again as part of an imminent upgrade to Mobile Logger. The API has been upgraded to “v1″, is now much more RESTful and enforces OAuth 2.0 authentication.

Once again, fired up Titanium Appcelerator to dig into the Mobile Logger source code. Every time I look at Appcerelator I’m reminded why I have opted to focus on Objective-C. Not going to get into a religious war…it just feels cumbersome. That could just as easily be attributed to my general unfamiliarity with the Titanium Studio and toolchain, since I’m otherwise using Xcode and Objective-C daily. Still, it’s much better now than when I first started Mobile Logger in 2009—using vim because Titanium did not have an IDE (or documentation, for that matter).

Back to Fusion Tables…it’s fairly easy to create a new table and import all the data from logs. Two authenticated calls: one to create the table and receive it’s ID, and another to use that ID with CSV data in a batch import. Once in Google Drive it’s trivial to map the data and play in various ways to chart the data. Nothing special, but here is a quick result from a walk in the park.

For now, I’ve only gotten a one way trip going. Haven’t tried to reconcile changes bidirectionally, or enabled updates to existing tables…but it seems like a promising start. Beta testing the next release of Mobile Logger now. Release likely just after the new year when iTunes Connect reopens. In the meantime, the code is up on github.

(binary) C10CK app in App Store!

Thursday, May 12th, 2011

My second (personal) iPhone app, C10CK, is now available in the App Store. It is a clock which displays time using binary notation – the same way everything is (eventually) stored in a digital computer. I’ve been using a binary clock since a staff member of ITP passed this past year and several alumni recalled stories of the binary clock she kept on her desk and would happily explain to anyone who asked. I now keep a binary clock on my desk and think of her when people ask me what it is. (more…)

Hello Fun-A-Day 7!

Tuesday, February 15th, 2011

For this year’s Philadelphia Fun-A-Day project I decided to write “Hello World” programs. “Hello World” is a traditional programming tradition where a programmer encountering a new language writes a trivial program which displays the phrase “Hello World”.

This introduces the programmer to the basic syntax of the language and demonstrates that their development environment is set up properly to work with that language.

Much of our current environment runs on software, which is generally invisible to us, except when a failure impacts our lives. However, software generally starts as human-readable written text, albeit in a highly defined form using specific vocabulary.

This project attempts to make software visible, in at least a trivial way. The words and structure may differ between languages, but each program is a series of instructions to achieve some end – here to issue a friendly “Hello Fun-A-Day 7!”. Hopefully this can serve to demystify software to some degree, and remind us that software, at some point, has been written by a person.

The programs here demonstrate a Fun-A-Day variant on Hello World in several languages. I made an effort to explore historical and modern languages, compiled and interpreted languages, console and graphical programs, but avoided esoteric languages which are often difficult to understand by design.

Mobile Logger – GPX extensions

Tuesday, August 10th, 2010

gpx-extRolling the extra logged sensor data into the GPX export took more effort that it should have…but I uncovered and fixed a latent bug in the export feature, so that’s a win right? Regardless, it’s was nice to use the new issue tracker at for real(z) for the first time. I’m looking to get several other features implemented before the next released update…planning on a few weeks. Otherwise, code is available, as always, on github.

Parsing foursquare KML files

Tuesday, February 23rd, 2010

We’re using Foursquare as a data logger for one of our assignments in the Telling Stories with Sensors, Data and Humans class at ITP. As an aid to begin understanding the relationships between venues for our tracks, it’s helpful to munge the KML into CSV so it can be plotted and played with in a spreadsheet, Illustrator, R, Processing or whatever…

Below is a short python script to parse a Foursquare KML file into a simple CSV file. It outputs the check-in name, description, timestamp and location (as lat, lon). The Foursquare KML feed is available at the Feeds page on their site. (more…)

(overly simplistic) saving state in oF for iPhone

Friday, June 19th, 2009

save_stateThere was a recent comment about saving / restoring application state when using openFrameworks for iPhone which got me to thinking about how to do it. Apple’s frameworks provide a fairly thorough way to save state to the disk and restore later. There seem to be three primary ways to do this: simple plist files (usually encoded in binary on the iPhone), archived data (they like to refer to this as freeze-dried object graphs) and core data.

I believe that archiving objects require methods inherited from NSObject, which we don’t have in openFrameworks’ ofSimpleApp. Core Data seems like overkill, so I looked into using plist files.

There are likely better ways to do this, but this ad-hoc solution works wonderfully for a small app I’m working on, and only requires a bit of Objective-C code that could likely be moved up into a nice wrapper class. However, since the question was asked I’d just like to get it out there before working on a more elegant approach. (more…)

Simple things feel so good. (warning: geekery)

Wednesday, March 4th, 2009

Toggle an integer variable between 0 and 1. Useful for a flag to control program flow in C without boolean types.

toggleVar = 1>>toggleVar;

What this is doing is right shifting the integer 1 either zero or one place, depending on the current value of toggleVar.

An 8-bit (unsigned – positive values only) integer has 256 possible values. This is a byte of information whose bits can be represented in binary as 00000000. The least significant bit, the smallest values are on the right…so, 00000001 = 1, 00000010 = 2 … 11111111 = 255.

Ok, this isn’t a binary lesson…so, right shifting is simply moving all the bits to columns to the right. 2>>1 = 1 or, 00000010 >> 1 = 00000001 (which is binary for 1).

The expression at the top does exactly this: When toggleVar is zero, it becomes 1>>0 = 1 and when toggleVar is 1 the expression is 1>>1 = 0. The last bit gets shifted right into oblivion!!! (sorry for that).

Of course, with boolean data types toggleVar = !toggleVar is still shorter, by one char! :)