DECIPHERING THE GEMCLUB MEMO SMART CARD

Debian, Redhat, CentOS and Fedora were used as the test systems.

The card used was still in issue mode. The GemClub memo smart card documentation can be downloaded from the following link: https://jwamicha.wordpress.com/?attachment_id=37

1.) Download JSmartCardExplorer from the following URL: http://sourceforge.net/projec/showfiles.php?group_id=233662

2.) Install pcsc-lite, pcsc-lite-libs and pcsc-lite-tools on your system. The PCSC-Lite homepage can be found on the following link: http://pcsclite.alioth.debian.org/

A list of all smart card ATR (Answer To Reset) responses that can be detected by the drivers can be found inside the smartcard_list.txt file: http://ludovic.rousseau.free.fr/softwares/pcsc-tools/smartcard_list.txt

A list of all USB CCID (Chip/Smart Card Interface Devices) and ICCD (Integrated Circuit(s) Card Devices) smart card readers supported by the pcsc-lite drivers can be found on the following link: http://pcsclite.alioth.debian.org/ccid.html

The Gemalto PC Twin Reader was used for my tests.

The logs below show the Gemalto PCT Twin Reader being detected after installation of the pcsc drivers:


Nov 21 14:37:00 localhost pcscd: pcscdaemon.c:464:main() pcsc-lite 1.2.9-beta10 daemon ready.
Nov 21 14:37:01 localhost pcscd: hotplug_libusb.c:406:HPAddHotPluggable() Adding USB device: 002:003
Nov 21 14:37:01 localhost pcscd: readerfactory.c:1098:RFInitializeReader() Attempting startup of Gemplus GemPC Twin 00 00.
Nov 21 14:37:01 localhost pcscd: readerfactory.c:972:RFBindFunctions() Loading IFD Handler 3.0
Nov 21 14:37:01 localhost pcscd: ifdhandler.c:1152:init_driver() LogLevel: 0x0003
Nov 21 14:37:01 localhost pcscd: ifdhandler.c:1162:init_driver() DriverOptions: 0x0000
Nov 21 14:37:01 localhost pcscd: ifdhandler.c:75:IFDHCreateChannelByName() lun: 0, device: usb:08e6/3437:libusb:002:003
Nov 21 14:37:01 localhost pcscd: ccid_usb.c:227:OpenUSBByName() Manufacturer: Ludovic Rousseau (ludovic.rousseau@free.fr)
Nov 21 14:37:01 localhost pcscd: ccid_usb.c:237:OpenUSBByName() ProductString: Generic CCID driver v1.2.4
Nov 21 14:37:01 localhost pcscd: ccid_usb.c:243:OpenUSBByName() Copyright: This driver is protected by terms of the GNU General Public License version 2, or (at your option) any later version.
Nov 21 14:37:01 localhost pcscd: ccid_usb.c:391:OpenUSBByName() Found Vendor/Product: 08E6/3437 (Gemplus GemPC Twin)
Nov 21 14:37:01 localhost pcscd: ccid_usb.c:393:OpenUSBByName() Using USB bus/device: 002/003

Ensure the pcscd daemon is running on your system. Additional serial readers can be configured inside /etc/reader.conf.d.

3.) After installation of the pcsc drivers, we shall now use JSmartCardExplorer to examine the Gemplus smart card.

Start up JSmartCardExplorer:

$java -jar JSmartCardExplorer.jar

4.) Select the protocol type name T0. Connect to the Gemplus Memo Smart card. The Card ATR field should show 0X3B 0X02 0X53 0X01, which is the ATR for the Gemplus Memo smart card.

Our tests may now begin. Page 5 was used to reference the Gemlub Memo Card Memory Map Structure. Page 11 was used to reference for the Area Access Conditions.

Each memory address on the Gemclub Memo smart card will store a WORD. Each word is 4 bytes or 32 bits. While issuing commands to the Gemplus Memo smart card, the length should be the hexadecimal representation of the byte length (not the bit or word length) as we shall see below:

6.) Read Manufacturer area: 0X80 0XBE 0X00 0X00 0X04
0X04 represents one word (4 bytes or 32 bits) inside the memory location address 00 (P2 = 00). The class byte (0x80) and P1 byte (0x00) could be anything since they aren’t tested by the card. See page 17 of the GemClub Memo Card manual for more details.

We will now read continue to read consecutive memory locations from the gemclub memo so we see can see a pattern emerge.

7.) Read Issuer area: 0x80 0xBE 0x00 0x01 0x10
Response: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x40

Find out if card is in issuer or user mode by reading memory location 0x04: 0x80 0xBE 0x00 0x04 0x00 0x04
Response: 0x00 0x00 0x00 0x40

0x40 in binary form = 0100 0000 (01 means that the card is in issuer mode. 10 would mean the card is in user mode. 00 and 11 would mean that the card is blocked. – see page 7 in the manual)

8.) Read Protected Area: 0X80 0XBE 0X00 0X05 0X04
(Memory adress = 0x05)

9.) Read CSC0 Key: 0X80 0XBE 0X00 0X06 0X04
(Memory address = 0x06)

10.) Read CS0 Ratification Counter: 0X80 0XBE 0X00 0X07 0X04

11.) Read CTC1 + CTC1 Backup: 0X80 0XBE 0X00 0X08 0X0C
(0X0C = 12 bytes or 3 four byte words/memory locations)

12.) Read Balance1 + Balance1 Backup: 0X80 0XBE 0X00 0X0B 0X14
(0X14 = 20 bytes or 5 four byte words/memory locations)

13.) Read User Area 1: 0X80 0XBE 0X00 0X10 0X40
(0X40 = 64 bytes or 16 four byte words/memory locations)

14.) Read CTC2 + CTC2 Backup: 0x80 0xBE 0x00 0x20 0x0C

15.) Read Balance2 + Balance2 Backup: 0X80 0XBE 0X00 0X23 0X14

16.) Read User Area 2: 0X80 0XBE 0X00 0X28 0X40

17.) Read CSC1 Key: 0X80 0XBE 0X00 0X38 0X04

18.) Read CS1 Ratification Counter: 0X80 0XBE 0X00 0X39 0X04

19.) Read CSC2 Key: <0X80 0XBE 0X00 0X3B 0X04

20.) Read CS2 Ratification Counter: <0X80 0XBE 0X00 0X3C 0X04

21.) Make the Issuer card emulates the user mode.

Verify CSC0 Key: 0X00 0X20 0X00 0X07 0X04 0XAA 0XAA 0XAA 0XAA
(0x07 = CSC0 Ratification Counter)
(0x04 = Length of data the smart card should expect which in this case is our CSC0 4 byte key)

Send the card into emulated user mode: 0X00 0X20 0X00 0X3A 0X04 0XAA 0XAA 0XAA 0XAA

Now we will continue to use the card as though we were in user mode.

22.) Read User Area 1: 0X80 0XBE 0X00 0X10 0X40

23.) Write to User Area 1:

Verify CSC1 Key: 0x00 0x20 0x00 0x39 0x04 0x11 0x11 0x11 0x11
(0x39 is the CSC1 Ratification counter)
(0x04 = Length of data the smart card should expect which in this case is our 4 byte CSC1 key)

Write 4 bytes to User Area 1: 0x80 0xDE 0x00 0x10 0x04 0x22 0x22 0x22 0x22
0X10 = First Word Address of User Area 1
0x04 = Length of the bytes we want to write to write to the smart card (4 bytes in this case)
0x22 0x22 0x22 0x22 = the 4 bytes we write to the gemclub smart card.

Read User Area 1 to verify our data has been correctly written to the smart card.

24.) Read User Area 2: 0X80 0XBE 0X00 0X28 0X40

25.) Write to User Area 2:

Verify CSC2 Key: 0x00 0x20 0x00 0x3B 0x04 0x22 0x22 0x22 0x22
(0x3B is the CSC2 Ratification counter)

Write 4 bytes to User Area 2: 0x80 0xDE 0x00 0x28 0x04 0x33 0x33 0x33 0x33
0X28 = First Word Address of User Area 2
0x04 = Length of the bytes we want to write to write to the smart card (4 bytes in this case)
0x33 0x33 0x33 0x33 = the 4 bytes we write to the gemclub smart card.

Read User Area 2 to verify our data has been correctly written to the smart card.

GemClub Smart Card successfully deciphered.

REFERENCES:

1.) http://www.gemalto.com
2.) http://pcsclite.alioth.debian.org/
3.) http://jveliot.free.fr/blog/wp-content/smartcardpgonlinuxfornewbies.txt
4.) http://cheef.ru/docs/HowTo/APDU.info
5.) http://cheef.ru/docs/HowTo/SW1SW2.info

Comments (22)

Speed up XUL GUI Development on Linux

1.) Install eclipse ganymede: http://www.eclipse.org/downloads/ (Works fastest with SUN’s JDK)


$cd download/path
$tar eclipse-jee-europa-linux-gtk.tar.gz
$vi /usr/local/bin/eclipse

Paste the following text inside to start Eclipse with optimized memory settings: download/path/eclipse/eclipse -clean -configuration download/path/eclipse -vm /path/to/jdk/jdk1.6.0_02/jre/bin/java -vmargs -XX:MaxPermSize=350m -Xms128m -Xmx350m

XX:MaxPermSize and Xmx can be adjusted upwards depending on the amount of memory available on your system. Making -Xms too high seems to make eclipse grow the heap size too high too fast.

2.) Install Eclipse xulbooster plugin; please follow instructions on the link below:

http://cms.xulbooster.org/index.php?option=com_content&task=view&id=14&Itemid=2

You should now have colour coded editors for .xul, .rdf, .js, .dtd and .properties files.

Previews on localized xul documents will not work by default. To enable localized xul document previews using xulbooster, use the trick below:

$cd /etc/gre.d

Open the conf file with the highest version as this is most likely the xulrunner instance the xulbooster plugin is most probably using:

$vi 1.9.0.3.system.conf

4.) Navigate to the location of the xulrunner libs (GRE_PATH) indicated in the gre conf file:


$cd /usr/lib/xulrunner-1.9.0.3
$cd chrome

Find out the exact path of the .dtd files the xul document you want to preview on Eclipse is using for localization. Create a symbolic link to this path inside the chrome folder:


$ln -s /path/to/my/chrome/locale myextension

‘myextension’ can be any name. In our example, myextension will contain the chrome folder within it. The chrome folder will in turn contain the content and locale folders.

5.) Depending on the locale your firefox browser is using, open the corresponding .manifest file. In our case, since we’re using the en-US locale, we open the en-US.manifest file:

$vi en-US.manifest

Append the following line (depending on the name of your symbolink link above and the folder structure within your extension):


locale myextension en-US my_extension/locale/en-US/

The .dtd files (myextension locale files) are now available to the xul instance and by extension the xulbooster plugin. It should now be possible to preview localized xul documents without having to restart firefox. This should hopefully significantly improve one’s speed of xul GUI interface development.

6.) Automatically update your extension by running a script:

$vi /usr/local/sbin/myextension-update

Contents of the script:


#!/bin/sh
cp /path/to/my/extension /home/myhomedirectory/.mozilla/firefox/tame3m4a.default/extensions/{myextension-uuid}/

Now updating your firefox extension with the changes you have made should be as simple as running:

$myextension-update

7.) Install Quick-Restart Firefox extension: https://addons.mozilla.org/en-US/firefox/addon/3559

Now restarting firefox to view the changes you have made to the extension you are developing should be as simple as pressing the Ctrl+Alt+R keys.

XUL Development on Linux is not too well documented on the web yet and any more tips we could add for Linux developers would be highly welcome.

Leave a Comment

Subversion – A Summary Cheat Sheet – Learn svn in 10 minutes

This post is a summary of the subversion book, only that the summary takes you straight in. Please find the subversion book here:
http://svnbook.red-bean.com/

If you have not done so already, begin by installing Subversion on your system. For Fedora/CentOS/Redhat users, this is explained in another post here:
https://jwamicha.wordpress.com/2008/04/25/quick-svn-trac-installation-on-centosfedora/

SUBVERSION COMMANDS SUMMARY

1.) Checkout the code and do an update in case of any changes made since your last update (We assume that you are using apache dav server to access your code and not svnserve):

$svn checkout http://192.168.0.54/svn/repos/server_code server_code

If your repository requires authentication:

$svn checkout –username my_username http://192.168.0.54/svn/repos/server_code server_code

Update your working copy:

$svn update
(update from current)
$svn update -r BASE server_code
(update foo from base revision)
$svn update -r 1200 server_code (update foo from revision number 1200)

2.) Make changes:

$svn add eg svn add new_directory
(add a new directory foo)
$svn delete
$svn copy directory1 directory2
(copy directory directory1 to directory2)
$svn move directory2 renamed_directory
(rename?)

3.) Examine your changes (Can be done even with no network access to the subversion repository):

$svn status
(To get an overview of all your changes)
eg
A stuff/loot/bloo.h # file is scheduled for addition
C stuff/loot/lump.c # file has textual conflicts from an update
D stuff/fish.c # file is scheduled for deletion
M bar.c # the content in bar.c has local modifications

$svn diff
(to show changes between current working directory and the same directory in the repository)

4.) Possibly undo some changes (Can also be done even with no network access to the subversion repository):

$svn revert
After running svn revert as a way to resolve local conflict with the repository copy, Run:

$svn resolve
To inform svn that the conflict has been resolved. You will now be able to successfully run svn update in case of previous conflicts.

5.) Resolve Conflicts (Merge Others’ Changes):

$svn update
$svn resolved

6.) Commit your changes:

$svn commit
eg
$svn commit -m “Removed out of mem errors.”
or
$svn commit -F comment.txt
or
$svn commit –file comment.txt

6. Logs:

$svn log (use current working directory as the default target)
$svn log server_code
(current working directory/file is server_code)
$svn log -r 5:19
(shows logs 5 through 19 in chronological order of working directory)
$svn log -r 19:5
(shows logs 5 through 19 in reverse order of working directory)
$svn log -r 8
(shows log for revision 8 of working directory)
$svn log -r 8 -v
(shows verbose? log for revision 8 of working directory)

7. Diffs (Changes):

$svn diff
$svn diff -r 3 rules.txt
(or svn diff –revision 3 rules.txt)
$svn diff -r 2:3 rules.txt
(revisions 2 and 3 are directly compared)
$svn diff -c 3 rules.txt
(compare changes between current revision and revision 2)

8. Browse a file directly:

svn cat -r 2 rules.txt
svn cat -r 2 rules.txt > rules.txt.v2 (send cat output directly to a file)

9. Browse a folder directly:

svn list http://svn.collab.net/repos/svn
svn list -v http://svn.collab.net/repos/svn

10. Fetching older repository snapshots:

$svn checkout -r 1729
(Checks out a new working copy at r1729)
$svn update -r 1729
(Updates an existing working copy to r1729)

11. If you’re building a release and wish to bundle up your files from Subversion but don’t want those pesky .svn directories in the way, then you can use svn export to create a local copy of all or part of your repository sans .svn directories. As with svn update and svn checkout, you can also pass the – -revision switch to svn export:

$svn export http://svn.example.com/svn/repos1
(Exports latest revision)
$svn export http://svn.example.com/svn/repos1 -r 1729
(Exports revision r1729)

12. Cleanup if a Subversion operation is interrupted (if the process is killed, or if the machine crashes, for example), the log files remain on disk. By re-executing the log files, Subversion can complete the previously started operation, and your working copy can get itself back into a consistent state.

$svn cleanup

13. Revision specifiers:
HEAD: The latest (or “youngest”) revision in the repository.
BASE: The revision number of an item in a working copy. If the item has been locally modified, the “BASE version” refers to the way the item appears without those local modifications.
COMMITTED: The most recent revision prior to, or equal to, BASE, in which an item changed.
PREV: The revision immediately before the last revision in which an item changed. Technically, this boils down to COMMITTED-1.

$svn diff -r PREV:COMMITTED main.c
(shows the last change committed to main.c)

$svn log -r HEAD
(shows log message for the latest repository commit)

$svn diff -r HEAD
(compares your working copy with all of its local changes to the latest version of that tree in the repository)

svn diff -r BASE:HEAD main.c
(compares the unmodified version of foo.c with the latest version of foo.c in the repository)

$svn log -r BASE:HEAD
(shows all commit logs for the current versioned directory since you last updated

$svn update -r PREV main.c
(rewinds the last change on foo.c, decreasing foo.c’s working revision)

$svn diff -r BASE:14 main.c
(compares the unmodified version of foo.c with the way foo.c looked in revision 14)

14. Checkout based on revisions:

$svn checkout -r {2006-02-17}
$svn checkout -r {15:30}
$svn checkout -r {15:30:00.200000}
$svn checkout -r {“2006-02-17 15:30”}
$svn checkout -r {“2006-02-17 15:30 +0230”}
$svn checkout -r {2006-02-17T15:30}
$svn checkout -r {2006-02-17T15:30Z}
$svn checkout -r {2006-02-17T15:30-04:00}
$svn checkout -r {20060217T1530}
$svn checkout -r {20060217T1530Z}
$svn checkout -r {20060217T1530-0500}

15. Logs based on revisions:

$svn log -r {2006-11-28}
$svn log -r {2006-11-20}:{2006-11-29}

16. Properties of files:

$svn propset copyright ‘(c) 2006 Red-Bean Software’ calc/button.c
property ‘copyright’ set on ‘calc/button.c’

$svn propset license -F /path/to/LICENSE calc/button.c
property ‘license’ set on ‘calc/button.c’

$svn propedit copyright calc/button.c
No changes to property ‘copyright’ on ‘calc/button.c’

$svn propset copyright ‘(c) 2006 Red-Bean Software’ calc/*
property ‘copyright’ set on ‘calc/Makefile’
property ‘copyright’ set on ‘calc/button.c’
property ‘copyright’ set on ‘calc/integer.c’

$svn proplist calc/button.c
Properties on ‘calc/button.c’:
copyright
license

$svn propget copyright calc/button.c
(c) 2006 Red-Bean Software

$svn proplist -v calc/button.c

$svn propset license ” calc/button.c
$svn propdel license calc/button.c

And specify the revision whose property you wish to modify

$svn propset copyright ‘(c) 2006 Red-Bean Software’ calc/button.c -r11 –revprop

17. Locking files:

$svn lock banana.jpg -m “Editing file for tomorrow’s release.”
‘banana.jpg’ locked by user ‘harry’.

$svn status
K banana.jpg

$svn info banana.jpg
Path: banana.jpg
Name: banana.jpg
URL: http://svn.example.com/repos/project/banana.jpg
Repository UUID: edb2f264-5ef2-0310-a47a-87b0ce17a8ec
Revision: 2198
Node Kind: file
Schedule: normal
Last Changed Author: frank
Last Changed Rev: 1950
Last Changed Date: 2006-03-15 12:43:04 -0600 (Wed, 15 Mar 2006)
Text Last Updated: 2006-06-08 19:23:07 -0500 (Thu, 08 Jun 2006)
Properties Last Updated: 2006-06-08 19:23:07 -0500 (Thu, 08 Jun 2006)
Checksum: 3b110d3b10638f5d1f4fe0f436a5a2a5
Lock Token: opaquelocktoken:0c0f600b-88f9-0310-9e48-355b44d4a58e
Lock Owner: harry
Lock Created: 2006-06-14 17:20:31 -0500 (Wed, 14 Jun 2006)
Lock Comment (1 line):
Editing file for tomorrow’s release.

$svnadmin lslocks /usr/local/svn/repos
$svnadmin rmlocks /usr/local/svn/repos /project/raisin.jpg
Force out someone else’s lock:

$svn unlock –force http://svn.example.com/repos/project/raisin.jpg
Force a lock over someone else’s
$ svn lock –force raisin.jpg

18. Creating branches:

$svn checkout http://svn.example.com/repos/calc bigwc
A bigwc/trunk/
A bigwc/trunk/Makefile
A bigwc/trunk/integer.c
A bigwc/trunk/button.c
A bigwc/branches/
Checked out revision 340.

Now create the branch;

$cd bigwc
$svn copy trunk branches/my-calc-branch
$svn status
A + branches/my-calc-branch

$svn commit -m “Creating a private branch of /calc/trunk.”
Adding branches/my-calc-branch
Committed revision 341.

You can do all the above in one step (Recommended way):

$svn copy http://svn.example.com/repos/calc/trunk \
http://svn.example.com/repos/calc/branches/my-calc-branch \
-m “Creating a private branch of /calc/trunk.”
Committed revision 341.

Merging branch to main trunk (Assuming you are in the working branch directory)

$svn merge -c 344 http://svn.example.com/repos/calc/trunk (merge change revision number 344 on your working directory branch)
U integer.c

$svn status
M integer.c

Merging while specifying the destination and target:

$svn merge -c 344 http://svn.example.com/repos/calc/trunk my-calc-branch
U my-calc-branch/integer.c

$svn merge http://svn.example.com/repos/branch1@150 \
http://svn.example.com/repos/branch2@212 \
my-working-copy

$svn merge -r 100:200 http://svn.example.com/repos/trunk my-working-copy

$svn merge -r 100:200 http://svn.example.com/repos/trunk

Previewing merges:

$svn merge – -dry-run -c 344 http://svn.example.com/repos/calc/trunk
U integer.c
(- -dry-run is a double dash without spaces. Word press munges the double dash into one when put together.)

$svn status
(nothing printed, working copy is still unchanged)

Merging branch changes into trunk:

$cd calc/trunk
$svn update
At revision 405.

$svn merge -r 341:405 http://svn.example.com/repos/calc/branches/my-calc-branch
U integer.c
U button.c
U Makefile

$svn status
M integer.c
M button.c
M Makefile

Examine the diffs, compile, test, etc…

$svn commit -m “Merged my-calc-branch changes r341:405 into the trunk.”
Sending integer.c
Sending button.c
Sending Makefile
Transmitting file data …
Committed revision 406

Undo a merge:

$svn merge -c -303 http://svn.example.com/repos/calc/trunk
or
$svn merge –revision 303:302 http://svn.example.com/repos/calc/trunk
U integer.c

$svn status
M integer.c

$svn diff
(Verify that the change is removed)

$svn commit -m “Undoing change committed in r303.”
Sending integer.c
Transmitting file data .
Committed revision 350.

Merging from branch to trunk:

$cd trunk-working-copy

$svn update
At revision 1910.

$svn merge http://svn.example.com/repos/calc/trunk@1910 \
http://svn.example.com/repos/calc/branches/mybranch@1910
U real.c
U integer.c
A newdirectory
A newdirectory/newfile

Resurrecting deleted items:

$svn copy -r 807 \
http://svn.example.com/repos/calc/trunk/real.c ./real.c

$ svn status
A + real.c

$svn commit -m “Resurrected real.c from revision 807, /calc/trunk/real.c.”
Adding real.c
Transmitting file data .
Committed revision 1390.

Traversing branches:
$cd calc

$svn info | grep URL
URL: http://svn.example.com/repos/calc/trunk

$svn switch http://svn.example.com/repos/calc/branches/my-calc-branch
U integer.c
U button.c
U Makefile
Updated to revision 341.

$svn info | grep URL
URL: http://svn.example.com/repos/calc/branches/my-calc-branch

Making releases using tags (snapshot of a directory at a given instant in time)
$svn copy http://svn.example.com/repos/calc/trunk \
http://svn.example.com/repos/calc/tags/release-1.0 \
-m “Tagging the 1.0 release of the ‘calc’ project.”

Committed revision 351.

Remove your branch after merge:
$svn delete http://svn.example.com/repos/calc/branches/my-calc-branch \
-m “Removing obsolete branch of calc project.”

Committed revision 375.

Commit a log message correction:
$echo “Here is the new, correct log message” > newlog.txt
$svnadmin setlog myrepos newlog.txt -r 388

Migrate repository:
Create the dump files first:
$svnadmin dump myrepos -r 23 > rev-23.dumpfile
$svnadmin dump myrepos -r 100:200 > revs-100-200.dumpfile

Load the dump files into the new repository:
$svnadmin dump myrepos -r 0:1000 > dumpfile1
$svnadmin dump myrepos -r 1001:2000 –incremental > dumpfile2
$svnadmin dump myrepos -r 2001:3000 –incremental > dumpfile3

Comments (12)

Quick SVN & Trac Installation on CentOS/Fedora

Tested on CentOS 4 but the assumption is that this same setup should work on both Fedora and Redhat. SELinux has been disabled for this setup.

Install the mod_dav_svn module:
#yum -y install subversion mod_dav_svn

CREATE SUBVERSION ROOT REPOSITORY


#mkdir /srv/svn
#svnadmin create /srv/svn/repos
#chown -R apache /srv/svn/repos

ENABLING SVN HTTP ACCESS USING APACHE WEBSERVER

1.) Backup the original subversion.conf file that might be on your system.
#mv /etc/httpd/conf.d/subversion.conf /etc/httpd/conf.d/subversion.conf.old
#vi /etc/httpd/conf.d/subversion.conf

2.) After opening your subversion.conf file above, insert the following directives:

<Location /svn>
DAV svn
SVNParentPath /srv/svn
#SVNListParentPath on
# authentication
AuthType Basic
AuthName “Repository Name”
AuthUserFile /srv/users
Order deny,allow
Require valid-user

# authorization
# AuthzSVNAccessFile “/etc/httpd/conf/svn-auth.ini”
</Location>

Add a new user who can be authenticated against the repository:
#htpasswd -cm users user1

The first user you add, will require you to use the -cm switch. From then on, create new users as shown below:
#htpasswd -m users user2

SVNListParentPath allows you to have several repos under the same svn directory ie you can create repo2 and repo3…repon under the svn directory and apache will still be able to serve them.

PLEASE ENSURE YOU DO NOT PLACE the /srv/users file under the /srv/svn directory. This is because should you decide to list the files under this directory, and you allow anonymous access to this directory on apache, all your visitors to /srv/svn will be able to see your password.

Other authentication types include LDAP and Basic authentication. References:

> http://httpd.apache.org/docs/2.0/howto/auth.html (Basic authentication)
> http://httpd.apache.org/docs/2.2/mod/mod_authnz_ldap.html (LDAP)

Using LDAP has the benefit of having a universal authentication, authorizaton and access for your system configured from one place. Thus, LDAP system users, would automatically be users on the Subversion Server (as well as the Trac Server).

IMPORT PROJECTS INTO SUBVERSION REPOS

#svn import -m "Initial Import" local-directory-projectX http://server-name/svn/projectX

INSTALLING TRAC SERVER ON CENTOS

Enable extra repositories on Centos (Fedora and Redhat should be able to use the dag repository. Not sure about the karan repository):

#cd /etc/yum.repos.d
#vi dag.repo

Paste the following:

[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
enabled=1


#wget http://centos.karan.org/kbsingh-CentOS-Extras.repo
#wget http://centos.karan.org/kbsingh-CentOS-Misc.repo

#rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
#rpm --import http://centos.karan.org/RPM-GPG-KEY-karan.org.txt

#yum install mod_dav_svn mod_python clearsilver python-clearsilver python-sqlite trac

CONFIGURE TRAC SERVER ON APACHE WEBSERVER

#trac-admin /srv/trac initenv

Your repository path would be /srv/svn/repos when asked by trac-admin. Choose your desired Project Name. All other default values should be ok to use.

#chown apache:apache /srv/trac

Create a trac.conf file:

#vi /etc/httpd/conf.d/trac.conf

And paste the following

<Location /trac>
SetHandler mod_python
PythonHandler trac.web.modpython_frontend
PythonOption TracEnv /srv/trac
PythonOption TracUriRoot /trac

# authentication
AuthType Basic
AuthName “JoeWami Trac Server”
AuthUserFile /srv/users
Require valid-user
</Location>

Notice we use the same authentication file as above (Please see subversion.conf)

Finally, ensure you are loading the following modules for apache dav svn to work:

LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so

GOTCHAS

1.) Watch out for mod_security/mod_security2, either turn it off or enable mod_security(2) to let through dav requests (/etc/httpd/conf.d/mod_security.conf)

Comments (6)

INSTALL ZEND FOR ORACLE ON LINUX

(comes with php configured for Oracle by default)

1. Untar and install:

Download Zend for Oracle from the following site:
https://www.zend.com/core/oem_registration.php?access_code=OracleDB

#tar -xzvf ZendCoreForOracle-v1.5.0-Linux-x86.tar.gz
#cd ZendCoreForOracle-v1.5.0-Linux-x86
#./install

Follow the instructions to install.

Note that in our installation, we will be using the default installation path of Zend for oracle (/usr/local/Zend). Yours could be different.
2. Follow instructions to the end. If you are on Debian or Fedora (worked perfect for Suse!), copy the sysv init.d script as follows:
#cp /usr/local/Zend/apache2/bin/apache/apachectl.ZSAV /etc/init.d/apachectl.Zend
#chmod 755 /etc/init.d/apachectl.Zend
#chkconfig 2345 apachectl.Zend on

Look inside the /etc/apachectl.Zend file and change anything that needs to be changed. If you installed Zend for Oracle in the default directory, then you won’t need to change anything.

3. Then;
To start apache:
#service apachectl.Zend start
To stop apache:
#service apachectl.Zend stop

4. Alternatively, you may use a modified apachectl.Zend file. This allows you to start apache with ssl directly. Please replace the existing contents of the apachectl.Zend script with those below:

Replace the option “start” with the following:
start)
$HTTPD -k start -DSSL
ERROR=$?
;;

Replace the option “restart” with the following:
restart)
$HTTPD -k stop
$HTTPD -k start -DSSL
ERROR=$?
;;

Replace the option “graceful” with the following:
graceful)
$HTTPD -k -DSSL graceful
ERROR=$?
;;

CREATE A CERTIFICATE FOR YOUR WEBSITE
In our case, the apache configuration files were installed in the /usr/local/Zend/apache2 directory. Yours are most likely installed in /etc/apache2, so just map the directories as appropriate.

#cd /usr/local/Zend/apache2/conf
#mkdir ssl.crt
#mkdir ssl.key
#mkdir ssl.csr

Option 1 – This will create a certificate key with a password. You are advised to remove the password, so that you don’t have to input it everytime you restart apache. This is because apache might restart in the middle of the night, while there is no one to input the password.
#openssl genrsa -des3 -out ssl.key/yourdomain.co.ke.password.key 1024
(generate key with password)
#openssl rsa -in ssl.key/yourdomain.co.ke.password.key -out ssl.key/yourdomain.co.ke.key
(remove password from key)

Option 2 – This will create a certificate key without a password directly.
#openssl genrsa -out ssl.key/yourdomain.co.ke.key 1024
(generate key without password directly)

Create a certificate request key. This certificate request .csr file is what you will send to Verisign or Thawte so that they can verify it for you. In the meanwhile you complete your application and they send your certificate, we will create one for ourselves by using a self-signed certificate. This will still encrypt the channel for you, even though users will see the certificate as coming from an untrusted source.
#openssl req -new -key ssl.key/yourdomain.co.ke.key -out ssl.csr/yourdomain.co.ke.csr

Create the actual certificate using the certificate request file you created above:
#openssl x509 -req -days 365 -in ssl.csr/yourdomain.co.ke.csr -signkey ssl.key/yourdomain.co.ke.key -out ssl.crt/yourdomain.co.ke.crt

Examine the just created certificates to ensure they were created without errors:
#openssl rsa -noout -text -in ssl.key/yourdomain.co.ke.key
#openssl req -noout -text -in ssl.csr/yourdomain.co.ke.csr
#openssl x509 -noout -text -in ssl.crt/yourdomain.co.ke.crt

Configure your httpd.conf or whatever httpd config file you use to Listen on port 443 ie
Listen 443

Configure the virtual hosts as appropriate for your system, and don’t forget to switch on SSL.
The important options to configure are: SSLEnable, SSLCertificateFile(use the crt file we created above) and SSLCertificateKeyFile(use the key file we created above). Refer to the apache documentation. For example, your options should look like this:

SLCertificateFile /usr/local/Zend/apache2/conf/ssl.crt/yourdomain.co.ke.crt
and
SSLCertificateKeyFile /usr/local/Zend/apache2/conf/ssl.key/yourdomain.co.ke.key

If you are using zend for oracle apache, to start the webserver with ssl support you need to provide a special start option, start-ssl:
#/etc/init.d/apachectl.Zend start-ssl

If you are using our modified script, you can call the options using the service commands as follows:
#service apachectl.Zend start
(this will start apache with SSL support by default)

It is important that you turn off directory listing. To do this, ensure you have the following Options Directive in your httpd.conf or other apache default conf file:
Options -Indexes

REDIRECT USERS DIRECTLY INTO HTTPS
1. Inside your httpd.conf file we need to allow rewrite rules from the .htaccess file. So change:

AllowOverride None
to
AllowOverride AllowOverride FileInfo Options

Now add the following Options directives:
Options +FollowSymLinks +SymLinksIfOwnerMatch

1. Create a .htaccess file in your DocumentRoot
2. Add something similar to this in your file:
In our case the DocumentRoot was /usr/local/Zend/apache2/htdocs. So we did the following:

#cd /usr/local/Zend/apache2/htdocs
#vi .htaccess

Then add the following 3 lines:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

All http users will now be redirected to the https page by default.

Comments (4)

PORTING KANNEL TO HP UX

(Tested with version 11.11)

Before we begin, it would be useful to have the backspace key on hand so do:
#stty erase [BACKSPACE KEY]
or just install bash.

1. Before compiling kannel, we first need to put the HP UX application layer on steroids. So, download libxml2, gcc-4.1.1, libiconv, gettext, bison, flex etc and all the related dependencies from the following link:
http://hpux.connect.org.uk/

Note: When installing hp depot files, ensure you type in the whole path to the depot, or else it will complain about not being able to see the package. For example to install gcc, assuming the depot file was in /opt, you would type this:

#cd opt
#gunzip gcc-4.1.1-hppa-11.11.depot.gz
#swinstall -s /opt/gcc-4.1.1-hppa-11.11.depot gcc

Do an swinstall for all the other related packages. You can check for the related dependencies by referring to the hpux.connect.org.uk porting and archiving center site listed dependencies for each package.

2. Inside your /etc/profile file, add the following lines (SHLIB_PATH is used in 32-bit machines while LD_LIBRARY_PATH is used in 64-bit HP machines; just put both in to be sure)


export LD_LIBRARY_PATH=/usr/local/lib:/lib:/usr/lib:/opt/gnome/lib/
export SHLIB_PATH=/usr/local/lib:/lib:/usr/lib:/opt/gnome/lib/

Now do:
#env

and ensure the variables above are set. If not, you can run them manually for now. However, since you have put these variables inside the /etc/profile file, the next time you login they will be automatically set in the environment.

3. Once you are through, installing gcc and all the related dependencies, download kannel and follow the steps below (The version we used was: gateway-1.4.1):
(Please ensure that inside the configure file, the CC variable refered to is gcc and not the HP UX cc, or else your configure will fail!)

(We are configuring kannel with minimal options in this case. You may also wish to add database support eg for MySQL)

#./configure --with-malloc=native --enable-sdb

4. Configure will complete successfully. However, before running the gmake (Please do not run make as this will use HP make and your compilation of kannel will fail! Please ensure you run gmake not make!), edit the files
gw/smsc/smsc_smpp.c
gw/smsc/smsc_soap.c

If you are on a 32-bit machine, replace all occurences of the strtoll method in kannel with strtoimax
If you are on a 64-bit machine, replace all occurences of the strtoll method in kannel with strtol

Do this so gmake will succeed in compiling kannel. This is because HP UX does not have any definitions for strtoll function.

5. Run gmake

#gmake

6. Once you have successfully run gmake, run a gmake install. I always like installing kannel in /usr/local/sbin (actually that’s the default kannel install directory!) so I specify my bindir like this:

#gmake --bindir=/usr/local/sbin

When starting kannel, it will complain about not being able to find the shared library libiconv in /usr/local/lib, so add the following symbolic link:
#ln -s /opt/gnome/lib/libiconv.sl.2 /usr/local/lib/libiconv.sl.2

7. Next put the kannel init.d script below in the /sbin/init.d directory.

#!/sbin/sh
#
# NOTE: This script is not configurable! Any changes made to this
# scipt will be overwritten when you upgrade to the next
# release of HP-UX.
#
# WARNING: Changing this script in any way may lead to a system that
# is unbootable. Do not modify this script.
#

#
# Start kannel
#

PATH=/sbin:/usr/sbin:/usr/bin
export PATH

KANNEL_CONFIG=/usr/kannel/kannel.conf
KANNEL_BASE=/usr/local/sbin

rval=0
set_return() {
x=$?
if [ $x -ne 0 ]; then
echo "ERROR CODE $x"
rval=1
fi
}

case $1 in
start_msg)
echo "Start kannel daemon"
;;

stop_msg)
echo "Stop kannel daemon"
;;

'start')
if [ -f /etc/rc.config.d/kannel ] ; then
. /etc/rc.config.d/kannel
else
echo "ERROR: /etc/rc.config.d/kannel defaults file MISSING"
fi

${KANNEL_BASE}/bearerbox $KANNEL_CONFIG 2>/dev/null 1>/dev/null &
${KANNEL_BASE}/smsbox $KANNEL_CONFIG 2>/dev/null 1>/dev/null &

set_return
;;

'stop')
#
# Determine PID of kannel process(es) to stop
#
smsboxpid=`ps -ef | awk '/smsbox/ && !/awk/ {print $2}'`
kill -9 $smsboxpid
bearerboxpid=`ps -ef | awk '/bearerbox/ && !/awk/ {print $2}'`
kill -9 $bearerboxpid
;;

*)
echo "usage: $0 {start|stop}"
;;
esac

exit $rval

8. Now follow these steps:
#chmod 755 /sbin/init.d/kannel

Link it to the rcX.d directories ie:
#ln -s /sbin/init.d/kannel /sbin/rc3.d/S500kannel
#ln -s /sbin/init.d/kannel /sbin/rc2.d/K500kannel

Create the /etc/rc.config.d/kannel file:
#echo START_INN=1 >/etc/rc.config.d/kannel

10. Now, configure the KANNEL_BASE and KANNEL_CONFIG variables in the init.d file as suitable to your system. Then;

To start kannel:
#/sbin/init.d/kannel start
To stop kannel,
#/sbin/init.d/kannel stop

Kannel successfully ported to HP UX.

Comments (9)

CREATE NEW JAVA RED5 APPLICATION

During this tutorial, we will be using Joachim’s migration guide:
http://www.joachim-bauch.de/tutorials/red5/MigrationGuide.txt

In this tutorial we will be examining how to create applications in the Red5 Standalone Server. The Red5 Standalone Server uses a Spring Framework Managed Jetty Embeddable Http Server and Servlet container. The Spring Framework is a JAVA Framework that provides hooks (configuration metadata is in the form of either XML bean definitions, JAVA properties file or by calling the configurable items of the Spring API from within your POJO-Plain Old JAVA Object) through which you can control the behaviour of various JAVA applications, objects or frameworks (eg Jetty, Acegi, Hibernate). This allows you to leverage a broad array of JAVA technologies from within your POJO without having to face the challenge of coding to interface to all these JAVA objects yourself while still ensuring you adhere the common JAVA Design Patterns. In addition, by making use of the hooks provided by Spring to influence your application’s behaviour by editing the configuration metadata (See Dependency Injection), you can easily change the behaviour of your application while leaving your core POJOs intact.
Because of IoC, one’s application can be developed using a set of simple JavaBeans (or plain-old Java objects—POJOs), with a a lightweight IoC container (Spring) wiring them together and setting the dependencies.
The XML configuration metadata and is used by Spring’s IoC to create a fully configured system or application. This configuration metadata tells the Spring container how to “instantiate, configure, and assemble [the objects in your application]”.

In addition, you will also learn about the scope of a red5 application, as well as how to create and use server side shared objects.

Before beginning this tutorial, you may download the red5java application explained from here:
red5java.tar.gz
Extract the contents of this folder into your red5_server/webapps directory.

and the demo flex2 client from here:
red5_flexclient.tar.gz

1. Get into the root directory of the red5 server which in my case was red5_server

#cd /opt/red5_server/webapps

This is the root folder of all your red5 application definitions, from which all red5 applications are started. This is the global scope. If you are running a hosting service this would be your root folder. To create a section for each hosted user you would create a WEB-INF/user-dir as shown below;

2. Create your new application as follows (The new application name for this tutorial will be called red5java)

#mkdir -p red5java/WEB-INF

re5java is the name of your application in this example. You will access your application using the URL rtmp://your-ip/red5java or rtmpt//your-ip/red5java in the case of a proxy-tunneled RTMPT connection). The WEB-INF folder is so that Jetty (the Embeddable HTTP Server and Servlet Container that is used by the Standalone red5 server) knows where to access your application (Servlet) from. This is because your application is actually a JAVA servlet. It is in the WEB-INF file that you will load all the configuration files/beans that will be required to load your application. These files specify all the Spring beans that your application will require as well as bean definitions that will be used by Spring to Dependency Inject your application. These config files include web.xml, red5-web.xml, red5-web.properties and log4j.properties as will be shown below.

Under the red5java directory create a folder called src where you will create your own custom application that will be used to communicate with the Flash clients.

#mkdir src

This would also be a good point at which to create your classes (for the classes) and lib (for the jar file) directories. We will also be doing this in the ant build file below but so that we get the concept, lets create the directories here;

#mkdir classes && mkdir lib

We now need to create a package for our Application. Lets call it org.red5.webapps.red5java
#cd src
#mkdir -p org/red5/webapps/red5java

Your sources will go into the org/red5/webapps/red5java directory.

[*TODO: Verify and test the statement below*] red5java represents your “application scope” under the “global scope” ie webapps. Sub-folders under red5java would represent your “room scope” ie all subfolders under red5java are subscopes of the red5java application scope.

If you are on Windows, you can create your directory structure from within eclipse, so that it will look something like this. After you create the src directory, under WEB-INF, right click src directory then New>Package and create a package so that it has the structure shown below (Don’t worry, since you are downloading the sources, these folders are already created for you):


> |red5_server
 - -> |webapps
  - -> |red5java
   - -> |WEB-INF
    - -> |src
     - -> |your
      - -> |package
       - -> |name
    - -> |classes
    - -> |lib

The build.xml file that came with the sources can prepare the classes and lib directories for you, simply type:

#ant prepare

To clean out directories after a build, type:

#ant clean

You can change the target of your build by editing the source and target tags. For 1.6, change from 1.5 to 1.6.

Now, for the concept:
If you created a new application (as we will later) eg MYAPPLICATION, your directory structure would look more or less look like this:

> |red5_server
 - -> |webapps
  - -> |MYAPPLICATION
   - -> |WEB-INF
    - -> |src
     - -> |your
      - -> |package
       - -> |name
    - -> |classes
    - -> |lib

3. Let us now study the following files which are contained within the WEB-INF folder: web.xml, red5-web.xml, red5-web.properties, log4j.properties, build.xml. These files are ordinarily dropped in the WEB-INF folder:
red5_server > webapps > red5java > WEB-INF > drop them here!:

a) web.xml: This is the first file that your Jetty/Tomcat Servlet engine will read. The parameter webAppRootKey defines the application context of your application. This file required by the servelet specification and is the standard deployment descriptor used by your Servlet engine. It will be used to load the other 3 files below. Again consult Joachim’s migration guide.

b) red5-web.xml: This config file is used to configure and load your scope/context handler, your virtual-host configuration and your very own application. This is file is used by the Spring Framework IoC beans when Dependency Injecting your Servlet so it can be correctly instantiated within the red5 server.
It is also within this file that you configure your Handlers. The Handlers are the methods that are called when a flash client connects to your application ie rtmp://your-ip/your-application. “your-application” represents an application scope and so these Handler/Methods are valid within your application scope. Thus, your Handlers will be able to react when a flash client connects or leaves your application scope, you need to implement the interface org.red5.server.api.IScopeHandler.
Joachim Bauch’s tutorial explains this in good detail:
HOWTO-NewApplications.txt
The Dependency Injection specified by the bean id web.handler is very important or else your application might not start. Please ensure you specify the correct classpath of your application here.

c) red5-web.properties: This file is imported into the red5-web.xml file. Use this file for items that often change within your configuration eg the contextPath (ie name of your application scope) or virtualHosts directives (which might change from one hosted service to another). If you open the file red5-web.xml, you will see that the Spring PropertyPlaceholderConfigurer bean is used to load the red5.properties file. The contextPath and virtualHosts properties are loaded within the red5-web.xml file by using the variables ${webapp.contextPath} and ${webapp.virtualHosts} respectively.

d) log4j.properties: This is used to configure the logging properties of your application by using the log4j libraries. This file will be used by the
org.apache.commons.logging LogFactory class.

For the settings in this file to take effect, you have to register the logger for your application in this file. (Alternatively though, you could add your log4j definition in the conf/log4j.properties file, together with the logging definitions for the other sample Red5 applications. However, you may just use the log4j.properties file that is within your own application). Add the following entry (modify as appropriate for your own application):

In red5_server/webapps/red5java/WEB-INF/log4j.properties or red5_server/conf/log4j.properties:
log4j.logger.org.red5.webapps.red5java=DEBUG

In your class you will retreive the log by using:
protected static Log log = \
LogFactory.getLog(Application.class.getName());

You can obtain a template of these files from within the red5 server folder by going to doc/templates/myapp/WEB-INF

The combination of the above 4 files is used to instantiate your red5 application. This is the application we will be using to communicate with flash clients for this tutorial.

e) build.xml: This is the file that we will use to compile our application before restarting red5. You may use this example build file to compile/build for your own custom applications. Modify the following parameters as appropriate:

In our case it was red5java.jar and so we have:

4. Now going back to Eclipse, click within the Naviator Panel and then click F5 to refresh your Navigator panel. You will now see the folder red5java under webapps. Under red5java is WEB-INF and under WEB-INF is src. The folder src contains the folders that represent your package above ie org.red5.webapps.red5java

[Please note that all Shared Objects below are “Remote Shared Objects” ie they are stored on the Server, not the flash client]

CREATE A PLAYLIST AND STORE IT WITHIN “TRANSIENT” RED5 SERVER SHARED OBJECT USING JAVA AND OTHER SHARED OBJECTS FUNCTIONALITY

In this section we will create a Shared Red5 object. This object represents a Playlist of all available content. Once this playlist has been loaded into the Shared Object, all Flash clients that connect to our red5java application scope will have access to the same playlist. This is because in an ideal environment, we would only need one playlist for all our Flash clients. This playlist could typically be loaded from an XML file (see loadPlayList method of Application.java). But rather than always re-reading the XML file everytime a client connects, this XML could be loaded only once when the first client connects and then made immediately available to all other clients when they connect. This is why we put the method appStart(IScope app) hook.
[****This is a very important NOTE****: When debugging your application, do not put any code inside the appStart method unless you are absolutely sure it works. This is because an error in the application scope of your application will result in your application never ever even seeing the light of day. Debug in say appConnect method (so you are able to view related debug logs) and only transfer to appStart once you are sure it works.]

1. From your red5java WEB-INF folder, right click and create a new folder called playlist. Inside this folder we drop the following file inside this playlist folder: playlist.xml

Now while still within your red5java WEB-INF folder, navigate to

org>red5>server>webapps>red5java>WEB-INF>src>org>red5>webapps>red5java
.

The following source java files are dropped in: Application.java, DemoService.java, SOEventListener.java, SOHandler.java, ScheduledJob.java. These are the files that we will use to demonstrate creation of transient/non-persisted shared objects, handlers, listeners and a scheduled job. Our package name is org.red5.webapps.red5java

Below I explain some aspects of this example red5 application.

2. The Application.java….
> Application.java is the scope handler of you application. By extending the ApplicationAdapter class, we can determine or code what happens whenever the application is started, whenever the a new client connects or disconnects and whenever an application is stopped.

> loadPlayList loads playlist items from an xml file. The main scope of your red5 application will be the folder of your red5 appliction. In our case, the main scope was therefore red5java. Thus on doing the following:
Resource playlistXML =
\ this.appScope.getResource(fileName);

we actually get the resource from red5java/playlist/playlist.xml

We retreive the Inputstream to the xml file by using the usual JAVA BufferedReader.

3. The DemoService.java…
There is no reason we could not have put the methods in this file in the Application.java file. However, we all know that it is good programming practise to separate application logic into different classes depending on the pattern that emerges in your application. Anyway, that won’t be the case for now, I just want to show you something very interesting…

Methods in DemoService.java are called from the flex2 client using the following call for example:
nc.call("demoService.getPlayList", nc_responder);

Now for the interesting question, how the hell does by flash client get to know how and where to call the demoservice.getPlayList method from. How does it do this? This is accomplished by wiring your DemoService class in the red5-web.xml file, through defining its bean in this file. If you have more classes, this is exactly the same place you would place them in. Thus, whenever your flash client calls a remote red5 method, the rtmp handler will be able in turn find and call your class due to this bean definition(**confirm/test this statement). You will also notice that the red5-web.xml file contains a bean definition for the Application.java file above; it is defined as the main web handler of your application as described above.
Here are the bean definitions we are talking about in the red5-web.xml file:


bean id="web.handler" class="org.red5.webapps.red5java.Application"

and

bean id="demoService.service" class="org.red5.webapps.red5java.DemoService"


The new service you define in red5-web.xml should end with service, so that red5 will be able to invoke it.

4. You may call getPlayList method that makes use of a “Transient Shared Object” from the flex2 application which you can download from here:
red5_flexclient.tar.gz

Open the Flash client from the following URL. Put the following URL: rtmp://ip-of-your-red5-server/red5java.

Click the “Connect” button. On connecting to the red5 application from the flash client, the following happens:

>the xml playlist is loaded into a transient shared object, once only during the start of the application. To veiw the contents of this shared object, select getPlayList method and click on the Execute button. You will see the contents of the playListSO SharedObject we loaded in the red5 server printed on the Text Area. However, this method will only work with the latest trunk of red5.

>a counter of all the persons who have connected to your application scope is printed by clicking on the Execute button after selecting the getCounter method (This method should work with the latest release of red5). Follow this sequence several times to see the counter changing:
Connect>select getCounter >click Execute>click Disconnect>click Connect>select getCounter>click Execute … etc…

>a transient shared object with a listener is created in the red5 initTSOwithListener() method. The listener should be triggered whenever a change occurs to the shared object. To demonstrate this, select the sendMessage(trigger Red5 TSO update) method and click execute. If you go to the red5_server console, you will see the default message “This is to modify TSO” printed, and onSharedObjectUpdate for the SOEventListener triggered. You may change the message that is sent to red5 by entering your own text, inside the textbox labelled Message(message to send to red5). This textbox can also be used to change the message used to update the persistent shared object with listener below. At this point it is very important that I mention that make sure that you put your onSharedObjectUpdate functionality in the

onSharedObjectUpdate \
(ISharedObjectBase so, String key, Object value)

and not
onSharedObjectUpdate functionality in the

onSharedObjectUpdate \
(ISharedObject so, String key, Object value)

or else the onSharedObjectUpdate Event will never be triggered. Please remember this as it is very easy to confuse these 2 interface methods.

> a persistent shared object with a listener is created with the initPSOwithListener method, and just like the transient shared object above, the listener should be triggered everytime there is a change with the persistent shared object. Again, if you experience problems with this method, delete the red5java/persistence/SharedObjects folder.

> Calling a remote shared object method using remote_sharedobject.send(“handler”, “args”) should cause your red5 shared object handler to be called. Shared object handlers can either be defined in red5-web.xml or by defining a Handler class and registering it using the sharedobject registerServiceHandler method. Please consult Joachim’s guide for a good explanation of this.

>If on the flex client you listen for change events on shared objects, then red5 will enable this synchronisation for you, so that whenever a sharedobject value changes, the flex client will be informed. Please refer the red5_flexclient.tar.gz sources for examples of how to do this.

SHARED OBJECT LISTENERS NOTES
These implement the ISharedListener interface.
1. You can register several listener classes (which in our case was SOEventListener), for the same shared object.

2. Several SharedObjects can use the same listener. Simply identify the shared object attributes whose values are changing by ensuring names (keys to the shared object attributes/values) are unique. React differently if the name returned is different.

SHARED OBJECT HANDLERS NOTES
1. You may call a remote shared object from the red5 server by using SharedObject.getRemote syntax (please see the red5_flexclient sources attached).
2. You may call a red5 method (without ever having to register the class in red5-web.xml), by using so.registerServiceHandler syntax, where you can register a method handler for a shared object (You may still do the same using the red5-web.xml file though – see Joachim’s migration guide). You then call this method using the remote_so.send syntax (refer to the red5_flexclient.tar.gz for how to do so)

SCHEDULE FOR THE PLAYLIST TO BE RELOADED EVERY 1 HOUR USING JAVA
You might want the playlist Transient shared object above to be reloaded every 10 minutes with updated content from a changing playlist.xml file. The Application.java and ScheduledJob.java files shows you how to create a regularly scheduled job.

BUILD YOUR RED5 APPLICATION
Whenever you make a change to your application, you need to rebuild it and restart red5. Using the red5java build file provided, here’s an example that allows you to automate and speed up this process using ant:

1. First create red5.jar by running from within the root/base of the red5 source folder. You only need to do this once (ie just after downloading red5), and not all the time.

#ant jar

2. Now go to the red5java directory within your webapps directory and do:
#ant build

To adapt the build.xml file for yourself, simply change the following build.xml items depending on your system:
>target.jar (put the name of your own jar file)
>source= (put 1.5 or 1.6 depending on the java jvm version you are running on your machine)
>target= (put 1.5 or 1.6 depending on the java jvm version you are running on your machine)

3. If your application builds successfully, restart red5 using ant server, ./red5.sh or red5.bat and then try to connect to your red5 application using the sample flex2 application you have modified.

CONCLUSION
The code written here is by no means clean and is not designed using the best principles. Most of it was written while half-asleep ;). It is only meant as a guide so you are able to see Red5 in action by example based on Joachim’s Migration Guide. In addition, this code has been little tested and therefore comes with no warranty whatsoever.

SPRING REFERENCES
1. http://www.onjava.com/pub/a/onjava/2005/05/11/spring.html
2. http://www.springframework.org/docs/reference/beans.html

FLEX2 REFERENCES
1. http://flash-communications.net/technotes/fms2/flex2FMS/index.html
2. http://livedocs.macromedia.com/flex/15/asdocs_en/
3. http://www.amfphp.org/docs/datatypes.html
4. http://coenraets.org/testdrive/flex4j/index.htm
5. http://www.adobe.com/devnet/flashmediaserver/articles/rmi_fms2_02.html
6. http://livedocs.macromedia.com/flex/201/langref/flash/net/SharedObject.html#send()

LOG4J REFERENCE
1. http://jakarta.apache.org/commons/logging/commons-logging-1.0.4/docs/apidocs/org/apache/commons/logging/package-summary.html
2. http://gef.tigris.org/LoggerConfiguration.html
3. http://www.spikesource.com/docs/cs_1.4-linux/doc/commons-logging/commons-logging_quickstartguide.html

RED5 FUTURE DIRECTORY STRUCTURE
http://jira.red5.org/confluence/display/appserver/3rd+proposal+or+Searching+the+Holy+Grail

Comments (93)

Oracle on Linux

I have so far been lucky in not having to get too deep into Oracle since my dealings with Oracle mostly involved running other people’s scripts. But my luck finally run out and here’s a short tutorial based on my experiences…

ORACLE INSTALLATION SUMMARY

1. Create oracle user
#useradd oracle (more options needed if using ldap)

2. Groups: dba, oinstall

#groupadd dba
#groupadd oinstall
#usermod -g oinstall -G dba oracle
#passwd oracle (more options needed if using ldap)

In my case I installed oracle on the oracle home directory /opt/oracle, so change oracle directory ownership:
#chown oracle.dba /opt/oracle
#chmod 755 /opt/oracle

Don’t forget to add user nobody (ie ‘useradd nobody’), but is normally there by default
#su - oracle
#xhost +

oracle@yourmachine>cd databases
oracle@yourmachine>./runInstaller

3. Start and Stop oracle:
oracle@yourmachine>$ORACLE_HOME/bin/dbstart
oracle@yourmachine>$ORACLE_HOME/bin/dbshut

Start and Stop listener:
oracle@yourmachine>$ORACLE_HOME/bin/lsnrctl start
oracle@yourmachine>$ORACLE_HOME/bin/lsnrctl stop

4. Connect to sql database
#sqlplus /nolog
>connect / as sysdba (connect ben/passwd as sysdba)
>startup [nomount]

Or go directly…
#sqlplus ben/passwd@OurTest

5. For Suse Linux;
>Edit /etc/oratab appropriately.
>Edit /etc/profile.d/oracle.sh appropriately especially ensure the $ORACLE_SID is correct
>Edit /etc/init.d/oracle appropriately
>Edit the $ORACLE_HOME_LISTNER variable in $ORACLE_HOME/bin/dbstart file.
Set it to the value of your $ORACLE_HOME directory
>Edit /etc/sysconfig/oracle appropriately

6. Edit
>network/admin/[tnsnames.ora|listener.ora|sqlnet.ora]
and
>db_1/dbs/init.ora
(Under the References below, go to the cuddletech website for a tutorial on how to do so)

7. Oracle Database Management URLs:
> http://localhost:5560/isqlplus (Load and execute scripts)
> http://localhost:5560/isqlplus/dba
> http://localhost:1158/em (Start/Stop oracle instance. Instance start/stop interface)

8.Check version of oracle:
>select banner from v$version;

9.Yasql examples:

#yasql -d 1 -s loyalty sys/passwd@loyalty as sysdba
#yasql -d 1 -s loyalty sys/passwd@loyalty as sysdba @/home/sysadmin/ourtest.sql

10. All databases are created in:/opt/oracle/oradata,
where /opt/oracle was the oracle home directory I chose in my case.
Yours could be different.

11. You have to run dbca(oracle tool to help you create your database) and netca(oracle tool to help you configure your oracle tns and listeners) as root or else it will fail to run.

12. Oracle strace to trace what is happening:
#strace sqlplus sys/passwd@loyalty

13. Test to see if tnsping is working properly for a given database
#tnsping [databasename]

14. You may add the following ORACLE variables to you bash profile eg /etc/profile:

export ORACLE_HOME=/opt/oracle/product/10.2/db_1
export ORACLE_BASE=/opt/oracle
export ORACLE_SID=OurTest
#export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$PATH:$ORACLE_HOME/bin

15. Perform an ldconfig for oracle libs:
#echo $ORACLE_HOME >> /etc/ld.so.conf
#ldconfig

CREATE A NEW DATABASE
1. Copy sample init.ora and only change SID (System Identification).
$cp init.ora initOurTest.ora, where OurTest=SID

Change DB_NAME to the DB_NAME you wish to use.
You might possibly need to change your shared_pool_size value.

2.
#sqlplus /nolog
>connect sys/passwd as sysdba
>CREATE SPFILE='/opt/oracle/product/10.2/db_1/dbs/spfileOurTest.ora'
FROM PFILE='/opt/oracle/product/10.2/db_1/dbs/initOurTest.ora';

Make sure initOurTest.ora is owned by oracle (ie chown oracle.users initOurTest.ora)

The SPFILE is a binary used directly by Oracle that stores even temporary changes you may have made to your database (ie ALTER sql statements). That way, even supposedly transient changes can be saved and used the next time Oracle is started so you as the DBA don’t always have to remember what “alter”rations/optimisations you have done and copy it to PFILE. If you wish to revert to the old PFILE, then create SPFILE from PFILE and remount your database with your old SPFILE. You can only edit the PFILE.

3. To see the SPFILE currently in use by Oracle instance:
>SHOW PARAMETERS SPFILE
View the location of your SPFILE
>select name,value from v$parameter where name='spfile';

4. Startup new instance with your own custom spfile:
>SHUTDOWN IMMEDIATE
>STARTUP NOMOUNT \
PFILE='/opt/oracle/product/10.2/db_1/dbs/initOurTest.ora'

(STARTUP NOMOUNT will use the default PFILE or SPFILE)

Examples:

——————————————————–

create database mydb1 controlfile reuse
Logfile
Group 1 ('/mydatabases/mydb1/log01a.log',
'/mydatabase02/mydb1/log01b.log') size 50M,
Group 2 ('/mydatabases/mydb1/log02a.log',
'/mydatabase02/mydb1/log02b.log') size 50M,
Group 3 ('/mydatabases/mydb1/log03a.log',
'/mydatabase02/mydb1/log03b.log') size 50M,
Group 4 ('/mydatabases/mydb1/log04a.log',
'/mydatabase02/mydb1/log04b.log') size 50M
Datafile '/mydatabases/mydb1/mydb1_system.dbf' 250M
AUTOEXTEND ON MAXSIZE 500M
Undo tablespace mydb1_undo1
Datafile '/mydatabases/mydb1/mydb1_undo1.dbf' 50M
Default temporary tablespace mydb1temp tempfile
'/mydatabases/mydb1/mydb1temp1.dbf' size 75M
Extent management local
Character set US7ASCII
MAXLOGFILES 10
MAXLOGMEMBERS 10
MAXLOGHISTORY 1
MAXDATAFILES 500;

———————————————————
——————————————————–

CREATE DATABASE OurTest
USER SYS IDENTIFIED BY passwd
USER SYSTEM IDENTIFIED BY passwd
LOGFILE GROUP 1 ('/opt/oracle/oradata/OurTest/redo01.log') SIZE 10M,
GROUP 2 ('/opt/oracle/oradata/OurTest/redo02.log') SIZE 10M,
GROUP 3 ('/opt/oracle/oradata/OurTest/redo03.log') SIZE 10M
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
MAXINSTANCES 1
CHARACTER SET US7ASCII
NATIONAL CHARACTER SET AL16UTF16
DATAFILE '/opt/oracle/oradata/OurTest/system01.dbf' SIZE 32M REUSE
EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE '/opt/oracle/oradata/OurTest/sysaux01.dbf' SIZE 32M REUSE
DEFAULT TABLESPACE tbs_1
DEFAULT TEMPORARY TABLESPACE tempts1
TEMPFILE '/opt/oracle/oradata/OurTest/temp01.dbf' SIZE 20M REUSE
UNDO TABLESPACE undotbs
DATAFILE '/opt/oracle/oradata/OurTest/undotbs01.dbf'
SIZE 20M REUSE AUTOEXTEND ON MAXSIZE 500M;

——————————————————–

——————————————————-

INSTALL PHP OCI8 EXTENSION

1. Download Oracle Instant Client from here:
(http://www.oracle.com/technology/tech/oci/instantclient/index.html)
if you do not have oracle installed on the machine. If you have Oracle already installed, skip this step.

#mkdir -p /opt/oracle/instantclient
#cd /opt/oracle/instantclient
#unzip instantclient-basic-linux32-10.2.0.1-20050713.zip
#unzip instantclient-sdk-linux32-10.2.0.1-20050713.zip
#echo /opt/oracle/instantclient >> /etc/ld.so.conf
#ldconfig
#ln -s libclntsh.so.10.1 libclntsh.so
#ln -s libocci.so.10.1 libocci.so

2. Download php oci8 module from here:
http://pecl.php.net/package/oci8,
or use:
#pear5 download oci8
3. untar, get in and

4.

#phpize
#./configure --with-oci8=shared,instantclient, \
/opt/oracle/instantclient/instantclient_10_2
(to use instant client)
or
./configure --with-oci8=$ORACLE_HOME
(To use oracle home if you have installed Oracle locally)

Debian installation URL:
http://samgerstenzang.com/blog/archives/2006/09/howto-installing-oracle-xe-on-ubuntu-with-php

USE ZENDCORE ALREADY PRECOMPILED OCI8 MODULE
1. Download zendcore:
http://www.zend.com/products/zend_core/zend_core_for_oracle

2. Use Zendcore as it is or alternatively after installation copy it's own oci8.so module into your own distros php extensions directory which in my ase was /usr/lib/php5/extensions:

#cd /usr/local/Zend/Core/lib/php/20050922/
#cp oci8.so /usr/lib/php5/extensions

TOP ORACLE TOOLS FOR LINUX:
After many hours of testing all the tools out there, the following tools got the best revs in my opinion:

1. yaSQL
(Download DBD::Oracle module from http://search.cpan.org/dist/DBD-Oracle/ to use)
2. tORA
3. SuperQuaiL
4. m2o
(mysql sql script to oracle script converter)
5. OracleEditor.php

REFERENCES
1. http://www.cuddletech.com/articles/oracle/node34.html (*****)
2. http://www.oracleadvice.com/Tips/isqlplus.htm
3. http://www.oracle.com/technology/pub/articles/smiley_10gdb_install.html
4. http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b12170/ch2.htm
5. http://www.oracleopensource.com/archives/2005/06/index.html
6. http://saturn.uab.es/win.920/a95491/create.htm (Create Oracle database)
7. http://www.idevelopment.info/data/Oracle/DBA_tips/Database_Administration/DBA_37.shtml
8. http://www.examcram2.com/articles/article.asp?p=350920&seqNum=5&rl=1
9. http://orafaq.com/node/6
10. http://www.dbmotive.com/oracle_error_codes.php (Error codes debugging)
11. http://www.stanford.edu/dept/itss/docs/oracle/10g/java.101/b10979/basic.htm (Authentication)
12. http://www.oreillynet.com/oracle/os_dir/commandline.csp
13. http://orafaq.com/faqplus.htm
14. http://www.oracle.com/technology/pub/notes/technote_php_instant.html (php-oracle)
15. http://ubuntuforums.org/showthread.php?t=92528 (php-oracle)
16. http://www.dynamicwebpages.de/tutorial/27/
17. http://creole.phpdb.org/trac/browser/trunk/classes/creole/drivers/oracle?rev=1
18. http://www.psoug.org/reference/system_privs.html (general sql statements)
19. http://www.puschitz.com/InstallingOracle9i.shtml

Comments (5)

TV Capture on Linux

I’d like to begin by saying that after testing vlc, ffmpeg and mencoder in that order, mencoder came out tops.

Capture using vlc
vlc is unable to do the volume mute. You have to do it yourself unlike mencoder.
#v4lctl list (To view the current status of the tuner)

To turn mute off so we get sound off the sound card when caputuring from the sound card using vlc:
#v4lctl volume mute off

To capture from vlc:
#vlc -vvv --color \
v4l:/dev/video:norm=pal:frequency=805750: \
size=640x480:channel=0:adev=/dev/dsp: \
audio=0 -sout '#transcode{vcodec=mp4v \
,acodec=mpga,vb=3000,ab=256, \
venc=ffmpeg{keyint=80,hurry-up,vt=800000}, \
deinterlace}:duplicate{dst=display}'

805750 is the channel frequency in KHz. If you do not know the frequency of your channel, use tvtime’s tvscanner to print out all channels available as shown below:
#tvtime-scanner -n PAL (Yours could be NTSC. Everytime it tunes into a frequency it’ll show you in MHz. That’s how to get the frequency)

To turn it on back again (or else the sound from the tuner will continue playing even after having closed vlc)
#v4lctl volume mute on

Enable sound capture from sound card audio device

1. View all commands available:
#amixer –help

2. View all controls available:
#amixer controls

3. Get the “Capture Source” Item numbers. In my case the Capture Source was number ID 26 from “amixer controls” command above:
#amixer cget numid=26

4. Select the “Line” Item number as displayed in the command above:
#amixer cset numid=26 4

This should now allow you to record sound from your sound card.

Capture from TV to file using ffmpeg

First tune the tvcard using xawtv which doesn’t lock the video and audio device:
#xawtv

Now capture to a file using ffpmeg. The sound’s very disappointing.
#ffmpeg -t 10 -y -vd /dev/video0 -ad /dev/dsp -deinterlace -r 25 -s 320×240 -f avi -vcodec mpeg4 -b 800 -g 128 -bf 2 -acodec mp3 -ab 64 -ar 44100 -benchmark output.avi

Capture TV to file using xawtv’s streamer
If you’ve configured xawtv ok, here’s an example that records to out.avi using streamer (29.97 is PAL’s fps)
#streamer -p 4 -q -r 29.97 -t 00:00:10 -q -o out.avi -j 90 -f mjpeg -F mono16

Capture from TV to file using mencoder
The quality, filters and encoding of mencoder are amazing. It came out the best for me.
This command should capture from TV to flv file:


#mencoder -tv driver=v4l2: \
device=/dev/video0:freq=775.500: \
adevice=/dev/dsp:fps=25:input=0: \
audiorate=48000:amode=1:norm=PAL \
-endpos 00:00:10 -vf pp=lb,scale=320:240 \
-o analog.flv -ovc lavc -lavcopts vcodec=flv \
:autoaspect:vbitrate=500:mbd=2:mv0:trell: \
v4mv:cbp:last_pred=3 -of lavf -lavfopts \
i_certify_that_my_video_stream_does_not_use_b_frames \
-oac mp3lame -lameopts abr:br=56:fast \
-srate 22050 tv://

If you are doing web streaming you might want to optimize the file by reducing the number of keyframes using keyint shown below:
#mencoder -tv driver=v4l2: \
device=/dev/video0:freq=775.500: \
adevice=/dev/dsp:fps=25:input=0: \
audiorate=48000:amode=1:norm=PAL \
-endpos 00:00:10 -vf pp=lb,scale=320:240 \
-o analog.flv -ovc lavc -lavcopts vcodec=flv: \
autoaspect:vbitrate=500:mbd=2:mv0:trell:v4mv: \
cbp:last_pred=3:keyint=150 -of lavf -lavfopts \
i_certify_that_my_video_stream_does_not_use_b_frames \
-oac mp3lame -lameopts abr:br=56:fast -srate 22050 tv://

You could reduce the bitrate and file size even further by using -ofps (output frames per second), but then you stream might look too jerky.

Watch TV using Mplayer

You may use the v4l2 drivers to watch TV on mplayer. Here’s an example:
# mplayer -tv driver=v4l2: \
device=/dev/video0:freq=775.500: \
adevice=/dev/dsp:fps=25:input=0: \
audiorate=48000:amode=1:norm=PAL \
-vf pp=lb tv://

Leave a Comment

BEGIN RED5 DEVELOPMENT

[NOTE: Please replace the paths with your own directory structure for this tutorial]

CHECKOUT RED5 TRUNK INTO ECLIPSE – RED5 SERVER
Checkout red5 if you have reliable bandwidth.
1. Install subclipse. Instructions are on the following URL:
http://subclipse.tigris.org/install.html

2. Set up red5 on eclipse using the wink tutorial on the following URL:
http://www.bluetube.com/clients/red5/eclipse.htm
The red5 dev repository is:
http://svn1.cvsdude.com/osflash/red5/java/server/trunk

3. Right click on the red5 repository above, click on Checkout to checkout the code. The red5 sources will be copied to your workspace directory. In addition, a new java project will be automatically created.

4. You will now have checked out the red5 code and can immediately begin working on it.

Alternatively if your bandwidth is poor, you may download the red5 sources of your choice from the following link:
http://www.osflash.org/red5/red5downloads
Untar these sources, then continue on with the steps below:

CREATE NEW RED5 PROJECT IN ECLIPSE
1. Then navigate to File > New > Project. Call it say red5server

2. Right click on the red5server project link and select Import > File System. Navigate to the location of the untarred red5 sources folder. Select this folder and click on Finish to create your new Red5project.

INSTALLING FLEX2 ON LINUX
Why do we need flex2? We need flex2 to development the Flash Client User Interface that will be connecting to our Red5 server in order to play streams. Flex2 sources can be compiled on linux.

1. Download the flex2 SDK (flex_sdk_2.zip) from Adobe
http://www.adobe.com/cfusion/tdrc/index.cfm?product=flex
However, you need to be logged in first.

2. Then follow the steps below(Note: you might choose to create your flex2sdk directory in a different location):

#mkdir /home/sysadmin/flex2sdk
#cd /home/sysadmin/flex2sdk
#unzip /home/sysadmin/Downloads/flex_sdk_2.zip
#vim /usr/bin/mxmlc

Paste the following 2 lines inside:

#!/bin/sh
/home/sysadmin/flex2sdk/bin/mxmlc

Then…
#chmod 755 /usr/bin/mxmlc

You should now be able to compile flex2 source off the command line

EDITING FLEX2 CODE USING VIM
1. Download the actionscript vim file from the following link:
http://geocities.com/manish_jethani/actionscript.vim

2. Follow the steps below:

#dos2unix /home/sysadmin/Downloads/actionscript.vim
#cd /home/sysadmin/Downloads/
#cp actionscript.vim /usr/share/vim/current/syntax/
#vim /usr/share/vim/current/filetype.vim

Remove the *.as from the entry for the Atlas language
Then add the following 2 lines to the same file:

” Actionscript
au BufNewFile,BufRead *.as setf actionscript

Now,
#vim /etc/vimrc
Append the line below to the vimrc file:
syntax on

You should now be able to edit *.as files on vim.
3. Since *.mxml are xml files, syntax highlighting for these files will be on by default.

INSTALLING ECLIPSE WTP
1. Download Eclipse WTP (for J2EE web application development) from the following link:
http://download.eclipse.org/webtools/downloads/
Look for the wtp all in one sdk and download it, as it comes with all the required pre-requisites.

2. Untar the all in one wtp sdk.
#cd /home/sysadmin/Downloads
#mkdir wtp
#tar -xzvf wtp-all-in-one-sdk-*-linux-gtk.tar.gz —directory wtp

3. Create a folder (if it doesn’t exist already) called links in your eclipse installation path. So in my case I did this:
#mkdir /opt/eclipse/links

3. #vim /opt/eclipse/links/wtp.link
(Append the following line ie the path to your untarred wtp sdk folder)
path=/home/sysadmin/Downloads/wtp/eclipse

4. Now restart eclipse. The wtp plugin should have been installed. To remove the WTP plugin just remove the wtp.link file in your links directory above.

INSTALL SPRING ECLIPSE IDE
Red5 is written using the Spring Framework so to do server side logic code it would help a great deal to have this plugin installed. Red5 uses Spring to perform Dependency Injection (DI) by using Spring’s IoC (Inversion of Control) container. This allows you to custom configure red5 (with your own personal dependencies) without having to alter/modify the core red5 api. In addition, Spring comes with plenty of functionality and features that you can use for your server-side logic. When using Spring’s IoC container, try us much as possible to decouple the IoC container from your actual source code. Please follow the steps below to configure the Spring Eclipse IDE:

1. Download the spring ide eclipse plugin from the following URL:
http://springide.org/updatesite/

2. unzip it:
#cd /home/sysadmin/Downloads
#mkdir spring
#mv springide_updatesite_*.zip spring
#cd spring
#unzip springide_updatesite_*.zip

3. Add the plugin to Eclipse. A warning is given not to copy the plugin folders directly into your eclipse installation. You can only use Eclipse’s Update Manager. In Eclipse, navigate to: Help > Software Updates > Find and Install > Search for new features to install. Click on Next.

4. Click New Local Site. Select the folder spring above ie
/home/sysadmin/Downloads/spring

5. Tick the checkbox with spring and click Finish. Follow the installation instructions to completion to install Spring IDE plugin inside Eclipse.

INSTALLING FLEX BUILDER 2 ON LINUX
1. Download Flex Builder 2 from the following link:
http://labs.eshangrao.com/files/FlexBuilder_2.0_Linux_Alpha_0.1.tar.gz

2. Follow these steps:
#mkdir /home/sysadmin/Downloads/FlexBuilder2

In my case, I have eclipse installed in the /opt directory.


#cd /home/sysadmin/Downloads
#mv FlexBuilder_2.0_Linux_Alpha_0.1.tar.gz /opt/eclipse
#cd /opt/eclipse
#tar -xzvf /opt/eclipse/FlexBuilder_2.0_Linux_Alpha_0.1.tar.gz
#cp -Rf configuration plugins
#cp -Rf configuration features
#vim /opt/eclipse/configuration/com.adobe.flexbuilder/flexbuilder2.properties

Edit the line sdk.path=/home/sysadmin/flex2sdk to the path of your flex2 SDK. You should now be ready to start flex2 development on Linux.
Do the same for the following files:

#vim /opt/eclipse/plugins/configuration/com.adobe.flexbuilder/flexbuilder2.properties
#vim /opt/eclipse/features/configuration/com.adobe.flexbuilder/flexbuilder2.properties

3. Start Eclipse (to be sure everything runs ok without any permission errors, run it as root)
#eclipse -clean

4. When Eclipse starts up, you will be asked for your valid Flex Builder 2 Serial Number and Chart Serial Number if you choose to enable it. Enter your Serial Numbers, press ok and you can now run Flex Builder 2 on Linux.


INSTALL ECLIPSE Actionscript Development Tool ON LINUX INSTEAD OF Flex Builder 2

1. Please download and follow the instructions on this link:
http://sourceforge.net/projects/aseclipseplugin/

You may now use vim or eclipse for all red5 development on Linux.

INSTALL FLASHPLAYER 9 FOR LINUX
1. Download Flash9 for Linux from the following link:
http://www.adobe.com/go/getflashplayer

2. Please follow these instructions:
#tar -xzvf /home/sysadmin/Downloads/FP9_plugin_beta_101806.tar.gz
#cd /home/sysadmin/Downloads/flash-player-plugin-9.0.21.55

Now follow the instructions in the readme.txt contained in this directory
(Your directory will be most likely be either /usr/lib/mozilla or /usr/lib/firefox. Try both and see which works for you.)


RED5 FLEX2 SAMPLE PLAYER

1. Download John Grden’s excellent sample player from the following link:
http://www.rockonflash.com/red5/demos/samples/Red5Samples.zip

2. Follow the steps below if you are on Linux:
#unzip /home/sysadmin/Downloads/Red5Samples.zip
#cd /home/sysadmin/Downloads/Red5 Samples

All the player sources are contained therein
Use this player to connect to the red5 oflaDemo streams as you will see below:

3. Open the Red5 Samples folder using either vim or eclipse and then modify the file build.properties and build.xml so we can compile the samples on Linux. Lets begin with build.properties. Edit the following variables:
– launchmethod=ff (make it equal to firefox)
– firefox=/usr/bin/firefox (location of your firefox binary)
– compiler=/usr/bin/mxmlc
– flex2.dir=/home/sysadmin/Downloads/flex2sdk/bin

4. Under the build.xml file change the compile and launchfirefox targets to something that fits your system. Also, comment out the tag: arg line=”-source-path=’C:/Program Files/FlashDevelop/Library'”

5. Increase the detail of red5 logging by modifying the file /conf/log4j.properties. Modify the file conf/log4j.properties under #Demos for the oflaDemo specifically. Change from WARN to DEBUG. In my case the was /opt/red5svn

6. In Eclipse navigate to File > New Project > Flex Project. Give it a name say red5flex.

7. In the Package Explorer to the left of your Eclipse workspace, right click on red5flex and click Import. Then go to General > File System and click Next. Select the location where you unzipped the Red5Samples.zip above. You now have a new flex project in Eclipse.

7. To run, right click on red5flex’s project build.xml (the build.xml file you have just edited above) file and select Run as > Ant Build. The player will open in a new firefox browser window.

8. In the location where you downloaded or checked out red5 server code, run:
#ant server (In my case this was /opt/red5svn. Run this command where build.xml file is in the same directory.) To confirm that red5 has started up ok, navigate to http://localhost:5080/, where you should be able to see the red5 admin panel.
Since logging for the oflaDemo is set to DEBUG, you will be able to see when the player connects to Red5 (using AMF0) and retreives the flv files.
If you have any problems running ant server, please ensure you have SUN’s JDK in your JAVA path. The jdk on my suse box for example doesn’t work for red5 compilation. Download it from the following link:
http://java.sun.com/downloads/

Then put it in your path. Open the file /etc/profile. Append the following text inside:
export JAVA_HOME=/opt/jdk1.5.0_09
export PATH=$PATH:$JAVA_HOME/bin

In my case I installed the jdk in the folder /opt.
Then do:
#source /etc/profile

Now everytime you boot the machine, your $JAVA_HOME variable is set.

If you are running Suse, go to /usr/bin
#cd /usr/bin
#rm java
#ln -s /opt/jdk1.5.0_09/bin/java java

You can now use the latest SUN jdk on your machine.

9. Inside the player that you have just opened in the firefox window, click Connect. In the console where you started ant server you will see the flash client connecting and retreiving information on the flv streams available.

10. Modify John’s flex2 flash client to your liking from here on and everytime you want to test just run ant using it’s build.xml file as shown above.

MAKE YOUR OWN RED5 APPLICATION AND PLUG IT INTO THE RED5 SERVER
1. At this point you should now be ready to follow Joachim’s excellent tutorials on how to do so. Please find them on the following link:
http://www.joachim-bauch.de/tutorials/red5/view

2. To start up red5 run ant server or ./red5.sh or execute red5.bat.


CREATE SAMPLE FLASH PLAYER USING OPEN SOURCE OPENLASZLO

[TODO]

A GOOD READ
1. Red 5 searchable mailing lists:
http://www.mail-archive.com/red5@osflash.org/
http://www.nabble.com/Red5-f16328.html(new)

2. Tomcat:
http://tomcat.apache.org/tomcat-5.5-doc/appdev/deployment.html

3. Beans:
http://www.springframework.org/docs/reference/beans.html#beans-basics

4. Ruby and Groovy with Spring:
http://www.springframework.org/docs/reference/dynamic-language.html

Comments (26)