Monthly Archives: April 2008

I could get cable for this…

My wife and I only recently bought a TV, but we still don’t get cable or even have an antenna. If we ever did, the only things we’d watch are Discovery, History, and Food.

This is the closest I’ve come to signing up:


Check out my latest book, the essential, in-depth guide to performance for all .NET developers:

Writing High-Performance.NET Code, 2nd Edition by Ben Watson. Available for pre-order:

Please help with Word Count Plugin

I was taking a look at the download page for my Word Count Plugin for Windows Live Writer.

It’s gotten a few hundred downloads (thanks!), but the single review is actually spam. Unfortunately, I can’t remove it or even report the review from my account since it’s my own software.

Plea for help: Can a helpful reader out there please report this review as spam and request it to be removed? Also, could someone out there who does use Live Writer write a real review of the plug-in?

If you have further ideas to improve it, please let me know.


Check out my latest book, the essential, in-depth guide to performance for all .NET developers:

Writing High-Performance.NET Code, 2nd Edition by Ben Watson. Available for pre-order:

Rudeness is destroying the arts

or Why I Don’t Leave The House Anymore

“Am I disturbing you?”

The last movie I saw in the theater was the 3-D version of Beowulf. The theater was fairly empty–maybe 30-40 people total. Two teenage girls sat two seats to my left. A man was in front of me. The two girls talked loudly through before the movie and when it started, they didn’t stop. They continued to talk and laugh loudly until the man in front gave up first:

Man: Excuse me ladies, the time for talking is over.

Girl: I ain’t talking to you! You turn right around and shut up. I ain’t disturbin’ no one.

Main: if you don’t stop talking, I will go get a manager and have you thrown out.

Girl: You shut up. Turn around, turn around… turn around mister.

Girl: <to me> excuse me, sir, am I disturbing you?

I looked at her and said, “Yes, you are.”

She shut up after that.

That wasn’t all in this showing. A man/woman couple behind me had the following exchange:

Woman: shut off your phone!

Man: I ain’t shutting off my phone! I don’t shut off my phone for anyone–I don’t even shut it off in church!

Woman: shut it off!

Man: No way!

(this repeated a few times in a similar vein.)

This man got up and left half way through the movie when his phone went off. He came in 20 minutes later with a friend, and they stood in the doorway and talked VERY loudly to each other and on the phone. The man in front of me got up and asked them to leave, and they did..after a minute or two.

What goes through the heads of these imbeciles?

“Thanks for coming to our bachelorette party!”

My mother, grandmother, and family friend were in London. They got tickets to see Dirty Dancing (which they thought was good, but not as good as the movie of course). Apparently that show is popular as a destination for girls’ bachelorette parties. The entire performance was punctuated by screams and yells every time the lead male came out.

I’m not against a good time, but this is the theater not a private party. Most of the audience is there to see a show. The theater should advertise certain days as more appropriate for this thing–theater aficionados beware.

“It isn’t real Texas theater unless you get drunk off your rocker.”

When my wife was visiting family in San Antonio they got tickets to see the touring Phantom of the Opera. They had nosebleed seats, which made the experience even more unfortunate.

Apparently, the theater serves beer throughout the performance–not just intermission. The guys in front of them got up half a dozen times to refill their beer glass throughout the show, blocking their view for a significant period of time. Add to this, the glare from the beer glasses, the opening of cell phones during the performance, bathing everyone in bluish glow, talking, and basically acting as if they were at a rodeo.

What is wrong with people that this is accepted behavior? Why aren’t these people kicked out more often? we (I’m including myself)willing to tell them their behavior is unacceptable and get management to act  ? And I mean without a refund–maybe even a fine or a ban.

Edit: My wife was so upset at the experience that she wrote the theater a letter of complaint.

Yeah, I’m a snob. So what–it doesn’t make me wrong.

All of these stories come down to rudeness at a basic level. People just don’t care what effect their actions will have on others. Sooner or later, this will creep up into the higher arts–classical music and opera, if it hasn’t already. Nobody will enjoy anything because of the few who just don’t care and ruin the experience for everybody.

I actually don’t think I’ll ever attend the theater to see a film again. We finally bought our first TVand a sound system. It’s modest, but it’s better than having expensive experiences marred by idiots.


Check out my latest book, the essential, in-depth guide to performance for all .NET developers:

Writing High-Performance.NET Code, 2nd Edition by Ben Watson. Available for pre-order:

How to enable Simple Tags support in Windows Live Writer

I’m using Simple Tags to do the tags on this site. I wanted to enable support for these tag links in Windows Live Writer (it beats having to log in and edit each post after publishing).

Quite easy:

  1. Click on Insert Tags
  2. In the Tag Provider combo, scroll to the bottom where it says (Customize Providers…) and select that. It brings up another dialog.
  3. Click Add…
  4. Here’s what I entered for my site:

HTML Template: <a href=”http://www.philosophicalgeek.com/tag/{tag-encoded}” title=”{tag}” rel=”tag”>{tag}</a>

simpletags_livewriter

Now you can select Simple Tags as your tag provider.


Check out my latest book, the essential, in-depth guide to performance for all .NET developers:

Writing High-Performance.NET Code, 2nd Edition by Ben Watson. Available for pre-order:

In this universe we obey the law of commutativity

This kind of thing has happened to be a few times now, so I thought I’d share the fun.

In one of our pieces of software we have a process that looks like this:

void MyThread()
{
    while (true)
    {
        DoFunctionA();
        DoFunctionB();
        SleepFor10Seconds();
    }
    
}

While FunctionA and FunctionB are conceptually similar, they interact with completely different systems.

We had a problem with FunctionA the other day–it was taking 120 seconds to do its thing instead of the normal 10 (or less) because a remote server was down. This caused problems for FunctionB because it wasn’t running as often as it should have so things were getting backed up in the system. Oops.

Now, the solution is to split these two functions into two independent threads so they don’t interfere with each other, and I’ve been meaning to do this for a while, so that’s what I proposed.

Response back: “That’s a good idea, but before we do something complicated like that, can we just put FunctionB first?

Um, no.

The time we want to minimize is the time between running FunctionB, which is TimeSleep + TimeA. Putting FunctionB first makes it TimeA + TimeSleep. Last I checked, those were actually equivalent.


Check out my latest book, the essential, in-depth guide to performance for all .NET developers:

Writing High-Performance.NET Code, 2nd Edition by Ben Watson. Available for pre-order:

How to work an 8-hour day

One of the things I decided when I started working was that I was not going to be one of those guys who worked 12 hours a day for a company (if I ever become an entrepreneur, all bets are off since I’m working for myself). So far, I’ve been pretty successful, and I’ve noticed a few things that may help others. Some of these are more observations than practices.

1. Understand reality: Work Load

The first thing to realize is that the amount of work to do will always exceed the time available. This is why effective management is important. If you are being ineffectively managed, it may be difficult to force a change in some of the following areas.

Just because there is always more work to do, this is no reason to kill yourself trying to get it all done. Or even overexert yourself (except in rare instances). Don’t misunderstand: I’m not saying you have an excuse to slack. Giving all of your time and attention to your employer/projects/job is the baseline here. I am saying that just because you have a lot of work is not a valid reason to work 12 hour days.

Unless you enjoy it…in which case you’re reading the wrong article. If you’re a workaholic, sacrificing your health, family, and free time to get ahead, knock yourself out. You can stop reading now.

There are always special circumstances, though. If you operate in an environment that runs 24/7 services and Something Bad happens–well, then you need to fix it if takes you 24 hours. Hopefully, you’ll get corresponding time off in return. If it’s the last week before release of a project and a major bug comes up–get it done.

I’m talking about normal days, normal work.

If you are working 12 hour days and you don’t like it, then change. No excuses. Change the job or change jobs.

2. Don’t waste time

I knew someone who always complained about having so much work to do, working 60-70 hour weeks, always been pressured, etc. I know he did have quite a bit of pressure to do a number of things, but I eventually stopped feeling empathy for him because I constantly saw him talking to so many people (friends, not direct co-workers) during work.

If you’re so busy working long hours, why do you waste so much time? Why is it that the people who complain loudest about being overworked mostly create the situation themselves?

Don’t wander the halls looking for distractions–chances are you’ll find them.

There is a balance to strike here between enjoyable work environment, having friends, being part of a team, and actually getting things done. There is also something to be said for the difficulty of concentrating on challenging topics for a long time at a stretch. Breaks are definitely needed.

There are trade offs to everything. If you spend an hour or two every day reading blogs instead of working on your projects, you’ll pay for it in time later. If this is a trade off you’re willing to make, so be it, but make sure you understand your priorities and the consequences of your decisions.

I know someone else who used 100 words to say something when 4 would do. This made meetings long, tortuous affairs (unless strong ground-rules were created, endorsed, and enforced). Even simple questions were avoided because nobody wanted to sit there and endure a longer-than necessary answer about the history of the universe. Don’t waste people’s times, and don’t stand for people wasting yours.

Be wise, what can I say more?

3. Don’t micro-manage

The topic of micro-management is something that could take up other blog posts and books dedicated to the subject, but I just want to focus on aspects of it related to time.

This is an inverse of wasting time on trivialities. I once had another boss who spent unbelievable amounts of time responding to every trivial e-mail (and he insisted on being CC’d on every topic of course) and he also complained about working extremely long weeks. And he worked all weekend. He checked on the status of things constantly and was usually the first to spot potential problems. (There were other reasons for this, too: he was usually a main point-of-contact for customers and he had more domain knowledge of everything we were doing). He was very, very smart and usually not wrong, but he did spend a lot of time doing things that were arguably someone else’s job. We never felt invested in these aspects of work, though, because he just did them.

If you find yourself with your fingers in every aspect of your organization, you have a problem, and need to take some time out for consideration:

  • Why do you feel the need to be connected to everything going on? Is it because you have to feel in control, or do you not trust others to do a good job?
  • Do you not trust your employees? If not, why not? Do they really do a bad job?
  • If they do a bad job, why? Are they fundamentally lazy, unqualified, dumb? If so, why are they still working there? Why are you paying them and doing their job anyway?
  • Would better training help?
  • Maybe expectations aren’t clear. Instead of you picking up the slack, review the expectations you have for them and go over deficiencies. Make them responsible and give them ownership. Don’t undermine their jobs by taking it away. Check on them in the future to make sure things are improved, but don’t involve yourself day-to-day.
  • Is it necessary to involve yourself in every discussion or can you just ignore until it reaches a level you need to get into? Resist the urge to comment on things you weren’t asked about.

If nothing else, micro-management always breeds resentment.

 

4. Set boundaries

I have tried to make it clear to my bosses over the years that when I’m working on a task, I am not to be bothered on a whim. When I’m concentrating, don’t bug me. This is a somewhat loose rule for me, because it really depends on what I’m working on. However, it is more true than not.

The context switching that can happen with interruptions is dangerous for productivity. Eric Gunnerson wrote about “flow state” years ago. Flow state is a zone you get in where your brain is completely engaged–you’re firing on all cylinders, fully committed and involved–pick your metaphor. It’s hard to get into and easy to leave.

I have a nice pair of Bose QuietComfort 2 Noise Cancelling Headphones. These are essential for me now. The whole topic of listening to music while programming is a separate one, with some debate, but I find it usually beneficial. Sometimes I put them on to block sound without listening to music. This also minimizes casual interruptions. I rarely listen to music while trying to create a new solution for something–only when I’m coding something I understand.

Also make sure to enforce a work/life boundary. I have made it clear in my job that I am not be called unless it’s an emergency that needs to be fixed RIGHT NOW. I ignore IMs and e-mails (unless I’m in the mood to answer something, or it’s trivial, or I know it would make somebody happy to know the answer to). If there’s a critical problem, I’ll get a phone call.

I also communicate vacations and just how far out of reach of civilization I will be well ahead of time.

5. Limit Meetings

There is an abundance of resources out there for effective meeting management. I’m more in favor of limiting the occurrences of meetings in the first place. How well you can do this depends a lot on your organization and the projects you’re working on.

Pointless meetings are a waste of everyone’s time. They can be demoralizing, energy-sucking vortexes. Recovering from a bad meeting can take further attention away from actually getting things done.

In my case, we have mercifully few meetings–only when the entire team needs to give input, we need to brainstorm about a tricky problem, or general status updates (yearly or quarterly).

Much of what goes on in meetings can be substituted by effective individual planning, e-mail, issue tracking, or planning better in the first place.

6. Know your tasks

Spinning your wheels is death. Don’t be wasting your time unconsciously (If I’m going to waste time, I’d rather do it consciously with Desktop Tower Defense).

If you’re stuck on a task, get help, change gears, do something else. Make sure you have a process to detect when you and others are stuck so that you don’t waste time.

Always know what you’re supposed to be working on. In addition to have issue-tracking software, make sure priorities are communicated clearly and often. Once you finish something, you should know what the next task is, whether¬† you do it then or not. Whenever I have a problem of knowing my priorities, I ask my manager. It’s his responsibility to know and set them. I don’t have to worry about it.

There is usually a list of “nice-to-haves” that you can work on once high-priority stuff is done. Don’t let that list get lost, but track it the same way you do regular issues.

7. Effective Information Management

This means all sorts of data: e-mail, documents, data, scheduling, task lists. Simplify, automate, streamline. I won’t go into specific techniques–you can find them elsewhere.

Just a few simple points that I use:

  • Don’t read what you don’t need to
  • Don’t respond when you don’t need to
  • File away or delete ASAP

It’s easy to get buried in information these days–and consequently it’s easy to think it’s at all important. Don’t fall into that trap.

8. External Motivations

A little obvious, this one, but important to ponder. None of this will work if you don’t have strong outside motivations. You have to really enjoy being outside of work–and I don’t think the satisfaction of doing nothing is enough. You’ll get bored of that eventually. Sitting in front of a TV every night “unwinding” for three hours is not a motivational experience (quite the opposite, usually).

Hobbies, projects, sports, exercise, cooking, family, church, books, culture, service are all part of life and should be enjoyed.

I usually schedule my evenings to some degree–whether it’s working out,¬† moving ahead on personal programming projects, building my latest LEGO model, watching a movie with Leticia, or reading a book–I’ve got a long list of things I enjoy doing. If I don’t follow the schedule exactly, or can’t fit everything in, I don’t sweat it–as long as I’m enjoying myself, that’s what matters.

Work isn’t everything–in fact, it isn’t even the greatest part of anything. Be well-rounded.

* Exceptions

Unfortunately, not every job can be forced into a neat 8-hour work day. My wife, for example, works for a news wire service. She works 8-hour days most of the time, but quite often she ends up staying late to take care of things. Unfortunately, when your job depends so much on other people, it can be a bit hard to plan days, and it’s very possible that work comes up right when you leave, or there is too much work to fit in in a day. However, this is unsustainable in the long run. Either more efficient processes have to be introduced, the work load decreased, or more people hired.

A word or two about politeness as well: it’s difficult in some environments to enforce better behaviors without being considered rude, grouchy, or holier-than-thou. Sometimes firmness has to give way to politeness. The carrot usually works better than the stick anyway in the long term.


Check out my latest book, the essential, in-depth guide to performance for all .NET developers:

Writing High-Performance.NET Code, 2nd Edition by Ben Watson. Available for pre-order:

GetTextExtent vs. DrawText (with DT_CALCRECT)

Working on an MFC app that has just been converted to Unicode (finally!), I noticed that one button (which is created dynamically) is too small to fit the text in Korean (and Russian and a few other languages).

The code was calling something like:

CSize sz = m_btAdjustColors.GetDC()->GetTextExtent(sCaption);

It seems correct, but these script languages are throwing it for a loop–the measured size is much smaller than it should be. The GetTextExtent documentation doesn’t shed any explicit light on this subject, but may hint at it.

The solution? DrawText. There is a flag you can pass to tell it to calculate the rectangle needed instead of drawing.

CRect rect(0,0,0,0);
m_btAdjustColors.GetDC()->DrawText(sCaption, &rect, DT_CALCRECT);

It’s important to initialize the rectangle to zeroes because, as the docs say, it only modifies the right and bottom members of the rectangle.


Check out my latest book, the essential, in-depth guide to performance for all .NET developers:

Writing High-Performance.NET Code, 2nd Edition by Ben Watson. Available for pre-order:

How to catch a NetFlix thief

Via Geekologie comes the hilarious tale of a man (boy, really) caught stealing NetFlix DVDs from a mailbox. The comments are funny, too. Some seem like they’re obviously written by the neighbor.

One issue I didn’t really see addressed in the comments on the post is the overall issue of mail safety. People need to consider the seriousness of stealing mail. There’s a reason the fines for it are so severe. A reliable and trusted mail system is the foundation of a good portion of our society and its communications mechanisms.

Having lived overseas, and having had many family members live all over the world, I can personally testify to the need for a secure mail system. There are countries I would not mail a package to–it would just be a waste of money. The security of our system *HAS* to be enforced harshly or people will lose faith in it and it becomes a system of corruption and scamming. This kid got off lucky. If he were older or there were stronger evidence he were stealing more valuable items, or he were being less discriminating in what he stole, I think he could have gotten a far worse punishment.


Check out my latest book, the essential, in-depth guide to performance for all .NET developers:

Writing High-Performance.NET Code, 2nd Edition by Ben Watson. Available for pre-order:

The Bugle podcast

I just discovered this gem of a podcast. The Bugle is a podcast published by the Times Online. Better writing than the Onion, and funnier than the Daily Show. It’s basically two Brits being witty about the week’s news. I’ve only listened to episode one so far, but found myself laughing too hard to concentrate on anything else.


Check out my latest book, the essential, in-depth guide to performance for all .NET developers:

Writing High-Performance.NET Code, 2nd Edition by Ben Watson. Available for pre-order: