rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

What do you mean by "put the same name of the objects"? Show code please.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Never having used BlueJ I cannot answer #3. As for #1, if two objects of the same class have the same state, then at that time, they are identical, in that A == B. That said, you can change the state of one, and then they will no longer be identical. Identical does not mean they are the same, just as identical twins are not the same entity.

As for #2, when you compile a .java source file, you get a .class file (a binary representation of the source code). They are not the same, but there are tools to reconstruct the source code from the .class file.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Find a subject that interests you, and then figure out how to program an application that fits it. For example, let's say you like weight lifting and you want to track your progress in pressing more and more weight over time. You could write an application that lets you input current data on a regular basis, stores that in a file or database, and then lets you run some graphs of your progress over time, such as meeting specific goals.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

What have you done so far? I have developed PHP/MySQL applications (for internal purposes at Nokia). Making it an application? What does it do? Does it serve a rational purpose? Please describe what it does, and how it does it.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

You have typedef'd PTR_VALUE, but in this function:

int initialize(PTR_VALUE value_array)
{
    value_array = (PTR_VALUE)malloc(sizeof(PTR_VALUE) * 94);
    return 0;
}

You initialized the value_array parameter, but it is never returned to the calling function, or set as a global or static variable. IE, it has taken up memory, but it isn't accessible from anywhere outside of this function. Try this instead:

PTR_VALUE initialize(void)
{
    PTR_VALUE value_array = (PTR_VALUE)malloc(sizeof(PTR_VALUE) * 94);
    return value_array;
}
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

The default arguments should be in the class declaration (header), not in the definition. Some compilers may accept this, but many will not.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

The tablet obviously has access to a valid DNS server. You either need to configure the hotspot software to relay DNS requests from connected systems, or you need to tell your system what DNS server it should use (using an IP address for same). You can set this in the network configuration tool for the attached system.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

JorgeM pretty much hit this on the head. All the data in a VirtualBox VM are stored in system files. You do want to use the incremental expansion option for the virtual drive though, since it will not take up more space on your system disc than necessary - growing the file only when needed. So, if you allocate 50GB of space, but are only using 20, then it will only take 20GB of space (more or less). Also, with snapshots, you can roll the VM back to an earlier state very easily if needed, such as a bad update or such.

So, if you decide you don't want CentOS on the system any longer, VirtualBox has a "delete" option for your VM's that will give you the opportunity to get rid of the VM as well as all associated files.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

There is a command escape sequence that you can use with bash to set your prompt. Read the bash man page for information on how to set this. The default version can be seen in /etc/bashrc. It is likely that ssh is configured to use another rc or login file to set the prompt.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Did you initialize WindowMain to NULL when you created it? If not, then it contained arbitrary data from the stack and it would not be NULL in your test in the WM_CREATE switch.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

So, your 33 lines of C code generates 383 lines of assembler. And you expect us (most of us have day jobs) to analyze it? You set both ax and ay to the same value, and then call the atan2f() function with both variables. If atan2f() is a system library function, then you won't see the assembler code for it since it is already binary - just the function calls you observe.

In addition, you do nothing with the return values, such as printing them out. How do you know you aren't getting valid results?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

What virtual machine manager are you using? What is the host operating system? Did you verify the ISO or DVD that you used to install Vista - the disc checksum (usually an md5 or sha256 checksum)?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

This is a case where you need to incorporate multiple threads - one to handle the character, and another to play the music. In a single thread, only one activity can go on at a time.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Pick either and do your best! :-)

@Mike2K - I spent a couple of months sitting in front of a computer in a huge hangar sized warehouse where the PC board lines and CNC machines were in Charleston, SC working on this stuff! That was in the early 1990's. A great experience, for sure! I'm still more proud of the US Patent I got for adaptive systems software about 10 years after that (US Patent #7,185,325) as sole inventor. Check it out. It is currently owned by Applied Materials, the 800lb gorilla of semiconductor equipment. Seems that a number of Java patents cited my work as well. :-)

naqvi.s.bukhari commented: i too struck in these difficulties ,, both i probably bachelor degree have similarities +0
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

And don't be afraid of the math! In any case, formal logic is a subject you should take for either CS or SE. I took it in engineering school, and that one class has been of more benefit to me than all the engineering and programming classes I ever took!

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I think that CS is more academically oriented, and SE is more application oriented. Science vs. Engineering. You can't have engineering without the science. :-) IE, it is not hard for someone with a degree in CS to get a job as a software engineer. One of my best friends and colleagues was a professor of CS at a major east coast university. He decided to explore more practical applications of his studies. As as result, we were both software engineers together for many years and developed some really advanced systems. He and I together, implemented the entire TCP/IP protocol suite for a real-time operating system, from the Department of Defense DDN protocol handbooks that define TCP/IP and related protocols. That was used by the US Navy in their RAMP (Rapid Aquisition of Manufactured Parts) program that enabled the Navy to reduce time in dry dock for a battleship or destroyer from months to weeks when getting new parts. We also built a lot of the manufacturing software systems for that program to build electronic assemblies, machine drive shafts and propellers, etc.

mike_2000_17 commented: TCP/IP suite for DoD RTOS... OMG! That's beyond impressive! +14
Slavi commented: (y) +6
iamthwee commented: genius +14
JorgeM commented: Nice! +12
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I'm not sure it is possible to call shell scripts from PL/SQL. You can call embedded java code which in turn can call a shell script. I had to do that in the past to solve this problem. Here is a link that may help: http://stackoverflow.com/questions/4068816/how-to-call-a-shell-script-from-plsql-program

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

This is a compiler, not a linker error. You are not including the header that has declared Swprintf.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Good explanation Moschops. Now on to nit-picking and some common new C++ programmer errors.

  1. Always initialize member variables that do not have default constructors, such as pointers. See code below.

  2. DO NOT use NULL for null pointers in C++. Always use 0 (as shown below). NULL is usually defined as a void* and if your compiler is set to fail on warnings, or set to observe strict C++ standards, then using NULL as you did will cause a compiler error since your pointers are char* types and not void* types. You cannot (or should not) expect an automatic cast of a pointer from void to char. The C++ standards allow, and encourage, the use of 0 to initialize or set any pointer type.

    MyString(const char* InitialInput) : Buffer(0)
    {
        cout << "Default constructor: creating new MyString" << endl;
        if(InitialInput != 0)
        {
            Buffer = new char [strlen(InitialInput) + 1];
            strcpy(Buffer, InitialInput);
            // Display memory address pointed by local buffer
            cout << "Buffer points to: 0x" << hex;
            cout << (unsigned int*)Buffer << endl;
        }
    }
    
    // Copy constructor
    MyString(const MyString& CopySource) : Buffer(0)
    {
        cout << "Copy constructor: copying from MyString" << endl;
        if(CopySource.Buffer != 0)
        {
            // ensure deep copy by first allocating own buffer
            Buffer = new char [strlen(CopySource.Buffer) + 1];
            // copy from the source into local buffer
            strcpy(Buffer, CopySource.Buffer);
            // Display memory address pointed by local buffer
            cout << "Buffer points to: 0x" << hex;
            cout << (unsigned int*)Buffer << endl;
        }
    }
    
…
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Show how you are using getopt() in your code. Just talking about it isn't helpful without something tangible to work from.

FWIW, the Linux getopt() man page has several pages of documentation and examples to help. Here is one of the examples:

       /* The following trivial example program uses getopt() to handle two  program  options:  -n,  with  no  associated
       value; and -t val, which expects an associated value. */

       #include <unistd.h>
       #include <stdlib.h>
       #include <stdio.h>

       int
       main(int argc, char *argv[])
       {
           int flags, opt;
           int nsecs, tfnd;

           nsecs = 0;
           tfnd = 0;
           flags = 0;
           while ((opt = getopt(argc, argv, "nt:")) != -1) {
               switch (opt) {
               case 'n':
                   flags = 1;
                   break;
               case 't':
                   nsecs = atoi(optarg);
                   tfnd = 1;
                   break;
               default: /* '?' */
                   fprintf(stderr, "Usage: %s [-t nsecs] [-n] name\n",
                           argv[0]);
                   exit(EXIT_FAILURE);
               }
           }

           printf("flags=%d; tfnd=%d; optind=%d\n", flags, tfnd, optind);

           if (optind >= argc) {
               fprintf(stderr, "Expected argument after options\n");
               exit(EXIT_FAILURE);
           }

           printf("name argument = %s\n", argv[optind]);

           /* Other code omitted */

           exit(EXIT_SUCCESS);
       }
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

KISS - keep it short and simple. The sum() function should be simply this:

int sum( int x, int y)
{
    return x + y;
}

This results in this output:

-1
-11
7
1
26

Unless your definition of "sum" and mine differ! :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Usually these would be written to the file system as CSV (comma separated value) files that Excel can handle very well. I used to do that with PHP to generate cell phone performance data for Nokia's quality assurance department.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

What version of Windows is this? It sounds like when the window is out of focus, it is put in a hold state. There may be some Win32 settings you can use to let it continue to run in such a situation, but I am not expert enough with Win32 API's to tell you how to do that.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

It looks like you are trying to access a member of a class that is not declared or instantiated in instances of that class. You need to look at the "module" components and class/structure definitions.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Sorry. We don't do your homework for you. Make an effort and we can help you debug your work. Do read this site's terms of service (TOS) in regard to this issue.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

@sdtelchi - which is evaluated in what order when the operator precidence is the same is up to the compiler. This can vary - I have experienced this when using compilers other than GCC. I think my post was worth a comment - not a down vote! In any case, it is definitely a situation where caveat programmer... Always state it the way you mean it. After all, your intention could have just as easily been this: per=((m1+m2+m3+m4+m5)/(500*100); - totally different result. Remember, some compilers parse left to right, and others right to left. This is why the parens are so important. MAKE NO ASSUMPTIONS!

ddanbe commented: So true. +15
sdtechi commented: Yes you true rubberman..thanks +0
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Your printf() function should be printf("%s", message); You could have used message as you did if you cast it to a const char* as in printf((const char*)&message[0]);, but the first example I provided is preferable.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Basically, it is a binary sort that on average requires O(n log n) comparisons to sort, though it is often more efficient that that. Here is the Wikipedia article that does a decent job of explaining the details: https://en.wikipedia.org/wiki/Quicksort

If you are inserting items into a sorted array, then you can use a version of this as in insertion sort. When you do that though, you want to do head and tail optimizations (look to see if the new entry should go to the head or tail of the array). Doing that adds two comparisons to the overhead, but adding items to a sorted array can create a huge speedup. An example of that situation is to insert output from an SQL select statement with an orderby clause, causing the output to be sorted before inserting in the array.

I have personally implemented these algorithms in major commercial application frameworks.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Volatile allows a global or shared variable to be read and written attomically. Example: int newvalue = vvar++; which would set newvalue to the volatile variable (vvar) and then increment vvar. This may be a viable approach if the threads share no other data that needs to be protected from simultaneous access. Without more of your code to review, this is as much as I can say.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

This line: per=(m1+m2+m3+m4+m5)/500*100; means that per is equal to the sum of the inputs divided by 50000. It that your intention? Or is it to divide the sum by 500 and then multiply that result by 100? If so, then the expression should be (since C/C++ treat multiply and divide operators with equal prescidence) per=((m1+m2+m3+m4+m5)/500)*100;. You need the parentheses to force the order of evaluation.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I have written such in C back in the 1980's. It was not only a movie database (that was part of it), but it was a full video store management package, integrating register, scanner, price lookups, rentals, purchases, etc.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

To see what is going on, before line 8, put in a printf statement that will output i and j. That may help you see the behavior of the algorithm. IE:

    int i = 1;
    while ( i < 10 )
    {
        int j = 10;
        while ( j > i )
        {
            j--;
        }
        System.out.printf("i == %d, j == %d\n", i, j); 
        i += j;
    }
    System.out.print(i);
JamesCherrill commented: Exactly! That's how to understand it. +15
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

C++ is derived from C, and is fully compatible with C code. It has added classes, templates, references (vs raw pointers), and a number of other advanced programming features that allow you to write very complex programs much more quickly and with less code that it would require in C. As it is, the original C++ was a pre-processor for C, and C++ code would be turned into C code for the C compiler. That was the standard when I started programming in C++ in the early 1990's some 25 years ago.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

And don't forget to stick your tongue out and flap your arms vigorously while you reboot!

Sorry, I couldn't help myself after these other responses! Do let us know WHAT you need help with. We are not mind readers, but we will do what we can to help you if you let us know what your problem is.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

@Nathan
If they weren't open then I would expect the input and output operators to throw an exception.

@markdean1989
What output do you get if you use cout instead of outfile for the output stream? Do you get sensible values for mathgrade, scigrade, and average. Do you get any output? If not, then you may be getting a divide-by-zero or value overflow error. Also what compiler are you using, and if a GNU variant such as MingW, what compiler options did you use?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Why are you worried? Do you think someone is hacking your keyboard/computer interactions? Yes, that is possible, but really unlikely unless you are up to something that the government is worried about, or someone is trying to steal information from your company.

A friend of mine developed a high-security Tempus terminal for the government that could not be hacked. The terminal itself was very tightly shielded from remote scanning, and the keyboard (a common weak point for computers and terminals) did not do any electronic communication with the system. It used passive LED's, shutters, and light pipes (fiber optics) to signal keystrokes to the CPU. No electronics were involved. It passed the most stringent NSA tests on the first try - unheard of in those days (the early 1980's).

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Nobody really gets this correct. Microsoft certainly doesn't get it right, and Linux engineers are not much better. There are too many factors such as system load, I/O loads, disc read/write speeds, is the source file on one disc and the target on another or the same disc? What are their speeds, buffer sizes, etc. You can get the actual size easily enough, and let your progress bar show the actual percentage of the file that has transferred. After some has been moved, you can start estimating how long it will take and show that in a window with the progress bar. That is how most do it.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

This is a MS API question, and not relevant generally to C++. We would need to know in detail what the SelectObject() function is doing, and that is not in the pervue of C++. It is specific to the MS API's. Read their documentation for more information would be an appropriate answer I think.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

@Mike2k
My grandson is a prodigy, though he has finally hit adulthood (21 this year). At 8 years old he rewired my daughter's kitchen radio in order to receive transmissions from his kid walky-talky in the back yard ("Hey mom, can you bring me some lemonade?"). He designs and builds from scatch drone aircraft (both fixed wing and rotary) and designs/builds/programs all the control systems as well so they are totally autonomous!

I have only one suggestion for this "prodigy" - get competent with formal/boolean logic. Just learning programming languages is the easy part. Making them work right is not so simple! I speak/read/write multiple human languages, and dozens of computer languages. The key is understanding the context. In Spanish, when does the english word "plate" imply "plato", and when does it imply "platillo"? Context is the issue here, and logic.

And don't hesitate to ask for help and/or advice Jack. I wish you the very best!

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Is this a 32-bit only CPU, or does it have 64-bit capabilities? My Dell D630 is a Core 2 duo with 64-bit capabilities. I run a clone of Red Hat Enterprise Linux (Scientific Linux) on it very nicely. Getting the WiFi working took a little work, but it functions nicely once I got the correct driver and firmware installed.

In any case, a lot of people like Linux Mint, a clone of Ubuntu, which is a clone of Debian. They are more up-to-date kernel-wise than RHEL, CentOS, or Scientific Linux. They also support newer software, such as Google Chrome for a browser (no longer supported on RHEL 6.x systems, though Firefox is fine).

Anyway, my recommendation is that you experiment and find a distribution that you like better than the others. You may need to burn a few live DVD/USB devices (you can reuse the USB thumb drives) and try them out before you find the one that says "ME". For USB live devices, check out Unetbootin. It has software for Windows, Linux, and OSX, though the resulting USB drive, if created on OSX, will not run on an Apple system. Here is a link: http://unetbootin.sourceforge.net/

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

TCP is connection oriented, suitable for sending complete files. UDP is packet oriented, suitable for sending short messages. TCP will verify that all the data got to the destination, and in the proper order. UDP makes no guarantees. You will have to bake your own error recovery and retry logic.

In the case of a "media server", if a client connects to you via TCP, then you can send the data in a stream and not worry about it getting there properly, other than if something breaks the stream (network glitch or whatever). If you are just pushing out data, and let all the "listeners/receivers" get the data as desired, then you would use UDP - the receivers would need to deal with bad/missing data. With media that may not be a problem unless you have a lossy network environment. This is a "broadcast" environment, and TCP/IP does let you broadcast UDP messages to anyone on the network (LAN - broadcast packets usually don't travel outside of the local network), which the clients can listen for and receive. So, there are two real options for a media server. One is connection-oriented TCP streams where the clients connect to the server to get a stream. The other is where the media server broadcasts UDP packets to whoever wants to get them, kind of like radio.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

JorgeM is correct. In our home, I have two wifi access points w/ switches. The router/internet connection and access point is in my office in the basement. The other switch/access-point is in my wife's office on the first floor. They are connected via a power-line connector, which is just an ethernet cable that uses the home power lines for transmission (don't have to run a cable). It has worked great for 9 years now.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

By default, deleting files on Linux systems will put the file/directory into the trash folder (works that way on Windows also). If you empty the trash folder, the files in that directory will be physically deleted. The reason for putting them there is that if you realize you didn't want to delete a file, you can recover it from there. Usually, the trash folder has a file number or size limit. When you exceed those settings, then the oldest files will be deleted first.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

For a bootable image, you first need to write a boot loader. Not too hard - I've done it in the past. The boot loader executes the code found, then relocates to the actual system image to continue. Then it jumps to the actual system code. So, it is a 3 step process at the least. You can't just write some assembler and then expect it to work like a disc, iso or not.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

This is why we use surge suppressors! Chances are that many components on the motherboard and/or video card were fried with that surge. My system and peripherals are plugged into a UPS that is also a serious surge supressor (industrial strength). Brownouts can cause almost as much damage as a lightning strike surge. My advice is to get a new system and be happy if you can recover your data from the old system.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

You are almost there. Do the code and show us how you might do it. Basically you are adding the values of arr[0][N] and arr[1][N] where N is 0...4.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

The means to clear the BIOS flash memory varies from system to system. Some let you do that by removing the battery and holding down the power button for 10-30 seconds. Some require that you remove the battery and short out a pair of contacts on the motherboard. You need to visit the system manufacturer web site support pages to find out for your specific model. It should also let you know if it has a UEFI BIOS. Those require "signed" operating systems and kernel drivers, though some do allow that "feature" to be turned off in the BIOS. Some do not. You can thank Microsoft for this cruft!

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Does this system have a UEFI BIOS. Considering it is a Core 2 Duo probably not. Sorry, but as I have indicated, I have never seen this before. Have you wiped the disc, cleared the BIOS flash memory, and created the bootable image on another system from the .iso files?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

What is the make, model, BIOS version, and processor type of the computer you are trying to install on? Also, how did you burn the CD/DVD/USB drives? As I said, these errors make no sense to me and in 15+ years working with Linux on 32 and 64 bit systems (workstations, servers, laptops, netbooks) I have never seen them.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

What distributions are you trying to install? These make no sense to me! I believe you have a bogus distribution. Have you tried Debian, Red Hat, Ubuntu, Mint, et al?