rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Classes are to be preferred if you may want to subtype them and their behavior. Example for your logging functionality. You might a logging class to log to a file, rotating the files when they get to a certain size, and another one to send log messages to a remote system via TCP/IP or some sort of middleware. Their functionality is basically the same, but how they do what they do is quite different, so some virtual functions for the actual logging would be appropriate, especially if you had a virtual base class as effectively an interface class. That way, you could pass a pointer to that base class to a function and it could log stuff without needing to know what kind of logging class you are using. This sort of operator overloading is extremely useful in order to work with what we call abstractions, or in more current parlance, patterns.

Function libraries are very useful when what you are doing is discrete, such as TCP/IP socket handling, and not likely to be used to derive new behaviors.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

That probably means that there are no available partitions left. The standard partition table only has room for 4 primary partitions. Windows and the recovery partition take two of those. Please boot into the LiveUSB device, log into the GUI as root, start up a terminal/console window, and execute this command, posting output here: fdisk -l
That is a dash ell, not dash one as the argument to the fdisk command.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Do you mean Ubuntu 10.10? Also, are you running the 64-bit, or 32-bit version? Post output of the command uname -a here.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Have you done a thorough virus/malware/trojan scan of your system? It could be hardware (something as simple as a loose/bad cable), or it may be something more serious. If it is the drive, they aren't very expensive to replace ($30USD about). If you have been pwnd, then you may have a much more serious problem to deal with.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

UDP - more efficient
TCP - more reliable

A number of applications use UDP because of its efficiency, such as (optionally) NFS. Example, One end sends sends 100 packets, each associated with one block of a file. It will sequence them, and include a checksum. These are validated by the receiver, which only needs to tell the sender to resend those that have a bad checksum, or that are missing. This is basically what tcp does, but tcp also requires an ack of each packet whereas udp does not. As a result, on a clean connection (such as a lan with good ethernet switches), you get much better throughput with udp than tcp. For WAN applications, tcp is a much better choice in my experience. So, if an application can choose or be configured to use either UDP or TCP, then select UDP for high performance LAN applications, and TCP for WAN applications.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster
const char* ptr = "255";
unsigned int i = (unsigned int)strtoul(ptr, 0, 10);
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Depends upon the OS. For Linux there is the inotify event subsystem. Don't know/care what Windoze uses.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

The quoted excerpts are pretty clear to me. What, specifically, are you confused about?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Huh? This is a meaningless question in itself.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Sorry, but we don't solve your class problems for you. If you need some help and/or comments with specific parts of your code, that is another thing, and that we might help you with.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

What Narue said is all very true. However, to get you on your way, first you need to write the code that can identify variable declarations/definitions, such as: int a,b,c; Next, you need to break out each variable in this list, which requires that you recognize the comma delimiters and terminating semicolon. Note that sometimes these declarations may span lines. Also note, you may see something like this: int a=3,b,c; or this int a = 3, b, c; I could go on, but you should start to be seeing why Narue said that this gets complex quickly. As a result, my guess is that the purpose of this exercise is to get you to thinking about parsing and parsing problems - a very important part of computer software engineering.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

There are a number of functions in the atoi() family, some of which can be used for floating point values. These functions are strtof(), strtod(), and strtold(). Don't use atoi() or atof() functions - it is better to use strtol() and strtof() type functions instead as they give you better support when parsing input. If you are running Unix/Linux systems, see the man pages. If Windows, see the MSDN library documentation, or look up online.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

This seems to be on a Unix/Linux system, correct? Chances are you have exceeded the amount of memory available to you as specified by your ulimit environment settings. This is to keep individual processes from eating up all system RAM. On my system, since I am the sole user and administrator, I set my limits to "unlimited" because I have some applications that of necessity use a lot of RAM. However, this is very unsafe, especially if you have a buggy program that gets into a "runaway" state while allocating memory. I have one application that occasionally does this, and I have to catch/kill it when it starts to hit the swapper.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

To print to another output stream using the C-style printf() functions, you would use fprintf(FILE* fp, const char* fmt, ...) function. However, for C++ it would be preferable to use output stream objects such as ostream, ofstream, ostringstream, etc. You can create your own output stream class that provides the behavior you want.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

We don't do homework assignments for people. You need to make the effort to write this program. Then, we might be able to make suggestions to help you understand your mistakes and what to do next.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Windows has supported NFS, as a client at least, for a long time, since Win2000 anyway, with their SFU (Services for Unix) package - a free download from MS. NFS would be most useful when your Unix/Linux servers are not going to run Samba. If Unix/Linux is the client and Windows is the server, then I would advise using CIFS since that way there is better preservation of Windows file/directory permissions, ACLs, and such. Anyway, staying with CIFS/Samba just keeps your Windows users from needing to futz with all the *nix cruft. All they need to do is share folders as usual, or connect to a group share on the *nix system(s) like they do to another Windows box.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I'll need to look that up in my copy. May be a few days before I can respond.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

As someone once said, "scooby dooby dooby do"... :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

What about mounting a Windows box's CDRom?

I don't bother with that, since I only run Windows these days in a virtual machine on a Linux host... :-) If Windows shares the drive, then it should work just fine.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

CIFS - Common Internet File System

This is the updated version of SMB (Server Message Block), or Samba. Linux systems use CIFS to mount Windows shares, but will use a Samba server to provide shares to Windows systems. CIFS is the protocol. Samba is the application/server code. So, yes Samba per se has been outdated by CIFS, and you can indeed directly mount Windows shares in Linux. I do it all the time. Likewise, vise versa for Windows mounting Linux shares.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

When you run into that problem, you will discover that you have 10K lines of code to fix... Be safe. Read the ANSI/ISO C++ standard. They are very clear on this point. In the company I was senior/principal engineer at for almost 20 years, we made that part of the company coding standards. We learned early on that there were cases when it was not good. We were developing major enterprise systems in C++ that had to build and run identically on many different hardware and operating system platforms, ranging from PC's with Windows to QNX real-time systems, to just about every Unix variant out there (AIX on PPC, SunOS/Solaris on Sparc, HPUX on PA-RISC and Itanium, Tru64 Unix on DEC Alpha, and SysV on NCR, plus others). This bit us once, and when I pointed out that the Standard is clear on this point, there was no argument from management to change our coding standards to be FIRM on this point. Don't assume that all compilers behave identically - they manifestly do not!

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

ROFL! Then it's probably a good thing I'm a vegetarian! I only need to pick the fries out from between my teeth when I eat at Mickey D's.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

In your example, you are calling the constructor CircularLinkedList(int), which does not initialize the head pointer. You assume that add() does that, which it should, but that is a bad practice. In any case, there are a number of issues. Whatever you do, make sure that you initialize your member variables in the initialization block, before the body of your class constructors. This will save a LOT of grief. IE, instead of this

Node(int in, char* val,Node* nextNode){
     index = in;
     value = val;
     next = nextNode;
  }
.
.
.
   CircularLinkedList(){
      head = NULL;
   }
   CircularLinkedList(int capacity){
      size = capacity;
      for (int i = 0; i < capacity; i++)
         add(i,NULL); //add new node value of char* NULL      
   }

do this

Node(int in, char* val,Node* nextNode)
  : index(in), value(val), next(nextNode)
  {
  }
.
.
.
   CircularLinkedList() : head(0) {}
   CircularLinkedList(int capacity) : head(0)
   {
      size = capacity;
      for (int i = 0; i < capacity; i++)
         add(i,NULL); //add new node value of char* NULL      
   }

Also, DO NOT USE 'NULL' for generic null pointers in C++. Use the value 0 instead. Why you ask? Because NULL is defined as ((void*)0), and that cast may be a problem in some cases. You are ALWAYS safe to assign 0 to a pointer for a null value. Says so right in the ANSI C++ standard... :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

@rubberman

Thanks for the correction

Not a problem. We all get used to the goodies on our particular systems, often not considering if they are available elsewhere. After 30 years of serious cross-platform development (one code base, 10+ operating systems, 10M lines of code) I quickly learned that what works on one system, may either not work at all (not available), or function differently on another. It gets really fun when you are bit-twiddling and you switch from a big-endian to a little-endian (or vice versa) machine, or one where a long integer is 32 bits to one where it is 64 bits.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Hey Frogboy, isn't it difficult to speak when your tongue is so stuck in your cheek? :lol: :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

re: Ancient Dragon

2 statements:

Call program, redirecting input from file and output to results file.

1. while read cin into number and not eof(cin)
2. write to cout number^2

done... :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

There are a number of good references online with regard to quicksort and similar algorithms. Here is a link to the wikipedia article: http://en.wikipedia.org/wiki/Quicksort

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I have found that an insertion sort - a modified qsort, that inserts items in the appropriate place in an array, is extremely effective and efficient. I wrote a class some time ago to do that, and it could handle very large numbers of entries very efficiently. I also optimized for head/tail insertions so that either sorted or reverse-sorted inputs would go in quickly. If you already have your data in an array or vector, then a quicksort would be best using qsort(), or a b-tree.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

There are a lot of options, including C-style sprintf(), C++ ostringstream objects, etc. FWIW, itoa() is not a standard function, but a lot of systems and compilers support it - caveat programmer! Anyway, here is a link to some documentation on the ostringstream class which is probably what you should use: http://www.cplusplus.com/reference/iostream/ostringstream/

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Sorry, but we are not going to do your homework for you! Make an effort first, and then we may critique it and give you some pointers, but don't expect a 4 course meal for free!

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

That depends entirely on the encryption and hash algorithms used. Any current strong encryption method should NOT provide pattern-based clues to the plain-text. For more information about all of this, read Bruce Schneier's book "Applied Cryptography".

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Computer forensics is a growing field, and there is always a need for competent analysts in that field of endeavor. If that is your interest, then I would suggest that you consider an MS in computer forensics as well as a BS in computer science. The CS degree is a good start on the forensics stuff, but there is a great deal of depth to the field that cannot be garnered in an ad-hoc manner. It is a real discipline that requires a rigorous approach to generate valid results from your analyses.

As for a final year project, there are a number of things you can do, such as keyword/keyphrase searches, deleted file analysis and non-destructive recovery of deleted data (requires physical access to the drive media, and may require specialized tools), etc. Remember, that in forensics, you need to preserve UNTOUCHED the original media, otherwise you have polluted the water and your analyses may not be admissible in court. So, first you make a bit image copy of the drive being analyzed, then you search that. The recovery of deleted data requires access to the physical media so you can do a sector-by-sector scan to dig out what has been deleted or overwritten. However, you have to document your processes to assure the court that you have made no changes to the media itself (read-only operations). However, the bit-image you made at the beginning should hold a lot of that, so hopefully you won't need to get into …

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

The implementation of printStock() and Sales() differ from their declaration at the top of the file. The declaration for printStock() is void printStock(int, int) whereas the implementation is void printStock(int[], int) . Ditto for Sales().

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

So, what is your problem. You want us to analyze your code, but you give no indication where you are having a problem. You have $200USD/hour for my consulting time? Probably not. So, what is your problem?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Often times paper and pencil are your best approach.

Amen to that! :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

itsRadius is a pointer, you need to dereference it before incrementing it.

Precisely. Ie,

/Prefix, increment then fetch
const SimpleC& SimpleC::operator++()
{
	++(*itsRadius);
	return *this;
}
 
//Postfix, creates temp to store original, increment, then fetch 
const SimpleC SimpleC::operator++(int)
{
	SimpleC temp(*this);
	++(*itsRadius);
	return temp;
}

Anyway, good first effort. The mistake is common in new programmer code. One other issue/mistake is the question as to why you are using a pointer-to-int for itsRadius instead of a simple integer (unsigned is probably better)...?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I would urge against installing one Distro then using repos for a different distro. It smells of fail and/or much pain at some point.

If you don't want to pay Red Hat for support then don't install their OS. Install CentOS from scrach. CentOS recommend that you do not simply change the repos.

For running systems with a lot of software installed and used on them, this may not be a simple, or even feasible solution. The fact of the matter is that you CAN install alternative repositories on RHEL systems from clone systems, the two main ones of which are CentOS and SL. I, and clients, have done this not infrequently, and have never had a problem with that, including RHEL 4, 5, and now 6. I've done it on my own systems to avoid a long, messy reinstallation.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

No. Too much other stuff on the agenda. I'm chairperson of an IEEE network in the Chicago area and that, along with my music (playing in a bluegrass band), and consulting practice takes most of my time.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I often use pseudo code to express clearly what I want to do. However, do try to be consistent. Example, in your IF/ELSE/ENDIF block you assign the calculated amount to the variable Deposit_Amount, but at the end you print Loan_Deposit, and not Deposit_Amount, which is what I think you were intending. Also, your initial read/if/endif block where you take input to Loan_Amount, should probably be a do/while loop, breaking out only when the Loan_Amount value is valid, or a termination value is input.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Good Form.. Relating to the post though... I do believe ANT is an android game that was enjoyable.

Rubberman, almost on 200 posts, good form.

Or as they say in Merry Old England - well bowled! :lol: FWIW, I got my colours in cricket, not rugby - me a dyed-in-the-wool Yank!

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I spent a year at boarding school in England many moons ago, and we used to do that also after a rugby match.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I got tickets to see the Harlem Globetrotters in Cardiff next month - now that's what I call living!

I took my Little Brother to see the Globetrotters at the old Boston Garden some years ago, when he was 12 or 13. Boy was he thrilled! He got a whole bunch of autographs. I saw them before in the 1950's with my dad in Nebraska, when Wilt "The Stilt" Chamberlin and Meadowlark Lemon were playing - that was also such a thrill! So, have a great time - these are great entertainers, and athletes.

diafol commented: Nice one. Can't wait! +0
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I couldn't live in a snowy environment for too long, I love going to the beach 200 days of the year :) Motor bike riding, fishing.. In the snow i guess most of those things are a rarity.

Not to mention that I am 1000 miles from the nearest ocean! We have a big lake (Lake Michigan) nearby, but not too many people swim in it during the cold months. There are a few, called "polar bears", who brave the frozen waters for a few seconds to prove how "tough" they are! We went to a lodge up in Minnesota a couple of years ago in the winter for a weekend dance and music jamming event, and some cross-country skiing. They had a nice sauna, and a hole cut in the ice (a foot thick) in the lake outside, with a ladder to climb out. You get all hot and sweaty in the sauna, run outside to jump into the icy water, and then quite literally "explode" back to the surface and zip inside! The Scandinavian descendants who live in the area seem to think it's quite the thing to do! :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I'm from Australia, if there was snow outside, tell you what, that would be fun.. Go outside, get active.

Around here, in the winter, I go outside and shovel snow for exercise... :-) Wouldn't mind some nice warm weather and a nearby beach... Spring has sprung. It has finally gotten above freezing a few days this past week, so I walk around the block a couple of times before I turn blue from the chill. Mostly, for exercise in the winter here, when I'm not shoveling snow, is to go to a barn dance with my wife. Sometimes we play. Sometimes we dance. Sometimes she calls the dance and I handle the door.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Work sucks. Studying sucks. Playing music rocks! I speak as a 60+ year old geek who also plays bluegrass mandolin... :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

1. Make sure that the school agrees to this - it is probably illegal.
2. What makes you think it hasn't already been done? :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Depends upon the OS. I use Brasero or K3b on Linux. On Windows I use Alcohol 120%, but that I paid for - fewest "coasters" of all I've worked with on Windows. I've had no problems with Brasero or K3b on Linux, but I think they both use mkisofs (genisoimage) or growisofs under the covers, but like all burners, one is advised to record at somewhat slower speed than the maximum that the disc is advertised as capable. IE: for an 8x DVD, record at 4x to 6x for better reliability.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Go out side, enjoy the fresh air??.... Ride a motorbike, go to the beach..

10 below zero, snowing, everything is closed, nowhere to go... Gee, sometimes a good session of flinging birds is just what was on order! :-)

ChrisHunter commented: funny response. +3
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I guess Red Hat considers maintaining the repositories to be part of support. In any case, that is how they enforce their licensing. They don't do anything else that will keep your system from running, which is good, and as I said, it is easy enough to install alternative repositories that bypass their support licensing. I know a number of people who have done that upon my advice. In some cases, they may be better off paying Red Hat for support, as they will also have to pay me for my time. Sometimes that is what I advise.