All Questions
2,211,583
questions
778
votes
20
answers
885k
views
PHP parse/syntax errors; and how to solve them
Everyone runs into syntax errors. Even experienced programmers make typos. For newcomers, it's just part of the learning process. However, it's often easy to interpret error messages such as:
PHP ...
643
votes
15
answers
402k
views
How to avoid using Select in Excel VBA
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 re-usable if I were able to use ...
3248
votes
45
answers
484k
views
JavaScript closure inside loops – simple practical example
var funcs = [];
// let's create 3 functions
for (var i = 0; i < 3; i++) {
// and store them in funcs
funcs[i] = function() {
// each should log its value.
console.log("My value:", i);
...
3407
votes
41
answers
1.2m
views
What's the problem with "using namespace std;"?
I have heard using namespace std; is wrong, and that I should use std::cout and std::cin directly instead.
Why is this? Does it risk declaring variables that share the same name as something in the ...
916
votes
7
answers
305k
views
Why is my variable unaltered after I modify it inside of a function? - Asynchronous code reference
Given the following examples, why is outerScopeVar undefined in all cases?
var outerScopeVar;
var img = document.createElement('img');
img.onload = function() {
outerScopeVar = this.width;
};
img....
246
votes
5
answers
55k
views
How to make good reproducible pandas examples
Having spent a decent amount of time watching both the r and pandas tags on SO, the impression that I get is that pandas questions are less likely to contain reproducible data. This is something that ...
52
votes
1
answer
212k
views
Reference - What does this regex mean?
What is this?
This is a collection of common Q&A. This is also a Community Wiki, so everyone is invited to participate in maintaining it.
Why is this?
regex is suffering from give me ze code type ...
1286
votes
39
answers
281k
views
Reference - What does this error mean in PHP?
What is this?
This is a number of answers about warnings, errors, and notices you might encounter while programming PHP and have no clue how to fix them. This is also a Community Wiki, so everyone is ...
568
votes
30
answers
543k
views
PHP mail function doesn't complete sending of e-mail
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$from = 'From: yoursite.com';
$to = '[email protected]';
$subject = 'Customer ...
611
votes
7
answers
202k
views
Why does jQuery or a DOM method such as getElementById not find the element if I put the script element near the top of the page?
What are the possible reasons for document.getElementById, $("#id") or any other DOM method / jQuery selector not finding the elements?
Example problems include:
jQuery silently failing to ...
7750
votes
91
answers
2.7m
views
Is Java "pass-by-reference" or "pass-by-value"?
I always thought Java uses pass-by-reference. However, I read a blog post which claims that Java uses pass-by-value. I don't think I understand the distinction the author is making.
What is the ...
1135
votes
32
answers
1.3m
views
How can I access and process nested objects, arrays, or JSON?
I have a nested data structure containing objects and arrays. How can I extract the information, i.e. access a specific or multiple values (or keys)?
For example:
var data = {
code: 42,
...
1358
votes
13
answers
212k
views
UTF-8 all the way through
I'm setting up a new server and want to support UTF-8 fully in my web application. I have tried this in the past on existing servers and always seem to end up having to fall back to ISO-8859-1.
Where ...
63
votes
1
answer
60k
views
Official locator strategies for the webdriver
In the official W3C webdriver documentation, it's clearly stated that the location strategies are:
State Keyword
-----------------------------------------------
CSS selector ...
2300
votes
19
answers
808k
views
Why can templates only be implemented in the header file?
Quote from The C++ standard library: a tutorial and handbook:
The only portable way of using templates at the moment is to implement them in header files by using inline functions.
Why is this?
(...