Recently, my feelings towards PowerShell have been somewhat ambivalent. There are some seriously good ideas in the PowerShell design. I really want to like it, it’s just that it makes it very hard sometimes… Let’s just say you have the simple task to create a file that contains a list of all files in a specific directory – recursively of course. You’ll probably start with the Get-ChildItem cmdlet (aka “ls”) which gives you the files in the current directory.
Continue reading PowerShell output formatting trouble
$ Get-ChildItem
Tools
I hate that Home Screen which pops up on every Skype start. I really do…
So I created a small Tray Icon app which looks for this Window and closes it immediately.
As usual, there is some Win32 API needed to do this. Here’s the Code which searches and closes the Window:
[DllImport("user32.dll", CharSet = CharSet.Auto)] public static extern IntPtr FindWindow(string strClassName, string strWindowName); [DllImport("user32.dll")] public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam); public const Int32 WM_SYSCOMMAND = 0x0112; public const Int32 SC_CLOSE = 0xF060; public static void Close() { IntPtr hWnd = FindWindow("THomeForm", "Skype Home"); if (hWnd.ToInt32() > 0) { SendMessage(hWnd, WM_SYSCOMMAND, new IntPtr(SC_CLOSE), IntPtr.Zero); } }
Here’s the programm: SkypeHomeCloser_1.0
Code printed in Visual Studio 2010 is not colored.
To enable this “feature”, you have to install this Extension.
Be aware that you can’t collapse regions for printing with this Extension.
Furthermore, if you wan’t line numbers, you have to enable them via Tools->Options.
Recently I’ve noticed that a lot of my co-developers where I work don’t use a lot of tools beyond the usual VisualStudio / Notepad combo. I find that rather weird since personally I have spent a lot of time learning how to use certain tools because it makes life just that much easier. As I am pretty sure I have mentioned before, developers are supposed to be lazy. According to Larry Wall (the inventor of Perl) this is even one of the three most important virtues of a programmer – the other two being impatience and hubris. In this case I happen to agree with Larry, because the urge to avoid any kind of repetitive, mind-numbing task or do something with two clicks instead of three is what programming is all about.
I always forget how to Rollback a Changeset, so here’s the command to do it:
First, make sure you got the Team Foundation Server Power Tools installed.
Then execute the following command:
tfpt rollback /changeset:<changesetnumber> "<workspace>"
so for example:
tfpt rollback /changeset:48745 "C:\Workspaces\XXXComplete"
Time for some more fun with VisualStudio macros.
Lets consider this common scenario: You open a project to make a minor adjustment and then realize that in order to compile that project, you need to add all the dependencies (project references) to your solution. For larger projects, that could be a LOT of projects to add… AND you may have to do this recursively! take a look at the reference, locate the project file, add it to your solution, repeat. Since I am indeed THAT lazy, I created a macro to do that for me.
For quite some time now, it has happened to me occasionally that attaching the debugger to the w3wp.exe (IIS worker process) to debug a web application gets extremely slow. I’m talking about several minutes to load all the symbols before it could actually start debugging. In the VS status bar you could see that it took about 1 second for each assembly to load – and we’ve got LOTs of them. In the past, the problem usually went away by itself after a reboot or some other Windows “feature”. This week however it just didn’t get any better. After some Googleing I now think that I have found the solution to the problem: simply delete ALL breakpoints and set a couple of new ones. Don’t ask me how or why exactly, but it seems to be quite reliable.
I often get an Not enough storage is available to complete this operation
Error when compiling a large Solution. By storage they mean Memory (RAM) in fact.
Visual Studio is limited by how much RAM it will use but theres a trick to increase the Memory it will use.
Quick HowTo:
1.
Windows xp: backup the boot.ini file and then put the /3gb switch in your boot.ini.
Windows Vista: run the following from the visual studio command prompt:
bcdedit /set increaseuserva 3072
2.
– be sure to backup devenv.exe
– using the visual studio command prompt, navigate to c:\program files\microsoft visual studio 9\common7\ide\
– execute the following command:
editbin /largeaddressaware devenv.exe
Here’s the Link to the original entry:
http://stevenharman.net/blog/archive/2008/04/29/hacking-visual-studio-to-use-more-than-2gigabytes-of-memory.aspx
There is this fancy new feature in Windows 7 called “Boot from VHD”. It essentially allows you to boot your machine from a virtual disk without having to virtualize the rest of your hardware. This can be quite helpful if you want to experiment with your Win7 without reinstalling all the time because you screwed up.
First I’ll explain how you can create and manage virtual disks. In the second part I will discuss how to install a second Win7 on the created virtual disk and how to set up the bootloader correctly.
Continue reading Win7 Boot from VHD – Part I
On Friday I tried to update one of the legacy DataSets of the application I’m working on. When I double-clicked the data set schema, VS just opened the XML view to edit the schema. Quite useless. So I right-clicked the item and selected “View Designer” which then brought up a new window that contained all the inner text of the XML document as one large blob. More than just useless…
Today I started looking for a solution or possible cause for the problem. It would seem that the data set designer was not loaded on VS startup. The solution then was quite simple: Open a command line and start
devenv /resetskippkgs
This tells VS to reset its list of skipped packages and load everything. Now I can use the designer again.