.net

Assembly-wide / root-level styles in WPF class library

I have a C# (2008/.NET 3.5) class library assembly that supports WPF (based on http://dotupdate.wordpress.com/2007/12/05/how-to-add-a-wpf-control-library-template-to-visual-c-express-2008/). I've created several windows, and am now attempting to create a common style set for them. However, as it's a class library (instead of a WPF app), ...

MouseMove event too slow for painting

I'm using C# WinForms to create a level builder for my XNA game. I have a tile grid that you can paint with a Pencil tool, like in MSPaint. The problem is that when you drag the mouse fast(ish) to paint a line tiles get skipped. I've tried using one approach i saw on Google saying to spawn a thread to do the painting, but that didn't se...

.Net implementations

I've worked at two companies that implement ASP.Net two different ways. I tend to lean towards A, but my current job follows the B (more typical) approach. I'm wondering which is best, and also, are there formal names for these implementations? A) No project or solution was built. We simply pointed Visual Studio to a directory and sta...

What account is my service running as?

How do I determine what account a service is running as from within the service itself. ...

splash screen w/ load assembly status

Hi, I'm trying to create a splash screen that shows assemblies (all referenced library) loading status. I use AppDomain.AssemblyLoad AssemblyLoadEventHandler delegate to catch what assembly is being loaded but the problem is the event is not triggered when the program initializes. I tried register the event handler in application startu...

C# MySQL Connection problems

I'm now using Visual Studio 2008 Pro Edition. I installed Connector/Net 5.2 with Visual Studio integration. I restarted Visual Studio, and MySQL database now appears in the list of data providers. I entered my database information, and clicked "Test Connection" and it succeeds, but when I try to close the Add Connection dialog, I get an ...

Regular expressions question in .NET ...

In my ASP.NET application, I want to use regular expressions to change URLs into hyper links in user posts, for example: http://www.somesite.com/default.aspx to <a href="http://www.somesite.com/default.aspx"&gt;http://www.somesite.com/default.aspx&lt;/a&gt; This is fairly easy using Regex.Replace(), but the problem I'm having is th...

Control serializer in JsonResult aka Json function in ASP.Net MVC?

Is there a way to configure what JSON serializer is used when returning JSON via the JsonResult in the controller: public ActionResult SomeJsonFunction() { var x = SomeModelCode.SomeModelFunction(); return Json(x); } It looks like the default is the JavaScriptSerializer. I would love to be able to use the DataContractJsonSerializ...

Add rows programmatically to a DataGridTable

How do I add rows programmatically to a DataGridTable in C#? When the user selects an option, I want to repopulate a DataGridTable with fresh data, which I am acquiring as shown below: connect.Open(); MySqlCommand comm = connect.CreateCommand(); comm.CommandText = getCustomerInvoices + customerID + "\'"; ...

Can I create a regular windows DLL (for a plugin) in .NET?

I'm trying to create a plugin for a program. The program works by loading your plugin DLL and executing specifically named functions within that DLL. Pretty standard stuff. However, I'd like to create my plugin in C# (and I am a bit of newbie). My question is, can I export regular C like functions from C#? or How do I easily create a...

How to remove objects from an Enumerable collection in a loop

Duplicate Modifying A Collection While Iterating Through It Has anyone a nice pattern to allow me to get around the inability to remove objects while I loop through an enumerable collection (eg, an IList or KeyValuePairs in a dictionary) For example, the following fails, as it modifies the List being enumerated over during the forea...

Developing a code base for multiple versions of a product

I know this is possible since there are so many packages available where you have a "Standard", "Professional", and "Enterprise" version of a package... but does anyone have any decent tutorials available on how a uISV would go about learning the techniques involved in developing a tiered feature piece of software? I've done multiple se...

TransactionProxyException using Enterprise Services

Hi, I have a windows service that s synchronises 2 databases using Enterprise Servcies. I t uses a ServicedComponent to do distributed transaction. I am getting a TransactionProxyException and the problem is intermittent. ie run the same data a second time and it may not happen. Anyone know what may cause this exception or guide how ...

How do I retrospectively create unit tests for a .NET application?

I am new to unit testing but am beginning to think I need it. I have an ASP.NET web forms application that is being extended in unforeseen directions meaning that certain bits of code are being adapted for multiple uses. I need to try and ensure that when changing these units I don't break their original intended use. So how do I best go...

Can I use a Regex in an XPath expression?

Something like ".//div[@id='foo\d+]" to capture div tags with id='foo123'. I'm using .NET, if that matters. ...

Sun branded competitor to .NET using the JVM

There have been many JVM languages in the recent few years including Javascript, Python, Ruby etc. (full list here: List of JVM Languages). My question is this: why has Sun not come out with a full suite of languages for the JVM just like Microsoft's .NET? With the new version of the JVM, they can make any necessary adjustments for dynam...

Can my .NET Web Services be considered as a RESTful interface?

Happy New Year. I have a bunch of SOAP Web Services. They all have an HTTP POST and GET interfaces along with the SOAP interface. I believe POST and GET are offered by default when building SOAP Web Services in .NET/Visual Studio. These methods either: (1) get information, e.g., provide your username, password and a transaction ID -> g...

Best practices when applying conditional formatting in data bound controls?

I have a Repeater contol bound to a custom object (an EntitySpaces query) and have noticed there are a couple of ways to conditionally format the values being displayed. 1) From my aspx I can call a method in my code-behind and pass through the bound value and use that to drive any conditional logic: <a class="star" href="<%#M...

How to draw 3D mathematical models in .NET? What 3D engine would best suitable to do this effectively?

Hi, I recently faced a problem of presenting the output of simple genetic algorithm that looks for extremes of 2 argument function f(x1,x2) . I would like to be able to use x1 as x, x2 as y and f as z and to draw points in 3d space that I could rotate. ( I'm currently drawing this on bitmap using color as the 'z axis'.) Where should I ...

.NET Rectangular Arrays: how to access in a loop?

Basically you have two ways for doing this: for (int x = 0; x < UPPER_X; x++) for (int y = 0; y < UPPER_Y; y++) { arr1[x, y] = get_value(); arr2[y, x] = get_value(); } The only difference is what variable to change in the inner loop: first or second. I heard that the results differ from language to ...