Questions tagged [null]

1

votes
1

answer
10

Views

Nullcheck Children Chain in Typescript

Using strict null checking is great, but it's also resulting in this sort of silliness: if (x) if (x.y) if (x.y.z) if (x.y.z.stringProperty) console.log(x.y.z.stringProperty) Is there a way to do this null checking without repetition? Thanks!
calben
1

votes
2

answer
1.6k

Views

Remove null values from array using Array.indexOf?

I'm trying to find if there's a null value in my array without using for loops, mainly something similar to Array.indexOf. Undefined is NOT a string, it's a null value that comes up as undefined when I use console.log(ARRPREFIX) var arr = ["**", undefined, null]; if (arr.indexOf(null) > -1) { cons...
1

votes
2

answer
280

Views

How to return only one specific null field with GSON?

If I have a simple object as follows: String name; String email; int age; boolean isDeveloper; Then let's say JSON object received have values: {"name":null,"email":null,"age":26,"isDeveloper":true} When deserializing this JSON using GSON as default I have: {"age":26,"isDeveloper":true} But email f...
Shell_Leko
1

votes
1

answer
5.3k

Views

java: Using Buffered Reader and checking if String is null

why doesn´t if (txtLine == null) { break; };work? or maybe the correct answer is why does it still set the string txtLine to null (literally). The way I understand it, it should break the moment the string is null? I don´t want it to set the string to "null". but stop when there are no mo...
Tom Lilletveit
-1

votes
1

answer
47

Views

NULL substitute for a double in C language 99 standard

I am working on a Circularly-Doubly-Linked List with a sentinel in the C language with the 99 standard. The headers I am allowed to use for class are stdio.h, stdlib.h, and assert.h only. The sentinel is a struct and the structs have a value data member which is a double value. I was wondering if...
R00ki3 M1stak3
1

votes
2

answer
35

Views

Where condition in oracle request

I have a a date field who can be null in an Oracle Database. I want to select the row with the highest date. But if there is only one row with a null date and I use the max clause it will be ignored. SELECT val1, val2 from T_DER WHERE DATE_AP = ( SELECT MAX (DATE_AP) FROM T_DER WHERE AE= 'XXX') A...
LedZelkin
0

votes
0

answer
8

Views

My photo field still showing null in my table structure after inserting images using mysql statement

use work; update applicants set photo = (load_file("C:\Users\CEO\Pictures\MY PHOTOS\OT.jpg")) where ID = 2001; When I execute the query in MySQL workbench, it runs successfully, displaying 0 row(s) affected Rows matched: 1 Changed: 0 Warning But when I decide to view my table records, the value...
CEO
1

votes
2

answer
784

Views

npgsql : Selecting a null data throws exception with error “Column is Null”

I am running npgsql v3.7 with .NetCore on Ubuntu. When I execute a select query and a cell in any row in the results is null, an exception is thrown with the error message "Column is null". I am having to work around this by putting every column in the select clause inside a case statement which tes...
Hughgo
1

votes
2

answer
4.8k

Views

Slim 3 getParsedBody() always null and empty

I'm am using the Slim Framework Version 3 and have some problems. $app-> post('/', function($request, $response){ $parsedBody = $request->getParsedBody()['email']; var_dump($parsedBody); }); result is always: null Can you help me ?
animatorist
1

votes
1

answer
2.3k

Views

NULL statement in VHDL

What is the actual purpose of null statement in VHDL? Consider the following codes 1- CASE s IS BEGIN WHEN 0 => y NULL; END CASE; 2- CASE s IS BEGIN WHEN 0 => y
mahmood
1

votes
2

answer
497

Views

Ignore null values in descending order using Django Rest Framework

I am using Django for my website, and hence decided to use Django Rest Framework for building my REST APIs. For a particular model, i want to filter on a text field (using SearchFilter for that), filter on a few categorical fields (FilterBackend with a FilterSet defined) and be able to order data ba...
Shubham
1

votes
1

answer
1.5k

Views

How to have a null value for MySQL in Python

This is my version of SQL command line. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 122 Server version: 5.0.95 Source distribution I have a table, and from Python, I want to write the last column as a null. Eventually, the last column of a particular row wi...
octopusgrabbus
1

votes
2

answer
44

Views

ObjectMapper - How to send null value in JSON

According to third party API spec, I need to send null value in JSON using ObjectMapper if no value exists, Expected results : "optional": null If optional value exists, then send "optional": "value" I didn't find such option in Jackson – Working with Maps and nulls Code: requestVO = new RequestV...
user7294900
1

votes
2

answer
35

Views

Spark SQL Ranking for nullable unicode strings

We are working on Spark SQL. We are doing ranking using some nullable string fields. The problem is: In Spark SQL, null values come first in the ranking. But, We want null value to come in the end. So, we have applied a CASE WHEN logic. As we are having Unicode data, "ZZZZZZZZ" will not be coming...
Venkataraman R
1

votes
2

answer
3.7k

Views

How to return null char reference

How do i return a null value? I created a local char set to null...but is there a different way to return a null lvalue? char& String::operator[](int index) { char s = NULL; if (index > length) { cout
randomname
1

votes
3

answer
1.6k

Views

All Null, Any Null is possible guava Predicate

I'm currently facing a code readability issue. The problem is the following: Have three objects // initialization skipped, all of three could be null as result of their initalization Object obj1; Object obj2; Object obj3; I want to create two booleans from them as follows: // all are null boolean bo...
px5x2
1

votes
3

answer
6.2k

Views

MySQL insert NULL instead of 0000-00-00 date

I have birthday column as a date defined in my table. When i insert a person and left blank birthday field, i get 0000-00-00 and i want to get NULL values. when i insert date as birthday i get date, which is fine. i tried : Create table ( birthday DATE NULL, birthday DATE DEFAULT NULL, birthday DATE...
59

votes
5

answer
4.6k

Views

Will printf still have a cost even if I redirect output to /dev/null?

We have a daemon that contains a lot of print messages. Since we are working on an embedded device with a weak CPU and other constraint hardware, we want to minimize any kinds of costs (IO, CPU, etc..) of printf messages in our final version. (Users don't have a console) My teammate and I have a dis...
Michael Peng
0

votes
0

answer
4

Views

recognizing the null token in Antlr4

I want to parse this list. identifier ( item1, item2, item3 ...) It has 2 important rules. Items are separated by ',' or blank. if there is comma, then it recognize null token as ' '. For example, these a same sentences func ( ' ' item2 ' ') func ( ' ',item2,' ') func ( , item2 , ) skip;
userA
1

votes
2

answer
686

Views

Select the last value of each column, per user, the simplest way

This is an extended version of a related previous question. I have posted it a new question for Erwin Brandstetter suggested me to do so. (I realized that I actually wanted this, after people replied to my first question) Having the following data (blank means NULL): ID User ColA ColB ColC...
Mario
1

votes
2

answer
1k

Views

Select the last value of each column, with a single query

Having the following data (blank means NULL): ID ColA ColB ColC 1 15 20 2 11 4 3 3 How can I get the last not-NULL values of each column in a single query? So the resulting for the given data would be: ColA ColB ColC 11 3 20 I ha...
Mario
1

votes
2

answer
1.6k

Views

Check if Class is Nothing, or Structure is default value, using a single condition

I've written my own method for programmatically selecting an item in a ComboBox: Function SelectItem(ByVal item As Object, ByVal comboBox As ComboBox) As Boolean If Not comboBox.Items.Contains(item) Then comboBox.Items.Add(item) End If comboBox.SelectedItem = item Return True End Function The "item"...
Rudey
1

votes
4

answer
1.2k

Views

Getting a Null Pointer Exception in my program. What am I doing wrong? [closed]

Having null pointer exception in my program at the bolded part, what am I doing wrong? Any insight would be nice. Thank you. Some background on me, I am a biochemist, very new to programming. If there is a null created somewhere, how can I take care of it and not allow it to terminate and create a r...
Biochemist_HK
1

votes
2

answer
2.3k

Views

sql server null value in where clause

There is one table which is having only one row with 4 date columns ,initially all date value are null so if Exists(select 1 from rep_master where pacdt_1=null OR pacdt_2=null OR pacdt_3=null OR pacdt_4=null) select 0 else select 1 this one is returning 1 if Exists(select 1 from rep_master where IS...
Buzz
1

votes
2

answer
1k

Views

How to do jquery validation on something that is equal to zero, but not when its null/empty

So I want to validate a textbox that I have, the user can leave this box blank which is fine. However if they enter the number 0 in it, I want an error message to appear. However if it say is it null, it validates as an error when it is empty as well. I have done is it equal to "0" in quotes, how...
Ben
1

votes
4

answer
5.5k

Views

Grails - Cannot invoke method getAt() on null object

I am getting an error when trying to append a book to a list of classes list of books. Any ideas as to why or what I could do to fix it? //For each book in a class... for (int k = 0; k < rows.size(); k++) { Book book = new Book() //Assign the values to a new book object book.id = rows[k]....
grantmcconnaughey
1

votes
1

answer
4k

Views

Oracle: Is it possible to accurately join null fields from two different tables?

I have four fields -- itemnum, storeloc, binnum, and quantity. I am trying to select data, where the first three fields match, but binnum is sometimes null. When I perform my sum on quantity, the calculation is not correct because of the NULL binnum. The database has an index where there can only be...
Sun
1

votes
1

answer
1k

Views

Invalid string or buffer length when inserting null in byte type field

I get the following exception when inserting : ERROR [HY090] [Informix .NET provider]Invalid string or buffer length. When obj.Request_file = null;//of byte[] type using (IfxConnection con = new IfxConnection(ConfigurationSettings.AppSettings["con1"].ToString())) { con.Open(); StringBuilder cmdTxt...
Anyname Donotcare
1

votes
3

answer
3.2k

Views

Entity framework + Lambda expression null comparison not working

i have a simple select: this works: User = ent.e_user.FirstOrDefault(x => x.usr_name == UserName && x.password == null); Even if var Password is equal to null this doesn't work: String Password = null; if(Password == null) { //it enters here } User = ent.e_user.FirstOrDefault(x => x.usr_name == U...
Moondustt
1

votes
1

answer
794

Views

Sparse columns not showing any savings

Ive ran a test comparing a table with a few sparse columns to a table with no sparse columns, and i am seeing zero space saving. I have two tables, both storing Address info mainly in varchar columns. both tables allow nulls, one has columns sparse property set. I insert 1000 rows of default values...
wilson_smyth
1

votes
2

answer
974

Views

Android pick image from Gallery NullPointerException?

I am currently trying to create an App, which allows the user to pic an image from gallery and upload it to a server. But i'm still stuck in picking an image. I followed a tutorial exactly, but when launching the activity i get a NullPointer. Do you guys see any errors? Thanks in advance! Heres the...
user2147674
1

votes
1

answer
1.5k

Views

Passing a NULL value to a GUID

I am a total beginner at VB.NET so you may need to bear with me but I need to edit this code behind so that a null value is passed to my database for the 'imageurl' field. The front end is a web form where a user can enter details of a book, with the option of uploading a book cover. I want to chang...
adaam
1

votes
1

answer
793

Views

Reading NULL values with MFCs RFX (Record Field Exchange)

I'm using RFX (Record Field Exchange) to move data from a ODBC data source to my Recordset object. Numbers are moved with RFX_Int (within DoFieldExchange) and apparently the database NULL (not a value) is mapped to a pseudo null value AFX_RFX_INT_PSEUDO_NULL. Unfortunately this sentinel value is def...
Christian Ammer
1

votes
1

answer
94

Views

How do I index values in a multiple data type array in Lua?

This is a strange question but it baffles me. I want to be able to store x and y co-ords on an id based system such as: id.1.x = 10, id.1.y = 15: id.2.x = 50, id.2.y = 42 and I am trying to make a function to do it for me, I am having issues. here's my code a = { p = {x,y}} function box(xpos,ypos,id...
Rock48
1

votes
3

answer
1.4k

Views

Javascript Email validation that allows a null value

I have this on submit function that checks for the email field to have a properly formatted address. Works fine. However, I want the field to allow a null value as this particular input is optional and not required. I know this should be simple, Im missing the obvious. Someone point me in the right...
quori
1

votes
2

answer
853

Views

Simple SQL, Setting default value for multiple columns in a table

So I'm doing homework for a class and I have been stuck on this problem for days, apparently I'm not as good at google as I need to be. Here it is: "Change the StoreReps table so that NULL values can’t be entered in the first and last name columns." My Code (does not work): Alter Table StoreRep M...
user2238127
1

votes
4

answer
2.4k

Views

Remove Duplicates … With NULLs

In MS SQL Server I am trying to remove duplicates from a table with nulls. Que the groans. Lots and lots of NULLs. The bottom line is I need to retain one copy of any duplicate record with or without NULLs. I basically wantNULL to act like a normal record with a value of "NULL" for the duration of t...
user2366153
1

votes
3

answer
8.1k

Views

Printing string array also prints null

When I am printing contents of a string array the output is printing 'null' as well. I am not sure what's wrong with this. Here is the output, what I expect is the output without 'null' null(wa?>=0)nullnull*(wo?>=0)nullnull*(4*wa?+7*wo?>=50)nullnull*(d1=10)nullnull*((d2=1)+(k=2))nullnull Thanks and...
user1596115
1

votes
1

answer
1.4k

Views

How to update to NULL a field in solr using XML?

In solr 4 is possible to make partial document updates. For example: 1 newvalue updates myfield to "newvalue" in record 1 without affecting other fields. But how can I update myfield to NULL? I tried with but obviously it sets an empty string (not NULL) and for date fields raises an error. Is there...
Zac
1

votes
1

answer
1.7k

Views

Foreach System.NullReferenceException: Object reference not set to an instance of an object

I get System.NullReferenceException: Object reference not set to an instance of an object in this: var offeredItems = new List(Trade.steamMyOfferedItems); foreach (var item in offeredItems) { Trade.RemoveItem(item); } What is different than in all such questions is that the exception is in line 3 fr...
user2410832

View additional questions