Entries matching tag 'code'
5,105 comments
i’ve talked to a lot of people over the last year about “what they should do next”: some want to get into technology; some are wondering what to study in school (or, even, whether they should stay in school at all!); some want to create a product. no matter what we talk about, it always seems to come back to one thing: making stuff. and i feel like i always give the same advice: that no matter what you’re doing, no matter what field you’re in, you should learn to code.
it’s been talked about quite a bit before [1] and a conversation with fred recently brought it back up: i like to see coding as being a bit like art. it’s one of those skills for which you should at least learn the basics. you may not get very good at it, and that’s fine, but in learning how to do it, you’ll get three things:
- it’ll make you appreciate how it’s done and how an engineer’s mind works;
- it’ll give you a different perspective on whatever it is you do during your day job;
- it’ll give you the ability to make something out of nothing – like painting on a blank white canvas!;
the follow-up i tell people is that they should “learn by doing” [2]. that is, to pick a small project of some sort and to see it through to the finish. the smaller and easier, the better, as you’ll be able to realize a working product you can hold, appreciate and show your friends. it almost doesn’t matter what language or platform you pick, as long as you pick something that you can finish and that you dreamt
up.
over the last couple of sundays, i’ve started to make stuff on the side again. i take a sunday here and there to try to learn something new. sometimes these projects are foursquare-related and, sometimes, they are things i’ve seen others do and was curious to learn. nearly everything i do on a day-to-day basis exists in the digital world, so i’ve started seeking old-school, slowed-down, hand-made experiences that we haven’t done in a while.
recently, jealous that mari can paint so well, i decided to try my hand at learning to paint. i decided to take my own advice. i’m aiming to learn and to make something that i can hang on a wall: be it a painting or some other sort of programmatic art. i’m trying to bring my knowledge of code to art and to programatically create art from data. my first project is one i’ve been thinking about for a while: i’m trying to visualize what i know of my dna. i hope to hang this on a wall someday soon.
last week, my buddy steve shared a quote with me:
“building software is the last thing we do by hand.”
it’s a clever way of looking at how art has progressed.
it’s the last art that will allow us to make something out of nothing.
—
notes:
1. pg, hackers & painters.
2. i watched the eames documentary last weekend and i noticed they talk a lot about this ‘learn-by-doing’ philosophy. it’s a great doc, you should put it on your list for 2011.
6,896 comments
I just started developing for Adobe AIR like 15 minutes ago, so bear with me here. :)
I wanted a small desktop app that I could run in the corner that would auto-refresh and show me where my friends currently are. So I whipped up ‘foursquair’ quick. It basically wraps the foursquare mobile web (http://m.playfoursquare.com) and refreshes once every 5 minutes.
In the near future, I’m hoping we can make the app use the foursquare API (coming soon). Get the source (and let me know if you want to collaborate/help out) and get version 0.1 of the app.
3,436 comments
So I’ve been writing a lot of code the past few months :). Some are just small apps that I wrote to learn iPhone coding. Others are hacks that I’ve been using for a while in various projects. A lot of it is just sitting on my computer taking up space. I thought it would be neat if I just open-sourced it and let everybody play (and maybe learn something in the process).
I’ve been slowly cleaning up recent projects and putting them up on github for everyone to download. Right now, you’ll find Emojicon (a hack to get the Emoji keyboard on your iPhone), Pickture (a HOWTO app I wrote for Dennis’ class back in the Fall) and Round Robin (a small experiment/game we ran at MobileCamp a few months ago).
There’s a whole folder of this kind of stuff on my Desktop — I think I’m going to slowly start sharing it all.
5,176 comments

Last week, Emoji on the iPhone was all the rage with some people in my circle of friends (/followers). By default, usage of the Emoji keyboard is only available on iPhones purchased and used in Japan. However, some hacks exist that can allow your non-Japanese iPhone to access the Emoji keyboard. The first version of the hack requires that you jailbreak your phone (too complicated for most); the second requires loading of special Vcards into your address book (messy); the last method is to download an app from the App Store that enables this setting on the handset (easy, but for a small price).
We were talking about these different methods a few days ago and found the easiest way to enable this was to use the App Store method. There are a few apps currently in the store that can do the trick but I wanted to build my own for three reasons:
1. I was interested to see how quickly I could build such an application. It didn’t take long to code.
2. I thought the price of $4.99 for such an app was too much; and I was curious to see if I could get a similar app approved for much lower.
3. I wondered whether the App Store would actually let me submit an application that changes a low-level user preference (outside the application “sandbox”, as Apple describes it).
I submitted my application (Emojicon) five days ago. Earlier today, I got news that it was rejected. Hah! I half-expected it. The best case I could have hoped for would have been that the App Store accepted it, but then rendered it useless by enabling it in a future iPhone update. The reason given for the rejection:
“An Application may write data on a device only to the Application’s designated container area, except as otherwise specified by Apple. [...] For security reasons, iPhone OS restricts an application (including its preferences and data) to a unique location in the file system. This restriction is part of the security feature known as the application’s “sandbox.” The sandbox is a set of fine-grained controls limiting an application’s access to files, preferences, network resources, hardware, and so on.” [Taken from the iPhone OS Programming Guide].
It was a good experiment: I got to challenge myself on how quickly I could go from idea to submitted app. And I got to test the acceptance process – particularly when working with shared preferences.
The question I have now though: How did the other Emoji-enabling apps make it into the App Store? :)
Emojicon is open-source (all four lines of code – ha!). Get it at /code/emojicon.
2,846 comments

I recently guest-lectured Dennis/Michael’s Designing Around Place class. I mostly talked to the kids about iPhone development — with some primer material on OO, MVC, etc. We wrote a lot of sample code in class (most of it got deleted shortly after class ended. wah!). Then I got to thinking that others might find this code useful too especially because there’s not much open iPhone code out yet (and almost _none_ in small bite-size chunks that beginners can use as a start). So I’m trying to package a few examples together into small working apps. The first of these apps is something I called “Pickture“. It will allow you to get an image from either your photo gallery or from the camera.
2,973 comments
An alpha version of Ubiquity just came out of Mozilla Labs. It’s a Quicksilver-like add-on for Firefox that allows you to quickly launch favorite sites and chain together actions. Aza and gang have put together a powerful toolkit. I particularly like the idea of scripting together various actions and being able to modify content inside a page. (For example, see the TinyURL command).
As I was reading about Ubiquity, I couldn’t help but smile. I’ve been using a very rudimentary version of a similar setup for a few years now. A while ago, frustrated with having to load up individual pages and add-ons for common tasks, I pieced together quick launch system using bookmarklets and Firefox’s keywords support. I’ve been wanting to share these hacks and even though Ubiquity now captures all of these elements quite nicely, I figured now is a good time as any to do that.
Some basics
First off, any time you bookmark a URL in Firefox, it will give you the ability to attach a “keyword” to the bookmark. Once you’ve saved a bookmark, edit the entry using Bookmarks Manager (Bookmarks > Organize Bookmarks) and fill in the “keyword” field. I usually pick a short keyword such as “map” for Google Maps and “t” for Twitter and “g” for Google. The keyword can be used as a shortcut in the browser’s address bar. For instance, if you chose a keyword “home” for the bookmark to your homepage, you can type just “home” into your address bar and you’ll be redirected to your page. If you have a keyword “g” for Google, all you have to do is to type the letter “g” into the address bar to be taken to Google.
But what if you want to combine this keyword with a search term? This could be particularly useful in the Google example above. The second step is to get the bookmark URL to respond dynamically to any searches you might want to do. You can get Firefox to dynamically fill-in a URL with text of your choice by using the “%s” substitution token. For instance, let’s say I’d like to be able to quickly search for something on Google. I can use the keyword “g” followed by my search text in the address bar to search Google for that term. To do this, I’d bookmark the URL “http://www.google.com/search?q=%s“. When used alongside the keyword, Firefox will automatically substitute “%s” with my search text and will show Google’s search results for that term.
Examples
These are some of the most-used shortcuts I’ve put together, along with the keywords I use:
Action: Find something on Google
Keyword: g
URL: http://www.google.com/search?q=%s
Action: Find something on Yelp
Keyword: y
URL: http://www.yelp.com/search?find_desc=%s&find_loc=New+York%2C+NY
Action: Map an address on Google Maps
Keyword: l
URL: http://maps.google.com/maps?q=%s
Action: Find something on Hype Machine
Keyword: h
URL: http://hypem.com/search/%s/1/
Action: Quickly add current page to del.icio.us
Keyword: da
URL: javascript:(function(){l=location.href;t=document.title;if(!t) t = prompt('title:');tags=prompt('tags:');location.href='https://api.del.icio.us/v1/posts/add?url='+escape(l)+'&description='+escape(t)+'&tags='+escape(tags);})()
Notes: This will prompt you for tags (space-separated).
Action: Quickly add current page to del.icio.us (with notes)
Keyword: das
URL: javascript:(function(){l=location.href;t=document.title;if(!t) t = prompt('title:');s=prompt('notes:');tags=prompt('tags:');location.href='https://api.del.icio.us/v1/posts/add?url='+escape(l)+'&description='+escape(t)+'&extended='+escape(s)+'&tags='+escape(tags);})()
Notes: This will prompt you for tags and will ask you to fill in the notes field.
Action: Twitter something
Keyword: t
URL: [links to script on my system that automatically authenticates and posts to Twitter. see below for more]
Some notes
I started using these hacks mainly because I was tired of using heavier bookmarklets and popups to perform simple tasks. For instance, the del.icio.us posting bookmarklet is very lightweight in that you don’t have to download meta-data (tags, etc) from del.icio.us before you post a URL. It’s also easy to use these same bookmarklets in other browsers – I use the del.icio.us hints on my iPhone to quickly save things when on the go. As you can tell, this is a very simple system. One of the major drawbacks (which Ubiquity improves upon) is that bookmarklets/keywords only allow you to perform “GET” requests (“POST” is not allowed). This is the reason I had to write up a separate script to provide the ability to post to Twitter. Ubiquity allows you to perform all sorts of network connections using jQuery (including AJAX calls). On the other hand, one of the issues with Ubiquity (which is easily configurable in my keyword-based setup) is the use of custom keywords. For example, I might prefer using “f” for FriendFeed updates. Someone else may want to use “f” for Facebook. From a command development standpoint, who will get first choice on a keyword like “ebay”? It will be interesting to see how this namespace issue is handled.
Porting keywords to Ubiquity
I took a few minutes to create the Ubiquity del.icio.us “quick add” bookmarklet – it’s essentially a straight port of my simple keyword-based bookmarklet from above. I’m going to start moving a few other browser hacks into Ubiquity as well in the coming days.
Feel free to browse and subscribe to my collection of Ubiquity commands.