KBD

Keith Devens .com

Friday, March 19, 2010 Flag waving
Ever wish you could freeze frame a moment in your day, and look at it and say "this is not... – Daniel (Mrs. Doubtfire)

Archive: December 03, 2003

← December 02, 2003December 04, 2003 →

Daily link icon Wednesday, December 3, 2003

Daily Show

"I'm really glad we're bombing countries, it's the only way I learn geography." - Jon Stewart (funny man)

Awesome skateboarding video

Check out this awesome skateboarding video:
http://www.actvsdei.com/~fookied/Skate/rodneymullenspartformopinion.WMV

Page execution time code on my site

Someone recently asked me in an e-mail how I generate the "This page took about x seconds to generate" message on my site. As I started to reply, and pasted the code I use into my e-mail client, I realized that this would work much better as a weblog entry (you get source-code highlighting here). So, here's how I do it:

I have one function, called timer().

<?php
function timer($finish false){
    static 
$start_frac_sec$start_sec$end_frac_sec$end_sec;
    if(
$finish){
        list(
$end_frac_sec,$end_sec) = explode(" "microtime());
        echo 
'<p style="font-size: smaller">This page took about ' .
            
round(
                (
                    (
$end_sec $start_sec)
                    + (
$end_frac_sec $start_frac_sec)
                ),
            
4) . ' seconds to generate.</p>\n';
    }else{
        list(
$start_frac_sec,$start_sec) = explode(" "microtime());
    }
}
?>

Because of the $finish parameter, you can use one function to both keep track of the time (which works without global variables because of the static variables) and print it when you're done. So, I call timer() around the start of my script, and timer(true) around the end of it.

Draft posts

One of the features I definitely need to get into my weblog after I get my new CMS done is draft posts. I've been wanting to do a big post on Federalism, states' rights, marriage, the Supreme Court, Christian Reconstruction, limited government, etc. But, I don't want to post something that's not done, and I don't want to be rushed to publish it just because I can't save it as a draft. So... feature request to myself.

More on the Wilson/Plame scandal

Just like no blood for oil, I hope this is the last time I'll post on the Wilson/Plame "scandal". Reynolds has a post saying that the scandal is bogus because they're both obviously self-serving publicity-hounds. Absolutely Yes, and that's more wood on the fire. I've been arguing that this whole "scandal" is bogus for a while.

Crufty code

Ack! People actually write code like this? Run and hide! Though, these examples are small little monsters, like the tiny little Ash's in Army of Darkness, not like the big monster that comes out of Ash when he eats one of the little Ash's who makes sweet love to Ash's woman.

← December 02, 2003December 04, 2003 →
March 2010
SunMonTueWedThuFriSat
 123456
78910111213
14151617181920
21222324252627
28293031 



RSS feed RSS feed for Keith's Weblog
Atom feed Atom feed for Keith's Weblog
Weblog archive
Recent comments
  on 2 posts

Recent comments XML

I hate ASP.NET

I hate ASP... I was doing wonders​with PHP, then suddenly one of my​clients...

Johnies: Mar 17, 6:14am

Quantum physics and free will

I knew you were going to say that....

Tom Massey: Mar 15, 9:26pm

Generated in about 0.059s.

(Used 7 db queries)