.net

Peachtree SDK: Do the Equal / Mask / NotEqual filters actually work?

I had been struggling to get some of the "server"-side filtering working with the Peachtree SDK (assembly version is 17.0.0.0), and having to debug to try each combination of values of filters was annoying me, so I wrote a program using reflection to test them all. I tried to post the output here (well-formatted!), but markdown basicall...

Why does FormatException not inherit from ArgumentException?

Is there a known reason why FormatException does not inherit from ArgumentException? An invalid format would seem to be a very specific case of an argument being invalid, similar to ArgumentOutOfRangeException. The MSDN article for the class states: FormatException is thrown when the format of an argument in a method invocation doe...

Static and Generic working together .NET

Hi, I have this code: public class EntityMapper<T> where T : IMappingStrategy, new() { private static T currentStrategy; public static T CurrentStrategy { get { if (currentStrategy == null) currentStrategy = new T(); return currentStrategy; } } } Th...

Internal Namespace for .Net?

Here is a simplified example: namespace MyNS.Proj.InternalNS { internal class InternalClass1 {...} } I would like to make InternalNS as the part in MyNS.Proj invisible to outside since all the classes with the namespace are internal or private. Not sure if this is possible? ...

How can i include the clicked element's id in an ajax call?

I'm trying to bring over the IDs of the input elements "submit" and "skip" and do some logic based on which button was pushed. It doesn't appear to be coming over in the Request object. How can I do this??? <div id="modal"> <% using (Ajax.BeginForm("Promo", new AjaxOptions { UpdateTargetId = "modal" })) { %> <div id="mo...

ASP.NET MVC Design Question Where to put specific user / "access level" code

So, I've successfully implemented my own MembershipProvider and that's working exactly as I intended it to. I've decorated my controller actions with the [Authorize] attribute, and this is also work exactly as I want. My question is, where should I put code that determines "how much" access a use has? [Authorize] simply means that th...

Writing a base64 string to a file without carriage returns

Will I run into problems if I write a base64 string into a file without breaking it up using carriage returns? Is there a length where I'll run into difficulties writing and reading a big string in one go? Right now the size of the strings I'm storing are about 100 characters but they can get into the 10,000+ range - will that be a p...

Interface with method GetInstance<T>() in .Net?

I am not sure if there is any interface already exist in .Net like this: public interface IController { T GetInstance<T>(string name) where T: class; } Basically, this interface contains a method to get instance of T by name/key. IControler is an arbitrator name I use here. It may be something like IFactory, ICreator, or somethi...

Google Sitemap and .NET 1.1

What is the best way for create a sitemap for google using .net 1.1 and use this sitemap in a treeview into a webpage .aspx? ...

Expression blend and mock data

I have an Item template and I want to design it, but I can't see what the stuff looks like in blend because I am databinding it to objects that doesn't exist in blend. Is there a way that I can make fake data come up to do this? They are textblocks. ...

Badly formated XML generated by XElement.ReplaceWith()

Hi, I am trying to replace a node using ReplaceWith(), but noticed that it results in badly formated XML (missing new lines and indentations). Has anyone has come across this problem before? Code Snippet: [Test] public void Test() { XDocument document; using (var reader = XmlReader.Create("C:\\test.xml")) { // ...

Plugin Architecture - Make an MDI Parent Form Aware of Children in DLLs

I'm experimenting with a plugin architecture for my company's internal business system. I have managed to read all .DLLs in a Plugin folder which implement a specific interface. What I am trying to figure out is the best method of communication between the "host" MDI parent application and forms that will be in the .DLLs which I intend t...

Is time comes to not worry about memory

About a year ago we are developed for internal use inprocess MOLAP engine that perform aggregation of a large amount of data. We using it only as a part of our platform because we was sure that such a system without custom memory alocation, paging etc is not viable solution, but some time ago Microsoft published beta version of PowerPivo...

Receiving error message: "The installed product does not match the installation source(s)"

I have written a .NET C# application and have created an installer in Visual Studio 2008. Everything works fine. The application uses an external config file (not app.config). The application is written such that when the config file is deleted, the defaults for the application are restored and a new config file is created. This beha...

How to make a text box in a command line window?

I'm working with .NET (specifically Boo, but answers would work in C# too) and I want to know how I could create an editable box inside the command line, such that I could display a section of output in the top part of the command line, and have a one line box at the bottom for input, much like the program irssi (the IRC client) does. I...

how to know the project type of a VS C# project?

Joined a project a week ago. We use Visual Studio 2008 for C#. How do I know the VS project type (Windows Forms Application, WPF Application, Console Application, ...) of the existing project from its property? thanks, ...

.NET constant for number of seconds in a day?

Does .NET have a constant for the number of seconds in a day (86400)? ...

Dictionary with no 'payload' value in .Net

Occassionally I need to check for duplicate IDs in a set of values and generally I use a Dictionary for this - using just the keys and leaving values empty. Note that this is tight and highly optimized code so please no cries of 'premature optimization'! Assuming scenarios where CPU and RAM are being squeezed to the limit I was wanting...

Calculate week of month in .NET

Do the .NET libraries have an easy way of returning the week number for a given date? For example, input of Year = 2010, Month = 1, Day = 25, should output 5 for the week number. Closest I found was Calendar.GetWeekOfYear, which is almost there. Java has a date string format "W" which returns week in month but I can't see anything equi...

How do I pass transactions between threads for parallel execution?

I'd like to execute a task in parallel where each thread needs to have DB access but if one thread fails the transactions in all threads will fail. You can assume that the transaction is active before the threads are created and that it's committed after they complete. I'm also using a TransactionScope under the System.Transactions nam...