One Time Events: Already Fired?

Posted by Sean on Jul 30, 2009 under

Batch programming is certainly very easy to understand and write. You order a todo list and give it to the compiler/interpreter. It's what's usually taught first when you learn to program, and even in some server-side languages, you batch program (PHP doesn't have events at all, for instance). However, persitance applications that live on the desktop (and perhaps Ajax applications with minimal page refreshes) rely on event-driven programming. You set up a user interface, and then wait for the user to do something to that interface, and then respond to the event.

This is all well and great. But I've hit a problem a couple times recently as I create more desktop applications. I thought this would be easy to find, since I've hit the problem often and early. But I haven't, so I'll have to solve it myself. Sometimes, a component might have a one-time event that you need to listen to, and you don't know if that event has fired or not.

I'm a Twitter Monstar

Posted by Sean on Jul 24, 2009 under

I've been twitting... tweeting... using Twitter for, oh, a little while now. I can't actually remember, maybe since the beginning of the year. And I've never really let anyone know, other then putting my latest tweet on the right side of my web-site.

Out of Beer tweet

4 Ways Functions Mess With this

Posted by Sean on Jul 22, 2009 under

In Javascript, the this keyword can be a tricky thing. It's trickiness comes from how functions behave differently depending on how you call them. What? You can call them differently? Yep! There's 4 major invocation patterns for a function, so let's see how each works, and how they handle this.

  1. Method Invocation
  2. Function Invocation
  3. Constructor Invocation
  4. Apply Invocation

Random String Generation with Symbols

Posted by Sean on Jul 16, 2009 under

I've been playing with some random string generation, since I built a fairly simple one in a recent project for when users forget their password, and I reset it. It seemed decent enough: produced a string of strong size, alpha-numeric. It was good enough.

base_convert(uniqid(rand(),true),10,36)

It didn't take long after I had commited that code before I started thinking it could be better.

Requiring Login to CakePHP Admin

Posted by Sean on Jul 09, 2009 under

For some of my freelance clients, I have provided a home-brewed CMS, built using CakePHP, since I'd already used Cake for the rest of their web-site. I wanted to create a couple users, and an interface to be able to create pages that made up the navigation and content.

Building an admin area for this functionality, the first thing I did was turn on admin routing.

My Syntax Highlighting

Posted by Sean on Jul 07, 2009 under

One of the most obvious benefits to code editors and IDEs is being able to customize all the pretty colors that we must stare at for hours on end. It's our decoration. It's our wardrobe. So let me show off my own code outfitting.

A Basic Lesson in Password Hashing

Posted by Sean on Jul 01, 2009 under

In the world of the web, lots of sites are popping up requiring users to login. When you need to do so, there's a bit more security than you might realize. You might be making a simple To-Do list, and might think:

Security? Pfft, I'm not too worried about people's to-do lists being stolen.

But what you didn't account for, is that all those username/password combinations a hacker just made off with? Yea, those are the same login's to important stuff, like e-mail , or bank accounts . Yikes!