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

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

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

So, you are trying to run the phone as a mobile "hot spot"? Does it support USB tethering? What mobile OS does the phone run?

hmidaboy31 commented: suport wlan nokia n79 +0
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

1. Until you write a sane value to an address, it is uninitialized, and contains random data.
2. Ditto.

You can allocate memory, it has an address, but until you store something there, it contains garbage.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

It has to do with the associations of application and file extensions. If you right click on the .exe file, open properties, and then click on the tool icon, you will get a form that shows what applications are associated with that extension. You can change, or move them up/down to change the default. So, the system thinks .exe is another name for .zip... :-). A Windows exe file may run in the Wine environment, but you need to make sure you have Wine installed. Then you may be able to run it as an application in Linux.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Standards use the sleep(seconds) function, not wait.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Following your statements, neural network and fuzzy logic are examples of IR in programming systems today. Have you studied those disciplines? They are both founded upon rigorous, and proven, mathematics and logic. How familiar are you with Prolog, Lisp, CLIPS and other such inductive reasoning languages and tools? This is not new stuff you are talking about, and many use these tools to great effect in solving otherwise intractable problems. I have applied such methods myself to the development of adaptive systems that currently manage the manufacturing processes at most semiconductor fabs in the world...

So, I don't disagree with what you are saying, but I AM saying that this isn't necessarily new nor innovative. You've rediscovered fire! So, agreeing with you further about the ability of such techniques to reduce system complexity, here is an example:

A thousand lines of complex, but well-written C++ code --> 1 line, and 6 rules written by manufacturing engineers (not software engineers or programmers) stored in the database. That was the delta to associate a lot (carrier of wafers) with the next bit of equipment in a semiconductor fab that is the best choice to process the lot on its next step in the process plan. Some of the factors involved with that decision would be alternate steps in the process plan, current recipes loaded in the equipment needed for those steps, priority of the lot compared with other lots ready to process on that equipment, the maintenance state (or planned …

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Neither Kaplan nor UoP are considered legitimate degree granting institutions by most states. So, if you get an engineering degree from them, don't expect any state Professional Engineering Examination Board to accept that as part of the requirements for a PE certificate, no matter how much experience you get. Ditto most any other technical degree from them. Don't waste your money with them. There are legitimate universities that have online and correspondence degree programs that are certified nationwide. Those are worth the $$ you are going to invest.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Your symptoms are those of an array index overrun. Ie, when you loop over an array, you are going past the end of the array. You must make sure that you are respecting the size of the array, and the number of actually set elements in it. Review all instances of your accessing an array, and how you create, initialize, and populate it. You will find your problem.

P.S. Running in a debugger can help find this sort of problem. Once you see where it is happening, you will probably pull a "Homer" - doh!

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

A software engineer uses rigorous, repeatable, provable methods to design and construct software systems. They are capable of building the most complex systems from scratch that will function as designed. The language used should not matter to them.

A computer programmer knows the syntax of one or more computer languages, and is capable of writing programs and functions in them that are clearly specified in advance. Their software architecture skills are likely to be weak, and probably need a considerable amount of oversight.

So, if you tell a civil engineer that you need a bridge across river X that can carry Y amount of traffic across per hour, and has to handle loads up to Z tons at any given moment, they can go away and come back some time later with a design that mathematically will meet the specifications. You then take that design to a bridge building contractor and their workers can build it to those designs and specifications, with the engineer overseeing their work.

If you tell a software engineer that you need an application server that can process X transactions per second, and store/retrieve Y megabits of data per second, handle requests in Z format, and has to provide 6-sigma availability. They can go away and come back some time later with a design that will meet those specifications (class models, finite state machines, work-flow specifications, recovery mechanisms, etc). Those specifications and models can then be given to a team of programmers who …

Mattox commented: Great Post +1
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

This is one of those things that the standards allow implementations to "do their own thing" on. A string literal may (or may not) be in read-only memory as a constant. So, gerard4143 is absolutely correct if you want to modify the contents of the string in a platform-neutral manner. Neither gcc nor Turbo are breaking the rules. It's just that the rules are flexible in such cases. Caveat Programmer! :-)

gerard4143 commented: Didn't know that, thanks for the pointer. +5
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Have you made the operator >> a friend of the Matrix class? If you don't, it can't get access to the internal parts of Matrix, assuming they are (properly) private or protected. Also, have you determined that the format of the input data is compatible/parseable with the method by which you are reading it?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Please don't ask us to solve your homework problems. :-( We will help you find a path that will work for you, but you need to try to solve the problem first, and then ask for comments or corrections.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Better:

struct Segment
{
  int start, end, value;
};

class Set
{
private:
  vector<Segment*> segments;
public:
  Set() {}
  virtual ~Set() {
    for (size_t i = 0; i < segments.size(); ++i) {
      delete segments.at(i);
    }
  }
  vector<Segment*>& getSegments() {
    return segments;
  }
  const vector<Segment*>& getSegments() const {
    return segments;
  }
  // accessor functions...
};
 
class Collection
{
private:
  vector<Set*> sets;
public:
  Collection() { }
  ~Collection() {
    for (size_t i = 0; i < sets.size(); ++i) {
      delete sets.at(i);
    }
  }
  void push_back(Set* set) {
    sets.push_back(set);
  }
  // other accessor functions...
};
 
int main()
{
  Collection collection;
  // open file, read file
  Set* set = new Set;
  while (!f.eof()) {
    Segment* segment = new Segment();
    set->push_back(segment);
    // fill segment
    // instantiate set using "new" as needed, and fill it with segments
    collection.push_back(set);
  }
 
  // do other stuff
 
  return 0;
}

Memory management in C++ is no different that C by default, BUT IT COULD BE A LOT EASIER! There are techniques, such as using smart pointers and reference counters to hold your Segments and such, so you don't have to destroy them manually. I do this all the time, and as a result, have nearly zero delete statements in my code, and no memory leaks. I also have to deal with very large data sets, for statistical analysis of stocks and options, or performance and failure analysis of large computer networks, for example. My wife also does a lot of C++ coding, but she has data sets that dwarf the mind! …

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I take it you are going to hold onto the string pointed to by p? Wny not make a copy of the source string as in a C++ string class object? In case you didn't know, I believe the string class uses a copy-on-write memory management algorithm, so if you don't modify the string, all you are getting is a pointer to the original - no actual allocation or copying done. There is rarely a reason to use C-style string pointers in C++. If you need to modify the contents of a string, pass it around by reference. If you only want to access or copy it, pass it around by const reference. Properly written, C++ is much more secure and in fact more efficient than all but the most carefully crafted C code. I've been a professional software engineer for 30 years, cut my teeth on C, and 20 years ago switch to C++ for major (10M loc) system development. Most of the stuff I've done since then couldn't be done in C, at least in the time frames I had to do it in. I still use C for kernel module and device driver development, but it's like going to the WC back in the 17th century - it's dark, dirty, nasty, and unsanitary! :-) FWIW, in that major system of 10M loc, we had ZERO deletes and no memory leaks because we "encouraged" our engineers to use our garbage-collecting smart pointers. Not having to worry about scoping …

mike_2000_17 commented: "6-Sigma failure rates were too high! " Holy macaronies!! +2
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Try something you'd personally find useful, such as a CD/DVD cataloging application. Since you want to program in C++ (my favorite language - been using it for 20 years), try to "think objectively". Think about the things you are modeling, and write the classes for those things with the behavior they should have. Each class should have its own header file and source file - don't jam everything together in one huge source file. That just makes modifications and bug fixes more difficult.

Make sure your class constructors properly initialize all member variables that do not have constructors of their own.

Avoid the NIH (Not Invented Here) syndrome - use standard library functions as much as possible. They have been thoroughly tested, and trust me when I say that writing your own vector or string classes may be educational, you will spend a lot of time implementing something that isn't as good, fast, or efficient.

Passing arguments to functions, where in C you would use a pointer, use a reference instead. It will eliminate an entire class of bugs when you try to dereference a null pointer. The compiler will catch that stuff for you.

Always declare destructors as virtual, and always have a destructor, even if it does nothing. Some day you will want to use that class as a base class, or have it derived from some other class, and this will enable you to delete pointers to either base or derived and it …

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

You can compile a completely empty source file, or one that only has preprocessor statements like #include, #define, etc. You will possibly get a warning, but it shouldn't be fatal. You are correct in that two main() functions would not be viable. Even c++ which allows function overloading (two functions with same name, but different signatures) doesn't allow two main() functions - I just tested this on my system.

That said, there are a lot of nasty little bugs in this program, including the string_to_integer() function. You might want to read it through again carefully, especially with regard to array access/indexing in main().

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

What mike said is generally correct. However, it is also dangerous! Never dereference a pointer like this without first making sure it is not a valid pointer. This is why we have reference objects in C++ since it eliminates the need to check the pointer first. IE:

int int_function_1(int* y)
{
   int x = *y; // BAD! If y is null, you are toast!
   return x+1;
}

int int_function_2(int* y)
{
   int x = 0;
   if (y != 0)
   {
       x = *y; // Better - we know that y is not null
   }
   return x + 1;
}

int int_function_3(int& y)
{
    int x = y; // Best - we know that y references a real integer
               // unless the caller of this function was a real meathead!
    return x + 1;
}

Also, in mike's example of doing array references (legal code), this is also dangerous in that you must know two things. First that the memory that y points to is really an array (if we are looking past the 0th element), and second that the array is big enough and properly initialized for the element we are accessing. In any case, this sort of code is a very big security hole.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Unfortunately it is true that many (if not most) hospitals are almost entirely Windows shops, even the systems that monitor critical medical devices. A number of them were effectively shut down recently when they were hit with a particularly nasty virus - only emergency operations in life-threatening situations were allowed to go forward. This type of computer monoculture is incredibly dangerous. To use Windows for any safety-critical system is, in my professional opinion, a matter of malpractice. FWIW, I am a 20+ year member of the IEEE and director of a major IEEE consultant's network.