-
A quick and simple guide to set up your a private Git repository without paying extra for specialized hosting.
-
Syntax check all of your php files
Here's a nifty little shell script that will let you quickly run syntax validation against your entire PHP project -
MVC Guide - In-model Data Validation
I explain how to make your code better by performing data validation in your models, and give a few examples making it as simple and painless as possible. -
Site moved - things may be broken
The blog had completely crashed over at my old host, for reasons unknown to me. I think Wordpress was at fault. In any case, I've moved the site over to the Rackspace Cloud, and pulled everything off of Wordpress and into a custom (albeit quickly-hacked-t -
What good are standards if you don't enforce them?
A little rant about coding standards, and why it's important that you actually ENFORCE them. -
Cheating with PHP's __set magic method
A little trickery to make PHP's magic methods __get($var) and __set($var, $value) even more useful. -
New Theme and a quick PHP tip
I just switched over to a new theme for the blog: Sharp, available at ThemeForest. A bit snazzier, I think. A few tweaks made, mostly to the code sections. People with newer browsers that support CSS3's @font-face rule should get snippets in Panic Sans, which I extracted from my copy of Coda, in a slightly smaller than default size and with better overflow handling. I'll assume everything still looks decent in IE, but I don't have easy access to a Windows machine and honestly don't give a damn since I focus primarily on back-end code where I can (and do) set requirements to use standards-compliant browsers. Now on to a quick tip... PHP coders who also use jQuery might enjoy this. If you're writing OO PHP and have setters for protected/private class members, usereturn $this;instead ofreturn true;(or a return-less void) at the end of your setter method. It mimics jQuery's "chainability" concept by returning the modified object. So you can go from this:$user->setName('Eric'); $user->setPassword('password'); $user->setStatus('admin');To this:$user->setName('Eric')->setPassword('password')->setStatus('admin');Small change, but I find it a bit more readable and there's no discernable performance impact. And while I haven't looked into it in any detail, I'm pretty sure this is (more or less) how PHP'sSimpleXMLclass works. -
LP120 In Pictures
And now, some pictures of the LumoPro LP120 flash, including some size comparisons with the Canon 580EXII and the Vivitar 285HV. You can see it's the smallest of the lot, but it's very comparable to the 580. Easily the lightest of the three, which is fantastic for those who want to travel light. Time will tell how it holds up. It's reportedly equivalent in power to the 285HV; I again haven't yet done any testing. [gallery link="file" orderby="post_name"] And yes, I did hack that Vivitar to add in a proper 3.5mm sync port. And superglued it back together. -
LumoPro LP120 Strobist Flash - first impressions
Just took delivery of a new LumoPro LP120 strobe - the flash designed by Strobists for Strobists. I'll probably post more details (and photos!) later, but first impressions:Features
Nice, compact size. About the same as my Canon 580EX II, significantly smaller than the Vivitar 285HV. The head size is also comparable to the 580EX II, so you should have no problems with using any small-flash accessories - a nice change from the 285's giant head that doesn't fit anything properly. 4 triggering methods - awesome. Hotshoe, PC cord, 3.5mm socket, optical slave. Haven't tested the hotshoe, but the other three all work very reliably so far. No problems with the optical trigger at short range, which is all I've tried so far. I expect it'll mostly be fired by a Paul C Buff CSRB unless I'm out of triggers, in which case I'll go with the optical trigger. Head moves 90º clockwise, 180º CCW, 90º vertically. 4 (manual) zoom positions: 28, 35, 50, and 85mm. Like the Vivitar, it doesn't lock into any of the positions, just clicks into place. 180º in both directions would have been nice, but I don't envision it being a problem. Pretty much identical movement range as a Canon 430 I think. It also includes a wide-angle diffuser that you can pop in, which I'll probably lose promptly. -
Updating to jQuery1.3 + jQueryUI1.7
A quick heads-up for changes I’ve noticed so far when upgrading from jQuery 1.2.6+UI1.5.x to 1.3+UI1.7:
UI.tabs() now expects to be run on a wrapper element containing both the tabs and their respective panels. Previously I would have something like this:
<ul id="nav"> <li><a href="#tab1">Tab 1</a></li> <li><a href="#tab2">Tab 2</a></li> </ul> <div id="tab1">Tab 1 content</div> <div id="tab2">Tab 2 content</div> <script type="text/javascript"> jQuery("#nav").tabs(); </script>Since UI1.7, I need the following structure:
<div id="tabs_wrapper"> <ul id="nav"> <li><a href="#tab1">Tab 1</a></li> <li><a href="#tab2">Tab 2</a></li> </ul> <div id="tab1">Tab 1 content</div> <div id="tab2">Tab 2 content</div> </div> <script type="text/javascript"> jQuery("#tabs_wrapper").tabs(); </script>Minor change, but previously I had ul#nav in div#top and the panels in div#middle, so I needed to do some minor restructuring for UI1.7 compatibility.
Also another minor tweak: UI.dialog.overlay seems to have been shifted from a settable javascript property to styles in div.ui-widget-overlay that’s created for modal dialogs (perhaps non-modal dialogs as well; I haven’t tested).
Old version:
<script type="text/javascript"> jQuery("#dialog").dialog({ autoOpen: false, modal: true, resizable: false, draggable: false, overlay: { background-color:'#000', opacity:0.75 } }); </script>New version:
<script type="text/javascript"> jQuery("#dialog").dialog({ autoOpen: false, modal: true, resizable: false, draggable: false }); </script> <style type="text/css"> .ui-widget-overlay { background-color:#000; opacity:0.75; } </style>If I find other changes (that don’t appear to be documented at docs.jquery.com) I’ll post them up here.
