Archive for February, 2009

More about formatting, layout and Web design

For more advanced formatting, Web designers use a variety of techniques based on style sheets to customized components of a Web page and Web site. These include  padding and margin and width settings to indent and line up paragraphs, headings, tables, and other components. In addition to using tables for layout, modern browsers can also use layers to locate components exactly on the Web page, and layers are bing used mroe and more. All this is achieved using style sheets and you will want to research CSS to learn more. Since this course is not a complete HTML/CSS course, we’re just introducing general concepts.

For an EXCELLENT introduction to Web design and standards that wil start you off right as a Web designer/developer and help you avoid many bad design approaches, check out Designing with Web Standards by Jeffrey Zeldman. It does not get any better than this – I cannot recommend it enough!

Leave a Comment

How do I line up prompts and input boxes in a form?

Any easy way to do this is by using tables (see page 87 for some discussion of this). If you add a table (<table>) in your form, you can combine a prompt and either input box or drop down in each row (<tr>). The prompt goes in the first column of the row (first <td> and the input box or dropdown goes in the second column (second <td>). You can then eliminate your paragraphs around these items since the table rows will lay them, one line at a time, and the columns (td’s) will line them up. Remember to close the table! Be sure that your <table> and </table> tags are located appropriately within the <form> tags. Here’s an example:

<form action=”circle.php” method=”post”>
<table>
<tr>    <td>What is the radius of the circle?</td>
<td><input type=”text” size=”10″ name=”radius” /> </td>
</tr>
<tr>    <td>What do you want to know?</td>
<td><select name = “request”>
<option>Circumference</option>
<option>Area</option>
</select>
</td>
</tr>
</table>
<p><input type=”submit” value=”Tell me what I want to know” /> </p>
</form>

Leave a Comment

Help!! My PHP Code Displays when I view it in a browser!!

The most common question I hear from students goes something like this:

Help!!!!! I am working on the homework for chapter 5 and am having some trouble. When I view my fixIt in my web browser, it appears like this: (same for the Modify and other exercises):

Your hourly wage is $ $hourlyWage and you worked $hoursWorked hours

“); print(”

Your wages are $$wage
“); ?>

Good news – that’s an easy one, it’s not your code. If you connect to a PHP file and see the PHP code instead of the results, it means you are opening your files using Windows Explorer instead of typing the URL to the Web server in your Web browser’s address box. You must open your HTML and PHP files using the URL, beginning with http://localhost/Webtech

Even
though you may have started your Web server, you are not connecting to
it if you just double click your HTML or PHP files in Windows. When you
do that the browser opens the files but does not connect the Web
server. You can always tell by looking at your browsers address window.
If you see an address that begins with file:// that
means you are
not connecting to the Web server. Change to the address in this window
to URL’s begining with http://localhost/webtech/ in order to connect to
your files under the Web server, for example:

http://localhost/webtech/coursework/Chapter05/Fixit1.php
or
http://localhost/webtech/coursework/Chapter05/Modify1.html

Leave a Comment

Check it out! A interactive Flash tutorial!

Check it out! I have developed a Flash based interactive tutorial to help explain  basic operations and control structures. You can walk through code samples, one instruction at a time, and watch the effect of each instruction on variables, tests and output. Just click the link to try it out. You can also download and distribute it freely (just right click the link to save a copy to your local drive). Note that the application may not be changed, and copyright remains fully with the author. I intend to add and modify the tutorials as time permits – the link will always bring up the latest version.

I’d like to know what you think. Is this useful? Right now the code sample are generic, not language-specific I’m thinking of a feature that would let you see code in your language of choice, for example PHP or Java or C++ or whatever. What do you think?

, and also to allow users to choose between different programming languages when viewing the code samples.

Leave a Comment

Chapter 3 Exercises: writing algorithms

Algorithms can be confusing at first. In these exercises, you are writing instructions that you will later convert into code for the computer to execute. In these exercises, the instructions are broken down into two separate algorithms. The first algorithm provides instructions to generate a form used to get data from the user and send this to a php program. The second algorithm provides instructions for the php program to receive the data from the form, process it, and display the results.

It helps to think about giving the same instructions to two people. The first person will ask a user for information, then send the information to a second person. The second person will receive the information, perform calculations and other operations as needed, and then announce (display) the results to the user. Your job is to write the instructions that these two people must follow, being careful to ensure that the instructions are correct, understandable, efficient, and in the right order.. Later you will convert these into actual code that the computer will execute.

Leave a Comment

Do you have corrections or suggestions?

If you find errors in the book (I’m sure you will!) or have suggestions please take a moment to reply to this postand share them. It will help me to improve the next version and allow some discussion also. A list of all corrections that have been found so far can be found on the textbook Web site.

Leave a Comment

Do you get a socket address or port 80 error when you try and run the Web server?

If you get an error that refers to a socket address,or port 80, these indicate that xampp can’t start because port 80 is already in use. This means that you are running other piece of software that is already using port 80. The most likely candidates are Skype or another Web server such as MS IIS or Cold Fusion server.

SOLUTION 1: Exit the program that is causing the conflict, start xammp again and it should run with no problem. For SKYPE, see SOLUTION 2 below. If you are running another Web server or can’t determine what program is causing the conflict, SOLUTION 3 below may be simplest for you.

SOLUTION 2 (IF YOU USE SKYPE): Skype does not actually need port 80 but will use it if it’s available. So if Skype is running BEFORE you start xampp you will get an error. But if you run Skype AFTER starting xamppp, both programs should run OK.  Alternatively you can tell Skype not to use Port 80, as follows.

Depending on your version of Skype. either:

(a) Go to File-> Options -> Connection or

(b) Go to Tools->Options->Connection

Now Uncheck Use Port 80 as an alternative for incoming connections. You may need to restart Skype after doing this. You should now be able to run xamppp with no problem.

SOLUTION 3: If you cannot determine which software is causing the conflict, OR if you want to run both programs, you can tell xampp to listen to port 8080 (the alternative for port 80). IMPORTANT: Once you make the change to accomplish this you will need to restart xampp, and use http://localhost:8080/ in the address window instead of just http://localhost/. Here are the changes to use port 8080:

Start a text editor and choose Open File. Browse to your xammplite folder location and open xampplite\apache\conf\httpd.conf. You will make TWO changes:

  1. Somewhere around line 53 (or just search for this), you will find the line: Listen 80 Change this to: Listen 8080 (NOTE: do not change the lines that begin with # – these are comments and will not effect the configuration)
  2. Somewhere around line 169 (or just search for this), you will find the line: ServerName localhost:80 Change this to: ServerName localhost:8080 (NOTE: do not change the lines that begin with # – these are comments and will not effect the configuration)
  3. Save the file. Start xampp. It should now run with no problem but your URL must always begin with http://localhost:8080/ instead of http://localhost/

Leave a Comment