Friday, July 9, 2010

Problem with Red5 - SLF4JLogFactory does not implement LogFactory

I'm currently working on a team of more at least 16 developers -- the largest team I worked with on a very complicated project.

The setup is a central J2EE application that runs on JBoss, web application that written in PHP (powered by Apache web server), and a rich internet application written in ActionScript (yep, a Flash application). This Flash application communicates to Red5 server which runs on Tomcat.

If that's not complicated enough for you, continue reading.

The Flash application is a sub-application of the PHP web application. Both the PHP and Flash applications communicates to J2EE application. The PHP uses WSDL and the Flash uses Axis.

The PHP application gives data to the Flash application to let the Red5 server communicate with the J2EE application-- again, via Axis.

To make matters worse, the JBoss, Apache, and Tomcat servers are running on three different machines.

Now, when something in the process broke, it's up to the lead developers to debug it.

As I am the lead on the Flash application that communicates on Red5 server, I am oblige to find the solution.

How on Earth are you going to debug which caused which bug?

Well, the good thing in this complicated project is that it uses free and open source software and open data -- except for Adobe Flash specifics, that is. (For the record, I'm using the open source Flex SDK with FlashDevelop -- it's the Flash' SharedObject-thingy that Red5 uses I'm worried about not being open format/data)

Step-by-step, it boiled down to Red5 and Axis.

Another good thing is, a good person with a good heart by the name Jim O'Halloran, blogged about his same experience, six months earlier.

It turns out that Axis uses commons-logging.jar, which contains same classes (but not same version) of what Red5 uses. This makes the error that Red5 kept whining about:
Caused by: org.apache.commons.discovery.DiscoveryException: Class org.apache.commons.logging.impl.SLF4JLogFactory does not implement org.apache.commons.logging.LogFactory

As O'Halloran suggested, removing the JAR file for commons-logging then restarting Red5 will solve the problem. And it did!

If this helped you too, thank Jim O'Halloran. Send him beer or pizza if you could. ^^

Saturday, July 3, 2010

Using PHP with Red5

The default installation of Red5 doesn't include support for PHP. And since Red5 is ran by Tomcat, this means we need Tomcat to handle PHP.

I found a tutorial that requires you to recompile Tomcat with PHP-handling. Tedious task for a simple need of enabling PHP. Good thing, there's Quercus -- a 100% Java implementation of PHP 5. This means that it can be used with Tomcat.

What I did was, download Quercus 4.0.3 binary, then extracted file to a temporary location.

Now move the following files from the Quercus' temporary location,
  • /WEB-INF/lib/inject-16.jar
  • /WEB-INF/lib/javamail-141.jar
  • /WEB-INF/lib/resin.jar

to your Red5 installation's /webapps/root/WEB-INF/lib/{here}. Create the /lib directory on Red5's /root/WEB-INF if needed.

Now, here's the part where you need to be cautious.

From Red5's /webapps/root/WEB-INF/ location, then open web.xml.

Add the following before the </web-app> tag.
  <servlet-name>Quercus Servlet</servlet-name>

  <servlet-name>Quercus Servlet</servlet-name>


Now, try creating a helloworld.php to test Quercus.

Make sure to restart your Red5.

Monday, June 21, 2010

Red 5: Fixing NetConnection.Connect.InvalidApp Error

Are you having problem connecting to your Red5 server? Is the error message, NetConnection.Connect.InvalidApp?

This happened to me too. Sadly, there was no available help online -- but there is now. ^^

This error occurs when your Flash application is connecting to a non-Flash-compatible service, like Skype for instance.

Skype opens a local connection at port 80 (the HTTP port). So if your Red5 is ran, it wouldn't actually be able to provide the RTMP service correctly, thus giving the NetConnection.Connect.InvalidApp error message.

What's the solution? Simply close Skype, restart Red5, and viola! Your open source media server is back running!

Tuesday, June 15, 2010

Connecting Sun Broadband Huawei 1550 USB modem on Ubuntu 10.04

I'm finally trying Mobile Broadband and friends recommends Sun -- because its the cheapest you can have in Philippines.

So before actually buying one, I tried my friend's Sun USB modem which happens to be a Huawei E1550. My Ubuntu 10.04 installation was upgraded from 9.10 via alternate CD (ISO). It had some problems upgrading because I am not connected to the Internet but went to upgrade most of the installations.

Based on my readings, I shouldn't be having any problem running Huawei E1550 on Ubuntu Lucid Lynx (or 10.04) but I am.

I've repeatedly plugged and unplugged the device and kept restarting Ubuntu but nothing.

So I tried my other friend's Sun USB modem (the ZTE one) and Ubuntu recognizes it -- though I still couldn't connect.

I even went to one of Sun's store at SM Megamall's cyberzone just to ask for assistance but all I got was a sarcastic response. The guy said, "You (as in me) need to be techy to run (the modem) on Linux (Ubuntu)".

It was a blunt slap in the face being a programmer and going-4-years of using Ubuntu. Ouch!

I dare say that I am techy alright, just not enough to connect a damn Huawei E1550 on my Lucid Lynx Ubuntu installation.

A day later after a few googling, I bumped into a post saying that I have to install linux-backports-modules-headers-lucid-generic and usb-modeswitch packages -- possibly not installed on my Ubuntu due to problems I had while upgrading. The article was posted on the day I went to Sun store -- odd, eh?

True enough, Ubuntu started recognizing Huawei E1550 after restarting. Still, I couldn't connect.

I still had to change APN from minternet to fbband and one final restart I'm finally connected.

Not to mention, disabling EAP, CHAP, MSCHAP and MSCHAP v2 -- leaving PAP as the only enabled Authentication Method.

Wednesday, May 5, 2010

GTK#: How to Change Font of Entry

This tutorial assumes that you are using MonoDevelop and created a C# GUI application using GTK#.

Supposing you already have a Window with an Entry, named txtSource, this is how you change the Font.

First, include Pango in imports.
  • using Pango;

Second, use the FontDescription class and instanciate one.
  • FontDescription fontDesc = new FontDescription();

Third, set the Family property of FontDescription object to any font family you want (ex, "Arial", "Tahoma", "Courier).
  • fontDesc.Family = "Courier";

Lastly, set the FontDescription object to Entry using ModifyFont method.
  • txtSource.ModifyFont(fontDesc);

The whole code should look something like this:

using System;
using Gtk;
using Pango;

public partial class MainWindow : Gtk.Window {
  public MainWindow () :base(Gtk.WindowType.Toplevel) {

    FontDescription fontDesc = new FontDescription();
    fontDesc.Family = "Courier";

Tuesday, May 4, 2010

Android on iPhone

I've heard about the fake iPhones from one of my officemates and I was deeply interested to buy one for some experiment. So I went to Divisoria (Philippine version of black market) and did see one which is worh PhP2,800

I tested the unit and was quite fascinated and impressed with the technology.

My supposed plan was to experiment with any opensource mobile operating system that would possibly work on the said phone. Specifically, I am interested in running Android on that fake iPhone. But a little googling showed that there is already an existing iPhone clone that uses Android. Cool, huh?

I'm still going to buy and try to do this hack for myself.

Sunday, March 21, 2010

AS3 and Red5

There seem to be not enough documentation about Red5 and AS3, especially on properly creating a new application, so I thought of writing one.

SOSampleAS3 is a simple Remote SharedObject demo app.The code is a modified Red5's SOSample demo which was written in Adobe Flash IDE and AS2. This is written in pure AS3 on FlashDevelop. Also, it demonstrates remote call using Shared Fridge Magnet tutorial.

How to install the demo webapp?

  1. Extract
  2. Then extract
  3. Copy bin directory to C:\Program Files\Red5\webapps\root so it will be:
    • C:\Program Files\Red5\webapps\root\bin\
    • C:\Program Files\Red5\webapps\root\bin\expressInstall.swf
    • C:\Program Files\Red5\webapps\root\bin\index.html
    • C:\Program Files\Red5\webapps\root\bin\SOSampleAS3.swf
    • C:\Program Files\Red5\webapps\root\bin\js\swfobject.js
  4. Extract
  5. Copy SOSampleAS3 directory to C:\Program Files\Red5\webapps so it will be:
    • C:\Program Files\Red5\webapps\SOSampleAS3\
    • C:\Program Files\Red5\webapps\SOSampleAS3\META-INF\MANIFEST.MF
    • C:\Program Files\Red5\webapps\SOSampleAS3\WEB-INF\classes\org\red5\server\webapp\elcMagnets\Application.class
    • C:\Program Files\Red5\webapps\SOSampleAS3\WEB-INF\lib\elcMagnets.jar
    • C:\Program Files\Red5\webapps\SOSampleAS3\WEB-INF\
    • C:\Program Files\Red5\webapps\SOSampleAS3\WEB-INF\red5-web.xml
    • C:\Program Files\Red5\webapps\SOSampleAS3\WEB-INF\web.xml
  6. Restart your Red5 Server.
  7. Open your browser and set address to http://localhost/bin/.

That's it!

Fixing NetConnection.Call.BadVersion

After trying out AMFPHP 1.9 (yep, 1.9 -- although it's also called 2.0) that came out stable last 2nd of February 2010, I was almost ready to give up because of the "NetConnection.Call.BadVersion" errors that I'm getting when I try even a simple HelloWorld call. Followed every suggestions found on the Internet but none fixed the problem.

Then I tried checking out the AMFPHP code. I started with gateway.php. On line 106, changing PRODUCTION_SERVER to false fixed the problem.

It turns out that PRODUCTION_SERVER is set to true by default now.

Tuesday, March 16, 2010

Open Source Alternative to Daemon Tools Lite

It was cool to know that there is something like of Daemon Tools Lite that runs on Ubuntu GNU/Linux -- that is GMount ISO. Sadly, it only runs on GNU/Linux platforms.

Getting back on Windows, I wondered if there is other open source Daemon Tools Lite that runs on Windows. Luckily, there is one -- it is called WinCDEMu. Go try it for yourself.

Thursday, March 4, 2010

Getting Started with GTK on Windows

I am assuming that you already know GTK+ and wanted to try it out for the first time. This article will discuss how to setup your development environment to start writing GTK+ based applications.

First things first, download everything you need.

Download GTK from -- I downloaded

Optionally, download libiconv from -- as of this writing libiconv is version 1.9.1.

For C editor, I am using MinGW Developer Studio. It is the easiest to setup in compiling GTK+ applications since it already works well with MingGW, the recommended toolchain when using GTK. Sadly, the developer's website is somewhat down or possibly currently doing a revamp. But you can easily get version 2.0.5 from list of mirrors courtesy of

Setting them up

Install MinGW Developer Studio.

Extract then place content in C:\Gtk+\{here}

Same with libiconv, extract then place all contents in C:\Gtk+\{here}

Configuring MinGW Develop Studio.
  1. Launch the editor
  2. Click Edit -> Options... to open the Option dialog box.
  3. Click the Directories tab
  4. On Show directories for,
    • select Include files then add the following paths:

      • C:\Gtk+\include
      • C:\Gtk+\lib\glib-2.0\include
      • C:\Gtk+\lib\gtk-2.0\include
      • C:\Gtk+\include\cairo
    • select Library files then add this path:

      • C:\Gtk+\lib
Testing it out.
  1. Launch MinGW Developer Studio
  2. Click Project -> New Project to open New dialog box.
  3. Select GTK+ Application and indicate HelloGTK as Project Name
  4. Click OK to create new project.
  5. Click File -> New to open New dialog box.
  6. Select C/C++ Source File and indicate hellogtk.c as File name.
  7. Click OK to create new file.
  8. Type in the code below then press F5 to compile and run the program.

If you are having problem running you hellogtk application, you might need to install GTK+ runtime. I use GIMP, which installs the runtime -- try to download and install a copy of GIMP for Windows.

Where to go from here? Read the official documentation and tutorials.

Thursday, February 18, 2010

How to svnsync on Windows?

One of the most powerful tool in subversion is the ability to transfer repository from one server to another.

That tool is called svnsync. There are some documentations around but not much tutorial.

Let's pretend that your project's source code is currently hosted at and wanted it to transfer at

So, how do we migrate the source code? Simple. First, install Slik-Subversion from Now, follow the next procedure.
  1. Run a Command Prompt
  2. Type-in: svnsync initialize
  3. Then type-in: svnsync synchronize --source-username mynewsvn_usr --source-password mynewsvn_pwd --sync-username myoldsvn_usr --sync-password myoldsvn_pwd
Viola! You are done!

Of course, you will have to edit the following to apply on your situation.
  1. mynewsvn_usr to your real username at your site
  2. mynewsvn_pwd to your real password at your site
  3. myoldsvn_usr to your real username at your site
  4. myoldsvn_pwd to your real password at your site
Not to mention, change:
  1. to your real old project repository
  2. to your real new project repository
Enjoy migrating!

Wednesday, February 17, 2010

Blender: Export 3D Model for Flash

I did a demo of my WIND library late January this year and I was having problem exporting the 3D model from Blender, properly.

The screen resolution of the laptop I'm using went to 640 by 480 upon attaching the LCD projector. I was having a hard time figuring the problem out. Until the demo ended, and I detached the LCD projector cable and *poof* -- I know what I've been missing.

Below is the screenshot of how to properly export 3D model for use of Papervision.
  • Make sure the model is exported in Triangles -- not Quads.
  • Obviously, export only the model -- not the whole scene.
  • Make sure the texture path is Relative to the Collada file path.
  • Then finally, to have a deformed model (aka posed model), toggle on Apply Modifiers.

The demo went okay until the exporting problem -- sheesh...

Saturday, January 30, 2010

Setting-up Android Development Enviroment on Windows

Downloading the Tools.
  1. Download Android SDK r4.
  2. Download Eclipse Classic 3.5.1.
  3. Download Android Development Tools 0.9.5.
Installing the Tools.
  1. Extract the SDK at your root directory (ex: C:\)
  2. Extract Eclipse and run eclipse.exe
  3. On Eclipse, click Help -> Install New Software.
  4. Click Add... button, Add Site dialog will pop-up.
  5. Click Archive... button and browse for then click OK.
  6. Specify ADT as Name then click OK.
  7. Toggle-on Developer Tools then click Next to install.
  8. Now set the path of the SDK. Click Window -> Preference. Select Android, and set the SDK Location to: C:\android-sdk-windows, then click OK.
Installing the Android API.
  1. With the SDK path set, click Window -> Android SDK and AVD Manager.
  2. Select Available Packages. Then toggle-on the following:
    • Documentation for Android 2.1, API 7, revision 1
    • SDK Platform Android 2.1, API 7, revision 1
  3. And optionally, toggle-on:
    • Google APIs by Google Inc., Adroid API 7, revision 1
    • Usb Driver package, revision 3
  4. Click Install Selected then accept the license and click Install Accepted.
Creating Android Virtual Device (AVD or what we call Emulator).
  1. Again, click Window -> Android SDK and AVD Manager.
  2. Specify the Name (ex: MyAndroidEmulator)
  3. Choose Android 2.1 - API Level 7 as the Target.
  4. On Hardware, click New and OK repeatedly until all Properties has been added.
  5. Click Create AVD.
Now you can start writing Android Apps!

Wednesday, January 13, 2010

What If 2012 happens?

Been months since I watched 2012 but I still can't remove it in my mind, "What if 2012 happens?"

With billions of dollars in bank, Bill Gates will surely get on board. How about Richard Stallman? Linus Torvalds perhaps?

As a developer, it makes me think, should I still be doing the "right" thing for people? Or should I do the "right" thing for me and my family -- to start hoarding tons of money by selling patented proprietary software...

Another thing that puzzles me, "What kind of software will be saved?". Or better yet, "What kind of software will power the computers of the next generation?". Microsoft's Windows and Visual Studio? Google's Chrome and Go? Perhaps Canonical's Ubuntu, thanks to Mark Shuttleworth.

I hope my small programming language will be saved along with other free and open source projects on SourceForge.

So, I ask you, "What if 2012 happens?"