Archive for April, 2010

A Cool always-on-top Keyboard Toggle and a Lesson in Software Tool Development

Monday, April 26th, 2010

The other day, I came across a problem I frequently seem to encounter. I had a group-chat in Skype that I wanted to follow, but not necessarily contribute much to, and due to how often it was updating, it was getting annoying to have to constantly stop typing in my full-screen IDE and alt-tab back to Skype. I realized that it would be much more efficient if I could somehow temporarily designate that Skype window to always stay on top of the screen, the same way Task Manager does. That way I could be working away in my IDE, and when there were new messages in Skype I simply had to glance over, rather than alt-tab.

Naturally, I assumed this was a problem that was already solved, and a little Googling led me to a handy always-on-top toggle script that is activated using a hotkey. Perfect! Download, install, run, and within a few seconds I had my desired functionality… only the hotkey that the script uses to toggle the always-on-top property is ctrl-space, the same shortcut used for the absolutely-necessary auto-complete feature in Eclipse.

The script doesn’t provide any means for changing the hotkey, so I had to get a bit more creative. I set out on what I thought would be the difficult quest of figuring out how this script was made and re-making it with a different hotkey (I ended up using caps-lock). To my utter disbelief, it only took about five minutes. There were a few reasons why this was so easy to do, which I’ll get to in a moment, but first here is the script in case it might be useful to anyone else:

Download my Capsatop utility for Windows XP

No, I didn’t test it in Vista or Win7. Yes it might still work; please let me know if you try it. If you’re curious about doing this in linux or OSX, you’re on your own, but I’d love to hear about that too :~)

Now then, the rest of this post will be about why this was so easy to do, with a few lessons about good software tool development practices. For starters:

It helps when things are open-source.

That handy page I mentioned earlier was kind enough to mention that their ctrl-space script was made using a tool called Autohotkey, which I’d never heard of, and that it was only one line, which they provided:

^SPACE:: Winset, Alwaysontop, , A

So I downloaded Autohotkey, and braced myself for the impending learning curve. Fortunately, I was in for a shock:

Autohotkey is an incredibly intuitive tool.

It literally took me under two minutes to install Autohotkey, grok how it worked, and recreate the script with the line of code above. I credit this entirely to Autohotkey’s development team for putting together a really easy-to-use slice of utility software. Here are the things it got spot-on:

It installs an editor and a converter. No sense trying to put these two functions together into one larger (and surely more complicated) application, and their respective purposes are obvious right from their executable names.

The editor literally doesn’t let you do anything other than type out .ahk files. This is key; don’t let me fret over which filetype to save in, force me to use one option that is guaranteed to work.

The converter has a dead-simple UI. A field asking for an .ahk file, a field for specifying the path for the .exe, and a giant button that says “Convert”.

Without reading any documentation or having any experience with this tool, it took minutes to accomplish a simple, but specific task. All software should work like this. I shouldn’t have to read any documentation to figure out how to use the core feature of your application. That said:

Autohotkey’s documentation is excellent, from what I saw.

I say “from what I saw” because I didn’t have to look at very much of it (which, again, is the way it should be). All I wanted to do was change the hotkey I already knew about from ctrl-space to something more convenient, so I pulled up the AHK docs, which had a very convenient Hotkey pages summarizing exactly what I wanted to know (and nothing more).

All I had to do was skim through this one, short page to find a better hotkey. About two screen-lengths down I saw a note on how to disable caps-lock (this is perfect; I never use caps-lock—ever—and it’s a nice big key that’s easy to hit). Even though the docs actually use num-lock in their welcomely-concise code-sample, I was able to take a pretty reasonable guess at the syntax for disabling caps-lock and how to override it to run my always-on-top line. Back in the editor, I made the small change, switched back to my converter and hit that big, impossible-to-miss convert button again (without re-entering my filenames) and… it worked on the first try! I was speechless — five minutes.

Make Every Day New Year’s Eve

Monday, April 19th, 2010

One of my favourite things about New Year’s Eve is that it’s a good time to reflect on the past year, and maybe gather some ideas of things to do better going forward. The net result of this introspective process is one or more New Year’s Resolutions.

I like making resolutions because I like setting goals for myself. One of my resolutions for 2010, which longtime readers of this blog may recall, is that I would have a new post up every Monday (and I’ve only missed one so far). I made other resolutions this New Year’s as well, and (as ridiculous as this sounds) by March I was already planning resolutions for next year. That’s when it hit me:

Set goals more than once per year.

Why wait until some arbitrary holiday to set goals? You can set realistic, helpful, attainable goals for yourself right now. And they don’t have to be scoped to a full year, either. Mix it up and have some that are month- or week-based. I find that short-term goals are usually easier to keep, provide benefits right away, and can help build confidence to hit more lofty goals that take a bit longer to reach. For example, here are some goals that I’ve set for myself recently:

I learned something interesting from each of these goals. In particular, I’ve realized that writing blog posts gets easier the more you do it, cooking breakfast helps me sort out my day/is delicious, and (perhaps most of all) I am not meant to be up at the crack of dawn. Which brings me to my next point:

It’s ok to fail.

Many of my goals don’t play out exactly as planned, and sometimes they get flat-out canceled if they turn out to be terrible ideas (6:30 mornings, I’m looking at you). The point is to experiment and see what works for you. Instead of getting discouraged when you’re constantly not hitting a goal, pause and reconsider if this is a goal you should really be pursuing. Did you over-estimate how much you could do? Is there a better way to get the result you were after when setting this goal? Often it’s the goal that is the problem, not you.

How I Hit my Goals

I use a few simple tricks to help me keep up with whatever goals my optimistic past-self may have signed present-me up for. In particular, this is what I find works best for me:

First and foremost, I try to be realistic. It won’t do me any good to set a goal that I won’t be able to reach, so especially for goals that are more than a week long, I’ll run my idea by someone I can trust to give me honest feedback as a sort of sanity-check. This way if the goal is too ambitious, at least I’ll have a red flag going in that I can use to adjust my targets. Of course, ultimately I know best; if I really think I can do something, I’ll still try it even if the feedback I’m getting isn’t all that positive.

Second, I find it helps to tell people if it’s an interesting goal (like breakfast). Maybe they’ll want to do it too, which makes motivation easier, or maybe they’ll pressure me into remembering to do it, which is nice when needed. Especially with this goal, I’d like to remind you that you’re not me and this may not work for you; it seems my opinion on this subject is not very popular.

Lastly, I find it’s important to give myself visual reminders of my goals. The tool I use most for this is a web-based task-management application called HiTask. For my month-long breakfast experiment, for example, I added a task to HiTask with a flashy-coloured label and a star, so that it really stuck out and was always at the top of my to-do list. You can also go low-tech; in January I printed out a grid of every Monday in 2010 broken down by month so that I could check them off throughout the year after publishing each weekly post.

Have you set any goals lately?

I’d love to hear about anything you’re striving for right now. What tools do you use? What else works for you? If you haven’t set any goals for yourself lately, why not start now? What do you have to lose?

Internet Explorer 9

Monday, April 12th, 2010

I’m a little late to the party on this one, but I have a few of thoughts I’ve been meaning to jot down since watching Microsoft’s MIX presentation about Internet Explorer 9. It’s a pretty in-depth video, and a touch long (~1 hour), but if you’re at all interested in browser technology it’s absolutely a must-watch.

Internet Explorer is no long playing catch up.

The resounding vibe I get from the video is that the Internet Explorer team is finally starting to get really serious about modern browser technologies. I’ve made my position on IE8 clear in the past — namely that it nailed CSS 2.1 but still wasn’t a competitive browser overall — and IE9 looks to be where that second clause will change. For the first time in about 10 years, Internet Explorer is innovating. For the skeptics out there, here’s a list of the features promised in IE9 that I’m excited about:

  • Proper JS/DOM programmability.
  • Standards-compliant HTML5 and CSS3 support.
  • GPU usage for more complicated UI effects.
  • Inline SVG support.

Now those first two aren’t exactly revolutionary, but it’s clear after the CSS 2.1 push in IE8 that the Internet Explorer team isn’t ignoring the standards anymore; they’re dedicated to promoting cross-browser mark-up, and they have the technical capacity to make it happen. This is great news for users and especially great news for developers, and hopefully it will push other browser-makers to fulfill their obligations to HTML5 and CSS3 as well.

What is new are those last two points. Using the GPU for rendering complicated UI effects such as the <video> tag is a welcome innovation to balance increasingly client-heavy rich internet applications. I can see this being a major reason for users to stick with IE9 (the first one in a while, in fact). And what is there to say about inline SVG other than finally? As long as the implementation isn’t falling apart at the seams I can see developers jumping all over this; I wouldn’t be surprised at all to see Firefox et al follow suit with similar support in the near future.

This is going to be huge.

IE9 is going to be the best version of Internet Explorer since IE4. It’s not going to be a standards-scoffing, security-lacking, feature-stealing deviant like its distant predecessors, and it’s not going to be that browser that we all hate rewriting our mark-up for. As a web developer who has lamented the existence of Internet Explorer for the majority of my career, I’m as surprised as I am pleased to say that for the first time in my life I’m looking forward to the next version of Internet Explorer.

The Breakfast Experiment

Monday, April 5th, 2010

Around the end of February, I came across this inspiring post about how cooking breakfast every morning will help you work better and feel happier. I was curious to see how that would turn out if I tried it, so for the entire month of March I made a point to cook a real breakfast every morning.

My definition of “real breakfast”.

A real breakfast (to me) is a breakfast that is relatively healthy and takes some effort to make. A stove should be involved, and eggs are definitely encouraged, but probably the most important rule is that it can’t be just one thing like “a bagel” or “a bowl of cereal” (but a balanced meal that may happen to involve a bagel or some cereal is fine).

My definition of “every morning”.

This quickly slipped to “every weekday morning” because my Monday-to-Friday morning routine is very different from its weekend counterpart, and then further slipped to “most weekday mornings” towards the end of the month — but we’ll get to that in a moment. Here’s how it went:

The good news.

I do agree with pretty much all the points Joe made in his post. I definitely found that it was a great way to start my day off because it gave me a solid 30~40 minutes where I could wake up, get focused, and plan out the rest of my day. I also found that as the weeks went by, I was getting more and more adventurous with what I was willing to try to cook (I’m far from hopeless in the kitchen, but up until a few weeks ago my repertoire of breakfast ingredients consisted mostly of toast and associated spreads).

One other benefit that was probably more specific to me is that it gave me a good excuse to get out of bed on time. I used to be the kind of person that abused the Snooze button a fair bit; a typical morning for me consisted of groggily mauling my alarm clock 3 or 4 times before actually getting up, which means I was more-or-less losing a solid half hour of my day, every day, Monday through Friday. With breakfast as a motivator, I found I was able to get up much more easily sans Snooze, which gave me back part of my day that I then turned into productive cooking time.

The bad news.

Even thought I was quite evangelical about the whole concept of a real breakfast every morning, somehow when people asked me about it I’d often catch myself joking that I was tired all the time. As you might expect, I had to wake up earlier to fit breakfast into my day, and I had a hard time getting to bed early enough to make up for it — even though all I needed was an extra half hour of sleep. This really added up week over week and started to become a bit of a problem towards the end of the month; but to be fair, it was certainly compounded by my incredibly-overloaded March schedule.

Another issue is the typical motivation problem for similar activities like going to the gym. At first it’s really easy, because you told everyone you were going to start doing it and you have to prove to them that you weren’t talking out of your ass. But over time, the novelty wears off and it becomes almost chore-like — resentment sets in, and a spiral of increasing difficulty is spawned (during the last week of March, I skipped breakfast more often than not, which was disappointing). Again it’s tempting to blame this on my overburdened schedule, but I feel like what I really needed to make the entire month work was someone else doing it with me so that we could feed off of each other’s positive energy to keep going (the gym analogy still holds — maybe my similes are improving?).

That said, the pros definitely outweighed the cons, and I am going to try to keep it up through April.

You should try this.

I really recommend giving this a shot. Maybe not for a whole month, but at least try to manage a full week (I went almost three before my first skip). Independent of all the typical bonuses proclaimed in the original article, I did learn a fair bit about cooking breakfast and even more about how important it is for me to spend a little time thinking about my day before tackling it. You might be surprised by what you learn, too!