Just yesterday I finally installed Windows 10 and today at work I found the computer working well except for one thing that was very annoying.
Since I work in Visual studio very much I have ReSharper installed and from time to time I use the shortcut Shift-Alt-L and apparently this is the same shortcut as to bring up the Touchpad Driver Diagnostics popup. This generates a logfile and the system asks if you want to look at the directory where the file was created.
If you, as I, want to disable this popup here is what to do:
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SynTP\Parameters\Debug /v DumpKernel /d 00000000 /t REG_DWORD /f
Warning the above command changes the register and I'm not responsible for any problems with your computer if anything happens.
The fix was found from Microsoft community and given by Mark in August 7 2015 (http://answers.microsoft.com/en-us/windows/forum/windows_10-files/touchpad-driver-diagnostic-pop-up/f8ad5ca2-9559-4327-9b7e-bdaaaca4d2b1?auth=1)
10 August 2015
23 October 2013
Make sure that the correct version of Visual Studio is opened using a batch file
I like most of other developers have several versions of
Visual Studio
installed on my computer and it can be a hassle to get the correct version to open using a batch file.
I have a batch file that starts up the program that I normally use during the day and in this I have a start of Visual Studio. Now that Visual Studio 2013 has arrived I installed this on my machine that already have Visual Studio 2012 and 2010.
For my current project I need to use Visual Studio 2012 (due to an old TFS) so I want the batch file to start the correct version.
I have the followin line in the batch file
start /d "D:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\" devenv.exe
This started to start up Visual Studio 2013 anyway and I couldn't understand why until I stumble upon the solution on another webpage.
I turns out that Windows associates devenv with a specified directory path through a setting in the register
My Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\devenv.exe
This key was set to
D:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe
which meant that Visual Studio 2013 was started, to get Visual Studio 2012 to start instead I just needed to change the register setting to
D:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe
Problem solved!
I have a batch file that starts up the program that I normally use during the day and in this I have a start of Visual Studio. Now that Visual Studio 2013 has arrived I installed this on my machine that already have Visual Studio 2012 and 2010.
For my current project I need to use Visual Studio 2012 (due to an old TFS) so I want the batch file to start the correct version.
I have the followin line in the batch file
start /d "D:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\" devenv.exe
This started to start up Visual Studio 2013 anyway and I couldn't understand why until I stumble upon the solution on another webpage.
I turns out that Windows associates devenv with a specified directory path through a setting in the register
My Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\devenv.exe
This key was set to
D:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe
which meant that Visual Studio 2013 was started, to get Visual Studio 2012 to start instead I just needed to change the register setting to
D:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe
Problem solved!
14 January 2013
Customize lockscreen for Windows 7
I recently worked in an office complex and was a bit depressed as so many people in the office just let their Windows 7 installation use the default lockscreen view.
The default lockscreen image is the standard blue screen which is kind of nothing. Most people that use a computer change their background in Windows but since Microsoft made the change of lockscreen image so much harder not that many changes the lockscreen image.
The change of lockscreen image is actually quite easy even if you have to perform some manual work to get it ok.
First of all you need administrator rights on the computer since either you have to dive into the register and edit a key yourself or using the group policy editor. Then you need to be able to put your prefered image in the correct directory and you will be done.
Follow the steps below and you will have you own lockscreen image and be the envy of your colleges at the office.
1. Type "Edit Group Policy" in the startmenu and run the corresponding option.
2. Expand the node "Administrative Templates"
3. Expand the node "System"
4. Locate and select the node "Logon"
5. Locate the option "Always use custom logon background"
6. Double click the option and mark the option as "Enabled"
7. Apply and close the dialogs that are opened.
8. Locate the image you want to use.
9 Make sure that the image matches you screen resolution since the image will be stretched by windows to fullscreen.
9. The image need to be max 256kb in size otherwise windows will ignore it.
10. Rename the image to "backgroundDefault.jpg"
11. Place the image in the directory "%windir%\System32\oobe\info\backgrounds\" create any missing subdirectories.
12. Done!
If the image doesn't show make sure that the "Always use custom logon background" is enabled and that the image is at the correct position with the correct name and hasn't a size greater than 256kb.
If you rather edit the register yourself then you can ignore the steps 1-7 and instead do the following
1. Open RegEdit
2. Locate the node "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background"
3. Edit (or add as a DWORD) the key OEMBackground and set the value to 1
4. Continue with step 8 above.
The default lockscreen image is the standard blue screen which is kind of nothing. Most people that use a computer change their background in Windows but since Microsoft made the change of lockscreen image so much harder not that many changes the lockscreen image.
The change of lockscreen image is actually quite easy even if you have to perform some manual work to get it ok.
First of all you need administrator rights on the computer since either you have to dive into the register and edit a key yourself or using the group policy editor. Then you need to be able to put your prefered image in the correct directory and you will be done.
Follow the steps below and you will have you own lockscreen image and be the envy of your colleges at the office.
1. Type "Edit Group Policy" in the startmenu and run the corresponding option.
2. Expand the node "Administrative Templates"
3. Expand the node "System"
4. Locate and select the node "Logon"
5. Locate the option "Always use custom logon background"
6. Double click the option and mark the option as "Enabled"
7. Apply and close the dialogs that are opened.
8. Locate the image you want to use.
9 Make sure that the image matches you screen resolution since the image will be stretched by windows to fullscreen.
9. The image need to be max 256kb in size otherwise windows will ignore it.
10. Rename the image to "backgroundDefault.jpg"
11. Place the image in the directory "%windir%\System32\oobe\info\backgrounds\" create any missing subdirectories.
12. Done!
If the image doesn't show make sure that the "Always use custom logon background" is enabled and that the image is at the correct position with the correct name and hasn't a size greater than 256kb.
If you rather edit the register yourself then you can ignore the steps 1-7 and instead do the following
1. Open RegEdit
2. Locate the node "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background"
3. Edit (or add as a DWORD) the key OEMBackground and set the value to 1
4. Continue with step 8 above.
Labels:
Custom background,
lockscreen,
OEM background,
Windows 7
30 October 2012
Removing, altering table and re-adding unknown constraints in SQL
Every now and then when you are writing update scripts for a database you need to drop and recreate a constraint. The problem you might face is that you haven't explicit created the constraint in the first place which means that the constraint haven't gotten a given name. With the following small script you will be able to locate the constraint, alter the table and then recreate the constraint.
!!
Be warned that the script has only been tested on basic constraints and there might be constraints that specify different options that this script will ignore. Be sure to test the script in some test environment before committing that the script works as intended
!!
Declare @tableName varchar(30) = '<tableName>'
Declare @constraintName varchar(50) =
(
Select OBJECT_NAME(OBJECT_ID)
From sys.objects
Where type_desc Like '%CONSTRAINT'
and OBJECT_NAME(parent_object_id) = @tableName
and type_desc = 'UNIQUE_CONSTRAINT'
)
Declare @constraintDrop varchar(200) = 'Alter Table ' + @tableName + ' drop constraint ' + @constraintName
Declare @ColumnList varchar(max) =
(
Select Stuff(
(
Select '[' + COLUMN_NAME + '] Asc, '
From INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE
Where CONSTRAINT_NAME = @constraintName
For Xml Path('')), 1, 0, ''
)
)
Set @ColumnList = (Select LEFT(@ColumnList, LEN(@ColumnList) - 1) )
Declare @constraintAdd varchar(Max) = 'Alter Table ' + @tableName + ' Add Unique NonClustered (' + @ColumnList + ') On [Primary]'
exec(@constraintDrop)
-- Add alter/update script here
exec(@constraintAdd)
!!
Be warned that the script has only been tested on basic constraints and there might be constraints that specify different options that this script will ignore. Be sure to test the script in some test environment before committing that the script works as intended
!!
Declare @tableName varchar(30) = '<tableName>'
Declare @constraintName varchar(50) =
(
Select OBJECT_NAME(OBJECT_ID)
From sys.objects
Where type_desc Like '%CONSTRAINT'
and OBJECT_NAME(parent_object_id) = @tableName
and type_desc = 'UNIQUE_CONSTRAINT'
)
Declare @constraintDrop varchar(200) = 'Alter Table ' + @tableName + ' drop constraint ' + @constraintName
Declare @ColumnList varchar(max) =
(
Select Stuff(
(
Select '[' + COLUMN_NAME + '] Asc, '
From INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE
Where CONSTRAINT_NAME = @constraintName
For Xml Path('')), 1, 0, ''
)
)
Set @ColumnList = (Select LEFT(@ColumnList, LEN(@ColumnList) - 1) )
Declare @constraintAdd varchar(Max) = 'Alter Table ' + @tableName + ' Add Unique NonClustered (' + @ColumnList + ') On [Primary]'
exec(@constraintDrop)
-- Add alter/update script here
exec(@constraintAdd)
20 January 2012
Deal with multiple .vsmdi-files in sourcecontrol
If you ever have worked in a large project you have probably seen that there are multiple .vsmdi-files under sourcecontrol after a while. These files contains information about the testruns in the project and if the current file is checked out to another developer you will create a new such file if you change the testrun.
There is a good reason for not having these files under sourcecontrol.
Almost all developers have their own way of viewing files and especilly testruns and if this file is checked in and somebody makes a change that change will affect all other developers when they perform a "get latest"
The below blogpost is very informativ in specifying in how you can remove these files from sourcecontrol and make it possible for every developer to create their own testruns.
http://seriouscodage.blogspot.com/2010/03/multiple-vsmdi-files-with-vs2008-path.html
There is a good reason for not having these files under sourcecontrol.
Almost all developers have their own way of viewing files and especilly testruns and if this file is checked in and somebody makes a change that change will affect all other developers when they perform a "get latest"
The below blogpost is very informativ in specifying in how you can remove these files from sourcecontrol and make it possible for every developer to create their own testruns.
http://seriouscodage.blogspot.com/2010/03/multiple-vsmdi-files-with-vs2008-path.html
15 December 2010
Use Outlook as interface against Lotus Notes
During my work as consultant I often find myself in positions where I get a new mail from a customer during a project. Since I already have a couple of email addresses, at least one from my company and one private. I'm using Office Outlook to gather all these mail accounts in one place to avoid having to look through multiple places and get access to all my mails easy and fast.
With my latest customer I was required to get a Lotus Notes mail address and when looking over the web to find a method to use Outlook as interface with this mail too I started to think that this wasn't possbile without the use of DAMO (Domino Access for Microsoft Outlook) which is a program that IBM stands for that makes this possible.
I don't really fancy using an extra tool for making this possible and continues to look around and eventuelly I found a solution that is blatant obvious. All you need is to know that adress of your Domino server and your account information.
Add a new account and choose to create manually then select an internet mail account of type IMAP. Add the correct information with using your domino server as incomming and the correct server as outgoing. Your technicians should know what settings you need here.
After that leave all other settings as default and Voilá you can start using your outlook as interface against Lotus notes.
With my latest customer I was required to get a Lotus Notes mail address and when looking over the web to find a method to use Outlook as interface with this mail too I started to think that this wasn't possbile without the use of DAMO (Domino Access for Microsoft Outlook) which is a program that IBM stands for that makes this possible.
I don't really fancy using an extra tool for making this possible and continues to look around and eventuelly I found a solution that is blatant obvious. All you need is to know that adress of your Domino server and your account information.
Add a new account and choose to create manually then select an internet mail account of type IMAP. Add the correct information with using your domino server as incomming and the correct server as outgoing. Your technicians should know what settings you need here.
After that leave all other settings as default and Voilá you can start using your outlook as interface against Lotus notes.
08 November 2010
Using reflection to obtain type information in runtime (C#)
Usually you know which type that you are working with but once in a while you only know what basetype you are working with but doesn't know what subtype you currently have.
During these times reflection is the way to go. Using reflection you are able to find out what type you are working with and create actions based on the fields, events and properties of the type.
I'll start with a short example to show the usage of reflection:
If you send information about events that happens by a webservice and these events are prone to change and it is possible that new events can be added too. If then the webservice usages is so that a presentation of theses events should be created you need to have some way to create a default view of the properties of the different events.
We have three classes defined, one base class and two classes that inherites from this one and defines some properties of themself.
public abstract class MyBaseObject
{
public string Message;
public string Felmeddelande;
}
public class MyDateTimeObject : MyBaseObject
{
public DateTime StartTime { get; set; }
}
During these times reflection is the way to go. Using reflection you are able to find out what type you are working with and create actions based on the fields, events and properties of the type.
I'll start with a short example to show the usage of reflection:
If you send information about events that happens by a webservice and these events are prone to change and it is possible that new events can be added too. If then the webservice usages is so that a presentation of theses events should be created you need to have some way to create a default view of the properties of the different events.
We have three classes defined, one base class and two classes that inherites from this one and defines some properties of themself.
public abstract class MyBaseObject
{
public string Message;
public string Felmeddelande;
}
public class MyDateTimeObject : MyBaseObject
{
public DateTime StartTime { get; set; }
}
public class MyOccurenceObject : MyBaseObject
{
public int NumberOfTimes{ get; set; }
public string[] Values { get; set; }
public string[] Headers { get; set; }
}
If we now have a method that accepts a parameter of MyBaseObject and want to create functionallity of examining the content of the object we can do as follows:
public class ObjectInspector
{
public static InspectObject(MyBaseObject obj)
{
var typ = obj.GetType();
var fields = typ.GetFields();
var properties = typ.GetProperties();
foreach(var field in fields)
Console.WriteLine(string.Format("{0} : {1}", field.Name, field.GetValue(obj));
foreach(var prop in properties)
if(prop.CanRead())
Console.WriteLine(string.Format("{0} : {1}", prop.Name, prop.GetValue(obj, null));
}
}
A warning, ifyou are to use GetValue of properties then you need to make sure that the method CanRead returns true. This method examines the accessor methods for the different properties and makes sure that the property is readable. Likewise the method CanWrite returns information is the property have a setter.
More information about this can be found in these two articles:
Subscribe to:
Posts (Atom)