Dan Newcome, blog

I'm bringing cyber back

Archive for February 2013

Google Glass – enabling new layers of context

with 3 comments

If you’ve followed me for a while on this blog you know I’ve written about some different UI/UX paradigms in the past, mostly focusing on the rise of tablets and touch computing and the passing of the stylus into niche areas and near obscurity.

The scary and exciting thing about all of these changes is that they happen nearly overnight with the launch of a pivotal product and the entire market shifts. The most amazing thing about these changes is that once our perceptions are changed, we forget the old paradigms seemingly overnight and the new changes permeate the way we interact.

Google did this with search, Apple did it with the iPhone. I think Google is going to do it again with the Glass.

Once I had constant and immediate access to my online world via smartphone, opening up my laptop seemed almost baroque. I think that the Glass is going to have the same effect, moving us one step closer on the connectivity continuum.

Having such immediate access to data is going to challenge us in new ways, and context is going to be more important than ever to avoid information overload. Devices that are tuned to where our attention is focused can be powerful allies in giving us contextual  information.

#ifIHadGlass I would focus on solutions that learn the wearer’s patterns of attention and focus to build smart, contextual maps of their online and offline existence. Otherwise instead of Glass being one step closer to seamless integration with our data, it’s going to drown us in it faster. As one of the founders of Ubernote, I understand personal data patterns and I’d really love to bring the level of context that Glass could provide to bear on the problem of personal data.

We already have some contextual clues via GPS and browsing history, etc. However, with a visual data stream of attention and focus I think we can extract a lot more data about the contexts in our daily lives. Along with other data from devices like the Somaxis MyoLink, Nike Fuel Band and the Zeo Sleep Manager we can understand a lot more about ourselves.

Advertisements

Written by newcome

February 27, 2013 at 4:28 pm

Posted in Uncategorized

Hacking on local Ruby gems

with one comment

I’m playing around with some ideas posed by a friend of mine lately in Ruby. I’ve done some Rails hacking in the past but I don’t usually get far off the beaten path in Ruby. Well, except for that time that I hacked up a version of Mongrel to try to make it a streaming HTTP server before node.js was released. That was pretty awesome.

Anyway in order to get this stuff working I had to patch the ruby readline gem (rb-readline). Initially I just did this in my own gem installation path (~/.rvm/gems/…) but later on I wanted to just pull that library into my project until I can figure out a way to get it working without patching.

Initially I tried just copying the gem locally to my project and “require”-ing the code directly. It seems like this should work but I was always getting file load errors like this:

/Users/dan/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- rb-readline (LoadError)
	from /Users/dan/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'

So the next thing I tried was using a Gemfile to specify the local location:

gem "rb-readline", :path => "./rb-readline-0.4.2"

This resulted in errors that the source could not be found:

Could not find gem 'rb-readline (>= 0) ruby' in source at ./rb-readline-0.4.2.
Source does not contain any versions of 'rb-readline (>= 0) ruby'

After looking around a bit I finally read the Gemfile man page:

Similar to the semantics of the :git option, the :path option requires that the directory in question either contains a .gemspec for the gem, or that you specify an explicit version that bundler should use.

So my final gemfile looked like this:

gem "rb-readline", "0.4.2", :path => "./rb-readline-0.4.2"

Now bundle install worked. But I was still not able require the code because I forgot the following in my code:

require "rubygems"
require "bundler/setup"

Done!

Written by newcome

February 7, 2013 at 12:25 am

Posted in Uncategorized

Working with Jekyll static blog generator on Mac

with one comment

A while ago I started moving a bunch of my WordPress and Posterous blogs to Octopress. Octopress is a static website generator that uses Jekyll under the hood. On Linux this was pretty easy to get working, but on Mac I had to figure out a bunch of things related to ruby and rake on the Mac.

I had a few of these blogs that I cloned down from Heroku using Git. Well actually I couldn’t just point myself directly at Heroku to get this working, I had to grab the Heroku tools for mac and install them, and then use those tools to upload my ssh public key before I could do anything.

Once Heroku had my public key I could clone my repos back to the Mac. I had an older 1.8.7 version of ruby on the mac, so I tried installing ruby from homebrew. This was a mistake, as other tools like bundler and rake kept trying to use the older version of ruby still.

The core problem I was having was that my version of ruby was wrong. This wasn’t that obvious, as this is the error that I was getting when trying to do rake generate:

retnex:octopress dan$ rake generate 

## Generating Site with Jekyll directory source/stylesheets/ create source/stylesheets/screen.css Configuration from /Users/dan/Desktop/sandbox/mine/octopress/_config.yml /Users/dan/Desktop/sandbox/mine/octopress/plugins/category_generator.rb:109: warning: regexp has invalid interval /Users/dan/Desktop/sandbox/mine/octopress/plugins/category_generator.rb:109: warning: regexp has `}' without escape /Users/dan/Desktop/sandbox/mine/octopress/plugins/category_generator.rb:174: warning: regexp has invalid interval /Users/dan/Desktop/sandbox/mine/octopress/plugins/category_generator.rb:174: warning: regexp has `}' without escape /Library/Ruby/Gems/1.8/gems/jekyll-0.12.0/bin/../lib/jekyll/site.rb:78:in `require': /Users/dan/Desktop/sandbox/mine/octopress/plugins/image_tag.rb:27: undefined (?...) sequence: /(?\S.*\s+)?(?(?:https?:\/\/|\/|\S+\/)\S+)(?:\s+(?\d+))?(?:\s+(?\d+))?(?

Installing from brew builds ruby from source apparently, and took kind of a long time. And didn’t work in the end.

Installing rvm also built ruby from source. Which took a while. And downloaded another version of gcc:

==> Downloading http://r.research.att.com/tools/gcc-42-5666.3-darwin11.pkg

I have no idea why rvm needs its own version of gcc. I have xcode installed and I have Apple’s commandline compiler tools, which includes gcc. So for all I know I have 3 versions of gcc here now. My vague understanding of xcode/commandline tools is that the commandline tools basically just let you avoid calling xcrun before invoking gcc.

So getting this set up on Mac wasn’t quite as bad as setting it up on Windows, but Linux is still way easier for this kind of thing.

You also need bundler and rake, which I installed as a gems, once I had rvm set up.

Here is a synopsis of useful commands to get started:

$ bundle install
$ rake generate
$ rake new_post['My post title']
$ rake preview

Written by newcome

February 6, 2013 at 7:37 pm

Posted in Uncategorized

Making system calls in OS X

leave a comment »

I’ve been hacking away on my new Mac ever since I got it last month, and I’m slowly getting all of the native stuff I used to do under Linux moved over to my new environment.

Some of the things I’ve gotten installed so far are homebrew (needed to install just about anything that isn’t distributed directly as a disk image or precompiled binary), Xcode command line tools (needed to build many homebrew packages), rvm (ruby version manager), git (via homebrew) and many other homebrew packages.

So anyway, I’ve been working on getting some low-latency HID (keyboard) code working under Windows and I’m eventually going to try to get it working on the Mac. I’m able to make system calls on Windows pretty easily by now, but I was wondering how it worked on Mac.

There is a big list of all the system calls for OS X here. Notice that the integer ID for EXIT is 1.

The following code snippet calls exit() via syscall() and returns an exit code of 7:

#include <stdio.h>
#include <sys/syscall.h>

int main( int argc, char** argv ) {

        /* system call 1 is EXIT */
        syscall(1, 7);
        
        /* we will never get here */
        printf("arg0: %s \n", argv[0] );
        return 0;
}

Compile with gcc and run like this:

./a.out ; echo $?

Here we output the return code to the console so that we can see it.

Written by newcome

February 1, 2013 at 1:33 am

Posted in Uncategorized