null

@ManagedProperty does not work in a CDI managed bean

▼魔方 西西 提交于 2019-12-30 10:34:47
问题 I try to learn JSF and encountered on a problem connected with ManagedProperty. However I have tried to use it, it always failed - null exception pointer. What am I doing wrongly? I have read some "similar posts" on stackoverflow, but they did not helped to me. (I use GlassFish 4.0, JSF 2.2, JDK 1.7, Netbeans 7.3.1 (Java EE pack) and Java EE 6.0) <?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1

can we call any method on null object?

Deadly 提交于 2019-12-30 10:06:12
问题 is it possible? Object obj=null; obj.someMethod(); someMethod{/*some code here*/} 回答1: You can call a static method on a null pointer. The pointer will naturally be completely ignored in a static method call, but it's still a case when something that (without looking at the class definition) seemingly should cause a NullPointerException runs just fine. class FooObject { public static void saySomething() { System.out.println("Hi there!"); } } class Main { public static void main(String[] args)

SWIFT: Why is “NSURL(string:” returning with Nil, even though it's a valid url in a browser?

旧街凉风 提交于 2019-12-30 09:37:23
问题 The first two example links are working the third one returns NIL. Why is NSUrl returning nil for such string, even though it's a valid url in a browser? Am I supposed to process the string more? Here is my code: import UIKit import Foundation class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate, NSXMLParserDelegate { var myFeed : NSArray = [] var url : NSURL! var feedURL : NSURL! var selectedFeedURL = String() @IBOutlet var tableFeeds: UITableView! @IBOutlet var

Which of IsDBNull and IsNull should be used?

此生再无相见时 提交于 2019-12-30 07:56:22
问题 If in VB.NET I have DataRow and I want to test whether a column value is Null , should I use: myDataRow.IsNull("Column1") OR IsDBNull(myDataRow("Column1")) 回答1: Short answer : use the first way, it is faster, because the first method uses a pre-computed result, while the second method needs to recompute it on the fly every time you call it. Long answer : (you need to read C# code to understand this part; MS supplies framework code in C#, but VB programmers should be able to get the general

Why does String(null) work?

久未见 提交于 2019-12-30 07:51:37
问题 null and undefined don't have a toString or valueOf method. Afaik using String calls the toString method of its parameter (e.g. String({}) => [object Object] ). Why do String(null) or String(undefined work then? It doesn't implicitly do Object.prototype.toString.call(null) . because that evaluates to [object Null] . [edit]: from the spec ECMA-262/5th edition (page 48). This doesn't add to clarification, I'd say: /* Table 13 — ToString Conversions ----------------------------------------------

Differences between “IS NULL” and “ISNULL()” in Mysql

那年仲夏 提交于 2019-12-30 05:43:05
问题 Is there any difference in performance between the operator IS NULL and the function ISNULL() ? 回答1: Looking into the MySQL manual, they seem to be synonyms really. MySQL manual on IS NULL MySQL manual on ISNULL() and even if they aren't, I would tend to trust the query optimizer to pick the best solution. 回答2: This thread is similar, though not exactly on MySQL. According to the test shown there: IS NULL is more efficient as it doesn't require a scan. Seek is generally faster than a scan as

How can I write a null ASCII character (nul) to a file with a Windows batch script?

风流意气都作罢 提交于 2019-12-30 03:12:45
问题 I'm attempting to write an ASCII null character (nul) to a file from a Windows batch script without success. I initially tried using echo like this: echo <Alt+2+5+6> which seems like it should work (typing <Alt+2+5+6> in the command window does write a null character - or ^@ as it appears), but echo then outputs: More? and hangs until I press <Return> . As an alternative I tried using: copy con tmp.txt >nul <Alt+2+5+6><Ctrl+Z> which does exactly what I need, but only if I type it manually in

Field value must be unique unless it is NULL

梦想与她 提交于 2019-12-30 03:10:07
问题 I'm using SQL Server 2005. I have a field that must either contain a unique value or a NULL value. I think I should be enforcing this with either a CHECK CONSTRAINT or a TRIGGER for INSERT, UPDATE . Is there an advantage to using a constraint here over a trigger (or vice-versa)? What might such a constraint/trigger look like? Or is there another, more appropriate option that I haven't considered? 回答1: Here is an alternative way to do it with a constraint. In order to enforce this constraint

Null-conditional operator and !=

陌路散爱 提交于 2019-12-30 02:45:10
问题 With the introduction of Null-Conditional Operators in C#, for the following evaluation, if (instance != null && instance.Val != 0) If I rewrite it this way, if (instance?.Val != 0) it will be evaluated to true if instance is a null reference; It behaves like if (instance == null || instance.Val != 0) So what is the right way to rewrite the evaluation using this new syntax? Edit: instance is a field of a big object which is deserialized from JSON. There are quite a few pieces of code like

How set 0 with MAX function when it is NULL?

感情迁移 提交于 2019-12-30 01:45:06
问题 I would like to understand how to set 0 value of the attribute when it is NULL with MAX function. For example: Name columns: number - date Values: 10 - 2012-04-04 11 - 2012-04-04 12 - 2012-04-04 13 - 2012-04-15 14 - 2012-06-21 1 - 2013-07-04 Number is incremental field, but it has set itself 1 when new year has come. But result of: SELECT (MAX(number)+1) number WHERE date LIKE "2014%" is NULL and not 1 because MAX(number) is NULL and not 0 回答1: Well, as there is no date like 2014, you would