Tuesday, March 3, 2009

Overloading in PHP

since year ago, I started my way to study and be professional in PHP, since I study php well, and of course I study the OOP features in PHP, but since, I haven't know about the overloading in php, Overloading is the duplication of method name in the class, but both methods should have diffrent type of parameters and diffrent number too, i.e diffrent method signature,
but how this can be implemented with language that doesn't concern with the variable data type (I mean php),
the method overloading was the most important feature I use in Java, but it isn't exist in PHP, (as I was think)

week ago, i've read document about method overloading in OOP as one of the basic features in oop, and during the article, the author say that php has this ability, and he write this link , I've saw this link before, but I wasn't concerned with it, but now, I'm do

Now I can say
PHP HAS METHOD OVERLOADING FEATURE

I like php more than later,

Ahmed Gaber

Thursday, February 26, 2009

Get the grub of your ubuntu machine

lot of my fresh to linux friends asks about how to get the grub (boot loader information) of your machine, this grub will help you to restore your ubuntu system, after installing another OS on it beside your ubuntu.

to get the grub, you need to lig on your system as root,
su root
then enter the password,
now, this is the Xfactor:
dd if=[source] of=[destination] count=1
the command dd, which copy the content of if and put it in of location,
count means how many block copied from the source to destination
now, if you want to get the grub of your machine, you'll enter this command
dd if=/dev/sda of=/home/aigdonia/grub.bin count=1

this will read the first block form /dev/sda (you need to change it according to your system) and paste it in /home/aigdonia/grub.bin (change to wherever you like to paste)

now, you've a file called grub.bin on /home/aigdonia holds the first block of your hard disk, you can now install Windows or whatever OS you like then you'll restore the grub again by doing the following simple steps:

from your ubuntu live CD, write the following in the shell window:
sudo dd if=[grub.bin] of=[/dev/sda] count=1

this will do the reverse operation, and then you can leave the live session and log normally to your ubuntu :)