Thursday, August 16, 2007

Regular Expressions

Basic Syntax of Regular Expressions (as from PHPBuilder.com)


First of all, let's take a look at two special symbols: '^' and '$'.

What they do is indicate the start and the end of a string, respectively, like this:"^The": matches any string that starts with "The";

"of despair$": matches a string that ends in the substring "of despair";

"^abc$": a string that starts and ends with "abc" -- that could only be "abc" itself!

"notice": a string that has the text "notice" in it.


You can see that if you don't use either of the two characters we mentioned, as in the last example,
you're saying that the pattern may occur anywhere inside the string -- you're not "hooking" it to any of the edges.

There are also the symbols '*', '+', and '?', which denote the number of times a character or a sequence of
characters may occur. What they mean is: "zero or more", "one or more", and "zero or one."

Here are some examples:

Wednesday, August 15, 2007

Assembly Language

Assembly language is essentially the native language of your computer. Technically the processor of your machine understands machine code (consisting of ones and zeroes). But in order to write such a machine code program, you first write it in assembly language and then use an assembler to convert it to machine code.

However nothing is lost when the assembler does its conversion, since assembly language simply consists of mnemonic codes which are easy to remember (they are similar to words in the english language), which stand for each of the different machine code instructions that the machine is capable of executing.

Here is an example of a short excerpt from an assembly language program:

MOV EAX,1
SHL EAX,5
MOV ECX,17
SUB EAX,ECX
....

An assembler would convert this set of instructions into a series of ones and zeros (i.e. an executable program) that the machine could understand.

Because it is extremely low level, assembly language can be optimized extremely well. Therefore assembly language is used where the utmost performance is required for applications.

Assembly language is also useful for communicating with the machine at a hardware level. For this reason, it is often used for writing device drivers.

A third benefit of assembly language is the size of the resulting programs. Because no conversion from a higher level by a compiler is required, the resulting programs can be exceedingly small. For this reason, assembly language has been a language of choice for the demo scene. This involves coders writing extremely small programs which show off their creative and technical abilities to other members of the scene.

In this tutorial you will learn how to write assembly language programs and how to make use of these to do interesting things such as calculations, graphics, writing windows programs and optimizing programs written in other languages.

Anton Subagja