Archive for March, 2011

If you are using a Mac OS, you may come across a situation where you are not able to see the collection in the Pivot viewer, while you will be able to see the same collection in Windows/Linux. And this can happen in the case of both when the cxml comes from a file or it is generated dynamically using the PivotServerTools JIT collection. There can be multiple reasons for this:

  1. The website that hosts the cxml doesn’t have anonymous access on. If this is case, just switch on the anonymous access and you should see the collection now.
  2. This case is usually found to be obstacle. It comes because of an incompatibility between Mac and PivotViewer’s DeepZoom. The DeepZoom bug is reproduced on all the Mac browsers if the “source” attribute for your items in the collection’s dzc file is empty. To see if you are the victim of this, do the following:

    1. Try to navigate to your .cxml from a browser on the mac. Make sure it comes back i.e. if the URL of your collection is, visit this URL and see if the cxml is populated in your browser. In case of chrome, you’ll have to right click on the page and click on “View Page Source” to see if the collection is coming back.
    2. b. If the cxml is returned, find out the dzc from it. You can find it in the “ImgBase” attribute of the “Items” tag; it’ll look something like “collection-5f7c6a376516425598d3d822d2bd3cbf.dzc”.
    3. c. Then try to navigate to your .dzc file from the same browser, the URL will now be and see if the dzc is sent back. Again in chrome, check the Page’s source to see the result. The collection returned will now be something like this:

	<?xml version="1.0" encoding="utf-8" ?>
	<Collection MaxLevel="8" TileSize="256" Format="jpg" NextItemId="183" xmlns="">
		<I Id="0" N="0" IsPath="1" Source="items-5f7c6a376516425598d3d822d2bd3cbf/dzi/0.dzi">
		  <Size Width="256" Height="256" />
		<I Id="1" N="1" IsPath="1" Source="items-5f7c6a376516425598d3d822d2bd3cbf/dzi/1.dzi">
		  <Size Width="256" Height="256" />
		<I Id="2" N="2" IsPath="1" Source="items-5f7c6a376516425598d3d822d2bd3cbf/dzi/2.dzi">
		  <Size Width="256" Height="256" />
		<I Id="3" N="3" IsPath="1" Source="items-5f7c6a376516425598d3d822d2bd3cbf/dzi/3.dzi">
		  <Size Width="256" Height="256" />
		<I Id="4" N="4" IsPath="1" Source="items-5f7c6a376516425598d3d822d2bd3cbf/dzi/4.dzi">
		  <Size Width="256" Height="256" />
		<I Id="5" N="5" IsPath="1" Source="items-5f7c6a376516425598d3d822d2bd3cbf/dzi/5.dzi">
		  <Size Width="256" Height="256" />

This dzc file contains the information about the DeepZoom for the collection items. Here what you have to check is that for an item you have the value in the Source attribute. If there’s no value in the Source attribute i.e. Source=””, then we have a problem. And this is what brings us to the DeepZoom bug on the Mac OS. So if you can be put a value to this Source attribute even though a fake one (Yes, I said fake), you will start seeing the collection. It’s funny how an attribute whose value doesn’t matter can be so problematic (FYI, the source attribute is used for getting the DZI). If you are doing a JIT collection, the reason for this could be that the size of your images used for the collection items is 256 by 256. You can check this by debugging the “PivotServerTools” project, go to PivotServerTools à Internal à MakeItemContent

	string source = string.Empty;
	if ((null != item.ImageProvider) && (null != item.ImageProvider.DziPath))
		source = item.ImageProvider.DziPath;
	else if (IsAutoGenerateDzi)
		//Only provide an auto-DZI if the image is larger than a collection tile
		if (null != item.ImageProvider)
			Size size = item.ImageProvider.Size;
			if ((size.Width >= TileDimension) || (size.Height >= TileDimension))
				source = DziSerializer.MakeDziPath(m_collection.CollectionKey, id);

	yield return new XAttribute("Source", source);

Check here what the exact reason is and correct it else you can use a fake URL to get it working. Enjoy!

When you are using dynamic collections with PivotViewer i.e. JIT collections generated using the PivotServerTools, there comes a situation when the Pivot Viewer stops taking the fresh data from the server. This is because the Pivot Viewer caches the collection, so when you reload the collection again (in the same session), it doesn’t ask the JIT server for the cxml again and instead uses the cxml from the cache. This is good in terms of the performance however it’s bad if your data keeps on updating at the server and you are not able to reflect the latest data in your collection. What you should know is that the PivotViewer caches the collection based on the URL that you pass in the PivotViewer’s LoadCollection method, so if you call the method:

PivotViewer.LoadCollection(“url”, “viewerstate”);

again and again without changing the url parameter, only for the first call data will be fetched from your server, for all subsequent calls PivotViewer will take the collection from the cache. To avoid this, you have to keep changing the URL, whenever you call the above method. The best way to do it, is to add a query string parameter which you may/may not use and update it every time you load the collection. You can do something like below:

PivotViewer.LoadCollection(“url”+ “?guid=”+Guid.NewGuid(), “viewerstate”);

this adds a new query string parameter “guid” to your url who’s value change every time you load the collection and since it’s a different url, PivotViewer doesn’t find the collection in its cache and hence sends a call to the JIT server to get the new collection. Therefore, you will always see fresh data in your collection but what you should keep in mind is that this will degrade the performance of the PivotViewer (but only at the time of loading), so what you can do as a further tweak is only change the guid parameter when you need fresh data in your collection and in all the other cases you can use the url with the same guid parameter which will help in keeping the performance of the PivotViewer intact, this tweak will be a boon if your JIT server takes time for generating the collection and the data is not updated always.

Happy Coding 🙂

I have been working around with the Silverlight Pivot Viewer for long time now and I have noticed that whenever I use a JIT collection I dont see Description in the facet panel but when I use a static collection, Description is available. First I thought maybe description facet is not allowed in JIT collections but then I remembered that the Collection class constructor does ask for Description in its parameter, this made my curious and I started dive into the code of PivotServerTools Project and I found that there’s no place in the code where this Description is used apart from when creating the default item images. After a lot of searching I was able to find a solution using which Description can be made visible. To do so, follow the below steps:

1. Go to the PivotServerTools project.
2. Open the Internal folder.
3. There you’ll see a “CxmlSerializer” class, this class is used when the method Collection.ToCXML() is invoked, which is done by the Pivot Viewer. Open this class and navigate to the method “MakeItemContent”. In this method add the following line:

if (!string.IsNullOrEmpty(item.Description)){
	yield return new XStreamingElement(Xmlns + "Description", item.Description);

This way Description will start showing up in the Facet panel of every collection provided you specified a value for it in the Item’s collection class constructor.

Ever reached a situation where you see the error message “The application ‘/’ does not exist” in IIS 7. This may be due to the fact that you created a site in IIS first and then deleted the physical folder from your hard disk and after you have deleted the folder, if you go to IIS and try selecting the site’s node under the Web site section, you’ll see this alert message. In order to get rid of this error, you can do two things:

  1. If you want to keep this application, create a folder with your code with the same name and at the same location as before (when you created the site) and the error will go away.
  2. If you want to delete this application, then you can do the following:
    1. Create a folder as we did in Step 1 and then go to IIS. This time you will be able to select the Website’s node, right click on the site and click delete and then you can delete the dummy folder too.




    2. Open in the Command Prompt with Administrator Rights and then write the following command and press enter:

    \Windows\System32\Inetsrv\AppCmd.exe delete site “Your Site Name”

This will you will be able to restore\delete the site and get rid of the error message.