JavaScript is a prototyping programming language, and as such, has many different ways to define classes or create objects. If you try to search for a tutorial on object-oriented programming in JavaScript, you’ll find that each tutorial has its own way of doing things. It can be very confusing.

Fortunately, jQuery UI has a widget framework, that makes setting up object-oriented widgets easy. After using it, I wanted to use it for everything, until I find something at least as easy to use as it. I didn’t, however, want to include a large dependency like jQuery UI if I was only using it for its widget framework.

I was glad to find, after a little experimentation with the Build Your Download page, that I can get jQuery UI’s widget framework in a download of only 9.06 kb minified. You can get this by clicking Deselect All and checking UI Core. After that, the theme drop-down box should be set to No Theme.

I made a geocoding widget for Django in a project for a client using this. It simplified my code a great deal.

One thing it does that’s good for projects that might have a lot of custom widgets on one page (which was not the case for this one) is it takes care of using jQuery’s data() method, which stores objects in a way that is less likely to cause memory leak issues in Internet Explorer than storing objects using closures.

How do you react when you find out that a lot of grief could have been prevented by something as simple as maintaining a to-do list? Or following or not following a piece of advice from a friend or colleague? Or doing a little bit more or less yak-shaving? Or taking a break when you need one? Or paying closer attention to Object-Oriented Design?

Are you happy for the learning experience, or do you get angry at yourself because it’s something you should have already learned?

While self-anger can drive a person to change, I think it’s important for programmers to be able to take a step back when it gets to be too much. After all, every passionate programmer knows enough to be successful beyond his or her wildest dreams. Execution is the tricky part.

I’ve talked a lot about it, but I still haven’t taken a proper twitter break. I took a break for about a week. Toward the end of the break, I didn’t think about twitter a whole lot, but I still thought about it. It’s quite a habit.

Making it take a couple of steps to check my twitter account wasn’t enough, so I’m going to try something else—making my twitter account private. One reason for logging back into my twitter account after such a short amount of time was to replace the current tweets on my twitter profile with fresh ones. Now my twitter profile can only be seen by those whom I follow, so that won’t be such a concern this time.

I made it clear in my twitter profile that I’m taking a break from twitter and will still be reading my DM’s. Hopefully people won’t worry about me this time like a few did when I abruptly deleted my twitter account last October.

So, why has twitter been such a problem for me? I think a big part of it is that I’m not in control of my experience. If I was in charge, I would make my twitter account purely a microblog. People couldn’t see who I was subscribed to. I would also change how I manage users and filter and aggregate my feeds. This latter part I can change by writing my own twitter account, which is something I might do at some point.

I’m going to experiment with doing microblog summaries and putting content in a directory. For now I’m putting them on twitter tagged with #blog, copying the content, and expanding them just a bit. The full articles will simply be directories containing an index.php or index.html file. That way I can play around with the layout of individual posts, or make the pages dirt simple if I so desire.

Image editing with php & GD is simple and fun. I removed text from a SlimTimer Fluid icon I found on flickr with it.

I’ve been blogging for a few years now. Over the last few months, I’ve been keeping private notes regularly. I haven’t been returning to them much after I’ve written them.

Today I realized that twitter has been a bigger distraction for me than ever after many attempts to deal with it. So I stopped checking it. I was more productive at work today than I’ve been in months.

After thinking about it, I remembered that I’ve blogged about various ideas I’ve had for dealing with twitter productivity problems. I wonder if I would have come to the realization sooner if I made a habit of reading my own blog posts?

I also have a lot of ideas jotted down over the last few months that I haven’t returned to. I’m busy right now, but when I get a chance I think I’ll take a peek.

jQuery has convenience functions for events like click and keydown, and lets you create and use your own events with bind() and trigger(), but doesn’t provide a way to create your own convenience functions for custom events. I took several lines of code from the jQuery source and created a plugin that makes creating convenience functions as easy as calling $.convenience(‘nameOfFunction’). Then I can bind or trigger an event simply by calling nameOfFunction() on the selector. This should be apparent by looking at the demo source (the third link).

  1. jquery.convenience.js – plugin source (github)
  2. convenience.html – demo (my site)
  3. convenience.html – demo source (github)

The example shows one feature of custom events that I overlooked: propagation.

I had two twitter accounts that I wanted swapped. One had my real name on it. The other had a made-up-name and was the one I’d been using on a regular basis. It was also where all of my followers were.

Since I’m getting a start in freelancing, I decided to make my main account the one with my real name on it, and try not to ramble quite so much on it.

I first tried to do this a couple of weeks ago. I deleted the account with my name, and tried renaming the account with the made-up name to my name. Unfortunately, twitter told me the account was unavailable. I quickly re-created the account to avoid losing @benatkin, which is the same as my domain name.

Today, while I was filling out a request to twitter to change the names for me so I don’t lose them, an idea popped into my head. I tried it and it worked! Here’s what I did:

  • I went to the account settings on the benatkin account and changed the username to benjamin_atkin. I figured that if worse came to worse I’d still have some representation of my name.
  • I went to the account settings on the account with my made-up name (lowerCamelCase) and changed the user name to benatkin
  • I went to the account settings on benjamin_atkin (which used to be benatkin) and changed the username to lowerCamelCase.

Now, I don’t know if twitter thought this through, so I am calling this a “hack”. It may be that twitter just hasn’t implemented locking of old names after a rename, and would prefer that people like me go through customer service.

After it was done, I left a tweet to fill my followers in on the situation:

2245067457

I got Screenflow and a Snowflake with the intent to make screencasts, but found another use for them, that might be more valuable.

It started with me testing out my equipment. I wasn’t ready to do a scripted screencast, so I just coded for an hour, while talking, and looked at the results. I found that talking to myself out loud helped me figure things out more quickly in a couple of cases. And since I was testing my gear, talking to myself didn’t feel all that strange.

Some time after watching it, I wondered what it would be like to record myself frequently. Maybe if I did something really cool, I could take a look back and try to see what my thought process was, and it would reinforce it. Or, if I was in a slump, I could use it to remind myself what I’m capable of.

Then I asked myself whether it’s practical. The answer I got was a resounding “Sure it is!”. Space and processing power are cheap. With the default settings, Screenflow documents take roughly a gig an hour. 500 gigabyte hard drives can be had for under a hundred bucks. If I record 5 hours a day, which is a *lot*, it’s about a dollar a day for the space. Screenflow doesn’t take much processing power, or if it does, it doesn’t interfere with the work that I’m doing.

I’m not sure what the most clear analogy is to other fields, but there are obvious parallels. Disk Jockeys commonly record their experiments. Team sport coaches record their players’ performances.

I’m really excited about this. I can get part of the benefit of pair programming by talking out loud and learning from yourself, without the need for a willing partner. It’s also a journal that’s remarkably easy to write. It does take a lot of time to read, though, so I’ll probably only play back my favorite sessions, and I’ll only play bits and pieces of them most of the time.

The only caveat is I might feel like I’m my own big brother. I might as well get used to that, though, as I expect in the future there will be wearable video cameras that transparently archive everything. In fact, something like that’s probably already been built.

I still plan to do some screencasting. Stay tuned!

From the this-should-have-been-obvious department:

  • If there are a couple of friends whose tweets you feel like you can’t miss during the break, turn SMS updates on for them. That way you can stop checking twitter and still (hopefully) get their tweets quickly.
  • Log out of twitter.com on all desktop or mobile web browsers.
  • Do something to hide or log out of all desktop or mobile apps. Deleting accounts is fine, because they can always be recreated. Sure, I lose my cached data, but I don’t use a twitter client to store data, I use it to read the most recent updates. Here’s what I did for each of my twitter clients:
    • Nambu: I’ve been using this twitter client on my Mac for a couple of weeks. I like it. I was able to delete my account by finding the Accounts screen, selecting my account, and pushing the delete button. I also removed it from my dock.
    • Tweetie for iPhone: I use this on my iPod Touch sometimes, when I have wifi available. I had to enable multiple accounts in the settings before I could find a way to delete my account.
    • Twidroid: My Android twitter client. I couldn’t find a way to remove my username and password, so I just uninstalled it. I can install it later.
    • Syrinx: Ditto. Uninstalled it. (I used this OS X twitter client for months, but I’ve been liking Nambu better.)

In retrospect it would have been quicker for me to just change my twitter password.