Clean the Windows Installer Folder

June 1st, 2015 3 comments

Problem

The c:\Windows\Installer folder contains windows .msi installers and .msp patch files that are used when installing and updating software on your windows computer.

Over time as more and more programs are patched the size of this directory gets very large and some of the files are actually orphaned and no longer required on your system.

The problem is you cannot just delete the entire directory as these files are used when upgrading or uninstalling your software. What you need to do is only delete those files that are not in use any more

Solution

Patch Cleaner

This is a simple piece of software that will clean your windows installer folder in one easy click.

PatchCleaner

PatchCleaner

If you are unsure of the program just use the move function to move the detected orphaned patches off onto an external drive. If the program has done something wrong you can just copy them back.

This software is 100% free. >> Download Here <<

Categories: Free Software Tags:

How to make a self extracting archive that runs your setup.exe with 7zip -sfx switch

May 14th, 2015 8 comments

The scenario

When you use the default Microsoft Visual Studio Installer (yes, it is back as an extension for VS 2013 – Visual studio Installer Projects Extension), the output are two files:

  1. installer.msi – the .msi installation file
  2. setup.exe – which is the bootstrap that does your pre-requisite checks

So you want to provide a download for your product from your website as a single file.

Some possible options include:

  1. Zip the two files – the user has to download a zip, extract the zip and run the setup.exe
  2. Just provide the msi file, but this by passes the pre-requisite checks which is not ideal; or
  3. Create a self extracting archive that runs, extracts the software and then calls the setup.exe

The self extracting archive option seems the best.

The problem

I wanted to use 7Zip to create the self extracting archive but I could not seem to find a simple guide that explained exactly how to do it.

I have finally worked it out and below are some detailed instructions.

How to make a self extracting archive that launches your installer after extraction

It is actually quite simple to do if you follow these easy steps.

Step 1 – Setup your installation folder

To make this easy create a folder c:\Install. This is where we will copy all the required files.

Step 2 – 7Zip your installers

  1. Go to the folder that has your msi and your setup.exe
  2. Select both the .msi and the setup.exe
  3. Right-Click and choose 7Zip –> “Add to Archive”
  4. Name your archive “Installer.7z” (or a name of your choice)
  5. Click Ok
  6. You should now have “Installer.7z”.
  7. Copy this .7z file to your c:\Install directory

Step 3 – Get the 7z-Extra sfx extension module

You need to download the 7z-Extra.

  1. Follow this link to go to 7zip download.
  2. You need to download the 9.20 version (as @ May-2015) as the beta does not contain the correct files.
  3. A direct download link.
  4. Extract the 7zip extra files
  5. Copy the file “7zS.sfx” to c:\Install

Step 4 – Setup your config.txt

I would recommend using NotePad++ to edit this text file as you will need to encode in UTF-8, the following instructions are using notepad++.

  1. Using windows explorer go to c:\Install
  2. right-click and choose “New Text File” and name it config.txt
  3. right-click and choose “Edit with NotePad++
  4. Click the “Encoding Menu” and choose “Encode in UTF-8”
  5. Enter something like this:
    ;!@Install@!UTF-8!
    Title="SOFTWARE v1.0.0.0"
    BeginPrompt="Do you want to install SOFTWARE v1.0.0.0?"
    RunProgram="setup.exe"
    ;!@InstallEnd@!
    

Edit this replacing [SOFTWARE v1.0.0.0] with your product name.
Notes on the parameters and options for the setup file are here

CheckPoint

You should now have a folder “c:\Install” with the following 3 files:

  1. Installer.7z
  2. 7zS.sfx
  3. config.txt

Step 5 – Create the archive

These instructions I found on the web but nowhere did it explain any of the 4 steps above.

  1. Open a cmd window, Window + R –> cmd –> press enter
  2. In the command window type the following
    cd \
    cd Install
    copy /b 7zS.sfx + config.txt + Installer.7z MyInstaller.exe
    
  3. Look in c:\Install and you will now see you have a MyInstaller.exe
  4. You are finished

    Run the installer

    Double click on MyInstaller.exe and it will prompt with your message. Click OK and the setup.exe will run.

    Everything is easy… once you know how. 🙂

    P.S. Note on Automation

    Now that you have this working in your c:\Install directory I would create an “Install.bat” file and put the copy script in it.

    copy /b 7zS.sfx + config.txt + Installer.7z MyInstaller.exe
    

    Now you can just edit and run the Install.bat every time you need to rebuild a new version of you deployment package.

    P.P.S. super user

    If you got here from the super user article, perhaps you would like to vote my answer up 🙂
    Thanks

Categories: Scripts Tags:

Terrible Performance of SQL Server Linked Server query over WAN

April 14th, 2015 2 comments

The problem

I have a linked server connection between 2 SQL servers approx half the world away. One server resides in Sydney, Australia and the other in London, UK.

I was getting terrible performance.

To simulate this for testing purposes, on my home internet connection, I created an Azure database in Northern Europe and my local SQL server is in Sydney.

I used the DimDate table as created in this code project example. http://www.codeproject.com/Articles/647950/Create-and-Populate-Date-Dimension-for-Data-Wareho
(This is a 36 column table)

I ran this against my azure database and populated it with 45,656 records, (days between 1-Jan-1974 to 31-Dec-2099, just adjust the populate script)

On my local sql server, I have a Linked Server connection called LSEUROPE set to use SQLNCLI – SQL Native Client, configured to connecting to the Azure database in Europe.

On the local sql server:

1. Download and Install Wireshark on the local server, https://www.wireshark.org/download.html
2. Download and Install Compass wildpackets free from, http://download.cnet.com/Compass-Free/3000-2085_4-75447541.html. This is used to visualise the throughput.

Wireshark was enabled and set to monitor only the remote server, (capture filter – “host 10.10.0.1” where 10.10.0.1 is the IP address of the remote server).

2 tests were executed:

Test 1 – SSMS Direct

1. Open SSMS and connect directly to the REMOTE server.
2. Start Wireshark Capture
3. execute “select * from dbo.DimDate”
4. once finished stop wireshark
5. Save the wireshark session as a .pcap file, (compass only opens .pcap files)

Test 2 – Linked Server

1. Open SSMS and connect to the LOCAL server.
2. Start Wireshark Capture
3. execute “select * from LSEUROPE.TestDB.dbo.DimDate”, (Note: OpenQuery in this instance makes no difference as all we are testing is the throughput of transferring data from the other side of the world.)
4. once finished stop wireshark
5. Save the wireshark session as a .pcap file.

Fig 1. SSMS Direct Test – 35 sec
SSMS_Remote

Fig 2. Linked Server Test – 6m 29 sec
LSRemote

As you can see, throughput on the Linked server query is limited to 0.22 Mbits/s, whilst the remote SSMS query happily averages around 3Mbits/s (again, this is just on my standard ADSL2+ home internet connection, but I have replicated this exact same pattern at work on a 20MBps dedicated WAN link).

There is some bottle neck that is slowing performance of the data being sent via a linked server connection!!

A solution of sorts

After much playing and testing of the various Linked server connections I have managed to get the following results over a linked server connection.

Fig 3
LSRemote_SNCLIDSN

Fig 4
LSRemote_ODBCDSN

Figure 4 was obtained by creating a ODBC System DSN of type ODBC Driver 11 for SQL Server. This provided the fastest performance, bringing down the same 45,656 rows in 27 seconds.

Figure 3 was obtained by creating the ODBC System DSN using the SQL Native Client. It is now approx 46 seconds which is much better than 6 minutes, but still not the 27 seconds of the ODBC driver.

After multiple runs I was getting similar performance regardless of the Client used in the DSN

ODBCSystemDSN

In both cases Fig 3 and Fig 4, the linked server was created using the “Microsoft OLE DB Provider for ODBC Drivers” and configured the Linked server to use the System DSN.

LSConfig

Now the real question, why does this seem to work?

I am going to test using this as I am sure there will be synax type issues of changing the linked server connection, (I think ODBC doesn’t handle TEXT/NTEXT fields)

Microsoft, what is going on here?

I am going to be trying to find out what the reason is for the poor performance of the “Microsoft OLEDB provider of SQL Server”, and if there is something that can be done to improve the performance.

Categories: SQL Server Tags:

MVC Razor View escape character

February 13th, 2015 No comments

The Problem

You want to use your model or some code to append a variable inline with a string.
Assume you want to create a URL with a dynamic element like:

http://appserver-dev.domain.com

where -dev will be an appsetting accessed in razor from @Settings.Default.URLSuffix

When you add the @Settings value in like so;

http://appserver@Settings.Default.URLSuffix.domain.com

it treats the @Settings.Default.URLSuffix as a text string, outputting “http://appserver@Settings.Default.URLSuffix.domain.com” not “http://appserver-dev.domain.com” as you were hoping. What is the escape character?

The Solution

@@ is the escape sequence.. so that should be easy..

http://appserver@@Settings.Default.URLSuffix.domain.com

The problem now is it treats the .domain.com as part of the code and is not happy because a string object does not have .domain.com methods.

http://appserver@@Settings.Default.URLSuffix;.domain.com

Add a semi-colon to end the code and that is the problem solved.

Categories: MVC, Uncategorized Tags:

IIS Express and windows authentication

February 13th, 2015 No comments

How to control the IIS Express Authentication settings

To set the windows authentication parameters for you MVC applicaiton there are two ways to do this .

  1. On a per project basis, by going to the properties of the web app, F4, and setting the windows authentication to on or off; or
  2. Globally for the entire computer.
    • go to the following path, %HemePath%\Documents\IISExpress\config
    • edit the “applicationhost.config” file
    • find the line
    • Change the value as required and then save

Categories: MVC, Uncategorized Tags:

How to activate Windows Server 2012

December 2nd, 2014 No comments

Issue

Windows Server 2012 will not activate when you try to use the UI to activate a license key.

Solution

Open a command prompt and run the following command

slmgr.vbs /ipk <license key>

Where <license key> is your server license.

Press enter and wait about 30 seconds and you should receive a message saying “Installed product key successfully

Categories: Uncategorized Tags:

Azure Web deployment task failed. Make sure that the process (“Web Management Service”) is started on the remote computer.

August 29th, 2014 No comments

Issue

Recently I was playing around using Azure and Visual Studio 2013.

I was attempting to deploy my website to azure using the Publish wizard. It had been working but them I started getting this error

Web deployment task failed. (Could not connect to the remote computer ("xxx.scm.azurewebsites.net") 
using the specified process ("Web Management Service") because the server did not respond. 
Make sure that the process ("Web Management Service") is started on the remote computer.  
Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_COULD_NOT_CONNECT_TO_REMOTESVC.)	

Solution

In my case I had been playing around in the Azure management console and I had changed the “MANAGED PIPELINE MODE” to classic.

Setting it back to Integrated allowed the deployment to succeed.

Categories: Uncategorized Tags:

SSIS Convert between datetimeoffset and datetime

June 11th, 2014 No comments

The Problem

I had a sql table that was storing data in a DateTimeOffset(7) datatype, DateDeleted.

I was trying to use SSIS to sync the data to another table where the DateDelted column was a DATETIME datatype.

How do you cast/convert between a DateTimeOffset(7) datatype to a DateTime object

The Solution

In a derived column object use the following formula

DATEADD("hh", DATEDIFF("hh",((DT_DBTIMESTAMP)DateDeleted), DateDeleted), ((DT_DBTIMESTAMP)DateDeleted))

I will walk you through what this actually is.

Part 1 – Base Cast

(DT_DBTIMESTAMP) DateDeleted

This is just a standard type conversion.
The problem!!

When you try this you will receive a “Truncation Error”.

  1. Open the derived column transformation editor
  2. Click on “Configure Error Output”
  3. On this page for your derived column (in my case C_DateDeleted), set the Truncation value to “Ignore failure”

SSISConfigureError output

So now it will work, but the problem is the offset is lost. In my case I am in Australia, +10 UTC.

Part 2 – Add the Offset back

So I want to add 10 hours back so I changed my derived column to

DATEADD("hh", 10, ((DT_DBTIMESTAMP)DateDeleted))

This works great, but what about daylight saving time when the offset may alter to 11 hours etc.

Part 3 – calculate the offset

DATEDIFF("hh",((DT_DBTIMESTAMP)DateDeleted), DateDeleted)

This says get the hours difference between that DateTime version of the date ((DT_DBTIMESTAMP)DateDeleted) and the DateTimeOffset version of the date.

Part 4 – Final version

Now put it all together

DATEADD("hh", DATEDIFF("hh",((DT_DBTIMESTAMP)DateDeleted), DateDeleted), ((DT_DBTIMESTAMP)DateDeleted))

Easy :-)… not!!!

Categories: SSIS Tags:

Google Hangouts showing phone number not contact name

April 14th, 2014 2 comments

The Problem

I recently upgrade my phone and am using “Google Hangouts” as the default SMS client.

Some of my contacts appear with their phone number whilst others appear with their name.

The Issue

It appears that Google hangouts matches the contact by the phone number.. EXACTLY

So 0418 1111 2222 is NOT the same as +61 418 1111 2222

The fix

The fix is in two parts:

1. Make the phone number of your contact match the phone number as it appears in Hangouts, (generally in international format).
This can be done by (google hangouts 2.0.303)
– open the offending message with the phone number displayed
– select the menu, (top right …)
– choose “people & options”
– select the phone number, and a menu pops up “Add to People”
– choose OK
– search for the person
– select the person you wish to attach the phone number too an choose OK.

2. Logout and Login
The phone numbers will still be appearing incorrectly. By logging out and logging in again it refreshes Hangouts.
– select the menu (top right …)
– settings
– select your email address
– under account settings choose “sign out”
you will now be signed out
– beside the hangouts icon press “SMS”
– choose your email address
– you will be signed in and all your recently connected contacts should update

Note: Sometimes even login and logout doesn’t force it to refresh, I have just given up and then a few minutes later when I check it is now up to date?

Categories: Android Tags:

SQL Server Enable User

March 5th, 2014 No comments

The problem

You have a SQL Login created for your account usr_test
Everything appears fine, but you cannot connect.
When you look in the users section of your database, the user appears with a disabled icon? (little red down arrow)
usr_test_disabled

The issue

Your user does not have “CONNECT” permission and therefore shows as disabled.

The solution

In SQL management studio, do the following;

  1. Connect to your SQL Server
  2. Switch to the database having the issues
    Use MyDatabase
    GO
    
  3. Execute the following statement
    Grant Connect to usr_test
    
  4. Refresh the list of users and now the user looks normal and you can connect to the database

Categories: SQL Server Tags: