|
Albert,
many thanks for you reply. I was loosing all hope...
It seems that the FFT code is always copied from other sources and never really explained.
The best "explanation " so far - swap and butterflies. (from "Signal and image processing with neural networks " - my "textbook " way over my head for now!)
But my biggest mistake so far was that I did not check the audio source which was set for stereo ( my test source is mono) and the FFT "result" was power spectrum. So I completely missed the actual FFT output (real and img).
Cheers Vaclav
|
|
|
|
|
There should be plenty of sources online regarding the subject, FFT's have been used for quite a long time now and are a very prevalent method of signals analysis.
I would recommend when you're initially making a prototype of a function that is complex, that you start out with developing the algorithm in an environment that is well suited for helping someone understand the problem (versus implementing a solution). I use Matlab for prototyping any algorithms before going on to implement them in C/C++. Alternatively, you can use Octave which is a similar, free open source alternative. The Octave math engine is very good too but the GUIs are all very roughly put together. Their scripting is just as powerful as Matlab's (almost identical syntax).
|
|
|
|
|
Hi, I'm trying to teach myself C++ and was playing with an example from a website. If I only inherit from Derived class, I could change the access level of Identity method from protected to public by declaring public Derived::Identity in class DerivedChild. However, if I have multiple inheritance, I'm not able to access that method. Could someone tell me what I did wrong?
Thanks,
Helen
#include <iostream>
#include <string>
class Base
{
protected:
int m_nValue;
public:
Base(int nValue)
: m_nValue(nValue){}
void Identity() {std::cout << "I am a Base" << std::endl;}
};
class Derived
{
public:
Derived(){};
protected:
void Identity(){
std::cout << "I am a Derived" << std::endl;
};
};
class DerivedChild : public Base, public Derived
{
public:
DerivedChild(int nValue)
: Base(nValue){}
Derived::Identity;
};
int main()
{
DerivedChild cChild(9);
cChild.Base::Identity();
cChild.Derived::Identity();
return 0;
}
|
|
|
|
|
The 'public/protected/private' modifiers can only be used to maintain or reduce the accessibility of a base class's methods, it cannot be used to improve that accessibility.
ie. once a method is declared 'protected' or 'private' its accessibility cannot be improved by a derived class, otherwise this would break the encapsulation of the base class.
The only way to make a base class protected method visible outside of the derived class is for the derived class to override it and call the base class implementation.
I'm sure someone will be able to direct you to the relevant part of the standard but this is my understanding.
|
|
|
|
|
You cannot really change the access type in a derived class.
Consider the situation where Derived derives from Base in your example - class Derived : public Base
In this case, if you create an object of Base , then Identity() would be public .
And if you create an object of Derived , then Identity() would be protected.
This is probably what you want, but this behavior is only because when the Base object is created, the compiler sees Identity() as public and when the Derived object is created the compiler see Identity() as protected .
But if you do this - Base* ptr = new Derived;
And access Identity() like this - ptr->Identity();
You will be able to do this, since Identity() is still public and not changed to protected .
So even though, you're creating an object of Derived , the compiler only checks the class Base since the pointer is of type Base .
|
|
|
|
|
Thank you, .dan.g. and «_Superman_» for explaining. I was reading chapter 11.6 of learncpp.com and the author seems to indicate it's possible to change the access from a derived class. I tried it and it did work for single inheritance, but it doesn't work with multiple inheritance...
|
|
|
|
|
int main()
{
DerivedChild cChild(9);
cChild.Base::Identity();
cChild.Identity();
return 0;
}
You can use both, you would be in trouble if both base classes had Identity as protected because in that case you could put only one of them into to the public namespace of the DerivedChild class.
|
|
|
|
|
hi every body
i am trying to retrieve a single value from Adodc into EditBox
here i got an error :-
m_edit1=m_adodc1.GetRecordset().GetField().GetItem("StockName");
where "StockName" field of names in my table "Stocks"
the error :- binary : '=' no right side takes class tagVariant , or no convertion available
im working with "visual c++ 6 / mfc" dialog based project
thank you in advance .
|
|
|
|
|
What is m_edit1 ?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
m_edit1 is a member variable for the EditBox , EditBox is one of the tools which used in Dialogs it has the class CEdit , EditBox in visual C++ is similar to textbox in visual basic
|
|
|
|
|
I think the question was, whether m_edit1 is a control member (i.e. CEditControl) or a data member (CString). In the former case you would need m_edit1.SetWindowText(content) to display the content.
In any case you need to extract (or convert to) a CString from the variant that you have as input.
The good thing about pessimism is, that you are always either right or pleasently surprised.
|
|
|
|
|
an example would clear the case
thanx .
|
|
|
|
|
If m_edit1 is a data member it would be something like that.
m_edit1=m_adodc1.GetRecordset().GetField().GetItem("StockName").GetString();
If m_edit1 is a control member it would look like that instead.
m_edit1.SetWindowText(m_adodc1.GetRecordset().GetField().GetItem("StockName").GetString());
In both cases GetString() is a placeholder for the function to extract a String representation from the tagVariant. You should check the documentation (or intelli sense) for the correct function name.
The good thing about pessimism is, that you are always either right or pleasently surprised.
|
|
|
|
|
i made it ,,, partially !!
to inform you about my mdb file :-
its name (inventory.mdb)
it hase one table (Stocks)
the fields are (StockName,StockID,...)
now i can extract values from only the "StockName" which its string values
by the following code in button click :-
m_ado.SetRecordSource ("SELECT * FROM Stocks");
m_ado.Refresh ();
C_Recordset m_Record = m_ado.GetRecordset ();
COleVariant var1;
var1.vt = VT_I2;
var1.iVal = 1;
COleVariant value = m_ado.GetRecordset().GetFields().GetItem(var1).GetValue ();
m_edit = value.bstrVal;
UpdateData (FALSE);
how to extract the other values such as "StockID" which its integer or any other fields ?
thanx .
|
|
|
|
|
coolerfantasy wrote:
how to extract the other values such as "StockID" which its integer or any other fields ? See if this article is of any use.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
thank you and thanx to all those posting my Question
its solved ..
|
|
|
|
|
Hi,
I am using Googletest(gtest-1.6.0) for Unit testing activity for C++\VC++ code. Here i'm using microsoft Visual studio 2010. There is inbuild Codecoverage facility in MSVisualStudio 2010. I didn't find a way yo configure gtest framwork in visual studio to generate Codecoverage report. I mean any project setting required for the same.
Please guide me soon.Thanks
|
|
|
|
|
|
Hi All,
I would like to monitor my application memory usage when it runs outside the debugger (VS2008). How can I do it?
The best I can think of is to use some kind of a windows port of SAR utility from Linux to see what was the system memory state before I launched the program and what was the system memory state after I closed the program.
I am talking about an MFC GUI application.
Thanks!
modified 30-Sep-13 2:03am.
|
|
|
|
|
See here before you get too far into this.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Thanks David for the prompt reply.
Unfortunately my question was not clear nor complete...
What I meant was that I need to verify that memory is cleaned after app is closed.
So I'd like to check the system free memory before I started the app and after I closed it, and this way to know if all the allocated memory was cleared.
|
|
|
|
|
dushkin wrote: What I meant was that I need to verify that memory is cleaned after app is closed. It is, whether you want it to be or not.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
dushkin wrote: What I meant was that I need to verify that memory is cleaned after app is
closed. So I'd like to check the system free memory before I started the app
and after I closed it, and this way to know if all the allocated memory was
cleared.
Emphasizing the previous response - that is always true regardless of what your application does.
When the application stops, except for some exotic resources, all resources are cleaned up. Memory (all of it) is released, files are closed, sockets are closed, UI specific resources are closed, etc, etc, etc.
|
|
|
|
|
|