Archive for the ‘General’ Category

Because you’re reading this magazine, there’s a good chance you sling code for a living. And if you sling code for a living, you probably spend a lot of time in your IDE … which is—because you’re reading this magazine—probably Visual Studio.

Visual Studio 2010 is already an incredibly versatile coding tool. It does pretty much everything except write the code for you, and in many cases it’s getting good at doing that, too. Still, Visual Studio can’t do it all out of the box.

That’s where extensions come to the rescue. Visual Studio 2010 provides robust support for extensibility via custom tools, templates and plug-ins. (Note, however, that the Express versions of Visual Studio don’t support extensions.) If you can’t find the feature you need in Visual Studio, chances are there’s an extension that helps you customize the IDE or provides the tools you need to write code better and faster.

We’ll cover a few of the most popular free extensions for Visual Studio 2010.

Power Tools for Visual Studio There are thousands of extensions out there, and it just so happens that one of the most robust extensions was created by the Visual Studio team. Visual Studio 2010 Productivity Power Tools (bit.ly/g4fUGG) is a package of 15 handy features that range from Solution Navigator (think Solution Explorer on steroids) to tab autocompletion and highly configurable enhancements to tabs. Scott Guthrie explains how each of the features in Productivity Power Tools works on his blog, so check that out for details (bit.ly/aopeNt).

image: Solution Navigator in Productivity Power Tools

Solution Navigator in Productivity Power Tools

PowerCommands 10.0 PowerCommands 10.0 (bit.ly/hUY9tT), like Productivity Power Tools, is a grab bag of useful extra tools that will speed up or simplify common tasks in the IDE. You get 25 features in the package; they include robust copy and paste enhancements (copying entire classes, for example). The package also includes the ability to format your code, sort using statements and remove unused using references when saving.

Team Foundation Server Power Tools September 2010 Don’t feel left out if you’re using Visual Studio Team Foundation Server (TFS). Microsoft has a set of Power Tools for you, too. This extension (bit.ly/hyUNqo) gives you 11 new features that include check-in policies and item templates, a process editor, TFS command-line tools and Windows Powershell cmdlets, team member management, Windows shell integration and automated database backup.

Visual Studio Color Theme Editor It may not sound as glamorous, but sometimes it’s the little details that make coding that much easier. Take the colors used in the Visual Studio windows, tabs and menus, for instance. Do brighter colors cheer your mood? Are you particularly fond of magenta? Whatever you prefer, Visual Studio Color Theme Editor (bit.ly/fPKKEV) lets you customize all of the environment colors used in the IDE. You can also save themes and share them with your friends.

StudioStyles An even more personal choice is the colorization used for the code itself in your editor. StudioStyles (studiostyl.es) is a Web site that lets you download, create and share the .vssettings files that specify code colorization. Added bonus: These themes can be used with Visual Studio 2010, 2008, 2005 and even the Express versions.

image: StudioStyles

StudioStyles

WordLight Do you ever want to quickly find all the places you’ve used a method or variable name? WordLight (code.google.com/p/wordlight) is a simple extension for Visual Studio 2008 that lets you select some text and instantly highlights all other occurrences of that string in the code file. It also works in the Output, Command and Immediate windows.

Spell Checker If y0u tpye lke I do, the Spell Checker is a lifesaver. The Spell Checker extension (bit.ly/aMrXoM) looks for errors in the non-code portions of your files. It works in any plain-text files, for comments and strings in source code, and for non-tag elements of HTML and ASP files.

TortoiseSVN Add-in for Visual Studio So you’ve written and tested your code. If you’re working on a team or open source project, you probably need to commit your source to a repository. There’s a tool for that.

If you’re using Apache Subversion (subversion.apache.org) source control along with a TortoiseSVN client for Windows (tortoisesvn.tigris.org), there are a couple of Visual Studio extensions that incorporate the TortoiseSVN functionality into the IDE (tsvnaddin.codeplex.com), saving you many steps in the commit process.

VsTortoise When using TFS, you’ll need to add a layer such as SvnBridge (svnbridge.codeplex.com) that translates APIs between Subversion clients like TortoiseSVN (vstortoise.codeplex.com) and TFS.

Another popular source-code management system is Git (git-scm.com), and if that’s your preferred repository, then there’s an extension for you, too. Git Extensions (code.google.com/p/gitextensions) includes shell extensions for Windows Explorer and a Visual Studio plug-in. Plus, you can run most features from the command line.

NuGet Inspired by RubyGems and similar package-management systems from the Linux development world, NuGet (nuget.codeplex.com/) gives Microsoft .NET Framework developers the ability to easily incorporate libraries from source-code repositories directly into their local development projects. NuGet integrates with the Visual Studio 2010 IDE, and you can also run NuGet from the command line or via Windows PowerShell cmdlets.

image: NuGet

NuGet

Emacs and Vim Emulation In the beginning there was vi, and it was difficult to learn. Since those early days, Emacs and Vim have battled for supremacy as the One True Editor among coders. If you’ve chosen sides in that debate, yet find yourself using Visual Studio, then rejoice! The keybindings and many other features you know and love from Emacs and Vim are now available in extensions for Visual Studio.

You can follow the progress of VsVim (bit.ly/e3GsMf) developer Jared Parsons via his blog (blogs.msdn.com/b/jaredpar/). More information about Emacs emulation (bit.ly/eXhaIK), along with lots of other great tips, can be found on the Visual Studio Team blog (blogs.msdn.com/b/visualstudio/).

A Gallery of Extensions This is just the tip of the iceberg as far as Visual Studio extensions are concerned. Thousands of templates, custom controls and extensions are available through the Visual Studio Gallery (visualstudiogallery.msdn.microsoft.com), and more are being added all the time. Many are free, and there are trial versions available for many of the commercial products.

Write Your Own Extensions Don’t see what you need in the Visual Studio Gallery? Write your own! Visual Studio 2010 includes deep hooks for extensibility—anything from a custom project template to third-party tools that integrate directly with the IDE. Through the Extending Visual Studio developer center (msdn.microsoft.com/vstudio/vextend), MSDN Library articles and other resources in the Visual Studio community (bit.ly/aT1bDe), you’ll find a vast amount of information to start creating custom Visual Studio extensions. You’ve already got the tools … start coding! 

Source: Terrence Dorsey

About the Author:

Terrence Dorsey is the technical editor of MSDN Magazine. You can read his blog at terrencedorsey.com or follow him on Twitter at @tpdorsey.

Rule 1: Life is not fair – get used to it!

Rule 2: The world doesn’t care about your self-esteem. The world will expect you to accomplish something BEFORE you feel good about yourself.

Rule 3: You will NOT make $60,000 a year right out of high school. You won’t be a vice-president with a car phone until you earn both.

Rule 4: If you think your teacher is tough, wait till you get a boss.

Rule 5: Flipping burgers is not beneath your dignity. Your Grandparents had a different word for burger flipping: they called it opportunity.

Rule 6: If you mess up, it’s not your parents’ fault, so don’t whine about your mistakes, learn from them.

Rule 7: Before you were born, your parents weren’t as boring as they are now. They got that way from paying your bills, cleaning your clothes and listening to you talk about how cool you thought you were. So before you save the rain forest from the parasites of your parent’s generation, try delousing the closet in your own room.

Rule 8: Your school may have done away with winners and losers, but life HAS NOT. In some schools, they have abolished failing grades and they’ll give you as MANY TIMES as you want to get the right answer. This doesn’t bear the slightest resemblance to ANYTHING in real life.

Rule 9: Life is not divided into semesters. You don’t get summers off and very few employers are interested in helping you FIND YOURSELF. Do that on your own time.

Rule 10: Television is NOT real life. In real life people actually have to leave the coffee shop and go to jobs.

Rule 11: Be nice to nerds. Chances are you’ll end up working for one.

Source: Facebook

How do you answer the question, “what do I need to learn to be a good programmer?” I have written posts trying to answer that question, typically focusing on the languages that you should learn or the algorithms and other techniques you need to know. What about the rest of a programmer’s life? This is a less serious look at the life of a programmer. So, what does a programmer really need to know?

  1. Caffeine – You need to find your preferred caffeine delivery system. Mine is black coffee, early and often. Others may prefer diet soda throughout the day. There are always the classics as well, Mountain Dew and Jolt.
  2. Logic – As a programmer, you deal with logic constantly. Your true mettle will be defined by how you deal with the insanity (real or perceived) of the customer. The customer could be your project manager, the business analyst or the users. For any given project, you can count on someone sounding completely insane.
  3. Hours – Expect to be working a lot of them. Programming is one of those jobs that refuses to follow the 9 to 5 path. As you get closer to your deadline, the hours you work will increase quickly. Just hope that you can work from home sometimes. Also, weekends and time off are for management, and you need to be available at all times.
  4. Corporate Leash –  You may not have any power to make decisions, but that does not mean the company cannot give you a leash. The ability of constant communication is too much for companies to pass on so you will likely get a crackberry, a pager (people still use them), or some other company provided cell phone. No, your leash will not be an iPhone, this is not meant for fun this is business.
  5. Blame – As a programmer, you are the low man (or woman) on the totem poll. Just remember that shit rolls downhill, the buck stops with you and if there is a defect it is obviously the programmer’s fault.
  6. Sleep – More importantly it is the lack of sleep that you need to be concerned with. As your hours increase, you will find there is less time to sleep. You will have to call into a conference call at 7AM with your offshore team, or support a 5AM deployment on Saturday.
  7. Skills – Your skills typically do not matter in the corporate environment. There are plenty of programmers that do not have jobs and could fill your position. Your expertise in the business domain is not important because there are business analysts that are supposed to be the experts in the business. You are replaceable, you are just a part in the corporate machine.
  8. Odors – As the hours get longer and management reads something about the productivity of team rooms, the odors start to get worse. We are not talking about someone heating up their lunch. We are talking about the stereotypical, unkempt programmer sitting in a room full of other unkempt programmers. After some time, the room starts to smell like a camel, and it is not pretty.
  9. 24/7 support – Yes, you will be pulled into support at various times, even for something like a customer service site. The application may not be life threatening or revenue threatening, it is just job threatening. So, your corporate leash will ring at the worst possible moment and you will have to get on a conference call with 10 people who have no idea how to fix the problem but need to be involved from the management perspective and one other person that might be able to help you.
  10. Stress – Project failure is never an option. You cannot miss the deadline even though it was not the deadline you proposed. No, you cannot remove features from the application in order to make the deadline either. You need to deliver the entire application by the deadline, or the entire team could be fired. Nothing like a little pressure with your morning coffee.
  11. Non technical managers – These people are considered the bane of most programmer’s existence. They need to manage a group of programmers, but they do not understand what they do for a living besides “they write code”. They typically overpromise, underdeliver and treat their programmers like cattle or “resources”.
  12. Political battles – This is one of those things that programmers are rarely directly involved in. However, your project and even the whole team could become the casualty of some political war. You have no power to prevent any of it, but you are definitely involved. Keep listening to the rumors so that you have some warning that something bad could happen.

Obviously, these ideas will not happen everywhere and are much more of a worst-case scenario. If you see several of these things at your current employer or even a prospective employer, you may want to run the other way. Given that you already carry a cell phone anyway, don’t worry about the corporate leash, they will just want your current cell phone number.

Common Problems Programmers Face

Posted: August 10, 2010 in General

Programming is a deceptively damaging field to be in, partly because it doesn’t seem like you’re doing much, and also because of the attitude many programmers have toward their body. You should care about keeping yourself healthy because, when your body is in good shape, that removes "friction" from your mental capacity so that it can focus on important things rather than annoying little problems with your physical wellness.

Obviously the advice on eating right, going outside, getting exercise has been said by everyone. I’m not really going to tell you how to eat, or work out, or how to do a martial art or something else to stay healthy. If you are interested in those things, then please find a professional who can train you and help you.

What I do want to cover are a set of particular problems programmers have from their daily profession. These are just simple really obvious things that for some reason programmers don’t realize aren’t supposed to be happening:

  • Pain in your wrists from Repetitive Strain Injury (RSI).
  • Problems with your eyes from staring at moving print for extended periods.
  • Back problems from poor posture, especially in the lower back and upper shoulders.
  • Bowel and urinary issues from not crapping and pissing when you should.
  • Dehydration from drinking too much caffeine and not enough water.
  • Problems with hemorrhoids and the prostate for guys from sitting too much. Yep, I’m gonna go there.
  • Vitamin D deficiency from lack of sunshine.
  • Sleeping disorders from staying up late and drinking too much coffee.
  • General stiffness and soreness from a lack of stretching in general.

I’ve had to struggle with all of these problems at one point in my life because of programming, guitar, or actually from lifting weights wrong. In each case I was able to get healthy and then avoid it the rest of my life, and really only deal with a few problems periodically. You may think some of these are stupid, but believe me, many programmers have these problems for various reasons even if you might not.

The General Cause

Overall the general cause of all of these problems can be summarized as treating programming as an obsession. You may want to be very good at it, like I did, so you exclude everything else in your life in order to master it. You don’t go to the bathroom, you have macho 10 hour coding sessions, you don’t eat right, and all manner of mythological beliefs about "real programmers".

Truth is real programmers are kind of idiots. They don’t eat right. They don’t have sex on a regular basis. They can’t run without gasping for breath. They have huge problems with their internal organs not caused by disease. Really, it’s just not worth it if you have to kill yourself to be good at something.

So, as you read through each of these problems and how I’ve cured them, remember that it’s all about just having a balanced life and not being obsessed with coding or your business. Trust me when I say you will actually become better if you take it easy on yourself and stay healthy.

Wrist Pain

This is probably the one I struggle with the most, because I code and play guitar quite frequently and for long periods of time. I’ve had pain in my wrists periodically since I started coding professionally at 22, but I always had a set of Aikido exercises I did to get my wrists straight.

You see, Aikido has these fantastic wrist exercises that make your wrists strong and supple at the same time. They developed the exercises to avoid injuries during practice since many of the Aikido techniques involve wrenching, ripping, and breaking the joints in the arms, wrists, and shoulders.

For me these exercises have always fixed any misalignment and pain, and they’ve allowed me to code for long periods of time without much trouble. Typically the only time I’ll have problems is if I’ve switched keyboards and have a new odd keyboard layout, but if I do I simply do the exercises for about a week every time I go to code and they get strong again.

Now, if you have serious carpel tunnel or another kind of RSI then consult your physician before trying these. If you do them, then start very slowly, and do not try to make them hurt. Stretching should not hurt, it should just be "mildly uncomfortable". If it hurts, then you are straining to do the stretch.

What you actually want to do is relax into every stretch you do. It’s hard to explain, but instead of forcing your joint to a certain position, bring it to that position and then think about relaxing it or "letting" it move a bit further.

Keep this in mind, and then here’s a set of videos that show you how to do each exercise:

Here’s how you use these exercises before you sit down to type (every time!):

  1. First, you need to warm up, so put your hands out in front of you and grab at the air as fast as you can 20 times. Then shake your hands, then rotate your wrists 10 times one direction and 10 times another.
  2. Start with the first exercise you’re best at, and do 5-10 of them at a medium speed.
  3. Continue through each one, but after each one shake your hands and arms and rotate your wrists to realign them. These exercises do some moving of the bones in your wrist, so shaking them sort of makes them settle back in.
  4. NEVER do too much strain on your wrists. Do just enough to get them going and feeling supple and relaxed, but the motto "no pain no gain" will only damage you.

Do these each time you go to type, every day, and any time you stop. It doesn’t take long to do them, and after a bit of discomfort as your wrists start to adapt and get realigned, you’ll start to feel better.

One more time though: DO NOT DO THIS WITHOUT CONSULTING A DOCTOR FIRST You do these at your own risk, so don’t sue me if you fuck up your wrists because you didn’t pay attention. These exercises have been done for maybe thousands of years in various martial arts, so I know they aren’t dangerous but everyone is different. You could screw yourself up bad if you do them wrong, so if it hurts stop doing them and talk to a doctor!

Guitarists Are Worse

Programmers will get RSI but it’s nothing compared to what guitarists and bassists get. For various stupid reasons there’s myths around many of the big name musicians and their claims of studying "8 hours a day" or "16 hours a day!". Because of this guitarists will kill themselves and damage their hands making it impossible to play.

Guitar is a hard instrument on your hands, so even a little pain can put you out of commission. I learned this the hard way in school because, like an idiot, I believe my instructors when they said I had to study 8 hours a day. I literally thought they meant 8 hours straight, so I did that for about a month and then BAM!

Fucked up my thumb and gave it a bone spur and all my fingers hurt like crazy. My wrists were solid, but my fingers just couldn’t take it. Like an idiot I didn’t listen to what I already knew which is any new activity has to be gradually increased like any other work out.

The only way I could fix this, and it took nearly 1.5 years, was to do the following:

  1. Find guitars that didn’t hurt my hands. The idea that you can "play any guitar" is crap. Get the best guitar you can that doesn’t hurt you.
  2. Do the above exercises, and then some more for my fingers.
  3. Start slowly rebuilding my fingers and thumb by doing a set of exercises to improve their strength and relaxation.
  4. Constantly focus on relaxing while playing so that I could use a lighter touch.
  5. Avoid bends as they hurt my hands and caused me injuries.
  6. Changed my position and playing style so that I’m able to move around quickly without having to grip the guitar, instead my thumb is on the back of the guitar where it’s comfortable.
  7. Adjusted the height of my guitar so that it was comfortable on my shoulder and hands to play.
  8. Always play standing up now, rarely sitting down for long periods of time because the position is awkward, and if I do I keep the same position.

After doing that for the last year my hands are finally feeling good and have healed up, and I’ve not got good habits that prevent me from injuring myself. I’m an old guy so these things are important, but that also means I can’t do anything that might hurt my hands.

My hands are my life right now, so that means no boxing, capoeira, or anything else I really want to study. I have to much riding on my hands to waste it on a punching bag.

Eye Strain

I think this isn’t as much of a problem as it was for me, but you have to watch out for your eyes. I had perfect better than 20/20 vision when I was younger, but from decades of computer use my eyes are "slightly off". I have a minor correction in glasses and these days I just wear them all the time even if I only need them a little bit. The world is just annoyingly fuzzy without them.

Back in the bad old days we stared at CRT screens all day, which had horrible annoying flicker and screwed up quite a few eyes. These days it’s not the flicker so much as the poor font rendering on most LCD screens. Thanks to patents owned by Apple (I think) many computers can’t render fonts well on an LCD screen. Some folks though think Apple’s font rendering looks "fuzzy" so your mileage may vary considerably.

In my case I try to get out for about 2 hours a day and not look at a computer. Either I do something that doesn’t involve reading like play guitar, or I go for a walk or to the park. I may not do this for a full 2 hours but I try to not start at a computer screen for at least 2 hours a whole day.

This will also help with headaches you might have. Frequently programmers will think that the lighting in a room is what gives them headaches from using a computer, but really it’s bad posture, shitty fonts, not drinking enough water, and just using the computer for too long at a stretch.

Instead of doing some extreme thing like turning out all the lights in your office, just have good lighting and use a color scheme that fits the type of LCD you have and the room’s lighting. It’s the combination of room/area lighting, LCD brightness, LCD quality, fonts, and your color scheme that will make you feel better.

But most importantly, just take a break.

Back Problems

I’ve been extremely luck to have a good solid back most of my life. Even though I’ve been sitting in a chair for a good portion of that life, I still have a good flexible and strong back.

For me, the problem is in my upper back, neck, and shoulders. I tend to hunch over the keyboard and have to force myself to sit up straight. In fact right when I started typing this section I noticed I wasn’t sitting up straight and had to correct it.

Now, the choice of chair matters, and I tend to like either Aeron chairs of some kind of solid small stool or bench. I’m currently very much liking my little $40 piano bench I used to sit on to practice piano. It doesn’t have a back so it forces me to sit up straight more often and engage my core muscles (stomach and back muscles).

For my shoulders though it’s entirely stress. I tend to "scrunch up" my shoulders when I’m focused intensely and that causes my whole upper back to hurt, sending pain all the way up my neck and head. It gets really bad if I practice guitar for long periods at a time.

What I’ve found helps the most is stretching your upper arms and doing push-ups. Stretching your upper arms is as simple as grabbing a door jam, grabbing it, and pulling each arm or both arms in a different direction. Try these if you’re feeling stiff:

  1. Grab a door jam with one arm so your palm faces the front of your body, then pull your shoulder out so you stretch your chest and the front of your shoulder.
  2. Grab the door jam with one arm so that your arm crosses your body, and again with your palm facing the front (kind of backwards), then pull so your shoulder at the back is stretched.
  3. Put both arms on the door jam in front of you, right above your head, and stand away from it a bit so that you lean down and pull your arms above you and back.

If you do that, and also rotate your shoulders and shake your body out you’ll start to feel much better. Maybe combine this with your wrist stretches before you work each day.

Another big help is doing some push-ups. I wouldn’t do these at work or before you work because it will make you tired and make it hard to work. I’d instead just do 10 a night before you go to sleep. Just 10 will do a lot for your chest, back, wrists, and neck. Don’t do them very fast, but do them slowly and focus on balancing your body when you do them.

Dehydration

This one is simple, and I’m guilty of it quite frequently. I find I drink a ton of coffee, and because of that I have to make sure I drink some water too. If I don’t I get headaches and really don’t feel right. The problem with dehydration is it’s hard for you to tell you’re suffering from it until it’s too late.

What I suggest, and what I’ve started doing more, is that you drink a bottle or cup of water with every non-water beverage you drink. I also recommend you ditch the sodas. They’re just full of nasty fake sugar that make you fat and cause diabetes, and they’re not rehydrating you. If you gotta drink something then plain black coffee is pretty damn good, but again drink some water with it.

Bowel And Urinary Problems

Alright the next two are kinda gross so I won’t go into what happened to me, but I’ll say this:

Go to the fucking bathroom right when you have to go. Don’t wait.

You wouldn’t believe how useful this advice is and I really wish I’d been told it when I was younger. Because I would code non-stop like a "real programmer" I would skip bathroom breaks and hold it in for far too long. The problem is with bowel movements your body just stops telling you to crap, and then it builds up.

This eventually leads to constipation and it’s a motherfucker on your health. For your urinary tract it causes problems that are less important, but you can get infections and other nice little surprises.

If you’ve already screwed up, the best thing to do is go get some fiber tablets and take them then stay home ’cause it’s gonna get ugly.

Then, when you feel you need to go, just get up and go for the love of god. I’m telling you, your brilliant idea will come more naturally after you poop.

Hemorrhoids and Prostate Health

The other problem you have from not using the restroom when you should is that you get hemorrhoids. Yeah yeah, I know, really gross and I promise this is the only time I’m gonna mention them ever. But, many programmers have them and are ashamed to talk about them or even know what causes them so I’m going to lay it out for you. I’ve actually done all of these but only had them once or twice:

  1. Sitting for a long period of time.
  2. Lifting heavy weights without proper equipment.
  3. Not taking a dump when you actually need to.
  4. Forcing a dump when you don’t need to.
  5. The worst one though: Sitting on the toilet reading.

This last one is the killer let me tell you. If you don’t have to go, then do not sit on the can hanging out. What this does is put all the weight of your body and bowels on your already probably screwed up rectum and then pushes it out. Nasty. That also then causes hemorrhoids because the pressure increases in your blood vessels unnaturally.

These are just freaking gross, but they’re also potentially harmful. Yes, you can get some that are so bad you bleed all over the place. If you have some, please go see your doctor and deal with it. You may need surgery, so just do it. I didn’t but man it was close. One year I was lifting weights, working in a warehouse, coding non-stop, and not using the bathroom.

Yep, I was idiot, so don’t make the same mistake. Make sure you do these three things to keep your ass healthy:

  1. Eat some veggies regularly, or eat some fiber tablets at least.
  2. Go to the bathroom right when you have to go.
  3. Don’t force pressure down there in any way.

This can also damage your prostate if you aren’t careful, but usually that’s from sitting on your ass all day. Just get up and walk around or take breaks and you’ll fix that problem. If you find blood in your urine or you have problems peeing, go see a doctor because it might be more serious. If you pee a lot it can also be bad, so again see a doctor.

Vitamin D Deficiency

Vitamin D is weird. You really only get it from the Sun but you don’t need much direct sunlight to get it. Maybe like 5-30 minutes depending on how strong it is. It’s also tied to your calcium levels, and a lack of phosphate, but if you eat regularly and something other than potato chips that shouldn’t be a big problem.

Some of the things you can get are depression, screwed up teeth, pain in weird places like in the bones in your arms, cramping muscles, and just generally feeling like crap. If you’re really bad you might need to get a prescription from a doctor, but usually you can just make a plan to go outside for 30 minutes when the Sun is high in the sky.

In fact, I think this is one of the problems with catered food at many startups here in the Valley. Since you are inclined to stay in the office and eat food and constant leftovers, and because many offices have poor lighting, you tend to not go outside when the Sun is out. Combine that with poor sleeping habits and you can really be screwing up your vitamin D levels without knowing it.

Just something as simple as not eating the catered lunches and walking outside at noon to get your food could help more than you know. Anyway the food is better.

I got minor vitamin D deficiency when I lived in Vancouver and Seattle. Up there you just don’t have sunshine for months on end, and for me that was a killer. Some people can handle it, but for people like me who lived on a tropical islands in his teens, this was just murder.

So, if you have sunshine, get out and grab some when you can.

Sleeping Disorders

I’ve always had a flexible sleep schedule, usually depending on the season and the region. In some areas I trend toward a night owl persona and stay up really late doing things then sleeping in. Lately since moving to SF I’ve been getting up earlier and not staying up as late, and I’ve actually been feeling really good lately.

Sometimes though, and I’m not sure why, I feel way more productive in both music and coding late at night, or very early in the morning. I think it’s because I’m still in a tired state and so my brain is relaxed. I also think it’s because it’s very quiet and I can just hang out and think with no distractions.

Either way, this need to either get up very early or stay up very late sort of screws with my sleep schedule. I find that I much prefer getting up early as I get older. I feel more awake and rested during the day. If I stay up late and sleep in I feel like I have a hangover and I can get headaches.

If you have problems sleeping though, I have a very simple kind of meditation that I’ve been using for years to help you crash. It takes a bit of practice, but it totally works and works quickly.

First up, if you can, get the best damn bed you can afford. 2000+ dollars is nothing for a great bed. I spent at least 2200 on a sweet Tempur-Pedic. It’s totally worth it.

Now with your awesome bed here’s how you start practicing getting to sleep easily. It’s kind of a self-hypnosis trick:

  1. Make sure that you’ve killed all sounds and lights that might be in your room.
  2. Lay on your back and put your hands on your body somewhere comfortable, or at your sides.
  3. Start breathing in deeply and slowly and breathing out, as you do this imagine you can see the air flow in and out of your body.
  4. Once you start to see your breath, imagine that you’re looking through a window and outside the window is a large huge open space with stars in it.
  5. As you breath feel yourself float through the window and slowly out into the massive expanse of stars, all floating softly around you.
  6. Keep this going and then just let this floating spread into your bed and out around you until there is nothing.

You probably will crash out at around 4 or 5, but if not just hang out and keep letting yourself float and melt until you do.

If you have severe insomnia then definitely talk to a doctor about it, but try this out, as well as exercising like crazy for about an hour or two a day. Exercise will definitely make you sleep.

Stiffness And Flexibility

If you constantly feel "stiff" or unable to move well, then you probably need to stretch regularly. Really the best thing you can do is go to yoga about once a week, and then try to do the exercises on your own. If you can’t do that, then go get any number of books on basic stretching from the library or from a book store. You really just need a simple book on the subject, and you don’t need to do too many.

I think if you did about 5-6 big stretching exercises a night before sleeping you’d feel very relaxed and see a major improvement in your general health and feeling.

Relaxing your body through stretching relaxes your mind as well, so a great way to improve your creativity and boost your ideas is to do yoga or stretching for about 30 minutes, then take your morning shower. Combine this with some meditation and you’ll start to see a major improvement in your general ability to mentally adapt and start to see yourself make odd connections you wouldn’t have before.

I’m not sure why this is, but a relaxed mind is crucial to spontaneous creativity and idea generation.

A Simple First Step

This is probably a lot of information for one person, and I seriously hope that you don’t have all of these problems. What I recommend though if you don’t have these issues is that you try to avoid them. If you’re just starting out then you need to maybe adopt a simple "coding warm-up" routine you can go through before you code.

Here’s what I do before I sit down to code, or before I play guitar, and whenever I get stiff and need a break:

  1. Rotate all the joints in your body by just moving your wrists, arms, neck, back, and hips in a few little circles. Say 5 one direction, then 5 in another direction.
  2. Do a small number of the wrist exercises and shake your wrists between each set.
  3. Stretch your arms above your head as high as you can, and then stretch them back as far as you can, and then pull them across the front of your body.
  4. Finally, carefully use your hand to pull your head to the right, left, forward, and back a bit.

If you just did this you would avoid quite a few programming injuries. Since programming isn’t really that physically taxing it’s fairly easy to avoid hurting yourself, so this is really all you need.

However, if you have a specific problem, then again consult a physician and try some of my advice if they say it’s alright. Nothing I’m proposing here is radical or weird, just basic exercises and common sense, so it should be alright with any doctor. I just don’t want to get sued so remember I told you to ask one first.

Hopefully that helps you out, and if not just remember the advice in case you run into these. If you’re lucky they won’t be a problem but I think every programmer I know has had something like this at least once.

Hello world!

Posted: July 26, 2010 in General

Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!