Archive for July, 2008

PHP Operators

July 31, 2008

By now, you must have started writing those scripts and started working on PHP. Now, it’s time for you to learn about the operators available in PHP. An operator is something in which one or more values are fed and it gives another value as a result.

In general there are three types of operators:

  • Unary – it operates on only one value.
  • Binary – it operates on two or more than two values.
  • Ternary – it is used to select between two expressions depending on the third one.

There are many types of operators in PHP; some of them are useful but some are not. In this tutorial we will be studying about the most useful operators in PHP, which are:

  • Arithmetic operators
  • Assignment operators
  • Comparison operators
  • Logical operators

(more…)

Getting Help in Shell

July 27, 2008

hello everyone

in the last post, my friend “3abed” talked about Shell and its Advantages, Commands architecture and he also wrote some commands to let you know how to write commands

in this post … we’ll talk about “Getting Help” in shell

but before we start talking about getting help … let me talk about an indispensable command!!!

cd:

this command is used to Change Direcotry and it’s used as follows:

#cd /etc/

ok i want to Change Directory from /etc/ to /etc/sysconfig/

there’re two ways to write the path:

Relative Path:

The path in relation to the current working directory, and it’s used as follows:

#cd sysconfig/

Absolute Path:

The path that you can enter from any directory

#cd /etc/sysconfig/


note:there’s a way of referring to the Parent Directory or the Current Directory

the current directory is reffered to as “.”

the parent directory is referred to as “..”

so we can go to /etc/sysconfig/ from /etc/ by typing:

#cd sysconfig/

or

#cd ./sysconfig/

and we can go back to /etc/ by typing:

#cd ../

and this equals “UP” in any directories browser

if we want to go “back” type:

#cd –

now we can talk about getting Help:

1)man pages:

(more…)

Your First PHP Script

July 24, 2008

Now that you have installed all the support software for running PHP, you are ready to learn how to do a PHP script.

Writing a PHP script is very simple. No special software is needed, except a text editor like Notepad in which the script is written. You have to run that code on your web browser and you are ready with your first PHP script.

The First Script

A PHP file normally contains HTML tags and some PHP scripting code. A PHP scripting block always starts with <?php and ends with ?>. A PHP scripting block can be placed anywhere in the document.

In PHP scripting each line of code must end with a semicolon (;). The semicolon acts as a separator and is used to distinguish between two sets of instructions.

There is a PHP script in the example given below. This script will display the words “Welcome to expertrating!” in the web browser. There are two basic statements to output text on the browser with PHP: echo and print. In the example given below, the echo statement is used to display text.

Example
<html>
<head>
<title>Example</title>
</head>
<body>
<?php
echo “Welcome to expertrating!”;
?>
</body>
</html>

Output

(more…)

GIMP menus

July 22, 2008

Hello again

this time let me talk about

“Menus”

in this image … the menus are tabbed in one window
you can control them to make each tab in a separate window
just drag them away from this window, or click the “Configure this tab” button and select “Detach tab

you also can add tabs by dragging the separated windows into the tabbed window
another way is to click the “Configure this tab” button and select “Add tab” and add any tab you want

the essential tabs that are already loaded in the program’s start are:
Layers, Channels, Undo History, Paths, FG/BG colors, Brushes, Patterns and Gradients

lets declare what are these menus used for:

(more…)

first step with shell

July 16, 2008

hey
after my mate DidoooFidooo made the installation post i think we’re ready to start dealing with the system

we’ll deal with the system using “shell” most of the time

so what is “Shell”?

it is a program that takes your commands and gives it to the Operating System to deal with them

in the past … the shell was the only user interface .. but nowadays .. we have Graphical User Interfaces (GUI) in addition to Command Line Interfaces (CLI)

i know i know … you may say “why shell … it’s boring”

ok lets see Why Bother With Shell?!

i’ve copied few lines from http://linuxcommands.org

Why do you need to learn the command line anyway? Well, let me tell you a story. Not long ago we had a problem where I used to work. There was a shared drive on one of our file servers that kept getting full. I won’t mention that this legacy operating system did not support user quotas; that’s another story. But the server kept getting full and stopping people from working. One of the software engineers in our company spent the better part of a day writing a C++ program that would look through the directories of all the users and add up the space they were using and make a listing of the results. Since I was forced to use the legacy OS while I was on the job, I installed a version of the bash shell that works on it. When I heard about the problem, I realized I could do all the work this engineer had done with this single line:

du -s * | sort -nr > $HOME/space_report.txt

Graphical user interfaces (GUIs) are helpful for many tasks, but they are not good for all tasks. I have long felt that most computers today do not use electricity. They instead seem to be powered by the “pumping” motion of the mouse! Computers were supposed to free us from manual labor, but how many times have you performed some task you felt sure the computer should be able to do? You ended up doing the work by tediously working the mouse. Pointing and clicking, pointing and clicking.

I once heard an author remark that when you are a child you use a computer by looking at the pictures. When you grow up, you learn to read and write. Welcome to Computer Literacy 101.

Advantages of Shell:

  • More powerful than the GUI
  • requires a modest memory
  • the shell deals directly with the kernel
  • gives you more options to use with the system

that’s only little things to mention about shell

Shell Types:

There is a lot of types of shell:

  • bash Bourne-again shell (GNU)
  • csh C shell (BSD)
  • jsh Job control shell (SVR4)
  • ksh Korn shell (Bell Labs)
  • rc Plan 9 shell (Bell Labs)
  • rsh Remote shell (TCP/IP)
  • sh Bourne shell (UNIX 7th Edition)
  • tcsh Popular extension of the C shell
  • zsh Popular extension of the Korn shell

in linux we will use bash it’s very powerful smart one
read more about bash
now where we can find bash?!
first i would like to say that each shell have two types so bash have two types

  • login shell” means that you should be logged in using a username and password from the shell
  • nonlogin shell” the one we found at the GUI and it means that you just login with the user from the GUI then when you open the shell it automatically uses this user

we will use the login one

how to start it?
after the system is loaded and you get the login screen
press Ctrl+Alt+F1 through F6 those all are login shells … and F7 gets you back to the GUI

each one of these shells called “Terminal TYpe” or TTY … so when i say switch to TTY5 … this means press Alt+Ctrl+F5

now we will use any one from F1–>F6 they are the same
you will have some thing like that
localhost login:
so we will type the user name we will use the root
then you will get
password:
we type the password of the root
NOTE: the password won’t be displayed even in * so don’t worry just write it
now you’ll see some thing like that
root@localhost ~: #
that one calles the prompt. let’s see what does this prompt consist of
root: the user name you logged in with
localhost: the name of your machine
~: that means that you are at your home directory and it’s the working directory “will be explained later”
#: that means that you are logged in with root user ” the system admin”
if you are not logged in with the root you will have “$” instead of “#

Commands Architecture:

commands have an architecture
<command> <option> <parameters>

well, lets explain these things:

command: the command we will use
option: that makes the command makes more specified things
parameters: the file or the directory even the remote machine we are doing the command on it

Some Commands:

now let’s do our first commands

you’ll only have to type the Green-Colored words to type the command:

#date that shows the date of the day

#cal that one shows the calender of the month

#pwd prints the working directory which means where am i in the system

#ls this command lists the files at the directory where you are
this was just some thing to get familiar with the shell
we will continue in the next posts to be more active with the shell using more commands
the next post we will talk about the commands that deals with the files and directories
if there is any thing not clear you’re welcomed to write your notes

Thanks

Peace

PHP introduction

July 10, 2008

will talk more about some languages as start we select PHP as server side web language

What is PHP?

Taken directly from PHP’s home, PHP.net, “PHP is an HTML-embedded scripting language. Much of its syntax is borrowed from C, Java and Perl with a couple of unique PHP-specific features thrown in. The goal of the language is to allow web developers to write dynamically generated pages quickly.”

  • PHP stands for PHP: Hypertext Preprocessor
  • PHP is a server-side scripting language, like ASP
  • PHP scripts are executed on the server
  • PHP supports many databases (MySQL, Informix, Oracle, Sybase, Solid, PostgreSQL, Generic ODBC, etc.)
  • PHP is an open source software (OSS)
  • PHP is free to download and use

Why PHP?

(more…)