He has found the cause. A call to DirectX was changing the floating point (double) precision ..
Leif Goodwin
Posts
-
Solved: Floating point rounding question -
Solved: Floating point rounding questionHe is examing the property of the CGridPoint class using the debugger. He also confirms that the results look wrong when used. He displays a 2D representation of a Geophysical survey vessel and streamers on his screen, and position error ellipses are wrong, which is how he found this issue. The code is C++ of course. He has rewritten like this: CGridPoint gpt2 = gpt[i].Rotate(m_gptEllipseAngle); gpt2.m_fEasting += gptLocation.m_fEasting; gpt2.m_fNorthing += gptLocation.m_fNorthing; pts[i] = ViewPoint(gpt2); And it still fails. The original would have been something like: CGridPoint gpt2 = gpt[i].Rotate(m_gptEllipseAngle); pts[i] = ViewPoint(CGridPoint(gpt2.fEasting + gptLocation.m_fEasting, gpt2.fNorthing + gptLocation.m_fNorthing )); The above might have a typo or two, not sure, I rewrote it here without compiling it.
-
Solved: Floating point rounding questionNB: As indicated in a reply the issue has been solved. The DirectX module was changing the floating point precision. A colleague is calling the constructor of a class which takes two doubles as arguments. Each argument he passes is the sum of two doubles: CGridPoint( a + b, c + d) The class object stores the two values internally. When he views the result he sees that the values have been rounded to 1 decimal place. The values are not so large that this would be expected. Here are example: a = 44.445472717 b = 724631.800000000 a + b = 724676.250000000 In other words he passes in 44.445472717 + 724631.800000000 as the first argument to the constructor and the result is stored internally and is seen to be 724676.250000000. Does anyone know the cause of this rounding? BTW he uses VS2008. This works in VS2010.
-
Custom window title bar => system buttons stuffed [modified]Not it's not just you. Thanks for pointing it out. I've fixed the link.
-
Custom window title bar => system buttons stuffed [modified]I want an MFC SDI application frame window with a custom title bar, and I am using this code: http://www.microsoft.com/msj/0197/c/c0197.aspx It sort of works. Unfortunately the custom title bar causes the buttons in the top right (minimize, maximize and close) to shrink in width, and hence the end result is a mess. Has anyone come across this problem, or know of an alternative? Thanks.
modified on Thursday, January 6, 2011 5:19 AM
-
SQL Server CE : How to create a database from C++ with ADOIn case anyone else needs the answer, I had to use the MS_ADOX::_Catalog COM interface which is imported from msadox.dll. For example: MS_ADOX::_CatalogPtr catalogPtr; catalogPtr.CreateInstance(__uuidof(MS_ADOX::Catalog)); catalogPtr->Create("Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source=C:\\Temp\\sqlcedemo.sdf;"); The above crap non error checking code creates the C:\\Temp\\sqlcedemo.sdf database, which can then be opened and populated using ADO in the normal fashion.
-
SQL Server CE : How to create a database from C++ with ADOI have a demo application that uses SQL Server via ADO to create and populate a database. I connect to the master database and then execute a "CREATE DATABASE ..." SQL statement. Here is the connect: bool CMsSqlDemoView::Connect(LPCTSTR szDatabase) { Disconnect(); m_DBConnection.CreateInstance(__uuidof(Connection)); if (!m_DBConnection) { m_listErrors.AddString("Failed to create ADO::Connection instance"); return(false); } m_DBConnection->CursorLocation = adUseClient; // Note: The "sqloledb" provider does not fully support XML. // For XML support, the Provider and DataTypeCompatibility values must be set as indicated. CString strConnection; strConnection.Format( "Provider=SQLNCLI10;DataTypeCompatibility=80;Integrated Security=SSPI;Data Source=%s;Database=%s;Trusted_Connection=Yes;", m_strDataSource.GetString(), szDatabase); HRESULT hr = E_FAIL; bool bResult = true; try { hr = m_DBConnection->Open(strConnection.GetString(), "", "", adConnectUnspecified); } catch(_com_error &e) { CString strText; strText.Format("Error code '%d' : '%s'", e.Error(), (LPCTSTR)e.Description()); m_listErrors.AddString(strText); bResult = false; } return(bResult); } So far so good. I have now created a second demo application that uses SQL Server CE 3.5. I set the provider as "Microsoft.SQLSERVER.CE.OLEDB.3.5" but I am unable to create a connection object, and I have no idea how to create a database since I cannot connect to a master database. Anyone know how to do this (C++)? Thanks. BY the way I don't want to use managed C++, or OLEDB.
modified on Tuesday, October 26, 2010 8:52 AM
-
Visual Studio 2010 dog slowFor what it's worth, I have to turn off Intellitreacle, otherwise the system hangs for minutes at a time. Useless.
-
Visual Studio 2010 dog slowThank you. It looks like that does solve the performance issues. I will notify our IT dept who install VS 2010 for us!!!
-
Visual Studio 2010 dog slowWe are upgrading to VS2010 (C++) and on XP machines it is dog slow. Sometimes the IDE will hang the PC for 30 seconds or more. Right click a mouse button, and 30 seconds later the popup menu appears. And this is not while compiling, although compiles and builds seem very slow compared to VS 2005. VS 2010 seems fine on Windows 7. Does anyone have any ideas what the problem is? I assume it is something like intellisense getting its knickers in a twist, or some other background task. Oddly enough the Task Manager shows near zero CPU usage during these hangs. We do have plenty of RAM so virtual memory paging is not thrashing.
-
Visual Studio 2010 dog slowOoops. Thanks.
-
Visual Studio 2010 dog slowWe are upgrading to VS2010 (C++) and on XP machines it is dog slow. Sometimes the IDE will hang the PC for 30 seconds or more. Right click a mouse button, and 30 seconds later the popup menu appears. And this is not while compiling. VS 2010 seems fine on Windows 7. Does anyone have any ideas what the problem is? I assume it is something like intellisense getting its knickers in a twist, or some other background task. Oddly enough the Task Manager shows near zero CPU usage during these hangs. We do have plenty of RAM so virtual memory paging is not thrashing.
-
CRichEditCtrrl and EN_REQUESTRESIZE [modified]I am using a rich text control to display a block of formatted text. I create the control, set the content, then call the RequestResize method to notify the parent of the required height, and adjust the height to match. This works fine under VS 2005 on XP and Vista. Rebuilding under VS2010 as a 32 bit app and running on Windows 7 64 bit, the code does not work. The parent window does not receive the EN_REQUESTRESIZE message: ON_NOTIFY(EN_REQUESTRESIZE, 0, OnRequestResize); The parent window's OnRequestResize method is never called. So the control has zero height. This is bog standard code which worked fine before. Has anyone come across this? Any possible cause? Okay: Problem solved. A zero control ID is not valid although we do not care about the control id, and it was accepted under VC 2005 on XP.
-
WiX : how to find dependenciesThank you. Unfortunately it only tells us the DLLs. What we really would like to know is the merge modules. We can of course go through the DLLs, and locate the matching merge modules, but that is fairly time consuming.
-
WiX : how to find dependencies(Could not find a more appropriate location for this question.) We are looking to use WiX as our installer creator as it is so powerful, and not that hard to learn/use. But, it does not automatically find dependencies, whereas the VS installer automatically adds in standard merge modules. Is there any tool we can use to locate dependent merge modules such as Microsoft.VC80.MFC ?
-
WiX: Any good books or courses?Anyone know of any good books or courses on WiX? There are some online tutorials, but they are incomplete, and a nice book would go down a treat. Our needs are fairly complex, in that we need to install multiple files, register and start services, and COM objects, create registry entries populated from user input in custom dialogs, create merge modules, create patches and so on.
-
Windows InstallersIn case anyone is interested, we have pretty much reached a conclusion after evaluating numerous installers. My brief impressions follow: Inno Setup: Restricted features. Tarma Installer: Unable to create merge modules. Nice interface, and cheap. Install Shield: Feature rich but expensive. WiX: Complex, and not easy to learn, but very powerful and flexible. And free. InstallAware: Claims to be powerful, but the unprofessional feel scared us away, and it looks to be developed by one person who engages in online slanging matches with critics. It appears to b a copy of Install Shield by an ex-IS employee. There are other products, but they all lacked essential features such as custom dialogs, or creation of merge modules. I am fairly sure we will go with WiX. Commercial install products such as Tarma and InstallShield are easier to use for simple projects, but anything more complex is no easier than WiX.
-
Why I can't CreateDragImage in CTreeCtrl?You have to cheat. Create the tree control without an image list. Before calling CreateDragImage, assign an image list to the CTreeCtrl, After the CreateDragImage function returns, assign a NULL image list to the tree control. For example: m_tree.SetImageList( &m_imageListTree, TVSIL_NORMAL ); m_pDragImage = m_tree.CreateDragImage(m_hDragTreeNode); m_tree.SetImageList( NULL, TVSIL_NORMAL ); This assumes that you want a tree control WITHOUT images assigned to each item. If you WANT images in the tree control, just call SetImageList when you create the tree control. You might think that it is possible to assign an image list to the tree control, but for each item say specify -1 as the image index i.e. no image. The problem with this is that it displays the item as if there was a blank image, which is not the same thing.
-
Windows InstallersThanks for the informative post. We may need to run SQL Express scripts, and we will need to force the user to configure some control panel applets, then reboot the system. I'll see if Inno Setup can handle these tasks.
-
Windows InstallersThanks for the replies. It looks like we are restricted to these ones, as the rest do not have required features: 1. Install Shield 2. Tarma Software Installer 3. Advanced Installer 4. Inno Setup 5. InstallAnywhere 6. InstallAware It's now a case of ticking off the required features. Integration with source code control seems to reduce the list down to Install Shield, though it remains unclear what integration means in this context.