Tuesday, May 31, 2011

fun with node.js - building a node development appliance for virtual box

so... people who know me know i've been raving about this thing called node.js for the last several years. if you haven't heard about it, click over to the wikipedia's entry on node and take a minute to read it, i'll wait.

the simplest description of node would be to call it a "javascript web server." this is a decent description when talking to non-tech folks, though us technorati know it's really an "ecmascript application server framework."

turns out node can do some amazingly cool stuff. what most people have heard about is it's pretty good at handling high load situations. slightly less well known are the benefits of using the same code to render HTML in the server as is used to render HTML in AJAXy client apps running in a browser.

ultimately though, it's just a lot of fun to program apps with node.

so... to help spread the node.js gospel, i put together a virtual box appliance you can use to try it out without the fuss of having to download and compile the core packages yourself. i also added mongodb (and the node driver) to the image so you can play with persistence.

anyway... you can find more detailed info over at the node appliance page on my site. it's not a small download, but the time you lose in the download is more than made up for by the time you save by not having to configure it yourself.

you can find more information about node at the official node website (complete with docs!) and tim caswell's "how to node" site. you can keep up with the node community by following the #nodejs hashtag on twitter, visiting nodejs.se or dropping in on the #nodejs IRC channel.

happy coding!

Sunday, May 29, 2011

on accessing services from within second life

so a few moments ago, @ZauberExonar asked on twitter if anyone was aware of a JSON parser in the Linden Scripting Language (LSL). people unfamiliar with LSL or Second Life(tm) may want to skip this blog posting. in typical "software architect" fashion, i'm answering his question with several paragraphs of "why JSON and LSL don't mix" (and what you can do about it.)

a very brief intro to JSON

JSON, as we all know, is a transfer syntax that encodes messages in a way that looks remarkably like a JavaScript / ECMAScript object declaration. So... if you execute this JavaScript:

var foo = {   success: false,   error: "insufficient cheese error: recommend rebooting universe" };
console.log( JSON.stringify( foo ) );

you would get a JSON blob that looks something like this:

{"success":false,"error":"insufficient cheese error: recommend rebooting universe"}
so far, so good, right? you start with a JavaScript object and you convert it into a string that represents the object using a familiar syntax. it's now ready to send over the network. the receiver can execute this code to deserialize the string version of the message into a real live object:

var bar = JSON.parse( "{\"success\":false,\"error\":\"insufficient cheese error: recommend rebooting universe\"}" );

and now the receiver has an object it can manipulate.

the cool thing about JSON as a transfer syntax is messages are serialized using encoding rules that are way easy to process in JavaScript (the programming language of the web.) so it's easy to understand why web-devs love the heck out of JSON.

XML, in comparison, is seemingly bloated. XML allows you to define your own tags, each with semantics specific to the message. this can be a good thing in some situations, but you have to add the smarts to your JavaScript application to grab specific bits of data out of the XML and construct objects to contain the data.

enter the virtual world

but if we want to consume a JSON service in the virtual world, things get a little complicated. in Second Life, the programming language of choice is LSL (Linden Scripting Language.) a lot of people love to hate on LSL. i'm not going to do that here. but i will say this: parsing JSON or XML in LSL is a pain in the ass.

perhaps the most irritating aspect of LSL in this regard is it's lack of associative arrays. whether you call them maps, dictionaries, objects or associative arrays, they all let you use a string as a key into a collection of items.

because there's no associative array in LSL, you can't pull off the JavaScript trick of creating a new object that's essentially identical to the JSON. no, you have to map the contents of the JSON string into a list (which is like an array) or global variables.

JSON lovers aren't alone... XML partisans have discovered they're in the same boat: you have to parse the message and reason about the semantics of each field while constructing a list or setting global variables.

easy parsing?

and another aspect of JSON and XML parsing in LSL that's sub-optimal: you have to write LSL to look at each character in the message string.

okay, this is not precisely true. if your message does not include escaped quotes or curly braces, you can use llParseString2List() to build a list that's MUCH easier to parse. the down side of this approach is it's not entirely easy to handle curly braces inside strings and honestly, the code to implement it frequently looks bizarre.

so what i've started to do is to use a LSL-friendly format i'm calling the "DSD Text Transfer Syntax." experienced readers will recognize DSD as the abstract type system i routinely threatened the VWRAP group with. DSD text looks like this:

:v:1
appkey:u:77c3dd7c-4639-4681-aa52-a7dd35e96fd8
:{:
success:0:
error:s:insufficient%20cheese%20error%3A%20reboot%20universe
errno:i:23
desc:l:http%3A//example.com/error_descriptions/cheese.html
:}:

messages are a collection of individual lines (separated by either a CR or a CRLF.) each line contains three fields separated by colon characters. the first field is a "name" field; the second is a "type tag" while the third is the data in question. note that not all lines have a name, and not all lines have a data field. also note that colon characters are verboten in the data field, so we encode strings and URIs that may contain them.

people familiar with the LLSD binary encoding will likely recognize the tag characters, they're directly ripped off from that spec. (i also added a version tag so parsers will be able to know when they receive a message they may have problems interpreting.)

so the way you parse this in LSL is to split a message into lines like so:

// assume the string 'message' contains the complete message text
list lines = llParseString2List( message, ["\n", "\r", "\n\r"], [] );
integer lineCount = llGetListLength( lines );
integer i;
for( i = 0; i < lineCount; i++ ) {
string currentLine = llList2String( lines, i );
list fields = llParseString2List( currentLine, [":"], [] );
string name = llList2String( fields, 0 );
string key = llList2String( fields, 1 );
string data = llList2String( fields, 2 );

// now process the name-key-data triple
}

what you do when you process the name, key and data values depends on your app. i find i'm frequently either stuffing them into global variables or constructing new lists with the values. to parse the message above, we do something like this:

// parse location info message. generates a list with the following members:
// 0 - integer - success (1 for success, 0 for failure)
// 1 - integer - errno (0 for success)
// 2 - string - error description ("" if call was successful )
// 3 - string - URL for more information ("" if call was successful)
// 4 - string - region name
// 5 - float - x location in region
// 6 - float - y location in region
// 7 - string - comment text

list parseLocationInfoMessage( message ) {
integer success = TRUE;
integer errno = 0;
string error = "";
string desc = "";

integer in_map = FALSE;
integer version;

string region = "";
float x = 0.0;
float y = 0.0;
string comment = "";

list lines = llParseString2List( message, ["\n", "\r", "\n\r"], [] );
integer lineCount = llGetListLength( lines );
integer i;

for( i = 0; i < lineCount; i++ ) {
string currentLine = llList2String( lines, i );
list fields = llParseString2List( currentLine, [":"], [] );
string name = llList2String( fields, 0 );
string key = llList2String( fields, 1 );
string data = llList2String( fields, 2 );

// now process the name-key-data triple

if( 'v' == key ) {
version = (integer) data;
if( 1 != version ) {
success = FALSE;
errno = -1;
error = "invalid message version";
break;
}
} else if( '{' == key ) {
in_map = TRUE;
} else if( '}' == key ) {
in_map = FALSE;
} else {
if( FALSE == in_map ) {
success = FALSE;
errno = -2;
error = "parsing error";
break;
}

if( 'success' == name ) {
if( '1' == key ) {
success = TRUE;
} else {
success = FALSE;
}
} else if( 'errno' == name ) {
errno = (integer) data;
} else if( 'error' == name ) {
error = llUnescapeURL( data );
} else if( 'desc' == name ) {
desc = llUnescapeURL( data );
} else if( 'region' == name ) {
region = llUnescapeURL( data );
} else if( 'x' == name ) {
x = (integer) data;
} else if( 'y' == name ) {
y = (integer) data;
} else if( 'comment' == name ) {
comment = llUnescapeURL( data );
}
}
}

return( [ success, errno, error, desc, region, x, y, comment ] );
}

some might argue this is no less complex than XML or JSON parsing in LSL, but for my money, it seems a little more straight-forward.

making services give you DSD Text

ideally you're in a position to control both the server and the client. if you are, then your server code gets to decide what type of encoding you send back to the client. slatebureau.com uses the same API endpoints for requests, irrespective of where they come from. to determine what encoding to use, it looks for the Accept:, Content-Type: and S-SecondLife-Shard: headers in the request and uses this algorithm.

  1. if an Accept: header is present, and you can generate the mime type the client is requesting, use it. if you can't generate the encoding requested, send a 406 status code.

    in other words, if you ask for a 'application/json' or 'application/dsd+json', i'm going to give you JSON. if you ask for 'text/plain' or 'application/dsd+text', i'm going to give you the text format described here.

  2. if there's no Accept: header but there is a Content-Type: header present in the request, send the response in the format of the content type. if you can't generate that encoding, don't freak out, continue to step 3.

    so if there was a Content-Type: header in the request and there wasn't an Accept: header, i'm going to try to encode the response using the same type. if your request included a json blob with an 'application/json' Content-Type, i'll try to generate that as a response.

  3. send a DSD-Text formatted response.

so... anyway... i wrote a few DSD parsers in PHP and JavaScript. i'll try to dig them out and post them to github. -cheers!

Sunday, March 20, 2011

the return of hbmobile.org

so i'm in the process of turning the hbmobile.org web site back on, and i'm going back to spending my spare time making gadgets. there's a big long story behind this, so let's take it piece by piece.

i work for klout.com right now, but for a big chunk of my career, i worked for companies in the mobile value chain. most of the time i worked there, i wondered "why do mobile phones suck so hard?"

we all have some pretty great phones available to us at the moment, so it's easy to forget: before the iPhone and Android OS, being a developer on a mobile device was expensive, difficult and frustrating. expensive 'cause you frequently had to pay tens of thousands of dollars for development systems before you could even begin to start developing a mobile app. difficult 'cause you had to learn an entirely new operating system and dev platform and frustrating 'cause the mobile OS vendor, handset manufacturer or carrier would frequently hobble your app beyond recognition.

back before Android and iPhone, a bunch of us hobbled together our own DIY phones without these problems. Surj Patel and Deva Seetharam put together a "TuxPhone" back in 2005-2006. I spent some time putting bits of hardware and software together in 2006, while Craig Hughes and Gordon Kruberg of gumstix.com did some heavy lifting, building a GumStix daughterboard populated with a mobile phone chipset.

we also had this group called "the homebrew mobile phone club." modeled on the earlier "homebrew computer club," the idea was to provide support and encouragement for people building their own devices.

in 2008, the group fell apart. partially 'cause i had to concentrate on getting divorced. but also 'cause we were getting more or less what we wanted from the mobile industry. the iPhone and Android used familiar operating systems and well known development tools; you didn't have to pay google or apple insane amounts of cash for dev systems and you more or less had access to all of the phone's hardware.

for the most part we declared victory and moved on with our lives.

we did do a lot of very cool stuff. Adrian Cockroft used the "myPhone" project as an excuse to learn how to develop enclosures for mobile devices. i wrote a hack of a lot of control software for GSM modems. and Craig & Gordon did an insanely good job of developing open hardware that could send and receive phone calls and text messages. James Young saved our old wiki at the hbmobile.org backup; go check it out, there's a lot of cool stuff there.

sure... it's not that big of a deal when you compare it to what HTC and LG do, but remember, we were a bunch of individuals with soldering irons, extra cash and a few extra hours per week. we proved you didn't HAVE to be a multi-billion dollar company to build a mobile phone.

that the myPhone was more expensive than a subsidized iPhone, and had fewer apps than Symbian was not the point. the point was, we were able to build it on our own. we also shared as much as we could, using open source and creative common licenses for most system components. (read my blurb for O'Reilly called "the complete open phone" for the rationale behind this decision.)

so... we did a lot of cool stuff and moved on with our lives.

but now i'm reactivating the hbmobile.org domain to work on a new project.

AT&T has announced they're going to buy T-Mobile. This is a bad deal for everyone (except AT&T share-holders.) Om Malik has a great blog post on why it's a bad deal here: "In AT&T and T-Mobile Merger, Everybody Loses."

for the last year i've been worried by moves from the carriers: price increases, charging for tethering, wireless bandwidth caps, etc. and now we're falling towards monopoly in the GSM world.

i'm going to spend my spare time for the next couple months trying to solve the "quality communications services over unlicensed spectrum" problem. i'm not trying to dislodge AT&T or Apple or Microsoft. i'm not trying to build mobile phones that will be the next big thing at SxSW. i want to build some prototypes of systems that sidestep licensed spectrum and the problems of carving it up and giving it to monopolies.

if you're interested, take a look at the new hbmobile.org site. subscribe to my blog feed and consider listening to my rants on twitter.

if it makes sense, i'll also be hosting meetings in san francisco (and in second life.) stay tuned!

Saturday, March 12, 2011

radiation monitoring station

so sparkfun.com has this geiger counter device i've been eyeing for a year or two. (actually, i think this is an updated version of the one i was lusting over.) and now that we've apparently had an explosion at Fukushima 1, i believe we'll see an increase in environmental radiation. fwiw, someone posted a video of the explosion, if you haven't seen it already.

my college friend wilbur related to me that during the chernobyl meltdown in the 80's, his high school science teacher tracked the rise and decay of environmental radiation. that always seemed like a fun project to me. sort of like a weather station, but in touch with current events.

anyway, so i'm going to order one of these things tomorrow night. if we can get 10 people in the bay area, we could even do a group buy (ping me on twitter at @OhMeadhbh.) but i think tomorrow i'll be setting up a website to track decay events and map them on a google map.

cheers!

Tuesday, March 8, 2011

driving in dallas

my mom just forwarded this one to me as part of an explanation for why the rest of the family is frightened by her driving... her excuse: "i learned to drive in dallas." i tried figuring out who wrote this, but no luck. if it's yours, please ping me so i can give proper attribution.

First you must learn to pronounce the city name. It is DAL-LUS, or DAA-LIS depending on if you live inside or outside LBJ Freeway.

Next, if your Mapsco is more than a few weeks old, throw it out and buy a new one. If in Denton County and your Mapsco is one-day-old, then it is already obsolete. Forget the traffic rules you learned elsewhere. (Frisco has screwed everything up.)

Dallas has its own version of traffic rules... "Hold on and pray."
There is no such thing as a dangerous high-speed chase in Dallas . We all drive like that.

All directions start with, "Get on Beltline," which has no beginning and no end. (It REALLY DOESN'T!!!)

The morning rush hour is from 6 to 10. The evening rush hour is from 3 to 7. Friday's rush hour starts Thursday morning.

If you actually stop at a yellow light, you will be rear-ended, cussed out and possibly shot. When you are the first one on the starting line, count to five when the light turns green before going to avoid crashing with all the drivers running the red light in cross-traffic.

Construction on Central Expressway is a way of life and a permanent form of entertainment. We had sooo much fun with that, we have added George Bush Freeway and the High Five to the mix.

All unexplained sights are explained by the phrase, "Oh, we're in Fort Worth !"

If someone actually has his or her turn signal on, it is probably a factory defect. Car horns are actually "Road Rage" indicators - and remember, it's legal to be armed in Texas ..

All old ladies with blue hair in a Mercedes have the right of way. Period. And remember, it's legal to be armed in Texas ..

Inwood Road, Plano Road, NW Highway, East Grand, Garland Road, Marsh Lane, Josey Lane, 15th Street, Preston Road all mysteriously change names as you cross intersections (these are only a FEW examples). The perfect example is what is MOSTLY known as Plano Road . On the south end, it is known as Lake Highlands Drive, cross Northwest Highway and it becomes Plano Road, go about 8 miles and it is briefly Greenville Ave, Ave K, and Highway 5. It ends in Sherman ...

The North Dallas Tollway is our daily version of NASCAR. The minimum acceptable speed on the Dallas North Toll Road is 85 mph. Anything less is considered downright sissy. It also ends in Sherman .

If asking directions in Irving or SE Dallas , you must have knowledge of Spanish. If in central Richardson or on Harry Hines, Mandarin Chinese will be your best bet. If you stop to ask directions on Gaston or Live Oak, you better be armed... and remember, it's legal to be armed in Texas

The wrought iron on windows near Oak Cliff and Fair Park is not ornamental!!

A trip across town east to west will take a minimum of four hours, although many north/south freeways have unposted minimum speeds of 75.

It is possible to be driving WEST in the NORTH-bound lane of EAST NORTHWEST Highway . Don't let this confuse you.

LBJ is called "The Death Trap" for two reasons: "death" and "trap."

If it's 100 degrees, Thanksgiving must be next weekend. If it's 10 degrees and sleeting/snowing, the Fort Worth Stock Show is going on. If it has rained 6 inches in the last hour, the Byron Nelson Golf Classic is in the second round (if it's Spring) - and it is the Texas State Fair if it's Fall.

If you go to the Fair, pay the $8.00 to park INSIDE Fair Park . Parking elsewhere could cost up to $2500 for damages, towing fees, parking tickets, and possibly a gunshot wound. If some guy with a flag tries to get you to park in his yard, run over him.

Any amusement parks, stadiums, arenas, racetracks, airports, etc., are conveniently located as far away from EVERYTHING as possible so as to allow for ample parking on grassy areas.

Final Warning: Don't Mess With Texas Drivers ... remember, it's legal to Be armed in Texas

Monday, February 21, 2011

on the benefit of open mobile devices

in which the lack of an open hardware ecosystem for hobbyists and experimenters is described and bemoaned; radical ideas espous'd; and a solution to the world's mobile woes is consider'd.

in a different life i was the co-instigator for the Homebrew Mobile Phone Club. it was great fun, and i got to work with some insanely brilliant people, notably Adrian Cocroft and Craig Hughes (formerly of GumStix.) our objective was to support people who were building their own mobile phones, the same way the famous Homebrew Computer Club had supported early innovators in what grew into the PC industry.

we were active for about 2 years between 2006 and 2008, and were, in fact, able to make a home-brew system that could place and receive phone calls and text messages. at least 90% of the credit should go to Craig Hughes and Gordon Kruberg at gumstix. while i was busy getting divorced, Craig, Gordon and Adrian were doing real work.

after demoing our hardware at the Maker Faire 2007, we more or less moved on to other interesting projects. mostly 'cause the iPhone, Android G1 and FIC / OpenMoko Neo 1973 seemed to be doing a MUCH better job at opening up the potential for mobile applications.

i think a lot of us felt we had accomplished our task. we demonstrated what could be done with off the shelf hardware and software and (i hope) we tweaked the "big guys" into realizing there was a huge ecosystem in end-user selectable apps for mobile devices. remember, this was before the iPhone or Droid; the most successful application phone s'til then were the Palm Treo and various WinCE devices. realistically, we were a small amount of gasoline on an already growing fire.

but after a couple years, i'm still mildly disappointed. sure, we have some GREAT application platforms: iPhone, WP7, Android. heck, even BlackBerry looks good.

there's enough competition between the major mobile OSes that we're bound to get an increasing number of cool software features. but mobile hardware is still dominated by a small handful of companies: Apple, HTC, LG and (for the moment) Nokia.

this is an understandable situation. most people buying mobile phones use it to talk and text. whomever can deliver that simple feature set the cheapest will win large markets. an increasing number of people are experimenting with smartphones (iPhone, Droid, etc.) but it's still reasonably small compared to the number of people who just want to gab and text. and sure, as full feature smart phones get cheaper and cheaper, you'll see a lot more people adopting them.

but this isn't the market i'm talking about.

i'm talking about people who want to try out new things with mobile devices. like integrating RFID / near field communication with mobile devices. or adding a DECT radio module to a phone. or experimenting with eInk displays. or stuffing a mobile phone into a small wearable pin shaped like a star-fleet insignia.

and then i read this article: "Meshnets, Freedom Phones and the People's Internet." if you wanted, you could interpret the article as "yet another utopian pipe-dream by a young anarchosyndicalist," and maybe you would be right. but i think there are some pretty important social and business ramifications in this article.

i think what i realized after reading chris' article is that gilmore's quote about the internet applies to mobile phone companies as well. the internet does interpret censorship as damage and does route around it. we learned this in egypt. so my corollary to gilmore's quote would be something like this: "local economies interpret market domination by remote actors as damage and innovate around them."

"local" in this sense can be either geographically local or "local" to a vertical market or local to a concept.

throughout the middle-east right now, we see grass roots movements resisting and toppling repressive and allegedly corrupt regimes. the mubarak government did a reasonably bad job of cutting off the country from the outside completely, but they did cause some turmoil amongst opposition organizers "on the ground."

in about a year, we are told, we'll see a multi-party democracy holding elections. informed opinion is there'll be no one group holding majority power. in this environment, i believe it will be politically difficult for the emergent government to maintain a regulatory regime restrictive enough to include an "internet off switch." my suspicion is the fear of other political actors in the new egypt will trump fears of a second grass roots movement that can take down the new government.

i'm enough of a techno-anarcho-syndicalist to think that's a good thing.

but i wonder, is there an equivalent situation in the mobile marketplace? will the desire to shake off the yoke of Apple's oppressive app review regime lead to an iPhone uprising? will the info-proletariat revolt if/when Google eventually starts being evil and tracking mobile devices to deliver you targeted ads?

okay... maybe i'm overstating it a bit.

but right now we have a mobile infrastructure that's top-down. you want 4G? great. you have to wait for verizon to think your market is important enough. you want to add an RFID reader to mobile device. it sure as hell won't EVER happen on a Verizon phone, so you'll have to wait for T-Mobile to notice your market, add some limited support, then realize there's not enough cash there and abandon you.

for the past year i've been toying with the idea of trying to setup a company to provide LTE or WiMAX support in the San Lorenzo Valley. There's waaay too little ROI to justify this as a commercial entity, but there are enough geeks in the valley that a co-op might be doable. The cost of the equipment is falling rapidly, thanks to Huawei kicking the collective asses of the entrenched players (Ericsson, Nokia-Siemens, etc.)

i think i could convince a few peeps to sign up for VoIP over LTE if there were an off the shelf handset that would support it. but none of the majors will make such a handset if there's a market of less than a million phones.

and this gets me back to thinking about mobile handsets. wouldn't it be fun if there was a "handset kit" you could buy for a couple hundred bucks. think if it like LEGO for mobile phones. you want GSM? fine, you add the GSM brick. you want an OLED display? fine, you add the OLED brick. you can sort of already do this if you're handy with a soldering iron. (just go to sparkfun.com and search for cellular devices.)

but wouldn't it be fun if we had something "for the rest of us," who wanted to mix and match features of our mobile devices, but didn't want to design a new PCB every other week?

if we had something like that, we could experiment with all sorts of crazy "last mile" wireless concepts up here in my valley. protesters in repressive regimes could easily change from a centrally managed SMS/GSM system to... heck... use your imagination here... twitter over wi-fi to iridium uplinks to the interwebs.

the point here is, in terms of technology, protesters in egypt have the same interest in affordable tech experiments as 4G customers in the mountains. the centralized "powers that be" will not offer what we need either for economic or political reasons. maybe it's time to think about a "post-carrier" world?

why? 'cause every time Verizon and T-Mobile tell me they can't do something, it makes me start looking for a way to route around them.

Wednesday, February 2, 2011

experiments with social media

so i've been curious about second life people's twitter behavior and thought it might be fun to do a few experiments. no no, not talking about evil torturous experiments on defenseless digital animals. and i'm not scraping my social network, getting ready to sell them out to advertisers. i'm just genuinely curious about people's behavior with respect to tweeting and re-tweeting.

the following tests won't be held up by the APA as exemplars of rigorous experimental design. but i hope they'll satisfy some curiosity. also, i should point out that i'm not hiding my intentions by claiming some great reward or a chance to win a bazillion dollars that aren't there. no. i'm offering a few, inexpensive rewards. i'm also paying things in Linden Dollars (L$'s.) this is the game script for second life; it's a lot easier to pay people directly in-world than to mail out checks or deal with PayPal.

experiment 1 : re-tweet this please

my first experiment was this simple tweet:
social experiment. what happens when i ask people to retweet retweet requests in the guise of a social experiment? - please RT!
so i'm basically just asking people to please re-tweet a message. i'm offering no incentives to do so, only the pure joy of participating in my personal experiment. after about eight hours, only two people had re-tweeted this message.

experiment 2 : minor financial reward for re-tweeting

the second experiment was this tweet:
okay. social media experiment 2 : i'll give 50 lindens (each) to the first 10 people who retweet this message.
so i'm changing things up here and providing an incentive. if you re-tweet that message, i'll give you L$ 50. before you get too excited, you should probably note that 50 lindens equates to something around 20 US cents (or US$ 0.20 .) so it's not a really big reward.

i doubt this will be a great shock, but more people re-tweeted this message; after about 4 hours, about 5 people re-tweeted the message. so, it turns out that, at least in my social network, more people will re-tweet a message if there's a personal reward.

another interesting factoid: there was at least one person who re-tweeted this message who i can't see. i believe this means they're protecting their tweets and i'm not following them. people who want to try to get more "twitter buzz" by offering a reward should probably remind folk that if you can't see them, you can't reward them.

experiment 3 : rewarding someone else (a non-profit)

here's my third tweet:
social experiment: if 10 people retweet this message in the next 4 hours, i'll donate L$500 to Bridges for Women, http://sl8.us/gAPHcs4_E
in this case, i'm telling people they'll get no direct reward, but their actions can help out a non-profit. what i didn't really tell people is i planned to donate L$ 500 to Bridges for Women's Second Life presence whether i got the requisite re-tweets or not; it seems like we would be teasing them if we didn't. Also, L$ 500 is about US $2.00, so it's not like we're talking about a huge pile of cash. Still, L$ 500 could be useful if they wanted to spruce up their second life presence a bit with a few inexpensive knick-knacks.

this tweet proved way more popular than the previous two. it took about 2 hours for me to get 10 re-tweets. it's possible, however, this may be because there are just a lot more of my twitter peeps looking at twitter in the early afternoon (pacific time) than in the morning. or it's just that people are more motivated by altruism. or maybe small linden rewards just don't register with people.

experiment 4 : follow me and re-tweet and i'll give you some lindens

with my fourth tweet, i'm getting back to appealing to people's self interest:
social experiment : L$50 to the next 10 new followers who retweet this message. (follow me, then tweet your #secondlife avatar name)
but we're not talking about a lot of cash; remember, L$50 is about US$ 0.20 (20 cents.) also note that i'm telling people to publicly associate their second life and twitter identities. some people may not want to do that. sounds pretty straight-forward, right? yes and no. remember, this is for NEW followers. existing followers, in the immortal words of willy-wonka, "get nothing."

this experiment was crafted in part to avoid the problem with experiment 2 where you couldn't see (or reward) people who were protecting their tweets. you can setup twitter to send you an email message when someone starts following you (in fact, i think that's the default behavior) so you'll always be able to see new followers.

after about an hour, i had 7 re-tweets (though one was from someone whom i think already followed me.) i'm confident it won't take too long to get the last couple new followers.

experiment 5 : lindens for current followers who recruit new followers

the next tweet tries to overcome this last impediment:
social experiment : L$50 for the first 10 existing followers who convince new people to follow me. get new followers to tweet your name.
like previous tweets, we're not talking about a lot of cash. L$50 is about 20 cents. but i was curious if it would affect the outcome.

i actually want to publish this post before people on the east coast start going to sleep, and i just posted this tweet. i'm going to come back with results later with results.

observations

i should probably lead off by reminding people they can observe some of the results themselves. i don't protect my tweets, so you can click on these links to see the individual tweets. if you're using "new twitter," you should see a list of people who have re-tweeted the tweet in question.
the second observation i made is that i'm capable of producing some really gawd-aweful social experiments. if i tried submitting these experiments and "results" to a peer-reviewed journal, i'm pretty sure they would be rejected. if i tried to submit them as part of a class in social experimental design, i would be happy to get a D.

"real" experiments start with hypotheses; i didn't do this. they then describe what the testing methodology is going to be; i kinda-sorta did this, but in a haphazard way. and they usually describe how the hypothesis will be confirmed or refuted BEFORE conducting the experiment. i totally didn't do this.

so... observation 2: i'm not really doing a good job at being a social scientist here. but honestly, it's okay. these are anecdotal observations and i never claimed to be a trained social scientist. i know little of how sociological / anthropological experiments are constructed; just enough to be confident i'm doing it wrong here.

the third observation: i think twitter is caching the HTML of individual tweet pages. i noticed that if i used the twitter web page to see who's been re-tweeting things, it seemed to change considerably less often than if i used the API.

more important observations

maybe more important are the following observations:
  1. it seems more of my followers are active in the afternoon. yes. this is a completely unscientific statement. i'm conflating time with message content. had i repeated the same message in the morning and afternoon, we could have an "apples to apples" comparison.
  2. my followers seem to be somewhat altruistic. pat yourselves on the back, twitter followers, you seem to be eager to give away my hard-earned lindens to charities. seriously though, it took only a couple minutes to get 5 people re-tweet the message in experiment 3 and we finished the challenge with a couple hours to spare.
  3. larger sums seem more interesting to people than small sums. when i offered L$50 rewards, uptake was a little slow. slower than when i offered to donate L$500 to a charity. so maybe larger sums motivate people more than smaller sums.
  4. different experiments didn't seem to affect each other. after tweeting the L$500 challenge in experiment 3, i waited to see if there would be more interest in experiment 2. i was thinking we might see a couple people looking at the "big tweet" and then notice the others. but no dice.
  5. some of my followers think i'm a rube. perhaps they're not aware of just how high-brow embedding roald dahl references in pseudo-scientific observations is. but at least one follower indicated i was behaving like a dork for running these experiments.
  6. way more of my followers use the #NewTwitter re-tweet feature than copy and paste messages into new tweets. this shouldn't be a shocker, it's a lot easier on the twitter web page to hit the "re-tweet" link than it is to copy or paste. however, other twitter clients make "re-tweeting with comments" much easier. still, it looks like most people chose the easy "single click re-tweeting" route.
applying these observations

let me start this section by saying you're crazy to use these results as justification for any particular action. it would be nice to say "aha! evidence PROVES larger sums lead to more followers in twitter!" but i just don't see that being an interesting or particular defensible statement based on this data. that being said, the anecdotal data collected might be used to inform a more rigorous set of experiments.

but the data, anecdotal such that it is, might suggest a few "truths."
  1. your network may respond better at specific times of the day. i'm going to speculate that for most people, the majority of their human followers are in the same time zone as themselves. tweeting at 3AM is simply going to reach fewer people since fewer people are awake. it might be a cool idea for someone to come up with a tool to see when their twitter followers are most active. actually, i think most twitter analytics packages do this already.
  2. if you're going to give money away, people respond better to larger sums. i speculate this is because "more is always better" when it comes to cash. a more interesting way to spin this is that maybe some people just filter out low value commercial tweets. for instance, if someone told me "i'll give you a US$1 gift certificate for amazon" and i happened to be in the middle of an involved task, i may simply choose to ignore it. but if they said, "retweet this within 5 minutes for a US$500 amazon gift certificate," i would probably drop what i was doing and start retweeting. so i'm hypothesizing the existence of a "value point" for each person. rewards below that point are not worth the effort. i would be very interested to see someone come up with a "real" experiment for how to determine where this value point is for users.
  3. multiple promotions may have a synergistic effect, but i didn't see that here. i'm going to speculate there are a few people out there who even though they're not interested in a particular promotion, after seeing a it, they'll click on a "more info" or "other promotions" button or look at someone's twitter profile. they may find a promotion or tweet that's more in line with their needs or has a better value proposition for them. i guess what i'm saying is, i hypothesize promotions like the experimental tweets i used here get certain people's attention. while you have their attention, it's easy to convince a few of them to look at other promotions. but i think you have a limited window of opportunity when you have their attention. i spread these tweets out over the course of a full day and had pretty poor luck getting cross-pollenization.
so that's it: my deep thoughts about promotions and twitter. please ping me if you wind up doing "real" research in this field, i'd love to hear about it.

update 1

here's a quick update on the last experiment. so far NO ONE has retweeted the last tweet. this could be due to fatigue (seriously, how long can i keep asking my twitter followers to retweet things.) or it could be because it involves recruiting people to do things. the first four experiments required people simply to press a button. but the last experiment required people to go out, find someone to recruit, and get them to do something.

so maybe we can add one more important observation:
  1. you get more responses when tasks are easier to perform. the rewards i'm offering are on the order of L$50 or US$0.20 (not accounting for exchange fees.) maybe it's unreasonable to assume people will (as @shava23 says) "risk reputation for 20 cents." or maybe my followers aren't the recruiting type. or maybe you're not properly motivating existing followers by saying you'll reward new followers. discuss.