Wednesday, November 27, 2013

Quick JPEG Optimization to Speed Up Your Web Site

If you would like to quickly optimize the jpeg images for your web site, here's a quick method that works pretty good.

First, download jpegtran.exe, and save it to C:\

Download your image files to C:\Users\administrator\Desktop\files, or change the path in the code below to point to the root folder where you want to search for images to optimize. The script will crawl through subdirectories, so don't worry about the directory structure under the path that you specify.

Open a PowerShell prompt (you may need to "run as administrator" depending on your security settings). If your files are in a different path, or you placed jpegtran.exe edit the code below to reflect those difference. Run the code below.

$files = Get-ChildItem -Path C:\Users\administrator\Desktop\files -Recurse | where {$_.Extension -eq ".jpg"}
foreach($file in $files){
    [string]$image = $file.FullName
    [string]$cmd = "C:\jpegtran.exe -copy none -optimize $image $image"
    Invoke-Expression $cmd

The way the previous code is written, it will overwrite the existing file with the optimized one, so make a copy of them first if you want to keep the original as well.

I hope that helps. I optimized all of the JPEGs on one of my sites in a few minutes, and that includes writing the PowerShell code above.

Thursday, October 31, 2013

How to Setup Visual Studio (TFS) Test Agents in the Cloud

We ran into some issues trying to get the Visual Studio Test Agents to register and communicate with the Visual Studio Test Controller when the controller is inside our network, and the agents are in the cloud. There are some strange quirks that need to be addressed before this will work. However, following these steps you should be able to run test agents on VMs in Amazon AWS EC2, Microsoft Windows Azure, etc.

Resolution: Visual Studio Test Agent Unable to Connect to the controller. There is no agent registered...

Problem: I discovered a weird quirk with the Visual Studio Test Agents (a.k.a. TFS Test Agents). We were trying to set them up to do some load testing, and were getting the error below.

 Unable to connect to the controller on 'MyController:6901'. There is no agent with the name 'MyAgent' registered on the controller.

If you click on the "View Log" link after attempting to configure the Test Agent, you will see the follwing detailed error:

 V, 2013/10/28, 17:33:25.342, Observed that agent 'MyAgent' does not exist. Microsoft.VisualStudio.TestTools.Exceptions.EqtException: There is no agent with
the name 'MyAgent' registered on the controller.

Saturday, October 19, 2013

Resolved: WCAT: Invalid code received - Run error detected, terminating clients

When implementing WCAT for load testing for the first time I ran into the overly vague error message below.

All clients connected, Test beginning.
 Invalid code received.
  message: Run error detected, terminating clients...
  message: Terminating all instances of wcclient...
  message: Terminating all local instances of wcctl.exe...

Connection Pooling for Commerce Server 2007 and 2009

With as little as a couple hundred unique visitors on a website, we were seeing close to 300 SQL logons per second coming from Commerce Server. Every hit to SQL was creating a new connection. Luckily, this is a quick and easy fix to get Commerce Server to start reusing open connections to SQL by using connection pooling.

Take into account though, if you are using impersonation on your Commerce Server website then this is a security risk. If a one user reuses the SQL connection of a different user, they can assume the security rights of that previous user.

Saturday, September 14, 2013

Resolved: IDRAC Drive Error Either Virtual Media is detached or redirection for the selected virtual disk drive is already in use

I haven't used Dell servers much in an enterprise environment, so working with their IDRAC (Integrated Dell Remote Access Controller) controllers was a little new to me. So when I got the error message below when trying to mount an ISO, I was a little confused at first.

Drive Error Either Virtual Media is detached or Virtual Media redirection for the selected virtual disk drive is already in use.

Resolved: Error message Windows is unable to install to the selected location. Error: 0x80300001 after loading additional drivers

There is a very misleading/deceptive error that you might run into when installing various versions of the Windows operating system. It typically happens when you load additional drivers for raid controllers, fiber cards, SCSI controllers, etc. That error is:

Error: "Windows is unable to install to the selected location. Error: 0x80300001."