Monday, May 25, 2015

Inverting direction of mouse scroll wheel in Windows 7

There is a registry setting named FlipFlopWheel that does this! HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\HID\VID_???\VID_???\Device Parameters. There might be multiple mouse entries. The default value for FlipFlopWheel should already ready 0. Change into 1 to invert scrolling. Reboot or possibly replug in mouse for changes to take effect.
To get the VID_??? number you have two options:
  1. Go to the mouse control panel, click the Hardware tab, then click Properties.
    Now in the HID-compliant mouse Properties window click the Details tab and select the Device Instance Path property. The registry path is in there. You only have to unplug and plug back in my mouse for this to take effect.


Wednesday, May 14, 2014

TFS switch working copy to another branch

Problem

I assume that you already have a working copy of $/branch1.
Let's say it's checked out to local folder c:\inetpub.
And you want to remap this working copy to $/branch2 without re-downloading everything again.

Solution

  1. First you'll need to unmap existing branch.
  2. Map working copy folder to new branch.
  3. Apply remap recursively.

Run the following commands from command line:

tf workfold /unmap $/branch1
tf workfold /map $/branch2 c:\inetpub
tf get c:\inetpub /remap /version:T /recursive


You'll probably want to unshelve a shelveset from another TFS branch afterwards.


Wednesday, February 19, 2014

NEWSEQUENTIALID() (Transact-SQL)

Creates a GUID that is greater than any GUID previously generated by this function on a specified computer since Windows was started. After restarting Windows, the GUID can start again from a lower range, but is still globally unique. When a GUID column is used as a row identifier, using NEWSEQUENTIALID can be faster than using the NEWID function. This is because the NEWID function causes random activity and uses fewer cached data pages. Using NEWSEQUENTIALID also helps to completely fill the data and index pages.
Important noteImportant
If privacy is a concern, do not use this function. It is possible to guess the value of the next generated GUID and, therefore, access data associated with that GUID.

Tuesday, February 18, 2014

How to change default code editor for shelveset details in TFS

You need to change the following key in windows registry:
1. open REGEDIT
2. Find the key HKEY_LOCAL_MACHINE\SOFTWARE\Classes\SystemFileAssociations\text\shell\edit\command
3. Change the path to the editor (%ProgramFiles(x86)%\Notepad++\notepad++.exe  in my case)

How to unshelve changeset from one branch to another in TFS

You can do it using TFS Power Tools.

Here is the command:

tfpt unshelve "My Shelveset;DOMAIN\username" /migrate /source:$/project/branch /target:$/project/branch2

TFS Power Tools SCORCH

TFPT SCORCH - Ensure source control and the local disk are identical

Your local disk will be scanned for:
 (1) items that are not in source control
 (2) items which are different on disk from the workspace version
 (3) items which are in the workspace but are missing on disk

Items not in source control will be deleted from disk, just as with the
tfpt treeclean command. Items determined to be different on disk from the
workspace version will be redownloaded from the server. Items missing on
disk will also be redownloaded. Items with pending changes are exempted.

By default, items deleted from your local disk (#3 above) will not be
scanned for, and local items are determined to be identical/different from
the workspace version *solely by examining the read-only bit on the file*.

To redownload items deleted from your local disk (#3 above), supply the
/deletes option. To detect items which are different from the workspace
version but still have their read-only bit set (+R), supply the /diff option.
When using either or both of these options, tfpt scorch runs more slowly.

Usage: tfpt scorch [/exclude:filespec1,filespec2,...] [filespec...]
                   [/recursive] [/batchsize:num] [/noprompt [/preview]]
                   [/deletes] [/diff]

 /noprompt              Do not show the list of items to be deleted and
                        redownloaded in a dialog box for confirmation
 /exclude:filespec[,..] Files and directories matching a filespec in this list
                        are excluded from processing
 /preview               Do not make changes; only list the potential actions
 /recursive             Switch from one level of recursion to full recursion
 /deletes               Detect and replace items missing from the local disk
 /diff                  Use MD5 hashes to compare items with source control
 /batchsize:num         Set the batch size for server calls (default 500)
 filespec...            Only files and directories matching these filespecs
                        are processed (inclusion list)

Wednesday, January 29, 2014

ImageMagick

ImageMagick® is a software suite to create, edit, compose, or convert bitmap images. It can read and write images in a variety of formats (over 100) includingDPXEXR, GIF, JPEG, JPEG-2000, PDF, PNG, Postscript, SVG, and TIFF. Use ImageMagick to resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves.
The functionality of ImageMagick is typically utilized from the command line or you can use the features from programs written in your favorite language. Choose from these interfaces: G2F (Ada), MagickCore (C), MagickWand (C),ChMagick (Ch), ImageMagickObject (COM+), Magick++ (C++), JMagick(Java), L-Magick (Lisp), LuaNMagick (Neko/haXe), Magick.NET (.NET),PascalMagick (Pascal), PerlMagick (Perl), MagickWand for PHP (PHP),IMagick (PHP), PythonMagick (Python), RMagick (Ruby), or TclMagick(Tcl/TK). With a language interface, use ImageMagick to modify or create images dynamically and automagically.

ImageMagick is free software delivered as a ready-to-run binary distribution or as source code that you may use, copy, modify, and distribute in both open and proprietary applications. It is distributed under the Apache 2.0 license, approved by the OSI and recommended for use by the OSSCC.

Wednesday, January 22, 2014

Database Migrations in Entity Framework Code First

Enabling Migrations

Run the Enable-Migrations command in Package Manager Console

Generating & Running Migrations

Add-Migration migration_name

Update-Database –Verbose

Update-Database –TargetMigration: migration_name

If you want to roll all the way back to an empty database then you can use

Update-Database –TargetMigration: $InitialDatabase

Getting a SQL Script

Update-Database -Script -SourceMigration: $InitialDatabase -TargetMigration: migration_name



Automatically Upgrading on Application Startup (MigrateDatabaseToLatestVersion Initializer)

When we create an instance of this initializer we need to specify the context type (MyDbContext) and the migrations configuration (Configuration) - the migrations configuration is the class that got added to our Migrations folder when we enabled Migrations.

Database.SetInitializer(new MigrateDatabaseToLatestVersion<MyDbContext, Configuration>());



References:
http://msdn.microsoft.com/en-us/data/jj591621.aspx

Wednesday, January 15, 2014

Fixing Visual Studio connection to online galery

If you cannot connect to Visual Studio online gallery or online template and you get an error message like this:

Cannot search for online exensions because an error occured while trying to contact the server

Try adding the following to devenv.exe.config (in Common7\IDE folder):

<configuration>
<system.net>
<settings>
<servicePointManager expect100Continue="false" />
</settings>
</system.net>
</configuration>

http://stackoverflow.com/questions/2859148/cannot-connect-to…