Okay, so you've set up your server and are ready to start writing HTML, CSS, PHP, Python, and Ruby. How can you do it?
It is essential that you set up a workflow that suits your needs. Reading this article will make your life 10× easier for the rest of the semester.
Step 1: Choose Your Interface
You first need to choose how you want to approach file editing. You have a few choices:
- You can use a command-line text editor, like emacs, vi, or nano.
- You can use a GUI text editor, like Notepad++ or TextWrangler.
- You can use a full-scale integrated development environment (IDE), like Aptana Studio -- Eclipse (open source) or PHPStorm (paid, but highly recommended).
The most important aspect to consider is what you are most comfortable using. In particular, you don't have to keep using command-line text editors for this class. The graphical user interface was invented for a reason. Don't feel like using vi or emacs will make you a good programmer, because I promise: it doesn't. If you like emacs or vi, that's great, but know that there are other equally powerful options.
Step 2: Set Up Your Editor
This section covers how to configure your editor of choice to be most efficient at web development.
Command Line Text Editors
The communities behind command-line text editors are strong, and so there are plugins available to make your editor of choice more well suited to programming in HTML, CSS, PHP, and other web languages. Here are some links to tutorials that will show you how to set up your command line text editor of choice:
- Emacs: http://emacswiki.org/emacs/PhpMode
- Vim: http://net.tutsplus.com/sessions/vim-essential-plugins/
- Nano: http://www.nublue.co.uk/blog/tuning-nano-for-web-development-syntax-highlighting/
Graphical Text Editors
Notepad++ and TextWrangler are free GUI text editors for Windows and Mac OS X, respectively. You can download them from here:
- Notepad++: http://notepad-plus-plus.org/ (you might want to save it to your H: drive)
- TextWrangler: Available from the Mac App Store or from http://www.barebones.com/products/TextWrangler/
There are tools available for both to speed up your web development routine. Here are some helpful web sites:
- Notepad++: http://adamzwakk.com/?p=512
- TextWrangler: http://magp.ie/2011/01/10/tidy-and-format-your-php-and-meet-wordpress-standards-on-coda-and-textwrangler/
Integrated Development Environment
Aptana is a web development toolkit that can be installed as a plugin to Eclipse or as a separate application. Web site: http://www.aptana.com/
Follow these instructions to install Aptana as a plugin to Eclipse.
- In Eclipse, go to Install New Software...
- Add the following URL: http://update.aptana.com/update/studio/
- Load the packages and install Aptana Studio.
- Restart Eclipse.
- In the Aptana Studio welcome screen, go to Plugins
- Install the Aptana Studio PHP plugin
- Restart Eclipse again.
Step 3: Saving Your Project
If you edit your files directly on the server using a command-line text editor, you can use them right away. However, if you do, you are in danger of accidentally losing your code because you don't have it backed up anywhere. It is easy to destroy your entire project by pressing the wrong key in vim/emacs/nano! CSE330 students in past semesters have lost days worth of work because they used vim/emacs/nano to edit their files but didn't commit them to SVN.
If you edit your files on your desktop, you will always have a second copy, so this is less of an issue. However, since SVN is a version control system, you should still backup your files to SVN at the end of the day.
Uploading Files to Your Server
If you edit files on your desktop, there are several ways to upload those files to your server.
- If you edit the files in Eclipse, just commit changes to your repository, and on your server, run
svn updateto pull the changes down. This works best if you have configured Apache to point to your SVN repository.
- You can use as SSH filesystem client to make local files automatically update on your server. For instructions, see the Web Server Configuration guide from Module 1.
- You can use an SFTP client like FileZilla (universal) or WinSCP (if on Windows) to upload files to your server. For instructions, see the Web Server Configuration guide from Module 1.
If you need help setting up an SSH filesystem or an SFTP client, you may ask a TA. Once everything is up and running, you will be able to easily upload files to your server for the remainder of this course.
To reiterate: It is highly recommended, although not required, to backup files using SVN no matter how you edit and save them.