Nov 07

Discussion From Work…

Here are just a few articles to back up my statements that the logic _should_ stay out of the database. If you have some feedback you want to provide I’m always open and can be swayed to the Stored Procedure way - but, they do have to be compelling arguments.

Quote(s) straight from MySQL:

“However, stored procedures of course do increase the load on the database server system, as more of the work is done on the server side and less on the client (application) side.”

“Triggers and Stored procedures are wonderful tools, but they come with a price. Enforcing the business rules at the database level allows you to be confident that the data conforms. There are a few cautionary notes however.

The first is that you will probably end up creating your own procedural language which will differ from the other procedural language and start to introduce further discrepancies. If possible, using an existing language and creating an interpreter for it would be preferable. Although I am fluent in Oracle PL/SQL and SQL Server 2000 T-SQL, I know that I would really rather not be. It would be an advantage to me to be able to use a standard language so that I could leverage those skills elsewhere. A database where I had to learn yet another proprietary instruction set would make me dubious of wanting to get involved with it.

Performance will degrade and it will take awhile to get it to a satisfactory level. This does not take anything away from the development team, it has been true of every database system when they have done this. DB2 still has a reputation of being slow and a memory hog when you use their triggers and stored procedures. Teradata only recently added the ability to use them and it implemented them so poorly that nobody wants them. Be prepared for the performance hit and the resulting aftermath.

A possible way around this would be to include further support for server software that applies the business rules without actually being on the database. J2EE, for example, could be utilized with Enterprise Java Beans and have the exact same net effect as having stored procedures and triggers, without actually having to modify the database.”

–This also brings up a very good point… look at mysql system requirements… less of a system is needed, where as with stored procedures you need a workhorse with loads of RAM to cache all of those stored ‘compiled’ procedures. Not to mention including the processor time needed to compile the stored procedures in the first place (don’t forget page-swapping to handle all the memory requirements, reloading of the stored procs at restart… I could go on…).

http://dotnetjunkies.com/WebLog/johnwood/archive/2005/01/19/46398.aspx

http://weblogs.asp.net/fbouma/archive/2003/11/18/38178.aspx

http://www.windowsitpro.com/sqlserver/forums/messageview.cfm?catid=1669&threadid=130201

On a lighter note: What happens with more procedure calling than is necessary in JAVA?

http://madbean.com/anim/jarwars/

Jul 27

Definition of Vista...
So… I could not come up with real reason why Microsoft* named their OS ‘Microsoft Windows Vista’. Then, it dawned on me that I really didn’t know what a vista was in terms of the context they were using it. So I used Tiger’s happy little dictionay feature… low and behold it all started to make sense.

*Copyright & Trademark of the Microsoft Company IP used as a reference.

Jun 11

So in a effort to do more I’ve decided to blog a little more often. We’ll see how long that lasts. In the mean time I ran across robotics articles on http://www.engadget.com/. This one seemed to be the most interesting… but this lead to just the beginning… the appearance is what disturbes me.

Until next time.

May 06

I have been using a package from http://www.entropy.ch/software/macosx/php/ to get an up to date version of PHP for OS X Server. I really like the package and it’s options work great and do an excellent job of keeping up to date as well as making sure they do not break the default Apple settings.
I have recently had to use MSSQL 7.0 database to connect to some legacy data. I use ADODB to extract the SQL layer so I could change the database connections one it was all ported. Here is the only thing I had to add to get it to connect.

I have learned that in order to get ADODB to connect to MSSQL server (v7.0) you have to modify /usr/local/php/etc/freetds.conf (/usr/local/php5/etc/freetds.conf) by adding an entree such as this.

[sql.example.com]
        host = sql.example.com
        port = 1433
        tds version = 7.0

The host has to match the entree for ADODB to pick it up. This works for both 4.3.x and 5.0.x.

Just thought I would share with the online community.

BTW: Many thanks for Marc for including FreeTDS. You have made our server migrations from various platforms to OS X so much easier.

Mar 06

So, I’ve been a little busy at work. Let’s just say with Chris passing on, someone leaving the company, and sort of new hire(3 almost 4 months) out with back problems… my life has been nothing but boring. It’s great being the one person the entire company counts on seriously. Trial by fire is important it builds character, experience, and at the core sees how well you manage under extreme pressures. It keep thinking of the Army of one jokes. I’m the IT of one. Which leads me to the reason for my post.

Code!

I’ve found that lately I’ve been in research mode… very code productive lately. As a result this was created. I posted this on php.net but thought since it is my own work I’ld post it here just in case something happened to it.

Start Original Post

I figured out a way to create a simple progress bar that is for the most part cross platform. Seeing as I got my ideas from this site (http://www.php.net) it’s only share to give back to the community.

Note: Something interesting about browser buffering… you have to have the < html >< body > for Firefox and some other browsers to recognize items by their id in Javascript. So I recommend using some sort of header function before calling this function.

Code
< ? php

function fn_progress_bar($intCurrentCount = 100, $intTotalCount = 100)
{
   static $intNumberRuns = 0;
   static $intDisplayedCurrentPercent = 0;
   $strProgressBar = '';
   $dblPercentIncrease = (100 / $intTotalCount);
   $intCurrentPercent = intval($intCurrentCount * $dblPercentIncrease);
   $intNumberRuns++;

   if(1 == $intNumberRuns)
   {
       $strProgressBar = <<< BAR
< table width='50%' id='progress_bar' summary='progress_bar' align='center'>< tbody>< tr>
< td id='progress_bar_complete' width='0%' align='center' style='background:#CCFFCC;'> < /td>
< td style='background:#FFCCCC;'> < /td>
< /tr>< /tbody>< /table>
< script type='text/javascript' language='javascript' >
function fn_progress_bar_update(intCurrentPercent)
{
   document.getElementById(’progress_bar_complete’).style.width = intCurrentPercent+’%';
   document.getElementById(’progress_bar_complete’).innerHTML = intCurrentPercent+’%';
}
< /script >
BAR;
   }
   else if($intDisplayedCurrentPercent <> $intCurrentPercent)
   {
       $intDisplayedCurrentPercent = $intCurrentPercent;
       $strProgressBar = < << BAR
< script type='text/javascript' language='javascript' >
fn_progress_bar_update($intCurrentPercent);
< /script >
BAR;
   }
   if(100 < = $intCurrentPercent)
   {
       $intNumberRuns = $intDisplayedCurrentPercent = 0;
       $strProgressBar = <<< BAR
< script type='text/javascript' language='javascript' >
document.getElementById(’progress_bar’).style.visibility=’hidden’;
< /script >
BAR;
   }
   echo $strProgressBar;
   flush();
   ob_flush();
}

?>

End Original Post

Example


< ? php

$intTotal = 5000;

for($intCounter = 0; $intCounter <= $intTotal; $intCounter++)
{
fn_progress_bar($intCounter, $intTotal);
}

? >

Future Ideas

  • Make it so you can have several unique progress bars per page with their own progress.
  • Make sure it is as close to 100% cross-browser as possible.

Credits

If you copy and paste be sure to give credit.

If you do find this useful comment here, Thanks.