Best Web Hosting


COUPON CODE:  techpulpdeal



and get $9.94 off on all hosting plans

Search


There are hundreds of cool tips and tricks. Just search the site below.


Browse articles of 2010 | 2009 | 2008



Archive for October, 2008

1 2 3 »

  • TECHPULP | How to hide rule commands from display in Makefile
    Generally GNU make prints all the commands provided in the rules section. At times the output printed by the make may not be appealing if the makefile contains lots of rules with all complex jargon. For example consider the following...
  • TECHPULP | How to clean multiple sub-directories in Makefile
    The following example assumes that all sub-directories are listed in $(SUBDIRS) variable. All the entries in $(SUBDIRS) can be iterated using a “for” loop as shown below and “make clean” can be run in each directory. SUBDIRS = dir1 dir2...

  • TECHPULP | Arithmetic operation using double parentheses construct in Bash
    The following script illustrates how double parentheses can be used to do arithmetic operations. #!/bin/sh (( a = 23 )) echo "a (assign value) = $a" (( ++a )) echo "a (after ++a) = $a" (( --a )) echo "a...
  • TECHPULP | How to validate IP address in C
    Any valid IP address consists of four numbers separated by three period (.) characters and each nunber ranges from 0-255 inclusive. An example IP address is “125.231.167.234″. The string function sscanf can be used to extract the four numbers and...

  • TECHPULP | How to generate random/temporary file name using mcookie command
    The mcookie shell command is used to generate magic cookie for xauth. It throws a md5sum like output and the basic usage is as shown below. [neo@techpulp ~]# mcookie 5f8dbb14e7eb4db75428017585115feb [neo@techpulp ~]# Now let us use the output of mcookie...
  • TECHPULP | How to write infinite loop in Bash
    The while-do-done statement can be used to program an infinite loop in bash. The following sample shows how it can be done. #!/bin/bash while [ 1 ]; do echo I am in infinite loop. Press Ctrl+C to stop me done...

  • TECHPULP | How to generate temporary file name in bash using RANDOM environment variable
    Whenever the $RANDOM environment variable is accessed, it gives a random number. This can be used to generate a random file name. In the following example randfile function takes prefix and suffix of the temporary file name and returns a...
  • TECHPULP | How to scan all reserved ports on a host using nmap
    nmap is a very useful network exploration tool and security scanner. It can be used to scan all open ports on a host. The following example shows how it can be used. However port scanning is just one of the...

  • TECHPULP | View page source with a link or a button using Java Script
    window.location can be set to a special location using view-source: followed by window.location.href to make browser to display source code of the current page. This can be attached to a standard link or a click of a button as shown...
  • TECHPULP | How to prompt for e-mail on click of a button using Java Script
    In general a standard link can be created to prompt for an e-mail as shown below and it doesn’t involve Java Script. <a href="mailto:neo@techpulp.com">Mail to Neo</a> However same functionality can be attached to a button using onClick event of the...

1 2 3 »

  • Best Ever Deal on Earth