Author: way0utwest

  • Why Don’t We Have Better Practices?

    This essay isn’t quite Safe For Work (SFW) and might offend a few people, so be warned, but I found it somewhat humorous. It’s a look at all the insanity and problems with programming and software in the world. It certainly makes me glad that those of us working on software don’t actually build tangible objects like bridges.

    However the piece did make me think a bit. Why do we have so many conflicts and strange practices in our software systems? Why haven’t we decided upon more good security practices that we widely disseminate and use? Why doesn’t much of our code follow established patterns, like those that we might use to build a bridge?

    I think ultimately it’s because of the ease with which we can “try” something out in code. Our industry allows us to easily build mock ups of ideas, which often get altered and enhanced as we test out ideas to the point where we don’t have time to start over from the beginning in a new way. We continue to build and grow our systems like some sort of bizarre Winchester House, often afraid or uninterested in questioning the conglomeration of architectures that might be contained inside a single application. Even databases are not immune, containing multiple data models and substructures that may or may not mesh smoothly with each other, and often don’t contain much DRI at at all. I also think it’s the NIY syndrome that so many technologists have.

    It seems as though the more we learn about computing, and more important and embedded software becomes in our world, the less we seek to constrain the innovation and impose any sort of engineering or strong discipline on our systems. It makes me think we’ll never get to the highly integrated, and well running computer systems of the future.

    Steve Jones

    The Voice of the DBA Podcast

    Listen to the MP3 Audio ( 2.4MB) podcast or subscribe to the feed at iTunes and LibSyn. feed

    The Voice of the DBA podcast features music by Everyday Jones. No relation, but I stumbled on to them and really like the music. Support this great duo at www.everydayjones.com.

  • Powershell Tips–PSEdit

    I got this from watching a session from Jeffrey Snover at TechEd. It was a neat trick, and it’s worked better than what I used to do.

    Editing files

    Suppose I have the ISE open and I want to edit a file. I could easily do this:

    psedit_a

    Click File –> Open, or click the open Folder button, and get a dialog to open a file. I stopped doing that soon after I began playing with PowerShell because I was typing most of the time, and it was easier to do this:

    psedit_b

    Just type notepad and the filename, whether it exists or not, and have notepad open up. However working with notepad isn’t great because you lose intellisense and some of the other nice ISE features.

    However today I saw this. Type psedit and a file (it has to exist).

    psedit  attachdbs.ps1

    And I see the file open above.

    psedit_c

    Very cool.

    Of course, as I mentioned, the file needs to exist. If it doesn’t, then a CTRL+N will get you a new file, which you can save and then easily open from the command line the next time.

  • Quick Tips–SQL Prompt Formatting

    I love SQL Prompt, and think it’s a great productivity tool. Even before I worked at Red Gate, I love the tool and had a copy before Red Gate bought the technology from the original developer. Recently I’ve run into a few people that weren’t aware of some of the ways in which it can help you. This is a quick look at one of the ways I use SQL Prompt.

    Ugly Code

    It’s often that I’ll get code submitted at SQLServerCentral, or it will come in a demo from Red Gate, and it will look something like this:

    prompt_af

    This is actually code from Microsoft in the AdventureWorks 2008 sample database. It’s ugly and hard to read. In fact, I struggle trying to interpret code when I see it like this.

    Reformatting

    One of the things I probably do most often, after SSF, is reformat code so that I can read it. I have a few settings I prefer, but to apply them, I’ll click CTRL+K, then CTRL+Y and my code will get fixed.

    prompt_ag

    If I have invalid SQL, Prompt will throw an error and there will be a squiggle line under the offending sections. If I only want to reformat a portion of code, I can highlight it before hitting the shortcut.