c++

HTML parser to parse images and hyper link in C# or in C++

Possible Duplicate: Library Recommendation: C++ HTML Parser Hi all... Can any provide me a sample link which can parse all the images and .css files assosiated with web page... i know the logic.. but i m failing in one or the other possibilities... i am not getting any documentation that how web-browser download the entire webp...

How can I autoexpand an item in a QTreeView when it is filtered by QSortFilterProxyModel?

I have a normal QTreeView, a custom QAbstractItemModel and a custom QSortFilterProxyModel. I've reimplemented QSortFilterProxyModel::filterAcceptsRow to filter items from my model in the way I want, however now I want those filtered items to be expanded in the treeview. The obvious solution was to emit a signal from QSortFilterProxyMo...

C++ STL for_each should take pointer to member function taking one argument

Hi I have to pass the address of a member fn taking one argument to the std::for_each. how do i do this? class A{ void load() { vector<int> vt(10,20); std::for_each(vt.begin(), vt.end(), &A::print); //It didnt work when i tried mem_fun1(&A::print) } void print(int a) { cout<<a; } }; Thanks ...

PopFront Delimma C++

Strange programming problems as of now..As you can see below i have assigned intFrontPtr to point to the first cell in the array. And intBackPtr to point to the last cell in the array...: bool quack::popFront( int &popFront ) { //items[count-1].n = { 9,4,3,2,1,0 }; nPopFront = items[0].n; if ( count >= maxSize ) return fa...

Should I read the Exceptional C++ books if I've read the Effective C++ series.

Hi, I'm a practicing C++ programmer (on Unix and gcc 3.x) for the past 6-7 years. I've read Scott Meyer's Effective C++, More Effective C++ and Effective STL cover-to-cover and have lived and practiced his suggestions/techniques along with Boost. I would like to move on to the more advanced aspects of C++ - something along the lines of ...

libxml2 error handling

I'm writing a small wrapper around libxml2 in C++, and I'm trying to work out how to handle errors. For now, let's say I just want to print them out. Here's what I've got at present: My error handling function: void foo(void *ctx, const char *msg, ...) { cout << msg << endl; return; } Initialised like this: xmlGenericErrorFunc h...

Data-structure that stores unique elements but answers queries for another ordering in C++

Hi, is there a data structure, which stores its elements uniquely (for a given compare-Functor) but answers queries for the highest element in that data structure with respect to another compare-Function ? For Example: I have a class with two properties : 1) the size 2) the value I'd like to have a data structure which stores all elem...

CMake: how to add compiler flags to non-default compiler

Hello I want to build a project with intel compiler. With default gcc I usually run: cmake -DCMAKE_CXX_FLAGS=-I/some/path /path/to/project And this works fine. cmake -DCMAKE_CXX_COMPILER=icpc -DCMAKE_C_COMPILER=icc -DCMAKE_CXX_FLAGS=-I/some/path /path/to/project When I try to use non-default compiler it does not path CMAKE_CXX_...

Finding neighbor positions in matrix

Hi everyone, I'v been bored so I created a small console minesweeper game and while writting it I had to find the neighbor positions of an element in a size*size matrix which is represented as an vector of elements and one variable which holds the size value. I didn't want to return the actual values of the neighbor elements but their p...

C++ Virtual function implementation?

If I have in C++: class A { private: virtual int myfunction(void) {return 1;} } class B: public A { private: virtual int myfunction(void) {return 2;} } Then if I remove virtual from the myfunction definition in class B, does that mean that if I had a class C based on class B, that I couldn't override the myfunction since it w...

Do interfaces solve DDD with code duplication?

AccountController can't extend BaseAccount and BaseController at the same time. If I make all BaseAccount or BaseController methods empty, I can have an interface, but if I implement that interface in two different places, that is, I make a contract to implement a method in two different places, I will have duplicated code. Do interfaces...

is there a way to look at the preprocessor expanded file in C

Hi i want to know how could we look at the c file after it has been expanded by the preprocessor before compilation with all the macro values put in the code inside the function where ever they are used. in there a way to do it? ...

Converting an FFT to a spectogram.

I have an audio file and I am iterating through the file and taking 512 samples at each step and then passing them through an FFT. I have the data out as a block 514 floats long (Using IPP's ippsFFTFwd_RToCCS_32f_I) with real and imaginary components interleaved. My problem is what do I do with these complex numbers once i have them? ...

How do we find a biggest white rectangle in a n x n bitmap ? .

Any idea on how to solve such problems (in C++)- like which is the best Algorithm to use. ...

MFC without document/view architecture

I'd like some help on using MFC without the document/view architecture. I created a project without doc/view support, Visual C++ created a CFrameWnd and a view that inherits from CWnd. I replaced the view inheriting from CWnd with a new view that inherits from CFormView. However, when I run my program, after I close the window I get a ...

How Google desktop search is opening files in foreground?

Hi, I want to build similar experience as google desktop search is giving while opening the file. Suppose the user is searching for a particular file and he clicks on it in the browser, google desktop is opening it in foreground, i tried to do this in my app but it some times opens in background. I used ShellExecuteEx and then AllowSe...

how can I fix xcode compiling everything all the time ?

Hi, I've started to use XCode and it seems to work, well, most of it. The annoying thing is it compiles all the source files, even those that didn't change, each and every time. I'm getting the grips with openframeworks and I waste time compiling the openframeworks source files every time although they don't change. Here are my IDE a...

How to use SQLite in a multi-threaded application?

I'm developing an application with SQLite as the database, and am having a little trouble understanding how to go about using it in multiple threads (none of the other Stack Overflow questions really helped me, unfortunately). My use case: The database has one table, let's call it "A", which has different groups of rows (based on one of...

Atomic Operation C++

In C++, Windows platform, I want to execute a set of function calls as atomic so that execution doesn't switches to other threads in my process. How do I go about doing that? Any ideas, hints? EDIT: I have a piece of code like: someObject->Restart(); WaitForSingleObject(handle, INFINITE); Now the Restart() function does its work asy...

File handle left behind by C++ code in Linux

I am trying to debug an issue in my code. I have a process A which runs continuously till I ask it to stop. Inside A I do the following: mount partition /dev/sda1 open() // creates an empty file X write() // write some bytes to it close() // close the file processFile() // Perform some operation remove() // remove file umount /dev/sda...