Subscribe

Archive October 2010:

Improve ergonomics in your work environment

Ergonomics is always really important, no matter what kind of work hours you put in. Here's a few tips that'll help you get a better work environment.

Keyboard ergonimics

Use external gear when on a laptop

If you're using a laptop a lot, external gear is really important. With external gear, I mean a monitor, a keyboard and a mouse.

It's really bad sitting in front of a laptop day in day out, not only because of ergonomics but also because we're human and not used to work the way we do with laptops. Using external gear will make you feel better and it'll surely improve your body position when working.

Also - make sure you spend money on great external gear - it's an investment that's worth more than you think.

Get a great arm chair

An arm chair is one of the best investments that can be made. A good chair will be more useful than you think.

It's important to get an arm chair with adjustable seat, back and arm rests. Make sure the chair feels comfortable and adjust it to your measures to get the best possible out of the chair.

If you have to raise your chair so that your feet are dangling - get a footrest.

Be aware of your weaknesses and do something about them

Do you know you tend to not sit with a straight back when sitting in front of the computer?
Do you know the monitor you're staring at hour after hour won't do you any good?
Do you work with few light sources?

Do something about it!

Improve your position by thinking at how you sit in front of the computer. Sit up straight!

Get a new monitor and adjust brightness, contrast and sharpness. A good tip is to turn down the brightness to around 50 %, it'll save your eyes and save you some headache.

If you're a developer, use a dark theme with your favourite developer IDE (eg Visual Studio, Eclipse etc).

And one very important thing - make sure you've got enough light when working. Probably a desk lamp.

Pause from work

Every now and then, take a pause from work. Just leave the computer for two minutes and do something else. Do this a couple of times during the day. It's way better taking many short breaks than a long one.

Highlight Current Line in Visual Studio 2010

I recently ran into a minor problem with my Visual Studio theme - the current line was highlighted and because of that I had quite a hard time reading the code and comments on the specific line.

Since I've been dealing with Visual Studio themes a bit lately, I knew how to change the theme colours, via Tools -> Options -> Environment -> Fonts and Colors. However - there are quite a lot alternatives to go through and it isn't always easy to find which alternative corresponds to what Visual Studio theme setting.

Then I found how you could change the appearance of the current line. This is how:

  1. Find the Current Line (extension) and Current Line Inactive (extension) rows.
  2. Change foreground and background.

This is how it could look:

Example of highlighted current line in Visual Studio

Now, most of the Visual Studio users might not have those rows under Fonts and Colors. This is because the Productivity Power Tools must be installed.

The Productivity Power Tools will not only give you more control over Visual Studio's current line, but much more. If you're a serious Visual Studio developer, install the tools!

(Thanks to Patrik Totero for providing me with the Visual Studio theme)

How To Name Controls in ASP.NET Web Forms

When working with ASP.NET, particularly Web Forms up until version 4 of the ASP.NET framework, one might want to think a bit at the naming of the controls used.

I often stumble upon control names looking like this: ChoicesPlaceHolder, MessageLabel and similar. That's clear and decent naming, but it can be improved.

Me and fellow developers have found a simple yet useful and clear naming convention, based on a prefix and a descriptive control name (using Hungarian notation).

This is how it can look instead: phChoices, lblMsg

Naming is particularly important when dealing with nested controls and ContentPlaceHolders. Using better naming, you can improve and reduce this rendered control id:

ctl00_ContentPlaceHolderAllColumns_ContentPlaceHolderAllContentColumns_
ContentPlaceHolderSubNavigation_SubNavigation_RepeaterNavigation_ctl06_
HyperLinkNavigationPageLink

To this id:

ctl00_cphAllColumns_cphAllContentColumns_cphSubNav_SubNav_rptNav_
ctl06_hlNavLnk

Pretty much better, huh? Plus it saves bandwidth.

Also, think twice about where you put runat="server". Is it needed on all controls?

Here's a table with common controls, their prefix and an example naming.

Table: Common ASP.NET Web Forms control and naming
ASP.NET Control Prefix Example
Button btn btnSend
CheckBoxList cbl cblColourCombinations
ContentPlaceHolder cph cphMain
DropDownList ddl ddlNavChoices
Label lbl lblMsg
Literal lit litMsg
Panel pnl pnlLogin
PlaceHolder ph phArticles
RadioButtonList rbl rblPaymentChoices
TextBox tb tbUserName

To the top