rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

How's the weather up there? It may be condensation caused by the cold. Get the system to a warm environment, and give it some time to dry out. Some compressed air blown into the system may help dry things out more quickly.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I would tend to agree with @rproffitt, though the web site for QE says that there is a windows version available. You need a fortran compiler. I also don't see a Windows version for the 5.2.1 (latest) version. As for Windows 10, that is another issue entirely? Do you have a Windows 10 compatible fortran compiler?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Usually one uses recursion instead of a for() loop. Give an example of a problem you are trying to resolve.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I suspect that in a short while, PHP 7.x will be very solid. Keep testing it out until then! :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Where is your prolog code? This is C/C++. Prolog is very different. I assume you are speaking of the prolog computer language?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Rule of thumb for enterprise systems - NEVER do an upgrade to version 0 of anything. PHP 7.0 is no exception to this rule! That said, your feedback to the PHP development community may be helpful.

jkon commented: I agree 100% . It was 7.0.1 and in a small part of production +9
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

There are a number of solutions to this problem. You can use a std::vector for the array which will happily resize itself as needed. Much better than "rolling your own", which I have done in the past before the STL was available. For automatically resizable arrays these days I use vectors. Simple, and they take care of the care and feeding of the array.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Web servers often have to service 1000's of users in a short period of time. The less code they have to run, the better. My philosophy is to push as much of the processing, especially for UI stuff, as possible to the client, and leave the server to handle database I/O, and generating the html/js code needed by the client , and then pushing that out to the client in as big of chunks as possible. Less network traffic that way, and the server can handle many more users without noticeable performance degredation. Remember that client systems can usually download data much faster, and with lower latency, than they can upload it, so the less the network I/O, especially with regard to client->server stuff, the better.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

FWIW, this is the approach I used, with great success, at Nokia Mobile Phones before the Microsoft takeover.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Node.js is simply (AFAIK) a javascript API that allows you to speed up client-side development. Remember, JS runs on the client, and PHP on the server. PHP can serve up javascript to the client, where it is executed, and this includes node.js scripts. So, I don't think it is a matter of one vs. the other, but making them work well together. Keep server-side stuff on the server, and client-side stuff on the client. This sort of "separation of powers" will help with system security, as well as performance. In any case, use PHP on the server as the object-oriented language it was designed to be. Try not to mix HTML/JS with your PHP code, but rather use php to send the HTML and JS code to the client where it will be executed.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

You are accessing the array as a 1 dimentional one, but you have defined it as a 2 dimensional array. Your readarray() method is only assigning numbers to array[1][0...9], so your sum loop is wrong.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Not to mention a main() function... :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster
// Inheritance example.
using namespace std;
class base
{
private:
    int m_foo;
public:
    base(int afoo = 0) : m_foo(afoo) {}
    virtual ~base() { cout << "~base() called." << endl; }
    int getFoo() const { return m_foo; }
    void setFoo(int afoo) { m_foo = afoo; }
};

class derived : public base
{
private:
    float m_bar;
public:
    derived() : m_bar(0.0) {}
    virtual ~derived() { cout << "~derived() called." << endl; }
    float getBar() const { return m_bar; }
    void setBar(float abar) { m_bar = abar; }
};

This is an example of inheritance and polymorphism. When an instance of a "derived" class is destroyed, you will get this output:

~derived() called.
~base() called.

And no, this won't compile and run - there are missing includes needed - you get to figure that out!

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

So, what do you know about these subjects, and implementing examples in C++? Show what you might do, and we can help you, but I will NOT show you directly how to - that is the purpose of an education, to figure this stuff out from your text books and classes. Also, there is a ton of stuff on the Internet to help you.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Turbo C/C++ are so far out-of-date that you and your class should NOT be using them! You can download good open source C++ compilers for Windows that ARE up-to-date, such as MingW or GCC in Cygwin. If it doesn't allow string class usage (which is a derivative of basic_string, an STL class) then you are toast! If your teacher insists that you use Turbo C/C++, then you need to take another class...

That said, you CAN use char arrays for what you are doing, but you are using them very incorrectly. When you want to return a string pointer (or array), you are returning a single char. That won't work. You can build up an array in your functions, but then you need to return it as an allocated string which the caller can subsequently delete. IE, where your functions are returning char, they should be returning a char* to an item that has been allocated in the calling function. You COULD use a static array in your functions, and then return that as a char*, but that is not recommended practice!

rproffitt commented: I agree. Same for VB6. +7
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Also use classes where your constructor or setter methods can set internal variables that can be accessed with a simple getter method. Add to that @tinstaafl's suggestion about array's of strings, you can do something like obj.wbdisplay(); where the wb value is stored in the object when it is constructed. Also, wbdisplay(int) should return a string and not a char just as tinstaafl showed. It would be much more efficient, and do just what you want.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Types are critical. You are passing the address of a pointer to init() and not the pointer itself. Also, your variable TEMP* temp in main has not been initialized with a pointer to a real object. If you change the type of temp to a TEMP object, as in TEMP temp; then your call to init(&temp); will work just fine.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

What @tinstaafl said. You are basically passing the address of a pointer, not the pointer itself in your print() statement.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

There are a gazillion articles on the Net that cover this subject. You need to do some serious reading. The subjects of inheritance (dog inherits from animal, so does human), polymorphism (virtual int number_of_legs() - returns 2 for humans, 4 for dogs or cats but calling on a pointer or reference to animal will return the correct value), overloading - usually applied to operators such as assignment, comparison, math, or output operators. So, what language are you supposed to use for your exercise?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

This is DEFINITELY NOT a simple topic. As for computer languages used for AI applications, some of the common ones were (or are still) Lisp, Prolog, Smalltalk, Snowball, and stuff written in languages like C++ or Objective-C that implement CLIPS or neural network protocols. FWIW, I have programmed in Prolog, Smalltalk, some Lisp and Snowball, lots of C++ (I have a patent for adaptive systems software that is a branch of AI), and some neural networking in C++ (I took a class on the subject at MIT years ago).

Anyway, this is a delicious subject! Worth any time you spend studying it. Just don't expect to become an "expert" quickly. A PhD in the subject may just get you started! :-)

FWIW, there are tonnes of articles on the Web on the subject. There are also some great books. I recommend anything by Terry Winograd (professor of AI and Software Engineering at Stanford). I learned from him that syntax (the structure of a language) does not lead to the symantics (meaning) of the language, and it is deriving the meaning that is one of the biggest problems in the field. Consider these two sentences - syntactically pretty much identical, but symantically, very very different!

Time flies like an arrow.
Fruit flies like a banana.

(Thank you Terry for the above examples!)

Current AI has a real problem with this sort of stuff unless you have a gazillion special-case rules, which slow the system down incredibly.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

The info member of STRING is a char*, NOT a numeric or boolean value. What is your intent here?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Those card slots are usually attached to an internal USB hub. I usually fix this sort of cruft by going into the hardware manager, removing all the USB ports/devices, and rebooting. Windows will auto-discover all that gear and remount it. In any case, you can just remove the card-slot stuff from the device manager, possibly. I usually go for the "big hammer" solution... :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Good post. I left a comment using my Discus Rubberman48 ID.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

When I need to do this for clients, I will boot from a Linux live DVD with an external usb drive attached which Linux will auto-mount. Then I use the dd command piped through gzip to get the entire drive image and store the image to the external drive. Example:

dd if=/dev/sda bs=1M | gzip -c >/media/extdrivename/image1.gz

That will get the entire drive, including the boot loader and partition table, compressing it to save space on the external drive. To restore the image to a new system drive (which needs to be of a similar make/size if possible, you go through the boot process again and run this command:

gunzip -c </media/extdrivename/image1.gz | dd of=/dev/sda bs=1M

I have successfully cloned systems this way. As an aside, you will want to disable protected boot (set bios to legacy mode) if your systems have a new UEFI bios (most systems do today) since if it is enabled the installation of Windows 7 and later will write data on installation to the system bios' flash memory. Also, this may not work if you have full drive encryption enabled, but I haven't tried that so I can't say for sure.

rproffitt commented: "This looks like a job for ..." +7
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Assuming you want to keep your data, you install the new drive in the same place as the old one, boot from the CD, install Win7. Then, if you can, install the old drive in another slot, or put it in an external drive bay, connect to the system, and copy your files over to the new drive. You will also have to install new versions of most of your applications.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

What @amigura said. Hash values generated by the like of md5, des, sha1/sha256, etc. are NOT reversable by design.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

First, disable your Windows "firewall", then go to the networking page and delete your network connection, and then add it back. See what happens then. In any case, you should NOT need to update your system's network drivers, assuming that the new ISP's router is using a normal TCP connection.

One final thing. Some routers do not automatically detect whether you are using a regular ethernet cable, or a "patch" cable that is basically reverse-wired. You may want to check that out as well.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

You need to study what an insertion sort is. What are you inserting? How are you sorting the array? Also, your for loops in the sorting function is bogus. Didn't the compiler complain, at least about the inner loop? FWIW, EOF is dependent upon the context. Sometimes it means -1. Other times it means something else.

I think you need to go back to the drawing board and rethink this assignment.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Post your proposed code for the swap function. We are not going to give you the solution for this without some effort on your part. :-(

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Please format the register form with proper intentation. Also, you don't indicate where your bogus output is being generated. I can't find it anywhere in your example code (either PHP or HTML).

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

And do remember, we DO NOT do your homework for you. There are plenty of online resources about simulation software and how to do it. If you want our help, make an effort, post your code along with your problems and errors here, and then we can make the effort to help you. Just remember, most of us have day jobs. In my case, my time is worth around $100-$200 USD per hour, so remember that when I try to help you.

alfadil ahmed commented: thanks a lot for your advise , And sorry for taking your precious time. +0
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

In this example, it is redundant. However, in other cases, you can pass another function signature to the executeFunction() function, though that seems excessive unless the function to be called may be dynamically determined due to other things. In any case, do explain what you are trying to accomplish. In the C/C++ and other languages, this is called passing a function pointer to execute in the called function's body, perhaps using variables that the called function has, or knows about, or was passed when called.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I see you figured out to not apply the & (address-of) modifire to reverseWord in the form_temp_array() call.

It depends upon whether the words in the input file are one word per line, or all on one or more lines. That will determine how you parse them (problem 'A'). As for writing the words to a new output file, simply open a file for write access and do an fprintf() with new-lines for each word if the input file had them one word per line, and without (until after all the input) in the case where the words were all in one line (problem 'B'). Since you don't provide an example of the input file, that's as good as I can give you.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I think it has to do with how the printer deals with color variations. In your printer setup in the Acrobat Reader, you may be able to increase the color acuity, but then the printer may be limited in that. Try changing the line colors to see if that helps - more contrast == better output.

rproffitt commented: Yes! Do that too. For the test, go black then a primary color. +7
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Saying what the errors are is useful. That said, you are assigning your arguments to variables with the wrong variable names in your constructors such as BookTitle when the variable name for the class is 'title'. So, in the class, your variables should be things like BookTitle, ... BookReleased, etc.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Just this change:

class Account
    {
    public:
        Account()
            {
            }
        virtual ~Account()
            {
            }
    private:
        // Private parts here.
    }
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

So, to close. We don't do your homework for you. We will help you fix your more egregious mistakes, and make suggestions when we think you should be able to handle the exercise on your own. Good luck, and post your code and problems when you have some.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

So, using a stack to push the words of a sentence on, will reverse them as you pop them off at the end. IE, if you break up the sentence "This is a very good exercise in C programming" in to discrete words and push them onto a stack, as you pop them off and build a resulting string, what you would get would be "programming C in exercise good very a is This". Neat!

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

A stack is an abstract concept of, as @DavidW explained, that behaves in a first in, last out manner (or last in, first out if you prefer). To add an element to a stack, you "push" it onto the stack. Subsequent "push" operations will, conceptually, push the previous elements down one, and put the new element at the "top" of the stack. Then, when you "pop" an element off the stack, the last one "pushed" onto the stack will be returned, and the rest moved up one place. In C, this can be very expensive in terms of overhead, especially if the stack gets large. Usually we either use an array, where "push" puts the new element at the end, and the "pop" returns that element. As David mentioned, you can also use a linked list, which is more expensive in terms of memory, but very easy to implement. If you are using C++, the STL (standard template library) has a stack collection type that handles all of the gnarly stuff that has to go on.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

These are character (integer values) so the + or - '0' will subtract the ascii value from the left side of the expression. If you are talking about a zero and not a capital Oh, that has a decimal value of 48, so you are subtracting or adding 48. Here is a link to the ascii chart for you to look at: https://duckduckgo.com/?q=ascii+table

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster
  1. Use endl instead of '\n' for newlines in C++ code, especially when pushing to cout. It will force the stream to flush the data to output, which the newline will not.
  2. Where do you declare/define the pr variable? It is not in the function you show.
  3. Just saying you are having a problem is not particularly helpful. You also need to be more specific about what is going on.
  4. @DavidW has some other good suggestions.
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Most Intel-based chip sets support 64 bit math (80 bits internally to reducing rounding errors) which gives you up to 16 quadrillion in total values (16,000,000,000,000,000,000) - something less than 20 digits. For larger numbers, you need a library that supports an infinite number of digits - IE, if you need 2000 digits, that will handle it. Doing math on such large number is much slower than the internal math capabilities of the CPU, but still workable. There are dedicated chips (FPGAs mostly) that are designed for computing these numbers in hardware, but you won't find them on most systems as they are dedicated to only one thing - computing public/private keys and supporting the encryption/decryption that RSA and such require.

Since decryption of large messages with RSA and such is very slow, most systems only use the public key encryption to encrypt a smaller symmetric key and then use that to encrypt/decrypt the actual message. IE, the 1024-2048 digit public key is used to encrypt a much smaller (faster) key that is passed to the user who will use their private key to decrypt, and then use that key to decrypt the message.

A great book to read on this subject is Bruce Schneier's "Applied Cryptography" - considered to be a "bible" of the field.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

You should specify another php or HTML page for the action= component. In that page you can get the post variables and do the math... :-) If you construct your page properly, you can recursively call the same page. That said, just leaving the action out, the form will post to the same page, but you need to determine if you got post variables set, and then pass that data to the java script.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

As a final aside, I was about to build my own unlimited precision math library at that time, but I got a job as director of R&D for a software firm in Syracuse, NY where my wife was doing a post-doc in physics. That kind of put the kibosh on that project! :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

All that aside, the really big 1024-2048 digit numbers used for public key encryption these days requires the use of an unlimited precision math library. The boost library has such. Also, you need two of these mongo numbers, one for the public key and the other for the private one.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I did just that in the deep, dark past when I was studying RSA and public key encryption in general. That was back in the mid-late 1980's. I wrote a program that first seeded an array of 10,000 numbers using the Sieve of Aristostenes. Then, used recursion to determine if any number is prime. Of course, you first eliminate those that have an even digit at the end! It is only the odd ones (so to speak) that are of interest. Unfortunately, the code for that is on a floppy disc in a box somewhere in my storage room... I'd have to reconstruct it, but you might be able to find something on the net that does just that. On an old 8086 system, I could determine if a number up to 16 digits was prime in microseconds. I used that routine to factorize large numbers into primes and to generate Goedel numbers from strings.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

This is not an uncommon technique to minimize heap fragmentation; however, unless I can see the complete code for this I have trouble believing that they are returning that memory to the OS. Windows may do that, but *nixes won't without a call to sbrk().

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

@Ben - yes, simple delete operations on objects won't return the memory to the OS, but will be available to the program for future allocations. I'm not sure about what you say about "Binary Heap" allocations. The usual means to allocate more memory, and return it to the OS, is the sbrk function. It can only return (safely) the unallocated memory at the end of the heap. This is NOT an exercise for amateurs! I spent a lot of time studying, and writing, low-level memory allocation routines. Trust me, it is a LOT more trouble than it is worth!

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

All program memory allocated on the heap within a program will be returned to the operating system when the program terminates.

As for your line 30, that should be just fine. The results of new Type is a pointer to a Type object, Student in your case, so if you take the'*'away from the variable on line 30, you got the error you saw, which was correct. That all said though, you don't have to pass the pointer around in function calls, but can pass by reference and pass *pS to a function that uses it, declaring the usage as a Student& or const Student& as appropriate. This has a couple of benefits over passing as a pointer.

  1. The called function doesn't need to check the passed pointer for NULL (the compiler will deal with that for you).
  2. If it is passed as a const reference, then the called function cannot modify the object, but can only call public const methods that it provides.
ddanbe commented: Great explanation. +15
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

You cannot divide by zero as you do on line 5 when page-fault-counter is 0. Also, you are doing an integer divide and converting the resule to a double. You really should cast the numerator and denominator values (page_list_size and page_fault_counter) to doubles before the division. In any case, this should still result in a divide-by-zero error and cause the program to abort.