Tuesday, March 24, 2015

Not in college anymore


So the other day, a friend says to me "... and it's just time to stop living like I'm in college, you know?"

In their particular case, I did know. I knew exactly, from having lived through a very similar circumstance once, and I could readily empathize with them. That said, it still made me think, quite a bit, on what that means.

In my case, it meant things joked about years ago as kids were now quite real:
  • If you don't pay your bills, mommy and daddy won't save you.
  • You really do have to get up every day for work.
  • Life is short. Eat dessert first.
  • You really do have to go to bed on time every night to get up the next morning.
  • Be nice to people, and in general, they'll be nice back.
  • Source control (and the processes like it in non-software careers) look like a lot of work, and can be, but actually are there to protect you. It's like insurance for your continued employment.
  • Investing is non optional. There will come a day where you don't want to or can't work anymore. Then what are you going to do?
  • Always, always, always buy the best shoes you can afford.
  • Invest in yourself - train yourself. Don't expect other people to get you places.
  • Do what you love, sure, but realize that the definition of "professional" says more about what you do when the fun is no longer fun.



Tuesday, March 17, 2015

Task Scheduler Error 2147942667

Cause
Error code 2147942667 indicates that the directory name is invalid. In most cases, this is caused by placing quotes around the "Start In" directory.

Resolution
Remove the surrounding quotes from the "Start In" path.

The path of the program to launch must be surrounded by quotes if it contains spaces; the "Start In" path must not be surrounded by quotes.






Tuesday, March 10, 2015

VMWare, Virtual Machines, and Viruses, Oh My!

So I'm building a new set of lab machines again. They're going to be using Windows Server 2008 R2 and SQL Server 2012 as guests inside of VMWare's VM Workstation 9.

I don't need virus protection for my VMWare based virtual / lab machines, because:

  1. The lab machines are virtual, and
  2. The lab machines, after activation, have no internet access, and
  3. If my host PC has a virus that transmits to my lab machines, I have bigger problems that an infected lab machine
So, I went in to my anti-virus program, and added read/write/execute exclusions for the following files types:
  • *.iso 
    • (Granted, ISOs are not really a part of the lab, per se, but I get better throughput when loading into the VMs if the source images aren't being scanned. For pete's sake, they're read only anyway.)
  • *.vmdk
  • *.nvram
  • *.vmsd
  • *.vmx
  • *.vmxf
  • *.vmem
  • *.vmss
What I did NOT exclude were the files that I know are also file type extensions used elsewhere, such as:
  • *.lck
  • *.log

Tuesday, March 3, 2015

Sometimes, it's the little things

Visual Studio 2013 editor highlights the current line by changing the background color of the current line.

By default, it's this hideously impossible to see also-black that looks like crud on my LED screen. Also, the fact that I'm using the dark theme means that also-black doesn't help when the highlight value is a grey value of 80% black.

So I changed it from the default to Navy for Active, and Olive to Inactive.

It's found in the Visual Studio 2013 menu at

  • Tools\Options\Environment\Fonts and Colors\


The ones to edit are

  • Highlight Current Line (Active)
  • Highlight Current Line (Inactive)

Tuesday, February 24, 2015

Change all the SSIS package's protection levels, all at once

So, I have a scenario where I'm working in SSIS 2012 on SQL Server 2012 with SQL Server Data Tools 2012 (SSDT), and in order to ensure all the packages are both coming to me and going to others with the same level of protection and level of editability, I need to change all of the protection levels of all the packages in my solution, all at once. Somehow, somewhere, one or more of them got reset to a non-default value - or maybe, we need to pull one back from some other source - either way, at anything above about two packages, this gets to be a real pain.

I found two options:

Before you do anything else:
  1. First things first, commit everything to source control, close SSDT, and make a zip backup of the whole project folder. 
  2. Verify the backup.
Then:

  1. Set or Change the Protection Level of Packages
    1. http://technet.microsoft.com/en-us/library/cc879310.aspx
    2. Now, open a command prompt at the folder with the packages you want to modify.
    3. Next, create either a command window, or a command file (AKA batch file) with this:
      1. for %f in (*.dtsx) do dtutil.exe /file %f /encrypt file;%f;2;strongpassword
    4. What I wanted instead was to set them to DontSaveSensitive, plus, I have spaces in the file names (radical, I know), so I used this:
    5. for %f in (*.dtsx) do dtutil.exe /file "%f" /encrypt file;"%f";0 /Q
    6. The /Q doesn't prompt to overwrite the existing package
    7. You can find more about the DTUtil syntax here
      1. http://msdn.microsoft.com/en-us/library/ms162820.aspx
  2. Open the .dtproj file using your favorite text editor, and do a find and replace on some strings like
    1. me="ProtectionLevel">3

  • So, for me, it was 
  • me="ProtectionLevel">3
  • and replace with 
  • me="ProtectionLevel">0
  • last, reopen and build



  • Tuesday, September 9, 2014

    SSIS Performance Counters missing

    Recently, I overcame an instance where my SSIS Performance Counters were missing out of PerfMon on my development machine. This made it incredibly hard to keep track of what was running and it's system-level impact once I kicked it off in SSMS. Sure, I can use the reports to see the messages and the overview report, yes, but what I really want is to know whether or not it's paging to disk!

    Specifically, I want these
    http://msdn.microsoft.com/en-us/library/ms137622(v=sql.110)

    Buffers spooled
    Buffer memory

    So, I tried

    Restarting Perfmon
    Hey, sometimes the simplest solution is still the answer! It wasn't this time, though.

    Reinstalling the counters
    This involved a call to the command line. When I remember the syntax (or find it in my notes...) I'll update it here.

    Setting the Performance Logs and Alerts service to start automatically
    This didn't do anything, either, but it did set me up for...

    Set the Performance Logs and Alerts service to use "Local Service"
    It was in the process of re-enabling the perfmon service to use this account that I received a message to the effect of "Enabling this account to log on as a service". While I am still not sure which patch or update killed that ability, the SSIS counters now show up, and work as intended.



    Tuesday, September 2, 2014

    A quick way to load the baseball DB


    I found the quickest way to load and reload the baseball database I've converted was to do two things:
    1. Cut the db into individual files
    2. Load those files one by one along with some logging
    This is all accomplished through good, old-fashioned and very fast command line calls to SQLCMD .

    There's a couple of great things about this script.

    1. It runs fast, even in a VM.
    2. It uses integrated security - no need to jump through hoops to make it work.
    3. The output is directed to a very specific file, which is rebuilt with every command.


    The downsides of this approach aren't really "cons" as in "pros vs. cons", but more like limitations. For example:

    1. The file output of SQLCMD is overwritten every time. In command line mode, there is no SQLCMD flag to indicate I'd like the file "appended to" instead.
    2. The output file can be appended through concatenation, though, which, while a separate command line call, is still pretty simple.


    Here's the script. I've saved this in my VM as a file on the desktop named "Make Lahman.cmd"


    cls
    sqlcmd -S localhost -d lahman -b -I -i lahman2013_tables.sql -o tempout.txt
    type tempout.txt > finalout.txt
    sqlcmd -S localhost -d lahman -b -I -i "lahman master.sql"  -o tempout.txt
    type tempout.txt >> finalout.txt
    sqlcmd -S localhost -d lahman -b -I -i "lahman Fielding.sql"  -o tempout.txt
    type tempout.txt >> finalout.txt
    sqlcmd -S localhost -d lahman -b -I -i "lahman Batting.sql"  -o tempout.txt
    type tempout.txt >> finalout.txt
    sqlcmd -S localhost -d lahman -b -I -i "Pitching.sql"  -o tempout.txt
    type tempout.txt >> finalout.txt
    sqlcmd -S localhost -d lahman -b -I -i "Teams.sql"  -o tempout.txt
    type tempout.txt >> finalout.txt
    sqlcmd -S localhost -d lahman -b -I -i "PitchingPost.sql"  -o tempout.txt
    type tempout.txt >> finalout.txt
    sqlcmd -S localhost -d lahman -b -I -i "lahman ManagersHalf.sql"  -o tempout.txt
    type tempout.txt >> finalout.txt
    sqlcmd -S localhost -d lahman -b -I -i "lahman AllstarFull.sql"  -o tempout.txt
    type tempout.txt >> finalout.txt
    sqlcmd -S localhost -d lahman -b -I -i "TeamsHalf.sql"  -o tempout.txt
    type tempout.txt >> finalout.txt
    sqlcmd -S localhost -d lahman -b -I -i "TeamsFranchises.sql"  -o tempout.txt
    type tempout.txt >>finalout.txt
     sqlcmd -S localhost -d lahman -b -I -i "Salaries.sql"  -o tempout.txt
    type tempout.txt >> finalout.txt
     sqlcmd -S localhost -d lahman -b -I -i "Schools.sql"  -o tempout.txt
    type tempout.txt >> finalout.txt
     sqlcmd -S localhost -d lahman -b -I -i "SchoolsPlayers.sql"  -o tempout.txt
    type tempout.txt >> finalout.txt
     sqlcmd -S localhost -d lahman -b -I -i "SeriesPost.sql"  -o tempout.txt
    type tempout.txt >> finalout.txt
     sqlcmd -S localhost -d lahman -b -I -i "lahman Managers.sql"  -o tempout.txt
    type tempout.txt >> finalout.txt
     sqlcmd -S localhost -d lahman -b -I -i "lahman HallOfFame.sql"  -o tempout.txt
    type tempout.txt >> finalout.txt
     sqlcmd -S localhost -d lahman -b -I -i "llahman FieldingPost.sql"  -o tempout.txt
    type tempout.txt >> finalout.txt
     sqlcmd -S localhost -d lahman -b -I -i "lahman BattingPost.sql"  -o tempout.txt
    type tempout.txt >> finalout.txt
     sqlcmd -S localhost -d lahman -b -I -i "lahman AwardsSharePlayers.sql"  -o tempout.txt
    type tempout.txt >> finalout.txt
     sqlcmd -S localhost -d lahman -b -I -i "lahman AwardsShareManagers.sql"
    type tempout.txt >> finalout.txt
     sqlcmd -S localhost -d lahman -b -I -i "lahman AwardsPlayers.sql"
    type tempout.txt >> finalout.txt
     sqlcmd -S localhost -d lahman -b -I -i "lahman AwardsManagers.sql"
    type tempout.txt >> finalout.txt
     sqlcmd -S localhost -d lahman -b -I -i "lahman Appearances.sql"
    type tempout.txt >> finalout.txt