|
|
Good evening everyone I'm new to this forum, I wanted to ask if anyone can help me find the code of the algorithm Apriori in C. Thanks to all.
|
|
|
|
|
Maybe start with this article[^].
Sorry, I realized after posting that the article is C#, not C.
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
|
|
|
|
|
thank you anyway for your assistance, I hope someone can help me
|
|
|
|
|
|
I compiled the code but I have these errors. I do not understand where I am to put ever.
can anyone help me?
error LNK2028: unresolved token (0A000476) "class std::set<class std::set<unsigned int,struct std::less<unsigned int>,class std::allocator<unsigned int> >,struct std::less<class std::set<unsigned int,struct std::less<unsigned int>,class std::allocator<unsigned int> > >,class std::allocator<class std::set<unsigned int,struct std::less<unsigned int>,class std::allocator<unsigned int> > > > __cdecl apriori(unsigned int const &,class Matrix const &,unsigned int const &)" (?apriori@@$$FYA?AV?$set@V?$set@IU?$less@I@std@@V?$allocator@I@2@@std@@U?$less@V?$set@IU?$less@I@std@@V?$allocator@I@2@@std@@@2@V?$allocator@V?$set@IU?$less@I@std@@V?$allocator@I@2@@std@@@2@@std@@ABIABVMatrix@@0@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)
error LNK2028: unresolved token (0A000477) "void __cdecl display(class std::set<class std::set<unsigned int,struct std::less<unsigned int>,class std::allocator<unsigned int> >,struct std::less<class std::set<unsigned int,struct std::less<unsigned int>,class std::allocator<unsigned int> > >,class std::allocator<class std::set<unsigned int,struct std::less<unsigned int>,class std::allocator<unsigned int> > > >,class std::map<unsigned int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::less<unsigned int>,class std::allocator<struct std::pair<unsigned int const ,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > >)" (?display@@$$FYAXV?$set@V?$set@IU?$less@I@std@@V?$allocator@I@2@@std@@U?$less@V?$set@IU?$less@I@std@@V?$allocator@I@2@@std@@@2@V?$allocator@V?$set@IU?$less@I@std@@V?$allocator@I@2@@std@@@2@@std@@V?$map@IV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@U?$less@I@2@V?$allocator@U?$pair@$$CBIV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@std@@@2@@2@@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)
error LNK2028: unresolved token (0A000478) "public: void __thiscall Matrix::getData(void)" (?getData@Matrix@@$$FQAEXXZ) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)
error LNK2028: unresolved token (0A000479) "public: __thiscall Matrix::~Matrix(void)" (??1Matrix@@$$FQAE@XZ) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)
error LNK2028: unresolved token (0A00047A) "public: __thiscall Matrix::Matrix(unsigned int,unsigned int)" (??0Matrix@@$$FQAE@II@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)
error LNK2019: unresolved external symbol "public: __thiscall Matrix::~Matrix(void)" (??1Matrix@@$$FQAE@XZ) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)
1>salvo.obj : error LNK2019: unresolved external symbol "void __cdecl display(class std::set<class std::set<unsigned int,struct std::less<unsigned int>,class std::allocator<unsigned int> >,struct std::less<class std::set<unsigned int,struct std::less<unsigned int>,class std::allocator<unsigned int> > >,class std::allocator<class std::set<unsigned int,struct std::less<unsigned int>,class std::allocator<unsigned int> > > >,class std::map<unsigned int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::less<unsigned int>,class std::allocator<struct std::pair<unsigned int const ,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > >)" (?display@@$$FYAXV?$set@V?$set@IU?$less@I@std@@V?$allocator@I@2@@std@@U?$less@V?$set@IU?$less@I@std@@V?$allocator@I@2@@std@@@2@V?$allocator@V?$set@IU?$less@I@std@@V?$allocator@I@2@@std@@@2@@std@@V?$map@IV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@U?$less@I@2@V?$allocator@U?$pair@$$CBIV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@std@@@2@@2@@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)
|
|
|
|
|
It looks as though you need some basic C++ and compiler experience before moving on to something as challenging as the apriori algorithm.
LNK2028
http://social.msdn.microsoft.com/forums/en-US/vcgeneral/thread/e1417460-0ec7-400e-9df5-f16b98c7fd4d[^]
"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
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
|
Youming Lee wrote: char **ptr_alph = (char **)malloc(wordCount * sizeof(char *));
Explain this, please. What do you mean "can't calculate the expression"?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
when i debug ,until the place "char **
ptr_alph = (char **)malloc(wordCount * sizeof(char *))",compileer shows the error. where can i put the photo of the screenshot?or email to you .i am afraid i can't tell the problerm. or it may be caused by another error.
|
|
|
|
|
Just copypaste the relevant lines from the compiler's output here.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
You havent asked a queation, you have asked us to fix your code.
So the answer is: NO.
Come back with a properly formulated question and we will answer it.
==============================
Nothing to say.
|
|
|
|
|
Hello Friends
I am in difficult situation to create a map of maps.
I am having one class with Variables to store data.
class A
{
int id;
string a;
string b;
}
And ,there is one naother class
class Apart
{
string c;
string d;
int a;
int b;
}
Now,Situation is that I am having data that needs to be store in arrays of class A' object .And each object having an array of class Apart' object.
I used map for class A like this:
map<int,A> mapA;
map<int,A>::iterator itrA;
for(int n=0; n< numberofobjects ;n++)
{
A* objA = new A();
...
mapA.insert(make-pair(n,objA));
delete objA;
}
But,Now,how will I create map of map and How will I Insert into map.I googled but ddint get any right way.
I tried this way:
map<int,map<int,Apart>,A> mapA;
But,what we need to do while inserting.So many confusions.
Any Ideas?
Thanks In Advance.
Regards
Yogesh
|
|
|
|
|
Not sure i understand correctly, but...why not make the map of Apart s a mamber of A ?
class A
{
int id;
string a;
string b;
std::map<int, Apart *> aparts;
};
std::map<int, A*> As;
then you can insert into it like:
A *AnA = new A;
AnA->aparts.insert(std::pair<int, Apart *>(5, new Apart));
As.insert(std::pair<int, A*>(3, AnA);
and you can find items in it like:
std::map<int, A*>::iterator AIT = As.find(5);
A *AnA = (*AIT).second;
std::map<int, Apart *>::iterator ApartIT = AnA->aparts.find(3);
Apart *AnApart = (*ApartIT).second;
Error checks ommited for clearity...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
Code-o-mat wrote: > The problem with computers is that they do what you tell them to do and not what you want them to do. <
Heh, that reminds me of an occasion where the representative of a client took me aside after delivering the specifications for the software we were to develop and told me (rough translation):
"Please, if you will, give us the software that we need, not that which we tell you we want."
Good thing we were not computers.
|
|
|
|
|
It's good to know there are clients who actually know that they don't know what they want.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
Use the correct data structures! Nothing in the code and explanations you gave warrants the use of a map, let alone a map of maps. For all I know a simple C-style array might suffice, or maybe a std::vector, if you have need to add or remove elements after the intial construction of that array.
Besides, I understand that the code you provided just serves as an illustration of your problem, not as real code, but none of the member variables in your classes can be accessed - they are all private and you have no accessor functions!
For sake of simplicity I changed the classes A and Apart to struct . The following should serve your purposes at least so far as you have described them:
struct Apart { std::string c; std::string d;
int a;
int b;
};
struct A {
int id;
std::string a;
std::string b;
int nparts; Apart* parts; };
void initializeA(A& myA, int number_of_parts) {
myA.nparts = 0; if (myA.parts = new Apart[number_of_parts]) {
myA.nparts = number_of_parts;
}
}
* Note: I prefer to not add using statements to my code. there are way too many libraries for similar things, and often the names used within the namespaces of these libraries are very simple and might easily clash with existing symbols, or symbols from other libraries. Therefore I prefer std::string over just string . It has the added advantage that code posted into a forum out of context can be easily recognized to be using a specific library, in this case the STL.
|
|
|
|
|
I have created a thread using CreateThread() function
The thread function is as follows:
void backtrack(LPVOID)
{
while(1)
{
Sleep(iDelay); //iDelay is a global int variable
__________ //iDelay default value is 10000
__________
.
.
}
}
iDelay is a global int variable whose default value is 10000(10 minutes). The user can change the delay variable iDelay when the thread is running.
OnChangedelay()
{
iDelay = //Get input from user using a dialog window
SuspendThread(htBackTrackThread);
ResumeThread(htBackTrackThread);
}
My Question is:
When the thread is running with default Sleep time iDelay = 10000, I changed the Sleep time to 1000 using the OnChangedelay() function. But the new delay time takes effect only after 10 minutes which is the old delay time. I guess that since the thread has executed the sleep statement and in the sleep mode for 10 minutes, I am not able to suspend the thread and resume the thread with the new delay time.
Any solution to suspend the thread immediately even if it is in Sleep()
modified 27-Sep-11 7:02am.
|
|
|
|
|
|
Actually, My question is How to suspend a thread when it is in Sleep mode
|
|
|
|
|
Use the alertable SleepEx[^] function.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
modified 27-Sep-11 8:53am.
|
|
|
|
|
Excellent answer. Though the link needs an 'x' on the end to make it end ".aspx".
If I'd been the original developer of SleepEx, I would have called it the WakeUp() function instead.
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
|
|
|
|
|
Fixed, thank you.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
manoharbalu wrote: iDelay is a global int variable whose default value is 10000(10 minutes).
If you are after 10 minutes, you might want to consider 600000 milliseconds, otherwise you're looking at about 10 seconds.
"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
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
Hi,
I use the CWinThread class to have my CDialog GUI stay responsive while doing some lengthy calculation. However, my thread needs to stay alive, since it can receive some notification anytime while my application runs. The problem I have is that after InitInstance is done, my thread automatically enters the ExitInstance method, which I do not want. However, I want my thread to stay alive until I close my CDialog, and then enter ExitInstance. Any idea how this can be performed?
Thanks alot.
|
|
|
|
|