Category: Programming (page 2)

15 Apr 2012

PHP RFC Preview: Dynamic Callback Expressions

I’m posting this to get some initial feedback on this idea before I officially submit an RFC. Background Even with PHP’s growing object-oriented and functional programming features, the callback remains widely-used and useful. However, forcing authors to create callbacks via strings and arrays presents difficulties: Most IDEs do not recognize callbacks as such, and so

[ the post]
22 Jan 2012

Convert Google Maps embed HTML to Street View URL

You can use the form below to convert the HTML embed code Google Maps gives you to a usable Street View URL loading… Why do I need this? The new Google Maps layout has a chain-link icon on the left that gives you a URL to what you’re looking at. If you’re in Street View, sometimes

[ the post]
25 Dec 2011

ElggCollection Proposal

An ElggCollection entity would store an ordered set of integers optimized for filtering and/or ordering SQL queries of entities, annotations, or other tables with integer primary keys.

[ the post]
28 Sep 2011

String Subtypes for Safer Web Programming

Valid HTML markup involves several different contexts and escaping rules, yet many APIs give no precise indication of which context their string return values are escaped for, or how strings should be escaped before being passed in (let’s not even get into character encoding). Most programming languages only have a single String type, so there’s

[ the post]
15 Sep 2011

RotURL: Rot13 for URLs

RotURL is a simple substitution cipher for encoding/obscuring URLs embedded in other URLs (e.g. in a querystring). Also, common chars that need to be escaped (:/?=&%#) are mapped to infrequently used capital letters, so this generally yields shorter querystrings, too. /**  * Rot35 with URL/urlencode-friendly mappings. To avoid increasing size during * urlencode(), commonly encoded

[ the post]
13 Sep 2011

Validate Private Page Bookmarklet

ValidatePrivatePage <– validates in current window ValidatePrivatePage <– validates in new window (your pop-up blocker may complain) If you need to validate the markup of a page that’s not public (e.g. on localhost), you can now use this bookmarklet to auto-submit the current page source to the validator (instead of viewing source, copying, opening the

[ the post]
18 Aug 2011

NetBeans Love & Hate

For those cases where you have to work on remote code, NetBeans‘ remote project functionality seems to put it ahead of other PHP IDEs. It pulls down a tree of files and uploads files that you save. Having a local copy allows it to offer its full code comprehension, auto-complete, and great rename refactoring for “remote”

[ the post]
18 Jul 2011

Helping Netbeans/PhpStorm with Autocomplete/Code-hinting

Where Netbeans can’t guess the type/existence of a local variable, you can tell it in a multiline comment: /* @var $varName TypeName */ After this comment (and as long as TypeName is defined in your project/project’s include path), when you start to type $varName, Netbeans will offer to autocomplete it, and will offer TypeName method/property suggestions.

[ the post]
3 Jul 2011

Firefox 5 Shibboleth Issues

If you manage a Shibboleth SP and have been receiving complaints from Firefox 5 users, you may be running into an issue due to FF5′s more compliant caching of Location headers in 302 redirects. While this is a step in the right direction for front-end performance, even tiny HTTP handling changes can affect existing sites.

[ the post]
21 Jun 2011

Bookmarklet: Horizontally invert HTML5 videos

My demands for “reverse” glasses have gone unserved, but I made a bookmarklet that provides the same effect: “flopping” a video horizontally. Install the SwitchStance bookmarklet, for which you’ll need a modern browser that supports CSS transforms on video elements. Opt-in to YouTube’s HTML5 trial Load up any video without ads (here’s one of Matt

[ the post]
29 Apr 2011

ReCaptcha Broken? Here’s the fix

Sometime recently ReCaptcha decommissioned its old API hosts: api* The new API locations are at “http(s)://”. If you rely on Zend_Service_ReCaptcha (or its form element), you’ll need to change some constants in Zend/Service/ReCaptcha.php:

[ the post]
22 Apr 2011

Xdebug 2.1.1 for XAMPP OSX 1.7.3

xdebug-211-xampp-osx.tgz contains a freshly compiled xdebug 2.1.1 module for XAMPP OSX, using this tutorial as a guide. The archive contains step-by-step install instructions w/ bash commands. Happy debugging with fewer bugs.

[ the post]
22 Apr 2011

Bash: Resolve symlinks in your working directory

Say you have created a symlink from your home dir to another location: $ ln -s /Applications/XAMPP/xamppfiles/htdocs ~/htdocs Now you can easily change to the XAMPP htdocs: cd ~/htdocs and then get back home: cd .. But how do you get to xamppfiles? Update: Thanks to sapphirepaw, the solution is simple: cd -P htdocs/.. or

[ the post]
17 Apr 2011

How to Modify a 3rd-party Chrome Extension

I wanted to add a little feature to the Delicious Chrome extension, but couldn’t find any reference to how to edit/clone a 3rd-party extension. It turns out—at least for making minor mods—it works how you’d think: Change some extension files. Restart Chrome. Caveat: Undoubtedly an update of the extension would wipe out these changes, and following

[ the post]
16 Apr 2011

Shibalike: a PHP emulation of a Shibboleth environment

Update 2011-06-23: All the essential components of Shibalike are complete and the project is hosted on Github. This is currently blueprint-ware, but I’m excited about it. A co-worker and I have laid out a design for a flexible system that can emulate a working Apache/PHP Shibboleth stack, without requiring any outside resources (e.g. an IdP,

[ the post]
12 Apr 2011

EA Skate started as a text game

EA’s Scott Blackwood talks about prototyping the flick-it controls for EA skate. But we really liked it on paper. We worked with our lead programmer at the time, and really, in about two or three days, he built a prototype, and it was great. We actually were up and playing the game — no rendering,

[ the post]
1 Apr 2011

Designing a Contextual Role-Based Capability Control System

Update May 2: ScopedRole is now a PHP5.3 library based on this design and is passing initial unit tests! After surveying a few permissions models that one might want to choose for an LMS, I think Moodle really got right the notion that role-based permissions should be flexible depending on the domain(s) the user’s in.

[ the post]
1 Apr 2011

Programming is…

Myth: Programmers get to write code all day. Truth: Most programmers spend a ton of time (in no particular order): Carefully composing e-mails to other programmers/mailing lists/non-technical folks Sitting in on meetings, working on mockups and DB schemas, worrying about performance implications of proposed features Writing bug reports and searching through bug DBs Scrambling to

[ the post]
16 Feb 2011

IE6/7 CSS Specificity Bug

After our team launched the new College of Education site, I discovered that IE8′s handy “Browser Mode: IE7″ mode of IE8 is useless for real IE7 testing (but IETester actually works!). Undoubtedly this “IE7 mode” has many quirks in its emulation we’ll never know about, but after a few hours of hair-pulling I finally pinned down a

[ the post]
2 Feb 2011

Filtering WordPress Navigation Menus

WordPress 3 introduced native navigation menus, usually created via the wp_nav_menu theme function and the built-in Custom Menu widget.  If you have a menu with a deep hierarchy, you may want to display only the active branch and the submenu directly below the active item (given class “current-menu-item” by WordPress). You can see this menu

[ the post]