rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Friends are not inherited. Usually if you are a friend class and you want your derived classes to have access to the friending class' private and protected members, then you will need to add the appropriate functions to access them in yourself (the friend class). Example:

class AnotherClass;
class SomeClass {
private:
    int m_int;
public:
    SomeClass(int value = 0) : m_int(value) {}

    friend class AnotherClass;
};

class AnotherClass {
public:
    AnotherClass() {}
    int getSomeInt(const SomeClass& sc) const { return sc.m_int; }
    void setSomeInt(SomeClass& sc, int value) { sc.m_int = value; }
};
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

You need to reinstall CodeBlocks for XP. You can't run Win7 software on an XP system.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

...post retracted...

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Are you sure you have admin privileges on your computer? Are you trying to install a 32-bit, or 64-bit version of Oracle - your system is 32-bit. Did you remove some files after you installed Oracle, possibly thinking they were not necessary?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I agree with AW - arduino boards/devices are a great way to learn about interacting with hardware from your PC. My grandson does some awesome stuff with them, using his Linux laptop to control them. He uses them for control systems on his RPV aircraft and 'copters.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Show the contents of the crontab itself. The script is one thing. The crontab is another.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

There is the circuitry of the computer, external circuitry of other devices, and just other (simple) external circuitry, which if you want to control you need some kind of connectivity, such as RS-232, RS-485, etc. How you "talk" to those devices and circuitry depends upon the operating system, and a lot of other stuff. Most of the time, people use C to access these functions, to set or read voltages on various output ports or other stuff, but thankfully C code can be used in C++ - consider C++ as C with classes... :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

All that said, ALWAYS use the initialization list to set your member variables to some sane default value. Ones that require more complex work to set properly - that CAN be done inside main, but ONLY after you have set a proper default value, even if it is a flag that it wasn't properly initialized for the domain of the class. An example of this might be a file descriptor. Valid values are >= 0. So, if your class has a member that is a file descriptor, initialize it to -1. That way, you can tell easily that it is not something you want to perform I/O on... :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

A couple of observations:

  1. C++ classes have member initializers which should be used OUTSIDE of the main block of the constructor. IE, do this:

    Cube::Cube(int x, int y, int z)
    : width(x), height(y), other(z)
    {
    }

Why? Because you always want your member variables initialized before you can use them. Once you are inside the main block of the constructor, you can use them, initialized or not - BOOM!

So, your second example is correct. If you submitted the first example as an exercise or exam product in one of my classes, you would have been seriously downgraded for that... :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I would add one change to the structures/classes/members shown by decepticon, and that is to use a std::vector<CArticle> for the _articles member in the CLibrary class. Also, it is STRONGLY recommended by standards to NOT use leading underscores for local/class/static variables as that is reserved for internal use by system libraries, etc. IE, use m_articles instead. Also, the std::vector class has the advantage of being able to automatically resize itself when you add more elements than it may have been configured for in the first place. In decepticon's example, you would have to resize it manually in your addArticle() method if the size of the array has reached its previous limit.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Why are you using strings to contain numeric (int) values? Why aren't you using arrays of ints instead?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

This has been a Windows problem for just about ever, especially with XP. It is basically the software trying to push data to the drive faster than it can write it until the hardware buffer overflows... The OS then puts the device into read-only mode. You can remove and re-insert the disc, but you will need to determine the last file that was being written, and overwrite it as it will undoubtedly be corrupted and/or truncated.

FWIW, there are good 3rd party CD/DVD burning software out there that can handle this much better than the ones provided by MS. Two that are recommended are Nero and Alcohol. I have used Alcohol 120% (the high-end version) for years, and was very happy with it. These days I use Linux tools... :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

If you don't replace the drive, you first need to boot into a live cd/dvd/usb device and run the badblocks command on the first sectors of the disc. If the boot sector (first sector on disc) is bad, then you will have to replace the drive. If not, then format the drive and create your file systems with the live system, and then run "fsck -c" on the file system partitions, such as "fsck -c /dev/sda1". This will scan the file system on that partition for bad blocks, and map them out of use. Finally, you will be able to install the operating system, telling it which partitions to use - DON'T let it auto-partition the drive for you again. Usually you will create 3 partitions, 1 for /boot, 1 for swap, and 1 for /. You can use just two if you want /boot to reside directly in /, 1 for / and 1 for swap. I think Ubuntu usually does the latter (2 partitions), whereas Fedora and RHEL do the former (3 partitions).

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Or:

    #include <iostream>
    #include <string>
    using namespace std ;
    double get_double(string Prompt)
    {
        double salary ;
        cout << Prompt << flush; 
        cin >> salary ;
        return salary ;
    }
    void main()
    {
        double salary = get_double("Please enter your salary $") ;
            double perc_raise = get_double("What percentage raise would you like? ") ;
                double new_salary = salary * (perc_raise / 100) + salary ;
                    cout << "If I give you that much of a raise you would be making $ " << new_salary 
                          << ".\nYou better be worth it \n" ; 
            system("PAUSE") ;
    }

If you don't include the flush io manipulator, then the system may, or may not display the prompt output. The endl manipulator will also flush the output buffer, but you may not want a new-line in the output.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Each return point returns only one value, true or false. Assuming your logic is valid, you are ok. FWIW, I am NOT going to review all 250 lines of your code to determine if your predicate logic is valid! :-)

So, which branch is returning "128" instead of 0 or 1?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Run Linux in a virtual machine on your Windows system and install nasm. From the nasm man page: nasm - the Netwide Assembler, a portable 80x86 assembler

You can download/install the VirtualBox virtual machine manager, and then install any number of Linux distributions on that. Each virtual machine will be a virtual x86 computer, so you can learn the do assembler programming to your heart's content, and not mung your host system.

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

Here is a good description of the issue: http://www.cplusplus.com/forum/articles/416/

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Well, there are "infinite" precision math libraries (I think Boost has such) that you could look at for ideas... :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Ok. Your last comment about the fact that the "mapping" can change between boots, and that the on-screen keyboard also is fubar, is telling. To me that means it is most likely that the system keyboard controller is bad. I think it needs to be sent in for repair. Both the physical and on-screen keyboards send scan codes to the controller, which in turn talks to the operating system. One final test to determine this is to boot a Linux live cd/dvd disc and see if it is also mucked up. If so, it is a hardware problem with (most likely) the keyboard controller. If not, then... I am clueless! :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

BTW, when my sister-in-law read the review, her email response to me was (as in Doctor Who) "It's bigger on the inside!" ... :-) And then "I want one!".

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Disclaimer: I work in the Nokia Mobile Phones division as Senior Systems/Performance Engineer.

  1. I own a Google Nexus One Android phone (personal - gift from Google). I like it, but it is getting old.
  2. I have 3 Nokia phones - one is my main phone, a Lumia 920, one is my previous main phone, a Lumia 900, and the other is a Series 40 "feature" phone for R&D purposes. I also had an N8 phone, but it broke and is now only a WiFi-enabled smart camera that I have "lent" to my sister-in-law who is a professional animation artist and teacher/professor. As a camera, it is quite stunning! :-)

Nokia has some great low-end smart phones with good cameras and a lot of features. Ditto Android phones. Go to the various cell phone stores in your area, and play with them until you find one that fits your budget and needs. Don't pay attention to the sales people - they have their quotas and high-margin devices to flog. If you want to wait, and an awesome camera is your desire, then wait until you can get the new 1020 Lumia phone. Its camera and microphones (for still, video, and audio) are at least a generation ahead of anything else on the market - and it is thinner/lighter than my 920. Here is a review from TheReg: http://www.theregister.co.uk/2013/07/15/nokia_lumia_1020_technical_walkthrough/

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Mike2K rocks! Thanks for the post Mike. I haven't pulled myself up to speed on the new standard. This helps, and I WILL do some dilligence on it... :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

The main difference between vanilla java and Andoid's Dalvik is the byte code generated by the compiler and the virtual machine to execute that byte code, plus the additional API's that Dalvik provides.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Ah! You must have ordered the keyboard for dyslexics... :rolleyes: Sorry, couldn't help myself!

Seriously though, you need to go into the Control Panel / Ease of Access Center and turn on the on-screen keyboard. See if that is also reversed. In Linux you can remap the keyboard pretty easily, but I don't know off-hand how to with the current crop of Windows machines. I remember I could do that back in the Windows 3.1x and Windows 2000 days.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Have you installed the wxGTK, wxGTK-gl, and associated development packages?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

C# is not particulary portable, even if you use Mono on *nix systems. Convert your code to C++ and it will become much more portable... Or at least compilable.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Unimportant's links are good places to start, but you need to think about the process/protocols to communicate from client->server->client.

  1. Server starts and "listens" on a port for connection requests.
  2. Client attempts to "connect" to server on that port.
  3. Server "accepts" the connection request, getting a socket associated with that specific client.
  4. Client sends data to server.
  5. Server responds to client.
  6. Ad-infinitum... :-)

Have fun! This is basic networking 101 in action... :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

You may need to build from source for that. I do know that my Linux version of ffmpeg (binary installation) has the x264 lib installed by default. Don't know about the Windows version though.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

One of the main reasons to use references rather than pointers is that you don't need to check for a null pointer. The object must exist to get a reference to it. A pointer may or may not point to a real object (null if not).

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Why do you want to switch it off? If you need to keep an object in memory, then assign it to a global variable that can keep it in reference. Disabling reference counting is a sure fire way to have serious memory leaks...

FWIW, I designed and built a reference counting garbage collection suite for C++ that allowed us to have 10M lince of application code, and zero deletes (at the application level), yet no memory leaks. It is a subject I have spent considerable time on research and development.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

You missed the "then" clause in this block: if [ ${i} == "Screenshot*png" ]

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Glad to help. As the man page notes, most of this stuff is compliant with the iso standards for the C-preprocessor, so (at least in my experience), the internal stuff is relevant to most system compilers, including Visual C/C++. In any case, I never had an issue with that in many years of cross-platform software development.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Here is a copy of the Linux C Preprocesor man page (it is a bit long):

CPP(1)                                GNU                               CPP(1)

NAME
       cpp - The C Preprocessor

SYNOPSIS
       cpp [-Dmacro[=defn]...] [-Umacro]
           [-Idir...] [-iquotedir...]
           [-Wwarn...]
           [-M|-MM] [-MG] [-MF filename]
           [-MP] [-MQ target...]
           [-MT target...]
           [-P] [-fno-working-directory]
           [-x language] [-std=standard]
           infile outfile

       Only the most useful options are listed here; see below for the remainder.

DESCRIPTION
       The C preprocessor, often known as cpp, is a macro processor that is used automatically by the C compiler to
       transform your program before compilation.  It is called a macro processor because it allows you to define
       macros, which are brief abbreviations for longer constructs.

       The C preprocessor is intended to be used only with C, C++, and Objective-C source code.  In the past, it has
       been abused as a general text processor.  It will choke on input which does not obey C’s lexical rules.  For
       example, apostrophes will be interpreted as the beginning of character constants, and cause errors.  Also, you
       cannot rely on it preserving characteristics of the input which are not significant to C-family languages.  If
       a Makefile is preprocessed, all the hard tabs will be removed, and the Makefile will not work.

       Having said that, you can often get away with using cpp on things which are not C.  Other Algol-ish programming
       languages are often safe (Pascal, Ada, etc.) So is assembly, with caution.  -traditional-cpp mode preserves
       more white space, and is otherwise more permissive.  Many of the problems can be avoided by …
christinetom commented: Big help, thanks +1
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

A good example of why you should not declare multiple variables together, but better one per line / declaration statement.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Since you reset the device, you will need to go into the setup page (using the default admin account "admin" - no password I think, or "admin" if needed) and reconfigure the router again. For most Linksys routers that would be 192.168.1.1

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

What JorgeM said. Protocols are the rules by which we communicate. They can be implemented in hardware/firmware, or in software. I have implemented the complete TCP/IP protocol stack in software from the protocol definitions published by the US DOD in the DDN (Defense Department Networking) Protocol Handbooks. I have also worked with implementations in hardware of the same. FWIW, the handbooks take up a good foot of shelf space... Interesting if you like reading compressed BNF (Backus-Naur Form) grammars! :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Your system is running Windows? If so, then you probably are part of a bot-net... :-(

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

In my words, Java == C++ with training wheels. The biggest issue is which components to "include", much like C and C++... :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

You cannot use static libraries as a "plug-in", though as you surmise you can link it directly to the application code. However, that means it becomes not a plug-in, but a native component of the application. That also may mean that other plug-ins that implement the same functions (signatures) as your bit will not "plug in" because of symbol collision. An example of this is ODBC (database API's). Your user may want to use an Oracle, MySQL, Postgres, or other version of ODBC. If you linked your ODBC library statically, then they would not be able to use those others... Not a good thing probably.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I think it means that the text it is parsing has to be in standard 8-bit ascii or utf-8 format. IE, if your locale (or the user's) is set to Chinese or such (unicode - 2 bytes / character instead of 1), then it cannot parse the text as a number.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Most of these plugins are shared libraries (dll's in Windows lingo) that the application can dynamically load. They need to go into a directory that the application knows about and can find them. IE, just building them may not be enough. You probably need to copy/move the dll (or .so if running Unix/Linux) to a known directory for shared libraries, or configure the application to look for it elsewhere.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Another possible approach may be to install the Windows Services For Unix, which as I recall includes an ssh server component. That may be better than trying to tunnel via Cygwin.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

What Mike_2K said, plus to re-emphasize that writing good serialization/deserialization (orthogonal) methods into abstract classes is very difficult. I have done such for software used to run most semiconductor fabs today (MES frameworks), so I know some of the problems you face. The frameworks I developed would work with either TCL or XML wire format messages. The sender would serialize itself to the appropriate form, and the receiver would automatically detect the format and de-serialize it accordingly into a faithful representation of the object sent. The object could be highly complex, consisting of many sub-objects of various types. At times, the serialized string can be 10+MB in length, and contain recursive (circular) references where one object contains a reference to another previously encountered in the hierarchy. That was one of the more difficult problems to solve. Fortunately, both TCL and XML have constructs to deal with that! :-)

FWIW I wrote the original code for that about 20 years ago - prototyping it in Smalltalk, and then implementing it in C++.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

See item #3 in your list of instructions - modify an existing game. That seems to be the crux of the problem. Your professor appears to want that you take one of those single-player games and adapt it to a multi-player model. Sounds like a challenge! :-) He/she is trying to get you to think how to take what is, and adapt it to your needs - requires thought, design effort, and coding work. Good luck!

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

What browser are you using?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Do note that if you are serious about "millions of records", then you might be better off to store the data in a hadoop database and use mapreduce to process the data.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I assume you are using a Linux or similar *nix type of oeprating system? So, look at the man page for the 'diff' command. It will do what you want. The purpose of the 'patch' command is to apply diff's to an original file. I believe that with the correct options, diff can do what you want without using 'patch'.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

There are 2 wires each for tx and rx because the hardware uses what are called line-drivers to move the signal. This minimizes interference and increases distance for the transmitted signals and greatly increases the reliability of the media. FWIW, you CAN transmit and receive at the same time, if the system is set up for full-duplex operation. Most modern switches and NICs allow this, although you can configure them for half-duplex operation, where you can only send or receive at any particular time. If one end is configured full-duplex and the other half, then the thruput is greatly diminshed.

CimmerianX is correct about hubs vs. switches, which is why most networks these days use switches to eliminate (or greatly reduce) collisions.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Do you want to change the environment variables for all users, or just your own account? Files that start with a dot are not visible. If you want to see them, run the command "ls -a ~". You should see all the files and directories, including the dotted ones, in your home directory. In any case, don't make the changes in .bashrc - it is better to set them in .bash_profile.