Here is a list of dummy credit card number that can be used while testing your applications involving credit card transactions:
Visa: 4111-1111-1111-1111
verification number is 121
MasterCard: 5431-1111-1111-1111
Amex: 341-1111-1111-1111
Discover: 6011-6011-6011-6611
Credit Card Prefix Numbers:
Visa: 13 or 16 numbers starting with 4
MasterCard: 16 numbers starting with 5
Discover: 16 numbers starting with 6011
AMEX: 15 numbers starting with 34 or 37
Wednesday, March 31, 2010
Dummy Credit Card Numbers for Testing
Tuesday, March 30, 2010
How To Optimize Your Site With GZIP Compression
Compression is a simple, effective way to save bandwidth and speed up your site. I hesitated when recommending gzip compression when speeding up your javascript because of problems in older browsers.
But it’s 2007. Most of my traffic comes from modern browsers, and quite frankly, most of my users are fairly tech-savvy. I don’t want to slow everyone else down because somebody is chugging along on IE 4.0 on Windows 95. Google and Yahoo use gzip compression. A modern browser is needed to enjoy modern web content and modern web speed — so gzip encoding it is. Here’s how to set it up.
Wait, wait, wait: Why are we doing this?
Before we start I should explain what content encoding is. When you request a file like http://www.yahoo.com/index.
"How To Optimize Your Site With GZIP Compression"
- How To Optimize Your Site With GZIP Compression | BetterExplained (view on Google Sidewiki)
Wednesday, March 24, 2010
Mitch's list of really incredibly useful commands...
This thread is simply a list of commands that I use from time to time, which are really useful, but long enough that I won't remember them when I need them.
Please note: for the rename examples below to work, you must be using the Perl version of rename, such as the one included in Debian (and derivative) distributions. The Redhat Enterprise Linux version of rename is different and is almost useless.
Rename files to add leading zeros (in this case followed by a letter)
Code:
$rename -nv 's/^([1-9])([a-z])/0$1$2/' /mydir/*
note: remove the 'n' argument to actually change the filenames.
"This thread is simply a list of commands that I use from time to time, which are really useful, but long enough that I won't remember them when I need them.Please note: for the rename examples below to work, you must be using the Perl version of rename, such as the one included in Debian (and derivative) distributions. The Redhat Enterprise Linux version of rename is different and is almost useless.Rename files to add leading zeros (in this case followed by a letter)"
- Ithaca Free Software GNU Linux • View topic - Mitch's list of really incredibly useful commands... (view on Google Sidewiki)
A tabular summary of the regular expression (regexp) syntax in Perl with a collection of annotated examples.
Regular expressions in Perl
This document presents a tabular summary of the regular expression (regexp) syntax in Perl, then illustrates it with a collection of annotated examples.
"Regular expressions in Perl This document presents a tabular summary of the regular expression (regexp) syntax in Perl, then illustrates it with a collection of annotated examples."
- Regular expressions in Perl - a summary with examples (view on Google Sidewiki)
perlre, Perl Regular Expressions
NAME
perlre - Perl regular expressions
DESCRIPTION
This page describes the syntax of regular expressions in Perl. For a description of how to use regular expressions in matching operations, plus various examples of the same, see discussion of m//, s///, qr// and ?? in Regexp Quote-Like Operators.
The matching operations can have various modifiers. The modifiers that relate to the interpretation of the regular expression inside are listed below. For the modifiers that alter the way a regular expression is used by Perl, see Regexp Quote-Like Operators and Gory details of parsing quoted constructs.
"NAME perlre - Perl regular expressions DESCRIPTION This page describes the syntax of regular expressions in Perl. For a description of how to use regular expressions in matching operations, plus various examples of the same, see discussion of m//, s///, qr// and ?? in Regexp Quote-Like Operators. The matching operations can have various modifiers. The modifiers that relate to the interpretation of the regular expression inside are listed below."
- perlre - Perl regular expressions (view on Google Sidewiki)
Saturday, February 6, 2010
How to recursively go through all local or remote directories
Taken From: http://www.cyberciti.biz/tips/
You can use find command or recursdir command to recurse through local or remote directories to command/find files or create tar files.
recursdir command pass a C script to recursively perform operations on files. recursdir is an excellent tool for automatic stuff. It provides C style programming functions and statements such as:
* strncmp()
* exec()
* system()
* strstr()
* strcat()
* printf()
* popen()
* if ( expr ) { take-action }
* if ( expr ) { take-action } else { do-something-else; }
* /* comments */
* Detecting file types and macros
* All of the logical, arithmetic and bitwise C operators are supported. These are ( ) >= <= > < != == && || ! - + * / % & ^ and have the same meanings and precedences as in C. etc.
Install recursdir
recursdir is part of mirrordir package:
$ sudo apt-get install mirrordir
Recursively find file and take action
For example find out all *.bak file and delete them, using find command:
find /path/to/dir -iname "*bak" -exec rm {} \;
Following is a fast and overkill equivalent of find, using recursdir :
recursdir /path/to/dir -C 'exec("/bin/rm","-f",PATH);'
Find and print out all the *.CPP (C++) files on your system, enter (note usage of if and printf() C like syntax):
recursdir /path/to/dir -C 'if (!glob ("*.cpp", FILE)) printf ("%s\n", PATH);'
or
find /path/to/dir -iname "*.cpp"
Backup a remote ftp site to local tape:
This is my favorite command to mirror remote ftp tree:
recursdir ftp://user-name@ftp.server.
Write complex directory manipulation scripts
You can write complex scripts using recursdir. For example, following will removes all core files from your Linux 32 bit system:
recursdir / -C '
long l;
/* look for /proc */
if (strncmp (PATH, "/proc", 5)) {
if (S_ISREG (stat.st_mode) && !strcmp ("core", FILE)) {
if (strstr (popen ("file " + PATH), "ELF 32-bit LSB core")) {
l = l + stat.st_size;
printf ("removing: %s, cumu. total = %ldkB\n", PATH, l >> 10);
exec ("rm", "-f", PATH);
}
}
}'
recursdir offers many more advanced options such as encryption, backups compression and many more, please refer the man page for more information.
"How to recursively go through all local or remote directories"
- How to recursively go through all local or remote directories (view on Google Sidewiki)
Wednesday, May 14, 2008
Automating Processes by observing the Pattern
Here is just an example of ways in which one can automate processes.
I use Seagull Framework for developing faster, secure and feature rich Web based Applications Today, I had to update the Database to fill some blank columns in a table named sgl_permision
I first tried to edit them through the Seagull's Web based Admin Front end It was taking too long.
Then I tried to edit the same using phpMyAdmin setting the result to go to edit the next page instead of going back to the listing Page still it was very time consuming..
Then I decided to write SQL Queries by Observing the Pattern and using that to my rescue.
Here is the SQL Queries that I wrote to solve the Problem and am documenting so that it can be used in future.
/* To use a Manager */
UPDATE `sgl_permission`
SET `description` = CONCAT('Permission to use ', TRIM(TRAILING 'mgr' FROM `name`), ' Manager')
WHERE (`description` = '' OR `description` IS NULL)
AND `name` LIKE '%mgr'
/* To add a new entity */
UPDATE `sgl_permission`
SET `description` = CONCAT('Permission to add a new ', TRIM(LEADING 'admin' FROM TRIM(TRAILING 'mgr_cmd_add' FROM `name`)), ' through ', TRIM(TRAILING 'mgr_cmd_add' FROM `name`), ' Manager')
WHERE (`description` = '' OR `description` IS NULL)
AND `name` LIKE '%mgr\_cmd\_add'
/* To view the listing of entities */
UPDATE `sgl_permission`
SET `description` = CONCAT('Permission to view the listing of ', TRIM(LEADING 'admin' FROM TRIM(TRAILING 'mgr_cmd_list' FROM `name`)), '(s) through ', TRIM(TRAILING 'mgr_cmd_list' FROM `name`), ' Manager')
WHERE (`description` = '' OR `description` IS NULL)
AND `name` LIKE '%mgr\_cmd\_list'
/* To insert a new entity */
UPDATE `sgl_permission`
SET `description` = CONCAT('Permission to insert new ', TRIM(LEADING 'admin' FROM TRIM(TRAILING 'mgr_cmd_insert' FROM `name`)), ' through ', TRIM(TRAILING 'mgr_cmd_insert' FROM `name`), ' Manager in the Database')
WHERE (`description` = '' OR `description` IS NULL)
AND `name` LIKE '%mgr\_cmd\_insert'
/* To edit an existing entity */
UPDATE `sgl_permission`
SET `description` = CONCAT('Permission to edit an existing ', TRIM(LEADING 'admin' FROM TRIM(TRAILING 'mgr_cmd_edit' FROM `name`)), ' through ', TRIM(TRAILING 'mgr_cmd_edit' FROM `name`), ' Manager')
WHERE (`description` = '' OR `description` IS NULL)
AND `name` LIKE '%mgr\_cmd\_edit'
/* To update an existing entity in the database */
UPDATE `sgl_permission`
SET `description` = CONCAT('Permission to update an existing ', TRIM(LEADING 'admin' FROM TRIM(TRAILING 'mgr_cmd_update' FROM `name`)), ' through ', TRIM(TRAILING 'mgr_cmd_update' FROM `name`), ' Manager in the Database')
WHERE (`description` = '' OR `description` IS NULL)
AND `name` LIKE '%mgr\_cmd\_update'
/* To delete an entity */
UPDATE `sgl_permission`
SET `description` = CONCAT('Permission to delete ', TRIM(LEADING 'admin' FROM TRIM(TRAILING 'mgr_cmd_delete' FROM `name`)), '(s) through ', TRIM(TRAILING 'mgr_cmd_delete' FROM `name`), ' Manager from the Database')
WHERE (`description` = '' OR `description` IS NULL)
AND `name` LIKE '%mgr\_cmd\_delete'
/* To archive an entity */
UPDATE `sgl_permission`
SET `description` = CONCAT('Permission to archive ', TRIM(LEADING 'admin' FROM TRIM(TRAILING 'mgr_cmd_archive' FROM `name`)), '(s) through ', TRIM(TRAILING 'mgr_cmd_archive' FROM `name`), ' Manager in the Database')
WHERE (`description` = '' OR `description` IS NULL)
AND `name` LIKE '%mgr\_cmd\_archive'
/* To View an entity in detail */
UPDATE `sgl_permission`
SET `description` = CONCAT('Permission to view ', TRIM(LEADING 'admin' FROM TRIM(TRAILING 'mgr_cmd_view' FROM `name`)), ' through ', TRIM(TRAILING 'mgr_cmd_view' FROM `name`), ' Manager')
WHERE (`description` = '' OR `description` IS NULL)
AND `name` LIKE '%mgr\_cmd\_view'
/* To create a duplicate of an entity */
UPDATE `sgl_permission`
SET `description` = CONCAT('Permission to create a duplicate of ', TRIM(LEADING 'admin' FROM TRIM(TRAILING 'mgr_cmd_duplicate' FROM `name`)), ' through ', TRIM(TRAILING 'mgr_cmd_duplicate' FROM `name`), ' Manager')
WHERE (`description` = '' OR `description` IS NULL)
AND `name` LIKE '%mgr\_cmd\_duplicate'
/* To reorder entities */
UPDATE `sgl_permission`
SET `description` = CONCAT('Permission to reorder ', TRIM(LEADING 'admin' FROM TRIM(TRAILING 'mgr_cmd_reorder' FROM `name`)), '(s) through ', TRIM(TRAILING 'mgr_cmd_reorder' FROM `name`), ' Manager')
WHERE (`description` = '' OR `description` IS NULL)
AND `name` LIKE '%mgr\_cmd\_reorder'
/* To view an overview of an entities */
UPDATE `sgl_permission`
SET `description` = CONCAT('Permission to view an overview of ', TRIM(LEADING 'admin' FROM TRIM(TRAILING 'mgr_cmd_overview' FROM `name`)), '(s) through ', TRIM(TRAILING 'mgr_cmd_overview' FROM `name`), ' Manager')
WHERE (`description` = '' OR `description` IS NULL)
AND `name` LIKE '%mgr\_cmd\_overview'
/* To view a summary of an entity */
UPDATE `sgl_permission`
SET `description` = CONCAT('Permission to view an summary of ', TRIM(LEADING 'admin' FROM TRIM(TRAILING 'mgr_cmd_summary' FROM `name`)), '(s) through ', TRIM(TRAILING 'mgr_cmd_summary' FROM `name`), ' Manager')
WHERE (`description` = '' OR `description` IS NULL)
AND `name` LIKE '%mgr\_cmd\_summary'
/* To edit all entities */
UPDATE `sgl_permission`
SET `description` = CONCAT('Permission to edit all ', TRIM(LEADING 'admin' FROM TRIM(TRAILING 'mgr_cmd_editAll' FROM `name`)), '(s) through ', TRIM(TRAILING 'mgr_cmd_editAll' FROM `name`), ' Manager')
WHERE (`description` = '' OR `description` IS NULL)
AND `name` LIKE '%mgr\_cmd\_editAll'
/* To Update all entities */
UPDATE `sgl_permission`
SET `description` = CONCAT('Permission to update all ', TRIM(LEADING 'admin' FROM TRIM(TRAILING 'mgr_cmd_updateAll' FROM `name`)), '(s) through ', TRIM(TRAILING 'mgr_cmd_updateAll' FROM `name`), ' Manager')
WHERE (`description` = '' OR `description` IS NULL)
AND `name` LIKE '%mgr\_cmd\_updateAll'
/* Scan all Orphaned entities */
UPDATE `sgl_permission`
SET `description` = CONCAT('Permission to scan all Orphaned ', TRIM(LEADING 'admin' FROM TRIM(TRAILING 'mgr_cmd_scanOrphaned' FROM `name`)), '(s) through ', TRIM(TRAILING 'mgr_cmd_scanOrphaned' FROM `name`), ' Manager')
WHERE (`description` = '' OR `description` IS NULL)
AND `name` LIKE '%mgr\_cmd\_scanOrphaned'
/* Delete all Orphaned entities */
UPDATE `sgl_permission`
SET `description` = CONCAT('Permission to delete all Orphaned ', TRIM(LEADING 'admin' FROM TRIM(TRAILING 'mgr_cmd_deleteOrphaned' FROM `name`)), '(s) through ', TRIM(TRAILING 'mgr_cmd_deleteOrphaned' FROM `name`), ' Manager')
WHERE (`description` = '' OR `description` IS NULL)
AND `name` LIKE '%mgr\_cmd\_deleteOrphaned'
/* Scan to detect new Entities */
UPDATE `sgl_permission`
SET `description` = CONCAT('Permission to scan and detect for new ', TRIM(LEADING 'admin' FROM TRIM(TRAILING 'mgr_cmd_scanNew' FROM `name`)), '(s) through ', TRIM(TRAILING 'mgr_cmd_scanNew' FROM `name`), ' Manager')
WHERE (`description` = '' OR `description` IS NULL)
AND `name` LIKE '%mgr\_cmd\_scanNew'
/* To insert newly detected Entities */
UPDATE `sgl_permission`
SET `description` = CONCAT('Permission to insert new ', TRIM(LEADING 'admin' FROM TRIM(TRAILING 'mgr_cmd_insertNew' FROM `name`)), '(s) through ', TRIM(TRAILING 'mgr_cmd_insertNew' FROM `name`), ' Manager')
WHERE (`description` = '' OR `description` IS NULL)
AND `name` LIKE '%mgr\_cmd\_insertNew'