.net

Should I delete child objects from the client, or via a stored proc

I am working on both parts of a data layer. I get to create the procs, and the business object layer that will consume the procs. Is there a best practice for determining where a delete should occur? Here's the scenario. I have a table Book with foreign key to a child table Pages. If I delete the book, I also want to delete the page...

How should I handle URLs inside XML?

I'm creating an XML document and I want to store URLs inside the a node like so: <ns:url>http://example.com&lt;/ns:ulr&gt; My question is, do I need to encode/escape the URL in anyway? If I do the will the .Net XmlDocument object handle this for me? ...

In active directory, what is mailNickname used for?

In active directory, should mailNickname always equal samaccountname? Or, should it always be equal to the mail property (minus the "@domain")? My reason for asking is that we have recently changed everyone's primary email address to the first.last form and we set the mail property to the same. But, do we also need to modify the mailNi...

Does String.ToLower() always allocate memory?

Does String.ToLower() return the same reference (e.g. without allocating any new memory) if all the characters are already lower-case? Memory allocation is cheap, but running a quick check on zillions of short strings is even cheaper. Most of the time the input I'm working with is already lower-case, but I want to make it that way if ...

Developing a Robocode type game with .Net, for a School Assignment

I am currently in my final year at school, studying for a Higher National Diploma in Computer Studies, and basically in this final semester, we need to develop a Software Project, that basically incorporates a whole system. Now, what I'm thinking of doing is something along the lines of Robocode, but instead of Java, I will be doing th...

Show/Hide details WinForm

I am creating a WinForm App(.net3.5) where I display some Client Details. My issue is that we have a directions field that correlates to an Address. To save room I would like to have the directions hidden until the user "wishes" to see them. My intended method was to have an "accordion" like presentation for the directions. I would im...

XmlSerializer and decorated classes (C#)

I leveraging the XmlSerializer to convert to/from XML. Here is an example class: [XmlRootAttribute("myClass")] public class MyClass { private string someField; [XmlElement("someField")] public string SomeField { get { return someField; } set { someField = value; } ...

Vectorizing an image

I'm trying to generate a vector graphic from an area in a bitmap image, and while my current algorithm works for most cases it has some problems and it is quite slow. So I was wondering if you people know of any simple algorithms or code examples of how to do this efficiently. My situation is simple. I have a bitmap image, with sever...

.net DeflateStream 4Gb Limit

From msdn: http://msdn.microsoft.com/en-us/library/system.io.compression.deflatestream.aspx This class cannot be used to compress files larger than 4 GB. Do you know any other implementations for .net without the 4 gb limit? Thanks NOTE: I really need to decompress a file in GZ format with content larger than 4gb. Do you know any co...

Should I call Close on HttpWebResponse, even if it's inside a using statement?

The question says it all, I have some code like, this code is used very heavily: using (HttpWebResponse response = _GetHttpWebResponse(requestURIString, msgBody, methodType, contentType, headers)) { //*** do something with it... //*** Call response.Close() ??? } The code works fine today, but the connections to the serv...

.Net: Running code when assembly is loaded

Is it possible to run some code when an assembly is loaded, without doing anything specific in the loading code? What I am looking for is like a static constructor on a type. Eg: Assembly A does not know about Assembly B, but B does know about A. Assembly A needs to know certain things about B if B is loaded. When Assembly B is loaded ...

Is there such a thing as a Per-User Global Assembly Cache?

Question says it all ...

Is there a good way to display a DataTable in pure WPF?

Is there a good way to display a DataTable in pure WPF? I'm looking for something similar to System.Windows.Forms.DataGrid, but only for one data table, and in WPF. ...

What Happened to Handlers (ASHX) in ASP.NET 3.5

Why does the default "generic handler" code in an ASP.NET 3.5 web application add attributes to the class but not the correct namespace references. This is the template they give you out-of-the-box: using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace Handler1 { /// <summary> /// Summar...

C# : Invoke a method with [Type].InvokeMember() in a separate Thread

I am using this code where I am invoking the run method of a List of classes that I loaded dynamically from dlls: for (int i = 0; i < robotList.Count; i++) { Type t = robotList[i]; //robotList is a List<Type> object o = Activator.CreateInstance(t); t.InvokeMember("run", BindingFlags.Default | BindingFlags.InvokeMethod, null,...

How did you get ASP.NET to output UTF-16 encoded text?

How did you get ASP.NET to output UTF-16 encoded text? I serialize an object in .NET which by default is UTF-16 format. Now I want to send the string as an output response to an .ashx request. I get the error: Switch from current encoding to specified encoding not supported. Error processing resource How do I tell my website or page t...

How do I get System.Windows.ShowDialog() to return 'true'?

How do I get System.Windows.ShowDialog() to return 'true'? I am a little new to this. System.Windows.ShowDialog's return type is bool? It is supposed to return true when you hit Submit, and false when you hit Cancel. But I am not sure how to designate which button is the official submit button. EDIT: On a related note, I am curiou...

Binary Deserialization with different assembly version

I have a project which uses BinaryFormatter to serialize a collection of structs with string and bool? datatypes. The serialization/deserialization works fine, however if I were to change the assembly which does the work it fails to deserialize because of the header in the binary file indicating that it requires Assembly x instead of As...

Flags with web services

I have a flag attribute enumeration that is behind a web service as follows: [Serializable,Flags] public enum AccessLevels { None = 0, Read = 1, Write = 2, Full = Read | Write } My problem is the consumer of my web service does not have the original constant values of the enum. The resulting proxy class client side has...

VB .NET Save Panel without form

In Visual Studio 2008, using VB .NET, I have a Split Container that I want to dynamically load panels into the Panel2 slot from other team member's work based on user input in the Panel1 controls. Can my team members work on panels outside of a form, save it, then have the main Form just load those panels when needed without copying and...