Monday, October 26, 2009 |
|
|
Took me a bit of searching, but finally came across this article - http://www.satter.org/2007/10/compact-framewo.html which describes how to get LINQ goodness in you mobile apps.
Add reference to System.Core and you are away. NOTE: there isn't any L2S support in there yet, you'll just get the basics. |
Monday, October 26, 2009 6:37:22 PM (GMT Standard Time, UTC+00:00) | | c#
|
|
|
|
Thursday, October 22, 2009 |
|
|
Had a quick look at this today, as I wanted to see if there was a better way than doing: try
{
doSomething();
}
finally
{
Log.LogEvent("some log");
}
catch
{
Log.LogEvent("some error");
}Came across a library called PostSharp, which I'm going to give a go on a new project. It's had a decent write-up in the community, so hopefully this should keep the code nice and clean. You can find a decent tutorial here. |
Thursday, October 22, 2009 9:30:50 AM (GMT Standard Time, UTC+00:00) | | c#
|
|
|
|
Friday, October 02, 2009 |
|
|
When you're creating an app that uses Linq and you want to see the SQL that is generated, you can attach to the Log property of the DataContext. To get this to stream to the DebugWindow, use the following bit of code (credits to Kris Vandermotten - http://www.u2u.info/Blogs/Kris/Lists/Posts/Post.aspx?ID=11) using System;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Text;
namespace Vandermotten.Diagnostics
{
/// <summary>
/// Implements a <see cref="TextWriter"/> for writing information to the debugger log.
/// </summary>
/// <seealso cref="Debugger.Log"/>
public class DebuggerWriter : TextWriter
{
private bool isOpen;
private static UnicodeEncoding encoding;
private readonly int level;
private readonly string category;
/// <summary>
/// Initializes a new instance of the <see cref="DebuggerWriter"/> class.
/// </summary>
public DebuggerWriter()
: this(0, Debugger.DefaultCategory)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="DebuggerWriter"/> class with the specified level and category.
/// </summary>
/// <param name="level">A description of the importance of the messages.</param>
/// <param name="category">The category of the messages.</param>
public DebuggerWriter(int level, string category)
: this(level, category, CultureInfo.CurrentCulture)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="DebuggerWriter"/> class with the specified level, category and format provider.
/// </summary>
/// <param name="level">A description of the importance of the messages.</param>
/// <param name="category">The category of the messages.</param>
/// <param name="formatProvider">An <see cref="IFormatProvider"/> object that controls formatting.</param>
public DebuggerWriter(int level, string category, IFormatProvider formatProvider)
: base(formatProvider)
{
this.level = level;
this.category = category;
this.isOpen = true;
}
protected override void Dispose(bool disposing)
{
isOpen = false;
base.Dispose(disposing);
}
public override void Write(char value)
{
if (!isOpen)
{
throw new ObjectDisposedException(null);
}
Debugger.Log(level, category, value.ToString());
}
public override void Write(string value)
{
if (!isOpen)
{
throw new ObjectDisposedException(null);
}
if (value != null)
{
Debugger.Log(level, category, value);
}
}
public override void Write(char[] buffer, int index, int count)
{
if (!isOpen)
{
throw new ObjectDisposedException(null);
}
if (buffer == null || index < 0 || count < 0 || buffer.Length - index < count)
{
base.Write(buffer, index, count); // delegate throw exception to base class
}
Debugger.Log(level, category, new string(buffer, index, count));
}
public override Encoding Encoding
{
get
{
if (encoding == null)
{
encoding = new UnicodeEncoding(false, false);
}
return encoding;
}
}
public int Level
{
get { return level; }
}
public string Category
{
get { return category; }
}
}
} |
Friday, October 02, 2009 10:17:53 AM (GMT Standard Time, UTC+00:00) | | c# | Database
|
|
|
|
Thursday, October 01, 2009 |
|
|
When using SVN, you want to make sure that people provide (by automatic enforcement) a message with their Commit. Usually, you would do this using a Pre-commit hook, which would run a bit of script and validate this for you. Unfortunately Beanstalk does not support this at the moment, although hopefully this will be introduced in the future. http://help.beanstalkapp.com/discussions/questions/141-pre-commit-hook |
Thursday, October 01, 2009 3:56:07 PM (GMT Standard Time, UTC+00:00) | | Build Process
|
|
|
|
|
Before I forget, here is a link which shows how to achieve rounded corners in IE
http://msdn.microsoft.com/en-us/library/bb250413(VS.85).aspx
|
Thursday, October 01, 2009 8:35:13 AM (GMT Standard Time, UTC+00:00) | | Web Design
|
|
|
|
|
|
|
| Archive |
| July, 2010 (1) |
| June, 2010 (3) |
| May, 2010 (6) |
| April, 2010 (5) |
| March, 2010 (1) |
| February, 2010 (3) |
| January, 2010 (6) |
| December, 2009 (4) |
| November, 2009 (4) |
| October, 2009 (5) |
| September, 2009 (3) |
| August, 2009 (4) |
| July, 2009 (2) |
| June, 2009 (7) |
| May, 2009 (3) |
| April, 2009 (4) |
| March, 2009 (1) |
| February, 2009 (2) |
| January, 2009 (4) |
| December, 2008 (6) |
| November, 2008 (4) |
| October, 2008 (1) |
| June, 2008 (2) |
| May, 2008 (1) |
| March, 2008 (5) |
| February, 2008 (3) |
|
|
|
|