Thursday, 25 February 2010

Coming soon to MapGuide Open Source 2.2


The problem stuck out like a sore thumb for the past 2 years, but as of the next release of MapGuide Open Source, Windows Server 2003 users can now choose the web site they want to install the MapGuide Web Extensions to!

Why did it take so long? Doing the custom action in .net would've been a piece of cake, but since we cannot afford the luxury of assuming the .net Framework as a mandatory requirement, we had to resort to doing the custom action in C++, which is no walk in the park. Thankfully, wcautil and IMSAdminBase provided the required tools to make this possible! Also, real world priorities had stolen whatever time I had to tackle this problem, until now.

Note that this applies to IIS6 only, as IIS7 uses a totally different form of configuration although we can still apparently use the same IMSAdminBase COM API, so if time/resource permitting I may be able to give IIS7 the same loving treatment.

Wednesday, 3 February 2010

Technical Question Etiquette

This post is a bit ranty, but I really need to get this off my chest.

On the same day where I lost over half a workday to some stupid Visual Studio problem, I had lost several more due to problems with another Microsoft product: IIS

The problem was that I had two IIS websites which weren't serving content. I did a check of the ASP.net versions and the host headers just to make sure nothing was misconfigured. I even rebooted said server to see if it would fix the problem to no avail. Event logs did little to help me, so with very few other options, I turned to the Oracle of Google for help.

Google was not kind to my pleas for help. There was only really one relevant result on the topic at hand, when I clicked on the result, the question pretty much was similar to mine. The only problem was, the reply to the question was from the original asker, which simply read:

Don't worry. I got it solved.

End of sentence. End of story.

I think as a general rule of etiquette, if you have a question and you somehow answered it yourself, please do tell us how you solved the problem because there may be others (like myself on that day) that have the same problem and would like to know how you solved it too!

/end rant

WPF + Geospatial Platform API = A recipe for failure

If you use WPF in your AutoCAD Map applications and you are using the Geospatial Platform API you may encounter something like this when designing any WPF content:



The type initializer for '<Module>' threw an exception.
at System.Reflection.CustomAttribute._CreateCaObject(Void* pModule, Void* pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs)
at System.Reflection.CustomAttribute.CreateCaObject(Module module, RuntimeMethodHandle ctor, IntPtr& blob, IntPtr blobEnd, Int32& namedArgs)
at System.Reflection.CustomAttribute.GetCustomAttributes(Module decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes)
at System.Reflection.CustomAttribute.GetCustomAttributes(Assembly assembly, RuntimeType caType)
at System.Reflection.Assembly.GetCustomAttributes(Boolean inherit)
at MS.Internal.ReferenceAssemblyUtils.SafeGetCustomAttributes(Assembly assembly, Type filter, Boolean inherit)
at MS.Internal.Xaml.ReflectionProjectNode.BuildNamespaces()
at MS.Internal.Xaml.ReflectionProjectNode.Find(Identifier namespaceUri)
at MS.Internal.Xaml.PrefixScope.FindType(XamlName name)
at MS.Internal.Xaml.XmlElement.FindElementType(PrefixScope parentScope, IParseContext context)
at MS.Internal.DocumentTrees.Markup.XamlSourceDocument.get_RootType()
at Microsoft.Windows.Design.Documents.Trees.MarkupDocumentTreeManager.get_RootType()
at Microsoft.Windows.Design.Documents.MarkupDocumentManager.CalculateLoadErrorState()
at Microsoft.Windows.Design.Documents.MarkupDocumentManager.get_LoadState()
at MS.Internal.Host.PersistenceSubsystem.Load()
at MS.Internal.Host.Designer.Load()
at MS.Internal.Designer.VSDesigner.Load()
at MS.Internal.Designer.VSIsolatedDesigner.VSIsolatedView.Load()
at MS.Internal.Designer.VSIsolatedDesigner.VSIsolatedDesignerFactory.Load(IsolatedView view)
at MS.Internal.Host.Isolation.IsolatedDesigner.BootstrapProxy.LoadDesigner(IsolatedDesignerFactory factory, IsolatedView view)
at MS.Internal.Host.Isolation.IsolatedDesigner.BootstrapProxy.LoadDesigner(IsolatedDesignerFactory factory, IsolatedView view)
at MS.Internal.Host.Isolation.IsolatedDesigner.Load()
at MS.Internal.Designer.DesignerPane.LoadDesignerView()


A nested exception occurred after the primary exception that caused the C++ module to fail to load.

at <CrtImplementationDetails>.ThrowNestedModuleLoadException(Exception innerException, Exception nestedException)
at <CrtImplementationDetails>.ThrowNestedModuleLoadException(Exception , Exception )
at <CrtImplementationDetails>.LanguageSupport.Cleanup(LanguageSupport* , Exception innerException)
at <CrtImplementationDetails>.LanguageSupport.Initialize(LanguageSupport* )
at .cctor()


Type constructor threw an exception.
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
at <CrtImplementationDetails>.DoCallBackInDefaultDomain(IntPtr function, Void* cookie)
at <CrtImplementationDetails>.DoCallBackInDefaultDomain(IntPtr , Void* )
at <CrtImplementationDetails>.LanguageSupport.InitializeDefaultAppDomain(LanguageSupport* )
at <CrtImplementationDetails>.LanguageSupport._Initialize(LanguageSupport* )
at <CrtImplementationDetails>.LanguageSupport.Initialize(LanguageSupport* )

Though you can still build and run the project, the WPF designer is completely hosed, all intellisense is lost and as a result, the WPF designer becomes a bloated version of notepad.

The reason that happens is because the Autodesk.Map.Platform.dll is actually just a thin managed wrapper to the unmanaged AcMap* dlls in your AutoCAD Map installation, so the WPF designer is actually trying to locate these dlls from either:
  • The project's output directory
  • Or, some special working directory that's defined by Visual Studio (where this is, I have no idea)
After 5 hours of sleuthing around, I have found an acceptable workaround.

Simply put the AutoCAD Map installation directory into your PATH environment variable and restart Visual Studio. The WPF designer will correctly locate the AcMap* dlls and you'll regain full designer functionality.

This little tip will no doubt be useful to someone out there. I lost 5 work hours so you don't have to :-)

Tuesday, 26 January 2010

FDO Cookbook

For any budding FDO developer, it's always good to have some code samples of how to use the FDO API to get started.

Well, it just occurred to me that the FDO Developer's Guide has been updated with a whole new chapter (Chapter 13: FDO Cookbook) full of such code samples covering all the major general API usage scenarios.

But here's the catch, it is NOT the FDO Developer's Guide that's currently in the documentation area of the FDO project home page. That one is not the current version. The current version of the FDO Developer's guide is actually located here.

Tuesday, 5 January 2010

FDO Toolbox v0.9.2

A new year, a new release.

This is a small bugfix release that finally allows you to preview ArcSDE data sources (both attribute and map) just like every other FDO data source!


Monday, 14 December 2009

An interesting AU session on the internals of MapGuide

Though I didn't go to Autodesk University in person or virtually (maybe I will one day), I'm always interested in checking out the Geospatial-focused sessions that have been posted online. This year, there seemed to be the usual lot of sessions introducing MapGuide/FDO/Map3D, but one particular session caught my eye of interest:

http://au.autodesk.com/?nd=class&session_id=5241

This session is particularly special because at face value, it is not introductory in any way. You are assumed to know about what MapGuide and FDO are about. The session goes through the internals of MapGuide and demonstrates an example of using MapGuide in a standalone context (no server tier, no web tier).

This is a one of a kind presentation. I recommend checking out the slides/sample/podcast. It has certainly opened my eyes to the possibilities!

Wednesday, 9 December 2009

FDO Toolbox v0.9.1

Here's a new release, with lots of useful fixes.

New Stuff
  • Added an express connection option for ArcSDE
  • The BulkCopy command in FdoUtil.exe now has a geometry flattening parameter (-flatten)
  • A "fix schema incompatibilities" option is now available when creating an SDF/SHP/SQLite files with a loaded feature schema definition.
  • You can now delete/update multiple selected rows in a Data Query result set. Same restrictions apply (eg. No identity properties in result set = Can't update/delete)
  • You can now have connection names with slashes in them, these are interpreted as folder names when saving to / loading from the session directory.
Fixed Stuff
  • When doing a partial schema save, additional checks are performed to prevent an invalid schema from being saved (eg. A unique constraint for a property that is removed)
  • Fixed the BulkCopy command in FdoUtil.exe to work with the new Bulk Copy API
  • Fixed the RunTask command in FdoUtil.exe where it was really possible for the wrong data source to be trashed if your copy tasks had DeleteTarget = true
  • Queries performed in the Data Query UI are now done using qualified class names. This should now work on data stores with multiple schemas each containing 1 or more identically named feature classes.
  • Fixed SQL Server saved connections not reloading on next startup
Other Stuff of note
  • Since we are now targeting .net Framework 2.0 SP1, I can now take advantage of some of the new C#3.0 features while still being able to target framework 2.0. As a result the project files have been migrated to Visual Studio 2008 format. You'll need msbuild from .net Framework 3.5 to build the source code if you do not have Visual Studio 2008 installed.
  • Data Query is currently broken in ArcSDE. I'm looking for a solution