|
Thu
Oct 19 2006 |
Hide property from the Visual Studio Designer |
[Browsable(false), DesignerSerializationVisibility( DesignerSerializationVisibility.Hidden)] |
|
Tue
Oct 17 2006 |
Web Project Errors |
|
When opening a web project:
Create a file called c:\inetpub\wwwroot\Folder\MyProject.csproj.webinfo and add: <VisualStudioUNCWeb> <Web URLPath = "http://localhost/Folder/MyProject.csproj" /> </VisualStudioUNCWeb> |
|
Sat
Oct 14 2006 |
Books to Check out |
|
Agile Principles, Patterns and Practices in C# (Robert C Martin) |
|
Sat
Oct 14 2006 |
.Net Articles |
|
The Cost of GUIDs as Primary Keys |
|
Thu
Oct 5 2006 |
Double.NaN Equality |
Console.WriteLine(double.NaN.Equals(double.NaN)); // True Console.WriteLine(double.NaN == double.NaN); // False |
|
Tue
Sep 19 2006 |
Removing double.NaN from a SQL table |
|
SQL Server’s float datatype does not support the double.NaN value. SQL and T-SQL will prevent these values from entering the database, but ADO.Net does not. Query Analyzer will stop displaying additional results once it hits a NaN value. Enterprise manager will display -1.#IND. Normal queries on this value will result in errors so it is difficult to remove them. The solution: convert to a string first. UPDATE mytable SET floatColumn = NULL WHERE cast(floatColumn AS varchar(100)) = '-1.#IND' |
|
Sat
Jul 1 2006 |
Custom Configuration Section (.Net 2.0) |
|
To add a custom configuration section to a project:
|
|
Fri
Jun 30 2006 |
Quick XML Serialization |
public void SaveXml(string filename) { XmlSerializer xml = new XmlSerializer(this.GetType()); using (FileStream fs = new FileStream(filename, FileMode.Create)) { xml.Serialize(fs, this); } } public static Accounts LoadXml(string filename) { XmlSerializer xml = new XmlSerializer(typeof(Accounts)); FileInfo f = new FileInfo(filename); if (!f.Exists || f.Length == 0) return new Accounts(); using (FileStream fs = new FileStream(filename, FileMode.Open)) { return (Accounts)xml.Deserialize(fs); } } |
|
Sun
Jun 25 2006 |
Syntax Highlighting in WordPress |
|
Syntax highlighting with iG:Syntax Hiliter is mostly working now. This is the best excuse for hosting my own WordPress installation. I’ve found a few tweaks are needed to get this going:
|
|
Sun
Jun 25 2006 |
Redirect Trace Messages to a TextBox |
/// /// Outputs trace messages to a textbox. To use call /// Trace.Listeners.Add(new TextBoxTraceListener(textBox1). /// All subsequent calls to Trace.WriteLine() are copied /// to textBox1. /// public class TextBoxTraceListener : TraceListener { private TextBox textBox; /// /// Constructor /// public TextBoxTraceListener(TextBox p_textBox) { textBox = p_textBox; } /// /// Write a message to the textbox /// public override void Write(string message) { textBox.Text += message.Replace("\n", "\r\n"); } /// /// Write a message with newline to the textbox /// ///<param name="message" /> public override void WriteLine(string message) { this.Write(message + "\n"); } } |