.net

Database hit reduction .net?

Hi, In a single webmethod in .net webservice there are 4 times DB hit (for different tables), apart from using stored procedures, is there any means which i can follow to reduce the db hit? ...

using regular expression / Remove special characters with linq to sql

How can i use regular expressions with linq to sql in the asp.net mvc(C#) application? The columns in my MSSQL table (Products) has some special characters like (, - % ',.....). While searching for a product i need to search without that special chareters. For ex.: I have a product say (ABC-Camp's / One), when i search for "abccamp",...

Migration of .NET COM object to 64 bit.

Hi, We have C++ application which uses several COM object. COM object are .NET based (using COM Interop). I need to migrate application to 64 bit. I specifically need C++ application to be 64 bit. I don't want to recompile all of .NET com object to 64 bit and deliver two sets of DLL's (32 bit and 64 bit). I was investigating and foun...

Null reference exceptions in .net

Hello, we're having this big problem with our application. It's a rather large application with several modules, and thousands and thousands lines of code. A lot of parts of the application are designed to exist only with a reference to another object, for example a Person object can never exists without a House object, so if you at any ...

DoubleAnimation in ScaleTransform

I'm trying, as an exhibition, to use a DoubleAnimation on the ScaleX and ScaleY properties of a ScaleTransform. I have a rectangle (144x144) which I want to make rectangular over five seconds. My XAML: <Window x:Class="ScaleTransformTest.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http:/...

Missing Test Settings template in VS2010 Ultimate

I'm attempting to add a Test Settings file to my Unit Tests project in VS2010. All websites seem to simply say "Go to Add New Item > Installed Templates > Test Settings". However, I don't have Test Settings as an option in my Installed Templates (nor does searching for them online turn up any results). Can someone point me in the righ...

.NET Regex: Howto extract IPv6 address parts

Question: How does the .NET regex string to extract IPv6 addresses look like ? I can get it to extract a simple IPv6 address like "1050:0:0:0:5:600:300c:326b" but not the colon format ("ff06::c3"); My problem is, it should extract a 0 for every omitted value between the :: How do I do that? Below my code + description. Specify IPv6 a...

How to specify a cipher for an SSL connection in .NET?

How can I specify a cipher suite to use in an SSL Connections? I know that Mentalis Seclib got this feature however they don't maintain the project (and there are issues in that library with x64 OSes) as they say .NET Framework 2.0 introduced those features. However I couldn't find a way to do this in .NET Framework 3.5. To be more s...

Math problem: Determine the corner radius of an inner border based on outer corner radius/thickness

Here's a math/geometry problem for the math whizzes (not my strongest subject). This is for WPF, but should be general enough to solve regardless: I have two embedded Border elements, with the outer one having a certain corner radius, R and border thickness, T. Given these two values, what should the corner radius of the inner Border, R...

C# Array Maximum

I have 2 arrays named Arr1 and Arr2 in C#. They are of the exact same dimensions... I need to get the element of Arr1 corresponding to maximum of elements in Arr2 beginning with given indices ... e.g Get indices of the max of Arr2 [ 1 , 10 , 3 , i , j ] for all i,j Return Arr1 [ 1 , 10 , 3 , i , j ] Of course I need the elegant sol...

Printing at specific DPI/resolution

I'm currently developing a printing application and I'd like to print at high quality/resolution and I couldn't figure out how. I iterated printDocument.PrinterSettings.PrinterResolutions and got this results: Kind - Resolution.X - Resolution.Y High - -4 - -1 Medium - -3 - -1 Low - -2 - -1 Draft - -1 - -1 Is it possible to print at...

.Net to COM Interop Tester

I made a class in C# that I am exposing to COM. I can register it just fine using RegAsm.exe. I would like to test it before I send it off, but using TlbImp.exe gives me an error of "Type libaray was exported from a CLR assembly and cannot be re-imported as a CLR assemply." What is a good way to test this? ...

Immutable Dot Net strings

I usually define my string variables in vb.net as Dim f_sName as string=String.Empty f_sName = "foo" Given the immutable nature of strings in .net, is there a better way to initialize strings and deal with the "Variable 'f_sName ' is used before it has been assigned a value. A null reference exception could result at runtime." warni...

Available options for hosting FTP server in .NET application

I need to implement an FTP service inside my .NET application (running as a Windows Service) and have not had much luck finding good/current source code or vendors. Ideally it needs to be able to respond to the basic FTP Protocol and accept the data stream from an upload via a stream, enabling me to process the data as it is being recei...

Windows CE vs Windows XP Embedded

I am developing a device that will continuously collect data from a PLC and store the data in a database as well as over the network. The device has to be very reliable. I decided to use a fanless PC, thin client or nettop is the appropriate nomenclature I guess, and now I am trying to decide what OS to install. As much as I would like t...

How do I pass references as method parameters across AppDomains?

I have been trying to get the following code to work(everything is defined in the same assembly) : namespace SomeApp{ public class A : MarshalByRefObject { public byte[] GetSomeData() { // } } public class B : MarshalByRefObject { private A remoteObj; public void SetA(A remoteObj) { this.remoteObj = remoteObj; } ...

.NET GDI+ image size - file codec limitations

Is there a limit on the size of image that can be encoded using the image file codecs available from .NET? I'm trying to encode images > 4GB in size, but it simply does not work (or does not work properly i.e. writes out an unreadable file) with .bmp, .jpg, .png or the .tif encoders. When I lower the image size to < 2GB it does wor...

LINQ - IEnumerable.Join on Anonymous Result Set in VB.NET

I've long since built a way around this, but it still keeps bugging me... it doesnt help that my grasp of dynamic LINQ queries is still shakey. For the example: Parent has fields (ParentKey, ParentField) Child has fields (ChildKey, ParentKey, ChildField) Pet has fields (PetKey, ChildKey, PetField) Child has a foreign key reference to ...

SqlCeCommand ExecuteNonQuery performance issue

UPDATE: I've modified the code to drop the indexes before the inserting, but it makes not difference. I've been asked to resolve an issue with a .Net/SqlServerCe application. Specifically, after repeated inserts against the db, performance becomes increasingly degraded. In one instance at ~200 rows, in another at ~1000 rows. In the l...

how to turn off percentage sign in .net/wpf?

I would like my WPF application to display all percentages without % sign. For example 20% would be displayed as "20" but i still want to use the standard formatting for percentages (so i get the benefit of string formatter to multiply it by 100 for me) in other words, how do i get string.Format("0.00%", 0.2) to output "20" but not "20%...