Archive for the ‘Coding’ Category
How To Do It
Perl
There’s more than one way to do it
Python
There is one way to do it
PHP
I found a way to do it but it didn’t work. I’m just going to do it in WordPress
ColdFusion
You can do that?
.NET
There is one way to do it, but you can do it in any language you want
JavaScript
I know how to do it in jQuery. Does it have jQuery?
Clojure
First let’s do math!
Ruby
This is the right way to do it. All the other ways to do it suck.
Objective-C
Just do it like you’d think Steve would want it
C
Already did it
C++
It’s done, it’s just compiling.
Lisp
Once you’ve done it like this you will never be the same
Ok, that’s what I came up with. Got any more? Tweet them @muddylemon or comment on this post.
Online Audio Is A Poor Format For Learning Code
Saw a link to a “radio show” about Advanced OO Patterns. I thought that was an odd format for a topic like that. Online audio presentations are great for ideas that live mostly inside your head, but code you usually need to write down. I clicked the link and found a flash-based audio player. No slides or video or text, just the audio. I thought I’d try it out and record my notes….
9:50 pm
Some guy says he will be speaking about dependency injection, lazy initialization, and, possibly, if there is time, service locater patterns. I can’t place his accent. I don’t think he said his name.
9:56 pm
He is trying to encourage the people standing in the back to sit down.
9:58 pm
Apologizes for a poor performance he gave at a previous conference. Explains that the time limit of the previous conference made it hard to present a coherent presentation. Says he will never work with those conference organizers again.
10:00 pm
He’s apologizing that he doesn’t have much time to cover his topic. Says he won’t have enough time to explain everything properly.
10:08 pm
Speculating that even if you don’t understand what he says he hopes this presentation might at least inspire you to look up the topics later. (Sell it man!)
10:14 pm
Now he’s pointing out that this talk is a waste of time if you don’t look at the code samples in his slides. Asking people to not talk or use their laptops and please follow the slides.
10:16 pm
Spends the next few minutes reading the code out loud. Makes a point of saying “Semicolon” loudly at the end of each line.
10:25 pm
Something in the code reminds him of closures. He asks if anyone is using closures in PHP 5.3. He forgot what he was talking about, is trying to find his place in his notes.
10:28 pm
He’s apologizing for how complicated his code samples are. He is using code from real projects but hasn’t removed irrelevant parts. That didn’t stop him from reading those parts out loud.
10:32 pm
Asked the audience for examples of software patterns. Someone says “singleton.” He spends the next 3 minutes berating the audience member for using singletons. Concludes that we will learn why later.
10:37 pm
Asks if everyone is still awake. Says he should have ordered a coffee service. Jokes that maybe he should have ordered a beer service. Forgets what he was talking about; tries to find his place in his notes.
10:40 pm
Can everyone read the code on this slide? Asks if anyone can find something wrong with the code. Waits for an answer. No one responds. He asks again. Someone says that it isn’t testable, he snaps that isn’t relevant. Says in the real world no one wastes time with such things. Points out that the error is that it isn’t using dependency injection.
10:45 pm
He’s out of time. Says we should download the presentation on his personal website that he recites. It involves a lot of dashes and slashes.
10:50 pm
Asks if there are any questions and answers the one about when the next session starts. There is coffee in the lobby.
Conclusion: Online audio is the least of our problems
PHP Gravatar Class
I was recently working on a small side project when I ran across a need for a php implementation of a class that would produce Gravatar urls.
Generating Gravatar urls is not a complicated affair. In fact, it’s not out of the question to write a one-off gravatar function as needed. I wanted something slightly more robust and reuseable. I was surprised as I surveyed the php gravatar classes in github to find a morass of over engineered solutions that were often tightly coupled to a particular framework.
It’s understandable that the framework specific examples would be popular on github. More often than not a php coder will be working inside a standard framework and is more likely to seek code designed to plug-in directly to their framework of choice. Parsing the program flow and logic of these modules is difficult if you’re not familiar with the conventions and peculiarities of the framework for which they are designed. I was looking for a more barebones implementation that I can drop in a variety of contexts or use as a skeleton when implementing a gravatar class in a specific context.
After a page or two of browsing I decided it would be faster to just write one myself. It is a very simple and straightforward gravatar class. It uses sensible defaults and all parameters except the email address are optional.
Usage is as a simple as:
1 | $gravatar_url = gravatar::url('bob@bitcap.com'); |
If you are feeling more specific, pass parameters like so:
1 2 3 4 5 6 7 8 9 10 | $email = filter_input(INPUT_GET,'e',FILTER_SANITIZE_EMAIL); $params = array( 'secure' => false, 'default' => 'monsterid', 'rating' => 'x', 'size' => 256 ); $url = gravatar::url($email,$params); echo '<h1>'. $url . '</h1> <img src="'. $url .'" alt="" / >'; |
To clone or copy my simple php gravatar class:
Débrouillard
Débrouillard is what every plongeur wants to be called. A débrouillard is a man who, even when he is told to do the impossible, will se débrouiller — get it done somehow.
— George Orwell, Down and Out in Paris and London
How To Stand Out
“At each creative decision, ask whether you’re doing it a certain way because that’s the way you’ve seen it done before. If the answer is yes, then figure out if there’s a better way. You’ll stand apart from the rest, and we’ll love you for it.”
From a profile of Adam Lisagor in Fast Company
As a designer or developer, it’s easy to get intimidated by the work of your peers. In this age of dribbble and github, we can see each others works and inspect it in close detail. Sometimes I’ll stumble on someones repo on github and just be blown away by the quality and quantity of their work.
What sets some people’s work above the rest? It’s almost never how difficult the problems they solve are. Most problems are either simple or just haven’t been broken down into small enough pieces. From what I’ve seen it’s more likely their attention to detail and their taste.
Differences in taste are easy to see among designers but I think it applies just as much to developers. We just call it elegance.
When you have high standards and either the talent or persistence to meet those standards, you can make something great.
Explanations are a UX Smell

Have you ever added someone as a “Contact” on Flickr? It’s a confusing experience. The core of the problem is the word “contact.” When I call someone a “contact” I assume that I’m going to… well, “contact” them at some point.
That’s not at all what a contact is for on flickr, though. It’s really more like becoming a fan or a follower on other services. It’s probably most like adding someone to a circle on google +.
At the time that flickr was created, however, those services didn’t exist. There wasn’t a concept of identifying a relationship as tenuous and ethereal as what amounts to a personal bookmark.
Flickr has persisted with this nomenclature for whatever reason. Over the years they’ve added sub options to approximate what many people at first assume the “contact” role to be. They also have a relatively long explanation of what the action you’re taking means and a link to a more detailed discussion on their FAQ page.
Every time I use this feature I stop short at that dialog. I may have worried that I was doing something other than bookmarking this users photo stream. The fact that there is an important looking note attached to the dialog makes it seem riskier!
Flickr is using the vocabulary they had available at the time. At the time there wasn’t a word for a person that didn’t describe a real world relationship besides the politely non-committal ”contact.” A contact can be anyone. If you opened your (paper!) address book back in 2002 you could find just about anyone: friends, family, plumbers and old girlfriends. However, the word “contact” applied to them only in the context of a future or past interaction. On Flickr, the contact doesn’t imply interaction. It’s “liking” or “bookmarking.”
I don’t know what word Flickr would use if it was starting today. I don’t know why they’ve chosen to hang explanations on it instead of just changing the word to something more intuitive. I can imagine why – Yahoo! has a reputation for crushing inertia.
When you’re designing an application for internal use you have a limited audience to explain things to. Often when you encounter an app like that, you’ll find a collection of DailyWTF worthy hacks and kludges. The users work their way around those sharp edges the best they can.
When your application has competition there is no excuse.
- Any time a user has to do something in a way they couldn’t have guessed is a UX failure.
- Any time a user has to redefine a perfectly good english word in their head is a UX failure.
- Any time a user avoids a feature because they’re worried about what will result is a UX failure.
- Finally, any time you have to explain a design decision in prose is a UX failure.
There is something magical about describing something into existence
It’s hard to explain to someone who hasn’t done it.
She asked me how I can take the boredom of just sitting there writing instructions to a computer for hours.
“Don’t you ever just want to scream?”
If I was writing a novel, she’d get it. It’s romantic even… the image of the reclusive writer weaving stories and directing characters through arcs of conflict and resolution, forever tumbling toward that final page.
A musician iterating through melodies, alone at his instrument; he concentrates and creates.
An artist with a chisel or a brush.
The power broker looking out the window at the city writhing beneath him.
We create alone. Eyes fixed on our tools and the task before us.
But for some reason, it’s suddenly boring when the tool is a computer and the result is a stilted prose describing what you build if your brain was made of lego.
Sure, it can be excruciating when the code you’re writing is boilerplate. When you’re not solving problems so much as serving as an amanuensis to the status quo.
If you’re a certain kind of coder those are the days you devote to creatively scripting the banality out of your life.
However, the days that you get to make something new are a different story.
It’s those days when it is a delight to dive deep. You get to look at the backside of the problem. Your job is not to duck but to dig. You think about things in new ways. You chop things up into buckets and then suddenly realize that you brought the wrong buckets.
It’s on those days you get to say, “I wrote my thoughts down and they worked.”
CSS, Forms, Borders and Biographies
This is just a bit of internet mix tape of interesting things I’ve read recently:
Little CSS Stuff Newcomers Get Confused About
If you’re a pro, it’s easy to forget the confusion you felt when you just started learning CSS. Just for fun, let’s try and remember some of those little weird confusing moments. I’ll start us out by listing some random ones I remember and have picked up on while helping others recently. Then you folks take it from there in the comments.
These aren’t huge big things like broken layouts in IE or which vendor prefixes should you be using. It’s the little fundamental stuff, like tiny differences in syntax that change meaning in a big way.
The New and Improved Way to Create Forms with HTML5
Quick little listicle about some of the handier features available for forms with html5
The Fall of Borders and Bad Decisions
While it’s true that the book industry has changed, and that eReaders are a revolution, and even that the economy has been turbulent, none of these precluded Borders from being successful. In fact, it is how Borders reacted to each of those things that caused their failure.
How NOT to write a personal biography
Most of us have written a description about ourselves before, whether it be on Twitter, Facebook, Google+, LinkedIn or our CV. It’s not an easy task but it needs to be done, and it should always be evolving. Your bio should sell yourself and your story. It should show your credentials, your passion and expertise. It should be unique to you and you only. It should not be copied & handed out at whim.
Accumulated Links
- HTML5Pattern - A list of patterns that can be applied to many common form inputs
- To celebrate the 12th birthday of metafilter @mathowie bought the domain of the first site ever submitted: cat-scan.com
- Very long but good article about keyword research
- 6 Essential PPC Landing Page Optimizations
- Lessons From A Rewrite by Rebecca Murphey. I’m always impressed with her writing
Wrong To Right

The other day I ran across some very old code and decided to push it up to the interwebs. It’s a game I wrote when I was first learning jquery. That said, I wouldn’t recommend using the code to learn jquery best practices. It works though!
Check it out: Wrong to Right – A Word Game By Lance Kidwell





