Recursive Function for Nested Categories

Nested Categories over Drop Down

Nested Categories

Categories and its sub categories are always useful while developing simple to huge applications. Here is a simple php code to create multi-leveled nested categories on select box to those categories.

CREATE TABLE `tb_category` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`pid` int(11) NOT NULL,
`name` varchar(255) NOT NULL
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


<?php

/*

Function lists all items in table tb_category

- id

- pid

- name

*/

$HOST="localhost";

$DB="categories";

$USER="root";

$PASS="";

mysql_connect($HOST,$USER,$PASS);

mysql_select_db($DB);

function RecursiveCat($pid)

{

static $level=0;

static $strid="";

static $strname="";

$sql=mysql_query("select * from tb_category where pid = '$pid' order by name ");

while($row=mysql_fetch_assoc($sql))

{

$id=$row['id'];

$level--;

$pad="";

for($p=1;$p<($level*-1);$p++) $pad.="&nbsp;&nbsp;&nbsp;- ";

$strname.='<option value="'.$row['id'].'">'.$pad.$row['name'].'</option>';

$rid=RecursiveCat($id);

$strid[]=$row['id'];

$level++;

}

return $strname;

}

echo '<select name="cat">';

echo RecursiveCat(0);

echo '</select>';

?>

SIP Web Phone

SIP Phone service which lets you use your SIP account anywhere in the world via their web based SIP service. The good thing is they already have a few popular SIP services pre-configured, so you don’t even have to configure their SIP.

SIP (Session Initiation Protocol) is the most popular Voice over IP (VoIP) standard. SIP enables two or more people to make phone calls to each other using the Internet to carry the call.

A good quality sip provider will allow for pristine call quality and minimal drops.

Using Flex, Java and Red5 Server we can develop Web Sip Application. The main advantage of these phone is no need to install at client side. Simply we can browse application and we can register and make call.

Asterisk. Digium’s open source communications engine powers voice and video communication solutions worldwide. Discover the power of Asterisk, let us help you choose the right Asterisk solution.

Click2Call is a service that provides users of your websites to make calls from your website and leave voicemails for you by simply clicking a button.

Free Call - Free International Calls & Free VoIP Service. Internet phone calls - free VoIP, call PC to phone over Internet telephony

TringMe also provides a complete ecosystem wherein VoIP providers, Service providers, Enterprises, Developers and End-users can play. An ecosystem which can cater to developing innovative applications that integrate Voice and Telephony without worrying about the underlying details of call routing and signalling.

TringMe - Web based Telephony

Twilio Voice
Build applications that use the phone network to interact with people on landlines and cell phones all over the world. In just a few lines of code, you’ll have phones ringing.

Twilio - Build Scalable Voice, VoIP and SMS Applications in the Cloud

PHPVoice

Build voice enabled applications directly in PHP.

VoicePHP - PHP For Voice

Doddle Web Phone

Online SIP WebPhone-Click2Call Doddle - VoIP call from webpage public telephone

Make VoIP calls anywhere in the world via Doddle web based SIP phone directly from your webpage.
Public Internet Telephone: With the free, online, no registration Doddle phone service, VoIP is as easy as accessing a webpage: just start using!
It’s a Doddle.

Linphone is an internet phone or Voice Over IP phone (VoIP).

Linphone, open-source voip software - Linphone, an open-source video sip phone

* Linphone can be used for communicating freely with people over the internet, with voice, video, and text instant messaging.
* Linphone makes use of the SIP protocol , an open standard for internet telephony. You can use Linphone with any SIP VoIP operator, including our free SIP audio/video service.
* Linphone is free-software (or open-source), you can download and redistribute it freely.
* Linphone is available for desktop computers: Linux, Windows, MacOSX, and for mobile phones: Android, iPhone, Blackberry.

OpenSIPS (Open SIP Server) is a mature Open Source implementation of a SIP server. OpenSIPS is more than a SIP proxy/router as it includes application-level functionalities. OpenSIPS, as a SIP server, is the core component of any SIP-based VoIP solution. With a very flexible and customizable routing engine, OpenSIPS ‘unifies voice, video, IM and presence services in a highly efficient way, thanks to its scalable (modular) design.

OpenSIPS feature:
* SIP registrar server
* SIP router / proxy (lcr, dynamic routing, dialplan features)
* SIP redirect server
* SIP presence agent
* SIP back-to-back User Agent
* SIP IM server (chat and end-2-end IM)
* SIP to SMS gateway (bidirectional)
* SIP to XMPP gateway for presence and IM (bidirectional)
* SIP load-balancer or dispatcher
* SIP front end for gateways/asterisk
* SIP NAT traversal unit
* SIP application server

Cipango is a SIP Servlets extension to the popular Jetty HTTP Servlet engine. Cipango/Jetty is then a convergent SIP/HTTP Application Server compliant with both SIP Servlets 1.1 and HTTP Servlets 2.5 standards. It also features a Diameter extension to develop IMS applications.

slider_1

OpenVBX allows developers to build voice and SMS applications for business, such as toll free phone numbers, call forwarding, voicemail, visual voicemail, voicemail transcriptions, and auto-attendants. It’s like Google Voice, but open source and for business.

OpenVBX- the Web-based, Open Source Phone System for Business

OpenVBX- the Web-based, Open Source Phone System for Business1

FreeSWITCH is a scalable open source cross-platform telephony platform designed to route and interconnect popular communication protocols using audio, video, text or any other form of media. FreeSWITCH also provides a stable telephony platform on which many telephony applications can be developed using a wide range of free tools.

Record Audio from Websites

Flex is a platform for developing and deploying Applications that run on Flash player on Web using Red5 Server.

Flex / Red5 applications are compiled to SWF files and are executed at runtime by Adobe Flash Player.

Red5-Recorder

Open source Red5 video flex flash recorder and player project allows you to insert a red5 / flex module to do it directly from your website. Uses Flex and red5. Videos are stored as FLV streams and can be playable and reviewed from this project within flash player. 2 modes are visible: recorder mode and player mode. All other parameters can be defined through simple html script.

Record, Visualize & Save Microphone Input

Record, Visualize & Save Microphone Input - makemachine

MicrophoneCapture, MicrophoneInput, InputRenderer, WavEncoder are some basic classes to record audio from microphone.

Create a Useful Audio Recorder App in ActionScript

Create a Useful Audio Recorder App in ActionScript 3 - Activetuts+

The MicRecorder class is a great addition to ActionScript 3, be sure to bookmark this article. 😉

Barebones Audio Recorder

Client-side audio capture and conversion to MP3.

This recorder captures user audio, converts to MP3 format on the client side, then uploads to the server.

Barebones Audio Recorder

Flash-based interface
Barebones Audio Recorder1

Sample HTML-based interface
Barebones Audio Recorder2

Red5 record audio with the Flash plugin

Other Links:
http://www.sajithmr.me/jrecorder-jquery
http://flvar.com/documentation
http://labs.makemachine.net/2011/04/record-visualize-save-microphone-input/

PHP Syntax Highlighter

Online syntax highlighting

PHP has a great function that automatically highlights PHP code called highlight_string(); this could be used to roll your own code highlighting on a site. In this demo I’ll show you the basics of how it works, then extended it with a few tricks.

Install Etherpad on SUSE Linux

Collaborate on documents in really real-time on SUSE Linux

EtherPad is the first web-based word processor that allows people to work together in really real-time.

All editing of the document is instantly visible on the screens of all participating users, enabling new and productive ways to collaborate on text documents. Etherpad is useful for meeting notes, drafting sessions, education, team programming, and more…

1. Online word-processor with formatting options
2. Letter by letter collaboration
3. Color-coded edits
4. Infinite Undo
5. History Playback
6. Import HTML, Word, RTF
7. Export as HTML, Word, PDF
8. Change Zoom
9. Super simple to embed into your own website/CMS with jQuery and PHP examples
10. Support with PHP, jQuery, Elgg, Apple devices, JavaScript, Ruby, Python etc.

Instructions for compiling and running the EtherPad open source release

How we can install Etherpad on Open SUSE Linux?

I just want to help you out… If you want to pay me nothing that is fine too! 😉

Here are some simple steps to install Etherpad on Open SUSE Linux…..

SUSE Linux is different from RedHat, CentOS or Ubuntu. General Package Managers / Setup Tool won’t work on SUSE, It support Zypper or YaST.

First check your server architecture

# uname -a
http://www.cyberciti.biz/faq/linux-how-to-find-if-processor-is-64-bit-or-not/

# cd /usr/local

Requirements
Java 1.6 (tested with 1.6.0_20)
Scala 2.7 (tested with 2.7.7)
MySQL Server 5.1 (tested with 5.1.59)
mysql-connector-java (tested with 5.1.18)

Create username ‘etherpad’ with password ‘password’

# useradd -r -m etherpad
# passwd etherpad

Install Java

# uname -a
I am using 32-bit here…
# wget http://autosetup1.googlecode.com/files/jdk-6u20-linux-i586-rpm.bin
# sh jdk-6u20-linux-i586-rpm.bin

# java -version

Install fastjar

# zypper install fastjar
or
# yast –install fastjar
or
# yast2 –install fastjar

Download Scala

# wget http://www.scala-lang.org/sites/default/files/linuxsoft_archives/downloads/distrib/files/scala-2.7.7.final.tgz
# tar xvzf scala-2.7.7.final.tgz

Install MySQL

http://dev.mysql.com/downloads/mysql/5.1.html#downloads

# zypper install mysql-server
# service mysqld start
# chkconfig mysqld on

Download MySQL Java Connector

Try

# zypper install mysql-connector-java

Or

# wget http://mysql.llarian.net/Downloads/Connector-J/mysql-connector-java-5.1.18.tar.gz
# tar xvzf mysql-connector-java-5.1.18.tar.gz

Install MER­CU­R­IAL .. OR GIT

# zypper install mercurial

# zypper install git

Make sure port 9000 must be open on IPTABLES / Firewall

# /etc/sysconfig/iptables

-A RH-Firewall-1-INPUT -p tcp -m state –state NEW -m tcp –dport 9000 -j ACCEPT

Environment
Various scripts make assumptions about environment variables:

JAVA should be set to the java executable.
JAVA_HOME should be set to the main jdk directory.
SCALA should be set to the scala executable.
SCALA_HOME should be set to the main scala distribution directory.
PATH should contain $JAVA, $SCALA, and mysql
MYSQL_CONNECTOR_JAR should be set to the mysql-connector JAR file included in the mysql-connector download.
For example, this sets up the environment on my machine:

# touch myENV
# vi myENV

export JAVA_HOME=/usr/java/jdk1.6.0_20/
export JAVA=$JAVA_HOME/bin/java
export SCALA_HOME=/usr/local/scala/scala-2.7.7.final/
export SCALA=$SCALA_HOME/bin/scala
export PATH=$JAVA_HOME/bin:$SCALA_HOME/bin:$PATH
export MYSQL_CONNECTOR_JAR=/usr/local/mysqlconnector/mysql-connector-java-5.1.18-bin.jar

# cat myENV >> /etc/profile

Download EtherPad

# hg clone https://etherpad.googlecode.com/hg/ etherpad

Some Changes in etherpad source for your server…

./etc/etherpad.localdev-default.properties

# cd /usr/local
# cd etherpad/trunk/etherpad
# cp etc/etherpad.localdev-default.properties data/etherpad.local.properties

./bin/setup-mysql-db.sh

./src/main.js

./src/templates/pro/admin/admin-template.ejs

./src/templates/framed/framedheader-pro.ejs

./src/static/crossdomain.xml

./src/etherpad/pro/pro_utils.js

./src/etherpad/globals.js

./src/etherpad/control/pro/pro_main_control.js

./src/etherpad/control/pad/pad_control.js

./src/etherpad/control/global_pro_account_control.js

Database Setup
The scripts assume mysqld is running on localhost. Once mysqld is running, you can set up the etherpad database by running the following command inside ajcode/etherpad/.

# bin/setup-mysql-db.sh
This will create a database called “etherpad” with the password “password”, and grant privileges to the user “etherpad”.

All the tables will be set up the first time etherpad is run.

Compiling
EtherPad compiles all its Java and Scala libraries into a single JAR. To build this jar, you can run the following command inside ajcode/etherpad/.

# bin/rebuildjar.sh
If you modify anything in ajcode/infrastructure, you will most likely need to kill the server, rebuild the jar, and re-launch the server before your change takes effect.

Code inside ajcode/etherpad/src can be modified while the server is running, and the changes will automatically get picked up.

Running
To run the etherpad web server, execute the following command inside ajcode/etherpad/.

# bin/run-local.sh
The first time you run this, it should print out lots of messages about database migrations and finally print:

HTTP server listening on http://youdomain:9000/
At this point, you should be able to visit http://youdomain:9000/ in your web browser and create a new pad.

Thanks to Pauleira!

If you have error related to JVM

Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

Fix using

# export _JAVA_OPTIONS=’-Xms32m -Xmx56m -Xss128k -XX:PermSize=32m -XX:MaxPermSize=64m’

Other Link:
http://code.google.com/p/etherpad/
http://etherpad.com/
https://github.com/ether/pad
http://etherpad.org/

Google Books Downloader

Book Search works just like web search. Try a search on Google Books or on Google.com. When we find a book with content that contains a match for your search terms, we’ll link to it in your search results.

Google Books Downloader is a software that allows you to save these books in PDF, JPEG or PNG format.

We can get Embed link of Google Book from Embed code of Google Book…

<iframe frameborder="0" scrolling="no" style="border:0px"
src="http://books.google.com.au/books?id=sMnC55Ss2lcC&lpg=PP1&pg=PA6&output=embed"
width=500 height=500></iframe>

http://books.google.com.au/books?id=sMnC55Ss2lcC&lpg=PP1&pg=PA6&output=embed

We have to enter above URL in Google Book URL: & then Start

After few minutes you can see Output Format: (default PDF) file in Output Folder: with default Resolution:

VMGParser

VMG2TXT converts Nokia VMG message file to text file.

VMG2TXT module is used for reading and parsing Nokia’s VMG message file format.

Sample Nokia VMG File

Output of VMGParser using PHP based tool 😉

Planning for mobile messages compatibility 😉
Next may be Nokia to Android message conversion.

Red5 figure out audio/video out of sync issue

I had worked Red5 WebCam application that lets users to record video clips from their webcams. The users could talk while they record clips.

I was using PHP with Zend Gdata for uploading recorded video clips to YouTube. But I had issue in FLV files generated by Red5 server, the clip’s audio / video content was out of sync. 🙁

Code to upload Red5 FLV to YouTube

Then after few searches I got… FFMpeg might be a good option to solve this issue to convert clip from FLV to MP4. 🙂

Solution

I have to add -itsoffset 00:00:01.16 before the -i, because flash player prompts user to allow or deny webcam access during the process the video begins to record. these are seconds of recording where nothing is recorded. To audio video sync add the itsoffset that tell ffmpeg to wait a second before it starts the the transcoding.

FFMpeg syntax to sync the audio and video using MP4 file:

<?php

//........... svnlabs.com
//...........

$myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();

$file= 'tmp/'.$fileName.".flv";

// convert FLV file to MP4 using -vcodec libx264

$mp4file= 'tmp/'.$fileName.".mp4"; 

exec("/usr/bin/ffmpeg -y -itsoffset 00:00:01.166000 -i ".$file." -s 640x480 -y -strict experimental -acodec aac -ab 128k -ac 2 -ar 48000 -vcodec libx264 -r 24 -g 48 -b 520000 -threads 64 ".$mp4file);

$file = $mp4file;

$file = realpath($file);  

//....

?>

Other Command
# /usr/bin/ffmpeg -i “svnlabs.flv” -s 640×480 -y -strict experimental -acodec aac -ab 128k -ac 2 -ar 48000 -vcodec libx264 -vpre medium -vpre ipod640 -r 24 -g 48 -b 520000 -threads 64 “svnlabs.mp4”

Related Article: https://www.svnlabs.com/blogs/applications/media-streaming/

If you would hit the mark, you must aim a little above it…

Online Learning – Sharable Content Object Reference Model

E-Learning is a great way to spread knowledge in university, company or any other organization.

Sharable Content Object Reference Model (SCORM) is a collection of standards and specifications for web-based e-learning. It defines communications between client side content and a host system called the run-time environment, which is commonly supported by a learning management system.

There are various open source e-learning applications that can be installed easily…

Moodle is one of the most popular open source e-learning system. It is built with PHP & uses MySQL or PostgreSQL to store data. It has powerful course management features that covers creating lessons, assignments, quizes, documents, studnets, staff, reporting & more.

eFront is a complete e-learning software enables admins to create & manage lessons.

Dokeos offers course management features, Flash based videoconferencing, Powerpoint presentations can be imported and converted in to SCORM courses.

SCORM Cloud is our hosted SCORM player – so instead of using the one back in an LMS to launch a course, you can use ours from your Google domain. It will play your course, track the data and provide pretty reports right from the dashboard.

Claroline is an Open Source eLearning and eWorking platform allowing teachers to build effective online courses and to manage learning and collaborative activities on the web. Translated into 35 languages, Claroline has a large worldwide users’ and developers’ community.

ILIAS 4 e-Learning – Discover the flexible and powerful open source learning management system!

Sakai – A vibrant community creating technology that enhances teaching, learning and research.

ATutor is an Open Source Web-based Learning Management System (LMS) used to develop and deliver online courses. Administrators can install or update ATutor in minutes, develop custom themes to give ATutor a new look, and easily extend its functionality with feature modules. Educators can quickly assemble, package, and redistribute Web-based instructional content, easily import prepackaged content, and conduct their courses online.

Fle3 is a web-based learning environment. To be more specific Fle3 is server software for computer supported collaborative learning (CSCL).

LAMS is a revolutionary new tool for designing, managing and delivering online collaborative learning activities.

OLAT offers a flexible online course system along with extensive features to guarantee learning and teaching independent of time and place. It has been created especially for public institutions such as universities, academies or colleges, but it is also suitable for other businesses.

guru.ijoomla.com – Joomla LMS that will turn your knowledge into dollars! Create an online course, university or school and make money while you sleep!

Joomla LMS – is an aggregate of e-learning tools compiling into a powerful learning management system for Joomla!. It is a fully functional eLearning platform with innovative training / testing options (self-assessments) and advanced conferencing applications. JoomlaLMS offers a wide range of useful online training features for teachers and learners.

Joomdle – Joomla + Moodle

Webinars – https://www.svnlabs.com/blogs/?s=conference
https://www.svnlabs.com/blogs/2011/07/bigbluebutton-on-centos/

BigBlueButton – BigBlueButton is a clean implementation of a web conferencing system that focuses on offering a simple user interface and an extensible platform for distance education.

bigbluebutton

DimDim – Easy, open, affordable collaboration for online meetings, eLearning, desktop sharing, training, distance education, webinar, free web meetings.

dimdim

OpenMeetings is a free browser-based software that allows you to set up instantly a conference in the Web. You can use your microphone or webcam, share documents on a white board, share your screen or record meetings. It is available as hosted service or you download and install a package on your server with no limitations in usage or users.

openmeeting

We enable customers with advanced capabilities to manage Online Learning using above any web based tool. We can provide scheduling of Web Meetings, Logging, Tracking, Course Management, Staff / Student / Attendee / Host Management.

A teacher informs…
A good teacher explains…
A superior teacher demonstrates…
A Master inspires you by his being & learning happens….