Format Date into yyyy-mm-dd hh:ii:ss Format in JavaScript

This is a recurring thing I have to deal with. Here’s the code: get_time = function() { var date_part, local_time, now, time_part; local_time = new Date(); now = new Date(local_time.getTime() + (local_time.getTimezoneOffset() * 60000)); date_part = “” + (this.zero_pad(now.getFullYear(), 2)) + “-” + (this.zero_pad(now.getMonth() + 1, 2)) + “-” + (this.zero_pad(now.getDate(), 2)); time_part = “” […]

PHP Tip: Always Put Constants on the Left in Boolean Comparisons

This was a standard I enforced at my last company: Whenever you are doing a boolean check (such as an IF or WHILE), always place constants on the left side of the comparison. The following is BAD: // BAD if($user == LOGGED_IN) { The following is good: // GOOD if(LOGGED_IN == $user) { Why is […]

BUG: Constructors, Interfaces, and Abstracts Don’t Mix Well

I just discovered a bug today in PHP 5.1 (haven’t confirmed if it was fixed in newer versions). When trying to enforce interface arguments on constructors, PHP behaves unexpectedly. Normally, interfaces allow you to enforce argument counts or types in child class methods, but not with the constructor (and probably destructor). Crash course on interfaces: […]

Unrealistic Expectations in Job Posting

A funny Craigslist post (now deleted): Web Designer/Programmer Needed Reply to: job-483872814@craigslist.org Date: 2007-11-19, 4:51PM EST Must have specific database and Web-development experience to include in-depth database management and Web design services. Experience with government clients providing extensive data management and document tracking support a plus. Must have strong computer programming skills across a wide […]

A Great Web Developer is a Great Application Developer

After being a part of the developer hiring process for a while now, I have begun to see what distinguishes an exceptional web developer (the ones that get hired faster than we can even make an offer) and everybody else. Things have changed since 1995 – web development requires actual knowledge of programming! The problem […]

Permission Denied in the PHP Destructor and the Current Folder

I learned something new today, so I’m going to share two cool things with you. File access is screwed up during a destructor call in PHP. I will show you how to get around this. How to create a universal absolute path variable that refers to the current folder you are in. For the application […]