Clear input values inside a div using JavaScript

This script recursively traverses all HTML elements, looks for input fields and clears their values. It uses only JavaScript. No jQuery required.

// From
function clearChildren(element) {
   for (var i = 0; i < element.childNodes.length; i++) {
      var e = element.childNodes[i];
      if (e.tagName) switch (e.tagName.toLowerCase()) {
         case 'input':
            switch (e.type) {
               case "radio":
               case "checkbox": e.checked = false; break;
               case "button":
               case "submit":
               case "image": break;
               default: e.value = ''; break;
         case 'select': e.selectedIndex = 0; break;
         case 'textarea': e.innerHTML = ''; break;
         default: clearChildren(e);

For posterity’s sake. Source: Also at

How to install SFLphone on Fedora 16

This is a slightly modified version of the SFLphone build instructions.

First, install the dependencies:

sudo yum groupinstall group "Development Tools" "Development Libraries"
sudo yum install alsa-lib-devel pulseaudio-libs-devel libsamplerate-devel commoncpp2-devel ccrtp-devel libzrtpcpp-devel dbus-c++-devel pcre-devel gsm-devel speex-devel celt071-devel libyaml-devel cppunit-devel cppcheck

Then clone the master branch because the latest release (1.0.2) has a bug, which prevented me from installing it on Fedora 16:

git clone

Compile the PJSIP library

cd sflphone/daemon/libs/pjproject/
./configure && make dep && make clean && make

Install the Daemon core

cd ../..
./configure  --prefix=/usr
sudo make install

Install the Gnome client dependencies

sudo yum install gnome-doc-utils libtool GConf2-devel libsexy-devel libnotify-devel webkitgtk-devel webkitgtk3-devel libgnomeui-devel check-devel rarian-compat

Install the Gnome client

cd ../gnome
./configure --prefix=/usr
make && sudo make install

How to install Asterisk on Fedora 16

Because the installation of Asterisk via Yum didn’t work out-of-the-box for me, I have decided to install it from source. The instructions to compile and install Asterisk from source from the Asterisk wiki is pretty much straight-forward except for a couple of hiccups, which I encountered. So here is a slightly modified version of their installation instruction that worked for me on Fedora 16:

Install the compiler and system libraries

sudo yum install gcc, gcc-c++, openssl, ncurses, ncurses-devel, newt, libxml2, libxml2-devel, kernel-devel, kernel-devel make

We also need to install SQLite3 in order to avoid seeing this message later on:

configure: WARNING: *** Asterisk now uses SQLite3 for the internal Asterisk database.
configure: WARNING: *** Please install the SQLite3 development package.

So let’s install SQLite3:

sudo yum install sqlite, sqlite-devel

We also need to install doxygen for the Asterisk documentation:

sudo yum install doxygen

Download, build, and install libpri

Execute the following as root:

tar -zxvf libpri-1.4.12.tar.gz
cd libpri-1.4.12
make install

Download, build, install, and start DAHDI

Execute the following as root:

tar -zxvf dahdi-linux-complete-2.6.0+2.6.0.tar.gz
cd dahdi-linux-complete-2.6.0+2.6.0
make install
make config
chkconfig dahdi on
service dahdi start

Download, build, install, and start Asterisk

Execute the following as root:

tar -zxvf asterisk-10.3.0.tar.gz
cd asterisk-10.3.0
make menuselect
make install
make samples
make progdocs
make config
chkconfig asterisk on
asterisk -vvvvc

Notes: This set of instructions has been tested to also work on Fedora 14 and CentOS 5.7.



How to install AT&T Global Network Client on Fedora 16

First, download the AT&T Global Network Client from

If you try to install this using

rpm -ivh agnclient-1.0-

you will get an error similar to:

failed to install file:
agnclient-1.0- requires
agnclient-1.0- requires

To solve this error, create a symbolic link for the missing modules by executing commands similar to this as root:

ln -s /usr/lib/ /usr/lib/
ln -s /usr/lib/ /usr/lib/

Proceed with the installation:

rpm -ivh --nodeps agnclient-compat-1.0-3.oc2.i386.rpm agnclient-1.0-

If you try to run it at this point, you will get this error:

The AT&T Global Network Client daemon (agnclientd) is not running. It must be running to create a VPN connection. Please restart your computer or manually restart the daemon.

To solve this, execute the following command as root or just restart your computer:

/etc/init.d/agnclientd start

Note: This instruction also works for Fedora 14, and 15.

Cannot complete the install because one or more required items could not be found. Software being installed: Subversion Revision Graph 1.0.9

Cannot complete the install because one or more required items could not be found.
Software being installed: Subversion Revision Graph 1.0.9 ( 1.0.9)
Missing requirement: Subversion Revision Graph 1.0.9 ( 1.0.9) requires ‘org.eclipse.draw2d 3.2.0’ but it could not be found

If you happen to get this error while installing the Subclipse plugin on Aptana Studio 3, it means you need to install the Graphical Editing Framework Draw2d first, which is not included in the current Aptana Studio 3 package.

Draw2d is part of GEF, which you can get from Draw2d is the first package when you expand the GEF from the menu. No need to install the other items unless you know that you need them for something else.

Fedora 16 pre/post-installation setup

This is pretty much the same as my post for Fedora 15, but I modified some details to make sure everything is relevant for Fedora 16.

I also converted the steps that requires downloading and installing into one executable command, whenever possible. I also added the -y option to the yum commands so we can skip the questions if we really want to install the packages since most of the time we type ‘yes’ anyway.

These are the packages I chose during the pre-installation setup:


  • Design Suite (contains GIMP and OptiPNG, plus more)
  • Office/Productivity (contains LibreOffice)
  • Sound & Video (checked k3b)


  • Development Tools (checked cmake and PyLint)
  • Java Development


  • Mail Server (SendMail)
  • MySQL Database (checked php-mysql)
  • PostgreSQL Database
  • Printing Support
  • Server Configuration Tools
  • Web Server (mod_python, mod_ssl, php, php-ldap)

Base System

  • Administration Tools
  • System Tools

And here’s my post-installation setup:


Updating for the first time also installs the GPG keys, which are needed so you won’t get errors regarding unsigned packages when you use the “fedora” and “updates” repositories of Fedora. In our terminal, as root, type:

yum -y update

RPM Fusion

From the RPM Fusion website site:

RPM Fusion provides software that the Fedora Project or Red Hat doesn’t want to ship. That software is provided as precompiled RPMs for all current Fedora versions and Red Hat Enterprise Linux 5; you can use the RPM Fusion repositories with tools like yum and PackageKit.

RPM Fusion is a merger of DribbleFreshrpms, and Livna; our goal is to simplify end-user experience by grouping as much add-on software as possible in a single location.

To install both the free and non-free repositories, simply download and double-click the RPM Fusion free for Fedora 14, 15 and 16 and RPM Fusion nonfree for Fedora 14, 15 and 16 from the RPM Fusion Configuration page.

Google Chrome

yum -y install lsb # dependency
rpm -ivh

Mozilla Firefox

Firefox add-ons that use.


This is what I use to download torrents.

yum -y install azureus


For operating with the 7z file archiving format.

yum -y install p7zip


For transfering files between machines.

yum -y install filezilla


For PostgreSQL database administration.

yum -y install pgadmin3


For watching videos without worrying about the file formats:

yum -y install vlc


For extracting RAR file archives.

yum -y install unrar


CD-ripper with database lookup/submission to share track information over the net, supports OGG and FLAC and adding ID3v1/v2 to MP3s.

yum -y install grip


rpm -ivh


This is what I use for recording Skype calls.

yum -y install pulsecaster


Secure, fast FTP server

yum -y install vsftpd


To create custom application launchers in Gnome 3.

yum -y install alacarte


Some PHP modules that I need for web development.

yum -y install php-gd php-mbstring php-pgsql php-xml

MySQL Workbench

For designing databases visually.

yum -y install mysql-workbench


For converting e-books to different formats and for managing your e-book collection.

yum -y install calibre


HTML Help viewer for Unix/Linux (for viewing .chm files).

yum -y install chmsee

Development files for Qt toolkit

To develop applications using the Qt toolkit. And include the graphical configuration tool as well.

yum -y install qt-devel qt-config

GStreamer non-free plugins

From the Fedora Unity Project:

GStreamer is a multimedia framework used by many media players including rhythmbox, banshee, totem, listen, exaile and others. Due to legal issues support for various non-free formats , including mp3 files, aren’t included with GStreamer by default. You can add support for mp3 and other formats by installing an add-on package from the third party repository

yum -y install gstreamer-plugins-bad gstreamer-plugins-ugly gstreamer-ffmpeg phonon-backend-gstreamer


yum -y install ffmpeg ffmpeg-libs

DVD playback

yum -y install libdvdread libdvdnav lsdvd


To avoid this error in Eclipse and Aptana.

yum -y install subversion-javahl

Oracle JDK

Download and install the Java SE SDK RPM from the Java SE Downloads page

rpm -ivh

Then setup Java JDK java, (for Firefox), javac, and jar using alternatives –install:

alternatives --install /usr/bin/java java /usr/java/jdk1.7.0_01/jre/bin/java 20000
alternatives --install /usr/lib/mozilla/plugins/ /usr/java/jdk1.7.0_01/jre/lib/i386/ 20000
alternatives --install /usr/bin/javac javac /usr/java/jdk1.7.0_01/bin/javac 20000
alternatives --install /usr/bin/jar jar /usr/java/jdk1.7.0_01/bin/jar 20000

Add the following JAVA_HOME environment variable to /etc/profile:

export JAVA_HOME="/usr/java/jdk1.7.0_01"


Download and extract Aptana 3 from



Customize advanced GNOME 3 options and easily change the font sizes for applications, documents and windows.

yum -y install gnome-tweak-tool

After installing TweakTool, I customized my fonts as follows:

  • Document font: Sans 10
  • Monospace font: Monospace 10
  • Window title font: Cantarell 10

Startup services

Make sure Httpd and MySQL starts up on boot.

chkconfig --levels 235 httpd on
systemctl start mysqld.service
systemctl enable mysqld.service

Make personal user space accessible to apache user

First, add apache user to user group. Execute a command similar to this:

usermod -a -G randell apache

Then modify the permissions of the user directory with:

chmod 770 /home/randell/

File Management Preferences

From a Nautilus window, go to Edit > Preferences. I modified mine to reflect the following changes:

  • Default View > View new folders using: List View
  • Icon View Defaults > Default zoom level: 66%
  • List View Defaults > Default zoom level: 33%


I customized my Favorites to include these frequently used applications:

  • Chrome
  • Firefox (added by default)
  • Terminal
  • gedit
  • Files (added by default)
  • Rhythmbox
  • Take Screenshot


Edit > Profile Preferences > Colors > Foreground and Background

  • Use colors from system theme: Unchecked
  • Built-in schemes: Green on black

Text Editor

Edit > Preferences

  • View
    • Display line numbers: Checked
    • Display right margin at column: 80
    • Highlight current line: Checked
    • Highlight matching brackets: Checked
  • Editor
    • Tab Stops
      • Tab width: 4
      • Insert spaces instead of tabs: Checked
      • Enable automatic indentation: Checked
    • File Saving
      • Create a backup of files before saving: Unchecked
      • Autosave files every: 5 minutes
    • Font & Colors > Color Scheme: Oblivion

How to create custom application launchers in Gnome 3

Back in Gnome 2, we can simply right-clicked on a panel and chose “Create custom launcher” to create custom application launchers. But since the advent of Gnome 3, the panels where we add our frequently-used applications have been replaced with the Dash.

Alacarte is a graphical menu editor that lets you edit, add, and delete menu entries. It follows the menu specification and should work with any desktop environment that uses this specification.

Alacarte is the same menu editor that was available in Gnome 2. The only difference is the way we open it. In Gnome 3, we now select it from the App List.

But first we need to install Alacarte. As root, execute the following command in your terminal:

yum install alacarte

Run Alacarte by searching and clicking it from the Applications menu (it shows up as Main Menu) or executing it from the command line. Doing so should show you this familiar window:

Alacarte - Main Menu

Alacarte - Main Menu

Choose the menu where you want your application to fall under and then click the New Item button.

Alacarte - Create Launcher

Alacarte - Create Launcher

In this example, I used the details for the SpringSource Tool Suite, which I just installed, replacing the icon with that of STS (icon.xpm), and pointing the Command to the STS executable file. Then click OK.

Alacarte - Create Launcher with details

Alacarte - Create Launcher with details

That’s it. We’ve created our application launcher. To verify, we can search the STS application launcher we created from the App List.

Gnome 3 Application Search

Gnome 3 Application Search

If you think you’re going to use the launcher frequently, you can simply right-click on it and select Add to Favorites to add it in the Dash.

Gnome 3 - Add to Favorites

Gnome 3 - Add to Favorites

Voila! The launcher is now available from the Dash.

The Dash containing the new application launcher

The Dash containing the new application launcher

How to add Power Off option in Gnome 3 User Menu on Fedora 15

Because of Gnome 3’s deep hardware integration, if Fedora indicates that the Suspend is known to work on your machine, it shows the Suspend option in the User Menu instead of the Power Off option.

But for us who want the Power Off option available all the time, and don’t want to Log Out first before shutting-down the machine, there’s the alternative-status-menu Gnome extension which replaces the default Gnome 3 User Menu with one that includes both Suspend and Power Off options.
Execute the following as root to install the Gnome extension.

yum install gnome-shell-extensions-alternative-status-menu

Then refresh Gnome shell by pressing Alt + F2, enter r, then press Enter. After the refresh, your User Menu should now like something similar to this one:

Fedora 15 Gnome 3 User Menu

Fedora 15 Gnome 3 User Menu

Note: This particular extension adds the Hibernate option, too!