I've been using Fitocracy for a while now and I love it. The motivation of earning points and competing with friends totally works on me and it's really helped me to run/work out more.
Because Fitocracy is a relatively new company they have yet to release a public facing API. For a lot of fitness buffs this means absolutely nothing, but for developers (who might also like to work out from time to time) it means that it is much harder to get at all the great data that you put into Fitocracy with every workout you log. Particularly, I was really interested in looking at my running data. I wanted an easy way to see how much I had run in the last week/month or a good way to display times from the last run somewhere else.
So, like any good programmer, I wrote something myself to fix this.
I had been looking for a project to learn some Ruby on and I wanted to play around with the Heroku hosting platform, so writing an RESTful API seemed like the perfect task. I took care of all the interactions with Fitocracy using Mechanize and used Sinatra as a simple micro framework for the API.
I was REALLY impressed with how easy it was to set up an application on Heroku. You just do a simple git push and it's live!
So, what does this API do?
It's a RESTful API that returns some JSON with information about a user and the runs that they have logged into Fitocracy. For example if you were to enter this URL:
It would return something like this:
"note": "Felt like doing a faster run today... 6:52 miles, not bad."
"note": "Ran w/ Eileen to Caesar Chavez Park, ran around the park a bit then came home. A really nice little run. "
Here's a live example: JSON of DorkRawk's Fitocracy Runs
(NOTE: If you get a forbidden error from this link, just copy the URL and paste it into your browser. I'm not sure what's up with it.)
Just replace the user name ('dorkrawk' in the example above) with any valid Fitocracy user name and you will get back info about all of the user's running workouts.
I've also put the code for this project up on my GitHub account, so if you're interested in how all of this works, please check it out here: https://github.com/dorkrawk/unofficial-fitocracy-runs-api
Hopefully Fitocracy will come out with an official API soon, but until then I hope this provides some people with a useful tool.
You can check out a demo of the player here with some classic tunes from Davenport, The American Autumn, and Captain Supreme. It only works in Chrome right now because Firefox doesn't support .mp3s in <audio> tags (because it's a closed source compression algorithm). It might work in IE9, but don't hold me to that.
Do you do any coding on a Mac? Do you use Coda? If not, you should really check it out, it's a beautiful piece of coded editing software! Now, do you want to open Coda from Terminal? Sure we all do!
Recently I've been spending a lot more time in command line (Terminal if you want to use the OSX lingo) and since I've moved to doing all of my Python coding in Python I wanted a good way for the two to play together nicely. Some brief Googling brought me to this: Command-line Coda, a short Perl script that lets you use "coda" as a Terminal command to open files in Coda.
Simply download the file and copy it into one of your $PATH directories such as /usr/bin and change the permissions to execute ( type this into the command line in the directory you just copied the file: "chmod 755 coda" ). Now you can type this:
... and it will open up your file (in this case "dullroar.py") in Coda! Simple, but useful if you spend a lot of time in Terminal, but still want to edit your code in an attractive environment.
I noticed as I was drawing this week's Mount Saint Awesome comic that I draw myself sitting at a desk, in front of a computer quite a bit. This is probably because I am sitting at a desk, in front of a computer quite a bit. It's an occupational hazard.
As I've drawn this scene several times over the history of the comic, I thought it would be interesting to put them all together in chronological order and watch my art progress (even if I'm still in the same place).
Without further ado, I present... Me Sitting In Front of a Computer!
Huh... I spent a lot of time goofing off on the computer...
On Saturday night (2pm - 2am) I went to a Hackjam put on by Hackers@Berkeley. I hadn't done any large scale tech build thing like this since college (probably almost 6 years ago) so I just wanted to show up, meet some people, and learn some stuff. The last time I was really learning/hacking with new stuff PHP was the default web language, Ruby on Rails was the new hotness, and Google was a privately held company who's only commonly used product was a search engine, so I felt a little out of touch with what people were working with today. I learned that there were a lot of things that I didn't know much about and it really gave me some good technologies to look at.
Node.js (+ NowJS)
Bootstrap (by Twitter)
Wow. How have I not been using layout tool kits all this time? Bootstrap basically makes building website layouts and designs simple with some CSS and HTML to building page grids, form styles, validation, pagination, and a whole bunch of other stuff that I'm sick of writing from scratch all the time. This will be used for A LOT of my projects in the future.
Git (and GitHub)
I'm sort of embarrassed to say that I'd never used Git until Saturday night. I've used svn for some version control in the past and even used Google Code to setup repositories for projects, but GitHub seems to have a HUGE community of developers. It really seems worth using. I think I get the basics of Git now and I'll be using it for versioning in some of my upcoming projects.
I suppose it's better late than never for these things. I'm glad I went to the Hackjam and now I have a bunch of new stuff that I want to play with!
[note: This was originally written for my just as a note to myself about what I learned for my own "Input Coffee" productivity blog but I thought other people might be interested in this stuff, so this is a bit of a cross-post]
I am probably more pleased with the title of this post than I should be. Douglas Hofstadter, if you're reading this please consider using it as a title to your autobiography.
Anyways! The real point of this post is to talk about what I've been doing to help myself get things done. I've tried to make the focus of this blog about my work with CS, art, and music. I try to post things that I think other people might actually be interested in, but in order to produce those things I need to do a lot of everyday work that's probably not as engaging. BUT! I've found that it really helps me to write about the work I'm doing, even if it's not that interesting to read about. If I'm learning something new, it helps to write what I've learned so that I can be sure I really understood it. Zach Weiner (of SMBC fame) is doing this with physics and math on his blog. I also find it helpful to keep a log of things I do when I practice music. I can track my progress and make notes of things to focus on over time.
I wanted a central place where I could write about stuff, mainly for myself, but I was open to other people seeing most of my notes (in case people have valuable insight that could help me) so I did what any self-respecting nerd would do... I set up yet another blog on this server! I now have a "getting things done" blog called Input Coffee. It's not written for an audience and the posts are probably full of typos. In fact most of the posts just have sentence fragments and notes about whatever I'm working on, but I feel like just knowing that most of the posts are potentially public keeps me motivated to write regularly.
While people are welcome to check out Input Coffee if they're really interested in mundane day to day work, I don't expect it to be very engaging. Some of the posts there will get polished and turned into posts to this blog, which I would like to see people read! So far I've felt like this type of blog has been really helpful for some of the skills I've been working on and I hope I can keep it up.
So I spent a bit of time tonight messing around with Manga Studio and my little Wacom tablet. I've never been very good at drawing digitally, so it was fun to play around with this tool for a bit. While it didn't make me a better artist, it was a nicer environment for sketching and inking than Photoshop. Here's the output of some quick drawing. I guess the cat has a jet pack? And he used it to go to the moon? I don't know...
When I was in 4th grade I started playing saxophone in the school band. To get an "A" for practicing we needed to practice 125 minutes per week. I never let myself practice less than 130 minutes per week, just so I would always have done better than the maximum time required required.
What does this mean? Probably that I was kind of an over achieving little kid, but more importantly it's a habit that seems kind of dorky when I look back on it, but it really was a good good for me. At the time I was a pretty good sax player (for a 4th grader). As I got older I lost that discipline and ended up being somewhat mediocre at a lot of things that I really cared about.
Recently Eileen and I have been keeping a "Good Habits List", basically a chart of things we should be doing regularly to be better people. I've been using mine to make sure I do things like practice piano and guitar, work out, read difficult, but interesting books, draw, and study. The practicing music has been especially rewarding.
It's not that I haven't been playing guitar (or piano) in the past, but it's been a while since I've regularly PRACTICED either. I spent a lot of time either playing with the band, which was awesome or just noodling around while my brain was often thinking about something else. I've really been working on taking at least 30 minutes several times a week to really focus all my attention on what I'm playing. This means working on technique by running scales with a metronome, making sure I can play chords in any key cleanly, and slowing my playing down so that I don't just brush over sloppiness, but go back and fix it. This also means playing music by other people. I bought some Ben Folds Five sheet music and I've been working through song in that, breaking down hard parts into small chunks and working them out, playing single measure over and over until I can play them in the context of the full song, and then playing along with the song to work on dynamics and feel in my performance. I've been doing the same with guitar; conscious technical work and then learning songs and playing along with records.
These are things I should have been doing for a long time, but somehow I just got out of the habit and my playing has suffered because of it. I'm not putting in 8 hour practice sessions like a concert pianist, but reasonable sized chunks where I'm just focusing on playing better. Since I don't have a band any more and I my schedule is a lot more flexible this is a great time to really get myself into a good practice routine and build up my guitar and piano chops.
It feels like it's already paying off a bit. I've been able to see big progress in my piano playing and I'm remembering how fun it is to play along with songs on guitar. My fingers just feel more at home on the instruments. I've spent a lot of time in the past wishing that I was a better musician because I enjoy playing so much, it feels really good to be doing something about it.
So, a little over a year ago I wrote a post about the making of Mount Saint Awesome comics. Things have changed a bit since that time and I wanted to do an updated (and more visual) walk through of my current comic making process. This post will walk through the making of last week's comic, from scripting to final details.
1) Writing The Script
I write all my scripts in Google Docs because I tend to come up with them in random places, so I like having a central, synced location for all of them. At this point I try to layout what will be said in each panel so I can get an idea of the layout.
2) Drawing A Thumbnail
I don't do this for every comic, but whenever I want to get a feel for how the scene will be set up I start the drawing process by doing a quick, small thumbnail. This just gives me an idea of where to put everything so there's enough room for the art and speech bubbles.
3) The Layout Lines
Now I pencil my layout boxes for the comic. This one was pretty simple, but some end up being more complicated than this. Everything about the layout stays in pencil until the inking stage in case I want to break one of the borders or something.
4) Sketching The Comic
Now I sketch the comic into the frames I've drawn. Basically I try to reproduce the thumbnail, but with proper proportions and positions. This gives me a skeleton to actually draw over.
At this point I actually draw the comic. I start to put in all the details of the subjects, use a ruler for straight lines, and basically get things looking how I want them to look. I probably spend more time on this step than I should, but I don't trust myself to get things right in the inking stage without first doing it in pencil.
Now the comic gets set in stone, so to speak. I use a couple different sized pens (Prismacolor pens with a brush tip, an 03 tip, and an 08 tip) to ink the pencils from the previous stage. Once that's done I erase all the extra pencil lines. Sometimes I do make mistakes in the inking (you might be able to see one in the 3rd panel), these can be corrected in the next step...
7) Scan Into Photoshop
At this point the inked comic is scanned at 300 dpi into Photoshop where I adjust the layers to bring out the black and make sure the whites are white. I can also erase any mis-inked sections. When I'm done here I save it as a big (3268 x 1572 px in this case) .jpg.
8) Illustrator Magic
Now I create a new Illustrator file with the dimensions I want the final comic (780 x 364 px in this case). I place the .jpg from Photoshop into the file and resize it to scale. Then I use the Live Trace tool (ignoring white) to smooth out the lines of the inked comic. This also separates the ink from the white background so I can color "under" the ink. I add a white layer underneath the ink layer to sever as the background of the image.
Using the Pen Tool I color the comic by creating shapes of color under the ink layer. The coloring is done over a bunch of different layers. I still need to be better about setting up a standard color pallet for skin tones, hair color, desk wood, walls, etc. because now I just go back to previous comics to color pick what I want.
10) Adding Shading
This is something that I need to learn A LOT better. Once the coloring is finished I put layers of various transparency levels over the coloring (but under the ink). Then I draw my shading/shadows in black (which comes out in various translucence of black) the same was I draw shapes with the Pen Tool when I color.
11) Adding Text
Once the comic looks finished I use the text tool in Illustrator to add all the dialog and the text at the bottom. I've been doing most of my text with the font Blambot Casual. I'm still not every good at estimating the size of speech bubble that I will need, but I'm getting better. Doing the text this way is nice because if I catch a typo after I post, it's very easy to fix it and resave the comic.
12) It's A Comic!
Once the text is added I save it as an 8bit .png and upload it to the site! You can see the final product of all this work here. The whole process takes several hours from start to finish and can vary greatly depending on the details needed for the comic.
I know that once you have to explain a joke it really detracts from the humor. Still, I like making really nerdy jokes and it sometimes makes me sad when they don't land with a larger audience. I really liked the joke from last week's Mount Saint Awesome (also pictured below), but I think I might have over estimated the general public's recognition/understanding of genetic algorithms when I made this comic.
Inspired by the site explain xkcd and my love of genetic algorithms/comedy, I've decided to write an "Explain Mount Saint Awesome" for this comic.
[In 2057 scientists create the first truly self aware artificial intelligence by using genetic algorithms]
AI: "Hello World."
AI: "My grandfather wasn't no random bit string!"
[...Though some argue that it can't really be considered "intelligent".]
Ok, so to understand this joke, you need a basic understanding of genetic algorithms and how they work. Genetic algorithms are a search method used in machine learning based of off the process of biological evolution. A genetic algorithm will generally start with a population of random "solutions" (sometimes in the form of a random bit string representing the solution). These random (and very bad) solutions evolve by crossover (combining 2 or more solutions, like breeding in living organisms) and mutation (random changes in the genotype of the solution). The best (most fit) solutions are most likely to pass on their traits to the next generation of solutions. This keeps happening for many generations until an acceptable solution is found. (This is a VERY basic overview of how GAs work. They can be much more complicated than this, but they're useful for things like music generation and stock prediction).
The comic in question is implying that the software for this artificial intelligence was found by starting with a population of random bit strings and using a genetic algorithms to "evolve" these "programs" until they produced a self aware artificial intelligence. Realistically this isn't a very good way to find such a complex solution and another evolutionary computing technique called genetic programming, might be slightly better suited (though still not very realistic at this time), but that's not really the point. It's a comic, not a text book.
The line "My grandfather wasn't no random bit string!" is a parody of a stereotypical creationist objection to biological evolution, "My grandfather wasn't no monkey!" (best embodied by the accompanying picture). Here I'm implying that this miracle of modern science, a self aware artificial intelligence, is saying things that a creationist would say. These are not things that an intelligent entity would say.
So, was the joke worth this long winded explanation? Probably not, but some people might actually be interested in genetic algorithms (or making fun of creationists). If you're interested in either of these things please let me know and I'd love to chat about them in more detail!