.net

Does the Silverlight runtime automatically install via Windows Update?

I was just wondering, does the Silverlight runtime have to be downloaded/installed deliberately, or these days is there a chance that a fully-patched Windows machine will already have it? ...

Reflection and Generics get value of property

Hi i am trying to implement a generic method which allows to output csv file public static void WriteToCsv<T>(List<T> list) where T : new() { const string attachment = "attachment; filename=PersonList.csv"; HttpContext.Current.Response.Clear(); HttpContext.Current.Response.ClearHeaders(); HttpContext...

Complicated API issue with calling assemblies dynamically‏

I have an interesting challenge that I'm wondering if anyone here can give me some direction. I'm writing a .Net windows forms application that runs on a network and uses an SQL Server to save and pull data. I want to offer a mini "plugin" API, where developers can build their own assemblies and implement a specific interface (IDataMan...

Generic type parameters using out

Im trying to make a universal parser using generic type parameters, but i can't grasp the concept 100% private bool TryParse<T>(XElement element, string attributeName, out T value) where T : struct { if (element.Attribute(attributeName) != null && !string.IsNullOrEmpty(element.Attribute(attributeName).Value)) { ...

Unable to send SMTP mail with .NET, network issue?

I am trying to send an smtp email through gmail's smtp server using the code below: MailMessage message = new MailMessage("[email protected]", "[email protected]", "Testing SMTP", "Test, yo"); SmtpClient client = new SmtpClient(); client.EnableSsl = true; client.Host = "smtp.gmail.com"; client.Port = 587; client.Credentials = new Netwo...

Issue allowing custom Xml Serialization/Deserialization on certain types of field

I've been working with Xml Serialization/Deserialization in .net and wanted a method where the serialization/deserialization process would only be applied to certain parts of an Xml fragment. This is so I can keep certain parts of the fragment in Xml after the deserialization process. To do this I thought it would be best to create a ne...

SQL 2000 Not Supported by .NET Framework Data Provider for SQL Server in VS2010's Server Explorer Data Connections

Just tried creating a data connection to a SQL 2000 database in VS2010's Server Explorer using a .NET Framework Data Provider for SQL Server (versus OLE) and found that it didn't work. VS2010 complained that I had to use SQL Server 2005 and up. This used to work in VS2008 (using .NET Framework Data Provider for SQL Server instead of th...

What is the best way to migrate documents into Sharepoint (MOSS) 2007?

I'm working with a customer that needs to migrate documents from their current document management system (not Sharepoint) into Sharepoint MOSS 2007 retaining document history and metadata. I've written a proof of concept using the Sharepoint web services and that looks promising, but the snag so far seems to be programmatically setting...

What are MEF best practices?

What are some best practices for using MEF in your code? Are there any pitfalls to take into account when starting your extensible application? Did you run into anything you should have known earlier? ...

SQLite vs Firebird

The scenario I'm looking at is "This program uses Postgres. Oh, you want to just use it single-user for the moment, and put off having to deal with installing a database server? Okay, in the meantime you can use it with the embedded single-user database." The question is then which embedded database is best. As I understand it, the two ...

Can I enable/disable breaking on Exceptions programatically?

I want to be able to break on Exceptions when debugging... like in Visual Studio 2008's Menu Debug/Exception Dialog, except my program has many valid exceptions before I get to the bit I wish to debug. So instead of manually enabling and disabling it using the dialog every time is it possible to do it automatically with a #pragma or som...

NHibernate - Get entity property column name

How to get table COLUMN NAME for some entity property? ...

How to stream your images/files with VLC?

So I know there are lot of wrapers of libVLC.dll . But I just do not know what one is ready to do what I need... What I need is simple... in my C# programm I create some bitmap (once or twice per second)... I now want to stream bitmaps live as video (in some format VLC can to offer me) to some http:localhost:port/ using VLC... How t...

Custom Types in WCF Rest

I am using the Rest Singleton WCF Service temple from the Rest Starter Kit. The temples uses sample item as its sample Item. i am attempting to replace that sample ITem with a custom type from web reference in my ASP.Net project .dll. The types and name spaces are found and i can replace the sample item in the code. when i run the ap...

How to I define/change the mappings for Linq To Sql in code.

I wish to be able to change the table a class is mapped to at run time, I can’t do this if all the mappings are defined with attributes. Therefore is there a way to define the mappings at runtime in code. (I would rather not have to maintain xml mapping files.) Say I have two tables: OldData NewData and sometimes I wished to que...

Calculate location and number of intersections between multiple date/time ranges?

I need to calculate the location of intersections between multiple date ranges, and the number of overlapping intersections. Then I need to show which date/time ranges overlap each of those intersecting sections. It is slightly more complicated than that so I'll do my best to explain by providing an example. I am working in VB.Net, but ...

Determine if a decimal can be stored as int32

I am doing some custom serializing, and in order to save some space, i want to serialize the decimals as int, if possible value wise. Performance is a concern, since i am dealing with a high volume of data. The current method i use is: if ((value > Int32.MinValue) && (value < Int32.MaxValue) && ((valueAsInt = Decimal.ToInt32(value)) == ...

please explain NHibernate HiLo

I'm struggling to get my head round how the HiLo generator works in NHibernate. I've read the explanation here which made things a little clearer. My understanding is that each SessionFactory retrieves the high value from the database. This improves performance because we have access to IDs without hitting the database. The explanation...

Filter elements in PropertyGrid

In System.Windows.Forms there are a PropertyGrid that displays properties of an attached object. Let's say MyTextBox : TextBox. Now, I would like to display on it some MyTextBox properties, say only Size, Location and my custom property Date. More that than, I would like to be able to change the real property names, say "Dimension", "...

DTD is prohibited in this XML document -- how to change permissions?

I am using a 3rd-party .NET component which requires an XML configuration file. I'm am using this in an ASP.NET application. I get an error when configure the XML with the following dtd: <!DOCTYPE prod-config SYSTEM "cache-config.dtd"> The error is as follows: For security reasons DTD is prohibited in this XML document. To enab...