Discover File Changes Made Outside of Visual Studio


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.


  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


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


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.


  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.

Adjustable Bench Power Supply

WARNING! (Disclaimer)
This project is deadly dangerous as it involves working with electricity. By reading this article you are agreeing to hold me and all related people and entities completely harmless of any outcome from reading this article or building the project, including but not limited to property, harm and even life. DO NOT ATTEMPT this unless you know how to handle electricity safely. Always have a fire extinguisher ready and wear eye protection. Never work with electricity alone. Keep in mind that even low voltages can kill and mains (household) power more than qualifies and WILL KILL YOU if not handled properly.

Adjustable Power Supply
I needed a bench top power supply with adjustable output. I wanted it to have connectors to attach my oscilloscope so I can monitor the wave form and some other features. The problem is they are well over $300 for a nice one. So I decided to make one out of some spare components I had and a few cheap parts from my local electronics surplus. This article represents my first attempt and doesn’t yet have all the features I want. However, it will allow me to build on to it.

The first step was to find a transformer that would work. I used a 5:1 ratio transformer capable of stepping 120VAC down to 24VAC. Of course transformers are simple devices where a primary winding induces a charge on a secondary winding. They can even be used in reverse if no components are specifically preventing this. You can find then with center taps, multiple secondary coils and in all kinds of other configurations. I just used a basic step down transformer with a single primary and a single secondary coil.

I took an old computer power cable, cut the end off and stripped the insulation back. That gave me a black wire (hot), a white wire (common) and a green wire (ground). I had a problem though. My transformer did not have the primary and secondary sides marked. The wires were colored black and white on one side (which I was pretty sure was the primary) and blue and grey on the other side. To verify this I checked the impedance of each side by attaching a voltmeter (set to ohms) to both wires on one side of the transformer. Then repeated it on the other side. I knew that the primary side should have 5x the wire that the secondary should have, since this is a step down transformer, so the impedance should be higher. Sure enough the primary side showed 1.4 ohms while the secondary side showed .1 ohms. Of course this won’t give you the ratio but it’s good enough to identify which winding is the primary and which is the secondary.

So once I had the power cable hooked up white to white, black to black and ground to the casing of the transformer I tested the output. Sure enough that gave me about 24VAC output. With my combo meter/oscilloscope I was able to see about 26VAC at a steady 60Hz (since I’m in North America). I also tested the case with the ground unplugged to be sure there were no shorts to the casing that could shock me. The transformer was in perfect working order. Time to move on to the next step.

From here we have a steady sine wave (alternating current or AC) that oscillates above and below reference 60 times per second (60Hz). Think of this like the constant rolling waves of an ocean. My power supply should produce direct current (DC) though. Direct current should have a steady signal (think calm perfectly flat lake) that’s always above reference. Luckily there’s a handy little device that will “flip” the dips in a sine wave that go below reference to above reference. The device is called a bridge rectifier (or diode bridge). Since the signal doesn’t dip below reference anymore we technically have a messy DC signal from an AC source. Of course you can build your own bridge rectifier if you don’t have access to one by using 4 diodes as shown in the “basic operation” heading of the bridge rectifier Wikipedia page. They should be put together in the shape of a square with the bands touching on 2 corners and the non-banded ends touching on two corners.

The diodes will allow voltage above reference to go through two of the diodes and below reference to flow through the other two. This will essentially convert an AC voltage to DC, but it will be a messy wave form. The signal will look like a bunch of little hills one right after the other. This is no good to power sensitive electronics so we will need to clean that up next.

To clean up this signal and steady out the current we will need a large capacitor. In my example I’m using a 1F (Farad) cap. You will take the positive side of the bridge rectifier output and connect it to the positive side of the capacitor (side without the stripe). Then connect the negative side of the rectifier output to the negative side of the capacitor (side with stripe). This will fill the cap with a charge and allow us to draw from it at a steady rate.

To visualize this let’s think of water, which is generally an acceptable analogy for electricity. We need a steady flow of water (electricity), but we are using a hand pump to move the water. Every time we depress the pump handle water comes out but when we pull up on the handle there is no water being delivered. This relates to the wave DC wave form we have where it curves up, but comes back down to reference and then repeats. At reference there is no current (flow). To fix this we need a capacitor. In our analogy this would be a bucket.

We will be pumping water into the bucket, then on the other side we will have a hose coming out. As we keep pumping the amount of water in the bucket will vary, but as long as we don’t take too much out at once the hose will always have a steady flow of water. This effectively gives us a constant, steady flow of water (electricity) from an uneven source. From here we have to consider how much water we want out to determind how big that bucket will need to be. If your capacitor is too small and you’re drawing too much you will get what’s called a sawtooth wave form instead of a straight line. This means your capacitor (bucket) is running low and can’t deliver what you require from it. Think about a smaller bucket and a big hose in our example. The water would run out before more could be delivered giving you a mostly steady flow with a little drop off at the end. As you try to draw more the problem will get worse. There are equations to obtain the correct capacitor size ((5 * Io)/(Vp*f)) where “Io” is the current you’ll draw, “Vp” is the peak voltage and “f” is the frquency. Keep in mind that after the rectifier the frequency is doubled (120Hz).

Once you find the size that’ll work for you, you should have a fairly steady signal. From here we want to guarantee a particular voltage. That is where a voltage regular such as the infamous LM317 comes in. I am using an LM350K for my project. The LM317 voltage regulator will accept an input voltage difference of up to 42V (depending on heat dissipation). This means that if you are sending 60V into the VR then you can go down as low as 18V output as long as you are removing the heat properly. You can also use a fixed output voltage regulator if you wish.

This leads me to the topic of heat dissipation. In order for the VR to reduce the voltage, that energy has to go somewhere. This is the same as with a resistor. The more you try to drop the voltage, the more energy has to be removed from the system. It does this by resisting the flow, converting that electrical energy into heat energy. If you don’t find a way to dissipate that energy it will build up, eventually turning into light energy and then fire as it glows and then burns up. To remove this heat energy faster than it can be produced you have to mount the LM317 to a heat sink. This is an aluminum or copper block, generally with cooling fins to increase surface contact with the surrounding air. The heat energy is then radiated, transferring to the air.

To use this voltage regulator we wire the positive side of the capacitor to the Vin (voltage in) side of the regulator and the Vout (voltage out) pin will produce our regulated voltage. You will notice one more pin (adjust). This will be wired to either a resistor for fixed output or a potentioneter for variable output. Let’s call this second resistor R2. The R1 value will be a resistor that needs to be soldered from the voltage regulator’s Vout pin to the adjust pin. We will use the formula (1.25 * (1 + (R2/R1))) to determine the voltage out. The R1 value should typically be low, generally under 500 ohms. Then calculate the remaining formula to determine R2. If we use an R1 value of 100 ohms this means that the R2 resistor should be 860 ohms to produce 12v output.

So we wire the regulator’s adjust pin to our potentiometer’s wiper or adjust pin. Then the input pin of the potentiometer goes to the negative side of the capacitor. This will allow us to adjust the output voltage of the regulator by turning the potentiometer dial, in effect using the potentiometer as a variable resistor or rheostat.

So now we effectively have a variable output power supply. There are a couple more things we should do though. First we want to add another capacitor to the output. It should be a .01 to 1 uF (microfarad) ceramic, 1uF tantalum or 22 uF electrolytic capacitor. The positive side will be connected to the voltage regulator outout and the negative side will be connected to the same negative terminal that went into the potentiometer, on the larger capacitor side (not on the voltage regulator side). Without going into too much technical detail, this will  keep the voltage regulator from becoming an oscilator and will improve transient response.

You’ll also want to add a couple of diodes. The first should be between the voltage regulator’s output and input pins with the band facing the input pin. This will keep the voltage regulator alive if you connect the power supply to a power source such as a battery or capacitor. The second diode should be soldered between the adjust pin and voltage output pin with the band on the voltage output pin.

Some things to keep in mind with this project are to know what your destination voltage and current draw will be. This defines what kind of heat sinks you need on the voltage regulator and possibly bridge rectifier. Know what your voltage regulator is capable of providing and whether it will handle the heat build up and whether you can dissipate enough heat. Look online for formulas to calculate heat dissipation and heat sink size for the LM317.


Keep in mind that the source voltage and current CAN KILL! Take appropriate cautions when working with mains voltage. Even the output of the regulated voltage has enough current to kill even at lower voltages so take precautions! Also capacitors remain charged even when the circuit is dead so be careful. If you don’t understand what you’re dealing with either do not build this project or get an experienced friend to help. Always keep a fire extinguisher handy. Electronics can fry and even catch fire. Components can explode without warning, taking hot or fiery pieces with them so a fire extinguisher is required and eye protection is recommended. Smoke from burning electronic components is unhealthy to breath. By reading this article you are agreeing to take proper precautions and to hold me and any related people or entities harmless of any direct or indirect outcome resulting from this article. You are taking all responsibility into your own hands and are waiving all rights to pursue any form of damages, injury or the like.

Performance Analysis with PSSDiag and SQL Nexus


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 file into your new collection folder.
  5. In Windows Explorer (it won’t work otherwise) double-click on the 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.


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


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


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!

Quick-Tip: How to Kill .NET Worker Process

This is a quick-tip on how to kill the .NET worker process. Often when I’m developing web applications I’ll run into an issue where I’ve made a change but it’s not being reflected when I’m running or debugging the software. I’ll clear the browser cache and even restart my debugging session, but still the previous version persists. This can be an issue where the web server or caching mechanism are caching the results. There are numerous other issues that can be resolved by a restart of the .NET worker process.

I’ve found that the quickest way to get around this and other issues related to the .NET worker process, is to simply stop debugging, kill the process and then start debugging again. This causes it to reload the app domain, load fresh data into cache, etc. Here’s how you can do it.

Kill the .NET Worker Process

  1. Open a command prompt via whatever means your version of Windows requires.
    1. Click on Start -> Run -> Type “CMD” -> Click OK.
    2. Click on Start -> Type “CMD” in Textbox -> Press Enter.
    3. Etc.
  2. At the command prompt type “taskkill /IM w3wp.exe /F”.
  3. Press Enter.

Here is what’s happening in the taskkill program.

  • taskkill – This launches the taskkill application which allows you to terminate tasks by process id (PID) or image name.
  • /IM – This tells taskkill to search for a process by image name instead of process id (PID).
  • w3wp.exe – This is the image name we want to terminate. It’s the WWW Worker Process or .NET Worker Process.
  • /F – This tells taskkill to force terminate the process since it may be in use, stalled or otherwise unable to terminate on request.

I simply put this entire command in a shortcut which I keep in my handy list of developer tools folder in my favorites (yes you can keep program shortcuts in your favorites). Then I show my “Links” folder on my task bar by right-clicking my task bar (bottom bar in Windows), selecting Toolbars and then ensuring Links is selected. This causes all of my favorites to be in a small folder that opens upwards when I click on it, making all of my most used programs, web sites, folders, etc. within easy reach.

I hope this helps!