John Hesch

Echoing my thoughts and interests

Archive for January, 2006

Looks like a new virus is set to be unleashed on February 3rd. This virus targets the following file formats.

  • DMP - Oracle files
  • DOC - Word document
  • MDB - Microsoft Access
  • MDE - Microsoft Access/Office
  • PDF - Adobe Acrobat
  • PPS - PowerPoint slideshow
  • PPT - PowerPoint
  • PSD - Photoshop
  • RAR - Compressed archive
  • XLS - Excel spreadsheet
  • ZIP - Compressed file

As always, never open an email attachment from someone you don’t know, and even if you know the sender check the attachment type.

“Imagine 2006,” a benefit concert to support the arts in local charter schools will host some of Utah’s finest recording artists Saturday, January 28 at 8:00 p.m. at the American Leadership Academy (1172 Del Monte Rd., Spanish Fork, UT).

Among the line-up of musicians are such favorites as Alex Boye, Jenny Jordon Frogley, Providence, Julie de Azevedo, Greg Simpson, and George Dyer.

Tickets are $9 and are currently on sale at Deseret Book stores in Ft. Union, Orem Parkway, University Mall, American Fork, and Spanish Fork as well as online at www.deseretbook.com under the link for tickets.

For some reason my server is seeing spikes in the number of processes which is causing my server load to increase to levels that basically make the server inoperable. This is happening several times a day. Until I find out what the cause is, I implemented some code to check the server load every other minute and if the load is above 5, restart httpd.

PERL:
  1.  
  2. #!/usr/bin/perl -w
  3. #use strict;
  4. $|++;
  5.  
  6. open(LOAD,"/proc/loadavg") || die "couldn't open /proc/loadavg: $!\n";
  7. my @load=split(/ /,<LOAD>);
  8. close(LOAD);
  9.  
  10. if ($load[0] > 5) {
  11. `/sbin/service httpd restart`;
  12. } 

Save this as loadavg.pl and run it with cron. We shall see.

I found a really cool PHP, MySQL, CSS, and JS Quick Lookup tool. Since I now spend all my time building web applications in PHP, MySQL and CSS this tool saves me a lot of time.

Update:

Never mind, I finally figured it out. I was referencing the function Get() in the GetList() function and Get() was not searching by ItemID.


I have posted this problem on several PHP topic forums and have been working on it for several days and I cannot get it to work properly. You're my last hope.

I have the following function written in PHP

PHP:
  1.  
  2. function GetList($Value)
  3. {
  4.     $order_items_List = Array();
  5.     $Database = new DatabaseConnection();
  6.     $query = "select * from order_items where (IOrderID = $Value)";
  7. //        echo $query;
  8.     $Database->Query($query);
  9.     for ($i=0; $i < $Database->Rows(); $i++)
  10.         {
  11.             $order_items = new order_items();
  12.             $order_items->Get($Database->Result($i,"IOrderID"));
  13.             $order_items_List[] = $order_items;
  14.         }
  15.         return $order_items_List;
  16.     }

There are two records in the database. They each have a unique ItemID but the same IOrderID. When I try to display the results of the query in the above function I get two instances of the first record and not one instance of both records.

If I echo the query in MySQL I return both records as expected.

SQL:
  1. SELECT * FROM order_items WHERE (IOrderID = '10')

Here is what I'm using to display the results

PHP:
  1.  
  2.  $items = new order_items();
  3.  $itemslist = $items->GetList(10);
  4.     foreach ($itemslist as $items)
  5.     {
  6. echo "<tr>";
  7. echo "<td class=\"list\" height=\"25\">".$items->ItemID."</td>";
  8. echo "<td class=\"list\" height=\"25\">".$items->ISKU."</td>";
  9. echo "<td class=\"list\" height=\"25\">".$items->IDescription."<br /></td>";
  10. echo "<td class=\"list\" height=\"25\">&nbsp;</td>";
  11. echo "<td class=\"list\" align=\"right\" height=\"25\">".$items->IPrice."</td>";
  12. echo "<td class=\"list\" align=\"right\" height=\"25\">".$items->IPriceExtended."</td>";
  13. echo "</tr>";
  14.     }

If I add the following to display the database results within the function

PHP:
  1.  
  2. echo $Database->Result($i,"IOrderID")."<p>";
  3. echo $Database->Result($i,"ItemID")."<p>";
  4.  

The results of the echo are the two records as expected.

I can't figure out why my code above won't return both records. Any ideas?

01-13-06

How To Make Your iPod Faster

Posted by John

An iPod is basically a hard drive with built-in software, and just like your PC hard drive your iPod needs to be defraged to keep it in tip top shape.

Here's a pretty good article explaining how to send the videos you have on your video iPod to your TV.

01-8-06

Time To Update Copyrights

Posted by John

If you haven't done so already, you should update the copyright year on your website. I learned several years ago that this task can be automated if you program in PHP. I use the following on KZION.

PHP:
  1.  
  2. Copyright &copy; 2000&#8211;<?php echo date('Y'); ?> KZION LDS Radio&nbsp;&nbsp;&nbsp;All Rights Reserved.
  3.  

This bit of code simply prints the current year. Digital Web Magazine has the code to do the same thing using SSI or Smarty.

All times are MST

To air January 1, 2006

  • New Years Resolutions with music by The Pearsons – Gentle to air during the Sounds of Sunday
  • 12:00 AM and 12:00 PM - Gideon with music by Wade Egan-Amazing Things
  • 4:00 AM and 4:00 PM - Abraham with music by Showtime Co - Sacrifice
  • 8:00 AM and 8:00 PM - Nicknames with music by Showtime Co - Old Clothes

To air January 8, 2006

  • 12:00 AM and 12:00 PM - The Garbage Truck Driver with music by Molly Bice - Not Too Far From Here
  • 4:00 AM and 4:00 PM - The Switch with music by Angie/Rachel/Becca - Little Things
  • 8:00 AM and 8:00 PM - Vision of Enoch with music by Hillary Weeks - Be Still
  • Warm Bricks to air during the Sounds of Sunday with music by Liz Draper - One Heart In The Right Place

To air January 15, 2006

  • 12:00 AM and 12:00 PM - Persistance with music by Brett Raymond - Hold On, The Light Will Come
  • Lord, I Believe to air during the Sounds of Sunday with music by Felicia Sorenson - Which Part Is Mine?
  • 4:00 AM and 4:00 PM - Tom with music by Michael Farnes and Rachel Phelps - His Love
  • 8:00 AM and 8:00 PM - Michael’s Phone Call with music by Afterglow - I Know He’s There

To air January 22, 2006

  • 12:00 AM and 12:00 PM - Dawni's Disappointment with music by Courtney Gardner - Safe Harbors
  • 4:00 AM and 4:00 PM - The Cleansing with music by Steven James and Vickey Pankee-On That Day
  • 8:00 AM and 8:00 PM - That One Year with music by Rich Gibbons - I Feel The Answer
  • Reflections/Ski Trip will air during the Sounds of Sunday with music by Cope, de Azevedo, and Webb - Return With Honor

To air January 29, 2006

  • They That Be With Us will air during the Sounds of Sunday with music by Johanna Frechette Perry - He Gives Me Strength
  • 12:00 AM and 12:00 PM - Forward Momentum with music by Saturday’s Warrior Cast - Line Upon Line
  • 4:00 AM and 4:00 PM - Love with music by Gibbons Family - As I Have Loved You
  • 8:00 AM and 8:00 PM - Pumping Charity with music by M Child, M Payne, and R Hoffman - Power To Serve
Graytone | Design: Tenant Report