Monday, April 30, 2012

Making Contact Sheets with "montage"

Being very cheap, er,..., I mean frugal, and wanting to get a bunch of small pictures printed on real photo paper that I could slice into tiny 1 inch by 1.5 inch smaller-than-wallet photos, I used the open source, free "montage" program in the ImageMagick suite of tools on windows XP to create a contact sheet with this command:
montage pencil.jpg pencil.jpg pencil.jpg pencil.jpg pencil.jpg ^
pencil.jpg pencil.jpg pencil.jpg pencil.jpg pencil.jpg pencil.jpg ^
pencil.jpg  pencil.jpg pencil.jpg pencil.jpg pencil.jpg ^
-tile 4x4 -geometry +0+0  -border 0 -rotate -90 pencils.jpg
(Surely there's a way to not repeat "pencil.jpg", but I was in a hurry.) The source photo, in this case "pencil.jpg", needs to be 1 inch by 1.5 inches which will reproduce 16 times on a standard 4x6 inch photo. This is great if children want to give others a small picture of themselves.

Friday, April 20, 2012

Execution of user code in the .NET Framework is disabled. Enable "clr enabled" configuration option

While running a test from a project I've taken over, I get this error:
Execution of user code in the .NET Framework is disabled. Enable "clr enabled" configuration option
My first thought is , "I thought the .NET Framework kinda *had* to run CLR code." Turns out the project is using .Net CLR inside the database. The error message wanted to be
Execution of user code in the .NET Framework inside the database is disabled. 
Execute this TSQL:  "sp_configure 'clr enabled',1" and "RECONFIGURE"
So to fix this run this TSQL inside the database.
sp_configure 'clr enabled',1
sp_configure 'clr enabled'  -- make sure it took

Thursday, April 19, 2012

Pictures from Enterprise Mobile Applications with ASP.NET MVC 4 Workshop

Jimmy Bogard and Jeffrey Palermo from gave an insightful presentation at Enterprise Mobile Applications with ASP.NET MVC 4 Workshop to 45 people last Tuesday. Here's a few pics:

My jumbled musings and take-aways:
  • Microsoft is starting to realize we are in the 21st century and thankfully putting their MVC4 in an open format that ... gulp ... real users can see the source code and submit fixes at This is such a welcome change from the "We-are-the-smartest-people-in-the-world-and-no-one-else-could-possibly-contribute-anything-of-value-to-us." attitude.
  • "Web Api" is the new term for http access to data. REST is a little too vague.
  • will allow block editing in Visual Studio.
  • Chrome has a handy extension, "Advanced Web Client", for playing with web services, ur, I mean "Web Apis". It allows you to enter headers like "accept: application/xml" to tell MVC4 what for to download.
  • Skeleton is a good css framework for creating Responsive Web application so layout changes intelligently with changing screen size. Skeleton uses a 960 pixel area divided into 16 strips.
  • Headspring has example code checked in at
  • Much of the Responsive Web is done with the @media query in css:
    @media screen and (max-width: 524px) {
    #container, footer, #sidebar, #content { width: 292px; }
    #content article h2 {font-size: 24px;}
  • MVC4 has automatic bundling of css files, so you can declare a directory of css files and it will bundle and minimize all the css files into one file to speed delivery.

Wednesday, April 18, 2012

The URL-encoded form data is not valid

As a developer, it's the call you always dread.
"Hey, you know that web site that's been working great for years - it's broken."
We had that experience this last week with this error:
SOURCE: System.Web
TARGETSITE: Void FillInFormCollection()exception: System.Web.HttpException: 
  The URL-encoded form data is not valid. ---> 
Operation is not valid due to the current state of the object.
at System.Web.HttpValueCollection.ThrowIfMaxHttpCollectionKeysExceeded()
at System.Web.HttpValueCollection.FillFromEncodedBytes(Byte[] bytes, Encoding encoding)
at System.Web.HttpRequest.FillInFormCollection()
--- End of inner exception stack trace ---
at System.Web.HttpRequest.FillInFormCollection()
at System.Web.HttpRequest.get_Form()
at System.Web.HttpRequest.get_HasForm()
at System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull)
at System.Web.UI.Page.DeterminePostBackMode()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
To prevent malicious attacks against sites, Microsoft in the patches for Bulletin MS11-100 limits the number of name-value pairs to 1000.
To increase this number you need to add this key to the website's web.config or to the machine.config(s) on your servers:
<add key="aspnet:MaxHttpCollectionKeys" value="3000" />

Monday, April 16, 2012

Reducing the size of Sql Server log files

How do I trim down the size of log files in MSSQL 2008?
A quarter of my precious SSD disk space on my dev laptop was in database log files, the *.ldf files in C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA.
Since I'm not a Sql Server expert, I googled and stackoverflowed and patched together the minimum statement I needed to rid me of these tenacious ldf files.
Do not use these on production machines. Use only on development boxes where you are testing and really don't care about the database. This statement took the log size of my typical database from 15Gig to 30K.