Monday, 31 December 2012

How to delete gmail from android app

Most of you would think that this is quite simple however you would be wrong it is actually very counter intuitive

  1. first select the emails you want to delete
  2. then mark them as spam
  3. in in the span folder swipe the email to the right to delete it forever

Friday, 28 December 2012

Javascript framework performance tester

Came across this little gem for testing the performance of javascript frameworks in your browser. Interesting to see how each browser performs...
Also this is quite a good reference for all the difference frameworks that are out there at the moment to choose from
Performance test results for various browsers as follows...
IE 8.0 32-bit on Windows 7 64-bit
Chrome IE 9 32-bit on Windows 7 64-bit
Chrome 23.0.1271.97 32-bit on Windows 7 64-bit

Thursday, 13 December 2012

How to use the Translator Generator VS 2010 Extension


  1. Ensure you have the following installed...
    b) - simply double click the downloaded vsix file
  2. Install the TranslatorGenerator VSIX package by double clicking on it. You will see the following window appear, just click the Install button.
  3. If you have successfully installed you will see the following message...


Enabling the Translator Generator

  1. Open your solution in visual studio 2010
  2. Enable the translator generator from Tools, Guidance Package Manager, Enable / Disable Packages..., check Translator Generator option, OK


Using the Translator Generator

  1. Open a new Visual Studio instance after installing the package
  2. Right click on your target project and select Create Translator from the Translator Generator context menu option
  3. Click the ... buttons to choose your first and second classes, which are your source and target entities that you wish to create translator logic for
  4. Then click the Next button
  5. Now click the Map All button, this will attempt to match up similar named properties (case insensitive, and underscore characters ignored)
  6. You can then select properties manually in each side and click the map button to line these up as well
  7. Then click the finish button. Your newly created translator will end up under the Translators folder in your project.


  1. Run the following command from a VS.NET command prompt window
    VSIXInstaller.exe /U:8E53EB18-6A5C-4068-B24F-DE7147F3BB3E
  2. You should then see this window
  3. Then restart visual studio to ensure the package is completely removed from your extensions folder which is under


Monday, 3 December 2012

How to clear the Windows 7 Print Spooler – Method D

Run the following commands in order from a command prompt. I just stick them in a batch file called fixprint.bat under the %windir% windows folder.

net stop spooler
del %systemroot%\system32\spool\printers\*.shd
del %systemroot%\system32\spool\printers\*.spl
net start spooler

Configuring SQL Server Service Broker

Found a good step by step article here on SQL server central

At a high level these are the points to remember

To configure the service broker to send and receive messages between databases (either in local/remote instances), it needs few components in place to start the service. These are listed below.

  1. Enable the Service Broker on the database
  2. Create valid Message Types.
  3. Create a Contract for the conversation.
  4. Create Queues for the Communication.
  5. Create Services for the Communication.

Monday, 19 November 2012

No files were found to look in

If Visual Studio returns the message "No Files Were found to look in" from the find in files results window, then just do a Ctrl+Alt+PauseBreak key press withing the find results window, and search again.

How to fix the DELL 968 All in one printer, scanner

I came across this issue myself this weekend,


"When trying to scan from printer direct or via all-in-one centre the printer starts the scan and then shuts down/re-starts? Any ideas/seen this before? Thanks Steve"


Spent ages searching the web for a solution for this one, but in the end the old "2 - inch drop" was all it really needed...

Just took the two screws out of the left of the flat bed scanner glass section. Then removed the left hand grey panel that snaps in place to the left of these screws on the side of the printer. Then managed to get enough leeway out of the flat bed scanner glass holder, to reach in and give the scanner bar inside a bit of a shake.

Switched off and on again, and the scanner bar reset itself to the correct location, which is, when working correctly, out of site underneath the A4 indicator bar.

Thursday, 15 November 2012

Deep clone of an object by rewinding the Serialization stream

/// <summary>
        /// Serializes this class to a json string.
        /// </summary>
        /// <returns>A JSON string reprsenting a SelectListItem.</returns>
        public string ToJson()
            using (var memoryStream = new MemoryStream())
                var dataContractJsonSerializer = new DataContractJsonSerializer(typeof(JsonSerializableSelectListItem));
                dataContractJsonSerializer.WriteObject(memoryStream, this);
                memoryStream.Position = 0;
                using (var streamReader = new StreamReader(memoryStream))
                    return streamReader.ReadToEnd();

Wednesday, 14 November 2012

How to Tune Up a Virtual PC


If your VPC seems slow try the following steps to rectify.

1. Have separate drives for your Page File, Host operating system, and VHD file

2.Try defragging again using O&O defrag ( instead of the standard windows defrag tool, it works better. The steps below may take some time but should dramatically improve the responsiveness of your VPC. Make sure you have at least as much free space on your drive where the .vhd file is located as the current size of the .vhd. For example, if your .vhd file is 8GB, you need 8GB+ of free space. This much free space is not necessary but will speed up the defrag process. At the very least, try to have a couple gigs of free space before running defrag.

Warning: If you run these steps on a differencing or undo disk, compacting will require you to merge the differencing or undo disk with the original. If you cannot do this, your differencing or undo disk will be twice the size. However, it will most likely still perform better.

Note: Running defrag and precompacting are done inside the VPC. Compacting the disk is done using the Virtual PC Console with the VPC turned off.

Running Defrag (about 30 to 90 minutes depending on how fragmented the drive is)

1.     Download the defrag utility and extract the defrag.exe and defragps.dll files to a location on the VPC root drive.

2.     Inside the VPC, click Start, and then Run. Type cmd and press ENTER.

3.     Change the path to the location where you extracted the defrag.exe and defragps.dll files , i.e. cd c:\tools\defrag and press ENTER.

4.     Type defrag -d c: and press ENTER.

5.     Let this process go for awhile. At the end your .vhd file will be about twice the size.

Next, you must precompact inside the VPC before compacting the .vhd.

Running Precompact (about 10 minutes)

1.     On the VPC menu click CD, then Capture ISO Image.

2.     Browse to C:\Program Files\Microsoft Virtual PC\Virtual Machine Additions\

3.     Double-click Virtual Machine Precompactor.iso

4.     If it doesn't launch, open the D drive in Explorer and double-click precompact.exe.

5.     Let this process run. When it's done, shut down the VPC.

Now you can compact the .vhd file using the Virtual PC Console

Compacting the .vhd file (about 30 minutes)

1.     Go to the Virtual PC Console, select your VPC, and then click Settings.

2.     Select Hard Disk 1.

3.     Click Virtual Disk Wizard.

4.     Click Next on the first screen of the wizard.

5.     Click Edit an existing virtual disk, and then click Next.

6.     Click Browse on the Virtual Disk to Edit screen of the wizard and browse to your .vhd file. Select it and click Open.

7.     Click Next.

8.     Click Compact it (this should be the default), and then click Next.

9.     Click Replacing the original file, and then click Next.

10.  Click Finish. The disk compacting will start.

Other Performance Tips

  • Disable all visual enhancements

1.     Right-click My Computer, and then click Properties.

2.     On the Advanced tab click the Settings button in the Performance section.

3.     On the Visual Effects tab, click Custom then uncheck everything in the list below.

4.     Click OK.

  • Turn off automatic updates
  • Set hardware acceleration to full

1.     Right-click the desktop, and then click Properties.

2.    On the Settings tab click Advanced.

3.    On the Troubleshoot tab, move the Hardware acceleration slider to Full.

4.    Click OK

  • If you have an old spare 20GB drive lying around, you can use that as an external USB drive and dedicate the entire partition to a single VPC. This will have good performance even with undo disk on as there is virtually little or no fragmentation even over prolonged usage.
  • Hard disk paging is bad. Make sure that you balance memory allocation for both the VPC and the Host machine. Allocating too much memory to the VPC can cause your host machine to page to the hard disk and vice versa. With 2GB memory on the host machine, you can allocate 1GB to the VPC with good performance (even with Outlook 2007 and the IE browser running).
  • Try the Windows registry optimization with your host machine and VPCs.
    • Disable paging of the OS core files (look for the registry keyDisablePagingExecutive inHKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management and set the value to 0x1)
    • Disable the updating of the last access timestamp on the file system (run fsutil behavior set disablelastaccess 1 from the command prompt).
    • Reboot. Note the first registry tip is only useful if you have sufficient memory allocated to avoid hard disk paging.
  • To improve performance for applications in the VPC (applies to Windows Servers 2003)
    • Right click on Computer and select Properties.
    • Select the Advanced tab.
    • In the Performance section, click on Settings.
    • Under the Advanced tab, select best performance for Programs instead ofBackground services. For windows 2003 servers, this is normally set toBackground services.
    • Reboot.
  • If you have a Core Duo or Core 2 Duo processor on your machine, it should have support for hardware virtualization support. Make sure to do the following:
    • Turn on the Virtual Machine Monitor (VMM) in the bios settings. Depending on the bios type, there may be one or two settings related to this. Make sure all are enabled. If you do not see the settings in the bios, it means your hardware manufacturer has not implemented the support.
    • Enable Hardware Virtualization support in VirtualPC 2007. In the Virtual PC Console, go to File menu and select Options.
    • Under every VPC's settings, you should then be able to set the Hardware Virtualization option. This is only grayed out if you haven't done the previous two steps or if you don't have the right processor.
    • In the virtual machine, make sure that you have installed the latest VirtualPC 2007 Virtual Additions if you have not done so.

WCF System.Net.WebException: The underlying connection was closed: The connection was closed unexpectedly

WCF System.Net.WebException: The underlying connection was closed: The connection was closed unexpectedly

If you get the above error when trying to return large numbers of items in a List<T> from a WCF service, then ensure you have set the following behaviour for the dataContractSerializer in both your client and service configuration files..

<dataContractSerializer maxItemsInObjectGraph="2147483646"/>

As in this blog, but with larger number (i.e. max of int)

Need the settings in service layer and client, set to this.

Service has this

<behavior name="MyService.ServiceImplementation.MyService_Behavior">

                                  <serviceDebug includeExceptionDetailInFaults="true" />

                                  <serviceMetadata httpGetEnabled="true" />

                                  <dataContractSerializer maxItemsInObjectGraph="2147483646"/>



<service behaviorConfiguration="MyService.ServiceImplementation.MyService_Behavior"


                           <endpoint binding="basicHttpBinding"bindingConfiguration="BasicHttpBinding_Leads"


contract="MyService.ServiceContracts.IMyService" />

                           <endpoint address="mex" binding="mexHttpBinding"contract="IMetadataExchange" />



Client has this …



<behavior name="debuggingBehaviour">

<dataContractSerializer maxItemsInObjectGraph="2147483646" />




<endpoint address="http://localhost/Host/Internal/myservice.svc" binding="basicHttpBinding"

bindingConfiguration="BasicHttpBinding_IMyService"contract="LeadsServiceInternal.IMyService" name="BasicHttpBinding_IMyService"



Note you must also set the following two settings on the client maxReceivedMessageSize and maxBufferSize

<binding name="BasicHttpBinding_IMyService" closeTimeout="00:01:00" openTimeout="00:01:00"receiveTimeout="00:10:00" sendTimeout="00:10:00" allowCookies="false" bypassProxyOnLocal="false"

hostNameComparisonMode="StrongWildcard"maxBufferSize="500000000" maxBufferPoolSize="524288" maxReceivedMessageSize="500000000"messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">

                                  <readerQuotas maxDepth="32" maxStringContentLength="8192"maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>

                                  <security mode="None">

                                         <transport clientCredentialType="None"proxyCredentialType="None" realm=""/>

                                         <message clientCredentialType="UserName"algorithmSuite="Default"/>



Tuesday, 6 November 2012

How to remove the encryption from Humax HDR Fox T2 HiDef recordings

Going to give this a try when I have a spare moment,...

Keep watching this post to see how I get on.

So far so good, following these steps

Use FTP to access the Humax file system*
Pull the .hmt file (from the file set that comprises an HiDef recording) onto my PC (using FTP)
Use the Foxy utility to clear the ENC (Encrypted) flag in the .hmt file
Send the .hmt back to the Humax
Copy the HiDef recording to the USB stick decrypted (because the ENC flag was cleared)
Move it to the PC and do something with it

*Settings.. System.. Internet Setting.. FTP Server.. ON

Name: Humax (or whatever you like)
FTP Server: (or whatever your IP address is)
FTP Port: 21 (default)
User ID: humaxftp
Password: 0000 (unless you've changed it)
Passive Mode: NO (very important)
Save Password: YES
Mask Password: YES (doesn't matter)
Anonymous Login: NO

Got Foxy from here...

Further updates:

Seems like 4gb is FAT32 limit. Managed to get whole file off the box using ftp, but don't think that the encryption is removed when you copy it via ftp, as the 8gb file now doesn't play in vlc player for some reason.
The ftp copy to NTFS didn't work,
but then I discovered this post which I'm resting all hopes on now...
Samsung AllShare Software = File transfer no encryption! -
All share can be downloaded here  - - Note to get round the hotfix loop in the installer, Right click this exe and select run as administrator. Actually you may have to run the install twice, as it appears to get stuck in the hotfix loop the first time you run it. Use Task manager to end the install process, and then run it again using run as administrator option. Then RESTART YOUR COMPUTER!!!
Main software page for it here -

Important Note: In order to get Samsung All Share to see your Humax box, then on the Humax box you must enable content share, under the Internet settings menu option for the box.

Final update:

Finally managed to get it working. Used ftp://humaxftp:0000@192.168.x.x in windows explorer on Windows 7 , and create this as a favourite location. Used the foxy app mentioned above to crack open the .hmt file and upload it back via this ftp link in windows explorer.
Then used the humax menu to copy the recording into a folder on the machine, before restarting the all share application on my laptop.
Then used the samsung all share application to copy the .ts HD file over to my computer as an avi file, whilst another machine was copying the .ts file over via the FTP link as well. P.S. Works best with direct link into your router rather than over wifi as transfer speeds are faster over LAN cable of course.
Now just waiting to see if the full 8gb comes down via the all share interface..... BOOM! It worked.  

SQL to drop and recreate foreign keys

SELECT  'To'                                                      'Direction',
            OBJECT_NAME(sfk.constraint_object_id)     'ConstraintName',
        OBJECT_NAME(parent_object_id)                 'ConstrainedTable',                                            'ConstrainedColumn',
        OBJECT_NAME(referenced_object_id)       'ConstrainingTable',                                            'ConstraingColumn',
        'ALTER TABLE ' + QUOTENAME(OBJECT_SCHEMA_NAME(parent_object_id)) + '.' + QUOTENAME(OBJECT_NAME(parent_object_id)) + ' WITH NOCHECK ADD  CONSTRAINT ' + QUOTENAME(OBJECT_NAME(sfk.constraint_object_id)) +  ' FOREIGN KEY([' + '])  REFERENCES ' + OBJECT_NAME(referenced_object_id) +' ([' + +'])' AS [CreateScript] ,
        'ALTER TABLE ' + QUOTENAME(OBJECT_SCHEMA_NAME(parent_object_id)) + '.' + QUOTENAME(OBJECT_NAME(parent_object_id)) + ' DROP CONSTRAINT ' + QUOTENAME(OBJECT_NAME(sfk.constraint_object_id)) AS [DropScript]
FROM    sys.foreign_key_columns sfk
        INNER JOIN sys.columns psc ON psc.column_id = sfk.parent_column_id
                                      AND sfk.parent_object_id = psc.object_id
        INNER JOIN sys.columns csc ON csc.column_id = sfk.referenced_column_id
                                      AND sfk.referenced_object_id = csc.object_id
WHERE   OBJECT_NAME(sfk.constraint_object_id) IN


Thursday, 1 November 2012

How to replace the battery in a Jag X-Type Key Fob, and reprogramming the key fob
See the reprogramming information further down this page for the solution for reprogramming the key fob should this happen.

Replacing the battery

Here is just a quick write-up on how to replace the battery in the key fob. The only tool you need is a small flat head screwdriver.
First you can use the small flat head in this small tab to pull the fob into two pieces.

It should look like this after getting it apart.

Then taking the part with the buttons on it you will see a spot to use the flat head to start to work your way around to make that come apart into 2 pieces.

Once that's in two pieces you will see a small screw on the circuit board in the top left corner in the pic. The small flat head will allow you to unscrew this.

Then you will be able to pull the circuit board out and will allow you access to the battery.

Now you just use the flat head again to help pull the battery out and replace. Note: At this step I also used a cotton bud doused in some alcohol (Rum as there was some in the cupboard) to clean the contacts on the circuit board.

Once the new battery is in its just a matter of screwing the circuit board back in and everything else will just click back together. Now you have a fresh battery. You shouldn't have to reprogram the key fob it should just start working again if the battery was dead so just click the buttons to test. However if the battery has been dead a long while you will most likely have to reprogram the key fob.
Hope this helps some people out.

Reprogramming the key fob

To program the remote transmitter(s) without using Worldwide Diagnostic System (WDS), follow the procedure outlined below.
Note: When carrying out the alarm remote programming, ensure that
no other vehicles within a 50 meter radius are undergoing the same
programming procedure, as this could affect the programming
Note: All required remote transmitters must be available when carrying out this procedure.
1. Open driver's door using the metal part of the key.
2. Turn the ignition switch to the 'auxiliary' position, then turn the ignition switch to the 'ON' position and back to the 'auxiliary' position four times quickly (about one turn each half a second).
Note: A chime from the Generic Electronic Module (GEM) will indicate
programming status has been enabled.
3. Turn the ignition switch to 'OFF' position.
4. Remove the key from the ignition switch.
5. To program the transmitter, press any key within 10 seconds.
Note: If the remote transmitter has been accepted, the GEM will
make a chime.
6. If any other remote transmitters are to be programmed, press any button once on each transmitter within 10 seconds.
Note: A maximum of four remote transmitters can be programmed to the vehicle at any one time.
7. Close driver door.

Wednesday, 31 October 2012

Beware the perils of Javascript

These two links are definitely worth a read I think...

and especially…


Semicolon Insertion

JavaScript has a mechanism that tries to correct faulty programs by automatically inserting semicolons. Do not depend on this. It can mask more serious errors.

It sometimes inserts semicolons in places where they are not welcome. Consider the consequences of semicolon insertion on thereturn statement. If a return statement returns a value, that value expression must begin on the same line as the return:



status: true


This appears to return an object containing a status member. Unfortunately, semicolon insertion turns it into a statement that returns undefined. There is no warning that semicolon insertion caused the misinterpretation of the program. The problem can be avoided if the { is placed at the end of the previous line and not at the beginning of the next line:

return {

status: true


Tuesday, 30 October 2012

TSQL Performance Tuning


Below is an example of the TSQL you can use to investigate your stored procedure's performance. Best to put this in a snippet if you're using VS 2012 or greater versions of SQL Management Studio I find.







PRINT '-- START: ProcName --------------------------------------------------------------------------------------------------------------------------------'




EXEC dbo.MyProcNameHere




PRINT '-- END: ProcName --------------------------------------------------------------------------------------------------------------------------------'



Monday, 29 October 2012

Windows 8 - Keyboard Shortcuts

Those of you that know me, will know I'm pretty much obsessed with keyboard shortcuts. So imagine my delight when I came across this new list today whilst reading this review of Windows 8:

Windows logo key + start typing: Search your PC

Ctrl+plus (+) or Ctrl+minus (-): Zoom in or out of many items, like apps pinned to the Start screen or in the Store

Ctrl+scroll wheel: Zoom in or out of many items, like apps pinned to the Start screen or in the Store

Windows logo key + C: Open the charms

Windows logo key + F: Open the Search charm

Windows logo key +H: Open the Share charm

Windows logo key +I: Open the Settings charm

Windows logo key + K: Open the Devices charm

Windows logo key + O: Lock the screen orientation (portrait or landscape)

Windows logo key + Z: Open commands for the app

Windows logo key + PgUp: Move the Start screen and apps to the monitor on the right (apps in the desktop won’t change monitors)

Windows logo key + PgDn: Move the Start screen and apps to the monitor on the left (apps in the desktop won’t change monitors)

Windows logo key + Shift+period (.): Snap an app to the left

Windows logo key + period (.): Snap an app to the right

Monday, 22 October 2012

YSlow CSS inspector

Just installed the YSlow browser extension for Chrome (although versions are available for other browsers too!).

Not bad for finding where things on your site can be improved…



Design patterns

Other than the usual gang of four articles,, today I chanced across this page whilst reading the mvc best practices wiki, which had some more sample code for design-patterns....

Friday, 28 September 2012

How to create the DataContracts and Translators for Entity Framework generated objects

Think I've just come up with a fool proof method for creating datacontracts and associated translator logic from Entity Framework generated objects

Creating datacontracts

1. Grab the class definition from the xxxModel.cs file in xxxx.DataContracts.csproj project

2. Paste into a new file in the xxx.DataContracts namespace

3. Use Resharper to clean up the code (Ctrl +E , Ctrl + C), choose full format option

4. Suspend off Resharper (Tools, options ,Resharper)

5. Grab the primitives section and change privates to publics

6. Replace ; with { get; set; } and then replace _ with empty string

7. That's it, you now have your matching datacontract with no typos and property names matching the auto generated ones in the xxxModel.cs file.

Creating translators (little bit more involved) method

1. Use the following regex replace expression on the pasted properties from the class you created above.

Remember to paste them from the datatype definition onwards, and put them at the start of the line in the mapping class first! e.g.

String Author { get; set; }
String DMlibraryName { get; set; }
DateTime? DateCreated { get; set; }
String DocNAME { get; set; }
int? DocNumber { get; set; }
String DocPath { get; set; }
String DocTypeCode { get; set; }
String DocTypeDescription { get; set; }
Int32 IsDMType { get; set; }
Int32 IsRRAKMANType { get; set; }
int? PersonID { get; set; }
int? ProjectID { get; set; }
String ProjectLabel { get; set; }
String htmlLocation { get; set; }

Find: ^([a-zA-Z_$][a-zA-Z0-9_$?]*):b{(.*)}\{(.*)
Replace with: source.\1 = dest.\1;

Result is as follows...

source.Author  = document.Author;
source.DMlibraryName  = document.DMlibraryName;
source.DateCreated  = document.DateCreated;
source.DocNAME  = document.DocNAME;
source.DocNumber  = document.DocNumber;
source.DocPath  = document.DocPath;
source.DocTypeCode  = document.DocTypeCode;
source.DocTypeDescription  = document.DocTypeDescription;
source.IsDMType  = document.IsDMType;
source.IsRRAKMANType  = document.IsRRAKMANType;
source.PersonID  = document.PersonID;
source.ProjectID  = document.ProjectID;
source.ProjectLabel  = document.ProjectLabel;
source.htmlLocation  = document.htmlLocation;

(Old Creating translators (little bit more involved) method)

1. Turn resharper back on

2. Use the File Structure window


3. Stick this in Excel and do some manipulation (ask me if you're not sure how to do this)


4. Paste this back into your C# file, and do a regex replace of \t with nothing

5. That's it, translator code written

How to determine if a process is running in a DOS batch file


Trick is to use tasklist.exe and pipe the output through a find then check the errorlevel as follows...

tasklist /FI "IMAGENAME eq WebDev.WebServer40.exe" 2>NUL | find /I /N "WebDev.WebServer40.exe">NUL
echo. Starting web app dev server
call sw.bat


Wednesday, 26 September 2012

JavaScript dates are zero based for month part

It appears that JS treats dates as zero indexed on the month part when you construct them in the format new Date("yyyy", "MM", "dd")


Friday, 14 September 2012

DataContract attribute gotcha

A little known fact that has caught out a few of our project team members this week, including myself. If you annotate a class with the DataContract attribute, then you must also ensure that the members you want to have serialized are also annotated with the DataMember / EnumMember attribute as well. The ones that aren't annotated will NOT get de-serialized when the data arrives at the consumer of your service method.

Note: If you apply no DataContract annotation at all to the class, then this has the same affect of attributing every member in your class with the DataMember / EnumMember attribute.

To be fair, this is somewhat eluded to in the following Microsoft article, although the part about it being implicit if you don't apply the attribute is not entirely obvious at first...


Silverlight 5 also supports a simplified opt-out model for serialization, where these attributes can be omitted from the type and the members of the type to be serialized. The data contract is implicit in the sense that the visibility modifiers (public, private) used by the type determines whether it and its members are included in the data contract. In this model, the name of a member is used to identify it in the serialized representation. A new IgnoreDataMemberAttribute attribute can be used to opt-out a member that is public when required.

How to put a 3 second wait in a batch file

By pinging local host, and piping the output to nowhere you can achieve this as follows...

ping -n 3 localhost >nul

Killing Visual Studio quickly

Stick this in a batch file in your %systemroot%, then you can run it from anywhere

tskill devenv
REM 3 second wait for the macro question to come up
ping -n 3 localhost >nul
tskill vsaenv10
tskill vsmsvr10

Thursday, 13 September 2012

Visual Studio 2010 breakpoint ordering

In case any of you use the breakpoint window for setting bookmarks in code as well, then this will be very useful to you in VS2010, if you were used to VS2008, just putting the latest break point at the end of the list like I was...


Wednesday, 15 August 2012

How to send large files around the web

There are many ways to do this, using for example, but the best that I have come across to date is definitely

This requires no registration / login process, and you can send up to 2gb at a time, with no limit on the amount of times you can do this.

Thursday, 9 August 2012

How to get MSN messenger to work again

Follow these steps again to get windows live messenger working again when one of your contacts has switched to the new or domain.

Start, Run..., tsKill msnmsgr

Then log on via on the web and sign into web messenger, then delete all references to your friend from your Hotmail messenger contacts, then enter this in your hosts file

Start, run… , notepad %systemroot%\system32\drivers\etc\hosts

Enter this…

Then delete this folder here

C:\Users\MyUserName\AppData\Local\Microsoft\Windows Live\Contacts

Then restart msnmgr.exe - C:\Program Files (x86)\Windows Live\Messenger\msnmsgr.exe

Now add back your friend that you removed from your contacts using their new sign in address

10 classic mistakes that plague software development projects


Excellent article just pointed out to me by one of my colleagues at work today...

I have copied the article here below, just in case it ever gets removed from that site...

By Justin James

April 20, 2012, 4:01 PM PDT

Takeaway: When you combine project management pitfalls with software development challenges, you have a recipe for some big (but often preventable) problems.

Project management is never an exact science, but when you combine it with the vagaries of software development, you have a recipe for disaster. I have seen a fair number of common mistakes that project managers make when working with software development projects. Some of these mistakes are not exclusive to software development, but they are especially prevalent and damaging in that context.

1: The “pregnant woman” mistake

Fred Brooks illustrated a common project management mistake with his famous statement that just because one woman can have a baby in nine months does not mean that nine women can have a baby in one month. And we still see this come up time and time again — the idea that throwing more people at a problem can make it be fixed quicker. Sadly, this is just not true.

Every person you add to a project adds friction to the project as well –  things like the time needed to bring them up to speed or coordinate their work with other people. In fact, my experience has been that there is a tipping point where adding people actually slows the work down more than it speeds things up, especially for the first few months. And there are many tasks that just can’t be split up to be done by many people or teams at once. They simply have to be done “one foot in front of the other.”

2: The wrong metrics

Managers need metrics for variety of reasons: measuring “success” or status, performance reviews and analysis, and so on. The mistake I see too often is that the easier it is to collect a metric, the more likely that it’s not measuring anything useful. Of course, the easiest metrics to collect or understand are also the most likely to be used. Let’s take “bug tickets” as an example.

It is easy to count how many tickets get entered. But that is not a good measure of quality, because how many of those tickets are user error or truly “features”? So managers often look to the next level of metric: ticket resolution rate (tickets closed per day or week or iteration or whatever). If you have ever dealt with a help desk that constantly closes tickets for things that aren’t actually fixed, causing a proliferation of tickets, you know what it’s like dealing with an organization driven by this metric!

Instead of actually getting work done or helping the user (for example, leaving tickets open until the user accepts the resolution), the organization exists solely to open as many tickets as possible and then close them as quickly as possible, so it can get its resolution rate up. A better number would be the hardest to measure: ratio of true “bug tickets” created in relationship to features deployed, changes made, or something similar. Needless to say, that is not an easy number to understand or to collect and report on. The result is that organizations choose to make decisions based on the wrong metrics rather than the right ones, due to convenience.

3: Estimating times too far out

A common problem I see with certain project management methodologies is that they like to play “just so stories” with timelines and time estimates. Project manager who honestly think they know what pieces of functionality any given developer will be working on more than a month or two out (unless it is a very large, broad piece of functionality) are likely to be disappointed and mistaken. Software development is just too unpredictable. Even if you can prevent or account for all the usual things that alter timelines and priorities, there is still little guarantee that things will take the time you think they will.

4: Estimating times too broadly

Another typical issue with time estimates involves not breaking tasks down into small enough pieces. If I’m told that a piece of work will take one week, I’ll ask where exactly that number is coming from. Unless someone has analysed all the minor pieces of work in the whole, a “one-week” time estimate is nothing but pure conjecture and should be disregarded.

5: Failing to account for tasks

How many times have you seen a deadline blown because it was established without accounting for a critical task like testing? That is another reason why you cannot and should not ever accept a task on a timeline that is not broken down into its component tasks. There is a chance that the estimate omits something important.

6: Poor communications

It is important to keep everyone in the loop on project status, but it is easy to forget to do it. This is where a lot of the mistrust between IT and the business team comes from: The business does not feel like it has a good handle on what’s happening with its projects. And the more it feels left in the dark, the more likely it is to start trying to micromanage or force things to happen the way it feels it should be done. You can mitigate this problem by letting people know where things stand, both on a regular basis and when milestones are accomplished or the status changes.

7: Disconnected business priorities

There is often a wide gap between the priorities of projects within the development organization, the priority of the project in the view of the overall business, and the priority of the project in the eyes of the requester. A common issue is that a “high priority” project for one department is not viewed as important by the business because it does not generate revenues, and so the developers also downgrade it. Everyone needs to be on the same page with priorities, and a large part of that is to ensure that business units are not evaluated on the basis of projects that the overall business considers lower priority.

8: Constructing a wall of process

When the development team feels overwhelmed, one of the natural reactions is to establish a lot of process to slow things down. I have worked at places where even the most simple of changes required a change request form to be filled out (on paper, of course), in triplicate, physically disseminated, agreed upon, cross-signed by managers, and after all of that, there was still a 45-day minimum time until the work was to be done! Needless to say, this organization was not seen as a “partner” or an “important lever for getting work done” in the business, they were seen as a cost center and treated as such. The wall of process is typically a stopgap measure to deal with deeper issues in the process or company’s culture, and while it is easier to put up the wall than to deal with those issues (and in some companies, the issues are irreconcilable), the wall of process is counterproductive and leads to a hostile environment.

9: The “hit-the-ground-running” myth

When adding people to a project, it is tempting to assume that they can hit the ground running. No one hits the ground running in the world of software development, and those who say they do are mistaken. Every project has an acclimation period, and the farther along the project is, the longer that acclimation period is — there is more and more code to understand and get a handle on. Failing to take this into account will get you into hot water. It may take only a few days or weeks for a developer to come into the project at the beginning, but it could take months for a developer to be fully productive when added to the project long after it has started

10: Multi-tasking

This is another “skill” (like “hitting the ground running”) that people think they have, but they really do not. The more you ask people to multi-task, the worse their work will be and the longer it will take. This applies to multi-tasking at the minute-to-minute level (juggling emails, phone calls, actual work, etc.) as well as the hour-to-hour or day-to-day level (handling multiple projects). The more you demand from people, the more the wheels fall off. To make it even worse, multi-tasking not only is likely to mangle the work, but it grinds people up and sends them looking for another job eventually… forcing you to bring in new people in the middle of a project and causing even more issues.

Wednesday, 25 July 2012

Team foundation server power tools

Had completely forgotten about these handy little tools that helps you figure out what your team members are up to in source control…

This one,,  for example allows you to see your team members in team explorer, and run queries against them. Didn't even realise there was a status search built into source control until I found this option this morning.



Tuesday, 24 July 2012

Fix for Icons in WPF being blurry


Just found this article on stack overflow about why our WPF icons appear blurry.

Turns out you can fix this by adding the following attached properties to your images

<Image Source="/LoginPanel;component/Icons/icoLogin.ico"

Monday, 23 July 2012

Software installing in one easy step

Use this handy utility next time you have to install a machine with base software. Aggregates all installers into one handy little setup...


Wednesday, 18 July 2012

Client side tools for Phone development

These are the client side tools that have just been mentioned for developing responsive web applications for mobile platform today on 


Frameworks to learn for SPAs

If you're thinking of building single page applications in future, then you will need to learn the following frameworks for sure..


Thursday, 12 July 2012

Handy SQL for extracting creating your test data insert scripts




PRINT 'Checking for the existence of this procedure'

IF (SELECT OBJECT_ID('sp_generate_inserts','P')) IS NOT NULL --means, the procedure already exists


PRINT 'Procedure already exists. So, dropping it'

DROP PROC sp_generate_inserts



CREATE PROC sp_generate_inserts


      @table_name varchar(776), -- The table/view for which the INSERT statements will be generated using the existing data

      @target_table varchar(776) = NULL, -- Use this parameter to specify a different table name into which the data will be inserted

      @include_column_list bit = 1, -- Use this parameter to include/ommit column list in the generated INSERT statement

      @from varchar(800) = NULL, -- Use this parameter to filter the rows based on a filter condition (using WHERE)

      @include_timestamp bit = 0, -- Specify 1 for this parameter, if you want to include the TIMESTAMP/ROWVERSION column's data in the INSERT statement

      @debug_mode bit = 0, -- If @debug_mode is set to 1, the SQL statements constructed by this procedure will be printed for later examination

      @owner varchar(64) = NULL, -- Use this parameter if you are not the owner of the table

      @ommit_images bit = 0, -- Use this parameter to generate INSERT statements by omitting the 'image' columns

      @ommit_identity bit = 0, -- Use this parameter to ommit the identity columns

      @top int = NULL, -- Use this parameter to generate INSERT statements only for the TOP n rows

      @cols_to_include varchar(8000) = NULL, -- List of columns to be included in the INSERT statement

      @cols_to_exclude varchar(8000) = NULL, -- List of columns to be excluded from the INSERT statement

      @disable_constraints bit = 0, -- When 1, disables foreign key constraints and enables them after the INSERT statements

      @ommit_computed_cols bit = 0        -- When 1, computed columns will not be included in the INSERT statement





Procedure:  sp_generate_inserts  (Build 22)

            (Copyright © 2002 Narayana Vyas Kondreddi. All rights reserved.)

Purpose:    To generate INSERT statements from existing data.

            These INSERTS can be executed to regenerate the data at some other location.

            This procedure is also useful to create a database setup, where in you can

            script your data along with your table definitions.

Written by: Narayana Vyas Kondreddi


            Divya Kalra -- For beta testing

            Mark Charsley     -- For reporting a problem with scripting uniqueidentifier columns with NULL values

            Artur Zeygman     -- For helping me simplify a bit of code for handling non-dbo owned tables

            Joris Laperre   -- For reporting a regression bug in handling text/ntext columns

Tested on: SQL Server 7.0 and SQL Server 2000 and SQL Server 2005

Date created:     January 17th 2001 21:52 GMT

Date modified:    May 1st 2002 19:50 GMT


NOTE:       This procedure may not work with tables with too many columns.

            Results can be unpredictable with huge text columns or SQL Server 2000's sql_variant data types

            Whenever possible, Use @include_column_list parameter to ommit column list in the INSERT statement, for better results

            IMPORTANT: This procedure is not tested with internation data (Extended characters or Unicode). If needed

            you might want to convert the datatypes of character variables in this procedure to their respective unicode counterparts

            like nchar and nvarchar


Example 1:  To generate INSERT statements for table 'titles':

            EXEC sp_generate_inserts 'titles'

Example 2: To ommit the column list in the INSERT statement: (Column list is included by default)

            IMPORTANT: If you have too many columns, you are advised to ommit column list, as shown below,

            to avoid erroneous results

            EXEC sp_generate_inserts 'titles', @include_column_list = 0

Example 3:  To generate INSERT statements for 'titlesCopy' table from 'titles' table:

            EXEC sp_generate_inserts 'titles', 'titlesCopy'

Example 4:  To generate INSERT statements for 'titles' table for only those titles

            which contain the word 'Computer' in them:

            NOTE: Do not complicate the FROM or WHERE clause here. It's assumed that you are good with T-SQL if you are using this parameter

            EXEC sp_generate_inserts 'titles', @from = "from titles where title like '%Computer%'"

Example 5: To specify that you want to include TIMESTAMP column's data as well in the INSERT statement:

            (By default TIMESTAMP column's data is not scripted)

            EXEC sp_generate_inserts 'titles', @include_timestamp = 1

Example 6:  To print the debug information:

            EXEC sp_generate_inserts 'titles', @debug_mode = 1

Example 7: If you are not the owner of the table, use @owner parameter to specify the owner name

            To use this option, you must have SELECT permissions on that table

            EXEC sp_generate_inserts Nickstable, @owner = 'Nick'

Example 8: To generate INSERT statements for the rest of the columns excluding images

            When using this otion, DO NOT set @include_column_list parameter to 0.

            EXEC sp_generate_inserts imgtable, @ommit_images = 1

Example 9: To generate INSERT statements excluding (ommiting) IDENTITY columns:

            (By default IDENTITY columns are included in the INSERT statement)

            EXEC sp_generate_inserts mytable, @ommit_identity = 1

Example 10:       To generate INSERT statements for the TOP 10 rows in the table:

            EXEC sp_generate_inserts mytable, @top = 10

Example 11:       To generate INSERT statements with only those columns you want:

            EXEC sp_generate_inserts titles, @cols_to_include = "'title','title_id','au_id'"

Example 12:       To generate INSERT statements by omitting certain columns:

            EXEC sp_generate_inserts titles, @cols_to_exclude = "'title','title_id','au_id'"

Example 13: To avoid checking the foreign key constraints while loading data with INSERT statements:

            EXEC sp_generate_inserts titles, @disable_constraints = 1

Example 14:       To exclude computed columns from the INSERT statement:

            EXEC sp_generate_inserts MyTable, @ommit_computed_cols = 1



--Making sure user only uses either @cols_to_include or @cols_to_exclude

IF ((@cols_to_include IS NOT NULL) AND (@cols_to_exclude IS NOT NULL))


RAISERROR('Use either @cols_to_include or @cols_to_exclude. Do not use both the parameters at once',16,1)

RETURN -1 --Failure. Reason: Both @cols_to_include and @cols_to_exclude parameters are specified


--Making sure the @cols_to_include and @cols_to_exclude parameters are receiving values in proper format

IF ((@cols_to_include IS NOT NULL) AND (PATINDEX('''%''',@cols_to_include) = 0))


RAISERROR('Invalid use of @cols_to_include property',16,1)

PRINT 'Specify column names surrounded by single quotes and separated by commas'

PRINT 'Eg: EXEC sp_generate_inserts titles, @cols_to_include = "''title_id'',''title''"'

RETURN -1 --Failure. Reason: Invalid use of @cols_to_include property


IF ((@cols_to_exclude IS NOT NULL) AND (PATINDEX('''%''',@cols_to_exclude) = 0))


RAISERROR('Invalid use of @cols_to_exclude property',16,1)

PRINT 'Specify column names surrounded by single quotes and separated by commas'

PRINT 'Eg: EXEC sp_generate_inserts titles, @cols_to_exclude = "''title_id'',''title''"'

RETURN -1 --Failure. Reason: Invalid use of @cols_to_exclude property


--Checking to see if the database name is specified along wih the table name

--Your database context should be local to the table for which you want to generate INSERT statements

--specifying the database name is not allowed

IF (PARSENAME(@table_name,3)) IS NOT NULL


RAISERROR('Do not specify the database name. Be in the required database and just specify the table name.',16,1)

RETURN -1 --Failure. Reason: Database name is specified along with the table name, which is not allowed


--Checking for the existence of 'user table' or 'view'

--This procedure is not written to work on system tables

--To script the data in system tables, just create a view on the system tables and script the view instead

IF @owner IS NULL


IF ((OBJECT_ID(@table_name,'U') IS NULL) AND (OBJECT_ID(@table_name,'V') IS NULL))


RAISERROR('User table or view not found.',16,1)

PRINT 'You may see this error, if you are not the owner of this table or view. In that case use @owner parameter to specify the owner name.'

PRINT 'Make sure you have SELECT permission on that table or view.'

RETURN -1 --Failure. Reason: There is no user table or view with this name







RAISERROR('User table or view not found.',16,1)

PRINT 'You may see this error, if you are not the owner of this table. In that case use @owner parameter to specify the owner name.'

PRINT 'Make sure you have SELECT permission on that table or view.'

RETURN -1 --Failure. Reason: There is no user table or view with this name       



--Variable declarations

DECLARE           @Column_ID int,

            @Column_List varchar(8000),

            @Column_Name varchar(128),

            @Start_Insert varchar(786),

            @Data_Type varchar(128),

            @Actual_Values varchar(8000), --This is the string that will be finally executed to generate INSERT statements

            @IDN varchar(128) --Will contain the IDENTITY column's name in the table

--Variable Initialization

SET @IDN = ''

SET @Column_ID = 0

SET @Column_Name = ''

SET @Column_List = ''

SET @Actual_Values = ''

IF @owner IS NULL


SET @Start_Insert = 'INSERT INTO ' + '[' + RTRIM(COALESCE(@target_table,@table_name)) + ']'




SET @Start_Insert = 'INSERT ' + '[' + LTRIM(RTRIM(@owner)) + '].' + '[' + RTRIM(COALESCE(@target_table,@table_name)) + ']'


--To get the first column's ID



WHERE       TABLE_NAME = @table_name AND

(@owner IS NULL OR TABLE_SCHEMA = @owner)

--Loop through all the columns of the table, to get the column names and their data types




            @Data_Type = DATA_TYPE



            TABLE_NAME = @table_name AND

(@owner IS NULL OR TABLE_SCHEMA = @owner)

IF @cols_to_include IS NOT NULL --Selecting only user specified columns


IF CHARINDEX( '''' + SUBSTRING(@Column_Name,2,LEN(@Column_Name)-2) + '''',@cols_to_include) = 0





IF @cols_to_exclude IS NOT NULL --Selecting only user specified columns


IF CHARINDEX( '''' + SUBSTRING(@Column_Name,2,LEN(@Column_Name)-2) + '''',@cols_to_exclude) <> 0





--Making sure to output SET IDENTITY_INSERT ON/OFF in case the table has an IDENTITY column

IF (SELECT COLUMNPROPERTY( OBJECT_ID(QUOTENAME(COALESCE(@owner,USER_NAME())) + '.' + @table_name),SUBSTRING(@Column_Name,2,LEN(@Column_Name) - 2),'IsIdentity')) = 1


IF @ommit_identity = 0 --Determing whether to include or exclude the IDENTITY column

SET @IDN = @Column_Name


GOTO SKIP_LOOP               


--Making sure whether to output computed columns or not

IF @ommit_computed_cols = 1


IF (SELECT COLUMNPROPERTY( OBJECT_ID(QUOTENAME(COALESCE(@owner,USER_NAME())) + '.' + @table_name),SUBSTRING(@Column_Name,2,LEN(@Column_Name) - 2),'IsComputed')) = 1


GOTO SKIP_LOOP                           



--Tables with columns of IMAGE data type are not supported for obvious reasons

IF(@Data_Type in ('image'))


IF (@ommit_images = 0)


RAISERROR('Tables with image columns are not supported.',16,1)

PRINT 'Use @ommit_images = 1 parameter to generate INSERTs for the rest of the columns.'

PRINT 'DO NOT ommit Column List in the INSERT statements. If you ommit column list using @include_column_list=0, the generated INSERTs will fail.'

RETURN -1 --Failure. Reason: There is a column with image data type







--Determining the data type of the column and depending on the data type, the VALUES part of

--the INSERT statement is generated. Care is taken to handle columns with NULL values. Also

--making sure, not to lose any data from flot, real, money, smallmomey, datetime columns

SET @Actual_Values = @Actual_Values  +


WHEN @Data_Type IN ('char','varchar','nchar','nvarchar')


'COALESCE('''''''' + REPLACE(RTRIM(' + @Column_Name + '),'''''''','''''''''''')+'''''''',''NULL'')'

WHEN @Data_Type IN ('datetime','smalldatetime')


'COALESCE('''''''' + RTRIM(CONVERT(char,' + @Column_Name + ',109))+'''''''',''NULL'')'

WHEN @Data_Type IN ('uniqueidentifier')


'COALESCE('''''''' + REPLACE(CONVERT(char(255),RTRIM(' + @Column_Name + ')),'''''''','''''''''''')+'''''''',''NULL'')'

WHEN @Data_Type IN ('text','ntext')


'COALESCE('''''''' + REPLACE(CONVERT(char(8000),' + @Column_Name + '),'''''''','''''''''''')+'''''''',''NULL'')'

WHEN @Data_Type IN ('binary','varbinary')


'COALESCE(RTRIM(CONVERT(char,' + 'CONVERT(int,' + @Column_Name + '))),''NULL'')'

WHEN @Data_Type IN ('timestamp','rowversion')



WHEN @include_timestamp = 0




'COALESCE(RTRIM(CONVERT(char,' + 'CONVERT(int,' + @Column_Name + '))),''NULL'')'


WHEN @Data_Type IN ('float','real','money','smallmoney')


'COALESCE(LTRIM(RTRIM(' + 'CONVERT(char, ' +  @Column_Name  + ',2)' + ')),''NULL'')'


'COALESCE(LTRIM(RTRIM(' + 'CONVERT(char, ' +  @Column_Name  + ')' + ')),''NULL'')'

END + '+' + ''',''' + ' + '

--Generating the column list for the INSERT statement

SET @Column_List = @Column_List +  @Column_Name + ','

SKIP_LOOP: --The label used in GOTO



WHERE       TABLE_NAME = @table_name AND

            ORDINAL_POSITION > @Column_ID AND

(@owner IS NULL OR TABLE_SCHEMA = @owner)

--Loop ends here!


--To get rid of the extra characters that got concatenated during the last run through the loop

SET @Column_List = LEFT(@Column_List,len(@Column_List) - 1)

SET @Actual_Values = LEFT(@Actual_Values,len(@Actual_Values) - 6)

IF LTRIM(@Column_List) = ''


RAISERROR('No columns to select. There should at least be one column to generate the output',16,1)

RETURN -1 --Failure. Reason: Looks like all the columns are ommitted using the @cols_to_exclude parameter


--Forming the final string that will be executed, to output the INSERT statements

IF (@include_column_list <> 0)


SET @Actual_Values =


CASE WHEN @top IS NULL OR @top < 0 THEN '' ELSE ' TOP ' + LTRIM(STR(@top)) + ' ' END +

'''' + RTRIM(@Start_Insert) +

' ''+' + '''(' + RTRIM(@Column_List) + '''+' + ''')''' +

' +''VALUES(''+ ' +  @Actual_Values  + '+'')''' + ' ' +

COALESCE(@from,' FROM ' + CASE WHEN @owner IS NULL THEN '' ELSE '[' + LTRIM(RTRIM(@owner)) + '].' END + '[' + rtrim(@table_name) + ']' + '(NOLOCK)')


ELSE IF (@include_column_list = 0)


SET @Actual_Values =


CASE WHEN @top IS NULL OR @top < 0 THEN '' ELSE ' TOP ' + LTRIM(STR(@top)) + ' ' END +

'''' + RTRIM(@Start_Insert) +

' '' +''VALUES(''+ ' +  @Actual_Values + '+'')''' + ' ' +

COALESCE(@from,' FROM ' + CASE WHEN @owner IS NULL THEN '' ELSE '[' + LTRIM(RTRIM(@owner)) + '].' END + '[' + rtrim(@table_name) + ']' + '(NOLOCK)')


--Determining whether to ouput any debug information

IF @debug_mode =1



PRINT 'Beginning of the INSERT statement:'

PRINT @Start_Insert


PRINT 'The column list:'

PRINT @Column_List


PRINT 'The SELECT statement executed to generate the INSERTs'

PRINT @Actual_Values





PRINT '--INSERTs generated by ''sp_generate_inserts'' stored procedure written by Vyas'

PRINT '--Build number: 22'

PRINT '--Problems/Suggestions? Contact Vyas @'

PRINT '--'




--Determining whether to print IDENTITY_INSERT or not

IF (@IDN <> '')






IF @disable_constraints = 1 AND (OBJECT_ID(QUOTENAME(COALESCE(@owner,USER_NAME())) + '.' + @table_name, 'U') IS NOT NULL)


IF @owner IS NULL


SELECT 'ALTER TABLE ' + QUOTENAME(COALESCE(@target_table, @table_name)) + ' NOCHECK CONSTRAINT ALL' AS '--Code to disable constraints temporarily'




SELECT 'ALTER TABLE ' + QUOTENAME(@owner) + '.' + QUOTENAME(COALESCE(@target_table, @table_name)) + ' NOCHECK CONSTRAINT ALL' AS '--Code to disable constraints temporarily'





PRINT 'PRINT ''Inserting values into ' + '[' + RTRIM(COALESCE(@target_table,@table_name)) + ']' + ''''

--All the hard work pays off here!!! You'll get your INSERT statements, when the next line executes!

EXEC (@Actual_Values)

PRINT 'PRINT ''Done'''


IF @disable_constraints = 1 AND (OBJECT_ID(QUOTENAME(COALESCE(@owner,USER_NAME())) + '.' + @table_name, 'U') IS NOT NULL)


IF @owner IS NULL


SELECT 'ALTER TABLE ' + QUOTENAME(COALESCE(@target_table, @table_name)) + ' CHECK CONSTRAINT ALL' AS '--Code to enable the previously disabled constraints'




SELECT 'ALTER TABLE ' + QUOTENAME(@owner) + '.' + QUOTENAME(COALESCE(@target_table, @table_name)) + ' CHECK CONSTRAINT ALL' AS '--Code to enable the previously disabled constraints'





IF (@IDN <> '')







RETURN 0 --Success. We are done!



PRINT 'Created the procedure'


--Mark procedure as system object

EXEC sys.sp_MS_marksystemobject sp_generate_inserts


PRINT 'Granting EXECUTE permission on sp_generate_inserts to all users'

GRANT EXEC ON sp_generate_inserts TO public



PRINT 'Done'

How to Fix a Humax HDR FOX T2 PVR that will not stay powered on

Issue When you attempt to power on your Humax the standby orange light goes blue for a moment, and then powers off automatically again. ...