Archive

Author Archive

SATA 3 SSD running on SATA II benchmark

January 11th, 2012 17 comments

This benchmark and review is to show what performance differences you can expect when you try to run a SATA 3 SSD on older hardware that only supports SATA II (300 Mb/s) connections.

I was recently looking to purchase a SSD drive as an upgrade for my old socket 775 Core 2 Duo machine to keep it alive a bit longer. This meant purchasing a current SATA 3 drive and running it connected via the on-board SATA 2 connection.

When attempting to research whether I needed an add-on SATA 3 card I was unable to find any real world reviews of this type of upgrade, so this review is designed to fill this gap.



The Rig

Mother Board: Socket 775, Gigabyte EP45-DS3
CPU: Core 2 Duo E8400 3.0Ghz, running overclocked @ 4.0Ghz.
Memory: 4GB (2x2GB) Corsair CM2X2048-8500C5C (1066Mhz)
Video: MSi R6850 Storm II 1G OC (R6850 PM2DIGD5)
SSD: Corsair Force GT 120GB, (1.3.3 firmware on SATA II in AHCI mode)
ATA Drive: Segate Barracuda® 7200.12 1 TB
OS: Windows 7 SP1 – 64 bit

SSD Benchmark

The SSD drive in question is a Corsair Force GT 120GB.

Full specs and details can be found here on guru3D

This is connected via the on board SATA II Connection.

The theoretical throughput is 300Mb/s. The following is the results of AS SSD.

The overall score is comparable with the results from the guru 3d review with the obvious difference being the Sequential Read maxing out at 263Mb/s.

Here is the compression benchmark, so clearly the drive is not being pushed very hard..

OS Benchmark

The machine is running Windows 7 – 64bit, plus all the services and software one would expect, including:

  • AVG Anitvirus
  • Catalyst control centre
  • HP Printer Software
  • Msi Afterburner
  • Core Temp
  • Network and All CPU meter gadgets

The Test

This benchmark recorded the total time to startup the PC on the 7200RPM 1TB drive vs the SSD. The benchmark recorded the time from when windows started loading after the POST screen, until a working desktop was available. This was identified as the time at which the Gadgets appeared on the desktop. This was split into 4 timing points:

  1. time to login screen
  2. time to login
  3. time to see the desktop
  4. time until the gadgets loaded.

The windows startup time is now 4 times faster with the SSD drive, launching to a working desktop in less than 25 seconds, (including typing my password!)

Windows Experience Score

The windows experience went from…

to..

The slowest component is now my CPU.. may have to tweak that overclock ;-)

Edit Caveat: Note you will have to factor in the fact that the SSD benchmark is on a clean install Windows 7 whilst the ATA Drive have been running for a while, but even so I have been using the SSD setup over the past few weeks since writing this review and start up is still very quick with only a few seconds between clicking login and being able to use the computer :-)

Crysis

I timed the loading of the application and the loading of a new game.
With the following results.

The load times were generally faster on the SSD drive and seem to have a larger performance gap as we moved from Crysis to Crysis 2.

Crysis Benchmarks

I ran both the Crysis and Crysis 2 benchmarks with no consistent pattern of improvement. The tests were within 2 fps of each other but in some cases the SSD was better and some worse. So it appears the Disk has no real impact on Crysis frame rates.

General Performance

The general performance of loading applications like Internet Explorer and Firefox, windows media centre was recorded. In most instances the load times on the SSD drive was around the 0.5 – 2.0 seconds, whilst load times on the hard drive were sometimes comparable but more often they were slower (Browsers took approx 4 seconds to load to Google homepage), but the hard drive was inconsistent in performance with load times as high as 14.5 seconds for IE being recorded.

PC Mark – Vantage (1.0.2.0)

To give some kind of industry benchmark for the entire PC experience I benchmarked the machine for overall performance using PC Mark, the results were

Hard Drive Score – 6313
SSD Score – 10683

This is a 70% improvement over the Hard drives score.

Conclusion

The general feal of the machine is much snappier with the SSD drive. Applications install really fast, open quickly and it is a nicer experience to use with no major delays when using the applications. Also I just realised my computer is also eerilly silent on start-up no more mechanical whirring and noises

I would say that it was worth the money even with just an old SATA II connection. Also this drive will be a useful addition to my Laptop at some point in the future ;-) .

SATA 3 add-on Cards

The next stage of this benchmark test will be to get my hands on a SATA 3 card like the ASRock SATA 3 card or the ASUS U3S6 and see if these cards actually provide any performance benefit, stay tuned…

EDIT: 24-Feb-2012 – Asus U3S6 Review – Benchmark Sata 2 add on card >>>

EDIT- 15 march 2012

SATA 3 SSD with no AHCI?

Neville asked…

How much of an impact does AHCI have... Can you do a quick AS SSD test with AHCI turned off??

So here it is.

Synthetic benchmarks

On AS SSD I did 3 runs on with both AHCI on and AHCI off (IDE)

With AHCI on I got the following results:

  1. 158 / 209 – 449
  2. 158 / 173 – 413
  3. 158 / 184 – 422

The best result is here

AS SSD benchmark Corsair Force GT 120 GB in AHCI mode

Note: similar to the later tests I did on the ASUS U3S6 you notice the read performance score is solid but the write performance is quite variable.

With AHCI off I got the following results:

  1. 66/158 – 261
  2. 68/159 – 266
  3. 68/171 – 277

The best result is here:
AS SSD benchmark Corsair Force GT 120 GB in no AHCI (IDE) mode

So the synthetic performance result is about 40% slower with AHCI off!!
Notice also that the 4K-64Thrd really drags the read score down, whilst all other values are comparable

Here is what Crystal Mark recorded..

With ACHI on
CrystalDiskMark corsair Force GT SATA II SSD with AHCI on
With AHCI Off
CrystalDiskMark corsair Force GT SATA II SSD with AHCI off (IDE)

Note again most figures are comparable except 4KQD32.

I did some digging and found this post
What is 4KQD32 and it is described as “4k 32 queue depth. There are 32 requests in line for 4k of data”.
If you read further they suggested this is an un-realistic test for real world usage as the disk queue for windows 7 is between 1-3 normally, (all of which backs up my next statements ;-) …)

Real world performance

But again these are only synthetic benchmark figures. What did this mean to the general performance of the PC?

  • Windows Experience I re-did the windows experience score and it was identical in all of the measures.
  • Windows Start Up I averaged around 22.5 seconds for the boot time using the same approach to measuring startup time.
  • General Feel The system seemed still quite fast to load apps and not dis-similar to running with AHCI on.
  • Crysis I re-ran the Crysis Benchmarks and found that the performance was within +/- 1 fps with AHCI on or off.

So if you look solely at the synthetic benchmark things don’t look so good, (AS SSD even says its BAD – checkout the screenshot) but in the real world you will notice a significant improvement in boot times, and general speed of your PC.

As an example I have a work laptop that is a Lenovo ThinkPad with a Centrino processor and it has always performed really well and I couldn’t work out why it was so good with such a small CPU in it. Only when I did some poking around when writing this post did I find it runs a 60GB SSD.. and it all started to make sense.

VN:F [1.9.17_1161]
Rating: 10.0/10 (13 votes cast)

Categories: Hardware Review Tags:

Use CKEditor on MVC 3 Razor Website

December 6th, 2011 5 comments

This post provides the basic steps the implement a CKEditor control into your MVC Razor web page.

This post assumes you have a working MVC website, with a standard _Layout.cshtml page.

Follow these easy steps:

  1. Download the latest version of the CKEditor from here
    You only need to download the basic package.

    At the time of writing I downloaded the zip file of CKEditor 3.6.2

    You will see there is an ASP.net control that can be downloaded but this is not required to make it work with MVC.

  2. Unzip the downloaded package
  3. In windows explorer copy the “ckeditor” folder into the root folder of your website.
  4. In Visual studio and click the “Show All Files” icon.
  5. right-click on the ckeditor folder and choose include in project, this can take a little while..
  6. In the <head> of your _Layout.cshtml file reference the ckeditor.js file
    
    <script src="@Url.Content("~/ckeditor/ckeditor.js")" type="text/javascript"></script>
    

  7. Create a model class with a property you wish to bind to your HTML editor
  8. Create a strongly-typed view (use scaffold template of edit if you like)
  9. Now the easy bit, the way this works is by generating a <textarea> control with the class of “ckeditor” and an id, so the html for this would look like the following. Note the id can be anything you want.
    
    <textarea class="ckeditor" id="text-details" name="Details">some text</textarea>
    

    To generate this in MVC use the following
    
    @Html.TextAreaFor(model => model.Details, new { @class="ckeditor", @id="text-details"})
    

    where model.Details is the property of the strongly-typed class you passed through

That’s it. Run the site and visit the page. Your text area control will be rendered as the CKEditor control.

Happy editing

VN:F [1.9.17_1161]
Rating: 10.0/10 (1 vote cast)

Categories: MVC Tags:

Distributed Transaction Failure – Race Condition

November 18th, 2011 No comments

I have a process that is using MSDTC (Microsoft Distributed Transaction Co-ordinator) to manage the transaction.

The transaction is controlled inside a c# .Net windows form executable that manages the transaction by the TransactionScope() object.

The transaction is maintained across 2 SQL server and an Oracle server and it all works… most of the time.

All transactions are opened inside a using statement, as follows



using (TransactionScope scope = new TransactionScope())

Or similar.

The overview of the .exe is it monitors a queue of jobs to process. It processes the work inside the transaction successfully commits, and then after that updates the status on the job queue to success or failure.

When there is an application error, the program throws an exception which means it ends the main transaction and in an outer transaction updates the status to failure.

Intermittently when the core logic was throwing errors on many jobs the entire process would fail with the following error:


Connection currently has transaction enlisted.  Finish current transaction and retry.

But it was intermitted. I had the same 12 jobs throwing errors on every run and sometimes it would crash with the above error after 2 jobs, 8 jobs, 4 jobs or it would actually not crash at all. On my development box I could not replicate it at all?

So I figured I had a race condition.

The fix


After the main transaction block of code and before opening the next TransactionScope object to update the status, I put a 100ms sleep.

    // Stop race condition
    System.Threading.Thread.Sleep(100);

    item.Success = false; // <-- this is my object for updating the success or failure
    using (TransactionScope scope = new TransactionScope())
    {
        context.SubmitChanges();
        scope.Complete();
    }

The problem has disappeared. I think the re-opening of a new TransactionScope() object did not allow enough time for MSDTC to close the previous transaction and it was crashing.

Cheers
John

VN:F [1.9.17_1161]
Rating: 0.0/10 (0 votes cast)

Categories: c# Tags:

How to move wordpress.com site to a sub domain hosted on IIS – Tips and tricks

November 12th, 2011 No comments

I have recently moved my free wordpress.com blog (the one that you are reading) to my own domain.

If you read the contents on this site I hope you think I am reasonalby technically savy, but the feat of moving my site and redirecting the wordpress.com links was problematic and it took me a few days and many wrong turns to get it done.

I found that most instructions are based on apache/linux hosted solutions and I had issues using my IIS/Windows based host. My windows based host uses Plesk 10 (@ the time of writing).

Before you even begin to touch a computer there are a few things you have to think of first!

1. Root site or sub-domain?

Is this the only thing that you will have on your domain or are you going to have something else hosted on http://www.yourdomain.com? You need to answer this now as when you go to buy your domain mapping from wordpress.com you can only map a whole domain. So you would be better off hosting it @ http://blog.yourdomain.com, leaving the www for other things.

I started by creating my wordpress site with a click once install under a sub-directory in my httpdocs folder (main root web folder on my host), so I had my wordpress site setup @ http://www.homedev.com.au/ntsblog but as you can’t register a sub directory I had to start again.

So in my case I went and created a new sub-domain, http://ntsblog.homedev.com.au, and now I could register the sub-domain with my wordpress.com site.

2. Permalinks!!!!

Before you go any further you need to consider permalinks.

The issue

WordPress.com by default uses links that are styled as “Pretty Links” and default to a format of /%year%/%monthnum%/%day%/%postname%/” which means a posts will appear as http://blog.yourdomain.com/2011/11/31/post_title

The problem is that with version 3.2.1 of wordpress on a Windows host the “Pretty Link” is not supported by default and most “Permalinks” contain “index.php” in the path. see image..

Why is this a problem? Consider the link to your wordpress.com article that gets returned in a google search. When you try and do the domain mapping from wordpress.com to your domain, google will pass through a URL that your hosted wordpress site cannot handle.

This article discusses the various ways of mapping pretty links, and the section you are taken to is specifically for IIS/Windows systems.

http://codex.wordpress.org/Using_Permalinks#Permalinks_without_mod_rewrite

My hosting provider already had a copy of Microsoft “URL Rewrite Module”, so I created a web.config file as per the suggestion in this article and applied it to my site but it would not work.

Assume the URL was
http://ntsblog.homedev.com.au/2011/11/09/how-to-move-wordpress-com-site/

The URL re-writer would try to go to:

http://ntsblog.homedev.com.au/2011/11/09/how-to-move-wordpress-com-site/index.php/2011/11/09/how-to-move-wordpress-com-site/

In the end I did a little bit of tweaking and came up with the following solution…

web.config

Put this is the root directory of your wordpress site.


<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
  <rewrite>
    <rules>
      <rule name="Main Rule" stopProcessing="true">
        <match url=".*" />
        <conditions logicalGrouping="MatchAll">
          <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
          <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
        </conditions>
        <action type="Rewrite" url="redirect.php?path={R:0}" />
      </rule>      
    </rules>
  </rewrite>
  </system.webServer>
</configuration>

If you look at the “Action Type” link this is re-writing the url to go to a page called “redirect.php” passing in a parameter of the relative path. So we now need to create the “redirect.php” page.

redirect.php

Again, create this file in the root of you wordpress site.


<?php

  $relative_url = $_GET['path'];
  $new_relative_url = 'index.php/'. $relative_url;
  $hostname = $_SERVER['SERVER_NAME'];
  $new_url = 'http://' . $hostname . '/' . $new_relative_url;
  
  header("Location: " . $new_url)

?>

So what is this doing?
The URL re-writer matches the invalid URL and re-writes the url to “redirect.php”. This page then takes in the parameter, and rebuilds the full url to the site based upon inserting “index.php” in the chain. This works and also the “referrer” and “search engine” stats are not affected by the extra redirect.

To test this take an existing post on your new site, remove the index.php and paste that into a new browser window. The site should redirect to the index.php version. This means any link to your wordpress.com site will redirect to your new domain and be successfully passed along to the index.php page.

The only problem with this is that I don’t see how you could reverse the process and return to your wordpress.com site. The new articles will be found with index.php and if you try to go back to worpress.com as the primary domain the links with index.php will all break. Solution don’t go back. I will follow this up with wordpress and see if I can find a better solution.

Buy a domain from wordpress.com

Before you buy a domain read these wordpress articles about mapping domains or mapping sub-domains

Now seeing as I had created a sub-domain I went down the route of creating a CNAME entry. In plesk this means going to your DNSSettings and adding in a new CNAME. But being new to plesk I did not notice that when you make a DNS setting the settings shows with a warning like this
and right up on the top of the page you need to confirm the change by clicking Update.

So failing to notice that I handn’t saved the CNAME entry I gave up in frustration. So even though it told me not to I bought a domain and followed the full domain mapping instructions and it worked.

The instructions are fully mapped out in the mapping domains article but here are some extra tips.

  1. Go to your domain name provider site and find your name server settings, copy and paste them into a .txt document so you don’t forget them.
  2. With my name server provider, my names servers had a “Registrar Lock” on them. To update the ns1.wordpress.com, ns2.wordpress.com, ns3.wordpress.com, I had to
    1. Un-tick the checkbox and click save to clear the registrar lock.
    2. add the wordpress name servers and click save.
  3. now go to your wordress.com site and go to Store –> Domains.
  4. enter your domain, blog.yourdomain.com and click Add, follow the process to purchase the domain mapping
  5. Once registered, select your domain as the “Primary Domain” and click “Update Primary domain”
  6. Return to your name server and enter in the previous name server settings that you backed up to the text file.
  7. Re-enable the “Registrar Lock” if you have one.

Your wordpress site should now all be working.

What Plugins?

Now you’ve been using wordpress.com for a while and you probably have it configured how you like it, so how do you make your new site just like wordpress.com.
Most of the plugins on wordpress.com are special to wordpress.com, so I found it difficult to find and install the plugins to get the functionality I am used to.
So here is a mapping between functionality and the plugin you can freely download and install:

# wordpress.com Plugin Equivalent
1. Site Statistics Jetpack
2. Importer WordPress Imported
3. Ratings GD Star Rating

Other plugins I have found of interest;

  • Easy AdSense Lite
  • Google Analytics for WordPress
  • Preserve Code Formatting – keeps spaces and formatting when posting code snippets into your post.

Thats it for now.

Cheers
John

VN:F [1.9.17_1161]
Rating: 0.0/10 (0 votes cast)

Categories: Blogging Tags:

How to run MvcMusicStore v3.0 with SQL Server Express

November 11th, 2011 No comments

I’ve been trying to do the MVCMusicStore v3.0b tutorial, and I wanted to use SQLExpress rather than SqlServerCe.4.0.

When trying to do this I ran into a number of problems but I finally figured it out.

This guide assumes you already have a working copy of SQL Server Express and that your user account is a System Administrator for the database.

This is the link to the PDF document for the v3.0b tutorial. MvcMusicStore v3.0

(*all page numbers quoted as on the document, page 45 is actually Page 46 when listed in Acrobat)

Below is what I did and the 2 solutions that I found..

  1. As on page 45* I created the AppData Folder.
  2. I downloaded the MVC assets and extracted the files from the zip file.
  3. Right click on AppData and add an existing file, and add in the MvcMusicStore.mdf.
  4. Edit the web.config and added the following connection string:
    
    <connectionStrings>
      <add name="MusicStoreDb"
        connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|MvcMusicStore.mdf;Integrated Security=True;"
        providerName="System.Data.SqlClient" />
    </connectionStrings>
      

  5. Added the MusicStoreEntities.cs as on page 47.

At this point Debug the site and I was getting errors. First I was getting errors about meta data failures.
I managed to play a bit more and somehow fixed the meta data issues so that it was no longer erroring, but the queries were not returning any data.

Then I noticed the following 2 issues:

  1. Write some code like the following

    
          MusicStoreEntities db = new MusicStoreEntities();
          string connection = db.Database.Connection.ConnectionString;
        


    Run up in debug and check the value stored in the connection string.

    Note that the database name is related to the application MvcMusicStore, “MvcMusicStore.Models.MusicStoreEntities”? WTF?
  2. Put a watch on the db.Database.Genres object and note the sql statement is is going to execute. The table name is “dbo.Genres”.
    The issue? Your datbase doesn’t have a “Genres” table it has a “Genre” table (minus the ‘s’).

Solution 1

So to fix these issues I have done the following:

  1. Create a default constructor in the MvcMusicStoreEntities class like follows:
    
    public MusicStoreEntities()
    {
        this.Database.Connection.ConnectionString = 
               ConfigurationManager.ConnectionStrings["MusicStoreDb"].ConnectionString;
    }
    

    This over-rides the connection string with the one that we have specified in the web.config.

  2. Pluralise your database.

    If your hosting your database on SQL Server you can use the SQL Management studio, or if you are hosting it in AppData then use the server explorer.
    Right click on each table and select “Open Table Definition”. Press F4 to view the properties window, Edit the “Name” property and change the name of the table and add an ‘s’ to the end, Genre -> Genres, Album -> Albums, Artist -> Artists etc. Save the file to apply the name change.

  3. Edit: A bit more digging and I also found this solution to the Pluralised problem, this removes the pluralised table names. Probably a bit easier than the above solution
    In your MusicStoreEntities class add the following
    
            using System.Data.Entity.ModelConfiguration.Conventions;
    
            protected override void OnModelCreating(DbModelBuilder modelBuilder)
            {
                modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
            }
    
  4. Debug your site and it should all work now.

Solution 2

In attempting to work out the above solution I also found a second solution.

  1. Ensure the constructor is removed from the MusicStoreEntities class.
  2. Edit the web.config file and add the following connection string
    
        <connectionStrings>
          <add name="MusicStoreDb"
            connectionString="Data Source=.\SQLEXPRESS;Integrated Security=True;"
            providerName="System.Data.SqlClient" />
        </connectionStrings>
        
  3. Add the Sample Data as on page 47 & 48 of the PDF guide.
  4. Debug your site and it should work.

    Launch SQL Mangement Studio and refresh the list of databases, you will see you new database [MvcMusicStore.Models.MusicStoreEntities] and look at the tables and they have pluralised names.

Hope this works for you as it did for me. Happy MVC’ing.

VN:F [1.9.17_1161]
Rating: 0.0/10 (0 votes cast)

Categories: c#, MVC Tags:

Hyper-V Server virtual machine network connection failure – vm network issues

October 12th, 2011 No comments

Hi,

This has been a problem that has haunted me for over 18 months now and finally I have a solution.

The Problem

I have been creating virtual machines and been getting inconsistent success with getting the virtual network card inside the Virtual machine to successfully connect to the network. It will start up with a yellow “Warning” icon showing and when you confirm the IP Addres settings it is an invalid 169.x.x.x address. I am attempting to use DHCP to assign the IP.

I this situtation I have tried the following:

  1. netsh int ip reset – followed by a reboot.
  2. stop the VM, remove the network card completely, start the VM and login, shutdown the VM, add the network card back, start the vm and login
  3. changed the MAC ADDRESS on the virtual card to ensure it is not conflicting on the network.

All of these have failed.

This has been really confusing as I have created 2 Virtual Machines at the same time, from the same sysprep’d .vhd image and one will succeed and one will fail!!!

The only thing that has worked is to assign a static IP address.

Solution

A friendly member of the infrastructure team where I am working fixed it in about 2 seconds.

Apparently due to the way the newtork as been configured we run a virtual Lan, its number so happens to be 100.

So in hyper-v server find this screen:

And change it to something like this:

This sovled my problem.

I don’t know why sometimes it was set correctly and other times not, but this definitely solved my problems.

Let me know if it works for you.

VN:F [1.9.17_1161]
Rating: 0.0/10 (0 votes cast)

Categories: Servers Tags:

Setup App.Config during .msi install, msi re-installing

August 17th, 2011 No comments

The Issue

I wrote a windows form application that deployed  via an .msi installer.

The application has an App.Config file which contains a single configuration value. I wanted to prompt the user for this value during the installation wizard and write it to the application.exe.config file as part of the installation process.

I used the built in Setup project in Visual Studio 2010.

The solution

I could write it all here in my post but I have found one that was created earlier:

http://raquila.com/software/configure-app-config-application-settings-during-msi-install/

I essentially implemented the same solution but I wrote my .config file using a StringBuilder and deleted and re-wrote the.config file in the Post install custom action.

The other thing is that I created short cuts to the application by right-clicking on the primary output and chosing “Create Shortcut”, then I copied this to the desktop and users program menu locations.

The problem

I was installing this for “Everyone” and it would work fine for me, but when other people logged in and tried to launch the program the .msi would run and the application.exe.config file was being overwritten with the orginal version that was deployed with the .msi, which does not contain the users input.

The Fix

The problem is complicated and is related to the application short-cut.

It appears that by default the short-cuts created in the msi are “Advertised ShortCuts”.

According to microsoft when an advertised shortcut is activated “.. the installer verifies that all the components in the feature are installed before launching this file”.

This means that if you delete any of the files that were deployed to the installation location then the .msi will attempt to fix them and re-install the missing components, which in my case means that the application.exe.config is overwritten.

You can identify the “Advertised” short cut by looking at the “Properties” of a short-cut and the “Target” will be greyed out.

I found the post below that identifies an easy way to disable advertised shortcuts.

You need to set the “DISABLEADVTSHORTCUTS” property on the .msi. This can be done easily in the installer, I have my custom UI that is getting details from the user for the “Edit1Property” so in the Edit2Property I set these values and keep it invisible.

  • Edit2Property: DISABLEADVTSHORTCUTS
  • Edit2Value: 1
  • Edit2Visible: false

This updates the property table in the .msi and now all your short-cuts will be normal standard shortcuts.

http://social.msdn.microsoft.com/forums/en-US/winformssetup/thread/b0a3e6d5-38f0-4a37-9418-dd8d9297ef97/

Cheers :-)

Final Tip: Setting the shortcut icon

Another tip is to set the icon based on the icon embeded in your .exe.

  • In the File System Editor, click on the ShortCut and view the properties
  • Click on the icon property
  • choose browse,
  • change from .ico to .exe
  • browse to the “Primary-Output for…” and choose OK.

It will show you the icons embeded in your .exe and this way you don’t need to deploy a seperate .ico file.

VN:F [1.9.17_1161]
Rating: 0.0/10 (0 votes cast)

Categories: c#, Windows Forms Tags:

SQL Server 2008 R2 – Intellisense not working – Visual Studio 2010 SP 1

March 18th, 2011 11 comments

Hi,

Recently intellisense in the SQL Server management Studio stopped working.

It appears that it was caused by the installation of Visual Studio 2010 SP1.

The issue was raised here:
https://connect.microsoft.com/SQLServer/feedback/details/650569/ssms-2008-r2-is-losing-intellisense-after-installing-visual-studio-2010-sp1

It was originally suggested that this could fixed by SQL Server 2008 R2 Cumulative Update #6, but this in turn lead to a crash in Visual Studio 2010 when ever you opened a .sql file in your database projects.
https://connect.microsoft.com/VisualStudio/feedback/details/653180/method-not-found-opening-files-in-database-project

It suggested that this issue has been fixed and will be released in SQL Server 2008 R2 Cumulative Update #7, which was due out in Mid April.

You can install Cumulative Update #6 and in most cases this will get intellisense working in SSMS but it will break Intellisense (on database projects) in VS2010.

So if you are like me, you are between a rock and a hard place, your choice of which environment you prefer to have working.

Lets hope that CU #7 fixes it.

I will update this post with my results after I have applied CU #7.

Cheers…

Update as @ 19th April

Today Microsoft has released Cumulative Update package 7 for SQL Server 2008 R2

After downloading and installing, preliminary results are that the problem is solved.

Intellisense in SSMS seems to be working and I no longer get the crashes in Visual Studio 2010 and Intellisense in Visual Studio 2010 database projects also seem to be working correctly. So, so far so good.

Update as of Nov 2011

As someone has pointed out the release of SQL Server 2008 R2 SP1 is supposed to fix this issue, (as it contains all the rolled up cumulative updates).

I personally have had mixed results with some machines working again and others having “Intellisense” working in SQL management Studio but remaining broken in Visual Studio 2010. My main work Development environment is still broken in this way and if I ever get it working I will udpate you on what I had to do, but for now I am living with only having intellisense in the SQL management studio.

VN:F [1.9.17_1161]
Rating: 0.0/10 (0 votes cast)

Categories: SQL Server Tags:

Bootstrapper Manifest Generator (2008) – How To Guide v2

March 3rd, 2011 8 comments

I wrote the original Boostrapper Manifest Generator (BMG) blog post a few years ago.

It is one of the most heavily visited pages on my site so I thought I should revisit it, and given that the BMG is so buggy it could be useful to have some screen shots.

I will provide 2 concrete examples of how to use the BMG to create a bootstrapper pre-requisite check.

All this is being done on a Windows 7 32-bit (Virtual) machine, with visual studio 2010 installed.

I have also downloaded and installed the BMG2008 which can be downloaded from here

The application that I am going to bootstrapper is a small test application called “GuidGenerator”, can you guess what it does?

I will be using a standard setup deployment project to create the installer.

Here goes..

Setup BMG 2008

  1. Download the BMG2008 from here
  2. Install the application and note the path that it is installed to as it does not create a short cut, (C:Program FilesMicrosoftBootstrapper Manifest Generator for VS2008), and create your own desktop shortcut
  3. Run the BMG
  4. Click “Tools :: Edit Machine Paths”
  5. You may get a message about the SDK not being installed etc etc. Get past the error message and you will need to set the path to your boot strap directory. Do a search on your file system for “bootstrapper” and you will find a folder somewhere like this (note the SDK path)
    C:Program FilesMicrosoft SDKsWindowsv7.0ABootstrapper
    Enter that into the path and choose OK.

    You are now ready to create a bootstrapper

    Note: This bootstrapper folder is important – read the tips and tricks at the end.

Example 1 – .Net Framework 4.0 Pre-requisite Check

  1. Download the DotNet framework full install from Microsoft here, and save to a location that you can find, mine is @ c:DownloadsdotNetFx40_Full_x86_x64.exe
  2. Run the BMG
  3. Click “File New”
  4. Choose “Package Manifest”, choose OK
  5. Choose “Add Install File”, (button in the top left)

  6. Browse to the .Net Framework that you downloaded earlier and click OK
  7. Display Name: enter a name for the bootstrapper, this is the name of the pre-requisite check that will show up in visual studio. I will call mine “My .net Framework 4.0 Check”
  8. Click back on the “Package” option which is the root of the tree menu on the left and set the Product Name to DotNet4Check – this becomes the name of the folder that the package is created in.
    Note: You have to do it in this order as if you set the package name before adding a file it crashes the BMG.
  9. Click into the product code field and it will default with the “Product Name” just set, (otherwise this can throw a warning if left blank).
  10. System Checks
      You want to set up a system check that fails if the condition is not met, or alternatively by-pass the install if a condition is met.
      If it fails the check then it will prompt the user that they need to install the pre-requisite.

      For the .Net Framework I have chosen to do a simple registry check for the .Net Framework version.

    • Switch to the system checks tab
    • Click on the registry check (2nd icon in the list)
    • Property for Result: DotNet4RegCheck (note: this is the name of the check that is used later in the “Install Conditions” tab
    • Enter the following registry key: HKLMSoftwareMicrosoftNET Framework SetupNDPv4Full
    • Registry Value: Version
  11. Install Conditions
    • Switch to the install conditions tab. This is where we define when our installer should be run.
    • Type: ByPassIf
    • Property: DotNet4RegCheck – (This is the name entered in the “Property for Result” field in the system check
    • Comparison: Ver >=
    • Value: 4.0.30319
  12. Exit Codes
    Set the following: (Note: I am cheating as I am reverse engineering the .Net bootstrapper that comes with VS2010 to get these exit codes

      0 – Success
      3010 – Success with reboot

    Leave all the other options with their defaults

  13. Build: Now we can build the package, (button top right)
  14. Results, note that in my case it succeeded with no errors, and the path contains the folder name that I entered in the product name field.

  15. Copy: Go to the output directory and copy the “DotNet4Check” folder to “C:Program FilesMicrosoft SDKsWindowsv7.0ABootstrapperPackages”
  16. Setup Project
    1. My project looks like this:

    2. Right Click on the Setup Project and choose properites
    3. On the properties window Click the “Pre-Requisites” button.
    4. Deselect anything that is selected that you do not require and choose your check.

    5. In this case I am going to say – “Download prerequisites from the same location as my application”
    6. Build the setup solution in release mode.
    7. Copy the release directory somewhere to a machine missing the pre-requisites. The release directory should look something like this, because we chose to set the download from the same location.

    8. Run the installer and you will see this…

Example 2 – .Net Framework 4.0 Pre-requisite Check – web download

In this example we want to supply a web download version of the installer so you don’t have to distribute the requisite files with your installer.

This will be identical to the previous example with these changes:

  1. After adding the file you get the Properties tab. Enter the URL from the tips below in the “HomeSite URL” setting.
    I used – http://go.microsoft.com/fwlink/?linkid=182805 for the .Net 4.0 Framework. (remember you must right-click and choose paste).

  2. When setting up the package pre-requisites choose to “Download Pre-requisites from the package vendors website”.

Repeat all the other steps and when you choose “install” from the bootstrapper prompt you should get a message that it is downloading.

Tips and Tricks

  • The “Bootstrapper” directory is your friend (on my machine “C:Program FilesMicrosoft SDKsWindowsv7.0ABootstrapper”).
    If you have access to a VS2010 installed machine and go to the bootstrapper directory and into the Packages folder and you will find bootstrappers for 19 different things, including .Net 3.5/4.0 and Client installation versions.
    I suspect if you took a copy of the packages folder back to your older VS2005/2008 environment you would get the pre-requisites.
  • If you don’t intend to set up exit conditions don’t switch to the “Exit Conditions tab”. if you do it will put an empty condition in that throws a warning at build time. The only way to get rid of it is to enter 0 / Success.
  • I suspect for things like .Net you want the user to be able to download the .exe directly. Here are the URL’s provided by the .Net bootstrappers installed with VS2010.

    These are the small web installer based versions

    • .Net Framework 3.5 SP1: http://go.microsoft.com/fwlink/?linkid=118076 download
    • .Net Framework 3.5 Client: http://go.microsoft.com/fwlink/?LinkId=119637 download
    • .Net Framework 4.0: http://go.microsoft.com/fwlink/?linkid=182805 download
    • .Net Framework 4.0 Client: http://go.microsoft.com/fwlink/?linkid=182804 download
  • My web install failed because on my Install I happened to click into the “Value” field and it put the following “N/A for ValueExists and ValueNotExists”. This created an “unexpected error” on install.
    I went into the product.xml file and set value=”" and it worked.
VN:F [1.9.17_1161]
Rating: 0.0/10 (0 votes cast)

Categories: c#, Code Tags:

Reconnect all SQL logins after DB restore

March 2nd, 2011 No comments

Hi,

Below is a script that I use to reconnect sql logins after a database restore.

It reconnects all users to all databases.

Cheers

Use Master
GO

Set NoCount On

if exists(select * from tempdb..sysobjects where id = object_id('tempdb..#tblDatabases'))
  Drop Table #tblDatabases

if exists(select * from tempdb..sysobjects where id = object_id('tempdb..#tblUsers'))
  Drop Table #tblUsers

Declare @db nvarchar(max)
Declare @usr nvarchar(max)
Declare @sql nvarchar(Max)
Declare @msg nvarchar(200)

Create Table #tblDatabases
(
  DBName nvarchar(4000)
)

Create Table #tblUsers
(
  UserName nvarchar(4000)
)

Insert Into #tblDatabases
select name from master.dbo.sysdatabases where dbid &gt; 4 
Order By name

Select Top 1 @db = DBname from #tblDatabases

While @db is not null
Begin
  set @msg = Char(13) + 'Processing ' + @db
  RAISERROR(@msg, 0, 0) WITH NOWAIT 
  
  set @sql = N'
  Use [' + @db + ']
  
  Declare @usr nvarchar(max)
  set @usr = null

  Truncate Table #tblUsers;
  Insert Into #tblUsers SELECT name from sysusers where altuid is null 
                 and name not in (''dbo'', ''guest'', ''sys'', ''INFORMATION_SCHEMA'');
  Select Top 1 @usr = userName from #tblUsers;
  
  While @usr is not null
  Begin
  
    print ''fixing user '' + @usr
    exec sp_change_users_login ''auto_fix'', @usr
    
    Delete from #tblUsers where username = @usr
    Set @usr = null
    Select Top 1 @usr = userName from #tblUsers  
  End'
  
  --print @sql
  exec(@sql)
  
  -- main loop
  Delete from #tblDatabases where DBName = @db;
  
  Set @db = null
  Select Top 1 @db = DBname from #tblDatabases
End

Drop Table #tblDatabases
Drop Table #tblUsers

Set NoCount Off

VN:F [1.9.17_1161]
Rating: 0.0/10 (0 votes cast)

Categories: SQL Server Tags: