null

What is the meaning of nil owner in component constructor

为君一笑 提交于 2019-12-18 08:57:00
问题 I was looking at this question and I'm wondering now, what is the meaning of nil as the owner in component constructor. SomeComponent := TSomeComponent.Create(nil); I know, that I should free it by myself when using this constructor, but is that the only reason to pass the owner at creation ? And what happens, when I forget to free it and close my application - does it mean that this object remains in memory as a garbage ? Thanks a lot :) 回答1: It means that you're responsible for freeing it

Postgresql: using 'NULL' value when insert and update rows with prepared statements

自闭症网瘾萝莉.ら 提交于 2019-12-18 08:55:02
问题 sometimes i need to insert into the table some null values, or update them setting the value to NULL. I've read somewhere in the postgresql documentation that this cant be done, but can be tricket with the default value: pg_query("INSERT INTO my_table (col_a, col_b) VALUES ('whatever', default) p.s: i know that in this example i'll have the same result with pg_query("INSERT INTO my_table (col_a) VALUES ('whatever') But the problems comes witht the prepared statements: pg_prepare($pgconn,

Why NULL values are mapped as 0 in Fact tables?

非 Y 不嫁゛ 提交于 2019-12-18 08:23:15
问题 What is the reason that in measure fields in fact tables (dimensionally modeled data warehouses) NULL values are usually mapped as 0? 回答1: Although you've already accepted another answer, I would say that using NULL is actually a better choice, for a couple of reasons. The first reason is that aggregates return the 'correct' answer (i.e. the one that users tend to expect) when NULL is present but give the 'wrong' answer when you use zero. Consider the results from AVG() in these two queries:

Best practice to insert NULL to MySQL using PHP

旧街凉风 提交于 2019-12-18 07:43:09
问题 function save($gmt, $name, $address, $phone, $remark) { $query= "INSERT INTO `user` (`gmt`, `name`, `address`, `phone`, `remark`) VALUES ('$gmt', '$name', '$address', '$phone', '$remark')"; mysql_query($query); } Here address, phone and remark can be NULL value. I need it so that when I pass a null parameter into my function it stores an empty value in the database (NULL). I need to know what the best solution for doing this is. Thanks. 回答1: This is PHP solution, but you have to use mysqli

Line ChartJS empty / null values doesn't break the line

风格不统一 提交于 2019-12-18 07:03:38
问题 I want to break the line of the chart when values is null or empty, but I can't. Perhaps I miss something? var data = { labels: ["January", "February", "March", "April", "May", "June", "July"], datasets: [ { label: "My First dataset", fillColor: "rgba(220,220,220,0.5)", strokeColor: "rgba(220,220,220,0.8)", highlightFill: "rgba(220,220,220,0.75)", highlightStroke: "rgba(220,220,220,1)", data: [65, null, 80, 81, 56, 55, 40] }, { label: "My Second dataset", fillColor: "rgba(151,187,205,0.5)",

LOAD_FILE returns NULL

梦想的初衷 提交于 2019-12-18 06:51:53
问题 I am trying to insert an image into my MySQL server. I have done some research and it looks like the best way to do that is through LOAD_FILE() . However, LOAD_FILE() always returns null. I know there are 4 conditions for LOAD_FILE() : The file must be located on the server host You must specify the full path name to the file, and you must have the FILE privilege. The file must be readable by all and its size less than max_allowed_packet bytes. If the secure_file_priv system variable is set

Android data.getData() returns null from CameraActivity for some phones

时光总嘲笑我的痴心妄想 提交于 2019-12-18 06:13:48
问题 I have a fatal error occurring in my onActivityResult coming back from a camera activity. What has me scratching my head is that the error is only happening on a handful of phones (based on the number of affected users) while there seems to be nothing wrong for the majority. I can duplicate the error on my Nexus 6 (running Lollipop 5.1.1) while my Note 5 (also 5.1.1) has no problems at all. The problem is when I am trying to assign the imageUri from data.getData(). Debugging on the Note 5,

C# Null propagation - Where does the magic happen?

纵然是瞬间 提交于 2019-12-18 05:59:14
问题 Null propagation is a very nice feature - but where and how does the actual magic happen? Where does frm?.Close() get changed to if(frm != null) frm.Close(); - Does it actually get changed to that kind of code at all? 回答1: It is done by the compiler. It doesn't change frm?.Close() to if(frm != null) frm.Close(); in terms of re-writing the source code, but it does emit IL bytecode which checks for null. Take the following example: void Main() { Person p = GetPerson(); p?.DoIt(); } Compiles to:

How better refactor chain of methods that can return null in java?

梦想的初衷 提交于 2019-12-18 05:54:41
问题 I have code like: obj1 = SomeObject.method1(); if (obj1 != null) { obj2 = obj1.method2(); if (obj2 != null) { obj3 = obj2.method3(); if (obj3 != null) { ............ return objN.methodM(); } } } .... I have near 10 steps. It seems very fragile and error prone. Is there a better way to check on null chained methods? Thanks. 回答1: It's common problem for null references in java. I prefer chaining with && : if (obj1 != null && obj1.method1() != null && obj1.method1().method2() != null) 回答2: More

NULL check before deleting an object with an overloaded delete

瘦欲@ 提交于 2019-12-18 05:27:18
问题 This came up as one of the code review comments. Is it a good idea to check for NULL before calling delete for any object? I do understand delete operator checks for NULL internally and is redundant but the argument put forth was delete as an operator can be overloaded and if the overloaded version doesn't check for the NULL it may crash. So is it safe and reasonable to assume that if and when delete will be overloaded it will check for the NULL or not? In my understanding its reasonable to