rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

They are both 5 volts. One will provide a higher current, hence shorter charge time, than the other. The only thing you need to verify is what the maximum charge rate (amperage) is that your device supports. The 1Amp rate should be safe for everything. The 2.1Amp rate may not be.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Your main program can poll the files in question. When they get to the requisite size you can fork()/exec() a child process which know it is a child can take the file name and then archive the file in question, terminating when that is finished. So, you could have many children running which may exceed system resources (caveat programmer!), so you need to use one of the wait() functions to be informed when a child dies so the system will not leave zombie processes hanging around.

Another approach is to use the inotify api's to monitor the directories and files in them for specific events that you can specify, which will signal you when it happens. That eliminates the polling. I used this in the past year or two writing logfile processing systems for performance engineering. The code was a mix of C and C++. We were able to process 10 billion data points per day from 5000 systems, each point representing 1 log file line.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

For an unlocked device that can use a SIM (assuming you are going with a GSM device) from any provider, then $200 is pretty cheap. Take a look on Amazon.com. I have several, ranging from an old Nexus One (freebee from Google), to a Nokia 920 (freebee from Nokia when I left their employ), to a OnePlusOne which I purchased to replace the Nexus One. That one cost me about $350 USD, is very capable, has great battery life, 64GB storage, and 2GB RAM. I also have a company Samsung Galaxy S5 that has similar capabilities to the OnePlusOne, but also has a swapable battery and a micro-sd card slot.

Both the Samsung and the OnePlusOne should work on any GSM network (international) and I think they also have non-GSM capabilities as well, but I haven't tried that. I think I would need to visit Japan to find out! :-)

Elvi commented: ok thanks for ur advice! +0
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

"Most modern" != "best". All in all, it depends largely upon what your usage intentions are. Is this a personal workstation, laptop, server, what? Each has very different characteristics and performance needs.

Ijvaadh commented: A desktop +0
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

0x00 is a valid (null) character, and indicates the end of a string for C, C++, and other languages. Some languages encode strings with a length indicator (Java and others) and embedded 0x00 chars are just more data. 0x00 is only a problem if it is used to set a pointer to memory as it will then cause an exception (or segfault) when something tries to access it. Some poorly writtent languages may "go insane", but most will just give you an error and quit.

The bigger problem would be if a "valid" address (usually on the stack) is set to point to bogus/bad data, which could then result in "undesirable" results. This is how buffer overflows work for the most part.

RikTelner commented: Yea, heard about buffer overflows. +2
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

This is either a recovery system bug or the results of a corrupted image (such as a failing hard drive). I would guess the latter. Bug HP for new installation media and a new hard drive. If the system is still under warranty it may not cost you anything. If not, then... In any case HP has some pretty decent diagnostic tools so you may be able to determine if the hard drive is really failing or not.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

You make no sense.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Ok. Do you understand recursive functions? The simplest way is recursive, deleting the items from the tail of the list, otherwise you will have to keep storing the address of the next item, until the 'next' item is null. I'm not going to write your code for you since this is a class assignment. You write what you think is appropriate code, and we will help you debug it.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Assuming that the strings are dynamically allocated (with operator new or the C-style malloc/calloc functions) then they will remain around after the list pointer is deleted. More code would be helpful to enable us to better advise you.

senait.kifle.127 commented: It's a type of linked lists in C++ +0
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I think your problem is here:

for (int i = 0; i < messageList.Length; i ++)
{
    if (messageUserList[i].Contains("_0"))
    {
        .
        .
        .
    }
}

You probably need to set the guard barrier i < messageList.Length to i <= messageListPos. You have initialized the strings in messageList and messageUserList up to the value of messageUserPos, but everything beyond that is not initialized. The messageList.Length I believe would contain the number of slots in the list, which is the size of 16-bit integer - about 32000 items.

That said, before you start your loops you could first set every slot in messageList and messageUserList to an empty string. It will make your code slower because each iteration through the outer loop will require a full iteration in the inner loop, looking for the "_0" string. So, my advice is to rethink your nesting of these operations to determine if there is a more efficient way to accomplish your purposes.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

You could write a bash script to start it up on login (calling the script from ~/.bash_profile which is run when you login) to the system where it could ask for the password required. Anything else, keeping it in the script file for example, would not be safe as noted above.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster
  1. Learn to write code in C++ (not a trivial exercise).
  2. Learn some C++ game API's that will make your work easier (not a trivial exercise either).
  3. Design and model your game (what, where, how).
  4. Implement it in the API of choice.

FWIW, NathanOliver's post was spot on.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Well, Windows and its applications are still the 800lb gorilla target of malware writers (viewing all the credit card hacks recently at Target, Home Depot, et al that infected Windows cashier terminals), though Mac OSX is getting more attention these days. I personally believe that Linux is still the most secure OS, especially if you keep it properly updated and if you don't allow root logins and require a password for sudo operations by trusted users (needed to install new software, run system management tools, etc). Part of the problem with Windows and Mac is that the default user is usually set up on installation to have system management permissions, which is a MAJOR system vulnerability. If the default user doesn't have admin capabilities by default, most of these hacks would not work, at least without some additional assistance by the user.

ddanbe commented: Good tip! +15
Stuugie commented: Great points. +6
hefaz commented: Thanks alot for the topic +0
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

You aren't providing enough information. Does the system boot up ok? If not, do you get some indication that the BIOS is starting the system? Is your system using an older BIOS or one of the newer UEFI chip sets? What happens if you hold down a key (such as ESC or one of the function keys) during boot?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

You need an outer loop before the while (x == false) loop and after the end of the while (x == true) loop. IE:

while (true)
{
    while (x == false)
    {
    }
    if (conditions)
    {
        x = true;
    }
    while (x == true)
    {
        if (a == b)
        {
            //....
        }
        else
        {
            x = false;
        }
    }
}

You do need to determine if this outer loop needs another terminating condition. IE, this is a "forever" loop.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I would recommend that you create a support class, call it Person, that encapsulates name, address, city, state, and zipcode. That will simplify the underlying code considerably. IE:

class Person
{
private:
    string name;
    string address;
    string city;
    string state;
    string zipCode;
public:
    Person() {}
    Person(const string& aName,
           const string& anAddress,
           const string& aCity,
           const string& aState,
           const string& aZipCode) : name(aName),
                                     address(anAddress),
                                     city(aCity),
                                     state(aState),
                                     zipCode(aZipCode) {}
    ~Person() {}

    // Getters
    const string& getName() const { return name; }
    const string& getAddress() const { return address; }
    const string& getCity() const { return city; }
    const string& getState() const { return state; }
    const string& getZipCode() const { return zipCode; }

    // Setters
    void setName( const string& aName );
    void setAddress( const string& anAddress );
    void setCity( const string& aCity );
    void setState( const string& aState );
    void setZipCode( const string& aZipCode );
};

class Package
{
private:
    Person sender;
    Person recipient;
public:
    Package();
    Package( const Person& aSender, const Person& aRecipient)
     : sender(aSender), recipient(aRecipient) {}
    virtual ~Package();

    virtual void CalculateCost(void) = 0;
    virtual void Display(void) = 0;

    //setters
    void setSender(const Person& aPerson);
    void setRecipient(const Person& aPerson);

    //getters
    const Person& getSender() const { return sender; }
    const Person& getRecipient() const { return recipient; }
protected:
    Person& getSender() { return sender; }
    Person& getRecipient() { return recipient; }
};

There are a couple of important methods I left out of both classes - a copy constructor and assignment operator. I leave that to you as an exercise! :-)

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

Did you install Windows 8 after you installed Fedora? If so, then the Windows installer munged your grub boot sector. You might be able to recover it, but no guarantees. This may help: http://wiki.osdev.org/GRUB

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Ignore it. You know the saying, "If it ain't broken, DON'T FIX IT!"... :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Try initializing the variable 'i' first before using it.

Ashveen96 commented: I already have initialized it as Dim i as Integer. but still i get the same error. +0
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Even more important is the interconnect bus. That controls how fast and efficiently data moves between the CPU and RAM, secondary cache, etc.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Apparently a bunch of other banks (last I saw was at least 9 total) have been hit as well. Some think this is a Russian attempt at retaliation for recent Ukraine-related sanctions.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

256 bit AES is good for stuff only you are going to need to decode, otherwise you want to use at least a 1024 bit RSA algorithm such as PGP. Dropbox should have some guidelines for this use.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

We don't do your homework for you. Make an honest effort, show us the code if you are having problems, and if it seems appropriate we will help you resolve your problems and point out some of your errors.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

There are any number of distros it could be. The wallpaper may give a clue, but I'm not familiar with it. In truth, unless the name/logo is visible on the GUI, you would need to look at other things.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Do you mean the Simple and Fast Multimedia Library (SFML)? First I've heard of it, but the best way to check out something like this is to do some prototyping with it and see if it works for you. Since it is open source, do report bugs or usability problems to the development group. Without the feedback of real users, they can't strive to improve it for the rest of the community.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Well, it has been a couple of years since this post. I have to say that folks at Daniweb did get their stuff together. It has been seriously improved, without messing up the interfaces and other cruft that worked. Good work folks! And thanks for all the fish! :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

You need to scan into an integer value, not a string. Also, tell the user to enter a number instead of a string. IE:

int main()
{
    int num = 0;

    printf("Enter your number: ");
    fflush(stdout);
    scanf("%d", num);
    printf("Your number is %d\n", num);

    if (num % 2 == 0)
    {
        printf("Even.\n");
    }
    else
    {
        printf("Odd.\n");
    }
    return 0;
}
<M/> commented: thanks +10
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

You are missing a couple of curly braces. Try this instead:

    #include <iostream>
    using namespace std;
    int main ()
    {
        int num1 = 5, num2 = 10;
        if (num1 < num2)
        {
            cout << ”num1 is less than num2” << endl;
        }
        else
        {
            cout << ”num1 is not less than num2” << endl;
        }
        return 0;
    }

Proper bracing of conditional statements and better indentation help a lot in avoiding this sort of problem.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

You left off the command name which is "ls", as in ls -l ./HelloWorld

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

You need to either be online, or you need to call a phone number that should be provided in the Windows packaging.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

When multiple applications try to send/receive data at the same time over the same network link/connection, the network driver will mostly queue them in FIFO (First In, First Out) order. The network hardware will send/receive until it has reached its performance limit, which with modern hardware ports, is as much as 1Gbps (1 gigabit per sercond == 128 mega bytes per second). WiFi is slower, and most internet connections are even more so.

Anyway, there are delays. It is just that they are so short most of the time, you will never notice them. That's why I can stream audio over my internet connection while viewing a YouTube video at the same time, and not notice that there is buffering going on, unless my wife decides to upload another video to YouTube or Facebook at the same time... :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Go to the Manage Apps page. Applications that can be installed on the SD card will indicate that when you click on them. Many cannot, but many can, including things like Angry Birds. If they can, the "Move to SD Card" button will be lit up. I have an old Android phone (Google Nexus One) with only about 192MB of RAM, so I have moved as many applications as possible to the SD card. That has left me with enough space to install applications I would otherwise be unable to.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I wrote a simple desktop interface many years ago (about 1985) using the curses api. That wasn't simple to do, but worked rather well (it became part of a commercial office automation system). You can use Qt or GTK++ to do this today, as do Gnome and KDE, but modern systems have a lot of other cruft to deal with as Mike2K indicates. To create a desktop environment in a web-based (browser) environment has no less challenges, and may be more difficult in fact. As IamThwee said, you will need html, css, and php. FWIW, php is basically C++ with HTML embedding capabilities. Both Qt and GTK++ are C++ libraries. So, in either case, you need to understand object-oriented programming and C++ just to get started.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

The camera should only be enabled remotely if the student has reported the device as lost or stolen. To do so otherwise is an egregious violation of their right to privacy, and is, on the face of it, a felony. Keystroke logging? That is also a violation of privacy, but possibly not illegal, just unethical. If our school district did this to my children or grandchildren, I would have them in court so fast their heads would explode!

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Write out the algorithm first in pseudo-code. If words can only contain alpha characters (no numbers, special characters, etc), then incorporate that into the pseudo-code, skipping past the next white-space character(s). Myself, I would read the file one character at a time, and use a finite-state machine algorithm to accumulate characters into a word until either a disallowed character, or whitespace (including carriage returns and linefeeds) is encountered. If whitespace is encountered, then the word is looked up in the dictionary and the instance count is incremented, or if not found, then added to the dictionary with an instance count of 1.

Once the pseudo-code is satisfactory, then you can start coding. This is a good example of why starting with code is not a good idea. It just obfuscates the issues you need to deal with.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

There are network monitoring tools that can help you do that. Two that are available (free, open source) for both Windows and Linux are Wireshark and tcpdump. They can work together if needed. IE, you can capture a bunch of network packets with tcpdump and then view them in wireshark. Anyway, you might want to check them out on the web.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Mac OS is basically BSD Unix with a nice GUI. Linux is similar, with many nice GUIs, SOME of which resemble the Mac's. That said, Linux GUIs are a lot more user configurable than the Mac's is. Play with them. You can switch easily enough, without munging the entire system.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Try using Google or Wikipedia to start your search about facial recognition algorithms. This is not a simple subject and is one that has tripped up some of the top minds in the business for years. Just now are some such technologies becoming reasonably accurate where they can be used in "production" environments, not that as a student project that would be a requirement. In any case, I think you have a lot of work ahead of you, and not in just the coding aspects of the project. Getting your head around the algorithms themselves will be a challenge in itself. If you get it to recognize your own face in various poses (smiling, mouth open, eyes shut, with/without glasses, etc) with only one reference photo as a baseline, then you will be doing very well indeed!

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

And that method is...?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

And the purpose of this is? Keyloggers can be used to build a remote-control support application (I have done so in the past, and that is what VNC and other RC applications do), or it can be used for nefarious purposes. In any case, it can be a dangerous path to provide for those who don't know how to pwn systems already... :-(

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

You have defined State after Machine, but each has a dependency on the other. This is how you can deal with that:

// Forward declaration of the State class.
class State;

class Machine
{
    // Don't put 'class' in front of State here.
    State *current;
.
.
.
};
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

So, you only show your main() and argumentCheck() methods. What have you done for the createTable() and printTable() methods? What problems are you encountering?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Actually my suggestion only shows what runs on the browser. The PHP code runs on the server, and that, as mentioned by other posters here, is not easily accessible. That is the property of the web site, and not yours to use.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

You want the code for that web page? Most browsers should allow you to display the code. I just did with Firefox. It's about 1000 lines of HTML with form calls to various PHP pages, most of which are recursive calls to the same page except the login script which is a different page (index.php).

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

The main distinction, which decepticon was trying to get across, is that each member variable in a struct has its own memory within the structure, and the structure size is the aggregate of all the member variables. A union is only as big as the largest member of the union. So if you have a struct like this:

struct foo {
    int x;
    char* y;
    double z;
};

The size of struct foo is sizeof(x)+sizeof(y)+sizeof(z). However if you have this union:

union foo {
    int x;
    char* y;
    double z;
};

The size of union foo is the largest of these elements, which depends upon the system architecture. The size of x would be likely 32-bits, z would likely be 64-bits, and y could be anything from 32-bits to more than 64-bits, unless you are programming an 8 or 16 bit embedded processor, in which case they will be smaller. So, assuming you have a 64-bit system, then the size of union foo would be at least 64 bits, and the size of struct foo would be at least 32+64+64, or 160 bits.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Glad to help. Sometimes basic C/C++ programming rules can be rather confusing, even to us "experts". :-)

nitin1 commented: I want the day when I can say myself "expert" +4
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Some years ago I wrote a bunch of code to generate any number of primes. I used the Sieve of Aristhostenes to generate all the primes up to 10K or so and then used a recursive algorithm to determine primes beyond that. I would write them out to disk, and memory use was small - I did this on an old Compaq PC with 640K RAM, back in 1984-1985. It was computationally intense, but I had an 8087 chip which let me deal with large numbers up to 32-bits without problems (unsigned long integers of the time) and quite efficiently - IE, primes up to 4 billion. Today, you can use 64-bit unsigned integers for a googleplex of primes. :-)

And don't ask me to post the code here. I still have it on a floppy disk somewhere, but I currently have no functional floppy disk reader.

マーズ maazu commented: So, you have done the math decades ago. Would you consider investing in Primecoins? a variant of bitcoin. +0
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

What Moschops said, but you can have multiple versions of gcc installed on your system. The command shown will be the default version installed on your system. I have both 4.4.7 (default) as well as 4.7.2 installed. At Fermi National Laboratory, they are running 4.9.1 by default as I understand (my wife works in the computing division there). That is the latest and greatest with the most C++14 support available, given the standard is still evolving.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Fibonacci algorithms can be made interesting especially if you discuss some of the history. The algorithm for computing the Fibonacci sequence is simple enough, has tonnes of applications, and has copious examples in nature. Here are two wikipedia articles that may help: http://en.wikipedia.org/wiki/Fibonacci and http://en.wikipedia.org/wiki/Fibonacci_number

FWIW, I found that joining and participating in Toastmasters was extremely helpful in learning how to speak with confidence and clarity in public.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

First, arguments on the command line are presented to the main() function via the argv string array. Next, process each argument (argc 0 is the command name, argc 1 is the first argument, etc) and convert each to an integer. IE:

cmdname 1 2 3 999 will pass 5 arguments (arg 0 thru arg 4) as in int main(int argc, const char* argv[]) so you need to iterate argc as an index in argv from 1 thru 4, as in:

for (int i = 1; i < argc; i++)
{
    int value = atoi(argv[i]);
    /* Do other stuff here, such as output of the value. */
}