c++

pointer assignment

I have the following template structure: template <typename scalar_type> struct postc_params{ scalar_type delta; unsigned int time_horizon; matrix_math::matrix<scalar_type> dynamics; boost::shared_ptr<continuous_set> invariant_set_ptr; boost::shared_ptr<continuous_set> input_set_ptr; boost::shared_ptr<continuou...

Qt4 QNetworkManager Hangs

I'm trying to write an application using QNetworkManager. I have simplified the code down to the problem. The following code hangs, and I have no idea why: main.cpp: #include <QApplication> #include "post.h" int main(int argc, char *argv[]) { QApplication app(argc, argv); post("http://google.com/search", "q=test"); return a...

How can I get a list of classes and public methods from a C++ code base?

I have inherited a large-ish application written in C++ on Linux. Is there an easy way to get a report of each class and the public methods exposed in each class? I've looked at Doxygen, but that appears to just provide easy browsing of the codebase, not tailored for providing anything that can be exported to Excel, etc. ...

Open Source Search Engine

I'm learning search technology and reading the paper about Google prototype. Is there an open source search engine written in C++ that is easy to read? ...

C++ Templates and accessing namespaces

Hi, let's say I'm using a templated class with something simple like template <class T> class MyClass and I want to use elements from T's namespace, for example T could be string, and i wanted to use T::const_iterator myIterator; or something like that. How do I achieve that ? Probably it's not possible or very simple, but I'm...

url response time tracker in c++

hi! i have to develop a program that would keep track of all access url in a browser with its response time. the program must not be browser-dependent. any suggestion on topics that need to be studied? or anything helpful? thanks for the time!:) ...

Tickcount and milliseconds in C++

HOw do I convert from TickCounts to Milliseconds? this is what I used: long int before = GetTickCount(); long int after = GetTickCount(); I want the difference of it in seconds. Thanks! ...

What is a fast efficient way to find an item?

Hi so I need some FAST way to search for a word in a dictionary. The dictionary has like 500k words in it. I am thinking about a using a hashmap where each bin has at most 1 word. Ideas on how to do this or is there something better? ...

In MFC how do I avoid dialog boxes from staying on top of my app window?

I have a dialog box based application (MFC - VS 2008). I have a list control on it. I pop up other dialog boxes, but I also want to be able to get back to the parent app dialog. I can get back to the parent app dilaog box, but the problem is that even if I click on it with the mouse it remains hidden behind the "child" windows. I wan...

Order perserving minimal perfect hash functions

Hi, I want to implement an OPMPH function for the words in a dictionary in C++. How do I do it? Thanks! ...

rectangle disappearing with SDL

So I'm simply trying to make a red 10 x 10 box move vertically back and forth. I compile and run my program and the red box appears starts moving down, then just disappears after it hits the edge of the screen. I used some cout << statements that tell me when the functions are being called and they are all being called when they are supp...

C++ - strcmp() does not work correctly?

There's something really weird going on: strcmp() returns -1 though both strings are exactly the same. Here is a snippet from the output of the debugger (gdb): (gdb) print s[i][0] == grammar->symbols_from_int[107][0] $36 = true (gdb) print s[i][1] == grammar->symbols_from_int[107][1] $37 = true (gdb) print s[i][2] == grammar->symbols_fr...

Using Qwt on Mac OS X

How can I compile and run Qt programs using Qwt on Mac OS X? I always get an error telling me that it can't find libqwt.dylib. For what I have understood from my googling it won't help to set DYLD_LIBRARY_PATH in environment.plist since Apple has disabled that due to security reasons so how am I supposed to do it (without manually copy...

client-server design

i want to develop a pretty basic client-server program. one software reads xml (or any data) and send it to the server who in turn will manipulate it a little bit and eventually will write it to the disk. the thing is that if i have many xml files on disk (on my client side), i want to open multiple connection to the server , and not d...

If the only thing that changes is the constructor should I still derive?

I have a class that has everything already implemented but its initialization process is different for every child class. Is there a better idiom to replace the ctor? Is there something more generic/dynamic that I should use? ...

How to see hash items in C++?

Hi so I have the following code and I want to be able to insert words into it and be able to see the stuff I put into the hash by printing it out. Here's what I have: #include <iostream> #include <fstream> #include <string> #include <hash_map> #include <set> #include <windows.h> using namespace std; struct nlist{ struct nlist *nex...

Problem with winsock recv() and accept()

I'm having trouble with a socket application I'm programming in C++. I'm doing my programming with Bloodshed Dev-Cpp on Windows XP. I made a class for handling all the message transfers and have a client and server program that both use that class for handling their services. The application itself is very basic, the only intent I hav...

Boost Filesystem createdirectories on Linux replacing "/" with "\"

When using Boost Filesystem's createdirectory (and createdirectories) function in the following example, "/" is being replaced with "\". boost::filesystem::path path ("/data/configSet"); boost::filesystem::create_directory(path); This code snipped produces a directory called "data\configSet", instead of creating a subdirectory of "con...

Convert C++ RLE Unpack to Ruby?

Hello. I'm looking for help with converting C++'s custom RLE unpack function to Ruby style. struct packer_opcap { unsigned char tlen : 3; bool tzero : 1; unsigned char blen : 3; bool bzero : 1; }; static void rle_unpack(const unsigned char* in_buf, int in_length, std::vector<unsigned char> &buffer) { buffer.clear();...

Threading on bootloader

Where can I find resources/tutorials on how to implement threads on a x86 architecture bootloader... lets say I want to load resources in the background while displaying a progress bar.. ...