Download rpms. 1 links is here
http://www.nomachine.com/download-package.php?Prod_Id=718
Install all three Server, client, node
rpm -ivh rpmName
use -- yum install freenx nx
yum install openssh-server
User nx commands
cp /usr/libexec/nx/nxloadconfig /usr/NX/bin
/usr/libexec/nx/nxsetup --install --setup-nomachine-key
/usr/libexec/nx/nxserver --status
--restart [--start]
/usr/libexec/nx/nxserver --useradd root
/usr/libexec/nx/nxserver --passwd root
/usr/NX/bin/nxserver --keygen
On windows install NX client from EXE
[From Linux]
cat /var/lib/nxserver/home/.ssh/client.id_dsa.key
Copy the text you get and in your NX client, on your login dialog box go to:
Configure > General Tab > Key
Configure other things and login.
SSH must be ruuing on linux. Turn off the firewall.
Search This Blog
Wednesday, April 29, 2009
Configuring FreeNX Server on linux manchine & accessing it form Windows.
Download rpms. 1 links is here
http://www.nomachine.com/download-package.php?Prod_Id=718
Install all three Server, client, node
rpm -ivh rpmName
use -- yum install freenx nx
yum install openssh-server
User nx commands
cp /usr/libexec/nx/nxloadconfig /usr/NX/bin
/usr/libexec/nx/nxsetup --install --setup-nomachine-key
/usr/libexec/nx/nxserver --status
--restart [--start]
/usr/libexec/nx/nxserver --useradd root
/usr/libexec/nx/nxserver --passwd root
/usr/NX/bin/nxserver --keygen
On windows install NX client from EXE
[From Linux]
cat /var/lib/nxserver/home/.ssh/client.id_dsa.key
Copy the text you get and in your NX client, on your login dialog box go to:
Configure > General Tab > Key
Configure other things and login.
SSH must be ruuing on linux. Turn off the firewall.
http://www.nomachine.com/download-package.php?Prod_Id=718
Install all three Server, client, node
rpm -ivh rpmName
use -- yum install freenx nx
yum install openssh-server
User nx commands
cp /usr/libexec/nx/nxloadconfig /usr/NX/bin
/usr/libexec/nx/nxsetup --install --setup-nomachine-key
/usr/libexec/nx/nxserver --status
--restart [--start]
/usr/libexec/nx/nxserver --useradd root
/usr/libexec/nx/nxserver --passwd root
/usr/NX/bin/nxserver --keygen
On windows install NX client from EXE
[From Linux]
cat /var/lib/nxserver/home/.ssh/client.id_dsa.key
Copy the text you get and in your NX client, on your login dialog box go to:
Configure > General Tab > Key
Configure other things and login.
SSH must be ruuing on linux. Turn off the firewall.
Friday, April 24, 2009
Percentile program in c++
To calculate percentile
Write a program for the problem: the array of
inetegers indicating the marks of the students is
given, U have to calculate the percentile of the
students aaccording to this rule: the percentile of a
student is the %of no of student having marks less
then him. For eg:
suppose
Student Marks
A 12
B 60
C 80
D 71
percentile of C = 5/5 *100 = 100 (out of 5 students 5
are having marks less then him)
percentile of B = 3/5*100 = 60% (out of 5, 3 have
markses less then him)
percentile of A = 0/5*100 = 0%.
#include
#include
void main()
{
clrscr();
int a[10],n,i,j;
int percent;
int count;
cout<<"Enter the size of array";
cin>>n;
cout<<"enter the values";
for(i=0;i<=n-1;i++)
{
cout<<" Enter Marks for"< cin>>a[i];
}
for( i=0;i<=n-1;i++)
{ count=0;
for(j=0;j<=n-1;j++)
{ if(a[i]>a[j])
{
count=count+1;
}
}
percent=(count*100)/(n-1);
cout<<"The percentile of"< }
getch();
}
Write a program for the problem: the array of
inetegers indicating the marks of the students is
given, U have to calculate the percentile of the
students aaccording to this rule: the percentile of a
student is the %of no of student having marks less
then him. For eg:
suppose
Student Marks
A 12
B 60
C 80
D 71
percentile of C = 5/5 *100 = 100 (out of 5 students 5
are having marks less then him)
percentile of B = 3/5*100 = 60% (out of 5, 3 have
markses less then him)
percentile of A = 0/5*100 = 0%.
#include
#include
void main()
{
clrscr();
int a[10],n,i,j;
int percent;
int count;
cout<<"Enter the size of array";
cin>>n;
cout<<"enter the values";
for(i=0;i<=n-1;i++)
{
cout<<" Enter Marks for"< cin>>a[i];
}
for( i=0;i<=n-1;i++)
{ count=0;
for(j=0;j<=n-1;j++)
{ if(a[i]>a[j])
{
count=count+1;
}
}
percent=(count*100)/(n-1);
cout<<"The percentile of"< }
getch();
}
How to start and stop Apache
[use 'service httpd' ] OR ['apachectl' if installed]
[Here are some exapmles]
[root@vikas ~]# service httpd start
Starting httpd: [ OK ]
[root@vikas ~]# apachectl stop
[root@vikas ~]# service httpd status
httpd dead but subsys locked
[root@vikas ~]# apachectl start
[root@vikas ~]# service httpd status
httpd (pid 3055 3054 3053 3052 3051 3050 3049 3048 3047) is running...
[root@vikas ~]# apachectl stop
[root@vikas ~]# service httpd status
httpd dead but subsys locked
[root@vikas ~]# service httpd status
httpd dead but subsys locked
[root@vikas ~]# service httpd stop
Stopping httpd: [FAILED]
[root@vikas ~]# service httpd status
httpd is stopped
[root@vikas ~]# apachectl start
[root@vikas ~]# service httpd status
httpd (pid 3145 3144 3143 3142 3141 3140 3139 3138 3137) is running...
[root@vikas ~]# apachectl stop
[root@vikas ~]# service httpd status
httpd is stopped
[root@vikas ~]#
# What does apachectl do? - It sends a SIGUSR1 for a restart, and starts the apache server if it’s not running.
# How do you check for the httpd.conf consistency and any errors in it? - apachectl configtest
[root@vikas ~]# apachectl configtest
Syntax OK
[root@vikas ~]#
[Here are some exapmles]
[root@vikas ~]# service httpd start
Starting httpd: [ OK ]
[root@vikas ~]# apachectl stop
[root@vikas ~]# service httpd status
httpd dead but subsys locked
[root@vikas ~]# apachectl start
[root@vikas ~]# service httpd status
httpd (pid 3055 3054 3053 3052 3051 3050 3049 3048 3047) is running...
[root@vikas ~]# apachectl stop
[root@vikas ~]# service httpd status
httpd dead but subsys locked
[root@vikas ~]# service httpd status
httpd dead but subsys locked
[root@vikas ~]# service httpd stop
Stopping httpd: [FAILED]
[root@vikas ~]# service httpd status
httpd is stopped
[root@vikas ~]# apachectl start
[root@vikas ~]# service httpd status
httpd (pid 3145 3144 3143 3142 3141 3140 3139 3138 3137) is running...
[root@vikas ~]# apachectl stop
[root@vikas ~]# service httpd status
httpd is stopped
[root@vikas ~]#
# What does apachectl do? - It sends a SIGUSR1 for a restart, and starts the apache server if it’s not running.
# How do you check for the httpd.conf consistency and any errors in it? - apachectl configtest
[root@vikas ~]# apachectl configtest
Syntax OK
[root@vikas ~]#
How to start and stop Apache
[use 'service httpd' ] OR ['apachectl' if installed]
[Here are some exapmles]
[root@vikas ~]# service httpd start
Starting httpd: [ OK ]
[root@vikas ~]# apachectl stop
[root@vikas ~]# service httpd status
httpd dead but subsys locked
[root@vikas ~]# apachectl start
[root@vikas ~]# service httpd status
httpd (pid 3055 3054 3053 3052 3051 3050 3049 3048 3047) is running...
[root@vikas ~]# apachectl stop
[root@vikas ~]# service httpd status
httpd dead but subsys locked
[root@vikas ~]# service httpd status
httpd dead but subsys locked
[root@vikas ~]# service httpd stop
Stopping httpd: [FAILED]
[root@vikas ~]# service httpd status
httpd is stopped
[root@vikas ~]# apachectl start
[root@vikas ~]# service httpd status
httpd (pid 3145 3144 3143 3142 3141 3140 3139 3138 3137) is running...
[root@vikas ~]# apachectl stop
[root@vikas ~]# service httpd status
httpd is stopped
[root@vikas ~]#
# What does apachectl do? - It sends a SIGUSR1 for a restart, and starts the apache server if it’s not running.
# How do you check for the httpd.conf consistency and any errors in it? - apachectl configtest
[root@vikas ~]# apachectl configtest
Syntax OK
[root@vikas ~]#
[Here are some exapmles]
[root@vikas ~]# service httpd start
Starting httpd: [ OK ]
[root@vikas ~]# apachectl stop
[root@vikas ~]# service httpd status
httpd dead but subsys locked
[root@vikas ~]# apachectl start
[root@vikas ~]# service httpd status
httpd (pid 3055 3054 3053 3052 3051 3050 3049 3048 3047) is running...
[root@vikas ~]# apachectl stop
[root@vikas ~]# service httpd status
httpd dead but subsys locked
[root@vikas ~]# service httpd status
httpd dead but subsys locked
[root@vikas ~]# service httpd stop
Stopping httpd: [FAILED]
[root@vikas ~]# service httpd status
httpd is stopped
[root@vikas ~]# apachectl start
[root@vikas ~]# service httpd status
httpd (pid 3145 3144 3143 3142 3141 3140 3139 3138 3137) is running...
[root@vikas ~]# apachectl stop
[root@vikas ~]# service httpd status
httpd is stopped
[root@vikas ~]#
# What does apachectl do? - It sends a SIGUSR1 for a restart, and starts the apache server if it’s not running.
# How do you check for the httpd.conf consistency and any errors in it? - apachectl configtest
[root@vikas ~]# apachectl configtest
Syntax OK
[root@vikas ~]#
Thursday, April 23, 2009
Finding & deleting backup files, log files
Deleting *~ .log
find $PWD \( -name \*~ -or -name \*.o -or -name \*.log -or -name \*\#\) -exec rm -f {} \;
ZIP
find $PWD \( -name \*.tex -or -name \*README\* -or -name \*readme\* \) -exec gzip -9 {} \;
find $PWD \( -name \*~ -or -name \*.o -or -name \*.log -or -name \*\#\) -exec rm -f {} \;
ZIP
find $PWD \( -name \*.tex -or -name \*README\* -or -name \*readme\* \) -exec gzip -9 {} \;
Finding & deleting backup files, log files
Deleting *~ .log
find $PWD \( -name \*~ -or -name \*.o -or -name \*.log -or -name \*\#\) -exec rm -f {} \;
ZIP
find $PWD \( -name \*.tex -or -name \*README\* -or -name \*readme\* \) -exec gzip -9 {} \;
find $PWD \( -name \*~ -or -name \*.o -or -name \*.log -or -name \*\#\) -exec rm -f {} \;
ZIP
find $PWD \( -name \*.tex -or -name \*README\* -or -name \*readme\* \) -exec gzip -9 {} \;
How to know which binary file contains a particular function
[cd to dir where all binaries are]
for i in *
do echo $i;
nm $i | grep FUN_NAME ;
done
for i in *
do echo $i;
nm $i | grep FUN_NAME ;
done
How to know which binary file contains a particular function
[cd to dir where all binaries are]
for i in *
do echo $i;
nm $i | grep FUN_NAME ;
done
for i in *
do echo $i;
nm $i | grep FUN_NAME ;
done
How to make rpms of source code in linux
[Here is an example to make rpms of sipx source code (Fedora / CentOS)]
STEP 1: In .spec file modify 'Release: 013143' link this, a umber from SVN-VERSION file.
STEP 2: Make tar.gz of your source code. [Here i have sipxconfig-3.10.2/ folder of sipx config code]
$ tar -cvf sipxconfig-3.10.2.tar.gz sipxconfig-3.10.2/
Above command will make sipxconfig-3.10.2.tar.gz file.
STEP 3: Copy sipxconfig-3.10.2.tar.gz to /usr/src/redhat/SOURCES/
STEP 4: Run this command from terminal as root
$ cd sipxconfig-3.10.2/
$ rpmbuild -ba sipxconfig.spec
[This will make appropriate rpms of the source code. You can find them at /usr/src/redhat/RPMS/i386/ ]
STEP 1: In .spec file modify 'Release: 013143' link this, a umber from SVN-VERSION file.
STEP 2: Make tar.gz of your source code. [Here i have sipxconfig-3.10.2/ folder of sipx config code]
$ tar -cvf sipxconfig-3.10.2.tar.gz sipxconfig-3.10.2/
Above command will make sipxconfig-3.10.2.tar.gz file.
STEP 3: Copy sipxconfig-3.10.2.tar.gz to /usr/src/redhat/SOURCES/
STEP 4: Run this command from terminal as root
$ cd sipxconfig-3.10.2/
$ rpmbuild -ba sipxconfig.spec
[This will make appropriate rpms of the source code. You can find them at /usr/src/redhat/RPMS/i386/ ]
How to make rpms of source code in linux
[Here is an example to make rpms of sipx source code (Fedora / CentOS)]
STEP 1: In .spec file modify 'Release: 013143' link this, a umber from SVN-VERSION file.
STEP 2: Make tar.gz of your source code. [Here i have sipxconfig-3.10.2/ folder of sipx config code]
$ tar -cvf sipxconfig-3.10.2.tar.gz sipxconfig-3.10.2/
Above command will make sipxconfig-3.10.2.tar.gz file.
STEP 3: Copy sipxconfig-3.10.2.tar.gz to /usr/src/redhat/SOURCES/
STEP 4: Run this command from terminal as root
$ cd sipxconfig-3.10.2/
$ rpmbuild -ba sipxconfig.spec
[This will make appropriate rpms of the source code. You can find them at /usr/src/redhat/RPMS/i386/ ]
STEP 1: In .spec file modify 'Release: 013143' link this, a umber from SVN-VERSION file.
STEP 2: Make tar.gz of your source code. [Here i have sipxconfig-3.10.2/ folder of sipx config code]
$ tar -cvf sipxconfig-3.10.2.tar.gz sipxconfig-3.10.2/
Above command will make sipxconfig-3.10.2.tar.gz file.
STEP 3: Copy sipxconfig-3.10.2.tar.gz to /usr/src/redhat/SOURCES/
STEP 4: Run this command from terminal as root
$ cd sipxconfig-3.10.2/
$ rpmbuild -ba sipxconfig.spec
[This will make appropriate rpms of the source code. You can find them at /usr/src/redhat/RPMS/i386/ ]
Monday, April 20, 2009
Thursday, April 16, 2009
Trimming the string using javascript
// Removes leading white spaces
function ltrim( value ){
var re = /\s*((\S+\s*)*)/;
return value.replace(re, "$1");
}
// Removes ending white spaces
function rtrim( value ) {
var re = /((\s*\S+)*)\s*/;
return value.replace(re, "$1");
}
// Removes leading and ending white spaces
function trim( value ){
return ltrim(rtrim(value));
}
function ltrim( value ){
var re = /\s*((\S+\s*)*)/;
return value.replace(re, "$1");
}
// Removes ending white spaces
function rtrim( value ) {
var re = /((\s*\S+)*)\s*/;
return value.replace(re, "$1");
}
// Removes leading and ending white spaces
function trim( value ){
return ltrim(rtrim(value));
}
Stop being pinging by any host
Edit /proc/sys/net/ipv4/icmp_echo_ignore_all
[root@vikas ]# echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_all
[By doing this no body can ping you]
or
EDIT sysctl.conf
add these lines:
net.ipv4.icmp_echo_ignore_broadcasts=1
net.ipv4.icmp_echo_ignore_all=1
[check]
sysctl -p
[root@vikas ]# echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_all
[By doing this no body can ping you]
or
EDIT sysctl.conf
add these lines:
net.ipv4.icmp_echo_ignore_broadcasts=1
net.ipv4.icmp_echo_ignore_all=1
[check]
sysctl -p
Stop being pinging by any host
Edit /proc/sys/net/ipv4/icmp_echo_ignore_all
[root@vikas ]# echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_all
[By doing this no body can ping you]
or
EDIT sysctl.conf
add these lines:
net.ipv4.icmp_echo_ignore_broadcasts=1
net.ipv4.icmp_echo_ignore_all=1
[check]
sysctl -p
[root@vikas ]# echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_all
[By doing this no body can ping you]
or
EDIT sysctl.conf
add these lines:
net.ipv4.icmp_echo_ignore_broadcasts=1
net.ipv4.icmp_echo_ignore_all=1
[check]
sysctl -p
Know about you Linux OS
[root@vikas ~]# lsb_release -a
LSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID: Fedora
Description: Fedora release 8 (Werewolf)
Release: 8
Codename: Werewolf
LSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID: Fedora
Description: Fedora release 8 (Werewolf)
Release: 8
Codename: Werewolf
Know about you Linux OS
[root@vikas ~]# lsb_release -a
LSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID: Fedora
Description: Fedora release 8 (Werewolf)
Release: 8
Codename: Werewolf
LSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID: Fedora
Description: Fedora release 8 (Werewolf)
Release: 8
Codename: Werewolf
How to block all hosts entering through SSH over TCP
Add a line in file
# /etc/hosts.deny
sshd: ALL
OR give IP rather than ALL
OR to allow
edit file /etc/hosts.allow and add line
sshd: ip1, ip2
# /etc/hosts.deny
sshd: ALL
OR give IP rather than ALL
OR to allow
edit file /etc/hosts.allow and add line
sshd: ip1, ip2
How to block all hosts entering through SSH over TCP
Add a line in file
# /etc/hosts.deny
sshd: ALL
OR give IP rather than ALL
OR to allow
edit file /etc/hosts.allow and add line
sshd: ip1, ip2
# /etc/hosts.deny
sshd: ALL
OR give IP rather than ALL
OR to allow
edit file /etc/hosts.allow and add line
sshd: ip1, ip2
Wednesday, April 15, 2009
Worlds longest word
The longest word in the English language, according to the Oxford English Dictionary, is pneumonoultramicroscopicsilicovolcanoconiosis.
The only other word with the same amount of letters is pneumonoultramicroscopicsilicovolcanoconioses, its plural.
The longest place-name still in use is a New Zealand hill, Taumatawhakatangihangakoauauotamateaturipukakapikimaungahoronukupokaiwenuakitnatahu.
The only other word with the same amount of letters is pneumonoultramicroscopicsilicovolcanoconioses, its plural.
The longest place-name still in use is a New Zealand hill, Taumatawhakatangihangakoauauotamateaturipukakapikimaungahoronukupokaiwenuakitnatahu.
clear terminal using echo command
[clear the terminal]
echo -e "\033c"
[move cursor to 1st line]
echo -e "\033[1;5r"
echo -e "\033c"
[move cursor to 1st line]
echo -e "\033[1;5r"
clear terminal using echo command
[clear the terminal]
echo -e "\033c"
[move cursor to 1st line]
echo -e "\033[1;5r"
echo -e "\033c"
[move cursor to 1st line]
echo -e "\033[1;5r"
Input from terminal in java
Step1
import java.io.Console;
Step2
public static void main (String args[]) throws IOException {
Console con = System.console();
if (con == null) {
System.err.println("console not found");
System.exit(1);
}
String dta = con.readLine("Enter something-- ");
.............
}
------------------------------
[other way]
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String dta = null;
//Now use this in TRY section
dta = br.readLine(); // input from termminal
import java.io.Console;
Step2
public static void main (String args[]) throws IOException {
Console con = System.console();
if (con == null) {
System.err.println("console not found");
System.exit(1);
}
String dta = con.readLine("Enter something-- ");
.............
}
------------------------------
[other way]
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String dta = null;
//Now use this in TRY section
dta = br.readLine(); // input from termminal
Installing PUNJABI, HINDI fonts on centOS
Step 1. Download Punjabi or Hindi (.ttf) fonts
For examples - http://tdil.mit.gov.in/download/openfonts.htm
Download HINDI fonts from here - janahindi.zip
Can download from other locations.....
http://www.sikhnet.com/Gurmukhi-Fonts
Step 2. Extract .ttf file and copy it
in folder /usr/share/fonts/hindifont
If punjabi copy to it -- /usr/share/fonts/punjabifont
Step 3. Edit xfs config file so that system can find the fonts.
edit file /etc/X11/fs/config
Add line, at the end of catalogue section
/usr/local/share/fonts/hindifont,
/usr/share/fonts/punjabifont,
Step 4. Set the directory as font container, run these command from terminal
$ cd usr/share/fonts/hindifont
$ ttmkfdir -o fonts.scale
$ mkfontdir
$ fc-cache
Similarly for Punjabi fonts..
Step 5. Restart you xfs server to make these changes effective.
$ service xfs restart
For examples - http://tdil.mit.gov.in/download/openfonts.htm
Download HINDI fonts from here - janahindi.zip
Can download from other locations.....
http://www.sikhnet.com/Gurmukhi-Fonts
Step 2. Extract .ttf file and copy it
in folder /usr/share/fonts/hindifont
If punjabi copy to it -- /usr/share/fonts/punjabifont
Step 3. Edit xfs config file so that system can find the fonts.
edit file /etc/X11/fs/config
Add line, at the end of catalogue section
/usr/local/share/fonts/hindifont,
/usr/share/fonts/punjabifont,
Step 4. Set the directory as font container, run these command from terminal
$ cd usr/share/fonts/hindifont
$ ttmkfdir -o fonts.scale
$ mkfontdir
$ fc-cache
Similarly for Punjabi fonts..
Step 5. Restart you xfs server to make these changes effective.
$ service xfs restart
Installing PUNJABI, HINDI fonts on centOS
Step 1. Download Punjabi or Hindi (.ttf) fonts
For examples - http://tdil.mit.gov.in/download/openfonts.htm
Download HINDI fonts from here - janahindi.zip
Can download from other locations.....
http://www.sikhnet.com/Gurmukhi-Fonts
Step 2. Extract .ttf file and copy it
in folder /usr/share/fonts/hindifont
If punjabi copy to it -- /usr/share/fonts/punjabifont
Step 3. Edit xfs config file so that system can find the fonts.
edit file /etc/X11/fs/config
Add line, at the end of catalogue section
/usr/local/share/fonts/hindifont,
/usr/share/fonts/punjabifont,
Step 4. Set the directory as font container, run these command from terminal
$ cd usr/share/fonts/hindifont
$ ttmkfdir -o fonts.scale
$ mkfontdir
$ fc-cache
Similarly for Punjabi fonts..
Step 5. Restart you xfs server to make these changes effective.
$ service xfs restart
For examples - http://tdil.mit.gov.in/download/openfonts.htm
Download HINDI fonts from here - janahindi.zip
Can download from other locations.....
http://www.sikhnet.com/Gurmukhi-Fonts
Step 2. Extract .ttf file and copy it
in folder /usr/share/fonts/hindifont
If punjabi copy to it -- /usr/share/fonts/punjabifont
Step 3. Edit xfs config file so that system can find the fonts.
edit file /etc/X11/fs/config
Add line, at the end of catalogue section
/usr/local/share/fonts/hindifont,
/usr/share/fonts/punjabifont,
Step 4. Set the directory as font container, run these command from terminal
$ cd usr/share/fonts/hindifont
$ ttmkfdir -o fonts.scale
$ mkfontdir
$ fc-cache
Similarly for Punjabi fonts..
Step 5. Restart you xfs server to make these changes effective.
$ service xfs restart
Chnage every files name to lowercase in current folder
for i in * ; do
[ -f $i ] && mv -i $i `echo $i | tr ‘[A-Z]‘ ‘[a-z]‘`;
done;
[ -f $i ] && mv -i $i `echo $i | tr ‘[A-Z]‘ ‘[a-z]‘`;
done;
Chnage every files name to lowercase in current folder
for i in * ; do
[ -f $i ] && mv -i $i `echo $i | tr ‘[A-Z]‘ ‘[a-z]‘`;
done;
[ -f $i ] && mv -i $i `echo $i | tr ‘[A-Z]‘ ‘[a-z]‘`;
done;
Tuesday, April 14, 2009
Input from terminal in php i.e without interface
[Input from terminal]
$file = fopen("php://stdin","r");
$dta = fread($file,5); // will take only first 5 char of input
fclose($file);
echo $dta;
$file = fopen("php://stdin","r");
$dta = fread($file,5); // will take only first 5 char of input
fclose($file);
echo $dta;
Monday, April 13, 2009
Get file permissions in octat using stat command
whatis stat
stat - display file or file system status
stat - get file status
$stat -c '%a %n' *
[root@vikas pic]# stat -c '%a %n' *
644 121670133471emzSU.jpg
644 1.gif
[other valid options are]
Valid format sequences for file systems:
%a Free blocks available to non-superuser
%b Total data blocks in file system
%c Total file nodes in file system
%d Free file nodes in file system
%f Free blocks in file system
%C - Security context in SELinux
%i File System ID in hex
%l Maximum length of filenames
%n File name
%s Block size (for faster transfers)
%S Fundamental block size (for block counts)
%t Type in hex
%T Type in human readable form
stat - display file or file system status
stat - get file status
$stat -c '%a %n' *
[root@vikas pic]# stat -c '%a %n' *
644 121670133471emzSU.jpg
644 1.gif
[other valid options are]
Valid format sequences for file systems:
%a Free blocks available to non-superuser
%b Total data blocks in file system
%c Total file nodes in file system
%d Free file nodes in file system
%f Free blocks in file system
%C - Security context in SELinux
%i File System ID in hex
%l Maximum length of filenames
%n File name
%s Block size (for faster transfers)
%S Fundamental block size (for block counts)
%t Type in hex
%T Type in human readable form
Get file permissions in octat using stat command
whatis stat
stat - display file or file system status
stat - get file status
$stat -c '%a %n' *
[root@vikas pic]# stat -c '%a %n' *
644 121670133471emzSU.jpg
644 1.gif
[other valid options are]
Valid format sequences for file systems:
%a Free blocks available to non-superuser
%b Total data blocks in file system
%c Total file nodes in file system
%d Free file nodes in file system
%f Free blocks in file system
%C - Security context in SELinux
%i File System ID in hex
%l Maximum length of filenames
%n File name
%s Block size (for faster transfers)
%S Fundamental block size (for block counts)
%t Type in hex
%T Type in human readable form
stat - display file or file system status
stat - get file status
$stat -c '%a %n' *
[root@vikas pic]# stat -c '%a %n' *
644 121670133471emzSU.jpg
644 1.gif
[other valid options are]
Valid format sequences for file systems:
%a Free blocks available to non-superuser
%b Total data blocks in file system
%c Total file nodes in file system
%d Free file nodes in file system
%f Free blocks in file system
%C - Security context in SELinux
%i File System ID in hex
%l Maximum length of filenames
%n File name
%s Block size (for faster transfers)
%S Fundamental block size (for block counts)
%t Type in hex
%T Type in human readable form
Friday, April 10, 2009
Set / Reset a password to vi file.
[Set a password]
$vim -x filename
[This will prompt you the key]
[To Change or Delete the password, open file]
$vim filename
[Enter password]
[now edit file & type as below]
:set key=newpassword
[save using :wq & this will reset the password]
[If you use blank password here this will delete the password]
$vim -x filename
[This will prompt you the key]
[To Change or Delete the password, open file]
$vim filename
[Enter password]
[now edit file & type as below]
:set key=newpassword
[save using :wq & this will reset the password]
[If you use blank password here this will delete the password]
Set / Reset a password to vi file.
[Set a password]
$vim -x filename
[This will prompt you the key]
[To Change or Delete the password, open file]
$vim filename
[Enter password]
[now edit file & type as below]
:set key=newpassword
[save using :wq & this will reset the password]
[If you use blank password here this will delete the password]
$vim -x filename
[This will prompt you the key]
[To Change or Delete the password, open file]
$vim filename
[Enter password]
[now edit file & type as below]
:set key=newpassword
[save using :wq & this will reset the password]
[If you use blank password here this will delete the password]
Thursday, April 9, 2009
The Perfect Heart ....
One day a young man was standing in the middle of the town proclaiming that he had the most beautiful heart in the whole valley.
A large crowd gathered and they all admired his heart for it was perfect. There was not a mark or a flaw in it.
Yes, they all agreed it truly was the most beautiful heart they had ever seen. The young man was very proud and boasted more loudly about his beautiful heart. Suddenly, an old man appeared at the front of the crowd and said,
"Why your heart is not nearly as beautiful as mine." The crowd and the young man looked at the old man's heart. It was beating strongly, but full of scars, it had places where pieces had been removed and other pieces put in, but they didn't fit quite right and there were several jagged edges.
In fact, in some places there were deep gouges where whole pieces were missing.
The people stared -- how can he say his heart is more beautiful, they thought? The young man looked at the old man's heart and saw its state and laughed. "You must be joking," he said. "Compare your heart with mine, mine is perfect and yours is a mess of scars and tears."
"Yes," said the old man, "yours is perfect looking but I would never trade with you. You see, every scar represents a person to whom I have given my love - I tear out a piece of my heart and give it to them, and often they give me a piece of their heart which fits into the empty place in my heart, but because the pieces aren't exact, I have some rough edges, which I cherish, because they remind me of the love we shared. Sometimes I have given pieces of my heart away, and the other person hasn't returned a piece of his heart to me.
These are the empty gouges -- giving love is taking a chance. Although these gouges are painful, they stay open, reminding me of the love I have for these people too, and I hope someday they may return and fill the space I have waiting. So now do you see what true beauty is?"
The young man stood silently with tears running down his cheeks. He walked up to the old man, reached into his perfect young and beautiful heart, and ripped a piece out.
He offered it to the old man with trembling hands. The old man took his offering, placed it in his heart and then took a piece from his old scarred heart and placed it in the wound in the young man's heart. It fit,
But not perfectly, as there were some jagged edges. The young man looked at his heart, not perfect anymore but more beautiful than ever, since love from the old man's heart flowed into his. They embraced and walked away side by side.
A large crowd gathered and they all admired his heart for it was perfect. There was not a mark or a flaw in it.
Yes, they all agreed it truly was the most beautiful heart they had ever seen. The young man was very proud and boasted more loudly about his beautiful heart. Suddenly, an old man appeared at the front of the crowd and said,
"Why your heart is not nearly as beautiful as mine." The crowd and the young man looked at the old man's heart. It was beating strongly, but full of scars, it had places where pieces had been removed and other pieces put in, but they didn't fit quite right and there were several jagged edges.
In fact, in some places there were deep gouges where whole pieces were missing.
The people stared -- how can he say his heart is more beautiful, they thought? The young man looked at the old man's heart and saw its state and laughed. "You must be joking," he said. "Compare your heart with mine, mine is perfect and yours is a mess of scars and tears."
"Yes," said the old man, "yours is perfect looking but I would never trade with you. You see, every scar represents a person to whom I have given my love - I tear out a piece of my heart and give it to them, and often they give me a piece of their heart which fits into the empty place in my heart, but because the pieces aren't exact, I have some rough edges, which I cherish, because they remind me of the love we shared. Sometimes I have given pieces of my heart away, and the other person hasn't returned a piece of his heart to me.
These are the empty gouges -- giving love is taking a chance. Although these gouges are painful, they stay open, reminding me of the love I have for these people too, and I hope someday they may return and fill the space I have waiting. So now do you see what true beauty is?"
The young man stood silently with tears running down his cheeks. He walked up to the old man, reached into his perfect young and beautiful heart, and ripped a piece out.
He offered it to the old man with trembling hands. The old man took his offering, placed it in his heart and then took a piece from his old scarred heart and placed it in the wound in the young man's heart. It fit,
But not perfectly, as there were some jagged edges. The young man looked at his heart, not perfect anymore but more beautiful than ever, since love from the old man's heart flowed into his. They embraced and walked away side by side.
Wednesday, April 1, 2009
Creating repo of sipX rpms using comps.xml and then writing to dvd
1) #CREATE REPO IF RPMS ARE ADDED
#Write the name of rpms in ks.cfg and in comps.xml
#CREATE REPO IF RPMS ARE CHANGED no need to write in files
#changed dir to inside folder get init int cd folder if cd has all teh material
createrepo --baseurl="media://1195929637.060433" -g repodata/comps.xml .
#media is wriiten .diskinfo [use media of centos CD]
#if images are changed
mkcramfs stage2/ stage2.img
this will create img file. change with th e existing.
2) changed dir to outside folder i.e cd is the folder where all the material is.
mkisofs -R -J -T -no-emul-boot -boot-load-size 4 -boot-info-table -V "Coralpbx 3.4" -A "Created on 05/03/2009" -P "Coral" -p "Coral" -b isolinux/isolinux.bin -c isolinux/boot.cat -x "lost+found" -o coralpbx.iso cd
-o path of the iso file
3) To write a dvd / right click on iso file and select on "write to disc"
#images path in the stage dir. Change the required images here.
/root/Desktop/stage2/usr/share/anaconda/pixmaps
#Write the name of rpms in ks.cfg and in comps.xml
#CREATE REPO IF RPMS ARE CHANGED no need to write in files
#changed dir to inside folder get init int cd folder if cd has all teh material
createrepo --baseurl="media://1195929637.060433" -g repodata/comps.xml .
#media is wriiten .diskinfo [use media of centos CD]
#if images are changed
mkcramfs stage2/ stage2.img
this will create img file. change with th e existing.
2) changed dir to outside folder i.e cd is the folder where all the material is.
mkisofs -R -J -T -no-emul-boot -boot-load-size 4 -boot-info-table -V "Coralpbx 3.4" -A "Created on 05/03/2009" -P "Coral" -p "Coral" -b isolinux/isolinux.bin -c isolinux/boot.cat -x "lost+found" -o coralpbx.iso cd
-o path of the iso file
3) To write a dvd / right click on iso file and select on "write to disc"
#images path in the stage dir. Change the required images here.
/root/Desktop/stage2/usr/share/anaconda/pixmaps
Creating repo of sipX rpms using comps.xml and then writing to dvd
1) #CREATE REPO IF RPMS ARE ADDED
#Write the name of rpms in ks.cfg and in comps.xml
#CREATE REPO IF RPMS ARE CHANGED no need to write in files
#changed dir to inside folder get init int cd folder if cd has all teh material
createrepo --baseurl="media://1195929637.060433" -g repodata/comps.xml .
#media is wriiten .diskinfo [use media of centos CD]
#if images are changed
mkcramfs stage2/ stage2.img
this will create img file. change with th e existing.
2) changed dir to outside folder i.e cd is the folder where all the material is.
mkisofs -R -J -T -no-emul-boot -boot-load-size 4 -boot-info-table -V "Coralpbx 3.4" -A "Created on 05/03/2009" -P "Coral" -p "Coral" -b isolinux/isolinux.bin -c isolinux/boot.cat -x "lost+found" -o coralpbx.iso cd
-o path of the iso file
3) To write a dvd / right click on iso file and select on "write to disc"
#images path in the stage dir. Change the required images here.
/root/Desktop/stage2/usr/share/anaconda/pixmaps
#Write the name of rpms in ks.cfg and in comps.xml
#CREATE REPO IF RPMS ARE CHANGED no need to write in files
#changed dir to inside folder get init int cd folder if cd has all teh material
createrepo --baseurl="media://1195929637.060433" -g repodata/comps.xml .
#media is wriiten .diskinfo [use media of centos CD]
#if images are changed
mkcramfs stage2/ stage2.img
this will create img file. change with th e existing.
2) changed dir to outside folder i.e cd is the folder where all the material is.
mkisofs -R -J -T -no-emul-boot -boot-load-size 4 -boot-info-table -V "Coralpbx 3.4" -A "Created on 05/03/2009" -P "Coral" -p "Coral" -b isolinux/isolinux.bin -c isolinux/boot.cat -x "lost+found" -o coralpbx.iso cd
-o path of the iso file
3) To write a dvd / right click on iso file and select on "write to disc"
#images path in the stage dir. Change the required images here.
/root/Desktop/stage2/usr/share/anaconda/pixmaps
Subscribe to:
Comments (Atom)
