Search Results

Search found 20401 results on 817 pages for 'null coalescing operator'.

Page 11/817 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • webpart context.session is null

    - by tbischel
    I've been using the session array to store a state variable for my webpart... so I have a property like this: public INode RootNode { get { return this.Context.Session["RootNode"] as INode; } set { this.Context.Session["RootNode"] = value as object; } } This usually works fine. I've discovered that sometimes, the context.session variable will be null. I'd like to know what are the conditions that cause the session to be null in the first place, and whats the best way to persist my object when this happens? Can I just assign a new HttpSessionState object to the context, or does that screw things up? Edit: Ok, so its not just the session that is null... the whole context is screwed up. When the webpart enters the init, the context is fine... but when it reaches the dropbox selectedindexchange postback event (the dropbox contains node id's to use to set the rootnode variable), the context contains mostly null properties. also, it only seems to happen when certain id's are selected. This looks more like some kind of weird bug on my end than a problem with my understanding of the session.

    Read the article

  • Which to use - "operator new" or "operator new[]" - to allocate a block of raw memory in C++?

    - by sharptooth
    My C++ program needs a block of uninitialized memory. In C I would use malloc() and later free(). In C++ I can either call ::operator new or ::operator new[] and ::operator delete or operator delete[] respectively later. Looks like both ::operator new and ::operator new[] have exactly the same signature and exactly the same behavior. The same for ::operator delete and ::operator delete[]. The only thing I shouldn't do is pairing operator new with operator delete[] and vice versa - undefined behavior. Other than that which pair do I choose and why?

    Read the article

  • Why doesn't the conditional operator correctly allow the use of "null" for assignment to nullable ty

    - by Daniel Coffman
    This will not compile, stating "Type of conditional expression cannot be determined because there is no implicit conversion between 'System.DateTime' and ''" task.ActualEndDate = TextBoxActualEndDate.Text != "" ? DateTime.Parse(TextBoxActualEndDate.Text) : null; This works just fine if (TextBoxActualEndDate.Text != "") task.ActualEndDate = DateTime.Parse(TextBoxActualEndDate.Text); else task.ActualEndDate = null;

    Read the article

  • JSON Feed Returning null while using jQuery getJSON

    - by Oscar Godson
    http://portlandonline.com/shared/cfm/json.cfm?c=27321 It's returning null. I don't really have access to this. I have to have a server admin update the feed to my liking, so if you can tell me how to get this to work as is, without adding tags to my HTML please let me know. I will be using this with jQuery, and ive been trying to use getJSON which is what returns null. $.getJSON('http://portlandonline.com/shared/cfm/json.cfm?c=27321',function(json){ alert(json); }); that returns null. But if i use a flickr feed for example, it works fine. it returns what it should, [onject Object]. Any ideas?

    Read the article

  • When would ShowDialog() return null?

    - by Joe White
    WPF's Window.ShowDialog method returns a nullable boolean. So does CommonDialog.ShowDialog. Now, I understand cases where these would return false (user clicked Cancel or pressed Esc), and when they would return true (code sets Window.DialogResult to true, probably in response to OK being clicked). But null? My first thought is that clicking the title bar's Close button might return null. But the docs state (and I confirmed by testing) that the title-bar Close button is treated as a Cancel. So when would Window.ShowDialog or CommonDialog.ShowDialog ever return null?

    Read the article

  • check if(country == @"(null)" doesn't work

    - by Sean
    hi all, I got the problem that the if-statement doesn't work. After the first code line the variable contains the value "(null)", because the user who picked the contact from his iphone address book doesn't set the country key for this contact, so far so good. but if I check the variable, it won't be true, but the value is certainly "(null)"... does someone have an idea? NSString *country = [NSString [the dict objectForKey:(NSString *)kABPersonAddressCountryKey]]; if(country == @"(null)") { country = @""; } thanks in advance sean

    Read the article

  • How to avoid null pointer error

    - by Jessy
    I trying to find whether the elements of 2 arrayLists are match or not. But this code give me error Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException since some of the elements are null. How can I solved this problem? String level []={"High","High","High","High","High","High"}; ArrayList<Object> n = new ArrayList<Object>(Arrays.asList(level)); String choice []={null,"High","Low","High",null,"Medium"}; ArrayList<Object> m = new ArrayList<Object>(Arrays.asList(choice)); //Check if the two arrayList are identical for(int i=0; i<m.size(); i++){ if(!(m.get(i).equals(n.get(i)))){ result= true; break; } } return result; }

    Read the article

  • NULL handling with subselect in Hibernate Criteria API

    - by Jens Schauder
    I'm constructing a Hibernate Criterion, using a subselect as follows DetachedCriteria subselect = DetachedCriteria.forClass(NhmCode.class, "sub"); // the subselect selecting the maximum 'validFrom' subselect.add(Restrictions.le("validFrom", new Date())); // it should be in the past (null needs handling here) subselect.add(Property.forName("sub.lifeCycle").eqProperty("this.id")); // join to owning entity subselect.setProjection(Projections.max("validFrom")); // we are only interested in the maximum validFrom Conjunction resultCriterion = Restrictions.conjunction(); resultCriterion.add(Restrictions.ilike(property, value)); // I have other Restrictions as well resultCriterion.add(Property.forName("validFrom").eq(subselect)); // this fails when validFrom and the subselect return NULL return resultCriterion; It works ok so far, but the restriction on the last line before the return statement is false when validFrom and subselect result in NULL. What I need is a version which handles this case as true. Possibly by applying a NVL or coalesce or similar. How do I do this?

    Read the article

  • Richfaces a4j achtionparam set null value

    - by Jurgen H
    I am trying to reset some values in a form using the a4j:actionParam tag. But it seams that null values never arrive in the target bean. The converter receives it correctly, returns null, but it is never set in the bean. The target is to fill in the start and endDate for different predefined values (last week, last month etc). For the "This week" value, the endDate must be reset to null. <rich:menuItem value="Last week"> <a4j:support event="onclick" reRender="criteriaStartCalendar,criteriaEndCalendar"> <a4j:actionparam name="startDate" value="#{dateBean.lastWeekStart}" assignTo="#{targetBean.startDate}" /> <a4j:actionparam name="endDate" value="#{dateBean.lastWeekEnd}" assignTo="#{targetBean.endDate}" /> </a4j:support> </rich:menuItem>

    Read the article

  • Querying MySQL with CodeIgniter, selecting rows where field is NULL

    - by rebellion
    I'm using CodeIgniter's Active Record class to query the MySQL database. I need to select the rows in a table where a field is not set to NULL: $this->db->where('archived !=', 'NULL'); $q = $this->db->get('projects'); That only returns this query: SELECT * FROM projects WHERE archived != 'NULL'; The archived field is a DATE field. Is there a better way to solve this? I know I can just write the query myself, but I wan't to stick with the Active Record throughout my code.

    Read the article

  • DB4o Linq query - How to check for null strings

    - by Dave
    Hey there - simple query: var q = (from SomeObject o in container where o.SomeInt > 8 && o.SomeString != null //Null Ref here select o; I always get a null reference exception. If I use String.IsNullOrEmpty(o.SomeString) the query takes about 100 times as long, as if I use && o.SomeString != "" (which is way faster, but obviously not correct). I'm guessing because DB4o needs to activate the objects, in order to pass them in to the IsNullOrEmpty call, and can't use the indexes. My question is, what's a better way to check for nulls in this situation? Is there something like: mystring != Db4o.DBNull.Value, or something? Cheers, Dave

    Read the article

  • IS NULL doesn't work as expected in SQL Server 2000 with no Service Pack on it

    - by user306825
    The following batch executed on different instances of SQL Server 2000 illustrates the problem. select @@version create table a (a int) create table b (b int) insert into a(a) values (1) insert into a(a) values (2) insert into a(a) values (3) insert into b(b) values (1) insert into b(b) values (2) select * from a left outer join (select 1 as test, b from b) as j on j.b = a.a where j.test IS NULL drop table a drop table b Output 1: Microsoft SQL Server 2000 - 8.00.194 (Intel X86) Aug 6 2000 00:57:48 Copyright (c) 1988-2000 Microsoft Corporation Developer Edition on Windows NT 6.1 (Build 7600: ) (1 row(s) affected) (1 row(s) affected) (1 row(s) affected) (1 row(s) affected) (1 row(s) affected) (1 row(s) affected) a test b ----------- ----------- ----------- (0 row(s) affected) Output 2: Microsoft SQL Server 2000 - 8.00.2039 (Intel X86) May 3 2005 23:18:38 Copyright (c) 1988-2003 Microsoft Corporation Developer Edition on Windows NT 5.2 (Build 3790: Service Pack 2) (1 row(s) affected) (1 row(s) affected) (1 row(s) affected) (1 row(s) affected) (1 row(s) affected) (1 row(s) affected) a test b ----------- ----------- ----------- 3 NULL NULL (1 row(s) affected) If someone encounters the same problem - make sure you have the SP installed!

    Read the article

  • IS NULL doesn't work as expected in MSSQL 2000 with no Service Pack on it

    - by user306825
    The following batch executed on different instances of mssql 2000 illustrates the problem. select @@version create table a (a int) create table b (b int) insert into a(a) values (1) insert into a(a) values (2) insert into a(a) values (3) insert into b(b) values (1) insert into b(b) values (2) select * from a left outer join (select 1 as test, b from b) as j on j.b = a.a where j.test IS NULL drop table a drop table b Output 1: Microsoft SQL Server 2000 - 8.00.194 (Intel X86) Aug 6 2000 00:57:48 Copyright (c) 1988-2000 Microsoft Corporation Developer Edition on Windows NT 6.1 (Build 7600: ) (1 row(s) affected) (1 row(s) affected) (1 row(s) affected) (1 row(s) affected) (1 row(s) affected) (1 row(s) affected) a test b (0 row(s) affected) Output 2: Microsoft SQL Server 2000 - 8.00.2039 (Intel X86) May 3 2005 23:18:38 Copyright (c) 1988-2003 Microsoft Corporation Developer Edition on Windows NT 5.2 (Build 3790: Service Pack 2) (1 row(s) affected) (1 row(s) affected) (1 row(s) affected) (1 row(s) affected) (1 row(s) affected) (1 row(s) affected) a test b 3 NULL NULL (1 row(s) affected) If someone encounters the same problem - make sure you have the SP installed!

    Read the article

  • Map null column as 0 in a legacy database (JPA)

    - by Indrek
    Using Play! framework and it's JPASupport class I have run into a problem with a legacy database. I have the following class: @Entity @Table(name="product_catalog") public class ProductCatalog extends JPASupport { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) public Integer product_catalog; @OneToOne @JoinColumn(name="upper_catalog") public ProductCatalog upper_catalog; public String name; } Some product catalogs don't have an upper catalog, and this is referenced as 0 in a legacy database. If I supply the upper_catalog as NULL, then expectedly JPA inserts a NULL value to that database column. How could I force the null values to be 0 when writing to the database and the other way around when reading from the database?

    Read the article

  • Why DataTable not showing the NULL values?

    - by thevan
    I have one DataTable Which I gets from the BackEnd. But When I fix the BreakPoint and Visualize the DataTable, It does not show the NULL values. Why is it so? In the BackEnd, My Table looks like below: CustID JobID Qty ---------- -------- ------ 1 NULL 100 2 1 200 But in the FrontEnd, My DataTable looks like below: CustID JobID Qty ---------- -------- ------ 1 100 2 1 200 Why it is not showing the NULL Values? Is there any specific reason? How to show the DataTable as it is like in the BackEnd?

    Read the article

  • Accommodating null values in a list?

    - by h259bws
    Hi, I'm new to Java and Groovy and am running into trouble with the following Groovy script. I created this whittled down version of a larger script to facilitate debugging. The script is iterating through a list trying to calc a running total of the values of all objects in the list. Some or all of these objects' values may be null. Script import org.apache.commons.lang.math.NumberUtils class Field { def name def value } def fields = [ new Field(name:'Annuities %', value:75), new Field(name:'Other %', value:null), ] //def totalFunding = fields.inject(0) {int total, Field myField - // total + NumberUtils.toInt(myField.value,0) as Integer def totalFunding = fields.inject(0) {int total, Field myField - total + myField?.value as Integer } It gets this error: Exception thrown: java.lang.NullPointerException java.lang.NullPointerException at Script3$_run_closure1.doCall(Script3:15) at Script3.run(Script3:14) What is the correct way to accomodate null values? Thanks, Betsy

    Read the article

  • Calculating the null space of a matrix

    - by Ainsworth
    I'm attempting to solve a set of equations of the form Ax = 0. A is known 6x6 matrix and I've written the below code using SVD to get the vector x which works to a certain extent. The answer is approximately correct but not good enough to be useful to me, how can I improve the precision of the calculation? Lowering eps below 1.e-4 causes the function to fail. from numpy.linalg import * from numpy import * A = matrix([[0.624010149127497 ,0.020915658603923 ,0.838082638087629 ,62.0778180312547 ,-0.336 ,0], [0.669649399820597 ,0.344105317421833 ,0.0543868015800246 ,49.0194290212841 ,-0.267 ,0], [0.473153758252885 ,0.366893577716959 ,0.924972565581684 ,186.071352614705 ,-1 ,0], [0.0759305208803158 ,0.356365401030535 ,0.126682113674883 ,175.292109352674 ,0 ,-5.201], [0.91160934274653 ,0.32447818779582 ,0.741382053883291 ,0.11536775372698 ,0 ,-0.034], [0.480860406786873 ,0.903499596111067 ,0.542581424762866 ,32.782593418975 ,0 ,-1]]) def null(A, eps=1e-3): u,s,vh = svd(A,full_matrices=1,compute_uv=1) null_space = compress(s <= eps, vh, axis=0) return null_space.T NS = null(A) print "Null space equals ",NS,"\n" print dot(A,NS)

    Read the article

  • using dummy row with NOT NULL to solve DEFAUT NULL

    - by Tony38
    I know having DEFAULT NULLS is not a good practice but I have many optional lookup values which are FK in the system so to solve this issue here is what i am doing: I use NOT NULL for every FK / lookup valve field. I have the first row in every table which is PK id = 1 as a dummy row with just "none" in all the columns. this way I can use NOT NULL in my schema and if needed reference to the none row values which should be null. Is this a good design or any other work arounds?

    Read the article

  • rails belongs_to sql statement using NULL id

    - by Team Pannous
    When paginating through our Phrase table it takes very long to return the results. In the sql logs we see many sql requests which don't make sense to us: Phrase Load (7.4ms) SELECT "phrases".* FROM "phrases" WHERE "phrases"."id" IS NULL LIMIT 1 User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."id" IS NULL LIMIT 1 These add up significantly. Is there a way to prevent querying against null ids? This is the underlying model: class Phrase < ActiveRecord::Base belongs_to :user belongs_to :response, :class_name => "Phrase", :foreign_key => "next_id" end

    Read the article

  • C++ operator new, object versions, and the allocation sizes

    - by mizubasho
    Hi. I have a question about different versions of an object, their sizes, and allocation. The platform is Solaris 8 (and higher). Let's say we have programs A, B, and C that all link to a shared library D. Some class is defined in the library D, let's call it 'classD', and assume the size is 100 bytes. Now, we want to add a few members to classD for the next version of program A, without affecting existing binaries B or C. The new size will be, say, 120 bytes. We want program A to use the new definition of classD (120 bytes), while programs B and C continue to use the old definition of classD (100 bytes). A, B, and C all use the operator "new" to create instances of D. The question is, when does the operator "new" know the amount of memory to allocate? Compile time or run time? One thing I am afraid of is, programs B and C expect classD to be and alloate 100 bytes whereas the new shared library D requires 120 bytes for classD, and this inconsistency may cause memory corruption in programs B and C if I link them with the new library D. In other words, the area for extra 20 bytes that the new classD require may be allocated to some other variables by program B and C. Is this assumption correct? Thanks for your help.

    Read the article

  • Reflection and Operator Overloads in C#

    - by TenshiNoK
    Here's the deal. I've got a program that will load a given assembly, parse through all Types and their Members and compile a TreeView (very similar to old MSDN site) and then build HTML pages for each node in the TreeView. It basically takes a given assembly and allows the user to create their own MSDN-like library for it for documentation purposes. Here's the problem I've run into: whenever an operator overload is encounted in a defined class, reflection returns that as a "MethodInfo" with the name set to something like "op_Assign" or "op_Equality". I want to be able to capture these and list them properly, but I can't find anything in the MethodInfo object that is returned to accurately identify that I'm looking at an operator. I definitely don't want to just capture everything that starts with "op_", since that will most certainly (at some point) will pick up a method it's not supposed to. I know that other methods and properties that are "special cases" like this one have the "IsSpecialName" property set, but appearantly that's not the case with operators. I've been scouring the 'net and wracking my brain to two days trying to figure this one out, so any help will be greatly appreciated.

    Read the article

  • Type result with Ternary operator in C#

    - by Vaccano
    I am trying to use the ternary operator, but I am getting hung up on the type it thinks the result should be. Below is an example that I have contrived to show the issue I am having: class Program { public static void OutputDateTime(DateTime? datetime) { Console.WriteLine(datetime); } public static bool IsDateTimeHappy(DateTime datetime) { if (DateTime.Compare(datetime, DateTime.Parse("1/1")) == 0) return true; return false; } static void Main(string[] args) { DateTime myDateTime = DateTime.Now; OutputDateTime(IsDateTimeHappy(myDateTime) ? null : myDateTime); Console.ReadLine(); ^ } | } | // This line has the compile issue ---------------+ On the line indicated above, I get the following compile error: Type of conditional expression cannot be determined because there is no implicit conversion between '< null ' and 'System.DateTime' I am confused because the parameter is a nullable type (DateTime?). Why does it need to convert at all? If it is null then use that, if it is a date time then use that. I was under the impression that: condition ? first_expression : second_expression; was the same as: if (condition) first_expression; else second_expression; Clearly this is not the case. What is the reasoning behind this? (NOTE: I know that if I make "myDateTime" a nullable DateTime then it will work. But why does it need it? As I stated earlier this is a contrived example. In my real example "myDateTime" is a data mapped value that cannot be made nullable.)

    Read the article

  • A null value should be considered as 0 when addition of it is done with decimal value.

    - by Harikrishna
    There are three column in the datatable A,B and C. Now each column is type of decimal. Now I am doing like dt.Columns["A"].Expression="B+C"; to make addition of Column B's record and column C's record. Now if there is any value of B or C is null then addition of B and C will be null like B's value is 3 and C's value is null for first row then B+C(3+null) will be null which is not appropriate, the result of addition should be 3.If I replace 0 instead of null then it will be ok.But whereever there is null value in the records it should be remain it is and it should not be replaced by 0.That is null value should not be replaced by 0 and when addition of null value is done with any decimal value null value should be considered as 0. Is it possible,how can we do this ?

    Read the article

  • Can PCRE regex match a null character?

    - by Keng
    I have a text source with nulls in it and I need to pull them out along with my regex pattern. Can regex even match a null character? I only realized I had them when my pattern refused to match and when I pasted it into Notepad++ it showed all the null characters.

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >