Clear Server Names From List in SQL Server Management Studio


Overview
In Microsoft SQL Server Management Studio (SSMS) a history of the server names you connect to are kept in the connection dialog’s server name field drop down list. Often servers can be replaced, you move on to other projects, connect to the wrong server, etc. and this list can become cluttered.

Here is how you clear items from this list.

  1. Open the Microsoft SQL Server Management Studio (SSMS) version you want to affect.
  2. Open the Connect to Server dialog (File->Connect Object Explorer, Object Explorer->Connect->Database Engine, etc.).
  3. Click on the Server Name field drop down list’s down arrow.
  4. Hover over the items you want to remove.
  5. Press the delete (DEL) key on your keyboard.
  6. Repeat 4-5 for each server you want to remove from the list.

There are other ways to do this as well, like removing your MRU.DAT or SqlStudio.bin file from SSMS’s directory. However, it’s a little more difficult and resets all of your customized settings (those in Tools->Options). This could lead to changes to your Transaction Isolation Level, Results or Text Editor settings, etc. That isn’t much fun since we all spend a bunch of time getting those setup just right.

First Ever Passing of Turing Test!


Well Saturday, June 7, 2014 was a big day for the technology world. For the first time ever a computer has passed the Turing Test. This test was developed by Alan Turing in 1950 and is commonly used judge the presence of Artificial Intelligence (AI) in computing. There have been many attempts over the years, but none have been able to convince the requisite 1/3 (66.66_%) of the panel that they were human. The closest was in 2012 when a computer convinced 29% of the judges that it was human.

This event holds particular interest for me since I’m a software engineer, work in the technology industry and have always been involved in computing. It was a day I was looking forward to (and secretly fearing). As with Stephen Hawking, I fear the potential for opening “Pandora’s Box”. The day when we cross the singularity. This quote from Stephen Hawking sums up my fears perfectly.

“Whereas the short-term impact of AI depends on who controls it, the long-term impact depends on whether it can be controlled at all.” – Stephen Hawking

Anyone who’s seen The Matrix can imagine the potential outcomes. Once that boundary is crossed, the evolution is only limited by the speed in which the platform operates. This event would likely take place on a supercomputer. As of 2013 the fastest of these is the National University of Defense Technology (NUDT) Tianhe-2 in Guangzhou, China. This system is capable of 33.86 PFLOPS. This means it is capable of calculating 10,000,000,000,000,000 (10 Quadrillion) floating point operations per second.

Let me tell you… I’d have a hard time doing 1 mathematical operation per second let alone 10 quadrillion, per second… every second, of every minute, of every hour, of every day… endlessly. You can see how something that’s able to compute at that speed could get out of hand in very short order. How many seconds do you think it’d take it to determine humans are inferior?

Of course this doesn’t mean the end of humanity or anything. This achievement was not what I would consider A.I. It is essentially just a sophisticated chat bot and not an actual sentient computer. This begs the question though. Now that the Turing Test has been passed, how do we actually judge sentience in computing? This was thought of as the “Holy Grail” of A.I. research.

With regards to A.I. though, I’m not all doom and gloom. I don’t just go around worrying about the A.I. hiding under my bed at night. The technology could present some very real benefits to humanity as well (e.g. medical, materials, aerospace, astrophysics, etc.). Imagine being able to model every possible combination of molecular structure and test it on modeled humans without having to actually do anything. It would simply spit out a list of theoretically safe drugs to move on to lab tests with. The environment could benefit as well. What about having it think up an entirely new approach to moving humans from one place to another that wouldn’t hurt the environment or cost absurd amounts of money to implement? There’s really a bottomless pit of problems that need solving and what better than something that never needs to take a break or sleep and can operate billions of times faster than us?

Well, here’s to a new landmark! Now keep in mind that the truly sentient forms of AI I am discussing are still a long way off. Simply passing the Turing Test doesn’t automatically mean sentience, so don’t worry. However, it’s a big step in that direction!

Click Here for Article

Discover File Changes Made Outside of Visual Studio


Overview

I recently had an issue where I had to rollback an entire branch in TFS and then hand apply a whole mess of changes. There were entire sub-branches that needed to remain the latest version and other files that had to be hand edited. Overall it was a large job.

In an effort to speed up the process for those folders that needed to remain as the latest version I decided to work outside of Visual Studio and TFS. I manually removed the rolled back versions of the folders and copied the folder from a backup I’d made before rolling back into the appropriate location in my local source control folder. The only problem was that Visual Studio / TFS didn’t recognize that a change had been made.

Here’s how you get those changes made outside of Visual Studio to be recognized as changed in Visual Studio.

Steps

  1. Visit the Visual Studio Extensions site for Team Foundation Server Power Tools (TFPT).
  2. Download and install the package.
  3. Once installed, open a command prompt.
  4. Navigate to the TFPT installation folder (where tfpt.exe is located).
  5. Run the “tfpt.exe online” and optionally include the following switches as needed.
    1. “/adds” will pick up any added files.
    2. “/deletes” will pick up any removed files.
    3. “/diff” will pick up any changed files.
    4. “/recursive” will look for changes through all sub folders.
    5. PATH is where to look for changes.

The complete command is as follows.

tfpt online /adds /deletes /diff /recursive PATH

Summary

This has allowed me to pick up all of those changes I made outside of the IDE and apply them to TFS as usual. One thing I noticed though is that even folders such as bin, obj, Debug, etc. will be picked up. You will need to make a determination yourself as to whether you want these included in your source control.

I hope this helps!

How to Terminate Remote Desktop Sessions


Overview

I’ve worked in several companies where I’ve had to share the default 2 simultaneous remote desktop sessions on a single server. This isn’t a big deal if you only have 2 developers or other developers really don’t remote into the servers that much. However, what if you have a group of developers who all regularly access the server, or your coworkers always seem to click the “X” in the top-right corner instead of logging off? Well then you wind up with these connections constantly tied up. Usually the number of available connections is inversely proportional to the criticality of the needed connection.

So what do you do if you really need to get into the server? Here’s how to kick them or at least view who’s connected and what they’re doing.

Steps

  1. Remote Desktop into another server (or logon locally to another server if you have one).
  2. Navigate to the Administrative Tools menu from either Start Menu or Control Panel.
    1. Location varies by Windows Server version and configuration.
  3. Open the Terminal Services menu that’s inside the Administrative Tools menu.
  4. Open the Terminal Services Manager item (MMC plugin).
    1. You can also run “tsadmin.msc” if you can’t find this menu item.
  5. Click on the Action menu and select Connect to Computer.
  6. Select the Another computer radio button.
  7. Type in the computer name of the server you want to recover a remote desktop session on, or browse for it and then click OK.
  8. Select the server name from the list in the left pane.
  9. You should now see all of the sessions in the center content pane.
  10. From here you have some options.
    1. You can terminate the session by right-clicking on the session and selecting disconnect.
    2. You can reset the connection.
    3. You can log the user out, etc.
  11. Close the Terminal Services Manager.
  12. Log out of the server.

Note: Selecting Disconnect will recover the session but will terminate any running applications the user had open. For instance if they connect to the server, start an installation and then close the remote session but don’t log out (so the install stays running), it’ll kill this installation. However, if you know the person isn’t using the session and they simply closed out the session instead of logging out, you can recover this available connection by disconnecting them.

I hope this helps!

Watch “10 Ways the NSA Spies on You”


A lot of people don’t comprehend the degree to which the NSA has infiltrated the lives of even law abiding Americans.  This video was particularly good at showing some of the largely unknown ways this is happening right now. Some that stood out were that the NSA monitors all mobile traffic on android devices by recording the number called, duration of call and the nearest tower (essentially your rough location). All international calls are monitored. Also one that recently came to light is that the NSA actively works with companies like Google to write vulnerabilities they can exploit into their code. Check it out. This stuff isn’t conspiracy theory. It’s happening now. You might want to look at that mobile phone in your hands a little differently now.

Performance Analysis with PSSDiag and SQL Nexus


Overview

Although there are many means of obtaining performance information from SQL, that’s exactly the problem. You can setup performance counters, look at statistics in SQL itself, look at logs, perform a trace in SQL, look at system information and so on. You can also correlate things like performance logs together with SQL traces to get a bigger picture. This is labor intensive though and only includes two sources of information. Wouldn’t it be great if you could compile all of the pertinent information together into meaningful reports and do so easily? Well you can with PSSDiag and SQL Nexus.

PSSDiag and SQL Nexus are not very intuitive and there isn’t a lot of documentation for these tools. You will also notice quite a lot of steps on this page. I know it may look complex, but the steps are actually quite simple and I could have condensed it into just a handful. However, I wanted to make sure anyone could do this.

Once you get this setup and do it a few times, it will give you an entirely new picture of your SQL Servers. You will be coming up with rapid answers without all the slaving over your system that you typically have to do to gather this information. You can do this! Let’s get started!

Obtaining the Software

  1. Visit the Microsoft Download site here to download the PSSDiag tool.
    1. Visit the support site to install and run this tool.
    2. Note the installation folder as you will need this later on.
  2. Go to the CodePlex site here and download the SQL Nexus tool.
    1. Visit the installation instructions to install SQL Nexus.
  3. Go to this CodePlex page to download and install ReadTrace.

Setting Up PSSDiag

  1. Run the PSSDiag Tool by selecting the “Pssdiag Configuration Manager” item in the Pssdiag folder in the Start Menu.
  2. Select the appropriate processor architecture from the images under Platform
    1. If unsure use Intel Inside Pentium for 32-bit or AMD 64 for 64-bit systems.
  3. Select the tab at the top of the window corresponding to the SQL Server version you will be collecting information against.
  4. In the Diag Manager window that appears set the Machine name field to the name of your SQL Server.
  5. Set the Instance name field to the instance name of your SQL Server or astrisk (*) if it’s the default instance.
  6. Set the Connect using fields appropriately for your authentication method.
  7. In Machine-wide Diagnostics check the following items you would like to capture data for with regard to the system SQL Server is running on.
    1. Event logs: Windows Event Logs.
    2. Startup: Windows system startup.
    3. Shutdown: Windows system shutdown.
    4. Perfmon: Performance Monitor counters selected in checked listbox below.
    5. Max file size: The maximum amount of data to capture in MB.
    6. Interval (sec): The polling sample window in seconds.
    7. Checked listbox: Check all perfmon counters to capture data for (check the SQL Server counters if you aren’t sure).
  8. In Instance-specific Diagnostics check the following items you would like to capture data for with regard to the specific SQL Server instance noted in the Instance name field (#3 above).
    1. SQLDIAG: Collect data from general purpose SQL collection utility for logs, data files, etc.
    2. Startup: SQL Server startup.
    3. Shutdown: SQL Server shutdown.
    4. Database Engine (tab):
      1. Trace: Gather SQL Server trace information.
      2. Template: Use a predefined tracing template to define collection events.
      3. Max file size: The maximum amount of data to capture in MB.
      4. Checked listbox: Define a custom set of collection events to gather data for.
  9. In Custom Diagnostics check the miscellaneous other tools you want to gather data from.
    1. Note: For each of the items in this listbox, highlight the item and read the Instructions window contents at the bottom of the tool window for more information.
    2. Rearrange the order of collection by using the up and down arrows.
  10. Save the configuration package and tools by clicking the Save button on the toolbar.
  11. Leave the existing paths and file names (should be \Build and \Customer folders).
  12. If another dialog appears asking you for the SQL Server version, select the appropriate option.
  13. Close the PSSDiag Tool.

Run the PSSDiag Collection Tool

  1. Open Windows Explorer and navigate to the PSSDiag installation folder you noted when installing PSSDiag (e.g. C:\Pssdiag).
  2. Navigate to the Customer folder inside of the root PSSDiag installation folder (e.g. C:\Pssdiag\Customer).
  3. Choose a folder you wish to use when running this collection tool, we’ll call it the collection folder (e.g. C:\Users\Me\Documents\PssDiag).
  4. Copy the pssd.cab file into your new collection folder.
  5. In Windows Explorer (it won’t work otherwise) double-click on the pssd.cab file and it will open as if it were just another folder.
  6. Select all of the files and copy them (i.e. CTRL+A then CTRL+C).
  7. Go back up a folder so you’re in your collection folder.
  8. Paste the files you just copied into the collection folder (i.e. CTRL+V).
  9. Note: Here is where you will want to spend a few minutes getting your system ready. You don’t want to be collecting information that’s not related to the issue, such as starting your development tools or closing all the open apps you have running.
  10. Once you’re ready to start collecting data, find the file called “pssdiag.cmd” and double-click it.
  11. You will see a command prompt window open up and possibly a System Information window pop up. Don’t do anything until you see the text, “SQLDIAG Collection started.  Press Ctrl+C to stop.”
  12. Once you see the above statement in the command window start your test scenario.
    1. This could be using an app that’s been running slowly and uses a database on the server you’ll be collecting information against.
    2. It could be running a set of scripts that aren’t performing the way you expect.
    3. Just focus on only performing the steps that you want to get more insight into.
  13. Once you are done running your test scenario, press CTRL+C.
  14. When the command prompt displays the prompt, “Terminate batch job (Y/N)?”, press Y and then ENTER.

Setting Up the SQL Nexus Tool

  1. Run the SQL Nexus Tool by selecting the “SQL Nexus” item in the “SQL Nexus 3.0″ (or some future version) folder in the Start Menu.
  2. Choose a SQL Server that you would like to store your SQL Nexus database on.
  3. In the Connect to Server dialog that pops up, enter the Server Name you just chose and authentication information to that server.
    1. If you have never started SQL Nexus before, it will automatically connect to the server and create the “sqlnexus” database.
    2. If you have created this database before, but deleted it and get a message that it still exists, check the SQL data folder to ensure the database and log files are deleted.
  4. You will now be presented with the SQL Nexus tool.

Running the SQL Nexus Tool

  1. Technically the tool is already running from the step you just perfomed; if not follow step 1 in the Setting Up the SQL Nexus Tool section above.
  2. Click the Import item in the Data panel on the left-side tool window.
  3. Set the Source path field to the “output” folder inside the collection folder you created previously and click OK if you browsed for the folder.
  4. If you have imported previously with this database click the Options link and select Drop Current DB Before Importing.
    1. If you don’t do this you’ll get an error since you can only perform one import into the database.
  5. Click the Import button.
  6. If you chose to drop the current DB before importing, click Yes on the “Danger” dialog box that appears.
  7. Wait for all of the Data Import steps to complete and then close the Data Import window.
  8. Now start opening items from the Reports panel on the left-side tool window.
  9. Navigate through clickable links in the reports to see all that the reports can show you.

Summary

That’s it! You’ve just setup the tools, collected data, analyzed it and viewed reports. After setting everything up for the first time you can start with step 9 in the “Running the PSSDiag Collection Tool” in the future. If you want to change what sources you’re collecting data from you’ll need to go back through all of the sections to create a new configuration and collection package.

Let me know what you think and if this is helpful by leaving a comment.

Clear Silverlight Cache


Overview

I recently had an issue where a Silverlight application was acting up on me. It was an application that I was using, not one I’d developed and I really didn’t have much experience with Silverlight at that point. It was working for other people and other browsers on my computer were experiencing the same problem. I’d already cleared the Internet cache multiple times including cookies and other stuff. I applied all the latest patches, hot fixes and service packs as well as updated my browsers to the latest versions. I finally came to the point where I updated Silverlight thinking it could be related to Silverlight itself. None of this solved the problem.

Finally another developer alerted me to the possibility of clearing the Silverlight cache. Now don’t laugh, but I didn’t know that Silverlight had its own cache. I looked online for quite a while on how to clear the Silverlight cache but came up empty. So, I went looking myself. Here’s how you do it.

Clear Silverlight Cache

  1. Open the Microsoft Silverlight shortcut in your start menu.
    • Depending on what version and how you manage your Start Menu, this could be in various places.
    • You could also just click Run or browse to “C:\Program Files\Microsoft Silverlight\{VERSION}\Silverlight.Configuration.exe” where {VERSION} equals the version you have installed. For me, as of writing this article, it was 5.1.20125.0.
  2. You will see the Microsoft Silverlight Configuration application come up.
    • Microsoft Silverlight Configuration

      Microsoft Silverlight Configuration

  3. Click on the Application Storage tab and you will see tab contents like this.
    • Silverlight Application Storage

      Microsoft Silverlight Configuration – Application Storage

  4. Click on a web site you want to clear from cache and click the Delete button, or click the Delete all button to clear all web site data from cache.
  5. Click OK

Summary

Congratulations! You’ve just cleared the Microsoft Silverlight cache on your system. If you have any questions or comments please leave a comment below. Have a great day!