c++

How do I release an InMemoryWorkspaceFactory in the ESRI Map Control?

I am embedding the ESRI Map Control into a custom ActiveX control written in MFC/C++. The custom ActiveX control serves as a Map Control wrapper so I can embed it into a specific environment that is runtime only and non-relational. Thanks to this site, I am able to load feature points into an in-memory workspace. However, the hosting env...

Compress 21 Alphanumeric Characters in to 16 Bytes

I'm trying to take 21 bytes of data which uniquely identifies a trade and store it in a 16 byte char array. I'm having trouble coming up with the right algorithm for this. The trade ID which I'm trying to compress consists of 2 fields: 18 alphanumeric characters consisting of the ASCII characters 0x20 to 0x7E, Inclusive. (32-126) A ...

An efficient way to insert a single record using ADO

OK, this should be simple. I've just started using ADO in C++, and I'm trying to figure out the best way to insert a record. At the moment I'm creating a new Recordset and opening it using Open(), but it seems strange to use ADODB::adCmdTable, because it's my understanding that it does a select *. Is there a better option here? Also, i...

Compiling/Using MySQL Connector/C++ with MinGW

Well, I guess the title sums it up pretty well. The connector comes with Visual Studio libraries and dlls. There is also a source tar available which doesn't compile. ...

Hex edit a dll to change a dependency name?

I have a dll which is dependent of OPENGL.DLL . However, Windows comes with OpenGL32.dll . I want to change this dependency name in the dll binary so it looks for OpenGL32.dll instead. I tried opening it in VS's binary editor but I cant seem to make the name longer. I can for instance change it to OpenDD.dll but I cant add to it. How cou...

avoid rounding error (floating specifically) c++

http://www.learncpp.com/cpp-tutorial/25-floating-point-numbers/ I have been about this lately to review C++. In general computing class professors tend not to cover these small things, although we knew what rounding errors meant. Can someone please help me with how to avoid rounding error? The tutorial shows a sample code #include <...

No copy constructor available or copy constructor is declared 'explicit'

Could somebody please explain why I'm getting a compile error here - error C2558: class 'std::auto_ptr<_Ty>' : no copy constructor available or copy constructor is declared 'explicit' #include <memory> #include <vector> #include <string> template<typename T> struct test { typedef std::auto_ptr<T> dataptr; typedef std::auto_ptr< ...

Is there a dev kit/lib (written in c or c++) to write docx files?

Is there a dev kit/lib (written in c or c++) to write docx files? Microsoft has a dev kit, but it's written in C#. ...

Achieving Mutability When Mixing Primitives and Cocoa Collections

Okay, I think I might be over-complicating this issue but I truly am stuck. Basically, I am trying to model a weight set, specifically an olympic weight set. So I have the bar which is 45 lbs, then I have 2 weights of 2.5 lbs, 4 of 5 lbs, and then 2 of 10, 25, 35, and 45 respectively. This makes a total of 300 lbs. bar = 45 lbs 2 of 2.5...

What's wrong with this copy constructor?

I've been trying to come up with a copy constructor for a tree. I've found quite a few suggestions. This one interested me. class TreeNode { int ascii; TreeNode* left; TreeNode* right; public: TreeNode() { ascii = 0; left = right = 0; } TreeNode* clone(); // ... }; TreeNode* TreeNode::clone() { ...

Efficiency of design patterns

Hello, Does anyone know any sites/books/articles covering best practices or theory around design patterns in high performance applications? It seems a lot of the patterns use indirection/abstraction/encapsulation in a way that may affect performance in computationally intensive code. Head First Design Patterns and even GoF mention possi...

How does one suppress specific warnings from source code on g++ 4.5 or later?

The first comment on a feature request for g++ says, "Starting with 4.5 you can disable a class of warnings in the source." I looked through the 4.5.0 manual, but I can't find the syntax. What is the syntax in g++ 4.5 and later to suppress individual warning classes in the source? ...

Good book on Large scale Object Oriented System Design in C++

I am specifically looking for book which discuss about large scale system design (like Oracle server, Web servers) with extensive use of design patterns and meta programming (templates) in C++. thank you, ...

How to build facebook's scribe?

Hi All, I just downloaded the source code of facebook's scribe. I'm new to it and having read the readme.build file , I can say I could barely understand how to build it. Could anyone give me the step by step procedures? thanks... :) ...

Adding invariant check to every method of a Class

I have a class with many methods and would like to check for pre/post conditions, such as is mMember == null and invoke function x() if not. Is it possible to add pre/post conditions to every member of that class automatically? The class is defined in class.h and all methods are defined in class.cpp. Being able to define a macro at the ...

Application plugins with MingW and "undefined reference" errors

I have a Qt application which uses Q_DECL_EXPORT to mark certain data types and functions of my main executable as exported. Likewise, when I compile my plugins, I mark those same symbols with Q_DECL_IMPORT to import them. This has worked great on linux. All I need to do is compile with -rdynamic and it goes well. Visual Studio 2008 has...

Static Analysis API's?

I am interested in static analysis tools that are out there. Or rather the API's that are supported to allow me to write my own tools using these API's. I've written dozens over the years at my present employment that scrutinize our source code (C++) for various things. But one thing I want to know is if there are other static analysis A...

C++ polymorphism - Auto detect derived type

I have certain code that I want to optimize. It looks like this: function abc( string format ) { if (format == "a") { // this is a string, I shouldn't have used single quote, sorry for the confusion classx::a t; doit(t); } if (format == "b"){ classx::b t; doit(t); } if (format == "c"){ classx::c t; doit...

Using undocumented classes in C++

I'm in the process of reverse-engineering a Windows executable. I found a class that I want to use from some code that I inject into the executable (different thread, own stack). How would I go about declaring such a class, given method addresses and member variables structure? For instance, let's say I found a class called foo, with it...

How can I add a watermark or png or bitmap to the background of a CTreeCtrl?

I would like to have a background image for a list control (CTreeCtrl). Is this possible and how can I do it? (This is for a Visual Studio 2008 C++ mfc app) ...