Hello Bonjour

Hello Bonjour is a new tool for localising website content.

At These Days a lot of the websites we build have a Flash or Flex interface with content fed in via XML documents. That makes it really easy to deploy the same website in multiple languages. You just pass in a localised XML file and voila, you’ve got a localised site.

Until now, we have been translating those XML files manually, but we’ve just made a little tool called Hello Bonjour that makes that process easier. The tool generates an interface with a Rich Text Editor for each node in your XML document. It shows the original copy and the translated copy side-by-side for easy comparison. You can customise it for each project with your client’s official font faces and brand colours to make it easy to generate content that fits the styleguide. There’s also a Find and Replace tool so you can quickly update URLs or other text throughout the entire document.

You can test out a demo here. Sharing is caring, so here’s the source code. Feel free to use it or adapt it to meet your needs.

Hello Bonjour - content translation tool

Red5, will you be my Valentine?

I am somewhat late perhaps, with my profession of love, but last week, we launched a little Valentine’s Day campaign for our clients. We used a great open-source alternative to Flash Media Server (FMS), namely Red5. Red5 has been around for a couple of years now, but this was only the second time I actually got to work with it and I must say that its ease-of-use is simply amazing. Installing the service is pretty straightforward and once you have your server up and running, you can develop applications in a matter of minutes.

Installing the Server

You can download the Red5 server package from Google Code (current version: 0.9.1 final). Once it’s downloaded, just run the executable and it will automatically install the files and then prompt you for an IP address and a port number. When setting up the server for local testing, I just use 127.0.0.1 and 8080.

Once the installation is finished, you might want to run services.msc and check if the Red5 service is installed correctly and is running. With that done, we can open up a browser window and browse to http://127.0.0.1:8080 and you’ll see the Red5 gateway. Here you can test if Red5 is running properly and you can install some of the default applications that come with the Red5 installer. Red5 runs on Java and these applications are great for people like me, who don’t know Java and want to get right down to the good stuff. You can just install one of these basic applications (I recommend installing the oflaDemo app) and once it’s installed, your front-end application can just connect through one of these.

So how about we get to the interesting bit?

Creating your First App

Creating an app in Red5 isn’t too hard if you’re familiar with the NetConnection and NetStream classes, but you can save yourself a lot of trouble if you think your application through.

I created two classes that, in my opinion, came in quite handy:

  1. Red5Connection, the Red5Connection class is a subclass of  Flash’s NetConnection class and is pretty much just a class that handles the events that a NetConnection might throw at you.
  2. AbstractClient, just an extension of a Sprite or DisplayObject. Since we needed three entirely different clients (a broadcaster, a subscriber and a simple chat client, which displayed messages sent by the other clients), it was important to have one base class with the basic logic for all three clients.

Both of these classes are available for download here: Red5 Example files

When working with Red5, you’ll use two things often: a NetStream and a Remote SharedObject. The NetStream is used to broadcast or stream video footage. A SharedObject is used to store or retrieve data remotely. We use this to broadcast data to all connected users (could be used in a simple chat client for instance)

Here’s how you would normally use the NetStream object:

_ns = new NetStream(_nc);

// get the first camera
// set the max bandwidth used by the stream to infinite and the quality to 95 (0-100)
_cam = Camera.getCamera("0");
_cam.setQuality(0, 95);

// get the first microphone and if there is one, make sure there's no loopback nor echos
_mic = Microphone.getMicrophone(0);
if(_mic){
_mic.setUseEchoSuppression(true);
_mic.setLoopBack(false);
}

// attach microphone and camera to the netstream object
_ns.attachCamera(_cam);
_ns.attachAudio(_mic);

// publish the NetStream to Red5.
// the publish method uses two parameters, a name and a type
// the name is used to identify the netstream
// the method determines whether the netstream will be recorded, appended to an existing stream or just streamed live
// possible values are "record", "append" and "live"
_ns.publish("broadcastExample", "live");

If you wanted to stop a broadcast, you could use these bits of code:


_ns.attachCamera(null); // just removes the camera
_ns.attachAudio(null); // just removes the microphone
_ns.play(false); // stops the broadcast but leaves the NetStream intact
_ns.close(); // closes the NetStream altogether

And this is how we use the SharedObject’s send() method to send data to and from all connected clients


if (_so) _so.send("methodName", parameters);

An implementation of this code can be found in the Broadcaster and Subscriber files in the zip file I provided.
To recompile the .fla files on your computer, you will need to download De Monsterdebugger and adjust the class path settings via File > Publish Settings…

Furthermore, you will need to run Red5 locally (or adjust the RED5 constant in AbstractClient.as) and have the oflaDemo app installed in order for the files to work.

Well, that’s it for me, hopefully I was able to persuade at least some people to look into Red5.

Review of Appcelerator Titanium

Appcelerator Titanium is an open source mobile application development tool for iPhone and Android which allows you to code apps with HTML, CSS and JavaScript. I tested out the platform this morning. Having developed an iPhone application with Objective C before, I can tell you that Titanium makes the iPhone development process a whole lot easier. Getting the Android SDK working was a bit tricky but development itself is simple. I love being able to compile native applications by writing standard web code!

Here’s an example of just how easy it can be:

Code for a simple Titanium App

Code for a simple Titanium App

The Titanium app in iPhone

The Titanium app in iPhone

The Titanium app in Android

The Titanium app in Android

.

Getting the Andriod emulator installed correctly can be a real pain. After you have downloaded the Android SDK, open the Android SDK and AVD Manager and make sure you install all of these:

  • Android SDK Tools
  • SDK Platform Android 1.5, API 3
  • Google APIs by Google Inc., Android API 3

In your Titanium Developer profile, set the Android API location to /Applications/android-sdk-mac_86. Also, I found the Android emulator to be frustratingly slow, but I don’t think that’s Titanium’s fault.

To create useful mobile applications I think it would be a good idea to start with the following:

I have included some screenshots of the Kitchen Sink application built in Titanium below so you can get an idea of what can be done.

Slider UI

Slider UI

Entering text input

Entering text input

Saving data on the device

Saving data on the device

We should be developing mobile apps now

Barriers to mobile app development are getting so low they are almost non-existent. As web developers today we have no excuse not be creating for mobile. We don’t need to wait for Flash CS5. The tools to create rich, responsive mobile apps for iPhone, Android and Nokia are already available with HTML5. If we have to deploy a native app there are open source tools available to convert web standards like HTML and JavaScript into native iPhone, Android, Blackberry, Palm and Nokia applications.

There are a number of advantages to developing with HTML5 instead of writing native Objective C applications for iPhone. You have probably already heard these:

  • Developing with web technology is much faster than with Objective C,
  • Bug fixes and updates can be deployed instantly,
  • We can utilize our existing HTML, CSS & JavaScript talent.

But what you might not have realised is:

Of course there are still differences between the various mobile devices, but with a bit of tweaking the same HTML5 app can be made to run on iPhone, Android, Palm and Nokia devices because they all use the Webkit browser engine.

Sometimes we might need to generate native applications, to sell the application in Apple’s App Store for example. But even that doesn’t mean we have to resort to Objective C or Java. There is a clever open source tool called Appcelerator Titanium which deploys native applications to iPhone and Android – and we can code them in standard HTML, CSS and JavaScript. Of course deploying as native apps removes some of the benefits inherent to web apps – such as rapid deployment and development iteration. But this approach still dramatically reduces barriers to development. Phone Gap is another open source tool for deploying native mobile applications from standard web technologies. Unlike Appcelerator, Phone Gap supports Blackberry, Palm and Nokia as well as iPhone and Android. However it doesn’t offer as rich of a feature set as Appcelerator. Rhomobile offers yet another framework, but it is targeted towards Ruby developers.

So when you next have an idea for a mobile app, don’t give up on it because you don’t know Objective C or Java, or because it is too difficult to create a cross-platform app. Put your existing HTML, CSS and JavaScript skills to use and take advantage of HTML5 or an open source web-to-native compiler. I will have a play around with Appcelerator and Phone Gap and post my findings on this blog.

Comparison of mobile application development methods

Native apps Web apps Native apps compiled from standard web code
  • Fast, best method for games
  • Easily monetised
  • Slow, separate development process for each platform
  • Instant deployments of bug fixes and updates
  • Can be cross-platform
  • Uses web standards
  • Avoid the App Store gatekeeper
  • Easily monetised
  • Easily deployed to multiple platforms
  • Uses web standards

No pranks and no play make dev-monkeys go something something …

Fun & Play, These Days Sam | 14 Jan. 2010 | no comments

When you work for an agency, you need to work hard and work a lot. To help you focus you need to find ways to blow off steam and enjoy a little. We’ve found many creative ways to do that and one of them is the prankwar. The prankwar just started on it’s own between @samzzi and @coolz0r and then started to take over the whole agency … I expect many people will fall victim to our pranks. And since  more people will be involved, we made a small page with an overview of what has happened so far. This way we can tell our stories to our children and their children’s children and … ok nm that :)

Just go see for yourself: http://labs.thesedays.com/prankwar/

Switch to our mobile site