Posts

Showing posts from 2011

How to overlap or overlay youtube video with html or How do I fix a YouTube flash video in iframe overlay problem on a ajax popup

How do I fix a YouTube flash video in iframe overlay problem on a ajax popup If you want to overlap or overlay youtube video with you html content or pop up And you having the problem that your pop up or html comes under the youtube video in your website and u had already tried too much code and all the unless so try this definitely this work Please follow the instruction it will definitely works four you... simple copy and paste this code in your header or top of iframe <script type="text/javascript"> $(document).ready(function() { $("iframe").each(function(){ var ifr_source = $(this).attr('src'); var wmode = "wmode=opaque"; if(ifr_source.indexOf('?') != -1) { var getQString = ifr_source.split('?'); var oldString = getQString[1]; var newString = getQString[0]; $(this).attr('src',newString+'?'+wmode+'&'+oldString); } else $(this).attr('src',ifr_source+'?'+wmode

How to convert a string for url? or How to remove space or any special chrecter from my string?

How to convert a string for url? How to remove space or any special chrecter from my string? or How to convert a string in without space and without special character. use this code and you will got  a string for url or add with + sign <?php function filter_text($name){ $name = htmlentities(stripslashes($name), ENT_QUOTES); $name = preg_replace('/[^a-z A-Z 0-9]/','+',$name); $filtered = str_replace(' ', '+', strtolower($name)); return $filtered; } ?> if you got twoo or three + in a string so u can use two times these lines $filtered1 = str_replace('++', '+',$filtered); $filtered2 = str_replace('++', '+',$filtered1); like <?php function filter_text($name){ $name = htmlentities(stripslashes($name), ENT_QUOTES); $name = preg_replace('/[^a-z A-Z 0-9]/','+',$name); $filtered = str_replace(' ', '+', strtolower($name)); $filtered1 = str_replace('++'

How to get Longitude and Latitude from an Address using PHP OR get lat long by address using php

How to get Longitude and Latitude from an Address using PHP OR  get lat long by address using php <?php $geocode=file_get_contents('http://maps.google.com/maps/api/geocode/json?address='india'+'noida'+'sector'+'63'+'&sensor=false'); $output= json_decode($geocode); $latitude = $output->results[0]->geometry->location->lat; $longitude = $output->results[0]->geometry->location->lng; ?> Use your lan long where you want...

How to check all chackbox onclick function via javascript

How to check all chackbox onclick function via javascript <script type="application/javascript"> function checkAllbox(array_with_id_values) {     for (var i = 0, ilen = array_with_id_values.length; i < ilen; i++)     {         document.getElementById(array_with_id_values[i]).checked = true;     } } </script> <a href="javascript:void(0)" onClick="checkAllbox(['a1','a2','a3'])">select all</a> Where a1,a2,a3 are different id checkbox

How to get the value of jquery response in a variable in jquery or call back function

How to get the value of jquery response in a variable in jquery and how to use call function. $('#datajquery').load('<?php echo $this->baseUrl ?>/yourpage.php',{ 'b_askprice1':b_askprice1}, function(data){ if(data != 'No result Found!'){ window.location.href = data; }else{ $('#filter_result').html(data); } }); in this code data will return you the response value via jquery and #filter_result is a id where you want to display your data and #datajquery is a hidden field id where you response data will be save to check the value

Google Maps - Simple Multiple Marker API

Google Maps - Simple Multiple Marker API Google map api multiple marker code <!DOCTYPE html> <html>  <head>    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />    <title>Google Maps Multiple Markers</title>    <script src="http://maps.google.com/maps/api/js?sensor=false"            type="text/javascript"></script> </head>  <body>   <div id="map" style="width: 500px; height: 400px;"></div>   <script type="text/javascript">     var locations = [       ['sagar', -33.890542, 151.274856, 4],       ['Coogee Beach', -33.923036, 151.259052, 5],       ['Cronulla Beach', -34.028249, 151.157507, 3],       ['Manly Beach', -33.80010128657071, 151.28747820854187, 2],       ['Maroubra Beach', -33.950198, 151.259302, 1]     ];     var map = new google.maps.Map(document.getElementById('ma

How to configure url redirection in apache in xampp OR enabling mod rewrite in xampp

To configure url redirection in apache in xampp Or enabling mod rewrite in xampp You should follow these steps for enabling mod rewrite in xampp To enable mod_rewrite in xampp first go to the directory of installation <xampp-directory>\apache\conf   and edit httpd.conf . Find the line which contains #LoadModule rewrite_module modules/mod_rewrite.so uncomment this line means remove hash(#) front of this line (should be): LoadModule rewrite_module modules/mod_rewrite.so Also find AllowOverride None  Should be: AllowOverride All I really think it appears 2 or 3 times on the configuration file. Happy xampping!

how to get middle value from a string in excel or find value between two character or word?

IF you want to get middle value from a string in excel or find value between two character or word? Let ... If the value is  32000=1=10.44|32000=12=7.64|3200 and you want to get "10.44" value It is little bit long way but you can get exact result... First you should use =MID(A1,2,2)     This formula it will return you a string like =MID(A1,9,10) where 9 is the value where you want to start to select value and 10 is that how much character you want to put It will return something like this "10.44|3200" Now you  in other colon use this code for last result =LEFT(B1,FIND("|",B1,1)-1) Use this formula it will return you your value which you want to get like: 10.44

How Do I Determine If A Value In One Column Exists In Another Column? - Excel

How Do I Determine If A Value In One Column Exists In Another Column ? - Excel If you want to know that the value of first column exist in second column in  excel so So place at first column which data you want to check and place in second column which will you compare first column data. Now paste this code in  3rd colum.... =IF(ISNA(VLOOKUP(A1,$B$1:$B$600,1,FALSE)),"","Yes") Simply paste this code and if exist so it will return yes in front of that column.... 

How to get a date before or after 7 days from the current date using php programming?

getting a date before 7 days using php programming here is the code of to getting the date of 7 days before simply copy and paste this code on your page and and run this file on browser. <?php $m= date("m"); // Month value $de= date("d"); //today's date $y= date("Y"); // Year value echo date('Y-m-d', mktime(0,0,0,$m, ($de-7) ,$y)); ?> Note: You can change the diffrence  of date by changing the  " ($de-7)" 7 number to get  according yourself. you can also get a date after 7 days from the current date <?php $m= date("m"); // Month value $de= date("d"); //today's date $y= date("Y"); // Year value echo date('Y-m-d', mktime(0,0,0,$m, ($de+7) ,$y)); ?> Note: You can change the diffrence  of date by changing the  " ($de+7)" 7 number to get  according yourself.

How to edit footer or modified footer in magento?

Want to edit footer or modified footer in magento follow these steps For the frontend: app\design\frontend\default\default\template\page\html\footer.phtml For the backend: (If you want to edit footer in back end): app\design\adminhtml\default\default\template\page\footer.phtm You can find here head file, breadcrumbs file to change different static contant.

How to remove or change index.php from url in magento

you want to remove or change index.php from url in magento through admin and by page so please follow this steps.... i m sure it will work for you example: http://website.com/index.php/category to http://website.com/category then use the following steps 1) Login to admin section by using the URL http://websitecom/index.php/admin 2) then go to “System >>  Configuration >>Web >> Search Engines Optimization” Use Web Server Rewrites : YES 3) Go to “System >>  Configuration >>Web >>Secure” Use secure URL Frontend: YES 4)Then create the .htaccess file under your the magento installed folder. If the magento installed under document root ( /home/username/public_html) then add follogig rules into .htaccess  file <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> and

Setting Up Google Checkout or How to set Google Checkout?

Setting up Google Checkout ADMIN > Configuration > Sales > Google API > Google Checkout Overview Magento Go allows you to integrate your store with Google Checkout. With Google Checkout, customers can pay for purchases in their shopping cart using the Google Checkout payment processing system. For field descriptions, see Configuration: Google API - Google Checkout . Step 1: Open a Google Checkout Merchant Account The first step is to establish a Google Checkout merchant account. As you go through the process, take note of the following information, which you will need to complete the configuration in Magento Go: Merchant ID Merchant Key For more information about opening a Google Checkout merchant account for your Magento Go store, see the Google Checkout website . Step 2: Configure Google Checkout in Magento Go From the Admin panel, select System > Configuration . From the Configuration panel on the left, under Sales, select the Google API tab. Expand th

How to change or rename all file name in a folder in php?

If you want change or rename All file name or all images name in a folder so you can use this code and manipulate this code according to your need. <?php if ($handle = opendir('foldername1/')) {     echo "Directory handle: $handle\n";     echo "Files:\n";     /* This is the correct way to loop over the directory. */     while (false !== ($file = readdir($handle))) {     echo $file;    $newnameArr=explode('.',$file);// make sure in your file name there should not be . (full stop in File Name )     $Change_imageName = "yourchangename".$newnameArr[1];        echo $Change_imageName.'<p></p>';     rename( "foldername1/$file","foldername2/$Change_imageName");     }     closedir($handle); } ?> Note=> Where "Foldername1" is that folder where is images place now And "Foldername2" is that folder where images will take place after rename or change the filename. F

How to read all file name in a folder in php?

Read all file name in folder or Directory Here is the script which will return you all file name from a folder or Directory <? if ($handle = opendir ('cartColor-60-75/')) {     echo "Directory handle: $handle\n";     echo "Files:\n";     /* This is the correct way to loop over the directory. */     while (false !== ($file = readdir ($handle))) {         echo "$file";         echo '<p></p>';     }     /* This is the WRONG way to loop over the directory. */     while ($file = readdir($handle)) {         echo "$file<br/>";     }     closedir($handle); } ?>

How to get a string in excel with only first letter is capital and rest of string in small letter?

This code will give the right string in excel . In string First letter will be capital letter and rest of string will be in small letter. try this really works..... = UPPER (LEFT(A1,1))&LOWER(RIGHT(A1,LEN(A1)-1))

php interview question for 1-2 year experience

PHP-Mysql Interview Questions Q:1 How can we submit a form without a submit button? A:1 The main idea behind this is to use Java script submit() function in order to submit the form without explicitly clicking any submit button. You can attach the document.formname.submit() method to onclick, onchange events of different inputs and perform the form submission. you can even built a timer function where you can automatically submit the form after xx seconds once the loading is done (can be seen in online test sites). Q:2 In how many ways we can retrieve the data in the result set of MySQL using PHP? A:2 You can do it by 4 Ways 1. mysql_fetch_row. 2. mysql_fetch_array 3. mysql_fetch_object 4. mysql_fetch_assoc Q:3 What is the difference between mysql_fetch_object and mysql_fetch_array? A:3 mysql_fetch_object() is similar to mysql_fetch_array() , with one difference - an object is returned, instead of an array. Indirectly, that means that you can only

how to get the value of string between two word or charecter in string?

this function will return you the word or phrase in string which will come between two word or cherecter. function get_string_between($string, $start, $end) {     $string = " ".$string;     $ini = strpos($string,$start);     if ($ini == 0) return "";     $ini += strlen($start);     $len = strpos($string,$end,$ini) - $ini;     return substr($string,$ini,$len); } where $string is a string. $start is left word. $end is right word.

How to check if a string starts with a particular character in PHP?

You can use the substr  function in php and find the first character is exist in string or not if ( substr ( '_abcdef' , 0 , 1 ) === '_' ) { ... }

convert 10 digit timestamp to readable format in mysql

SELECT * , UNIX_TIME ( submitdate ) You should use  UNIX_TIME () function in mysql to convert timestamp to readable form

how to validate image extention by javascript?

function validate() {     var filename = document.getElementById("pimage").value;            if(filename!='')         {         var ext = getExt(filename);         if(ext == "jpg" || ext == "jpeg" || ext == "gif" || ext == "png" || ext == "")         return true;         alert("Please upload image files only.");         return false;         }     }        function getExt(filename)     {         var dot_pos = filename.lastIndexOf(".");         if(dot_pos == -1)             return "";         return filename.substr(dot_pos+1).toLowerCase();     } }

How to find a string in current Url?

If u want to check a string in current url. So go through this note: strpos($_SERVER['REQUEST_URI']); example: if(strpos($_SERVER['REQUEST_URI'],"userprofile")!==false) { Echo “profile.php” } Where $_SERVER['REQUEST_URI'] use for get the current url

How To get the url of last page in php?

In php to find the url of last page on a current page. You should use “$_SERVER['HTTP_REFERER']” $lastPageUrl = $_SERVER['HTTP_REFERER'];

How to increase the time of execution or Fatal error: Maximum execution time of 60 seconds exceeded

Sometimes execution of my $command lasts too long and after 1min it stop execution and i receive this error: Copy and paste the at the top or of your file which file you are running; ini_set('max_execution_time', 0); Setting it to 0 will make your script run forever according to the documentation of the ini-directive .

load() – jQuery API or how to use load function of jquery?

$('#likediv').load('ajax/like-updates.php',{ 'category':cat ,'type_id': typeid,'user_id': userid}); Example : function likeEvent(cat,typeid,userid) { $('#likediv').load('ajax/like-updates.php',{ 'category':cat ,'type_id': typeid,'user_id': userid}); } Note:   #like => div is a id of div where you will want to show your data. load => is a function where we gave path of a file where calculation takes place. { 'category':cat ,'type_id': typeid,'user_id': userid} => in braces we pass the parameter like there are passing 3 parameter Finally we can call a this function on any event

ul li horizontal css menu?

How to create ul li horizontal menu for header in html <style> ul { list-style-type: none; margin: auto; } li { float:left;} </style> <ul> <li>Home |&nbsp; </li> <li>about us |&nbsp; </li> <li>Help </li> </ul>

google talk multiple login

google talk multiple login 1. Right-click on the desktop 2. Select New 3. Select Shortcut 4. Paste this into the text box: "c:\program files\google\google talk\googletalk.exe" /nomutex 5. Click Next . Name it whatever: Google Talk Multiple, etc. 7. Click OK until you are done

Time Zone Error in Cake php

PHP Warning:  strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date. timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Los_Angeles' for '-8.0/no DST' instead in C:\xampp\htdocs\cake_1_2\cake\libs\cache.php on line 429   Warning in cake to resolve this you have to follow this path. Yourfoldername/cake/libs/cache.php Open this file Press ctrl+g and go line no. 570 You will find the code like this if (!is_numeric($this->settings['duration'])) {           $this->settings['duration'] = strtotime($this->settings['duration']) - time();     }    return true; simply paste this code:    date_default_timezone_set('UTC'); Example: if (!is_numeric($this->settings['duration'])) {                                 d

how to Dreamweaver read the CakePHP Files or Opening CakePHP Files in Dreamweaver?

In cake php there are two type of file which is mostly used in cake php THTML and CTP Files. So in dreamweaver There are ultimately 3 files that you need to edit. Path of file is C:\Program Files\Adobe\Adobe Dreamweaver CS3\configuration Open this folder and Open up “Extensions.txt” and on the first line at the very end add THTML and CTP separated by commas, in this file there is line like this MASTER,THTML,CTP:All Documents Similarly add these two extensions to the “:PHP Files” line. PHP,PHP3,PHP4,PHP5,TPL,THTML,CTP:PHP Files Next open the “DocumentTypes” folder and edit the “MMDocumentTypes.xml” file, just open it up using notepad or wordpad. Search for the line which has an id “PHP_MySQL” and add the THTML/CTP file extensions to both the “winfileextension” and “macfileextension” so the line should read: 1. winfileextension="php,php3,php4,php5,thtml,ctp" 2. macfileextension="php,php3,php4,php5,thtml,ctp" The final file is another version of t

How to write a where query in cakephp?

write a where query in cakephp    $var = $this->module->find('all',array('conditions' =>array('name' => 'xyz')));    this->set('user',$var); Note:- where 'all' is putting all field from table; you can replace 'all' by single field name also; 'name => xyz' is condition of query in cake php; 'user' is a variable which you will use in view folder for a page; // example: foreach($user as $users) in index.php

How to setup a 301 Redirect in php

A 301 HTTP response status code is a way of telling search engines that a page, pages, directory or entire website has been permanently moved to another place on the web. This is very useful if you have changed the structure of your websites url’s or if you have moved domain. You can also redirect your entire site. Whereas a 301 code tells search engines that something has been permanently moved , a 302 code tells search engines that something has been temporarily moved . This is useful if you only want to redirect a page for a short period of time. To do a 302 redirect simply change the 301 part to 302. You can also use 303, which is means ’seeother’ and the page has been replaced by something else. Again, to do this simply substitute 301 with 303 in the tutorials below. How to setup a 301 Redirect The basic code for redirecting is : Redirect 301 old_location new_location   The old location of the file has to be the absolute path from the root of your server. The new

150 useful run commands

To Access… Run Command Accessibility Controls access.cpl Accessibility Wizard accwiz Add Hardware Wizard hdwwiz.cpl Add/Remove Programs appwiz.cpl Administrative Tools control admintools Adobe Acrobat (if installed) acrobat Adobe Designer (if installed) formdesigner Adobe Distiller (if installed) acrodist Adobe ImageReady (if installed) imageready Adobe Photoshop (if installed) photoshop Automatic Updates wuaucpl.cpl Bluetooth Transfer Wizard fsquirt Calculator calc Certificate Manager certmgr.msc Character Map charmap Check Disk Utility chkdsk Clipboard Viewer clipbrd Command Prompt cmd Component Services dcomcnfg Computer Management compmgmt.msc Control Panel control Date and Time Properties timedate.cpl DDE Shares d