mySQL Murder
07 November 2009 at 11:47
Filed Under: coding
Good presentation from Jay Pipes about big mistakes you can make when developing with mySQL. I particularly like the point of not thinking in loops but in sets.
I love how complicated time is
03 November 2009 at 23:48
What every developer should know about time.
Also, a guide to GNU screen.
And finally, "I think it takes a special kind of incompetence to use the same acronym in the same place for different offsets."
billions and billions
31 October 2009 at 22:49
I'm watching cosmos on hulu on this all hallows eve. Earlier I took the dog for a walk. She does not like children in costumes.
Building an Object Collection Manager with the SPL
Gilligan goes to the movies
27 September 2009 at 12:04
Last night, Amanda, Max and I went to see Cloudy With A Chance of Meatballs. It was a funny movie, but funnier was the guy I met at the concession stand. He was very thin and dressed in jeans, a white t-shirt and a black vest. He looked a lot like an older Gilligan with bushy eyebrows that stood out about an inch and a half from his his forehead. He sidled up to the concession stand and peered into the candy display. "You got any.. uh... lemondrops or gumballs?" The teenager eyed him quizzically from behind the counter. "Any lemondrops?" "Uh... no." The teen looked around. "Mostly like whoppers and stuff." The man pointed at a bag. "What about that?" "Those is gummi bears" "What's that?" "You know like... gummi" "So they're gumballs?" "No, like they're ... gummi bears." The man furrowed his considerable brow. He squinted and pushed his face to the glass. "Licorice?" "No." "You know, I'll... I'll see what my lady friend wants..." He said as he backed nervously away from the counter.
Zen Cynicism: maitri
17 September 2009 at 18:45

There was a story about the Zen master Suzuki Roshi. This was a situation where his students had been sitting and they were 3 or 4 hours into a very hard sitting period, a sesshin. The person who told the story said every bone in his body was hurting, his back, his ankles, his neck, his head, everything hurt. Not only that, his thoughts were totally obsessed with either "I can't do this, I'm worthless. There's something wrong with me. I'm not cut out to do this." It was vacillating between those thoughts and "This whole thing is ridiculous. Why did I ever come here? These people are crazy. This place is like boot camp." His mind and body were just aching. Probably everyone else in the room was going through something similar. Suzuki Roshi came in to give the lecture for the day and he sat down. He started to talk very, very, very slowly and he said, "The difficulty that you are experiencing now..." And that man was thinking, "will go away."
And he said, "This difficulty will be with you for the rest of your life."
The Mind Models of a Developer
12 September 2009 at 07:17
The Interpreter - sees role as interpreting the back end processes to the user - application is a specialized gui to the database The Modeler - sees application as data, information that needs to be structured. Starts with models and relationships, then figures out the algorithms that will bridge and transform the data. Winding road, developer's job is to build roads into and out of the database. Zen Unix Master - applications are tools in a box.
Graphs in the database: SQL meets social networks
07 September 2009 at 14:41
Filed Under: coding
Graphs are ubiquitous. Social or P2P networks, thesauri, route planning systems, recommendation systems, collaborative filtering, even the World Wide Web itself is ultimately a graph! Given their importance, it’s surely worth spending some time in studying some algorithms and models to represent and work with them effectively. In this short article, we’re going to see how we can store a graph in a DBMS.A follow up to: Trees in the database: Advanced data structures
open without leaving process fragments in your terminal
31 August 2009 at 18:54
Filed Under: coding
open()
{
NO_ARGS=0
if [ $# -eq "$NO_ARGS" ]
then
echo " enter a program";
else
$1 &>/dev/null &
fi
}
PHP Validation and Sanitization with filters
31 August 2009 at 08:39
Filed Under: coding
One of the most common problems in web development in validating and sanitizing user inputted data. Often, we're tempted to reinvent the wheel when validating emails, ranges, booleans, etc. Fortunately, php has a lot of these tasks already written. You can use the built in filters to validate and sanitize in a manner that's already been tested and optimized by the core developers. Documentation:
Validation:
$email = 'test@example.com';
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
echo 'This (email) email address is considered valid.';
}
$ip = '127.0.0.1';
if (filter_var($ip, FILTER_VALIDATE_IP)) {
echo 'This (ip) IP address is considered valid.';
}
$int_example = '4';
$options = array(
'options' => array(
'min_range' => 0,
'max_range' => 3,
)
);
$options['options']['default'] = 1;
if ($int_example = filter_var($int_c, FILTER_VALIDATE_INT, $options)) {
echo 'This (int_example) integer is considered valid (between 0 and 3) and is $int_example.';
}
Sanitization:
$c = '(bogus@example.org)';
$sanitized_c = filter_var($c, FILTER_SANITIZE_EMAIL);
if (filter_var($sanitized_c, FILTER_VALIDATE_EMAIL))
{
echo 'This (c) sanitized email address is considered valid.\n';
echo 'Before: $c\n';
echo 'After: $sanitized_c\n';
}
$search_html = filter_input(INPUT_GET, 'query', FILTER_SANITIZE_SPECIAL_CHARS);
Howl
29 August 2009 at 07:34
Filed Under: coding
I saw the best minds of my generation destroyed by
coding, starving hysterical naked,
debugging their code through var dumps at
dawn looking for an angry fix,
angelheaded hipsters scripting for the ancient
heavenly connection to the starry dynamic typing
in the machinery of night,
who poverty and tatters and hollow-eyed and high
sat up smoking in the supernatural darkness of
the web floating across the tops of integers
contemplating lisp,
who bared their brains to Heaven under the C and
saw Euclidean angles staggering on
algorithms illuminated,
who passed through universities with radiant cool
eyes hallucinating data structures
among the scholars of war,
who were expelled by startups for crazy &
committing obscene codes on the windows of the skull,
who cowered in unshaven rooms in novelty t-shirts,
burning down charts and sprinting toward
the Terror on their wall
The Insufficiency of SCRUM
19 August 2009 at 11:50
Filed Under: coding
Interesting analysis of creeping issues in SCRUM. Having recently adopted SCRUM I haven't seen the problems described here yet, but it'll be good to keep an eye out.
Using gmdate()
19 August 2009 at 11:32
Filed Under: php
Recently at work I came across an odd bug involving gmdate(). A client wanted us to post some information to them including two fields: source_date and source_time. The values are really just the time when we're sending the information to them. However, they wanted it to be sent as GMT. So in preparing the request, I wrapped the source_time in gmdate(), tested and confirmed that it was giving the correct result. Then during an audit of their data they pointed out that around midnight our time would swing back 24 hours. Of course the issue was not wrapping the source_date in the same function. By not doing that our time would advance to tomorrow (from our perspective) but the date would be sent as today - therefore appearing to them as 24 hours previous. It's an easy bug to fix, and obvious once you think about it. I think it really shows the danger of failing to imagine edge cases - always a danger when working with dates.
