Posts in Category: Programming (page 2)

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 [...]

25 Jan 2011

Simpler API for Zend’s built-in Firebug Logger

Zend Framework has functionality to send messages to the Firebug console (via Firefox’s FirePHP addon), but if you’re not using the ZF front controller, the API is a bit of a pain. Besides your instance of Zend_Log, you must keep track of a few additional objects just to manually flush the headers after all your [...]

24 Dec 2010

Gainesville: PHP/Javascript Developer Position Open

The Office of Distance Learning is seeking a web programmer with considerable experience with PHP, Javascript, and SQL to aid in the creation of and maintenance of several web and mobile applications. The person we’re seeking will need a strong understanding of and experience with: PHP5 Javascript object-oriented and functional programming styles related technologies such [...]

8 Dec 2010

Closure Compiler is smarter than you

I’ve known about Google’s Javascript minifier, Closure Compiler, for awhile, but after sending a couple snippets through it today I realized it’s a pretty impressive piece of work. Input: function howManyMatch(arr, pattern) { var l = arr.length; var total = 0; var i = 0; for (; i < l; i++) { if (pattern.test(arr[i])) { [...]

21 Nov 2010

Customizing a Zend Navigation Menu

Zend Navigation has a menu helper class that can output a basic nested UL menu. You can set id/class attributes on the A elements, and it adds an “active” classname to A elements in the active branch, but customizing the markup beyond that gets complicated.

18 Nov 2010

?YouWontSeeMe

In beta 11, Opera’s going to hide all “http(s)://”, and also all querystrings (until you focus the addressbar). Opera’s devs are right that users consider them mostly “gibberish”, but I think this change could cause a ton of problems and confusion for people, especially support staff, and there are plenty of sites/apps still out there [...]

17 Nov 2010

We need a frontend design tool for live web pages

It’s quite frequently that an HTML/CSS designer might want to make changes to a live web page. Maybe she doesn’t have write access, or maybe the fixes needed aren’t worth the start-up cost of copying the page locally and working on it there, or multiple designers want to work up ideas on a given page [...]

14 Nov 2010

E-mail Address Munging Still Mitigates Harvesting

At least a decade into the use of simple e-mail munging on web pages (my own solution here) there’s a growing consensus—and it seems like common sense with the advancement of the web in general—that this surely can’t still work on modern harvesters. While trying to look up some old research I’d read about this, [...]

14 Nov 2010

Using jQuery Before It’s Loaded

It’s better to include scripts like jQuery at the end of the BODY, but this makes its methods inaccessible earlier in the page (e.g. inside a WordPress post). What you can do is use a script like the one below to queue DOMReady functions before jQuery loads. (function (w) { if (w.$) // jQuery already [...]

14 Nov 2010

Tiny E-mail Munging Script

I’ve seen a lot of these that are bloated/less effective/inaccessible, so I might as well put this out there. It’s simple enough to modify if you’re comfortable with Javascript. Markup: <a href=”mailto:john{@}example{.}org”>john{@}example{.}org</a> (function(){ var a, i = 0, o = this.onload; onload = function(){ o && o(); // run the old window.onload if existed while [...]

3 Nov 2010

Perks of Life in the Kingdom of Nouns

Execution in the Kingdom of Nouns is one of Steve Yegge’s most entertaining posts about the verbosity and noun-centricity of Java (and other strongly typed languages without first-class functions). His post paints a picture of life outside JavaLand, where things are simpler and more straightforward: There’s rarely any need in these kingdoms to create wrapper [...]

1 Nov 2010

A Zend Framework App in a Single File

Most PHP micro-frameworks I’ve reviewed have some major cons: incomplete namespacing of functions/classes/global vars; doing too much/little; being under-tested; and the worst: forcing a unique (and usually under-documented) code structure that will make it difficult to “graduate” an app into a more full-featured framework. It also seems silly to rely on “micro-optimized” code if performance [...]

17 Oct 2010

Elgg Core Proposal: New Table “entity_list_items”

[This proposal has been superseded with ElggCollection.] As of Elgg 1.7.4 there’s no way to specify a specific list or ordering of entities for use in an elgg_get_entities query. E.g. one might want to implement: A “featured items” list for a group or user widget. On a group page this could be implemented in “left” [...]

28 Jul 2010

Programmer Steve Yegge’s return to blogging does not disappoint

His latest: Wikileaks To Leak 5000 Open Source Java Projects With All That Private/Final Bullshit Removed

14 Jul 2010

MVC: M != the Database

Great article on the misunderstood scope of the “Model” in the Model-View-Controller architecture. The takehome: Models are commonly thought of as wrappers for database access/stored objects, but application state and business logic need to go in them, too. Otherwise you get bloated controller and/or views that clumsily try to take care of these concerns. Earlier [...]

7 May 2010

Bookmarklet and PHP to prevent Shibboleth-related Firefox Lockouts

Reason this might be useful. /* * Remove all _shibstate cookies if there are too many of them. This usually * occurs due to Firefox session restores. Unfortunately we don’t know which is * the active state cookie, so we have to delete them all, but this is a lessor * crime than locking the [...]

2 May 2010

Uh-Oh: Firefox’s Unique Session Cookie Behavior

By now, Opera’s invention of restoring tabs automatically is available in most browsers, but unlike every other browser, Firefox’s restored tabs retain session cookies for the domains of the saved tabs Firefox restores all session cookies as if the browser were never closed. This is handy in some ways, but dangerous in others: It’s fooling [...]

29 Jun 2009

Miško Hevery Programming Talks

Miško Hevery gave several presentations at Google last year that are worth checking out, I think even if you’re familiar with Dependency Injections and unit testing. They cover the ways that global state can sneak into applications, how undeclared dependencies make classes harder to test and reuse, and how DI in general eases a lot [...]

23 Apr 2006

MyPage Bookmarklet

MyPage puts you in control of the current page: Remove, isolate, edit page items with keyboard control. On-screen print-preview emulation lets you see how the page will print while editing. (if you dug click2zap, try this out.)

18 Feb 2006

Click2Zap Bookmarklet 1.1

Use Click2Zap to remove elements from the page for printing (remove text/images to save paper/ink) or reading comfort purposes. Note: MyPage can do this and a lot more. Get it You must enable Javascript! (right-click, add to favorites or bookmarks) Features click2zap panel fixed to the top right of the window. as you rollover elements, they [...]