Sunday, July 8, 2012

Sample valid credit card numbers for testing


Here is a list of sample/dummy/test credit card numbers, which are safe to use when you test credit card functionality on a website or application that involves credit card transactions. These credit card numbers validate properly but they are not actually in use.
American Express:
378282246310005
3111111111111117
343434343434343
370000000000002
340000000000009
371449635398431
378734493671000
Visa:
4111111111111111
4007000000027
4222222222222
4012888888881881
MasterCard:
5105105105105100
5111111111111118
5454545454545454
5500000000000004
5555555555551111
5555555555554444
Discover:
6011111111111117
6011000000000004
6011000990139424
6011601160116611
6111111111111116
Hope this helps. Thanks.

Magento Blog Links

Magento Extension to be implement:
http://www.magentocommerce.com/magento-connect/cart-items-preview-on-mouseover.html

HTML5 Links:
http://www.htmldrive.net/

Core PHP Hints :
http://bmehla.wordpress.com/

Create loading image through script :

http://ajaxload.info/
http://picasion.com/upload-pictures/

Magento For Beginners:
http://dbhoopendra.blogspot.in/ 
http://xhtmlandcsshelp.blogspot.in/
http://spenserbaldwin.com/
http://subesh.com.np/category/google/google-maps/
http://sanjoyroy.wordpress.com/author/sanjoyroy
http://www.khemissi.com/2010/07/09/magento-diagram-website-store-store-view/

Magento Query Conditions :
http://fishpig.co.uk/blog/addattributetofilter-conditionals-in-magento.html

Jquery Slider Links
http://www.freshdesignweb.com/80jquery-image-slideshow-and-content-slider-tutorial.html
http://www.jquery4u.com/plugins/100-jquery-sliders-part1/#.T-safpHHFhp

Javascript Hints

http://www.javascriptkit.com/script/script2/3slide.shtml 

http://www.dhtmlgoodies.com/

http://jquerybyexample.blogspot.com/ 


Magento Blog Links

http://shamimcse05.wordpress.com/
http://dx3webs.com/front/category/magento/
http://www.pethemes.com/weblog/
http://www.blog.magepsycho.com/
http://www.inacode.com/
http://www.developersupports.com/category/2/magento/page/3/
http://www.excellencemagentoblog.com/magento-create-custom-shipping-method
http://sapnandu-magento.blogspot.in/search?updated-max=2011-09-28T22:23:00-07:00&max-results=7&start=21&by-date=false
http://developer.practicalecommerce.com/topics/33-Code
http://blog.decryptweb.com/
http://phpmysqlscript.wordpress.com
http://www.fontis.com.au/blog/magento/
http://ommune.com/adding-new-currency-symbol-of-indian-rupee-inr-in-magento/
http://magentosnippet.blogspot.in/
http://magento-talks.blogspot.in/2011_09_01_archive.html
http://xhtmlandcsshelp.blogspot.in/2011/02/absolute-path-of-base-directory-in.html
http://magentocookbook.wordpress.com/category/magento-coding/
http://www.designer-daily.com/magento-tips-17085
http://www.learnmagento.org/page/4/
http://magebase.com/
http://www.magthemes.com/magento-blog/
http://amilan.wordpress.com/2008/05/
http://www.catgento.com/
http://spenserbaldwin.com/2010/03
http://magentoexpert.blogspot.in/2010/02/restrict-access-to-magento-during.html
http://keertikiran.blogspot.in/search/label/Magento
http://blog.baobaz.com/en
http://mydons.com/category/framework/magento/
http://www.justwebdevelopment.com/blog/category/magento/
http://magento-talks.blogspot.in/
http://phptalks.wordpress.com//?s=magento&search=Go
http://www.endreywalder.com/blog/magento/
http://fishpig.co.uk/magento-tutorials/custom-tabs-magento-product-admin
http://magento4u.wordpress.com/2009/06/08/create-new-module-helloworld-in-magento/
http://www.e-commercewebdesign.co.uk/blog/magento-tips/creating-a-custom-theme-in-magento-1-5.php
http://www.webspeaks.in/search/label/magento?max-results=10

Magento Themes Link

http://www.design4magento.com/free-magento-themes/
http://www.smashingmagazine.com/2010/06/03/download-a-free-magento-theme-hellowired/
http://www.tmdhosting.com/templates/free-magento-themes.html
http://pelfusion.com/freebies/15-free-high-quality-magento-templates/
http://www.modny73.com/inspiration/27-free-magento-themes-for-download/
http://www.tmdhosting.com/templates/free-wordpress-themes.html
http://www.magento-templates.com/free-magento-templates/
http://www.freewebtemplates.com/
http://www.expertmagentodevelopers.com/blog/6-exclusive-free-magento-1-7-themes/
http://www.expertmagentodevelopers.com/blog/download-free-magento-1-7-themes/

Free Wordpress Themes Link

http://www.freewebtemplates
http://www.freewebtemplates.com/download/free-wordpress-theme/customize-774829566/download/.com/download/free-wordpress-theme/customize-774829566/download/
http://www.queness.com/wordpress-theme
http://www.freewebtemplates.com/website-templates/

Free Magento Extension link

http://www.fmeextensions.com/free-stuff/free-themes.html?mode=grid
http://www.magentheme.com/magento-extensions/free.html?limit=30

Free HTML Templates link

http://www.freewebsitetemplates.com/templates/page-9
http://www.freewebtemplates.com/shop-templates/
http://www.metamorphozis.com/
http://www.templatesbox.com/templates.htm
http://www.siteground.com/
http://www.themesbase.com/?free=1&order=&page=11
http://pligg2u.com/
http://myfreetemplatehome.com/ws4/10-administration-panel-html-templates-best-of-this-week.php
http://ginva.com/2012/05/admin-html-css-website-templates/
http://www.templatemo.com/preview/templatemo_354_simple_grid

Free And paid magento links important

http://www.mage-world.com/
http://www.magikcommerce.com/


Free Jquery Block UI link
http://dreamerslab.com/blog/en/jquery-blockui-alternative-with-jquery-msg-plugin/



Wednesday, June 27, 2012

Javascript all key validation

function validateNumberKey(event) {
   
    var key = window.event ? event.keyCode : event.which;
    if (event.keyCode == 8 || event.keyCode == 46
     || event.keyCode == 37 || event.keyCode == 39 || event.keyCode == 9) {
        return true;
    }
    else if ( key < 48 || key > 57 ) {
        return false;
    }
    else return true;
}

function validateAlphaNumericKey(event) {
    var key = window.event ? event.keyCode : event.which;
    if (event.keyCode == 8 || event.keyCode == 46
     || event.keyCode == 37 || event.keyCode == 39 || event.keyCode == 9) {
        return true;
    }
    else if ( key >= 48 && key <= 57 )
    {
        return true;
    }
    else if ( key >= 65 && key <= 90 )
    {
        return true;
    }
    else if ( key >= 97 && key <= 122 )
    {
        return true;
    }
    else return false;
}
function validateAlphabeticKey(event) {
    var key = window.event ? event.keyCode : event.which;
    if (event.keyCode == 8 || event.keyCode == 46
     || event.keyCode == 37 || event.keyCode == 39 || event.keyCode == 9) {
        return true;
    }
    else if ( key >= 65 && key <= 90 )
    {
        return true;
    }
    else if ( key >= 97 && key <= 122 )
    {
        return true;
    }
    else return false;
}




Number :
AlphaNumeric :
Alphabetic :

Sunday, June 24, 2012

Javascript to create dynamic textbox

Javascript create dynamic textbox

Javascript to create dynamic table + multiple columns

Javascript create multiple column table

Create table through javascript

Javascript all key validation

function validateNumberKey(event) {
   
    var key = window.event ? event.keyCode : event.which;
    if (event.keyCode == 8 || event.keyCode == 46
     || event.keyCode == 37 || event.keyCode == 39 || event.keyCode == 9) {
        return true;
    }
    else if ( key < 48 || key > 57 ) {
        return false;
    }
    else return true;
}

function validateAlphaNumericKey(event) {
    var key = window.event ? event.keyCode : event.which;
    if (event.keyCode == 8 || event.keyCode == 46
     || event.keyCode == 37 || event.keyCode == 39 || event.keyCode == 9) {
        return true;
    }
    else if ( key >= 48 && key <= 57 )
    {
        return true;
    }
    else if ( key >= 65 && key <= 90 )
    {
        return true;
    }
    else if ( key >= 97 && key <= 122 )
    {
        return true;
    }
    else return false;
}
function validateAlphabeticKey(event) {
    var key = window.event ? event.keyCode : event.which;
    if (event.keyCode == 8 || event.keyCode == 46
     || event.keyCode == 37 || event.keyCode == 39 || event.keyCode == 9) {
        return true;
    }
    else if ( key >= 65 && key <= 90 )
    {
        return true;
    }
    else if ( key >= 97 && key <= 122 )
    {
        return true;
    }
    else return false;
}




Number : <input type="text" name="number" onkeypress="return validateNumberKey(event)"/>
AlphaNumeric : <input type="alphanumaric" name="an" onkeypress="return validateAlphaNumericKey(event)"/>
Alphabetic : <input type="text" name="fname" onkeypress="return validateAlphabeticKey(event)" />

PHP Script to read doc file

<?php
function parseWord($userDoc)
{
    $fileHandle = fopen($userDoc, "r");
    $line = @fread($fileHandle, filesize($userDoc));  
    $lines = explode(chr(0x0D),$line);
    $outtext = "";
    foreach($lines as $thisline)
      {
        $pos = strpos($thisline, chr(0x00));
        if (($pos !== FALSE)||(strlen($thisline)==0))
          {
          } else {
            $outtext .= $thisline." ";
          }
      }
     $outtext = preg_replace("/[^a-zA-Z0-9\s\,\.\-\n\r\t@\/\_\(\)]/","",$outtext);
    return $outtext;
}

$userDoc = "aa.doc";

$text = parseWord($userDoc);
echo $text;
?>

PHP Script to remove directory from project

function delete_directory($dirname) {
   if (is_dir($dirname))
      $dir_handle = opendir($dirname);
   if (!$dir_handle)
      return false;
   while($file = readdir($dir_handle)) {
      if ($file != "." && $file != "..") {
         if (!is_dir($dirname."/".$file))
            unlink($dirname."/".$file);
         else
            delete_directory($dirname.'/'.$file);   
      }
   }
   closedir($dir_handle);
   rmdir($dirname);
   return true;
}
         delete_directory("first directory");

apply browserwise css

.top_search {
margin-top:-11px;
* margin-top:-2px;          ////////for IE 7
margin-left:95px;
/*width:170px;*/
width:107px;
padding-left:10px;
background:transparent;
border:0px;

}
///// this is for google chrome css /////////////
@media screen and (-webkit-min-device-pixel-ratio:0) {
.top_search
{
    margin-top:-13px;
}
}


input[type='submit'].top_submit {
margin:-12px 0 0 ;
margin-left:-5px \9; /////////////this is for IE 8///////////
margin-top:-2px \9;
padding:0px;
border:none;
outline:none;
background:transparent url(../images/search_submit.png) no-repeat scroll center top;
width:18px;
height:18px;position:absolute;
}

PHP Script to calculate date after 10 days

// date to calcaulate after 30 days//
//echo date('Y-m-d',strtotime($date."+30 days"));die;

Checkall code with confirm delete javascript example

Checkall Code for javascript

Show hide div through jquery

<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $("#hide").click(function(){
    $("p").hide();
  });
  $("#show").click(function(){
    $("p").show();
  });
});
</script>
</head>
<body>
<p>If you click on the "Hide" button, I will disappear.</p>
<button id="hide">Hide</button>
<button id="show">Show</button>
</body>
</html>

Javascript settimeout example

Javascript Set Timeout

Resize image and create thumbnail

<?php
function fnCreatThumbnail($strSourcePath,$strFilename,$strDestinationPath,$intGetWidth)
{
    $info = pathinfo($strSourcePath);
    if ( strtolower($info['extension']) == 'jpg') {$img = imagecreatefromjpeg( "{$strSourcePath}");}
    elseif ( strtolower($info['extension']) == 'gif'){$img = imagecreatefromgif( "{$strSourcePath}");}
    elseif ( strtolower($info['extension']) == 'png'){$img = imagecreatefrompng( "{$strSourcePath}");}
    $width = imagesx( $img );
    $height = imagesy( $img );
   
    $new_width = $intGetWidth;
    $new_height = floor( $height * ( $intGetWidth / $width ) );

    $tmp_img = imagecreatetruecolor($new_width, $new_height);
   
    imagecopyresized( $tmp_img, $img, 0, 0, 0, 0, $new_width, $new_height, $width, $height );
   
    if(strtolower($info['extension']) == 'jpg'){imagejpeg($tmp_img,"{$strDestinationPath}{$strFilename}");}
    elseif(strtolower($info['extension']) == 'gif'){imagegif( $tmp_img, "{$strDestinationPath}{$strFilename}");}
    elseif(strtolower($info['extension']) == 'png'){imagepng( $tmp_img, "{$strDestinationPath}{$strFilename}");}
}
if($_REQUEST["btnSubmit"])
{
    $type = $_FILES['file']['type'];
    if(($type=="image/gif")||($type=="image/jpeg"))
    {
        move_uploaded_file($_FILES['file']['tmp_name'],'upload/'.$_FILES['file']['name']);
        $origional_image_path = "upload/".$_FILES['file']['name'];
        $strFilename = $_FILES['file']['name'];
        $strDestinationPath = "thumbnail/".$strFilename;
        fnCreatThumbnail($origional_image_path,$strFilename,$strDestinationPath,100);   
    }
    else
    {
        echo "Invalid value";
    }
}

?>
<html>
<body>
<form action="index.php" method="post" enctype="multipart/form-data">
<input type="file" name="file">
<input type="submit" name="btnSubmit" value="Submit">
</form>
</body>
</html>

Upload image by Resize both side and display center of content

<?php
function fnCreatBigThumbnail($strSourcePath,$strFilename,$strDestinationPath,$intGetWidth,$intGetHeight)
{
    $strSourcePath = $strSourcePath.$strFilename;
    $info = pathinfo($strSourcePath);
    if (strtolower($info['extension']) == 'jpg') {$img = imagecreatefromjpeg( "{$strSourcePath}");}
    elseif(strtolower($info['extension']) == 'gif'){$img = imagecreatefromgif( "{$strSourcePath}");}
    elseif(strtolower($info['extension']) == 'png'){$img = imagecreatefrompng( "{$strSourcePath}");}
   
    $intNewWidth = $intOrigionalWidth = imagesx( $img );
    $intNewHeight = $intOrigionalHeight = imagesy( $img );
   
    if($intOrigionalWidth > $intGetWidth)
    {
        $intNewWidth = $intGetWidth;
        $intNewHeight = (($intOrigionalHeight * $intGetWidth)/$intOrigionalWidth);
    }
    if($intNewHeight > $intGetHeight)
    {
        $intNewHeight = $intGetHeight;
        $intNewWidth = (($intOrigionalWidth * $intGetHeight)/$intOrigionalHeight);
    }

    $tmp_img = imagecreatetruecolor($intGetWidth,$intGetHeight);
    $strWhiteBackground = imagecolorallocate($tmp_img, 255, 255, 255);
    imagefill($tmp_img, 0, 0, $strWhiteBackground);
   
    $floatWhiteWidth = (($intGetWidth - $intNewWidth)/2);
    $floatWhiteHeight = (($intGetHeight - $intNewHeight)/2);
   
    imagecopyresized( $tmp_img, $img, $floatWhiteWidth, $floatWhiteHeight, 0, 0, $intNewWidth, $intNewHeight, $intOrigionalWidth, $intOrigionalHeight );
   
    if(strtolower($info['extension']) == 'jpg'){imagejpeg($tmp_img,"{$strDestinationPath}{$strFilename}");}
    elseif(strtolower($info['extension']) == 'gif'){imagegif( $tmp_img, "{$strDestinationPath}{$strFilename}");}
    elseif(strtolower($info['extension']) == 'png'){imagepng( $tmp_img, "{$strDestinationPath}{$strFilename}");}
}
if(isset($_REQUEST["submit"]))
{
    $type = strtolower($_FILES['file']['type']);
    if(($type=="image/gif")||($type=="image/jpeg") ||($type=="image/png") ||($type=="image/jpeg"))
    {
        move_uploaded_file($_FILES['file']['tmp_name'],'upload/'.$_FILES['file']['name']);
        $strSourcePath = "upload/";
        $strFilename = $_FILES['file']['name'];
        $strDestinationPath = "resize/";
        fnCreatBigThumbnail($strSourcePath,$strFilename,$strDestinationPath,935,440);
    }
    else
    {
        echo "Invalid value";
    }
}   
?>
<form name="frm" action="index.php" method="post" enctype="multipart/form-data">
    <input type="file" name="file"  />
    <input type="submit" name="submit" value="Save" />
</form>

display map in iframe like sis

<iframe width="285" height="200" frameborder="0" scrolling="no" marginheight="0" marginwidth="0"
src="http://maps.google.co.in/maps?source=s_q&amp;hl=en&amp;geocode=&amp;q=Sankhala+Info+Solutions,+F-33,+Amenity+Center,+Udhana+Bus+Depo,+Udhana-Navsari+Main+Rd,&amp;aq=0&amp;sll=21.125498,81.914063&amp;sspn=42.891601,56.513672&amp;vpsrc=6&amp;ie=UTF8&amp;hq=Sankhala+Info+Solutions,+F-33,+Amenity+Center,+Udhana+Bus+Depo,+Udhana-Navsari+Main+Rd,&amp;hnear=Udhana+Zone,+Surat,+Gujarat&amp;ll=21.109609,72.862124&amp;spn=0.073774,0.049263&amp;t=m&amp;output=embed"></iframe>
<br />
<small>
<a href="http://maps.google.co.in/maps?source=embed&amp;hl=en&amp;geocode=&amp;q=Sankhala+Info+Solutions,+F-33,+Amenity+Center,+Udhana+Bus+Depo,+Udhana-Navsari+Main+Rd,&amp;aq=0&amp;sll=21.125498,81.914063&amp;sspn=42.891601,56.513672&amp;vpsrc=6&amp;ie=UTF8&amp;hq=Sankhala+Info+Solutions,+F-33,+Amenity+Center,+Udhana+Bus+Depo,+Udhana-Navsari+Main+Rd,&amp;hnear=Udhana+Zone,+Surat,+Gujarat&amp;ll=21.109609,72.862124&amp;spn=0.073774,0.049263&amp;t=m" style="color:#0000FF;text-align:left">View Larger Map</a>
</small>

PHP in_array example

<?php
$people = array("1", "2", "3", "4", "5");
//$people = array(1,2,3,4,5);
?>
<select name="ad" multiple="multiple" style="height:100px;width:100px;">
<option value="0">Select Value</option>
<?php
for($intI=0;$intI<5;$intI++)
{
if(in_array($intI,$people))
{
    $selected = "selected='selected'";
}
?>
    <option value="<?php echo $intI;?>" <?php echo $selected;?>><?php echo $intI;?></option>
<?php
}
?>
</select>

PHP Show current temprature of city through zipcode

<?php echo "NOTE : Please on curl library from php.ini file";?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Yahoo! Weather API RSS</title>
<?php
function retrieveYahooWeather($zipCode="394230") {
    $yahooUrl = "http://weather.yahooapis.com/forecastrss";
    $yahooZip = "?p=$zipCode";
    $yahooFullUrl = $yahooUrl . $yahooZip;
    $curlObject = curl_init();
    curl_setopt($curlObject,CURLOPT_URL,$yahooFullUrl);
    curl_setopt($curlObject,CURLOPT_HEADER,false);
    curl_setopt($curlObject,CURLOPT_RETURNTRANSFER,true);
    $returnYahooWeather = curl_exec($curlObject);
    curl_close($curlObject);
    return $returnYahooWeather;
}
$localZipCode = "07306"; // Lake Arrowhead, CA
$weatherXmlString = retrieveYahooWeather($localZipCode);
$weatherXmlObject = new SimpleXMLElement($weatherXmlString);
$currentCondition = $weatherXmlObject->xpath("//yweather:condition");
$currentTemperature = $currentCondition[0]["temp"];
$currentDescription = $currentCondition[0]["text"];
?>
</head>
<body>
<ul>
    <li>Current Temperature: <?=$currentTemperature;?>&deg;F</li>
    <li>Current Description: <?=$currentDescription;?></li>
</ul>
</body>
</html>