Posts

Showing posts from 2005

Python script to stop Excel loading any addins on startup

Works for Excel 2000, probably adaptable to other versions of excel. You would need to check your registry to work out if your version of Excel uses the same OPEN, OPEN1 ... values to store addins to load on startup. import _winreg import os.path as path import re EXCEL_SUBKEY = r "Software\Microsoft\Office\10.0\Excel\Options" hkey = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, EXCEL_SUBKEY, 0, _winreg.KEY_ALL_ACCESS) try : (numSubKeys, numValues, lastModified) = _winreg.QueryInfoKey(hkey) valuesToDelete=[] for i in xrange(numValues): valuename, data, type =_winreg.EnumValue(hkey, i) if re.match(r 'OPEN\d*' , valuename): print "Deleting " +valuename + " : " +str(data) valuesToDelete.append(valuename) for value in valuesToDelete: _winreg.DeleteValue(hkey, value) finally : _winreg.CloseKey(hkey)

Using the Visual Studio .NET QuickWatch window

According to the MSDN documentation you can write C++ expressions in the QuickWatch window and have them evaluated. There are some documented limitations but in practice getting something to work in the QuickWatch window is very hit and miss. If you want to debug STL you run up against the limitations pretty quickly. Say we have the following code: vector<int> a; a.push_back(1); a.push_back(2); a.push_back(3); If we run this code and break into the debugger you'd hope that you could inspect the values in the vector by typeing things like a[0] into the QuickWatch window, but alas this results in: a[0] CXX0058: Error: overloaded operator not found Okay so lets try a.at(0): a.at(0) CXX0039: Error: symbol is ambiguous Hmmm, a.capacity() and a.size() work okay but how do we inspect the values? It seems the only reliable way is to rely on some knowledge of the underlying implementation: (a)._Myfirst[0] or if you want to see all the values: (a)._Myfirst,3 the ',3'

Opening ASP.NET examples in Developer Studio .NET

I'm just getting started with ASP.NET and have been downloading example ASP.NET projects from sites such as http://authors.aspalliance.com. When I unzipped these projects and tried to open them in Visual Studio .NET I get the following really helpful message: --------------------------- Microsoft Development Environment --------------------------- Visual Studio .NET cannot create or open the application. The likeliest problem is that required components are not installed on the local Web server. Run Visual Studio .NET setup and add the Web Development component. --------------------------- OK Help --------------------------- I'd already got ASP.NET project up and running so luckily didn't take much notice of the error message. It turned out that all I needed to do was define a new virtual directory in IIS that matches the one the project was configured for. The expected virtual directory can be found in the project's .csproj.webinfo file. Here's an example one: &l