.net

How to write a Multi-line RegEx Expression

I have a vb.net class that cleans some html before emailing the results. Here is a sample of some html I need to remove: <div class="RemoveThis"> Blah blah blah<br /> Blah blah blah<br /> Blah blah blah<br /> <br /> </div> I am already using RegEx to do most of my work now. What would the RegEx exp...

Need to make changes to MS Project 2003 files (MPP) from .Net - what are my options?

I have the need to make changes to MS Project files from a .Net program. My company has Apose.Task but I've just realized today that it apparently only allows for reading MPP files, writing is supported for XML only. Can anyone say I'm wrong about Apose?!!! Is there other products or open source alternatives? Can we use COM to do this...

Shared folder permission!

Hi! I use this code to share folder: Public Sub Share() Dim managementClass As New ManagementClass("Win32_Share") Dim inParams As ManagementBaseObject = managementClass.GetMethodParameters("Create") inParams("Description") = "My Description" inParams("Name") = "Share Name" inParams("Path") = "D:...

Do you use NDepend?

Hi I've been trying out NDepend, been reading a few blogposts about it and even heard a podcast. I think that NDepend might be a really useful tool, but I still don't see where I would use it. How do you use it? Do you use it, why? why not? I would like to hear about some down to earth real world examples. ...

Configuring ASP.NET MVC 2 with Spring.NET and FluentNHibernate

Hello, I'm trying to configure ASP.NET MVC 2 RC and Spring .NET 1.3 to use FluentNHibernate. I've managed to get FluentNHibernate running inside console application. At moment ASP.NET MVC 2 RC and Spring .NET are working fine for me, but I'm having trouble configuring FluentHibernate. Before asking this question I have Googled a lot...

Xml Serialization of a List where the parent element has additional elements

How would this be achieved in C# xml serializable class(s)? <Category Attrib1="Value1" Attrib2="Value2"> <Item>Item1</Item> <Item>Item2</Item> <Item>Item3</Item> <Item>Item4</Item> </Category> Inheriting Category from List<Item> results in the two Category properties being ignored by the xml serializer. If Category is compose...

Object model for html generation?

Something like new Div { new A{Href = "test", Content = "link"}, new P("text"), }.ToString() == "<div> <a href='test'> link </a> <p>text</p> </div>" ...

StringFormat flags : display the whole line

the StringFormat flags permits to differently represent a string in a rectangle. in this example was used string_format.FormatFlags = StringFormatFlags.NoClip one: Question having txt = "The quick brown fox jumps over the lazy dog." can I represent this text entirely as a single line (non-clipped and centered). I mean, I use ...

Validating DataAnnotations with Validator class

I'm trying to validate a class decorated with dataannotation with the Validator class. It works fine when the attributes are applied to the same class. But when I try to use a metadata class it doesn't work. Is there anything I should do with the Validator so it uses the metadata class? Here's some code.. this works: public class Pers...

.NET and DLL's in several projects

My current issue is I have a DLL which has a class I use as an abstraction for my Database Mappers. I use this DLL in all my projects (including other class libraries/dlls) that access the database. My issue is that every time I update my Data Mapper dll I have to updating it in all the other dll's I am using in my main project as well (...

Programmatically determining space available from UNC Path

Is there a programmatic API for determining available space on NAS sotrage from a UNC path? I looked through the WMI documentation and it wasn't clear that this is possible. A code example and references to the relevant API calls would be much appreciated. ...

Question about NHibernate

Hi, could somebody please review my source and let me know where I am going wrong. I am trying to insert a new application record and am receiving an exception when I try session.Flush(). Here is the application mapping (have changed some values for display purposes): <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="......

need suggestions about content filtering project

i'm thinking of designing and implementing a content filtering software as my graduation project. i want it to be a user contributed software. i mean, users can also add/categorize websites. it should be also a web project and extensions for browsers like chrome, firefox, ie.. my question is which programming language do you suggest fo...

Why is setting PixelType not working when negotiating Twain Session?

Hello, I'm trying to specify programmatically settings for scanning in TWAIN session. Because amount of code here would be significant I'm going to try to explain the problem without pasting the entire code. I hope there's someone good at TWAIN to help me.... To do scanning settings I'm using lowlevel calls to native Twain library. The...

creating an .NET COM component

I need to create a class that can be accessible through the classic asp's Server.CreateObject method, and that exposes 3 properties (int Width, int Height, bool Loaded) and 3 methods (void Load(string locatoin), void Resize(int width, int height), void Save(string location)). All my attempts so far has been unsuccessful. Any help would ...

C#: Can I get the details from an Unhandled Exception from the CLR?

First, I'm sorry for what must be a duplicate post. I cannot seem to narrow my search down enough on SO and google to find what I'm looking for. I'm currently working in a shop where they like their exceptions to bubble up. When the compiled app goes to test, it's a big pain trying to get the details of the exception (message and stac...

Storing current time as integer

Hi, I would like to store the current time as an integer, re perl. I know I need a TimeSpan, starting from windows time start. I know windows time starts from when?, Jan 1st, 1601. scope_creep ...

.NET SettingsProvider/ApplicationSettingsBase caching

I'm looking at some code that uses the .NET System.Configuration.SettingsProvider and ApplicationSettingsBase to handle configuration. We have a class that derives from SettingsProvider that uses a database as the data store, and then we have other settings classes that inherit from ApplicationSettingsBase, and have the [SettingsProvide...

Getting day suffix when using DateTime.ToString()

Is it possible to include the day suffix when formatting a date using DateTime.ToString()? For example I would like to print the date in the following format - Monday 27th July 2009. However the closest example I can find using DateTime.ToString() is Monday 27 July 2009. Can I do this with DateTime.ToString() or am I going to have to f...

String stream object in .NET library

Is anyone aware of a .NET class for encapsulating a collection of objects (strings in my case) which allow for Stream-like reading, seeking, etc. Essentially I need a List that has a GetNext method that will return the next object and update the current reading position. This wouldn't be hard to impliment (possibly with extension metho...