KBD

Keith Devens .com

Friday, May 16, 2008 Flag waving
in God I trust; I will not be afraid. What can mortal man do to me? – David (Psalm 56:4)

Archive: January 26, 2002

← January 25, 2002January 27, 2002 →

Daily link icon Saturday, January 26, 2002

Whoa, you can load neat stuff right in your AIM profile. I didn't realize AIM let you do that. I have to play around. I also wonder if there's some security hole here.

No, I wasn't wondering, but thanks Ken.

"Where's all this snot coming from?"
"... Your nose?"
"No, but how is my nose making all of it?"
"... Gremlins?"

What's a caper?

Here's some info about PHP5 I just found. Uh, the string indexing by using braces already exists, and as far as I know has been there, and recommended, for awhile. This might just be a really old article.

Via my brother, Powers of Ten: "View the Milky Way at 10 million light years from the Earth. Then move through space towards the Earth in successive orders of magnitude until you reach a tall oak tree just outside the buildings of the National High Magnetic Field Laboratory in Tallahassee, Florida. After that, begin to move from the actual size of a leaf into a microscopic world that reveals leaf cell walls, the cell nucleus, chromatin, DNA and finally, into the subatomic universe of electrons and protons."

I wonder if the police department in Penryn, Pennsylvania have actually read the Harry Potter books?

Another case of liberal bias in the media. As reported by NewsMax.com, when three law students subdued a bad guy at a school shooting in Virginia last week, out of the 280 separate news stories about the incident, only four actually reported that it was with the use of guns that they were able to subdue the man.

Noting that the rampage was widely covered in the world's media, Lott wrote: "As usual, there were calls for more gun control. Yet in this age of 'gun-free school zones,' the vast majority of the news reports ignored the fact that the attack was stopped by two students who had guns in their cars. The quick response by two of the students, Mikael Gross, 34, and Tracy Bridges, 25, undoubtedly saved multiple lives," Lott reported.

Such selective reporting is not unusual, Lott noted. "In the other public school shootings where citizens with guns have stopped attacks, rarely do more than one percent of the news stories mention that citizens with guns stopped the attacks."

Lott cited research showing there are 2 million defensive gun uses each year. "After all, if these events were really happening, wouldn't we hear about them on the news? But when was the last time you saw a story on the national evening news (or even the local news) about a citizen using his gun to stop a crime?"

Such "misreporting actually endangers people's lives," Lott concluded. "By selectively reporting the news and turning a defensive gun use story into one where students merely 'overpowered a gunman' the media gives misleading impressions of what works when people are confronted by violence.

"Research consistently shows that having a gun is the safest way to respond to any type of criminal attack, especially these multiple victim shootings."

Of course, Dr. John Lott, who I've mentioned before, is the author of the groundbreaking work, More Guns, Less Crime. Here is the original article from the NY Post that the NewsMax article referrs to: The Missing Gun.

Ok, here's my programming dilemma. I have a task manager on my website programmed in PHP. I want to write a script that will e-mail me my tasks for the day. I can set up a cron job for it that will run it at 12:05am or something. For security, I may put the script that is run by the cron job in a folder outside of my public website, but I'd prefer not to if possible.

Those are the specs, here's my problem. My task manager is private, so it forces you to log in by forwarding you to the login page if you're not logged in. The cron job isn't coming from a browser so it returns no cookie with a session id to show whether you're logged in or not, and it wouldn't be logged in with the cron job anyway. So, how do I detect when the PHP script is running standalone from a cron job so I can make it bypass the login? It's probably not a big deal, I'm just not sure how to do it (what environment variables I should check, etc.).

Ok, here's what I did. Some variables are not available from the command line, like I thought. The manual didn't recommend a specific variable to use, but it did say explicitly that "If PHP is running as a command-line processor, [$PHP_SELF] is not available", so I used $PHP_SELF. I also found out about using PHP from the command line.

If $PHP_SELF isn't defined, I turn off sessions and the web-based authentication, which I don't think is a security hole because no one but me (and root) can run my scripts from the command line. I also set $PHP_SELF to $argv[0] so that my forms will still work in the code generated from the command line, and I set a "base href" for my script so it'll still go to the right place when I click on links in the HTML e-mail.

The cron job runs a notify script which calls my main tasks script from the command line and e-mails the output. So now I get my tasks in the mail every morning. I'll never forget anything again! Smiley

Check out the bottom of the most recent PHP Weekly Summary. The first I've heard of PHP 5!

"Right before we went to "press", a small discussion thread appeared on the list that was sparked by a message from Andi Gutmans. It seems Andi is contemplating putting an alpha version of PHP 5 on the actual php.net website. Doing this will allow the developers to test the new object model that had been created in the new zend engine, as well as get some feedback from users as to what else they feel may be missing. Look out for the release in the coming weeks."

Hey, Hosting Matters (my host) has a network status page I never knew about. It's brand new.

I'm on Callisto, by the way.

At OSOpinion, a fun story about how one guy got back at a spammer in a fairly creative way.

← January 25, 2002January 27, 2002 →
May 2008
SunMonTueWedThuFriSat
 123
45678910
11121314151617
18192021222324
25262728293031



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

Recent comments XML

"IMDB for music"

IMDB for Music? It looks to be a​couple of years old...​http://MusicTell.co...

Ken Empie: May 14, 9:57pm

Generated in about 0.063s.

(Used 7 db queries)