October 26, 2010

SSIS Error Code DTS_E_PRIMEOUTPUTFAILED

Recently, while working on a db integration using SSIS, I had encountered a generic error while working with an XML Datasource: Error Code DTS_E_PRIMEOUTPUTFAILED. There are several scenarios that can produce this error, and there also was another message specifying that the offending element was at character 14988 in the XML. The data at that point in the file looked fairly straightforward, which then led me down the path to thinking the file size might be the problem:

<word>with</word>
<word>a</word>
<word>vegetable</word> <- supposedly offending line
<word>white</word>
<word>rice</word>

After whittling down the data for a test, the problem still existed, so the problem wasn't file size either. It ended up just up being bad data... there were several ampersand (&) characters throughout the file.
The error message referencing character 14988 was just a confusing diversion. After scrubbing the data, SSIS was then able to successfully parse the file and use it as a datasource.

Here's a quick reference to characters needing to be escaped within XML, and their associated escape sequences:

Ampersand(&) - &amp;

Greater Than symbol (>) - &gt;

Less Than symbol (>) - &lt;

Double Quote (") - &quot;

Single Quote (') - &apos;

Share |

December 16, 2009

Facebook ActionScript API - Overall Architecture

The last few posts talked about setting up your Facebook app and Flex e nvironment, now let's look at how all the pieces fit together. There are several ways to call the Facebook API via Flex, but we're going to focus on creating an IFrame application. There are other ways to interact with Facebook, like as an FBML application, or even as a desktop AIR application Documentation of each type of interaction is available here. Here is the official diagram from Adobe on the architecture of a Flex IFrame app




I personally didn't Grok how it all fit together when I saw this diagram, so after I finished my first app, I whiteboarded this diagram.




1 - Your app. The url is http://apps.facebook.com/[your application name] . When this page appears in a web browser, the page contains an IFrame that references a URL on your web server.
2 - Your Facebook application settings point to your website. Facebook posts all required variables over the querystring into your containing HTML page, as well as reposting any other querystring vars, including any variable you may want to pass in.
3 - The index.htm file supplied from Adobe creates an array of all querystring variables passed into the page, and using the standard swfobject.js file, injects all variables into your .swf. I have usually had to tweak the code of this page to include/refine my personal application variables.
4 - Now your .swf is displayed within the IFrame on your Facebook application page, having evaluated all Facebook variables, as well as your own custom application variables.

Next post, we'll talk about some even easier ways to integrate a Flex/Flash app with Facebook, and talk about some best practices.

Share |

October 07, 2009

Facebook ActionScript API - Creating a Canvas/Project

In my last post, I talked about some prerequisites and things you might want to think about before integrating a Flash app using the ActionScript API. Now let's take a look at how to configure a Facebook canvas and get your local project set up.

The first thing you need to do to get started is to add the Facebook developer application by going to www.facebook.com/developers. This is just a Facebook application that allows you to register your application.


Once you've allowed access to the Facebook developer application, it's time to create your application and canvas. Give it a name and agree to the terms.


Once you've created your application, go in to Edit Application and you'll see that Facebook created an API Key and Secret for you. We'll talk about those later, but remember that you never want to give out your Application Key and Secret for security reasons. When the app is deployed we will be using a session-specific key created for us by Facebook when making our API calls, but during testing, we can use these codes to perform the calls locally.



Now we need to set up our Facebook Canvas. First in the box for the Canvas Page URL, give it the name you want your application to have on Facebook (apps.facebook.com/[yourappname]) in all lowercase. Then set the Callback URL... this is the path to YOUR server where the swf will be located. (It should be contained within an HTML wrapper page that we'll get from Adobe). We will be creating an IFrame application - in other words the page on our site will be "sucked into" an IFrame on our Facebook canvas page.


When we release, our application type will be Web, but for coding/testing/debugging purposes, make the application type Desktop, so we can just pop up a window to allow access, and test our Facebook API calls locally.


Now we need to download a few files from Adobe to set up our application in Flex (0r Flash).
First, get the Facebook-ActionScript-API from Google Code (http://code.google.com/p/facebook-actionscript-api/downloads/list).



Then get the iframe wrapper from http://download.macromedia.com/pub/developer/flexfb_iframe_wrapper.zip . After you unzip the file, you'll see it contains an html wrapper page for your swf, plus swfobject.js. We'll look later at what this html wrapper page does.


Now we need to go ahead and create our project in Flex Builder, make sure it's a web application.


In the libs folder, go ahead and add the Facebook library you downloaded from Google Code.


...Now you're all set to start development on your Facebook Flash application. That's a lot for one blog post, so next time we'll take a look at really Grok-ing how and where everything goes, as well as looking at other Flash-Facebook architectures as well. (A much more in-depth walk through is available on the Adobe devnet site).

Share |

September 29, 2009

Facebook ActionScript API - intro/gotchas

After delving into the Facebook-ActionScript API for the last few months, and finally getting an app listed in the application directory, I was kindly asked to give an overview/presentation of my thoughts on Facebook/Flash integration at the Adobe User Group on 9/29.

It was a one-hour overview, so there's way too much for a single blog post. So for this first posting in the series, here are a few gotchas/considerations to make before integrating a Flex/Flash application with Facebook:

1) You can't send invites or requests.
The ActionScript API for Facebook just doesn't contain calls to these methods. The closest thing you can do is send a notification using the sendNotification() api call that takes in an array of Facebook userids, and your text message or hyperlink. If you're not sure what a Facebook notification is, it's that little sign icon down at the bottom right of all Facebook pages, to the right of the Facebook chat window.




2)Autoplay is always set to false when embedding a .swf using FBML.

This is by design. I'm sure the reason for it is for Facebook to distinguish itself from MySpace with all the auto-launch junk on many pages. You are allowed to specify a placeholder image, so that needs to be part of your design decisions. Hopefully this isn't a show-stopper.

3)Security issues when accessing external XML files.
If your swf references an external XML file, within Facebook you will get a security violation. The suggested workaround is to reference it using a parent PHP container. Or you could embed the xml in your .swf, but I imagine it's external for application update-ability purposes, and that would defeat the purpose.

4)Inability to make the Sessionless API calls
There are a variety of Facebook calls that can be made without having a session key however, when making these calls via the ActionScript API, you will receive an 'invalid signature' error message if you do not have a valid session because the api calls via session.facebook require a valid session key (ie: the user must allow access to your application before you can make any calls). I am still investigating this... any other insights are most welcome. It would be nice to be able to forestall the "ALLOW ACCESS" prompt to you user as long as possible.

Well, now that all this negativity is out of the way, in the next post we'll walk through how to set up a new Facebook application.

Share |

July 11, 2009

Solution to that triangular golf tee peg game.

Last month we stopped at a Cracker Barrel on the way back from Northern Ohio, and they had one of those triangular games where you jump the golf tee pegs until you hopefully only have one left. They've been around forever - on the east coast, the Dutch Pantry restaurants had the same thing. Anyway, I don't know if I ever had solved one of these puzzles, except for pure luck, but my oldest son Johnny ended up finding a repeatable solution before breakfast even arrived. So here he is showing off his solution pattern in a youtube video.

Share |