Feed Icon  

Contact

  • Bryant Likes
  • Send mail to the author(s) E-mail
  • twitter
  • View Bryant Likes's profile on LinkedIn
  • del.icio.us
Get Microsoft Silverlight
by clicking "Install Microsoft Silverlight" you accept the
Silverlight license agreement

Hosting By

Hot Topics

Tags

Open Source Projects

Archives

Ads

It's a boy!

Posted in General at Wednesday, December 22, 2004 1:58 AM Pacific Standard Time

Well I had a very exciting weekend! My wife went into labor on Sunday and on Monday morning at 7:18 she delivered a beautiful baby boy: Alexander DeVere Likes:

Both Mom and baby are doing great. Alex weighed 6 lbs. 4 oz. and is the best Christmas gift I've ever received. :) I'll post more photos later in the week. For now I'm taking some time off work to enjoy this wonderful new life!

House Cleaning

Posted in Sql and Xml | General | ASP.Net/Web Services at Saturday, December 11, 2004 5:40 AM Pacific Standard Time

I was doing some house cleaning today and came across some of the free software that I was sent because I was a .Net user group leader. The user group was through my school (CSUN) and so once I graduated I tried to pass it along but it was never really successful (I was too busy). Anyhow, instead of throwing the free software licenses into the trash I thought it would be better to raffle them off on my blog.

The first raffle will be for two licenses for VistaDB 2.0 (one per winner):

VistaDB is the #1 alternative data engine to Jet/Access, MSDE and Xbase. Built specifically to provide robust, high-speed, embedded data management with minimal overhead and hassle-free XCOPY deployment, VistaDB is the perfect database for building robust small to midsize database applications under .NET and Win32.  

If you're interested in a free license post a comment and be sure to include 1) why you would like the free license and 2) your email address. I will determine the which two comments offer the best reasons out of all the comments posted (if there are any) and will send them each a license. This offer is good until some point in the future when I check the comments and see two good reasons or until I get tired of waiting. :)

New Phone

Posted in General at Friday, December 10, 2004 5:07 AM Pacific Standard Time

I took advantage of Verizon's buy one get one free deal on the LG VX6100 phones. My wife and I both like them so far. Below is my first attempt at cat blogging:

Melvin wasn't sure about getting her picture taken, but it was a good sample. The photo quality isn't great and for $.25/photo download I won't be using it much, but it is a nice thing to have.

Test Driven SmartPart Development

Posted in SharePoint | ASP.Net/Web Services | Test-Driven Dev at Wednesday, December 08, 2004 3:02 AM Pacific Standard Time

A couple of weeks ago Jan Tielens released the SmartPart version 1.0.0.0. The SmartPart is a very cool WebPart that will host ASP.Net user controls in a SharePoint environment. This means you can use Visual Studio to edit the user controls and use the WYSIWYG editor instead of building the HTML via code. Additionally, Maxim Karpov helped out with the CAS aspect of the SmartPart which can be a confusing topic if you're not Maxim. Maxim does a great job of explaining the CAS issues and even though I've worked with CAS for things like custom code in reporting services, I still feel it is something foriegn (I think CAS knowledge seeps out of the brain).

So the SmartPart allows you do quickly create SharePoint WebParts and you can even debug those WebParts in a normal ASP.Net application, but what about using Test Driven Development (TDD)?

Well Scott Hanselman gave me an idea that I thought would be worth trying out. Scott detailed how to use TDD for normal ASP.Net development using Cassini, an idea I found to be very cool. So could I use the same technique to use TDD for SmartParts? The answer is you can.

First I created a SmartPart project to build my sample SmartPart. To do this I used a regular class library project since this will give me everything I need without having to use a web server. You will need to add references to System.Web, Microsoft.SharePoint, and SmartPart. For my simple SmartPart I created one ASCX file and one CS file. In my user control I added a Label and in the Page_Load event handler I set the Text property to “This is a simple smart part.”.

The next step is to create your testing project. Again I created a class library project and this time added references to the Cassini (using the cassini.dll) and NUnit.Framework (I'm using NUnit 2.2). I had to make some modifications to Scott's code in order to make things work since my approach is slightly different. He is testing ASPX pages while I'm testing a user control that needs to be loaded in an ASPX page.

The first test was just to start the cassini server and open an ASPX page that had no control to make sure everything worked. That was fairly easy thanks to Scott. The next step was a little more involved since I had to copy the user control and the dll from my other project and reference the ASCX in the ASPX page. However, after some trial and error I got that working as well. The real fun came when I went to set the SPWeb property of my SmartPart as shown by Jan in his debugging post.

The SPGlobalAdmin class requires the Microsoft.SharePointLibrary.dll in order to function (which exists only in the GAC) [Update: I made a change here since I made a mistake in the original post. The SPGlobalAdmin is in the Microsoft.SharePoint.Administration namespace, not library.]. I remembered seeing a post about how to extract this from the GAC so after a little googling I came across this example which allowed me to extract the dll and add it to the bin folder of my cassini project. Once I had this dll accessible to cassini things started to work except for a security exception: Failure decoding embedded permission set object. Hmmm.

This one kept me baffled for quite some time until I got the bright idea this morning (after reading some of Maxim's CAS articles again) to take a look at the constructor for the SPGlobalAdmin class using Reflector. Using Reflector I noticed that the contructor demanded the permission Microsoft.SharePoint.Security.SharePointPermission. Ahhh. So back to the GAC again to get Microsoft.SharePoint.Security.dll.

Once I had that everything worked. All my tests passed and I'm able to start developing my SmartParts using TDD. Now I'm off to see if I can figure out how to test creating and using connections. If people are interested I can write a short article with the code I used to do this.

Update: I ended up running into issues when setting the SPWeb property. I was able to get the SPGlobalAdmin but nothing past that. But at this point I'm not sure how much that matters. I did get some very simple connections working just by using Part1.SetConsumerData(Part2.GetProviderData()).

Pictures from Boston

Posted in General at Tuesday, December 07, 2004 4:45 AM Pacific Standard Time

Well I finally got around to uploading our pictures onto my the photo site I created for my wife. So here are some pictures from our trip to Boston in October.


Great fall colors.


My wife and me at Walden Pond.


In Plymouth


My wife and her brother on the North Bridge.


Red Sox Parade

 

Tripping Out SQL Server

Posted in Sql and Xml at Tuesday, December 07, 2004 4:01 AM Pacific Standard Time

Much of the work I've been doing lately is DBA type of work rather than development work. Even though I'm a SQL Server MVP, I'm still a newbie when it comes to managing databases where there are lots of developers and users. Because of this I've become a huge fan of fellow MVP Kimberly Tripp. I've watched her TechEd session on partitioning at least 10 ten times and I have used her techniques with great success. One of the best examples was a table which I recreated using horizontal partitioning.

The table had ~280 million rows and used up about 96 GB of space. The data stored in the table was historical data and a simple queries to get the number of rows for a certain date would take approx. 30 minutes. I redesigned the table (optimizing many of the column sizes) and used one table per year and a view to join them all together. The new tables together took up about 25 GB of space. Additionally, since I'm using multiple tables I can also only backup the most recent year which saves even more space since I'm using multiple files. Here is the real kicker though:

The simple query that took over 30 minutes now takes about 15 seconds.

Another example was using vertical partitioning. In this case there was a single table that was populated using data from multiple sources. There was a DTS job that populated the table which ran daily and took approx. 5-6 hours to run. Using vertical partitioning (meaning indexed views) I was able to create one table per data source and then join them with a schemabound view. Addionally I added many more datasources. The result:

The new DTS job completes in just over an hour.

The was due to the fact that I didn't have to pull down the data and do a lot of updates. Instead I could just truncate all the tables, pull in the data, and create my indexed view.

I highly recommend reading Kimberly's blog if you're not already and I would also suggest watching her TechEd sessions (if you have the DVD, if not you can buy it). She also has produced a webcast on indexes which you can watch for free and is also very good. There is lots of good info at her website as well.

 

Checking Checksum

Posted in Sql and Xml at Tuesday, December 07, 2004 2:18 AM Pacific Standard Time

I use checksum in SQL Server to distinguish between records that are different instead of comparing the character strings in them. My application was working fine until I added a lot of records and suddenly things started getting messy. After taking a look at it I determined the issue was that the checksums were being computed as being equal even though the columns had different values. Here is one example:

select checksum('where myval in (7004054,7004055)') a, checksum('where myval in (7003888,7003889)') b

  a b
1 1796206651 1796206651

 

Notice that the two values are the same even though the where clause is very different. There was an easy fix in my case though:

select checksum(N'where myval in (7004054,7004055)') a, checksum(N'where myval in (7003888,7003889)') b

  a b
1 1992021988 -375513627

So in this case I only had to change the variables I used to calculate the checksums from varchar to nvarchar and everything started working. This is going to force me to take a much closer look at my process though.

Uncle

Posted in Sql and Xml at Tuesday, December 07, 2004 1:52 AM Pacific Standard Time

If you've check the SqlXml.org website recently you may have noticed it has become very stale. This is due to the fact that I've been kind of overwhelmed with trying to manage the content and keep it up-to-date with the new developments in SqlXml. So, I'm saying uncle.

I'm looking for two or three people to help with the site's content. Before this happens I need to upgrade the site to support more categories and product versions so that it all makes sense. So if you would be interested in helping me design the new site, migrate content, and manage content let me know.

 

 

Getting it

Posted in General | ASP.Net/Web Services | Test-Driven Dev at Monday, December 06, 2004 4:09 AM Pacific Standard Time

Thanks to Brian Button, I am starting to get test driven development (TDD). TDD is a simple concept which is probably why it took so long for me to get it. I thought I understood it after reading through TTD in .Net. However, I think I only understood the concept of TDD, not how to actually implement it. For some reason my idea of TDD just didn't work very well in practice and I usually ended up neglecting my tests when I wrote code. However, thanks to Brian I feel that I'm getting it.

A few of the things that helped me get it:

As a sidenote, when I'm just starting off, I'll frequently put the test class and the application class in the same file for a while, until the classes get too big, at which time I'll extract them to their own files and deal with switching between buffers.

Ok so this is no big deal in theory, but in practice this made a big difference for me. I'm the type of developer who will not only create a seperate file for every class, I want to create a seperate project for my tests. KISS. I took this advice and suddenly getting started writing tests wasn't such a chore.

I know the implementation is really, really simple at this point, but I trust that I'll learn more very soon, and I'll be able to tell where to take it then.

This was the big learning point for me. I like to create complex implementations which tend to be hard to test. However, I learned that one of the most important aspects of TDD (at least for me) is to not even worry about the implementation. The implementation isn't the focus, it is that your code passes the tests (including the customer tests). Its that simple. This was hard for me because I like to come up with complex implementations and then I end up getting bogged down trying to figure out how to test them. The reality is I should come up with the tests first and then do the simpliest thing that works.

I think I'm starting to get it. :)

Read the whole series:

Enjoy!