Advertisement

09.01.2007 at 11:19AM PDT, ID: 22801859 | Points: 250
[x]
Attachment Details

counting occurrences in data file

Asked by fin_comp in C++ Programming Language, C Programming Language, Data Mining

Tags:

ok. so here's a data file that I have from a C program that prints 0's for no user activity, 1 for user activity in the last minute, and X's for system standby or reboot etc. See same data file below:
----------------------------------------------------------
- This is the output file from idleCollect2.  Data is    -
- collected once per minute. Output data is '0' for no   -
- user keyboard or mouse activity in the last minute,    -
- '1' for activity, and 'X' for system in sleep mode.    -
----------------------------------------------------------
Collecting data for 30 days
Program start time         = Mon Aug 27 17:41:45 2007
Data collection start time = Mon Aug 27 20:00:00 2007
----------------------------------------------------------
1100000000000010000000000000000000000000000000000000000XXXXX : null
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX1110110010 : Mon Aug 27 22:00:00 2007
00000000000000000000000XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX : null
111111111111111111111111110001011000000000001100000001110000 : Tue Aug 28 00:00:00 2007
011001XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX : null
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX : null
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX : null
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX : null
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX : null
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX : null
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX : null
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX : null
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX : null
XXXXXXXXXXX1010000000000111111XXXXX1111111111111111111011111 : Tue Aug 28 10:00:00 2007

I'm trying to find a way to represent the data in a more meaningful way i.e. be able to graph something to show how often a user is busy, idle, and be able to predict according based on history of user data. So the only way I thought of is to write a  program to grab the timestamp for each entry in this text file, count the number of X's 1's and 0's in each log and print that in another file. The output could be something like this:
- timestamp: X's: 25, 1s: 16, 0s: 19

The null timestamp is there because I chose not to print the timestamp for when the  pc was rebooted, standby or etc. so no need to timestamp those entries.

The other possible problem in the text file is when the pc reboots, standby or etc, the program auto resumes but I don't want it to print the header above again in the text file. I just want it to simply continue printing in the log i.e 1's 0's and X's for the next hour.

can anyone help as far as implementing the logic to grab the timestamp for each entry in the text file, count and print the number of 1's, 0's and Xs?

If you guys want, I can post some codes use to generate the data file.


Start Free Trial
[+][-]09.01.2007 at 11:48AM PDT, ID: 19814872

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.01.2007 at 12:10PM PDT, ID: 19814951

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.01.2007 at 12:23PM PDT, ID: 19814994

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.01.2007 at 12:38PM PDT, ID: 19815042

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.01.2007 at 12:59PM PDT, ID: 19815099

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.02.2007 at 09:32AM PDT, ID: 19817466

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.02.2007 at 11:18AM PDT, ID: 19817679

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.02.2007 at 12:49PM PDT, ID: 19817901

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.02.2007 at 01:03PM PDT, ID: 19817934

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628