Wednesday, March 07, 2012 1:13:49 AM
I dig SSMS 2010 (SQL Server Management Studio) and I use it religiously. But one thing that has always bugged me about the Solution Explorer is that it sorts items in the Queries folder by the order in which they are added (i.e. the most recently added item is always first in the list).
So to remedy this shortcoming, I present to you SsmsSort.
It's a simple Console application that you can run as an external tool in SSMS. Configure the tool as follows:

The Command field should point to the executable, SsmsSort.exe. In the screen capture above, I set the directory to the bin/Release folder of the SsmsSort .NET project.
After you add the External Tool, you'll have a new entry in the Tools menu called SsmsSort. Select that menu item to run the application against your project file.
SsmsSort outputs messages to the SSMS Output window (note that "Use Output window" is selected in the External tools dialog). Refer to the Output window for any errors.
I included the entire project so you can modify it however you wish.
Friday, February 03, 2012 5:10:04 PM
If you're using Azure to host your project and using Team Foundation Server to control the Azure deployment project's source, you might run into an issue where you get a build error saying that ServiceDefinition.csdef and ServiceDefinition.build.csdef cannot be written to because of a lack of permissions to access those files.
The problem is that once it's checked in to TFS, a read-only attribute gets placed on those files. The build process wants to write to those files during the build and cannot because of the -R attribute.
If you run into this, place a pre- and post-build event to handle the attribute:

These events will remove the read-only attribute, build the project, then add the read-only attribute. Problem solved!
Saturday, December 17, 2011 3:14:09 PM
I use L337 from time-to-time for my passwords. Whereas it makes for a strong password, it's sometimes a real pain in the butt to type in L337. So to make things a little easier, I created a Windows Sidebar Gadget to convert plain text to L337 for use in passwords.

You can download the project here.
To make a Gadget package, simply zip the project files (minus the Properties, bin, & obj folders and the *.csproj* files) and rename the extension to ".gadget". I included a Gadget installation package in the solution folder.
Enjoy!
Tuesday, September 13, 2011 4:01:47 PM
I've been using Reactive-Extensions quite a lot on the applications I've been building recently. We're supposed to see some pretty cool stuff for async programming in the next version of the .NET framework, too. It definitely cleans up the code and makes things easier to maintain.
Sunday, September 11, 2011 12:24:11 AM
GoDaddy pissed me off for the last time so I took my business elsewhere. The bad service... The constant barrage of pushy sales efforts... The crappy, slow administrative UI... The elephant...
I'm done! Buh-Bye, GoDaddy.
Tuesday, August 02, 2011 9:30:14 AM
Pair this with the next round of processors due to be released at the beginning of next year (higher speed, lower power consumption) and things are going to get a LOT more interesting.
Saturday, April 09, 2011 1:19:02 PM
SocialPush (formerly WebPush) is drawing the attention of some pretty serious people. I'll keep you posted but it looks like the past 2 months may pay off after all. Hydra is coming along nicely, too, and has some of the same people chomping at the bit.
I know I've been quiet lately and I hope to be back to a normal schedule soon.
Sunday, February 27, 2011 9:33:00 PM
Code generation has spoiled me. I'm having a helluva time getting a hand-crafted DomainService written. While editing my custom User (see my previous post), I got the following:
This EntitySet of type 'User' does not support the 'Edit' operation.
Wow. Really? Awesome.
In order for an EntitySet to support the 'Edit' operation, it must have the appropriate CUD (Create/Update/Delete) methods implemented. Adding the following solved the problem:
[Update]
public void UpdateUser(User user)
{
}
[Delete]
public void DeleteUser(User user)
{
}
This allows the DomainContextEntityContainer to create the EntitySet with EntitySetOperations.All which will open up the Entity for editing.
I hope that keeps someone else from wasting as much time as I just did!
Sunday, February 27, 2011 4:23:26 PM
It's little quirks like this that are bringing me to the edge of insanity. I just spent the past 2 hours trying to figure out why my custom Entity object wasn't showing up in my Silverlight client from its RIA DomainService. Here's what the DomainService looks like:
[EnableClientAccess()]
public class SecurityService : DomainService
{
public String GetUserName()
{
return HttpContext.Current.User.Identity.Name;
}
public Boolean IsInRole(String roleName)
{
return HttpContext.Current.User.IsInRole(roleName);
}
}
I added a User class to aggregate some simple data that was scattered out across several of my data abstraction objects which RIA Services couldn't access (mainly because of some self-referencing objects that require recursion - something that generated services don't like very much). Here's what the custom EntityFramework class looks like:
public class User
{
public User() { }
[Key]
[Required(ErrorMessage = "Email is required")]
public String Email { get; set; }
[Required(ErrorMessage = "Password is required")]
public String Password { get; set; }
[Required(ErrorMessage = "Security Question is required")]
public String SecurityQuestion { get; set; }
[Required(ErrorMessage = "Security Answer is required")]
public String SecurityAnswer { get; set; }
[Required(ErrorMessage = "Role is required")]
public String Role { get; set; }
[Required(ErrorMessage = "Company Id is required")]
public Int32 CompanyId { get; set; }
public String Status { get; set; }
}
Next I added a method that takes the User object as a parameter like so:
[Insert]
public void CreateUser(User user)
{
MembershipCreateStatus status;
Membership.CreateUser(user.Email, user.Password, user.Email, user.SecurityQuestion, user.SecurityAnswer, true, out status);
switch (status)
{
case MembershipCreateStatus.Success:
user.Status = "The user account was successfully created!";
break;
case MembershipCreateStatus.DuplicateUserName:
user.Status = "There already exists a user with this username.";
break;
case MembershipCreateStatus.DuplicateEmail:
user.Status = "There already exists a user with this email address.";
break;
case MembershipCreateStatus.InvalidEmail:
user.Status = "There email address you provided in invalid.";
break;
case MembershipCreateStatus.InvalidAnswer:
user.Status = "There security answer was invalid.";
break;
case MembershipCreateStatus.InvalidPassword:
user.Status = "The password you provided is invalid.";
break;
default:
user.Status = "There was an unknown error; the user account was not created.";
break;
}
}
After compiling, I got the dreaded "Parameter types must be an entity type or one of the predefined serializable types" error.
I tried adding data annotation attributes to the User class. Nothing. Then I prayed to the code gods. Nothing again.
Come to find out, RIA Services won't generate an entity type on the client until it's returned in a service call. After I added the following, everything showed up as expected:
[Query(IsComposable = false)]
public User GetUser()
{
return new User();
}
Hopefully this will help someone else...
Friday, February 11, 2011 2:03:59 PM
One of the things that has always bugged me about SQL Server was a lack of integration with a source control provider (especially Team Foundation Server - TFS). When developing on my local machine, I like to use source control more as version tracking than anything else. But when it has come to SQL, I have had to resort to saving the files to my hard drive and manually put them into source control; I've never found anything that would allow me to keep a change history from the SQL Management Studio IDE. Until now...
http://visualstudiogallery.msdn.microsoft.com/bce06506-be38-47a1-9f29-d3937d3d88d6/
This was evidently available for TFS 2005, too, but I somehow missed it. The above link will get you the 2010 version.
To get it to work, you need to create a Project in SQL Management Studio and, upon creation (although you can also add it to source control later), specify that you want the project under source control. After the project is created and added to the TFS database, you'll want to add a connection by right-clicking on the Connection folder and specify the connection. Then either double-click on the new connection or right-click on the Queries folder and add a new query. From there you can create your SQL statement and then check it in just like from the Visual Studio IDE. The project will also show up in Visual Studio and you can edit the files from there, too. Slick!