Wednesday, August 27, 2008

Error showing "Run-Time Check Failure #0"

After compiling the source code of OSG 2.6.0 and MANUALLY copying the binaries to another directory, I got the error message:

Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.

This error pops up when I run an OSG application in VS2005 in Debug mode. This error looks a little scary, but after looking for information about this error, I found http://www.gamedev.net/community/forums/topic.asp?topic_id=308819 which pointed me in the right direction. It was because I copied the dll's and include directory (*dll, *.h), but not the library files (*.lib) to a new directory. I guess that is why there is an INSTALL project in the OSG solution that copies the files automatically :)

Friday, June 27, 2008

Bug, Error or Defect?

A few days ago I came across this article:
www.sei.cmu.edu/news-at-sei/columns/watts_new/1999/March/watts-mar99.htm

It got me thinking... I usually use the word "bug" to referr to any unexpected behavior in the software. However, after reading this article, I started to say "defect" instead of "bug".

It also made me remember a Software Quality Assurance course I took during my Master's degree. In the course book the differences between defect, error, fault and some other words I don't really remember was explained. Back then -and still- I thought that there was no sense in using different words for different situations. In my opinion, problems during compilation, testing, deployment... all can be called defects. Using a word for each situation makes it confusing.

Finally, it is interesting how the name of the software changes our habits... for example, I used to say "bug" because I am used to using BugNET as a defect tracking system. Or when I say "googled" a word or "photoshop" an image.

Wednesday, June 18, 2008

VS2005 and wchar_t

While upgrading a VS2003 solution to VS2005, I received the following error:

Error 29 error LNK2028: unresolved token (0A001D22) "public: void __thiscall osgText::TextBase::setText(unsigned short const *)" (?setText@TextBase@osgText@@$$FQAEXPBG@Z) referenced in function "private: class osg::Node * __thiscall XXX::YY::ZZZ::FFF::WWWW(class XXX::YY::ZZZ::FFF::CCC &,class osg::Vec4f const &)" (?KKKKK@TTTTT@CCCCC@YY@XXX@@$$FAAEPAVNode@osg@@AAVGGGGG@234@ABVVec4f@6@@Z) RRRRRR.obj

My first thought was to make sure I had the correct version of the OSG libraries. They were OK, so then I googled some keywords of the error message and came across something interesting. VS has an option in Tools->Options that is "Treat wchar_t as built in type". My default value was false, so I set it to "Yes" and rebuilt the libraries. It worked!

Monday, April 28, 2008

Stack overflow at line: 0

While debugging an ASP.NET application I got the error: "Stack overflow at line: 0". This happens just after adding a new line of code to a javascript file. Then I thought this article forums.microsoft.com/MSDN/ShowPost.aspx could be related. However, the code indicated in the article was already implemented in the website.

The error appears in both IE7 and FireFox 2.0 in debug mode. However, in the deployed website the error was not appearing. Does it mean the error exist or not? Is it possible this issue is related to VS2005 and not to the javascript code I added?

Friday, February 8, 2008

Sergey Brin @ UC Berkeley

Check it out, interesting talk provided by youtube.com:

http://youtube.com/watch?v=Ka9IwHNvkfU

Using a ScaleDependentRenderer in a FeatureGraphicsLayer?

I was looking for a relationship between the classes FeatureGraphicsLayer and ScaleDependentRenderer. I could not find it in the EDN website. This is why I was looking for this: say you have a FeatureGraphicsLayer in which you want to draw features using a ValueMapRenderer. This is all OK since a ValueMapRenderer is "type of" IRenderer which is used by the FeatureGraphicsLayer.

However, what if you want to draw those features with a height/width that changes according to the scale? There is no IScaleDependentRenderer in the WebADF API. Philip Thompson posted a suggestion here:

http://forums.esri.com/Thread.asp?c=158&f=2276&t=245890#751096

Basically, we can extend his code snippet to set the Renderer on-the-fly everytime the ScaleChanged() method of the class Map is triggered. In this case, the Renderer will be set according to the scale. Thanks Philip!

protected void Map1_ScaleChanged(object sender, ESRI.ArcGIS.ADF.Web.UI.WebControls.ScaleEventArgs args)
{
if (args.NewScale > 4000)
{
foreach (MapResourceItem item1 in this.MapResourceManager1.ResourceItems)
{
if (item1.Definition.DataSourceType == "GraphicsLayer")
{
item1.DisplaySettings.Visible = false;
// OR RESET THE RENDERER AS WELL
}
}
}
if (args.NewScale < 4000)
{
foreach (MapResourceItem item1 in this.MapResourceManager1.ResourceItems)
{
if (item1.Definition.DataSourceType == "GraphicsLayer")
{
item1.DisplaySettings.Visible = true;
}
}
}
}

Tuesday, February 5, 2008

IServiceProvider error: ambiguous symbol message

I have been working on porting code from VS2003 to VS2005. The last error message I received before being able to compile it was:

error C2872: 'IServiceProvider' : ambiguous symbol

Lucky me, this error is well documented. The solution was moving the #include to the top of the file. It works for me and I did not look further on the cause of this error. However, it seems this symbol may be declared in more than one file.

This is one area where Microsoft could follow ESRI's approach. ESRI does not declare repeated names, it adds a number to the end of the class that can be incremented, i.e. ISpatialReference, ISpatialReference2, ISpatialReference3. Note that ESRI is actually extending a class with each increment and Microsoft may not be doing that.