I’m John C Bland II

Husband, Father, Tech Author, Deacon.
Founder of Katapult Media, and full-stack polyglot developer.
Political Free Agents Podcast Host.

I create. I launch.

YouTube Channel

I post regular fun on YouTube like me playing the bass and anything else I find fun. 

Get Something Built

All project work goes through Katapult Media. Business is open. Let’s chat.

AIR 2.0: My Wishlist

I’ve been thinking about AIR a lot more lately and it prompted me to think about what 2.0 might provide us in ways of building better AIR apps. So, here is a short list of items I think AIR needs in order to make me happy.

  1. FTP support
    I know…AS3 provides the tools for ftp support and there are a few libraries started but stop depending on the community Adobe, for this one not everything. We need this natively in AIR. Maybe not SWF but AIR for sure needs this.
  2. External executable interaction
    In the simplest form I want to tell ApplicationX.exe or ApplicationX.app to run and pass parameters to it (blah.exe -param value). I know there are security issues and cross-platform compat’ issues but it’d be great if you figured this one out.
  3. Direct database interaction
    At a minimum MySQL, SQL Server, and Oracle. Make the core extensible so we, the community, can grow the available database support but lay the groundwork. You already have a solid sqlite core so build on top of that code-base and allow us to specify a type or something.
    Pseudo code:
    connection = new SQLConnection(SQLConnection.MYSQL, …)

    I know…buy ColdFusion right? Use PHP? .NET? Java? Nix those assumptions. If we want to use them, great, but not in all cases do we have a web server at our disposal. Keep making server integration better but don’t force a desktop app to use a server.

  4. Email Support
    This is just like the FTP support. I know you guys have the tools in place and say it is possible. Well, show us. Provide us with the tools to email directly from AIR. This is a serious need. We don’t need to setup a full web server just to send emails. In some cases, this isn’t possible or is utterly painful and takes forever (especially at big orgs).

    I should be able to use full smtp, pop, and imap. Those features would provide a TON of support for a solid number of AIR apps. In AIR 3.0 extend it to integrate with Exchange, etc. Heck, do it in 2.0 if you have the time. 😉

  5. External library interaction
    This is tricky but would blow my mind if it were possible. Basically let me instantiate a DLL , perl script, etc and have it do something for me. I know DLL isn’t cross-platform and the system may not have perl but those are things we, the developers, will have to account for in our own apps. Give us the rope…let us hang ourselves. 😉 No need to allow separate installs bundled with our app (like the .net framework or install perl) but at least being able to use outside code to fill the gaps where AIR lacks.

    If you provide this one, 1-3 above aren’t as important anymore.

  6. Webkit plugins
    Silverlight and Java at a minimum. It isn’t that I want to build a full blown browser or anything…I just want to be able to support the mass majority of sites out there. Think of the press, “Run Silverlight in AIR” would be all over the blogosphere. 😉 hint hint, wink wink. lol Ok…bad argument but it would still open AIR to a broader audience of sites.
  7. Better installation bundle
    We REALLY need to be able to default files to specific locations on install. Right now I can bundle config files with my app and on Windows they go to the location as bundled (ex – bundle in configs/ and on they are in [app folder]/configs/ on Windows) but on Mac they are embedded in the .app file. Someone has to know to view the package contents to get to it. Let me specify whether I want it bundled in .app or in a specific location.

    Yes, I know I can use AS to write the files or download then save but that shouldn’t be a requirement. We need more control over the installation.

  8. Multi-“version” export
    This one may be pretty specific but I need to export an AIR file pointing to the QA environment. Once it passes QA, I need the same build pushed to production now pointing to production resources. I’d really like a way to, in the export process, specify different builds. So, a QA build bundled with 1 config and a Production build bundled with another. I know I can simply do two exports right now but I’d prefer to have this functionality native to Flex Builder. This also includes 1 -app.xml vs another. QA may have a different app title or something. I’d like to export these builds accordingly without having to manually change things back and forth each time.
    Now, if the Builder option isn’t available, I’d like a way, on the server, to dynamically update an AIR file so the automated processes for pushing to production is seamless. This does not include building the source again, not a valid option. The process, in my case, is completely automated.

I’ll leave it at that. If AIR beefed up to provide most of these there would be an uproar of praise. If no one else uproared with me, you’d still have an army of 1 supporting you. 😉

Let’s see what 2.0 brings. 1.x has been great and I’ve enjoyed working with it but it is time to “beef up” in 2.0. We need much more than what AIR currently offers for true enterprise applications, heck even some small to robust apps need the above.

AIR Deleted My Desktop!!

Ok…this isn’t a “spoof” post or anything like that. AIR literally deleted everything on my desktop as well as screwed something up on my OS (Vista). How did this happen? I’m glad you asked.

First off…I didn’t tell it to delete ANYTHING. I’m adding features to an app and one of the features is to save a file to a network share so I was testing it against my desktop directory. Since this is AIR I figured a simple file copy was sufficient.

Do you remember that old joke where someone sent you a spam email and opening the attachment showed your My Computer window deleting every file on your system? That’s how I felt watching my desktop directory contents leave.

I’m on Windows…just right click on Recyle Bin and restore, right? NOPE. AIR DELETED ALL OF MY FILES PERMANENTLY!!!!! Every file…gone. I open Computer and and it tells me “C:\Users\John C. Bland II\Desktop refers to a location that is unavailable. …” which is great because now I literally do not have a desktop (beyond a background image).

So, again…how did this happen? Ok…don’t get testy. I had to vent through sidebars real quick.

//Copy JSON file to web server
var file:File = File.createTempFile();
var stream:FileStream = new FileStream();
stream.open(file, FileMode.WRITE);
stream.writeUTF(“some content”);
stream.close();

var jsonFile:File = new File(_filePath);
jsonFile.resolvePath(“live” + _Index + “.json”);
file.copyTo(jsonFile, true);

So, this all works up to the last line. Odd right? I don’t have any delete lines. _copyTo(…)_ is the culprit. Yep, copy really should be: copyAndDeleteAllContentsInTheDirectoryThenMoveFile(….). 🙁

What’s worse is the desktop directory is gone so I have NO idea if it even worked. Now I have to try it again. 🙁 This time I’m setting _filePath to _File.desktopDirectory.nativePath+”/myapp”_ so it will only delete that directory vs everything.

copyTo(…)’s overwrite explanation:
“If false, the copy will fail if the file specified by the target parameter already exists. If true, the operation will first delete any existing file or directory of the same name (however, you cannot copy a file or folder to its original path). (Note: If you set this parameter to true and the source and destination File objects point to the same path, calling this method deletes the file or directory.) ”

So…whatever it was…AIR DELETED MY DESKTOP! 🙁 Boo FLIPPIN’ hoo! 🙁

UPDATE:
The bug is in my _resolvePath_. It should be _jsonFile = jsonFile.resolvePath(“live” + _Index + “.json”);_. So, AIR tried to copy a file to a directory which caused the directory to get nixed since it was an overwrite. The time you want Vista’s UAC to kick in…it is MIA! 🙂

AIR+OpenAIM: Buddy List Viewer

I’m researching OpenAIM for an upcoming article and thought I’d share a few quick tidbits about connecting to OpenAIM. Let me first say…I didn’t do anything special here. AOL has provided a pretty quality developer center and they have written the ActionScript 3 code necessary for connecting to the AIM service. As a test I thought I’d try to grab my buddy list and show it in an mx:Tree component.

Disclaimer: This is purely a sample app so the code does not use any best practices or anything…just showing how to use the OpenAIM code.

Sample AIR app:

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="https://www.adobe.com/2006/mxml" xmlns:wim="com.aol.api.wim.*"
                        layout="absolute"
                        applicationComplete="init()">
    <mx:Script>
        <![CDATA[
            import com.aol.api.wim.data.types.SessionState;
            import com.aol.api.wim.data.User;
            import com.aol.api.wim.data.Group;
            import com.aol.api.wim.Session;
            import com.aol.api.wim.data.BuddyList;
            import com.aol.api.wim.events.BuddyListEvent;
            import com.aol.api.wim.events.SessionEvent;
            private var aolSession:Session = new Session(stage, "your developer key", "Your Test Client", ".1");
            private var aolBuddyList:BuddyList;
            private function init():void{
                aolSession.addEventListener(SessionEvent.SESSION_STARTING, handleSessionStarting);
                aolSession.addEventListener(BuddyListEvent.LIST_RECEIVED, handleBuddyListLoad);
                aolSession.signOn("your username", "your password");
            }
            private function handleSessionStarting(event:SessionEvent):void{
                aolSession.requestBuddyList();
            }
            private function handleBuddyListLoad(event:BuddyListEvent):void{
                aolBuddyList = event.buddyList;
                updateBuddyList();
            }
            private function updateBuddyList():void{
                var buddyList:XML = <node label="AOL Buddy List" />
                var group:XML;
                var user:XML;
                for each(var item:Group in aolBuddyList.groups){
                    group = <node />
                    group.@label = item.label;
                    for each(var userItem:User in item.users){
                        if(userItem.state == SessionState.OFFLINE) continue;
                        user = <node />
                        user.@label = userItem.aimId;
                        group.appendChild(user);
                    }
                    buddyList.appendChild(group);
                }
                buddies.dataProvider = buddyList;
            }
        ]]>
    </mx:Script>
    <mx:Tree id="buddies" width="100%" height="100%" showRoot="false" labelField="@label" />
</mx:WindowedApplication>

So, briefly I’ll cover the code (gotta cook dinner in a sec; lol). On Line 4, above, we set the applicationComplete event to call our init() function, lines 19 to 23. In there we add a couple event listeners then call the signOn(..) function of the WIM api. Before we can successfully do this the aolSession variable must be created, which we do on line 15.

Note: You HAVE to get a developer key from AOL in order to test this code.

Once the sign on request is complete we call requestBuddyList(), line 26. When the buddy list is returned we set the aolBuddlyList variable then call updateBuddyList(), line 32. The updateBuddyList() function merely loops over the groups (your buddy groups) and users in each group, updates the buddyList XML local variable, then assigns it to the dataProvider of the buddies Tree component.

For the UI we mer
ely create an instance of mx:Tree and set the labelField to @label, which is what we created in the updateBuddyList() function.

That’s it. Run the app and you’ll see your buddy list in a window like below:

MyBuddyList

They have some work to do on the source code but I went from from 0 knowledge to this sample app in 20 or so minutes. Grab the code and check it out.

Flex 3 and AIR – Beta 3 on Labs

That’s right, check it out and get your Flex on while you grab some AIR! Ok…cliche…I know, or is it? 🙂

Anyways…”grab the beta versions on Adobe Labs”:https://labs.adobe.com/.

I can tell you…this is very important release. Check the release notes to see all of the new stuff.

CF AIR Compiler

Terrence Ryan has a proof of concept app (“CF AIR Compiler”:https://www.numtopia.com/terry/blog/archives/2007/11/cf_air_compiler.cfm) which takes CF sites and compiles them into AIR apps. His approach simply makes since and CF is probably the easiest language to accomplish this since CFHTTP and CFFILE are so freaking simple to use.

Although this is done with CF, for CF, and by CF (I only…with and by are the same thing but i had to complete the phrase; hehe) you could essentially point this to almost any site and pull the files (html content, js, and css) but it is cool to see this proof of concept in the wild.

Multidmedia Zinc vs Adobe AIR

Multidmedia wrote an article in April of this year titled “Zinc Vs Apollo: The Good, The Bad and The Desktop”:https://www.multidmedia.com/support/developers/articles/?action=show&id=33. It is written with a bit of a defensive tone, understandably. Their whole business is Zinc. I mean, they have other products but Zinc is definitely the big one and Adobe AIR is SERIOUSLY going to cut into profits for them. It is free compared to several hundred for Zinc. Anyways…I wanted to clarify a few things from their article.

They did write this in April of this year so the info was current as of them but it isn’t now. For instance, the table at the bottom compares Zinc and AIR. This is the biggest “gripe” I have with the article.

(see the article first then the rest of this post will make sense)

(more…)

Aptana IDE+Adobe AIR is SWEET!

Ok, this is my first impression and, as with all things, I’m sure I’ll find something wrong with it but right now…NOPE…IT ROCKS!

You can build “HTML+Javascript AIR applications”:https://labs.adobe.com/technologies/air/develop_ajax.html! I love it, again…at first glance. The more I play with it I’ll expand my thoughts but at this point this is about all I can say. lol. 🙂

Oh, it is also useful for normal Javascript, Apple iPhone development, and more. Last note…it is free! 😀