.net

Why do I need to specify a resolution for cropping?

I wrote a method to crop images in C#. It does it by creating a new Bitmap and drawing onto it a specified rectangle (the area to be cropped) from the original image. For the images I've tried with it was generating wrong results. The size of the resulting image was right, but the content was it. It was like if the image has been scaled...

What should I do about content files when sharing an assembly dll with another programmer?

I have a library project that has some content files (e.g., XML and schema files, image files, etc.) all with Build Action set to Content (copy always). This library project lives in a Visual Studio solution that also has a test application (WPF) that references the library. When I build the solution, all the content files from the dep...

Trying to find the top 3 properties of a POCO instance.

Hi folks, I have a simple POCO class that contains the student's scores. eg. Math - 83% Engrish - 82% Chemistry - 81% Drama - 100% etc.. Is there a way (using linq?) that i could figure out the top 3 properties ordered by score? I'm assuming the final object will be an IList of an anonymous type, which will have two fields. Name (t...

Bug in Sgen.exe

It seems that sgen.exe could not generate generic type XmlSerializer, right? My genereic type: [Serializable] [XmlRoot(ElementName = "Masterx")] public class Masterx<T> where T : class, new() {....} Serializer code: protected virtual List<T> ParseXMLToObject<T>(string resultXML) where T : class, new() { //return ParseXM...

POST data from a text file (read by a desktop client) to an ASP .NET based server

I am developing a client-server application - the server being an ASP .NET web app. The client (a desktop app) needs to send data contained in a text file to my asp .net web app. Data would be approximately 100 KB, in multi-line textual form. What is the best approach to POST this data to the server, given that I need to do it once eve...

Opengl on PictureBox toolbox in Visual Studio 2008.net

Hello, How can I use Opengl in PictureBox toolbox in Visual C++.I didn't come across any document on internet.Do you know any document,tutorial,code example etc. about this topic? Could you help me please? ...

c# How to downcast an object

Hi, I have the following list of slide objects. Based on the value of object's 'type' var I want to upcast the Slide object in the list. Is it possible? foreach(Slide slide in slidePack.slides) { if(slide.type == SlideType.SECTION_MARKER) { //upcast Slide to Section } } ...

SignedXml generates invalid signatures

I've been trying to get the XMLDSIG support in .NET to behave properly, more specifically the SignedXml class. I'm implementing a third party service and they've just recently started requiring that all messages have to be digitally signed... My problem is that, I can't seem to generate valid signatures. Both the third party service, an...

SPSite in web service throws 401 error

I have this code: using ( var site = new SPSite( myUrl ) ) { using ( var web = site.AllWebs[0] ) { // read-only operations } } The "myUrl" is top domain url with WSS 3.0. The authentication is set to Windows. If I run this code from command-line under "external_app_user" account, all is fine. But if I run this code from w...

How to creat a class level mutex , which work across process

I have a class which logs to a file .this class is used by multiple threads. I have use a mutex inside the write function and it works fine with one instance of my application . but if I start multiple instance of the application the it crashs. what is the correct implementation of named mutex at class level that can work across proce...

how to wrap/store the key of TripleDESCryptoServiceProvider

I'm using DES encryption, and I want to store the key of TripleDESCryptoServiceProvider. But the key consists of (Key + IV), I was trying to save them in an XML file using XmlTextWriter Convert.ToBase64String(...) but there was an exception due to IV contains invalid characters "=" in XML. Is there a better way to store symmetri...

Does anyone know the meaning of this EntryPointNotFoundException - "Unable to find an entry point named 'nonexistent_dummy' in DLL 'MSVCR80.dll'"?

Dear ladies and sirs. I am interesting in understanding the reasons for the following FCE, always happening once when I run the unit tests of our application. Note, that I wish to understand the reasons and fix the root cause, if possible. The line causing the FCE: if (System.Windows.Application.Current != null) Exception details:...

How can I measure the overhead of a mocking framework (TypeMock)?

I'm just beginning to evaluate mocking frameworks for my team and am wondering if anyone has any pointers to reference documentation or experience that you can share regarding the cost of mocking when doing performance tests. Links? Personal experience? Details appreciated. ...

Get a DataSet returned from SOAP as XML?

We have a .NET 2 SOAP web service meant for consumption by another app that is internal to our organisation. The web service returns a .NET dataset like so: public System.Data.DataSet GetStatementFor(string contractList, System.DateTime startDate, System.DateTime endDate) Now in one of the use cases it is necessary to get to the Dat...

Calling an SSIS package using a Web Application

How do you call an SSIS package using a Web Application? I'm using SQL Server 2005. I prefer a solution in C#2.0 above. Any help will be greatly appreciated. Thanks in advance. ...

ASP.net check box label name from xml

I have a check box in an asp.net webpage How to fill the labek name of the check box from an xml file ? I did the same for dropdown but i want similar to checkbox xmlData.ReadXml(Server.MapPath("./App_Data/view1_" + txt_dropDownToLoad + ".xml")) DropDownName.DataSource = xmlData DropDownName.DataValueField = "ddl_cod" DropDownName.D...

Conversion of code from .net framework1.1 to 2.0

Is there any better way for converting code written in .net framework 1.1 to framework 2.0 rather than manually checking entire application and changing individually ...

ASP.NET MVC - ASPX with non-default constructor

Is it possible for a ASPX view (in ASP.NET MVC) to have non-default constructor AND use this constructor when creating this view? Example - Page will inherit from this class: public class ViewPageWithHelper<TModel> : System.Web.Mvc.ViewPage<TModel> where TModel : class { public ViewPageWithHelper(Helpers helpers) { ...

Copy tables between access databases

I have two access databases and would like to find a way to copy tables from one database to the other. The copied table has to keep the same strucure and data. I already tried to fiddle around with sqlBulkcopy but all information i can found about it is using sqlBulkCopy to tranfer tables to sql server. Can I use sqlBulkCopy to copy t...

how to check unique collection in C#?

Hello everyone, I am using C# + VSTS2008 + .Net 3.0. I have an input as a string array. And I need to output the unique strings of the array. Any ideas how to implement this efficiently? For example, I have input {"abc", "abcd", "abcd"}, the output I want to be is {"abc", "abcd"}. thanks in avdance, George ...