null

How does ANSI_NULLS work in TSQL?

SET ANSI_NULLS OFF seems to give different results in TSQL depending on whether you're comparing a field from a table or a value. Can anyone help me understand why the last 2 of my queries give no results? I'm not looking for a solution, just an explanation. select 1 as 'Col' into #a select NULL as 'Col' into #b --This query gives resu...

Treating empty elements as nulls in SQL Server's OPENXML function

I have the following (highly simplified) XML document that I am reading into my database using the OPENXML function: <root> <row> <bar>123</bar> </row> <row> <bar>0</bar> </row> <row> <bar></bar> </row> </root> I am importing in into the database like so: insert into [Foo] ([bar]) s...

flex/actionscript assignment failing?

I'm seeing something weird in my actionscript code I have two classes foo and bar, bar extends foo. In a model class I have a foo member variable, I assign an bar object to the foo variable. But after the assignment the foo variable is null. [Bindable] public var f:foo; public function someFunc(arr:ArrayCollection):void { if(arr...

Simple syntax problem null check datatable / gridview asp.net vb

I have this code: Dim Result As New DataTable DataAdapter.Fill(Result) 'bind data to visible surname/name grid If Result.Rows.Count = 0 Then NoInputBottom.Text = "No Results. Please widen your search criteria and try again" NoInputTop.Text = "No Results. Please widen your search ...

Accommodating null values in a list?

Hi, I'm new to Java and Groovy and am running into trouble with the following Groovy script. I created this whittled down version of a larger script to facilitate debugging. The script is iterating through a list trying to calc a running total of the values of all objects in the list. Some or all of these objects' values may be null. ...

Is it a bad idea if equals(null) throws NullPointerException instead?

The contract of equals with regards to null, is as follows: For any non-null reference value x, x.equals(null) should return false. This is rather peculiar, because if o1 != null and o2 == null, then we have: o1.equals(o2) // returns false o2.equals(o1) // throws NullPointerException The fact that o2.equals(o1) throws NullPointe...

Why cast null before checking if object is equal to null?

I was looking through the "Domain Oriented N-Layered .NET 4.0 Sample App" project and ran across some code that I do not understand. In this project they often use syntax like the following to check arguments for null: public GenericRepository(IQueryableContext context,ITraceManager traceManager) { if (context == (IQueryableContex...

Mysql Left Join Null Result

I have this query SELECT articles.*, users.username AS `user` FROM `articles` LEFT JOIN `users` ON articles.user_id = users.id ORDER BY articles.timestamp Basically it returns the list of articles and the username that the article is associated to. Now if there is no entry in the users table for a particular user id, the...

dereferencing the null pointer

int* p = 0; int* q = &*p; Is this undefined behavior or not? I browsed some related questions, but this specific aspect didn't show up. ...

Null Safe dereferencing in Java like ?. in Groovy using Maybe monad

I'm working on a codebase ported from Objective C to Java. There are several usages of method chaining without nullchecks dog.collar().tag().name() I was looking for something similar to safe-dereferencing operator ?. in Groovy instead of having nullchecks dog.collar?.tag?.name This led to Maybe monad to have the notion of Nothing ...

"Null" is null or not an object error in IE javascript

The following code executes fine in Firefox and Chrome, but gives an error: 'null' is null or not an object when executed in Internet Explorer. if (xmlhttp.responseXML != null) { var xmlDoc = xmlhttp.responseXML.documentElement ; var ResultNodes = xmlDoc.getElementsByTagName ("Result") ; <---- error here if (ResultN...

Can a WPF ComboBox display alternative text when its selection is null?

G'day! I want my WPF ComboBox to display some alternative text when its data-bound selection is null. The view model has the expected properties: public ThingoSelectionViewModel : INotifyPropertyChanged { public ThingoSelectionViewModel(IProvideThingos) { this.Thingos = IProvideThingos.GetThingos(); } public Obser...

Idatareaders not returning values from database

In my codebehind I have this vb: Dim reader as idatareader = includes.SelectDepartmentID(PageID) While reader.Read Did = reader("departmentid") GroupingHeading = reader("heading") Folder = reader("folder") If reader("OwnBanner") Is DBNull.Value Then OwnBanner = Str...

Silverlight 4 HttpWebRequest user agent string is null

The problem I have a page with a silverlight object. It attempts to retrieve XML from another (external cross domain) page. But I am struggling with a security exception. I have this code working brilliantly in WPF. When using a website hosting a silverlight application with the same code, the user agent string of the HttpRequest obj...

JavaScript: why `null == 0` is false?

I had to write a routine that increments the value of a variable by 1 if it is a number, or assigns 0 to the variable if it is not a number. The variable can be incremented by the expression, or be assigned null. No other write access to the variable is allowed. So, the variable can be in three states: it is 0, a positive integer, or nul...

SQL Select between two fields depending on the value of one field

Hi. I am using a PostgreSQL database, and in a table representing some measurements I've two columns: measurement, and interpolated. In the first I've the observation (measurement), and in the second the interpolated value depending on nearby values. Every record with an original value has also an interpolated value. However, there are a...

SQL Server String Concatenation with Null

I am creating a computed column across fields of which some are potentially null. The problem is that if any of those fields is null, the entire computed column will be null. I understand from the Microsoft documentation that this is expected and can be turned off via the setting SET CONCAT_NULL_YIELDS_NULL. However, there I don't want ...

Javascript / jQuery Exec turns up Null

How do I skip over this next line if it turns out to be null? Currently, it (sometimes) "breaks" and prevents the script from continuing. var title = (/(.*?)<\/title>/m).exec(response)[1]; $.get(url, function(response){ var title = (/<title>(.*?)<\/title>/m).exec(response)[1]; if (title == null || title == undefined){ r...

Checking for a null int value from a Java ResultSet

In Java I'm trying to test for a null value, from a ResultSet, where the column is being cast to a primitive int type. int iVal; ResultSet rs = magicallyAppearingStmt.executeQuery(query); if (rs.next()) { if (rs.getObject("ID_PARENT") != null && !rs.wasNull()) { iVal = rs.getInt("ID_PARENT"); } } From the code fragment above,...

how to return NULL for double function with Intel C compiler?

I have some code that I am porting from an SGI system using the MIPS compiler. It has functions that are declared to have double return type. If the function can't find the right double, those functions return "NULL" The intel C compiler does not like this, but I was trying to see if there is a compiler option to enable this "feature" s...