March
7
browser search plugin

browser search plugin

OpenSearch is a collection of simple formats for the sharing of search results.

OpenSearch description file

http://www.svnlabs.com/opensearch.xml

We have to create  a simple xml file for websites and search engines to publish search results in a standard and accessible format.

See below the code in action…….

<?xml version=”1.0″ encoding=”UTF-8″?>

<OpenSearchDescription xmlns=”http://a9.com/-/spec/opensearch/1.1/”> <ShortName>svnlabs</ShortName>

<LongName>svnlabs – Concentrate > Observe > Imagine > Launch</LongName>

<Description>Search through articles posted on svnlabs.com</Description>

<InputEncoding>UTF-8</InputEncoding>

<OutputEncoding>UTF-8</OutputEncoding>

<AdultContent>false</AdultContent>

<Language>en-us</Language>

<Developer>svnlabs</Developer>

<Contact>svnlabs@gmail.com</Contact>

<Description>svnlabs – Concentrate – Observe – Imagine – Launch svnlabs, Linux, Apache, Mysql, PHP, Video Encoding, Youtube API, Facebook API, Twitter API, Amazon Web Service, OSCommerce, Joomla, Wordpress</Description>

<Tags>svnlabs Linux Apache Mysql PHP Video Encoding Youtube API Facebook API Twitter API Amazon Web Service OSCommerce Joomla Wordpress</Tags>

<Attribution>Search Articles on svnlabs, http://www.svnlabs.com/</Attribution> <SyndicationRight>open</SyndicationRight>

<Query role=”example” searchTerms=”India”/>

<Image height=”16″ width=”16″ type=”image/vnd.microsoft.icon”>http://www.svnlabs.com/favicon.ico</Image>

<Image height=”130″ width=”130″ type=”image/jpeg”>http://www.svnlabs.com/sv.jpg</Image>

<Url type=”text/html” template=”http://blog.svnlabs.com/?s={searchTerms}”/>

</OpenSearchDescription>

Paste below block of code to HTML Heading section to add browser search plugin….

<link rel=“search” type=“application/opensearchdescription+xml” href=”http://www.svnlabs.com/opensearch.xmltitle=“svnlabs blog search” />

Source:
https://developer.mozilla.org/en/Creating_OpenSearch_plugins_for_Firefox

March
3

PEAR is a framework and distribution system for reusable PHP components.

How we get PEAR packages with php files?

Add block of code to the php file….

<?php
// include PEAR class
include (”Date.php”);

// initialize Date object
$d = new Date(”1981-08-07 01:30:11″);

// retrieve date to display
echo $d->getDate();

// retrieve date as formatted string
echo $d->format(”%A, %d %B %Y %T”);

?>

Output:
1981-08-07 01:30:11
Friday, 07 August 1981 01:30:11

Converting between time zones

<?php
// include class
include (”Date.php”);

// initialize object
$d = new Date(”1981-08-07 10:36:27″);

// set local time zone
$d->setTZByID(”GMT”);

// convert to foreign time zone
$d->convertTZByID(”IST”);

// retrieve converted date/time
echo $d->format(”%A, %d %B %Y %T”);
?>

Output:
Thursday, 07 August 1981 16:06:27

Calculating GMT offsets

<?php
// include class
include (”Date.php”);

// initialize object
$d = new Date(”2006-08-08 10:26:27″);

// set local time zone
$d->setTZByID(”PST”);

// get raw offset from GMT, in msec
echo $d->tz->getRawOffset();
?>

Adding and subtracting timespans

<?php
// include class
include (”Date.php”);

// initialize object
$d = new Date(”1951-09-13 16:55:11″);

// add 01:20 to it
$d->addSpan(new Date_Span(”0,1,20,0″));

// subtract 00:05 from it
$d->subtractSpan(new Date_Span(”0,0,5,0″));

// retrieve date as formatted string
echo $d->format(”%A, %d %B %Y %T”);
?>

Enjoy programming with PEAR…. ;)

February
27



happy holi

February
24

The Alternative PHP Cache (APC) is a free, open, and robust framework for caching and optimizing PHP intermediate code.

yum install php-pear
yum install php-devel httpd-devel
yum groupinstall ‘Development Tools’
yum groupinstall ‘Development Libraries’
pecl install apc

http://si2.php.net/manual/en/install.pecl.php

February
24

1. Log in as root or use su at command line
$ su
2. Go to the font storage directory:
# cd /usr/share/fonts
3. Create a subdirectory for the Arial fonts:
# mkdir arial
4. Copy the Arial fonts into this directory from font sites or windows FONTS folder.
5. Make the font files accessible systemwide:
# chmod 0775 -R arial
6. Run fc-cache to cache the arial fonts on system:
# fc-cache arial

February
21

PECL Memcache client of memcached distributed cache server, is a very probable candidate for high-load systems.
Typically you won’t be able to use “pecl” directly and when you try to install manually with phpize you will get an error like:

” PHP Warning: Unknown(): Unable to load dynamic library ‘/opt/lampp/lib/php/extensions/no-debug-non-zts-20020429/memcache.so’ – /opt/lampp/lib/php/extensions/no-debug-non-zts-20020429/memcache.so: undefined symbol: OnUpdateLong in Unknown on line 0″

Below is step-by-step guide of how to install a PECL extension (Memcache in this case) in the latest XAMPP:

make sure you uninstall all and any PHP installations you may have had before along with PECL and PEAR

Download and install XAMPP 1.7.1

Add /opt/lampp/bin to your PATH

Download and install XAMPP Development Package

backup /opt/lampp/include directory to /opt/lampp/include-bak. This directory

Download source distribution of the PHP corresponding to your XAMPP installation

php source distribution is /opt/lampp/include/php

Run “./configure” and “make” on that php source.

Caution: Do NOT run “make install”!!!

Download memcache-2.1.2 anywhere

# cd memcache-2.1.2

# phpize

# ./configure

# make

# make install

Edit /opt/lampp/etc/php.ini and add a line:

extension=”memcache.so”

Knowledge speaks, but wisdom listens. ;)

February
21

Often, when we get error “No route to host” to connect remote server via linux command line e.g. wget, curl etc. or web services (webserviceserver).

The first solution we want to try to troubleshot firewalls and proxies?

But before that try hostname entry in linux box…

# vi /etc/hosts
add & save
192.168.0.100 webserviceserver

If still experienced the issue when deploying code from development machine to a live server.

Ping other servers like
# ping google.com
# wget http://www.google.com

If ping & wget working for google means the webserviceserver have some block or restrictions to calling servers.

Make sure with several linux network utilities

# nc webserviceserver.com 8080
webserviceserver.com [192.168.0.100] 8080 (www) : No route to host

# telnet 192.168.0.100 8080 (working?)

# traceroute www.webserviceserver.com (working?)

# ping www.webserviceserver.com (working?)

Make sure firewall is not blocking your access:
# /sbin/iptables -L -n
# /etc/init.d/iptables save
# /etc/init.d/iptables stop

# iptables -F
# iptables -X
# iptables -t nat -F
# iptables -t nat -X
# iptables -t mangle -F
# iptables -t mangle -X

Make sure we are using a router and not a proxy server. Proxy servers are good for Internet browsing but not for ftp, sending ICMP request and so on.

Try on alternate port..
# nc webserviceserver.com 8078

If this is working then we have to use alternate port for the server “webserviceserver.com”

Make alternate port for network connection :)

February
19

SWFTools is the utilities for working with Adobe Flash files. These tools includes programs for reading SWF files, combining them, and creating them from other content (like images, sound files, videos or sourcecode).

Install SWFTOOLS:
Download latest Sourcecode from here…
http://swftools.org/download.html

# wget http://swftools.org/swftools-0.9.0.tar.gz
# tar -zxvf swftools-0.9.0.tar.gz
# cd swftools-0.9.0

# ./configure
# make

Some time make generate errors for xpdf.. so we have to install xpdf here….
Search for “xpdf-3.02.tar.gz” download & install

# cd lib/pdf
# wget http://gd.tuwien.ac.at/publishing/xpdf/xpdf-3.02.tar.gz
# perl inject-xpdf.pl xpdf-3.02.tar.gz

Then…

# make clean
# make
# make install

Here we successfully installed swftools for all swf related operations.
We can find all linux utilities in src for of “swftools-0.9.0″ like

* as3compile
* font2swf
* gif2swf
* jpeg2swf
* pdf2swf
* png2swf
* swfbbox
* swfc
* swfcombine
* swfdump
* swfextract
* swfrender
* wav2swf

SWFTools has been reported to work on Solaris, Linux (both 32 as well as 64 bit), FreeBSD, OpenBSD, HP-UX, Solaris, MacOS X and Windows 98/ME/2000/XP/Vista.

February
7

Magento
Create a dynamic, fully featured, online store with the most powerful open source e-commerce software….

Download Magento from here..
http://www.magentocommerce.com/svn

# svn checkout http://svn.magentocommerce.com/source/branches/1.3

Features..

1. Categories and Attributes
2. Taxes
3. Adding Simple Products
4. Minimum Customization of Your Store’s Appearance
5. Customer Relationships / Configuring customer options
6. Accepting Payment
7. Configure Shipping
8. Fulfilling an Order

The list of requirements..

Linux, Apache web server, SMTP server, PHP 5.2.0 or newer with PDO/MySQL, mcrypt, hash, simplexml, GD, DOM, iconv, MySQL 4.1.20 or newer

Installation guide here…

Make the store’s appearance and organization..
* Add products
* Categorize products
* Create a navigation menu
* Configure payment options
* Configure shipping options
* Configure taxes
* Customize the front page
* Process orders

Magento make easy – part2 comming soon ;)

February
3

Here are the injected metadata:

* creator
* metadatacreator
* hasKeyframes
* hasVideo
* hasAudio
* hasMetaData
* canSeekToEnd
* duration
* datasize
* videosize
* videocodecid
* audiosize
* audiocodecid
* audiosamplerate
* audiosamplesize
* stereo
* filesize
* lasttimestamp
* lastkeyframetimestamp
* lastkeyframelocation
* keyframes (filepositions, times)
* width
* height
* framerate
* videodatarate
* audiodatarate

…………………………………………………………………………

Video formats are:

* avi
* mp4
* 3gp
* psp
* mpeg
* mpegts
* dvd
* flv
* svcd
* vcd
* vob
* asf
* mov
* rm
* mjpeg
* mpeg2video
* 3g2

video codecs are:

* mpeg4
* xvid
* flv
* h263
* mjpeg
* mpeg1video
* mpeg2video
* qtrle
* svq3
* wmv1
* wmv2
* huffyuv
* rv20
* h264

Audio codecs are:

* mp3
* mp2
* aac
* pcm
* amr_nb
* ac3
* vorbis
* flac
* pcm_u8

February
3

Have the fun with json….

JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate.

# yum -y install php-pear

# pecl install json

# vi /etc/php.d/json.ini
extension=json.so

# service httpd restart

February
2

Below is the simple code to create sql script of database on Amazon EC2 server using “mysqldump”…

then upload this sql script to Amazon S3 bucket using command line S3 tool “s3cmd”…

<?php

$sqlbackup=”/usr/bin/mysqldump -v -u root -h localhost -r /var/www/html/backup/”.date(”Y-m-d-H-i-s”).”_db.sql -pdbusername  databasename 2>&1″;

exec($sqlbackup, $o);
echo implode(”<br /> “, $o);

$file = “/var/www/html/backup/”.date(”Y-m-d-H-i-s”).”_db.sql”;
$bucket = “s3bucketname”;

exec(”/usr/bin/s3cmd  put –acl-public –guess-mime-type  –config=/var/www/html/.s3cfg   “.$file.”  s3://”.$bucket.”  2>&1″, $o);

echo implode(”<br /> “, $o);

?>


Lunarpages.com Web Hosting

January
31

What is XAMPP ?

XAMPP is an easy to install Apache distribution containing MySQL, PHP and Perl. LAMPP (XAMPP for Linux) is very easy to install and to use – just download, extract and start.

Download XAMPP

http://sourceforge.net/projects/xampp/files/XAMPP Linux/

Installing XAMPP in Linux

Download XAMPP Latest version from the following link
http://sourceforge.net/projects/xampp/files/XAMPP Linux

Currently latest XAMPP version is 1.7.3a

$wget http://downloads.sourceforge.net/project/xampp/XAMPP%20Linux/1.7.3a/xampp-linux-1.7.3a.tar.gz?use_mirror=nchc

Now you should be having xampp-linux-1.7.3a.tar.gz in your downloaded location

Go to a Linux shell and login as root:
Perform these commands as root user

$ su -p
Extract the downloaded archive file to /opt

#tar xvfz xampp-linux-1.7.3a.tar.gz -C /opt

XAMPP is now installed below the /opt/lampp directory.

Start XAMPP Server

To start XAMPP simply call this command:

#/opt/lampp/lampp start

Starting XAMPP for 1.7.3a…
XAMPP: Starting Apache with SSL (and PHP5)…
XAMPP: Starting MySQL…
XAMPP: Starting ProFTPD…
XAMPP for Linux started.

Test Your XAMPP Installation

OK, that was easy but how can you check that everything really works? Just type in the following URL at your favourite web browser:

http://localhost

Starting LAMPP automatically on startup

Starting LAMPP automatically on startup

XAMPP Security Configuration

As mentioned before, XAMPP is not meant for production use but only for developers in a development environment. The way XAMPP is configured is to be open as possible and allowing the developer anything he/she wants. For development environments this is great but in a production environment it could be fatal.

Here a list of missing security in XAMPP:

The MySQL administrator (root) has no password.
The MySQL daemon is accessible via network.
ProFTPD uses the password “lampp” for user “nobody”.
PhpMyAdmin is accessible via network.
Examples are accessible via network.
MySQL and Apache running under the same user (nobody).
To fix most of the security weaknesses simply call the following command:

#/opt/lampp/lampp security

It starts a small security check and makes your XAMPP installation more secure.
Start And Stop Server Services

start
Starts XAMPP.

stop
Stops XAMPP.

restart
Stops and starts XAMPP.

startapache
Starts only the Apache.

startssl
Starts the Apache SSL support. This command activates the SSL support permanently, e.g. if you restarts XAMPP in the future SSL will stay activated.

startmysql
Starts only the MySQL database.

startftp
Starts the ProFTPD server. Via FTP you can upload files for your web server (user “nobody”, password “lampp”). This command activates the ProFTPD permanently, e.g. if you restarts XAMPP in the future FTP will stay activated.

stopapache
Stops the Apache.

stopssl
Stops the Apache SSL support. This command deactivates the SSL support permanently, e.g. if you restarts XAMPP in the future SSL will stay deactivated.

stopmysql
Stops the MySQL database.

stopftp
Stops the ProFTPD server. This command deactivates the ProFTPD permanently, e.g. if you restarts XAMPP in the future FTP will stay deactivated.

security
Starts a small security check programm.

For example: To start Apache with SSL support simply type in the following command (as root):

#/opt/lampp/lampp startssl

You can also access your Apache server via SSL under https://localhost.

Important Configuration Files And Directories

/opt/lampp/bin/ – The XAMPP commands home. /opt/lampp/bin/mysql calls for example the MySQL monitor.
/opt/lampp/htdocs/ – The Apache DocumentRoot directory.
/opt/lampp/etc/httpd.conf – The Apache configuration file.
/opt/lampp/etc/my.cnf – The MySQL configuration file.
/opt/lampp/etc/php.ini – The PHP configuration file.
/opt/lampp/etc/proftpd.conf – The ProFTPD configuration file. (since 0.9.5)
/opt/lampp/phpmyadmin/config.inc.php – The phpMyAdmin configuration file.

Stopping XAMPP

To stop XAMPP simply call this command:

#/opt/lampp/lampp stop

You should now see:

Stopping XAMPP 1.7.3a…
XAMPP: Stopping Apache…
XAMPP: Stopping MySQL…
XAMPP: Stopping ProFTPD…
XAMPP stopped.

And XAMPP for Linux is stopped.

Starting LAMPP automatically on startup

For starting LAMPP automatically on startup, add the following line to you /etc/rc.local file

# /opt/lampp/lampp start

where /opt/lampp is the location where XAMPP files are kept. You will have to substitute the path to your XAMPP in the above command.

Uninstall XAMPP From your Machine

To uninstall XAMPP just type in this command

#rm -rf /opt/lampp


January
31
http://www.red5.org/

http://www.red5.org/

Red5 is an Open Source Flash Server written in Java that supports:

  • Streaming Audio/Video (FLV, h264, AAC, and MP3)
  • Recording Client Streams (FLV only)
  • Shared Objects
  • Live Stream Publishing
  • Remoting (AMF)

export variables in /etc/bashrc to become available for every user login or for any terminal opens.

echo “export ANT_HOME=/usr/local/ant” >> /etc/bashrc
echo “export JAVA_HOME=/usr/lib/jvm/java” >> /etc/bashrc

set CLASS PATH for java

# vi /etc/profile

JAVA_HOME=/usr/java/jdk1.6
export JAVA_HOME

Start/Stop Tomcat

# cd /usr/java/tomcat/bin
# ./shutdown.sh
# ./startup.sh

# cd ../webapps/
# netstat -ntlp|grep 1935

Install Tomcat

# wget http://www.trieuvan.com/apache/tomcat/tomcat-6/v6.0.20/bin/apache-tomcat-6.0.20.tar.gz
# tar xzf apache-tomcat-6.0.20.tar.gz
# ls
# mv apache-tomcat-6.0.20 tomcat
# mv tomcat /usr/java/
# cd /usr/java/tomcat/
# vi /etc/profile    (set class path)
# source /etc/profile
# /usr/java/tomcat/bin/startup.sh

Install Red 5

# wget http://dl.fancycode.com/red5/war/red5-0.6.2-java6.war
# ls
# cp red5-0.6.2-java6.war  /usr/java/tomcat/webapps/
# cd /usr/java/tomcat/bin
# ./shutdown.sh
# netstat -ntlp|grep 1935
# netstat -ntlp|grep 8080
# ./catalina.sh start

We are always hungry for TIME ;)


Lunarpages.com Web Hosting

January
30

Manual Settings
~~~~~~~~~~~~

Mail Server Username: no-reply+domain.com
Incoming Mail Server: mail.domain.com
Incoming Mail Server: (SSL) host200.hostmonster.com
Outgoing Mail Server: mail.domain.com (server requires authentication) port 26
Outgoing Mail Server: (SSL) host200.hostmonster.com (server requires authentication) port 465
Supported Incoming Mail Protocols: POP3, POP3S (SSL/TLS), IMAP, IMAPS (SSL/TLS)
Supported Outgoing Mail Protocols: SMTP, SMTPS (SSL/TLS)

Warning: Changing MX to something besides domain.com will prevent us from managing your mail. The email will no longer be sent to this server.

Increase RAM size
~~~~~~~~~~~~~~

Some time there is problem with kernel.. as rams physically is 8GB. The reason for 3GB RAM is kernel not updated, so the high volume memory is not recognized. Try this command to update ram size:

# yum install kernel-PAE

http://www.cyberciti.biz/tips/category/mail-server