Monday, November 26, 2007

Visual Studio SP 1 Error on Windows 2003

I was building a up a workstation the other day for SharePoint and one of the last steps was patching Visual Studio up to Service Pack 1. It's a sizable patch (over 150 MB on disk) and takes a while to unpack never mind run.

What was driving me crazy though was that the installer kept dying and throwing out this error message:

"Error 1718. File was rejected by digital signature policy"
I was pretty sure that the patch was not corrupt, it had just successfully installed on a Windows XP machine not 20 min before. After poking around I stumbled upon this KB article which fixed the issue. As it turns out there's a bug in the Windows Installer for Windows 2003. When trying to verify the signature of a file it needs a (depending on the size of the file) a fairly large piece of contiguous virtual memory to load the file into. For files that are pretty big this can be a problem. What ends up happening is Windows often can't come up with the contiguous memory and so the validation step fails and it throws the above error.

The KB article above includes a hot fix for Windows 2003.

Best,
Tyler




Saturday, November 17, 2007

Common SQL Server 2005 Diagram Suport Errors

Here's a scenario, you're trying to create a database diagram and you're presented with the following error:

Database diagram support objects cannot be installed because this database does not have a valid owner. To continue, first use the Files page of the Database Properties dialog box or the ALTER AUTHORIZATION statement to set the database owner to a valid login, then add the database diagram support objects.

There's two popular causes for this problem.

1) The database doesn't have a proper owner. This often happens if you're restoring the database from another SQL Server instance. To check the owner:
  • Right click on the database and click on properties. Click on the files group and make sure the owner property is set to a valid login. If you're lazy you can always set it to sa.

  • You can also do this T-SQL if you want to script it. The syntax looks like:
    ALTER AUTHORIZATION ON DATABASE::[databaseName] TO [owner]
2) Another trick you might try if the database does have a valid owner is setting the compatibility level to SQL Server 2005 (90). To change the compatibility level:
  • Right click on the database and click on properties. Under the options group set the Compatibility Level to SQL Server 2005 (90).

Well that's it folks. Hope it saves you a minute or two.

Best,
Tyler

Friday, November 16, 2007

Safari 3 - Finally a REAL browser

I'm not going to lie to you. I've hated Safari for quite some time. Shortly after I first opened it I realized that browsing the web with Safari was like looking at the world while hung over. Not only were the most mundane of activities painful, everything rendered looked miserable and queasy.

When I became a web developer and started trying to deploy web applications that worked for Mac users, I really started to hate Safari. It seemed like NOTHING worked. Common javascript calls that would work great in IE and Firefox would fail miserably in Safari. The browser that Apple claimed was the "Worlds Best Browser" could barely render a .jpeg never mind a decent Web 2.0 site.

Last night I unwittingly downloaded an update for OS X Tiger which included (among other things) Safari 3.0. To my surprise the browser actually works quite well. I was actually blown away when I found out that all the WYSIWYG editors that used to fail miserably in Safari 2 work wonderfully in Safari 3.0. Even the text editor that I'm using to write this blog normally fails terribly in Safari, but no more! Two other text editors that I'm fans of, TinyMCE and the FCKeditor also both work extremely well with Safari 3.0.

What surprised me even more after I started digging around for material for this blog entry was that Safari has actually had extremely strong CSS support since version 2.0. I found this page which has actually been tracking Acid 2 Test performance for major browsers for quite some time. Imagine my surprise when I found out that both IE and Firefox STILL don't pass the Acid 2 test.

That being said, the Acid 2 test isn't a measure of everything that's important for a good browser, but as a developer I can't help but shake my head at the test renders from both IE 7 and Firefox 2.0. One day I'd like to be able to write CSS without being paranoid as to how it's going to render in other browsers.

If you have any interest, this is how the Acid 2 Test currently renders in the IE 7, FireFox 2.0, Opera 9.0 and Safari 3.0.

IE 7 (renders terribly)

FireFox 2.04 (almost there)

Opera 9 (renders correctly)


Safari 3 (renders correctly)

It's worth mention that this blog entry was written entirely in Safari 3.0. I can only hope that Safari 3.0 gets rolled out quickly and enjoys tremendous Mac user adoption. Kudos to Apple for finally releasing a half decent browser with OS X.

Thursday, November 15, 2007

SEO with Google Webmaster Tools

Many people are probably already aware of the Google Webmaster Tools, but since I'm sometimes not the last to find out, I thought I'd spend a second speaking to what a great help these tools can be.

SEO is always an interesting topic, mostly because there's so much hearsay and urban myth. Here's an example.

True or False: "Your key word density should not exceed 15%".
True or False: "Participating in link exchanges could actually hurt your site".
True or False: "Parametrized URLs (like http://domain.com/page.aspx?param=foo) are not crawled by the Google Bot".

There's a HUGE number of these, some of them are easy to find the answer to, while others often get bogged down in opinion stated as the truth. In an effort to quell confusion surrounding how SEO with Google works. Google offers the Webmaster Central which tries to answer a lot of these questions. A lot of content in the form of Blogs, Discussion Groups and a collection of SEO tools make both answering these questions and actually improving the crawl-ability of your site possible.

One of the most interesting tools to me has been the Webmaster Tools pages which allow you to analyze through the eyes of Google what your site looks like. I've often found that one of the most frustrating things about SEO is that it's extremely difficult to get feedback from your efforts. How do you know that the changes you've made are actually helping!?

The Webmaster tools don't solve this in entire, but they do tell you important information like:

  • Were there any errors when Google crawled your website last?
  • What are some key search terms that bring up your site?
  • A break down of internal/internal and site links.
Given that this is a blog, I'm often curious as to what people actually need to type in to a search engine to find this site. As it turns out right now they need to tickle Google pretty hard for this scarce blog to show up. But if you're curious as to which terms actually bring up this site (at time or writing), you're in luck! The Webmaster Tools actually show you specific search terms that bring up your site when searching with Google (see below).

If you expand the image above you can see specific search terms that bring up this site and the rank that this site will appear in. Pretty cool huh? This is one of many features available for free with the Webmaster Tools. If you have a site that you're even mildly interested in promoting, you should definitely check it out.

I'm also messing around with Google Analytics (I know it's been around forever but I haven't really played with it yet). I'll do another post if it's as impressive as I think it will be.

Best,
Tyler

Tuesday, November 13, 2007

Uninstalling OFFICESERVERS Sql Express Instance from MOSS, WSS etc...

It seems to happen quite often that I install MOSS on some machine, want to remove it but am left with some slightly unsightly left overs.

Once such left over is the OFFICESERVERS SQL Express named instance that comes with a 'Basic' install of WSS.
To rid yourself of this garish fallen soldier do the following.

1) Start->Run->regedit

2) Navigate to hkey_local_machine\software\Microsoft\Windows\CurrentVersion\Uninstall

3) Find the key which has a display name of OFFICESERVERS (a search from this key down is usually a good idea).
4) Once you find the key in question (it's usually a GUID), copy the text out of the 'UninstallString' key and paste it into a Start->Run dialog box. (IE. Start->Run-> 'MsiExec.exe /I{6DEF11C0-35FF-4160-A543-FDD336C4DAE5}' would be the command garnered from the image below).


5) Let the installer run and when prompted choose to remove the Sql Express instance.


That's it, your box is now slightly cleaner.

Good riddance.

Take care,
Tyler

Friday, November 2, 2007

RichText WYSIWIG Editor for SharePoint (Safari Friendly)

It's a common problem for anyone trying to roll out SharePoint to a community that has Apple users. SharePoint is only semi functional for Safari users. If you ask "the Soft" himself he'll tell you that almost any browser from OS 9/10 is a "Level 2" browser and will have limited support for interacting with Lists and Administrative context menus.

Probably the most difficult pill to swallow though is that the stock HTML editor barely works at all from Safari. Even if the editor did work well, its still a pretty terrible user experience even for users who are running browsers that are supported. Common tasks like uploading documents, images and managing them from a text entry screen are not supported even from IE or Firefox.

Enter the RadGridLite. The RadEditorLite (for SharePoint) is free and adds some hot features to stock SharePoint Blogs/Wiki's, especially for users who want to include a little media with their Blogs, Wikis, etc...

Here's a Screen Shot of the stock editor.


Trying to add an image to a Wiki with the stock editor:


And this is what it looks like with the RadEditor Lite:

Browsing Images with RadEditor:

Uploading Image with the RadEditor:

You can create folders to store uploaded images but it's of note that all the content that you create is under the default Wiki SharePoint list. This probably makes sense for some implementations but a lot of instances have all their content stored in central document repository. I went through the .chm and was unable to see any documentation that made it easy to point uploaded content to another list (like a document repository or some other kind of content repository).

Either way it's a step in the right direction and it's always hard to criticize free add ons too strenuoulsly.

Take if for a spin and let me know what you think.

Best,
Tyler

Thursday, November 1, 2007

Backing up Sql Server 2005 with SMO

We recently decided that we needed a low maintenance backup strategy for our OLTP databases. The thing with working in contracting/consulting is it seems that you're working on a new database every other week. One of the clients we're working on right now has over 16 databases that we work on semi-regularly.

What makes things worse is that it seems we end up creating another one every other couple of weeks talk about a maintenance headache!

Normally for database backups I would recommend a SQL Server Maintenance Plan, but we wanted to do more than what SQL Server would generate for us via an SSIS package. We also didn't want to be changing the package every week as we drop and create more databases.

We wanted to be able to do the following:
1) Backup up ALL non system databases (except those in an "exclusion list")
2) Zip up all backups that we create (because you can get GREAT compression on .bak files)
3) Delete old backups after a certain time interval, say after accumulating 10 backups delete the old.
4) Send out summary emails so that we know the jobs are still running.
5) Be able to change these settings w/out knowing any T-SQL, C#, etc...

Because of this semi tall order we actually ended up writing some C#. At first I couldn't help but groan, I felt we were overly complicating the issue and creating an unnecessary maintenance headache (who wants to maintain more code).

After I spent some time on the Code Project though I felt a little better. SMO (SQL Server Management Objects) provides a WONDERFUL API in terms of manipulating SQL Server. This rich interface provides everything you might ever want to do to your data store through the Management Studio.

Some of the code ended up looking a little like this:

Backup backup = new Backup();
backup.Database = database.Name;
backup.Action = BackupActionType.Database;
backup.Devices.Add(new BackupDeviceItem(backupPath, DeviceType.File));
backup.Initialize = true;
backup.Checksum = true;
backup.ContinueAfterError = false;
backup.Incremental = false;
backup.LogTruncation = BackupTruncateLogType.Truncate;
backup.PercentComplete += new PercentCompleteEventHandler(backup_PercentComplete);
backup.Complete += new ServerMessageEventHandler(backup_Complete);
backup.SqlBackup(server);

It's ridiculously simple. Combined with the popular Zip library SharpZipLib we were able to do pretty much everything we wanted to our databases. As of right now our deployed utility runs as a SqlAgent job and backs up all databases (not in an exclusion list) before zipping them up. It then deletes the Nth oldest backup so that we don't have to clean up (we get a say, a 6 week revolving set).

One last thing, so that we could backup new databases without having to add any grants or new logins we created a single login user DBBackupOperator and put it in the server role 'sysadmin'. I know what you're thinking..."Tyler that's bloody CRAZY!" especially if you're gonna log in from some 3rd party app.

We decided that to save ourselves from living too dangerously we would hash at runtime the password that we store in the app.config. That is, the password we store in configuration files is NOT the password used to connect to the data store. Instead we hash the crap out of it and then used that shared secret password to connect.

Well that's it, I strongly encourage you to check out SMO the next time you're playing with SQL Server 2005.

Best,
Tyler