JavaScript Serial Applet

A couple of weeks ago I put together a process for allowing access to a hardware serial port from JavaScript. I thought I would point to the documentation page here and allow the comments section of this post to be a place where questions could be answered and so on.

Without further ado, here it is:
JavaScript Serial

Update: I can no longer maintain or provide any kind of support on this software.

Mobile Art && Code

I am here at CMU in Pittsburgh at a conference called Mobile Art && Code. Great talks, great workshops, glad I came.

I am doing a workshop called Interactive Telephony for New Media Arts, here is the full set of notes.

One thing that I did for the workshop is a put together an Asterisk driven webservice in PHP for getting at live phone call data. If you have been working projects that get information from asterisk or use phone calls to control other applications, it might be worth checking out.

PHP AGI Script:

#!/usr/bin/php -q
<?PHP
require('/var/lib/asterisk/agi-bin/phpagi.php');

$agi = new AGI();

$agi->stream_file("vm-extension");
$return = $agi->wait_for_digit(10000);
while ($return['result'] > 0)
{
        $ascii = chr($return['result']);
        $agi->say_number($ascii);
        file_put_contents("/var/www/html/webservice/data.txt",time() . "," . $agi->request["agi_uniqueid"] . "," . $agi->request["agi_callerid"] . "," . $ascii . "\n",FILE_APPEND);
        $return = $agi->wait_for_digit(100000);
}
?>

PHP Web Service Script:

<?
	// The client will send a timestamp if it want's new stuff from the timestamp
	$timestamp = 0;
	if (isset($_GET['ts']))
	{
		$timestamp = $_GET['ts'];
	}

	$data = file_get_contents("data.txt");
	$dataarray = explode("\n",$data);
	if ($timestamp > 0)
	{
		// Send everything from the timestamp forward
		for ($i = sizeof($dataarray) - 10; $i < sizeof($dataarray); $i++)
		{
			$currentline = explode(",",$dataarray[$i]);
			if (sizeof($currentline) > 0)
			{
				if ($currentline[0] > $timestamp)
				{
					echo($dataarray[$i]."\n");
				}
			}
		}
	}
	else
	{
		// Just send the last one
		if (sizeof($dataarray) > 1)
		{
			echo($dataarray[sizeof($dataarray)-2]);
		}
	}
?>

Processing Example

I should note that this was built very quickly and therefore somewhat buggy. I don’t think the Processing example is thread safe and the PHP should really be using a database.. Also, the Processing example is a riff off of something Dan Shiffman put together for getting Asterisk and Processing to talk through a Java server.

Major League Baseball and the Live Web

Some time ago, I cut the cord.. disconnected from cable. Some time after that, I got rid of the antenna as well.

I still watch television content, just not over the air or via cable; rather with a Mac Mini hooked up to my TV via the internet.

For the most part this works out just fine. I have no lack of video available due to a Netflix plan for both DVD and streaming (I use the streaming service waaaaaaaaay more than the DVD service), Hulu, ABC.com and NBC.com streaming, video podcasts and BitTorrent. (I am by no means alone, many people I know have a similar setup.)

The one part that doesn’t work out so well is when I want to watch a live televised event. TV it turns out is a pretty good medium for dissemination of live events. It is on these occasions that I generally miss having cable or an antenna hooked up to my TV.

Specifically during the last election I had a hard time watching the returns come in via streaming stations, during the last Superbowl I actually ran a long coax cable out to my yard hooked up to an antenna to watch the commercials.

Last week, I decided that I wanted to watch some of the baseball playoffs (this week it is the World Series). Being able to go out and watch the game at a bar is an option, I did so the first night but I can’t do that for every game. For the next game, I decided that I would try to watch it live online.

I noticed at first that the MLB did have some kind of streaming service but I wasn’t ready to plop almost $30 for a subscription..

Instead, I checked for the game on Justin.TV and UStream. Unsurprisingly, it was there (and a lot of people were watching). MLB it seems doesn’t have the resources to shut down (through DMCA takedown notices) pirate streams very quickly. I loved the chat room on the one that I was watching. It was a bit like being at a bar but actually talking when I liked and ignoring when I didn’t (which is a bit hard when the drunk next to you decides to talk to you in a bar).
ustream baseball

The best version I found was a stream of an ESPN broadcast from India. I was watching the game with people from all over the US and the world. It was fun, people were chatting, talking about where they are from, which teams they like and so on. It was also kind of fun to watch the commercials from India especially since I didn’t know what half of the products/companies were. The quality of the stream wasn’t that great, it stuttered at times, it was pixelated, definitely wasn’t good enough to watch full screen and so on..

Unfortunately, being the internet, the chat at times would turn ugly. The trolls showed unfortunately showed up and did everything possible to incite anger in those there to simply watch and talk about the game.

Shortly after that, the stream was shut down due to a DMCA takedown.

This seemed pretty ridiculous to me. The broadcast I was watching was a low quality version of what was already on TV. The commercials were in place, MLB or Fox wasn’t paying for the bandwidth and so on. It was just opening up the game to an audience that couldn’t ordinarily watch it on TV due to where they live or not having a television available. I do understand copyright and the law and I know that this is illegal but I still don’t see the point is doing anything about it. Perhaps if MLB or Fox just made it available they could make a bit of money showing some relevant commercials..

In any case, it was time to go back to MLB.com and have a look see. After trying to figure out if I could even watch mlb.tv if I paid for it (it seemed I couldn’t since there was a “National Blackout”), I decided to try out the alternate service: postseason.tv. I thought that it was actually just a way to watch the playoffs rather than the full MLB.tv service and it seemed it didn’t have the same blackout restrictions.

Unfortunately (or fortunately, depending on your perspective) that isn’t precisely what you get when you sign up for postseason.tv. What you get is a pretty slick service where you can pick and choose which cameras (up to 4 at once) you want to watch. You get the live audio from the TV broadcast. The cameras you can choose from are the same ones they have available for TV (blimp, slow motion and dugout included).
Picture10_new
What you don’t get is the actual switching that occurs for the live TV broadcast. This is somewhat problematic since you can only see a portion of the action at any given time and many of the cameras when they aren’t live on air are moving around quite a bit, setting up the next shot and so on. It is actually very difficult to watch a game like baseball in this form.

What was also unfortunate is that the cameras weren’t in-sync. I realize that can be a bit difficult to accomplish but, come-on.. They could have tried to at least make them close. Even if you clicked the “Sync” button on the top of the screen never seemed to match up.

This service while technically interesting had a lot of possibilities but instead it just made me ache for a normal television broadcast. I have some new found respect for live event directors, switching between all of those cams for 4 plus hours of a baseball game is definitely a hard job.

Nielson Says: Americans Watching More TV Than Ever; Web and Mobile Video Up too

While I expect Nielson to say that, what I didn’t expect was that they would show mobile viewing on par with internet viewing. That is certainly suspect and looking a bit more closely at their charts it makes more sense.




The top chart indicates that people watch as much on their mobile phones as they do on their computers. The second chart puts this in context, the number of internet users watching video is 131,102,000 and the number watching mobile video 13,419,000, 1/10th of the number. Taken across all of those users, the average monthly video viewing time on the internet is only 3 hours while the mobile user are up to around 3 1/2 hours.

This seems pretty out of whack but then again, the top/first 10% internet viewers are probably watching 10 times that amount (I know I am with NetFlix, Hulu, BitTorrent, YouTube and the like), it seems out of whack because you are only seeing the power users on the mobile phone accessing video while you are seeing broad viewership on the internet.

Consider it this way:

Internet: 131,102,000 users x 3 hours = 393,306,000 (almost 400 million hours)
Mobile: 13,419,000 users x 3.5 hours = 46,966,500 (approximately 47 million hours)
(mobile stills seems a bit over reported but taking into account the numbers they are talking about, it seems more likely)

Podcast Aggregation..

I was just looking through the feeds that I subscribe to in iTunes (audio and video podcasts) and noticed that every single one of them had a little exclamation point next to it indicating that it stopped updating as I haven’t watched or listened in a while.

This is interesting for a couple of reasons. First, I really really do enjoy watching and listening to many of these. Second, I have listened and watch some of these recently, just not through iTunes (or my iPhone). Most through their website or through online radio (NPR shows on WNYC).

With broadband pretty ubiquitous and even phones being able to be used for listening to or watching online audio/video, aggregators are becoming much less useful (and increasingly wasteful when considering bandwidth usage).

Since really the only reason I still have to use iTunes as an aggregator is to sync things to my iPhone for viewing on the subway (where I don’t have network access), I decided to pare down the list quite a bit.

What I took off and instead will just watch/listen to online:
Alive in Baghdad
Rocketboom
Ask A Ninja

(and a bunch that are defunct such as Boing Boing Boing, EFF Line Noise, The Show with Ze Frank, We Are The Media, WGBH Lab Showcase, <sniff>)

What I left on for iPhone consumption (mostly audio since I typically am doing something else like email on my iPhone on the subway):
Joe Frank Radio
NPR Science Friday
On The Media
The Onion Radio News
The TV of Tomorrow Show with Tracy Swedlow
They Might Be Giants Podcast
StreamingMedia.com Podcast
TEDTalks (Video)
This American Life

I also have a bunch that I haven’t decided yet for one reason or another. Mostly they are done by friends of mine and I just love to see their updates (bandwidth and space be damned):
Tech Trek TV, pouringdown, Ryan is Hungry, momentshowing, jonnygoldstein.com

(Nothing here is new, just wanted to take note of it)

ITP Show in full swing

ITP’s end of semester show is all the rage at the moment. Been floating around playing with projects and taking some snapshots.

More soon but here is a teaser courtesy of Meredith Hasson’s Video Mosiac

And another courtesy of Nobuyuki Nakaguchi’s Breath Note

(I love the digital take home)

Android phones hands down over iPhone

For one simple reason: Apps can run in the background.

Simple

The iPhone is amazing, the apps that have been developed for it are incredible and useful. The user interface is a dream. It is truly unfortunate that Apple hasn’t been staying true to it’s roots as an operating system and computer company and is bowing to the desires of the overly protectionist mobile industry. The development environment is good, the fact that they were forced to open it up is kind of sad. They should have had the foresight to do so themselves. Unfortunately they are dictatorial and don’t encourage innovation beyond the framework they have setup.

The Android platform on the other hand has serious user interface issues (though not nearly as bad as Windows Mobile or Symbian S60). There are some good apps, it doesn’t have the clout that Apple has garnered over the past year and a half or so and so on. The big difference, they are open, open, open at least in terms of app development. You don’t have to distribute your App through Google or the carriers, you can simply allow people to download it directly from you.

Now, Android isn’t perfect, it still has to work with the carriers and therefore bow to them in many ways but having just played with a friend’s G1, I have seen the light.

You can background applications..! This means that theoretically I can have additional services running in the background all the time! Twitter can alert me when I get a direct message, I can continue listening to AOL Radio while I check my email.. Apple limits these capabilities to their built-in apps and services (phone calls, SMS). Google seems to have it right.

We need a Moore’s law for web development

We need a Moore’s law for web development. I think it should go something like this: Within two years time, it will become within reach for the average developer to re-create the 50 out of 100 of the top sites on the internet in a matter of 6 month.

For instance, from a purely technical standpoint, many of my students are perfectly capable of building Flickr, Del.icio.us, YouTube, MySpace and the like. This is not to say that they can create those sites, just that they have the skills to build them. By create, I mean the incredible amount of work that it takes to get the requisite number of users using them and visitors visiting them and other special sauces that go into making a successful web venture.

(This is also not to say that they can build them from scratch, thankfully for them, many open source projects have taken on much of the burden and gotten them past some of the more technically tricky portions. In fact, open source is a crucial part of my argument.)

So, what’s so special about Flickr, YouTube and MySpace that keeps people coming back?

Well, momentum is one thing.

Flickr certainly wasn’t the first photosharing app, YouTube was no where near the first online video aggregation site and MySpace is among a series of hot social networking sites that have gone into and out of vogue.

While the fact will remain that the average developer will not re-create these sites, the possibility is there.

So what will my students build?

Why should you care?