rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Anyway, I have no clue as to the answer for your original question. Sorry. That (previous post) was my sarcastic clone answering... :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

You need to add some methods to the class P in order to traverse the list. IE, try creating some functions such as P::Node* first(), P::Node* last(), P::Node* next(P::Node* current). However, to do that, you need to make the Node structure public, or external to the class P.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Argh! VAX questions! I haven't had to deal with any of this cruft for over 20 years! If you want, I might still have my system documentation in some boxes hidden in my basement, somewhere... :rolleyes: I think I also have my IBM VM 370 manuals in the same place...

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

In my experience, your basic configuration at process is solid. However, you need to make sure that your web applications are not susceptible to SQL injection attacks. That is likely your most vulnerable point of system compromise.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

If from normal room temperature, then it is likely that there is a problem with some component where when "cold" there is a broken contact, but upon some increase in temperature, the expansion of material will make the contact again, resulting in a functioning system. Analysis? There is a physical problem with the system, and finding it may be next to impossible. My advice? Do what you are now, until it stops working altogether.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Thanks for that. But in the event of poor themal contact with cpu, wouldn't the reverse situation apply ie wouldn't there tend to be more problems as the PC warmed up, rather than from cold?

Probably. Is this from a thermally cold situation? Or is this also from normal room temperature?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Show how you think it should be implemented and we will be happy to critique your code. Just don't ask us to do your homework for you... :-(

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Well, the first error is this, the declaration of BST::InsertRecursive: BSTNode * BST::InsertRecursive(std::string * str, BSTNode * n) in that you are calling it with a const string& (reference), yet the function is defined to tak a non-const string pointer... No go. Realize that C++ is VERY strict in type usage. Also, I don't know if the root argument passed for the second argument, defined as a BSTNode* is a pointer or something else.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Data sent over networks can have this problem, which is why there are macro functions in C that will switch one form to a neutral form (network form), and another which will take a network form number and convert it to local. This needs to be done because you might be receiving a number (16, 32, or 64 bit) from one endian, like a Sparc processor (Sun/Oracle) system, on another, like an x86 processor system, and vice versa. Some processors can be configured as either, such as MIPS or ARM processors. So, the rule is, if you get what is supposed to be a number from a network message, use the appropriate macros to convert it, and if you are sending a number over the network to another system, use the appropriate macro to convert it... :-) Anyway, this Wikipedia article gets into that in some detail, and describes the macros that I briefly described (ntohl-htonl, et al): http://en.wikipedia.org/wiki/Big-endian

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

What other subnets do you have?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

FWIW, the software I have been writing for over 20 years has had to be better than 6-sigma in reliability, especially since an hour of downtime for our customers costs them in excess of $10M USD. We program for failure, and anticipate failure modes. We extensively use tools like Purify, Quantify, Pure Coverage, and other such in conjunction with extensive unit and system testing, so that when software is delivered, we have some reasonable expectation that it will work as designed.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Yes. Because, since you are discussing best practices, when you test the return code from scanf() you will find all values were not entered and handle the improper input. You do advocate always testing the return values from all functions, don't you? :icon_wink:

Absofragginglutely!

WaltP commented: :-D +17
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Unnecessary. Only values that are not read in or set in the code need to be initialized. In your example

int mm = 0, dd = 0, yyyy = 0, mm2 = 0, dd2 = 0, yyyy2 = 0;
   
   printf("Enter first date (mm/dd/yyyy): "); 
   scanf("%d /%d /%d", &mm, &dd, &yyyy);

initializing mm,dd,yyyy are completely unnecessary and a waste of time.

One last comment about yours: what happens when the user hits the RETURN key or Ctrl-D after just inputting the month and day? Is the year still sane?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Unnecessary. Only values that are not read in or set in the code need to be initialized. In your example

int mm = 0, dd = 0, yyyy = 0, mm2 = 0, dd2 = 0, yyyy2 = 0;
   
   printf("Enter first date (mm/dd/yyyy): "); 
   scanf("%d /%d /%d", &mm, &dd, &yyyy);

initializing mm,dd,yyyy are completely unnecessary and a waste of time.

Speaking from experience, your comment is correct on the face of it, but all software changes over time, and this has been the root cause of MANY major system failures over the years! My personal process says "never create a variable that is not initialized". I have written quite literally millions of lines of code over the past 30+ years that runs some of the biggest manufacturing corporations, US Navy refit centers, stealth fighter avionics manufacturing plants, 80% of the semiconductor manufacturing plants in the world, and this RULE has helped provide the highest quality software in 365x24 environments anywhere. FWIW, I am currently Senior Systems Engineer for the largest cell phone manufacturer in the world...

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Ok. Some comments first (remembering the KISS principal):

1. Initialize ALL variables to sane values (if only 0 or NULL) when you declare them.
2. Be orthogonal in your branches. IE, keep things that are related to yyyy/yyyy2 in the yyyy/yyyy2 branches, the things that are related to mm/mm2 in theirs, and the things related to dd/dd2 in theirs. I'll show what I mean below.
3. Validate ALL input. IE, make sure that the input for month, day, and year are sane, in that the month MUST be >= 1 and <= 12, and use an array for the number of days in a month to validate that. The only glitch here is dealing with leap years, which you do not deal with. As for years, have a valid range of them, and DO check for leap years. There are good algorithms for computing them - including in Wikipedia, so I won't elaborate here. Consider it a study assignment! :-)

Ok, here is what I think would be better:

/*
  Program assignment name: 2_Dates

  Author:Christopher D*****
*/

#include <stdio.h>

int main (void)
{ 
   int mm = 0, dd = 0, yyyy = 0, mm2 = 0, dd2 = 0, yyyy2 = 0;
   
   printf("Enter first date (mm/dd/yyyy): "); 
   scanf("%d /%d /%d", &mm, &dd, &yyyy); 

/* Validate mm, dd, yyyy here. */

   printf("Enter second date (mm/dd/yyyy): "); 
   scanf("%d /%d /%d", &mm2, &dd2, &yyyy2); 

/* Validate mm2, dd2, yyyy2 here. */

   if (yyyy < yyyy2)
   {
      printf("%2d/%2d/%4d is …
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

The rule of thumb is... EVERYONE over complicates their C code! Applying the KISS principal to code, especially C and C++ code is critical in building reliable and understandable programs/systems. Anyway, I will look at your code and comment again in another message.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

You can change your power settings so that it doesn't sleep when closing the lid. I usually set it that way for when it is plugged into wall power, but you can do it for when it is on battery as well.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I think you didn't see this question of mine

If we update the kernel(therefore tcp/ip protocol st),will it be harder to hack the latest version than an older version of tcp/ip model?

Yeah. I clicked on the quote, and it closed right away and took me to where it thought it should in my long post that answered your 9 questions (I thought). The tcp/ip kernel drivers are only updated when there are issues to fix. They aren't updated every time the kernel is. However, when security fixes are made to the drivers, then the answer would be yes, for the exploits that were identified and fixed. In any case, there is no general answer for this question, other than "maybe" and "it depends".

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

And in case you are wondering why we have so much computer gear? I am a software systems engineer and my wife is a particle physicist. Besides science and technology, our other main love is music - listening and performing. The only thing we have in our house that outnumber and outweigh our tech gear are our musical instruments, most of which we play on a semi-regular basis - guitars from steel dobro to classical to Mexican folk, mandolins from my 100+ year old Gibson that I play bluegrass on to modern ones made with exotic woods, fiddles, a Veracruz harp, 2 bass fiddles, a big collection of ukuleles, banjos, drums, and who knows what else!

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Thanks.Is "Prentice Hall - Computer Networks by Tanenbaum" a good one?That is what I am reading currently and I got these questions when I was reading it. So far it didn't explain those stuff yet,just about how protocols work,not where do they actually live stuff .

Tanenbaum is very good. He knows his stuff and writes very well. I am an engineering geek, so I go for the thicker books that are heavy with content. Comer and Stevens are much more thorough, but the Tanenbaum book is a great starting point for you. I don't have that book in my collection, but I have had a sit-down with it at some point. He has written some other very decent computer books. His "Modern Operating Systems", and "Operating Systems Design and Implementation" are excellent. I think I have that last one, but it seems to be hiding from me. One of these days I need to catalog all of my books... Heck, I even have a hand-written set of Feynman's physics class notes for the lectures he gave at CalTech. I inherited them from my father who was a colleague and good friend of his. They have since been reprinted a number of times and are very popular. My home office is in the basement and is in need of a good cleaning. If a mouse got in here, it would starve to death before it found its way out of the maze!

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

In case you are wondering what I do for a living, I am currently Senior Systems Engineer for Nokia Mobile Phones in their performance engineering and software architecture group. My job is analyzing and solving performance issues with very large, very complex TCP/IP installations that have to handle up to 100,000 concurrent users, and will grow to 1 million within the year. You could say that I eat and breath this stuff.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Silvercats, you are asking a lot of really good questions, and it is obvious that you are trying to understand this stuff. It's an investment, but there are some really good books you should have if you want to pursue this subject more thoroughly. I recommend the following (classics in their own right):

Internetworking with TCP/IP by Comer and Stevens, volumes 1 and 2, published by Prentice-Hall. You can get them from Amazon.com. Volume one is "Principles, Protocols, and Architecture", and volume two is "Design, Implementation, and Internals". Start with volume one, and if you are interested in the actual C programming implementation such as used by Unix and Linux, then get volume two later. There is a third volume on application programming, but that can wait unless you are ready for some serious socket programming. The DDN Handbook is strictly for engineers who have to implement this stuff from scratch. And yes, all of these books have places of honor on my 10' x 6' book-wall.

I also have the entire X-Windows set (2 ft of shelf space), two versions of the Java Virtual Machine Specification, the entire distributed database transaction multi-phase commit engineering standard, the ISO C++ Standard document/book. a raft of stuff on neural network and fuzzy logic programming, and of course all of Codd and Date's works on relational database theory (a field I am considered something of an expert in, having taught it at the graduate level). I have been building this library …

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Core stack?you mean the whole TCP/IP or just main protocols?

wait?what?NICs have firmwares too?like motherboard firmwares(BIOS) in a CMOS chip?
and part of that firmware is TCP/IP software set ?

The entire TCP/IP suite includes applications like ssh, telnet, ftp, etc. The core protocol stack includes TCP, IP, and things like ARP (Address Resolution Protocol) - the cruft that is necessary for basic connectivity. So, if a board has the core stack in firmware, I will still have to implement stuff like ssh, telnet, ftp, etc. They aren't necessary for basic connectivity, which is to connect to a remote system, and open a channel (TCP) or send raw messages (UDP). And yes, NICs have firmware just like your motherboard, disc controllers, and video cards.

As I said, the NIC firmware CAN contain parts of the TCP/IP protocol stack, but they don't have to. They will at least contain the basic Ethernet wire protocols and code to talk to the board's chips.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

What will happen if one computer have an older version than the other or something like that?

Usually nothing. Newer versions general are made to address security issues that usually have nothing to do with the protocol per se, but are application and coding bugs. As said before, the protocols themselves are rigorously defined, which is why my 15 year old QNX system still works fine with my brand new devices and operating systems installed last week.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

If I view a web site using windows 98 or something very old,we won't be able to see modern encrypted pages(let's say we have the 2012 version of firefox on 98 for a while ;)) and do what modern TCP/IP can do(encryption,Video streaming etc..)?

Encryption and video streaming are not part of the protocol suite. They are application-layer things, not transport layer.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

So routers and modems don't have TCP/IP built into their firmware ?they just use what is given from the computer?right?

Some do, and some don't have them built into the firmware. It depends upon the router. Being in the kernel means that you can update the stack a lot easier. In any case, the OS is stored in flash memory, which most firmware is also these days. The lines of distinction are getting narrower and narrower.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Anyway, to answer your 9 questions directly:

1.is it a software(I think it has to be)?
Generally yes. There are implementations of the core stack in firmware on some network boards (NICs).

2.Is it a BIOS level software?
No. The core protocols generally are kernel drivers.

3.Where is the protocol set installed in a computer?(Windows,linux,mac etc..)
Generally, the core protocols are kernel-level drivers for efficiency. Some protocols such as SSH, TELNET, and FTP are dynamically loaded when needed. There is a daemon on Linux/Unix systems called inetd (or xinetd - more current) which will start the SSH, TELNET, FTP, or other servers when a connection is made by the appropriate kind of client.

4.Can we uninstall it like normal software?
Not easily. Practically all networking today is built upon the TCP/IP protocol stack.

5.Can we update it?
Yes.

6.Where do routers and modems have that tcp/ip stack(protocol set)?
Incomplete question. Trying to read into your question, most routers run some sort of embedded Linux software, and the TCP/IP stack are kernel drivers. You can configure a kernel to build the protocols out of the kernel, but then you'd effectively have no networking at all.

7.In which language is it written?
Generally in C. Linux kernels are written almost entirely in C.

8.Will we ever get an update?
Often. When drivers are updated for Windows systems, or when the kernel is updated in Linux/Unix systems.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

If I get this correctly,you are telling me that it is possible to change TCP/IP function externally (without changing the current OS),using a later written software?

You can change the functions that are called, but you still have to follow the data and wire control flow specified in the RFCs. I actually wrote a finite state machine (FSM) for the protocols that was loaded from a text description of the protocol, so I could fix implementation issues by simply changing the FSM description and restarting the application (like telnet or ssh), or restarting a server daemon if necessary. Once the nitty gritty coding was done, that approach saved us many person months of effort in bug fixing and cleanup. Most of the issues were subtle differences in event-triggered state transitions, especially when dealing with out-of-band data. In fact, I spent a couple of days in a General Motors plant in Indianapolis tweaking the FSM descriptions to deal with just that problem. OOB event handling is very strange, and difficult to directly program for. I was able to fix the system in 2 days without rewriting one line of code. Most of my time was analyzing log files and packets to see exactly what was going on.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

For example, here is the first TCP RFC

Ah yes. RFC 793, Page 2-185 in the DDN Protocol Handbook - Volume 2 - DARPA Internet Protocols, December 1985. Just pulled it off of the shelf to check! :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

The full specification for the entire TCP/IP protocol suite takes up almost a linear foot of shelf space, is published by the US Department of Defense, and is called "The DDN Protocol Handbook". The DDN stands for Defense Department Network. Because the covers are white, it is sometimes known as "The White Book". From the detailed specifications it contains, it is possible to implement part or all of the TCP/IP protocol suite without recourse to other software. I and a colleague implemented the core TCP/IP functions (in C) for a real-time operating system back in the early 90's because we were contracted to deliver an automated electronics manufacturing line to the US Navy's RAMP project that used the OS, and they required that it could communicate to other TCP/IP network nodes such as control and monitoring systems that were running Unix. I spent a lot of time on a stool in front of a workstation in the middle of a HUGE warehouse structure in Charleston, South Carolina for that gig! But, we delivered and now the US Navy can fix its ships in a fraction of the time it used to take. In case you are interested, RAMP stands for Rapid Acquisition of Manufactured Parts. When a battleship is in drydock, they can't just order most of their gear out of a catalog. Most is manufactured on the spot, to order, including propellers, drive shafts, radar and sonar electronics, etc.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Well, I have given about as much help as I can, as I don't really know MIPS assembler code in any kind of detail. I've done x86 assembler, but the last time I did any for a production system was in the early 90's when I was writing some TCP/IP driver code for an x86 real-time operating system (QNX). I have tried to stick with C and C++ since then! :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

You could use message queues, or shared memory. A class static variable or translation unit static variable could also be used. In any case, there are a lot of ways around this barn, and which may be best for you depends upon a lot of factors, including concurrency, efficiency, and latency.

vedro-compota commented: +++++++++++ +3
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

It may be that the keyword "message" conflicts with something else. Try replacing "message" with something like MyMessage instead and see if that works.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Yeah, well you can use FAT32 with XP, but not as the system/boot file system.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Well, a struct will work because in C++ a struct is a class where all members (variables and methods) are public. Perhaps you can post your headers, and the problem code with any changes you have made here for us to review? I know you posted before, but it would be helpful to see what (if any) changes you have made. Also, you need to tell us if the errors are compile-time errors (post the error messages here), or run-time errors/exceptions. If the latter, try to find where they are being thrown from, and tell us that as well.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Well, the way it is written would be, with scoping parens to mimic the actual operator precidence, D = A^4 + (B^6 / 3C) - 2B

Are you SURE that is what you intend? Or do you mean D = (A^4 + B^6) / (3C - 2B), or something else?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Basically what swifttech said. You need to remove the existing partitions so XP can create an NTFS file system on a new partition. You probably have the option to do that when you start the XP installation disc - don't remember for sure because I haven't installed it for at least 5 or 6 years on any of my systems. On my personal systems, I only run Linux, and my work system runs Windows 7 Enterprise.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Are you trying to burn single-layer (4.7GB) or double-layer (9GB)? From your post, you are using double-layer (DL) discs. The Verbatim discs are very good, and I have rarely had any "coasters" using them. However, I NEVER burn at the full speed the discs are advertised for. If these are 8x discs, for example, then burn them at 4x. Also, configure Nero (or whatever burner you use) to use as much buffer space as you can get. Finally, make sure you enable burn-proof (or something like that), so that if the burn process has to stop because of a buffer underflow, it will continue correctly and give you a good disc.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

What is the make of the discs you are trying to burn. Some are better than others. Myself, I have had the best of luck with Verbatim and Taiyo Yuden. Memorex - not so good.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

In your example:

Class Queue
{
    message aMsg[SIZE};
Public:
.
.
.
};

should be this:

class Queue
{
    message aMsg[Size];
public:
.
.
.
};

Note the lack of Capitalization on the keywords 'class' and 'public'. You used 'Class' and 'Public', which will generate errors when compiled. Most programming languages (except perhaps BASIC and some others) are very case-sensitive. IE, the term 'Foo' is NOT the same as 'foo'.

In my example, the base class 'bar' is not shown. It can be any class, or even a simple C-type struct. My purpose in using it was to show you how to "friend" another class, and how friends differ (access to all, including private, members) from derived classes (access to public and protected members). I hope this is a bit clearer for you.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Don't capitalize "public". IE,

class foo : public bar
{
private:
    // Private components here - only accessible by this class and friends.
    int m_int;

public:
    // Public components here - accessible by the world.
    foo() : m_int(0) {}
    foo( const foo& cpy ) : bar(cpy), m_int(0) {}
    virtual ~foo() {}
    foo& operator=(const foo& rhs);

    int getInt() const { return m_int; }
    void setInt( int newValue ) { m_int = newValue; }

protected:
    // Some protected components here. Accessible by self, friends,
    // and derived classes.
};
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Means unless we are updating or modifying something there is no need to make such methods synchronous?

As long as you are only using local, and not static or global variables in your method, you should be fine. As we have stated however, the storeUser() method should either be synchronous, or a lock applied to the data store. If the storeUser() method does a lot and being synchronous could introduce unnecessary latencies, then use a lock only for access to the data store.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Simply put, a friend class has access to the private and protected parts of the class that made it a friend. In your case, the queue class can access all the parts of a message, and that includes write access. Be sparing with your use of "friends" - they can turn on you if you are not careful! :-) In any case, you are better off if you provide a good set of public methods in the message class that queue can use without making it a friend.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

This should be fine, but you probably want the BB storeUser() method to apply a lock to the data structure where it is placing the usr object.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

False. Compilers generate machine-neutral code. This is then (usually) passed to an assembler or machine-code generator. In modern systems, the code is compiled to ELF (Executable and Linkable Format) code, which the linker converts to the appropriate system machine code when generating the executable image.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

This is possible - I do it myself, but you will want to be sure that your user and group ids are the same on both systems. Not the name, but the id number.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Contact Dell tech support and ask them. They have an online chat with tech support and generally can answer questions like this quite easily. If the slots take different kinds of RAM sticks, they can tell you what the specs are.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Your options for username and password are wrong. It should be:

mount -t cifs //192.xxx.x.xx/share /mnt/mountPoint -o username="username",password="pass"

Also you need to do that as root, or sudo. If your mount doesn't require authentication, then leave the username/password options out altogether.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Glad to help and that you got it working. I use this dock a lot to remove viruses from client system drives, as well as just to plug in a backup disc to make system images and such. Works a treat. I use the esata connection instead of USB because it is a LOT faster! :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Here is a link to the device on buy.com: http://www.buy.com/pr/product.aspx?sku=209890871