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 SOSampleAS3.zip.
  2. Then extract SOSampleAS3-src.zip.
  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 SOSampleAS3-webapp.zip.
  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\red5-web.properties
    • 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 GTK.org -- I downloaded gtk+-bundle_2.18.7-20100213_win32.zip.

Optionally, download libiconv from GTK.org -- 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 TextEditors.org.

Setting them up

Install MinGW Developer Studio.

Extract gtk+-bundle_2.18.7-20100213_win32.zip then place content in C:\Gtk+\{here}

Same with libiconv, extract libiconv-1.9.1.bin.woe32.zip 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.