null

match tuple with null

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. ...

LINQ to SQL: If database return no values Count() throws an exception

I have a linq to sql statement which returns a set of Customer details to a customer object var customers = from ..... I then use if(customers.Count() > 0) { return customers.First(); } else { return null; } but customers.Count() throws a 'customers.Count()' threw an exception of type 'System.NotSupportedException' int ...

What is null in c#, java?

Like... is it 0 like in C++? Or is it some "special" object? Or maybe something totally different? -- EDIT -- I do know what it is, the question is rather - how it's done ...

netbeans & java, resourceMap.getString returning null

Product Version: NetBeans IDE 6.8 (Build 200912041610) Java: 1.6.0_17; Java HotSpot(TM) Client VM 14.3-b01 System: Windows 7 version 6.1 running on x86; Cp1252; en_GB (nb) Hello, newbee java programmer here and wondering if someone can help, I have been having some problems updating a GUI for a desktop application in netbeans, here are ...

PHP eval returns null but a return is called

Hi all, I have a, I think fairly easy, question, but I can't figure out what I'm doing wrong. I have a function which i call with PHP's function eval. I'm expecting an, selfbuilt, ArrayList to get as a result. But instead when I use gettype I see the result is NULL. Even though I'm using return in the eval-ed function. As far as I'm a...

vb .net null condition

this is my code - Dim provider As CultureInfo = CultureInfo.InvariantCulture Dim a1 As DateTime = Nothing insexp = DateTime.ParseExact(date1.SelectedValue, "MMMM yyyy", provider) If a1.Month = Today.Month AndAlso a1.Year = Today.Year Then a1 = Today.Date End If ...

Why doesn't Postgres Group By NULL select counts?

I am trying to get a count of each value in a table using the following SQL: SELECT col, COUNT(col) FROM table GROUP BY col (There's a WHERE clause in the real code, but it has no impact). When I run this I get results like so: a - 5 b - 4 <null> - 0 It doesn't matter how many null entries I have, it always shows a coun...

how to add nil to nsmutablearray?

NSArray *array = [[NSArray alloc] initWithObjects:@"ΕΛΤΑ", @"ΕΛΤΑ COURIER", @"ACS", @"ACS ΕΞΩΤΕΡΙΚΟ", @"DHL", @"INTERATTICA", @"SPEEDEX", @"UPS", @"ΓΕΝΙΚΗ ΤΑΧΥΔΡΟΜΙΚΗ", @"ΜΕΤΑΦΟΡΙΚΕΣ ΕΞΩΤΕΡΙΚΟΥ", nil]; This is working because it has nil at the end. But I add objects l...

How can DBNull not equal DBNull

I have the following line of code if (DBNull.Value.Equals(o) || o != null) where o is object o in row.ItemArray I keep getting an error of --> Xml type "List of xdt:untypedAtomic" does not support a conversion from Clr type "DBNull" to Clr type "String". What I don't understand is that when I step through my code this if should be...

StreamWriter sending null messages when closing

I've written a simple chat program to experiment with some basic tcp/socket concepts. For some reason I've found that when I close my writer stream (which I am getting from the TcpClient.GetStream() function) it will send one final null message to my server. To top it all off it doesn't do this if I send one final message over the stream...

Clearing Textbox does not set binding to null

I am having difficulty setting an empty TextBox to null on an nullable DB Field. XAML <y:TextBox Text="{Binding Year1Cost, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True, StringFormat=\{0:c\}}" Grid.Row="3" Grid...

Access Nz() function doesn't work in query

I have lots of orders in tblOrders and a few deliveries in tblDeliveries. SELECT tblOrders.SkuBestelId, Sum(tblDeliveries.delivered) AS TotalDelivered FROM tblOrders INNER JOIN tblDeliveries ON tblOrders.SkuBestelId = tblDeliveries.SkuBestelId GROUP BY tblOrders .SkuBestelId; Of course, this gives me lots of "TotalDelivered" fields wi...

Linq error generic parameter or the query must use a nullable type

I got this error when i use sum function in linq. The cast to value type 'Decimal' failed because the materialized value is null. Either the result type's generic parameter or the query must use a nullable type. GroupProduct.Where(a => a.Product.ProductID==1).Sum(Content => Content.Amount==null?0:Content.Amount), ...

Deep Null checking, is there a better way?

We've all been there, we have some deep property like cake.frosting.berries.loader that we need to check if it's null so there's no exception. The way to do is is to use a short-circuiting if statement if (cake != null && cake.frosting != null && cake.frosting.berries != null) ... This strikes me however as not very elegant, there sh...

Multiple Pointer Test in If Statment

considering a pointer to a struct struct a_struct { int A; }; Is it ok to do : struct a_struct *ptr; //... if( ptr != NULL && ptr->A == 1) { //work with ptr struct } or should you Test if the pointer is valid before testing for on of its field. if(ptr != NULL) { if(ptr->A == 1) { ...

In SQL, how do I allow for nulls in the parameter?

I have what seems to be a really easy SQL query I can't figure out and its driving me nuts. This is SQL 2008. Basically, there is a status field where the can pick "pending", "satisfied" or all. If they send in "pending" or "satisfied" there's no problem. But when they pick all I'm having problems. Mostly because I can't figure out how ...

How can I set null to an optional stored procedure parameter via crystal reports8.5 and vb6 ?

hi Is there any way to send null to an optional stored procedure parameter via crystal reports8.5 and vb6? I use CRXParamDef.AddCurrentValue method to send stored procedure parameter values. ...

checking for a null object in C++

Hi all, I've mostly only worked with C, and am running into some unfamiliar issues in C++. Let's say that I have some function like this in C, which would be very typical: int some_c_function(const char* var) { if (var == NULL) { /* exit early so we don't dereference a null pointer */ } /* rest of code */ } and l...

C# ExecuteQuery null value

I have some code: using (OAZISDBDataContext ctx = new OAZISDBDataContext()) { IEnumerable<DBContactDetail> details = ctx.ExecuteQuery<DBContactDetail>("exec [dbo].[zna_contact] {0}, {1}", "test", "19601023", } However I also want to be able to pass empty ...

python : mysql : Return 0 when no rows found

Table structure - Data present for 5 min. slots - data_point | point_date 12 | 00:00 14 | 00:05 23 | 00:10 10 | 00:15 43 | 00:25 10 | 00:40 When I run the query for say 30 mins. and if data is present I'll get 6 rows (one row for each 5 min. stamp). Simple Query -...