rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Also, force use of secure http connections (using ssl - https://site/...) so the user ID and passwords, as well as returned cookies, are not "in clear" for hackers to see. Anything less, and you might as well not bother with user authentication and just let anyone in... :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Normally, you initialize static class variables in a translation unit (a source file, NOT a header). IE, in pessoa2.cpp:

#include "./pessoa2.h"

string Pessoa2::strnome("ana");
.
.
.

You should NOT be initializing it in the header (class definition), although I think the latest C++ standard does allow that (not 100% sure) - most compilers will not be so current. :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

If this is a USB device then you may have run into the same problem that I and a number of others have in the past couple of years, especially with Windows 7 - the drivers stop operating properly. The only solution I have found is to remove ALL usb devices and hubs with the hardware manager, then reboot. The system will reinstall all the required drivers and the devices seem to work again. I have had this happen with USB drives, my USB keyboard/mouse wireless transceiver, and some other USB devices. We don't know what the root cause is, but this procedure has worked for all of us hit with this problem.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

What OS are you running? There have been issues with Windows 7 that makes it necessary to uninstall all the USB devices (in the hardware manager tool) and then reboot. The OS automatically reinstalls the required drivers. After rebooting, reattach the USB drive and you should get your connectivity back. I've been having this problem on 2 Windows 7 systems for the past 2 years... The USB ports seem to work for Most everything else, but not for USB flash drives. So far, I have not lost any data.

FWIW, a number of my colleagues have had the same problem, though it has also has been an issue with some usb hardware interfaces to our device diagnostic tools that integrate with the JTAG interfaces on our consumer gear.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Actually, to get a random number between 0 and 25 (exclusive) using rand(), use a modulus operation: num = rand() % 25

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Use an output statement to display the resulting sql string to the console, and then post that here so we can see what you are actually trying to store. In any case, remember that string values in SQL have to be delimited by single quotes, which you didn't do for the start of the student id value, though it was ended with one. If the id is numeric, remove the terminating single quote. IE, you have one of two errors that a cursory view shows me - one is that if the student id is a string, it isn't properly single-quote delimited, and if it is a numeric value, then it is improperly single-quote delimited at the end of the value... :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

FWIW, my post above is NOT performance optimized, but will handle most all situations adequately. I use such code to process 10's of thousands of log records (up to 2K in size) per second in real-time systems, and still only take 1 or 2% of a single core CPU load. This is a case where the KISS principle (Keep It Short and Simple) is a good protocol.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Myself, I would use a map to map words to occurances:

std::map<std::string,size_t> wordcount;

to store the counts of words. Simple enough. Just increment the count on each occurance.

void addWord(const std::string& word)
{
    if (wordcount.find(word) == wordcount.end())
    {
        wordcount[word] = 1;
    }
    else
    {
        wordcount[word] += 1;
    }
}
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Boot into Linux and post the output of the commands "lspci" and "lsmod" here. We need to see what the chip set is that this device uses (lspci), as well as any drivers that may be associated with it (lsmod).

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

My comments about ss125 being a blackhat or working for the NSA was tongue-in-cheek. No disrespect was meant. I have written stuff like keyloggers in order to implement remote control apps like VNC long before such tools were available.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

@Momerath - I guess you weren't interested in MicroFocus COBOL? :-) It is (as far as I recollect - I haven't done anything with COBOL in a donkey's age) pretty compatible with most mainframe COLBOL compilers.

But yes, the other posters (Ancient Dragon and Momerath) are absolutely correct.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I assume you mean "use the dot operator"... :-) If so, the answer is yes!

pars99 commented: Yes, sorry about that. Thank you. :-) +1
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Simply put, the dot (.) operator is used to access members of either a full instance or reference to and instance of an object. The pointer-to (->) operator is used to access members of a pointer to an instance. Ancient Dragon gave you some good examples.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Go to the Apple web site iPod support page. You should be able to post a query there about this issue.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Sounds (sic) like there is either an incompatibility between the old dock and the new iPod, or the iPod docking port is defective. Take them both down to your local Apple store for the "gurus" to look at and advise you.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Performance engineering. Add C++ to your skill set - consider Java as C++ with training wheels (like a kid's bike). I make a good 6 figure salary doing performance engineering for a world-wide networking operation. I use C++ w/ C to develop network and application performance monitoring and diagnostic tools. Why C++ and C? Because we want these tools to have minimal impact (memory and CPU) on the systems they run on, yet be as efficient (fast) as possible. In the past, our engineers used Java and scripting languages to perform these functions, but they are too heavyweight and slow to be sustainable. The tools I design and write have been shown to have negligible impact on the systems and networks they run on.

Another skill to gain these days is "big data" - Hadoop, HBase, OpenTSDB (time-series data), etc. And make sure your skills include Linux/Unix systems engineering. 90%+ of network servers running today are Linux systems.

somjit{} commented: i was begining to lose hope , this was a great help. +4
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

The bitwise & operator looks at the left-hand-side (lhs) and the right-hand-side (rhs) of the expression and returns a word that has the common bits set (all the bits in the lhs that are 1's that correspond to the same bits that are 1's in the rhs). So, in your example, bFlag1 will respond to true if any bits are set, but in the second version, the rhs !(var == 1) will only set the first bit to a 1 if true, so the & operator will only return a set value if the first bit in bFlag1 is set.

IE, these expressions CANNOT be equivalent except under VERY specific circumstances. This is a great example of "doing what you mean, not what you say"... :-)

P.S. My advice is to take a course in formal (boolean) logic.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Current Windows systems (7 & 8) sometimes seem to lose the ability to recognize USB drives. You can try to remove all of the USB devices from the Device Management control panel and then rebooting. That will re-install the devices, and it has worked for me an others that I have advised to do this with the same problem.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Samsung makes good drives, so if it works, you should be golden... :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

C# is NOT cross platform! Yes there is Mono for Linux, but it is not really ready for prime time... Consider it a Windows-only tool. If working in the Windows environment is what you want, then fine, but realize that even on Windows phone systems, Java is still the language of choice.

So, ss125 writes keyloggers? Is he a blackhat hacker, works for the NSA, or just someone who likes to see what others are doing, behind their back? :-(

ss125 commented: Any rules stating that only NSA can code for keyloggers? Because I am programmer with interest in learning of all sort of things. +0
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Ok. Try this:

printf("%d", oct[i] & 0x07);

If you need more than one character printed, then you will have to print/shift/print...

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

If you want to print the number in octal format, then in your printf() statement, use %o for the format specifier. IE,

/* Instead of this */
printf("%d", oct[i]);
/* Do this */
printf("%o", oct[i]);
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

:-) LOL! Correct! ... You need to use the -L option with find to follow symbolic links. From the "find" man page:

        -L     Follow  symbolic links.  When find examines or prints information about files, the information used shall be taken
              from the properties of the file to which the link points, not from the link itself (unless it is a broken symbolic
              link or find is unable to examine the file to which the link points).  Use of this option implies -noleaf.  If you
              later use the -P option, -noleaf will still be in effect.  If -L is in effect and find discovers a  symbolic  link
              to a subdirectory during its search, the subdirectory pointed to by the symbolic link will be searched.

              When  the  -L  option is in effect, the -type predicate will always match against the type of the file that a sym-
              bolic link points to rather than the link itself (unless the symbolic link is broken).  Using -L causes the -lname
              and -ilname predicates always to return false.
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Physically, any 2.5" laptop sata drive will work. However, a lot of the Sony Vaio hardware has embedded identifiers that the BIOS interrogates and if they aren't Sony "branded" devices, they won't work. The only way to tell for sure is to try one. I know we had issues of this sort with a Vaio that my wife had some time ago.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

There is a company that only sells Linux systems (laptops, desktops, servers) at reasonable prices: www.zareason.com

Ancient Dragon commented: nice link +14
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Windows 8 has enabled EUFI secure boot. You need to disable that via the BIOS settings, or you need to be sure that the Linux distribution you are installing is secure boot enabled (signed kernel and drivers). This is a serious problem these days. IE, don't purchase ANY computer with Windows 8 pre-installed if you want to run Linux on it! Yes, you can, but it is a serious PITA. FWIW, you cannot disable secure boot on ARM systems (tablets) with Windows 8 or RT pre-installed.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

As far as I know, these is no "standard" way to do that. What precisely are you trying to do, other than count the number of object that have been instantiated?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I think you wanted this:

 's/\(wireless\.1\.ssid=\).*/\${SSID}'

to be this:

 's/\(wireless\.1\.ssid=\).*/\${SSID}/g'
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Specific error messages would be helpful...

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Please post the compiler errors, especially with regard to line numbers where the errors are detected.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Ask HP support. It is unlikely that there are any simulators for this gear available, unless HP has one.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

In any case, this is a situation where building a debuggable image and running it in the debugger would quickly show you what/where your problems were.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

So, what is your problem? Just posting code isn't usually helpful. In any case, the problem is passing *c to qsort instead of just c. The other problem is in your final print loop, you are passing *c[i] to the printf statement instead of c[i].

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Not necessarily. In any case, your use of it is incorrect. Ok. You are looking for empty-ssid inside the named file then? If so, your syntax for grep (order of options) is incorrect, and it should be like this:

SSID=`grep -o empty-ssid ${FILE}`
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

This is where you use the back-quote method, as in

SSID=`grep ${FILE} -o empty-ssid`

You do need the file "empty-ssid" to exist in the local directory however or you will still get the "No such file or directory" error.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

The output you see is absolutely correct. See AD's advice above. If bit1 was 2 bits instead of one, it would have output the expected answer. IE, an integer value with all bits set == -1 in decimal. That is what you have in your example. This is a good example of "what you say is not exactly what you get". :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Is this for production use, or to test/evaluate? If the latter, then install it on a virtual machine.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

In this code:

double PEmployee :: set_salary(double new_salary) const

{
    double salary = new_salary ;
    return salary ;

}

You are creating a local variable "salary" which will override the class member salary. IE, it won't set the instance member like you think. Remove the "double" declaration. There may be other, similar issues, but I don't have time right now to find them for you. :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

One way is to encode the strings into an array and pass the index to the switch. However, it would not be particularly efficient unless the array is sorted and you can use a bsearch() to find the index. This is good for reasonably large data sets, but not for small ones.

FWIW, that approach can be useful for compiler lexical analyzers to determine what to do when a keyword is found.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Sorry, but you have to try first, and then we'll help. How would you approach the problem? Show some work...

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Have you tried booting into safe mode, or into the recovery partition?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

It may be a usb power problem. Not all ports on some PC's provide adequate power for such dongles - WiFi devices have a pretty high power cost. Try other ports on your system. At least one probably has a higher power load capability.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Even if you purchase one (probably about $5 from Best Buy or Office Despot), you should post a complaint with Amazon - they owe you either a cord, or credit. If you don't, then they won't know to review packaging/shipping processes with their providers...

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Python has functions that deal with that stuff - in an operating system neutral manner. RTFM... Or do some simple Google searches! I just did, and came up with a bunch of links to stuff that tells me how to do this stuff.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

And FWIW, I DO prefer C++ to C for my work, but I use C inside my C++ code when it makes sense.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

@mike2k "I think most of the cautionary tales about not using C++ for kernel code or other very low-level stuff is mostly a matter of tradition (very dominated by C programmers) and misunderstanding (dominated by programmers with little understanding of C++, and often with a prejudice against it.. cough... Linus Torvald ... cough..). In any case, kernel coding is hard enough as it is, so if those with the competence to write kernel code like the C language better, let them use it."

Agree entirely! :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

You can use a virtual machine and build your OS in that, including using interrupts. In any case, this is not a simple subject, and from your posting you have a lot of studying to do before you start exploring the joys of interrupt tables, jump vectors, interrupt masking, non-maskable interrupts, and all that stuff.

That aside, interrups are generally of two sorts - hardware interrups and software interrups. Hardware interrups are to deal with hardware events, such as data arriving at a port, a keyboard key is pressed, a clock tick has happened (context switch time), etc. Software interrupts are just as they sound, interrupts that allows software to do stuff "out-of-band". An example of this could be the cron task that runs on most systems to run specific programs at specific times.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

If you are writing Linux kernel code and drivers (or for Solaris/BSD Unix), it is STRONGLY recommended that you stick with C and not C++. C is often considered a high-level assembler language, whereas though there are C++ implementations that are targeted at real-time applications and possibly kernel development, they remove use of things like virtual functions (including destructors) that cannot be deterministic. RTTI is also deprecated for the same reason.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

It is available in the standard repositories for RHEL and clones, at least for version 6. IE, RHEL 6.x. I have it in my Scientific Linux (RHEL clone) 6.4 standard repository (/etc/yum.repos.d/sl.repo).

So, try running the command yum list 'tkinter*'

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

So, AnotherClass has just made the m_int property of SomeClass instances publically available. If you want to restrict that access to just derived classes, then make those access functions protected.