Updates from softwareandme RSS Toggle Comment Threads | Keyboard Shortcuts

  • softwareandme 8:12 pm on December 21, 2010 Permalink  

    Install Mulp on Linux 

    Mulp is developed with C++ and Wx and libxml++ is used for xml parsing, so we need Wx widgets and libxml++.

    Wx widgets, http://www.wxwidgets.org
    Libxml++, http://libxmlplusplus.sourceforge.net

    After installing Wx widgets and libxml++, download mulp source from http://sourceforge.net/projects/mulp

    Open the tar ball of mulp

    tar xzvf mulp-0.0.1.tar.gz
    

    then cd to mulp directory

    cd mulp-0.0.1
    ./autogen.sh
    ./configure
    make
    

    Login with root user

    and

    make install
    

    if you are using ubuntu or fedora or a distro with sudo

    sudo make install
    

    You installed the mulp software! Now try to run mulp from command line or with Alt+F2 on Kde and Gnome.

     
  • softwareandme 8:10 pm on December 21, 2010 Permalink  

    Mulp as Ubuntu Control Panel – xml file 

    Mulp may be used as Ubuntu Control Panel by editing its xml file, the default xml file for Mulp has the applications for Ubuntu. After installing mulp on ubuntu you will see you can use it as the Ubuntu Control Panel.

    /etc/mulp/mulp.xml file must be changed like this to use mulp as Ubuntu Control Panel

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <mulp>
    	<information>
    		<developers>
    			<developer>Onur GUZEL onur.oguzel@gmail.com</developer>
    		</developers>
    		<version>0.0.1</version>
    		<website>http://mulp.sourceforge.net</website>
    		<apptitle>Truva Control Panel</apptitle>
    	</information>
    	<setting>
    		<pluginfolder>plugins</pluginfolder>
    		<logindialog></logindialog>
    		<logo></logo>
    		<image>/usr/share/mulp/images/truvalinux.png</image>
    		<theme></theme>
    		<splash></splash>
    		<feed></feed>
    	</setting>
    	<pages>
    		<page id="1" name="Software" title="Software" image="/usr/share/mulp/images/softwarecenter.png">
    			<plugins>
    				<plugin type="program" name="update-manager" title="Online Update" image="/usr/share/mulp/images/onlineupdate.png">Online Update</plugin>
    				<plugin type="program" name="synaptic" title="Install Remove Software" image="/usr/share/mulp/images/installandremovesoftware.png">Install and Remove Software</plugin>
    				<plugin type="program" name="gnome-default-applications-properties" title="Preferred Applications" image="/usr/share/mulp/images/preferredapplications.png">Boot</plugin>
    				<plugin type="program" name="gnome-session-properties" title="Startup Applications" image="/usr/share/mulp/images/startupapplications.png">Startup Applications</plugin>
    				<plugin type="program" name="software-properties-gtk" title="Software Sources" image="/usr/share/mulp/images/softwaresource.png">Software Sources</plugin>
    				<plugin type="program" name="computer-janitor-gtk" title="Clean Computer" image="/usr/share/mulp/images/temizle.png">Clean Computer</plugin>
    			</plugins>
    		</page>
    		<page id="2" name="Hardware" title="Hardware" image="/usr/share/mulp/images/drivers.png">
    			<plugins>
    				<plugin type="program" name="bluetooth-properties" title="Bluetooth" image="/usr/share/mulp/images/bluetooth.png">Bluetooth</plugin>
    				<plugin type="program" name="jockey-gtk" title="Drivers" image="/usr/share/mulp/images/driversinfo.png">Drivers</plugin>
    				<plugin type="program" name="palimpsest" title="Disk Utility" image="/usr/share/mulp/images/diskutility.png">Disk Utility</plugin>
    				<plugin type="program" name="gnome-keyboard-properties" title="Keyboard" image="/usr/share/mulp/images/input-keyboard.png">Keyboard</plugin>
    				<plugin type="program" name="gnome-display-properties" title="Monitors" image="/usr/share/mulp/images/monitors.png">Monitors</plugin>
    				<plugin type="program" name="gnome-mouse-properties" title="Mouse" image="/usr/share/mulp/images/input-mouse.png">Mouse</plugin>
    				<plugin type="program" name="gnome-volume-control" title="Sound" image="/usr/share/mulp/images/preferences-desktop-sound.png">Sound</plugin>
    				<plugin type="program" name="usb-creator-gtk" title="Startup Disk" image="/usr/share/mulp/images/usbdiskgtk.png">Startup Disk</plugin>
    				<plugin type="program" name="system-config-printer" title="Printing" image="/usr/share/mulp/images/printer.png">Printing</plugin>
    				<plugin type="program" name="gnome-power-preferences" title="Power Management" image="/usr/share/mulp/images/gnome-power-manager.png">Power Management</plugin>
    			</plugins>
    		</page>
    		<page id="3" name="System" title="System" image="/usr/share/mulp/images/system.png">
    			<plugins>
    				<plugin type="program" name="gdmsetup" title="Login Screen" image="/usr/share/mulp/images/gdm-setup.png">Login Screen</plugin>
    				<plugin type="program" name="gnome-system-log" title="Log File Reviewer" image="/usr/share/mulp/images/logviewer.png">Log File Viewer</plugin>
    				<plugin type="program" name="gnome-system-monitor" title="System Monitor" image="/usr/share/mulp/images/monitor.png">System Monitor</plugin>
    				<plugin type="program" name="time-admin" title="Time and Date" image="/usr/share/mulp/images/time-admin.png">Time and Date</plugin>
    				<plugin type="program" name="users-admin" title="Users and Groups" image="/usr/share/mulp/images/usersgroups.png">Users and Groups</plugin>
    				<plugin type="program" name="checkbox-gtk" title="System Testing" image="/usr/share/mulp/images/systemsettings.png">System Testing</plugin>
    			</plugins>
    		</page>
    		<page id="4" name="Network" title="Network" image="/usr/share/mulp/images/network.png">
    			<plugins>
    				<plugin type="program" name="gnome-nettool" title="Network Setting" image="/usr/share/mulp/images/networksettings.png">Network Setting</plugin>
    				<plugin type="program" name="nm-connection-editor" title="Network Connections" image="/usr/share/mulp/images/network.png">Network Connections</plugin>
    				<plugin type="program" name="gnome-file-share-properties" title="Personal File Sharing" image="/usr/share/mulp/images/remotefolder.png">Personal File Sharing</plugin>
    				<plugin type="program" name="gnome-network-properties" title="Network Proxy" image="/usr/share/mulp/images/networkproperties.png">Network Proxy</plugin>
    				<plugin type="program" name="vino-preferences" title="Remote Desktop" image="/usr/share/mulp/images/remotedesktop.png">Remote Desktop</plugin>
    				<plugin type="program" name="bluetooth-properties" title="Bluetooth" image="/usr/share/mulp/images/bluetooth.png">Bluetooth</plugin>
    			</plugins>
    		</page>
    		<page id="5" name="" title="Language &amp; Accesibility" image="/usr/share/mulp/images/region.png">
    			<plugins>
    				<plugin type="program" name="gnome-at-properties" title="Accessibility" image="/usr/share/mulp/images/accessibility.png">Accessibility</plugin>
    				<plugin type="program" name="/usr/bin/gnome-language-selector" title="Language Support" image="/usr/share/mulp/images/language.png">Language Support</plugin>
    				<plugin type="program" name="gnome-keyboard-properties" title="Keyboard Layout" image="/usr/share/mulp/images/input-keyboard.png">Keyboard Layout</plugin>
    				<plugin type="program" name="gnome-keybinding-properties" title="Keyboard Shortcuts" image="/usr/share/mulp/images/shortcuts.png">Keyboard Shortcuts</plugin>
    			</plugins>
    		</page>
    		<page id="6" name="Appearance" title="Appearance" image="/usr/share/mulp/images/appearance.png">
    			<plugins>
    				<plugin type="program" name="gnome-appearance-properties" title="Appearance" image="/usr/share/mulp/images/appearance.png">Theme</plugin>
    				<plugin type="program" name="ccsm" title="Compiz Configuration" image="/usr/share/mulp/images/ccsm.png">Compiz Configuration</plugin>
    				<plugin type="program" name="alacarte" title="Main Menu" image="/usr/share/mulp/images/mainmenu.png">Main Menu</plugin>
    				<plugin type="program" name="nautilus-actions-config-tool" title="Nautilius Configuration" image="/usr/share/mulp/images/nautilus.png">Nautilius Configuration</plugin>
    				<plugin type="program" name="gnome-screensaver-preferences" title="Screensaver" image="/usr/share/mulp/images/screensaver.png">Screensaver</plugin>
    				<plugin type="program" name="gnome-window-properties" title="Windows" image="/usr/share/mulp/images/desktopinfo.png">Windows</plugin>
    			</plugins>
    		</page>
    	</pages>
    </mulp>
    

     
  • softwareandme 7:42 pm on December 21, 2010 Permalink
    Tags: , , , , ,   

    Mulp Editing xml file 

    Mulp is easy to configure and we will discuss what we can do with mulp by editing its xml.

    Mulp xml is located under

    /etc/mulp/mulp.xml

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <mulp>
    	<information>
    		<developers>
    			<developer>Onur GUZEL onur.oguzel@gmail.com</developer>
    		</developers>
    		<version>0.0.1</version>
    		<website>http://mulp.sourceforge.net</website>
    		<apptitle>Truva Control Panel</apptitle>
    	</information>
    	<setting>
    		<pluginfolder>plugins</pluginfolder>
    		<logindialog></logindialog>
    		<logo></logo>
    		<image>/usr/share/mulp/images/truvalinux.png</image>
    		<theme></theme>
    		<splash></splash>
    		<feed></feed>
    	</setting>
    	<pages>
    		<page id="1" name="Software" title="Software" image="/usr/share/mulp/images/softwarecenter.png">
    			<plugins>
    				<plugin type="program" name="update-manager" title="Online Update" image="/usr/share/mulp/images/onlineupdate.png">Online Update</plugin>
    				<plugin type="program" name="synaptic" title="Install Remove Software" image="/usr/share/mulp/images/installandremovesoftware.png">Install and Remove Software</plugin>
    				<plugin type="program" name="gnome-default-applications-properties" title="Preferred Applications" image="/usr/share/mulp/images/preferredapplications.png">Boot</plugin>
    				<plugin type="program" name="gnome-session-properties" title="Startup Applications" image="/usr/share/mulp/images/startupapplications.png">Startup Applications</plugin>
    				<plugin type="program" name="software-properties-gtk" title="Software Sources" image="/usr/share/mulp/images/softwaresource.png">Software Sources</plugin>
    				<plugin type="program" name="computer-janitor-gtk" title="Clean Computer" image="/usr/share/mulp/images/temizle.png">Clean Computer</plugin>
    			</plugins>
    		</page>
    		<page id="2" name="Hardware" title="Hardware" image="/usr/share/mulp/images/drivers.png">
    			<plugins>
    				<plugin type="program" name="bluetooth-properties" title="Bluetooth" image="/usr/share/mulp/images/bluetooth.png">Bluetooth</plugin>
    				<plugin type="program" name="jockey-gtk" title="Drivers" image="/usr/share/mulp/images/driversinfo.png">Drivers</plugin>
    				<plugin type="program" name="palimpsest" title="Disk Utility" image="/usr/share/mulp/images/diskutility.png">Disk Utility</plugin>
    				<plugin type="program" name="gnome-keyboard-properties" title="Keyboard" image="/usr/share/mulp/images/input-keyboard.png">Keyboard</plugin>
    				<plugin type="program" name="gnome-display-properties" title="Monitors" image="/usr/share/mulp/images/monitors.png">Monitors</plugin>
    				<plugin type="program" name="gnome-mouse-properties" title="Mouse" image="/usr/share/mulp/images/input-mouse.png">Mouse</plugin>
    				<plugin type="program" name="gnome-volume-control" title="Sound" image="/usr/share/mulp/images/preferences-desktop-sound.png">Sound</plugin>
    				<plugin type="program" name="usb-creator-gtk" title="Startup Disk" image="/usr/share/mulp/images/usbdiskgtk.png">Startup Disk</plugin>
    				<plugin type="program" name="system-config-printer" title="Printing" image="/usr/share/mulp/images/printer.png">Printing</plugin>
    				<plugin type="program" name="gnome-power-preferences" title="Power Management" image="/usr/share/mulp/images/gnome-power-manager.png">Power Management</plugin>
    			</plugins>
    		</page>
    		<page id="3" name="System" title="System" image="/usr/share/mulp/images/system.png">
    			<plugins>
    				<plugin type="program" name="gdmsetup" title="Login Screen" image="/usr/share/mulp/images/gdm-setup.png">Login Screen</plugin>
    				<plugin type="program" name="gnome-system-log" title="Log File Reviewer" image="/usr/share/mulp/images/logviewer.png">Log File Viewer</plugin>
    				<plugin type="program" name="gnome-system-monitor" title="System Monitor" image="/usr/share/mulp/images/monitor.png">System Monitor</plugin>
    				<plugin type="program" name="time-admin" title="Time and Date" image="/usr/share/mulp/images/time-admin.png">Time and Date</plugin>
    				<plugin type="program" name="users-admin" title="Users and Groups" image="/usr/share/mulp/images/usersgroups.png">Users and Groups</plugin>
    				<plugin type="program" name="checkbox-gtk" title="System Testing" image="/usr/share/mulp/images/systemsettings.png">System Testing</plugin>
    			</plugins>
    		</page>
    		<page id="4" name="Network" title="Network" image="/usr/share/mulp/images/network.png">
    			<plugins>
    				<plugin type="program" name="gnome-nettool" title="Network Setting" image="/usr/share/mulp/images/networksettings.png">Network Setting</plugin>
    				<plugin type="program" name="nm-connection-editor" title="Network Connections" image="/usr/share/mulp/images/network.png">Network Connections</plugin>
    				<plugin type="program" name="gnome-file-share-properties" title="Personal File Sharing" image="/usr/share/mulp/images/remotefolder.png">Personal File Sharing</plugin>
    				<plugin type="program" name="gnome-network-properties" title="Network Proxy" image="/usr/share/mulp/images/networkproperties.png">Network Proxy</plugin>
    				<plugin type="program" name="vino-preferences" title="Remote Desktop" image="/usr/share/mulp/images/remotedesktop.png">Remote Desktop</plugin>
    				<plugin type="program" name="bluetooth-properties" title="Bluetooth" image="/usr/share/mulp/images/bluetooth.png">Bluetooth</plugin>
    			</plugins>
    		</page>
    		<page id="5" name="" title="Language &amp; Accesibility" image="/usr/share/mulp/images/region.png">
    			<plugins>
    				<plugin type="program" name="gnome-at-properties" title="Accessibility" image="/usr/share/mulp/images/accessibility.png">Accessibility</plugin>
    				<plugin type="program" name="/usr/bin/gnome-language-selector" title="Language Support" image="/usr/share/mulp/images/language.png">Language Support</plugin>
    				<plugin type="program" name="gnome-keyboard-properties" title="Keyboard Layout" image="/usr/share/mulp/images/input-keyboard.png">Keyboard Layout</plugin>
    				<plugin type="program" name="gnome-keybinding-properties" title="Keyboard Shortcuts" image="/usr/share/mulp/images/shortcuts.png">Keyboard Shortcuts</plugin>
    			</plugins>
    		</page>
    		<page id="6" name="Appearance" title="Appearance" image="/usr/share/mulp/images/appearance.png">
    			<plugins>
    				<plugin type="program" name="gnome-appearance-properties" title="Appearance" image="/usr/share/mulp/images/appearance.png">Theme</plugin>
    				<plugin type="program" name="ccsm" title="Compiz Configuration" image="/usr/share/mulp/images/ccsm.png">Compiz Configuration</plugin>
    				<plugin type="program" name="alacarte" title="Main Menu" image="/usr/share/mulp/images/mainmenu.png">Main Menu</plugin>
    				<plugin type="program" name="nautilus-actions-config-tool" title="Nautilius Configuration" image="/usr/share/mulp/images/nautilus.png">Nautilius Configuration</plugin>
    				<plugin type="program" name="gnome-screensaver-preferences" title="Screensaver" image="/usr/share/mulp/images/screensaver.png">Screensaver</plugin>
    				<plugin type="program" name="gnome-window-properties" title="Windows" image="/usr/share/mulp/images/desktopinfo.png">Windows</plugin>
    			</plugins>
    		</page>
    	</pages>
    </mulp>
    

    It is not so difficult, you will see so dont be afraid of xml file. We will give you detailed information about xml file.

    Mulp file starts with mulp tag and ends with mulp tag.

     
  • softwareandme 7:37 pm on December 21, 2010 Permalink
    Tags: , , , , ,   

    Mulp – Multi Purpose Software Panel 

    I ‘ve developed an open source software, mulp – multi purpose software panel. Mulp was an effort to develop a control center for Truva Linux, but after i finished the software i realized that i always need a software panel when i develop desktop applications. I decided to make it easy-to-configure and usable in every platform where a software panel is needed.

    Mulp is a multi purpose software panel developed in C++ and Wx. It is easy to configure to build your own control panels. Distribution developers will be able to use mulp in their distributions easily. Project is open source and hosted in http://sourceforge.net/projects/mulp

    In first version of mulp, there are no plugins, you are able to run the installed programs on your system by editing mulp.xml. In later releases mulp will have the ability to load dynamic plugins, inşAllah.

    You may change the mulp into another software panel by editing its xml file, an ubuntu control center application, truva linux control center application, a redhat control center application, sabily control center application… You dont need to edit the source code, you must just edit xml and then you will have your new software panel for your distribution.

     
  • softwareandme 1:11 pm on September 25, 2010 Permalink
    Tags: design patterns, object oriented, ,   

    Php object oriented programming with design patterns 

    There are some certain designs in software development like in designing an aircraft. While designing an aircraft designers use some patterns, for example there is a pattern for landing gears. They are located under the aircraft and they have supports which are joint to the fuselage. Designer does not have to design a landing gear from scratch, if it is not needed, because he knows what is the pattern of a landing gear. Patterns are like templates while designing and building an automobile or aircraft.

    Software developers also need patterns for building their software projects like in other engineering disciplines. People say that Php is not suitable for object oriented programming in their blogs, it is not true! Php gives you chance to develop in procedural concept or in oop concept. Sometimes you need procedural programming though (but dont use procedural programming a lot in your oop projects it will turn your code to spaghetti code, just use where you have to use procedural programming). I used java which is known as the most suitable programming language for oop, but when you see  a Main function to run your program people who say php is not a suitable language for oop may think about this about other oop languages like java,c++. This is not true again all of these languages try to make their job, there is not a better or worse programming language. There are programming languages which are suitable for your needs and which are not suitable.

    I use object oriented programming in my projects with design patterns they help you to solve some problems in an efficient and fast way.

    In php.net site we see some patterns like factory and singleton design patterns, this is really cool, just look at the code dont try to understand if you do not know abything about design pattern i will explain what are design patterns and when we should use them.

    class Example
    {
        // The parameterized factory method
        public static function factory($type)
        {
            if (include_once 'Drivers/' . $type . '.php') {
                $classname = 'Driver_' . $type;
                return new $classname;
            } else {
                throw new Exception('Driver not found');
            }
        }
    }
    

     
  • softwareandme 10:00 pm on April 21, 2010 Permalink
    Tags:   

    Php Operators (3) 

    Php operators are grouped in some sections, we gave the common operators in our previous article;

    • Assignment
    • Arithmetic
    • Comparison
    • Logical
    • String
    • Bitwise
    • Error control
    • Execution
    • Incrementing / decrementing
    • Array
    • Type

    What is an operator?
    If you want to change a variables value, multiply two numbers, compare two variables you use operators. Operators do operations on variables and sometimes you use them in your functions also.

    Assignment Operators
    They set the left operands value from its right. If you assign a value to a varible you use = (equals) operator. $variable = 1453; It means assign 1453 to variable.

    Arithmetic Operators
    They are used for arithmetic operations like adding,subtracting,modulus and multiplying.

    -$a Negation Opposite of $a.
    $a + $b Addition Sum of $a
    and $b.
    $a – $b Subtraction Difference of $a and $b.
    $a * $b Multiplication Product of $a and $b.
    $a / $b Division Quotient of $a and $b.
    $a % $b Modulus Remainder of $a divided by $b.

    $variable = (((3+7)*9+9)*10)%10;
    

    $variable’s value is 0
    $variable = 97%7;
    

    $variable is 6

    Comparison Operators
    Used for comparing two values, they do not assign anything just compare the values. You may use comparison operators on different types of variables, like comparing string and integer variables, since php is a loosely typed language php does not give you any error, but you should be careful about comparing two variables. If you just want to check if a variable has “FALSE” boolean value you may try to use ($c == false), but  if $c is 0 then comparison will be true but that s not what you expect! Ok, no problem php has a solution for this you may always try === for checking for variable type and value. Comparison operators are used everywhere in your code, if you are new to programming just learn them very well.

    $a == $b Equal TRUE if $a is equal to $b.
    $a === $b Identical TRUE if $a is equal to $b, and they are of the same type. (introduced in PHP 4)
    $a != $b Not equal TRUE if $a is not equal to $b.
    $a <> $b Not equal TRUE if $a is not equal to $b.
    $a !== $b Not identical TRUE if $a is not equal to $b, or they are not of the same type. (introduced in PHP 4)
    $a < $b Less than TRUE if $a is strictly less than $b.
    $a > $b Greater than TRUE if $a is strictly greater than $b.
    $a <= $b Less than or equal to TRUE if $a is less than or equal to $b.
    $a >= $b Greater than or equal to TRUE if $a is greater than or equal to $b.

    Logical Operators
    We use them for logical operations like xor,and, not,or, they return boolean values

    $a and $b And TRUE if both $a and $b are TRUE.
    $a or $b Or TRUE if either $a or $b is TRUE.
    $a xor $b Xor TRUE if either $a or $b is TRUE, but not both.
    ! $a Not TRUE if $a is not TRUE.
    $a && $b And TRUE if both $a and $b are TRUE.
    $a || $b Or TRUE if either $a or $b is TRUE.

    String Operators
    Php has two string operators one of them is string concatenation operator and the other one is concatenating assignment operator.
    String concatenating operator is . , and used for concatenating two strings.

    $string_me    = 'Izmir';
    $string          = 'Istanbul';
    $string_new   = 'Eskisehir';
    $string_concat = $string_me.$string.$string_new; //</strong>concats,adds, strings to each other $string_concat is 'IzmirIstanbulEskisehir'
    

    String concatenating assignment operator is .= , it appends argument on the right to the argument left.

    $string = 'C++'; //$string value is 'C++'
    $string .= ' PHP'; // PHP is appended to $string , new value of the $string is 'C++ PHP'
    

    Bitwise operators
    Bitwise operators are used to evaluate and manipulate of specific bits within an integer. Multiplying by two and dividing by two can be made by bit shifting in Php with bitwise operators.

    $a & $b And Bits that are set in both $a and $b are set.
    $a | $b Or (inclusive or) Bits that are set in either $a or $b are set.
    $a ^ $b Xor (exclusive or) Bits that are set in $a or $b but not both are set.
    ~ $a Not Bits that are set in $a are not set, and vice versa.
    $a << $b Shift left Shift the bits of $a $b steps to the left (each step means “multiply by two”)
    $a >> $b Shift right Shift the bits of $a $b steps to the right (each step means “divide by two”)

    Error Control Operators

    @ is the php error control operator which is used to ignore any error messages in expressions. If it is used in an expression (we put it inf front of expressions) error messages caused by expression will not be showed. I dont suggest this operator, dont try to use it. Dont try to hide errors or notices with @ operator. Try to solve your problems and then use error_reporting function or php.ini file to set your error reporting level.

    $variable = @$_SESSION[$key]; //will not show you a notice if the index $key does not exist
    

    Execution operators

    Php uses backticks “ as execution operators, you may run any command by using execution operators. It is dangerous to use backticks to run commands on your system, be careful about backticks.

    $showme = `ls /var/www`;
    echo $showme;
    

    Incrementing / decrementing operators

    ++$a Pre-increment Increments $a by one, then returns $a.
    $a++ Post-increment Returns $a, then increments $a by one.
    –$a Pre-decrement Decrements $a by one, then returns $a.
    $a– Post-decrement Returns $a, then decrements $a by one.

    Array operators

    $a + $b Union Union of $a and $b.
    $a == $b Equality TRUE if $a and $b have the same key/value pairs.
    $a === $b Identity TRUE if $a and $b have the same key/value pairs in the same order and of the same types.
    $a != $b Inequality TRUE if $a is not equal to $b.
    $a <> $b Inequality TRUE if $a is not equal to $b.
    $a !== $b Non-identity TRUE if $a is not identical to $b.

    Type operators
    İnstance of is used as type operator, if we want to know if an object is instantiated from a certain class we use instanceof.

    class Aircraft
    {
    }
    class Airbus extends Aircraft
    {
    }
    
    class Boeing extends Aircraft
    {
    }
    
    $airbus = new Airbus();
    $boeing = new Boeing();
    
    if($airbus instanceof Airbus)
    {
            echo "airbus object is instance of the Airbus class\n";
    }
    else
    {
            echo "airbus object is not instance of Airbus class";
    }
    
    if($boeing instanceof Airbus)
    {
            echo "boeing object is instance of Airbus class";
    }
    else
    {
            echo "boeing object is not instance of Airbus class\n";
    }
    

    Output:
    airbus object is instance of the Airbus class
    boeing object is not instance of Airbus class

    Php has three types of operators

    • Unary operators : They operate on one value, like !,++,–
    • Binary operators : They operate on two value, like assignment, increment and assignment, comparison, multiplying
    • Tertiary operator : ?: It is used for comparison, it is used like in here ( $compare_me == $compare_me_second ) ? $we_are_same : $no_we_are_not_same; If $compare_me and $compare_me_second are same it returns $compare_me
     
  • softwareandme 9:24 pm on April 21, 2010 Permalink
    Tags: , php syntax, , software development   

    Php Syntax And Variables (2) 

    Hi,

    We are going to learn php syntax and variables on this article.

    We have talked about php syntax on the first php article, the syntax looks like c,c++,java and if you know one of these languages’ syntax it will be easy to learn php syntax.

    Php is a scripting language and we must say to its interpreter where the php code begins and where it ends. We use to tell the php interpreter it is a php script and it should interprets the script among these tags.

    <?php
    // What are these slashes?
    //Php script ends here
    ?>
    

    //: Double slashes means this line will not be interpreted by the interpreter, this line wont run , it is used for comment lines. Comment lines may be used to add extra information about the code, adding todo item, informing your colleagues about the code, etc.

    Before starting php syntax again we should look at what are variables and how can we define them. Variable stores data in it, variable name is a symbolic name associated with a value. Php has different variable types but php dont use them to define variables’ types. Php knows type of variable according to its value.If you assign a string to a variable then you may assign an integer and again you may assign an object to the variable.

    If you try to do this on C++ you have to use type casting. Php is a loosely typed language because of this feature.

    <?
    $string = 'Hello world!'; //String variable
    $string = 7; //Integer
    $string = 7.3; //Floating number , Float
    $string = new Object(); // Object
    ?>
    

    Php variables have $ sign in front of them. The second character of the variable i mean the character after $ sign must be a letter or underscore. Variable stores data so we should know how to assign data to a variable, we assign data to a variable by = (equals) sign. Equals assigns from right to the left, what does it mean? It means = (equals) gets the value from its right and puts it into its left. Php uses ; sign to assign values,references to variables, run functions.

    Php uses { } bracets for code blocks, code block is a piece of code which does something (multiply two numbers, checking if user has logged in etc), we write code inside { and } tags in code blocks. Code blocks are used in comparisons, functions, class methods, class declarations.

    In programming languages there are operators for making some processes on variables,functions,objects, like multiplying two numbers, assigning an object as a reference, comparing two strings etc. The next article describes php operators so please try to understand the operators which are located below;

    Arithmetic Operators

    Operator Description Example Result
    + Addition x=2
    x+2
    4
    - Subtraction x=2
    6-x
    4
    * Multiplication x=4
    x*3
    12
    / Division 8/2
    16/4
    4
    4
    % Modulus (division remainder) 7%2
    10%8
    10%2
    1
    2
    0
    ++ Increment x=7
    x++
    x=8
    Decrement x=7
    x–
    x=6

    Assignment Operators

    Operator Example Is The Same As
    = x=y x=y
    += x+=y x=x+y
    -= x-=y x=x-y
    *= x*=y x=x*y
    /= x/=y x=x/y
    .= x.=y x=x.y
    %= x%=y x=x%y

    Comparison Operators

    Operator Description Example
    == is equal to 4==8 returns false
    != is not equal 4!=8 returns true
    <> is not equal 4<>8 returns true
    > is greater than 4>8 returns false
    < is less than 4<8 returns true
    >= is greater than or equal to 4>=8 returns false
    <= is less than or equal to 4<=8 returns true

    Logical Operators

    Operator Description Example
    && and x=6
    y=3

    (x < 10 && y > 1) returns true

    || or x=6
    y=3

    (x==4 || y==4) returns false

    ! not x=6
    y=3

    !(x==y) returns true

    There are also different operators in php we try to explain them in our next article.

     
  • softwareandme 4:20 am on April 20, 2010 Permalink  

    Php Programming Language (1) 

    Hi,

    I was so busy so i could not write any content to my blog as i promised. I will try to describe what is Php and how,when and why should you use it. I am writing the tutorial from scratch and if i have some typos or errors on my tutorials please let me know.

    First of all, Php is a programming language and it is a scripting language which means it is not compiled to machine code directly it is interpreted from source code or byte code. It is originally designed for web development to produce dynamic web pages by Rasmus Lerdorf in 1995, it was called Personal Home Page. Php is developed in C language, php extensions are developed in C also, we will try to look at developing php extensions later. Zeev Suraski and Andi Gutmans developed the parser and changed the name of the language to Php Hypertext Preprocessor. They also rewrote the core of Php and named it Zend Engine and founded Zend Technologies.

    Php syntax looks like C syntax. Before Php 4 the language did not have any Object Oriented Programming features, with Php 4 some limited OOP features were added to the language. Php 5 brought a lot of OOP features, if you want to look at some of these features please http://php.net.

    This is the first article and its aim is giving background information about Php, but we may look at php syntax, it is not too early to look at php syntax.

    $message = 'Hello world!';
    echo $message;
    ?>
    

    Script assigns a string value to a variable
    Then echo prints the variable’s value

    Output:
    Hello world!

    What is variable? What is echo? What is <?php and ?>? You are right we will discuss them in our next post.

    Hope you like the article about introduction to php

     
  • softwareandme 4:00 pm on October 20, 2009 Permalink | Log in to leave a Comment  

    Software Development Life Cycle 

    I have found some good images on internet related to software development life cycle

     
  • softwareandme 3:35 pm on October 20, 2009 Permalink | Log in to leave a Comment
    Tags: bass, guitar, Music, rock   

    Some good bass songs 

    I asked this question when i first bought a bass guitar, i should add some songs here. Dont try to play songs just try to learn how to play a bass guitar. Learn the theory and then practice all the time then you can play any song you want to play, I will try to add good songs which have good bass riffs and  lead bass guitars in them.

    Metallica – Orion
    Metallica – My friend of misery
    Metallica – Anesthesia
    Doobie Brothers – Long train running
    Queen – Another one bites the dust
    Iron maiden – Powerslave
    Iron maiden – Wasting love
    Megadeth – Dawn Patrol
    Megadeth – This was my life
    Megadeth – A tout le monde
    Larry king – Stand by Me
    Baris Manco – Donence
    Baris Manco – Gulpembe
    RHCP – Snow
    RHCP – (All of the songs )

    These are the songs i like lead bass in them.

    Blogged with the Flock Browser
     
c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
shift + esc
cancel
Follow

Get every new post delivered to your Inbox.