My experience with Tropo has been good

I’m happy to say we’ve gone live with using Tropo for our international, outbound SMS messages.

In the early days, all I heard was Twilio, with the occasional mention of Tropo. Now that Twilio doesn’t support international SMS, I had to reinvestigate SMS options.

At first I tried Nexmo, but that didn’t work immediately, and I gave up right away and tried Tropo. True, I may have done something wrong with Nexmo, so I can’t say anything much.

In fact, even with Tropo my first attempt didn’t go well, but I decided to contact support and they helped me out.

After that, the experience has been great.  International SMS seems solid. They say they have years and years of doing this, so that makes sense.

Using Tropo to send SMS messages

(Special thanks to Mark Headd, developer evangelist from Tropo, for helping me out).

We’ve been using Twilio for a while now to make phone calls and send text messages. However, they removed their international SMS support, and I started looking around for another SMS provider.

So naturally I tried out Tropo, since I come across them once in a while. I did manage to get SMSes out, though there are some traps. Their API is also slightly confusing, but it works in the end.

Here are the steps, and some things to look out for, if you want to just get an SMS out.

Create a Tropo Scripting application. Associate it with a hosted javascript file that looks like this:

message(theMessage, {to:numberToDial, network:'sms'})
hangup()

I accidentally copied a Groovy example from the Tropo blog rather than a javascript example, and that totally threw me off. In that example, the message parameter is called “message”, which of course interferes with the message() function. And the associative array is specified using square brackets. Yes, I know, not javascript, but when you’re in “I want to copy the example and make this work” the brain turned off a little 🙂

Add a phone number to that Tropo application.

You can now send a message with a web browser:

http://api.tropo.com/1.0/sessions?action=create&token=<YOUR TOKEN>&theMessage=Hello&numberToDial=+1<YOUR NUMBER>

Note: The phone number must have NO spaces! It doesn’t work with spaces. Weird.

The java library also works (again, no spaces!):

String token = <YOUR TOKEN>;

Tropo tropo = new Tropo();
Map&lt;String, String&gt; params = new HashMap();

//params.put("numberToDial", "&lt;YOUR NUMBER NO SPACES&gt;");
params.put("theMessage", "Test from Tropo, Java. v5");
TropoLaunchResult result = tropo.launchSession(token, params);

iMovie imports HDV but plays it “slowly”

This weekend, we have a big family function (a family concert, actually), and dad tested out his HDV camera to make sure everything was working correctly.

It wasn’t.

Footage he captured from his Sony HDV camera (A PAL camera) would get imported into iMovie incorrectly. During import, things appear correct. But once the import completes, the length of the clip displayed suddenly becomes longer by about 20%, and playing back the clip shows that the playback is slower by about 20% and the sound is of lower pitch (consistent with slower playback).

I was convinced this was caused by some kind of NTSC – PAL framerate issue, since they differ by about 20%. I took the imported .mov clip into my windows PC, ran GSpot on it, and correctly the frame rate is 25 fps. So why is iMovie playing the video incorrectly?

I attribute it to some bug in iMovie 6. Dad has refused to upgrade to iMovie 11, but I finally convinced him and he will do it next week.

Meanwhile, I managed to find a workaround for the problem. I simply had to copy the clips out of iMovie onto a folder, and then copy it back… and voila, the clips now have the proper length and playback speed.

Disappointing experience with s3rsync.com

I’ve just signed up for Amazon Web Services S3 cloud storage solution. I need a place to store my large backup files, and iBackup.com is costing me tons of money.

I wanted a drop in solution for rsync, which is what is working smoothly right now with ibackup.com. I searched online for solutions, and s3rsync.com seemed to be a good solution.

The product does work… but it certainly was not a smooth experience, and ultimately I can’t achieve my end goal.

What I found:

  • I feel like I’m using a product from an amateurish company, or from a company that’s brand new and not yet mature.
  • For example: On the website, it says you can get up-to-date usage information. I would expect a portal that I can log in to from s3rsrync.com. No such luck: First, I have to access a website with a port 8080 address. Unbelievable, because not every firewall allows 8080 traffic through. Second, the log in is using browser authentication, as opposed to an html login page. As they say, that’s SO nineties. Finally, the “portal” turned out to be just an FTP site. Yikes.
  • All of which would have been fine, but alas, I discovered that the file in S3 appears as a TAR file with the date of the transaction. It does NOT appear as your original directory structure. So I can’t download individual files etc using the AWS console. To be fair, s3rsync did mention this in their FAQ but I guess I had to see it to understand it.
  • Finally, they require that I pay USD 20 straight up, before I even know it will work for me, i.e. ZERO ability to try the product. As it is, I know right away after testing that it won’t work, but I’m USD20 down. Sucks.

Hookbox testing going well

So I’ve put Hookbox through more testing. I’m still using Hosted Hookbox, and that really helps me focus on testing prior to deployment.

Here are some positive findings:

  • The best thing about using Hosted Hookbox during its early days is that I’m always testing with the latest versions.
  • It fully supports publishing internationalized characters. I tested with chinese and european characters.
  • It does a good job of escaping special characters. I sent a fairly complicated XML through, and received everything perfectly.
  • Integrating with Actionscript was a breeze, using watched variables.

On the negative side, I did experience one server hang. That was after publishing some really large xml numerous times. I had to restart the hosted hookbox server and all was good. HOWEVER, the clients don’t auto-connect, which will be a big concern moving forward.

Since testing is going well, we’re going to go live soon (within a month). Which makes me nervous since Hookbox is not yet version 1.0. It’s still at v 0.3.4dev.

Hookbox is THE fastest way to add comet functionality in an existing webapp

I have a web application that runs Flash in the browser client, and a JBoss 4.0.4 J2EE server on the server side. I don’t know a lot about comet technologies, but after poring through reading material over 1 day, it sounded complicated.

Thankfully I discovered Hookbox while reading CometDaily.

It’s still an early beta, but in my initial tests, I found it to be the perfect solution that I was looking for. You install hookbox on a server, and it’s a self-contained server that has provides basic comet (i.e. ajax push) functionality. It comes with a javascript library which you install on the client-side, and it allows your web server to communicate with the hookbox server via a RESTy api.

I managed to get a full-loop test going in about an hour, especially since there is a hosted version of hookbox that you can sign up instantaneously for development testing. To see server push happen so effortlessly in my existing web app, it’s beautiful!

The application which I’m going to build around hookbox will be fairly complex: It is a K-12 school scheduling software. Why I need comet is that it will be a multi-user interactive scheduling tool, i.e. many users can log on at the same time, and schedule classes, and everyone sees updates as they happen. So it will be interesting to see how the beta-release of hookbox handles this.

I’ll write more as I discover things. But for now, two quick notes:

  • The document says that javascript can connect to hookbox via a call like hookbox.connect(“http://<hookboxserverandport>/csp&#8221;); Actually, the /csp at the end has to be dropped. So mine is: hookbox.connect(“http://aris.hosted.hookbox.org&#8221;);
  • I couldn’t get the subscribe.publish() to work. The publish method doesn’t exist on the subscribe object. But I don’t need this right now, since only my webserver publishes events.

Update after 1 week of testing is in my next post.

My Windows7 laptop was using >90% cpu with fan running fast, and I fixed it!

Don’t you hate it when your laptop seems to be doing a LOT of work, with the fan furiously blowing out hot air, when you’re not doing anything intensive?

I actually managed to trace something down today, and I’m real happy about that.

I had hooked up my digital camera to download some videos, and then watched them in Media Player. Later I noticed my laptop was working hard.

Task Manager showed CPU utilization was very high, constantly over 90%. But in the process list, there was no guilty process apparent.

So I clicked on Show Processes From All Users. I saw one svchost.exe running. Now, I discovered that Windows runs many copies of svchost, each one associated with a group of services. So I right clicked on the offending svchost, and clicked Go To Services.

There were 3 services associated with this svchost:

  • upnphost
  • SSDPSRV
  • SCardSvr

upnphost is under SSDPSRV. I went to Services, looked for SSDPSRV, and stopped it.

My laptop fan stopped spinning IMMEDIATELY. Nice.

Actionscript 1: Getting all child movie clips

There are some examples on the web on how to get child movie clips in ActionScript 1 (and I suppose ActionScript 2). However, they are potentially buggy in that they retrieve all properties of a movie clip, and whichever property is a movie clip is assumed to be a child.

This breaks if you include references to other movie clips in a movie clip.

But, it turns out the solutions is easy enough. For each candidate child movie clip, check if the parent is the same as the current parent.

Example:

for (name in mc) {
	if (typeof (mc[name]) == "movieclip") {
		var childMc = mc[name];
		if(childMc._parent == mc) {
			// Yes! We've found a genuine child movieclip
		}
	}
}

AS3: Having issues doing a POST with URLLoader/URLRequest?

This issue was killing me. We’re in the process of upgrading our codebase from Actionscript 1 (yes that old clunky thing) to Actionscript 3 (auto-completion heaven!).  And for the life of me, I couldn’t figure out how to get POST with URLLoader working. I was close to convinced that AS3 had a core bug (ah… don’t we engineers love throwing the blame to the framework).

I found a whole bunch of posts of people who had trouble doing POST with actionscript 3, but in all the threads I read, they got it working! But I just couldn’t.

I left the issue for a while (coz, you know, there are 10,000 things on my plate, but we all know about that), but it came to the point where I had to figure it out or our development would stall.

It’s really simple. I guess my poor knowledge of how HTTP works with respect to content headers and all that had a big part to do with the problem.

I had this line:

urlRequest.contentType = “text/xml”;

This line shouldn’t be there when doing a POST with URLLoader. Problem solved.

Converting AS1 to AS3: Week 1

I have to say, we’ve made fantastic progress on our project to convert our legacy ActionScript 1 codebase to AS3. Our strategy is as follows:

1) Use JTree JavaCC to write an AS1 lexical analyzer and Abstract Syntax Tree (AST) creator. 2) Extend the automatically-generated classes from JTree to generate AS3 code. 3) As problems crop up, keep tweaking our extensions to handle special cases.

The reason the project has started off strong is thanks to an ECMA-262 grammar file for JavaCC which was already available through open source. After we understood how JavaCC grammar and Jtree extensions work, we could clearly understand the ecma grammar file and resulting JTree classes.

Extending JTree-generated classes to produce AS3 code was pretty easy. We now have AS3 code that is syntactically correct and compiles!

The next issue is to deal with all the changes in the actionscript framework API. Since we are using a lexical analyzer which understands the code at a syntax level, I anticipate this will be reasonably easy to do.