Archives 

Show All

  • 2010
    • June
    • 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

    • 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

    • 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

    • 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); <

    • 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

  • 2009
    • December
    • 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]);

    • 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

    • 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

    • August
  • 2008