06 August 2015

Nice jQuery plugin for "Read more" text truncating

Spent some time researching options to do "Read more" functionality for text on a web page. Many were based on a preset height in pixel, which cut the text in mid-sentence, without adding any ellipsis. In addition, those which did truncate with ellipsis lacked a flexible animation. Then I found jTruncate from jMar's blog. It does the trick on any number of elements on the page via jQuery; it also includes options for animation and more/less link text.

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>

22 June 2015

Use the RGB color profile in Photoshop

For a project, I needed to submit images to a publisher in RGB. Photoshop, at least the CS5 version, uses a strange, home-brewed color profile called sRGB. The conversion to the correct color profile is described in this informative article, but then, when saving for the web as JPEG, Photoshop wants to convert the colors back to sRGB in the save dialog box (File > Save for Web and Devices > Convert to sRGB). Ensure this checkbox is not marked when saving the file, or your efforts might be for naught. Also, it's a good idea to check the box for "Embed color profile" for JPG file format when saving publication-quality files.

19 May 2015

Visual Studio's "Start Without Debugging" option grayed out and F5 doesn't work

Ran into a very strange situation today. Suddenly, Visual Studio 2015 RC's debug options broke and the F5 key would no longer start the project in debug mode. Even IISExpress had disappeared, only showing "Start", which generated this error when clicked: "The debugger cannot continue running the process. Unable to start debugging."

Another issue: The References folder was empty, even though .NET 4.5.1 and 5.0 were added earlier.

I tried a repair via the uninstall utility but issue was still there. Finally, I exported and reset all the settings in Visual Studio following this article. Lo and behold: the options were back and I could run the app in debug or Ctrl-F5 (non-debug mode). Why this happened all of a sudden today, I don't know. I wasn't changing any settings, just editing a C# file when Visual Studio suddenly stopped working.

Whew!

23 April 2015

Great article on the "Mobilegeddon": Search me: Google's 'Mobilegeddon' is good news. Google has a great blog post on it as well.

08 April 2015

Memory issues with IISExpress process on Visual Studio 2015

Visual Studio 2015 comes with IIS Express, which enables the localhost to serve as a web server without having to set up the app in Windows IIS. I was building a C#/MVC/Bootstrap site that kept crashing IIS Express. Some research revealed that we can run the server in 64-bit mode: Just go to Tools > Options > Projects and Solutions > check the box for "Use the 64 bit version of IIS Express for web sites and projects."

Memory usage by IIS Express went from over 700MB to 8MB now. Much better.

Publishing to an Azure website from Visual Studio 2015

This was trickier than expected. We thought it had to do with permissions, but even with Owner access to the Azure site, it still gave errors (a code 99 with Grunt, having nothing on Google about it). Well, I was trying to get Less installed on Visual Studio, and an article revealed that Grunt wasn't installed; nor was Bower.

The article walked me through installing Grunt and Bower, which help with running jobs and managing client-side packages, respectively. Then I still got this error:
INVOKEPOWERSHELL(0,0): Error : Unrecognized link extension 'contentLibExtension'.
Some more digging revealed a StackOverflow post with the answer. It had to do with an old version of the msdeploy.exe file. And then the publish worked like a charm.

23 March 2015