Flex Character Counting Tool

If you need to quickly count characters in text then this little flex application might be useful. It uses Courier font for fixed width display, so you will need this font on your computer to use this tool. Type or paste text into the area below and see the number of characters in your text.

Note: In case you’re not familiar with this concept, there are hidden characters for line-breaks. If you wish to count these characters, you can include these characters with the checkbox at the bottom. You can also enable word wrap.

[kml_flashembed movie="http://www.chadupton.com/blog/wp-content/uploads/2009/03/charcounter.swf" height="500" width="480" /]

Flex Calendar Component

This calendar component is great. It’s still has some bugs in it, but it’s my favorite Flex calendar component out there.

It was originally developed by Ely Greenfield and some bug fixes and enhancements were made by Jove Shi. This post exists because Jove’s site is offline and I’m sure people would like to benefit from his hard work, so I am hosting what I believe to be Jove’s latest source (download below). If Ely or Jove have a problem with me hosting it, please let me know and I’ll take it down.

Ely’s post about it

Ely’s Example Page:

Jove’s enhancements and bug fixes:
Download (.zip) 823KB

65w vs 90w Laptop Power Supply Benchmark

I got a Dell Latitude D830 notebook a few weeks ago and it’s great. One thing I noticed, and it’s not a surprise; it doesn’t like the extra power adapter that I bought 6 years ago (3 Dell laptops ago).

The last generation of Dell power supplies are 65 watts, while the current generation power supplies output 90 watts. When you use a 65w supply on a 90w machine, you get a disappointing Windows alert:

65W AC Power Adapter has been determined. Your system will operate slower and the battery may take more time to charge. Please connect a Dell 90W AC adapter or higher for best system operation.

I wondered just how much impact this would have on system performance, so I got some free benchmark software (CPU Free BenchMark 2). This software clocks the time it takes your CPU to perform a series of registry, floating-point and integer tests. The lower the time, the faster the CPU. I ran these tests a number of times with various power configurations and here are the average results of those tests.

Dell Latitude D830 CPU Mark Chart

As you can see, using your Latitude D830 battery or 90w power supply are virtually the same. Using a previous generation 65w power supply provides only enough power for roughly 20% of maximum performance. It’s fine in a jam, but if you’re a two power supply user then it’s worth your money to get a second 90w power supply. I found one new for $10 (+ $13 shipping) at an eBay retailer.

UPDATE: Jan 12, 2009 – The $13 power supply I bought on eBay died after just 3 months use. It was potentially a counterfeit “OEM” power supply. It was very similar to the power supply that shipped with my computer, including high quality forming, metallic labels and high gauge cabling (atypical for counterfeits)… the only major difference was the weight. I’ve ordered another for $35, from another retailer who guarantees it is authentic. I’ll keep you posted.

UPDATE: Mar 11, 2009 – Some people have asked for some perspective on the 119 second time that I scored while using the 65 watt power supply. The slowest computer I was easily able to test for comparison is a Pentium 4 machine and it scored 38.85 seconds.

So, because the Core 2 Duo (2.5GHz/4GB RAM/Vista) took 24.83 seconds and the 4 year old Pentium 4 (3.4GHz/2GB RAM/WinXP) took 38.85 seconds, then 119 seconds is dreadfully slow. By my estimate, using a 65 watt power supply is like putting an 8 year old CPU in your machine. If somebody has a Pentium 3 up and running, it would be nice to find out the CPU Free Benchmark 2.2 score for that to know for sure.

Essential Flex 3 Links

As a Flex 3 developer, there are a number of links I think you should have. Some of these are tools that help me perform tasks faster and better, others are for quick reference and news.

Component Explorer
Style Explorer (CSS generator)
Color Picker

XML Buddy (XML color coding, validation…etc)
Subclipse (Subversion source control support for eclipse)
Perforce (Source control)
FlashTracer (FireFox Plugin)

Language Reference (Live Docs)
Runtime Error Codes
Compiler Error Codes

News and Community
RIA News Aggregate
Flex Developer Center
Flex Coders (Yahoo Group)

Alistair McLeod
Christophe Coenraets
Ely Greenfield
RIApedia (Mike Potter)
Everything Flex (Rich Tretola)

Maximum Concurrent HTTP Requests from Adobe AIR

The limit is 450.

Why did you test this and who cares?
I care. I was working on an application that has (potentially) hundreds of concurrent data requests and I needed to know if that was going to be a problem.

I built a Flex 3 application that had 1 HTTPService object and I called the send() method 1000 times using a for loop. I had a script that tracked the number of iterations, which reached 1000 instantly. I had a script that counted the number of responses received by the result handler. It got to 450.

My first test made requests from localhost (apache) and the responses totaled 450 within about a second. My second test made requests from another apache server about 50 miles away in a large data center; they totaled 450 within about 3 seconds. For my third test I sent 1000 requests and after about 250 were received I sent another 1000 requests. From 2000 requests, about 700 were received.

I concluded from this that there can be a total of 450 concurrent http requests pending at any given time. I tried more tests with multiple HTTPService objects and called them each 500 times. Still, the total number of received was 450. So it seems the limit is part of AIR itself and not the HTTPService object.

That made sense because when a Flex application is deployed in a browser, you’re limited by the browser’s maximum number of http connections. Typically, that number is between 2 and 50 – many modern browsers will let you adjust this number.

To adjust this number in FireFox: type “about:config” in the address bar and hit enter. Then, type “connections” in the filter box. You’ll see a number of connection settings that you can adjust. The faster your connection, the more simultaneous requests you can allow and still maintain a comfortable browsing experience.

450 connections is a lot and in most cases, far more than you need. I’m glad the AIR limit is very high; because this is one of the few ways to get information in and out of AIR. With some hard work, this is a viable way to communicate with other localhost software that may provide connections to USB or other devices – one of the current limitations of AIR.

– Chad Upton

Bullseye: Target Paints Logo on Their Roof That is 250 Feet in Diameter

I’m staying at this hotel near Chicago O’hare airport and I go on google maps to scroll around to see what is in the area. I see this giant bullseye on the roof of a building. I stop for a moment, not knowing what it is for… then I realize it is a target logo. Brilliant. Now I know there is a Target store nearby (whether I wanted to or not).

This serves two purposes:

  1. Online map users can see the store quickly and easily in satellite view
  2. Airplane passengers see the branding and store location as they’re landing

This is brilliant — a great way to capitalize on satellite imaging for branding.

Target Roof from Google Maps

See for yourself on google maps:
Example 1 - Chicago IL
Example 2 - Everett MA (thanks Colonel Kernel)

Some of the iPod and iPhone ideas were mine!

So, if you have ideas for apple products you’re welcome to submit those ideas. But, if you want them to look at your ideas without putting them in the garbage then you have to agree that all of your ideas become Apple’s ideas.

I want the products that I use to be great, so I’m always ready to provide feedback and suggestions for free, so I agreed that my ideas would belong to apple.

Idea #1 was implemented in the iPod firmware EXACTLY as I proposed it, and if you had a 5G iPod you know that it didn’t do this originally and was added later through a software update. I don’t want money and I don’t need any credit, but it would be nice… especially in the form of a 3G iPhone when available (you can have my non-3G iPhone back).

I should note that looking back, some of these ideas are terrible… but apparently 3 of them were good enough. Here’s the document that I sent Apple:


Dear Apple

I have read the unsolicited ideas verbiage and I agree all my ideas become property of Apple.

I appreciate apple products for their intuitive design and usability, but here are some short comings.

1. Backlighting should be adjustable, just like on my laptop. When I am in a dark room and I don’t want to blow out my eyes, or when I want to compromise brightness to save battery power I can dim the screen. My iPod should do the same, that will give me more power to watch movies during travel. I propose if the center button is clicked again after the shuttle/scrub state then the wheel will be in backlight dimming state.

2. The back of the ipod should have a belt clip/stand that can be deployed in a way that it will sit upright on an airplane seatback table to watch movies without having to hold it. This could be an accessory but it would be nice if it was built in or at least included.

3. iTunes should allow me to flag content and re-organize which folder it will appear in on my iPod.

4. While listening to music, there should be a built in trippy video or real time rendered visualization I can watch or use to show off how great the screen is on the iPod.

5. The next generation iPod should have a 16:9 screen ratio. When I hold it vertically, the screen is much taller than wide for easy grip and click wheel usage, but when I want to watch a movie I can turn it sideways and it will flip the screen. My Nikon digital camera has a mercury switch it in to sense which way I’m holding it, the next iPod should do the same to take advantage of a wide screen and still offer the comfort of the current generation while browsing music.

6. It would also be amazing if the next generation could be the same size as my 5G except with the entire front a wide screen / touch panel. Click wheel goes touch wheel… sweet. That could open the doors for a lot of other applications, like a full QWERTY onscreen keyboard for typing emails and text messages on the go. Even if it just acted as a Bluetooth keyboard for my cell phone.

7. A built-in camera to capture video and snapshots would be awesome. This could be an accessory.

8. Support for flash lite, (adobe/macromedia’s) flash’s mobile display engine would guarantee a bunch of really cool applications could be built for the iPod. The most obvious would be skinning the UI. Even proprietary apple UIs that could be bought at the iTunes store. People pay for cell phone ring tones to customize their phone, they’ll do the same to customize/personalize their ipod interface.

8. The next generation nano should be the same size as a PCMCIA card and fit into that slot for charging/docking/protection/transportation/removable storage.
Thinking Different…

– Chad Upton

Guided Setup, Using Perforce with Flex Builder

Perforce software makes a plug-in for Eclipse that makes life a lot easier when using the two together. This setup guide is directed specifically at using Perforce with Flex Builder 3.

As we know, Flex Builder 3 (FB3) is based on Eclipse 3.3.1. Since Flex Builder 2 is based on Eclipse 3.1.2, it probably won’t work – the release notes for the plug-in suggest is works on 3.2 and 3.3 only. I have not tested it, but if you were to upgrade Eclipse and use the Flex Builder plug-in then you should be OK.


  1. Open Flex Builder 3.
  2. Choose the following menu command: HELP > Software Updates > Find and Install.
  3. Select “Search for new features to install” and click Next >.
  4. Click “New Remote Site”.
  5. In the dialogue box, enter the Name “Perforce Plugin”.
  6. In the dialogue box, enter the URL: http://www.perforce.com/downloads/http/p4-wsad/install/
  7. Click OK.
  8. Click Finish.
  9. You will be prompted to “Select the features to install”.
  10. Be sure to check, “Show the latest version of a feature only” (at the bottom of the window)
  11. Fully expand the “Perforce Plugin” tree.
  12. Choose the last item in the tree that begins, “P4WSAD”.
  13. Click Next.
  14. Accept the terms in the license agreement to continue.
  15. Click Next.
  16. Click Finish.
  17. The feature will be downloaded and you may receive a Feature Verification warning
  18. Click “Install” if you receive the Feature Verification warning.
  19. The installation should occur and you need to restart Flex Builder.
  20. When Flex Builder restarts, we’ll tell the plugin where it can find Perforce on our system.
  21. Choose: Window > Preferences.
  22. In the left column, browse to: Team > Perforce.
  23. Under “Location of p4 executable” select “Location” and click “Browse”, then locate and select p4.exe. The default location is C:\Program Files\Perforce\p4.exe.
  24. Click Open.
  25. Click Apply.
  26. Click OK.
  27. Now, locate and open the project that you wish to use with Perforce.
  28. Right click on the project folder and choose: Team > Share Project.
  29. Select Perforce and click Next.
  30. The “Recent” field will probably be blank and that’s fine.
  31. Port will be the IP address and port of your Perforce server. (ex. If you already have P4V or P4Win setup then you can find this in the title bar of the application.
  32. User is going to be your Perforce username, likely given you to by an administrator.
  33. Client Workspace should also be found in the title bar of P4V or P4Win if you’ve got those setup.
  34. Charset can probably be left to the default (none) but may require changing in certain circumstances.
  35. Click Finish.
  36. You will likely be prompted for your Perforce password – the one that goes with the Perforce username you entered.

Assuming everything went smoothly, you should now be able to edit files and Flex Builder will automatically add that file to the default changelist and make the file writable so you don’t get that annoying message.

Some other useful things that this plug-in does. Go to Window > Other Views…
In this dialogue box you can open the Perforce folder and select “P4 Pending Changelists”. This view will show you the files you have opened for editing and allow you to right click on the changelist or individual file for submitting.

Also, you’re probably used to seeing error and warning messages in the Problems view. Now you’ll see info messages when some things are out of sync with the repository. For example, if you add a new file your project but it’s not in the repository then you’ll see an info message warning you. Right click on the file and choose “Open for Add” then Submit the changelist and it will be added.

I hope this makes your life easier and please send me a quick line if you found any errors in my instructions, that will help other people!

Further details on setup are available at the Perforce website: http://www.perforce.com/perforce/doc.073/user/p4wsadnotes.txt

Rotate On Center in Adobe Flex

Sometimes our programs have visual objects that need to be rotated. The default registration point in Flex is the top left corner, but that’s not always ideal. In Flash, we have the freedom to change that registration point — not in Flex.

We have to work around this limitation in Flex and I have seen a few different approaches. There are some blog posts out there that suggest using the Rotate effect, this seems messy to me. If you want to rotate around any point using a MatrixTransformer: Joel Connett has a great post on it here. I quite like that method, but I think I’ve found a more simple solution for center rotation.

Here’s a sample you can play with:

[kml_flashembed movie="http://www.chadupton.com/assets/RotateOnCenter.swf" height="180" width="280" /]

Click Here for Source Code

Try clicking the "show canvas" button, you'll see a white box that surrounds the bottom right quadrant of the spiral circle. It is only that quarter of the circle which is actually in the canvas. I have placed the center of the circle at the top left corner of the canvas. The canvas will (by default) crop content that exceeds it's boundaries; however, there is a property on the canvas called "clipContent". Set that to false and voila.

I know this is really simple solution, but it wasn't obvious to me until recently. Leave a comment to let me know if this helped to you.

This method works with Flex 2 and Flex 3.