Hi. I am having some trouble with my computer. Here is a quick review of issues...About a month ago my McAfee AV kept getting turned off. I could not figure out what was wrong. Nothing was found on any scans. I removed McAfee and got AVG free edition. It stopped doing that and has been working fine since then. Two days ago, my internet started going haywire. When I search for anything, the results are redirected to bogus advertising websites. You can type the URL in the address bar or go through Favorites and it works fine but clicking on and results link redirects it. I have run AVG, SuperAntiSpyware, Windows Malicious Removal Tool and Malware. I ran AVG & SuperAntiSpyware this morning while in Safe Mode. AVG said it found a trojan horse Backdoor.Generic14.cbjj. It did not seems to remove it. It also found 4 viruses located in C:\Windows\Temp\kolfo...etc. SuperAntiSpyware found some cookies and registry keys affected. It said it removed them. AVG keeps popping up that a threat was found and the only option I have is to ignore it. Also, I noticed that I have my cookies under Internet Options set to med-high and it keeps getting changed to Accept all Cookies. So, here is what I have done and the results...

I ran Windows Malicious Removal Tool. It ran for almost 3 hours with a Full Scan and did not find anything.

I tried to run ATF Cleaner but it froze up and became unresponsive.

I ...

I know you use strcmp() with strings and that if it is equal to zero, they match. But, how do you see if one string is less than the other? I want to compare SSN's to see if 12345620 is less than or greater than 123456708. Thanks for any input.

Can anyone tell me why this is printing doubles out to the output file?

[CODE]

IndexFile.seekp(20, ios::beg);

for (i = 0; i < NumOfSlots; i++)
{
if (RandomFile.peek() == 42)
{
Position = i;
RandomFile.seekg(37, ios::cur);
//cout << Position << " ";
}
else if (RandomFile.peek() != 42)
{
RandomFile.get(R.SSN, 10);
NumberWritten = NumberWritten + 1;
Position = i;

  //cout << Position << " ";

  IndexFile << R.SSN;
  I.RelativeAddress = Position;
  IndexFile << setw(3) << I.RelativeAddress;
  IndexFile << setw(3) << -1;
  IndexFile << setw(3) << -1;

  IndexFile.seekg(20, ios::beg);

  IndexFile.get(I.SSN, 10);
  IndexFile >> I.RelativeAddress;
  IndexFile >> I.LLink;
  IndexFile >> I.RLink;
  Position2 = Position2 + 1;

  for (i = 0; i < NumberWritten; i++)
  {
    if (strcmp(R.SSN, I.SSN) != 0)
    {
      if ((strcmp(R.SSN, I.SSN) < 0) && (I.LLink == -1))
      {
        I.LLink = Position2;
        IndexFile.seekp(3, ios::cur);
        IndexFile << setw(3) << I.LLink;
      }
      else if ((strcmp(R.SSN, I.SSN) > 0) && (I.RLink == -1))
      {
        I.RLink = Position2;
        IndexFile.seekp(3, ios::cur);
        IndexFile << setw(3) << I.RLink;
      }
    }
  }

  RandomFile.seekg((Position + 1) * 37, ios::beg);
  IndexFile.seekp((Position2 + 1) * 20, ios::beg);
}

}

[/CODE]

The output file should look like this:

[CODE]
123456720 3 -1 -1
123456708 4 -1 -1
123456705 5 -1 -1
[/CODE]

I am trying to fix the links but it keeps printing 20, 08, 20, 08, 05, etc. I am trying to crete an external binary tree in the output file. Thanks for any input.

Can anyone help me with this snippet of code? I have 2 files, a random record containing random records in it and an index file, which contains the binary tree of the random record. Here is what the index file looks like:

123456720 4 -1 -1
123456708 6 -1 -1
123456703 10 -1 -1
123456723 30 -1 -1
... etc.

What I do is add 1 number from the random record file into the first position of the index file. Then, I need to search the index file for the record I just inserted. The first record I come across that has a left or right link of -1 is the parent of the record I just inserted. My problem is:

I read the record from the random record number and get it inserted into the index file. Then, I want to start at the top of the index file and read each SSN. If it is not the record I just inserted, I want to check that record's link. I cannot get it to read the SSN from the index file. Here is what I have:

[CODE]

struct RandomRecord
{
char SSN[10];
char LastName[16];
char FirstName[11];
char MidInitial;
};
// end struct RandomRecord

struct IndexRecord
{
char SSN[10];
int RelativeAddress;
int LLink;
int RLink;
};
// end struct IndexRecord

.
.
.

for (i = 0; i < 100; i++)
{
if (RandomFile.peek() == 42) // the asterisk
{
Position = Position + 1;
RandomFile.seekg(Position * 37, ios::beg);
} ...

Here is my code:

use strict;

my @lines;
my $line;
my @fields;
my $fields;
my $count;

open(INPUT, "PerlOutput.txt") || print "Unable to open file";
open(OUTPUT, ">Parse.txt") || print "Unable to open output file";

@lines = <INPUT>;

close(INPUT);

foreach $line (@lines) {
@fields = split(/ /, $line);
if ($fields[0] eq 'OPAREN') {
push(@fields, $fields[1]);
print OUTPUT "$fields[0] ";
print OUTPUT "$fields[1]";
}elsif ($fields[0] eq 'CPAREN') {
pop(@fields);
print OUTPUT "$fields[0] ";
print OUTPUT "$fields[1]";
}elsif (($fields[0] ne 'OPAREN') && ($fields[0] ne 'CPAREN')) {
print OUTPUT "$fields[0] ";
print OUTPUT "$fields[1]";
}
}

close(OUTPUT);

The input file looks like above (one lexeme and token per line in previous post). The output file did not print like I had it typed. It should be like this:

OPAREN (
DEFUN Defun
NAME Acount
[tabs here] OPAREN (
[tabs here] NAME L
[tabs here] CPAREN )
... etc.

The tabs are used to indent each level of a parse tree as you are printing it to the output file. I have the parse tree I just need to get it to indent each level when printing.Thanks for any help you have.

I have a file, which I have read, and need to print a parse tree for it. What I am doing is a syntax checker only for open and close parentheses (). If the item read is a open parentheses, I put it on a stack. If it is a close parentheses, I pop it off the stack. But, as I am reading and writing, I need to write the parse tree to the file. The input file looks like this:

OPAREN (
DEFUN Defun
Name Acount
OPAREN (
NAME L
CPAREN )
OPAREN (
COND cond
OPAREN (
...
etc.

The parse tree should look like this:

OPAREN (
DEFUN Defun
NAME Acount
OPAREN (
NAME L
CPAREN )
OPAREN (
COND cond
OPAREN (
... etc.

The problem I am having is printing the tabs when there is a new level. Does anyone know how I could print the tabs out at a new level. Thanks.

Does anyone know how to match a negative number? What I am doing is printing the lexemes with their token to an output file. But, the problem is negative numbers. It should print like this:
INT -1

Instead, it prints like this:
SUB -
INT 1

The SUB - is technically right because the minus sign is printed this way but I want it to recognize the -1 as an INT. Any suggestions? Thank a lot.

TIRED OF PULLING MY HAIR OUT OVER SIMPLE THINGS! :mad:

I have a problem that deals with reading a random access file and creating an index file, which is a file to hold the binary tree of the random access file. I have the index file created with SSN (key), relative address of the SSN in the random access file, and a left and right link. What I need to do is every time a node is inserted, compare the node with the root of the tree. If it's less than, find the first SSN record in the index file that has a left link set to a -1 (dummy) and set that link equal to the position of the node I just entered. If greater than, find the first SSN record in the index file that has a right link set to a -1 (dummy) and set that link equal to the position of the node I just entered. The links are the left and right child. The first one I find with a link of -1 is the parent of the node I just inserted. Does anyone have any ideas how to do the search? Thanks for any input.

Does anyone know how to ignore the rest of a line in Perl? I am reading a file and printing out tokens to an output file. I want to ignore the rest of a line after a colon is found, which indicates a comment. That way it will not print to the output file. I tried a range from (; - \n) but it does not work. Thanks for any input.

I have a program that I need to do some matching in. For example, I need to match the lexemes in a LISP function and print the token out to a file. For example:

if ($input =~ /(^()/)
{
print OUTPUT "OPAREN $1\n";
$input =~ s/^(//;
}

I need the matching for the parentheses, letters, digits, etc. I am confused when it comes to matching. Thanks for any input you may have.

It is a 5-way balanced sort-merge. I have 10 temp files to work with (5 for input and 5 for output). I have to use a clump size of 1,000, write clumps of 1,000 records to the first 5 files. Then, I get 1 clump from each of those files and write the clumps to the alternating other 5 files. An example:

I have 1,000,000 records.

After phase 1:
Each of Files 1 - 5 have 200 clumps of 1,000 that are sorted.

In phase 2:
The first pass should put 40 clumps of 5,000 records in files 6 - 10.
The second pass should put 8 clumps of 25,000 records in files 1 - 5.
etc...

I am having a hard time controlling the loop to do the writing to the alternate files. Thanks if you have any input about it.

Does anyone know basic pseudocode for a balanced k-way sort-merge? Thanks for any info you may have.

Because my assignment requires me to. We have to show blocking and non-blocking direct communication and blocking and non-blocking indirect communication. But, it has to randomly choose between blocking and non-blocking for both direct and indirect communication. Thanks for the input.

I have a program that uses blocking/non-blocking direct and indirect communication. I need to have it randomly choose whether or not it should do the blocking or non-blocking method and I do not know how. Does anyone have any suggestions? Thank you.

Does anyone know how to have a thread randomly decide if it wants to do blocking or non-blocking mode with direct communication? I am using a bounded buffer with size of 5. I have the non-blocking mode right but I am not sure how exactly to change it to accommodate for blocking mode. I am not very proficient with Java. I am actually just learning. Does anyone also know how to do blocking direct communication with only 1 producer and 1 consumer used for blocking and non-blocking? Thanks for any help anyone may have.

No, the shared sides would not be diagonal. The best way I know to describe it is that the element would have a shared side by going side to side through the elements or up and down through the elements. So, for example,

M[1][1] would share a side with M[0][0], M[1][2], and M[2][1] but not with M[0][1] or M[2][2].

I assume there would not be a solution if the sum of the elements are odd because the 2 parts would not be equal. All of the numbers are regular integers. And I also assume that 2 elements can be equal. The data file has an unlimited number of matrices in it but they are defined like in the original message above. Thanks.

I have an assignment that I need to do that designs the necessary classes to facilitate an indirect blocking and non-blocking communication environment between threads (producers and consumers) using a bounded buffer whose size is defined at run time. I am to test the working of these classes by creating an environment where 2 producers and 2 consumers communicate with each other by arbitrarily choosing either blocking or non-blocking mode.

I also have to design the necessary classes to implement an emulated direct blocking and non-blocking communication between threads through a bounded buffer whose size is defined at run time. What this means is though the communication appears to be direct, in actual terms, it is implemented through a bounded buffer.

Does anyone know how to implement these examples in Java? I do not know Java but I get the concept of OOP. I do have pieces of code for creating the bounded buffer, the threads, and the mailbox (from my text boook).

One question I have is how do you ensure that the info sent by a particular producer for a particular consumer is delivered to that consumer? And be able to block until that is done? How do you match up the message from the producer to the consumer?

I am not sure how to implement the blocking or non-blocking methods. Thanks for any input anyone may have. It would be greatly appreciated.

I am doing a 5-way balanced sort merge. I have 1, 000, 000 records and a toal of 10 temp files to work with (5 for input and 5 for output). After phase 1, the temp files F0 thru F4 are populated with clumps of sorted records. The clump size is 1000. I am using an array of files to work with, instead of hard coding 10 temp files. My phase 2 is not working correctly. What I am trying to do is read 1 record from each of the 5 temp files and write the smallest one to the corresponding output file. I am having trouble with what controls the loop to do this phase as well. The total number of runs 5.

Here is the main part of my code:
[code]
int main()
{
cout << '\n';
cout << "**Phase 2 Started**" << '\n';
cout << '\n';

Merges = ceil ((NumOfColumns / NumOfFiles));
ClumpSize = ClumpSize * NumOfFiles;
F[Counter] >> Number1;

F[Counter+1] >> Number2;

F[Counter+2] >> Number3;

F[Counter+3] >> Number4;

F[Counter+4] >> Number5;

if (Counter == 5)
{
Counter = 0;
}

while (PassCount < NomOfPasses)
{
for (i = 0; i < Merges; i++)
{
for (j = 0; j < NumOfFiles; j++)
{
for (k = 0; k < ClumpSize; k++)
{
if ((Number1 < Number2) && (Number1 < Number3) && (Number1 < Number4) && (Number1 < Number5))
{
X.WhichFile = 1;
X.Priority = -1;
X.Number = Number1;
P.Insert(X);
F[Counter] >> Number1;
if (F[Counter].eof())
{
break; ...

I have a problem where I read in a 2D matrix and divide the matrix into 2 parts, where the sums of each part are equal. Each part must contain contiguous integers that can be networked together by following paths from one intger containing cell to another via shared sides. The first matrix is:

4 4
50 85 9 33
301 46 40 19
105 29 11 12
20 13 23 16

The solution is:

301 + 105 = 406
50 + 85 + 9 + 33 + 46 + 40 + 19 + 20 + 29 + 11 + 12 + 13 + 23 + 16 = 406

I get the matrix read in and I added up all of the numbers and divided by 2. This gives me the total that each part should be equal to. Does anyone know how I should attempt to figure out which numbers I should try to add up in the array to get the correct total? I am at a loss there. Thanks for any input.

I have a problem that I am not sure how to even come up with a solution. So, I was wondering if anyone would have any input to the problem at hand. I have to divide a matrix that is defined by an input file into 2 distinct regions so that the sums of the integers in each region are equal. And also to dicover how many combinations of two distinct regions can be created. For example, the first matrix is defined in a file as:

4 4 // The size of the matrix (a 4x4 matrix)
50 85 9 33
301 46 40 19 // The data in the matrix
105 29 11 12
20 13 23 16

The solution to this problem is:

301, 105
50, 85, 9, 33, 46, 40, 19, 20, 29, 11, 12, 13, 23, 16

Each line adds up to 406.

Each region must contain contiguous integers that can be networked together by following the paths from one integer containing cell to another via shared sides. Shared vertices are not acceptable. Wrap around paths from the edges of the matrices are not allowed and there can only be two regions per combination.

Thanks for any input anyone may have.

I am running Windows XP. I also have a Borland compiler. Thanks. I did not know it was not a portable command.

I know there is a way for the user to enter input and be able to accept it without the user having to press the Enter key but I do not know the command. Does anyone here know? For example, I have a menu like this:

A Add a record
D Delete a record
L Change last name
etc.

I want the user to type an 'A' and not have to hit the Enter key. The program just accepts the 'A' automatically. Thanks for any help. :p

Thank you. The "OutputFile.peek() == '*' " worked great. Thank you, thank you, thank you. I thought I had to store the value found with the peek() function. :)

Does anyone know how to compare a old style character string with a character in qoutes? Example:
I want to compare the first character in a record that is stored in an old style character string with a *. Here's what I have in my code:

char    FirstCharacter[1];  // Character string to hold to value found by
the peek() function

OutputFile.seekp(Total * 60);
//Seek to the correct position

FirstCharacter[0] = OutputFile.peek();
//FirstCharacter set equal to peek()

if (FirstCharacter[0] == "*")
{
cout << "Dummy Record";
}
//Try to compare value stored in FirstCharacter with a "*". If it is true, I know that I can write my record there.

It will not compare the string like it is. I get the error Cannot convert char to char* I tried strcmp() also, but to no avail. I get the error message Cannot find a match for strcmp(char, char*. Anyone have any suggestions? Thanks a lot.

I am trying to create a random access file from a sequential file. I have the random access file skeletonized with "dummy records". An example of my dummy record is:

                                                                                            100

ZZZZZZZZZZXXXXXXXXXXYYYYYYYYYYYYYYYYYYYY00.00 -1
ZZZZZZZZZZXXXXXXXXXXYYYYYYYYYYYYYYYYYYYY00.00 -1

The "'s" are a SSN, "Z's" are the last name, etc, etc. The 100 and the -1's are a link at the end of each file (to be used with synonym chaining). The 100 is the next available slot in my overflow area. Anyway, the problem is that I read the first SSN, use a hash function on that SSN (hashes to position 69 in the file). I use seekp to get to position 69. Then, I want to peek at the first character on line 69 and see if it is a "". If it is, I want to write the file to that line. If not, I want to add it to the overflow area. Here's what I have:

[code]while (Record.MySSN[[i][/i]i])
{
Sum = Sum + (int) Record.MySSN [i++];
}

Total = Sum % 99;
Total = Total + 1;

OutputFile.seekp(Total);
FirstCharacter[0] = OutputFile.peek();
cout << FirstCharacter[0];[/code]

It gives me the correct Total of 69. If I print out "tellp()", it gives me 69. But, where I print out "FirstCharacter", I get a "Z", not a "". I just want to check the first character without advancing the read/write arm. But, it gives me the Z instead of the . Any suggestions to compare the first character on the line to a *? ...

Thanks a lot for the input, Tight Coder. It worked great! Solved a very simple problem for me. Thanks again! :p

Can anyone tell me how to compare a string to an integer? I have a SSN stored as a string, SSN[10]. I need to compare each number in the SSN. What I need to do is to add up the ASCII values of the SSN to use for a hashing function. For example, the SSN is 222116666. I need to add the ASCII values up: 50 + 50 + 50 + 49 + 49 + 54 + 54 + 54 + 54 = 464.
strcmp() does not work comparing a string and an integer. I have the string class and tried it that way (declaring SSN as a string type) but then it will not let me use get(SSN) to read the SSN. Any suggestions? Thanks a lot.

Does anyone know how to stop a Java thread? I am not very familiar with Java and am not really sure exactly what I am doing. I have to create the necessary classes to facilitate an indirect blocking and non-blocking communication environment between threads (producers and consumers) using a bounded buffer whose size is defined at run time. I have to test the working of these classes by creating an environments where 2 producers and 2 consumers communicate with each other by arbitrarily choosing either blocking or non-blocking communication. I have all of the classes defined, i.e., BoundedBuffer, Buffer, Producer, Consumer, Channel (the mailbox), etc. The program will create the threads and run them but I cannot get the threads to sleep. I tried a "producerThread.sleep(1000)" command but it does not like that command. Any suggestions? Thanks a lot.

Here's the code:

// BoundedBuffer class

public class BoundedBuffer implements Buffer 
{
    private static final int BUFFER_SIZE = 5;
    private int count;
    private int in;
    private int out;
    private Object[] buffer;
    private Consumer C;
    private Producer P;

    public BoundedBuffer()
    {
        count = 0;
        in = 0;
        out = 0;
        buffer = new Object[BUFFER_SIZE];
    }

    public void send(Consumer C, Object item)
    {
        while (count == BUFFER_SIZE);

        count++;
        buffer[in] = item;
        in = (in + 1) % BUFFER_SIZE;
    }

    public Object receive(Producer P)
    {
        Object item;
        while (count == 0);
        --count;
        item = buffer[out];
        out = (out + 1) % BUFFER_SIZE;

        return item;
    }
}

// Bounded class

public class Bounded 
{
    public ...

I have a program for a 5-way sort merge. I can get the program to read from the original file of 1,000,000 records and write them to 5 tempoary files (File0 thru File4). Then, I am suppose to close the temp files (Files 0 - 4) and open them as input, and open 5 more temp files (File 5 thru File 9). I cannot get the Files 0 - 4 to print to Files 5 - 9. Here is part of my code, as it is a little long. How do you get the % operator to print to Files 5 - 9? It works fine for Files 0 - 4.

InputCounter = 0;
OutputCounter = 5;
int NumOfPasses = 0;
FileSize = ClumpSize * NumOfFiles;

while (NumOfFiles < 5)
{
    while (LoopCount < FileSize)
    {
        for (j = 0; j < ClumpSize; j++)
        {
            F[InputCounter%5] >> Number;
            ClumpArray[j] = Number;
        } // end for

        QuickSort(ClumpArray, 0, 999);

        for (i = 0; i < ClumpSize; i++)
        {
            F[InputCounter%5] << setprecision(15);
            F[InputCounter%5] << ClumpArray[i] << '\n';
        } // end for

        InputCounter ++;
        OutputCounter++;
    } // end while

    NumOfFiles ++;
    LoopCount++;
} // end while

Thanks for any input you may have.

I am having some trouble understanding pure LISP. I am confused about the concepts of atoms and flat lists vs. any lists. I have a problem that should be fairly simple, although it uses recursion, which I am not very familiar with using. The function takes 1 argument which can be any list. It returns the number of atoms named A in the list. I was trying to see if there was only one element in the list and, if so, is it an A. If it is, return a 1. This is what I have:

(defun A-Count (L)
(cond
((null L) nil) ;This works fine
((equal (atom a) L) 1)
)
)

I do not have the default set up yet. Was just trying to get the first working. However, when I run it I get an "error - unbound function" or "error - unbound variable", depending on which example I try to enter. Thanks for any info anyone may have.

It's all Greek to me!