Connect to VS-TFS remotely

This is another great help. Benefits include working more towards a common code library from home or work.

  • Connect to VPN
  • Visual Studio
    • > Connect to Team Foundation Server
    • Servers
    • Add
    • Use remote network internal i.p address
    • Use default settings
    • May be prompted for Login and password
    • Done > Success
  • Or in intenet explorer
    • http:// < internal ip address : <vs-tfs port number default = 8080> /tfs
Advertisements

Code Generation and T4 Text Templates

http://msdn.microsoft.com/en-us/library/bb126445.aspx

http://brochure.jrcs3.com/2011/03/t4-template-tour-of-first-gear.html

Include directive

Quite useful
<#@ include file=”TextTemplateVB6.t4″ #>
<#@ include File=”$(SolutionDir)\CodeDBGenerator\TextTemplateLibrary\TextTemplate\GeneratedHeader.t4″ #>

This uses actual file location, which may be different to how it appears in Solution explorer.

Note: the included file cannot have a <#@ template language=”VB” #> on it.
Probably want to rename it .t4 and remove the custom tool, so that it does not generate it’s own file.
After it has been included then Class Feature Blocks may be put in here for re-use by many templates. <#+

If you want it separately and also included elsewhere then a strategy I came up with was to have have the file without the <#@ template language=”VB” #> and then a separate file which was just:

<#@ template language=”VB” #>
<#@ include file=”TextTemplateVB6.t4″ #>
Be careful on .t4 file, you probably want to not have a custom tool. This can be done by creating a standard text file and changing it’s file extenstion to .t4 or create a text template file and then remove the Custom Tool from files properties. See:  Run Custom Tool

 

To use T4 within a program

To have a form that generates code say in a text box. Then:

  1. Set “Custom Tool” of text template to “TextTemplatingFilePreprocessor” and Custom Tool Namespace to say “My.Templates”
  2. Dim code = New My.Templates.PreTextTemplate1
    GeneratedCodeTextBox.Text = code.TransformText

 

To use If.

For instance with include file then:

<# If ParameterList(4) = 1 Then #>
<#@ include file=”SetRowBase.tt” #>
<# End If #>

 

More blog TODO

… looks potentially useful in some circumstances

Directives
http://msdn.microsoft.com/en-us/library/bb126421.aspx

To read
http://msdn.microsoft.com/en-us/library/gg251243.aspx

Run Custom Tool

Solution Folder > Point at file > Right click Properties
Custom Tool – Add or remove a custom tool name here.

Examples

  • TextTemplatingFileGenerator
  • TextTemplatingFilePreprocessor

Useful Transact SQL sp procedures

sp_defaultdb ‘login’, ‘master’
SQL Server 2005. If you detach the default database from the server, then you may experience unable to login errors, for instance on attach.
Use the above to change the default database and you will then be able to login.
For simple connection > Options > Connection Properties > Connect to database > Change from <default> to another still attached database or master

Windows Explorer remove add-in context menu

 

Export suspect registry key from. Then delete test. If not better then import saved.

HKEY_CLASSES_ROOT\Folder\shellex\ContextMenuHandlers

Subversion Windows Explorer Add-In Enable/Disable

 

http://www.howtogeek.com/howto/21106/how-to-enable-or-disable-tortoisesvn-menus-easily/

This works

Change IP address of a local (home) pc

This example is using Wanadoo Inventel Wireless Magic on Windows XP
The aim in this case is to change the IP address from using 192.168.1.x to using 192.168.0.x

Start > All Programs > Wanadoo > Configure the Live Box
Login > Configuration > Advanced > Network
Change LAN IP address, Broadcast LAN IP address, and 2 x DHCP addresses
Submit and wait for it to reset

My Network Places > View network connections > Right-click on Wireless Network Connection > Disable > Enable
This will force it to look for new IP address. Success

See Connection to SQL Server over VPN

Connection to SQL Server over VPN

 

Get VPN connection IP address from IT server administrator
Set up VPN and login
Connect to SQL on local PC using SSMS or Visual Studio using SQL Authentication login and password
The server name to use in SSMS will be an IP address on the Network that you have used VPN to get to. You may or may not need to add \InstanceName.
It is not uncommon for this internal IP address system to be 10.0.0.x where x is the computer number
So format may be 10.0.0.x or 10.0.0.x\InstanceName

Special Cases
If the VPN internal IP address system uses 192.168.1.x then be careful that your local PC is not using 192.168.1.x
If it is then need to change the local PC IP address system to use 192.168.0.x

See Change IP address of a local (home) pc