null

Indexing performance null vs dummy data

I have a table with a InTime and an OutTime column. Normally when I insert data into this table I set the InTime to a DateTime and the OutTime to null. When the data is removed a OutTime value is set. When I’m getting data out for a particular time I use something like: where InTime < sometime and OutTime is > sometime or OutTime is n...

null pointer equivalence to int

In "The C++ Programming Language", Bjarne writes that the null pointer is not the same as the integer zero, but instead 0 can be used as an pointer initializer for a null pointer. Does this mean that: void * voidPointer = 0; int zero = 0; int castPointer = reinterpret_cast<int>(voidPointer); assert(zero == castPointer) // this isn't nec...

Why does bcp output null when the column contains an empty string and empty string when the column is null?

This struck me as really weird behaviour and I spent a while checking for bugs in my code before I found this "out copies from the database table or view to a file. If you specify an existing file, the file is overwritten. When extracting data, note that the bcp utility represents an empty string as a null and a null string as an empty ...

Visual Studio Dataset Designer Null

Visual Studio 2008 has a bug in that you cannot use the dataset designer to set an int type field to be nullable. (There are error reports going back to Visual Studio 2005 but it seems this has never been addressed.) The only selectable behaviour is to emit code that raises an exception if an null value is passed back from the database...

Returning the value of a new CheckBox in Flex Air

I am trying to save settings to an XML File and setting the relevant data if the check box is checked or not. private static function createXMLData():void { prefsXML = <preferences/>; prefsXML.application.@windowsstart = Application.application.SettingsPage.settingWindowsStart.selected; prefsXML.application.@mintosystray = ...

How to get past null characters in a file posted to an asp.net form?

I have an asp.net MVC application that takes in uploaded NMEA track files from small GPS loggers. In some cases, the loggers will inject null (0x0) values into the track file text. Is there a way to strip out these 0x0 characters from the HttpPostedFile's InputStream before saving the file to the server's file system for processing? A...

JPA join column with null values

I have a query that works in plain SQL but is not working on JPA and can't figure out why. As you can guess from the title I have a clue but I don't know how to "fix" it. Here's the actual important code: @Id @Basic(optional = false) @Column(name = "id", nullable = false) private Integer id; @Basic(optional = false) @Column(name ...

NULL definition problem on 64 bit system

I'm running on RHEL 5.1 64 bit platfrom using gcc 4.1.2. I have a utility function: void str_concat(char *buff, int buffSize, ...); which concats char * passed in variadic list(...), while last argument should be NULL, to designate end of the arguments. On 64 bit system NULL is 8 bytes. Now to the problem. My application includes di...

JSP Portlet not submitting form values

Hi, I am using Liferay portal 5.x. I have deployed a simple portlet ( uses jsp & servlet extending GenericPortlet). This portlet will contain username & password field. I am able to see the form in view mode. But when i submit the form, the action is coming to processAction() of the Portlet class but the username & password request para...

C++ nil vs NULL

OK, I have some C++ code in a header that is declared like this: void StreamOut(FxStream *stream,const FxChar *name = nil); and I get: error: 'nil' was not declared in this scope nil is a pascal thing, correct? Should I be using NULL? I thought they were both the same or at least Zero, no? ...

Optimize Join sentence with foreign keys, and show records with nulls

Hi guys I have the following structure SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; CREATE TABLE IF NOT EXISTS `sis_param_tax` ( `id` int(5) NOT NULL auto_increment, `description` varchar(50) NOT NULL, `code` varchar(5) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7; CREATE TABLE IF NOT EXISTS ...

How to store NULL values in datetime fields in MySQL?

I have a "bill_date" field that I want to be blank (NULL) until it's been billed, at which point the date will be entered. I see that MySQL does not like NULL values in datetime fields. Do any of you have a simple way to handle this, or am I forced to use the min date as a "NULL equivalent" and then check for that date? Thanks. EDITED...

Simple math question with LinQ, simple Join query, Nulls, etc.

I have 2 tables   1. Client   2. Operations Operations can result in: Credits or Debits ('C' or 'D' in a char field) along with date and ammount fields. I must calculate the balance for each client's account using linQ... The result should also show balance 0 for clients whom didn't make operations yet I have the following function wi...

How can I store NULLs in NOT NULL field?

I just came across NULL values in NOT-NULL fields in our test database. How could they get there? I know that NOT-NULL constraints can be altered with NOVALIDATE clause, but that would change table's last_ddl_time in USER_OBJECTS. And that time is less than the date that those records were created. Is there something else I'm overlooking...

Adding missing NULL checks after malloc with coccinelle

I want to write a semantic patch for coccinelle, so that it will add if (ptr == NULL) ... checks after calls to malloc where they are missing. Let's say I have the following input source code: #include <stdio.h> #include <stdlib.h> #include <string.h> // memory leaks ignored static void OK_simple(void) { char *ptr; ptr = malloc(100...

C++ std::string and NULL const char*

I am working in C++ with two large pieces of code, one done in "C style" and one in "C++ style". The C-type code has functions that return const char* and the C++ code has in numerous places things like const char* somecstylefunction(); ... std::string imacppstring = somecstylefunction(); where it is constructing the string from a c...

Zend: How to insert NULL values into MySQL

I am using Zend Framework with MySQL,Apache and Ubuntu 9.04. I am trying to insert NULL values into database like this: $personObj->setPersonId( '1' ); $personObj->setPersonEmail('NULL'); $personObj->save(); But 'NULL' is stored in database as string and not NULL. When I use this: $personObj->setPersonId( '1' ); $personObj->setPers...

C#: Range intersection when endpoints are null (infinity)

Ok, I have these intersection methods to work with ranges, and they work well as long as the range endpoints are not null: public static bool Intersects<T>(this Range<T> first, Range<T> second, IComparer<T> comparer) { return comparer.Compare(first.Start, second.End) <= 0 && comparer.Compare(first.End, second.Start) >= 0; }...

SELECT the newest record with a non null value in one column

Hi there I have table data which looks like this id | keyword | count | date 1 | ipod | 200 | 2009-08-02 2 | ipod | 250 | 2009-09-01 3 | ipod | 150 | 2009-09-04 4 | ipod | NULL | 2009-09-07 Now what I am after is getting the count of the row which has the newest date but has a not null count. In which case row 3 with count 150.) eg ...

SELECT all the newest record distinct keyword with a non null value in one column

Hello again... Following on from this question http://stackoverflow.com/questions/1740199/select-the-newest-record-with-a-non-null-value-in-one-column I know have a problem where I have this data id | keyword | count | date 1 | ipod | 200 | 2009-08-02 2 | ipod | 250 | 2009-09-01 3 | ipod | 150 | 2009-09-04 4 | ipod | NULL | 2009-09-07...