Questions tagged [null]

Null means *nothing* or *unknown*, depending on context. Please use the "sql-null" tag for SQL specific questions.

"Null" has different meanings depending on context.

Set theory

Null is another name for the empty set, denoted by the symbol ∅. For this reason, some programming languages use null or nil for the empty list or empty tuple. Lisp uses nil to mean the empty list and the boolean value false.

Pointers and References

Null (or sometimes nil or None), in programming languages that support it, is the value of an uninitialized variable, a pointer that doesn't point to a meaningful memory address, or an object that fails to respond to any message.

Nullable references were invented by C.A.R. Hoare in 1965 as part of the Algol W language. Hoare later described his invention as a "billion-dollar mistake".

For more information, see Null pointer.

Agreeing with Hoare's sentiment, many languages don't have a special null value, choosing to use optional types instead.

Relational Databases

NULL as a special marker in SQL or a relational database stands in place of a value that is missing, or in a join means "no corresponding row." The operators IS NULL and IS NOT NULL are required for comparisons to a literal null: other comparisons between NULL and any value evaluate to "unknown."

For more information, see Null (SQL).

ASCII

Null or NUL is the name given to the character with ASCII code zero (0) - i.e. hex 00. In some languages, notably C, NUL is used to mark the end of a character string.

For more information, see Null character.

16208 questions
7
votes
1 answer

Difference between nullify(pointer) and pointer => null()

What is the difference between procedure(some_routine), pointer :: ptr ptr => null() and procedure(some_routine), pointer :: ptr nullify(ptr) Does nullify do something behind the scenes? Or is it just two different ways of doing the same thing?
PVitt
  • 11,500
  • 5
  • 51
  • 85
7
votes
1 answer

Why are my null checks so slow?

So I have code that currently looks like this public boolean in(TransactionType... types) { if (types == null || types.length == 0) return false; for (int i = 0; i < types.length; ++i) if (types[i] !=…
Cogman
  • 2,070
  • 19
  • 36
7
votes
2 answers

storing [NSNull null] values in NSUserDefaults, from JSON serialization, causes unwanted exceptions

I've got an app where I use a JSON based API. As part of JSON, often values are set to "null". This may be common: {"data":["one","two","three"],"name":null,otherstuff:10} Recently I've tried to store a misc NSDictionary hierarchy, converted from…
Miro
  • 5,307
  • 2
  • 39
  • 64
7
votes
3 answers

One out of 2 properties should be null (EntityFramework Code First)

I've searched a lot in the forum, but haven't found anything about regarding this issue. I have 2 properties in the EntityFramework Code First: [Column(TypeName = "Money")] public decimal? Debit { get; set; } [Column(TypeName =…
7
votes
3 answers

MPMediaItemArtwork is null while cover is available in iTunes

The UIImage "image" is always empty ("null") though the cover is shown in the music app by apple. in iOS 7 it works fine, but with iOS 8 I get no cover. Whats wrong with my code, or what has changed in iOS 8? -(UITableViewCell…
Meins
  • 145
  • 1
  • 12
7
votes
5 answers

ng-repeat filter null value not displaying

Why won't angular display values that are null when I apply: ng-repeat="p in foo | filter: filter2" where filter2 is $scope.filter2 = function(p){ if (p.state === null){ return p.state; } else{ return; } }; here's a…
Garuuk
  • 2,153
  • 6
  • 30
  • 59
7
votes
2 answers

Why doesn't list.get(0).equals(null) work?

The first index is set to null (empty), but it doesn't print the right output, why? //set the first index as null and the rest as "High" String a []= {null,"High","High","High","High","High"}; //add array to arraylist ArrayList choice = new…
Jessy
  • 15,321
  • 31
  • 83
  • 100
7
votes
2 answers

Volley string request error while passing string with null value as param

I am using the following code for string request on volley pDialog = new ProgressDialog(context); pDialog.setMessage("Loading..."); pDialog.setCancelable(false); pDialog.show(); StringRequest strReq = new…
Vinil Chandran
  • 1,563
  • 1
  • 19
  • 33
7
votes
4 answers

nil vs kNilOptions

I find some time ago the enum kNilOptions which is equal to 0. I try to make my code the most readable but I wonder what is best to use when you have methods that take an option parameter, for example : [NSData dataWithContentsOfFile:imageURL.path …
Kevin Hirsch
  • 956
  • 1
  • 9
  • 17
7
votes
2 answers

Why `Nil` is defined as `case object`

In scala source, I found: case object Nil extends List[Nothing] { ... } I can't understand why it is declared as case object rather than object? I found this question [ Difference between case object and object ] is useful, and I guess this…
Freewind
  • 193,756
  • 157
  • 432
  • 708
7
votes
4 answers

List without nil in Lisp

I know that in Lisp a list must end with nil, but expression like (print (cons 1 (cons 3 2))) does not throw any errors. It prints: (1 3 . 2) Is it correct? I'm using GNU Clisp.
Stan Kurilin
  • 15,614
  • 21
  • 81
  • 132
7
votes
3 answers

Semantics of the Boolean and comparison operators in the context of three-valued-logic

Professor ask me this question: What is the semantics of the Boolean and comparison operators in the context of three-valued-logic? I'm not sure what he meant by that. What is comparison operator? Is that the same as relational operator? Semantics?…
DB Student
  • 71
  • 2
7
votes
3 answers

How to remove conditions from WHERE clause if parameters are NULL

I'm passing 2 parameters to a PL/pgSQL function. Here's the query: SELECT * FROM table WHERE col1 = param1 AND col2 = param2 Both parameters can be NULL, in which case the respective expression should be removed from the WHERE clause. How can…
user3339988
  • 404
  • 2
  • 5
  • 12
7
votes
2 answers

COUNT() Function in conjunction with NOT IN clause not working properly with varchar field (T-SQL)

I came across a weird situation when trying to count the number of rows that DO NOT have varchar values specified by a select statement. Ok, that sounds confusing even to me, so let me give you an example: Let's say I have a field "MyField" in…
The Shaper
  • 3,495
  • 2
  • 16
  • 6
7
votes
1 answer

Does null=True imply default=None for models?

When allowing database fields of a Django model to be NULL using null=True, is there default value guaranteed to be NULL by default? Or do I have to speficy this manually: report = models.FileField(upload_to='reports', null=True, default=None) …
danijar
  • 32,406
  • 45
  • 166
  • 297
1 2 3
99
100