How to install mysql-connector-java / mysql-connector-odbc on fedora

I am using the Fedora9 for installation
I downloaded rmp file from this location.
http://rpm.pbone.net/index.php3/stat/4/idpl/7221422/com/mysql-connector-java-3.1.12-5.fc9.i386.rpm.html

If you are using the fedora 10 or 11, you can use this url;
http://www.rpmfind.net/linux/rpm2html/search.php?query=mysql-connector-java&submit=Search+…&system=fedora+9&arch=

[siwan@localhost ]$ su
Password:
[root@localhost ]# rpm -Uvh mysql-connector-java-3.1.12-5.fc9.i386.rpm
Preparing… ########################################### [100%]
1:mysql-connector-java ########################################### [100%]
[root@localhost ]#

how to install mysql-connector-odbc on fedora

I downloaded rmp file from this location.
http://rpm.pbone.net/index.php3?stat=3&search=mysql-connector-odbc&srodzaj=3

[root@localhost Desktop]# rpm -Uvh mysql-connector-odbc-3.51.24r1071-1.fc9.i386.rpm
Preparing… ########################################### [100%]
1:mysql-connector-odbc ########################################### [100%]
[root@localhost Desktop]#

how to check programs installation path in linux

There are many linux distributions like fedora, redhat, centos. Each has different program installation path. Using following commands you can check programs installation path in linux

how to check programs installation path in linux

Use following commands:

</pre>
[root@localhost ]# which php
/usr/bin/php
[root@localhost ]# which ruby
/usr/bin/ruby
[root@localhost ]# php --version
PHP 5.2.9 (cli) (built: Apr 17 2009 03:42:25)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
with eAccelerator v0.9.5.2, Copyright (c) 2004-2006 eAccelerator, by eAccelerator
[root@localhost ]# ruby --version
ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-linux]
[root@localhost Desktop]#

Solved: Access denied with code 400 (phase 2).

When I restarted my apache server. I am using the fedora 9 here.

I did not get my default page opened in browser.
When I opened the apache error log file. I saw following error.

ModSecurity: Access denied with code 400 (phase 2). Pattern match “%0[ad]” at REQUEST_HEADERS:Cookie. [id “950910”] [msg “HTTP Response Splitting Attack. Matched signature <%0a>”] [severity “ALERT”] [hostname “localhost”] [uri “/”] [unique_id “SuWoGH8AAAEAAFF3rKEAAAAA”]

I after doing some R&D but I did not got any perfect soluction.
Then I cleared the whole browser cookies. That solves my problem.

solution – clear the browser cookies…

How to use Custom Page as Homepage in WordPress

wordpress tutorial, How to use Custom Page as Homepage in WordPress. Here we given full step by step explanation about using custom template.

This is one of the most wanted hacks that users want to know how to accomplish. First you need to learn how to create a custom page. You will need to duplicate your page.php or create a wordpress.php file and add the following code at the very top:

How to use Custom Page as Homepage in WordPress

wordpressapi */ ?>

How to use Custom Page as Homepage in WordPress
How to use Custom Page as Homepage in WordPress

You can change the template name. Change any styling, that you want in that page. Go to your WordPress admin panel and create a new page and select this template(wordpressapi).

custompagetemplate

Select your page to be the homepage as per your choice. Now you have yourself a Custom Home Page.

Have fun!

Solved: DirectoryIndex not allowed here

When I tried to run my one of my project on server I got following error on the Browser.:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, root@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

When I got above error I opened the error log file.

Error Log File log(#vim /var/log/httpd/error_log)
[Wed Oct 14 12:02:56 2009] [notice] mod_python: Creating 4 session mutexes based on 256 max processes and 0 max threads.
[Wed Oct 14 12:02:56 2009] [notice] mod_python: using mutex_directory /tmp
[Wed Oct 14 12:02:56 2009] [notice] Apache/2.2.9 (Unix) DAV/2 PHP/5.2.6 mod_python/3.3.1 Python/2.5.1 mod_ssl/2.2.9 OpenSSL/0.9.8g mod_perl/2.0.4 Perl/v5.10.0 configured — resuming normal operations
[Wed Oct 14 12:02:59 2009] [alert] [client 127.0.0.1] /var/www/html/your_domain_name/.htaccess: DirectoryIndex not allowed here, referer: http://your_domain_name.org/
[Wed Oct 14 12:03:29 2009] [alert] [client 127.0.0.1] /var/www/html/your_domain_name/.htaccess: DirectoryIndex not allowed here, referer: http://your_domain_name.org/
[Wed Oct 14 12:11:13 2009] [notice] caught SIGTERM, shutting down
[Wed Oct 14 12:11:13 2009] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Wed Oct 14 12:11:13 2009] [notice] Digest: generating secret for digest authentication …
[Wed Oct 14 12:11:13 2009] [notice] Digest: done

At the end of file I saw above error.

When I saw that I opened the httpd.conf file and I searched for line.

AllowOverride None

I commented this line.
#AllowOverride None

Then I added following lines to that tag
Order allow,deny
Allow from all

Then I saved the httpd.conf file and restarted the apache server.

This solved the my issue.

solved: [warn] _default_ VirtualHost overlap on port 80, the first has precedence

Here I am using the Fedora 9 for this example. I solved the issue of _default_ VirtualHost overlap on port 80 warning in linux

If you want to host many sites on one computer or machine.
I added following lines to httpd.conf file(end of file).

[viral-lock message=”Solution code is Hidden! It’s Visible for Users who Liked/Shared This article on Facebook or Twitter or Google+. Like or Tweet this article to reveal the content.”]

<VirtualHost  *:80>

Options +FollowSymLinks
ServerName example1.com
DocumentRoot /var/www/html/example1

VirtualHost>

<VirtualHost  *:80>

Options +FollowSymLinks
ServerName example2.com
DocumentRoot /var/www/html/example2

</ VirtualHost>

[/viral-lock]

When I restarted the apache server using following command.
#su
#ROOT_PASSWORD
#/etc/init.d/httpd restart

I got the following error;
[warn] _default_ VirtualHost overlap on port 80, the first has precedence

Again I opend the httpd.conf tile and I read following lines;
#
# Use name-based virtual hosting.
#
#NameVirtualHost *:80

# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
#

Than only I uncommented following line and restarted the Server.

NameVirtualHost *:80

My promlem get solved.

change file permissions of all files in a folder in linux

If you are new in Linux for that use this command. change file permissions of all files in a folder in linux, In this article we given commands for changing permission for all folders and files. using command you can change the permission

 

change file permission of all folder and subfolders in linux

#chmod 777 * //for chanding the all folders file permission
#chmod 777 FOLDER_NAME

Where I stuck, I want to change the Main folder and subfolders and all files persimission.
You can use following command.

#chmod -R 777 *
#chmod -R 777 FOLDER_NAME

How to Add or Remove the javascript file using javascript function

We can use following functions for adding the Javascript file dynamically.

function AddJsFile(file) {
var script  = document.createElement('script');
script.src  = file;
script.type = 'text/javascript';
script.defer = true;

document.getElementsByTagName('head').item(0).appendChild(script);
}

Or We can use this also, both will work:
function AddJsFile(file)
{
document.write('');
}

We can use following functions for adding the CSS file dynamically.


function AddCssFile(file) {
var stylesheet  = document.createElement('link');
stylesheet.href  = file;
stylesheet.type = 'text/css';
stylesheet.defer = true;

document.getElementsByTagName('head').item(0).appendChild(stylesheet);
}

Or We can use this also, both will work:

function AddCssFile(file)
{
document.write('');
}

We can use the following code for remving the JS the files.


function RemoveJsFile(file) {
var alljs = document.getElementsByTagName("js")
for (var i = alljs.length; i >= 0; i--) {
if (alljs[i] && alljs[i].getAttribute("src")!= null && alljs[i].getAttribute("src").indexOf(file)!=-1)

alljs[i].parentNode.removeChild(alljs[i])
}

}

We can use the following code for remving the CSS the files.

function RemoveCssFile(file) {
var allcss = document.getElementsByTagName("css")
for (var i = alljs.length; i >= 0; i--) {
if (allcss[i] && allcss[i].getAttribute("href")!= null && allcss[i].getAttribute("href").indexOf(file)!=-1)

allcss[i].parentNode.removeChild(allcss[i])
}

}

How to find Mysql database engine type

Mysql tutorial, How to find Mysql database engine type.  You need to use this command for checking the engine type. command for checking engine type.

How to find Mysql database engine type

SHOW TABLE STATUS WHERE Name = ‘users’;

Or Use this command for checking the all table’s engine type.

SHOW TABLE STATUS;

Or You can use this command for database:

mysqlshow –status db_name;

I used following URL for creating this commands:

http://dev.mysql.com/doc/refman/4.1/en/show-table-status.html

php create xml file from mysql

php create xml file from mysql, Here I am giving you the very basic sample code for creating XML file through PHP and MYsql. We given code sample for this.

php create xml file from mysql

<?php

// We'll be outputting a PDF
header('Content-type: text/xml');

echo ""

$db_name = "testDB";
$connection = mysql_connect("example.com", "username", "password") or die("Could not connect.");
$table_name = 'user';

$query = "select * from " . $table_name;

$result = mysql_query($query, $connection) or die("Could not complete database query");
$num = mysql_num_rows($result);

while ($row = mysql_fetch_assoc($result)) {
echo "". $row['firstname']."";
echo "". $row['lastname']."";
echo "
". $row['address']."

";
echo "". $row['age']."";
}

?>