c++

retrive the text in a specific cell in a QTableWidget?

I've been trying to use QT4 with a QTableWidget to store data. I seem to be unable to select a cell and get the text out of it and wanted to see why it won't retrieve it. ui->QTableWidget->item(ui->QTableWidget->rowCount(),0)->setText(""); ...

Force macbundle setup

Background: I am writing a GLFW app on MacOSX. When I call glfwCreateWindow, the MacBundle stuff is called. Right now, in my program execution, I ahve the following: // getcwd() = /Users/me/code glfwCreateWindow(...); // some MacBundle stuff happens // getcwd() = /Users/me/code/prog.app/Contents/Resources I would like to control this...

C++ Templates polymorphism

Hello. I have this structure of classes. class Interface{ ... } class Foo : public Interface{ ... } template <class T> class Container{ ... } And I have this constructor of some other class Bar. Bar(const Container<Interface> & bar){ ... } When I call the constructor this way I get "no matching function" error. Container<Foo> c...

How to optimize an external reference to an interface in C++?

Using VC8, I create two modules similar to the following: Header class IFoo { virtual void Bar() = 0; }; Module A extern IFoo& Foo; void DoStuff() { Foo.Bar(); } Module B IFoo& Foo = ConcreteFoo(); VC8 handles this by essentially treating 'Foo' as a pointer to an IFoo. Wherever it sees Foo.Bar() (even in module B), it...

How can I link an .o file using g++

Hi, I am trying to use g++ to compile a .cc file, and I need it to link a .o file. So I tried: $g++ -o client -I../ipc -L../messages.o client.cc /usr/bin/ld: error: ../messages.o: can not read directory: Not a directory And I have tried: $g++ -o client -I../ipc -l../messages.o client.cc /usr/bin/ld: error: cannot find -l../messages...

What is the address of back() in an empty container?

I mistakenly took the address of the reference returned by the back() operator in an empty container and was surprised to see that the address wasn't zero. If a container e.g. std::deque is empty, what does back() return? ...

hiphop PHP download?

Where can you download the HipHop Code? I would really like to test it. Interestingly enough if you go here: http://github.com/facebook/hiphop-php/wikis It must not exist or private because it redirects to github.com index.php page So you can not even see the wiki or anything ...

error while loading shared libraries

Hello! I'm trying to install Code::Blocks from source. There is an `anarchy' folder on my university's CS department's mainframe, where anyone can install anything, basically. wxwidgets is a dependency of Code::Blocks, and I'm trying to put wxGTK, as it's called, into my own folder on `anarchy', which works fine. I then compile Code::...

Minimal linear regression program

Hi, I am running some calculations in an external machine and at the end I get X, Y pairs. I want to apply linear regression and obtain A, B, and R2. In this machine I can not install anything (it runs Linux) and has basic stuff installed on it, python, bash (of course), etc. I wonder what would be the best approach to use a script(pyt...

How to initialise memory with new operator in C++?

I'm just beginning to get into C++ and I want to pick up some good habits. If I have just allocated an array of type int with the new operator, how can I initialise them all to 0 without looping through them all myself? Should I just use memset? Is there a C++ way to do it? ...

Advice for converting a large monolithic singlethreaded application to a multithreaded architecture?

My company's main product is a large monolithic C++ application, used for scientific data processing and visualisation. Its codebase goes back maybe 12 or 13 years, and while we have put work into upgrading and maintaining it (use of STL and Boost - when I joined most containers were custom, for example - fully upgraded to Unicode and t...

recv windows, one byte per call, what the?!

c++ #define BUF_LEN 1024 the below code only receives one byte when its called then immediately moves on. output = new char[BUF_LEN]; bytes_recv = recv(cli, output, BUF_LEN, 0); output[bytes_recv] = '\0'; Any idea how to make it receive more bytes? EDIT: the client connecting is Telnet. ...

Saving debugging state and backwards debugging with Xcode or friends

Hi, I am using Xcode in order to debug C++ programs. The main problem for me is that it takes around 10 munutes till the program gets to the point of the program that I need to debug. Then I realize about something inspecting the variables and some other stuff, and modify the code. Then 15 minutes again and so ... I wonder if there is ...

How to display remote email message?

I have been using this code to display IMAP4 messages: void DisplayMessageL( const TMsvId &aId ) { // 1. construct the client MTM TMsvEntry indexEntry; TMsvId serviceId; User::LeaveIfError( iMsvSession->GetEntry(aId, serviceId, indexEntry)); CBaseMtm* mtm = iClientReg->NewMtmL(indexEntry....

I have an interview for a DB2 C++ developer internship and IBM coming up and need to know how to best prepare

I got an interview for a DB2 C++ developer internship at IBM. I have the option of doing it over the phone or in person. Which would you recommend? Is it appropriate to say in my reply email "What will be the nature of the interview so I can best prepare for it?" so I can found out just how technical and code-based it will be. But in ge...

How do I communicate from my global hook to my application?

I installed a global hook using win32 but I need to communicate with my main application. How should I do this? I guess the dll can have a function where I set my apps HWND and then the hook can sendmessage it? or should I search the window titles to find my application from the hook and sendmessage that way? What's the best strategy and...

How can I add SOAP Headers to a WSDL generated Borland C++ Builder 6 application.

Using a WSDL that requires a SOAP HEADER for Authentication (fragment below) code that gets generated when creating a web service client via the "WSDL Importer" has no concept of the Authentication Headers and there are no examples in BCB6 C++ Examples/WebServices directories that show how, and nothing on Web that I can find. Anyone wit...

How can I create an 'ostream' from a socket?

Hi, In C++, if I have a socket, how can I create an ostream object from it? I have googled some example: http://members.aon.at/hstraub/linux/socket++/docu/socket++_10.html And i have tried: sockbuf sb(sockfd); std::ostream outputStream(&sb); But I can't find the .h file and the library to link with for 'sockbuf'. Is that part of a ...

Need quick primer on databases for C++.

My primary area is HW/Software interaction & Robotics, but we're running into situations where having a few database tables would be handy. I've got almost no knowledge on DBs. What is a good primer on Database programming that would quickly get me up to speed on create/add entries/delete entries/query. Prefer either a basic Flat-file...

Does C++ call destructors for global and class static variables?

From my example program, it looks like it does call the destructors in both the cases. At what point does it call the destructors for global and class-static variables since they should be allocated in the data section of the program stack? ...