.net

Why can't I use LINQ on ListView.SelectedItems?

I am trying to do use .Select extension method on ListView.SelectedItems which is SelectedListViewItemCollection, but .Select doesn't show up in intellisense. I can use foreach on SelectedListViewItemCollection, so it must have implemented IEnumerable. I just checked on MSDN, and it certainly does. Then why can't the LINQ extension meth...

WCF AuthorizationContext not cleared between calls from different clients. (was: When does a WCF service session actually end?)

I was doing some unit testing, and ran into an interesting problem in WCF. I have a service using the wsHttpBinding, configured as such: <bindings> <wsHttpBinding> <binding name="wsHttpUnsecured"> <security mode="None"> <transport clientCredentialType="None" /> <message clientCredentialType="None" /> <...

Is there an equivalent of BitBlt in WPF?

Is there a way to invert a region of the screen using WPF? In Win32, I would do BitBlt ( .... DSTINVERT ...). Of course, I would use Interop but that seems pretty messy. ...

.Net Programming: What to validate on an SSL self-signed certificate

I cannot get the users to create real certs for their servers but I'd like to do some security checks. So the following is too light because, as I read it, there is no checking on the certs. ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }; What do you recommend that I have the clients check on the x...

NHibernate: How to insert a new Set member after containing object is created?

I have a Person class which has a Tags property public virtual System.Collections.Generic.List<Tag> Tags { get; set; } which contains a collection of Tag class objects. Given the system design, the instance of the Person class is created initially and then at a later time the user can add tags to a Person. Being new to NHibernate I ...

.NET 3.5/C#: Is there a performance difference between if() == and !=

When using an if() statement is it better from a performance perspective to use == or != if(object==null) or if(object!=null) Should the statement w/ the highest probability of success be first in the if() sequence? ...

Does the Entity Framework have an equivalent of DataContext.GetTable<TEntity> from Linq2Sql (ObjectContext.CreateQuery<T>?)

Hi, I'm looking for an equivalent of the DataContext.GetTable<TEntity> in Entity Framework. I've found the ObjectContext.CreateQuery<T> method but it is different from DataContext.GetTable<TEntity> since it needs a querystring to work. Is there a way to get an IQueryable object for a table using the entity type without specifying the qu...

Using regular expressions to get a word in between two Key words

It has been a while since I have used regular expressions and I'm hoping what I'm trying to do is possible. I have a program that sends automated response regarding a particular file and I'd like to grab the text between two words I know will never change. In this example those words are "regarding" and "sent" Dim subject As String = "...

Storing settings: XML vs. SQLite?

I am currently writing an IRC client and I've been trying to figure out a good way to store the server settings. Basically a big list of networks and their servers as most IRC clients have. I had decided on using SQLite but then I wanted to make the list freely available online in XML format (and perhaps definitive), for other IRC apps ...

How to distribute a .NET Windows Forms application that talks to Oracle?

Hi, I'm building a small .NET Windows Forms application that talks to an Oracle database. I understand that I can use System.Data.OracleClient.dll to talk to Oracle, but it won't work without the Oracle Client installed. The Oracle Client is huge, is there any way I distribute my app (say in a zip file) without it being gigantic? i.e....

Visual Studio 2008 & Override LanguageService for Existing File Extension

Hi, I write simple LanguageService for JavaScript language. Target IDE is Visual Studio 2008. I want to run my LanguageService for .js extension file(default extension for JavaScript language). But for this extension my LanguageService don't working. When I run my LanguageService for extension .jsp(could be any extension don't supportin...

How do you get the fully qualified method name when an exception happens

Hello, I have a global HandledExceptionHandler. In the catch part of my try catch block I would like to pass the fully qualifed method name where the exception occurred. How do you do that? Can it be done without reflection. HEre is an example of what I am looking for... Public Sub MySub Try 'some error happens Catch ...

Is it possible to write map/reduce jobs for Amazon Elastic MapReduce using .NET?

Is it possible to write map/reduce jobs for Amazon Elastic MapReduce (http://aws.amazon.com/elasticmapreduce/) using .NET languages? In particular I would like to use C#. Preliminary research suggests not. The above URL's marketing text suggests you have a "choice of Java, Ruby, Perl, Python, PHP, R, or C++", without mentioning .NET lan...

C# .NET - Membership.ValidateUser returns false in web; true in visual studio

When running a web in visual studio, the following line returns true. if (Membership.ValidateUser(Login1.UserName, Login1.Password)) However, the moment I access the same code through a web, it returns false. Same database, same computer, same web folder, the only difference is that when I'm running through debug in visual studio, it...

Why is unmanaged exception call stack is missing relevant information when caught in managed code?

I have an application that consists of managed and unmanaged DLLs. My managed DLL is a C++/CLR DLL that is used to access a native C++ DLL. When code crosses from managed to native the logic is wrapped in a try/catch statement. The purpose is to log any exceptions before we rethrow them. C++/CLR code calling into native code. try ...

Specify required base class for .NET attribute targets

I tried to create a custom .NET attribute with the code below but accidentally left off the subclass. This generated an easily-fixed compiler error shown in the comment. // results in compiler error CS0641: Attribute 'AttributeUsage' is // only valid on classes derived from System.Attribute [AttributeUsage(AttributeTargets.Class)] int...

VB.Net: Dynamically Select Image from My.Resources

I have a group of images in my My.Resources. I want to select select images to display dynamically at run time. How do I do this? 'Static (Compile time) Assignment UltraPictureBox1.Image = my.Resources.zoo_picture_1 'Dynamic (Runtime) Assignment UltraPictureBox1.Image = ??? ...

Babel Obfuscator crash

hi, currently i try to use the Babel Obfuscator. my options are --not --nostringencrypt --ildasm but an appcrash(babel) is the result. my project is a WPF(.net 3.5) project - size 1029kb. Description: Stopped working Problem signature: Problem Event Name: APPCRASH Application Name: babel.exe Application Version: 1.5.0.0 ...

Getting Work as a .NET Developer

This probably should've been asked as a followup to my previous question (http://stackoverflow.com/questions/1185433/knowledge-and-skills-in-cvs) but I thought I would start afresh. I'm in a situation where I have a CS degree and a years experience however the experience I've gained in this position has been with mostly open source (or ...

ASP.NET DropDownValue is not persisted across one server in webfarm

I have a problem that a DropDownList is losing its SelectedValue after a PostBack on one server on the web farm. On the other servers, everything is working correctly. All servers are on the same version of code with the same service packs and all updates applied. The code also works correctly when I run on my local machine (but point ...