Archive for the 'OS X' Category

The GAE SWF Project

The GAE SWF Project: Knowledge and tools to help you build Flash and Flex apps on Google App Engine

Today I'm releasing The GAE SWF Project, a resource of Flash and Flex-related knowledge specifically aimed at getting you up and running quickly with Google App Engine. If you want to skip all the details and start playing with it, skip to the Getting Started section.

Everyone else, read on!

When Google announced Google App Engine last week, I couldn't believe what I was hearing. It was as if someone had said, "Hey, Aral, tell us what your perfect development environment is and we'll build it for you."

In recent weeks, I had started playing with Python and Django and experimenting to see whether I could use it to build the web application for the Singularity web conference that I'm organizing at the end of October. Turns out that I could not have picked a better time to invest in learning Django and brushing up my Python as Google App Engine is heavily influenced by (and supports) Django and is written in Python.

A framework for the Singularity Conference

Singularity is shaping up to be a really great conference. I'm honored to have a constantly-expanding stellar line-up of speakers and yet the sessions are just one very important aspect of the conference. I find that you get as much out of your social interactions with speakers and other attendees at conferences as you do from the sessions. And Singularity is no exception.

The Singularity conference application is not something you will login to on October 24th and never visit again beyond October 26th. On the contrary, I plan to launching the application as early as possible and add features as we go so that we can start building the community around the conference. This is essential for the organization of the local conference hubs, for building friendships months in advance of the conference, and so that you can influence what the conference ultimately becomes (you do not have to attend the conference to join the online community.)

When I initially announced the Singularity conference two months ago, I stated in the About page that Singularity would have a "focus on open source, the community, and on giving back."

Today, I'm taking the first step towards delivering on that promise by releasing the initial underpinnings of a framework that will eventually power the Singularity conference web application. I present to you The GAE SWF Project.

The GAE SWF Project

The GAE SWF Project (hey, Google chose the name, I only provide the juvenile attempts at humor) is a resource of Flash and Flex-related knowledge specifically aimed at getting you up and running quickly with Google App Engine. The initial release contains a proof-of-concept Flash 9 client showcasing a pre-alpha version of The GAE SWF Framework. The framework is a very light-weight combination of Python and ActionScript 3 that uses some of the best open source components available today on the Flash Platform and Python ecosystem. It is inspired at its core by best practices and a pragmatic approach to application development.

The proof of concept (and, indeed, the whole project) specifically targets Google App Engine. This is by design. The framework is not a generic one (although, by all means, feel free to get inspired and port it if you wish). The dedicated focus is part of the appeal. It means that we can make things simpler.

There will be no abstraction for the sake of abstraction and no premature abstraction; the framework will evolve by encountering real-world problems and solving them.

Finally, keep in mind that you are viewing the fruits of three days of work at the moment (this, in itself, should be testament enough to how easy -- and fun -- Google App Engine makes development). It is early days but I feel that we've made a good start. I hope to hear your thoughts and feedback in the comments.

The Proof of Concept

The proof of concept is built on Google App Engine using Google's webapp framework.

It showcases several fundamental architectural considerations, the most important of which I've outlined for you below.

HTML and Flash in a tree...

You use handlers in app.yaml to host a mix of Flash and HTML content, including the Flash Remoting gateway, in a single Google App Engine app.

Embed Flash content using SWFObject

SWFObject is the way to embed Flash and Flex applications in your HTML. Use it. 'Nuff said.

Deep links

You implement deep linking using a combination of server-side Python and SWFAddress so that both SWFAddress-style and regular URLs are supported. Regular URLs are translated to SWFAddress-style hash/anchor URLs on the server.

Thus, both of the following URLs are valid ways to reach your profile page on the proof of concept Flash 9 client:

Regular URL:

http://gaeswf.appspot.com/examples/initial/profile

SWFAddress-style URL:

http://gaeswf.appspot.com/examples/initial/#/profile

Flash content that obeys browser text-size changes

Users with poor eyesight or in environments with reduced-visibility (such as bright sunshine outdoors) may want to increase the size of the text displayed in the browser. By default, Flash and Flex content does not react to these text-size changes. However, it is possible to make Flash content obey browser text-size changes and the proof of concept implements one such method that does not involve any alterations to the Flash app.

(You can read more about similar issues -- and see some juicy Flash myths debunked -- in my review of the talk I gave at Highland Fling this month titled Bare-naked Flash: Dispelling myths and building bridges.)

PyAMF

PyAMF is a Flash Remoting implementation for Python. It has a dedicated and responsive group of passionate developers working on it, led by Thijs Triemstra, Nick Joyce, and Arnar Birgisson. On Tuesday, the team released PyAMF 0.3 with support for Google App Engine.

The GAE SWF Framework uses PyAMF as a core component to communicate with the server and the various Google App Engine APIs. It is currently running PyAMF 0.3.

The PyAMF gateway is setup as a regular mapping, and mapped to /gateway in app.yaml.

Users API

You use the Google App Engine Users API to login and out of the Flash application. The current Flash 9 proof of concept implements one of three possible ways of handling logins (see the note in my earlier blog post about the other two ways.)

Intelligent forwarding after login

When you hit a deep link in the application without logging in, you are automatically forwarded to the link after you login. This is a behavior that you are accustomed to seeing (and expect) in HTML-based applications but I have rarely seen it implemented in Flash and Flex applications.

DataStore API

The Google App Engine DataStore is a massively scalable database based on Google's Bigtable (the same distributed database that powers their search and services like Google Earth).

The proof of concept has a profile section where you can fill in your name and a URL (the Users API currently does not provide your GAE app with the user's name, just their email address). This data is saved via PyAMF and the DataStore API.

(All server-side services are in the /services package.)

Client-side and server-side validation

The Profile Screen shows you how to implement two different types of validation: simple client-side validation and server-side validation.

The Name field performs simple client-side validation that stops the user from submitting the form without entering a name.

The URL field, on the other hand, actually hits the server and asks the DataStore to verify that the URL is valid. When you think about it, it makes sense to use server-side validation code to validate more complex data types using the exact same code that the DataStore API uses.

The user experience is managed via visual cues that are carefully scripted using the excellent KitchenSync AS3 sequencing library by Mims Wright. (Mims just added me as a project member so I can contribute a small update I blogged about earlier.)

(I'm still working on tweaking the timing of the type wait duration for firing the server-side validation code to make it as seamless as possible.)

As the framework develops, I know that the KitchenSync library is going to be an essential, core element, and I look forward to contributing back as much as I can to the project.

Mail API

The proof of concept also makes use of the Google App Engine Mail API to send email confirmations to your Google Accounts email address after you update your profile.

When initially working with this, I was searching for a simple way to monitor the mail that was being sent from the app. Although the Development Web Server allows you to specify an SMTP server when you start it, I couldn't get it to work with either GMail or my web host's mail server. And setting up sendmail or postfix was a pile of worms I didn't want to sample.

Instead, I found a simple, open source SMTP server written in Python that's perfect when developing locally with the Development Web Server. It's in The GAE SWF Project app that you can download. To start it, simply change to your The GAE SWF Project folder and type:

./monitor_mail

You will see all email sent from your application in the Terminal window. (Note: I run on a Mac and all the commands in this article are meant to be run in Terminal on OS X. You may need to tweak them slightly for your operating system of choice.)

CSS, etc.

I may introduce myself as a Flash Developer but that doesn't mean that I don't care about the rest of the web. With good friends like Andy Budd, Richard Rutter, Paul Annette, and Jeremy Keith living almost a baseball-bat-wave away from me, I'd be scared silly implementing a new site with anything less than pristine markup. So that's what I've strived for here and I hope I've at least come close. (I did use one <br/> tag, for which I feel very dirty indeed!)

Nearly all of the credit for the CSS goes to the excellent YUI Grids CSS library that Rob Knight clued me into via Twitter last week when I was battling with altering the K2 theme on Singularity to make it into a cross-browser three-column fluid layout.

(The scale9-esque fluid download cell is courtesy of the even more rounded corners with CSS technique.)

The HTML content is structured using several Django templates, which are supported by Google's webapp framework.

Finally, the Flash client uses the TabBar component from the open source Yahoo Astra Flash components and Uza's AS3 Global Object to implement several global convenience properties (like the current SWF's URL).

Getting Started

Getting started with The GAE SWF Project couldn't be easier.

1. Download and unzip

First off, download the Google App Engine SDK (includes the local Development Web Server and webapp framework.)

Next, download the latest release of the The GAE SWF Project and unzip it.

(Or, you can check out the unstable, bleeding-edge version from The GAE SWF Project Subversion repository's trunk on OSFlash.)

2. Start the server

Open up Terminal and navigate to the folder you unzipped The GAE SWF Project to. To start the Development Web Server type:

./start

This is a convenience script that I made that starts the Development Web Server and sets the mail server as localhost:5000. You can change these in the script of just use dev_appserver.py . to start it up without mail support.

If you want to monitor the email that gets sent, open up a separate Terminal window and, in The GAE SWF Project folder, type:

./monitor_mail

3. View the app and start hacking!

Now that the app is running, view it in the browser by hitting http://localhost:8080.

You can now open up the source folder and start exploring!

Trace you, trace me, trace it for always...

Wow, did I just paraphrase Lionel Richie?

Anyway, I find it useful to tail the Flash trace log (especially to see trace results in the browser and online). Here's how you do it:

Before you start, you need to enable logging by creating a file called mm.cfg in /Library/Application Support/Macromedia.

In it, enter:

ErrorReportingEnable=1
TraceOutputFileEnable=1

You only need to do this once. After that, whenever you want to tail the log, open up a new Terminal window and type the following, replacing USER with your home folder:

tail -f /Users/USER/Library/Preferences/Macromedia/Flash\ Player/Logs/flashlog.txt

Play, enjoy, share, have fun!

As I state on The GAE SWF Project site, I hope that this open source effort will help you to get started quickly with building Flash and Flex application on Google App Engine. In the past few days, I have had more fun developing this than I can remember in a long while. I love Python, I love Django, I love Google App Engine, and I love Flash and Flex. To have them all together... well, that's a dream toolset, right there!

And, there's something to be said about writing your app and then letting Google handle the rest. Personally, I can live with that.

(Oh yes, and I do desperately need to talk to someone at Google about hosting the Singularity conference web application on Google App Engine with regards to the quotas -- if you know whom I should contact, please either let me know directly at aral {at} aralbalkan(.)com or leave a comment below -- thanks!)

The GAE SWF Project is currently a proof-of-concept; it's a three-day old baby that I hope will blossom into a useful resource.

I hope you you enjoy it and I hope that it makes your life a little easier or at least gives you food for thought.

Play with it and let me know what you think in the comments.

14 great Mac apps for $49 - only one day left on Mac Heist! (And me want NoteBook… yum!) :)

Macheist

VectorDesigner, Snapz Pro X, Pixelmator, CSSEdit, AppZapper, Speed Download, 1password, CoverSutra, Cha-Ching, iStopMotion, Awaken, Tiki Magic Mini Golf, Wingnuts 2, and TaskPaper are the 14 applications you get for $49 in this year's Mac Heist. And there's just over 1 day left to take advantage of it.

I just put in my order (through your link, Relly, so I hope you get NoteBook!)

I already have a couple of the apps but you can assign the ones you have to someone else at checkout -- in this case, Stephanie's going to have a nice surprise when she wakes up tomorrow! :)

And, if you buy the bundle using the links on my post, I might just get a cool app called NoteBook also (and LaunchBar, but I'm way too much a QuickSilver addict!)

Check out Mac Heist.

Update: Thanks, guys and gals! Enough of you bought it through the night that NoteBook was unlocked for me when I woke up this morning... can't wait to play with it. :)

Reply to multiple email messages in Mail

You guys are great! Ninety sites have the Singularity badge on them and the number is growing every day. I couldn't be happier and yet it also means that I now have ninety emails that I need to reply to. While I've started to answer each one personally in turn, what I really need is the ability to respond to all the emails with a single message to say "Hey, I got your email, thanks. You'll be among the first to know what Singularity is in the next few days!"

I've been tagging messages with the label "Singularity Badges" in GMail as the emails were coming in (note to self: next time, also reply to the message at this point and they won't pile up!) So I thought I'd fire up Mail app, select all the messages with the label, hit Reply and Bob's your uncle.

If you've tried yourself in the past, you are probably aware that Bob is most definitely not your uncle! (The reply option is grayed out in Mail when there are multiple messages selected.)

So if you want to work this way, you have to write some AppleScript.

Being an AppleScript newbie, I was happy to see that Jake Albert had already done most of the work for me and shared his solution on Mac OS X Hints. I started with his code in Script Editor and applied the follow-ups suggested by Peter Bukowinski, Matt Harris, and Tom Wible. Instead of putting all the senders in to To field, however, I made the script put your default account's email address in the To field and put all the other recipients in the BCC field.

Here's the final script, released here under the open source MIT license:

set thesenders to {}
set thesenderstext to ""
tell application "Mail"
    set themessage to the selection
    repeat with i from 1 to the number of items in themessage
        set thesender to (extract address from (the sender of (item i of themessage)))
        if thesenders does not contain thesender then
            set thesenders to thesenders & {thesender}
        end if
        set the was replied to of (item i of the themessage) to true
    end repeat
    set AppleScript's text item delimiters to ", "
    set thesenderstext to thesenders as text
    set AppleScript's text item delimiters to ""
    set newMessage to make new outgoing message
    tell newMessage
        set visible to true
        make new bcc recipient with properties {address:thesenderstext}
    end tell
    set toAddress to email addresses of item 1 of accounts as text
    tell newMessage
        make new to recipient with properties {address:toAddress}
    end tell
    activate
end tell

Finally, I saved the script under ~/Library/Scripts as ReplyToMultipleEmails.scpt and used Quicksilver to add a hotkey combination to trigger the script.

To do this, I first made sure that my scripts folder was included and selected under Quicksilver → Catalog...

Quicksilver Catalog Scripts

And added the Trigger from Quicksilver → Triggers... and assigned it to the hotkey ⌃ ⌥ ⌘ R.

Quicksilver Trigger

With this script in place, you can reply to multiple email messages in Mail by selecting them and hitting your chosen hotkey combination. So I'm off to email everyone who put the Singularity badge on their sites with an update.

Hope you find this useful... enjoy!

Update: I noticed that when you use this script to reply to multiple messages, the "was replied to" flag on the messages is not set. I've modified the script so that the flag is now set but be aware of an issue with this: If you use the script to create a new message and then don't send it, the "was replied to" flags on the messages you were replying to will remain set. If you don't like this behavior, remove the line that reads set the was replied to of (item i of the themessage) to true from the script.

Apple releases a fix for Leopard keyboard freezes

John Grden just forwarded me an email form John Olsen (thanks guys) alerting me that Apple has reportedly released a fix for the keyboard freezing issue in Leopard.

That's good news but, to tell you the truth, I'm going to wait a couple of months at least before even considering giving Leopard another shot. See, the thing is, I'm really happy on Tiger and downgrading to it made me realize just how many little issues I had with Leopard (responsiveness, general quirkiness, etc.) I absolutely love how stable Tiger is. I love how Tiger looks (yes, I love my non-transparent menu bar, rounded corners and blue apple logo) and I love how everything (all applications, etc.) work. I love the level of polish Tiger has.

Tiger doesn't remind me of Windows at all and Leopard did.

Part of Apple's corporate culture is its arrogance. The problem with arrogance is that, combined with incompetence it makes you appear a fool. Apple can be as arrogant as they want with Tiger. It's a shining beacon of stability and aesthetics, a perfect marriage of form and function. It just works. Not so with Leopard, at least not yet.

In Leopard, form trumps function and eye-candy exists for its own sake while fundamental characteristics of the operating system like stability are compromised.

I'm personally going to wait until Apple or third parties at least give me the option to make Leopard more like Tiger before I upgrade again. I'm guessing this will be in the 10.5.2 - 10.5.4 timeframe.

And really, I don't miss anything that Leopard had. I definitely do not miss the IMHO butt ugly interface. The Finder enhancements were really nice (I loved the breadcrumbs, for one), spotlight was far more useful and I did enjoy the integration between Mail and iCal but I value a stable system far more than any of these. And I didn't really get to use Time Machine as I'm on a laptop and don't have a USB drive plugged in all the time (here's hoping for that dual hard-drive laptop in '08, Apple... and I'll have that second one removable/hot swappable if you don't mind!) :)

I know that Leopard is working well for some of you and that some of you are very happy with it and that's great! But I see Leopard as more of an alternative to Tiger than an upgrade.

At the end of the day, the kitty that still has this early adopter's heart is Tiger.

I’m downgrading to Tiger

That's it, I've had it with Leopard. All the issues I've been having are driving me nuts. Leopard is just not stable enough for professional use. I almost feel like a Windows user again. (OK, not entirely, but I definitely don't feel like a Mac user anymore!)

So today, I bid adieu to Leopard and downgrade to Tiger.

I have to say that I am not looking forward to the hassle. Instead of being arrogant pricks and making fun of Vista, I wish Apple would provide a downgrade option like Vista has to make this easier.

Leopard: Great eye candy, pity the keyboard doesn’t always work.

<rant>

Dear Apple,

I have a Macbook Pro. It's your hardware. Unmodified. As shipped from your factory. I also recently bought your operating system upgrade for OS X Leopard. The only problem is that since I upgraded to Leopard, I can't use my keyboard without it freezing every few minutes.

Yeah, that does suck. In fact, it sucks huge hairy elephant balls.

See, this other company, Microsoft, they got the whole keyboard thing working without a hitch in, oh, what was it? Version 1?

You see, Apple, keyboards are important things. They're usually the primary means by which we provide input to our computers. In fact, I'm trying to use one right now -- quite unsuccessfully, I might add -- to write this blog post.

You remember those arrogant "I'm a Mac" ads that tout how reliable Macs are when compared to PCs? (And they truly were with Tiger.) I used to chuckle at them as I remembered what hell my life was under Windows before I switched last year. The only problem is that since I upgraded to Leopard, the ads seem further and further removed from reality. I kind of miss how I never had to worry about my keyboard freezing up in the 23 years that I used Windows. I'm beginning to eye those shiny new Vaios with envy again.

What the fuck is wrong with you Apple? You haven't even publicly acknowledged this issue and it has been reported to you over a hundred times on your own support forums for the past month.

Here's the Apple ad that Microsoft should make ASAP:

Mac: Hi, I'm a ................
PC (grinning): Mac?.. Mac?.. I think his keyboard's frozen again. But have you seen his shiny new 3D dock? Ooh-la-la!

Apple, do you have any idea how incompetent this makes you look?

Most importantly, the first thing you need to do is to officially acknowledge that the problem exists.

Yes, bugs are a fact of life in our industry but it is also common practice to _acknowledge and fix them_.

Next, state that you are working 24/7 on isolating it and finding a fix for it. Tell us you're aware of the problem and working on it. Heck, say you understand. While you're at it, you might even apologize to the hundreds (thousands?) of people who are losing their productivity due to this unbelievable bug.

And scrap your arrogant ads, you don't deserve them anymore. Maybe snack on humble pie for the next year or so until you get Leopard as stable as Tiger was.

Leopard just works? My ass! Tiger just worked. Not Leopard.

(Do I seem _really_ annoyed? Maybe it's because my keyboard has frozen about a dozen times so far in writing this blog post.)

I'm just one previously enthusiastic Apple user who is getting ever more annoyed and disenchanted with Apple. Something tells me that I'm not the only one. Here's a quote from one of the frustrated MacBook Pro owners on Apple's support forums:

Sadly, I am writing this from my Dell. I can't stand using the MBP at this point. How could they let a bug like this get out? At my company, a team would be working 24/7 to fix a problem like this. Do you want to begin to quantify how much this could cost Apple in the long run? Every day without a fix is another level reached in my anger and I assume there are thousands of others like me. I have two friends who are also having the problem now. One MPB from Fall '06 and one MPB from last week! Mine is from early October. I will not be buying Leopard for my fiancee's (fall 06) MacBook Pro this Christmas!

Oh and if any you should come by the cafe I'm in the next few minutes, I'll be the one with the shiny Macbook Pro frantically tapping his Num Lock key to see if his keyboard is back so he can continue working.

Un-fuckin'-believable.

Thanks a whole bunch, Apple! I'm off to restart my computer and (hopefully) get my keyboard back so I can do some work instead of bitching about my computer not working.

</rant off>

Links:

Keyboard freezes in Leopard: possible link to changing batteries?

I'd been enjoying over a week of keyboard-freeze-free Leopard use until a few moments ago. Coincidentally, I also hadn't switched batteries in about over a week as I'd been too lazy to charge my second battery. A few moments ago though, I hot-swapped to the other battery after the first one ran out (once my MacBook Pro had gone to sleep) and I've just experienced two separate keyboard freeze-ups.

I'm going to go out on a limb here and suggest a link between changing batteries (possibly hot swapping) and the keyboard freezes in Leopard. It may not be the only trigger but it does appear to at least be one of the reasons.

Has anyone else noticed this?

Update: And it seems that a restart cures this. The reports on the web that clearning the PRAM fixes the issue may be an ad-hoc fallacy as clearing the PRAM involves a restart and it might be the latter that fixes things.

Update: Someone in this thread is also reporting that they see the keyboard freezing issue only after changing batteries. Also, someone else suggests that it might be a problem with the Finder capturing keystrokes (restarting the Finder reportedly resolves the issue for him).

It’s official: What people are really searching for is sex, not food, water, or shelter!

Google Trends Gadget verifies Maslow

I downloaded the new Google Gadgets for Mac today (finally, a third party gadget engine does it right -- they integrate with Dashboard so you don't have to have two sets of competing gadget paradigms) and tried out the Trends gadget that lets you compare Google search trends.

To make Maslow proud, I typed in sex, food, water, and shelter. And lo and behold, people are searching for sex online (whodathoughtit, eh?) Although, interestingly, the media appears to be more interested in water! (Water sells?)

Anyway, so Google Gadgets is a mixed bag. Some of the widgets (like the Google Earth widget) would not install and others didn't work properly (the weather widget didn't display it's preference panel, for example. The ones that do, work well though. Integrating it with Dashboard was a stroke of genius. Good one, Google!

Random keyboard freezes after upgrading to Leopard

After upgrading to Leopard, I've been experiencing random keyboard freezes and, apparently, I'm not alone.

One thing I've found is that repeatedly pressing Num Lock appears to bring it out of the freeze for me after pressing it about five or six times.

Of course, this is very annoying and I hope that Apple will address this problem ASAP (currently, they don't appear to acknowledge it as an issue and the latest system update (10.5.1) has not made a difference.) On the whole, I must say that I am not very happy with Leopard: It has definitely fallen short of the sort of stability and polish I had come to expect from OS X with Tiger.

Has anyone else with a MacBook or MacBook Pro experienced this?

Visor now works on Leopard

Visor gets a Leopard upgrade!

Things are beginning to get back to normal on Leopard for me now that my beloved Visor has a Leopard version.

Visor is a SIMBL plugin that gives you access to a Terminal window as a Quake-style console that drops down from the top of your screen. And the Leopard version supports tabs! Woot!

A big thank-you to Tim Robles for alerting me to the Leopard release in the comments of my previous Visor-related post.






Bad Behavior has blocked 0 access attempts in the last 7 days.