A rambling blog from Arron, a scrawny little dork who likes to code. ;)
Friday, February 20, 2009
Oooh, Discover pisses me off.
Monday, February 16, 2009
When will Mobile Browsers be the new Mobile API?
The Palm Pre is heralded by some as the second coming of Palm. What makes this phone stand out the most is the fact that its operating system is essentially a web-browser that talks to the hardware underneath. It's user interface is HTML/CSS/JavaScript, built on standards blah blah blah. The thrust of it means that writing a Palm Pre app is as simple (or complex) as writing a webpage. For regular end users, this is probably meaningless; all that matters is that the phone looks good and moves quickly. For developers, however, it opens up a new realm of app-developing whup-ass. By making web-apps easier to create, the Palm Pre is enabling developers to make more apps with better quality for less investment.
Pretty much every developer, and several people who have no idea what they're doing, has a good grasp of HTML/CSS/JavaScript. This means that anyone can immediately dip their feet into Palm Pre and start developing. Ease of development is what made the Web explode, and the same potential is lying in wait for the Palm Pre.
So, when will Mobile Browsers be the new Mobile API?
The Palm Pre is very much a step in that direction: you talk to the Palm Pre OS using its JavaScript libraries, and you markup the application's user interface using HTML/CSS. There's only one catch: the application has to be installed first.
Why?
Why can't I, Arron Washington, Destroyer of Worlds and Small Celestial Bodies, visit http://maps.example.com, be prompted by the phone ("Hey Mr. World Smasher, this website would like to access your phone's GPS!"), and then have all the tight integration you would come to expect with an application on any website the Web cares to offer?
Imagine the potential awesomeness of that, being able to access a phone's features via JavaScript in a regular web page. You go to Google Maps Mobile, it asks for GPS access, you grant it, and voila': a whole new subset of features are available just for you, without having to download the app and update it every time a new release comes out.
With this kind of available integration, anyone can make their website "mobile enhanced" just by calling the phone's custom JavaScript libraries. With simple (DEAD SIMPLE) JavaScript integration, something as simple as a coupon site could deliver location-aware opportunities (sales in progress, 30% off!, etc) without having to make an application for every popular phone. Just point your browser at the site, authorize and it's there, all magically delicious 'n' shiznit.
Now, some privacy nuts will tell you, "Hey man, what happens if I enable a site to use my GPS to find my location? That's an invasion of my privacy!" I'll tell those folks, don't get in a boat with cannibals.
I think with the Palm Pre we're inching just a little bit closer to that. The whole awesome website-phone integration thing, not the boat full of cannibals thing.
Saturday, January 31, 2009
can_has_assets? A new Rails plugin for requiring stylesheets and javascript in views.
<%= title "hello world" %>
CanHasAssets
============
can_has_assets is a super-simple way of requiring stylesheets and javascript files
from within views. It also supports inserting snippets of CSS and Javascript into
a page only once. Snippet support should really only be used for rapid prototyping,
though. :)
Installation
------------
script/plugin install git://github.com/radicaled/can_has_assets.git
Notes
-----
can_has_* will include a file or snippet only once -- it is safe to call these
methods multiple times, where-ever required.
Alternatives
------------
If you're looking for more control, consider Needy Controllers by Michael Bleigh:
http://github.com/mbleigh/needy-controllers/tree
Example
=======
In your layout:
<%= stylesheet_link_tag :can_has_assets %>
<%= javascript_include_tag :can_has_assets %>
In your views:
CSS
---
<% can_has_css 'css_file' %>
<% can_has_css :sample_snippet do %>
.item {
/* some fake example css here */
}
Javascript
----------
<% can_has_js 'js_file' %>
<% can_has_js :sample_snippet do %>
function helloWorld() {
alert("Hello, world!");
}
<% end %>
Thursday, January 29, 2009
Discipline + Git = good awesome funtime!
Tuesday, January 27, 2009
Tag Aliases: get them, people.
#rails vs #rubyonrails -- AKA, "Why Tag Aliases are needed in every tagging system."
Mozilla Ubiquity: Metacritic Script
Yes, Mozilla Ubiquity does rock. However, having no API to your site does not rock. It is the exact opposite of rock, in fact!
function __searchMetaCritic(pblock, searchText) {
jQuery.get("http://www.metacritic.com/search/process?sb=0&tfs=all&ty=3&x=0&y=0&ts=" + escape(searchText),
function(response) {
var resultsREGXP = /\[0-9]\.(.*)\<\/p\>/gmi;
var results = response.match(resultsREGXP);
found = true;
if (results == null) {
var msg = 'No results for "${what}"';
var subs = {what: searchText};
pblock.innerHTML = CmdUtils.renderTemplate( msg, subs );
return;
}
var tempElement = CmdUtils.getHiddenWindow().document.createElementNS("http://www.w3.org/1999/xhtml", "div");
tempElement.innerHtml = '<link href="http://www.metacritic.com/general.css" rel="stylesheet" type="text/css">';
tempElement.innerHtml = tempElement.innerHtml + results.join('');
var msg = 'Searching for "${what}"
${results}';
var subs = {what: searchText, results: tempElement.innerHtml};
pblock.innerHTML = CmdUtils.renderTemplate( msg, subs );
});
}
CmdUtils.CreateCommand({
name: "metacritic",
takes: {"what": noun_arb_text},
preview: function(pblock, what) {
__searchMetaCritic(pblock, what.text);
var msg = 'Searching for "${what}"';
var subs = {what: what.text};
pblock.innerHTML = CmdUtils.renderTemplate( msg, subs );
},
execute: function(what) { __searchMetaCritic(what); }
});
Saturday, January 24, 2009
My moment of revenge against L4D exploiters. :)
Monday, January 19, 2009
I don't want to talk to you if I need to sign up for something new to do it.
Like, take this post from the OpenMicroBlogging mailing list. It's about OMB Spec 0.2. When I read it, I instantly had questions about #3, HTML-rendered notice content. A: what the hell does that mean, and B: won't that lock-in OMB consumers to a particular implementation of @ replies and # tags?
Yet, I just can't bring myself to sign up for the mailing list to ask. I don't want to mess with another account on another site for something so trivial. I just don't have it in me anymore. I've even started designing my own small sites to accept OpenID or whatever else I can get my hands on to avoid making a unique account for myself.
I guess I'm all username/password'd out.
As for OMB -- no link, can't find a portal site for it -- my interest is easy integration of microblogging into client sites. In my mind, if a client breeds a community site, integrate microblogging as a communication stream, and expose it via OMB so they can "reach out" as a community into the Web. It's still a big foggy in my mental about it. For now I've just been watching its progress in case a relevant scenario pops up.
Friday, January 16, 2009
Monetizing Yahoo! BOSS.
Excerpted from this post about third-party monetization with Yahoo! BOSS:
Our current policy is, while we do not prevent you from implementing a third party monetization method in conjunction with your use of BOSS, we may at any time require you, for example, to implement and display Yahoo!'s Sponsored Search (or similar) advertising offering instead of a third party's. Alternatively, we are considering the option to pay a fee based on your use of the service; in this case, we would anticipate permitting the continued use of monetization methods from third parties.Basically, Yahoo! reserves the right to fuck you up: any time, any place.
For small niche-like sites this is probably OK; they wouldn't bother trying to get any cheddar from you. If you run something moderately successful powered by BOSS you might have problems in the future.
I don't have a problem with having to display YPN ads or whatever. The real problem is not being able to support third-party monetization efforts. For instance, if you're running a site that makes good bread with CPA ads / Amazon affiliate links, removing those and replacing them with lesser YPN ads is a kick in your junk. What do you do then? Try to manage direct sales?
Something to think about.
Friday, January 09, 2009
The Microsoft Tag site...
Even though it's powered by Silverlight, which means it should function identically in anything that runs Silverlight.
Seriously.
Visit http://www.microsoft.com/tag/ and try to click on 'Get it for your phone' or 'Make a tag' -- it Just Doesn't Work.
That is such a cold, cold burn.
Tuesday, January 06, 2009
Need design ideas? Surf Wordpress blogs.
One of the best resources I've found so far are Wordpress blogs. Some Wordpress blogs have the most ridiculously beautiful themes you will ever find. For instance, following a link from Hacker News got me to some dude's post about "Encouraged Commentary." Excellent ideas aside, the first thing that struck me was that his blog was freakin' beautiful. I mean, look at it. It is aesthetically pleasing and functional, to boot. Hell, look at what he does to images -- they're faded out until you roll over one, at which point the image becomes crisp and the caption pops up.
Another resource is the official Wordpress Themes site. Some gems hidden away in there.
I'm not saying steal these themes or anything -- far from it. But they can provide a jumping off point for the uncreative types to work with. For a certain site, I started with a pretty nice Wordpress theme and then modified it so much it looked nothing like the original... but without the original, I wouldn't have gotten even half as far as I did. It helps that most of the themes on the Wordpress site are liscensed liberally, even though I don't actually look at the underlying CSS. I actually cherry pick certain parts of the designs and incorporate them into one OK-looking site.
It provides enough momentum to get me going, at least.
Sinatra made me go ROOOOAARRRR.
So, sudo gem install sinatra and we're off to the races, right? Wrong. After about 10 minutes of debugging I realize that the Sinatra gem, a) doesn't work with the latest Rack (0.9), and b) seems to be updated infrequently judging by some blog posts I've read. They recommend grabbing Sinatra from github, but there's no stable Git branch available. I don't know if they're using the master branch as the stable branch or what. Doesn't matter, because I don't know what revision of Sinatra works with what copy of Rack. >:(
So I do the next best thing, which is to downgrade Rack to 0.4, which is what the Sinatra gem requires.
Which works. For a bit, until I need to serve up a static html file. I guess that functionality isn't in the Sinatra gem. Some blogs mention how to use the 'public/' directory, which I tried, and failed miserably at; I'm assuming that functionality is somewhere in the github version of Sinatra and not in the gem.
Right around that point I gave up and just cracked out a full-blown Rails project. I copied the logic over, had it up and running in about 7 minutes, which was a stark contrast to the ~2/hrs I spent trying to get Sinatra working.
Lesson?
Next time, just use the latest edge version of Sinatra and hope there are no bugs in it.
This time, I'll just waste two minutes watching the '...'s go by.
Friday, January 02, 2009
My Dirty Programming Secret #424
...using Ubuntu...
...inside of a virtual machine.
Wednesday, December 31, 2008
Preoptimization in real life.
No sweat, even though I picked out what I wanted in about 10 seconds.
I spent the rest of the time thinking about how to phrase the sentence,
"I want a foot-long Subway Club on wheat."
But then I thought to myself, "If I say I want a foot long wheat Subway Club," she'll be able to get the sub bread before I finish speaking. Then I realized that, although that sentence is understandable, it is not very "correct." Would she understand immediately, or would it introduce a further delay in my sub making adventure? On the other hand, even if she did understand it immediately, would she even be able to react in time before I finished the sentence? Was the optimization even worth it?
I totally wasn't paying attention by then, so when she said "What do you want?" I kinda jerked in place and replied,
"Uh, a subway club. On wheat. Foot long wheat."
Tuesday, December 30, 2008
Importing OpenOffice files into Google Documents: Don't.

Saturday, December 27, 2008
Flex file uploads: no custom HTTP headers for you!
For some reason (unexplained, and it seems unlikely that this is an actual security issue) you can't have custom HTTP headers for file uploads in Flex 3.2 (possibly Flash as a whole). They state it in the documentation, to their credit, but it's more of an aside, tucked away at the end of an irrelevant paragraph, than a big red "HEY WE JUST CHOPPED OUT SOME FUNCTIONALITY YOU'D NORMALLY EXPECT TO BE THERE" warning.
For half a minute I thought I was in ruby and said to myself, "I'll just override this and inject the custom headers myself," then I realized where I was and went "D'oh!"
Monday, December 22, 2008
Aptana: Changing Ruby Interpreter on a per-project basis?
"The Chrome."
Thursday, December 18, 2008
ThoughtBot Shoulda -- It Whups the RSpec's ass.
Heh, heh. Yeah, back when people used WinAMP... I guess they still might. I switched to WMP (gawd, I know), but then to Songbird when it finally stopped sucking (still sucks a little, to be honest).
Anyway, for newer Rails projects, I've completely replaced RSpec with Shoulda. It's nice, clean, readable, doesn't add anything extra to the Rails folder hierarchy, and best of all, it is filled with sweet-as-hell macros that take a lot of pressure off'a my tired fingers.
For non-Rails projects (I do those too!), they offer a gem, but I haven't used it yet.
It seems like every day that something exciting and awesome happens in the Ruby / Rails area, and everyone moves up to the next big thing... but I think that's because the next big thing is better than the thing you happen to be using at the moment.