Development
No lambdas in the Visual Studio immediate window
Submitted by Duncan Bayne on Thu, 2010-07-29 02:12So I'm looking at some code that's failing, using the immediate window in Visual Studio. I type an expression:
parent.Children.Where(c => c.Property != 42)... and Visual Studio responds with:
Expression cannot contain lambda expressionsIt turns out that this is by design. Neat. No script/console equivalent for me :-( Maybe if enough of us up-vote that Connect issue MS might decide to bring VS into the 21st century.
Column editing in Visual Studio 2010
Submitted by Duncan Bayne on Wed, 2010-07-28 00:29Visual Studio 2010 now - finally - has column editing; see Visual Studio 2010 - Box Selection for instructions. It's gradually catching up to Emacs in some respects ;-)
Ugly language
Submitted by Duncan Bayne on Wed, 2010-07-21 08:00... and I don't mean programming. I was reading a blog post explaining an aspect of Haskell programming, and I got to this line:
If you like this style, that’s cool, but if you want to tell me that I should like it as well, be prepared to get punched in the face.
Perhaps I'm missing the humour in it, but that sort of statement is neither funny or enlightening. Reading it makes me hope to never meet the author in person.
Tools for Silverlight TDD & CI
Submitted by Duncan Bayne on Fri, 2010-07-16 02:27I'm currently spending my days working on a Silverlight application built using the standard SL4 technology stack: SL4, WCF + RIA, IIS, SQL Server. Certain areas have proved particularly painful, especially trying to develop test-first with continuous integration using Silverlight. It is possible however, using the following tools:
- ReSharper - an absolutely essential tool if you're working on .NET or Silverlight code
- AgUnit - a plugin for ReSharper that allows you to quickly run or debug Silverlight tests from within the Visual Studio IDE
- TeamCity - a continuous integration / build server
- Moq - a mocking framework with Silverlight support
- StatLight - a command-line runner for Silverlight tests
All you need to do is get TeamCity to invoke the Silverlight tests with StatLight as per these instructions and you're good to go :-)
Oh, and whatever you do, don't use TFS.
What does MinValue mean? It depends ...
Submitted by Duncan Bayne on Thu, 2010-07-01 03:43MSDN defines Double.MinValue as representing "... the smallest possible value of a Double."
double.Parse(string.IsNullOrWhiteSpace(text) ? double.MinValue.ToString() : text);
However, the above fails when text is "", because double.Parse() fails on double.MinValue.ToString(), claiming that it's too small to be a double. Clearly, MinValue meant two different things to two different developers at Microsoft :-)
I've replaced it with:
double result;
if (!double.TryParse(text, out result))
{
result = double.MinValue;
}
... which works nicely.
Clearing the deck
Submitted by Duncan Bayne on Wed, 2010-06-30 03:26Astute observers may have noticed that I've removed several GitHub repositories (duncans_fvwm, duncans_emacs and plumbing) and emptied the andelys repository.
I originally made duncans_emacs and duncans_fvwm public as part of a tutorial series on Emacs, but seing as almost no-one has been making use of them or following the tutorial, I've shut them down and incorporated both into my private Subversion repository. Plumbing has gone west as a consequence of my decision to restart the andelys (Rails-based media player) project using Hobo.
Finally, I've marked the Wuji project as no longer under active development, simply because it does what I need it to and I have no plans for additional features.
Fix Silverlight 4.0 debugging in VS2010
Submitted by Duncan Bayne on Mon, 2010-06-28 01:40I just upgraded Firefox to 3.6.6, and immediately noticed that Silverlight 4.0 debugging through Visual Studio 2010 was broken; if I set a breakpoint & hit F5, I'd get the dreaded "The breakpoint will not currently be hit. No symbols have been loaded for this document" message.
Coding music: Gotye
Submitted by Duncan Bayne on Wed, 2010-01-27 04:21Armin brought Gotye to my attention - makes great coding music ...
From his blog ...
Ummmm, let’s see- I’m recording vocals and various instruments in this barn south-east of Melbourne:
Oh, and I’m using these thingies- stone wool, felt-covered tube traps that my dad made. They’re great for sorting out the acoustic issues known as “barniness”
Love it! :-)
HTTP 417 error when POSTing to Lighttpd
Submitted by Duncan Bayne on Sat, 2009-12-19 04:18We just shifted from using HTTP GET to HTTP POST for some of our web services; in this case, we are POSTing from a .NET 2.0 application to a Ruby on Rails server running on Lighttpd (a.k.a. lighty).
This resulted in an HTTP 417 error.
This is caused by the Microsoft .NET WebClient class adding an expect header into the POST, which in turn causes Lighttpd 1.4 to fail. The fix (as explained by Phil Haack) is to make the following call before POSTing:
System.Net.ServicePointManager.Expect100Continue = false;Stack Overflow
Submitted by Duncan Bayne on Fri, 2009-12-04 23:04So far, I'm very impressed with Stack Overflow. It's a great source of information (many of my more obscure development-related Google queries wind up there), and a good way to promote yourself while helping build the already useful repository of information and advice.
My original plan was to post regularly on Rails Forum, but to be honest Stack Overflow appeals more. There's a broader range of technologies represented there, and the reputation system gives me a direct incentive to continue answering questions. So, I've added a little Stack Overflow block to the right-hand column of my blog, & I'll see how my time & motivation goes w.r.t. growing my reputation.



Recent comments
1 week 19 hours ago
3 weeks 3 days ago
3 weeks 6 days ago
11 weeks 17 hours ago
15 weeks 4 days ago
31 weeks 7 hours ago
31 weeks 13 hours ago
37 weeks 3 days ago
37 weeks 3 days ago
37 weeks 3 days ago