|
Hello everybody?
I am trying to know how I can detect changes in data streams.
But I don’t have any practice this field.
I found 1 paper and read it. But I didn’t understand fluently it. (http://www.cs.technion.ac.il/~shai/vldb04.pdf)
If you have any idea about detecting changes in data streams, can you help me?
Also can you explain to me algorithm that presented paper?
What is distance anything?
My e-mail address is u_bulga@yahoo.com.
Thank you so much for your help.
Thank you
|
|
|
|
|
i face problem in insert data from text file to mysql database,when the program finish read a line of a text file,it should insert data into database.
How can i make the program to insert data into database once read a line from text file?
Below is my code:
-----------------------------------------------
void CXXXDlg::OnButtonInsert()
{
// TODO: Add your control notification handler code here
CStandardDB db;
FILE* pFile = fopen("c:\\XXX.txt","r");
log_standard logRead;
while (!feof(pFile)) {
if(!searchfile(logRead.strLogdate,pFile,'\t'))
break;
if(!searchfile(logRead.strLogtime,pFile,'\n'))
break;
insertdb(&logRead);//after finish read a line,call insert data
}
//insertdb(&logRead);//success insert last line of data if call insert data here
}
void CXXDlg::insertdb( logfile * pLog)
{
CDatabase myDb;
myDb.Open(NULL,FALSE,FALSE,"ODBC;DSN=standard");
CODBCRecordset rs(&myDb);
CString strQuery="";
strQuery.Format("insert into standard (logdate,logtime,name) values (\'%s\',\'%s\',\'%s\')",
pLog->strLogdate,pLog->strLogtime,pLog->strName);
//AfxMessageBox(strQuery);
myDb.ExecuteSQL(strQuery);
}
|
|
|
|
|
I'm having trouble trying to do one on the implementation files of my project. can you plz help... i will attach the appropriate header file/s and .cpp files which I have completed, yet however that is one .cpp which is partially completed, can you really help with the definition of the member functions. The partially completed file is called EmployeeDatabase_template.cpp. i included the source code below for you to look at. plz help with definition of these member functions
<pre>
#include "EmployeeDatabase.h"
#include <vector>
using namespace std;
EmployeeDatabase::EmployeeDatabase()
{ // Complete code.
size = 0;
}
void EmployeeDatabase::getEids(vector <int>&ids)
{ // Complete code.
}
string EmployeeDatabase::getName(int employeeID)
{// Complete code.
}
double EmployeeDatabase::getShoeSize(int employeeID)
{// Complete code.
}
void EmployeeDatabase::makePerson(string employeeName, int employeeID, double employeeShoeSize)
{//complete code.
}
int EmployeeDatabase::getSize()
{// Complete code.
return size;
}
</pre>
here is the appropriate specification files(header files).
this is EmployeeDatabase.h
<pre>
// A EmployeeDatabase consists of a vector of Persons;
// methods are supplied to retrieve all the employee IDs and
// to query the database for employee names and shoesizes using
// the corresponding employee id.
#include "Person.h"
#include <vector>
using namespace std;
#ifndef EmployeeDatabase_H
#define EmployeeDatabase_H
class EmployeeDatabase{
public:
EmployeeDatabase();
// Constructor:
// Makes an instance of an EmployeeDatabase containing no data.
void getEids(vector <int>& ids);
// Returns a vector of all the employee ids in the vector people.
string getName(int employeeID);
// Returns the name of the Person with eid equal to employeeID.
double getShoeSize(int employeeID);
// Returns the shoesize of the Person with eid equal to employeeID.
void makePerson(string employeeName, int employeeID, double employeeShoeSize);
// Creates a new instance of Person using the input data
// and adds it to the vector people.
int getSize();
// Returns the number of Persons stored.
private:
// The database is vector of Persons.
vector <Person> people;
int size; // The number of Persons in the database.
};
#endif //EmployeeDatabase_H
</pre>
This is Person.h
<pre>
// A Person consists of the name, the employee ID and the shoe size.
// Methods are supplied to retrieve each of the three data items.
using namespace std;
#include<string>
#ifndef Person_H
#define Person_H
class Person{
public:
Person(); // Default constructor.
Person(string personName, int personId, double personShoeSize);
// Constructor:
// Makes an instance of a person with the
// given data.
string getName();
// Returns the name of the Person.
int getEid();
// Returns the employer ID of the Person.
double getShoeSize();
// Returns the shoesize of the Person.
private:
string name; // The employee's name.
int eid; // The employee's ID.
double shoeSize; // The employee's shoesize.
};
#endif
</pre>
PLZ CAN YOU HELP ME WITH THE FIRST BIT OF CODE THE OTHER TWO ARE THE HEADER FILES. I JUST CANT FIGURE OUT HOW TO DEFINE SOME OF THE MEMBER FUNCTIONS.
|
|
|
|
|
You need to create a vector of employees, then the makePerson method should create a person from that data, and push it onto the vector. Then you can return the vector, or search it for the data that the other methods require. Have you used a vector before ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
no I have very limited knowledge on vectors. I know the push back and pop stack functions but vectors, I'am in the process of learning. However could you possibly show in first bit of code, in which I have the member functions undefined,(place where it says complete code). I have created a application test program, however, i need first to define those un-completed member functions. CAN U PLZ make adjustments to the code given.. plz help.. THANKS FOR THE SHARP RELPY
|
|
|
|
|
in the header file you need
vector<person> m_Staff;
void EmployeeDatabase::getEids(vector <int>&ids)
{ // Complete code.
ids = m_Staff;
}
void EmployeeDatabase::makePerson(string employeeName, int employeeID, double employeeShoeSize)
{//complete code.
Person p(employeeName, employeeID, employeeShoeSize); // this assumes a class called person with this constructor signature
m_Staff.push_back(p);
}
Now, for your search functions, do you want to do something like :
std::vector<person>::iterator it = m_Staff.begin();
for (; it != m_Staff.end(); ++it)
{
Person p = *it; // You dereference an iterator to get the object.
// Check if this person has the data you're looking for, and if so, return it.
}
// return some default value for item not found.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hello everyone!
OK, look:
http://www.sulfurmidis.com/error.jpg
That's part of what I get when I try to compile my code in DOSBox using this command:
gpp tfc.cpp
The problem is that the code compiles really well on both Windows and Linux... Is this a problem with DJGPP and DOSBox, or am I doing something wrong? I downloaded everything that the Zip Picker from DJGPP's site told me, and then I unzipped it to a directory, set the DJGPP environment variable to "C:\DJGPP\DJGPP.ENV" (I also tried with forward slashes) and added the Bin directory to my PATH. Do I have to do something else? What do I do at this point? Thanks! Everyone who answers gets a free caramel candy!
PS: What's the difference between the GPP and G++ commands?
Sulfurik K. Nosferathus (Darth_Sulfur)
www.SulfurMidis.com
www.SulfurSoft.tk
http://www.BeepXtreme.tk
[ftp://][http://][hotline://]tsfc.ath.cx
|
|
|
|
|
|
Wow, I never thought I'd have to post this question here but after digging around I'm not totally certain what the best approach is.
Essentially, I'd like to write something like kiwisyslogD without the UI. Essentially I just need to watch in/out traffic on a NIC and log whether it's TCP/UDP/Etc the port and remote IP. If it's a web request I want to get the URL. I've seen tons of different examples that use WinPCap, Network Packet Drivers, Etc. They seem to have a lot of other stuff I don't need. This is only going to log to a file. It will never have a user interface nor will it do anything other than what I've just described. I only need Windows support and if I cannot support all flavors then 2K/XP/2K3 will have to do. I have no need/reason to log the traffic on the network. Just in/out on the host machine's NIC.
If I didn't have to reference a 3rd partly library I'd prefer that. What are the ideas and where do I begin? I've programmed in C/C++ but not in this nature before.
- Rex
Some assembly required.
Code-frog System Architects, Inc.
-- modified at 21:25 Saturday 10th September, 2005
|
|
|
|
|
I wrote some program about polymorphism but it is giving runtime error.
what i observe is it is not calling type cat speak() function
#include <iostream>
#include <string>
#include <conio>
using namespace std;
class Pet
{
public:
Pet(){}
virtual ~Pet(){}
virtual void speak();
inline void breath()
{cout<<"\nGASP "<<endl;}
};
void Pet::speak()
{
cout<<"\nGROW! "<<endl;
}
class rat:public Pet
{
public:
rat(){}
~rat(){}
void speak();
};
void rat::speak()
{ cout<<"\nRat noise "<<endl;}
class cat:public Pet
{
public:
cat(){}
~cat(){}
void speak();
};
void cat::speak()
{
cout<<"\nMeaw "<<endl;
}
/*void chorus(Pet pet,Pet *ptr,Pet &refptr)
{
pet.speak();
ptr->speak();
refptr.speak();
}*/
#define MAXCAP 50
int main()
{
int quit=0;
int choice;
int toalno;
Pet *ptr[MAXCAP];
int i=0;
while(quit==0&&i<MAXCAP)
{
cout<<"\nEneter(0) for Quit"<<endl;
cout<<"\nEneter(1) for rat"<<endl;
cout<<"\nEneter(2) for cat"<<endl;
cin>>choice;
if(choice==0)
{quit=1;}
else if(choice==1)
{ ptr[i++]=new rat;}
else if(choice==2)
{ptr[i++]==new cat;}
else
{cout<<"\nINVALID ENTRY"<<endl;}
}
toalno=i;
for(i=0;i<toalno;i++)
{
ptr[i]->speak();
}
getch();
return 0;
}
Regards
cnu...
-- modified at 13:06 Saturday 10th September, 2005
|
|
|
|
|
mcnu wrote:
{ptr[i++]==new cat;}
Did you mean = ?
BTW, I threw this into a compiler to see what was wrong and found it right away. Your compiler should give you a warning for mistakes like this, mine did.
Christian Graus - Microsoft MVP - C++
-- modified at 18:33 Sunday 11th September, 2005
|
|
|
|
|
I got that .But my compiler didn`t give any warnings for this.i am using Borland C++ 5.0
sorry for the wasting of your valueble time and
THANKS FOR THE HELP
Regards
cnu...
|
|
|
|
|
mcnu wrote:
sorry for the wasting of your valueble time
Not at all, glad to help. You should check your compiler warning settings, I'd have thought any half decent compiler would help you find little traps like this.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I have the compiler Borland C++ 5.0 and Visual C++ 6.0.
which one is the best compiler . could you please suggest me .
Thank You
Regards
cnu...
|
|
|
|
|
I would guess VC6 because of the amount of online help you can get, but VC6 is really crappy, VC7 is tons better if you can get it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
is that same Visual Studio.net and VC++ 7.0
Regards
cnu...
|
|
|
|
|
Yes, .NET 2002 is VC 7.0. There is also 2003 and soon, 2005.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote:
VC7 is tons better if you can get it.
Make it VC 7.1, and download it for free here[^].
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
Why the compiler complains about "'operator <<' is ambiguous" in statement like cout << I;. Is it ambiguous because it doesn't know which "<<" operator to call: the one in iostream and the one in code snippet below? If so I don't see any ambiguous exist!
#include <iostream>
#include <sstream>
#include <cstring>
using namespace std;
class IntArray
{
public:
enum { sz = 5 };
int i[sz];
IntArray() { memset(i, 0, sz* sizeof(*i)); }
int& operator[](int x)
{
return i[x];
}
friend ostream& operator<<(ostream& os, const IntArray& ia);
friend istream& operator>>(istream& is, IntArray& ia);
};
ostream& operator<<(ostream& os, const IntArray& ia)
{
for(int j = 0; j < ia.sz; j++)
{
os << ia.i[j];
if(j != ia.sz -1)
os << ", ";
}
os << endl;
return os;
}
istringstream& operator>>(istringstream& is, IntArray& ia)
{
for(int j = 0; j < ia.sz; j++)
is >> ia.i[j];
return is;
}
int main()
{
stringstream input("47 34 56 92 103");
IntArray I;
input >> I;
I[4] = -1;
cout << I;
}
|
|
|
|
|
I made some modifications in your code and it is working fine. i think objective of program is" reads input from user and get printed on screen" .that works fine and you need call operator "[]" like this:
I.operator[](-1);
#include <iostream>
#include <string>
#include <conio>
using namespace std;
class IntArray
{
public:
enum { sz = 5 };
int i[sz];
IntArray() { memset(i, 0, sz* sizeof(*i)); }
int& operator[](int x)
{
return i[x];
}
friend ostream&operator<<(ostream& os, const IntArray& ia);
friend istream&operator>>(istream& is, IntArray& ia);
};
ostream& operator<<(ostream& os, const IntArray& ia)
{
for(int j = 0; j < ia.sz; j++)
{
os << ia.i[j];
if(j != ia.sz -1)
os << ", ";
}
os << endl;
return os;
}
istream& operator>>(istream& is, IntArray& ia)
{
for(int j = 0; j < ia.sz; j++)
is >> ia.i[j];
return is;
}
int main()
{
/*stringistream input; */
IntArray I;
cin >> I;
//I[4] = -1; // Use overloaded operator[]
cout << I;
return 0;
}
Regards
cnu...
|
|
|
|
|
Thanks mcnu
But actually the original implementation isn't wrong, later I found when I made the definition of friend operator "<<" inside the class the codes compile smoothly!
I wonder why the compiler treated the operator "<<" definition outside class as another function!
|
|
|
|
|
Your Welcome
But it`s must be not giving error if it`s definition made inside the class or outside the class it must be work.
In my compiler it doesn`t giving error to the "<<"
operator definition
it is only giving error to the ">>" operator definition only
my compiler is Borland C++5.0
Regards
cnu...
|
|
|
|
|
|
I read your reference and i wonder why it is needing forward declaration.
anyway thanks to you because i got some new knowledge from you
Regards
cnu...
|
|
|
|
|
At first glance, this is an issue with Koenig lookup ( read my article ). VC6 is not very standards compliant. VC7 and onwards is a whole new world.
Christian Graus - Microsoft MVP - C++
|
|
|
|