June 9, 2009

New version of PixelWindow

PixelWindow (was PixelPerfect) was one of the first AIR applications I wrote, and has turned out to be one of the most useful. I wrote it primarily as a test case for multi-window, custom chrome, transparent, pure ActionScript AIR applications, and I've been using it almost daily ever since.

If you're unfamiliar with PixelWindow, it's a simple, light-weight AIR application for measuring things on your screen. It creates a translucent window that acts like a pixel ruler with its width and height reported in the center. Just drag it around and resize it to measure whatever you want.

I finally got around to updating PixelWindow, and creating its own site and installer badge. I also added a few new features:

  • You can now measure down to 15x15 pixels. When the ruler gets too small to display the dimensions, they jump outside the window.
  • The ability copy dimensions to your clipboard.
  • The ability to use your keyboard to move rulers by one or five pixels at a time.
  • A help window to remind you of the keyboard shortcuts.

If you use an old version of PixelWindow (probably installed as PixelPerfect), I recommend that you grab the new version. And if you don't use it, it's an extremely useful app for any designer or developer to have around. And remember that PixelWindow is open source, so feel free to grab the code to fix bugs, add features, or just to see how it works.

Posted by cantrell at 9:53 AM. Link | Comments (2)

June 1, 2009

ActionScript function for turning a date into a time interval

While working on a small Twitter utility, I wrote a function to turn a date into a time interval string. For instance, rather than formatting the date, it returns strings like "Just posted," "6 minutes ago," "4 hours ago," or "20 days ago". It's not a complex function, but I thought I'd post it here in case it might save someone a few minutes of coding. The less time we spend writing code someone else has already written, the more time we can spend innovating.

private function formatDate(d:Date):String
{
	var now:Date = new Date();
	var diff:Number = (now.time - d.time) / 1000; // convert to seconds
	if (diff < 60) // just posted
	{
		return "Just posted";
	}
	else if (diff < 3600) // n minutes ago
	{
		return (Math.round(diff / 60) + " minutes ago");
	}
	else if (diff < 86400) // n hours ago
	{
		return (Math.round(diff / 3600) + " hours ago");
	}
	else // n days ago
	{
		return (Math.round(diff / 86400) + " days ago");
	}
}

Posted by cantrell at 10:42 AM. Link | Comments (0)

May 1, 2009

Adobe Feeds Data Problem

I just wanted to let everyone know that we had a little problem the other day with Adobe Feeds and ended up losing some data. Most of the post data has been recovered, but we lost some site submissions. If you submitted your blog after 2/12/09, it's likely that it was lost and you will need to resubmit it. Sorry for the goof up.

On a related note, how many of you out there are still using Adobe Feeds? I talked to a few people recently who just use the RSS that Adobe Feeds generates rather than using the site itself. How are people getting their Adobe developer news these days, and/or technology news in general?

Posted by cantrell at 7:42 AM. Link | Comments (4)

March 5, 2009

Make the mouse wheel work in Flash on OS X

As I'm sure all you Mac users are painfully aware, the mouse wheel doesn't work in Flash on Macs. Imagine my surprise, therefore, when testing out a new Flex-based bug tracking system, and finding that I was able to use my Mighty Mouse to scroll a List. The source of the page revealed a clue which eventually led to AS3.0 MouseWheel on Mac OS X. Seems to work pretty well, and should hold us over until we get this in the player.

(Note that the mouse wheel works as expected in AIR applications; this is for browser-based apps only.)

Posted by cantrell at 12:04 PM. Link | Comments (5) | TrackBack (0)

January 30, 2009

ShareFire: a new feed reader for Adobe AIR

Over the summer, I built a feed reader called Apprise with my intern, Dan Koestler. Dan is now working with me full-time, and the first thing he did when he started at Adobe was update the application and release a new version. The following changes were made for 1.5:

  • Renamed the application to ShareFire. It's all about sharing news, after all.
  • Enabled shorter update intervals. You can now updated as frequently as every 15 minutes.
  • On OS X, the number of unread posts now appears in the dock icon.

In case you're new to ShareFire, here are some other interesting features:

  • Share articles via Twitter, AIM, email, Facebook, Delicious, Digg, Newsvine, and more right from the application.
  • Automatic categorization by author and topic.
  • Create "smart topics" to easily find posts on topics you're interested in.
  • Get "toast" notifications of new posts.
  • OPML import and export.
  • Realtime search.
  • "Site view" (switch between the summary, and the site itself).
  • Automatic feed resolution. Rather than entering a feed URL, you can now enter a site URL, and Apprise will automatically find and aggregate the feed associated with it.
  • Support for 16 languages.
  • Lots lots lots more.

If you already have Apprise installed, you will get the update automatically (if you want to update manually, go to Settings > Application Updates > Check Now). If you don't have it installed, check it out here.

Let us know what you think!

Posted by cantrell at 9:44 AM. Link | Comments (8)

January 12, 2009

Geolocation API Research

I'm starting to do some research into geolocation APIs. Right now, I'm planning on checking out the Google Gears and Google Chrome APIs, the new Firefox 3.1 APIs, Skyhook's technology, and IP geolocation technology like that used by ip2location. Anything else you think I should be looking into? How valuable do you think geolocation APIs on the desktop are? Will all computers (or at least all laptops which are gradually becoming all computers) have GPS chips soon? Other than GPS, IP addresses, Wi-Fi access points, and cell tower triangulation, how else can people be located?

Any and all feedback is greatly appreciated.

Posted by cantrell at 10:28 AM. Link | Comments (8)

November 11, 2008

Revisiting Linux

It's been a long time since I've used Linux on a daily basis. Back in those days, my development tools were vim, make, and CVS. I ran an early free version of Red Hat with the best windowing manager there was at the time: FVWM. My browser was Netscape, my multi-protocol IM client was the text-based CenterICQ, and my mail client was Pine running inside of Screen. (My cell phone was a big plastic Nextel clamshell which the IT guys called the construction worker phone.)

But like many Linux users at the time, I was trying to exist in a Windows world. I used VMWare for testing web sites on IE, and various command line tools for converting Word documents that people insisted on emailing me into watered-down PDFs. So when OS X came out, I rejoiced and immediately jumped ship (before it even supported CD burning), and I've never looked back.

But when builds of AIR for Linux started appearing, I decided it was time to revisit Linux (specifically Ubuntu) to see what had changed. I made the mistake of installing it under VMWare on my MacBook initially which didn't impress me all that much since it wasn't able to access the graphics card directly, so yesterday I decided to set aside some time and install Ubuntu natively on my Mac.

From the time I got it in my head to give it a try to the time I was running AIR apps was probably about an hour. That included downloading Ubuntu 8.10, burning the ISO, using Boot Camp to make my Mac think I wanted to install Windows, and more or less following these instructions for installing Ubuntu on a new partition. Although I used an internal build of AIR for Linux, a public beta build is available here.

The experience of running Ubuntu natively really blew me away. The windowing effects are beautiful, and after using the OS for a few hours, I began to realize that Ubuntu even does a few things better than OS X. All my AIR apps ran beautifully (here's a screenshot of three of them running), and I began to realize that with Flex Builder for Linux, AIR for Linux, a few strategic AIR apps (Apprise Reader, TweetDeck, etc), Firefox, and with the amount of data that's moving to "the cloud," I could very easily start using Linux again day-to-day. I did encounter a few incompatibilities running Ubuntu on Mac hardware, but if I could get my hands on a decent ThinkPad, I think I just might be able to make the switch. Of course, I'll have to keep my Mac around for synching my iPhone since I did finally give up that Nextel i1000.

Posted by cantrell at 12:25 PM. Link | Comments (10)

September 17, 2008

Be careful how you call super()

Here's something all ActionScript 3 developers should know about extending classes and how parent constructors are called:

If class B extends class A, does class B have to call super() in its constructor in order to instantiate the parent class? Nope. What happens if you don't? The compiler inserts a call to the constructor for you. Usually.

The compiler just looks to see if you call super() at any point in your constructor. What if that call is inside of a conditional statement that evaluates to false? The default constructor won't get inserted, and the parent classes's constructor won't get called. Why is that a problem? You may very well get null reference exceptions since class level variables are often initialized in constructors. What's worse, you may only get them sometimes — only when your conditional statement evaluates to false.

Even if you determine that your code works whether super() is called or not, you still have to watch out. What if the implementation of the parent classes changes in the future? Code that used to work, and code that you could reasonably expect to continue working, may just break on you. I've actually seen this happen. It's not pretty.

How do you avoid this problem? Either call super(), or don't. Never put super() in a statement that may not execute, even if you find that your code works fine today since you never know what might happen to that parent class tomorrow.

Posted by cantrell at 10:41 AM. Link | Comments (6)

September 2, 2008

Apprise 1.1: More sharing, more features, and more languages

We just released Apprise 1.1 with several new features:

  • In addition to AIM and Twitter, now you can share posts via email, as well.
  • Post links directly to Facebook, Delicious, Digg, Newsvine, MySpace, Google Bookmarks, and Windows Live Bookmarks.
  • Smart topics. Only posts containing specific keywords will show up in your smart topics.
  • Configurable notifications.
  • Support for 16 languages: English, German, Spanish, French, Italian, Japanese, Korean, Portuguese, Russian, Swedish, Dutch, Czech, Turkish, Polish, and both Traditional and Simplified Chinese. Apprise will use the language of your OS, or you can change languages dynamically from the settings window.
  • Improved aggregation. We now show you post content, if it's available, rather than just a post summary.

We've also added some smaller features and polish, and fixed several bugs. If you're already running Apprise, it will auto-update. Otherwise, go check it out.

Posted by cantrell at 9:14 AM. Link | Comments (5)

August 6, 2008

How do you want to share with Apprise 1.1?

We're working Apprise 1.1, and we'd like some feedback. Apprise 1.0 allows you to share articles via AIM and Twitter, and for 1.1 (not out yet), we're adding the ability to share via email, as well. We're also adding Facebook, del.icio.us, Google Bookmarks, and Windows Live Favorites. What other services would you like to see us support? MySpace? Newsvine? Mixx? Let us know what you're using, and we'll do our best to get it in.

Posted by cantrell at 8:40 AM. Link | Comments (14)