Skim back through Chapter 2, and see how what we did on Friday’s class relates to what’s in that chapter.

Read Chapter 3, and do all of the coding examples.

If you don’t already have MAMP or WAMP on your home computers, I suggest one be installed so you can quickly work on your projects without relying on somebody else’s server. It’ll also give you much more flexibility in working with your own projects outside of this class.

I encourage you to play around with all examples. Change variables, make the code do more than the example intended. See how changes you make affect the outcome. It’s good if you have bugs in your code in this class, because you’ll learn how to fix them! This is called debugging. Of course, when you do real world projects. you don’t want bugs πŸ™‚

Now, do you know why they’re called bugs? It’s because back in the old days of vacuum-tube based computers, bugs would crawl into the system and cause the tubes to blow. So, the maintainers of those huge computer systems had to literally de-bug their machines!

Please let me know if you have any questions!

Best,

-Auri

Ok, we’ve built the Dan Akroyd Guessing Game, so now what?

Well, things to take away from the class:

  • You learned how to perform a postback, which is where you send form data back to the same page so you can continue processing.
    • Postbacks are good for validation, or for using the same page for multiple purposes.
    • One example of a good postback use is an email form. For example, you could have a Contact Us form. The business process for the form would be:
  1. When the page is first loaded, it shows the Your Name, Email Address, and Comments fields.
  2. After submitting the form, you postback to your page and make sure they filled everything out.
  3. If the fields were all filled out, then you would hide the form part, send their message to some contact at the company, and display a message to the user that the comment has been received.
  4. If the fields were not all filled out, then you would display a message saying so. They would then submit the form again and again and again until they finally filled it out properly, and thus the email would be sent.

You learned about validation. While we touched on it briefly, validation is one of the most important concepts to master. Since interactive Web sites live and die by how they respond to user input, you need to make sure the user has actually entered information you can work with. On an industry note, secure coding practices dictate that you always validate the data received. We will be going over secure coding practices and validation in our next class.

  • Remember what happened when we passed in a string and the shopping cart tried multiplying a number against a letter? Whoops!
  • I added code using an if statement to validate the POSTDATA read from the $_POST array to make sure I a) received any data at all and b) whether it was a number. If the data was invalid, I used echo to write a Javascript script to display an alert on the client and used PHP’s exit command to stop all processing on the server. Otherwise, the server would have still tried processing the data, regardless of what was displayed on the client.
    • For those who didn’t catch it, here’s the javascript I wrote:
    • <script type="text/javascript">alert("Sorry, the tire value appears to be incorrect. Please re-enter it."); history.go(-1);</script>
    • The history.go(-1) tells the user’s browser to go back one page, as if they had hit the Back button. The good thing about this function is the user is brought back to the form and it should already be filled out with the data they had previously entered.

You also learned about business process. Remember what programming in the real world is all about:

  • Programming is the digitization of a process, usually a business process.

So, if you document the process first, the program is much easier to write! You already know the steps you have to digitize. This is a very large part of writing a specification. If you don’t have a specification, and you don’t have a documented business process, your project will almost always ship late or never ship at all.

One last thing: You learned about some of the built in helper functions in PHP:

  • is_numeric(value), which checks to see if a value is a number.
  • rand(min, max), which returns a random integer number

You will end up memorizing many helper functions. They will make writing code much easier and much, much faster. Because many common tasks are taken care of by well-tested helper functions, you don’t have to write them yourself, which will make the code more reliable.

  • As Steve Jobs said: "The best line of code is the one you never have to write."

I hope you enjoyed the class! Please let me know if you have any questions!

Best,

-Auri

We discussed MAMP and WAMP as solutions for running Apache (a Web server) + MySQL (a relational database server) + PHP (a programming language) on your computer. Using these tools, you can create your class projects and run them on your computer.

If you have a Mac, you’ll want MAMP, which you can download here.

If you have Windows, you’ll want WAMP, which you can download here.

If you want to learn more about these solutions, go to their respective Web sites:

The I.T. Snowball

Posted: August 16, 2008 in Uncategorized

"I don’t know. I guess you didn’t take it down right."
You just powered down the Exchange Server!!!

Yeah… funny… all on this awesome site: http://www.thewebsiteisdown.com/

Thanks to Ron for this one!

We’re an expansion team, and we greatly improved!

As you may very well know, I attended the Segway Fest this year…

My photos are now online, so enjoy! Just hit up my photo albums, or click here to go there directly.

The Segway 500

Posted: August 10, 2008 in Hobbies

As part of Segfest 2008 (http://segwayfest2008.com/), you could go to the Speedway, where the Indy 500 takes place, and ride your Segway on the track.

They let us ride up and down the brickyard! Enjoy the video!

GENTLEMEN! START YOUR SEGWAYS!

Funny Indian Video

Posted: August 10, 2008 in Uncategorized

If you liked Tanak Tanak Tun, you’ll love this one…

Crazy Indian Video… Buffalaxed… PAPAYA!

Ok, so this was annoying the heck out of me. I love Windows Live Photo Gallery, but it installs with support for Quicktime. Its Quicktime support is provided via a process called WLXQuickTimeControlHost.exe. Unfortunately, whenever you open a folder that contains any Quicktime-associated files, the Quicktime support process uses 100% of one of your processors! Well that SUCKS!

Well, I found the solution today… Microsoft Knowledge Base Article 944563, which disables support for Quicktime in Windows Live Photo gallery. Fine by me – I can use Windows Media Player or Quicktime itself to view the MOV and MPEG-4 files.

Here’s the link:

http://support.microsoft.com/kb/944563

Enjoy!

Best,

-Auri

Ever wanted to start your own business, but weren’t sure of the steps? Well, my latest Consultant’s Corner article in ASP.NET PRO Magazine covers just that!

If you’re a subscriber, then it was in the August issue. Later this month you can read it online at www.aspnetpro.com.

Here’s the direct link to the article: http://aspnetpro.com/features/2008/08/asp200808ar_f/asp200808ar_f.asp

Enjoy!

-Auri