Sunday 24 August 2008

They awarded me with - "Nerd King" title grrr.....


The second version was worst....... I doubt this tool!!!!!!!!

My Score Summary
******************


NerdTests.com says I'm a Nerd King.  What are you?  Click here!


My Nerd Score........


I am nerdier than 82% of all people. Are you a nerd? Click here to find out!

Friday 15 August 2008

Installing omnetpp on Ubuntu

Here are the steps :



1. Download the simulator archive from omnetpp.org

2. sudo tar zxf omnetpp-3.4b2-src.tgz -C /usr/local/ ; sudo ln -s omnetpp-3.4b2 omnetpp ; cd /usr/local/omnetpp

3. sudo apt-get install bison flex blt lmodern giftrans doxygen libxml2-dev graphviz imagemagick

4. sudo apt-get install tcl8.4 tk8.4 tcl8.4-dev tk8.4-dev

5. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/omnetpp/lib

6. export TCL_LIBRARY=/usr/share/tcltk/tcl8.4

7. export PATH=$PATH:/usr/local/omnetpp/bin

8. sudo ./configure;

9. sudo make

(Step 5,6,7 may be added into ~/.bashrc for future convenience. Remember to remove the word export!)

Following all those step should be no problem. It will be a problem once you in step 9 where compiler will be complaint about some command not found. Example :

opp_msgc -Xnc -Xns sim_std.msg

make[1]: opp_msgc: Command not found

Solution :

10. sudo -i

11. cd /usr/local/omnetpp;export PATH=$PATH:/usr/local/omnetpp/bin

12. make



I have successfully install omnet++ using the steps mention above but when installing it in my pc,i have error: Standard C Math Library not found when running steps 8.

Solution: sudo apt-get install build-essential

Well, that’s all. enjoy your omnet++

Thursday 14 August 2008

Root login in Ubuntu


Basically in almost all linux machines we will be having root access for login. But in ubuntu by default that option was not enabled.If u want to have root login in ubuntu then u have to do some changes in ur Ubuntu machines.

Steps to follow
1. First enter into ubuntu as your user login.
2. Then open the terminal and type the command sudo -s,it will ask for root access and type the password.
3. Then type passwd root it will ask for new password
4. Open terminal and go to the path /etc/gdm/
5. Open gdm.conf
6. search for AllowRoot=false
7. and then change AllowRoot=true
8. now restart ur machine
9. now u can enjoy with root access



Storage engines in MySQL


When you create a new table in MySQL then there is the possibility to define the table type or storage engine at the end of your table definition. This is not a mandatory part of your table definition. If you don't define an engine then the default one will be used. Later you can change the storage engine by ALTER TABLE command.Here is an example how to create a table specifying a storage engine:

CREATE TABLE demo
{
username VARCHAR(50) NOT NULL,
age SMALLINT NOT NULL
} ENGINE=MyISAM;

Instead of ENGINE keyword you can also use TYPE, however the preferred one is the ENGINE as the TYPE is only for backward compatibility.

MySQL Storage engines

In MySQL you have the possibility to select from the following storage engines:
  • MyISAM
  • InnoDB
  • MERGE
  • MEMORY
In older MySQL version the BDB and ISAM table types were also available but in the new versions they are not more supported. Besides this in MySQL 6 there will be a new table type called Falcon.I

MyISAM
MyISAM is the default storage engine in MySQL. It is the improved replacement of the old ISAM table type. Using MyISAM storage engine every table is stored in 3 different files:
  1. .frm file which stores the table structure
  2. .MYD file, which stores the table data
  3. .MYI file which is the index file
MyISAM storage engine is optimized for speed and supports extensive indexing. You can index BLOB and TEXT and also supports FULLTEXT indexes.

However MyISAM tables do not supports foreign key constraint and row level locking.

InnoDB
InnoDB is a transaction-safe storage engine in MySQL. Table data are managed by the InnoDB tablespace. These table type supports foreign key constraints and row level locking as well. However FULLTEXT indexes are not supported.

MERGE
The MERGE storage engine is a bit special. In this case the data are not stored in the MERGE table, but in the MyISAM tables from which the virtual MERGE table was made up.

MEMORY
In case of MEMORY storage engine the data are stored in the memory and are available only as long as the MySQL server is available. The MEMORY tables are very fast and so they are ideal for temporary tables.


Creating MySQL Users...


The first thing we need to do is create a new user. You could have your application access MySQL as the root user, but that has serious security risks.
There are more ways how you can do this
  • Using CREATE USER and/or GRANT commands
  • Inserting a new record into the mysql.user table
First let's see how to use the CREATE USER command. Here I have to mention that thi s command is available only in MySQL 5 (5.0.2) and newer releases. The syntax is the following:

CREATE USER user [IDENTIFIED BY [PASSWORD] 'password']

Here is an example:

CREATE USER 'user1'@'localhost' IDENTIFIED BY 'pass1';

Now if you check the mysql.user table you can find a new record in it. Notice that all privileges are set to No so this user can do nothing in the DB. To add some privileges we can use the GRANT command as follows:

GRANT SELECT,INSERT,UPDATE,DELETE ON *.* TO 'user1'@'localhost';

Here we have added only the most important privileges to the user. With the setting above this user is good to run a CMS or a blog, however with such settings this user will not able to install them as it cannot create tables. To add all privileges to the user you don't have to list all of them but you can use the ALL shortcut as follows:

GRANT ALL ON *.* TO 'user1'@'localhost';

You can create a new MySQL user in one step as well using again the GRANT command with a small extension as here:

GRANT ALL ON *.* TO 'user2'@'localhost' IDENTIFIED BY 'pass1';

The above examples used dedicated commands, but sometimes you maybe want to add a new MySQL user via directly editing the mysql.user table. In this case you just inserts a new record into the table with a normal INSERT command:

INSERT INTO user (Host,User,Password) VALUES('localhost','user3',PASSWORD('pass3'));

Or you can add some privileges as well in a form like this:

INSERT INTO user (Host,User,Password,Select_priv,Insert_priv)
VALUES('localhost','user4',PASSWORD('pass3'),'Y','Y');


Setting-up of PHPMyadmin


The phpmyadmin configuration file is located at: /etc/phpmyadmin folder. To set up under Apache all you need to do is include the following line in /etc/apache2/apache2.conf:

Include /etc/phpmyadmin/apache.conf


Now restart Apache:


/etc/init.d/apache2 restart

Point your browser to: http://domain/phpmyadmin That's it! MySQL and phpMyAdmin are ready. Log in with your mysql root password and create users to connect to database from your php script.



Installing MySQL and phpMyAdmin on debian platform

To install MySQL,

sudo apt-get install mysql-server

If this is a clean installation of MySQL, it will prompt you to set your root password. Make sure that you type it correctly, as it will only ask you once. If you've upgraded, or installed MySQL before, it may not prompt you for a password.

Testing MySQL

Once MySQL is finished installing, we can test MySQL by connecting to it, using...

mysql -uroot -pyourpassword


After filling in your own password after -p, you'll see a MySQL prompt.
That's it, you're done! You can type 'exit' to get out of MySQL.

Installing phpMyAdmin

if you want to install phpMyAdmin to administrate your MySQL, you can type...

sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin


Again, like MySQL, if this is a clean installation, it will ask you to choose a webserver to configure automatically. If you have had phpMyAdmin installed before, it won't prompt you to choose. You can use the space bar to select apache2 and then enter.

Once that's finished, restart it one more time and enter the webserver as apache2.


Adept gives a message that the packaging database is locked by another program


Try

1. sudo dpkg --configure -a

else

2. ps -ewf| grep adept|grep -v grep|awk '{print $2}'

This will list all process being used by adept, one per line. Next kill these processes:

sudo kill -9

else Use this command....

3. $ sudo fuser -vki /var/lib/dpkg/lock

This will ask you if you want to kill the process using the file. Now you can run:

$ sudo dpkg --configure -a

to make sure all packages are fully installed.


Drupal 5.x and Clean URLs on Ubuntu


The default unclean URLs that Drupal provides with question marks lurking around, could be annoying. But it does offer an option to have clean URLs.

Step 1

Check whether the rewrite module for your apache is enabled. Assuming you have an apache2 installation, you can do this by

ls /etc/apache2/mods-enabled/

If you don’t find rewrite.load, it means that the rewrite module is not enabled. Drupal’s clean URLs feature requires this module to be enabled. In ubuntu / a debian based machine try..

sudo a2enmod

This will ask you the enter the module to be enabled. Type

rewrite and press enter

This can also be done as

sudo a2enmod rewrite

This can also be done like this (say for a non-Debian based OS):

cd /etc/apache2/mods-enabled

sudo ln -s ../mods-available/rewrite.load rewrite.load

There! We have enabled the rewrite module for apache.

Step 2
We have to edit /etc/apache2/sites-available/default. Look out for the following lines.


Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny

Change AllowOverride None to AllowOverride All. Save the File.

Step 3
Make sure that the .htaccess file under your Drupal installation folder has the following lines


RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]


Step 4

Restart the apache server sudo /etc/init.d/apache2 restart

Step 5
Go to your Drupal administration page for clean URLs and enable them.

Wednesday 13 August 2008

Installing PHP5 for Apache2 on Ubuntu 8.04

PHP5 - Scripting Language
PHP is a general-purpose scripting language suited for web development. The PHP script can be embedded into HTML. This section explains how to install and configure PHP5 in Ubuntu System with Apache2 and MySQL.

Installation
To install PHP5 you can enter the following command in the terminal prompt:
sudo apt-get install php5 libapache2-mod-php5

You can run PHP5 scripts from command line. To run PHP5 scripts from command line you should install php5-cli package. To install php5-cli you can enter the following command in the terminal prompt:
sudo apt-get install php5-cli

You can also execute PHP5 scripts without installing PHP5 Apache module. To accomplish this, you should install php5-cgi package. You can run the following command in a terminal prompt to install php5-cgi package:
sudo apt-get install php5-cgi

To use MySQL with PHP5 you should install php5-mysql package. To install php5-mysql you can enter the following command in the terminal prompt:
sudo apt-get install php5-mysql

To verify your installation, create a php file named info.php and write the following script into it.
print_r (phpinfo());
?>

If you need to have universe source list in your sources.list file
For php4 support
sudo apt-get install libapache2-mod-php4 php4-cli php4-common php4-cgi
For php5 support (as discussed earlier)
sudo apt-get install libapache2-mod-php5 php5-cli php5-common php5-cgi

Next open /etc/apache2/apache2.conf file and check the index files are correct
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml
If you want to enable some Apache modules (SSL, rewrite, suexec, and include)
sudo a2enmod ssl
sudo a2enmod rewrite
sudo a2enmod suexec
sudo a2enmod include
Restart Apache to make sure all is well.
sudo /etc/init.d/apache2 restart





Apache2 on Ubuntu

Apache is the most commonly used Web Server on Linux systems. Web Servers are used to serve Web Pages requested by client computers. Clients typically request and view Web Pages using Web Browser applications such as Firefox, Opera, or Mozilla.

Installation
To install Apache2:

At a terminal prompt enter the following command:
sudo apt-get install apache2

Enter the user password on promt and confirm on question promt.


To stop/start apache2 write:
sudo /etc/init.d/apache2 stop
sudo /etc/init.d/apache2 start

Your default public folder shall be in: /var/www/ If everything is OK you should see an ordinary HTML page when you type: http://localhost in your browser.

Monday 11 August 2008

How to reset MySQL password.

Follow the steps below:
  1. Stop the mysqld daemon process.
  2. Start the mysqld daemon process with the --skip-grant-tables option.
  3. Start the mysql client with the -u root option.
  4. Execute - UPDATE mysql.user SET password=PASSWORD('password123) WHERE user='root';
  5. Execute the FLUSH PRIVILEGES; command.
These steps reset the password for "root" account to "password123".