fill the void

Posts Tagged development

WordPress Tip: Debug Logging

Today, I needed a debug log for WordPress. Luckily, the WordPress Codex details just a couple lines of code to turn on error logging. This method is especially nice for hosted environments like DreamHost, where there’s no access to php.ini. Simply add the following to wp-config.php: # http://codex.wordpress.org/Editing_wp-config.php#Debug define(‘WP_DEBUG’, true); # http://codex.wordpress.org/Editing_wp-config.php#Configure_Error_Log @ini_set(‘log_errors’,'On’); @ini_set(‘display_errors’,'Off’); @ini_set(‘error_log’,dirname(__FILE__).’/logs/php_error.log’);


Dedupe Files with 50 Lines of Ruby

Somehow, my iPhoto library contains duplicates. Lots of duplicates. I tried Brattoo Propaganda’s Duplicate Annihilator, but while it took care of many, many photos, there are some photos and quite a few movies duplicated. Ruby to the rescue! I wrote a 50-line Ruby script to list out the duplicate files. The script uses SQLite3 and [...]


Cocoa Tip: NO vs nil for Preferences

Recently, I wanted to store a key/value pair in Info.plist or in preferences (NSUserDefaults) and know if the key existed and the value if it did. I started by using boolForKey, but this method doesn’t distinguish between NO and nil. Instead, I switched to valueForKey. Here are six lines of code to detect the three [...]


Cocoa Tip: URLs in NSTextFields

Apple has a great Technical Q&A document for embedding a URL in an NSTextField. However, after implementing their approach, I found two issues: Font: When I clicked the link, the URL’s font changed. To keep it consistent, I needed to set it myself. I added the following code to Apple’s NSAttributedString category from the link [...]


Don’t make users feel bad

Matt Drance posted an interesting thought the other day about the average consumer rejecting bad user experience. When helping out my parents or other non-technical folk, I’ve never found that. At least, not exactly. Average consumers do not think about user experience. They don’t think about workflows, calls to action, marketing copy, or corner cases. [...]