Don’t debug like Google!

June 8th, 2007

Everybody loves Google because they do a great job at everything, but there are two things I noticed on YouTube.com that my fellow flash developers should avoid in their Flash applications.

While watching a video I noticed debug statements appearing in my FlashTracer window. Although it is pretty common to see similar debug statements on websites that have flash content, it should not be common and it is very easy to remove these statements for production content.

99% of these statements were typical, but there were a couple that, although funny, could be embarrassing. Look at the two lines of text I highlighted in the left column of this screenshot:

YouTube.com screen capture

Although it is hilarious to see these statements in code from a reputable company, there are a couple reasons why they should not be there.

I avoid writing this kind of stuff in my code because most developers know another developer who has been burned by writing these type of statements and they never learn. Google can get away with this because nobody is really going to be offended and they’re their own client. But, when I’m working for a client I follow these two rules:

  1. Never put anything in your code that you don’t want your client or boss to see.
  2. When you do comment your code, be professional enough to omit them when you compile for production!

When you compile/publish in Flash, remember to select “Omit Trace Actions” in the publish settings to prevent your trace statements from appearing in the compiled swf. Sometimes, I might leave in a few traces so I know the version of the app that the client uploaded or other info that might be helpful for debugging problems.

Here are some other funny examples of code I have seen in other applications that should be omitted for production…

  • The connection just got tea bagged – reset and reload
  • Fuck bandwidth detection script its taking too long or not working so fuck it hard
  • This feature does not work and crashes the player fix laterz
  • HACK HACK HACK HACK HACK this scuks

The best part about the google debug statements, is that you can see them for yourself by installing the FlashTracer add-on for Firefox and the Debug Flash Player, then browse over to YouTube.com and watch a video. And, although I named this post after Google, you could also look at another example of what not to do in this article. It’s about a bunch of unprofessional comments from some Microsoft Win2K source code.

UPDATE: Google promptly removed these statements after about 130 hits to this page from google.com (not referrers, but actual native traffic from the company domain).


Two Bites of a $32 Rib-eye Steak

January 5th, 2007

Nothing beats a great steak, nothing. Well, maybe a Burger King breakfast sandwich with eggs and bacon on a buttered croissant served with little hash browns that make ketchup pumps act like diet coke on a mentos binge.

There was no Burger King nearby, and it was dinner time anyway… so I went with the (waitress recommend) 18oz steak. Now, I have eaten in the same restaurant with the same waitress for the past two evenings, so she was recommending this steak because she had raport, not because it was $32 (or at least not ONLY because it was $32). There are of course more expensive steaks out there, but $32 should definitely buy a good steak.

I started with a goat cheese and roasted red pepper salad, which was fabulous. My steak came, and I paired it with Sterling Vinter’s 2004 Shiraz. Now, a rib-eye is not the most lean steak but it is extremely tasty. I had it prepared medium-well because I like it a little pink on the inside and dark on the outside.

I first tried the wine and it was great. It smelled of cranberries and was dry as this Blog post. The steak… it wasn’t great, it was unbelievable! I have had steaks in the $50-60 range before and they were excellent, but this steak was the best yet. I had two bites and my appetite was ruined. Honestly, but it wasn’t the steak… it was the conversation, and I was eating alone.

Now, I don’t usually listen to other’s conversations, but when you’re alone, male and [insert Lilith fair performer] is playing on the radio, you can’t help listening to the loud and obnoxious voice coming from the table beside you. All I wanted to do with my mouth was put it around this steak, but the loud mouth beside me wanted to tell her girlfriend all about the time she cut her finger off. I don’t know if this woman was a doctor, but the graphic detailed regurgitated in her story could have earned a pass on the board exam.

I don’t know why people have to talk about personal dismemberment during a meal, but it is one of those topics that should be completely off limits… especially when you and your neighbors are eating red meat. You’d think after 5 dirty looks in 5 minutes she would stop talking about her missing finger, and if I wasn’t such a wimp, I would have given her one of mine.

Occasionally Connected Wide Area Gaming

January 4th, 2007

I don’t know what to call this type of gaming, but imagine playing a game (casually) over a few hours, days or even weeks as you go about your daily business. I suggest the name “Occasionally Connected Wide Area Gaming” which could be short formed as ACUA Gaming (“Aqua Gaming”).I came up with this idea after discovering Dinner Murder Mysteries. If you’re not familiar with Dinner Murder Mysteries, kits to host these events can be purchased where you buy board games. If you’re familiar with the game (or Movie) Clue, then this is where the idea comes from. People attend your event Role Playing as a Character; they have a script which tells them how to act, what to do and when. Each person has a different script which directs the outcomes of the evening. After a sequence of events, a murder will take place out of room and shortly after be discovered by someone. It is the job of everyone to figure out who committed the murder. Was it the person who discovered the body, the maid, the person who left to use the bathroom?

These events can be extremely fun for most people involved, except for a couple people, especially the person who gets murdered. Some people will know ahead of time the outcome and how it happened. In this age of digital communication there is no reason why we should snail mail invitations and instructions. What if a computer could send out all of the instructions in real time as they should be carried out. Ideally these instructions would be sent by text message (or email/blackberry) to each person’s mobile device. That way, no one would know ahead of time what was going to happen next and the instructions could be extremely up to date, referencing current issues or even using the current date and time to instruct participants.

The software itself would not be particularly immersive, like many of today’s popular games, but the overall experience could be extremely immersive. To setup this type of game there would need to be a web based console where it could be managed. The host would enter all of the mobile device contact info for each person, the date and time the event will start and other event information (will there be drinking or dinner). The server will take over from there, sending invitations to all users listing any props or costume pieces the participant will need for the event (fake gun, Swiss Army Knife, flashlight, money…etc).

At the start time of the event, users will start to receive instructions on their mobile devices: “Tell everyone you must go outside for a cigarette, ask Dr. Woz to join you. Stay outside and wait for further instructions” Dr. Woz will also receive a message telling him to go (or not) with you. A few minutes later they could receive a message telling them to drive to the local convenience store and wait for instructions. Then a message instructing them to phone Mr. Smith and tell him their car has broken down, and requesting he come pick them up. While this is happening a murder could take place back at the house. When the three other people return home they could be considered suspects, although they could claim they weren’t even at the house. Because the instructions are delivered in real time, the server could assemble the event as it goes, inserting or removing instructions to lengthen or shorten the event.

This would not be limited to murder mystery events either. All kinds of real time events could be developed such as scavenger hunts, checkpoint missions…etc. These events would be great for corporate events, dinner groups and fund raisers. The downside is that someone would have to program, test and host the software to run these events. It could also be expensive for some participants who don’t have text messaging plans on their cell phone. The possibilities are endless, and unlike other computer games it gets us out of our desk chair. Also, there could be games that intertwine with you daily life. As messages are received throughout the day or week, you could respond to them or follow their instructions. Today we play computer games; someday, computer games will play us.

Bulleted List

January 3rd, 2007
  • This is a
  • REAL
  • bulleted list

When I was creating the styles for this blog and I got to the bullet style, I decided the bullets had to really look like bullets, not pellets. I think more bulleted lists should have real bullets as their symbols!

Flex 2 Shortcuts

December 11th, 2006

Interest in Adobe Flex has really heated up with the release of Flex 2, and because so many people are starting to use Flex there is huge demand for training courses. I am certified by Adobe to teach Flex (among other technologies) and during my Flex courses I demonstrate a lot of useful short-cuts. I am constantly asked for a site that lists these; therefore, I have compiled a short list of the Flex Builder short-cuts I use every day:

(ordered by usefulness)

  • Ctrl+Space … Content assist (aka Code Hinting) – Shows you most of the available tags or properties appropriate for your cursor position
  • Shift+Enter … Adds a new line below the current line (extremely useful in mxml as you enter tag properties, this means you don’t have to hit the arrow key to move outside the quotation marks
  • Crtl+Enter … Adds a new line above the current line
  • Ctrl+D … Delete the current line
  • Alt+Down … Moves the current line down (passing through any lines below it).
  • Ctrl+L … Go to line number (popup window).
  • Ctrl+Shift+C … Adds a comment around the currently selected text (MXML and ActionScript).
  • Ctrl+Alt+Up … Duplicates current line.
  • Ctrl+Click … Allows you to click on a class in AS or MXML and open that class file.

Indenting: Since we all use good coding form and properly indent all child tags it is important to know some tricks to this. Most code editors support multi-line code indenting, which means you can highlight multiple lines and press the Tab key to indent all of those lines. Try that in a word processor and it will delete the text, but most code editors (Flash, Se|py ActionScript Editor and Flex Builder/Eclipse) support this. Also, you can reduce the indent across multiple lines by pressing Shift+Tab.

There are also some workflow tricks I find very useful. First, I always use “Build Automatically” available in the “Project” dropdown menu (unless the project is extremely large, and you’ll know when it’s too large for this). With this enabled, Flex Builder will automatically generate the SWF and HTML file for viewing. Watch the bottom right corner of Flex Builder in the status bar for the building status; when “Building Workspace” disappears, you can simply hit F5 (refresh/reload) in your browser to see any changes you made to your Flex project. If you try to refresh or reload before the workspace has been built you will get an empty SWF file.

This isn’t a Flex Builder shortcut, but when you have the Flex Data Services server console open, you can use Ctrl+C to “Close” (shutdown) the server.

This list is by no means complete, but simply a list of my favorite shortcuts. This list will continue to grow as other shortcuts creep into my daily finger dance. To see a complete list of shortcut keys, press Ctrl+Shift+L in Flex Builder.

Chad

Getting Out of Contracts

October 16th, 2006

Whether you’re looking for a new cellphone, automobile or cable service you’re going to be offered a contract. Of course, this is the service providers way of keeping you around to recover any costs associated with aquiring you as their customer (advertising, discounts, “free” things).

So what do you do if you have to get out of one of these? A lot of sites have been popping up to help you pass your contract on to someone else who is looking for a contract like yours. Why would anyone do that? First, you probably did so ask yourself. Second, someone might want to take over your contract because…

It is often cheaper to take on an existing contract than to get a new one of your own.

If you want to get rid of your cellphone contract check out this site and this article. Most notably from that article, check out your terms of service when/if your provider changes them. Usually, you have the ability to terminate the contract at such a time. For getting out of your car lease, check out this site.

My advice, never sign a contract longer than 1 year… unless you’ve already been with that company for a number of years and know what to expect. In some cases, you can’t avoid a contract. When I signed up for Bell Sympatico (DSL) last year, they would only sign me up for a one year contract. Sometimes I wonder if it is the agent who makes up the rules, or if it is an actual policy. You should know that agents generally get a larger commision by selling you a longer contract.

Chad