Tag: Code

Object Or Array Check in JavaScirpt

Test whether an object is an object or an array if(Object.prototype.toString.apply(arr) === ‘[object Array]’) alert(“Array”) Original Article

Start a new Django Project

Command to start a new Django project… django-admin.py startproject [PROJECT_NAME] cd [PROJECT_NAME] python manage.py startapp [PROJECT_NAME]

Random Password in PHP

A simple way to create a random password in PHP $password = substr(md5(time()), 0, rand(4,8));

Finding the Factorial using Recursion

Finding the Factorial using Recursion in javascript. function factorial(x) { if(x

Remove www From URL using .htaccess in Apache

This htaccess code will remove the ‘www’ part from the url. It uses the mod_rewrite module of apache to re-write…

Find if a Variable is Defined in Ruby

This will let you find whether a variable is defined in ruby. if(defined? var_name) then print var_name + ” is…

Using Ant to Concatenate files

The build.xml file to concatenate files using ant. This can be executed using the command ‘ant “ConcatAll”‘ <?xml version=”1.0″ encoding=”UTF-8″?>…

Creating a Toolbar in GTK Python(PyGTK)

Creating a toolbar using GTK Python. There is an old method – but this example shows a better method of…

Python Function for Space Units

A Python function to return readable size using the given size(KB) # Returns a more readable format of the given…

Get Result of Command using Python in Linux

Execute a command and get its results using python in Linux import commands result = commands.getoutput(“ls”)