nullable

Do XML parsers tell the difference between xsi:nil=“true” and omitted elements?

你。 提交于 2020-01-13 10:11:58
问题 Are XML parsers/deserializers in general able to tell the difference between nillable elements explicitly set to null and optional elements that are left out? Assume that we have the following complex type: <complexType name="NiceType"> <sequence> <element name="niceElem" nillable="true" type="int" minOccurs="0" /> </sequence> </complexType> Element explicitly set to null (example 1): <niceType> <niceElem xsi:nil="true"/> </niceType> Element omitted (example 2): <niceType> </niceType> Would

Do XML parsers tell the difference between xsi:nil=“true” and omitted elements?

让人想犯罪 __ 提交于 2020-01-13 10:11:10
问题 Are XML parsers/deserializers in general able to tell the difference between nillable elements explicitly set to null and optional elements that are left out? Assume that we have the following complex type: <complexType name="NiceType"> <sequence> <element name="niceElem" nillable="true" type="int" minOccurs="0" /> </sequence> </complexType> Element explicitly set to null (example 1): <niceType> <niceElem xsi:nil="true"/> </niceType> Element omitted (example 2): <niceType> </niceType> Would

How to insert NULL in database using Django

送分小仙女□ 提交于 2020-01-13 07:02:20
问题 I have a problem inserting NULL in Django. I mean i don't know how to do this. I have function, lets call it find_position , then i have field in model like position (IntegerField, null=True, blank=True). This function inspect some html code, and if it match with some regex, it returns integer, but if it doesn't find - have to return NULL or None or something that I can put in database. def find_position(self, to_find, something): ... if re.search(to_find, something): return i + (page * 10) +

Is it possible to make safe inline Optional in Kotlin?

穿精又带淫゛_ 提交于 2020-01-13 06:39:08
问题 In Kotlin sometimes I have to work with double nullability. For example, I need double nullability, when I want to use T? where T may be a nullable type. There are a few approaches for doing this: Holder<T>? where Holder is data class Holder<out T>(val element: T) - example 1 boolean flag variable - example 1 containsKey for Map<K, T?> - example 1 The special UNINITIALIZED_VALUE for representing the second kind of null - example 1 The last approach has the best performance, but it's also the

testing inequality with columns that can be null

泄露秘密 提交于 2020-01-12 04:45:11
问题 So, I asked a question this morning, which I did not phrase correctly, so I got a lot of responses as to why NULL compared to anything will give NULL/FALSE. My actual question was, what is the time honored fashion in which db guys test inequalities for two columns that can both be NULL. My question is the exact opposite of this question. The requirements are as follows, A and B are two columns: a) if A and B are both NULL, they are equal, return FALSE b) if A and B are both not NULL, then

MVC 3 doesn't bind nullable long

南笙酒味 提交于 2020-01-11 19:52:06
问题 I made a test website to debug an issue I'm having, and it appears that either I'm passing in the JSON data wrong or MVC just can't bind nullable longs. I'm using the latest MVC 3 release, of course. public class GetDataModel { public string TestString { get; set; } public long? TestLong { get; set; } public int? TestInt { get; set; } } [HttpPost] public ActionResult GetData(GetDataModel model) { // Do stuff } I'm posting a JSON string with the correct JSON content type: { "TestString":"test"

MVC 3 doesn't bind nullable long

那年仲夏 提交于 2020-01-11 19:50:12
问题 I made a test website to debug an issue I'm having, and it appears that either I'm passing in the JSON data wrong or MVC just can't bind nullable longs. I'm using the latest MVC 3 release, of course. public class GetDataModel { public string TestString { get; set; } public long? TestLong { get; set; } public int? TestInt { get; set; } } [HttpPost] public ActionResult GetData(GetDataModel model) { // Do stuff } I'm posting a JSON string with the correct JSON content type: { "TestString":"test"

LINQ Join query (with nullable ref between table)

青春壹個敷衍的年華 提交于 2020-01-11 06:48:11
问题 I have got 3 table. For instance Client , Company and Address . Client has got ref to Company. Company has got 2 nullable refs to Address (Billing and Shipping), so Address may not exist in some case. I need make join query, but in case when Company.BillingAddress or Company.ShippingAddress equals null , I don't get all data). I tried it (but it's wrong query): var res = (from client in context.Clients join clientCompany in context.Companies on client.ClientCompanyId equals clientCompany.Id

Difference between nullable, __nullable and _Nullable in Objective-C

£可爱£侵袭症+ 提交于 2020-01-10 06:13:27
问题 With Xcode 6.3 there were new annotations introduced for better expressing the intention of API's in Objective-C (and to ensure better Swift support of course). Those annotations were of course nonnull , nullable and null_unspecified . But with Xcode 7, there is a lot of warnings appearing such as: Pointer is missing a nullability type specifier (_Nonnull, _Nullable or _Null_unspecified). In addition to that, Apple uses another type of nullability specifiers, marking their C code (source):

Convert nullable bool? to bool

前提是你 提交于 2020-01-09 08:38:07
问题 How do you convert a nullable bool? to bool in C#? I have tried x.Value or x.HasValue ... 回答1: You ultimately have to decide what the null bool will represent. If null should be false , you can do this: bool newBool = x.HasValue ? x.Value : false; Or: bool newBool = x.HasValue && x.Value; Or: bool newBool = x ?? false; 回答2: You can use the null-coalescing operator: x ?? something , where something is a boolean value that you want to use if x is null . Example: bool? myBool = null; bool