rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

If fork() returns 0, then the process that got that is the child, otherwise the forking process will get the child's pid, and it is the one that wants to know when the child terminates so you don't end up with a zombie process (the dead child). That's what the waitpid() process does. There are some subtleties related to that which you will want to research in any case. RTFM - read that fine man page! :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Ok deceptikon. I don't know since I ALWAYS return a value from main(). In many cases it is an error condition that occurred that the shell needs to know about. Just returning 0 by default does no one any good, IMO.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

If you want to debug system files, then you need the debuggable versions of those files (dll's mostly) that still have the source symbols in them. Normally, system dll's don't have those included in that they are "stripped". IE, if you need more information about this, go to the Microsoft VS web site.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

And what problems, specifically are you having? From the title of this post, you seem to think that shared memory is a problem? Why do you think that? Please be more clear about your issues. I see your code - you create a shared memory segment, fork, but you don't do anything with it.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

The more WiFi connection on your local network, the slower things get. A hard-wired connection will be the most stable, internet lags and such notwithstanding. Those you cannot control, but on the LAN side, you can have some control.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

"The nice thing about standards, is that there are so many!"

So, when writing code, be clear, explicit, and consistent!

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

@Nathan - Ok, but I prefer to never leave things to chance. Not all compilers are so compliant...

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

It depends upon the system. Linux can handle timing in the nanosecond realm. You need to run both algorithms many times, accumulate the time, and then compare. Just comparing on one run that may only take nano, micro, or milliseconds is not sufficient since other stuff is also taking system time. Your process is not the ONLY process running...

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

When it answers "NO", you still fall through to process the invalid handle. You need a conditional to detect that and either emit an error message, or throw an exception.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Never pay these thieves a penny! It's like leaving cheese out for the rats. They won't leave you alone! There are some of these malware encrypted systems that can be decrypted. Do a Google search to find out if there is a means to determine the code for the system in question. If not, cut your losses, wipe the system, and restore from backup - you do have backups, right?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Your question is not clear. Please be more specific. Symbols are embedded in object and executable code until they are stripped, usually in order to reduce the physical size of the file(s). If you have stripped a binary, then you cannot debug it since the debugger (WinDbg in your case) needs the symbols in order to step through the code and show you where you are in the execution process.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Ok. Since you are using yum as a package manager, that means that you are trying to install this on a Red Hat or clone system. Please provide the specifics of your OS, distribution, version, etc. I am running a clone of RHEL 6.6 and the 4.0.10.9-1 version (from epel) doesn't have installation problems.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Almost 800 lines of scan output? Please reduce it to the entries you thing are problematic. My time costs my clients $200 USD per hour. Be respectful that we are doing this gratis.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

You can initialize a structure, or array of structures, with memset(). Example:

#include <stdio.h>
#include <iostream>
struct MyStruct
{
    string name;
    string address;
    string mobno;
};
int main(void)
{
    struct MyStruct aStruct;
    struct MyStruct arrayOfStructs[0];
    ::memset((void*)&aString, 0, sizeof(struct MyStruct));
    ::memset((void*)&arrayOfStructs[0], 10, sizeof(struct MyStruct));
    return 0;
}
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Those are typically the tools you use to develop web applications like this. PHP on the server side handles the "heavy lifting". Javascript on the client will handle most of the graphics (there are a lot of JS graphics tools out there, some of which are google's), and HTML will help deal with the user input, buttons, lists, etc. You have a great deal to learn to accomplish this project. Time to get started! :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

All phones should get their time from the cell tower/service (by default) which is normally syncronized to the global time service (network time protocol). So, normally, you should NOT have to deal with this. If your application needs to, because the devices are in different time zones, then adjust the program's time to GMT on both ends. In any case, they should be within milliseconds of each other when using the same time base. Bear in mind that there will be some lag if one end is in the USA and the other is in Australia or India (etc). Maximum lag? 12000 (1/2 way around earth in miles, approximately) / 186,000 (speed of light in miles/second, approximately) ~= 64.5 milliseconds. IE, a signal at light speed will take about 64 1/2 milliseconds to go 1/2 the way around the earth. Given current communications technology, it will be somewhat longer than that because of switches, repeaters, routing, etc. It could be 100ms or longer.

Note that satellite links will be even longer as geostationary communication satellites are about 25,000 miles from earth, so round trip to another point on earth would be about 50,000 miles, or about 4x the time noted above - or about 250 milliseconds (1/4 second). This will give a noticable lag in speaking, and hearing the reply.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Ok. Post your questions, code, errors, and problems (incorrect results or output) here and we will help if possible.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Your example will output the data and then return (you forgot the return statement, btw) because the condition will always evaluate to false. If you stated it as a while()... statement instead it would have to have been while(true) {/*output;*/ break; } which is somewhat uglier. There are times for while loops (usually), but there are times for do...while loops as well. So, you have written a most elementary do...while single pass loop. Show how you would write a simple while loop to do the same thing.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Don't dual boot. Have a good host OS and then run other operating systems in virtual machines. Current systems, especially ones built for Windows, don't play nice for dual booting without a lot of effort, pain, and suffering on your part!

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

It depends upon the usage. For personal and gaming systems, mostly Debian and derivatives (Ubuntu, Mint, et al). For enterprise servers, mostly RHEL and clones (CentOS, Scientific Linux, Oracle Linux).

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I'm not sure there is much we can help you with here. Part of the issue with algorithm development is the math and the logic. If you aren't strong with those, then you are going to have problems. Start by writing out the problem, and then your solutions, using plain language. Next, when you think you have the domain properly understood and a possible solution, write it out in computer pseudo code, along with the logic and math to support it. Be as detailed as possible. I think 90% of the time will be getting this to where you are sure you understand and have a solution to the problem. Only 10% will be writing the code. BUT DO NOT START WITH CODE!

ddanbe commented: Exellent advice. +15
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

If you are doing this as an online project, then for the server use PHP, and DO use it as a C++ like object oriented language! On the client, you will probable use javascript graphics tools to handle the rendering. The server will emit the javascript to the client, with appropriate variables and function arguments filled in by the PHP classes you write for the server. You should not need C, C++, Java, VB.net, et al for this. PHP, javascript, and HTML should work well for this.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

If the PracticeTest class inherits from Task, then you can use it to initialize a Task variable. However, you won't be able to use PracticeText methods unless they were also inherited from Task. This is where interface classes can be useful.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Media converter? Such as gigabit ethernet to fiber? Go to www.blackbox.com. They have lots of such stuff. And yes, you would need two converters - one to go from ethernet to fiber, and another from fiber back to ethernet, unless the system, router, bridge you are connecting from/to has a compatible fiber port (a lot have standard fiber ports these days). Just remember, the nice thing about "standards" is that there are so many! Read the fine print and make sure you understand the standards and protocols each device uses, otherwise you will spend a lot of your client's money and not have a functioning system.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

If you aren't technically astute and haven't built a system before, then either buy a pre-built one with the features you want, or find a local white-box builder (computer store) to build one to your specs. I have built a lot of systems (and am certified by IBM and others to do so - factory trained and certified computer technician by IBM, Apple, Compaq (now HP), AT&T, and Zenith), but my current workstation I had a local builder do it to my exact specifications. That was 8 years ago - the price was very competitive, and it still works fine - I'm writing this on it right now. 8 cores, 8GB RAM, many terabytes of disc, and good audio (built-in) and video (nVidia card) w/ Bose speakers and dual 24" HD displays (1920x1200). The builder burnt everything in and tested it extensively before delivery. If there was a problem, he would have dealt with it before bothering me.

I only had to write him a check, and plug it in!

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Most routers have 100mbps ethernet links, so if your WiFi is 802.11n, it will have close to that speed. The advantages of a wired connection are these:

  1. More reliable and stable data stream.
  2. No radio interference (w/ accompanying speed degradation) from neighbors' access points (AP).
  3. If someone connects to your AP/router with a slower connection type, such as 802.11b, then you won't be impacted.
  4. Less chance of being "hacked" by a drive-by road warrior.
JorgeM commented: +1 yes, exactly.. +12
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Per David W's post, modular arithmetic returns the remainer of a division operation, so 4%2 is the remainder of 4/2 which is 0. If there are 30 days in a month, then if it is the 15th of the month, the remainder of 15/30 is 15, so 15%30 == 15. If we are using the day of the year to determine the month, and day of the month, assuming all months have 30 days, then if the day is 250, the month is 250/30 == 8 with a remainder of 10. So 250%30 == 10. IE, the date would be the 10th of the 9th month (September 8th) as the 8th month (August) is complete.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

And remember, we don't do your homework for you. We get really cranky when people post the assignment, but not their work...

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

So, are you having a problem? The code looks ok, functionally, although you should probably add conditions that test for equality as your code won't trigger if it finds an equality condition. IE, if (a >= b && a >= c) { if (a==b) printf(a and b > c); }, etc. It does get more complicated that that, since you also have to check for equality with c, so if a, b, and c are all equal, you might want to note that.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

You might be able to get it unlocked at an Apple Store, or if you know who the original vendor was (AT&T et al), you could go to one of their stores to get an unlock code.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Yes, I can see that it can be a good teaching tool. Enjoy! I hope we have helped you in your self-education endeavors. I always say, never let school get in the way of your education! :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Joke: I can easily help you "badly". Helping you well (good) is another problem! :-) FWIW, JamesCherrill usually gives good advice. Also, read stultuske's comment about Random(N). IE, create one instance of Random and then call the appropriate methods on that instance to get the next random number. If it is a class member variable, then you can use it any time you want. Just create a public getter method to access the next random number. That way, any of your classes can get one as needed.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

How depends upon the operating system. If it is a simple program, then with Windows, you add it to your Start menu. If Linux, you can add it to /etc/rc.local. If it is a service, then for Windows you add it to the Services list to be autostarted. If Linux you add it to the rc.<runlevel> files with the chkconfig command (as root or sudo). Read the Linux chkconfig manpage for more details.

As for Windows programming / GUI programming, that is another topic entirely, and I suggest you create a new thread for that! :-) And good luck!

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Some nit-picking here. Your functions set global variables instead of returning values. Change that so that the results of a functional computation is returned without setting a global variable. Your current practice will come back and bite you in the future unless you change it. IE, instead of void Reverse_Number (int Product), the function should be int Reverse_Number (int Product) and it will return the reversed number.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

@tinstaafl - an interesting adaptation, though I think that even (slightly less than) ~1000 computations will, on current processors, not take enough time to measure, or at least to bother with. If this were frequently done in a production system, then I would agree with your analysis, and that it may be worth it from the performance perspective. I still prefer to start with the KISS principle, and then see if I need to speed things up. My philosophy for software engineering is that first, you make it right, and then you make it fast! :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Here is the results I come up with: 9*9*9*9*9*9*9*9*9*9*9*9*9 (9^13) == 2541865828329, which definitely requires an unsigned long long. When I tried a simple long unsigned value, the compiler (gcc 4.4.7) complained about an integer overflow.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Also, please avoid duplicate posts. Your question (?) has already been answered in your other post.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

And BTW, years != month/12, unless you are talking about the total number of months beyond or == 12, so you should say:

(months~=total_days/30;), (years=total_months/12;), (day_of_the_month~=total_days%30). Remember the approximate symbol (~). Approximations are good, if you remember to note them, otherwise you are just plain wrong!

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster
  1. 30 days has September, April, June, and November.
  2. All the rest have 31 except February which has 28 unless it is a leap year, in which case it has 29.
  3. Leap years are those where year % 4 == 0 unless year % 100 == 0 but it's still a leap year when year % 400 == 0.

Or in more simple terms (from Wikipedia):

if (year is not exactly divisible by 4) then (it is a common year)
else
if (year is not exactly divisible by 100) then (it is a leap year)
else
if (year is not exactly divisible by 400) then (it is a common year)
else (it is a leap year)

Of course, this only applies to Gregorian calendars, which we use today... :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Working out efficient algorithms is a key part of computer science. Good math skills helps. Also, don't be afraid of trying other approaches to solving the problem at hand. As someone once said, there is more than one way to skin a cat. Try different approaches and test them for efficiency, keeping in mind the KISS principle.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I used to do this all the time when I was researching public key encryption and Goedel algorithms. I would create an array of 10K elements that included all of the primes up to that, using the Sieve of Aratosthenes (I almost always misspell that). Look here for good coverage of the various algorithms to use: https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Accidentally removing the power like that can damage system files or the hard drive. When you say it won't boot, do you get the boot POST (power-on self test) that lets you press a function key (or escape) to get to the BIOS setup?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

So, do you have a problem, or are just showing off? :-) Sorry, couldn't help myself!

For some problems, recursion is simple and elegant. There are classes of problem where recursion is the only reasonable approach. Once upon a time, I found that a compiler (mainstream commercial C++ compiler for realtime as well as other systems) wasn't handling exceptions properly. I wrote a fibonacci routine (recursive) using exceptions to illustrate the problem. Properly compliant compilers handled it correctly, but the compiler in question didn't. I submitted the code to the vendor, and they had it fixed within a couple of days.

FWIW, recursive fibonacci don't dig that deep into the stack, and perform perfectly adequately. Using non-recursive algorithms for this is fine, but probably more trouble than it's worth. Using non-recursive algorithms for extracting the prime factors for really big numbers is a situation where recursion is, in my experience, the only viable approach. I won't get into that algorithm right now except to say that you use a Sieve of Aristhostenes to build an array of primes of say 10K elements. Using recursion allowed me on an old 8086/8087 PC with only 512K of RAM to factorize any number up to that expressible by a double precision floating point number. I would have extended it for arbitrary length numbers, but didn't have the time. It was part of my personal research into public key encryption and Goedel numbers. FWIW, extracting the prime factors for these big numbers took less …

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

It depends upon the system. Usually you need to access the computer manufacturer/vendor's website and support page for such information. In some systems, you can do that by removing the external power, remove the battery, and hold the power button on for some period of time (30 seconds usually will work) - a lot of Toshibas work this way. Others require that you remove the power (and battery if a laptop), and short a couple of contacts on the motherboard for some number of seconds. A lot of HP laptops require this latter technique. My attorney gave my grandson an HP laptop that had the BIOS locked with his fingerprint. My grandson, who is an engineering genius, removed the keyboard cover, shorted the required contacts, and had Windows 7 installed, all in less than an hour! I gave him the system, sat down to talk with my daughter, and after a bit he brought the system into the living room, which proviously was running XP, to show it running Win7. Heck, it would have taken me at least 2-3 hours to do the same! :-)

cambalinho commented: thanks for all +3
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

@saifN - your post makes little sense to me. You are declaring a function that takes an argument 'n', and only has a statement 's' in the body. No operations. No nothing.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

What Ene said. We don't do your homework for you. Post code, errors, and problems. Then we may help you.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Part of the problem with Mac systems is that the default user has admin privileges, much like Windows systems do by default, so malware can install software that can bypass other system security measures. This is not the case with most Linux systems unless the user, as root, alters the /etc/sudoers file to allow someone root privileges without a password. I'm not sure if the Mac default user has to input their password when installing new software, but hackers could compromise that if needed.

Good system security is very difficult. Just ask Bruce Schneier! Any system can be hacked - just ask the NSA...

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

How did you format the laptop? Also, did you clear/reset the BIOS flash memory as well, and as part of the refomatting, include the boot sector, or just the NTFS partitions?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Have you read this in detail yet? http://www.ftdichip.com/Support/Documents/DataSheets/Modules/DS_UM245R.pdf

Use the Code block to post your code. Just make sure your code is properly braced and indented. I assume you are talking about C or C++ code?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Switch to Linux? Not an option I suppose... Back up data to external drive. Scan and clean the drive for malware by another (uninfected) system. Wipe your system drive. Reinstall the system from DVD. Reinstall all your necessary applications. Copy data back to system from backup drive.

And when I say to wipe the system drive, that includes the boot sector, and you also might want to reset (wipe) the BIOS flash area. It keeps getting more and more difficult to get rid of this cruft!