WebORB licensing restrictions removed

30 09 2008

Until very recently, the Flash remoting solution, WebORB, was limited in that it couldn’t be used in a Software as a Service (SaaS) instance without a valid support plan. That meant a yearly fee of a few thousand USD.

However, I have been informed today that this restriction has been removed.

Having read it myself, I can confirm that WebORB license now allows the solution to be used in software applications that earn themselves an income.

From the license itself: (please follow the link above for the actual wording)

“… and does not prevent developers from using and bundling Software with higher level applications that run on these platforms….”

Flex, .NET 3.5 with LINQ to SQL part 2 (synchronising from Flex to LINQ)

29 09 2008

March 2009: This post is outdated, please see the latest article on FLEX & LINQ:




So, getting your objects from your .NET 3.5 Linq to SQL setup to Flex is fairly easy. Getting the changed data back and synchronised to your DB is a different story.

The great thing about LINQ is that the data you retrieve and modify in .NET will automatically sync back to the DB by calling the SubmitChanges() method on your context (Linq to SQL) object.

The problem is of course when this data comes back in from Flex, the system doesn’t know what exactly has changed.

Now, the first thing to realise is that your Value Objects in Flex should NOT have the foreign key IDs in them. Why? Because say in the Company/Employee example, if you submit a Company object back to the system, with each Employee in the list having both a CompanyID AND a Company object reference, how will the LINQ system know which is the correct reference?

These foreign IDs will try to get serialised on the remoting level and be ignored. Good. We’re dealing with object references now, and foreign key ids are useless. If I want the foreign key of some employee, I would say: EmployeeObj.Company.CompanyID

Now, in .NET, I have a “Save()” method that I want to essentially insert/update the object and all objects within in.

Using the example before, say I have a company object, and that has a list of Employees. Then if I have a Save(Company c) method, I want the company object to insert/update, and the list of employees to automatically synchronise.

You can try deleting the old object and then inserting the new


SaveCompany(Company newCompany)

DataClassesDataContext db = new DataClassesDataContext();
if (newCompany.CompanyID > 0)

Company oldCompany = db.Companies.Single<Company>(c => c.CompanyID = newCompany.CompanyID);

This will nicely handle an insert/update of the company object, but it won’t deal with your Employee objects that well. Especially when each Employee references anthor table that essentially depicts there type./

Say each Employee has a foreign key reference to EmployeeType. Employee type is a static naming table that has a set of 5 records: “Manager”, “Sales Coordinator”, “Receptionist”, “Consultant” and “Helpdesk”. Then my Employee object will have an EmployeeType property (loaded via LINQ). Now, when this goes through LINQ, I believe during the serialisation, the creation of a “new” object EmployeeType will mean that the code above will create a new EmployeeType record for the Employee. Ouch.

So even though you may have sent all the employees through LINQ to Flex via a Company object, when it comes back, even if unchanged, all these employees will have references to new EmployeeType objects.

The way to solve this is fairly easy:

foreach (Employee e in newCompany.Employees)
   EmployeeType type = db.EmployeeType.Single<EmployeeType>(t => t.TypeID == e.EmployeeType.TypeID);
   e.EmployeeType = type;

oldCompany.Employees = newCompany.Employees;

Unfortunately, it’s not an easy process to learn how exactly to handle each scenario in synching LINQ and Flex, but one thing’s for sure, it certainly makes code lighter, and a lot easier to update.

Flex, .NET 3.5 with LINQ to SQL

23 09 2008

March 2009: For more information see the latest article on FLEX & LINQ:



I had certainly delayed looking at LINQ for too long.

After seeing a screencast on some of the new features in ASP.NET I noticed the very handy LINQ to SQL item.


Let’s just say I’m not using strongly typed datasets anymore.

LINQ provides strongly typed access to your database (tables, views, sprocs and function) while also allowing you to query those results.

Whilst many still advocate the use of stored procs for larger and more advanced or intensive queries, at least some of the simple overhead can be reduced. Furthermore, updating your C# classes to reflect your DB is as simple as updating the LINQ to SQL item.

But the major advantage from a Flex remoting perspective is how easy it is to have all this returned data in your client.

Say I have three tables: (already linked with relationships via foreign keys)

Employee, Company & Position

I add the LINQ to SQL item to my solution. Inside, I connect the LINQ object up to the db and drag in my database objects. Voila, I have the strongly typed classes: “Employee”, “Company” and “Position”. None of this DataRow, DataTable, DataAdapter business.

Using LINQ syntax, I can do simple queries on the spot, like:

DataClassesDataContext db = new DataClassesDataContext();

var data = from e in db.Employees where e.CompanyID == someCompanyID select p;

List<Employee> employees = data.ToList<Employee>();

Now, I can return this list to either FluorineFx or WebORB and the ArrayCollection that the List is serialised into will contain an array of Employee Value Objects (my Employee.as file). Nothing special there.

BUT, the “Company” property is also provided. This is the Company property that is automatically generated in LINQ to SQL that provides the foreign key reference to the company.

This holds for all your foreign keys.

So if you want to reduce your overhead from a C# (writing classes for your db objects) and DB perspective (writing sprocs for every data call), then take a gander at .NET 3.5.


  • If you weren’t aware, .NET 3.5 framework is actually an addition to .NET 2.0. This means that once you install the framework on a machine, no manual IIS settings are required (as opposed to the 1.1 to 2.0 switch) to activate 3.5 on a website or virtual directory.
  • Both FluorineFx and WebORB support .NET 3.5

Flex 3 : IE 6 : SSL and mixed secure items

9 09 2008


This wasn’t a fun one to try to debug.

Essentially, I moved a flex project over to SSL. This meant a simple header redirect on all requests and using the Secure AMF channel for remoting. No problems.

But wait, IE 6 starts throwing me “This page contains both secure and nonsecure items. Do you want to display the nonsecure items?”

This will be familiar to many people, and it would probably be acceptable if it didn’t keep reloading the page no matter which button I pressed.

One word – WTF? I checked EVERY link and reference and everything was relative and thus HTTPS. FireFox reported that everything was hunky dory, even the favicon, so WTF?

Turns out IE6 doesn’t like iFrame tags without a SRC attribute. Fine. But so what? I’m not using iFrames without SRC tags. Hangabout, checking history.js which is deployed alongside any Flex app, you’ll notice around line 381:

var _initialize = function () {
if (browser.ie)
var scripts = document.getElementsByTagName('script');
for (var i = 0, s; s = scripts[i]; i++) {
if (s.src.indexOf("history.js") > -1) {
var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
historyFrameSourcePrefix = iframe_location + "?";
var src = historyFrameSourcePrefix;
var iframe = document.createElement("iframe");
iframe.id = 'ie_historyFrame';
iframe.name = 'ie_historyFrame';
//iframe.src = historyFrameSourcePrefix;
try {
} catch(e) {
setTimeout(function() {
}, 0);


Notice the commented line? Strange. I’m not sure why it’s been commented by Adobe, but this is our problem right here. This iframe is causing IE6 to have a cry under SSL.

I’ve uncommented it and since I’m using BrowserManagement instead of HistoryManagement, have found that everything is worked as expected. I’m too tired to go looking to see what minute repercussions there may be, but if anyone has anything to add, please be my guest.

Getting started with Flex 3 and Flash Media Server 3

4 09 2008

This is a just a brief get up and go starting off with Flash Media Server 3 and Flex 3.

For the purposes of this discussion, I’ll be using Flash Media Development Server 3.

The goal of this post is to have two videos streamed into a Flex app – one a live stream, the other a recorded stream.

What you’ll need:

  1. Flash Media Development Server 3 …. free download
  2. Flash Media Encoder 2.5 … free download
  3. a web cam & a mic

So to start off, you download and install the Flash Media Development Server 3 software.

Once installed, jump into the Flash Media Administration Console to have a look around. Guess what – there’s not much to see yet.

Now install the Flash Media Encoder software.

This will take the streams coming in from your webcam and mic and convert them to video. Whilst it’s running – you have a live stream running in “rtmp://localhost/live/livestream” and if you stop it running, it will save a FLV file in the “My Videos” folder of your user.

So do a short 20s video and stop the encoder. You should have a small FLV sitting in “My Videos” called “sample.flv”. This you can copy to your video-on-demand’s media folder which is under “applications/vod/media”.

Now, start the encoder again but leave it on to generate a live stream.

In Flex, write a small app that has two VideoDisplay controls – one for your live stream and one for the video on demand.

<mx:VideoDisplay source=”rtmp://localhost/live/livestream” live=”true” autoPlay=”true” />

<mx:VideoDisplay source=”rtmp://localhost/vod/sample.flv” autoPlay=”true” />

When you run the app, you’ll see your stream and your video, running side by side.