null

Hibernate: How to set NULL query-parameter value with HQL?

Hello, how can I set a Hibernate Parameter to "null"? Example: Query query = getSession().createQuery("from CountryDTO c where c.status = :status and c.type =:type") .setParameter("status", status, Hibernate.STRING) .setParameter("type", type, Hibernate.STRING); In my case, the status String can be null. I have debugged this and hib...

How do I initialize an object of a class?

My code is something like: public class Foo { public int a; Bar[] bar = new Bar[10]; a = bar[0].baz; } public class Bar { public int b; public Bar () { //I tried doing away with this constructor, but that didn't //fix anything b = 0; } public int Baz () { //do somthing ...

Any reason to use hex notation for null pointers?

I'm currently improving the part of our COM component that logs all external calls into a file. For pointers we write something like (IInterface*)0x12345678 with the value being equal to the actual address. Currently no difference is made for null pointers - they are displayed as 0x0 which IMO is suboptimal and inelegant. Changing this ...

Remove null values from javascript array

Hi, I am having a javascript array. addresses = new Array(document.client.cli_Build.value, document.client.cli_Address.value, document.client.cli_City.value, document.client.cli_State.value, document.client.cli_Postcode.value, document.client.cli_Country.value); document.client.cli_PostalAddress.value = address...

Zend Framework convert NULL string to actual NULL value for MySql

Somehow when doing an import of data into mysql using a multi-row insert with execute() function, there were many rows added with the string NULL for some columns. How can I convert those NULL strings into MySQL NULL values so that I can check for empty values using is_null() in php when displaying data. How can I avoid this problem? I ...

Objects becoming null when passed to a Property in C#

I have an abstract class Employee and 2 other classes that extend it (Developer and Manager). My problem is that when I whenever I create a Manager Employee man = new Manager(1234567, 30, "Bob", "Pie") and try to set it in the Manager field of a new Developer, Employee codemonkey = new Developer(1234568, 20, "Code", "Monkey", (Mana...

Null value being returned from a Stored Procedure using Linq to SQL

If I run a stored procedure in my database (SQL 2000) and return the SCOPE_IDENTITY, I receive a value. However, using LINQ to SQL, I get a null value for the Column1 property. Anyone have a suggestion? ...

mysql_fetch_* function does not return any NULL columns in the array

When I call mysql_fetch_row() or mysql_fetch_array(), any column that is NULL is not in the returned array. Is this a feature? Context: I am using CakePHP to get data using Model::find(). EDIT The issue is that when I use the SQL statement: SELECT col_1, col_2 FROM table where col_1 is defined as VARCHAR NOT NULL and col_2 as VARC...

How to zero out new memory after realloc

What is the best way to zero out new memory after calling realloc while keeping the initially allocated memory intact? #include <stdlib.h> #include <assert.h> #include <string.h> #include <stdio.h> size_t COLORCOUNT = 4; typedef struct rgb_t { int r; int g; int b; } rgb_t; rgb_t** colors; void addColor(size_t i, int r, i...

Is it possible in Java to check if objects fields are null and then add default value to all those attributes?

I need to make sure that no object attribute is null and add defautl value in case if it is null. Is there any easy way to do this, or do I have to do it manually by cheking every attrute by its getter and setters? ...

Mysql: select * from table where col IN (null, "") possible without OR

is its somehow possible to do a select for empty strings and NULL values in Mysql without using or? this: select * from table where col IN (null, ""); doesnt work, it ignores the null (or possibly matches it with the string 'null' thanks, P.V. Goddijn ...

passing null values from ajax to phpscript

Hello, I am having some problems with null values Is there a good way of passing the null values from js in a way that they are interpreted the same. This apparently is not the same ajaxNullVar = null; post_var = {'action': 'update_foto','fotoid': fotoid, 'ajaxNullVar': ajaxNullVar }; $.ajax({ url: post_url, ...

How to check if two objects are equal even if they could be null

Sometimes, I see this: if (a.equals(b)) do(something); However, if a is null, a NullPointerException is thrown. Assuming when a==null and b==null or if just a==b that I would want to do(something). What's the simplest way to do this check without getting an exception? ...

C-like language without NULL?

Hi I was recently watching an old video about how null pointers were a billion dollar mistake. He points out both C# and java as they have run-time checks but don't completely eliminate it enough and this is somewhat understandable. He also points out the C at one point which he feels so sure of is a great problem. I get that null termin...

How to bind controls without data (NULL)?

Hi, I have a GridView (RadGrid) being bound with data using LINQ. In the LINQ query, I use DefaultIfEmpty because some records have empty values to a lookup table. In the real SQL query generated by LINQ, we can see LEFT OUTER JOINs, so even if some data is not provided to reference the table, records are returned. My problem is when ...

How do I ensure another Thread's Handler is not null before calling it?

My program threw a NullPointerException the other day when it tried to use a Handler created on another thread to send that thread a message. The Handler created by the other thread was not yet created, or not yet visible to the calling thread, despite the calling thread having already called start on the other thread. This only happens ...

making elements of an array null

are these two the same things? for(int i=0; i<array.length; i++){ array[i] = null; } and array = null; ...

SQL Server 2008 - Default column value - should i use null or empty string?

For some time i'm debating if i should leave columns which i don't know if data will be passed in and set the value to empty string ('') or just allow null. i would like to hear what is the recommended practice here. if it makes a difference, i'm using c# as the consuming application. ...

PLug in to find null initializers

I recently found out that having null initializer for objects are an overhead from http://www.codinghorror.com/blog/archives/000343.html I have a huge C# codebase where in lots of such initializations are made,i want to know if there is any free plug in to help me replace it.I tried to search on net but no free plug ins:( ...

Eclipse getResourceAsStream returning null

I cannot get getResourceAsStream to find a file. I have put the file in the top level dir, target dir, etc, etc and have tried it with a "/" in front as well. Everytime it returns null. Any suggestions ? Thanks. public class T { public static final void main(String[] args) { InputStream propertiesIS = T.class.getClassLoader().get...