Monday, December 20, 2010

Testing credit card numbers list

List of credit card numbers to test for web developers.

Here is the sample credit card numbers to test

List of Credit Card numbers

Sunday, December 19, 2010

Delete virus from pen drive or computer without antivirus

Remove virus from pen drive or computer. This is nice trick to remove virus from your removable device or computer without anti-virus.

This will feature:
Delete .exe virus file from pen drive or computer.
Delete .ini virus file from pen drive or computer.
Delete desktop.exe virus file from pen drive or computer.
Delete newfolder.exe virus file from pen drive or computer.

Follow the steps below:

Go to virus place.
Create a notepad file and drag and drop all virus files into the notepad.
Now delete the content of the notepad.
Save the notepad.
Now you can able to delete undeletable virus file.

Friday, December 17, 2010

List tables used by stored procedures in mysql

List tables used inside the stored procedures in MySQL


SELECT IT.TABLE_NAME

FROM INFORMATION_SCHEMA.ROUTINES IR

JOIN INFORMATION_SCHEMA.TABLES IT ON

IR.ROUTINE_DEFINITION LIKE BINARY CONCAT("%", IT.TABLE_NAME, "%")

WHERE TABLE_SCHEMA = 'DATABASE_NAME' AND IR.ROUTINE_NAME IN

('PROCEDURE_NAME1', 'PROCEDURE_NAME2')

GROUP BY IT.TABLE_NAME;

Add fields to joomla registration form

Here you can find " How to add fields to joomla registration form "

Adding fields to joomla registration form is very simply. Follow the below steps.
Here steps to joomla registration form add fields:

Step 1:

Explore joomla database in phpMyadmin or in any GUI tool for the RDBMS MySQL
go to table jos_users and add your column in an appropriate place.

Step 2:

go to "libraries -> joomla -> user" from the root directory of joomla

open user.php and find existing variables of jos_users table like $id, $name, $email etc.

and insert the fields that you want to add in an appropriate place between the variables.

and Below find a check() function, add the validation for you filed under that function, if needed.

Step 3:

Now go to
"components -> com_user -> views -> register -> tmpl" from the root directory of joomla

open default.php and add your HTML element like textbox or dropdown whatever under the table.

Now it's done.

Tuesday, December 7, 2010

Learn Mysqli with PHP

Learn PHP - Mysqli


http://www.rvdavid.net/using-stored-procedures-mysqli-in-php-5/

Friday, December 3, 2010

PHP result set to multi select options

PHP Array result set into category wise multi select.


public function FormatEducationOnJobApplicants($Education, $SelectedEducation = '')
{
$EducationCategory = array();
$Select = '';
$OptGroup = '';
foreach($Education as $Row)
{
if(!in_array($Row['EducationCategory'], $EducationCategory))
{
if($OptGroup != '')
{
$Select .= "";
}
array_push($EducationCategory, $Row['EducationCategory']);
$Select .= "";
$OptGroup = $Row['EducationCategory'];
}
if(is_array($SelectedEducation))
{
$Select .= "";
}
else
{
$Select .= "";
}
}
if($OptGroup != '')
{
$Select .= "
";
}
return $Select;
}

Thursday, November 11, 2010

Wednesday, November 10, 2010

PHP Object Buffering ob_start() and ob_flush()

PHP Object Buffering

bool ob_start ( [callback output_function])
bool ob_end_flush ( void )
bool ob_end_clean ( void )

There are two ways to start buffering output:
through a setting in php.ini to enable output
buffering for all scripts, or by using a function
call on a script-by-script basis. Surprisingly,
the latter is preferred - it makes your code
more portable, and also gives you greater flexibility.

To create a new output buffer and start
writing to it, call ob_start(). There are
two ways to end a buffer, which are ob_end_flush()
and ob_end_clean() - the former ends the buffer
and sends all data to output, and the latter ends
the buffer without sending it to output.
Every piece of text outputted while an output
buffer is open is placed into that buffer
as opposed to being sent to output.
Consider the following script:

ob_start();
print "Hello First!\n";
ob_end_flush();

ob_start();
print "Hello Second!\n";
ob_end_clean();

ob_start();
print "Hello Third!\n";
?>

ob_start();
print "Hello First!\n";
ob_end_flush();

ob_start();
print "Hello Second!\n";
ob_end_clean();

ob_start();
print "Hello Third!\n";
?>



Reusing buffers



void ob_flush ( void )
void ob_clean ( void )

The functions ob_end_flush() and ob_end_clean()
are complemented by ob_flush() and ob_clean() -
these do the same jobs as their longer cousins,
with the difference that they do not end the output buffer.
We could rewrite the previous script like this:

ob_start();
print "Hello First!\n";
ob_flush();
print "Hello Second!\n";
ob_clean();
print "Hello Third!\n";
?>

This time the buffer is flushed but left open,
then cleaned and still left open, and finally
automatically closed and flushed by PHP as the
script ends - this saves creating and destroying
output buffers. Reusing buffers like this is
about 60% faster than opening and closing buffers
all the time, and is a smart move if you ever find
yourself in this situation.



Refer this page for more PHP buffering.

Wednesday, November 3, 2010

Wednesday, October 20, 2010

PHP convert or parse array to object and object to array

Convert array variable to object variable.


function parseArrayToObject($array) {
$object = new stdClass();
if (is_array($array) && count($array) > 0) {
foreach ($array as $name=>$value) {
$name = strtolower(trim($name));
if (!empty($name)) {
$object->$name = $value;
}
}
}
return $object;
}


For multidimensional array use the below function


function array2object($data) {
if(!is_array($data)) return $data;

$object = new stdClass();
if (is_array($data) && count($data) > 0) {
foreach ($data as $name=>$value) {
$name = strtolower(trim($name));
if (!empty($name)) {
$object->$name = array2object($value);
}
}
}
return $object;
}


Example of php array to object conversion.

$a = array (
'index_0' => 'value_0',
'index_1' => 'value_1'
);

$o = parseArrayToObject($a);

//-- Now you can use $o like this:
echo $o->index_0;//-- Will print 'value_0'



Now let see Object to array conversion.

function parseObjectToArray($object) {
$array = array();
if (is_object($object)) {
$array = get_object_vars($object);
}
return $array;
}


For multidimensional Object use the below function

function object2array($data){
if(!is_object($data) 66 !is_array($data)) return $data;

if(is_object($data)) $data = get_object_vars($data);

return array_map('object2array', $data);
}


Example of PHP Object to Array conversion.

$o = new stdClass();
$o->index_0 = 'value_0';
$o->index_1 = 'value_1';

$a = parseObjectToArray($o);

//-- Now you can use $a like this:
echo $a['index_0'];//-- Will print 'value_0'

Monday, October 11, 2010

Implode multidimensional array in PHP

implode PHP multidimensional Array into string

Code :


public function ImplodePHPArray( $Char, $ArrayVal )
{
foreach( $ArrayVal as $Row )
{
if( is_array( $Row ) )
{
$FinalArray[] = $this -> ImplodePHPArray( $Char, $Row );
}
else
{
$FinalArray[] = $Row;
}
}
return implode( $Char, $FinalArray );
}


TESTING :

$Week = $ClassObj -> ImplodePHPArray('~^', $Week);
echo $Week;

PHP calculate days of week from monday to sunday given week number

Calculate week days in php, Find week days.

PHP Monday to Friday week days calculation

function week_from_monday($date) {
// Assuming $date is in format DD-MM-YYYY
list($day, $month, $year) = explode("-", $_REQUEST["date"]);

// Get the weekday of the given date
$wkday = date('l',mktime('0','0','0', $month, $day, $year));

switch($wkday) {
case 'Monday': $numDaysToMon = 0; break;
case 'Tuesday': $numDaysToMon = 1; break;
case 'Wednesday': $numDaysToMon = 2; break;
case 'Thursday': $numDaysToMon = 3; break;
case 'Friday': $numDaysToMon = 4; break;
case 'Saturday': $numDaysToMon = 5; break;
case 'Sunday': $numDaysToMon = 6; break;
}

// Timestamp of the monday for that week
$monday = mktime('0','0','0', $month, $day-$numDaysToMon, $year);

$seconds_in_a_day = 86400;

// Get date for 7 days from Monday (inclusive)
for($i=0; $i<7; $i++)
{
$dates[$i] = date('Y-m-d',$monday+($seconds_in_a_day*$i));
}

return $dates;
}


OUTPUT

Array
(
[0] => 2008-10-06
[1] => 2008-10-07
[2] => 2008-10-08
[3] => 2008-10-09
[4] => 2008-10-10
[5] => 2008-10-11
[6] => 2008-10-12
)

Wednesday, September 22, 2010

Capture image through webcam and upload to server - PHP code

PHP Code for capture photo through web cam and save into your server.

take a snap through web cam and save into your database(DB)...

Source...

PHP code to capture image through webcam

PHP api to capture image through webcam.

PHP code for image capture.

download here...

real time testing page

Wednesday, September 15, 2010

CSS Compatibility and Internet Explorer

CSS Compatibility and Internet Explorer

With each new release of Windows Internet Explorer, support for the Cascading Style Sheets (CSS) standard has steadily improved. Internet Explorer 6 was the first fully CSS, Level 1-compliant version of Internet Explorer. Windows Internet Explorer 8 is fully compliant with the CSS, Level 2 Revision 1 (CSS 2.1) specification and supports some features of CSS Level 3 (CSS 3).

If your Web site targets browsers that include earlier versions of Internet Explorer, you want to know the level of CSS compliance for those versions. This article provides an at-a-glance look at CSS compliance across recent versions of Internet Explorer, including support in Internet Explorer 8.

More...

Friday, September 3, 2010

Remove tag without value from html element

Remove tag without value from HTML element and display only value of the Tag.

use the below function to remove the tag from HTML element.

function removeHTMLTags()
{

if(document.getElementById && document.getElementById("input-code"))
{
var strInputCode = document.getElementById("input-code").innerHTML;

/*
This line is optional, it replaces escaped brackets with real ones,
i.e. < is replaced with < and > is replaced with >
*/
strInputCode = strInputCode.replace(/&(lt|gt);/g, function (strMatch, p1){
return (p1 == "lt")? "<" : ">";
});

var strTagStrippedText = strInputCode.replace(/<\/?[^>]+(>|$)/g, "");
alert("Output text:\n" + strTagStrippedText);
// Use the alert below if you want to show the input and the output text
// alert("Input code:\n" + strInputCode + "\n\nOutput text:\n" + strTagStrippedText);
}

}

JQuery live focus and live blur bug fixing code

JQuery focus and blur event does not work with JQuery live event handler.

Here the solution for that. Just add the below code in you JQuery file or your java script file at the end.

and call your event like

$("Element").live("blur", function(){
// Your code goes here...
});

JQuery Blur and Focus code you need to add is here...

/****************************************************
JQUERY BLUR AND FOCUS EVENTS BUG FIXING CODE
****************************************************/

(function(){

var special = jQuery.event.special,
uid1 = 'D' + (+new Date()),
uid2 = 'D' + (+new Date() + 1);

jQuery.event.special.focus = {
setup: function() {
var _self = this,
handler = function(e) {
e = jQuery.event.fix(e);
e.type = 'focus';
if (_self === document) {
jQuery.event.handle.call(_self, e);
}
};

jQuery(this).data(uid1, handler);

if (_self === document) {
/* Must be live() */
if (_self.addEventListener) {
_self.addEventListener('focus', handler, true);
} else {
_self.attachEvent('onfocusin', handler);
}
} else {
return false;
}

},
teardown: function() {
var handler = jQuery(this).data(uid1);
if (this === document) {
if (this.removeEventListener) {
this.removeEventListener('focus', handler, true);
} else {
this.detachEvent('onfocusin', handler);
}
}
}
};

jQuery.event.special.blur = {
setup: function() {
var _self = this,
handler = function(e) {
e = jQuery.event.fix(e);
e.type = 'blur';
if (_self === document) {
jQuery.event.handle.call(_self, e);
}
};

jQuery(this).data(uid2, handler);

if (_self === document) {
/* Must be live() */
if (_self.addEventListener) {
_self.addEventListener('blur', handler, true);
} else {
_self.attachEvent('onfocusout', handler);
}
} else {
return false;
}

},
teardown: function() {
var handler = jQuery(this).data(uid2);
if (this === document) {
if (this.removeEventListener) {
this.removeEventListener('blur', handler, true);
} else {
this.detachEvent('onfocusout', handler);
}
}
}
};

})();


Now Call your blur / focus event

JQuery new features added in JQuery 1.4

Some good new features added in JQuery 1.4
JQuery features

Monday, August 23, 2010

Windows 7 desktop.ini bug fixing

Fix desktop.ini bug from windows 7. Remove desktop.ini file from windows 7 installed. Remove desktop.ini file from DVD drive.

Complete solution here...

Access blocked websites by proxy server or some other server

Access blocked websites by proxy server or some other server in your office or college or school.

Access your site from here...

Thursday, August 19, 2010

Clear internet activity history from your computer

To clear ur all internet activity history
go to RUN
Type inetcpl.cpl
then click ok
it will clear browsing history, cookies & offline data.

Learn Basics of Symfony

Learn Basics of Symfony

Symfony Basics

Friday, August 13, 2010

Monday, June 21, 2010

Find Ajax Request in a Page

To find ajax request we can use the below condition.

if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']))
{
//Ajax Code Here
die;
}

Sunday, May 30, 2010

Website Status Code or Error Codes Status

Web site error code status and their meaning

http://www.w3schools.com/tags/ref_httpmessages.asp

Thursday, March 18, 2010

Mysql Storage Engines

About Mysql storage engines :

ISAM

ISAM full form is Indexed Sequential Access Method, a method for indexing data for fast retrieval. ISAM was originally developed by IBM for mainframe computers.

Algorithm :



More about this ...


MyISAM :

MyISAM [full form] stands for Mysql Indexed sequential access method.

MySQL implements and extends ISAM as MyISAM.

-> MyISAM is a default storage engine for the MySQL relational database management system

-> MyISAM will not support transactions.

-> Additional inclusion from ISAM is referential integrity constraints, and higher concurrency.

More about MyISAM ...

Wednesday, March 17, 2010

Block websites on a local computer

Block websites on a local computer.

C:\WINDOWS\system32\drivers\etc\

filename hosts

edit like below


~~~~~~~~~~~~~~~~~~~~~~~

# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host

127.0.0.1 localhost
127.0.0.1 www.yahoo.com
127.0.0.1 www.yahoomail.com
127.0.0.1 www.mail.yahoo.com
127.0.0.1 www.gmail.com
127.0.0.1 www.orkut.com
127.0.0.1 www.naukri.com
127.0.0.1 www.monsterindia.com
127.0.0.1 www.rediffmail.com


~~~~~~~~~~~~~~~~~~~~~~~

Flex samples

Flex Sample applications

Flex samples

All in Flex with PHP

Flex with PHP

All in one for Flex

Learn flex with PHP

Flex with PHP


learn flex with PHP

Overview of flex with PHP

Complete flex concepts with php

Monday, March 15, 2010

How to remove username from gmail login page or Remove auto complete from web address

How to remove username from gmail login page or Remove auto complete from web address

Remove or disable auto complete from the web forms or web address in the browser and mail accounts

Turn it off and delete the auto-complete history

Wednesday, March 3, 2010

Change style of webpage scrollbar Advanced CSS features


ADVANCED CSS FEATURES:

CSS can be even used to change the appearance of the scroll bar at your right side. Unfortunately, that only works with IE. You have to be using IE in order for this to work. Here is how to change some appearances of your scroll bar:

The CSS statements for doing this are:
1) scrollbar-3dlight-color
2)scrollbar-arrow-color
3) scrollbar-base-color
4) scrollbar-dark shadow-color
5) scrollbar-face-color
6) scrollbar-highlight-color
7) scrollbar-shadow-color
8) scrollbar-track-color



BODY {
scrollbar-arrow-color: green;
scrollbar-face-color: #FFFFFF;
scrollbar-track-color: rgb(12,35,244);
}



How to customize your textboxes.
Here is the code on how to do it:



BODY {
scrollbar-arrow-color: green;
scrollbar-face-color: #FFFFFF;
scrollbar-track-color: rgb(12,35,244);
}
TEXTAREA {
scrollbar-arrow-color: green;
scrollbar-face-color: #FFFFFF;
scrollbar-track-color: rgb(12,35,244);
}



That above code, has some similarities. The textbox area is treated with the same function statements as for the scrollbar. The scrollbar statements goes in the BODY selector.

Solution for Reported Attack Site

Reported Attack Site!
This web site at "www.??????.com" has been reported as an attack site and has been blocked based on your security preferences.

Attack sites try to install programs that steal private information, use your computer to attack others, or damage your system.

Some attack sites intentionally distribute harmful software, but many are compromised without the knowledge or permission of their owners.

Solution:

good solutions

another solution

Flex builder cannot locate the required version of Flash Player. You might need to install Flash Player 9 or reinstall Flex Builder

Problem on Flex Builder with flash player on executing the MXML file...

Problem:
Flex builder cannot locate the required version of Flash Player. You might need to install Flash Player 9 or reinstall Flex Builder

solution:

solution to Flex builder cannot locate the required version of Flash Player. You might need to install Flash Player 9 or reinstall Flex Builder