c++

Accessing Linux diagnostic information from JavaScript

Is there a way can I access machine diagnostic information within the Linux OS in realtime? Such diagnostic info as CPU utilization, memory utilization, etc using JavaScript to display on a web page? If there is no direct access from JavaScript, is there any other method where JS code can call functions in shared libraries (dll, etc.)?...

C++ map insertion and lookup performance and storage overhead

I would like to store a mapping of an integer key to a float value in-memory. I have roughly 130 million keys (and, accordingly, 130 million values). My focus is on lookup performance -- I have to do many, many millions of lookups. The C++ STL library has a map class for associative arrays of this sort. I have several questions abou...

Null Object Pattern, Recursive Class, and Forward Declarations

Hi folks, I'm interested in doing something like the following to adhere to a Null Object design pattern and to avoid prolific NULL tests: class Node; Node* NullNode; class Node { public: Node(Node *l=NullNode, Node *r=NullNode) : left(l), right(r) {}; private: Node *left, *right; }; NullNode = new Node(); Of course, as written...

How do I select the client only framework in a Managed Visual C++ project in VS 2008 Sp1?

The title said it all. ...

gdb 7.0, signal SIGCONT doesn't break from a pause() call.

I'd built a version of gdb 7.0 for myself after being pointed to a new feature, and happened to have that in my path still. Attempting to step through some new code, I'd added a pause() call, expecting to be able to get out like so: (gdb) b 5048 Breakpoint 1 at 0x2b1811b25052: file testca.C, line 5048. (gdb) signal SIGCONT Continuing ...

How to find what's new in VC++ v10?

Hello, Googling nor binging "VC++ What's new C++0x" gives me nothing that tells me what is new.Is there an official page at msdn or something similiar that contains the information for VC++ 10? I've seen such for C#,there must be one for what I'd enjoy to read. If not, please list the new features available in Visual Studio 2010 for VC...

Socks Client Support

I'm looking to add socks 4/5 support to my windows C++ application. Can you recommend a decent library, or resource? Thanks, ...

Help programmatically add text to an existing PDF

I need to write a program that displays a PDF which a third-party supplies. I need to insert text data in to the form before displaying it to the user. I do have the option to convert the PDF in to another format, but it has to look exactly like the original PDF. C++ is the preferred language of choice, but other languages can be inve...

A recurring const-connundrum

I often find myself having to define two versions of a function in order to have one that is const and one which is non-const (often a getter, but not always). The two vary only by the fact that the input and output of one is const, while the input and output of the other is non-const. The guts of the function - the real work, is IDENT...

How can I share HWND between 32 and 64 bit applications in Win x64?

MSDN tells me that handles to windows (HWND) can be shared between 32- and 64-bit applications, in Interprocess Communication (MSDN). However, in Win32 a HWND is 32 bits, whereas in 64 bit Windows it is 64 bits. So how can the handles be shared? I guess the same question applies to handles to named objects such as mutexes, semaphores ...

C++ swap problem in inheritance scenario

I want to add swap functionality to two existing C++ classes. One class inherits from the other. I want each classes' instances to only be swappable with instances of the same class. To make it semi-concrete, say I have classes Foo and Bar. Bar inherits from Foo. I define Foo::swap(Foo&) and Bar::swap(Bar&). Bar::swap delegates to ...

What is the best way to eliminate MS Visual C++ Linker warning : "warning LNK4221" ?

I have a CPP source file that uses #if / #endif to compile out completely in certain builds. However, this generates the following warning. warning LNK4221: no public symbols found; archive member will be inaccessible I was thinking about creating a macro to generate a dummy variable or function that wouldn't actually be used so this...

Load XML into C++ MSXML from byte array

I'm receiving XML over a network socket. I need to take that XML and load it into the DOM to perform further operations. MSXML requires input strings that are in either UCS-2 or UTF-16 and completely ignores the XML header with the encoding type when loading from a string. It allows the loading of XML fragments, so this makes some sense....

Declaring arrays similar to C style (C++)

In C a programmer can declare an array like so: unsigned char Fonts[2][8] { [1] = {0, 31, 0, 31, 0, 31, 0, 31} }; And element [0] is likely random bits. Is there a similar way in C++? ...

stringstream operator>> fails as function, but works as instance?

I'm writing simple code that will extract a bunch of name, int pairs from a file. I'm modifying existing code that just uses: string chrom; unsigned int size; while ( cin >> chrom >> size ) { // save values } But I want to use another (similar) input file that has the same first two columns, but are followed by other data (that w...

Matrix classes Directx & OpenGL

I have the following C++ matrix class: transform.h transform.cpp I am using this coupled with a renderer, for which there is an opengl and a directx implementation. I have a test example where the coordinates of the mouse within the window are used to position a graphic under the cursor. This works as expected under OpenGL. Because d...

How to implement dependency checking for C/C++ sources

I started adding support for a 3rd party toolchain (IAR Compiler) to Visual Studio 2005. So far I've managed to implement the required msbuild tasks (Compile, Link and Assemble) and the Visual Studio Add-in to support the *.proj file. The next hurdle is handling dependencies for the headers. I'm not sure what the best way to go about t...

C++ overloading * for polynomial multiplication

So I have been developing a polynomial class where a user inputs: 1x^0 + 2x^1 + 3x^2... and 1,2,3 (the coefficients) are stored in an int array My overloaded + and - functions work, however, * doesnt work. No matter the input, it always shows -842150450 when is should be (5x^0 + x^1) * (-3x^0 + x^1) = -15x^0 + 2x^1 + 1x^2 or (x+5)(x-...

[ Nachos ] Write and test sub func

I'm trying to write sub func for nachOS but when I combines it doesn't work. Don't know the reason. Details: In ../userprog/syscall.h Add : #define SC_Sub 11 int Sub(int a, int b); In ../test/ .globl Sub .ent Sub Sub: addiu $2,$0,SC_Sub syscall j $31 .end Sub After that I write a sub.c: #include "syscall.h" int main() { ...

which is a better language (C++ or Python) for complex problem solving exercises (ex. Graphs) ?

I am trying to work on some problems and algorithms. I know C++ but a friend told me that it would be better if done with Python.As it would be much faster to develop and less time is spent in programming details which does not actually earn anything solution wise. EDIT 2: I plan to use python-graph lib from Google-codes, Please provide...