What consumers want is different from what makers want.

When DVD Jon was arrested after breaking the CSS encryption algorithm, he was charged with “unauthorized computer trespassing.” That led his lawyers to ask the obvious question, “On whose computer did he trespass?” The prosecutor’s answer: “his own.”

If that doesn’t make your heart skip a beat, you can stop reading now.

One particular angle about the iPad is that it’s a closed system.  As a developer, I tend to like open systems myself.  I can do whatever I want with it, and I can tinker with it. However, instead of complaining about apple, developers should do better work on open platforms.

Most products aren’t used to make more of itself.  Crowbars are used to open doors, not make more crowbars.  Pans are used to make food, not make more pans.  The person eating the food (consumer), and the person making the food (maker) are two different parties.  Part of the problem for general purpose computers that it serve two masters, the consumer, and the maker.  And each has different needs.

The consumer just wants things to work.  They’re trying to get something else done, so they can go home, make more money, raise their status amongst their peers, socialize with other humans, and ultimately get laid.  They’re not interested in tinkering because this is not what they tinker with.  Apple has shown that in order to achieve this, you need control from top to bottom of both the hardware and software stack, especially if you allow 3rd party developers running native code on a device.  If the days of Windows systems crashing were any indication, you shouldn’t trust any joe developer to have the same sense of quality as you.  

The maker, however, wants to be able to do with their hardware and software, whatever they want.  The openness of a platform allows you to learn, to play, to grow.  And it’s with this very sandbox and playground that you’re able to learn how to innovate the technologies of tomorrow, which ultimately drives our economy.  If many of us weren’t able to tinker and make things with the computers we used, it’s doubtful that many of us would be innovating as programmers and engineers today.  

However, part of the motivation for making things is so people can use what we built, and consumers can only use things where makers are making them.  In order for both to happen, makers and consumers have to be on the same platform, and therein lies the dilemma.  And thus far, Apple has leaned towards catering to the consumer, because they’re the ones that pay money.  That’s not to say everyone is one or the other.  I may be a web maker, but I’m a video chat consumer.  I don’t mind making web applications, but I hate futzing around with video drivers.    

So far web apps are the only thing that bucks the trend.  There, developers can make on open platforms, like linux, and the consumer with their browser are shielded from difficulties.  However, with a foreseeable future of different types of devices, native apps are going to be around on smartphones, tablets, and who knows what else.  Until wireless bandwidth is cheap, abundant, and ubiquitous, this will the case for a while.

The only way out of a closed system of native apps is to develop use-centric applications on open platforms.  Developers and engineers are going to have to care very much about design, aesthetics, and user experience.  Something that works and is simple.  This will have to start with developers being able to empathize with frustration and with others.  Instead of lamenting about how Apple has a closed system, develop really great, simple, easy to use, and useful applications on open platforms.  

How to add paths to your emacs shell

Actually this is probably because start-process can’t find your git

executable. Try doing something like this in your Emacs configuration

(adjust the path if needed):

(setenv “PATH” (concat (getenv “PATH”) “:/usr/local/git/bin”))

(setq exec-path (append exec-path ‘(“/usr/local/git/bin”)))

If you’re trying to use magit in emacs, and you can’t figure out why it’s not recognizing your git repos, it’s probably because it can’t find git. And it can’t find git, because it’s not in the path.

Just set the path, as it’s show above, and add your own directory, wherever git is being held. If you’re on a mac, you can add /opt/local/bin for the rest of your utilities.

Erlang mode on Emacs

Although there are a few other editors for Erlang, I prefer to use Emacs for Erlang and its the only major reason I use Emacs for. Erlang now has an eclipse plugin too, called Erlide.

Erlang comes with the emacs mode as part of its standard distribution, so you only need to customize your emacs settings to use the erlang mode. Once you have Emacs installed (I have Carbon Emacs on my Mac OSX), create a .emacs file in your home directory (or use the one that you already have).

$ vi ~/.emacs

Then insert the following lines of Lisp code into your .emacs file.

;Erlang Mode
(setq load-path (cons  "/usr/local/lib/erlang/lib/tools-2.6.1/emacs" load-path))
(setq erlang-root-dir "/usr/local/lib/erlang")
(setq exec-path (cons "/usr/local/lib/erlang/bin" exec-path))
(require 'erlang-start)

/usr/local/lib is where my Erlang is installed, and /usr/local/lib/erlang/lib/tools-2.6.1/emacs is the location where erlang.el and erlang-start.el files are, which actually define and initialize the Emacs Erlang-mode.

Update the path and version of the tools in the above code as per your installation, and enjoy the amazing features – including the Erlang shell right from Emacs.

Just something to remind me.

A REST service description language not a good idea

There's a lot of public data out there, and more being added everyday.  However, they're added in all sorts of oddball formats, like HTML in crazy formatted tables, CSV, PDFs, Excel files, etc.  For web services, at least the data format is easier to parse, like XML and JSON through SOAP and REST APIs.  

And there's no uniform way to access and parse all this data.

Even when you just focus on REST APIs, there's no uniform way to access all the APIs.  Right now, if you want to use an API, you need a separate wrapper library for each API.  Even though REST is simple enough that all you need are URIs and HTTP verbs, without documentation or a service description, you don't know what methods are available to you from the service.  Therefore, if you wanted to join data from two different REST APIs in a mashup, you currently need two separate wrapper libraries, then join the data in your application.

Taking a first crack at the problem, you might think that we should have machine-readable descriptions of these web services.  There have been some tries at that.  One is YQL, which treats the web as a database in which you use SQL-like statements to get and join data from REST APIs. 

Another is WADL, a machine-readable description of REST resources–like a WSDL for REST.  The idea is if you have a machine readable description of a resource, you can generate API wrapper code for it.  Then to join data from two different REST APIs wouldn't require two different interfaces. 

These two solutions have the problem of requiring programmers to write an explicit mapping of which service has which URI methods available, along with what parameters they take.  YQL uses a global repository of table mappings in a github repo to convert SQL statements to REST methods.  With WADL, it requires maintainers of the REST API to both update their API, their documentation, and a WADL file.  When the service API changes, the WADL/WSDL could be out of date, unless their web frameworks generates WADLs for them.  To my knowledge, none of the major web frameworks do such a thing.  

There's even a blog post by Joe Gregorio about whether we need WADL.  He says no.  I think I agree, though what he proposes is to have a limited number of service descriptors, the same way that we have a limited mime-types.  That way, when we see a web service resource description type, we expect it describe a REST API with certain methods, the same way we expect an image/png or text/html file to have certain properties and operators.  He may have something, but if descriptions of REST APIs are not the way to go, what's an alternative?

A simple guessing game in Erlang

Recently, I found out about a book called Inventing your own computer games with Python.  In it, there's a "Guess the Number" game.  Man, it takes me back to when I was toying around in GW-Basic.  I've been meaning to do Erlang again, and was going through Learn You Some Erlang for Greater Good, when I wanted a simple project to practice some Erlangian.  I had forgotten a lot of the basics, and this was a good way to get back into it.  Not a very fun game to play–maybe I'll try Bagels later on.  For now, it's just "Guess the Number".


start() ->

intro(Guesses) ->
    io:format("Welcome to the Guessing game!n"),
    io:format("I'm thinking of a number between 1 and 20n"),
    get_guess(Guesses, random:uniform(20)).

get_guess(Guesses, Secret) when Guesses =< 0 ->
get_guess(Guesses, Secret) ->
    io:format("You have ~p guesses left.n", [Guesses]),
    {_, User_guess} = io:read("What is your guess (end with .)? "),
    check_guess(Guesses, User_guess, Secret).

check_guess(_, User_guess, Secret) when User_guess =:= Secret ->
check_guess(Guesses, User_guess, Secret) when User_guess >= Secret ->
    io:format("The number I'm thinking of is lower. Try again!n"),
    get_guess(Guesses - 1, Secret);
check_guess(Guesses, User_guess, Secret) when User_guess =< Secret ->
    io:format("The number I'm thinking of is higher. Try again!n"),
    get_guess(Guesses - 1, Secret).

lose_game(Secret) ->
    io:format("You lost the game!n"),
    io:format("The number was ~pn", [Secret]).

win_game(Secret) ->
    io:format("You win the game! 🙂n"),
    io:format("The number was ~pn", [Secret]).

What's interesting is that basic process and components of the game map very well to each decision that must be made, so you don't need to use an if statement at all.  All you need are the guards for each function.  Also, the entire game state needs to be carried in the parameters of each function.  I can see how that can be a pain for more complex games.

Lorem ipsum for images in French Maid


Just yesterday, I saw a post on HN about the lorem ipsum for images, and I thought, "Hey kinda neat, but it shouldn't really require a server.  All you really need is a place holder."  So I decided to add it to French Maid, and it didn't take long…considering I was watching TV at the same time. 

French Maid is just a small little javascript wrapper library that injects common behaviors into web pages using unobtrusive javascript, based on jQuery.  All you ever need to do is set the attributes of html to standard html5 or microformats, and it'll give you some behavior that makes sense.  I started this because while working in Sinatra and Django, there wasn't built in javascript behaviors for templates like in Rails.  Turns out that was a good thing, but a bit annoying, so I wrote something to help me out.  

Lorem ipsum for images is the only non-standard in there right now.  When you're laying out a page, put:

<!-- Changes this into a div placeholder -->
<img class="lorem" data-size="200x100" />

And you'll get an image placeholder 200 px wide by 100 px height.  There's only a few options:

<!-- When you want to set the color -->
<img class="lorem" data-size="100x100" data-color="#ddd" />

<!-- Or when you want some other styles along with it -->
<img class="lorem" data-size="100x100" style="margin: 10px" />

<!-- Or if you want to override something -->
<img class="lorem" data-size="100x100" style="border: 0px solid black" />

This is pretty useful for having placeholder icons.  I usually spend lots of time picking icons when I'm laying out a page, when I really shouldn't be.  

I haven't yet made a homepage for French Maid.  Figured I would when it's more mature, but hey, if you're not embarrassed when you release something, it's too late, right?  So while I haven't gotten around to implementing all the microformat and html5 specifications, it's been useful so far, especially for standard pattern AJAX calls.  The screenshot is from the test/example/documentation page in the project.  You need Sinatra gem to run it.  Then just fire up the server by running the test file, then navigate to localhost:4567 and start clicking around.

Have fun, and if you find it useful, lemme know.  It'll be motivation to get a homepage up for it.

Getting a kid started with programming

I recently had a kid that wanted to program as well. He's about 12. Wanted to program games, but didn't get very far in a directX book.

I had a couple choices for him, due to some requirements: 

  • Something easy to install or didn't have lots of things to install 
  • Something with a all-in-one gaming library 
  • Something with some sort of community around it. 4) It'd be nice if there was a book for it.

So with those there, there was: 

Ruby and HacketyHack. http://hacketyhack.heroku.com/ It also has a app framework called shoes that you can use to build both games and apps. However, since _why left, all this requires a lot of hand hold to set up.

Lua and Love. http://love2d.org/ Lua is an easy language to pick up as it's pretty minimal, and love's 2D engine is pretty fantastic. I've used it before and it's pretty easy to get started with, and plenty of examples, as well as a vibrant community.

Python and Pygame. http://www.pygame.org/news.html Pygame has all of the above, and for me, the final winner, since there was a book that walks the kid along from basic text games to the graphics part. http://inventwithpython.com/ 

Just in case there are those of you out there that are looking for things to help out your little programmer.  Are there others you'd recommend?