Move C:\ProgramData\Package Cache\ to D:\

Windows with a couple of development tools takes up about 126GB of my 128GB SSD, to free-up some space I followed the guide at: http://www.hanselman.com/blog/GuideToFreeingUpDiskSpaceUnderWindows81.aspx

 

Then I moved the "C:\ProgramData\Package Cache" used by Visual Studio to D:\.

 

I did this by following the instructions at: http://superuser.com/questions/455853/can-i-delete-the-the-folder-c-programdata-package-cache

 

1. Move folder from C:\ProgramData to D:\ProgramData

This must be a move of the complete “Package Cache” folder, so after move you will have a folder C:\ProgramData, that does NOT contain the folder “Package Cache”.

2. Create a filesystem junction: mklink /J "C:\ProgramData\Package Cache" "D:\ProgramData\Package Cache"

This will create a filesystem junction, that will point all software that wants to access  "C:\ProgramData\Package Cache" to "D:\ProgramData\Packa Cache".

 

That alone saved me about 6GB.

Fix for: Could not connect with Remote Desktop to a Windows 10 machine using a Microsoft account.

On my home network I wanted to set up a Remote Desktop connection to a Windows 10 machine from a Windows 8.1 machine, by using the credentials of a Microsoft account. Both machines were using the same Microsoft account to login.

 

Turns out I had 2 problems, first on the Windows 10 machine I had not turned on sharing.

When I went to Control Panel\Homegroup, on the right of the screen a text appeared to enabled sharing, when I clicked OK, I could connect with Remote Desktop to the machine, but then I had to enter credentials.

 

Assuming my email address, used to login with my a Microsoft Account is: john@tools.com then you should enter the username as: MicrosoftAccount\john@tools.com

 

Yes you really have to put the text “MicrosoftAccount” in front of the email address.

 

 

image

One of the most important things to remember: In C# and JavaScript, object references are passed to functions by value not by reference

By default C# and JavaScript pass object references by value not by reference, but what does that mean?

Well if you assign an object to a variable, this variable is just a pointer to that object in memory.

(Examples in C#)

var person = new Person
{
Id = 2,
Name = "John"
};

The variable person is just a pointer to the object in memory, the memory contains the object { Id = 2, Name = “John”}

When passed to a function, a copy of this pointer is supplied to the function, not the object itself.

So when you update properties of the object in the function, the variable outside the function will get updated.

 

But when you set the object to NULL in the function, the variable outside the function will NOT be set to NULL.

 

In C# you can override this by adding the “ref” keyword before the parameter, in that case the pointer of the variable will be passed and thus setting the object to null in the function will set the variable outside the function to NULL.

 

Some unit test to explain this:

namespace Test
{
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;      
[TestClass]
public class Research
{
[TestMethod]
public void Update_object_properties_should_update_variable()
{
var person = new Person
{
Id = 2,
Name = "John"
};
UpdateObjectProperties(person);
Assert.IsTrue(person.Name == "Mike");
}
public void UpdateObjectProperties(Person person)
{
person.Name = "Mike";
}
[TestMethod]
public void Update_object_pointer_should_not_update_variable()
{
var person = new Person
{
Id = 2,
Name = "John"
};
UpdateObjectPointer(person);
Assert.IsTrue(person.Name == "John");
}
public void UpdateObjectPointer(Person person)
{
person = null;
}
}
public class Person
{
public int Id { get; set; }
public string Name { get; set; }
}
}

 

image

 

More info can be found at:

http://stackoverflow.com/questions/9717057/c-sharp-passing-arguments-by-default-is-byref-instead-of-byval

http://jonskeet.uk/csharp/parameters.html

http://jonskeet.uk/csharp/references.html