Saturday, August 6, 2011

how to make jar file

make jar file

jar cvfm MyJarName.jar manifest.txt *.class *.txt

in manifest.txt
Main-Class: ExecuteclassName


runjar file
java -jar MyJarName.jar

jar file execute on click

right click on jar file and open with path to jre/lib/jexec

Start rmiregistry programmatically

try {
LocateRegistry.createRegistry(1099);
} catch (RemoteException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}

Tuesday, June 28, 2011

Apache Userdir enabled

go to

In httpd.conf
add comment bellow line
userdir disabled
-----------------------------------------------
chmod 711 for /home/userdir(userid)
chmod 755 for /home/userdir(userid)/public_html

[or]

chcon -R -t htppd_sys_content_t /home/keval/web
-----------------------------------------------
system => selinux management => boolean
check => Allow httpdto read home directores(module apache)

[or]

setsebool -P httpd_enable_homedirs true
-----------------------------------------------
remove comment in httpd.conf
NameVirtualHost *:80


ServerName localhost
DocumentRoot /home/userdir/web

-----------------------------------------------
restart httpd
-----------------------------------------------

/etc/hosts

change localhost localhost.localdomain to localhost.localdomain localhost

127.0.0.1 localhost localhost.localdomain
::1 localhost localhost.localdomain

replace with

127.0.0.1 localhost.localdomain localhost
::1 localhost.localdomain localhost

-----------------------------------------------

Friday, May 27, 2011

Saurashtra University Result

How to recover / change the root password on RedHat Linux based systems

How to recover / change the root password on RedHat Linux based systems

Power on, or reboot as needed.

and press 'tab' key

Now you should press 'e' and you will get this screen.

plz select kernel option

now press 'e'

Insert an space and the number one '1'.

After that press ENTER and 'b' and ENTER again.

Now you can change the password like this

#passwd

enter new password

then

give

#chmod u+s /bin/su

and

#exit

Tuesday, April 19, 2011

Enable Remote Access To Mysql Database Server

By default remote access to MySQL database server is disabled for security reasons. However, some time you need to provide remote access to database server from home or a web server.

Working on fedora 10, php 5.3.2 and mysql Server version: 5.1.47

Edit my.cnf File
Red Hat Linux/Fedora/Centos Linux file is located at /etc/my.cnf location

opne this file and search [mysqld]
and add bellow line
port = 3306
bind-address = your system ip

service mysqld restart


Open port 3306


open TCP port 3306 using iptables.
A sample iptables rule to open Linux iptables firewall

/sbin/iptables -A INPUT -i eth0 -p tcp --destination-port 3306 -j ACCEPT

save all rules

service iptables save

Example

<?php
$link = mysql_connect('host ip', 'username', 'password');
if (!$link) {
die('Could not connect: ' . mysql_error());
exit;
}

$db_selected = mysql_select_db('database',$link);
if (!$db_selected) {
die ('Can\'t use database : ' . mysql_error());
exit;
}

$sql = "SELECT id as col1, col2, col3 FROM sometable";

$result = mysql_query($sql);

if (!$result) {
echo "Could not successfully run query ($sql) from DB: " . mysql_error();
exit;
}

if (mysql_num_rows($result) == 0) {
echo "No rows found, nothing to print so am exiting";
exit;
}

while ($row = mysql_fetch_assoc($result)) {
echo $row["col1"];
echo " ".$row["col2"];
echo " ".$row["col3"];
}

mysql_free_result($result);

mysql_close($link);
?>

Base on : http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html

Thursday, April 7, 2011

windows desktop corrupted

if windows desktop corrupted

then copy explorer.exe from working windows folder to corrupted deskotp windows folder (same version)

how to see xml preview in browser php

xml preview view in browser $xml = new DOMDocument('1.0', 'UTF-8');                 $xml->preserveWhiteSpace = false; ...