null

can't get value from readonly or disabled textbox control asp.net

橙三吉。 提交于 2019-12-22 07:37:30
问题 I created an uneditable control in asp.net using either of the folowing <asp:TextBox ID="txtStartDate" runat="server" enabled="false"></asp:TextBox> or <asp:TextBox ID="txtStartDate" runat="server" readonly="true"></asp:TextBox> am using a javascript popup to fill the textbox in the client side. the value is always null when i tried to retrieve it in codebehind can anyone suggest a better way 回答1: Try this <asp:TextBox ID="txtStartDate" runat="server"></asp:TextBox> Code Behind txtStartDate

Push Notifications using Urban Airship returns apID as null at the first launch

試著忘記壹切 提交于 2019-12-22 07:09:16
问题 I have successfully integrated urban airship push notification to my android application. I ran into an issue here, that is the apID becomes null with the very first launch and then with the second launch, apId comes correctly. This is how I grab the apId: String apid = PushManager.shared().getAPID(); This is the class that I have used: public class MyApplication extends Application { public static SharedPreferences PREFS_TOKEN; public static final String PREFERENCE = "UrbanAirship"; public

Using Collections.emptyList() and null handling

假装没事ソ 提交于 2019-12-22 07:06:27
问题 Speaking of best practices to handle "nulls" in Java(especially "List" returns), is it a good practise to return "Collections.emptyList()" from an entity class's getMethod? or should we keep the entity/data classes/methods neat and clean and always return whatever its value is(even its null) then handle that null somewhere else in the code, for example; Class Reference{ private Reference reference; @XmlElement(name = "Reference") public List<Reference> getReference() { if(reference==null){

Accessing IBOutlet from another class

本小妞迷上赌 提交于 2019-12-22 06:57:18
问题 I am calling a class function from my ViewController class like this: Buttons.set_cornerRadius(10) I have another .swift file where I have the function declared: class Buttons { class func set_cornerRadius(radius: CGFloat) { ViewController().someButton.layer.cornerRadius = radius } } When I'm trying to run this it throws the error: "Unexpectedly found nil while unwrapping an optional Value" . I checked the Storyboard-IBOutlet connections already. Everything is connected right. If I call the

Symfony ManyToOne relationship getter returns empty object

僤鯓⒐⒋嵵緔 提交于 2019-12-22 06:47:03
问题 I'll simplifly my code, I have te next: Doctor entity: use ...\...\Entity\Paciente; class Doctor extends Usuario { public function __construct() { ... $this->pacientes = new ArrayCollection(); ... } /** * Número de colegiado - numColegiado * * @var string * * @ORM\Column(name="numColegiado", type="string", length=255, unique=true) */ protected $numColegiado; /** * @ORM\OneToMany(targetEntity="Paciente", mappedBy="doctor") * @var \Doctrine\Common\Collections\ArrayCollection */ private

Why is assigned a nil to singleton's static variable

房东的猫 提交于 2019-12-22 06:36:44
问题 What is the advantage of using this: + (CardPainter*) sharedPainter { static CardPainter* sp = nil; if (nil == sp) { sp = [[CardPainter alloc] init]; } return sp; } instead of this: + (CardPainter*) sharedPainter { static CardPainter* sp = [[CardPainter alloc] init]; return sp; } The static variable initialization is performed only once, so I see no advantage of the former. 回答1: Well, at a compiler level there's several overlapping reasons… the simplest to think about is that static variables

Function doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used

扶醉桌前 提交于 2019-12-22 06:01:36
问题 I'm getting this error: Function 'getkey' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used. to the following code: Public Function getkey(ByVal id As String) Dim cmd As SqlCommand Try cmd = New SqlCommand("dbo.getkeydesc", GenLog.cn) cmd.CommandType = CommandType.StoredProcedure cmd.Parameters.AddWithValue("@id", id) Dim r As SqlDataReader = cmd.ExecuteReader() If r.HasRows Then Return True Else Return False End If Catch ex

match tuple with null

匆匆过客 提交于 2019-12-22 05:41:20
问题 I don't understand why the following case doesn't match. Null should be an instance of Any, but it doesn't match. Can someone explain what is going on? val x = (2, null) x match { case (i:Int, v:Any) => println("got tuple %s: %s".format(i, v)) case _ => println("catch all") } prints catch all Thanks. 回答1: This is exactly as specified. Type patterns consist of types, type variables, and wildcards. A type pattern T is of one of the following forms: * A reference to a class C, p.C, or T#C. This

Eclipse null analysis: The expression of type int needs unchecked conversion to conform to '@Nonnull Integer'

删除回忆录丶 提交于 2019-12-22 05:38:42
问题 When configuring Eclipse 4.2.0 to perform a null analysis (configured to use @javax.annotation.Nonnull etc.), the following code will generate the warning Null type safety: The expression of type int needs unchecked conversion to conform to '@Nonnull Integer' class C { static void foo(int i) { bar(i); // Warning } static void bar(@javax.annotation.Nonnull Integer i) { } } How am I supposed to fix this (without using @SuppressWarnings("null") )? It seems that the analyzer does not know that

Calling instance method on a null reference in IL

心不动则不痛 提交于 2019-12-22 05:33:47
问题 Is it correct that a instance method can be called on a null reference in IL..? Is there any example to show this..? 回答1: Yes, this is possible, as long as the method doesn't use this because the CLR does not do a null check for call instructions. You would have to modify the IL by hand as the C# compiler would almost always generate a callvirt instruction 1 . See this blog post for details and an example: Instance Methods Called on null References Sample .method private hidebysig static void