The stand up desk rises to the occasion

Like most Americans, I lead a largely sedentary lifestyle. I’ve never been particularly athletic. The closest I’ve ever been was 5 years of forced physical training courtesy of the United States Army. That experience drilled in me a particular distaste for exercise, so with the exception of some fair weather golf, I don’t get much exercise. Between my disdain for exercise and my hectic schedule, carving out time to go to the gym just ain’t happening. Naturally, this creates a vicious cycle: I’m too sedentary, so I get heavier, which only makes me more sedentary, so I get heavier still, and so on.

I sit too much

I recognized some time ago that like most American office workers, I sit far too much. I sit at work, I sit in the car when I travel, I sit in my recliner when I’m home watching TV or playing on the XBox.  Basically, I’m sitting my life away, and over the last few years I’ve really started to notice the difference. My legs, hips, and back hurt most of the time to some extent or another. And of course it doesn’t help that I passed the magical 40 barrier.

There are plenty of articles supporting the idea that sitting is killing us, and really it’s just common sense.  For the office professional, the question becomes “how do I work on my computer all day without sitting?” There are many suggestions but ultimately they all boil down to one idea: get out of your chair. Whether you are stretching, walking, or doing pushups, you have to get out of your chair first. When I wrote about the Pomodoro Technique back in 2009, one of my key points was that during breaks you need to get out of your chair and walk around:

Breaks are essential to the success of the system.  While it may not count as exercise, getting out of your chair is physically good for you.

Getting out of your chair is much harder than it sounds. I was successful when I was strictly following Pomodoro, but otherwise I find it really difficult to tear myself away, especially in the afternoons. Even with the best of intentions, after lunch I can sit for 3 to 5 hours sometimes before I realize it. Sure, it can be done, but you have to have more discipline than me to make it work.

A simple solution

Surprisingly, the answer is drastically simple: don’t sit, stand instead. It turns out that there are a lot of options out there for stand up desks.  I read about them in several articles, and I was curious, but had little to compare it to and plenty of questions. How does that work in a real setting? Won’t your feet hurt? Where do I buy a stand up desk? What if I need to sit for a while? I was also taken back a bit by the cost of some of the stand up desks on the market, and I wasn’t about to invest a bunch of money in something like that without testing it first.

I skirted around the idea for quite a while, talking to people, getting opinions, and generally avoiding actually trying it out. For one thing, I didn’t have access to one of these desks, which is a convenient excuse.  Then I visited a local co-working space and there was a guy there with a stand up desk. More accurately, there was a guy there with a cardboard box on a table, using it like a stand up desk. It dawned on me that I was procrastinating for no reason, so only a couple of months later, I decided to give it a try for myself.

BoxDesk

A simple box desk

The box was a fruit box, which was sturdy and large enough for my laptop, mouse, and coffee cup.  The 2nd monitor is on a shelf behind the box. I already had the box, so it really gave me a chance to try it out for free.

Making the move

The biggest challenge for me was that all the recommendations say not to overdo it. I have a tendency to go whole hog, so I tried really hard the first couple of days to only stand half the time.  The first couple of days, I could feel it in my feet and legs, but my hips and back felt much better. I did worse on days 3 and 4, I ended up standing all day each day. Yes, by the end of each day I was ready to sit, and yes my feet hurt a bit more, but otherwise I felt great. What I figured out was that this is not just about not sitting, or even standing: it’s about movement. Being on my feet all day forces me to move around a lot. I’m constantly shifting my weight, or stretching muscles that normally lie dormant. And the momentum is already there, so walking around the room a bit or even out of it comes naturally. My favorite part is on phone or Internet calls. I use a headset, so I can move around during the call, use regular body language, and basically get more involved in the conversation. This all may sound minor, but it eventually adds up to a superior experience.

Also, I have slept even better than ever since I started, because at the end of the day I’m tired – not from sitting on my rump all day, but from physical activity, which is a very rewarding kind of tired. Oh, and the best thing of all? At the end of the day, sitting down feels really good!

By the morning of day 5 I was hooked and ready to commit, the only decision left was which desk to buy. I did some research and found that there are a lot of options when considering a stand up desk. You can get a gadget that hooks to your existing desk, you can get a desk that is all stand up all the time, you can get a sit-stand desk, you can even get a Treadmill Desk. For a while, I seriously considered a treadmill desk, but it really wouldn’t work in the space I have and since I hadn’t tried one I wasn’t willing to commit to the idea.  I may work up to one some day, just not yet.

What most of the articles I read said was that you still need the option to sit, so to me that meant buying a sit-stand desk. Again, there are plenty of desks out there to choose from with a wide range of styles and prices. One important issue for me is that my work space is in my bedroom, so it has to look nice as well, and unfortunately a lot of the options out there look rather industrial.

At that point, I still had a choice to make: manual or power.  The manual desks either have preset heights that you can adjust to, or have hand cranks to allow finer settings. The preset desks would not be conducive to adjustments during the day, or with a full complement of computer equipment on them. I did not relish the idea of a crank-up desk, and besides, what self-respecting geek doesn’t want power? So I decided to find a power desk.

The problem with power desks is they seem very expensive. I found some that were more than $3,000, but don’t worry those were extreme examples. I needed something sturdy, reliable, and attractive that wouldn’t break the bank. Fortunately, I found it at UpDesk.

The UpDesk PowerUp

Several things impressed me about UpDesk. First, they have a great website. I love the video section – short, funny, to the point. I even watched the “how to assemble” video before I purchased (more on that later). Second, I emailed them and received a response from an actual person in under 30 minutes. Finally, their prices won’t break the bank: I bought the largest one (72″ x 30″) and it was less than $1,000 not including shipping. Shipping was $139 which is perfectly reasonable considering it comes in three boxes and weighs over 70lbs.

The design is simple and very well thought out. There are two leg posts that are set back out of the way, each with its own motor. They are connected by a stretcher that you can use as a cable run, which I’ve also found I can prop my foot on when standing.

Legs and stretcher

Legs and stretcher

The top is thick and sturdy, with an curved front, and all the corners are rounded. And it is definitely attractive with a clean and elegant look that my wife does not protest having in the bedroom. You can choose from 4 different colors, Maple (the one I chose), Mahogany, Black, and Orange (limited to 60″ x 30″).

A word about price

If it seems excessive to spend that much money on a desk, I understand the thought, and I balked at the idea at first myself. Here are a few thoughts I had on the matter. The Money Factor: office furniture is not all that cheap to begin with, and nice office furniture is very expensive. Sure, you can buy cheap laminated particle board furniture, but as the old saying goes “you get what you pay for”. The Time Factor: I don’t know about you, but I spend more time every day at my desk than I do in my bed, so I should be willing to make an investment in a great work space. The Health Factor: ultimately this is about my health, and this seems a small price to pay for something that will make me healthier.

And don’t forget, there are manual options as well that are more affordable. In fact, UpDesk’s crank (video) system seems far better than any of the others I saw in my research, and several hundred dollars less expensive.

Assembling your desk

I ordered the desk on Friday, it shipped on Monday, and I received it on Wednesday. It comes in three boxes, one large heavy one for the desktop, one medium heavy one for the legs and power system, and one long light one for the stretcher. The design is so simple that assembly is really easy. Basically, you connect the legs together with the stretcher, connect the legs to the desktop, and add the power supply and cables. I followed the great installation video and had it put together in about an hour. It took me a little longer because my power drill is broken, so I used manual tools.

And speaking of tools, here’s what you’ll need: a #3 Phillips head screw driver, a 1/4″ Hex drive (if you don’t have one of these, a #2 Phillips head screw driver should work), and a #1 Phillips head screw driver. Add in a little elbow grease and you’ll be done in no time. The biggest challenge I had was unpacking all the parts. Let’s just say that if your desk arrives damaged, call the authorities because the delivery guys ran over it with their truck several times. Oh, and if you love bubble wrap (and who doesn’t?), you’ll get a years supply gratis.

Enough already, where are the pics?

Here are some pics of my assembled desk.

Standing position

Standing position

Sitting position

Sitting position

I learned something else that I never realized: my old desk was too tall. Even with my adjustable chair all the way up, I never realized I was holding my arms at an uncomfortable angle. With this desk, even sitting I am able to get the desk at just the right height for me.

Push button height adjustment with digital display

Push button height adjustment with digital display

The underside is very neat and tidy, thanks to the supplied cable holders.

Cable management

Cable management

And of course, I wrote this entire article standing at my new desk.

Additional reading

Phil Haack – Sitting is making you fat and killing you

Steve Smith – Walking while working

The power of walking while working

Standing desks better for kids too

Working while standing proves beneficial for health

Prolonged sitting shown to be bad for your health

The Wheel in the Sky Keeps Turning

Time marches, the seasons change, and so do our lives.  And so, once again, my life is changing.  Today is my final day with Lotic Factor, Inc.  I have thoroughly enjoyed my time with the team at LFI: they are intelligent, dedicated, and a whole lot of fun, both on and off the job.  Unfortunate financial realities may have brought our partnership to an end, but the friendships will certainly endure.  I wish them all the best, they deserve it.

As for my next chapter, on Monday I begin working as a consultant at Sogeti (pronounced “sew-JET-ee”), an international consulting firm.  Sogeti has a stellar reputation and the projects I will be working on promise to be diverse, challenging, and rewarding.  I am very excited about this opportunity and am looking forward to getting to know my new team.

Finally, after much thought on the matter, I have decided to resign as a ComponentOne Influencer.  I feel that with my new obligations, along with plenty of existing ones, that I am no longer able to meet the needs of the program.  I am deeply grateful to ComponentOne for its community support and for letting me be part of their program. Speaking of C1, be sure to check out the new 2013 release of their Studio Enterprise.

A Sudden Move: one developer’s journey from C# to JavaScript

I was very fortunate recently to have my first article for Simple Talk published.  Simple Talk is an online magazine operated by redgate.  The article is titled “A Sudden Move: one developer’s journey from C# to JavaScript“.  In it, I discuss the reasons that JavaScript is so compelling and try to dispel some of the unfair treatment JavaScript get from developers.

Please pop over and give it a read, feel free to leave comments there or here.

CORS, AJAX, and POST data in Web API

Last week was quite possibly the most frustrating week of my 15+ year software career. Stuff that was working stopped and stuff that should work didn’t. Hours of research on  the Internet and miles of code trying anything and everything to get over this one small hurdle, but all to no avail.  The good news, if you can call it that, is that I wasn’t alone. As my Grandmother always said “misery loves company”, so I shared the problem with my co-workers at Lotic Factor Inc, Brian Lanham and Chris Atienza, and we all suffered together. And then we suffered some more.

For 3 days we rode an emotional roller coaster, hopefully trying new solutions only to end in failure. I don’t see how Edison survived 2,000 attempts at creating the light bulb.  By the end of day 2 I was thinking of inflicting bodily harm on somebody, and by the middle of day 3 I was ready for that person to be me.  If I’ve painted a depressing picture for you, then as a writer I have done my job: I think this is the first time that a software problem has actually depressed me.

However, as evidenced by the fact that I have yet to do myself in, we did finally manage to put together a solution. I just hope it’s a long time before something so frustrating crosses our paths again.

CORS, AJAX, and Chrome

Brian already wrote about the issue in detail, so I’m not going to rehash the specifics. You should go read his post first.

Here are the highlights (my version):

  • Accessing resources across domains (also known as CORS, or “Cross-Origin Resource Sharing”) requires the remote domain to grant permission to the requesting domain. This makes perfect sense.
  • The server must be configured to acknowledge said permission. You can do this through the Response Header or server configuration. This also makes sense.
  • Google Chrome ignores these settings. This sucks. Hard.

OK, the last point may be a little unfair. Chrome doesn’t ignore them so much as makes you do a magic dance and stand on three toes of your left foot under a full moon during a month beginning with a vowel before it will recognize them. Also, it may actually be web-kit causing the issue and not Chrome per se, but as Chrome is my browser of choice for development I’m going to aim all my angst at Google. On the plus side, had I not been using Chrome for development, we wouldn’t have discovered the issue any time soon. Better to suffer now than later I suppose.

The CORS AJAX Handlers

Brian mentioned the CORS AJAX code we wrote, the core of which came from Zoiner Tejada’s article on CORS with Azure. We also found lots of other help from many places, and as always I am grateful for the awesome software development community.

Here is the completed version of our CorsAjax JavaScript file. Just drop this script into your page and it will automatically create a global variable called “corsAjax” which you can use to issue GET and POST requests.

The problem of POST data

Getting past the dreaded origin issue was a major relief, but it led to another problem sending POST data to the Web API controller actions. These actions have object parameters, which should automatically map the incoming data. What we found is that depending on how you prepare the data for the POST submission, sometimes this will work and sometimes it won’t.

If you send JSON, the mapping should occur automatically:

This will result in the object being correctly initialized with the JSON data.

Another common approach is to serialize the data first. In the following example, we’re using KnockoutJS’s ko.toJSON method:

If you POST the data in this manner, jQuery will create a Form object, serialize the form, and submit it. When you do this, the parameter object in the Action method will be initialized to default values.

This means you will need to first extract the serialized string from the Request and re-serialize it as JSON:

Next you will need to deserialize the JSON into your object:

This is a little on the ugly side, so naturally we wrote  a GenericDeserializer<T> class that takes an HttpContext instance and returns the deserialized object:

Using the GenericDeserializer, here is the completed Action to deserialize POST data:

How to tell if the data was serialized

The problem with the preceding approach is that the controller doesn’t inherently know whether the data was serialized or not. If you call the GenericDeserializer when there is no data in the HttpContext to deserialize, it will throw an exception. Rather than relying on try/catch I would prefer to only call the GenericDeserializer if necessary. To that end, I dug around in the Request object and discovered a useful little tidbit that we can use to solve this problem.

The solution is in the Request.Params.AllKeys property. When the data is passed as regular JSON, the sent parameters will be the first ones in this list. If, however, the data was serialized, the first item in the AllKeys list will be null. I wrapped this up in an Extension Method to make reuse more palatable:

Now I can decide when to try and deserialize based on this Extension Method. If the data does not need to be deserialized, it will fallback on the default parameter object.

Putting it all together

The final solution Action code includes the correct method attributes (see Brian’s post referenced previously), a call to determine if the data is serialized, and if needed call GenericDeserializer:

While there are several places this could be streamlined, like using the Request object instead of HttpContext, I can now implement a consistent way to handle POST data in Web API Action methods without the client implementation being aware of specifically how to send the data.

Weekly roundup 10/12/12

Since I started at Lotic Factor I’ve been sharing a list of links with my coworkers we call “The Weekly Roundup”. There is no set schedule but typically I send out a list about once a week. The links mostly come from Twitter and various newsletters. The concept is nothing new, but it saves them from needing to spend as much time on twitter as I do! I’m sharing them in the hopes that some readers may find them interesting as well, and also as an archive of past links. DISCLAIMER: The only qualification for inclusion is that I found them interesting. In no way are the links or articles vetted, nor does their inclusion constitute agreement with, adherence to, or support of any claim, position, prognostication, or statement contained therein, by either myself or my employer.


WINDOWS 8

JAVASCRIPT

TYPESCRIPT

WEB DEVELOPMENT

DESIGN AND CSS

WINDOWS PHONE 8

WINDOWS AZURE

LATEST IN WEB COMICS

HARDWARE

MISCELLANEOUS

 

Weekly roundup 10/3/2012

Since I started at Lotic Factor I’ve been sharing a list of links with my coworkers we call “The Weekly Roundup”. There is no set schedule but typically I send out a list about once a week. The links mostly come from Twitter and various newsletters. The concept is nothing new, but it saves them from needing to spend as much time on twitter as I do! I’m sharing them in the hopes that some readers may find them interesting as well, and also as an archive of past links.

DISCLAIMER: The only qualification for inclusion is that I found them interesting. In no way are the links or articles vetted, nor does their inclusion constitute agreement with, adherence to, or support of any claim, position, prognostication, or statement contained therein, by either myself or my employer.


TYPESCRIPT

TYPESCRIPT REACTION POSTS

JAVASCRIPT

WEB

MISCELLANEOUS

DESIGN

HARDWARE

SOCIAL MEDIA

WINDOWS 8

Weekly roundup 9/28/12

Since I started at Lotic Factor I’ve been sharing a list of links with my coworkers we call “The Weekly Roundup”. There is no set schedule but typically I send out a list about once a week. The links mostly come from Twitter and various newsletters. The concept is nothing new, but it saves them from needing to spend as much time on twitter as I do! I’m sharing them in the hopes that some readers may find them interesting as well, and also as an archive of past links.

DISCLAIMER: The only qualification for inclusion is that I found them interesting. In no way are the links or articles vetted, nor does their inclusion constitute agreement with, adherence to, or support of any claim, position, prognostication, or statement contained therein, by either myself or my employer.


MISCELLANEOUS

WEB

MOBILE

WINDOWS 8

DESIGN

HTML/CSS

 JAVASCRIPT

HARDWARE

Know What the Heck You’re Doing (KWHYD)

Developing for JavaScript has never been easier than it is today thanks to the plethora of freely available open source third party libraries. I’m sure I’ll be writing about many of these in the months to come, but today I want to introduce something that is crucial in JavaScript land. We’ll call it “KWHYD” (pronounced “Quid”) which stands for “Know What the Heck You’re Doing”. What can I say, I’m into naming things these days.

Knockout

I’m a big fan of KnockoutJS, Steve Sanderson’s now famous MVVM library for JavaScript. It may not be your cup of tea: I’ve talked to some pretty smart folks who don’t like mixing the bindings in with the markup. I’ve also met some pretty smart folks who love it’s power, simplicity, and ease of use. As a longtime XAML-head I’m certainly more aligned with the latter. Knockout made my transition to JavaScript and Single Page Applications (SPAs) not only tolerable but downright enjoyable. Whether you use Knockout or not won’t impact the point I’m making, so read on.

jQuery

Another tool that makes life in JavaScript land far more pleasant is the ubiquitous jQuery. My fellow MVP, ASPInsider, and recent founder of WinSitterKevin Griffin, is fond of saying “jQuery makes JavaScript not suck.” My version of Kevin’s statement is that “jQuery makes DOM manipulation not suck.” I’ve also heard it said that “if you aren’t using jQuery, you’re doing it wrong” but I’ll leave you to decide that for yourself.

Library Interaction

This is not an introduction to Knockout or jQuery, the Internet is replete with fine examples and tutorials. For me, these two tools are key components in modern web development, and it would seem Microsoft agrees since they are both installed by default with the new MVC4 templates:

Default scripts included in MVC4 template

Default scripts included in MVC4 template

One of the arguments against JavaScript is that you don’t really have to know what you’re doing. JavaScript is very flexible and ostensibly forgiving of simple mistakes. Using third party libraries can “enhance” this “feature”. Using multiple libraries exponentially increases the probability that something will go wrong.  The interaction between libraries may be subtle so it is exceedingly important you actually Know What the Heck You’re Doing.

The Symptom

To highlight the issue, I’m going to share with you something that happened to me recently. I was working on an application that uses Twitter Bootstrap (see, there’s yet another library at play) for the UI. The app makes heavy use of Knockout for data binding and jQuery for eventing. Here is some psuedo-code to outline the problem:

HTML:

JavaScript:

The problem is that the click event handlers for the option1 and option2 nav pills never fire. I stared at this for quite awhile, made a lot of incorrect guesses, and tried a lot of solutions, all to no avail. The frustration was exacerbated because at one point they DID work. Turns out a seemingly unrelated change was implemented and the UI was never retested, but I’ll address that shortly. Finally, I *saw* it and all was clear.

The Cause

If you are an experienced Knockout developer, you may have already spotted the culprit. If not don’t worry, I won’t make you wait: the offense here is in using the Knockout ‘if’ binding. On the surface, the if binding acts like the visibility binding, only showing the HTML element (and hence its children) if the matching condition is true. What if actually does is physically add and remove elements from the DOM, which is what caused the problem.

When the page loads, and the bindings are created, the value of Companies() is an empty observableArray, which caused the if binding to interpret as false and remove the DOM elements. Since the elements are no longer part of the DOM, jQuery had no targets to bind the events. In other words, it was functioning exactly as designed.

The Solution

It turns out I had recently moved this particular if binding higher in the DOM heirarchy. It used to be in the div after the nav-pills and moving it back there fixed the bug. Another solution would have been to change the binding from if to visible. I’m sure there are more complex solutions, like dynamically adding the jQuery bindings but that seemed unnecessary and nontrivial.

Conclusion

At the end of the day, it was not Bootstrap, Knockout or jQuery at fault: it was me. The true cause was my choice of if instead of visible because I liked the syntax better and not for any technical reason.

What really makes it worse is that by the time I moved the code that caused the problem to surface I DID know how the if binding functioned. I failed to see the unintended consequence and worse still I failed to test the app after the change. In other words, I failed KWHYD at several times during the process. The good news is I won’t make that mistake with if again…

Weekly roundup 09/21/12

Since I started at Lotic Factor I’ve been sharing a list of links with my coworkers we call “The Weekly Roundup”. There is no set schedule but typically I send out a list about once a week. The links mostly come from Twitter and various newsletters. The concept is nothing new, but it saves them from needing to spend as much time on twitter as I do! I’m sharing them in the hopes that some readers may find them interesting as well, and also as an archive of past links.

DISCLAIMER: The only qualification for inclusion is that I found them interesting. In no way are the links or articles vetted, nor does their inclusion constitute agreement with, adherence to, or support of any claim, position, prognostication, or statement contained therein, by either myself or my employer.


MISCELLANEOUS

WINDOWS 8

EXPRESSION BLEND

WINDOWS PHONE 8

HARDWARE

JAVASCRIPT

ASP.NET MVC

MICROSOFT OFFICE

MOBILE

DESIGN/CSS

 

 

Metro is dead, long live FIRST

On a recent This Week inWindows broadcast, Leo and Mary Jo Foley discussed some of the issues introduced by Microsoft’s abandonment of the Metro brand.  The problem is a serious annoyance to developers and especially technical teachers, bloggers, presenters, and authors. It’s also the source of some not-always-so-good-natured ribbing from the technical community. I’m a big fan of using proper terminology, so when Microsoft declared that Metro was verboten I dutifully tried to expunge it from my vocabulary, but I find it increasingly difficult.

Metro was used to refer to the new design language, but it also referred to the new Windows 8 experience. The tile-driven, blocky, clean and modern look and feel of Metro was already present on Xbox, Zune, and a host of other applications and websites. Discussing this UI approach without using the word Metro is a challenge, so what should we be saying instead? There was a period of uncertainty created by the void of Metro.  Some replacement names were floated around, some were not even all that bad such as “Modern”, and some were more in keeping with Microsoft, such as “Windows 8 Style”.

For a time Microsoft was quiet on the question of “what do we call it now?” but finally Visual Studio 2012 RTM’ed and we had the official answer. Metro is now rebranded “Windows Store”, so the style is now the “Windows Store Style” and the applications are “Windows Store Applications”.  Having spoken on Windows 8 development numerous times in the recent past, let me tell you that this is no fun at all, and it certainly doesn’t make sense in every scenario.

I’ve long referred to the new start experience as the Start page, but it makes no sense to refer to the new face of Windows 8 as “Windows Store Applications Start Experience”.  I tried to refer to it as just Windows 8, but that isn’t fair as the desktop is also part of Windows 8.  You can try just calling it Windows 8 Style, but let’s get real: life was much easier when we had “desktop” and “Metro”.

To address this issue, I’d like to suggest a community driven rebranding: let’s start using the phrase FIRST Apps. FIRST is an acronym for Fluid, Immersive, Responsive, Service-oriented, and Touch-friendly. Let’s discuss each of these in turn.

Fluid – Modern applications should be easy on the eye and engaging. Navigation should be animated and lively, utilizing animations, transitions, and easing. Effective use of white space and visual cues provide hints to more content.

Immersive – Content is King, and we should minimize anything that detracts from the content. These detractors, known as “the Chrome”, are very familiar to Windows users: menus, toolbars, status bars, navigation links, context menus, and so on.  These items do not need to be visible all the time: every pixel they use decreases the area available to present the thing the user cares about the most, the Content.

Responsive – Applications should start, load, and react quickly.  Heavy adoption of asynchronous techniques drive at least an illusion of performance and provide a non-blocking UI experience. Applications should start and reactivate quickly.

Service-oriented – I would also accept “Sharable” or “Social”.  This indicates an active reliance on content services, typically supplied by some cloud or web service or social interaction. It should be easy to share content with other people and applications.

Touch-friendly – non-traditional devices increasingly dominate the user experience, and the vast majority of these new devices are touch based. Touch support is included as part of WinRT but we still have to consider is as a design feature.  Adequate spacing, large friendly touchable items, and adherence to common gestures should be standard features.

I believe that FIRST embodies the intent and style of the brand formerly known as Metro.  It has the added benefit of being short  easy to say.  Metro is dead, long live FIRST!

Next Page »