Friday, February 8, 2008

Using the Python Interpreter

Invoking the Interpreter The Python interpreter is usually installed as /usr/local/bin/python on those machines where it is available; putting /usr/local/bin in your Unix shell's search path makes it possible to start it by typing the command pythonto the shell. Since the choice of the directory where the interpreter lives is an installation option, other places are possible; check with your local Python guru or system administrator. (E.g., /usr/local/python is a popular alternative location.) On Windows machines, the Python installation is usually placed in C:\Python24, though you can change this when you're running the installer. To add this directory to your path, you can type the following command into the command prompt in a DOS box: set path=%path%;C:\python24Typing an end-of-file character...

Thursday, February 7, 2008

Tutorial on ruby-debug

InstallationThe installation procedure requires rubygems package and C compiler available.Two notes worth to mention:For Debian users, you must have ruby-dev package installed.For Windows users, I don't have a precompiled version for Windows available yet.The installation procedure is very simple: $ sudo gem install ruby-debugBasic usagesThere are two way you can use this library.rdebug script.When you start your application with rdebug script, the debugger is activated by default and the execution of your script is halted at the first line of code:$ cat test.rbputs 'ok'$ rdebug test.rb./test.rb:1:puts 'ok'(rdb:1) list[-4, 5] in ./test.rb=> 1 puts 'ok'(rdb:1)From this point you can invoke any commands available, such as you can create breakpoints and step through your code.On demand invocationYou...

Monday, February 4, 2008

MYSQL PART II Update Statement

UPDATE Statement :The UPDATE query is used to change or modify the existing values in a table.The Update Syntax isUPDATE tbl_name SETcol_name1=expr1 [, col_name2=expr2 ...][WHERE where_condition];The UPDATE query updates the columns of existing rows in a table with the new values. The SET clause is used to indicate which columns to be modified. The WHERE clause is used to specify the conditions that identify which rows to be updated.The following example will set the address of the student to a new address.mysql> update student set address='welling street' whereaddress='victoria street';Query OK, 1 row affected (0.03 sec)Rows matched: 1 Changed: 1 Warnings: 0But this will set all the address of the students who ever lives in victoria street will be changed to welling street.Suppose if we...

Sunday, February 3, 2008

MYSQL PART II TABLES

Creating tables :Once you have selected the database, we can start creating tables. The CREATE statement is used to create a table in MySQL with constraint. A Constraint is restriction to the behavior of a variable.The Create syntax isCREATE TABLE tableName( fieldName1 dataType(size) [NULL NOT NULL]fieldName2 dataType(size) [NULL NOT NULL] );If NULL is specified, the field is allowed to be left empty. If NOT NULL is specified, the field must be given a value. In the absence of either a NULL or NOT NULL, NULL is assumed.The below example query will help you in creating table:CREATE TABLE student( studID INT(5),name VARCHAR(30),);The above query will create the table student with fields ID and Name.PRIMARY KEY :A PRIMARY KEY is a field in a table that uniquely identifies a record. This attribute...