null

is there any function like string.isnullorempty() in javascript

I always (thing != undefined || thing != null)?...:...; check. Is there any method will return bool after this check in javascript or jquery ? And how would you add this check in jquery as a function? ...

How can I find all columns that are filled with 100% nulls in my SQL Server database schema?

Is there a SQL way to find out which columns in my schema are completely full of null values? There are some fields in a couple of tables that I know are not used by the application and will be dropped, but I wanted to see if there was an automated way/script to find this out across the whole database to find candidates for code review/...

Hibernate exception while using "identity" generator - how to use

I am using Hibernate over SQL Server for a web application. I was using the "increment" generator class till now and recently ran into ConstraintViolation exceptions. So, I changed the generator to "identity" and I am getting the following error - Cannot insert the value NULL into column 'assessment_administration_id', table 'faip....

c# Object obj's value is {}. What is "{}"?

I'm using some old code that runs a sql query as a reference. At some point, it gets to something like: sqlDataAdapter.Fill(dataSet); DataRow dataRow = dataSet.Tables[0].Rows[0]; Object obj = dataRow[fieldName]; The old code does: string output; if (!string.IsNullOrEmpty(obj.ToString())) { output = obj.ToString(); } else { output = ...

How to do ToString for a possibly null object?

Is there a simple way of doing the following: String s = myObj == null ? "" : myObj.ToString(); I know I can do the following, but I really consider it as a hack: String s = "" + myObj; It would be great if Convert.ToString() had a proper overload for this. ...

Java null problems

Node<Integer> soln = question(n,n,null); where question(n,n,null) returns null, now i want to output the result as "no solution"; i wrote Node<Integer> soln = question(n,n,null); if(soln==null) System.out.println("no solution"); An error occurs, what shall i do? ...

String.Format with null format

Hi, Can anyone explain why the following occurs: String.Format(null, "foo") // Returns foo String.Format((string)null, "foo") // Throws ArgumentNullException: // Value cannot be null. // Parameter name: format Thanks. ...

XCode compiler doesn't set my variable (and pointer) initial value to 0 or nil!

Hi, sthis is very annoying, since now my values are stored as if they contain somethin by default (like in c). All my OO stuff are now broken since my delegate are always somethin. I was wonderin why XCode do this to me, since by default XCode always set the variable value to 0 or nil. So if i do NSArray* anArray; and then NSLog(%@"...

WebOperationContext Object reference not set to an instance of an object

When I try to use WebOperationContext.Current in a WCF project, the Current is null. Below is the example. Could anyone please shed a light on it? WebForm - default.aspx: ServiceClient sc = new ServiceClient(); Response.Write(sc.DoWork(1) + "<br />"); WebOperationContext c = WebOperationContext.Current; --Current is null...

Comparing fields in a trigger

So I've created a trigger that compares update before and after and determines if specific fields, specified in the where clause, have changed. If so, I insert a snapshot of the prior information into a history table. The problem is when the field is created with null values (given the business rules, it is legitimately null) and when ...

calling trygetmember on chained null references

Is it possible to have a DynamicObject implementation that can be called in chain keeping a null reference to end if anywhere in the path a null reference is encountered, without throwing any exceptions? a.b.c.e for example: if a is null then a.b.c.e is null, or if c is null c.e is null etc.? Very much like the Maybe monad from Haske...

Crystal reports zero values

Hey guys, So I have this report that I am grouping into different age buckets. I want the count of an age bucket to be zero if there are no rows associated with this age bucket. So I did an outer join in my database select and that works fine. However, I need to add a group based on another column in my database. When I add this group, ...

Check for null pointer

Hi, I'm building a iphone app and using c++ and am having trouble checking if a pointer is null. IMyInterface* myInterface; if ( !myInterface ){ //doesn't work myInterfacee->doSometing(); } if ( myInterface != 0 ) { //doesn't work myInterfacee->doSometing(); } if ( myInterface !...

How do :default => 0 and :null => false differ for integer fields in migrations?

If I use a migration to update a database, and I add an integer field like this: t.integer :foo :default => 0, :null => false What is the default state of existing and new records in the database? I hoping the answer is: - Both will read back foo as 0. Is default => 0 necessary, if I have :null => false? Just trying to understand t...

How to ignore null values in R?

I have a data set with some null values in one field. When I try to run a linear regression, it treats the integers in the field as category indicators, not numbers. E.g., for a field that contains no null values... summary(lm(rank ~ num_ays, data=a)), Returns: Coefficients: Estimate Std. Error t value Pr(>|t|) (Int...

Can we avoid npe while checking for null in nested java objects?

1) if(null != parentObj.childObj) 2) if(parentObj.childObj != null) Do you think that "1" will avoid a potential null pointer exception in the case where 'parentObj' is null, in contrast to "2"? ...

Why is PHP mysqli prepared statement working but inserting all NULL values?

What would cause this? Code follows: $m = new mysqli($host,$user,$pass,$db); if(mysqli_connect_errno()) die('Connect failed: ' . mysqli_connect_error()); $PrepSQL = "INSERT INTO Products (" . implode(',',$this->cols) . ") VALUES ("; $PrepSQL .= '?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; $stmt ...

Which constructor is chosen when passing null?

In the following example, I have 2 constructors: one that takes a String and one that takes a custom object. On this custom object a method "getId()" exists which returns a String. public class ConstructorTest { private String property; public ConstructorTest(AnObject property) { this.property = property.getId(); } public Constr...

HttpContext.Current.Session null on page rendering when im adding CustomUrlAuthorizationModule tag to web.config

Dear, I'm facing a problem with HttpContext.Current.Session when I'm adding CustomUrlAuthorizationModule tag to web.config. Every time i'm adding the above tag to my web.config, HttpContext.Current.Session is null every time the page is rendered. PS: i'm using HttpContext.Current.Session from SQLSiteMapProvider class from BuiltSiteMap...

How do I make an integer to null in Excel VBA?

I am trying to detect whether an integer was set, and if not, skip most of the code in the loop (using an if statement). Here is what I have so for. Do While hws.Cells(r, 9).Value <> "" On Error Resume Next ar = Null ar = aws.Range("A:A").Find(hws.Cells(r, 2).Value).Row If Not IsNull(ar) Then 'work with ar' End If ...