RE: LINQ select nullable Id
Try this: int? id = (from t in things where t.Name == Foo select t.Id) .ToArray() .Concat(new int?[] { null }) .First(); Cheers. James. From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com] On Behalf Of Greg Keogh Sent: Monday, 4 March 2013 18:20 To: ozDotNet Subject: LINQ select nullable Id Folks, I want to select the int Id of an entity in a DbSet, or int? null if it's not found. Like this wrong sample: int? id = (from t in things where t.Name == Foo select t.Id).FirstOrDefault(); In this case I get int zero if there is no match but I want null. Is there some way of rearranging this to get an Id or null? Remember that the query has to convertible down to SQL. Greg K
Re: Custom Attribute
I was playing with Attributes to understand when they were created and found they were only created when someone looked for them. So I'd guess you'd need to ensure something does reevaluate the attribute. I'd guess you might have to mark the attribute, or its usage, in some way as not permanent for code access purposes. On 4 March 2013 13:47, Stephen Price step...@perthprojects.com wrote: Hey all, I've written a custom attribute that duplicates the behaviour of PrincipalPermissionAttribute (It checks the user roles against my own Authentication service instead of looking at the Thread.CurrentPrincipal) I've noticed that it works but only seems to check the first time you access the method its decorating. Its like it assumes it has permission first time so will have access from then on. Problem being if the user logs out and logs back in as someone who isn't in the correct role, it doesn't check and lets them in when if it were to check, it would fail. Is there some kind of message or something to signal that the CodeAccessSecurityAttribute (the one i'm inheriting as PrincipalPermissionAttribute is sealed) should reevaluate it? Not even sure what to search for on Google... I've found a couple of similar implementations but nothing mentions this issue that I've found. cheers, Stephen -- Regards, Mark Hurd, B.Sc.(Ma.)(Hons.)
Re: LINQ select nullable Id
Hi Greg. FirstOrDefault() will return 0 for non null Ints, So I'm guessing that t.Id is an (int). So you're going to have to do something like this. ListAB abs = new ListAB(); for (int i = 0; i 10; i++) { abs.Add(new AB { Id = i }); } int? id = null; IEnumerableint output = from t in abs where t.Id == 1000 select t.Id; if(output.Any()) { id = output.First(); } Assert.IsNull(id); or This. public static int? FirstOrNull(this IEnumerableint query) { if (query.Any()) { return query.First(); } return null; } int? alternative = (from t in abs where t.Id == 1000 select t.Id).FirstOrNull(); hth. Davy, The US Congress voted Pizza sauce a vegetable. Don't even try to convince me of anything in the states is sane any more! On Mon, Mar 4, 2013 at 11:20 AM, James Chapman-Smith ja...@chapman-smith.com wrote: Try this: ** ** int? id = (from t in things where t.Name == Foo select t.Id) .ToArray() .Concat(new int?[] { null }) .First(); ** ** Cheers. ** ** James. ** ** *From:* ozdotnet-boun...@ozdotnet.com [mailto: ozdotnet-boun...@ozdotnet.com] *On Behalf Of *Greg Keogh *Sent:* Monday, 4 March 2013 18:20 *To:* ozDotNet *Subject:* LINQ select nullable Id ** ** Folks, I want to select the int Id of an entity in a DbSet, or int? null if it's not found. Like this *wrong* sample: int? id = (from t in things where t.Name == Foo select t.Id).FirstOrDefault(); In this case I get int zero if there is no match but I want null. Is there some way of rearranging this to get an Id or null? Remember that the query has to convertible down to SQL. Greg K
Re: LINQ select nullable Id
int? id = (from t in things where t.Name == Foo select new int?(t.Id)).FirstOrDefault(); On 4 March 2013 18:19, Greg Keogh g...@mira.net wrote: Folks, I want to select the int Id of an entity in a DbSet, or int? null if it's not found. Like this wrong sample: int? id = (from t in things where t.Name == Foo select t.Id).FirstOrDefault(); In this case I get int zero if there is no match but I want null. Is there some way of rearranging this to get an Id or null? Remember that the query has to convertible down to SQL. Greg K -- Regards, Mark Hurd, B.Sc.(Ma.)(Hons.)
Does anybody know why the visual studio 2012 developer command prompt points to a 32-bit path when on a 64-bit OS?
I was wondering if this is the case with anyone else using the 64 bit version of Windows 8, it's the case for me, and I think that if the OS is 64 bit, then shouldn't most of the tools and applications running on it also be? Thanks for your input.
Re: Does anybody know why the visual studio 2012 developer command prompt points to a 32-bit path when on a 64-bit OS?
AFAIK, Visual Studio is still a 32bit application, so possibly related. On Tue, Mar 5, 2013 at 5:31 AM, Katherine Moss katherine.m...@gordon.eduwrote: I was wondering if this is the case with anyone else using the 64 bit version of Windows 8, it's the case for me, and I think that if the OS is 64 bit, then shouldn't most of the tools and applications running on it also be? Thanks for your input.
RE: Does anybody know why the visual studio 2012 developer command prompt points to a 32-bit path when on a 64-bit OS?
Dang, it shouldn't be. What was Microsoft on when they made that decision? LOL. From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com] On Behalf Of Craig van Nieuwkerk Sent: Monday, March 04, 2013 4:10 PM To: ozDotNet Subject: Re: Does anybody know why the visual studio 2012 developer command prompt points to a 32-bit path when on a 64-bit OS? AFAIK, Visual Studio is still a 32bit application, so possibly related. On Tue, Mar 5, 2013 at 5:31 AM, Katherine Moss katherine.m...@gordon.edumailto:katherine.m...@gordon.edu wrote: I was wondering if this is the case with anyone else using the 64 bit version of Windows 8, it's the case for me, and I think that if the OS is 64 bit, then shouldn't most of the tools and applications running on it also be? Thanks for your input.
Re: Does anybody know why the visual studio 2012 developer command prompt points to a 32-bit path when on a 64-bit OS?
I thought there was an intent to release an x64 version this time around, but a fast google didn't show one. On Tue, Mar 5, 2013 at 8:59 AM, Katherine Moss katherine.m...@gordon.eduwrote: Dang, it shouldn’t be. What was Microsoft on when they made that decision? LOL. ** ** *From:* ozdotnet-boun...@ozdotnet.com [mailto: ozdotnet-boun...@ozdotnet.com] *On Behalf Of *Craig van Nieuwkerk *Sent:* Monday, March 04, 2013 4:10 PM *To:* ozDotNet *Subject:* Re: Does anybody know why the visual studio 2012 developer command prompt points to a 32-bit path when on a 64-bit OS? ** ** AFAIK, Visual Studio is still a 32bit application, so possibly related.*** * On Tue, Mar 5, 2013 at 5:31 AM, Katherine Moss katherine.m...@gordon.edu wrote: I was wondering if this is the case with anyone else using the 64 bit version of Windows 8, it's the case for me, and I think that if the OS is 64 bit, then shouldn't most of the tools and applications running on it also be? Thanks for your input. ** ** -- Meski http://courteous.ly/aAOZcv Going to Starbucks for coffee is like going to prison for sex. Sure, you'll get it, but it's going to be rough - Adam Hills
Re: Does anybody know why the visual studio 2012 developer command prompt points to a 32-bit path when on a 64-bit OS?
When I download from MSDN it only lists 32 bit versions. On Tue, Mar 5, 2013 at 9:02 AM, mike smith meski...@gmail.com wrote: I thought there was an intent to release an x64 version this time around, but a fast google didn't show one. On Tue, Mar 5, 2013 at 8:59 AM, Katherine Moss katherine.m...@gordon.eduwrote: Dang, it shouldn’t be. What was Microsoft on when they made that decision? LOL. ** ** *From:* ozdotnet-boun...@ozdotnet.com [mailto: ozdotnet-boun...@ozdotnet.com] *On Behalf Of *Craig van Nieuwkerk *Sent:* Monday, March 04, 2013 4:10 PM *To:* ozDotNet *Subject:* Re: Does anybody know why the visual studio 2012 developer command prompt points to a 32-bit path when on a 64-bit OS? ** ** AFAIK, Visual Studio is still a 32bit application, so possibly related.** ** On Tue, Mar 5, 2013 at 5:31 AM, Katherine Moss katherine.m...@gordon.edu wrote: I was wondering if this is the case with anyone else using the 64 bit version of Windows 8, it's the case for me, and I think that if the OS is 64 bit, then shouldn't most of the tools and applications running on it also be? Thanks for your input. ** ** -- Meski http://courteous.ly/aAOZcv Going to Starbucks for coffee is like going to prison for sex. Sure, you'll get it, but it's going to be rough - Adam Hills
RE: Does anybody know why the visual studio 2012 developer command prompt points to a 32-bit path when on a 64-bit OS?
We have no intention on delivering a x64 version. From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com] On Behalf Of Craig van Nieuwkerk Sent: Monday, March 4, 2013 2:05 PM To: ozDotNet Subject: Re: Does anybody know why the visual studio 2012 developer command prompt points to a 32-bit path when on a 64-bit OS? When I download from MSDN it only lists 32 bit versions. On Tue, Mar 5, 2013 at 9:02 AM, mike smith meski...@gmail.commailto:meski...@gmail.com wrote: I thought there was an intent to release an x64 version this time around, but a fast google didn't show one. On Tue, Mar 5, 2013 at 8:59 AM, Katherine Moss katherine.m...@gordon.edumailto:katherine.m...@gordon.edu wrote: Dang, it shouldn't be. What was Microsoft on when they made that decision? LOL. From: ozdotnet-boun...@ozdotnet.commailto:ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.commailto:ozdotnet-boun...@ozdotnet.com] On Behalf Of Craig van Nieuwkerk Sent: Monday, March 04, 2013 4:10 PM To: ozDotNet Subject: Re: Does anybody know why the visual studio 2012 developer command prompt points to a 32-bit path when on a 64-bit OS? AFAIK, Visual Studio is still a 32bit application, so possibly related. On Tue, Mar 5, 2013 at 5:31 AM, Katherine Moss katherine.m...@gordon.edumailto:katherine.m...@gordon.edu wrote: I was wondering if this is the case with anyone else using the 64 bit version of Windows 8, it's the case for me, and I think that if the OS is 64 bit, then shouldn't most of the tools and applications running on it also be? Thanks for your input. -- Meski http://courteous.ly/aAOZcv Going to Starbucks for coffee is like going to prison for sex. Sure, you'll get it, but it's going to be rough - Adam Hills
Re: Does anybody know why the visual studio 2012 developer command prompt points to a 32-bit path when on a 64-bit OS?
Heh. My question would be Why? And should third part software manufacturers that write code for Windows follow your lead in this? Yes, I know that the x86 version of VS2012 produces x64 code, but certain aspects of VS2012 are poorly integrated with its production. Resource editing with controls, for instance. On Tue, Mar 5, 2013 at 9:14 AM, David Kean david.k...@microsoft.com wrote: We have no intention on delivering a x64 version. ** ** *From:* ozdotnet-boun...@ozdotnet.com [mailto: ozdotnet-boun...@ozdotnet.com] *On Behalf Of *Craig van Nieuwkerk *Sent:* Monday, March 4, 2013 2:05 PM *To:* ozDotNet *Subject:* Re: Does anybody know why the visual studio 2012 developer command prompt points to a 32-bit path when on a 64-bit OS? ** ** When I download from MSDN it only lists 32 bit versions. On Tue, Mar 5, 2013 at 9:02 AM, mike smith meski...@gmail.com wrote: I thought there was an intent to release an x64 version this time around, but a fast google didn't show one. ** ** ** ** ** ** On Tue, Mar 5, 2013 at 8:59 AM, Katherine Moss katherine.m...@gordon.edu wrote: Dang, it shouldn’t be. What was Microsoft on when they made that decision? LOL. *From:* ozdotnet-boun...@ozdotnet.com [mailto: ozdotnet-boun...@ozdotnet.com] *On Behalf Of *Craig van Nieuwkerk *Sent:* Monday, March 04, 2013 4:10 PM *To:* ozDotNet *Subject:* Re: Does anybody know why the visual studio 2012 developer command prompt points to a 32-bit path when on a 64-bit OS? AFAIK, Visual Studio is still a 32bit application, so possibly related.*** * On Tue, Mar 5, 2013 at 5:31 AM, Katherine Moss katherine.m...@gordon.edu wrote: I was wondering if this is the case with anyone else using the 64 bit version of Windows 8, it's the case for me, and I think that if the OS is 64 bit, then shouldn't most of the tools and applications running on it also be? Thanks for your input. ** ** -- Meski http://courteous.ly/aAOZcv Going to Starbucks for coffee is like going to prison for sex. Sure, you'll get it, but it's going to be rough - Adam Hills ** ** -- Meski http://courteous.ly/aAOZcv Going to Starbucks for coffee is like going to prison for sex. Sure, you'll get it, but it's going to be rough - Adam Hills
RE: (sorry slightly off topic) Laptop Backpack
Standbags has a Navarro backpack for about AU$40 which survived roughly 600km of backpacking and music festivals while protecting a 15 laptop, external hard drive and DSLR +lenses. Handled travelling much better than a Targus pack I paid 3-4x as much for on my last trip. Still using it as my day pack for work now, only major wear is the mesh water bottle nets on the side. I'm pretty sure they have stores in NZ as well, don't know if they'd have the same stock but worth a shot. From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com] On Behalf Of Preet Sangha Sent: Tuesday, 5 March 2013 7:36 AM To: ozDotNet Subject: (sorry slightly off topic) Laptop Backpack I need a new laptop bag (the previous one that came with MSI Laptop has has finally given up the ghost). Does anyone here walk or cycle distances (I'm doing 15k a day) carrying their laptop in a backpack? If so would you recommend you case? Ideally I need enough space to pack a towel and a bit of running gear too :-) yes I know I probably need a military style burgen but no I'm not getting one of those. -- regards, Preet, Overlooking the Ocean, Auckland Click herehttps://www.mailcontrol.com/sr/MZbqvYs5QwJvpeaetUwhCQ== to report this email as spam. This message has been scanned for malware by Websense. www.websense.com
RE: Does anybody know why the visual studio 2012 developer command prompt points to a 32-bit path when on a 64-bit OS?
http://blogs.msdn.com/b/ricom/archive/2009/06/10/visual-studio-why-is-there-no-64-bit-version.aspx What’s the Resource Editing with controls issue? From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com] On Behalf Of mike smith Sent: Monday, March 4, 2013 2:21 PM To: ozDotNet Subject: Re: Does anybody know why the visual studio 2012 developer command prompt points to a 32-bit path when on a 64-bit OS? Heh. My question would be Why? And should third part software manufacturers that write code for Windows follow your lead in this? Yes, I know that the x86 version of VS2012 produces x64 code, but certain aspects of VS2012 are poorly integrated with its production. Resource editing with controls, for instance. On Tue, Mar 5, 2013 at 9:14 AM, David Kean david.k...@microsoft.commailto:david.k...@microsoft.com wrote: We have no intention on delivering a x64 version. From: ozdotnet-boun...@ozdotnet.commailto:ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.commailto:ozdotnet-boun...@ozdotnet.com] On Behalf Of Craig van Nieuwkerk Sent: Monday, March 4, 2013 2:05 PM To: ozDotNet Subject: Re: Does anybody know why the visual studio 2012 developer command prompt points to a 32-bit path when on a 64-bit OS? When I download from MSDN it only lists 32 bit versions. On Tue, Mar 5, 2013 at 9:02 AM, mike smith meski...@gmail.commailto:meski...@gmail.com wrote: I thought there was an intent to release an x64 version this time around, but a fast google didn't show one. On Tue, Mar 5, 2013 at 8:59 AM, Katherine Moss katherine.m...@gordon.edumailto:katherine.m...@gordon.edu wrote: Dang, it shouldn’t be. What was Microsoft on when they made that decision? LOL. From: ozdotnet-boun...@ozdotnet.commailto:ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.commailto:ozdotnet-boun...@ozdotnet.com] On Behalf Of Craig van Nieuwkerk Sent: Monday, March 04, 2013 4:10 PM To: ozDotNet Subject: Re: Does anybody know why the visual studio 2012 developer command prompt points to a 32-bit path when on a 64-bit OS? AFAIK, Visual Studio is still a 32bit application, so possibly related. On Tue, Mar 5, 2013 at 5:31 AM, Katherine Moss katherine.m...@gordon.edumailto:katherine.m...@gordon.edu wrote: I was wondering if this is the case with anyone else using the 64 bit version of Windows 8, it's the case for me, and I think that if the OS is 64 bit, then shouldn't most of the tools and applications running on it also be? Thanks for your input. -- Meski http://courteous.ly/aAOZcv Going to Starbucks for coffee is like going to prison for sex. Sure, you'll get it, but it's going to be rough - Adam Hills -- Meski http://courteous.ly/aAOZcv Going to Starbucks for coffee is like going to prison for sex. Sure, you'll get it, but it's going to be rough - Adam Hills
RE: (sorry slightly off topic) Laptop Backpack
I have been using a Tatkonka Server Pack for the last 10yrs, one word perfect! For me I ride a motorcycle (150klms a day) rain hail or shine with it and it has carried all my laptops over the years from my current 13in dell xps, to a asus 17in. It goes everywhere with me, it's my man bag, I have done several overseas trips with it as well. It's quite comfortable, I would mind getting a new one as I have 1 zip that has an issue with it, they don't make them any more (I have been unable to find a new one) , the only thing that has come close is the http://www.kriega.com/ motorcycle backpacks - but it's a touch smaller than what I have been used to so I keep putting it off. The thing with Kriega is they are designed to sit on your back without you knowing it, they extremely well made and comfortable. Good luck Dave From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com] On Behalf Of Preet Sangha Sent: Tuesday, 5 March 2013 7:36 AM To: ozDotNet Subject: (sorry slightly off topic) Laptop Backpack I need a new laptop bag (the previous one that came with MSI Laptop has has finally given up the ghost). Does anyone here walk or cycle distances (I'm doing 15k a day) carrying their laptop in a backpack? If so would you recommend you case? Ideally I need enough space to pack a towel and a bit of running gear too :-) yes I know I probably need a military style burgen but no I'm not getting one of those. -- regards, Preet, Overlooking the Ocean, Auckland
RE: Does anybody know why the visual studio 2012 developer command prompt points to a 32-bit path when on a 64-bit OS?
But this would also be a good place for this discussion, maybe? Since I am planning on learning how to develop on the .net framework for now, should I try learning, since there are a few ways in which one could compile an application, does it matter whether 32 bit, 64 bit, or the any CPU option is used? And what benefit would one over the other provide? From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com] On Behalf Of David Kean Sent: Monday, March 04, 2013 5:49 PM To: ozDotNet Subject: RE: Does anybody know why the visual studio 2012 developer command prompt points to a 32-bit path when on a 64-bit OS? http://blogs.msdn.com/b/ricom/archive/2009/06/10/visual-studio-why-is-there-no-64-bit-version.aspx What’s the Resource Editing with controls issue? From: ozdotnet-boun...@ozdotnet.commailto:ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com] On Behalf Of mike smith Sent: Monday, March 4, 2013 2:21 PM To: ozDotNet Subject: Re: Does anybody know why the visual studio 2012 developer command prompt points to a 32-bit path when on a 64-bit OS? Heh. My question would be Why? And should third part software manufacturers that write code for Windows follow your lead in this? Yes, I know that the x86 version of VS2012 produces x64 code, but certain aspects of VS2012 are poorly integrated with its production. Resource editing with controls, for instance. On Tue, Mar 5, 2013 at 9:14 AM, David Kean david.k...@microsoft.commailto:david.k...@microsoft.com wrote: We have no intention on delivering a x64 version. From: ozdotnet-boun...@ozdotnet.commailto:ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.commailto:ozdotnet-boun...@ozdotnet.com] On Behalf Of Craig van Nieuwkerk Sent: Monday, March 4, 2013 2:05 PM To: ozDotNet Subject: Re: Does anybody know why the visual studio 2012 developer command prompt points to a 32-bit path when on a 64-bit OS? When I download from MSDN it only lists 32 bit versions. On Tue, Mar 5, 2013 at 9:02 AM, mike smith meski...@gmail.commailto:meski...@gmail.com wrote: I thought there was an intent to release an x64 version this time around, but a fast google didn't show one. On Tue, Mar 5, 2013 at 8:59 AM, Katherine Moss katherine.m...@gordon.edumailto:katherine.m...@gordon.edu wrote: Dang, it shouldn’t be. What was Microsoft on when they made that decision? LOL. From: ozdotnet-boun...@ozdotnet.commailto:ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.commailto:ozdotnet-boun...@ozdotnet.com] On Behalf Of Craig van Nieuwkerk Sent: Monday, March 04, 2013 4:10 PM To: ozDotNet Subject: Re: Does anybody know why the visual studio 2012 developer command prompt points to a 32-bit path when on a 64-bit OS? AFAIK, Visual Studio is still a 32bit application, so possibly related. On Tue, Mar 5, 2013 at 5:31 AM, Katherine Moss katherine.m...@gordon.edumailto:katherine.m...@gordon.edu wrote: I was wondering if this is the case with anyone else using the 64 bit version of Windows 8, it's the case for me, and I think that if the OS is 64 bit, then shouldn't most of the tools and applications running on it also be? Thanks for your input. -- Meski http://courteous.ly/aAOZcv Going to Starbucks for coffee is like going to prison for sex. Sure, you'll get it, but it's going to be rough - Adam Hills -- Meski http://courteous.ly/aAOZcv Going to Starbucks for coffee is like going to prison for sex. Sure, you'll get it, but it's going to be rough - Adam Hills