Archive: July, 2008

Zend Framework, Flex & PHP – Best Practice Cautions

Hey guys,

recently me and my flex developer colleague had a weird problem while exchanging data from zend framework to flex as web services using json.

well, 1st caution :

<?php echo "Json = $encoded_json_data"; ?>

don’t ever use a closing tag ” ?> ” in your controllers or classes, as it will result in new line in the output json data, which will make flex not able to recognize it correctly.

2nd caution :

<?php echo "Json = $encoded_json_data"; ?>

when u echo output from php don’t leave space between the variable and the equal “=” sign and also between the equal “=” sign and the value.
to be clear :
example 1 :

This won’t work as flex will not recognize a value for the variable Json.
example 2 :

This will work because we removed the spaces.

hope u don’t fall in this trap as we did.
& enjoy ;)

Adobe to contribute AMF support to Zend Framework

Hey folks,
i have read this great news yesterday, that Adobe has made a proposal for an AMF (Action Message Format) component in Zend Framework.
what a great addition to the strong & superior framework.
this will facilitate my work a lot with my colleagues here that works with Flex, we have been developing some Air applications, and as a solution of the interaction between Flex & PHP we used web services to exchange the data in Json format between us, it works fine, but having the options of AMF will make it more powerful and smooth.
long live ZF, long live flex ;)

here is the link for the news i got :
http://andigutmans.blogspot.com/2008/07/adobe-to-contribute-amf-support-to-zend.html

and here is the link for the proposal :
http://framework.zend.com/wiki/display/ZFPROP/Zend_Amf

Enjoy ;)

Linux Terminal Commands Guide

Hey folks,

a friend asked me for a nice guide to learn the Linux commands, so i made a search for him and found some cool links

straight to the point guide for beginners :
http://linux.org.mt/article/terminal

it covers the following topics :
* Introduction
* Preparation
* The “Bash” shell
* A simple command
* Obtaining help
* Linux Directories
* Linux Files
* Wildcards
* Typing Tricks
* Redirecting Output
* Environment variables
* Scripts
* Aliases
* Switching to root
* Compiling from source
* Conclusion

————————————————–
Alphabetical Directory of Linux Commands
http://www.oreillynet.com/linux/cmd/

a complete directory of Linux commands

————————————————–
Linux shortcuts and commands
http://www.unixguide.net/linux/linuxshortcuts.shtml

This is a practical selection of the commands we use most often

if you have more cool guides, please post in comments

Google Calendar SMS Reminders Active in Egypt

Well, as u can understand from the subject, now the sms notifications of google calendar works with egyptian providers, i tried with vodafone and mobinil and it works smoothly.

steps are easy :
1- go to www.gmail.com and open your mail account.
2- click on the calendar link on the top left of the page.
3- in the calendar page click on settings on the top right of the page.
4- click on mobile setup tab.
5- enter your mobile number and then you will recieve a confirmation code,
6- enter the confirmation code and verify.
7- you will be redirected to notifications page, enable all SMS notifications, and setup default reminders for each event, you can setup up to 5 reminders.

you are done, and you can setup repeated events, for example i setup a daily event to wake me up by sms every morning.

another trick if you want to send sms to another person and you have no credit , just enter a new event, with the title

Installing ffmpeg-php on Centos 5

It took me a couple of days to figure out the right way to install ffmpeg-php extension for php, so i documented all the instructions to not waste another 2 days for me and anyone interested
i started with http://www.amman-dj.com/Slim/2008/01/29/how-to-installing-ffmpeg-mplayer-flvtool-2-and-ffmpeg-php-4-youtube-clone-script/ but didn’t work with me and i needed more plugins, so i modified it and added the other packages
enjoy :)

##########################
# add dag repository

rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm

##########################
# update system

yum -y update

##########################
# Download Packages

mkdir ~/ffmpeg-packages
cd ~/ffmpeg-packages
wget http://www3.mplayerhq.hu/MPlayer/releases/codecs/essential-20061022.tar.bz2
wget http://rubyforge.org/frs/download.php/9225/flvtool2_1.0.5_rc6.tgz
wget http://downloads.xiph.org/releases/ogg/libogg-1.1.3.tar.gz
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.1.2.tar.gz
wget http://liba52.sourceforge.net/files/a52dec-0.7.4.tar.gz
wget http://downloads.sourceforge.net/faac/faad2-2.6.1.tar.gz
wget http://downloads.sourceforge.net/faac/faac-1.26.tar.gz
wget http://superb-east.dl.sourceforge.net/sourceforge/lame/lame-3.98b8.tar.gz
wget http://www.tortall.net/projects/yasm/releases/yasm-0.7.0.tar.gz
wget ftp://ftp.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-20080630-2245.tar.bz2
wget http://downloads.xvid.org/downloads/xvidcore-1.1.3.tar.gz
wget http://www.linux1394.org/dl/libraw1394-1.3.0.tar.gz
wget http://mesh.dl.sourceforge.net/sourceforge/ffmpeg-php/ffmpeg-php-0.5.3.1.tbz2

##########################
# Install SVN/Ruby

yum install subversion
yum install ruby
yum install ncurses-devel

##########################
# Extract all the source files

bunzip2 essential-20061022.tar.bz2; tar xvf essential-20061022.tar
tar zxvf flvtool2_1.0.5_rc6.tgz
bunzip2 ffmpeg-php-0.5.3.1.tbz2; tar xvf ffmpeg-php-0.5.3.1.tar
tar zxvf libogg-1.1.3.tar.gz
tar zxvf libvorbis-1.1.2.tar.gz
tar -zxf a52dec-0.7.4.tar.gz
tar zxf faad2-2.6.1.tar.gz
tar zxfv faac-1.26.tar.gz
tar zxfv lame-3.98b8.tar.gz
tar zfvx yasm-0.7.0.tar.gz
bunzip2 < x264-snapshot-20080630-2245.tar.bz2 | tar -xf -
tar zxfv xvidcore-1.1.3.tar.gz
tar zxfv libraw1394-1.3.0.tar.gz

##########################
#Create the codecs directory & import them

mkdir /usr/local/lib/codecs/
mv essential-20061022/* /usr/local/lib/codecs/
chmod -R 755 /usr/local/lib/codecs/

##########################
# Install Lame

cd lame-3.98b8
export LD_LIBRARY_PATH=/usr/local/lib
./configure
make
make install
cd ..

##########################
# Install libOGG

cd libogg-1.1.3
./configure
make
make install
cd ..

##########################
# Install libVorbis

cd libvorbis-1.1.2
./configure
make
make install
cd ..

##########################
# Install flvtool2

cd flvtool2_1.0.5_rc6
ruby setup.rb config
ruby setup.rb setup
ruby setup.rb install
cd ..

##########################
# Install a52

cd a52dec-0.7.4
./configure --enable-shared=PKGS
make
make install
cd ..

##########################
# Install FAAD2

cd faad2
autoreconf -vif
./configure --disable-drm --disable-mpeg4ip
make
make install
cd ..

##########################
# Install FAAC

cd faac
./bootstrap
./configure --disable-mp4v2
make
make install
cd ..

##########################
# Install yasm

cd yasm-0.7.0
./configure
make
make install
cd ..

##########################
# Install x264

cd x264-snapshot-20080630-2245
./configure --enable-shared
make
make install
cd ..

##########################
# Install Xvid

cd xvidcore-1.1.3/build/generic
./configure
make
make install
cd ../../..

##########################
# Install libraw1394

cd libraw1394-1.3.0
./configure
make dev
make
make install
cd ..

##########################
# Install libdc1394

yum install libdc1394 libdc1394-devel

##########################
# Install libtheora

yum install libtheora libtheora-devel

##########################
# Install vlc & mplayer

yum install vlc mplayer

##########################
# Install ffmpeg

svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
cd ffmpeg
./configure --enable-gpl --enable-postproc --enable-nonfree --enable-postproc --enable-libfaad --enable-avfilter --enable-pthreads --enable-libxvid --enable-libx264 --enable-libmp3lame --enable-liba52 --enable-libfaac --disable-ffserver --disable-ffplay --enable-libtheora --enable-libvorbis --enable-shared
 
make
make install
export LD_LIBRARY_PATH=/usr/local/lib
cd ..

##########################
# Install FFMPEG-PHP (make sure the php.ini path is correct.)

cd ffmpeg-php-0.5.3.1
phpize
./configure
make
make install
 
echo 'extension=ffmpeg.so' >> etc/php.ini
cd ..
service httpd restart
 
php -r 'phpinfo();' | grep ffmpeg