C# 2.0: Can MethodBase.GetCurrentMethod() return null?
I'm tracking down a NullReferenceException and the official documentation is lacking. This is C# 2.0 code. ...
I'm tracking down a NullReferenceException and the official documentation is lacking. This is C# 2.0 code. ...
I am parsing a JSON file. After getting the NSDictionary, I parse the objects in the dictionary into an array of objects. However, for certain JSON files, I get NULL, which should be fine, but it crashes my app for those place where I am expecting something but getting null: - (id)initWithDictionary:(NSDictionary *)boxDictionary { if ...
How can I prevent inner SELECT from returning NULL (when matches no rows) and force query to fail. INSERT INTO tt (t1_id, t2_id) VALUES ( (SELECT id FROM t1 WHERE ...), (SELECT id FROM t2 WHERE ...) ); Side question: is there better way form this query (t1_id, t2_id are foreign keys, but might be NULL) ? ...
Is this an acceptable coding practice? public class MessageFormat { private static final Color DEFAULT_COLOR = Color.RED; private Color messageColor = DEFAULT_COLOR; public MessageFormat(Person person) { Color color = person.getPreferredColor(); messageColor = (color != null) ? color : messageColor; // this...
I'm working with a library that redefines NULL. It causes some problems with other parts of my program. I'm not sure what I can do about it. Any idea? My program's in C++, the library's in C. #ifdef NULL #undef NULL #endif /** * NULL define. */ #define NULL ((void *) 0) Oh, and it produces these errors: Generic.h:67: error: def...
Hi folks, I'm interested in doing something like the following to adhere to a Null Object design pattern and to avoid prolific NULL tests: class Node; Node* NullNode; class Node { public: Node(Node *l=NullNode, Node *r=NullNode) : left(l), right(r) {}; private: Node *left, *right; }; NullNode = new Node(); Of course, as written...
I have a class that I use to setup objects in an array. In this class I have a custom "initWithDictionary", where I parse a JSON dictionary. However, as I am running into NSNull, this crashes my app. To get around this, I set up a class that handles exceptions, so when a string is NSNull, it's replace it with @"". or -1 for integers. Th...
So I have been through most of the questions here. Also quite a few articles good and bad. One thing I am looking for some additional clarification on is how undefined and un declared variables are treated. Take the code below. var a; if(a == null) // True - Due to Type Coercion if(a == 'null') // False if(a === null) // False ...
Null pointers have been described as the "billion dollar mistake". Some languages have reference types which can't be assigned the null value. I wonder if in designing a new object-oriented language whether the default behavior should be for references to prevent being assigned null. A special version of the could then be used to overr...
I was reading this article: http://stackoverflow.com/questions/191640/get-null-null-in-sql And the consensus is that when trying to test equality between two (nullable) sql columns, the right approach is: where ((A=B) OR (A IS NULL AND B IS NULL)) When A and B are NULL, (A=B) still returns FALSE, since NULL is not equal to NULL. That...
So, I asked a question this morning, which I did not phrase correctly, so I got a lot of responses as to why NULL compared to anything will give NULL/FALSE. My actual question was, what is the time honored fashion in which db guys test inequalities for two columns that can both be NULL. My question is the exact opposite of this questio...
Is it possible to set a value to values who is NULL? The sql I use now is this: SELECT date FROM Activity WHERE date BETWEEN [Forms]![Search]![fromDate] AND [Forms]![Search]![toDate] But the problem is when there is no value for fromDate or toDate the result is zero rows. So what I want to do is when fromDate is NULL, change the from...
I wonder how JPA defines to handle following scenario: Table A: | Table B: ID FK_B | ID 1 10 | 10 2 null | 12 3 11 | I want all Table A entries with FK_B NULL or referencing not available Table B entry. public class A implements Serializable { @Id private Long id; @JoinColumn(name = "FK_B", nullable = true) ...
Is there any particular reason why Regex.MatchData.group(i: Int): java.lang.String returns null rather than Option[String]? Is there a "Scala Way" to handle nulls in Scala? ...
In SQL server if you have nullParam=NULL in a where clause, it always evaluates to false. This is counterintuitive and has caused me many errors. I do understand the IS NULL and IS NOT NULL keywords are the correct way to do it. But why does SQL server behave this way? ...
I have a unit test invoking a constructor, passing in a "null" on purpose to test the handling of the null. I expect the method invoked to throw an ArgumentNullException, but when I step through the code, I see the parameter has actually been initialised. This has me stumped, although my gut says it has something to do with the DI cont...
Does it ever make sense to check if this is null? Say I have a class with a method; inside that method, I check this == NULL, and if it is, return an error code. If this is null, then that means the object is deleted. Is the method even able to return anything? Update: I forgot to mention that the method can be called from multiple th...
Hi, I tried to write a query in access. My aim is; To get results of how many surgeries are done in one day. Problem is; Result are giving me dates and how many surgeries are done but days without any surgery are not listed on the result table. I want days without surgery to be shown as 0. But there is no record about SURGERY TYPE 1...
I try to have this computed column: CREATE TABLE dbo.Item ( ItemId int NOT NULL IDENTITY (1, 1), SpecialItemId int NULL, --I tried this IsSpecialItem AS ISNULL(SpecialItemId, 0) > 0, --I tried this IsSpecialItem AS SpecialItemId IS NOT NULL --Both don't work ) ON [PRIMARY] ...
I have an update statement that updates fields x, y and z where id = xx. In the table I have a few different x_created_datetime fields (for different portions of the record that are maintained/entered by different folks). I'd like to write a single query that will update this field if is null, but leave it alone if is not null. So what...