Uninitialized variables in Adobe Flex "for" loops

for(var j:int; j < editAreas.length; j++) trace("doing something");

What's wrong with this ActionScript code? This was a block of code that I fixed while tracking down a nasty bug. c# would have never let me do this.


Basically, the "j" variable starts out at 0 in the method. That's fine, because it's what I would normally expect. The problem is that I have it declared inside another loop, so this loop initializer is run multiple times. The second time around, "j" maintains it's value. It could start at 5 next time. The loop still partially works, if the length of the arrays get longer each time. It's a bit odd that the "j" variable is never created more than once. I'm guessing it's a compiler optimization.

This loop was used in a drawing routine for images. If you had an image in the first drawing area, the first image in the consecutive drawing areas would never be drawn.

It should be obvious, but please don't forget to initialize your "for" loop variables.

Like this post? Please share it!

See a mistake? Edit this post!

How many hours per week should you work?

I'm sure most of you have worked at a service job at one point in your life. That includes restaurants such as McDonald's or Burger King. I'm sure you knew exactly how many hours you were expected to work. A schedule was made, and you knew your scheduled hours each day.

Fast forward to today. You're now working at a job where the customer is not longer looking for immediate help. If you have a career in software development like myself, you probably have days, weeks, or months to finish a project. If it weren't for the other employees that you need to collaborate with, you could conceivably be hiding in a cave in Klackiastan.

If you need to estimate the amount of time your project will complete, you need to know the amount of work that you can effectively expect to finish in a given week. As a point of reference, it's probably a good idea to use 40 hours as a baseline. Keep in mind that you'll later have to figure in vacation and sick time.

So now you've calculated on your release date based on 40 hours, everyone agrees, and you start your magic. Some tasks take longer than expected, a couple take slightly less time, but overall, you did a good job predicting. You optimize your time as much as you possibly can. You skip the unimportant meetings, you keep the necessary meetings short. Everyone stays focused and in the zone. Your expected release date comes around, and because of your dedication and excellent use of your time, and by some miracle, it releases on time! No small feat in the world of software. In the company that I used to work for, I never heard of a project actually being completed by it's due date. In fact, some companies refuse to give release dates, because they know it could be a big let down for customers.

On the day of your release, you order pizza to celebrate. Everyone is on top the world. You turned an idea into reality, which is no small feat. Anyone who has been through this will certainly understand what I'm talking about.

If you work for a software company, you'll probably have a boss that can gauge your dedication and skills. The truly great managers can and will ignore the hours you worked. Your boss might see Bob working 20 hours, and Sam working 50 hours. A good manager will know if Bob is getting 3 times as much done, and recognize that Bob is the more valuable employee, regardless of his hours.


But what if you don't work at a software company? Or more specifically, your boss has no idea how good of a job you're actually doing? Your boss is going to start looking for a metric to put a number on your performance.

  • Lines of code? Yuck! Everyone should know by now this is a horrible metric, and probably opposite of reality.
  • Least number of bugs entered? This doesn't make sense, this will end up being proportional to the amount of actual productivity.
  • Number of hours worked?

Do you think the last one could really happen? Well it did to me. Someone in the company ran a report, and a red flag was raised because I didn't work the arbitrary number of hours that was secretly expected of me. I averaged 41.6 hours in the office, but was expected to work 43. The average expected workweek for an industrialized nation, is 32-40 hours. When France standardized on the 35 hour work week, studies showed that their productivity stayed the same I've read countless articles saying that employees that worked more, usually got less done. I was putting in overtime! However, after all my hard work, my world came crashing down. For the first time in my professional life, I was viewed as a dispassionate, lazy employee.

The solution my boss came up with? Put in more time. I had prided myself on my time management skills, and this was the result?

It turns out I was being compared to employees that had completely different jobs than me. Of course I look bad. Joe the janitor works 60 hours per week! He's much more valuable! That fact that I managed to build a complete e-commerce site in 4 months no longer means anything. He even explained that they didn't know how else to gauge performance.

So do you think if I worked an extra hour and a half per week, things would be all fine and dandy? Maybe in the short term, but I think it's indicative of a larger problem. Visibility.

I'm my next article, I'm going to talk about what you need to do to make sure that your work get's recognized.

Like this post? Please share it!

See a mistake? Edit this post!

Should you host your own blog, or use a blog host?

Every great developer feels the urge to write a blog at one point or another in their life. Personal blogs let you share photos with family members, and easily announce what is going on in your life. Technical blogs serve many purposes:

  • Practicing your writing and communication skills
  • Help out the development community. We've all been stuck, and we've all been thankful of the person that ran into the same problem, solved it, and posted the answer in detail on their blog.
  • Keeping a journal of the problems we've run into in the past. Developers have a tendency to experience the same problems again, but often forget the answer (at least I do!).

YTechie Blog Screen Capture

Once you decide to write a blog, you have a number of options:

  1. Write your own - If you have enough time to write a full featured blog platform, I envy you. I've seen people do this, and they probably had fun. The reality is that blog software is to the point where it is fairly mature. Your own software may pale in comparison, unless you absolutely only need a couple of features.
  2. Use an existing package. Personally, I'm a Windows/Microsoft/.NET guy by trade. If you're in the same boat, some of the common solutions are Community Server, and Subtext. Community Server was too slow and complicated the last time I tried it. It's just plain overkill for most users. Subtext is great, but I'm not sure how much work has gone into it lately. I have a big wish list of features for Subtext.
  3. Use a professional blogging service. That includes,, or I'm sure there are others, but they're the big ones. Professionals tend to shy away from services like these.

In the past, I have tried the first 2 options. I've been there and done that, and I'm just tired of spending hours configuring a blog, setting up hosting, setting up DNS, etc.

Most experts recommend against using one of the blogging services. When you use those services, by default, the address is part of their domain. For example, I agree that this isn't ideal. Blogger does offer FTP publishing, but I've heard that it's fairly limited, and not very popular.

The alternative that I'm experimenting with on this blog, is using a CNAME record, so that I can use my domain, but still use the blogger or wordpress service. If you configure your blog this way, YOU control the name, but use a special DNS entry to point it at their server. The result is that you can have a friendly URL such as If you don't feel like using a subdomain, you can actually set up your CNAME records so that and are addresses for your blog. You don't even need a hosting provider, but you DO need a DNS provider. This is exactly how this site has been configured.

Here are the DNS settings for the domain. Simple huh?


How does this affect SEO (search engine optimization)? Good question! There isn't a lot of clear data right now. CNAME records are at the DNS level, so many speculate that Google goes strictly off of the name. As time goes on, we'll be able to see how Google indexes the pages on this blog.

In a follow-up post, I'll be discussing some of the key differences between and I'll also show you how to configure each of them to use a CNAME record.

Like this post? Please share it!

See a mistake? Edit this post!

Jason Young I'm Jason Young, software engineer. This blog contains my opinions, of which my employer - Microsoft - may not share.

@ytechieGitHubLinkedInStack OverflowPersonal VLOG