SiteFinity - using SWF files

I've finally had a chance to continue with my POC to try to integrate my SWF file into SiteFinity. It went pretty smoothly but there was quite a bit of manual work. I haven't had a chance to look at version 3.6 of SiteFinity yet, I hope later versions would have a control that would handle the browser initialization of the SWF file and helping take care of the reference to the SWF file.

I've heard a lot of buzz about swfobject which is a JavaScript based framework that instantiates Flash based content regardless of browser, I decided to try it out to see how I would like it. After working for a Fortune 500 company, you learn to worry about what license any open source projects uses, swfobject uses the MIT license which is a plus. It has a nice wizard that will help you set up the appropriate attributes which really helps when you're unfamiliar how to use it in the beginning.

In SiteFinity, the only way I have found from my initial research is to add it to the Master Page. Hopefully there's a better way than to be forced to have the user get the JavaScript downloaded to the browser or have to add a custom user control if you just have a handful of pages where you use SWF files. I decided to just link to the Google Code repository but you probably want to include it in your website in production scenarios.



I just uploaded my SWF file to the Files section in SiteFinity and then added it via an OBJECT tag in a Generic Control. I have not been able the get the file reference of the SWF file to be resolved inside the OBJECT so I can use a relative reference like for the server side controls in SiteFinity. Instead, I've had to put the full URL to the file which is a pain point if you have separate QA and Production environments. It appears that others in the SiteFinity forums also have struggled with this but hopefully I'm just overlooking something.



The actual page shows the SWF file as we would expect.



It is a relatively easy process to add a SWF to SiteFinity but hopefully there will be an easier way to add it in the future and control it better.

eBay integration in Flex

Work has been quite demanding lately but hopefully I will be able to post more regularly now.

I had planned to integrate eBay into SiteFinity via custom user controls but I decided to instead write the integration in Flex and integrate that into SiteFinity. It will make it easier for my client to add new versions since I only need to give them the SWF file and they can upload it themselves. I already know that we will need to support both search functionality for eBay auctions and ability to list items for auction and possibly other types of functionality. I decided to create a POC first and integrate that into SiteFinity before adding more interesting functionality. I focused on getting the infrastructure set up before making it look spiffy. In this post I'll show how to create the Flex binary. The SWF and source code has been posted here.



I decided to use one of the Flex MVC frameworks because I already know I will need to support several screens and it will make it easier to support. I picked the Mate framework, because it fits so nicely into Flex and it's non-intrusive. Mate strongly encourages you to separate the logic into views, event maps, events and business objects shown below.



The communication between the view and event handlers is handled via the Event Bus. An event is dispatched from the view and the event bus figures out which event map that listens for the event that was dispatched. The event map calls services and/or business objects. Commonly the event map also have injectors that binds properties in the view to business objects.

The event map in my POC is relatively simple displayed below.



This event map listens for the event SearchRequestEvent.GET and calls a business class SearchInvoker. This class makes a call to eBay using their Flash based API and dispatches either a success event or a fault event that gets handled inside the event map.

The event map also has Injectors that sets up the binding between properties in the view to the SearchManager. These injectors are initialized first before any custom events gets dispatched from the view.



The next step will be to add the SWF to SiteFinity.

Manning rocks!

It seems like everyone is getting a bad customer experience these days. I bought a MEAP early access book from Manning last year called "Unlocking Facebook". In October, the author wrote that Manning had cancelled the book. I was going to contact Manning but you can only contact them by calling them so I gave up. This week they sent me an email and let me have a refund OR two books of same type! Now that is great customer service!

I'm going to be busy reading Nhibernate In Action and ASP.NET MVC In Action now. Good stuff.

Taking a look at the Ebay API's

Work has been quite challenging as of late but I finally have some spare time on the weekends again. One of my planned tasks have been to integrate Ebay listings into SiteFinity. This was something that our charity originally requested during the charity event in January but we never got to it. Now after I've had a chance to look into Ebay's API, I can tell it would have been impossible unless I had known then what I know now about their API's.

Ebay has a developer web site which describes all the various API's they have available and sample code. They have different types of API's depending on what I intend to do, i.e. if you want to sell or buy or look at historical data and so forth. They also have a number of different stacks you can use depending on your platform: library based, SOAP based, XML over HTTP and REST. Their site is a little messy and I couldn't find anywhere where they show all the options you have, you have to dig around. I decided to use the Trading API based on what I am interesting in doing and decided to use the SOAP API.

I first downloaded the SDK for .Net with samples to take a quick look. Apparently, all the samples appears to be using their library. Surprisingly, the samples were built with VS 2003/.Net 1.1 and it was not a smooth process to VS 2008/.Net 3.5. Apparently they have a dependency on the J# Redistributable Package so I had to search their forums and download the Redistributable Package just to be able to even compile the sample. Bad customer experience. However, they have some samples that are more up-to-date in the Knowledgebase and other sections at their developer web site.

I'm a little surprised how companies like Ebay and Amazon appear to be pushing their libraries if you want to integrate with them. Is that what developers actually ask for or is it just a bad idea conceived by someone in their marketing departments? I don't like to add a dependency on a third party library unless it has a compelling set of features that really makes everything so much easier. In this case because it appears that they want to have some of the assemblies in the GAC and my code will be hosted at a hosting provider, it seemed like a bad idea to me. Maybe I haven't looked into it in enough depth but I don't see that it's much easier than just using one of their other API's directly.

I decided to either to use their SOAP API or their REST API. I'm inclined to call their "REST" API a STREST API since it's not resource based at all, you just dump the request at one service endpoint which really defeats the purpose of using REST. Their SOAP API is not a lot better, it consists of one single massive 4 MB WSDL file. Their API's just seem to be based on their old XML over HTTP technology and the only thing that is different if you use a different API is the notation. You have to specify both the operation you want to invoke and the authentication in the service endpoint like this:

https://api.ebay.com/
wsapi?callname=AddItem&siteid=0&appid=myappid&version=511&Routing=new

This is a poor design IMO, there's no reason why they can't derive the operation and authentication from the message. If you use their SOAP API, you have to specify both authentication and the operation you want to invoke in the SOAP body as well. I'm disappointed in their design decisions and I hope no one uses Ebay as a good example to follow. Frankly, I had expected a lot more based on their good reputation in general.

If you decide to use their SOAP API or their REST API, I recommend you use a web service testing tool to verify that your calls work correctly instead of having to write a bunch of code and running into issues and either having serialize the request or have to use a HTTP Proxy tool to be able to troubleshoot it. I prefer using soapUI because the rich feature set and that they have a free version but there are a number of other tools you can use, I'm not aware of any other free tools though. SoapUI also has a professional version with more features but I have never looked into that. Here's an example of the GetCategories call in soapUI:



However, some of their other operations are quite complex like AddItem. It might be more benefical to just use a tool like this to easily see all the options instead of trying to get it to run because of the large number of options. Thankfully, they have really good documentation online that describes all the various options and the available values when it's restricted.

In my case, the operations that are of interest to me is GetCategories to get all the various categories and AddItem which lists an item at Ebay. Now when I have figured out exactly what operations I need to invoke for the functionality I am interested in, I will try to get it to work in SiteFinity.

Telerik SiteFinity - first impression

At the We Are Microsoft charity event last weekend, our team decided to implement a solution using a CMS product so they easily would be able to update the content. We decided to use Telerik SiteFinity based on the repution of Telerik and the fact that they had developer training the first day. Perhaps not the strongest reasons to pick a product but in our case we did not regret picking SiteFinity. The Web CMS Report have categorized the most well known CMS products, SiteFinity is categorized "Mid Market Challengers" which from what I can tell is an accurate categorization.

We used SiteFinity version 3.5 SP 1. The intial setup was a bit painful because the MSI installer didn't work too well on my Vista laptop but thankfully evengalist Gabe Sumner pointed out during the training that you can download a SiteFinity Visual Studio solution from sitefinity.com . The solution file is a Visual Studio Web Site template, I would have preferred a Web Application Project but I assume it's easy enough to change if you really want to change it.

SiteFinity plugs into the regular VS template pretty nicely. You will without a doubt want to add your own master page and the good news is that you just add it like you would in a normal ASP.NET web site. You need to add a script manager in the markup though like this:







You also need to add a theme to the App_Themes folder. This is where you put your css files and images that you use in the header/body/footer via your master page. Once you restart your worker process or the web server if you use Cassini, both the master page (template) and your theme should be visible once you edit a page. If you select a the template and the theme you created earlier, you should get the look and feel your expecting.





This is the basics to set it up, I will go into more detail after adding more functionality.

What I like about SiteFinity so far:

  • WSIWYI Editor for editing content.
  • Very easy for non-technical people to learn to use with a little training. Of course, you still need to know some basic HTML to make it look right.
  • Workflow enginge in the Standard version, which is nice to have. I haven't had a chance to use it yet though.
  • User controls hooks into SiteFinity in a nicely, allowing drag-and-drop in the GUI. You do have to add an entry into the web.config file though.
  • It's relatively inexpensive, I don't think $899 is much money for a commercial organization for a CMS product where you get support.
What I don't like:
  • All pages appear to use ViewState by default, whether it's static text only or a form. I think ViewState in general is way overused in ASP.NET web forms in general, I wish Telerik didn't fall into this trap as well but perhaps there's a good reason.
  • I really don't understand why even images must use an Httphandler ASHX but perhaps it's not as heavy handed as it seems to be.
  • Error handling seems a little sparse. Both during the setup and if it can't find the database when you run it, you get uncaught exceptions.
  • ASP.NET 3.5 has been out for a good while now, you expect products to use 3.5 instead of 2.0 by now.
All in all, I really like this product and I'm glad I got a chance to try it out. The road map for version 4 looks pretty interesting. I wish they would have mentioned using the ASP.NET MVC framework instead of the ASP.NET Web Forms though.

We-Are-Microsoft charity event - wrap-up

I just got back from the charity event We Are Microsoft hosted in Dallas. It was a wonderful event, so many charities that all were worthwhile causes. I met a bunch of wonderful people, it is amazing that so many people were willing to give up a full weekend away from their families. I think the final tally was over 170 people including developers, designers, charities and event staff. It was very exhausting weekend of coding and little sleep but great to see that all charities actually received a fully working web site. Chris Koenig and Toi Wright put together a really great event plus all the volunteers.

Our team built a web site for the shelter New Beginning Center using Telerik Sitefinity as the CMS of choice. The new website isn't quite ready yet but will hopefully be up in the next few weeks as we're working on the finishing touches.

None of the guys on our team had any prior experience using SiteFinity but thankfully it was relatively easy to use. Telerik also had two great developer evengalists, Gabe Sumner and Todd Anglin who really knew the product well and were great at providing feedback. I will post later this week what I liked and disliked about SiteFinity.

ASP.NET MVC - StoreFront

Like so many others in the .Net community, I've been looking at the ASP.NET MVC framework lately which as of this writing is currently in beta. I really like what I've seen so far but YMMV. It seems like many developers that have experience using MonoRail have raised quite a few concerns. Obviously, MonoRail has been around for quite a while and have a lot more features and some of the design decisions may make MonoRail more extensible than ASP.NET MVC ever will be.

I've used the User Interface Process (UIP) Application Block previously in some projects and ASP.NET MVC is quite impressive compared to UIP :-). I really like that you can replace the view engine and that the aspx pages are so much more lightweight compared to Web Forms.

One of the more fascinating sample applications that I have seen come from Microsoft as long as I can remember is the MVC StoreFront by Rob Conery. It is so refreshing to finally see a sample application that has some complexity. It takes quite a bit of time to go through all the video's but is well worth it where Rob goes through using ASP.NET MVC and concepts like Dependency Injection, TDD, Mocking and even Domain Driven Design. It's a little bit confusing that the first 23 video's are at ASP.NET / MVC while also all the previous and new episodes (25 and forward) with topics like Domain Driven Design is at Rob's blog. There are a ton of good comments at his blog so that's the best place to go to.

The MVC StoreFront is just a tremendous learning experience using a variety of frameworks that may be useful in your projects. Extra plus that Rob doesn't just "pimp" Microsoft solutions and educate the use of some OSS frameworks.