How to install webmin on Fedora9

You can able to download webmin package through RPM only.
You can find the webmin RPM http://sourceforge.net/projects/webadmin/files/webmin/1.490/webmin-1.490-1.noarch.rpm/download
from this url.

Use following command for installing webmin
#rpm -Uvh webmin-1.490-1.noarch.rpm

This will install the webmin package on your fedora box.
Afer installation you will get following message.
Webmin install complete. You can now login to http://localhost.localdomain:10000/
as root with your root password.

Open this URL in browser http://localhost.localdomain:10000/

That sit.

how to use sftp command with different port

I am using the Fedora 9 here for this explaination.

I tried to sftp on remote server for port no 2202. I got the following error on command prompt.

[siwan@localhost ~]$ sftp user@example.net -oPort=2202

Connecting to example.net…
ssh: connect to host stylo.smartsourcingglobal.net port 22: No route to host
Couldn’t read packet: Connection reset by peer

Then i tried the following command, than I able to make connection with port

[siwan@localhost ~]$ sftp -oPort=2202 user@example.net


Share Thunderbird Between Windows and Linux

Many people are using Thunderbird as a email client.

I am using the Windows xp and Fedora 8 (Dual boot OS) on my System. Two years back i was using Microsoft office Outlook for viewing the emails.

Later on i need to work on Linux also. For email check i always i need to go or restart the system and start the Outlook.

Then i moved to Thunderbird which is Open source and free. Important thing is Thunderbird works on Linux and windows both.

My Tip :Share Thunderbird Between Windows and Linux

I installed the Thunderbird for Windows. First save all settings. Then follow my steps:

1. Open Thunderbird ->Click on Local Folders button(Top left button)

2. Choose or click on-> View settings for this account

3. Choose or click on-> Local Folders

4. First go that location by browsing the explorer and copy the folder and paste into your d:  drive.

5. Restart the thunderbird.

thunderbird

You need installed Samba windows share program in your Linux OS. Samba share is the free linux utility for checking windows files or drive.

Then go to Linux OS. and follow the save stages. Which i mentioned in top.

You will be able to use or check same emails on Windows and Linux.

Enjoy.

How to Use chkconfig command on fedora

chkconfig command is default command for linux versions.
chkconfig command is basically used for what is status when machine is rebooting. Startup of machine which services get started automatically.

For listing for services:
#su
#ROOT-PASSWORD
#chkconfig –list

If you want to add any service at startup:
# chkconfig –add nginx

If you want to turn on any service at startup:
#chkconfig nginx on

Stopping service
#chkconfig mysql off

install netbeans 6.7 on fedora 9

For installation of  netbeans package you need JDK 1.6 installed on your Fedora box. on Fedora 9 you are having already installed JDK 1.6 so you need to update the installation only.

Use following command for installing or updating JDK installation.

#su

#ROOT_PASSWORD

#yum update java-1.6.0-openjdk-devel

#yum install java-1.6.0-openjdk-devel
Than go to this URL (http://www.netbeans.org/downloads/index.html) and download the .sh file which you want install on your Fedora 9 box.

As per my view Netbeans supports for Rails and PHP and Netbeans is best IDE for Rails and PHP.

For Linux platforms, the installer file has the .sh extension. For these platforms, you need to make the installer files executable by using the following command:
#chmod +x netbeans-6.7.0-ml-ruby-linux.sh

This command i given for ruby IDE, you can choose your IDE or as per file name.

Than run the installer file

#netbeans-6.5.1-ml-ruby-linux.sh

That sit netbeans installtion will start to PC. After installation you can start netbeans from programming menu.

Install Apatana Studio on Fedora 9

Installation of Apatana in Detail

1. Download zip file from this location(http://www.aptana.com/studio/download)
File name:Aptana_Studio_Setup_Linux_1.2.7.zip
2. Then uncompress the .zip file. and copy the resulting ‘aptana’ folder under ‘/home/siwan’.(siwan is my username for fedora, you have replace your username)
3. Install xulrunner (for install xulrunner user following command, Became root first)
yum install xulrunner
or follow this step
Down load xulrunner from this url
http://releases.mozilla.org/pub/mozilla.org/xulrunner/releases/1.8.1.3/contrib/linux-i686/xulrunner-1.8.1.3.en-US.linux-i686-20080128.tar.gz
Unarchive using file roller to get a ‘xulrunner’ folder.
Open a terminal, and type the following commands, changing the path in the last line ie nigel to your username.
(for install xulrunner user following command, Became root first)

    mkdir /usr/lib/xulrunner
    cp -r /home/nigel/Download/xulrunner/* /usr/lib/xulrunner

4. Create a new file called say ‘aptana.sh’ and make it executable
use this command for make file executable.
Became root user first.
cd /home/siwan/aptana/
chmod +x aptana.sh
5. Copy the following into that text file

#!/bin/sh
MOZILLA_FIVE_HOME=/usr/lib/xulrunner
if [ $LD_LIBRARY_PATH ]; then
LD_LIBRARY_PATH=$MOZILLA_FIVE_HOME:$LD_LIBRARY_PATH
else
LD_LIBRARY_PATH=$MOZILLA_FIVE_HOME
fi
export MOZILLA_FIVE_HOME LD_LIBRARY_PATH
/home/siwan/aptana/AptanaStudio

Then run the aptana.sh file.
Enjoy with Aptana Studio

Easy Steps for setting up nginx with php on Linux

I am using Fedora 10 so for that linux version i used these commands for setting up my server.

Installing Nginx:
yum install nginx

Then we create the system startup links for nginx:
/sbin/chkconfig –level 35 nginx on

We can make PHP5 work in nginx through FastCGI.For that install all this packages:
yum install lighttpd-fastcgi php-cli php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-eaccelerator php-magickwand php-magpierss php-mapserver php-mbstring php-mcrypt php-mhash php-mssql php-shout php-snmp php-soap php-tidy

Then open /etc/php.ini and add the line cgi.fix_pathinfo = 1 right at the end of the file:
vi /etc/php.ini
paste this line :- cgi.fix_pathinfo = 1

To start a PHP FastCGI daemon listening on port 9000 on localhost and running as the user and group nginx, we run the following command:
/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u nginx -g nginx -f /usr/bin/php-cgi -P /var/run/fastcgi-php.pid

To restart PHP FastCGI daemon, Use this command:
ps -ef|grep php-cgi
kill PROCESS_ID

you don’t want to type in that command manually whenever you boot the system, so to have the system execute the command automatically at boot time, open /etc/rc.local…
vi /etc/rc.local
and add the command at the end of the file:
/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u nginx  -g nginx -f /usr/bin/php-cgi -P /var/run/fastcgi-php.pid

THEN STOP THE APACHE WEB SERVER:
/sbin/init.d/httpd stop
To stop apache on every startup:
/sbin/chkconfig –level 35 httpd off

First take backup of your nginx configuration file:
cp /etc/nginx/nginx.conf nginx.conf_cp
use nginx.conf file from life180 “config/nginx” folder

deconstructing date_select in rails

// Reconstruct a date object from date_select helper form params

// place this code into your application.rb file
def build_date_from_params(field_name, params)
Date.new(params["#{field_name.to_s}(1i)"].to_i,
params["#{field_name.to_s}(2i)"].to_i,
params["#{field_name.to_s}(3i)"].to_i)
end

//You can changes order of displaying into view
<%= date_select ‘from’, ‘date’ ,:order => [:day, :month, :year] %>
<%= date_select ‘to’, ‘date’,:order => [:day, :month, :year]  %>

//goes into controller -- add your own error handling/defaults, please!
@from = build_date_from_params(:date, params[:from])
@to = build_date_from_params(:date, params[:to])

Comparing date time into controller

@users_reports = User.find(:all, :conditions=>[‘created_at >= ? and created_at < ?’, @to, @from])

Getting Information about Databases and Tables

MySQL provides a SHOW statement that has several variant forms that display information about databases and the tables in them. SHOW is helpful for keeping track of the contents of your databases and for reminding yourself about the structure of your tables. You can also use SHOW prior to issuing ALTER TABLE; it’s often easier to figure out how to specify a change to a column after you determine the column’s current definition.

The SHOW statement can be used to obtain information about several aspects of your databases and tables:

  • List the databases managed by the server:
    SHOW DATABASES;
  • List the tables in the current database or in a given database:
    SHOW TABLES;
    SHOW TABLES FROM db_name;
  • Note that SHOW TABLES doesn’t show TEMPORARY tables.
  • Display information about columns or indexes in a table:
    SHOW COLUMNS FROM tbl_name;
    SHOW INDEX FROM tbl_name;
  • The DESCRIBE tbl_name and EXPLAIN tbl_name statements are synonymous with SHOW COLUMNS FROM tbl_name.
  • Display descriptive information about tables in the current database or in a given database:
    SHOW TABLE STATUS;
    SHOW TABLE STATUS FROM db_name;
  • This statement was introduced in MySQL 3.23.0.
  • Display the CREATE TABLE statement that corresponds to the current structure of a table:
    SHOW CREATE TABLE tbl_name;
  • This statement was introduced in MySQL 3.23.20.

Several forms of SHOW take a LIKE 'pat' clause allowing a pattern to be given that limits the scope of the output. 'pat' is interpreted as a SQL pattern that can include the ‘%‘ and ‘_‘ wildcard characters. For example, the following statement displays the names of tables in the current database that begin with 'geo':

SHOW TABLES LIKE 'geo%';

To match a literal instance of a wildcard character in a LIKE pattern, precede it with a backslash. Generally, this is done to match a literal ‘_‘, which occurs frequently in database, table, and column names.

The mysqlshow command provides some of the same information as the SHOW statement, which allows you to get database and table information from the shell:

  • List databases managed by the server:
    % mysqlshow
  • List tables in the named database:
    % mysqlshow db_name
  • Display information about columns in the named table:
    % mysqlshow db_name tbl_name
  • Display information about indexes in the named table:
    % mysqlshow --keys db_name tbl_name
  • Display descriptive information about tables in the named database:
    % mysqlshow --status db_name

The mysqldump utility allows you to see the structure of your tables in the form of a CREATE TABLE statement (much like SHOW CREATE TABLE). When using mysqldump to review table structure, be sure to invoke it with the --no-data option so that you don’t get swamped with your table’s data!

% mysqldump --no-data db_name tbl_name

If you omit the table name, mysqldump displays the structure for all tables in the database.

For both mysqlshow and mysqldump, you can specify the usual connection parameter options (such as --host or --user.)

Determining Which Table Types Your Server Supports

ISAM is the only type available before MySQL 3.23. From 3.23 on, MyISAM, MERGE, and HEAP are always available, and availability of the other types can be assessed by means of an appropriate SHOW VARIABLES statement:

SHOW VARIABLES LIKE 'have_isam';
SHOW VARIABLES LIKE 'have_bdb';
SHOW VARIABLES LIKE 'have_inno%';

If the output from the query shows that the variable has a value of YES, the corresponding table handler is enabled. If the value is something else or there is no output, the handler is unavailable. The use of the pattern have_inno% to determine InnoDB availability matches both have_innodb and have_innobase. (The latter form was used in MySQL 3.23.30 to 3.23.36 before being renamed to have_innodb.)

You can use table type information to determine whether your server supports transactions. BDB and InnoDB are the two transaction-safe table types, so check whether their handlers are enabled as described in the preceding discussion.

As of MySQL 4.1, the list of table types is available directly through the SHOW TABLE TYPES statement:

mysql> SHOW TABLE TYPES;
+--------+---------+-----------------------------------------------------------+
| Type   | Support | Comment                                                   |
+--------+---------+-----------------------------------------------------------+
| MyISAM | DEFAULT | Default type from 3.23 with great performance             |
| HEAP   | YES     | Hash based, stored in memory, useful for temporary tables |
| MERGE  | YES     | Collection of identical MyISAM tables                     |
| ISAM   | YES     | Obsolete table type; Is replaced by MyISAM                |
| InnoDB | YES     | Supports transactions, row-level locking and foreign keys |
| BDB    | YES     | Supports transactions and page-level locking              |
+--------+---------+-----------------------------------------------------------+

The Support value is YES or NO to indicate that the handler is or is not available, DISABLED if the handler is present but turned off, or DEFAULT for the table type that the server uses by default. The handler designated as DEFAULT should be considered available.

Checking a Table’s Existence or Type

It’s sometimes useful to be able to tell from within an application whether or not a given table exists. You can use SHOW TABLES to find out:

SHOW TABLES LIKE 'tbl_name';
SHOW TABLES FROM db_name LIKE 'tbl_name';

If the SHOW statement lists information for the table, it exists. It’s also possible to determine table existence with either of the following statements:

SELECT COUNT(*) FROM tbl_name;
SELECT * FROM tbl_name WHERE 0;

Each statement succeeds if the table exists and fails if it doesn’t. The first statement is most appropriate for MyISAM and ISAM tables, for which COUNT(*) with no WHERE clause is highly optimized. (It’s not so good for InnoDB or BDB tables, which require a full scan to count the rows.) The second statement is more general because is runs quickly for any table type. Use of these queries is most suitable for use within application programming languages, such as Perl or PHP, because you can test the success or failure of the query and take action accordingly. They’re not especially useful in a batch script that you run from mysql because you can’t do anything if an error occurs except terminate (or ignore the error, but then there’s obviously no point in running the query at all).

To determine the type of a table, you can use SHOW TABLE STATUS as of MySQL 3.23.0 or SHOW CREATE TABLE as of MySQL 3.23.20. The output from both statements includes a table type indicator. For versions older than 3.23.0, neither statement is available; but then the only available table type is ISAM, so there is no ambiguity about what storage format your tables use.