KBD

Keith Devens .com

Thursday, November 20, 2008 Flag waving
I was talking recently to a friend who teaches at MIT. His field is hot now and every year he... – Paul Graham

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 →
November 2008
SunMonTueWedThuFriSat
 1
2345678
9101112131415
16171819202122
23242526272829
30 



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

Recent comments XML

new⇒Java join function

Meh, don't have null strings in​your string arrays imo, but you're​welcome ...

Keith: Nov 19, 7:51pm

Girls, please don't get breast implants

sorry but another thing i have to​make a comment on about you​men...the men...

happynow: Nov 17, 11:36pm

Books by Vincent Cheung

to all Cheung​fans:

read:

http://www.progin​osko.com/aquascum/cheung.h...

Zamir: Nov 16, 9:07am

Spider solitaire

To undo or not to undo that is the​question.
I'm an undoer. 
My dad​was n...

Can Turk: Nov 15, 2:50pm

Generated in about 0.092s.

(Used 7 db queries)

mobile phone