Standing Desk Experiment

You can now officially add me to the list of standing desk converts.

Reasons

A few weeks ago while at the gym I tweaked my back. Flash forward another two weeks and my back still hadn’t gotten any better. It was fine in the mornings, but by the end of the day I couldn’t bend over it was so painful.

Part of the problem was that I have horrible posture when sitting down.

So I decided to give a standing desk a try. While my setup isn’t perfect (the keyboard and track pad are too high. also it’s a chair standing on a desk), after a solid week of using it I think I will be investing in a proper standing desk arrangement, it has really improved my back that much.

But I’m not going to talk about the health benefits. I’m going to talk about the ansiliary benefits of not sitting down while being at a computer.

Why It’s Awesome

The first and foremost reason is that I am more productive1.

If I’m sitting down, I feel like I’m “relaxing” and it’s ok to get distracted by reddit/twitter/digg for an hour or more at a time. If I’m standing, I actually feel like I’m wasting time intead of just browsing (intead of ignoring just the nagging feeling that I’m wasting time).

The second reason has to do with the way that I work.

Sometimes I work best by pacing. Being at a standing desk makes it trivial to wander away while deep in thought instead of just staring at my screen… which inevitably leads to getting distracted.

Tablet Convert

Something that I’ve said since the release of the iPad was that “I have no use for a tablet”. This is true because I’m on my computer almost my entire waking weekday and any kind of entertainment an iPad would provide I would just do at my desk (surfing reddit/twitter/etc).

However, with this new found “distractionless mode” I now have a use case for a tablet while sitting down somewhere other than at my computer. I haven’t purchased a tablet yet, but am strongly considering it for this reason.

Try it

I cannot recommend enough that you try a standing desk. I went cold-turkey and had a set up that didn’t allow me to sit down at all if my legs got tired. I found that they didn’t, but you might be different, so try something that allows you to sit down.

My Setup

Standing Desk

  1. not just feel

Rails Girls Houston 2.0

This weekend I participated in the second (semi annual, hopefully) Rails Girls Houston event and it was an absolute blast.

coaching

For those of you not familar with Rails Girls, this is what went down.

Friday evening the attendees can show up and let us help them get everything installed. This allows us to focus completely on coaching them through the actual coding all day Saturday instead of having to deal with the setup process.

At the beginning of the event on Saturday we did an “intro to the internet” that involved a kitchen and a cherry pie. I’ll let your imagination fill in the blanks.

Then we broke up all the girls1 up into groups of 3-5 and the “coaches” guided them along their route to awesomeness.

I should explain a little bit about what a “coach” is. We’re not really instructors (although my group asked some really great questions and I did end up lecturing for quite a while). The girls have a little booklet that walks them through the steps of pulling down a git repository, running bundler, and starting the rails dev server.

Really all I was there for was to trouble shoot and explain concepts (wtf is MVC).

Here comes the interesting part, however:

I Know Diddily Shit About Rails

And that’s cool! I know just enough ruby, erb, and how things should look to get by. The cool thing about these Rails Girls events is that it’s great for the coaches too. I got a refresher on some MVC concepts, and got to see how easy it is to get things going in Rails.

If you are interested in participating in a Rails Girls event near you, checkout http://railsgirls.com. If you’re intersted in participating in the next one in houston (either as a coach or attendee) feel free to email me.

Bonus Picture

Of me in a chef’s hat immediately after hitting Paul in the face with a plate of whipped cream.

Creamy

  1. I say girls, but really there was a wide range ages.

Apache-esqe Nginx Setup For PHP

If you’re here looking for the config file you’ll need, it’s directly below here. If you want the story behind why I made it and am now posting it, keep reading.

This assumes that you’re using php5-fpm to serve php.

This Is The Nginx Config You’re Looking For

 1 server {
 2     listen 80;
 3     root /path/to/your/folder/;
 4     server_name your.domain.tld;
 5     index index.php;
 6 
 7     # In case you have any .htaccess files carrying over
 8     location ~ /\.ht {
 9         deny all;
10     }
11 
12     # allow all ".php" files to be executed
13     location ~ \.php {
14         fastcgi_pass 127.0.0.1:9000;
15         include fastcgi_params;
16     }
17 
18     # This is for use with any frameworks that rewrite urls (pretty urls)
19     # that don't necessarily end with ".php"
20     #location ~ ^/(.*)$ {
21     #    # Serving non-php files makes fpm not happy, so exlude them from being passed
22     #    location ~ \.[^css|js|jpg|jpeg|png|gif]$ {
23     #        fastcgi_pass 127.0.0.1:9000;
24     #        include fastcgi_params;
25     #    }
26     #    try_files $uri /index.php; # add any params your framework needs here
27     #}
28 }

The Story

Recently I was hacking on something for Houston Hackaton and our group was ready to present, we just needed to throw our project on publicly-accessible server and we were ready to go.

“Hey, I have two of those sitting around not doing much, I’ll just throw it on one of them!” I said. We were already using one of them to host our code via git (not wanting to use github because for various reasons).

However. I had recently moved both my servers to Nginx. While i’m enjoying the performance improvemnt and overhead memory savings, it can be a PITA to configure for people new to Nginx.

We were using the Slim Framework to make the development go a little faster, and it uses url rewriting to support it’s routes.

“Ok, fine, I’ll just throw a ‘try_files’ in there and have it default to index.php” I thought. Not so fast there, kid. By default (and for very good security reasons) php5-fpm doesn’t allow access to not-specifically-requested files. Here’s a really good explaination as to why This meant that We were having problems with assets loading.

So that’s my story. I added an extra location check to not pass the execution off to php5-fpm if it’s not supposed to be a php file (i.e. specifically has a non-php extension).

Strange Thinking

Every once in a while I’ll make a joke about my pet peeve being “stupid people”. Let me qualify this by labelling “stupid” as “voluntarily stupid”. Not people with a learning disability or genuine mental health issues, but the person who gets in the “10 items” line at the grocery store with a full cart. The person who argues that “irregardless” is a word. The person who takes 14 tries to park their car.

Even more specifically, I hate inefficient people.

I suppose this is a side effect of my day job. I spend the vast majority of my time while awake looking for the most efficient way to accomplish my goal. This has carried over noticably in my day to day activites.

  • Wait until I finish with the bread and the jam so I only have to open the fridge door once.
  • While on my way to the store, I’ll visualize the optimal path to take to get all the items in the shortest distance.

The other side of that is if I see someone doing something inefficient, but not necessarily wrong, I get frustrated with them. Typing one key at a time. Not using the “page up/down” button on the remote to select a channel.

This has completely or nearly ruined several relationships. Loading the dishwasher in an inefficient manner. Folding clothes in a way that is not the most compact.

It took me several years of claiming that I hated stupid people to realize that it wasn’t hate at all, it was an unrealistic expectation.

I consider myself moderately intelligent and converse with equally (and usually more) intelligent people all day. It becomes an echo chamber of smarts. I frequently forget that people I interact with that aren’t in that group aren’t less intelligent, but have different priorities. Also, they not have the same experience in clothes-folding that I do.

Not everyone in the world cares about making as few trips to the kitchen as possible, or the fastest way to open a soda can. These things aren’t that big of a deal. In fact, it’s pretty strange to even think about these things.

##It’s pretty strange to try and optimise every interaction.

This was the biggest revelation I had. I’m the weird one. I have the problem.

Since realizing this, I have become more conscious of becoming upset over minutiea. I’m not sure if it’s nature (genetic predisposition for OCD) or nurture (an engineering mindset) that got me to this point. I have several engineers in my family who are fastidious and detail-oriented, and I went to an engineering school majoring in computer science.

Either way, now that I’ve accepted that the world isn’t completely full of idiots I don’t have nearly as high a stress level on a daily basis.

Polite Javascript

Let’s say you’re working with some legacy form submission javascript. You need to grab the value of the input with id='email' so you do something like:

val = document.getElementById('email')
console.log(val)

Printed to the console is the email you entered.

Next you try submitting the form, but to your dismay the client-side validation starts failing saying “Invalid Email Address”.

Wait, what?

You have just fallen victim to the consequences of two of the more severe violations of “polite javascript”.

The Bad

The first violation in the story there is some other variable in the validation script that uses val (a horrible name for a variable), and you just reassigned it to an invalid value.

This is how something like that happens:

val = "hello";
printme = function(){
    val = "world";
    return val;
}
console.log(printme()); // "world"
console.log(val);       // "world"

The Good

Javascript has a keyword var that declares a variable, but more importantly the scope of a variable. This means that if you have two variables with the same name but one is global and the other is declared with var inside a function, they will not clobber each other.

Let’s try the code from above using the var keyword:

var val = "hello";
var printme = function(){
    var val = "world";
    return val;
}
console.log(printme()); // "world"
console.log(val);       // "hello"

The second violation

You’ll notice that in the example above the reason the first declaration of val doesn’t change is because the second declaration is inside of a function. Using the var keyword alone wouldn’t fix the problem outlined at the beginning, but putting different modules of code inside their own anonymous functions as well as using the keyword makes sure everyone’s scope is correct.

Look at almost any sufficiently mature javascript library or plugin and you’ll see that the entirety of it is wrapped inside an anonymous auto-executing function. jQuery since 1.2 (the more recent jQuery’s are in general a FANTASTIC example of well-written javascript), output from compiling coffeescript and the list goes on.

TL;DR

Wrap your code in an anonymous autoexecutin function:

(function(){
    console.log('wheee');
})();

Use the var keyword to assert the variable’s scope.

var date = '2012-05-22';

Converting AVI to MP4 with ffmpeg

I wanted to convert a file from AVI (mpeg2, mp3) to MP4 (mpeg4, aac) to be able to play it on another device (one without VLC). I found a ‘helpful’ post on how to do this, but the commands were for a much much older (2008) version of ffmpeg. I then came across a ubuntu forums post that used the same commands but updated for the neweer (but still 2009) version of ffmpeg. After a little more fiddling, I finally found something that worked fantastic!

updated 2017-02-12

There are some new kids in town when it comes to best practices.

First of all we want to use the built-in AAC encoder with ffmpeg now.

Secondly we want to use H.264 instead of -vcodec mpeg4 and just let it do it’s thing without messing with the bitrate. Also, we want to use a Constant Rate Factor for h.264.

TL;DR

If you don’t know what most or all of the below command means, you should probably read this entire post first.

ffmpeg -i input.avi -c:a aac -b:a 128k -c:v libx264 -crf 23 output.mp4

thanks to Werner Robitza for motivating me to update this and researching the new hotness.

original post from 2012-05-10

Caveats:

  • I ran the below command on OSX with ffmpeg installed from homebrew. YMMV as far as codec availability goes.
  • I got up to ~200 frames per second on a Macbook Air with a 1.7 Gh i5, which took a 2.25 hour movie about 30 minutes to complete.

If you’ve already got ffmpeg and an appropriate aac encoder, here’s the ffmpeg command you’ll need:

NOTE: this is the old and busted command. see updated command above.

ffmpeg -i input.avi -acodec libfaac -b:a 128k -vcodec mpeg4 -b:v 1200k -flags +aic+mv4 output.mp4

The long story

I ran the above command on a Macbook Air running OS X Lion 10.7.3 and installed ffmpeg and it’s dependencies with homebrew. There were a couple steps to get to this point.

The following assumes you have homebrew installed and use the brew command.

Installing ffmpeg

brew install ffmpeg

If you don’t have libogg installed (which is likely) brew will choke and give you a couple more steps. It will probably tell you to run brew link libogg, and then the install command above again.

If you don’t care much about how the actual ffmpeg command works, you can now run the below command (replacing ‘input.avi’ and ‘output.mp4’ with their respective values) and you’re done.

ffmpeg -i input.avi -acodec libfaac -b:a 128k -vcodec mpeg4 -b:v 1200k -flags +aic+mv4 output.mp4

ffmpeg command explained

I won’t go into too much detail about the command, just some high points.

-acodec libfaac

This uses the faac codec to encode the audio to aac.

-b:a 128k and -b:v 1200k

These are the audio and video (respectively) bitrates of 128kb and 1200kb

-flags +aic+mv4

These options are explained in more detail here

Customizing

The beauty with using ffmpeg is that there are zillion options for customizing how your file is output. The most noticable things will be upping the audio and video bitrates, and using a better audio codec for aac.

Hello, Again

Hello, World. Again.

It’s time to get some use back out of this blog. Also, i’ve rekindled my excitement with using it with my recent transition of it from Wordpress to Jekyll the other night.

I also had some time on my hands (read: needed to clear my head) so I played around with jekyll and ruby.

At first I wanted to patch jekyll to add a --new flag that would add a new post with a given title. But that was a bit over my head at first, so I started smaller.

I ended up building Quickpost. A mostly-trivial ruby script to quickly add a new post (yep, used it to start this one). Next step would be to make it into a ruby gem, and then to talk to the Jekyll community about adding it into Jekyll proper.

I’m going to try to do a weekly wednesday night post. For both people that still read it (hi mom!).

Node.js and jQuery and Rhythmbox

I wrote a node.js server that listens on port 3000 (with an index page to be served by a regular server) that can do rudimentary control of rhythmbox.

Dependencies:

  • Rhythmbox
  • Node.js
  • Express

##TLDR: Download Playr from github.

###The Premise

I wanted to be able to control my Rhythmbox from my phone, but didn’t want to build a special app to do so. So I set about building something in php to control it. I thought I would be able to use the rhythmbox-client command line tool I use with Compiz’s ‘Commands’ to map things to my keyboard and mouse buttons.

Boy was I wrong.

###Linux and it’s Multiple-User architecture suck

So first I tried to use the command-line and php’s exec to call things. Then I realized that php tried to start an X session to try to start up rhythmbox because it couldn’t detect one. OK. Fine. Maybe I can try to use dbus to communicate with it? No dice. Linux mandates that users cannot see each others programs. Or at least I’ve failed at finding out how. I tried changing the uid,gid,eid through various languages, still to no avail.

Then I had a conversation with @xanderal and came up with the idea of a server running in user space listening for commands. Magical! I’ve been looking to try my hand at some node.js, so I figured this would be a great opportunity to try it out.

I found a great web server framework that would do handily (expressjs) for dealing with uri’s sent by ajax, and got it working in quick order.

###Gotchas

Because the port had to be different, I had to use jsonp to fetch data from the node.js server. What I couldn’t figure out is why sometimes the clicks sent out requests, and sometimes they didn’t. Browser caching is to blame. After setting $.ajax’s cache to false, it fired every time.

###Todos

I’d like to have autocompleted searching for songs and being able to play them.

Also I’d like to add in some volume controls too.

If there is any way possible to get this server to run in user space on startup (or more likely login) please let me know. That would be awesome

Backups or rm -rf

At my startup, we have a moderately sane deployment environment. Check-ins are automatically pushed to a staging server. When we want to push code to our live server, we manually move things.

For a while that meant we had to run a svn export command by hand once a day or so. (we are under heavy development still)

Eventually we needed a couple more things done when we moved code to the live server (among them run google’s closure compiler to reduce our js footprint). So I wrote a script to handle these things. Apparently while testing, I got distracted and never finished it, because when i ran it, the code was this:

# ... snipped ...
#
# code to assure you're running as root
#

if [ -z $2 ]
    then
        loc= '/path/to/code'
    else
        $loc = $2
fi

# nuke old files
rm -rf $loc/*

# ... snipped ...

Now, to the astute, you will notice there is a bug here. Can you find it? It’s in the assignment of

$loc = $2

It SHOULD be similar to the loc assignment above it.

loc=$2

Well. This throws an error, but happily keeps moving on down the script. Next question: what happens here when $loc is an empty string ''? That’s right. I just ran rm -rf /* as sudo on our main server.

I quickly realized what had happened. Errors whizz by about permissions, and finally I Ctrl+c’d it out of existence. Everything still in memory was intact. Our application was still running, I was still ssh’d in. So I took stock of my life, and tried to calm down. I had no idea what to do at this point; thoughts ranged from spending the next 12 hours slowly rebuilding everything (I had the latest copy of our code and db on my local computer, so our code was safe) to never returning my CEO’s emails again and abandoning our company. I initially did some fruitless googling for ‘restore hard drive after rm’ even though I knew - short of serious hard drive-level manipulation - I was NOT getting anything back.

Then I remembered that we are using Jungle Disk to do daily and weekly backup. I figured out that our hosting allows us to reinstall our OS if something like… this happens. So first I checked that we had a recent backup. We did. So i went into our dasboard, and clicked on the button to ‘Revert to Default’. And waited. After that was done, the first thing I reinstalled was Jungle Disk and set it up to recognize itself. Then I simply ran Jungle Disk’s restore program, and voilà! I installed a few more programs that we needed, and we were 100% back up and running in about 3 hours

We back up our /etc, /var, and /home folders daily and our entire file system weekly, so not too much data was lost. As it turns out, this doesn’t include our Postfix maildir, so we lost about a week’s worth of email (personally, I use gmail and it downloads all the email, so I didn’t lose anything). We have since fixed this to save email daily.

This story is another among many to remind you to back your shit up. Fortunately we ended up ok; thanks in no small part to Jungle Disk.

Ablu.us and Chrome Extension

I recently created a file hosting and url shortening service for myself: http://ablu.us/. Now as a pet project, i’m starting to get some feature creep action going on. Case in point: I just wrote a chrome extension to use this service.

That said, here is a link to download it if you actually want it:

###INSTALL ablu.crx

###CHANGELOG

version 0.2 now includes using fizl.us.

version 0.2.1 fixed an initial settings bug

version 0.3 don’t remember fixes. but there were some!

It’ll ask you if you really trust me, and to continue. And that’s it.

I won’t get into the nitty gritty details of HOW TO create your own chrome extension quite yet, but expect a blog post about it soon. Also, Google has a bunch of getting started tutorials that helped me so well it only took me about 2 hours to write this extension from scratch.

Some interesting things are as follows:

###These babies are written in javascript

This was news to me. I knew Firefox plugins are written in XUL, which is similar to javascript. Chrome extensions are written in plain, vanilla javascript. Not only that, the part that gets displayed is literally an html page that you can do whatever you want with. If you want to include jQuery, you can (mine does not). Any other library? yup. It also means that you can use any of the HTML 5 capabilities Chrome offers: local storage, canvas, image rotation.

This strikes me as a bit excessive as you can load an unlimited number of scripts from anywhere. Seems to me that this could be abused.

###Chrome allows copying to clipboard

That’s right. You can copy things to clipboard just like in IE with document.execCommand(‘Copy’) This is exactly how similar URL Shortening extensions work. After seeing how awesome this is, I have to wonder… why doesn’t Firefox support this? I don’t see it being a security risk more than copying profanity into the clipboard. Whatever, it’s nifty that chrome has it.

###Autoupdating is scary

Hoo dangle is it scary. What happens if the dev’s life suddenly tanks and decides he wants to have your browser randomly redirect to a porn site at random intervals? If you have a previously installed extension of his and he decides to update this new functionality, he can (there are some caveats to this, like what permissions the extension already has). This could be problematic as it would be difficult to track down exactly what’s causing this browser behavior. This has the potential to turn any previously useful and non-porn-redirecting extension into a very messy thing to be a part of.

If you are in the market for (another) url shortening extension, give it a try. Let me know what you think. It could probably use a much better logo, so if  you want to help drop me a line at hello at this domain.

Image Uploader and URL Shortener

I recently purchased the url ablu.us with the intention of using it as a url shortener/image uploader. So i did.

It was actually quite trivial, and I had the code for it done about 6 months ago, but didn’t purchase the url till recently. I had created a photo uploader for another website I was working on (newnantheatre.org) so I just copied over the code (I wasn’t getting paid anyway, so I felt it was ok to reuse the code). There are some improvements tho that I’ll document here. However, I’m not actually going into the implementation of a url shortener or image uploader. You should take a weekend and figure this out for yourself. Or maybe I’ll do a post on it later.

###Resize Me

The first thing I wanted was for people to not have to scroll horizontally to see huge pictures. But I didn’t want to resize them during the upload process, because I wanted people to see them the largest possible. So i wrote a quick jQuery script to detect the window size/proportions, and resize the image to that roughly. There are still some bugs in this, and currently there is no way to see the actual real size image without going to the hotlink.

###mod_rewrite

This was a huge thing, as I had just started experimenting with it recently. I’m not a fan of big, scary regular expressions, but they’re damn useful (and necessary) when it comes to mod_rewrite. For those of you who don’t know what this is, it’s pretty urls. It takes the part after the .com, .net, .us, etc, and turns it into a meaningful request to the script that is actually being accessed. This was particularly useful for url shortening because it removes the need for a ?x=xxx at the end of a url.

###api

In the case of the url shortening, i created a dead simple api to use. This can be used as a bookmarklet with any browser that supports them (Firefox, Chrome (only tested in dev builds), Safari, etc). Just paste this code into the url part of a bookmark to create a bookmarklet:

javascript:void(window.location='http://ablu.us/s/up.php?site='+location.href)

Or you can visit http://ablu.us/ and copy the url you want to shorten and click ‘Shorten’. Or you can use it in any other context of plugin, extension, etc for url shortening purposes by using the url http://ablu.us/up.php?site=

##EDIT: Chrome Extension

I have written a chrome extension for this as well.

Programmers and Everyone Else

A hard concept for some people (especially people like me) is that not everyone has the same knowledge base you do. Think about how you would describe what you to to a non-technical person. It’s a hard reality to grasp when you are immersed in code all day. Even the websites that you visit probably have content for people like you.

###Everyone Else###

I have this problem alot. I spend all day reading articles and blogs about programming, by programmers, for programmers, and I forget that not everyone else in the world is a programmer.

I recently read a (rather old, but still relevant) article explaining the biculturalism in software programming. I would like to think of myself as a UNIX developer. I don’t even own a Windows computer (I do dual boot, and have a virtual machine both running Windows 7). At home I have a laptop running Ubuntu Netbook Remix, and a desktop running Linux Mint. Sometimes I have to just take stock and recognize that there are a very very very small number of people who do what I do. It just seems like a disproportionate number because it’s all around me.

Just remember that users are stupid. They aren’t stupid like, us. They’re even worse.

PHP and Security

Recently, I have been doing some work with php and having users log in. One of the projects I’m working on is something where we’re pretty much rolling our own mini-CMS. We have users log in, manage sessions, check timeouts, etc. In php, security is pretty easy to do well (for my example… i’m being very general here). The rest of this post will skip over explaining how redirections and sessions work in php.

This is the easiest way to prevent someone who is not logged in from viewing the current page:

if (!isset($_SESSION['user_id'])) header("Location: login.php");

What executes is if the user is not logged in (or has timed out and $_SESSION['user_id'] has been unset()). Then the user is redirected to login.php or any appropriate page.

However, what happens when you run into something like an indexing or archiving bot that ignores headers? You run into this tdwtf problem. That article also tackles deletion-by-href instead of deletion-by-form. That’s a whole different beast. What can you do about this problem? Is there a more secure alternative to using headers?

###Headers are just dandy###

What most people (including me up until recently) assume is that after sending the header, all things stop. For a bot, this is not the case, it goes on it’s merry way executing the rest of the code. In the case of the above article, with dire consequences. But fret not! There is a simple solution.

exit();

By putting exit(); at the end of that line of code, the script stops executing, and while the bot may not be redirected, disaster is averted. So, your code will now look like:

if (!isset($_SESSION['user_id'])){
    header("Location: login.php");
    exit();
}

Hope this helps stave off any disaster.

Ambition and College

Like many of my fellow students at Tech, I didn’t have to work much through high school. I showed up to class and got my A (ok, maybe a B here or there). I was on cruise control and I’m positive there are alot of people who can relate. Then came college.

To quote Talladega Nights, “If you’re not in first, you’re in last”. That is (for the most part) a very applicable philosophy here at Tech. Fortunately, I’ve come to terms with the fact that I’m mediocre at best. This, however, does not mean that I lack anything like ambition or drive or the will to succeed. I just accept that there are smarter people in the world than me. I try not to beat myself up for not being the best and the brightest. I’ve already proven I’m in the top echelon by getting this far.

###A Bit Of Ambition###

Having established that I’m a tad lazy, I can now point out that last summer was spent working for myself doing freelance design/production of websites. (seems to be the cool-kid thing to do for bored CS majors here). Now, however, I’m looking for a bit more of a steady income and am attempting to acquire a (real) job for this summer. This also takes a bit of ambition. Attending job fairs, sending out endless resumes, going on nerve wracking interviews. (As a side note, i didn’t know you could spell wracking with or without the ‘w’). Especially when you are a 3rd year CS major with no (real) internship and/or work experience under your belt.

About 3 months into my undergrad career here at Tech, I found myself already doing side projects. Learning new languages, trying things that weren’t part of the homework assignment. It was then that I realized that yes, I am in the correct major. I’m a nerd, I love making computers do awesome things, I love wowing people and showing them the amazing capabilities of the machine sitting in front of them. Ask anyone who is successful in their respective field why they are successful, and without a doubt they will tell you it’s because they enjoy what they do. Not only was it their ambition to succeed, but because they don’t have to “work”, it’s fun.

So I guess what I’m trying to say is: I work hard at what I do because I love it. Please hire me?

Ho Hum Rovio

###UPDATE

It seems that Wowwee did things without telling us behind the scenes. According to their API, the encoders reset every time they are accessed. What they DIDN’T tell us is that the embeded os checks the encoders at 7hz. So our random findings with the encoders happened when we accedentally accessed the encoders in between when they were polling it. One solution is to just poll it faster (20hz seems to work). Wowwee is addressing this problem with some new firmware.

###/update

I am presently in a class called Robotics and Perception. This class is all about how robotics work and the underlying principles therein. We have discussed things ranging from motion to sensors to feature recognition. Our main project is making a little robot move around and do various things.

The robot we were given was a Wowwee Rovio. So far we have done some pretty fun things with it.

And then we needed to get accurate.

First, Rovio: A Quick Catch-Me-Up. Rovio is a “mobile web cam” that has a nice, pretty web interface for you to stare at whomever’s shins you so choose. It also has an API (kinda) that you can use to develop your own commands and movement. This is just dandy if you are making a replacement web app or even an iPhone app. However, the way that you USE the API is with http requests. You can control the rovio by going to a webpage. Yikes. On the bright side, it’s really damn simple to do. something like wget http://192.168.10.18/rev.cgi?Cmd=nav&action=18&drive=1&speed=1 would make it drive forward a bit. Therein lies the problem.

This allows you no control over simple things like the motors. Or accurate movement. Or Even access to encoders. There is apparently a command to get an “MCU Report” that gives a string of 32 or so bits containing various information about encoders, positions, and whatnot. HOWEVER. Not a single group that is working on the Rovio with us can get the damn thing to work. Encoders that never change. Random numbers being given as positions. Inconsistent movements for the same command.

For instance. We have a command that rotates the Rovio 30 degrees. To accomplish this, we must move three times one way, then once back. Why? Because a side affect of only having a set number of commands that can be given at certain speeds means that there is a smallest one. Supposedly there are 10 speeds at which the Rovio can be rotated. However, nothing above 6 does anything. (larger = slower …wtf?) The motors hum, but it goes nowhere, and the lowest speed that actually moves goes relatvely far (~22 degrees). So to go to 30 degrees, we must go 22 degrees 3 times, then come back 37 degrees (the next lowest speed).

This solution would be stellar, and perfectly acceptable if not for one thing: this behavior is neither predictable nor consistent. Sometimes the same command given goes too far, some times it doesn’t go far enough. This is frustrating to say the least. When using the camera to check our bearing, it becomes much much easier. But for the time being, we are “dead reckoning” with something that is unpredictable.

Wish us luck.