.net

Best resource to learn application programming? (.Net/Cocoa/etc)

I'm an embedded programmer - primarily very small systems where I deal with data as bits, not objects. I'd like to learn how to program for Mac and PC using their native libraries (Cocoa and .Net). I've hacked a few things together in Xcode and Visual Studio, but I feel like I'm hacking, not programming. I put things in AwakeFromNib wit...

How to develop a Windows scheduled task?

I need to have a process that compiles daily data into an PDF that will be attached into an email. I have already used MSSQL to send emails in the application being developed and would like to continue to use MSSQL as the email processor. In my research, I have found that this can be achieved by creating a Windows Service. But, since I ...

Pros and cons of RNGCryptoServiceProvider

What are the pros and cons of using System.Security.Cryptography.RNGCryptoServiceProvider vs System.Random are. I know that RNGCryptoServiceProvider is 'more random', i.e. less predictable for hackers. Any other pros or cons? UPDATE: According to the responses, here are the pros and cons of using RNGCryptoServiceProvider so far: Pro...

Platform SDK Deployment in C#

Hi, I was reading the Platform SDK samples, and the examples are in VB.NET. I use C# so I was wondering, how can I replicate this line in C#? Set Installer = CreateObject("WindowsInstaller.Installer") Thank you. ...

Design pattern for aggregating lazy lists

I'm writing a program as follows: Find all files with the correct extension in a given directory Foreach, find all occurrences of a given string in those files Print each line I'd like to write this in a functional way, as a series of generator functions (things that call yield return and only return one item at a time lazily-loaded)...

How expensive is MD5 generation in .NET?

To interact with an external data feed I need to pass a rolling security key which has been MD5 hashed (every day we need to generate a new MD5 hashed key). I'm trading up whether or not to do it every time we call the external feed or not. I need to has a string of about 10 characters for the feed. It's for an ASP.NET (C#/ .NET 3.5) s...

C++ 'GET' request or how do you download files to work with in C++?

Alright I've spent a good three days trying this, here's the scenario: I want to download a '.csv' file from Google and then do stuff with the data from the file. It's for a Win32 Console Application. I have the latter down, I just cannot for the life of me figure out how to download the file. I've heard of libcurl, curlpp, ptypes, roll...

Debugging an AmbiguousMatchException thrown when calling AppDomain.CreateInstanceAndUnwrap in .NET

I have an application which is throwing an AmbiguousMatchException when I call AppDomain.CreateInstanceAndUnwrap to instantiate a type in another AppDomain. This is happening on a customer's computer which I don't have direct access to. I think the problem is that there are two copies of the same assembly loaded. Is there any way to f...

Serialisation order & Unity problems

I have an application that uses an XML and custom serialiser, and have recently added some DI using Unity 1.2 to set two properties in my class. Now when I serialise the class the properties that were set by Unity are serialised first followed by all the other properties in order. So if class Properties 2 and 3 are set by Unity the ser...

How do can I get the current DateTime from the Precompiler in C#

In C# 3.0, I have a property which is suppose to contain the version of the class. The version number is simply the date and time of compilation. Right now, I have the following code: public DateTime Version { get { return DateTime.UtcNow; } } Obviously, this is wrong since this property returns me the current date and time. So, i...

.Net WSDL command line utility error

I'm pointing the .Net command line WSDL utility that ships with Visual Studio 2005 at a web service implemented in Java (which I have no control over) and it spits out the following error: WSDL : error WSDL1: Unable to cast object of type 'System.Xml.XmlElement' to type 'System.Web.Services.Description.ServiceDescriptionFormatExtension...

Best reporting engine for WPF without a database?

Does anyone know of a Reporting Engine for WPF? Most of the ones I could find are still for WinForms. I'm happy enough using a WinForms one in WPF with a WinForms host so long as the tool has a UserControl that can be embedded in a window. Also, I'm not using a database and all my data is in XML so the Reporting Engine needs to be able...

Installing .NET Framework with my app using MSI

I have created a setup project in VS2008. My WinForms app uses .NET 2.0, so I chose .NET 2.0 Prerequisity and built the setup project. When I run my Setup.msi on a clean PC, it correctly detects that the .NET is missing and asks if it should be installed. After a successful installation of the .NET, the installer simply exits and doesn'...

System constant for the number of days in a week (7)

Can anyone find a constant in the .NET framework that defines the number of days in a week (7)? DateTime.DaysInAWeek // Something like this??? Of course I can define my own, but I'd rather not if it's somewhere in there already. Update: I am looking for this because I need to allow the user to select a week (by date, rather than wee...

How can you stop a Winforms Panel from scrolling?

If you put a DataGridView that is 400 pixels high on a panel that's 300 pixels high, so that there's a scroll bar on the panel, then scroll down so that the lower half of the grid is shown, then click on a control outside the panel, then click on a line in the grid, the panel scrolls up to the top and the wrong row in the grid is selecte...

C# Can I nullify an object from another class

I have an object that is generated in one class public class CreatingClass { public T CreateObject<T>(Dictionary<string, object> parameters) where T : IMyInterface, new() { .... } public void DestroyObject(IMyInterface objectToDestroy) { .... } } I call this function from a client class, then a...

when to use Collection<T> vs List<T>

What is the best practice for when to use one vs the other? Both implement IList<T> and hold the data in an ordered fashion, but only List expose the sorting semantics.... (edit: duplicate from here) ...

PictureBoxSizeMode.Zoom - What's the zoom factor?

I have a PictureBox (its SizeMode property set to Zoom) containing an image, and both may vary in size. Since the user has to interact with the image directly, I need to be able to convert the PictureBox click coordinates to image coordinates. What I have done so far, is compare the aspect ratio of the PictureBox to the aspect ratio of...

Running a bootstrapper on Windows 2000

Is there any way how to run the setup.exe bootstrapper generated by VS2008 with .NET 2.0 WinForms application on Windows 2000 SP4? If I try to run it, it gives me an error message about missing HeapSetInformation in Kernel32.dll and it doesn't run. I tried to install manually Windows Installer 3.1 and also .NET 2.0 Framework, but the se...

Retrieving application settings after a name change?

I have a Windows forms application that contains per-user settings. I'm using Properties.Settings.Default.Upgrade() to preserve these settings between versions and everything is fine. Recently I had to change the exe name of my application, so after an upgrade, all settings revert to default values. I guess the settings system thinks ...