Patrick McVeety-Mill:

Loud & Abrasive


Posts on development, software, and technology including tips, troubleshooting, and "nobody-asked-you" commentary.

  • Flagrant Error: Function Syntax In PowerShell

    The modarn developer can easily find themselves knee-deep in several programming languages. Between javascript and the server language of your choice for the web, the various options for mobile platforming, or the many hats of the academic, chances are if you’re making for computers you’re some degree of a polyglot.

    Despite the challenges of context-changing between languages, most of them (particularly of the object-oriented variety) are similar enough in appearance and general methodologies. And yet sometimes this familiarity betrays us. Below is a simplified scenario roughly akin to the pickle I recently found myself in, wherein I was calling a PowerShell function from an external module: Disclaimer: I don’t know PowerShell

    Read On
  • Checked="checked" in Razor

    I often see the following Razor-enhanced form markup for writing out input checkboxes, particularly in loops where a given checkbox may be checked or unchecked based on some state in the Model. In the completely real scenario below, I have a form on a webpage where I select fruits for a smoothie:

    @foreach(var fruit in Model.AllFruits)
    {
        var id = "SelectedFruits_" + fruit.Id;
        if (Model.SelectedFruits.Contains(fruit.Id))
        {
            <input id="@id" name="SelectedFruits" type="checkbox" value="@fruit.Id" checked="checked" />
        }
        else
        {
            <input id="@id" name="SelectedFruits" type="checkbox" value="@fruit.Id" />
        }
    }
    
    Read On
  • Don't Put Links Inside Buttons

    And Vice Versa

    This assertion may be old news to you, and if it is feel free to breeze by, but I just made this mistake and surely I’m not the only or the last one to come upon it.

    The anchor (<a>) and button (<button>) html tags are designed for different purposes. Buttons act in forms, anchors (links) are practically anywhere and go to other pages. Thinking people like Chris Coyier have posted some thoughts about that before, and I’m sure there are many opinions about it, as living things like html are wont to lead to.

    Read On
  • Dynamic Collapse Headers in Bootstrap

    Twitter Bootstrap sure is fancy. With it or cousin framework Foundation, you can whip up a pretty nice, modern-looking website with minimal effort. (Though personally, I often prefer the less-opinionated Pure framework.) These libraries and tools provide the groundwork and components to style your way into the future, but also leave out some of the nuances to enhance your user experience to primo usability and slickness.

    Bootstrap’s Collapse component is pretty handy. It looks like this:

    Read On