.net

Date Format in .net

I am getting date as April,1,2009. I want to format the date so that the month is displayed as 4. Not only for the date given above but for whatever date is given. Can anybody give appropriate code? ...

Windows Service in .net cannot resolve tns service name

I have moved a component of our application from a webservice to a Windows Service. It connects to oracle perfectly from the webservice but refuses to see the Tns names from the Windows service. I have given full control to the ORAHOME dir to the account the service is running under. I have also checked the service account permission t...

Library to generate .NET XmlDocument from HTML tag soup

I'm looking for a .NET library that can generate a clean Xml tree, ideally System.Xml.XmlDocument, from invalid HTML code. I.E. it should make the kind of best effort guesses, repairs, and substitutions browsers do when confronted with this situation, and generate a pretend XmlDocument. The library should also be well-maintained. :) I...

Getting the Redirected URL from the Original URL

Hi, I have a table in my database which contains the URLs of some websites. I have to open those URLs and verify some links on those pages. The problem is that some URLs get redirected to other URLs. My logic is failing for such URLs. Is there some way through which I can pass my original URL string and get the redirected URL back? Ex...

How to stop worker threads in a multithreaded Windows service on service stop

I have a Windows service that uses the producer/consumer queue model with multiple worker threads processing tasks off a queue. These tasks can be very long running, in the order of many minutes if not hours, and do not involve loops. My question is about the best way to handle the service stop to gracefully end processing on these work...

GUI Error Reporting

I'm using a background worker in order to get data from a database. My problem is that I'm struggling to report any errors in the database activity. I've tried straight up spawning a Dialog (Windows Form that I've created) from the DatabaseUpdater class. However, this hangs and I'm left with a white box instead of the error message. I'v...

Read .net config files with Javascript (not javascript in an aspx page)

Is there an easy way to read settings from a (asp.net) web.config file using javascript within a html page? BTW I have found examples of passing config settings into javascript blocks within aspx pages e.g. <script type="text/javascript"> function ReadConfigSettings(){ var wibble = '<%=ConfigurationManager.ConnectionStrings["MyCo...

WPF MVVM Using Commands vs. Event Handlers

Hello, I like MVVM pattern, once you start using it, you get addicted to it. I know that in perfect world your View code-behind is almost empty (maybe some code in constructor) and every aspect of View is being manipulated from ViewModel. But there are times when creating new fields, properties,commands in ViewModel creates more code ...

VS .Net: Post build events for "Primary Output from <myProject>" in installer project

Hi, I'm using the following post build actions in a project, to merge a lib into my application: IF $(ConfigurationName) == Debug GOTO end cp $(TargetPath) $(TargetDir)app_unmerged.exe del $(TargetPath) "C:\Program Files\Microsoft\ILMerge\ilmerge.exe" /internalize $(TargetDir)MyApp_unmerged.exe $(TargetDir)someLib.dll /out:$(TargetDir)...

Quickest way to set properties on an object?

Assume you have a business object with a lot of properties. What is the easiest and best way to set the properties without the use of an ORM tool? This implies setting properties from a data reader object, such as client.Name = (string)reader["Name"]; What about the case where the object contains other complex objects? Any suggest...

Mdi form ensure visible

I am developing a c# .NET app with MDI forms. When the Mdi children are moved around and using the scroll bars some forms will be outside the displayed area. I would like to do to the Mdi children something similar to TreeNode.EnsureVisible() which moves the TreeView scrollbars until the Node is fully visible. Calling Form.Activate() doe...

.NET Face-Recognition Library

Is anyone aware of a good face-recognition library for .NET? I am writing a Facebook client and I'd like to apply face recognition when a user wants to tag an image. Any suggestions will be highly appreciated! ...

How do I open a FolderBrowserDialog at the selected folder?

I have a FolderBrowserDialog, displayed with code shown below. However, it keeps opening with 'Computer', i.e. the root of the folder tree, selected. How do I get it to open on the selected folder? var folderBrowser = new FolderBrowserDialog(); folderBrowser.Description = "Select Chase 6 Installation Folder"; fo...

Why is my application using CSC during execution

I've been experimenting with the Remotesoft Linker and Mini Deployment tools to create a single native executable (that doesn't need the framework installed) from my managed code. One of the configurable features it has is if csc.exe is available for the final executable. The documentation for it says that it's typically only needed if...

How can I return an instance of a dynamically-built type to a WCF service expecting an interface ?

I want to have an operation contract that returns an interface. My problems: 1) I want to register dynamically with the service the known type that will be returned, or to have WCF accept the type. I noticed that unless it is a known type marked by attribute or in a static method of the service, the method will fail. 2) I want on the...

.Net DefaultValueAttribute on Properties

I got this code in a user control: [DefaultValue(typeof(Color), "Red")] public Color MyColor { get; set; } How can I change MyColor to be its default value? ...

Create PowerPoint 2007 presentation from a template

Hi, I need to create a PowerPoint 2007 presentation from a template with Open XML Format SDK 2.0. The template has to be provided by the customer and is used for a individual layout style (font, background color or image,...). It needs to contain two predefined slides: Text slide Image slide The application should now create a copy ...

How to convert/call a c++ project to/from .Net?

Hi, I currently have a huge project that I've recently converted from VC6 to 2005. Now I'd really like to create a new frontend for some of the functionality, However the main logic of the program is based in c++. Also the code base revolves around it's own metatypes and bespoke classes. The best solution I can come up with is to call ...

Changing the order of LINQ to SQL Inserts

I have two LINQ to SQL classes, CandyBar and DeliciousCandyBar that map to tables of the same name in SQL Server. There is a 0..1 relationship between CandyBar and DeliciousCandyBar. i.e, A CandyBar can have 0 or 1 DeliciousCandyBars. Conversely a DeliciousCandyBar has exactly one CandyBar. In LINQ to SQL class, they look (basically) l...

How many of you are using an internally developed installer for your company?

Awhile ago there was a debate whether we should use a third party installer or write our own. We've had 2 generations of internally developed installers that just do services, msmq, com+, gac and sql script by shelling out to exe's. So I was wondering who out there is using a custom written installer for your companies specific needs? ...