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
8
votes
2 answers

Unity: Null while making new class instance

I got stuck in pretty dumb situation: I'm making new instance of the generic class but it returns "weird" null. Rule rule2 = new Rule(); // initiate the class Debug.Log(rule2); //1st debug rule2.RuleSetup(r: "CaughtEnough", li: 0);…
Alex
  • 189
  • 1
  • 1
  • 10
8
votes
5 answers

Java ConcurrentHashMap not thread safe.. wth?

I was using HashMap before like public Map clients = new HashMap(); now I've switched to ConcurrentHashMap to avoid synchronized blocks and now i'm experiencing problems my server is…
SSpoke
  • 5,656
  • 10
  • 72
  • 124
8
votes
5 answers

Why I'm not getting an error when checking the length of null

I'm checking the number of digits in a string using the match and length properties. Here is the codepen with my function http://codepen.io/PiotrBerebecki/pen/redMLE Initially when returning numberOfDigits.length I was getting an error message…
Piotr Berebecki
  • 7,428
  • 4
  • 33
  • 42
8
votes
3 answers

Copying elements from one character array to another

I wanted to transfer elements from a string to another string, and hence wrote the following program. Initially, I thought that the for loop should execute till the NULL character (including it i.e) has been copied. But in this code, the for loop…
Ranjan Srinivas
  • 347
  • 1
  • 3
  • 10
8
votes
4 answers

Is it always a good practice to set pointers to NULL after free()-ing them?

Possible Duplicate: Setting variable to NULL after free … I am learning about good C programming practices and my friend told me to always set the pointers to NULL after free()ing them (or calling a specific freeing function). For example: char*…
bodacydo
  • 75,521
  • 93
  • 229
  • 319
8
votes
1 answer

Stop empty strings at the database level with EF code first

Consider the following POCO entity for Entity Framework Code First: public class Foo { public int Id { get; set; } [Required, StringLength(100)] public string Name { get; set; } } Which will generate the following table: CREATE TABLE…
lc.
  • 113,939
  • 20
  • 158
  • 187
8
votes
4 answers

How to get control in ASP.NET PreInit event?

How to get control in ASP.NET PreInit event? Pointers are null and FindControl method returns null. I am using master and content pages. Markup of the content page looks like this:
brain_pusher
  • 1,507
  • 3
  • 21
  • 31
8
votes
10 answers

Drowning in a Sea of Nulls

An application I inherited tracks lab test results performed on material samples. Data is stored in a single table (tblSampleData) with a primary key of SampleID and 235 columns representing potential test results. The problem is that only a few…
DeveloperDan
  • 4,626
  • 9
  • 40
  • 65
8
votes
1 answer

Difference between null==object and object==null

Hi I would like to know diff between the above comparisons? I am getting null pointer exception when I check object.getItems() == null. But if I change it to null == object.getItems(), it workes fine. I did look into this what is the difference…
priyank
  • 4,634
  • 11
  • 45
  • 52
8
votes
2 answers

Check if all three columns are either not null or null

I have a table with 4 columns: create table dbo.Table ( Id int not null, A int null, B int null, C nvarchar (4000) null ) How can I make sure that A, B and C are all three null or all three not null?
Miguel Moura
  • 36,732
  • 85
  • 259
  • 481
8
votes
3 answers

Android FragmentActivity returns null in getActionBar()

I have imported an Android sample project called HorizontalPaging in Android Studio and it works fine when I run it. But when I copied the code into my code, I get a NULL pointer exception in getActionBar(). I have been reading about these problems…
fersarr
  • 3,399
  • 3
  • 28
  • 35
8
votes
3 answers

MySQL COUNT NULL content by column, GROUP by column

How can I count non-null entries by field/column? I see several answers to count by row but can't hack how to do so for columns. Input: ╔════╦════════╦════════╦════════╗ ║ id ║ field1 ║ field2 ║ field3 ║ ║ 1 ║ do ║ re ║ me ║ ║ 2 ║ fa …
Slam
  • 3,125
  • 1
  • 15
  • 24
8
votes
1 answer

Objective-C Property Getter/Setter crash EXC_BAD_ACCESS

I was wondering why assigning values to properties in another class causes EXC_BAD_ACCESS. I can't seem to figure out why. 1.) The value being sent into the setter is non-nil; 2.) When trying to assign the value, EXC_BAD_ACCESS happens, the variable…
ReverseEffect
  • 297
  • 3
  • 10
8
votes
2 answers

Inserting default values if column value is 'None' using slick

My problem is simple. I have a column seqNum: Double which is NOT NULL DEFAULT 1 in CREATE TABLE statement as follows: CREATE TABLE some_table ( ... seq_num DECIMAL(18,10) NOT NULL DEFAULT 1, ... ); User can enter a value for seqNum or…
Sunil Kumar
  • 622
  • 1
  • 12
  • 33
8
votes
3 answers

In the Django admin changelist, how to show a blank space instead of the default "(None)"?

When a field is null in the database, Django inserts "(None)" to hold the place of the null when displaying a changelist. While descriptive, when there are lots of fields on a changelist, it makes everything very busy to look at, where as a blank…
meesterguyperson
  • 1,726
  • 1
  • 20
  • 31