All Questions

35
votes
4answers
16219 views

How can I access an array/object?

I have the following array and when I do print_r(array_values($get_user));, I get: Array ( [0] => 10499478683521864 [1] => 07/22/1983 [2] => email@saya.com ...
740
votes
37answers
1508568 views

What does "Could not find or load main class" mean?

A common problem that new Java developers experience is that their programs fail to run with the error message: Could not find or load main class ... What does this mean, what causes it, and how sho...
86
votes
7answers
14391 views

How to avoid having class data shared among instances?

What I want is this behavior: class a: list=[] y=a() x=a() x.list.append(1) y.list.append(2) x.list.append(3) y.list.append(4) print x.list [1,3] print y.list [2,4] of course, what ...
801
votes
18answers
582925 views

What is the purpose of self?

What is the purpose of the self word in Python? I understand it refers to the specific object created from that class, but I can't see why it explicitly needs to be added to every function as a parame...
1362
votes
16answers
821384 views

Static class variables in Python

Is it possible to have static class variables or methods in python? What syntax is required to do this?
793
votes
9answers
171825 views

What is the difference between old style and new style classes in Python?

What is the difference between old style and new style classes in Python? Is there ever a reason to use old-style classes these days?
360
votes
28answers
293644 views

What are the differences between struct and class in C++?

This question was already asked in the context of C#/.Net. Now I'd like to learn the differences between a struct and a class in C++. Please discuss the technical differences as well as reasons for c...
79
votes
4answers
77637 views

How to properly set up a PDO connection

From time to time I see questions regarding connecting to database. Most answers is not the way I do it, or I might just not get the answers correctly. Anyway; I've never thought about it because the ...
1693
votes
21answers
578771 views

When to use self over $this?

In PHP 5, what is the difference between using self and $this? When is each appropriate?
360
votes
10answers
194945 views

How to read the value of a private field from a different class in Java?

I have a poorly designed class in a 3rd-party JAR and I need to access one of its private fields. For example, why should I need to choose private field is it necessary? class IWasDesignedPoorly { ...

Previous Next