null

How should I handle invalid user input in this case?

I'm writing a plug-in for a geometric modeling program, and I have an abstract class that is based off a Curve object. The curve is only considered valid if it is planar, closed, and does not intersect itself. I then have a chain of other methods that reference this curve that do things like make a surface out of it, or extrude it into...

Does mysql 5.0 index null values?

Hello, I realize that the exact question has been asked before on stack overflow with only a vaguely conclusive answer: link So here it is again. Table A: Has an integer column which is nullable, along with an index. Query: SELECT * from table WHERE column IS null LIMIT 10; Will an index be used, or will mysql do a full table scan un...

Set a String to "" or leave it null?

I have some String variables which are getting the values from invoking the function getParameter() and some of this variables will probably be null. Later, I will evaluate this variables using equals() method. Should I set all the String variables to the empty String ("") if they are null to avoid any problems? ...

Help - Null Object error when using stage.addEventListener (ScrollBar)

Hey guys, hoping for some help with this :( been stuck on it for a couple days now. I'm creating a ScrollBar using Lee Brimelow's ScrollBar class. I've had to modify it to work inside of my Class files and think I'm on the right track, but I'm getting the dreaded: Error #1009: Cannot access a property or method of a null object refere...

Java: Treemap - forbid null?

Is there a way to prevent a treemap from accepting null values, or do I need to do a check every time I enter something? ...

Internet Explorer Post Data Bug - ASP.NET MVC

I just started playing with MVC and I've run into a roadblock. I'm using a partial view as a User Login flyout on the header of each page using OpenID. When the user clicks on the provider (similar to stackoverflow) it authenticates and then either returns to the calling page or redirects to the signup page. The code works flawlessly ...

Delete NULL but no compile error

I'm confused why the following C++ code can compile. Why does a call to delete the method of 0 not produce any error?! volatile *arr = NULL; // or if i use 0, it's the same thing delete arr; I did try to run it, and it did not give me any error at all... ...

When javascript returns null & undefined??

I have been using javascript for couple of years and never cared about the difference between null & undefined earlier, i always use undefined to validate the object existence. But recently i came through this article. Here they said JavaScript distinguishes between null, which is an object of type 'object' that indicates a del...

When to use nil and NULL in Objective C ?

This is a sample code: NSDictionary *myDictionary = [NSDictionary dictionary]; NSNumber *myNumber = [myDictionary valueForKey: @"MyNumber"]; NSLog(@"myNumber = %@", myNumber); // output myNumber = (null) if (myNumber == nil) NSLog(@"test 1 myNumber == nil"); if (myNumber == NULL) NSLog(@"test 2 myNumber == NULL"); if ([myN...

Which is the best practice to use in string in ASP.NET(C#).

I want to know which is the preferred way to declare a string in C#: string strEmpty = String.Empty;    or string strNull = null; Which practice is better or what is the difference between these statements. ...

Ignoring a column when condition doesnt match in select query - SQL-Oracle

Hi, My requirement is to display a Column in select query when a condition satisfies and not to display the column when condition is not matched. For eg : In this simple table below Table : XYZ Name ID Fairness harish 3 White ravi 5 brown arun 2 black rahul 5 white Query: select name,case id when 5 then " I Like to learn more...

Is it a bad thing to override == and have an instance compare equal to null ?

Background Let's say I have the following class: public class MyValue<T> { public T Value { get; set; } public static bool operator ==(MyValue<T> first, MyValue<T> second) { // if first and second are the same instance, they are equal if (object.Equals(first, second)) { return true; ...

PHP Check for NULL

Here is the below Code: $query = mysql_query("SELECT * FROM tablex"); if ($result = mysql_fetch_array($query)){ if ($result['column'] == NULL) { print "<input type='checkbox' />"; } else { print "<input type='checkbox' checked />"; } } If the values are NOT NULL i still get the uncheked box. Am i doing something wrong from a...

C#: In what cases should you null out references?

The CLR Profiler can also reveal which methods allocate more storage than you expected, and can uncover cases where you inadvertently keep references to useless object graphs that otherwise could be reclaimed by GC. (A common problem design pattern is a software cache or lookup table of items that are no longer needed or are safe to r...

De-referencing null in VS with Windows 7

I have noticed that when I was running Windows XP, if my code dereferenced null I would get a crash in debug and I could then easily identify where the bug was coming from. It seems that in Windows 7 (I'm running 64-bit), instead of crashing or creating any sort of notification, the code will simply break its current iteration and start...

how to fix a document.body is null-error

Hi, I'm having a document.body is null error in my javascript because I use: $(window).width() as value to assign to a variable in my $(document).ready(function(){}); I would be very grateful to anyone who could help me with this. Kind regards edit: sorry if this all was unclear. I have a demo at: http://www.wpmonk.com/demo/...

Why/When to use (!!p) instead of (p != NULL)

In the following code, what is the benefit of using (!!p) instead of (p != NULL)? AClass *p = getInstanceOfAClass(); if( !!p ) // do something else // do something without having valid pointer ...

Expression Tree to Infix: Null in one instance, but not in another?

I have an expression tree class, which has a method buildExpressionTreeFromQueue. As its name suggests, the method takes a queue (just a series of operators and operands) and cycles through it, adding nodes to the tree appropriately. My problem is this: when I try to write the tree as Infix notation (or Prefix or Postfix for that matter...

Objective-C uninitialized pointers vs null pointers

Maybe my memory has gone completely wacko, but I think I remember that declaring pointers without initializing them made them point to nil. But recently this doesn't seem to be the case. Has it always been this way? Or has it something to do with the compiler settings? ...

null objects vs. empty objects

[ This is a result of Best Practice: Should functions return null or an empty object? but I'm trying to be very general. ] In a lot of legacy (um...production) C++ code that I've seen, there is a tendency to write a lot of NULL (or similar) checks to test pointers. Many of these get added near the end of a release cycle when adding a N...