Tim Huffam

Dotting the I and crossing the T of I.T.

  Home  |   Contact  |   Syndication    |   Login
  153 Posts | 0 Stories | 2747 Comments | 653 Trackbacks

News

Archives

Post Categories

Interesting Blogs/Links

Thursday, April 19, 2012 #

When creating a branch programmatically using the TFS 2010 API, if you do not do things in the correct sequence, TFS does not create the proper object types and/or relationships eg either the folders will not show as branches (showing the branch icon instead of the folder icon) in Source Control Explorer or they will show as branches, but when you do View Hierarchy, it will not show the relationships/structure.

After much trial an error I have found the solution...

(assuming the source folder already exists)

// The source of the branch must first be created as a branch object
VersionControl.CreateBranchObject(new BranchProperties(new ItemIdentifier(sourceServerPath)));

// Then you can create the branch
VersionControl.CreateBranch(sourceServerPath, targetServerPath, VersionSpec.Latest, null, checkinComment, null, null, null);

That's it!

HTH
Tim


Sunday, January 8, 2012 #

If your Silverlight app references services, the endpoints to these services are stored within a config file within the xap bundle - which is usually deployed as .xap file within the ClientBin dir of your web app.

To change the end point urls:
1) Rename the xap file (eg within E:\Demos\MySilverlightApp.Web\ClientBin) to .zip. 
2) Unzip it
3) Edit the ServiceReferences.ClientConfig file (to update the endpoint url) and save it.
4) Recreate the zip file
5) Rename the .zip file as .xap

That's it.


Wednesday, July 6, 2011 #

To remove all source control from a TFS project (not a VS project!) - you must use the 'tf destroy' tool. 

If, like me you try to delete the top-level directory/project node in Source Control Explorer (within VS), then you'll likely get the following error:

TF10169: Unsupported pending change attempted on team project folder $/MyProject.  Use the Project Creation Wizard in Team Explorer to create a project or the Team Project deletion tool to delete one.

So, this (removing source control) is useful if you have a TFS project created just for project management assets eg Work Items, Sprints, PBI's etc.

Use the following syntax:

  tf destroy $/<project name> /s:<server name>

  eg: 
  tf destroy $/MyProject /s:mytfsserver.mydomain.com

The tf.exe tool is within the <Program Files>\Microsoft Visual Studio 9.0\VC dir.

Note that this will remove the project from the Source Control Explorer - but the TFS project still exists - you can see it in Team Explorer and/or TFS Web Access.


Wednesday, March 9, 2011 #

Just pondering the workings of the human mind - from an AI/robotics point of view (either of which I know little about)..
 
If conscience is when you're thinking about it (processing it in realtime)... and subconscience is when you're not thinking about it (eg it's autonomous behaviour)..  would it be fair to say then, that:
  - conscience could be likened to (or implemented as) software (as it requires a processor at runtime)
  - subconscience could be likened to (or implemented as) hardware (as it does not require a processor at runtime)
 
Considering that human learning is attributed to the number of neural connections made - and repetition is the key - the more the connections, the better one understands the subject - until it becomes a 'known'.
 
Therefore could this be likened to forming hard (wired) connections?  Eg maybe learning would progress from an MCU to FPGA's - therefore offloading realtime process to the hardware (FPGA or some such device)?

t


Thursday, February 3, 2011 #

This error occured on our TFS2008 (RTM) build server after installing VS2010.

This is caused because VS2010 updates the MSBuild targets file Microsoft.TeamFoundation.Build.targets but not the Microsoft.TeamFoundation.Build.Tasks.dll file (which preforms the tasks mentioned in the targets file).

To resolve you need to update TFS (build) server with SP1.  See this article.

HTH
Tim


Wednesday, December 8, 2010 #

This error occurred on our TFS2008 build server which we had upgraded to cater for VS2010 projects (by installing VS2010 on the build server - see this article).

Error MSB4019: The imported project "C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

However - although we had installed VS2010 on the build server - we had not installed the web development components (Visual Web Developer) - this is what caused the error.

To fix - simply add the web development components:

  1. Go into Control Panel - Add or Remove Programs
  2. Select Microsoft Visual Studio 2010, and click on Change/Remove
  3. In the VS Maintenance Mode screens, select Add or Remove Features
  4. In the Setup - Options page make sure 'Visual Web Developer' is checked.
  5. Click on Update.

 

You shouldn't need to restart your build service.

HTH
Tim
 


Wednesday, December 1, 2010 #

This is for TFS2008.

This is based mainly on this article: http://blogs.msdn.com/b/jpricket/archive/2007/08/03/tfs-2008-running-two-build-agents-on-the-same-machine.aspx
But also had input from these:
http://www.woodwardweb.com/vsts/000398.html
http://blogs.msdn.com/b/buckh/archive/2007/08/14/tfs-2008-a-basic-guide-to-team-build-2008.aspx
http://blogs.msdn.com/b/jimlamb/archive/2010/04/13/configuring-multiple-tfs-build-services-on-one-machine.aspx

Also the following article discussing upgrading a TFS2008 build server to cater for VS2010 projects: http://www.richard-banks.org/2009/11/how-to-build-vs2010-solutions-using.html

Scenario: 
---------
We want to use the existing build service the way it is - for VS2008 projects.
We will create a new build service, on the same machine but using another port -  for building VS2010/.Net 4.0 projects.
**For this we must have first installed VS2010 on the build server! (see article mentioned above).

The reason we're creating another service is that we found certain VS2008 projects would not build using MSBuild 4.0 (intended for VS2010 - but supposedly catering also for VS2008).  The main problem area was unit tests and the private accessor's VS generates (to provide access to private/internal members of a class being tested).  The following link provides a work around, but we found this just opened up more problems - and in the end decided that the multi-service solution would get us up and running quickest: http://blogs.msdn.com/b/adamroot/archive/2009/12/10/building-vs-2008-unit-test-projects-in-msbuild-4-0-beta-2.aspx


To create the 2nd build service (VS2010/.Net 4.0 projects):
-----------------------------------------------------------
1) Copy build service executable and config file (tfsbuildservice.exe & tfsbuildservice.exe.config) giving them another name
   (eg tfsbuildservice_2.exe & tfsbuildservice_2.exe.config).
   They are located within the following directory:
   <Program Files>\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies

2) Modify port setting.
   Edit the new config file (tfsbuildservice_2.exe.config) and update the following line with a new port number (eg 9193):
   <add key="port" value="9191" />

3) Make the new service use .Net 4.0 - by changing the MSBuildPath - so it references MSBuild 4 (for VS2010/.Net 4.0 projects).
   Change the following line in tfsbuildservice_2.exe.config from:
    <add key="MSBuildPath" value="" />
   to
    <add key="MSBuildPath" value="C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319" />

4) Configure URL ACLs.  Do this by running the wcfhttpconfig.exe utility in the new directory using the following syntax:
  wcfhttpconfig reserve <domain>\<user name> <port number>
  *** You must run this command as a local administrator.

5) Create the new windows service.
   Execute the following command at the command prompt - as an administrator.  Note the spaces after the equals signs.
   sc.exe create "VSTFBUILD_2" binpath= "D:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\TFSBuildService_2.exe" DisplayName= "Visual Studio Team Foundation Build Service 2 (for VS2010 and .Net 4.0 projects)" 
  *** You must run this command as a local administrator.

6) Open the new service's properties and set the account and password to run as, then start it. 
   It would also pay to set this service's startup type to automatic.

You will need to create new Build Agents to point to this new service.

HTH
Tim


Thursday, November 4, 2010 #

Turns out you can't just move a TFS warehouse/cube from SQL Server 2005 to 2008...  

Once performed we got the following error on the TFS app server tier  - when we tried to update/process the cube (both manually and via the TFS scheduler service):
Detailed Message: Failed to load adapter Microsoft.TeamFoundation.Warehouse.CommonStructureAdapter. Exception Info: \n Microsoft.TeamFoundation.Server.AnalysisServiceConnectionException: Error encountered when creating connection to Analysis Services. Contact your Team Foundation Server administrator. ---> Microsoft.AnalysisServices.ConnectionException: Cannot connect to Analysis Services version '10.0.1600.22'.

The point worth noting here is the version number (10.0.1600.22) - this is the version of the updated Analysis Services server (on the SQL Server 2008 platform).  The problem was that our TFS app server did not have the client access software of the correct version.

Assuming you've moved your cube already (using this article) - The following steps should fix the problem (all done on the TFS app server tier):

  1. Install the correct version of the Microsoft.AnalysisServices.dll assembly.   Download and install "Microsoft Analysis  Management Objects" from here.
  2. Update the following config files so that this line
    <bindingRedirect oldVersion="9.0.242.0" newVersion="9.0.242.0"/>
    looks like this:
    <bindingRedirect oldVersion="9.0.242.0" newVersion="10.0.0.0"/>
    Files to update:
    <programfiles>\Microsoft Visual Studio 2008 Team Foundation Server\Web Services\Warehouse\web.config
    <programfiles>\Microsoft Visual Studio 2008 Team Foundation Server\TFSServerSchedluer\TFSServerScheduler.exe.config
  3. Process the cube (this updates both the TFSWarehouse relational db and then the cube:
    - Log on to the TFS app server, then navigate your browser to http://localhost:8080/Warehouse/v1.0/warehousecontroller.asmx, then click Run, then Invoke.
    - go back to the main warehousecontroller.asmx page and run GetWarehouseStatus - to monitor it's progress.
    - when it's complete (status of idle) check the event log for errors - should be none.
  4. Run a report (via  http://tfsappserver/reports url) to see if it contains updated data.
  5. Restart the TFS Scheduler service.

Note that if you're having problems - ie you're not seeing updated data in the reports, yet you're not seeing errors in the event log, then turn on verbose error logging (I think that's what this is/does) but updating the web.config file in this dir: <programfiles>\Microsoft Visual Studio 2008 Team Foundation Server\Web Services - changing this line<add name="General" value="1" />  to value="4"

Here's some useful links I found while trying to do all this work:

 I have to say, TFS really is a b*tch to manage. 

HTH
Tim


Sunday, August 22, 2010 #

After following steps in this link, I found that my projects would still not build correctly. 

The error I got in the build was:

"The path C:\Documents and Settings\myBuildServiceUser\Local Settings\Temp\myProject\Build1\Sources\WindowsFormsApplication1 is already mapped in workspace myBuildServerMachineName_16."

To fix this problem you need to delete all workspaces on the build server (owned by the user account that the build service runs as) - these are named buildservername_nn where buildservername is your build server name and nn is a number it assigns as it generates them (upon the first time a build is run).  It appear that these old workspaces are incompatible with the MSBuild 4.0 engine - hence we delete them so it can re-create them upon next build.

To get a list of all the workspaces on the build server use this command:

tf.exe workspaces /owner:myTFSBuildServiceUser /server:myTFSServer /computer:myBuildServerMachineName

tf.exe is run from the VS command prompt (TFS/VS2008 install dir: C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE).

or just run a build - to get the error message mentioned above - this will provide the problem workspace name (eg myBuildServerMachineName_16).

The following command will delete a workspace:

tf.exe workspace /delete /server:myTFSServer workspaceName;myBuildServerUser

See this article for how to delete workspaces.

Attrice's Team Foundation Sidekicks provides a nice GUI to both view and remove workspaces.

UPDATE 21 September 2010:
Updated/re-written to correct a number of things.  

If you get the following error:
"TF30076: The server name myTFSServer provided does not correspond to a server URI that can be found. Confirm that the server name is correct."
Then you will need to specify it's full URI eg:
tf.exe workspace /delete /server:http://myTFSServer:8080 myBuildServer_16;myBuildServerUser
See this article regarding this error.

HTH
Tim


Wednesday, July 28, 2010 #

When workig on a project in VS2010 and performing a "run tests in context" the debugger was catching and halting on a test that fails, raising the exception AssertFailedException.  I thought this was strange as the same test (in fact any test) that failed in VS2008 would simply just be noted in the test results as Failed...

Turns out it's the way I've been running tests..

Both VS2008 and VS2010 have the same shortcut mappings:
- "ctrl-r, t" for "Run tests in context"
- "ctrl-r, ctrl-t" for "Debug tests in context"

I've always done "ctrl-r, ctrl-t" - holding down ctrl then pressing r, releasing r then pressing t (while still holding down ctrl) then t then releasing ctrl.  This is actually "ctrl-r, ctrl-t".. so should have been invoking "debug tests in context" - but in VS2008 it was not detecting that I was holding down the ctrl when pressing t.

So, now that vs2010 is properly detecting the ctrl key, its running "debug tests in context" (as it should), hence I'm seeing the AssertFailedException being caught by the debugger instead of just failing the test.

So the solution is for me to use the proper shortcut to "Run tests in context" which is": "ctrl-r, t" - hold down ctrl, press r, release r and release ctrl, then press t (by itself).

HTH
Tim


Saturday, July 24, 2010 #

 

If you are programmatically assigning an image as a DiffuseMaterial to your 3D model, then you need to make sure that you have created TextureCoordinates. 
 
I was using some sample code that created a 3D object - and tried to change the brush from a color to an image.  The color worked fine, but the image never showed (it was invisible).  The reason was that the sample code only did mesh.Positions.Add() and mesh.TriangleIndicies.Add().  When I added the appropriate mesh.TextureCoordinates.Add() lines the image then showed.  eg:
 
 
MeshGeometry3D mesh = new MeshGeometry3D();
 
mesh.Positions.Add(new Point3D(1, 1, 1));
mesh.Positions.Add(new Point3D(1, 1, -1));
mesh.Positions.Add(new Point3D(-7, 1, -1));
mesh.Positions.Add(new Point3D(-7, 1, 1));
 
mesh.TriangleIndices.Add(0);
mesh.TriangleIndices.Add(1);
mesh.TriangleIndices.Add(2);
mesh.TriangleIndices.Add(0);
mesh.TriangleIndices.Add(2);
mesh.TriangleIndices.Add(3);
 
// These are the lines you need to allow an image to be painted onto the 3d model
mesh.TextureCoordinates.Add(new Point(0, 0));
mesh.TextureCoordinates.Add(new Point(0, 1));
mesh.TextureCoordinates.Add(new Point(1, 1));
mesh.TextureCoordinates.Add(new Point(1, 0));
 
ImageBrush imgBrush = new ImageBrush(new BitmapImage(new Uri("pack://siteoforigin:,,,/myimage.png")));
//GeometryModel3D geometry = new GeometryModel3D(mesh, new DiffuseMaterial(Brushes.Green));  // this line works without the TextureCoordinates
GeometryModel3D geometry = new GeometryModel3D(mesh, newDiffuseMaterial(imgBrush));
 
geometry.Transform = new Transform3DGroup();
Model3DGroup group = new Model3DGroup();
group.Children.Add(geometry);
 
 
HTH
Tim

Wednesday, April 7, 2010 #

This is quite simple...

Define the enum eg:

public enum MyEnum{
  ItemOne,
  ItemTwo,
}

Within the form set the datasource of the combobox to the values of the enum eg:

myCombo.DataSource = System.Enum.GetValues(typeof(MyEnum));

To have the combo auto select a value based on a bound object, set the databinding of the combo eg:

class MyObject{
  private MyEnum myEnumProperty;
  public MyEnum MyEnumProperty{get {return myEnumProperty;}}
}
MyObject myObj = new MyObject();
myCombo.DataBindings.Add(new Binding("SelectedIndex", myObject, "MyEnumProperty");

 


Wednesday, March 3, 2010 #

The Aris scripting language provides a couple of ways to select and read a file for input.  This is useful for auto populating Aris (generating models and objects).

To select a file on the clients machine:

Aris provides a dialog for selecting a file on the users machine.  This returns an array of file objects, each of which have a method which returns a byte array (which seems to be the standard way to handle file content in Aris). Eg:

    // Get file from client
    var selectedFiles = Dialogs.getFilePath(null, "XML Files|*.xml||", null, "Select file", 0);
    if(selectedFiles==null){
        Dialogs.MsgBox("No file selected.");
        return;
    }
    var fileByteArray = selectedFiles[0].getData();
 

To use a file on the Aris Server:

Alternatively you can just access a known file from the Common Files area.  To put the file there in the first place you need to add it within Aris (from the Scripting module open the server, right-click on "Common files" and select "Add files..." etc).  Then use the Dialogs.getFilePath() method, eg:

    // Get file from Common files
    var fileByteArray = Context.getFile("myInputFile.xml", Constants.LOCATION_COMMON_FILES);
 

HTH
Tim


Monday, January 4, 2010 #

If you do a 'typical' install of Artcut, it will try to install the 'chinese graph files' - and therefore, when you run it for the first time (after the installation) it will prompt you to insert the Graphic Disc.

To avoid this, run the install and choose Custom install (instead of the default of 'Typical') then click Next, then uncheck the component 'chinese graph files' and continue with the installation.

HTH

Tim


Tuesday, July 21, 2009 #

When trying to run a .Net winforms app with a progressbar on it, I found that if it was run from a non-standard class, the marquee style did not work.

The reason was because we were running the app from our own loader class, instead of the usual winforms program.cs.  This was because we were instatiating it from VB using COM interop - I thought this was the cause of the issue - but it turns out that this is not the case... 

The problem was that our own loader class did not enable the windows XP visual styles (apparently the Marquee style is only supported on platforms later than and including Windows XP - with visual styles enabled).

So the solution (to make the Marquee style work) is to include the following line of code before instantiating your form:

Application.EnableVisualStyles();

HTH
Tim


Tuesday, July 7, 2009 #

To update the UI with values returned from an asynchronous WCF/web service call you need to make sure the coding updating the UI is running on the UI thread.  Depending on how you've performed the async remote service call, often this is done on another thread - so when the handler executes upon completion of the call it is not on the UI thread and causes a threading exception.

Within winforms, the solution is to use the Invoke() method eg the following method would be on your form or user control and could be safely called from the async service call handler:

public void UpdateCustomerName()
{
 
if (this.InvokeRequired)
  {
   
this.Invoke(new EventHandler(delegate
     
{textBox1.Text = presenter.Customer.Name;}));
  }
 
else
 
{
    textBox1.Text = presenter.Customer.Name;
  }
}

If you're using something like the MVP pattern (in winforms) then you could make your presenter base class provide some generic handling for it with these 2 members:

protected delegate void UIDeligate();/// <summary>
/// Invokes the specified method in the UI thread. This is useful for executing view methods, that update the UI, from an asynchronous callback handler in the presenter.
/// Eg: <code>OnUIThread(new Presenter&lt;ITestView&gt;.UIDeligate(View.BindCustomers));</code>
/// </summary>
///
/// <example>
/// The folling code executes the view method BindCustomrs() in the UI thread.
/// OnUIThread(new Presenter&lt;ITestView&gt;.UIDeligate(View.BindCustomers));
/// </example>
/// <param name="method">Method to invoke.</param>
protected void OnUIThread(UIDeligate method)
{
 
if (disposed) return;
 
Control control = View as Control;
 
if ((control != null) && (control.Created))
    control.Invoke(method);
 
else
   
method.DynamicInvoke();
}

These allow your presenter to handle the thread synchronization for you (as it would be the one handling the the callback processing).  In this case your UI method, in your form or usercontrol, would look like this:

public void UpdateCustomerName()
{
    textBox1.Text = presenter.Customer.Name;
}

and the presenter implementation class would call it like this:

public void customerService_CustomerUpdate(object sender, EventArgs<Customer> e)
{
  customer = e.Data;

  // Previously we would have done: 
 
// View.UpdateCustomerName();
  // but now we do this:
  OnUIThread(new Presenter<ITestView>.UIDeligate(View.BindLivingExpenseRates));
}

So now the view does not need to care about any threading/async issues.

You could also use the <methodname>Async method and <methodname>Completed event in the generated WCF client proxy - as from what I've seen the <methodname>Completed event magically executes on the UI thread (have no idea how/why).  See this article for a good example.

HTH
Tim

 


Tuesday, June 16, 2009 #

This requires a testrunconfig file that has been configured correctly.  To do this I did the following:

  1. In VS2008, right click on Solution Items folder and select Add - New Item...
  2. Select Test Run Configuration and enter the name WithCodeCoverage.testrunconfig.
  3. Open/edit this file in VS.
  4. Select the 'Code Coverage' item on the left, then selected (checked) the assemblies I wanted to instrument
  5. Click Apply to save these changes.

Note that you can select which is the active test run configuration from under the Test menu in VS2008.

Now we need to update the TFS build...

  1. Open your TFS build file (eg TFSBuild.proj)
  2. In the section starting with
    <PropertyGroup>
    <!--
    TEST ARGUMENTS...
    Add the following line (after the comments and before the closing of PropertyGroup):
    <RunConfigFile Condition=" '$(IsDesktopBuild)' != 'true' ">$(SolutionRoot)\DEV\Release1\Source\WithCodeCoverage.testrunconfig</RunConfigFile>
    (update accordingly to suit your build server paths).

That's it.  Queue a build to test - you may need to verify your server build paths to get it working (I did).

HTH
Tim


The following will make your builds (running on a TFS Server) execute your unit tests after the build:

  1. Open your build file (eg TFSBuild.proj).  VS2008 has a nice xml editor for this.
  2. Search for the RunTest node and change it from:
    <RunTest>false</RunTest>
    to:
    <RunTest>true</RunTest>
  3. Look for a section that starts with:
    <ItemGroup>
    <!--
    TEST ARGUMENTS ...
    and add nodes within this (after the comments and before the closing of the ItemGroup node) - one entry for each unit test assembly you have eg:
    <TestContainer Include="$(OutDir)\My.App.UnitTests.dll" />

Thats it - check in this file and queue a build.

An error I got while getting this working indicated that the MSTest.exe could not be found - this was because TFS Client had not been installed on the build server - once these were installed it worked fine.

Something else you may want to do is ensure that a build is triggered every time someone checks in.  To do this, edit your build definition (right click on your build within Team Explorer and choose "Edit Build Definition...") - click on the 'Trigger' item in the list on the left and make sure the "Build each check-in (more builds)" item is checked.

HTH
Tim


Friday, May 22, 2009 #

When unit testing you sometimes need to test that values are being set to the correct literal/constant value - and this value is often stored in a resources file.

However, for some reason the VS2008 'Create Private Accessor' feature did not work for me for resources (maybe be cause they're all static properties and the generated _Accessor classes need to be instantiated).  So to make these resource available within the unit test project I simply made the Resources class public (by default it's internal).

To do this:

  1. Open the resource file (eg Resources.resx) using the Visual Studio resource editor tool (just double click on the .resx file).
  2. At the top of the editor tab there is a drop down box labelled "Access Modifier" - change this from Internal to Public and save the file.
  3. Rebuild the project.

Your resources will now be accessible in your unit tests.

HTH
Tim

 


Thursday, May 14, 2009 #

This error ("Failed to access IIS metabase") can occur when you try to access your WCF when you have added for hosting within IIS.

To solve this problem do this:

  1. Reregister ASP.NET for IIS:  Open an Visual Studio Command Prompt (or a regular command prompt and cd into the .Net dir - usually: C:\WINNT\Microsoft.NET\Framework\v2.0.50727) then type:
       aspnet_regiis -i
  2. When complete, from the same command prompt run: iisreset

Verify your IIS virtual/app dir is setup correctly (uses .Net 2).  If you don't already have one...

To Host a WCF Service within IIS:

  1. Develop your service in IIS (I'm not going to tell you how to do that!) and build it.
  2. Within your computer management/MMC console (compmgmt.msc), open the Internet Information Service node and right click on the site you want to use and select New - Virtual Directory...
  3. Enter the name you want.
  4. Point this to the directory you created your WCF service project in (the project root dir - not the bin dir).
  5. Complete the wizard then back in the MMC window right click on your new virtual dir and select Properties.
  6. On the ASP.NET tab make sure uses version 2.0.50727 (or whatever your v2 is).

To test:  within the MMC console - open your new virtual dir, right click on one of your services (eg MyService.svc) and select Browse.

HTH

Tim


Tuesday, March 10, 2009 #

This post will explain how to do fading (fade out a layer) in Gimp.

Assuming you have an image open...

  1. Add a new layer
  2. Draw the part you want faded
  3. Right click on the layer in the Layers panel/window and select 'Add Layer Mask', then click on Add on the Add Layer Mask dialog (making sure the default value of 'White (full opacity)' is selected).
  4. Select the Blend/Gradient tool and set the Gradient to 'FG to GB(RGB)' .
  5. On the layer click and drag a line where you want the gradient (fade) to start and finish.  The first click is where it will be faded out and the second click is where it will start to fade.
  6. Right click on the layer in the Layers panel/window and select 'Apply Layer Mask'.

That's it.


Wednesday, February 4, 2009 #

On a fresh php installation (on WinXP using IIS 5) the mysql extension did not load.  This turned out to be because php could not find the libmysql.dll library - to resolve just put the php dir (eg "c:\xampp\php) and the ext dir (c:\xampp\php\ext) into the PATH environment variable (and restart iis).

To verify your php configuration, create a php file with the following content:
<?php
phpinfo();
?>
Save this as something like info.php into your web root dir and navigate to it with a browser eg http://localhost/info.php.

FYI - this is how I installed my own WIMP stack:

  1. Instead of doing the usual individual custom installs of these components - this time I simply downloaded the xampp and unzipped it into a dir off c: drive (c:\xampp).  This contains apache (which I won't use), mysql, php and phpmyadmin.
  2. To setup php in IIS simply add an extension mapping (mapping .php to c:\xamp\php\php5isapi.dll) - in IIS admin right click on Default Web Site  (or your other specific web site if on a windows server) and select Properties - click on Home Directory tab then click on 'Configuration...' - then click on Add and enter the details.
  3. In IIS admin create a virual directory (eg pma) pointing to the phpmyadmin dir (C:\xampp\phpmyadmin)
  4. Create an envirnment variable PHPRC and set it to your php path eg C:\xampp\php
  5. Add the php (c:\xampp\php) and ext (c:\xampp\php\ext) paths to the PATH environment variable.
  6. Run the xampp setup script: setup_xampp.bat
  7. Restart IIS (iisreset).
  8. I've also edited httpd.conf (under c:\xampp\apache\conf) to change apache to use port 81 - so I can still run apache and IIS side by side (IIS uses port 80 by default for).

That should do it. 

To test start mysql (run the mysql_start.bat script in the xampp dir) and browse to: http://localhost/pma/index.php

HTH
Tim


Sunday, February 1, 2009 #

Windows Vista Home edition has some funny quirks - and this one is a prime example...

When trying to update my hosts file I get permission denied.  That's odd - so I check the permissions and sure enough Administrator group has write access - yet I am the only administror on the system.   How's that for tricky - so I'm an admin with no admin rights - go figure.  Then I tried deleting the file then readding it....  wow - delete worked but could not re-add.

It appears the only way around this little gem is to turn off user access control (not recommended - but there seems to be no other option as the security is fairly random and not what it used to be in earlier verisons of windows).

To do this go into Control Panel, select User Accounts then choose "Turn User Account Control On or Off" and turn it off (uncheck the checkbox then click OK) - you'll need to reboot for this to take effect.

Now you can change the files.

*** Just remember to undo the security by-pass - but turning back on the user access control (same as above - checking the checkbox). ***

**** Updated: As Joe suggests below - yes the correct way would be to start your editor by using right-click - 'Run as administrator'.  However this still does not explain the bug with Vista's security model that does not allow an admin user to update the hosts file without turning off UAC.

HTH

Tim


Thursday, January 22, 2009 #

TFS has a wonderful feature whereby it marks files as changed, even though there are no changes.  These files show up in the Pending Changes window in Visual Studio (VS 2008).

To work around this,  add the following external command to your VS tools:
  1. First you need to install TFS Power Tools
  2. In VS go into Tools - External Tools and click Add
  3. Enter the following details:
    Title: Unchange
    Command: C:\Program Files\Microsoft Team Foundation Server 2008 Power Tools\tfpt.exe
    Arguments: uu /recursive /noget
    Initial Directory: $(SolutionDir)
  4. And check 'Use Output Window'
  5. Click Ok
That's it.  To test, view the Pending Changes window - usually after a 'Get Latest' is when it lists unmodified files as changed - then click Tools  - Unchange.

Thanks to Duncan Smith for this gem of info.

The fact they created a tool for this makes you wonder!

HTH
Tim

Wednesday, November 5, 2008 #

The following code shows you how you can make Silverlight controls/objects moveable by dragging them with the mouse.
Page.cs:
<UserControl x:Class="MovingObjs.Page"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Width="400" Height="300">
    <Canvas x:Name="LayoutRoot" Background="White">
        <Border CornerRadius="10" x:Name="brdMovable" BorderBrush="Black" BorderThickness="2" Background="AntiqueWhite" Canvas.Top="100" Canvas.Left="10" MouseLeftButtonDown="brdMovable_MouseLeftButtonDown" MouseLeftButtonUp="brdMovable_MouseLeftButtonUp" MouseMove="brdMovable_MouseMove">
            <Grid x:Name="grid1" Width="300" Margin="5" >
                <TextBlock x:Name="txtBlkTest" Text="Test"></TextBlock>
            </Grid>
        </Border>
    </Canvas>
</UserControl>
Page.xaml.cs:
namespace MovingObjs
{
    public partial class Page : UserControl
    {
        private bool moving = false;
        private double offSetX;
        private double offSetY;
 
        public Page()
        {
            InitializeComponent();
        }
 
        private void brdMovable_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            moving = true;
            Point offset = e.GetPosition(brdMovable);
            offSetX = offset.X;
            offSetY = offset.Y;
        }
        private void brdMovable_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            moving = false;
        }
 
        private void brdMovable_MouseMove(object sender, MouseEventArgs e)
        {
            if (moving)
            {
                Canvas parent = (Canvas)this.brdMovable.Parent;
                Point p = e.GetPosition(parent);
                double x = p.X - offSetX;
                double y = p.Y - offSetY;
 
                txtBlkTest.Text = "X: " + x.ToString() + ", Y: " + y.ToString();
 
                this.brdMovable.SetValue(Canvas.LeftProperty, x);
                this.brdMovable.SetValue(Canvas.TopProperty, y);
            }
        }
    }
}