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.
Installing a D-Link DWA-125 Wireless 150 USB Adapter on Ubuntu
Submitted by Duncan Bayne on Mon, 2010-07-19 11:34All you need to do is follow these handy instructions on LinuxForums.org and you'll be good to go.
Edited to add: ... and if you want your drivers to load at boot, don't forget to add rt3070sta to the end of your /etc/modules file.
Edited to add: ... as well as adding the following lines to /etc/modprobe.d/blacklist.conf so it loads the correct drivers upon reboot:
blacklist rt2800usb
blacklist rt2870usbSony MDR-NC22 earbuds - good but could be better
Submitted by Duncan Bayne on Mon, 2010-07-19 07:20I just purchased a set of Sony MDR-NC22 ANR earbuds. After spending half a day waiting for Philips to fail to tell me where in Melbourne I could buy theirs (so much for the advantages of bricks & mortar stores), I hopped on eBay and had purchased the Sony model in under a minute, which arrived within two days.
I love the ANR when I'm on the train or when I'm programming (next best thing to having a private office when you need a bit of quiet thinking time), but the weight of the cable is supported by my ears, making them a bit sore after a day's wear. Also, I miss the functionality of the headphones that came with my HTC Desire, i.e., the hands-free calling and the media controls.
So, here's a product I want: the Ultimate In-Ear Headphones (TM), as defined by the following requirements:
- in-ear buds, using rubber grommets similar to the Sony MDR-NC22
- over-the-ear supports similar to the Sennheiser OMX 50 (the comfiest headphones I've ever owned)
- sound quality at least as good as the aforementioned Sony unit
- active noise reduction that's at least as good as the aforementioned Sony unit (which gets some unfair bad reviews, mostly from people who don't understand that you need a good tight fit for the ANR to work properly)
- hands-free call support for my HTC Desire
- track play / skip support for my HTC Desire
I'd happily flog my Sony 'phones if something with the above spec was available.
Gnome configuration from the command line
Submitted by Duncan Bayne on Sun, 2010-07-18 05:50I have my own private Subversion repository, in which I keep all my personal documents, along with a script that sets up Ubuntu GNU/Linux just the way I want it. In case you didn't know, there's a handy tool called gconftool-2 that allows you to programmatically control the behavior of properly implemented Gnome apps. E.g., in my script, I call:
gconftool-2 --set /apps/guake/style/background/transparency --type integer 20
gconftool-2 --set /apps/guake/keybindings/global/show_hide --type string "grave"
gconftool-2 --set /desktop/gnome/background/picture_filename --type string "$(pwd)/images/default_desktop.jpg" This does pretty much what it looks like it ought to do: it tells Guake (a Quake-style slide-down terminal) to use 20% transparency and display on ALT+~, and sets my default desktop to a particular file that's stored in my Subversion repo.
Installing Ubuntu on a PC with an ABIT AB9 mobo
Submitted by Duncan Bayne on Sun, 2010-07-18 02:38The ABIT AB9 motherboard has a reputation for being buggy and prone to hanging when running Linux; a quick Google search shows the problems people have been having. However! There is a solution. It's a painful one, but it works (note that my configuration has SATA but not RAID; this may effect the FreeDOS boot parameters) ...
- go into BIOS Setup and load fail-safe defaults
- if you don't have a floppy drive, make sure BIOS knows that, or things will become a little confused when you try to boot FreeDOS
- download and burn the full FreeDOS ISO
- download the latest AB9 BIOS update and put it on a USB flash disk
- install FreeDOS onto the hard drive (yes, really - issues with CDROM support on early AB9 BIOS releases means that this is the best way)
- boot off the FreeDOS live CD, and edit C:\FDCONFIG.SYS to remove the phrase "TUNS" from the end of the SHELLHIGH directive (see here for the reason)
- boot using your Ubuntu live CD, and copy the BIOS flash utility from the USB keychain to the FreeDOS partition; you may have to attempt this multiple times as the old AB9 BIOS will be causing Linux to crash randomly but frequently
- reboot into FreeDOS in safe mode (either from the live CD or the startup menu) and run the BIOS flash utility
- when prompted by the BIOS flash utility, hit F1 and the machine will reboot
- BIOS will then complain about a CMOS checksum error; press DEL to enter BIOS setup and load optimized defaults, disable the floppy drive (unless you have one), and set the first boot device to be the CD-ROM
- boot from the Ubuntu live CD and install Ubuntu
- go and put some more home-brew in the fridge
I'll update this post if I ever hear back from ABIT; I lodged a support request explaining the situation but they never replied.
In other news, FreeDOS is fun ... if you ever have a hankering for the 'good old days of DOS' or have a requirement to run DOS software (like BIOS flash utilities) I suggest giving it a whirl. It even comes with the OpenGEM GUI environment and a bunch of dev tools ...
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.



Recent comments
1 week 17 hours ago
3 weeks 2 days ago
3 weeks 6 days ago
11 weeks 16 hours ago
15 weeks 4 days ago
31 weeks 5 hours ago
31 weeks 11 hours ago
37 weeks 3 days ago
37 weeks 3 days ago
37 weeks 3 days ago