Frequent Questions

2463 votes
23 answers
493k views

When discussing performance with colleagues, teaching, sending a bug report or searching for guidance on mailing lists and here on Stack Overflow, a reproducible example is often asked and always ...
209 votes
12 answers
4.4m views

What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them? What methods/tools can be used to determine the cause so that you stop the exception from causing the program ...
6744 votes
44 answers
2.2m views

How do I return the response/result from a function foo that makes an asynchronous request? I am trying to return the value from the callback, as well as assigning the result to a local variable ...
Felix Kling's user avatar
2769 votes
27 answers
2.2m views

If user input is inserted without modification into an SQL query, then the application becomes vulnerable to SQL injection, like in the following example: $unsafe_variable = $_POST['user_input']; ...
2379 votes
36 answers
4.1m views

I need to match all of these opening tags: <p> <a href="foo"> But not self-closing tags: <br /> <hr class="foo" /> I came up with this and wanted to make ...
1864 votes
26 answers
2.5m views

I have some code and when it executes, it throws a NullReferenceException, saying: Object reference not set to an instance of an object. What does this mean, and what can I do to fix this error?
4035 votes
35 answers
631k views

Consider the following code: 0.1 + 0.2 == 0.3 -> false 0.1 + 0.2 -> 0.30000000000000004 Why do these inaccuracies happen?
Cato Johnston's user avatar
4226 votes
1 answer
3.4m views

This question attempts to collect the few pearls among the dozens of bad C++ books that are published every year. Unlike many other programming languages, which are often picked up on the go from ...
723 votes
23 answers
4.8m views

I've been using the == operator in my program to compare all my strings so far. However, I ran into a bug, changed one of them into .equals() instead, and it fixed the bug. Is == bad? When should it ...
1832 votes
40 answers
1.0m views

What are undefined reference/unresolved external symbol errors? What are common causes, and how do I fix and prevent these errors?
Luchian Grigore's user avatar
1374 votes
29 answers
2.2m views

I'm running a PHP script and continue to receive errors like: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php on line 10 Notice: Undefined index: my_index C:\wamp\www\...
2738 votes
14 answers
270k views

What are the technical reasons for why one shouldn't use mysql_* functions? (e.g. mysql_query(), mysql_connect() or mysql_real_escape_string())? Why should I use something else even if they work on ...
Madara's Ghost's user avatar
2830 votes
30 answers
423k views

In this question, someone suggested in a comment that I should not cast the result of malloc. i.e., I should do this: int *sieve = malloc(sizeof(*sieve) * length); rather than: int *sieve = (int *) ...
Patrick McDonald's user avatar
1673 votes
23 answers
1.1m views

I have a bit of code where I am looping through all the select boxes on a page and binding a .hover event to them to do a bit of twiddling with their width on mouse on/off. This happens on page ready ...
Eli's user avatar
  • 100k
651 votes
15 answers
418k views

I've heard much about the understandable abhorrence of using .Select in Excel VBA, but I am unsure of how to avoid using it. I am finding that my code would be more reusable if I were able to use ...
BiGXERO's user avatar
  • 7,304

15 30 50 per page
1
2 3 4 5
151716