28 July 2015

The type or namespace name 'XmlNodeReader' could not be found (are you missing a using directive or an assembly reference?)

I had to download a Visual Studio 2015 RC solution to a VM and rebuild it. However, in the process, build errors popped up. They were similar to this one:

The type or namespace name 'XmlNodeReader' could not be found (are you missing a using directive or an assembly reference?) myapp.DNX Core 5.0

Lots of research and trial-and-error finally revealed the answer: The myapp project (an ASP.NET MVC app) had references to two frameworks -- DNX 4.5.1 and DNX Core 5.0. These were listed in the project.json file:

"frameworks": {
    "dnx451": {
      "frameworkAssemblies": {
        "System.Web": "4.0.0.0",
        "System.Xml": "4.0.0.0",
        "System.Xml.Serialization": "4.0.0.0"
      }
    }//,
    //"dnxcore50": { }
  },

This article had the answer. I needed to comment out the dnxcore50 in project.json; once done, the app compiled and all was well with Visual Studio. 

20 July 2015

Creating a peeling sticker effect in Photoshop

Used this great tutorial today to create some peeling stickers for Facebook ads.

01 July 2015

Pass arbitrary parameter to partial view in ASP.NET MVC

I had a chunk of HTML that needed to repeat in a few places, so it made sense to throw it into a partial view. However, each chunk had to have a unique ID for a Bootstrap collapse component. So a parameter needed to be passed in. Some research revealed a rather simple, elegant way in this article. Just pass it as the partial view's model:

@Html.Partial("~/Views/Shared/_TestimonialSubmitPartial", "1")

Then, in the partial view, read it using @Model -- it's the only value passed in, so no dot notation is necessary. Each time I'm using the partial view, I change the value.

In the partial view, I set the data-target of the Bootstrap button to the concatenated ID and also set the collapse div to that same value:
<button class="btn btn-default" 
    data-target="#testimonial-submit-instructions-@Model" 
    data-toggle="collapse" type="button">
    Submit Testimonial
</button>
<div class="collapse" id="testimonial-submit-instructions-@Model">
.....
</div>