Thursday, April 23, 2015

Terminologies of OOP : Class


  • A set of objects that have similar attributes(characteristics, which can be seen.) and methods.
  • Attributes and methods of a class can be used by each object from that class.

Terminologies of OOP : Object


  1. Object is the term used to explain many things.
    • Example: student, chair and circle .
  2. An Object consists of data and method
  3. Properties of an object are called data. In the real world, characteristics of an object can be divided into two types:
    • Data that can be seen such as a human with two hands.
    • Data that cannot be seen such as a human with a name.
  4. Method is a set of function that manipulates data, such as method DetermineStatus() can determine exam result for object student.

Advantages of using OOP

Code extensibility
  • Ability to add codes, which are already existing and consistent with needs.

Code reusability
  • Existing code can be tested first before it is inherited from previous module.
  • This will save cost and time needed to develop software.
  • With this method, it will help to increase programmer’s productivity.

Represent real world
  • Using object-oriented concept, it will assist the programmer in creating a module because data used represents real situations.

Data security
  • The use of encapsulation concept has made data to be protected from misuse by an unauthorized person.

History of Object Oriented Programming

In the 1960s, Simula language were developed by Norwegian Computing Center.
  • It became the first OOP language which applies the OOP concepts.
  • It was designed for the purpose of creating simulations, and was developed by Kristen Nygaard and Ole-Johan Dahl in Norway.

In the 1970s, Alan Kay developed Smalltalk language at Xerox Parc (Palo Alto Research Center).
  • Targeted to be understandable to people with no prior training in computer use.
  • Demonstrated by experiments conducted using children as programmers

In the 1980s, Bjarne Stroustrup at Bell Lab who had learned Simula during his PHD studies develop C++ as an extension of C. Later many other OOP languages were developed: Eiffel, Objective-C, Actor,Object Pascal, Java and etc

Object oriented programming

According to Wikipedia, Object Oriented Programming (OOP) is a programming technique that uses “objects” to design the applications and computer programs. It also can be define as a type of programming where the programmer can define data types and types of operations, which will be performed on the data structure.

  • By using this method, data structure will become an object such as Student object, which consists of data and functions. 
  • The programmer can create relationship between one object with another object such as an object inherits characteristics from another object
  • Object-oriented programming is a method used to write programs where data and behaviours are packaged together in one class. Object is a member of a class.

Friday, April 17, 2015

Disable php files execution in the certain directory

Most of website has an ability to allow users upload they files such as image or spreadsheet and uploaded into a certain directory. It's a good practice for security reasons to disable server-side parsing of scripts such as PHP.

As programmer, you must have security concern about your program, all data sent by users should be validated before being stored on the server. This is to prevent from risk of LFI/RFI vulnerability and harden the system from any exploit.

If you have access to the httpd.conf file, add the following rule to your virtualhost:
<VirtualHost *:80>
   <Directory "/path/to/my/web/uploads/directory">
     php_flag engine off
 </VirtualHost >

* Please replace /path/to/my/web/uploads/directory with you target directory.

Then save and restart you apache2 services. Now the php files cannot execute anymore from that directory. If you dont have permission to access httpd.conf files don't worry, You can denied php files execution with htaccess rule :
php_flag engine off

All these technique will turns off the php engine ;)

Tuesday, April 14, 2015

Ubuntu : Remove Apache2 autostart using sudo sysv-rc-conf

Peace be upon you! Do you remember my post about tutorial How to stop Apache2 and MySQL services from boot on Ubuntu linux? Somehow, it not working for the latest version of Ubuntu for Apache2. But after a quick googling, I found a solution for this problem.

Normally, we can just use chkconfig tool but this tool is missing in Ubuntu. For alternative, we can use sysv-rc-conf tool.

# Installing the sysv-rc-conf tool
sudo apt-get install sysv-rc-conf

# Check init script status for Apache2 services
sudo sysv-rc-conf --list apache2

# To disable Apache2 script
sudo sysv-rc-conf apache2 off

# To enable it again
sudo sysv-rc-conf apache2 on

Simple and easy, right ? See you again in next tutorial. Bye!

Sunday, April 12, 2015

Resize / scale android emulator (AVD)

Peace be upon you!


Resizing Android Virtual Device (AVD) emulator are problem that newbie found during debugging the android application. Sometimes, it took to much scale on your screen. I always hate when AVD emulator doesn't fit on the screen because I cant see the bottom of the AVD and it look silly.

# Solution :

To resize or scale the android emulator, you just need to insert additional command line argument inside run/debug configuration. You can refer from screenshot as below. Just add -scale 0.3 into that field. You also can change whatever suit with you screen and size that you prefer.
That all for now..see you later. Bye!

Thursday, April 2, 2015

The end of CrunchBang Linux

I was very upset when the CrunchBang developer announced to end the development, some of my server machine still running this distro. Crunchbang has probably one of the best Linux distro and best community that I ever saw. CrunchBang was incredibly compact and efficient linux operating system. Till now, I can't find any linux distro that use OpenBox WM that satisfy me just like this distro. Sayonara CrunchBang #!