Cursed Leap Years!
I used to think that leap years only happened every four years
I used to think that leap years only happened every four years. In fact, every centennial year that is not evenly divisible by 400 is not a leap year.
Contents
I don’t expect to live to 2100, so it shouldn’t matter. But, unfortunately, in programming world, remembering this caveat on the leap year could result in a bug, or worse, world cataclysm like we saw didn’t see with Y2K.
I recently landed this bug and had to write a way out of it. Here’s my solution in PHP, JavaScript, and Cappuccino.
Phase In, Phase Out By DAVID GOLDING | Print This Post Print This Post
So 2009 has been a whirlwind for all of us. The global economy has gone to pot and many of us are struggling mightily to make ends meet. As for me, I have the benefit of laying low, kinda. I’ve been hard at work pursuing a graduate degree, and since this is a necessary step in my professional aspirations, now is perhaps the best time to be chugging away at schoolwork rather than taking the job market head-on. What this has meant, though, is more or less a hiatus from the full-steam-ahead web development work of 2008. And this blog has been quiet as well.
But students are not immune from ailing economies. Funding has dried up all over the place. My particular university noticed a drop of around a third in their endowment fund. So just as I was phasing out of web work to embark in more academic pursuits, I have found myself falling back and relying heavily on web development to get me through. I have more to blog about, more CakePHP to discuss, and hopefully more screencasts to film.
As a blog-warming gift to those readers who have stuck around, here’s a handy PHP script I wrote for managing 2-way encryption for credit card numbers. Like anything in data security, it’s not completely bulletproof, but I think I’ve managed a moderately to highly secure algorithm here that allows one to hold onto credit card numbers in an encrypted form, and still decipher those numbers for later processing. Of course, there’s no replacement for overall site security, so be sure to install this file outside the server root, and take care of those database calls so that you forestall any intrusion hacks.