After a painful re-image of my laptop I resumed my daily web development work only to realize that for some reason the connection to my vault diff & merge tool had been broken. With a not-so-useful error I was able to hunt down the problem to an incorrectly mapped executable due to bogus environment variables being used. I believe this is an error with Vault in the installation.
If you go to Visual Studio Options > Source Control > Vault (or Fortress) Options > Advanced Options > Diff/Merge. Look for the paths to the Diff/Merge EXE. Browse to the file SGDM.EXE using the browse button, click OK. You do not need to restart VS to complete this fix.
"The SQL Server 2005 Express Tools are installed. To continue, remove the SQL Server 2005 Express Tools."
I checked add/remove, I checked the "Program Files" directory, but could not find a trace of the SQL 2005 Express Tools installed.
After a little research I found this posting: http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/08/14/sql-2008-install-blocked-on-express-tools-but-actually-due-to-sql-prompt.aspx
Jasper mentions that older versions of RedGate SQL Prompt can cause this issue. You can find that by digging through the registry and looking for dependencies. In addition to the issue with SQL Prompt (only version 3 and below) there is an issue with the newer version of RedGate SQL Search. I uninstalled boh and SQL 2008 R2 installed fine.
As I was doing a little development tonight I realized that I was using one of the new features of VS2010 and totally forgot it was new. Some multi-line editing features make what used to be a pain a now simple process:
I have to say this is one of my favorite features added to this new version. I don’t know how many times I have gone into method overload madness because C# has never supported optional parameters. VB.Net always has…why not C#? Well, now it does!
public void AddUser(string firstName, string lastName, string status = "New User") {User = new User(firstName, lastName, status);}
Now this method could be called in a few ways:
AddUser("Sean", "Jaeger", "Working right now");AddUser("Sean", "Jaeger");AddUser(lastName: "Jaeger", firstName: "Sean");
Pretty darn cool!
Since I have now run into this issue 3 times and each time had to look it up to find out to fix it, I decided to post about it. If you use SSMS 2008/2008 R2 you will find out very quickly that altering a table using the GUI will throw an error. This is because SQL has added a new “feature” to prevent us from doing this.
In order to turn this “feature” off you will need to go to tools > options. On this screen uncheck this option:
I do not think this is a bad “feature”, but it should be something that admins can set at the server level to prevent it in UAT/Production environments… makes little sense in a development environment.
With C# 4.0 you can now use the new Tuple type instead of creating your very own… far simpler than using a struct or class to accomplish the same task.
There are two ways to create a Tuple in c# 4.0:
var newTuple = new Tuple<string, string, int>("Sean", "Jaeger", 36);var newTuple = Tuple.Create<string, string, int>("Sean", "Jaeger", 36);
Type inference can also be used (but doesn’t self document):
var newTuple = new Tuple.Create("Sean", "Jaeger", 36);
You can add up to eight parameters now:
var newTuple = new Tuple<int, int, int, int, int, int, int, int>(1, 2, 3, 4, 5, 6, 7, 8);
One huge thing I see in using a Tuple rather than an anonymous type is the fact that scope can be at any level. As we all know the scope of an anonymous type is limited to the method boundaries.
Fun stuff!
<script runat="server" language="c#">protected string BadHtml = "<script language='javascript'>alert('Hello');</script>";</script><%=BadHtml%>
The code above would cause an alert box to pop saying “Hello” because it is not HTML encoded. Typically what you might do here is use the Server.HtmlEncode() method within a property and use that instead. But now with C# 4.0 & Visual Studio 2010 you can just write this:
<script runat="server" language="c#">protected string BadHtml = "<script language='javascript'>alert('Hello');</script>";</script><%:BadHtml%>
Notice the “:” instead of “=”. This will automatically do the encode for you. Saving keystrokes is great!
I decided that I need to break away from the geeky stuff and post something else. Below is a list of things that frustrate me day-to-day. Some are work related, other things are just the environment that we live in today…
- People who claim they know a lot more than they really do
- Drivers that drive less than the speed limit when the weather is perfect
- Pigeons – do I need to explain?
- 90 degree weather in April – Arizona was not the only place this year!
- People who come to a garage sale and offer $2 on an item marked $20 that is worth $50
- Having to press 2 for English… having to look for the English section on instructions… going to Wal-Mart and seeing everything written in Spanish… driving down I-17 and seeing all the billboards in Spanish… American schools teaching English as a SECOND language!!
- Most unions – Especially teachers unions…. one of many things destroying America’s education system
- Lotus Notes – only 9 steps to flag an email for follow-up, 4 to remove that flag. What, search by email subject? That’s silly…
- Taxes – we get taxed on the gas that fills the car that we got taxed on to get to work earning a paycheck that has taxes removed so we can pay for a house that gets taxed and to buy food that gets taxed… chewing gum that was taxed… watching cable TV that is taxed… using water that is taxed… electricity… just to die and have the money that we wish to leave to our children taxed. I am surprised they have not found a way to tax the balance on revolving credit accounts!
- People who are afraid to be told they failed or did not do well or as well as others… I can write a book about this one! Get over it! America (and most of the world for that matter) was built on the many who failed and the few who succeeded. We would not have the great technology and scientific knowledge we have today if it were not for those failures that motivated another to push forward.
A few days ago while in Greensboro, NC I ran into a few issues setting up SQL reporting services on the same machine that SQL Server 2008 is installed. Apparently if you install SQL reporting services on the same machine as the SQL server running as a non-default instance you need to first have the SQL Browser Service running. You then need to configure reporting services to point to [servername]\[instancename]. Typically I would use [servername],[instanceport]… but that does not work!
Server or site migrations require that you give yourself ample time for the transition. The last thing you want is for users to be making changes on the site while you are taking a backup and moving to another location. There are many ways to avoid this server-side that will interrupt the users viewing experience. But, there is one way that you can still allow the users to interact with the MOSS or WSS site without allowing them to add/update/delete content. By using the site lock feature you can switch an entire site collection to read-only mode.
stsadm –o setsitelock –url http://server/site –lock { none | noadditions | readonly | noaccess }
none = sets site to “normal” mode allowing adds/edits/deletes
noadditions = no additional content can be added, current content can be edited as long as it doesn’t add to the total content
readonly = entire site becomes readonly. No adds/updates/deletes are permitted
noaccess = locks total access from the site. User will see an error specifying that they contact the administrator for more information
The MOSS/WSS GUI is great for many of the day-to-day administrative tasks, but I have found that it falls short on many of the larger tasks such as migrating entire sites or even large lists. Using the STSADM command line tool with the correct parameters can solve errors like the one in the title of this entry.
stsadm -o export -url http://server/site -includeusersecurity –nofilecompression -filename C:\directory
stsadm -o import -url http://server/site -includeusersecurity -nofilecompression -filename C:\directory
-includeusersecurity = will add ALL of the user accounts that have posted, edited, or have been given direct access to the site. This can either be a great help or a major pain. If the site and lists on the site rely heavily on tracking who created/modified files in document libraries, or you have workflows that use people pickers or utilize the createdby or modifiedby fields this should be included.
-nofilecompression = makes the export larger, but does not throw the failure decompressing error. Using this flag also requires that you use the command line tool to import.
If either of these flags are included on the export, they will also need to be included on the import.
After making a few changes to a custom form “NewForm_2.aspx” in WSS I realized that I needed to start over. I deleted the form and copied “NewForm.aspx” again and renamed to “NewForm_2.aspx”. When doing this you need to point WSS to the new form by using SharePoint Designer, right clicking the list, then using the “Supporting Files” tab browse to the newly created custom form:
The issue was when I deleted “NewForm_2.aspx” I broke the hook that WSS had to the form. Even recreating the form did not reset the hook. When clicking the “New” button on the list I got the error “Invalid Page URL:”. Microsoft has a KB article on this:
http://support.microsoft.com/kb/935504
But that does not resolve the issue. It states “To resolve this issue, delete the list, and then re-create it.”. This was not an option with a list with over 400 items and 50+ fields. So I went on the hunt and finally found this article:
http://blogs.msdn.com/dszabo/archive/2007/02/20/custom-list-newform-aspx-ruined-in-wss-3-0.aspx
In the article they explain the issue and a few ways to resolve it without deleting the list and recreating. The option that I found that worked was in the “POST-POST COMMENT: ALTERNATIVE RESOLUTION” section. Here you just need to replace a piece of the HTML code used by WSS to build the page. It worked like a charm!
A few days ago my boss and I were on a 4.5 hour call trying to fix a SharePoint custom list that had started behaving strange after a migration from MOSS to WSS. The creator of the list customized the “NewForm.aspx” and named it “NewForm_2.aspx”. The issue was a single column that was not saving when a new item was created, but could be edited and it would save fine. It was a lookup column to a list on the same site that had about 25 items.
First, we recreated the column with a new name & copied the data over then deleted the old column. I refreshed and reordered the SharePoint custom data list on “NewForm_2.aspx”. Still not saving…
Second, we recreated the lookup list. Still not saving…
Third, we changed the column to a standard choice control and hard-coded the values from the lookup list into the choice field. Still no luck…
I would go into all that we did, but it might take a few hours to list… so after “NewForm_7.aspx” was created (2,3,4,5,6 failed) I decided to not rearrange the fields on the form, leave them as they were default. It worked! So I reordered the columns in the list settings and created “NewForm_8.aspx”. All is good now.
Lesson of this story: When creating custom forms in SharePoint. #1 do not delete the placeholder where the data control is. #2 Do not move fields on the form. Removing fields is OK, but once they are moved you get unpredictable results. Use the list settings to reorder the columns how you want THEN create the form.
I always forget the code to do this because I do it so rarely. If you want to move the location of TempDB for SQL Server do this:
USE master
GO
ALTER DATABASE tempdb
MODIFY FILE (NAME = tempdev, FILENAME = '{new location}\tempdb.mdf')
GO
ALTER DATABASE tempdb
MODIFY FILE (NAME = templog, FILENAME = '{new location}\templog.ldf')
GO
Then restart the SQL Server services.
Windows Internal Database (or SQL Server Embedded) can be used by WSS or Windows Software Update Services (WSUS). It is well hidden and annoyingly unmanageable. By default the data files reside in a folder under the root drive in the Windows directory. This can be a bad place to allow a potentially fast growing database to reside… especially if your drives are partitioned for a small “C” drive just to be used by the operating system. I was able to find out how to move these databases pretty easily.
1. Download and install SQL Server Management Studio Express (find it here: http://tiny.cc/msssmse)
2. Turn off any services that might be using the database (SharePoint, WSUS, etc)
3. Connect to \\.\pipe\mssql$microsoft##ssee\sql\query using SSMSE named pipes
4. Detach all databases that you wish to move (check box to kill connections)
5. Move the databases and associated log files (MDF & LDF) to the desired location
6. Reattach databases in there new location
Now the databases will not hog your boot drive.
An interesting but frustrating thing occurred a few months back when I was creating a SharePoint WSS server installation at work. We had created an alias for the server but the name would not stick. You could browse to the server but whenever you clicked a link within SharePoint it would take you to the page with the name of the server in the URL not the alias. The same would happen when using the IP address, NetBIOS name, or the FQN.
Solution… the Alternate Access Mappings link within SharePoint Central Administration. Set up all the possible names that people may type into to get to a place within SharePoint and that name will stick.
In SharePoint (MOSS 2007 & WSS 3.0) there is a limit on the size of list template that can be saved… 10MB. For most lists that just contain data this is sufficient. There may be a need for lists that have attachments or document libraries that may contain many documents. SharePoint lets you increase this size to a maximum of 500MB by running the following command at the prompt:
stsadm -o setproperty -propertyname max-template-document-size -propertyvalue 50000000
I noticed the other day that IIS management was not connecting shortly after an enterprise MOSS 2007 installation. I know a few colleagues at work had mentioned seeing this before as well. I went on the hunt and came across a well hidden paragraph in an article about IIS in general that gave me the solution. Apparently all you need to do is stop and restart the SharePoint timer service. That is it! Amazing how simple the solution can be for an issue that has caused so many people to jump through hoops for workarounds!
I ran across a great suite of tools offered for the STSADM command line SharePoint administration tool. It is a helper class written by Gary LaPoint MOSS MVP. Great features and nice documentation.
Here is his blog: http://stsadm.blogspot.com/.
And here are the tools: http://stsadm.blogspot.com/2009/02/downloads.html
