Archive for July, 2007

Dynamic/Static/Strong/Weak Types

A dynamically typed language is a language where the type of a variable can be altered at any time. (It is a string, now it is a Fixnum, now it is a Time object, etc.)

A statically typed language is the opposite. (Decide what x is once for all and don’t change your mind!)

A strongly typed language is a language that is being strict about what you can do with your typed variables. (Don’t mix them… or I will throw you an error in the face!)

A weakly typed language is the opposite. (Do what you want with your different types. Mix them all! We’ll see what happens!)

Original Article

[tags]type,types,duck,static,weak,strong,dynamic[/tags]

Command to make a CD/DVD ISO Image in Linux with dd

This command can be used to create an image of a CD/DVD/HDD. You can also use some GUI tool like K3B to do this.

Make sure that the CD is unmounted before running this command


dd if=/dev/cdrom of=cd_image.iso

[tags]cd,dvd,image,iso,dd,linux,command[/tags]

Fetch columns of Output using Awk

One can use awk to get a specific column from a command output…

First column of the command
date|awk '{print $1}'

11th Column of the command
ps aux|awk '{print $11}'

Use a different Field separator
cat /etc/passwd|awk -F ':' '{print $1}'

[tags]awk,sed,shell,script,output,filter,text,cli,linux,string,separator[/tags]

Get the First Line of Command Output in Shell

Get just the first line of the output of a command…


<command>|head -n1

ls -1|head -n1

Remove File Extension using sed

Get just the file title without the extension in a variable.


file_name=$1
file_title=`echo $1|sed 's/\..\{3\}$//'`