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
8
votes
1 answer
PHP defined not working?
I have a config file that I include early in my program and set this
define('BASE_SLUG','/shop');
I include another file later with these lines
echo BASE_SLUG;
if (defined(BASE_SLUG)) {
echo ' - yes';
} else {
echo ' - no';
}
And my output…

Gilberg
- 2,514
- 4
- 31
- 41
7
votes
1 answer
Understanding precedence when assigning and testing for definedness in Perl
When trying to assign a variable and test it for definedness in one operation in Perl, as would be useful for instance in an if's condition, it would seem natural to me to write:
if ( defined my $thing = $object->get_thing ) {
…

scozy
- 2,511
- 17
- 34
7
votes
5 answers
Visual Studio 2010 C# "already defined a member with same parameter types error."
im having a problem in visual studio it keeps saying i have defined a member with same parameter types. Im new to C# programming and i dont really know what to do. These are the errors that are occurring:
Error 1 Type 'Secret.AddPage' already…

William Bergendahl
- 115
- 1
- 1
- 9
6
votes
1 answer
How is "0" result from readdir() not false in a while condition?
See also: Where in the documentation does it say that while tests readdir for definedness?. (Not a duplicate; just closely related.)
Many people treat the loop below as idiomatic:
while (defined(my $file = readdir($dir)) {
...
}
instead…

Alnitak
- 334,560
- 70
- 407
- 495
6
votes
3 answers
If isset for constants, but not defined?
If I set a constant to = '',
How to I check if constant has something inside ?
(ie see if it is set to something other than the empty string.)
defined() does not do what I want, because it is already defined (as '').
isset() does not work with…

Cameleon
- 453
- 1
- 6
- 16
6
votes
1 answer
Perl `defined' and `undef' subroutine scope
Please take a look at the following code:
use strict;
use warnings;
print "subroutine is defined\n" if defined &myf;
myf();
sub myf
{
print "called myf\n";
}
undef &myf;
#myf();
print "now subroutine is defined\n" if defined &myf;
The…

password636
- 981
- 1
- 7
- 18
5
votes
3 answers
How to specify the variable which must be set and exist in cmake
I have a need to have some variable to be specified and exist in the environment.
In case it does not exist need to stop building.
example
if ( "${VARMUSTEXIST}" STREQUAL "ON" )
message(STATUS is ON)
elif ("${VARMUSTEXIST}" STREQUAL "OFF")
…

D. Alex
- 167
- 1
- 1
- 6
5
votes
1 answer
How to check does array key exist in defined constant array [PHP 7 define()]
PHP7 brought possibility define array constants with define(). In PHP 5.6, they could only be defined with const.
So I can use define( string $name , mixed $value )) to set array of constants, but it seems that it forgot to bring also upgrade of…

mkungla
- 3,390
- 1
- 26
- 37
5
votes
5 answers
Is there a simple way to validate a hash of hash element exists and is defined?
I need to validate a Perl hash of hash element such as $Table{$key1}{$key2} to exist and be defined. Here is what I do. (I have no idea $key1 even exists)
if
((defined $Table{$key1}) &&
(exists $Table{$key1}) &&
(defined $Table{$key1}{$key2})…

WL.
- 51
- 1
- 2
5
votes
2 answers
django check existence of template context variable
I am writing a django template and I want to differentiate between the existence of a context variable vs it being None, empty etc. I've done my homework and it seems surprisingly hard. Specifically, this is what I'm trying to do
view 1:
...
if…

sha
- 614
- 6
- 16
5
votes
1 answer
CXF - Wsdl2java - the XX property is already defined
I use CXF to generate client class to access web service server. The web service are based on WCF (.NET).
When I call wsdl2java, I have the following error :
The id property is already defined. use to resolve this conflict. The…

clement M.
- 141
- 2
- 9
5
votes
2 answers
Why is my python function not defined, when it exists in the same file?
I have a simple function, which I shall call myFunction. It takes two parameters, performs some calculations on them, and returns the result.
I also have a class, MyClass, which has a constructor that has a header like this:
__init__(self, bar,…

user1123936
- 181
- 3
- 4
- 14
4
votes
4 answers
Oracle: column ambiguously defined
I know there are lots of questions like these, but my question is not how to get rid of this error but to know how this worked earlier in 9-th version of Oracle.
I've got an old sources written in Ruby and Oracle DB which recently was upgraded to…

Andrey Eremin
- 287
- 1
- 4
- 14
4
votes
1 answer
Is it possible to create user defined functions in Tableau? If yes, what coding language it uses?
Tableau has many in-built functions but if I want to create my own functions and save it, is it possible to do so?

Sharma
- 51
- 1
- 2
4
votes
1 answer
Ruby defined?( 42[0][:foo] ) && defined?( 93[0]["bar"] ) == true. Why?
Short story:
"Why does defined?(59[0][:whatever]) evaluate to true?"
Long story:
I came across some strange behaviour lately which threw me off.
I was developing a method that did some washing of the data:
#Me washing input data:
def foo(data)
…

Automatico
- 12,420
- 9
- 82
- 110