A definition is an unambiguous statement for the meaning of a word or phrase. In programming, a variable definition provides all the details for that variable.
Questions tagged [defined]
304 questions
539
votes
6 answers
Determine if variable is defined in Python
How do you know whether a variable has been set at a particular place in the code at runtime? This is not always obvious because (1) the variable could be conditionally set, and (2) the variable could be conditionally deleted. I'm looking for…

user102008
- 30,736
- 10
- 83
- 104
80
votes
6 answers
How do I check if a class is defined?
How do I turn a string into a class name, but only if that class already exists?
If Amber is already a class, I can get from a string to the class via:
Object.const_get("Amber")
or (in Rails)
"Amber".constantize
But either of these will fail with…

fearless_fool
- 33,645
- 23
- 135
- 217
19
votes
2 answers
How to deal with clang's (3.9) -Wexpansion-to-defined warning?
clang 3.9 has added to -Wall a the warning -Wexpansion-to-defined, which produces
macro expansion producing 'defined' has undefined behaviour
in case defined is used outside an #if expression, including the case of a macro that is then used…

Walter
- 44,150
- 20
- 113
- 196
17
votes
5 answers
Gradle error: "Attribute "rippleColor" has already been defined" in android studio
So I was trying out the material design support library and when I added the dependency, compiled, and I got this error.
I looked at similar problems and tried their solutions but it would not get fixed so I hope you can help me.
Here's my…

Dutch-Raptor25
- 183
- 1
- 1
- 4
17
votes
1 answer
Why {$IFDEF MSWINDOWS} is replaced with {$IF defined(MSWINDOWS)} in Delphi XE5?
In XE5 all conditional compilations such as
{$IFDEF MSWINDOWS}
are replaced with
{$IF defined(MSWINDOWS)}
For example System.Diagnostics.pas in XE4 had
...
implementation
{$IFDEF MSWINDOWS}
uses Winapi.Windows;
{$ENDIF}
{$IFDEF MACOS}
uses…

Gad D Lord
- 6,620
- 12
- 60
- 106
15
votes
3 answers
Is there any way to check to see if a VBScript function is defined?
This is probably just wishful thinking...
Is there any way to check to see if an ASP/VBScript function is defined before calling it?

Matthew Cole
- 1,329
- 2
- 18
- 30
15
votes
2 answers
C# - Check for attribute's existence on enum's element
I've got a situation like the following:
enum Header
{
Sync,
[OldProtocol] Keepalive,
Ping,
[OldProtocol] Auth,
[OldProtocol] LoginData
//...
}
I need to obtain an array of elements on which the OldProtocolAttribute is…

user1098567
- 339
- 3
- 9
12
votes
1 answer
How to programmatically list all properties defined while executing MSBuild?
I'm looking for a way to access all the Build properties defined while executing MSBuild. I have a configuration file. I want to modify the Properties in the configuration file and copy it to a new location. Is there a way to do it?
Christo Nelson
12
votes
1 answer
How to implement user defined fields and grouping for the multi-tenant application: EAV, fixed tables pattern, NoSQL
I'm working at a SaaS, where any tenant can have several lists of contacts, each list can have any number of custom fields contacts of this list can store and any number of groups the contancts of the list can be includes (groups are used for…

Oleg
- 2,733
- 7
- 39
- 62
12
votes
2 answers
How to know whether a racket variable is defined or not
How you can have a different behaviour if a variable is defined or not in racket language?

gaucib
- 465
- 4
- 8
11
votes
3 answers
How can I determine if a Perl hash contains a key mapping to an undefined value?
I need to determine if a Perl hash has a given key, but that key will be mapped to an undef value. Specifically, the motivation for this is seeing if boolean flags while using getopt() with a hash reference passed into it. I've already searched…

Alex Marshall
- 10,162
- 15
- 72
- 117
11
votes
8 answers
Python: Variance of a list of defined numbers
I am trying to make a function that prints the variance of a list of defined numbers:
grades = [100, 100, 90, 40, 80, 100, 85, 70, 90, 65, 90, 85, 50.5]
So far, I have tried proceeding on making these three functions:
def grades_sum(my_list):
…

GiamPy
- 3,543
- 3
- 30
- 51
10
votes
6 answers
Excel Return Table name using Formula?
I was wondering if there is anyway to return the name of the table using a formula?
I was working on a way to break down a few thousand addresses into there perspective column of information. ie.. #, Street, City, State, Zip-code and Phone#. The…

Mouthpear
- 199
- 1
- 3
- 13
9
votes
3 answers
How to judge whether a method has defined in a class?
class C1
unless method_defined? :hello # Certainly, it's not correct. I am asking to find something to do this work.
def_method(:hello) do
puts 'Hi Everyone'
end
end
end
So, how to judge whether a method has defined or not?

Croplio
- 3,433
- 6
- 31
- 37
8
votes
1 answer
Ruby "defined?" operator works wrong?
So, we have the code:
class Foo
def bar
puts "Before existent: #{(defined? some_variable)}"
puts "Before not_existent: #{(defined? nonexistent_variable)}"
raise "error"
some_variable = 42
rescue
puts "exception"
ensure
…

mr.The
- 445
- 5
- 17