Tuesday, January 4, 2011

Disadvantages of Creating Many Tables in the Same Database

If we have many MyISAM tables in the same database directory, open, close, and create operations are slow. If we execute SELECT statements on many different tables, there is a little overhead when the table cache is full, because for every table that has to be opened, another must be closed. We can reduce this overhead by increasing the number of entries permitted in the table cache.

We can set the table_cache value in the my.cnf file by
set-variable = table_cache=8
Or
If we have the SUPER privilege then, use
set GLOBAL table_cache=8;

since the Variable 'table_cache' is a GLOBAL variable it should be set with SET GLOBAL

Thursday, May 20, 2010

How to add a "Share on Facebook" button to a webpage?

Copy the script for the style you'd like:


Copy and paste the following code blocks into your site and replace '<url>' with the link you want to Share.

Text link:

<script>function fbs_click() {u=location.href;t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}</script><a rel="nofollow" href="http://www.facebook.com/share.php?u=<;url>" onclick="return fbs_click()" target="_blank">Share on Facebook</a>

Small icon and text:

<script>function fbs_click() {u=location.href;t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}</script><style> html .fb_share_link { padding:2px 0 0 20px; height:16px; background:url(http://static.ak.facebook.com/images/share/facebook_share_icon.gif?6:26981) no-repeat top left; }</style><a rel="nofollow" href="http://www.facebook.com/share.php?u=<;url>" onclick="return fbs_click()" target="_blank" class="fb_share_link">Share on Facebook</a>

Icon only:

<script>function fbs_click() {u=location.href;t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}</script><style> html .fb_share_button { display: -moz-inline-block; display:inline-block; padding:1px 20px 0 5px; height:15px; border:1px solid #d8dfea; background:url(http://static.ak.facebook.com/images/share/facebook_share_icon.gif?6:26981) no-repeat top right; } html .fb_share_button:hover { color:#fff; border-color:#295582; background:#3b5998 url(http://static.ak.facebook.com/images/share/facebook_share_icon.gif?6:26981) no-repeat top right; text-decoration:none; } </style> <a rel="nofollow" href="http://www.facebook.com/share.php?u=<;url>" class="fb_share_button" onclick="return fbs_click()" target="_blank" style="text-decoration:none;">Share</a>
Sources: http://www.facebook.com/share_partners.php

Tuesday, April 20, 2010

How To Add Or Insert Orkut Post Share Button In Blogs

Orkut allows a share button feature with which website owners can extend the functionality of sharing their content with visitor friends using Orkut. It is not difficult at all to add the share button. Just follow the following guidelines and you are done. Orkut Post Share Button.

Implenting Share Button In any Blog

There will be a header file or any common file in your application and you need to paste the following code

<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
      google.load('orkut.share', '1');
      google.setOnLoadCallback(function() {
        var params = {};
        params[google.orkut.share.Field.TITLE] = 'Site title here';
        params[google.orkut.share.Field.DESTINATION_URL] = 'www.scriptscart.com';
        var connection = new google.orkut.share.Connection(params);
        document.getElementById('orkut-share').onclick =
          function(e) { connection.send('orkut.com', {}); };
      }, true);
    </script>


Now save the file and go to any other file or wherever you want to put this button and paste the following code there.

<span id="orkut-share" style="cursor:pointer; border:0px solid black">
<img src="http://3.bp.blogspot.com/_eEuHGVw5WLg/SwpFfy4rMqI/AAAAAAAAAAk/jdm-zBiDdv8/s320/share.gif" alt="Share Orkut" />
</span>

Save the file and you are ready for using the Share Button feature of ORKUT API.

Wednesday, March 24, 2010

Deprecated INI directives in php 5.3.x

• define_syslog_variables
• register_globals
• register_long_arrays
• safe_mode
• magic_quotes_gpc
• magic_quotes_runtime
• magic_quotes_sybase
• Comments starting with '#' are now deprecated in .INI files.

Deprecated features in php 5.3.x

• Assigning the return value of new by reference is now deprecated.
• Call-time pass-by-reference is now deprecated.
• The use of {} to access string offsets is deprecated. Use [] instead.

Deprecated functions in php 5.3.x

• call_user_method() (use call_user_func() instead)
• call_user_method_array() (use call_user_func_array() instead)
• define_syslog_variables()
• dl()
• ereg() (use preg_match() instead)
• ereg_replace() (use preg_replace() instead)
• eregi() (use preg_match() with the 'i' modifier instead)
• eregi_replace() (use preg_replace() with the 'i' modifier instead)
• set_magic_quotes_runtime() and its alias, magic_quotes_runtime()
• session_register() (use the $_SESSION superglobal instead)
• session_unregister() (use the $_SESSION superglobal instead)
• session_is_registered() (use the $_SESSION superglobal instead)
• set_socket_blocking() (use stream_set_blocking() instead)
• split() (use preg_split() instead)
• spliti() (use preg_split() with the 'i' modifier instead)
• sql_regcase()
• mysql_db_query() (use mysql_select_db() and mysql_query() instead)
• mysql_escape_string() (use mysql_real_escape_string() instead)
• Passing locale category names as strings is now deprecated. Use the LC_* family of constants instead.
• The is_dst parameter to mktime(). Use the new timezone handling functions instead.

Tuesday, March 2, 2010

How can I turn off MySQL strict mode? or Solving Incorrect integer value problem with MySQL 5 strict-mode

To turn off strict_mode in MySQL

This can be done in two ways...

Open your "my.ini" file within the MySQL installation directory, and look for the text "sql-mode".

Find:
# Set the SQL mode to strict
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

Replace with:

# Set the SQL mode to strict
sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

Or, you can run an SQL query within your database management tool, such as phpMyAdmin:

SET @global.sql_mode= '';

Wednesday, February 17, 2010

Function set_magic_quotes_runtime() is deprecated in PHP 5.3.0

It's better to change the error_reporting line because there are a few other deprecated functions.

error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);

You need to wrap this in a test for PHP version 5.3 because E_DEPRECATED only became available as of 5.3.


Another method is

find:
set_magic_quotes_runtime(0);
and replace:
ini_set("magic_quotes_runtime", 0);

Friday, January 15, 2010

To view apache error log

tail -f /usr/local/apache/logs/error_log | grep betaisc

Monday, December 28, 2009

What is the difference between AIM or SIM in Authorize.Net

In SIM (Simple integration Method) customer credit card details are taken on the authorize.net site - no SSL required AIM (Advanced integration Method) Credit card details are taken over your site SSL required - please check setup instructions for more details http://www.ecommercetemplates.com/phphelp/ecommplus/authorizenet.asp

Thursday, November 12, 2009

To view the exim mail log

tail -f /var/log/exim_mainlog

Tuesday, October 20, 2009

Turn dynamic URLs into search engine friendly static URLs

The original URL
------------------
http://www.scriptscart.com/shop.php?cmd=product&category=vehicles&product=bus

The rewritten URL
--------------------
http://www.scriptscart.com/product/vehicles/bus.html

Add the following lines to .htaccess:

RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)/([^/]*)\.html$ /shop.php?cmd=$1&category=$2&product=$3 [L]

Please follow the instructions below to do it.

  1. First you need to check if the file .htaccess exists in the root of your website.
  2. If the file .htaccess exists, download it from your site, add the lines below to the end of the file, and upload the modified file back to your site. Please make a copy of the original file .htaccess. So if anything goes wrong, you may restore the original file.
  3. If the file .htaccess does not exist, create a new file .htaccess and add the lines below to it. Then upload it to the root of your website. You may delete it if anything goes wrong.

Thursday, August 6, 2009

Payment gateways test account

Authorize.net
==========

You can use any of the following test credit card numbers. The expiration date must be set to the present date or later:

370000000000002 American Express Test Card
6011000000000012 Discover Test Card
4007000000027 Visa Test Card
4012888818888 second Visa Test Card
3088000000000017 JCB
38000000000006 Diners Club/ Carte Blanche



google checkout
===========

GoogleMerchant ID : 643760143118924

Google Merchant Key : jk0ACPM8RdntndpuFbqjew

Wednesday, July 1, 2009

How to find how much free space in Hard disk Linux


"df -h"
du -sch *

Monday, June 15, 2009

How to run a crontab entry as "nobody"

Assuming you are the root user on a Linux computer, here's a quick example of how to run a program on a Linux system through a crontab entry, with the program being executed as the user nobody.

Just put this entry in a crontab file (by issuing the "crontab -e" command, for example), and the program named myProgram.sh will be run at 1:30 a.m. using the Bourne shell, and will be run as the user nobody.

30 1 * * * su -c '/path/to/program/myProgram.sh' -s /bin/sh nobody

testing is always recommended, but this has worked for me.

How to create aliases (linux/unix)

Creating aliases is very easy. You can either enter them at the command line as you're working, or more likely, you'll put them in one of your startup files, like your .bashrc file, so they will be available every time you log in.

I created the ll alias by entering the following command into my .bashrc file:

alias ll="ls -al"

/etc/bashrc


Monday, June 1, 2009

Restore a Mysql database from the server backup

root@testserver [/var/lib/mysql]# mysql testsite_support < /backup/cpbackup/weekly/testsite/mysql/testsite_support.sql

Thursday, March 26, 2009

.htaccess 301 redirection

.htaccess 301 redirection

RewriteEngine On RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]


Alternate method is


ServerName www.example.com
ServerAdmin webmaster@example.com
DocumentRoot /home/username/public_html

ServerName example.com
RedirectMatch permanent ^/(.*) http://www.example.com/$1


For more details refer http://www.seobook.com/archives/001714.shtml

Wednesday, March 25, 2009

To increase memory limit using .htaccess

To increase memory limit using .htaccess

Put a .htaccess file with the following code in the particular directory


php_value memory_limit 128M

To get the cpanel username

To get the cpanel username

First login to the server as 'root' then

grep domainname.com /etc/userdomains