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

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
Insiders

Sign Up for our Newsletter

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

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."

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: 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: To Coalesce a Null

The Daily WTF

As we all know, managing null values is its own challenge, especially when you're working in a functional style. So as languages like.NET add functional approaches like LINQ extension methods, they also add null coalescing operators and nullable types, making it easy to pass values around without getting surprised by an unexpected null.

Lambda 95
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 ?