-
2010
-
June
-
Mysql: How to drop a Unique Constraint?
06/03/10
ALTER TABLE `test_table` DROP INDEX `subject`
where test_table is the table name and subject is the column name
-
Mysql: How to drop a Unique Constraint?
-
May
-
How to find world writable directories by "find" command?
05/15/10
find . -type d -perm -a+w -exec ls -lah {} \; > ww.txt -
perl - handling sigint
05/14/10
Write a small Perl program that waits for 30 seconds and exits with printing “Bye”. If interrupted by any key before 30 second then print “Hello” before exiting.
perl -e "$SIG{INT}= sub {print 'Hello';exit;};for ($i=0;$i<30;$i++){sleep 1;}; print 'bye';" -
Perl Important links
05/14/10
Remove repeated characters from a string - http://www.perlmonks.org/?node_id=353072
How to find and remove duplicate elements from an array? - http://www.perlmonks.org/?node_id=90493
perlfaqs - http://perldoc.perl.org/perlfaq4.html
perl references - http://www.sdsc.e -
Perl - Difference Between my local our
05/14/10
The variables declared with my() are visible only within the scope of the block which names them. They are not visible outside of this block, not even in routines or blocks that it calls.
local() variables, on the other hand, are visible to routines that are called from the block where t
-
How to find world writable directories by "find" command?
-
April
-
Windows 7: I want WinXP Style back
04/13/10
http://www.howtogeek.com/howto/windows- -
Windows7 How to add the Quicklaunch Toolbar
04/13/10
Right-click on an open area of the taskbar, and choose Toolbars \ New Toolbar from the menu.
You should probably also unlock the taskbar at this point.
paste the following path into the location bar:
%appdata%\Microsoft\Internet Explorer\Quick Launch
The normal Quick
-
Windows 7: I want WinXP Style back
-
March
-
opensubtitles.org oscar not working - resolved
03/22/10
http://trac.opensubtitles.org/projects/
change www.opensubtitles.org to api.subtitles.org in OSCAR's Preferences tab -
Find Joomla Module Positions
03/20/10
In Joomla there is a hidden core function which once activated displays a layer on a Joomla website which shows you exactly the template positions currently used.
To activate this function you just need to add ?tp=1 to the end of your current Joomla address. As an example take a lo
-
opensubtitles.org oscar not working - resolved
-
February
-
Duplicate a Table using Javascript
02/06/10
function addLocationRow() {
var nonpTbl = document.getElementById('tblLoc1');
var newRow = nonpTbl.cloneNode(true);
var tds = newRow.getElementsByTagName('td');
var currLen = parseInt(document.getElementById('total -
Duplicate a row using javascript
02/06/10
function addNonPhysicianRow() {
var nonpTbl = document.getElementById('NPTbl');
var trs = nonpTbl.getElementsByTagName('tr');
var len = trs.length - 1;
var lastRow = trs[len];
var newRow = lastRow.cloneNode(true); <
-
Duplicate a Table using Javascript
-
January
-
CS1010: Newline in Constant" Error Message - fixed
01/20/10
CS1010: Newline in Constant" Error Message
I got this error from asp.net application and here is the solution
Modify string as like
string strValue = "Test value";
string strAll = "<SCRIPT lanquage='JScript'>window
-
CS1010: Newline in Constant" Error Message - fixed
-
June
-
2009
-
December
-
iPhone Screen Orientation: Portrait and Landscape
12/15/09
http://www.evotech.net/blog/2009/09/iph -
Private Messaging System
12/13/09
http://www.pixel2life.com/publish/tutor
-
iPhone Screen Orientation: Portrait and Landscape
-
November
-
Page layout Ideas/JS/Flash
11/26/09
This is a living article and contains urls which I find interesting and Might incorporate one day into something.
1. http://www.marriott.com/default.mi
-
php quote in mysql like perl
11/23/09
mysql_real_escape_string()
<?php
// Connect
$link = mysql_connect('mysql_host', 'mysql_user', 'mysql_password')
OR die(mysql_error());
// Query
$query = sprintf("SELECT * FROM users WHERE user='%s' AND pass -
After Registration Email
11/19/09
$content = "
<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'
'http://www.w3.org/TR/html4/loose.dtd'>
<html>
<head>
<title>TotalESL</title>
<meta http-equiv='Content-Type' content='te -
PHP Sending Mail
11/19/09
Code below works without errors
<?php
$Name = "Da Duder"; //senders name
$email = "email@adress.com"; //senders e-mail adress
$recipient = "PersonWhoGetsIt@emailadress.com"; //recipient
$mail_body = "The text for the mail...&q -
PHP random password generator
11/19/09
<?php
function generatePassword($length=9, $strength=0) {
$vowels = 'aeuy';
$consonants = 'bdghjmnpqrstvz';
if ($strength & 1) {
$consonants .= 'BDGHJLMNPQRSTVWXZ';
}
if ($strength & 2) {
$vowels .= &quo -
PERL OOP - Destructors
11/17/09
If constructors can have arbitrary names, then why not destructors? Because while a constructor is explicitly called, a destructor is not. Destruction happens automatically via Perl's garbage collection (GC) system, which is a quick but somewhat lazy reference-based GC system. To know what to c -
PERL OOP - Inheritance
11/17/09
Like the special per-package variables recognized by Exporter (such as @EXPORT, @EXPORT_OK, @EXPORT_FAIL, %EXPORT_TAGS, and $VERSION), the @ISA array must be a package-scoped global and not a file-scoped lexical created via my(). Most classes have just one item in their @ISA array. In this case, we -
PERL OOP - Constructor
11/17/09
sub new {
my $self = {};
$self->{NAME} = undef;
$self->{AGE} = undef;
$self->{PEERS} = [];
bless ($self);
return $self;
} -
Autovivification
11/17/09
Autovivification is a distinguishing feature of the Perl programming language involving the dynamic creation of data structures. Autovivification is the automatic creation of a variable reference when an undefined value is dereferenced. In other words, Perl autovivification allows a programmer to re -
Left, Right, Inner Join
11/17/09
If I do a LEFT JOIN, I get all records that match in the same way and IN ADDITION I get an extra record for each unmatched record in the left table of the join - thus ensuring (in my example) that every PERSON gets a mention:
mysql> select name, phone, selling
from demo_people le -
Exporting symbols
11/17/09
There are rare occasions when you do want to export methods or variable names into the calling package. I only do this occasionally for static helper methods I need very, very often. In order to export symbols, inherit from the Exporter class and fill the @EXPORT array with the symbols you'd li -
Difference between 'use' and 'require'
11/17/09
USE
Imports some semantics into the current package from the named
module, generally by aliasing certain subroutine or variable
names into your package. It is exactly equivalent to
BEGIN { require Module; import Module LIST; }
except that Module *must* b -
Change Preferred language in Different Browsers
11/17/09
Firefox
1. Select menu [Tools]
2. Select menu item [Options].
3. Select tab [General].
4. Click button [Languages].
5. Click drop-down-box [Select a language to add..]
6. Mark a language e.g. English (United Ki -
GEO IP Database
11/11/09
http://ipinfodb.com/ip_database.php -
Perl Cookies
11/10/09
Adding a cookie
use CGI;
$query = new CGI;
$cookie = $query->cookie(-name=>'MY_COOKIE',
-value=>'BEST_COOKIE=chocolatechip',
-expires=>'+4h',
-path=>'/');
print $query->header(-cookie=>$ -
Perl get date time fast - localtime
11/08/09
my @postdate = localtime;
my $postdate = sprintf("%4d%02d%02d",$postdate[5]+1900,$postdate[4]+1,$postdate[3]);
-
Page layout Ideas/JS/Flash
-
October
-
Action script 2.0 Trim function
10/31/09
function mytrim(str : String) : String
{
var i = 0;
var j = 0;
for (i = 0; str.charCodeAt(i) < 33; i++);
for (j = str.length - 1; str.charCodeAt(j) < 33; j--);
return str.substring(i, j+1);
} -
Iphone useragent
10/31/09
in Firefox
about:config
general.useragent.override
Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A535b Safari/419.3 -
JavaScript Form Validation Script
10/30/09
very nice script
http://www.javascript-coder.com/html-fo
http://www.javascript-coder.com/html-fo -
Perl Email Validation
10/28/09
if ($email_address =~ /^(\w|\-|\_|\.)+\@((\w|\-|\_)+\.)+[a-zA-Z]{2,}$/)
{
print "$email_address is valid";
}
else {
print "$email_address is invalid";
}
-
Perl search n replace in place
10/28/09
perl -i.bak -p -e 's/old/new/g' filename -
mytrim
10/18/09
function myTrim(obj){
rt = obj.value;
//alert("rt = " + rt);
preRe = /^\s+/;
postRe = /\s+$/;
if(preRe.test(rt)){
//alert("pre");
-
Javascript setTimeOut
10/13/09
https://developer.mozilla.org/En/Window.setTimeout
var timeoutID = window.setTimeout(func, delay, [param1, param2, ...]);
var timeoutID = window.setTimeout(code, delay);
window.setTimeout('window.parent.generateOutput()', 1000);
function generateOutput(aConc -
perl quick file addentry
10/06/09
open TT, ">/tmp/teeimg.html" or die "$!"; print TT $page_content; close TT; -
javascript confirm
10/02/09
url = http://www.tizag.com/javascriptT/javascriptconfirm.php
<html>
<head>
<script type="text/javascript">
<!--
function confirmation() {
var answer = confirm("Leave tizag.com?")
if (answer){
alert("Bye bye!&qu -
meta redirect
10/02/09
<meta http-equiv="refresh" content="2;url=http://webdesign.about.com"> -
perl mysql
10/01/09
my $dsn = 'dbi:mysql:dbname:localhost:3306';
# set the user and password
my $user = 'user';
my $pass = 'pass';
# now connect and get a database handle
my $dbh = DBI->connect($dsn, $user, $pass)
or die "Can& -
perl CGI
10/01/09
use CGI;
my $q = CGI->new;
# Process an HTTP request
@values = $q->param('form_field');
$fh = $q->upload('file_field');
$riddle = $query->cookie('riddle_name');
%answers
-
Action script 2.0 Trim function
-
September
-
Perl contenttype
09/23/09
print "Content-type: text/html\n\n"; -
Apache Htaccess
09/23/09
.htaccess
AuthUserFile /home/sandeep/install/ixquick/data/Admin_Passwords
AuthGroupFile /home/sandeep/install/ixquick/data/Admin_Passwords.Groups
AuthName "Ixquick Partners"
AuthType Basic
<Limit GET POST PUT>
require group ixadmins ixpartners bel -
Perl smiple wordwrap
09/23/09
$data_hr->{URL} =~ s/.{1,80}/$& /sg; ## Perl simple "wordwrap" -
iphone useragent
09/09/09
Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3 -
STDERR Redirect
09/05/09
The following redirects both stdout and stderr into a file named tmp
sh <filename> 1>tmp 2>&1
-
Perl contenttype
-
August
-
Slide Show more then one image in Java Script
08/25/09
<html>
<title>:: Image Rotation ::</title>
<a href="" id="link1"><img src="" name="Rotating1" id="Rotating1" height="100" width="100"></a>
<a href=&quo -
Change something in multiple files using Find
08/22/09
find ./ -name 'index.cgi' -exec sed -i 's#$shortboardname = "";#$shortboardname = "";\n$meta_title= "ESL/TEFL Jobs";#' '{}' \; -
Copy a folder from one folder to multiple folders
08/21/09
perl -e 'opendir DR,".";@files = grep {/tesl/} readdir DR;foreach (@files) {next if ! -d $_; print $_,"\n";$x=qq{cp -rf ~/public_html/esl-tesol-jobs/captcha/ $_/};print $x,"\n";qx{$x};} closedir DR;' -
Change Images Slidshow in Java Script
08/21/09
<html>
<head>
<script type="text/javascript">
var slideimages=new Array()
function slideshowimages(){
for (i=0;i<slideshowimages.arguments.length;i++){
slideimages=new Image()
slideimages.src=slideshowimages.arguments
-
Show the Tip box in html using Javascript
08/20/09
<script type = "text/javascript">
var TipBoxID = "TipBox";
var tip_box_id;
function findPosX(obj)
{
var curleft = 0;
if(obj.offsetParent)
while(1)
{
curleft += obj.offsetLeft;
-
TextBox Counter in Javascript
08/20/09
Just copy and paste this code and view textbox counter.
<script language = "Javascript">
/**
* DHTML textbox character counter script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
*/
maxL=255;
var bName = navigator.appName;
-
Check All CheckBox on click in Javascript
08/20/09
<script language = "Javascript">
var form='frmSample' //Give the form name here
function SetChecked(val,chkName) {
dml=document.forms[form];
len = dml.elements.length;
var i=0;
for( i=0 ; i<len ; i++) {
if -
Date validation in Java Scripts
08/20/09
<script language = "Javascript">
// Declaring valid date character, minimum year and maximum year
var dtCh= "/";
var minYear=1900;
var maxYear=2100;
function isInteger(s){
var i;
for (i = 0; i < s.length; i+ -
Count the words in a sentence using PHP
08/19/09
<?php
$str = "I am the best";
echo str_word_count($str);
?>
********out put *******
4 -
Calculate the similarty between two string
08/19/09
<?
$string1="rakesh";
$string2="rake";
$string3="rakesh";
$string4="rakesh";
similar_text($string1, $string2, $p);
similar_text($string3, $string4, $q);
echo "Percent: $p%".'<br>' -
Pad a string to a certain length with another string
08/19/09
<?php
$input = "Rakesh";
echo str_pad($input, 10, "*", STR_PAD_LEFT); //pad in left side
echo str_pad($input, 10, "#", STR_PAD_BOTH); //pad in both side
echo str_pad($input, 10 , "@"); //pad in right side -
Replace the string instead of searching string in PHP [Replace String ]
08/19/09
<?php
$replace = str_replace("r", "t", "kumar");
echo $replace;
?>
**********output ********
kumat
// here r replace with t -
Repeat the String
08/19/09
<?php
echo str_repeat("S2k", 10);
?>
// here s2k repeat 10 times.
******* output ******
S2kS2kS2kS2kS2kS2kS2kS2kS2kS2k -
Convert special characters to HTML entities
08/19/09
<?php
$new = htmlspecialchars("<a href='test'>Test</a>", ENT_QUOTES);
echo $new;
?>
********out put **********
// <a href='test'>Test</a> -
Join the all Array elemments in a single string in PHP
08/19/09
<?php
$array = array('S2k', 'Design', 'Delhi');
$join_array = join(",", $array);
print "<pre>";
print_r ($array);
print "</pre>";
echo $join_array;
?>
-
change first letter of String in upper case in php
08/19/09
<?php
$first = 'my name is rakesh';
$first = ucfirst($first); // Hello world!
echo $first;
?>
***********out put********
My Name is Rakesh -
Change All charachter of string in Uppercase and Lowercase in PHP
08/19/09
<?php
$str = "India is the best";
$str = strtoupper($str);
echo $str;
echo '<br>';
$str1 = "INDIA IS THE BEST";
$str1 = strtolower($str1);
echo $str1;
?>
**********
//output
INDI -
Convert the HTML entities to their Decoded format
08/19/09
<?php
$myhtml="I m "the" <b>best</b> ";
$mydecode= html_entity_decode($myhtml);// out put comes like
echo $myhtml.'<br';
?>
**************Out Put ******
I m "the&q -
Remove Space from right of the given text in PHP
08/19/09
There are two function to remove space from right of the text:
(1) chop(string,"");
(2) rtrim(String,"");
//chop("yourstring ","");
<?php
$before='First ';
echo $before.'Second -
CheckBox validation in HTML using Javascript
08/19/09
<SCRIPT TYPE="text/javascript" LANGUAGE=JAVASCRIPT>
function validcheck() {
if (document.frmTest.chk1.checked == false &&
document.frmTest.chk2.checked == false &&
document.frmTest.chk3.checked == false)
{
-
Validate Email id with Regular Expression in Javascript
08/19/09
<script>
function Validation(){
var emailRegEx = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
str = document.getElementById('txtemail').value;
if(str.match(emailRegEx)) {
alert(str+' is valid emai -
Radio Button validation using Javascript in HTML
08/18/09
This is very simple way to validate radio button through Javascript in HTML Form.
<script type="text/javascript">
function validate_form (str) {
valid = true;
if (
(document.frmSample.rdo1[0].checked == false )
&am -
Validate TextBox that accept only Numeric value using javascript.
08/18/09
This code display a textbox that accept only numeric value.
<script type="text/javascript">
function Validation(){
var a=document.getElementById('MyTextBox').value;
var regex1=/^[0-9]*$/;
if(regex1.test(a)== false){
-
validate TextBox that accept only Alphabatic value using Javascript
08/18/09
<script type="text/javascript">
function Validation(){
var a=document.getElementById('MyTextBox').value;
var regex1=/^[a-zA-Z][a-zA-Z]*$/;
if(regex1.test(a)== false){
alert('Please enter only Alphabatic ');
MyTextBo -
Validate TextBox that accpet only Alphanumeric value without white Space
08/18/09
TextBox that accept only Alphanumeric value without any white space.
<script type="text/javascript">
function Validation(){
var a=document.getElementById('MyTextBox').value;
var regex1=/^[a-zA-Z][a-zA-Z0-9]*$/;
if(regex1.test(a)== false){ -
Validate TextBox that accpet only Alphanumeric value with white Space
08/18/09
This is a simple way to validate a textbox that accept only alphanumric value with space.
<script type="text/javascript">
function Validation(){
var a=document.getElementById('MyTextBox').value;
var regex1=/^[a-zA-Z][a-zA-Z0-9 ]*$/; //thi -
Convert the moved items as a PHP array and display that in ListBox using Java Script
08/18/09
Here two page one is select.php and another is view.php, in view.php we diplay the array elements from moved items in second ListBox from page Select.php.
// Select.php //
****************
<script type="text/javascript">
function goto(path) {
wind -
Display items HTML ListBox from PHP array list.
08/18/09
To retrive itmes from a PHP array to a ListBox and display that.
<?php
$items = array('country' => array(1 => 'India',
2 => 'Pakistan',
3 => 'England',
4 =>'Japan',
-
Java Script To Move Selected Items from one <Select> to another [ Multiple / Single ]
08/18/09
To View a good example, Just copy and paste this code in html format and run it.
<script type="text/javascript">
function goto(path) {
window.location.href = path;
}
function fnMoveItems(lstbxFrom,lstbxTo)
{
var varFromBox = do -
Dispaly value in Div from Listbox OnChange Event [ Value ]
08/18/09
To view the example just copy and paste this code in your html page.
<script language="javascript">
function ListBox1_DoubleClick() {
document.getElementById('ListBox1Hidden').innerHTML = document.frm1.select1.value;
} -
HTML Page Structure
08/10/09
For making HTML pages always create the following folders:
img
css
js
img = All Images should go in img folder.
css = All css files should go in css folder.
js = All Javascript should go to js folder.
There SHOULD NOT BE any CSS or JavaScript Code -
JavaScript Code to go to a page
08/10/09
Javascript code to go to page
Path = URL to goto
function goto(path) {
window.location.href = path;
}
to call:
<script type='text/Javascript'>goto('screen2.php');</script> -
TextBox Validation
08/10/09
This function performs Textbox Validation using Javascript
function validate_form1()
{
valid = true;
if ( document.frm.username.value == "" ) {
alert( "User Name Should Not be Empty." )
-
Slide Show more then one image in Java Script
-
December
-
2008
-
October
-
Actionscript / Javascript Country and State lookup
10/19/08
window.onload=addLoadEvent;
window.onload=changeregligion;
var states = new Array();
states['Afghanistan'] = new Array('Badakhshan','Badghis','Baghlan','Balkh','Bamian','Farah','Faryab','Ghazni',
-
Actionscript / Javascript Country and State lookup
-
October

Calendar



