.net

How to handle transactions in dotnet world?

Hi, we are using linq-to-sql in a desktop project? How should we handle transactions? What about using transaction scope? ...

How to convert binary to decimal

How can I convert a binary string, such as 1001101 to Decimal? (77) ...

what should a controller action look like if it just redirects?

I have a action that just does some db work based on the parameter passed into it, then it redirects to another page. What should the return type be then? ...

Apply a Regex on Stream?

Hi I searching for fast and safe way to apply Regular Expressions on Streams. I found some examples over the internet that talking about converting each buffer to String and then apply the Regex on the string. This approach have two problems: Performance: converting to strings and GC'ing the strings is waste of time and CPU and sure...

How do I determine which interface is referenced by an explicitly-implemented MethodInfo object?

I have a MethodInfo object that represents an explicitly-implemented interface method, as follows. MethodInfo GetMethod() { return typeof(List<>).GetMethod( "System.Collections.IEnumerable.GetEnumerator", BindingFlags.Instance | BindingFlags.NonPublic); } How do I query this MethodInfo object to obtain the interfac...

Using Closures to keep track of a variable: Good idea or dirty trick?

Ok, i have a need to be able to keep track of value type objects which are properties on another object, which cannot be done without having those properties implement an IObservable interface or similar. Then i thought of closures and the famous example from Jon Skeet and how that prints out 9 (or 10) a bunch of times and not an ascendi...

What is the C++/CLI equivalent to C#'s default(T)?

I'm working with some C++/CLI code (new syntax) and am trying to declare a generic type and want to set a member variable to it's default. In C#: class Class<T> { T member = default(T); } What's the equivalent in CLI? generic<typename T> public ref class Class { public: Class() : member(default(T)) // <-- no worky { ...

Human-readable date formats

You may have noticed that certain web applications (for example, certain parts of GMail) display dates in a more human-readable format than simply DD/MM/YYYY. For example, if I open up a mail item from the 23rd (which happens to be 3 days ago at the time of writing, I'll get the following: Dec 23 (3 days ago) I'd like to implement...

How do I test my DNS connection?

A simple question. How do I test if my current DNS is working or down? Would it involve polling? That I fear would take up resources and also require execution on a separate thread. ...

How do I give professional look and feel to my .NET windows application?

I'm using WINFORMS not WPF. I just know basic c# .net gui programming. I donot want the traditional windows look. I want to have my own custom look (eg. gtalk, antivirus softwares, media players, google chrome). Actually I'm inspired by google's PICASA software. Its awesome. I want to do something like that.How can I do that? If there ...

how to write a custom control in c# to work with any windows text processor application?

I am trying to write a custom control in c# using windows api which should interact with any windows text based application. for e.g. notepad I had looked at tinyspell and it works like anything. can any one suggest how to get started? also if u know how tinyspell would work, plz help me. u can find tinyspell here http://www.tinyspell...

application immediately closing after pressing run

HI This is Bharat Bhushan.I have encountered a problem that When I run the application in visual studio 2005 by pressing the Run button then VS IDE closes automatically without giving any error message. But when I run without debugging with Ctrl+F5 then Application page runs sucessfully. As a solution I have installed fresh copy of visu...

Storing class files in dll and using the dll for multiple websites in asp.ne

Hi, I want to create a class file in VS2005 and be able to use it in other websites on my computer / production server. How do I create this dll and store it in a common place where I can reference it while developing and also on the production server ? Thanks & regards Sanjish ...

.net error Culture name 'az-az' is not supported. Parameter name: name

Hi, i am trying to implemnet different languages to my site and so far there was no problem with my setup. I create Language.en.resx,Language.nl.resx etc and put them in App_GlobalResources folder. Then with code blewlo i allow users to set their prefered language protected override void InitializeCulture() { if (string.IsNullOrE...

Custom attributes with Service Reference proxy (.net 3.5 c#)

I added a custom attribute to an enum that I was using as part of a web service. When I add the web service as a service reference to a win forms application the custom attributes do not appear in the service reference proxy objects although the enum type itself does appear. I've looked all over and haven't found anything close to a solu...

Equivalent to JasperReports in dotnet

JasperReports is cool with JAVA web apps. CrystalReports is not equivalent to it :D what tool can we use in asp.net web applications ? ...

Running ADPlus on w3wp.exe leaves orphan process?

I am troubleshooting an issue where our web application will spike to 95-100% CPU and hang there until it is recycled or the server is restarted. I've been able to get some dumps using ADPlus when this is happening. (-hang option, no other special switches.) That said, I'm noticing something else that is rather odd... whenever we do th...

How do I specify pluralizeTableNames in Castle Active Record Integration?

I used a section in my app.settings to configure AR, in which I specified: <activerecord pluralizeTableNames="true"> Now, I moved to using ActiveRecordIntegration facility and a separate xml file. How can I configure pluralizeTableNames ? ...

Deadlock, some questions...

After some phase of testing of my task scheduler I encountered a deadlock pretty much random. I want to ask some help, especially I want to know if my approach can take to a deadlock or if the problem is elsewhere. Before starting i'll say that the application is a fullscreen game. (in case it may influence anything) I'll explain in wor...

Can I have some advice about globalization in .net for a multi-language CMS?

I am building a CMS that will support 7 different languages/cultures. For images that cannot be changed through the CMS I think I am going to use different resource files. As for the content I was thinking of separate databases. If the user needs to change the current culure I have a drop down that stores the chosen culture in a cooki...