SITE SEARCH

Google
 

Thursday, June 26, 2008

How to install PEAR packages in Ubuntu

Open the terminal and type the following command

sudo apt-get install php-pear

Then after installing pear follow this procedure to install packages

I am installing System_Folder package

Example

sudo pear install System_Folders

output:
Did not download optional dependencies: pear/XML_Parser, pear/XML_Util, use --alldeps to download automatically
pear/Config can optionally use package "pear/XML_Parser"
pear/Config can optionally use package "pear/XML_Util"
downloading System_Folders-1.0.0.tgz ...
Starting to download System_Folders-1.0.0.tgz (8,364 bytes)
.....done: 8,364 bytes
downloading Config-1.10.11.tgz ...
Starting to download Config-1.10.11.tgz (27,718 bytes)
...done: 27,718 bytes
install ok: channel://pear.php.net/Config-1.10.11
install ok: channel://pear.php.net/System_Folders-1.0.0


Then type

pear list

to check that System_Folders is installed

Output

Installed packages, channel pear.php.net:
=========================================
Package Version State
Archive_Tar 1.3.2 stable
Config 1.10.11 stable
Console_Getopt 1.2.2 stable
PEAR 1.5.4 stable
Structures_Graph 1.0.2 stable
System_Folders 1.0.0 stable

The System_Folders appears in the list.

Also pear list-files System_Folders

will help you to find Installed Files For System_Folders

like

php /usr/share/php/System/Folders/Cached.php
doc /usr/share/php/docs/System_Folders/examples/cached.php
doc /usr/share/php/docs/System_Folders/examples/example.php
php /usr/share/php/System/Folders.php

Finally the example using System_Folders


require_once 'System/Folders.php';
$sf = new System_Folders();
$home = $sf->getHome();
echo "$home\n";

?>

Monday, June 23, 2008

Optimize Ubuntu 8.04 for Speed

So what if Ubuntu is a fast operating system?... There is always room for some more tweaking... and I am talking here about some aspects that are NOT useful for the end-users (yes YOU, the regular Ubuntu user). The hacks presented in this guide will greatly improve the overall performance of your Ubuntu 8.04 Linux OS.

WARNING: Please follow the following instructions very carefully, in the order in which they are listed below, and reboot your machine after each one. If not, your operating system will NOT work anymore and you will have to reinstall it.

Click to Know more

Alternative Installation Methods for Hardy - How to install Ubuntu Hardy over network, from a USB stick or from a hard disk!

Ubuntu can be installed using other methods as well, which might prove handy in some circumstances. For example, let's say you want
to install Ubuntu on a computer that has no CD/DVD-ROM drive. What do you do? Well, you can install Ubuntu from another machine on the network (if there is one) that will provide the installation files to other computers on the LAN, or you can install it from the hard drive, if there is no LAN. For the latter solution, you will need an active Internet connection to download the Ubuntu ISO image or you can use an external hard drive as well. But the best of all is to have a Live USB Stick with Ubuntu OS!

Click Here for More Screen shots
You will need...

• Ubuntu 8.04 Alternate CD
• Ubuntu 8.04 Destktop CD
• an 1 GB USB Stick
• an active network connection
• 'boot from network' and 'boot from USB' options in the BIOS of the computer you want to install Ubuntu
• access to another network machine that is already running Ubuntu

Install Ubuntu from a USB Stick

This is a newly adopted method and the most used these days, and that's just because it's the fastest, easy to use and portable way to install Ubuntu on a computer. It will require at least 1 GB USB Stick. You don't need to pre-format the USB disk as this will be done automatically by the software we'll use for this method. Just make sure you don't have any important data on that USB disk, as it will be erased! This method will bake a Live USB Ubuntu 8.04 disk. OK, so let's get down to business!

Go to System -> Administration -> Software Sources, click on the second tab (Third-Party Software), click the 'Add' button and paste the following line:

CODE

deb http://ppa.launchpad.net/probono/ubuntu hardy main


Review image

Click the 'Add Source' button and then click on the 'Close' button. It will ask if you want to reload the information about the available software.

Review image

Now, open a terminal (Applications -> Accessories -> Terminal) and paste the following command:

CODE

sudo apt-get -y install liveusb


When the installation is over, insert the USB Stick on your PC and the Ubuntu 8.04 Desktop CD on your CD/DVD-ROM drive.

Go to System -> Administration -> Install Live USB...

Review image

If you've inserted the USB Stick and the Ubuntu 8.04 Desktop CD, you will see this nice window...

Review image

Click on the "Options" link and then check the "Download and integrate Adobe Flash Player" box. Then click the 'Execute' button and you will be asked if you want to install Ubuntu on that USB disk and if you are sure that you want to erase all the data and partitions on it. If you are sure, click 'Yes' on both questions...

Review image

Review image

The data will be copied from the Ubuntu 8.04 Desktop CD to the USB Stick...

Review image

After about 5-6 minutes, the whole process will be over and you can remove the USB Stick!

Review image

That's it! You can go now to your friends, with the USB disk, and install Ubuntu on their machines. You can also run and use Ubuntu (browse the web, talk to friends, do different stuff) directly from the Live USB Stick! Just remember to boot from USB-HDD (your computer must have this option on BIOS)!

Method 2 - Install Ubuntu from a network (LAN) server

For this task, you will need another computer that has Ubuntu installed (and working) and it's connected to the machine you want to install Ubuntu, through a LAN (Local Area Network). We will call that PC that already has Ubuntu, "Server", and the PC on which you want to install Ubuntu, "Client". On the Server, you will install a FTP server, an HTTP server and a DHCP server, which will allow the Client machine to connect to the server and fetch the installation files and package repositories. To install these servers, open a Terminal (Applications -> Accessories -> Terminal) and type:

CODE

sudo apt-get install tftpd-hpa apache2 dhcp3-server openbsd-inetd


Now, mount the Ubuntu 8.04 Alternative ISO image with the following commands:

CODE

cd /path-to-the-iso-image
sudo mkdir /var/lib/tftpboot/ubuntu
sudo mount -o loop ubuntu-8.04-alternate-i386.iso /var/lib/tftpboot/ubuntu (for an i386 PC)

or

sudo mount -o loop ubuntu-8.04-alternate-amd64.iso /var/lib/tftpboot/ubuntu (for an AMD 64/Intel 64 PC)


Make a symlink to the mounted ISO, from the Apache's root directory:

CODE

cd /var/www
sudo ln -s /var/lib/tftpboot/ubuntu/


If the Server has a CD/DVD-ROM drive and you already have burned the Ubuntu 8.04 Alternate ISO installation CD, insert it in the optical drive and wait for it to get auto-mounted. It will probably get mounted under the /media/cdrom path, so we will need to create symlinks for both FTP and HTTP servers. Copy and paste the following commands in a Terminal window:

CODE

sudo ln -s /media/cdrom /var/lib/tftpboot/ubuntu/
sudo ln -s /media/cdrom /var/www/ubuntu


Now, configure the DHCP daemon. Download the dhcp config file:

CODE

cd /etc/dhcp3
sudo mv dhcpd.conf dhcpd.conf.old
sudo gedit dhcpd.conf


Copy and paste the following lines into the dhcpd.conf file:

CODE

ping-check = 1;
filename = "ubuntu/install/netboot/pxelinux.0";
subnet 192.168.1.0
netmask 255.255.255.0 {
range 192.168.1.10 192.168.1.254;
}


Edit the following directives to match your network:

• REPLACE the subnet with your network subnet
• REPLACE the netmask with your network netmask
• REPLACE the range of IPs with the corresponding IP addresses from your network. An IP address from this range will be randomly assigned to the Client computer.

Restart the DHCP server with the following command:

CODE

sudo /etc/init.d/dhcp3-server restart


At this point, your client machine is ready to boot the alternative installation ISO from the server. Power up the Client PC, enter the BIOS, search for the 'Boot from network' options (under the BOOT menu) and put it as the first boot device. Save and exit. If everything worked out well, you should see the Ubuntu installation screen and boot prompt. Install Ubuntu!

Method 3 - Install from a hard drive

Use this method for a faster system installation and if you don't have a CD/DVD-ROM drive, you will need to have a working Ubuntu system on the computer on which you want to install the new Hardy OS.

First of all, you need to use GParted to create a new primary partition and format it to ext3. For example, let's say that the partition is /dev/sda3 (for a SATA drive) or /dev/hda3 (for a IDE drive). You will need to copy the ISO's contents over to the new partition. Open a Terminal (Applications -> Accessories -> Terminal) and type:

CODE

mkdir /tmp/installcd
sudo mount -o loop /path-to/ubuntu-8.04-desktop-i386.iso /tmp/installcd (for an i386 PC)

or

sudo mount -o loop /path/to/ubuntu-8.04-desktop-amd64.iso /tmp/installcd (for an AMD 64/Intel 64 PC)
sudo mkdir /mnt/installer
sudo mount /dev/sda3 /mnt/installer (for the SATA drive)

or

sudo mount /dev/hda3 /mnt/installer (for the IDE drive)
sudo cp -r /tmp/installcd/* /mnt/installer
cd ~/
sudo umount /tmp/installcd


Next, you'll need to edit your current GRUB configuration file to boot the new partition. To do this, open the /boot/grub/menu.lst in a text editor with:

CODE

sudo gedit /boot/grub/menu.lst


...and add the following lines at the end of the file:

CODE

title Ubuntu Hard Drive Installation
root (hd0,2)
kernel /casper/vmlinuz boot=casper root=/dev/ram ramdisk_size=1048576 rw
initrd /casper/initrd.gz


IMPORTANT: the root line tells Grub which partition contains the installer. If in your case, the partition you created is /dev/hda1, you'll need to edit that line to root (hd0,0). Grub starts counting your partition from 0, therefore the fourth partition will be (hd0,3) and so on. If you have a secondary hard disk, you will have to modify the first number from 0 to 1 (e.g. hd1,0 - for the second hard disk, first partition).

Save the file, close the text editor, reboot the computer and choose 'Ubuntu Hard Drive Installation' from the GRUB boot menu and install Ubuntu 8.04 Hardy Heron!

Thursday, June 19, 2008

Encrypting Password Field in MySQL using MD5

The Following sample code shows the MD5 functions usage in MySQL to encrypt your password fields

Now let's insert a record with MD5 applied to the password field.

mysql> INSERT INTO user_md5 VALUES ('member1',MD5('secretpassword') );

Wednesday, June 18, 2008

How To Install Adobe Acrobat Reader on Ubuntu

It appears now that the simplest way to install the Adobe Acrobat Reader is to get the package directly from Adobe’s website. Try following these steps to find the .deb package and install that.

1. Visit the Adobe Reader download page.
2. Select “Linux”, Select “Linux - x86 .deb”, Select your language.
3. Click the “Continue” button.
4. Click “Download Adobe Reader” to begin the download.
5. You can then “Open with…” to open it with the package installer directly, or “Save as” to be distributed to your other machines and installed manually via double-click on the package.

If you’re going to call the reader directly you’ll also need to configure two more items within the Adobe Reader preferences. Open the reader via “Applications > Office > Adobe Reader 8″ and it should give you a message concerning a libgtkembedmoz.so. After you click OK it’ll give you a blank window with no options. Switch back to the previous window and select “Edit > Preferences > Internet” as suggested by the previous notification window.
Click Here To Know more

Tuesday, June 17, 2008

HTML Editor for Linux Users

Bluefish is a powerful editor targeted towards programmers and webdesigners, with many options to write websites, scripts and programming code. Bluefish supports many programming and markup languages, and it focuses on editing dynamic and interactive websites. See features for an extensive overview, take a look at the screenshots, or download it right away. Bluefish is an open source development project, released under the GNU GPL licence.

What others have said about Bluefish

Bluefish is by far the most powerful among the HTML editors we tested. It is probably the most potent editor for Linux in general. (www.suse.com)

GPL-licensed Bluefish has become an excellent 'production tool' for those of who earn our living writing for Web sites, full of little 'speed you up' features [..] It is an excellent example of how a multinational group of talented programmers can produce a piece of work under the GPL that is at least as good as any commercial program (newsforge.com)

The Bluefish HTML editor is an excellent example of of how good open source programs can be. It is feature rich, with lots of time saving tools for experienced coders and friendly enough for newbies to be productive in little or no time. (www.linuxorbit.com)

If you've ever longed for an HTML editor that is easy to use, yet doesn't try to do everything for you, Bluefish is just the editor for you. It has a wealth of features that will make your programming easier, but in the end you retain total control of the HTML (software.linux.com)

Bluefish marries the best of GUI's and traditional text editing into a customizable, useful package. (www.linuxplanet.com)

One of the most powerful editors for Linux + Supports many programming and markup languages + Lots of time saving tools for experienced users + Friendly enough for beginners + Its wealth of features will make your programming easier + While letting you maintain control over your code (www.lindows.com)
Click to Download

Friday, June 13, 2008

How to restart Apache 2.X server from terminal

type this command in terminal

/etc/init.d/apache2 restart

On successful restart you will see the message below

* Restarting web server apache2 [ OK ]

Monday, June 9, 2008

MySQL update Multiple Fields using UPDATE SET

Example:

Table Name: Empdet

UPDATE Empdet SET CNO='$mobil',PEMAIL='$emailid' ,LNO='$land',FATHUS='$fah',DOOR1='$door1',STREET1='$street1',LOC1='$loc1',CITY_DIST1='$dist1',STATE1='$state1',PIN1='$pin1',DOOR2='$door2',STREET2='$street2',LOC2='$loc2',CITY_DIST2='$dist2',STATE2='$state2',PIN2='$pin2',QUAL='$qual',AD_QUAL='$adqual' WHERE EID='$empid';