Live from Apollo Camp

by Josh Tynjala

So here I am at Adobe‘s office at 601 Townsend in SF. The room is packed. Everyone has a beer, and Kevin Lynch is getting ready to speak. Twitter conversations about Apollo Camp are live and running on the big screens. Renaun and Doug are right next to me. I’m loaded up with more Adobe schwag than I can carry. I’m glad I brought my backpack. Let me tell you, this is the place to be in the Flash and Flex world tonight.

Earlier today, I was showing off the cool instant messenger client that I built with Apollo to fellow early arrivers. Don’t worry, source code and a build you can try out yourself will be available for download not long after the Apollo bits are live on Adobe Labs. I’m excited to share toys from my Apollo playground soon.

Mike Chambers says “one minute”… and we’re starting! There’s a ton of stuff here: Q&A rooms, free coffee and drinks, chill-out rooms. I see big cameras near my seat. I guess they’re recording all the sessions so everyone can see the festivities and learn about Apollo. Everyone from the Apollo, Flex framework, and Flex Builder teams are here, and we gave them a big round of applause. We’ll have a chance to chat with anyone.

Kevin Lynch is beginning the keynote to introduce Apollo, and he’s starting with the required marketing-speak. Adobe software has touched almost every product we see everyday. Flash is all over the place (PCs, mobile, video game consoles, etc). The usual stuff. Now we’re getting to the motivations for Apollo. Kevin has a graphic on-screen that shows how web applications are moving out to the desktop after 2006. Mobile MXML in the move to 2007-2008… What’s that? :) He makes fun of Microsoft in a tiny corner of the visualization.

As we’ve heard before, Apollo runs SWF, HTML, and PDF. The browser is the open source WebKit. It has two basic modes. An Apollo application can run on a SWF with a web browser or PDF inside, or HTML with SWF and PDF. Features include file system access, offline mode, drag-and-drop across applications, clipboard access, apps without windows in the background, multiple windows, and custom window chrome. Let’s have a look at some examples!

Demos

Kevin is showing an Amazon Item Watcher application. It can tell you when something changes about an item for sale on Amazon changes. Something like price or availability. They actually built a Greasemonkey script to integrate with a browser. Next he shows a feed reader. It uses Flex’s runtime CSS loading for themes. Very slick appearance. I guess the UI was actually built with HTML. Interesting.

Now Kevin is showing BuzzWord by Virtual Ubiquity. It’s a full-featured word processor written in Flex for Apollo. Multiple pages, images floating in the document with text flowing around them in real time as he types. Very cool toolbars slide in and out as he needs new features. It looks like they’re context-sensitive. The table editing interface looks great and useful.

Last, he’s showing a prototype application that supports PDF. He says that we won’t have PDF support in Alpha 1, but it’ll definitely be available for 1.0. Adobe Reader must be installed for Apollo apps to be able to use it. It won’t be part of the Apollo download. I guess it will prompt the user to install Reader if they don’t have it installed. I don’t know what I think about that. It’s probably a good choice since Reader is a big download. Hopefully, they’ll make the workflow easy for users that need to install it.

Some Q&A

Will QuickTime be supported? No, plugins won’t be available at this time. Of course, Flash Video will be present.

What is different between Java Web Start and Apollo? Java doesn’t have a consistent runtime. Backwards compatibility is extremely important for Apollo, just like it is for Flash Player. Apollo apps will be installed directly to the start menu, dock, etc so that the user can find their apps again.

What will Apollo be called? Adobe loves the name, but they might have trouble getting the rights. Kevin says an alternate name is in the works, and “it’s really cool”.

How will Apollo be distributed? They’re learning from their experiences with Flash Player distribution. The Flash Player is able to install Apollo, and the process has been available for a few years already! Partnerships will be important too, but the biggest way to get Apollo to the people will be with cool apps that people want to use. Kevin is telling a funny story about how they paid millions to Netscape to get Flash Player distributed with the browser. A couple weeks later, Microsoft called up Macromedia, and they asked to bundle it for free. Haha.

Extensibility? They’re working to add more and more over time. This will be driven by feedback from developers. Native code is a “problem” for security and cross-platform support. They learned from Shockwave, and they’re wary because most people will only support Windows. They’re working to figure it out, and they’re not against native code support.

Can Apollo apps be compiled to a native executable? No, the big goal is cross-platform support so that the same bits will run on all supported operating systems.

Database support? They’re looking into it, but only file-system writing is available right now.

Now he’s done, and Mike is going to get us all started with Apollo. I’ll try to share more later. I can’t be typing all night! It’s time to have some fun.

Yahoo! Pipes is Flash-Friendly

by Josh Tynjala

A couple weeks ago, Yahoo! Pipes went live to much fanfare from the tech community. For those unfamiliar, Pipes offers a way to mashup, manipulate, and aggregate feeds from all over the net. The slogan in the title says, “rewire the web”, and that’s exactly what you can do with its cool visual interface. As of Saturday, Flash and Flex developers just gained a very powerful tool. Pipes now has a cross-domain policy file.

Now, a million news and blog feeds are at your fingertips. You can use Pipes with RSS or JSON output. Speaking of JSON, you know that there’s a parser already written for ActionScript 3 in the corelib open source project, right? That’s more than enough reason to try it out if you haven’t yet.

Don’t forget, if you make a cool Flash app with Pipes or any of the other Yahoo! APIs that are accessible with Flash, share it with everyone on the Yahoo! Flash Gallery. Now, go have fun.

Extra info on the new Yahoo! AS3 libraries

by Josh Tynjala

In case you didn’t know, my team at Yahoo! released a beta version of our Yahoo! ActionScript 3 API library on the Yahoo! Flash Developer Center this week. The announcement officially came as part of our presentations at the 360 Flex conference in San Jose. Wonderful conference, by the way. If you missed it, shame on you! Truly one of the greatest concentrations of Flex developers ever, and I can’t wait until Ted, Tom, and John organize the next one. The place was overflowing with knowledge and excitement.

As you’re exploring the new Flash-friendly APIs, be on the look out for bugs, and please consider what you’d like to see in future versions. If you’re having trouble getting a particular API working, or you’re unsure about what something in the documentation means, I encourage you to contact us. The best way to send us questions and feedback is to send messages to the ydn-flash group on Yahoo! Groups. You’ll have access to not only real Yahoo! engineers like me, but also a knowledgeable community. Remember, we’re working hard to release new code for you guys, so other experienced developers that use our libraries can help you too.

If you want to get started with our new library, be sure to look at the how-to examples that our team developed. We demoed each of them at 360 Flex, and explained much of the code that we wrote with some extra insights. I’ll do a quick post once our slides become available, in case anyone is interested.

Now get out there and build some cool Flex mashups with our cool new Yahoo! libraries!

Jump into RoR with 'Rails Solutions'

by Josh Tynjala

Every time I read a tutorial or book about Ruby on Rails, I get excited. A single book about this framework can contain enough information to build a light, but surprisingly complete, application. In fact, it wouldn’t take too much effort to polish up the code and actually deploy it. I recently picked up a copy of Rails Solutions: Ruby on Rails Made Easy by Justin Williams, and like other Rails-focused material, it makes me want to have some fun and build something cool. Justin shows the reader how to build a web application similar to craigslist in RoR, and he nearly brings it to completion.

The first three chapters get you started pretty quickly. Chapter 1 introduces both Ruby and Rails with a bit of history, a summary of OOP and MVC, and some answers to a couple questions about databases, security, and popularity. The second chapter shows you how to install RoR and it’s required dependencies on both Mac and Windows. The author gives a surprising number of different options without being confusing to new users. In fact, his suggestions to use Instant Rails and Locomotive couldn’t have been better. Finally, the introduction ends with a look at Ruby the language as it’s used with Rails. It’s short and sweet, and anyone with a little programming and OOP knowledge should be able to pick it up without any trouble at all.

Chapters 4 and 5 build the foundation of working with Rails. Getting Started with Rails helps you start up the server and get working with the database. You will build your first controller and corresponding view, and the author explains some of the common scripts you’ll be using. He also shows how you can add common items to your view, like stylesheets. The next chapter, More Advanced Rails, adds to your knowledge with information on data validation, some work with migrations for database alterations, and creating associations between models. The author continues with routing, with an emphasis on clean and human-readable URLs, and finishes up this section with a look at debugging in Rails.

The next several chapters cover various interesting topics that most applications will need. Chapter 6 looks at data formatting with numbers and dates. Chapters 7 and 8 show just how easy Rails makes it to add a dash of AJAX to your app. Out of the box Rails has support for the popular AJAX libraries Prototype and script.aculo.us. The end of Chapter 8 includes a tutorial on using Action Mailer in Rails, but it’s long enough to seem out of place with some of the more obviously-AJAX material earlier in the chapter. Chapter 9 continues work with Action Mailer by adding support for file attachments, and it covers file uploads as well. These last couple of chapters feel clumsy. Good material, but I think it could be organized a bit better.

Chapter 10 shows the reader how to build a user authentication system. This includes sessions, password hashes, and checking to see if a user can perform certain actions within the application. The author points to a commonly-used user library called login_engine in a later chapter. Personally, I would recommend using a tried and tested system like that if you’re building a real-world application, but I’m assuming this chapter exists purely as an exercise in learning Rails.

Later chapters give good information, but they’re a little fluffy, if you know what I mean. Of note, Chapter 12 finally presents one of Rails’ most interesting features, scaffolding. The author explains that he doesn’t mention it in earlier chapters because he feels that the reader may become too dependent on the generated code that it builds. I think this is a novel approach for a Rails book, and I appreciate the author’s choice. The section is a little short, and I recommend reading up on scaffolding a bit more online if you’d like to learn more.

Chapter 13, Deploying with Capistrano, offers the reader a lot of very specific information about deployment. From the way the author presented it, this utility may not be widely used (I could be wrong), and it requires that you use a source control system like Subversion. The chapter came off as overly technical compared to the rest of the book, and far to specific. I would have axed it, but I’m sure many readers will find it useful when they actually use Capistrano.

This is the second Rails book that I’ve reviewed recently, and I promise that I’ll move back into Flash territory with my next review. As a Flex developer, I find many parallels between the Rails framework and Flex. If you’d like to learn more about using Flex with RoR, consider checking out WebORB, a popular implementation of AMF, the Ruby on Rails RIA SDK by Adobe, and Flex on Rails, a blog focused on using these two technologies together. This book, Rails Solutions: Ruby on Rails Made Easy by Justin Williams, and Ruby on Rails: Up and Running by Bruce A. Tate and Curt Hibbs should be good companions as well.

Catch me and Yahoo! at 360 Flex

by Josh Tynjala

Since the details weren’t 100% finalized until this week, I held off on mentioning that I’d be on stage at next week’s 360 Flex conference. Myself, along with the rest of the Yahoo! Flash Platform team, will be unveiling some new ActionScript 3 libraries that allow Flash and Flex developers access to our public APIs. I’ll save the details for our sessions on Monday night and Tuesday morning, but we’ve got some cool examples and mashups to show. These two sessions, by the way, will each have different content so be sure to attend both.

In addition to our API sessions, you should also attend one of the cool company get togethers on Monday night. After you grab a bite from the barbecue, head over to meetings put on by Yahoo!, Adobe, and eBay. You’ll get to hear about some cool projects being built inside each of these companies, and they’ll tell you a bit about current Flash and Flex developer openings. Get your foot in the door and have a chat with representatives from all three of these cool companies!

I mentioned it before, but now’s another good opportunity. Coming this June, you’ll have another chance to meet with a bunch of rabid Flex lovers. Flex Maniacs will be in Washington D.C. on June 25th-26th. I’ll be speaking there too. Rather than focusing on Yahoo! work, I’ll be doing a session about my cool open source TreeMap component for Flex. Specifically, I hope to cover some interesting advanced techniques with optimization, data descriptors, and other fun stuff like that.

Keep you travel calendar open this year because Flex is taking over in a big way!

Vote for a Yahoo! Maps ActionScript 3 API

by Josh Tynjala

Want to use Yahoo! Maps in Flash 9 or Flex 2? Vote for it. Let your voice be heard! The Yahoo! Developer Network suggestion board has a topic with digg-like voting that is getting some strong interest, and I want to see the votes jump into the triple digits. If you’re unfamiliar with the current sitation, the Maps API targets ActionScript 2. There have been a thousand different ways to use LocalConnection to communicate with the AS2 version of Yahoo! Maps from Flash 9. Let me tell you, it feels like the big ugly hack that it is.

Now, though I work at Yahoo!, my team doesn’t control this particular API. As a result, we’re pushing hard to let the Maps team know that developers want a first-class API for Flex 2 and the cutting edge of the Flash Platform. To help our efforts, I urge you to vote for an ActionScript 3 Yahoo! Maps API. Not only will you have a proper API without hacks, but it will be running 100% in AVM2, and you should see a nice speed boost in your applications.

Advanced ActionScript Rounding Functions

by Josh Tynjala

Everyone knows about and uses Math.round(), Math.ceil(), and Math.floor(). They’re great, but what if you don’t want to round to the nearest whole number? For instance, you might want to round to the nearest even number, or even a fractional value like the nearest tenth. The following functions make rounding in ActionScript 3 a lot more robust:

package com.joshtynjala.utils
{

/**
 * Utility functions for the manipulation of numbers.
 */
public class MathUtils
{
	/**
	 * Rounds a target number to the nearest multiple of another number.
	 * @see Math#round
	 */
	public static function roundToNearest(numberToRound:Number, nearest:Number):Number
	{
		return Math.round(numberToRound / nearest) * nearest;
	}

	/**
	 * Rounds a target number up to the nearest multiple of another number.
	 * @see Math#ceil
	 */
	public static function roundUpToNearest(numberToRound:Number, nearest:Number):Number
	{
		return Math.ceil(numberToRound / nearest) * nearest;
	}

	/**
	 * Rounds a target number down to the nearest multiple of another number.
	 * @see Math#floor
	 */
	public static function roundDownToNearest(numberToRound:Number, nearest:Number):Number
	{
		return Math.floor(numberToRound / nearest) * nearest;
	}

	/**
	 * Rounds a target number to a specific number of decimal places.
	 * @see Math#round
	 */
	public static function roundToPrecision(number:Number, precision:int = 0):Number
	{
		var decimalPlaces:Number = Math.pow(10, precision);
		return Math.round(decimalPlaces * number) / decimalPlaces;
	}
}

}
/*
Copyright (c) 2007 Josh Tynjala

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/

I’ve used various versions of this class on many projects, and the functions will always be in my toolbox. You can download the class, and use it under the terms of the MIT License.

Floating-point errors got you down?

by Josh Tynjala

Many developers will never encounter issues when floating-point math fails to return the correct result. Every once in a while, when you’re expecting to see a number like 10.1 in your trace panel, you might actually see 10.1000000001. This isn’t a specific issue with Flash either. By it’s very nature, any sort of calculation with floating-point numbers can result in tiny, nearly insignificant errors anywhere in modern computing.

In many cases, that number could get corrected the next time you use it in a mathematical operation. Other times, you’ll never notice that something went wrong because you might be animating some object, and the position gets rounded off anyway. You won’t always be so lucky, though. At some point in your future, you may need to display a number to the user. Imagine their look of shock as some crazy number with ten decimal places appears on the screen. “Oh my god! Why is it doing that?” exclaims a user of your cool new Flex app.

It gets worse. When these errors occur, checking if two numbers are equal can fail as well. Now, when you need to know if your function returned a multiple of two, and you get 15.9999999999, bad things can happen. Another problem, which I’ve run into a few times, is when I’m “counting” between two numbers, like two and three:

2
2.1
2.2
2.3
2.4
2.5000000001
2.6
2.7000000001
2.8
2.9
3

Consider the following two functions. I’ve been using them for a while now, and they work great. The first, correctFloatingPointError will manipulate the number (even a fractional one) with some clever multiplication, division, and rounding to try to account for the error. The second fuzzyEquals will check if two numbers are almost equal. In many cases, if two numbers have a difference of 0.00001, they might as well be considered equal. With both of these functions, you can manipulate the precision to allow for more accurate or inaccurate calculations depending on your needs.


/*
Copyright (c) 2007 Josh Tynjala

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/

/**
 * Corrects errors caused by floating point math.
 */
public function correctFloatingPointError(number:Number, precision:int = 5):Number
{
	//default returns (10000 * number) / 10000
	//should correct very small floating point errors

	var correction:Number = Math.pow(10, precision);
	return Math.round(correction * number) / correction;
}

/**
 * Tests if two numbers are almost equal.
 */
public function fuzzyEquals(number1:Number, number2:Number, precision:int = 5):Boolean
{
	var difference:Number = number1 - number2;
	var range:Number = Math.pow(10, -precision);

	//default check:
	//0.00001 < difference > -0.00001

	return difference < range && difference > -range;
}

If you have any more tips in this area, I’d like to hear them. Those two functions have been enough for my needs so far, but my toolbox always has room for an extra trick or two.

Check out the speakers at Flex Maniacs

by Josh Tynjala

A few minutes ago, I remembered that the list of sessions would be announced for Flex Maniacs today. If you’re not familiar, Flex Maniacs is another great new conference focused on Adobe Flex. Sponsored by Fig Leaf Software and Adobe, it will be taking place in Washington DC on June 25-26, 2007. If you can’t make it to 360 Flex because tickets sold out too fast, be sure to keep your budget open for Flex Maniacs. It looks to be just as exciting!

The list of sessions includes a plethora of Flex goodness including skinning, component development, Flex Data Services, using other server-side languages with Flex, Cairngorm, memory management, and too many other topics to list them all here. Many sessions will be led by real Adobe employees like Ted Patrick (evangelist extraordinaire). Others will have an industry expert like Chafic Kazoun at the helm. Oh yeah, and I’ll be speaking too.

The lecture I’ll be giving will focus on my open source TreeMap component for Flex 2. Here’s the official description:

Though the Flex 2 SDK ships with an impressive array of useful components, opportunities abound for the creation of more advanced visualizations that add new depth and interactivity to Rich Internet Applications. Treemaps, originally developed by Ben Shneiderman of the University of Maryland, offer an interesting way to display hierarchal data that goes beyond standard Tree components.

The Flex development community is growing quickly, and many developers want a look at the process and design considerations required for the creation of a complex component. Josh Tynjala shares his open source Flex TreeMap component with an in-depth study of its data handling methods, optimization considerations, and points for extensibility.

To be more specific, I plan to talk about using data descriptors with your components to allow custom or complex data structures, to show some of the methods I used to optimize the drawing code for the TreeMap, and a bit on the subject of using fields and functions to allow the user to customize your component without subclassing.

I’m pretty excited because this will be the first time I’ll be speaking at a conference. Thankfully, I have several months to prepare, and I plan to get it down to an art form by the time I’m facing a hundred ravenous Flex developers. All I ask of my audience is that you hold off on throwing rotten vegetables until after the Q&A.

One more thing. It looks like they need a couple more brave folks to do hands-on sessions at the conference. Go submit a topic if you think you’ve got a good one.

Tales of a Switcher: Josh Gets a Mac

by Josh Tynjala

Last week, I bought my first Apple Mac. I’ve been a long-time Windows user, and it took me some time to decide on this purchase. In high school, I played a bit with an older Mac at the library, but I never wanted one myself. In college, I remember trying some newer Macs with OSX. At the time, they ran pretty slowly when compared to the blazing fast gaming box I had in my dorm room, and I didn’t like the single-button mouse. It wasn’t until Apple switched to the faster Intel processors, they released of the ultra-small Mac Mini, and I discovered the safety-net known as Parallels that I felt I was ready to buy a Mac.

Certainly, it helps a great deal that I work with Adobe products. Adobe supports applications like Flex Builder, Flash Authoring, and Photoshop on both Windows and OSX. For other applications, especially simple utilities, I’ve had to spend a bit of time searching for proper alternatives. Here’s a list with a few useful (and free!) applications to help ease your switching pains. I’m sure a million other switchers have listed them too, but I felt like sharing.

Witch adds Alt-Tab support to OSX. While Command-Tab offers similar functionality, it doesn’t allow the user to switch between individual windows. Instead, it seems to switch to the most recently used window of each application. Witch has an amazing array of options to customize the look and feel of its functionality, and I highly recommend it.

If you like using Gaim or Trillian for instant messaging on Windows, you’ll want to check out Adium. It has a simple interface that’s very easy to use. I wish I had it on Microsoft side of life.

For FTP access, I’ve started using CyberDuck. While its interface looks nothing like FileZilla, my personal favorite on Windows, I still found it pretty easy to use.

Of course, both Firefox and Thunderbird work on Macs too. If you’re used to using Internet Explorer on Windows, Firefox will probably feel the most familiar. Interestingly enough, both of these programs have different behaviors in some cases when you change between platforms. For instance, I often press the Delete key to move an email to the trash in Thunderbird on Windows, but it doesn’t seem to do anything (other than cause the mouse pointer to disappear for a moment) on the Mac version.

As a Windows user, I commonly use the Home and End keys to move the cursor to the start and end of a line of text. Much to my dismay, these keys behave in a completely different manner on OSX. When I’m coding, I constantly find myself at the beginning or end of the file, rather than the line I was editing. Life Hacker has a good tip for making Home and End behave in a more familiar way. For some reason, I couldn’t get that particular solution to work, but I found a link in the comments to a program called DoubleCommand. The user interface leaves much to be desired, but it worked for me.

If you ever miss an episode of your favorite TV show, or you’re into downloading Linux ISOs, you may want to check out Transmission, a BitTorrent client. I’m a big fan of uTorrent on Windows, which has loads of options, but I’ve been pleasantly surprised at how much I like Transmission for its simplicity. I guess that’s the Mac Way™.

As I continue to explore and discover new things, I’m sure I’ll share more of my adventures as a Mac switcher. I doubt I’ll be making any big rants about how I miss Windows, though, because so far it’s been smooth-sailing.

Pages: Prev 1 2 3 ...10 11 12 13 14 15 16 17 18 19 20 Next