null

LINQ Replace DBNull with Blank String

In this example, an error is raised if either row.FirstName or row.LastName are NULL. How do I rewrite the Select clause, to convert a DBNull value to a blank string ""? Dim query = From row As myDataSet.myDataRow in myDataSet.Tables("MyData") _ Select row.FirstName, row.LastName NOTE: Since the DataSet is strongly-typed....

PHP fopen returning null on files that work fine with include and get_file_contents

Hi, I have XAMPP installed on a windows 2000 server. everything is working great except the PHP fopen function. I can neither create nor open files with it. the strange thing is that i can include/require/file_get_contents/other file related functions; also fopen does not generate any errors or notices it just returns NULL. I have gone...

How to have a primary key with null values using empty string ?

I have a table in which I need both the values to be primary because I am referencing this combination as foreign key in the other tables. Table definition and the data I need to put are as follows create table T1 ( sno number(10), desc varchar2(10), constraint T1_PK primary key(sno,desc) ) DATA to put sno | desc -------------...

In C# is it possible to evaluate if a variable is different of null without using an operator ?

For instance is it possible to write this if (variable != null) without using the operator != or == ? ...

JSON Feed Returning null while using jQuery getJSON

http://portlandonline.com/shared/cfm/json.cfm?c=27321 It's returning null. I don't really have access to this. I have to have a server admin update the feed to my liking, so if you can tell me how to get this to work as is, without adding tags to my HTML please let me know. I will be using this with jQuery, and ive been trying to use g...

Erlang ODBC parameter query with null parameters

Is it possible to pass null values to parameter queries? For example Sql = "insert into TableX values (?,?)". Params = [{sql_integer, [Val1]}, {sql_float, [Val2]}]. % Val2 may be a float, or it may be the atom, undefined odbc:param_query(OdbcRef, Sql, Params). Now, of course odbc:param_query/3 is going to complain if Val2 is undefi...

Is this the proper way to initialize null references in Scala?

Let's say I have a MyObject instance which is not initialized: var a:MyObject = null is this the proper way to initialize it to null? ...

Elegant check for null and exit in C#

What is an elegant way of writing this? if (lastSelection != null) { lastSelection.changeColor(); } else { MessageBox.Show("No Selection Made"); return; } changeColor() is a void function and the function that is running the above code is a void function as well. ...

PHP: why is this null different from the other null

hi i tried 2 things what should be the same however it my testing says different does anyone know why the only thing i do is put it in a variable... if ($_SESSION[$something] === null) echo("this is null"); $_SESSION[$something] does not exists so it indeed says: "this is null". now look at this $theSession = $_SESSION[$s...

GetHashCode on null fields?

How do I deal with null fields in GetHashCode function? Module Module1 Sub Main() Dim c As New Contact Dim hash = c.GetHashCode End Sub Public Class Contact : Implements IEquatable(Of Contact) Public Name As String Public Address As String Public Overloads Function Equals(ByVal other As Contact) As Boolean _ ...

Get the parent class of a null object (C# Reflection)

How would I get the parent class of an object that has a value of null? For example... ClassA contains int? i which is not set to any value when the class is created. Then in some other place in the code I want to pass in i as a parameter to some function. Using i as the only info, I want to be able to figure out that ClassA "owns" i....

LINQ-to-entities - Null reference

I could swear this was working the other day: var resultSet = (from o in _entities.Table1 where o.Table2.Table3.SomeColumn == SomeProperty select o ).First(); SelectedItem = resultSet.Table2.SomeOtherColumn; I am getting a null reference exception on the last line: resultSet.Table2 is null. Not only am I sure that al...

Java - JSON Null Exception

Hi, I'm using JSON to deserialize an input string that contains a null value for certain hashmap property. Does anyone have any clue why this exception occurs ? Is it possible that null is not accepted as a value Is this configurable somehow ? input sample: {"prop1":"val1", "prop2":123, "prop3":null} stacktrace: net.sf.json.JSONExc...

Are NULL and nil equivalent?

Actually my question here is: are null and nil equivalent or not? I have an example but I am confused when they are equal when they are not. NSNull *nullValue = [NSNull null]; NSArray *arrayWithNull = [NSArray arrayWithObject:nullValue]; NSLog(@"arrayWithNull: %@", arrayWithNull); id aValue = [arrayWithNull objectAtIndex:0]; if (aValu...

Which is the better way to simulate optional parameters in Java?

I have a Java method that takes 3 parameters, and I'd like it to also have a 4th "optional" parameter. I know that Java doesn't support optional parameters directly, so I coded in a 4th parameter and when I don't want to pass it I pass null. (And then the method checks for null before using it.) I know this is kind of clunky... but the o...

Why doesn't the compiler at least warn on this == null

Why does the C# compiler not even complain with a warning on this code? : if (this == null) { // ... } Obviously the condition will never be satisfied.. ...

how to count NULL categories in one SQL question

hi, i have a blog application were Post belongsTo Category and Category hasMany Post Post can have a Category or not - in latter case NULL value is present in Post.category_id field. Now i would like to have following category count with single SQL query category|post_count -------------- PHP | 2 JavaScript | 4 SomeOtherCat | 1 NULL...

What is the purpose of the NullObject class in Groovy?

I've been using Groovy for all of five hours and just came across the Groovy NullObject. I read the Groovy explanation of the Null Object Pattern, but it doesn't touch on the NullObject class directly; is NullObject merely intended to be a base class for things like NullTree and NullJob? I'm getting a NullObject back in some code that ...

Querying MySQL with CodeIgniter, selecting rows where field is NULL

I'm using CodeIgniter's Active Record class to query the MySQL database. I need to select the rows in a table where a field is not set to NULL: $this->db->where('archived !=', 'NULL'); $q = $this->db->get('projects'); That only returns this query: SELECT * FROM projects WHERE archived != 'NULL'; The archived field is a DATE field. ...

linq null refactoring code

i have code public List<Files> List(int? menuId) { if (menuId == null) { return _dataContext.Files.ToList(); } else { return _dataContext.Files.Where(f => f.Menu.MenuId == menuId).ToList(); } } is it possible to make it only one line like return _dataContext.Files.Where(f => f.Menu.MenuId == men...