.net

Can't connect to SQL Server 2008 from .NET 3.5

I installed SQL Server 2008 Management Studio, and uninstalled 2005 as a consequence my .net application with a local SQL Server express doesn’t work anymore. I tried with nothwind 2008 sample at my App_Data folder. The connection string is : Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\NORTHWND.MDF;Integrated Security=Tr...

Does array resizing invoke the GC?

Hi, I looked into the implementation of Array.Resize() and noticed that a new array is created and returned. I'm aiming for zero memory allocation during gameplay and so I need to avoid creating any new reference types. Does resizing an array trigger the Garbage Collector on the previous array? I'm creating my own 2D array resizer, but ...

Best ORM for .NET Windows Forms applications?

Which one is the best .NET ORM for using in a Windows Forms application? I like NHibernate, but it seems that NHibernate is mostly used in web applications. ...

Behavior of DebugBreak differs between unmanaged and mixed (unmanaged+managed) application?

Take the following simple source (name it test.cpp): #include <windows.h> void main() { DebugBreak(); } Compile and link this using the following commands: cl /MD /c test.cpp link /debug test.obj If TEST.EXE is now run (on a 64-bit Windows 7 system), you get the following dialog: Now add the following source file (name it test2...

Need help with a regular expression

I'm pulling out my hair over the following function: Public Function SetVersion(ByVal hl7Message As String, ByVal newVersion As String) As String Dim rgx = New Regex("^(?<pre>.+)(\|\d\.\d{1,2})$", RegexOptions.Multiline) Dim m = rgx.Match(hl7Message) Return rgx.Replace(hl7Message, "${pre}|" & newVersion, 1, 0) End Function ...

Will struct modifications in C# affect unmanaged memory?

My gut reaction is no, because managed and unmanaged memory are distinct, but I'm not sure if the .NET Framework is doing something with Marshaling behind the scenes. What I believe happens is: When getting a struct from my unmanaged DLL, it is the same as making that call gets an IntPtr and then uses it and the Marshal class to copy th...

Is it possible to have a property that is IEnumerable<T>?

I have a class that's IEnumerable<T> where I want to have different properties that provides a filtered IEnumerable<T> access. So for instance: class Shape ShapeType = Box/Sphere/Pyramid class ShapeCollection : IEnumerable<Shape> { public IEnumerable<Shape> OnlyBox { foreach(var s in this) { if (s.Sha...

Mutual authentication between asp.net and WAS application (Java)

I'm building a .net application that needs to consume a WAS (Java) based web service using SSL and mutual authentication. Any pointers on how to go about doing this? I know that somehow I need to create private and public certificates for both the server and client and that I need to install the public certificate for the server somewh...

How to specify a trigger for an empty TextBox in WPF?

I have a style applied to a TextBox. The style contains two triggers - both of which check the property Validation.HasError. A different image is displayed on the background of the TextBox indicating if the data is valid or not. I'm trying to change the style so that when the TextBox is empty, no image is displayed in the background. I ...

Calling F# (.Net dll) code from php

Hello, I was wondering if it was possible to call some F# code from php. It seems like Phalanger does the trick. Is anybody using it ? For this solutions and others( if there are any?), what requirements does it have on the server to run the code ? Thank you ...

PrincipalContext.ValidateCredentials Always Returns False With Machine ContextType on XP

I'm using PrinciaplContext.ValidateCredentials to validate a set of credentials against the local machine: string account = Context.ReadLine(); string pass = Context.ReadLine(); using (var context = new PrincipalContext(ContextType.Machine)) { bool valid = context.ValidateCredentials(account, pass); Console.WriteLine("valid: "...

How to validate X.509 Certificate in C# using Compact Framework

I am trying to validate an X.509 certificate using C# and .NetCF. I have the CA certificate, and if I understand correctly, I need to use the public key from this CA certificate to decrypt the signature of the untrusted certificate. This should give me the computed hash value of the untrusted certificate. I should then compute the hash o...

Compiling OpenAL 1.1 SDK\samples\capture sample on Win32 under \clr problem.

So original SLN compiled. I tried it, it worked. But when I am triing to compile it under \clr (which is critical for me). So what I tried was to try playing with compiler options but after fixing general visiable errors I ended with this 3 Error 10 error LNK2028: unresolved token (0A0003BF) "extern "C" int __cdecl _CrtDbgReportW(in...

Binding empty list or null value to table valued parameter on a stored procedure (.net)

I have created a stored procedure that takes a table valued parameter that is a table with a single column of type int. The idea is to simply pass a list of ids into the store procedure and allow the sp to work with the data. However, in the case where there is no data to pass in, I am encountering problems (things work correctly when ...

Automate publishing of a WCF library using MSBuild

I searched and couldn't find anything releated to this topic. When using Visual Studio 2010 for a WCF library, you can right-click it and publish the WCF Library, which generates/creates the .svc and web.config file as well as deploys it. I have been trying to mimic this in msbuild and have had no success. Is this possible? I have bu...

What is the correct way to design a .NET web application?

Months ago, I was put in charge of a web application, from scratch. I had never programmed in vb.NET and was only familiar with Classic ASP. That being the case, I put together a very workable site and yet feel as if I didn't do much better than a beginner. What is the correct or best format for designing a .net website. Master Pag...

Is collection of different List<T> objects possible/right way??

Existing application: Net application, crystal reports, datasets, setdatasource Need to modify existing to use custom objects with no change to existing report templates. Need to set different data tables of template with different collection objects like Employee to List collection, Contacts to List collection, etc Now I need to know...

How to sort an IEnumerable<string>

I might be misunderstanding something, and this may even be impossible, but I would like to sort a IEnumerable<string> alphabetically. How do I go about it? Edit: I would really love and adore an in-place solution. ...

Justify text in a Report

In my work we need to generate contract documents that dynamically extract information from the database to personalize client related information. These documents not only have text, but also they need tables with dynamic rows (ie.: shows some products owned by the client). These tables can be placed in different parts of the document ...

Visual Studio Windows Forms designer fails with custom .NET component

I'm working on a project in C++/CLI, which includes some custom-made native libraries, a pair of custom .NET components and many .NET application with Windows Forms. Right now, I have problem with the Visual Studio designer; each time I add one of our custom components into a form it works, but after closing the designer tab it fails to...