Pages

Sep 27, 2008

Celsius to Farenheit and Vice Versa

So, assignment #2 for my PHP/mySQL class was to create a page that will convert a numeric value from Celsius to Fahrenheit or vice versa. I started out this morning writing on my big marker board to write out all the stuff I had to have and process.

That part went pretty smoothly so I sat down to start coding the stuff on the board. But, when I uploaded the file I was in dismay as the calculation functions were obviously doing something, just not the right thing. After a couple of hours on and off it (doing other stuff that actually paid) I finally realized I had left the "$" off of a variable in both calculation functions... AMAZING! No telling how many sets of working code I had been through before discovering that.

So I finally got it working... or so I thought. The page is supposed to issue a error message if the input field is blank or if it has non-numeric input. Mine did that, but it also issued the warning when you loaded the page before any input. UGH! Back to debugging. I finally figured that out and all was going very well... or so I thought...

So when I tried to convert "0" from either F to C or C to F the page just kind of stared back at me with nothing. I looked over the formulas and saw nothing that could be wrong so I emailed my professor about it. He was kind enough to tell me I had discovered a nuisance in PHP. It seems that "0" is considered empty by PHP. So, there was nothing to convert, and it was neither empty or non-numeric so it did nothing. First he told me to play with using the === operator (which I had done early on when I was missing the $ in the variables) and then he suggested the is_null() fucntion. Shazaam! Put that on in and all was great... problem solved!

Or, so I thought. Another problem which had always been there, it just was not till now I could test to see it. When you enter 32 F to convert to C the result is seen as... you guessed it... empty by PHP. Now I have that conundrum to solve. Oops.. solved it by using the same is_null() instead of empty() again in the output.

YAY! Done. Here's the page. Now, wonder if I can give a visual diagram of this output like last week?

Sep 18, 2008

Pro Coders Would Consider This Child's Play

But, I don't care! I'm stoked I actually could do it! And without copying and mimicking someone else's code. For those of you who don't know, I enrolled in a PHP/mySQL course at Front Range Community College this semester. I figured it was time I actually buckled down and learned how to code for real (rather than finding code someone else wrote and using it or modifying it to suit my needs).

Today was our fourth class meeting and we came out with five assignments. I have to say the last one made me a little nervous. Especially when the instructor told us we would really not like him when we got to step 4 and 5 of the fifth assignment. Guess what... I don't hate him at all. (Of course, it's yet to be seen if I did it "wrong")

The fifth assignment was a story problem instructing us to create a PHP script that fictional high school students could use to estimate the time and cost for their jobs mowing lawns around the neighborhood. Here's the text of the problem:
    The students use the following method to estimate the time and cost of their jobs for customers:
  1. Calculate the total area of the yard in m² (Multiply the length of the yard in meters by the width of the yard in meters)

  2. Calculate the total area of the house in m² (Multiply the length of the house in meters by the width of the house in meters)

  3. Subtract the total area of the house from the total area of the yard to find the total area of the lawn that must be mowed.

  4. Find the total time it will take to mow the lawn knowing that a high schooler can mow 4.3m² of lawn/minute

  5. Find the total cost for mowing the lawn. The high schoolers charge $10 per hour to mow the lawn


    Given the following dimenstion for a Customer:
  • Length of Yard: 62 meters

  • Width of Yard: 93 meters

  • Length of House: 27 meters

  • Width of House: 20 meters


Write a program which uses PHP to output the following (and then a sample text output that should appear on the page).

So, check out my page (P.S. It looks like the output with the correct calculations... YAY!)
And, here's a link to my main page I'll use throughout the semester to link to all my projects/assignments... if anyone cares!

So, here's the crazy thing. I finally understand the addiction of coding. I've had friends for years who were hard core coders. And, though I always appreciated their zeal and passion to just sit and write code... I actually understand and have experienced it myself tonight... whoa! More problems... more code! I'm ready! (I think I'm addicted!) Is there a CWA (Code Writers Anonymous) chapter near me? I may need it!

Sep 16, 2008

Flashback Charts

So I stumbled upon a cool site tonight while reading some forums. It's called Flashback Charts and allows you to look up the number one song on the day you were born.

Mine is 1960 ... "Are You Lonesome Tonight" by Elvis Presley. And for those of you young critter friends who don't know this song...

[audio:http://www.craigkendall.com/audio/ElvisPresleyAreYouLonesomeTonight.mp3]

Go look yours up and post it here if you have a minute.

Sep 7, 2008

vendorHIPPO Video

Today should be fun. For the last couple of months I've been helping Dan Borgman over at vendorHIPPO.com with some stuff. We're about to switch him over to a new site later this week so we have lots to do.

One of the things Kendall Media Group is coming alongside the HIPPO to provide is video services for the markets and vendors he's working with. And, Dan wants to do some video on the site as well. So, today we're going to shoot an intro video as a "welcome to vendorHIPPO" piece for the main page of the site. We're shooting it at the Twenty Ninth Street Market in Boulder, CO so we have an authentic backdrop. It should be lots of fun and I'm hoping for some great outtakes to bribe Dan with.