Installing and using your development tools

Dr Andres Baravalle

Installing and using your development tools

  • Your development tools: overview
  • Using your development tools

Your development tools: overview

Your development environment

By the end of this workshop, you will become familiar with these editors:

Do not use software as Microsoft Word or TextEdit. They are not suitable for programming.

PHP and code generators

A number of environments automatically generate your PHP code (e.g. Adobe Dreamweaver when using Behauviours).

Never, ever use automatic code generators; automatic code generators make it very hard to mantain the code, or to build on top of existing code.

Instead, you must study the PHP lexical structure and speed up your development using:

  • Frameworks, as Zend, CakePHP or CodeIgniter
  • External libraries - e.g. PEAR classes.

Notepad++

Notepad++ is a general-purpose lightweight text editor, that can be used to write code in a number of different programming languages.

Editing features include:

  • Auto-completion
  • Syntax highlighting and syntax folding
  • Brace and indent highlighting
  • Regular expression find and replace
  • Macro recording and execution
  • Function list

Additional plugins allow to extend the program and integrate further features.

Eclipse

Eclipse is both an editor and a generic platform used to build editors.

The original codebase was developed by IBM, and is now developed and maintained by a large community.

Eclipse:

  • Can support most of the more commonly used programming languages, including Java, Python, PHP, C/C++ etc.
  • Is one of the most popular text editors (over 2,000,000 downloads as of September 8th 2015 for Eclipse 4.5)
  • Includes a large library of plugins that extend its features

Eclipse (2)

Editing features include:

  • Auto-completion
  • Syntax highlighting and syntax folding
  • Context-sensitive documentation
  • Regular expression find and replace
  • Project overview
  • Running and debugging scripts
  • Additional plugins allow to extend the program and integrate further features

Aptana Studio

Aptana Studio is a editor built on top of Eclipse, targeting development using Python and PHP

Aptana Studio is a more complete application compared to all the ones seen in the previous slides

  • It includes all the features of the standard eclipse, integrated with a large number of plugins focusing on Python, PHP and web technologies in general

Eclipse vs Aptana Studio

  • Use Eclipse for a lighter environment and/or if you need only few plugins
  • Use Aptana Studio for an environment with more features and easier support for debugging and running of scripts
  • Aptana Studio is a less stable application; you will notice occasional errors that are due to bugs in the codebase
  • Remember that neither you nor the university is paying for the software.

And it's all Open Source

Open Source is software released under a license that guarantees to its users the:

  • Freedom to use it
  • Freedom to modify it
  • Freedom to redistribute it

And it's all Open Source (2)

Free to use means that Open Source software can be used without restrictions:

  • It does not mean “free as in free beer”. Free is as in the French and Spanish libre
  • In your case, all the software that we are going to use in class is also “free as in free beer”

Other options

Other editors include:

  • Zend Studio
  • Netbeans
  • PHP Tools for Visual Studio
  • vim (of course)

Using your development tools

Using the CN5109 software in the UEL library

As part of this module we will be using a number of tools, amongst which:

  • Notepad++ (we will be using it during this workshop)
  • WinSCP (we will cover it in the next workshop)
  • Putty (we will cover it in the next workshop)

You can install all of them using the Application Catalogue (at UEL) or downloading them from internet if you are not at UEL.

Apache and PHP

During Workshop 1 you should have successfully installed Apache and PHP. After our first lesson, for security, maintanance and good practice reasons you will not be running your own version of Apache on your local machine at UEL.

You will instead use a remote installation of Apache and PHP for deployment (and a local installation of PHP for testing basic scripts).

Where to store your files

I suggest you store your files on your local documents folder or the desktop for the duration of the class and copy them on a pen drive at the end of each class.

Hello World

In the next activities we will be running a simple "Hello World" file in PHP

We'll create the file with all our editors and run it from the command line and from the server.

The file should just include the following line:

<?php
echo "Hello  World";
?>
              

Activity #1: running hello.php

Run the the hello.php file from the command line.

Please go back and review Activity #6 in Workshop 1 if you do not remember how to run PHP files.

Activity #2: using Notepad++

  • Install Notepad++ (remember: use the Application Catalogue if you are at UEL or download it if you are NOT at UEL)

Notepad++ is available to download from here.

Activity #2: using Notepad++ (2)

Set up Notepad++ to run PHP scripts using the NppExec plugin:

The start-up string is:

NPP_SAVE
cd "$(FULL_CURRENT_PATH)"
"C:\Program Files\php\php.exe"  "$(FULL_CURRENT_PATH)"

Make sure you include the quotes and update paths as needed to reflect the local folder structure (it will vary depending on your lab).

Write your hello.php and run it! A screenshop it available here and demo (based on Python! you are using PHP) is available here.

Using the CN5109 software at home

Remember: CN5109 uses Open Source software only; that means that you can download and use the software at home.

If you are using a Mac or Linux, the good news is that we are against discrimination - even if you use a Mac. 

To work from home, you will need to install:

  • Apache and PHP: available for Windows, Mac and Linux
  • Notepad++ or another text editor: your text editor of choice would change would change depending from your operating system. Feel free to experiement with other editors.

Activity #3: using Aptana (optional)

We'll set up and test Aptana as your development environment:

  • Install Aptana
  • Run Aptana Studio
  • Create a new PHP project
  • Open and create your hello.php script

A demo (based on Python! remember: you are using PHP) is available here.

Notes on Aptana

You may find start-up errors when running Aptana Studio; you can normally ignore the start-up errors.

You do not need to configure Git support; please select "Check this if you do not want to be asked again".

Aptana start-up errors

Activity #4: using Eclipse (optional)

Set up Eclipse as you have done with Aptana Studio and:

  • Install Eclipse
  • Run Eclipse
  • Create a new PHP project
  • Open and create your hello.php script

Make sure that you configure your PHP path. Use Run -> Run to test your script

Have you finished?

Share your experience on twitter #uel #cn5109

This work

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License

Creative Commons License