Over Macho Grande

Sunday, August 31, 2014

MSBuild, NuGet restore, and HintPath

First of, let me start by acknowledging that you're no longer supposed to use NuGet restore (with the .nuget) as of NuGet 2.7.  Then again, to quote Mick Jagger, you can't always get what you want.

The biggest problem I have with this is the "HintPath" in the project file.  It took some experimentation (and a couple of wrong turns) to work out that HintPath is relative to the project directory even when it's part of a multi-project solution.

You'll know that your HintPath is wrong when the NuGet package is installed but can't be found by the compiler.  Drop into the directory containing your project and confirm that you've got a valid HintPath.  One of my wrong turns was not verifying that I had a correct path (there was an extra 'lib' in the definition.

You may also see this as a busted reference in Visual Studio.


Monday, June 24, 2013

Application backstory

I'm in the "winding down" phase of my time here in Noumea.  One of my cornerstone achievements is migrating a buggy MS Access app into a shiny new MVC3 (and then MVC4) web application.

I've been working on it off and on for most of my time here (maybe 18 months) and one of my co-workers asked me to document some of the design decisions.  The app kind of grew organically, so I don't have a software spec to point to like I would have had at my prior engagements.  I felt a series of blog posts would be an appropriate way of documenting this.  It's an open source app, so the blog posts are my defense when someone digs into the app and finds some awful hack that migrated from a short-term fix to a permanent solution.

I've got nothing more today, but next time I'll dig into the choice of data access layer.

TUBS on GitHub

Friday, May 11, 2012

Don't buy a Portege R830

Okay, so this is something of a rant, but given my experiences with the laptop, how can I not?

Backstory:  Corporate IT maintains a list of acceptable portables, all of which are made by Toshiba.  After looking over the list, it looked like the best choice was the Portege R830.  It had the best possible CPU and it wasn't a giant clunker that looked my back-in-the-day 15 pound Inspiron 7000.  As a bonus, it was available with a reasonably priced docking station.

My first conception that something was wrong when, after first boot, I checked free memory.  Physically, 4GB is installed, but windows says that only 2.7GB is available.  The Intel HD3000 video setup is eating the rest (1.3GB!).  Okay, no big deal.  I can reboot and change that in the BIOS.  Oops.  No option.  Well, maybe it's just some old drivers.  Nope.  Drivers are latest from Toshiba.  They're not particularly new, so maybe the generic Intel ones will fix it.  Damn!  Toshiba has crippled the video so that it won't accept the Intel drivers.

Maybe if I install more physical memory.  As an aside, IT installed the 32-bit version of Win7.  I know, I know.  But I've got duty travel coming up, and getting the laptop within 3 months was a major achievement as it is.  Asking for a wipe on day two isn't going to win me any friends.

So, I dropped 8GB into the computer on the assumption that the BIOS would be smart enough to leave the 4GB that Win7 _can_ address to me, and take the rest for video, even if it is overkill.  No dice:  The BIOS reserves nearly 6GB of the 8GB memory for video.  Really?  Really?!

A tech support request to Toshiba hasn't been answered.  I got the obligatory "We'll get back to you within 24 hours" email, but no actual email.

I wouldn't think that being able to specify video memory would be all that big of a deal, but then again, this BIOS is pretty braindead.  I think I've seen more options on locked-down Pentium 1 era computers.  I'm not expecting overclocking options, but at least let me use the damn thing, especially if IT has already f**ked things up by only installing half the memory I asked for and then installing the 32-bit version of Windows.


Sunday, April 15, 2012

MVC3 Unobtrusive Validation, Bootstrap, and You

I _really_ like Twitter's Bootstrap.  It saves me from making any number of questionable content design choices.  I'm using it in an MVC3 project and one of the things that bugged me was the inability to get Microsoft's unobtrusive validation working with the fancy form control states in Bootstrap.

Well, after looking around on StackOverflow and poking and prodding MVC, here's what I've got:
If you correct the error, the state changes away from error and you get this:
I hacked this into place by inserting a shim error placement function.  It saves a handle to the original Microsoft implementation, changes the class on the nearest div with a CSS class of "control-group" and then calls the Microsoft implementation to display the actual error text.

$(document).ready(function () {
            var esettings = $.data($('form')[0], 'validator').settings;
            // Get a handle to the original errorPlacement function
            var originalFunction = esettings.errorPlacement;
            esettings.errorPlacement = function (error, inputElement) {
                // Although you have access to the form via $(this),
                // getElementById should be efficient
                // NOTE:  This assumes that the name and id properties are the same
                var id = "#" + inputElement[0].name;
                var controlGroup = $(id).closest("div.control-group");
                // error[0].innerHTML contains the validation error message
                if (0 == error[0].innerHTML.length) {
                    controlGroup.removeClass("error").addClass("success");
                } else {
                    controlGroup.removeClass("success").addClass("error");
                }
                // Call the original function
                originalFunction(error, inputElement);
            }
        });
 There's probably a much smarter way to do this, but this works well enough for now.

Labels: , ,

Tuesday, March 27, 2012

Initial Speech Recognition App

I'm pretty impressed with Microsoft's System.Speech API.  It took less than 3 days to throw together a proof-of-concept application.  The hardest part was probably coming up with the grammar -- documentation for that is pretty thin on the ground.

Anyways, here's the application source code on GitHub if anyone wants a look:
ObserverLengthSampler project

If nothing else, I'd recommend it as a starting point for someone needing a number recognition SRGS grammar in an XML format.

Labels: , ,

Monday, March 26, 2012

Speech Recognition

I just got a short side project @ work:  Use speech recognition to capture fish species and length from tuna observer samples.  I'm going to try the win7 version first but I'll probably wind up giving sphinx a try too.

Sunday, November 27, 2011

Gingerbread redux

I've been running GingerStreak of late and I'm not best pleased with the results. So I thought I'd try my hand at building Gingerbread for the Streak. Dell has helped out by actually releasing a working kernel. Just so I remember, here's how I put myself onto the latest released msm8660 build (gingerbread_house @ CodeAurora):

 repo forall -c git checkout M8660AAABQNLZA3620 

 Initially I just moved the original externals to a .aosp directory (e.g. bluetooth -> bluetooth.aosp) so that I could diff them, but the default build process still wants to build 'em. Looks like I'll have to move it outside the tree.

Labels: , ,