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.

Spring’ing my Flex via BlazeDS

Spring+Flex+BlazeDS = NICCCCCCCCCE, seriously. First, “Spring”:https://www.springframework.org is a pretty nice approach to Java development. Couple Spring with “Velocity”:https://velocity.apache.org/ and you can do some pretty quick web work. Anyways…I’m talking Flex here…not Velocity. 🙂

So, I struggled BIG TIME getting this thing to work. Java has this insane idea that you need to configure everything (hehe)! Configuring Java/Spring/BlazeDS whooped my tail today. I finally got it and it seemed most of my problems were due to me missing a few jar’s in my /WEB-INF/lib folder.

Anyways…I got it working and I am officially Springing my Flex. 😉

Here are a few code snippets of why this is a nice approach.

In my DAO I have a method (let’s call it foo) that returns a List. To query the database I setup in my applicationContext.xml and return the List, I simple do the following:

bq. return getJdbcTemplate().queryForList(“select * from mytable”);

My DAO is extending JdbcDaoSupport so it takes care of a few things for me. That’s pretty easy huh? That is almost as easy as ColdFusion queries. It gets a bit more hairy when you have to build a query string but that is expected.

You will DEFINITELY hear more from me about Flex+Spring via BlazeDS. My next task (after finishing this app) is to build a messaging app to showcase how sweet it is to push content to my Flex app vs my Flex app asking for content.

Stay tuned…

FMS: A Quick Fix for missing onBWDone, onFCSubscribe, etc.

Ok…this one made me work a bit. A customer was having a problem using Flex to build a simple video player. The player I built, at work, is FP9 but AS2 (medium-long story) so I hadn’t come across their specific problem.

The Problem
ReferenceError: Error #1069: Property onBWDone not found on flash.net.NetConnection and there is no default value.

The Problem #2
ReferenceError: Error #1069: Property onFCSubscribe not found on com.llnw.controls.MediaPlayer and there is no default value.

Quick Discussion
Both problems are the same issue. When you call Flash Media Server and attempt to connect there is server-side Actionscript that gets executed. For certain calls there is a return call. For example:

_netConnection.call(“FCSubscribe”, null, “mystreamname”);

With that type of call you will get a return call to onFCSubscribe.

The AS2 Solution
In AS2 it is easy because of how loose classes are. You can easily use:

_netConnection.onFCSubscribe = Delegate.create(this, handleFCSubscribe);

This is exactly what I do and it works but AS2 isn’t the problem here…AS3 is the culprit.

The AS 3 Solution
My first shot at it was an old AS2 “hack”:

NetConnection.prototype.onFCSubscribe = handleFCSubscribe;

That worked just fine but it kind of bugged me. I just felt a little dirty hitting the “.prototype” keystrokes. So, I kept looking.

{insert blaring horns of victory; or Fanfare…whatever your song preference}

public function onFCSubscribe(info:Object):void{
trace(“worked”);
}

public function play(connectionurl:String):void{
_netConnection = new NetConnection();
_netConnection.client = this;
_netConnection.connect(connectionurl);
}

That’s it right there. _netConnection.client = this; is the fix. What it tells the server-side actionscript is “when you want to return calls, return them on my client property.” So, since “client = this” all of the calls from FMS back to my client will run inside of “this”.

{long sigh}

Man…I feel a little cleaner now. 🙂 Well, that fiasco is over so I need to head to the house. Ping me if you have any other questions here.

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.

AS2 Events & Constants Work-around

Going from AS3 (Actionscript 3) to AS2 is a bit of a struggle at times and at “work”:https://www.llnw.com I’m mainly in AS2 for a few projects I’m working on. So, one of the things I’ve been doing is creating every app using events so I have a base EventDispatcherBase class that mimics the AS3 EventDispatcher. All classes, that need to, extend EventDispatchBase and, to follow how things go with AS3, your event names are constants of either the event or your class/mxml file.

For example, you would dispatch an event like this in AS3:

bq. dispatchEvent(new Event(Event.COMPLETE));

In AS2, you dispatch like this:

bq. dispatch({type: “MyType”, target: this});

So, my EventDispatchBase has a dispatchEvent function which does the above by takes an IEvent (interface) as an argument. My event dispatching in AS2 looks like this:

bq. dispatchEvent(new Event(Event.COMPLETE, this)); //where “this” is the target in most cases

I added the “this” argument for specific cases where I wanted to specify a child of my present class as the target.

Now…how do I keep all of my event names in check AND insure new developers working with the code do not jack up my event calls? Constants. Well…wait…AS2 doesn’t have constants so how do I use them? I’m glad you asked.

bq. public static function get PLAY_VIDEO():String{ return “PLAY_VIDEO”; }

A getter function is nothing more than a read-only property. Using a getter with no setter ensures your event name cannot be changed. One thing to not is I’m returning the string direct vs storing it in a variable.

bq. private var _playVideoEvent:String = “PLAY_VIDEO”;
public static function get PLAY_VIDEO():String{ return _playVideoEvent; }

The reason is due to AS2’s loose nature of allowing you to access private vars in a class by using code like this:

bq. trace(myclass[“privatevarname”]);

Anyways…this is my little rant for the day. I have all sorts of lil’ random information I want to blog about daily but I never take the time to do it. I’ll try to do it more often though.

Flash CS3 AS3 RPC

My recent “RIAForge”:https://www.riaforge.com email showed a new project added called: “Flash CS3 AS3 rpc (WebServices, Remoting)”:https://cs3as3rpc.riaforge.org/.

Now, I haven’t tested this or anything so don’t hold me to it. 🙂 Let me know how well it works if you test it.

Thanks Johan!

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.

AS3 Spell Check Engine – gSkinner

Grant, and the guys at gSkinner, has done it again. If you have a need to use Spell Checking and have a pretty penny to spend on it, this is probably your best/fastest solution.

“Read more here”:https://www.gskinner.com/blog/archives/2007/10/spell_check_eng.html

To Command or not to Command

I’m contemplating an approach to this IM/Chat application I’m about to build and the “Command Pattern”:https://www.johncblandii.com/2007/09/desert-code-camp-day-1.html came into mind. Here are my thoughts…please respond and let me know what you think of the approach.

(more…)

WebORB Kinda Rocks!

The “WebORB Preso by Mark Piller”:https://www.johncblandii.com/2007/09/azfpug-september-meeting-webor.html was given tonight for “azFPUG”:https://www.gotoandstop.org. I knew the majority of the info Mark talked about having toyed with the product before but there were a few things I didn’t know. On the “WebORB Mailing List”:https://tech.groups.yahoo.com/group/flashorb/ I have made numerous comments about licensing (has been months but you should be able to find it in the archives). Well, now I see why it has the price tag(s) it does and definitely see the benefits of using it.

First, I didn’t know you could stream videos from it. That gives you Flash Media Server capabilities…very nice.

Secondly, I didn’t know you could use Remote Shared Objects (for sharing data between connected clients). [another feature of FMS]

Thirdly (is that a word? lol), I didn’t realize WebORB generated messaging code. So, you can go from 0 to 59 with the last 1 being your own custom UI. That’s great and for those not familiar with messaging, it is a way to allow data to be pushed to clients vs the client apps constantly polling the backend for data.

All of this is possible through .NET, PHP, Ruby, Ajax, and Java. Very nice!

The guys at “Midnight Coders”:https://www.themidnightcoders are doing some great work. I highly suggest looking into WebORB. Their admin console truly kicks butt!

UPDATE:
I forgot to add Silverlight to the technologies you can use WebORB with. 🙂 They haven’t released it yet but they are working on it.

azFPUG September Meeting: WebORB Preso

https://www.gotoandstop.org/index.php/2007/09/23/september-07-meeting-mark-piller-on-weborb/

I’m excited about this meeting. I’ve been around the WebORB community for a while now but have yet to really get into it. This preso will help me take the first step(s) into the world of WebORB by seeing an end to end solution as presented by Mark Piller (the man over at Midnight Coders).

Hopefully you’ll come out or join us in the Connect room!

Free Flex Training for 30 days

bq. “Get Adobe Flex Training Tutorials – 30 Days Free at Total Training™ Online
Welcome Adobe Partners. What better way to learn Adobe® Flex® 2 than from Adobe Flex team veteran James Talbot and Adobe Certified Master Instructor Leo Schuman!

bq. For a limited time, Total Training™, the leader in comprehensive, high-quality, interactive, software training, is offering 30 day access to over 17 hours of our Adobe Flex 2 online training titles, absolutely FREE.

bq. How to Redeem
Sign up now to get your 30 day FREE subscription and start learning Adobe Flex 2.0 from the pros today. Complete the required information and Enter Activation Code: 29fa706d Once you input the activation code your 30 day subscription will begin.”

“Sign up here”:https://www.totaltraining.com/Store/online_adobe_login.aspx.

Flex 3 Cookbook site

I just found out about this so I figured I’d let everyone know since it looks like a great resource.

Several people know I love “Peter’s work over @ blog.flexexamples.com”:https://blog.flexexamples.com and this is along those lines. “Flex 3 Cookbook”:https://www.adobe.com/cfusion/communityengine/index.cfm?event=homepage&productId=2 is a site hosted on adobe.com which allows the following:

* Find solutions to your Flex-related problems.
* Publish solutions you have created for the greater Flex community.
* Comment on solutions created by others.
* Opt for a chance to have your solution published by O’Reilly.
(source “Adobe.com”:https://www.adobe.com/cfusion/communityengine/index.cfm?event=homepage&productId=2)

This is also akin to the “ColdFusion Cookbook”:https://www.coldfusioncookbook.com/categories “Sir Camden”:https://www.coldfusionjedi.com hooked us up with about a year ago or so.

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…)

AS3: Remove HTML RegEx

I was working on an app and needed to remove all HTML instances in a string. Well, that same functionality was needed elsewhere so…I created a class.

/**
* String Utility functions
* @author John C. Bland II
* @version 0.1
*/
 
package utils{
public class StringUtils {
 
public static function stripHTML(value:String):String{
return value.replace(/<.*?>/g, "");
}
}
}

To use it you simply:

trace(StringUtils.stripHTML("some html string"));

Hope this helps someone.

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! 😀