Remove null
article thumbnail

Representative Line: A String of Null Thinking

The Daily WTF

SELECT * FROM users WHERE last_name = 'NULL' Now, I don't think this particular code impacted Mr. Null , but it certainly could have. They could just store a NULL , but due to data sanitization issues, they stored 'NULL' instead- a string. That's just a special case of names being hard.

article thumbnail

Error'd: (Almost) Nought but Nulls

The Daily WTF

For this week, it's mostly nulls. " Old Hand (I know, because he double-spaced after his periods, see) Randal Schwartz told us a while back about null null. "I for null, or $89.99 Will the more-expensive null make hands with only five fingers? I thought that having a null OS seems like a bad idea."

Insiders

Sign Up for our Newsletter

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Trending Sources

article thumbnail

CodeSOD: Functionally Null

The Daily WTF

new Iban (input) : null ; } }.apply(account.getIban()); new Bic (input) : null ; } }.apply(account.getBic()); Which creates two other anonymous Function types, with their own apply methods, all of which exist to do null checks. In the end, while this code is a mistake, it's not the billion dollar mistake that nulls are.

Lambda 52
article thumbnail

CodeSOD: Terning Nulls into Values

The Daily WTF

A former co-worker of David S wanted to check for nulls, and apparently, they had just learned about the ternary operator, so they wanted to combine these actions. That, itself, isn't a WTF- using ternaries to coalesce nulls is a time-honored tradition and generally pretty effective. null : id, title == null ?

article thumbnail

CodeSOD: A Null Mystery

The Daily WTF

string localDir = "null" ; string filePath; if (save_to_Temp) { dir = Path.GetDirectoryName(engineeringDataPushPath); } else. { # if PRODUCTION. The key lines that frame the mystery are these: string localDir = "null" ; if (localDir != dir = @"calibration cert" + "" ; # endif. } if (localDir !=

article thumbnail

CodeSOD: A Variation on Nulls

The Daily WTF

Submitter “NotAThingThatHappens” stumbled across a “unique” way to check for nulls in C#. Now, there are already a few perfectly good ways to check for nulls. variable is null , for example, or use nullable types specifically. So really, this is just an awkward way of saying objectCouldBeNull is null.

article thumbnail

CodeSOD: Comments, Documentation, and Nulls

The Daily WTF

James sends us this one-liner from the WHERE clause of a stored procedure: emp.LawbaseCode = ISNULL( null , emp.LawbaseCode) The ISNULL function takes two parameters: a check expression which may be null, and a value to return if that expression is null.