rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

The actual ethernet frame size is 84-1542 octets (bytes) in size. Here is a wikipedia article about it: http://en.wikipedia.org/wiki/Ethernet_frame

The last 12 bytes is taken up with the interframe gap, so the actual data packet, including the CRC is 1530 bytes in length.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Your file system has been corrupted due to the hard shutdown. You need to boot with a recovery disc or partition and fix the file system before you can continue.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

What virtual machine manager are you using? And are you using a nat'ed or a bridged network configuration for the virtual machines?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

The simplest way is to use the C function strchr(const char* source, char target). It will return the pointer to the character if found in the string, or null if not.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Well AD, I don't disagree that WiFi cruft is a big issue with Linux. With Ubuntu and related systems it is often because they require that you install proprietary drivers and firmware (required for most WiFi gear) manually, so they don't work "out-of-the-box"... Pisses me off! Anyway, if you need to get WiFi running on Linux, and your system doesn't work with default drivers, then visit www.linuxwireless.org. They have drivers, or links to drivers, and firmware for just about any non-supported gear, as well as comprehensive instructions to get them installed and running.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Oh, and you need to implement the getInput() function as well... :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

So, this is a 3-part problem. Solve each separately, and then see if you need to make some changes to make them all work together. Example of a possible issue to bring up with your professor is #2, "when the numbers are put into the array, are the sums of the rows, columns and diagonals equal to each other?". My question is, when examining the semantics of the question, is whether he/she wants to simply know if they are equal, or does he/she want you to make them equal? Very different things, for sure.

So. Problem #1 - remember each number input and check if any have already been input. Problem #2 - well, this goes back to my previous query about the professor's intent. Problem #3. And after reading #3 about the output, I have to assume that the intent is not so much that you make every row/column/diagonal meet the conditions, but just to test if they do.

So, go back to problem #1 - what would you do, taking one input at a time from a user, to populate a 5x5 array. Consider that the array could be defined as such:

int array[5][5];

And then, what would you do as each item is input to see if it has not been input yet? One way is as follows:

// Make sure we initialize the array to known values NOT >=1 OR <= 25
// Zero is good for this case.
int array[5][5] = {{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0}};

// For …
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

The symbols ROW_BOUNDS and COL_BOUNDS are macros? If so, please post their definitions (in their entirety) here. Also, you are missing other code, such as where mat1rows, et al are declared and defined. IE, you need to post the function declaration that you are calling here, as well as the code that calls it. Giving us less than half of the necessary information makes it difficult to help...

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

A bad connection, or bad wire which have excess resistance will generate the heat you felt. The cable is fubar. Contact Gateway, and if they resist replacing it free, tell them they are lucky your system didn't burst into flames, resulting in a costly lawsuit and a lot of more money in your bank account (assuming it didn't burn you up in the process)... After all, if it had caused a fire, and you were asleep at the time, what might have been the outcome of that? :-( They owe you, and in my opinion, a LOT more than a silly cable!

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

What distribution+version of linux, and which version of wpa_supplicant are you using? FWIW, this is a pretty new enhancement, so you may need to get current sources and build it from scratch.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

So, a more generic offering:

void swapChars( char* p1, char* p2)
{
    char tmp;
    tmp = *p1;
    *p1 = *p2;
    *p2 = tmp;
}
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Swap elements 1 and 3:

void swap1and3(void)
{
    char* p1 = &menu[1];
    char* p2 = &menu[3];
    char tmp;

    tmp = *p1;
    *p1 = *p2;
    *p2 = tmp;
}
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Are you looking it up by key, or by value? Do you need to handle duplicates? Does it need to be sorted? What is the average tuple (element) size? How many elements will your collection contain? Before days of the STL (Standard Template Library) I implemented a wide variety of C and C++ collections such as maps, multimaps, hashmaps, hash tables, linked lists (single and double link types), sorted linked lists, circular lists, etc. Now, for C++ at least, one would just select the appropriate type of collection from the STL and be done with it. In Java there are generics (template classes) very similar to the collection template classes in C++.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

So, there you have it - at least 3 to choose from - yasm, nasm, gas. There are probably others. I know that Intel has their own in their Linux and embedded development tool set (not free, however).

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Any uninitialized variable will contain whatever is in that chunk of system memory (automatics are on the stack, so whatever was in that stack space). If you were to run a function in a loop, since the stack when the function is run will always be at the same place, if you don't initialize the variables, they will always have the same data values. A pointer will happily point to whatever is in that stack frame, which in your case is kernel memory, probably because that stack address had previously been used by something that set it that way.

This is why, using uninitialized automatic or class member variables will result in "undefined" behavior. Caveat Programmer! (Programmer Beware!). If you want to use a language that protects you from such things, then don't use C/C++... :rolleyes:

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Also, the way you are reading the file, you are reading each word separately. Is that what you want to do? What about duplicates? Anyway, I implemented an insertion sort for C++ years ago (about 20 years ago) that used a modified bsearch() routine to find the insertion point in the array (these days you should use a vector), pushed the values from that position to the end down one in the array, and set the insertion point element to the new value. Some optimizations included head and tail insertions, which sped up inserting sorted data tremendously. Since this is an in-memory operation, you may need to limit the size (we handled over 100K items very efficiently, with key sizes of 40-50 bytes).

Other issues to decide. When you need to grow the array, don't grow by just one element - waaay too slow! So, have a settable size increment member (or class static) variable. Also, you need to decide if you want duplicates!

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Don't use atoi(). Use strtol(), strtoul(), etc. The last (third) argument passed to the function is the base. It will try to convert intelligently if the base is 0, so if the string is 0xCAFEFACE, it will look at the "0x" and convert from hex, where 01234567 would be treated as octal since it starts with zero and only has digits 0-7. If you pass a second non-null argument (char** endptr) the address of a string pointer, the pointer will be set to where in the passed number string the conversion stopped, such as when it encounters a letter or some other character. Anyway, the signatures are:

long int strtol(const char* nptr, char** endptr, int base);
long long int strtoll(const char* nptr, char** endptr, int base);
unsigned long int strtoul(const char* nptr, char** endptr, int base);
unsigned long long int strtoull(const char* nptr, char** endptr, int base);

Your compiler may or may not support the long long (64-bit values) versions.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

:lol: Good one! And just how many billion$ do you have available for this exercise?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Start by studying other kernels - simple ones like FreeDOS, for which the source code is available. You need a kernel (control program), and a shell (monitor), along with some utilities to do something like look at system activity, etc. There will be drivers necessary in order to access any hardware (video, drives, etc). So, you might want to get an appropriate operating system book, such as Minix (which was Linus Torvald's inspiration for Linux). Look on Amazon.com.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Do we also get your degree when you graduate?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

A reasonably full-featured router for the network should allow you to block internet access to all but the authorized systems. You can do this with a dedicated router (cheapest, and easiest method), or a computer that is acting as a router.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Can you boot into safe mode and run a virus scanner on your system?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Most of your code is pretty bogus... :-(

  1. The structure member ar[] has the size outside of the brackets. Wrong...
  2. The rest of your code is bogus. The initialization of buff is not correct.
  3. What is this while() condition? And what are the minus signs preceeing the array[i] members of the loop?
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Abstract: exists only in concept, not in reality. In C++ this would be a class with virtual member functions that have no implementation. Exampe:

class abstract {
public:
    abstract();
    abstract(const abstract& cpy);
    ~abstract();
    abstract& operator=(const abstract& rhs);

    virtual unsigned computeArea() = 0;
};

Note the virtual method declaration that has an implementation = 0. That means that it is not implemented in this class, so this class cannot be instantiated. A derived class will have to be created that does implement this method. This is somewhat (not exactly) analogous to a Java interfact class; however, in C++ you can have abstract/virtual classes like this that do implement some of their interfaces, which you cannot with a Java interface class.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

By "go the other way" you mean you use s.at(i) = tolower(s.at(i))?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

And FWIW, using a zero size array as the last element in a structure is not an uncommon (but deprecated and discouraged practice) for a variable size element who's size you don't know until the structure is created. In such a case, there is usually a member of the structure that stores the size of the array, as in:

struct foo
{
    size_t sizeOfArray;
    char array[0];
}

struct foo* makeFoo(size_t size)
{
    struct foo* retval = calloc(1, sizeof(struct foo) + size);
    retval->sizeOfArray = size;
    return retval;
}

These days you would use a size of 1 for the array as some compilers don't like 0 size arrays. Remember, just because GCC and/or MS Visual C/C++ let you do so, doesn't mean that other compilers will. Trust me that this exact thing has bitten me in the backside in the past... :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Yes, in theory you can have a zero-size array, but you cannot do anything with it except get its address! And, even though conformant compilers will deal with it, it may actually have no address since it uses no space! My guess is that the compiler simply eliminates it as unneeded code/data. However, you are taking its address in your printf() functions, so I guess in this case, it does give you an address. However, I think that the address of a and b (both on the stack) will be the same... Anyway, this begs the question - why are you doing this?! :rolleyes:

zeroliken commented: completely agree +9
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

You basically want your circular list class to extent the linked list class, not encapsulate it as you have. Then, your circular list class will ensure that the last node is pointing to the first node in the linked list. It eliminates a lot of cruft and lets you focus on the differences between the two types. That way, when you find the marker (assassin), you can easily remember that node, go to the next to find the following, and then set the following to the Next member of the assassin node. Voila! One dead victim! And you don't have to do anything to keep the list healthy except that if you "kill" the head of the linked list, you need to reset it to the next member that you just linked to the assassin... Clear as mud yet? :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

If you can post your code that broke the compiler here, it may be illustrative. Usually something weird in the code will cause this sort of problem, although I have broken many compilers with perfectly legal code. In some of those cases I had to rattle cages at the top of the company's engineering heap (VP of engineering for HP, Sun, and DEC come to mind) to get the appropriate attention paid to the problem. Since these problems also jeopardized delivery of software their own companies needed to build their latest manufacturing facilities, usually I was able to get some pretty prompt service... :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Run Linux with qemu installed. Then you can run just about any sort of emulator you want... and often faster than on the original hardware with modern 64-bit x86 systems.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Well, with Linux and a bash shell, this would be trivial:

find . -type f -exec chown name.group {} \;
find . -type f -exec chmog ugo+rw {} \;

etc. So, you can install Cygwin (free Linux/Unix environment for Windows) and have these tools available for you. I find they are very useful on Windows systems for these sort of bulk updates.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

It may be a clock syncronization problem. Make sure all your systems are getting clock updates using NTP. You can either use an internet NTP server such as NIST, etc, or you can set up a local server on your LAN which will keep all the PC's updated locally, yet it will keep updated from the Internet - allowing a large LAN installation to minimize the amount of NTP traffic going out of the firewalls.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Actually, it is called Thunderbolt. It is a high-speed interconnect for audio, video, data, etc. You can connect appropriate stuff at multi-gigabit speeds, such as external displays, disc drives, etc. It is sort of a replacement for firewire, but with more capabilities.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

The most common x86 assembler for Linux is yasm.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

You could always install a Linux operating system on your laptop... :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Where is the declaration/definition of stuff[]?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Time to switch to Linux...

PhilliePhan commented: That's really helpful!! -2
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Back in the day when Ethernet was over coax cables, half-duplex was a necessity (the comment about CSMA-CD is appropriate here). That changed with ethernet over twisted pair when you could have separate channels for sending/receiving data. Back then, before ethernet could run over twisted pair, ethernet was not suitable for real-time control systems. Arcnet and Token Ring could be (and were) used for deterministic realtime systems. Once ethernet was running on full-duplex switched gear, it became capable of real time (deterministic) behavior, so now it is ubiquitous in industrial control systems which previously would have been interconnected via alternative means.

silvercats commented: thanks,good info +0
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Good question. Have you run a virus scanner (or 3) on your system to determine what has infected you?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I used to use Roxio a LONG time ago. I long since switched to Alcohol 120% for Windows disc ripping and writing. It has been 100% more reliable than Roxio's cruft. Here is a link: http://www.alcohol-soft.com/

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

A VPN is the usual way, although if your bandwidth needs are great, you might be better off leasing dedicated bandwidth on the fiber optic cables between point A and B. My company (a tier-one mobile phone manufacturer) has data centers in a number of places all over the world. We have that sort of dedicated "pipe" between our various data centers so we can easily shift load from one to another as necessary. Our major data centers are in the US, Great Britain, Singapore, and China, and more regional ones in India, South America, and elsewhere (not sure where they all are). These are multi-gigabit links. So, depending upon the day and time, a phone user in Brazil that wants to browse their Facebook account may be connected to a data center in any of those locations. To the user, there is a small delta in latency, but overall the end-to-end time is very close to the same.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Most A/V products perform what is called "on access scanning" in that when you start a new program, then the A/V product will scan the program file and all loaded components (shared libraries, and other files) before allowing it to run. This can cause serious performance problems, as you have seen. Once they are scanned and loaded into memory to run, then the system load will return to normal. Let's say that the executable and its associated libraries and other data comprise 100MB, then the scanner has to read through and analyze all 100MB EACH AND EVERY TIME it is loaded into memory. Myself, I usually disable that "feature" since I scan stuff before I download or install it on my computer. I use ClamWin, an open source A/V program. It does not do on-access scanning, though it can scan memory as well as files on demand, and it can be integrated with your email and browsers to keep malware from getting into your system in the first place.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Ok. I think your logic for push() and pop() is somewhat inverted. In push(), you set the top of the stack to the new element (S(top) = item), and then you set top to the previous entry (top = top + 1). Why line 11 in main() is generating the error (push(s, 5), I am not sure. Let me think on all of this some more, and review my old ADA texts... :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Whew! I haven't coded any ADA for about 7 years, so it will take me a bit of refresher time to help you on this. Be patient! :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

It was probably installed somewhere else, and the old version is found first in your PATH environment.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Beginning with L7Sqr's comment, there are a lot of resources out there, including the source code for GCC/glibc and other compilers/libraries out there that implement malloc/free which you can study to help understand what is going on. I did a considerable amount of research back in the 1990's into memory management functions and generic garbage collectors. This is not simple, but it is doable.

  1. You need to get memory from the operating system heap. Traditionally the brk()/sbrk() system calls do this.
  2. You need to determine a method of tracking where memory that malloc provides is located.
  3. You need to be able to merge freed memory segments as necessary.
  4. You need to have a method to provide a suitably sized chunk of memory to the user program when asked with malloc(), from the free store you have available.
  5. If a big enough chunk of memory is not available, then you need to know how to ask the operating system to give you more, if available, and tack that onto your free store.
  6. etc. etc... :-)

Remember, Google is your friend! :-) And good luck! FWIW, this is a GREAT assignment! It will teach you a lot by the time you are done!

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Some compilers will co-locate string literals that are "equal" at the same address. However, this is not required, and a lot of compilers do not do that. So, the comparison that you are doing is comparing two pointers (addresses) that are not necessarily equal, and are not in your situation, so the comparison is false (unequal). Use the strcmp(const char* str1, const char* str2) function instead, as in

if (strcmp(p,q) == 0)
{
    printf("equal");
}
else
{
    printf("unequal");
}
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

See Knuth, Volume 3, Sorting and Searching, Addison-Wesley Pub.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

It is difficult to read this. Consulting the site's guidelines on how to post source code. Here is an example:

    // This is a comment
    // Here is some code
    for (int i = 0; i < 1024; i++)
    {
        if ((i % 100) == 0)
        {
            cout << (dec) << i << endl;
        }
    }
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

It requires an argument that is an object of type Picture. You are calling the method without any arguments, and while the class writer could have included a version of the method that takes no arguments, they did not. As a result, the compiler is telling you that you are missing an argument of type Picture. Clear yet?