Client Certificate from the User Store to the Local Machine Store

August 18th, 2010 1 comment

If a service application such as ASP.NET Web application cannot access a client certificate that other applications like console applications can access, then the client certificate may not be stored in the local machine. You can understand that something like that may be happening if you get the error:

Could not create SSL/TLS secure channel for your Web Request and you can’t understand what is going wrong while it might be ok at your development machine but when you try to publish it you get this error.

So let’s copy a client certificate in the local user store to the local machine store by using the Certificate Export Wizard following the steps below:

  1. Click Start, click Run, type mmc, and then click OK.
  2. On the File menu, click Add/Remove Snap-in, and then click Add.
  3. In the Add Standalone Snap-ins dialog box, click Certificates, click Add, click Computer account, click Next, and then click Finish.
    image
  4. In the Add Standalone Snap-ins dialog box, click Certificates, click Add, click My user account, and then click Finish.
    image image
  5. Click Close, and then click OK.
    image
  6. To export the client certificate from the local user store, follow these steps:
    1. Expand Certificates – Current User, expand Personal, and then click Certificates.
      image
    2. Right-click the client certificate, click All Tasks, click Export, and then click Next.
      image
    3. Click Yes, export the private key, and then click Next two times.
      image image
    4. In the Password box and in the Confirm Password box, type a password, and then click Next.
      image
    5. In the File name box, type a file name. Click Next, and then click Finish.
      image
    6. In the Certificate Export Wizard dialog box, click OK.
      image
  7. To import the client certificate to the local machine store, follow these steps:
    1. Expand Certificates (Local Computer), and then expand Personal.
      image
    2. Right-click Certificates, click All Task, click Import, and then click Next.
      image
    3. In the File name box, type the file name that you specified in step 6e, and then click Next.
      image
    4. In the Password box, type the password that you specified in step 6d, and then click Next two times.
      image image
    5. Click Finish, and then click OK.
      image
Categories: ASP.NET Tags: ,

Uninstall SQL Server 2005 Express Tools to continue, but…

July 17th, 2010 1 comment

If you try to install SQL Server 2008 R2 Express Edition you might get into the following error:

“The SQL Server 2005 Express Tools are installed. To continue, remove the SQL Server 2005 Express Tools.”

You say ok, that’s easy! You popup control panel, head to Uninstall Program and search for SQL Server 2005 Express Tools but nothing there…

Omg how should I continue now? :P

Don’t worry here is a quick fix:

  • Hit Start Menu and at the Search Field type “regedit” (The Registry Editor should be open now.)
  • Search for HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\90
  • While you are there select the folder 90 and delete it.

This will allow you to continue the installation wizard.

Categories: Database Tags:

Save time with ninite.com

July 16th, 2010 No comments

Are you bored to download and setup each of your favorite applications after formatting your PC?

Would you like to install multiple applications at once without toolbars and clicking Next?

ninite.com
Ninite is the answer :P

This is a great tool that allows you to install common applications at once without having to separately download and setup each software.

All you have to do is:

  • Go to ninite.com
  • Select applications you want to install
  • Get the installer and go for a walk

When you return the latest version of each application will be installed and ready to use

Categories: Tools Tags:

How to sort a drop down list (select) using jQuery

July 15th, 2010 5 comments

Let’s assume we have a drop down list that it is initialized to display a list of option and programmatically you want to add or remove options. When you add options you might need to sort options in the drop down list based on the text or the value of each option.

Here is a select box with the list of Cities:

dropdown_list_cities

<select id="cities">
    <option value="0">Select City</option>
    <option value="2">Paris</option>
    <option value="3">London</option>
    <option value="4">Athens</option>
    <option value="5">Mexico</option>
</select>

In order to add a new city, let’s say Rome, and resort them you can do that client side using jQuery:

// Add a last option to the cities drop down list
$("#cities").append($('<option/>').attr('value', '1').text('Rome'));

// Sort by name
$("#cities").html($("#cities option").sort(function (a, b) {
    return a.text == b.text ? 0 : a.text < b.text ? -1 : 1;
}));

// Sort by Value
// If you don't convert a.value to integers javascript will assume
// that a.value and b.value are strings
$("#cities").html($("#cities option").sort(function (a, b) {
    var aValue = parseInt(a.value);
    var bValue = parseInt(b.value);
    return aValue == bValue ? 0 : aValue < bValue ? -1 : 1;
}));

// Reselect the first option
$('#cities').val('0');

What took me some time to figure out is that the value options should be converted to integers before sorting them as javascript will consider them as strings

Categories: Javascript, Web Design Tags: ,

Preload images with jQuery

May 15th, 2010 No comments

Sometimes you might want to preload some images used in your site to improve user experience. In photo galleries or other image-heavy sites preloading images help visitor enjoy faster loading times.


jQuery can help us with a few lines of code to achieve that:

//Function that preloads a defined list of images (arguments for the function).
 jQuery.preloadImages = function(){
  //Loop through the images
  for(var i = 0; i<arguments.length; i++){
    jQuery("<img>").attr("src", arguments[i]);
  }
}

// Call the function:
$.preloadImages("images/1.png", "images/2.png", "images/3.png", "images/4.jpg");
Categories: Javascript, Web Design Tags: