Sunday, February 24, 2008

Using Windows Live Writer for Blogging

Some of you may have noticed my blog posts have actually increased as of late. Why? I used to use Blogger's online editor and the trouble I had with it really pushed me away from writing posts. I want my posts to look just the way I want, and the editor kept taking liberties with my visual formatting. SO FRUSTRATING!

So I posted the query to Twitter:
"I'm taking a poll: What is your favorite blog editor?"

Since then I've started using, you guessed it, Windows Live Writer.

So far I'm loving it, every post I've made matches the preview. Just like a WYSIWYG should. I've also started playing with the "Plug-ins."

I've recently added Insert Code Plug-in. Awesome! No more images of code for me. Here's a sample of what it does:

Inserting HTML Code (but I'm using XML):

<?xml version="1.0"?>
<configuration>
    <system.serviceModel>
        <services>

Inserting C#:

public static void SomeMethod(string someString)
{
Console.WriteLine(someString);
}

Inserting TSQL:

CREATE PROCEDURE someStoredProcedure
@someMsg varchar(256) = NULL
AS
BEGIN

I can only imagine what other tools will be coming out in the future. So for right now Windows Live Writer is for me.

Tuesday, February 19, 2008

Cincinnati Users Group and the Version Control Panel

Well I just finished up being part of the Source Control Panel at the Cincinnati Users Group.

I was very enjoyable. I think I did a fine job representing Subversion. Those of you that read my blog know that I got a good understanding of the system and methodology.

For those that are interested, I tend to tag allot of my research

Actually, I was quite surprised there weren't more questions about "Version Control Best Practices," "Branching Options," and "Database Versioning"

At the end there was much discussion about the "additional features" of TFS. I thought that was a bit unfair to SVN. SVN was designed to be nothing more then Version Control. Do one thing, and one thing well, right?

<PersonalOpinion>

Sure SVN doesn't have the "baked in" features like TFS does (and I'll admit TFS' integration is awesome) but with a few extra steps you can have work item tracking with trac. If you want Continual Integration you can always run CI Factory. If you want a better repo viewing experience you can install Fisheye. If you want code review you can run Crucible. With Subversion you have so many options.

Actually, I think being able to "choose" which tools you want to mix and match is a huge perk of using SVN. However, you do have to write the "glue" that holds it all together.

</PersonalOpinion>

All in all I had a really great time. There were a flurry of good questions and conversation. In the end, I just hope I helped someone learn something.

Remember,

Any version control is better then no version control.

P.S. If you have any additional questions about version control, ask away. I would be happy to address them.

Regular Expression Negation for Required Field Validators

Out of the box ASP.NET regular expression validators have the following behavior:

Does control value match regular expression? If yes validation passes, else validation fails.

But what if you wanted the following:

Does control value NOT match regular expression? If yes validation passes, else validation fails.

Turns out there is no "If expression not match" property on a regular expression validator. Now, you can make your own custom regular expression control, or you can buy a toolset. But it turns out you might be able to do it in your regular expression itself.

This can be accomplished by using something called a Negative lookahead assertion. It succeeds if the contained expression doesn't match at the current position in the string.

The syntax is

(?!&lt;value>)

For example, say you wanted to prevent users from using an email address that contained "@spam.com". You could use the following RegEx:

*@(?![Ss][Pp][Aa][Mm][.][Cc][Oo][Mm]$).*

Now your regular expression validator will pass if their value does NOT match the regular expression.

Regular Expression are extremely powerful, and I encourage everyone to learn about them. If you can master them, consider yourself a superhero.

Sunday, February 17, 2008

Visual Studio 2008 Tour and Install Party

This month (February 27, 2008 18:00) I'll be speaking at the Dayton .NET Developers Group about Visual Studio 2008 and .NET 3.5.

The official blub is:

Visual Studio 2008 and .NET 3.5 are soon to be released, after a very public and open beta process. We will run around the products, and discuss what the new features are. This will briefly cover VS, WCF, WF, C# and VB.NET features.

<RandomSideNote>
I'm actually filling in for Brian Prince, who was filling in for Jeff Blankenburg. Both of whom are very busy men. Being that I'm a single guy, with no kids, or pets I figured I could jump in and help out. People seemed to be excited about this upcoming meeting, I just couldn't let it be canceled.
</RandomSideNote>

Saturday, February 16, 2008

I'll be on the Source Control Panel on February 19, 2008 18:00

The Cincinnati User's Group (Cinnug) has asked me to be a part of the "Source Control Panel" they are having on Tuesday February 19, 2008 at 1800.

This meeting is different then those I've been in before. It's an open panel for group members to come and ask questions about VSS, TFS, Harvest, ClearCase, Vault and Subversion.

I'll be there primarily as a Subversion resource, but I'll try to fill in on VSS and TFS where I can.

Short notice I know, but if you're not doing anything Tuesday, come on down an heckle me. I think it's going to be a lot of fun.

Central Ohio Day of .NET - April 19, 2008

CentralOhioDoDNLogo_smallIt's that time again. Time for us developers to get together and geek out to the latest technology and see who's smarter. ;)

Day of .NET events are a series of mini-conferences organized by developers for developers. The event it FREE to to all.

Visit the event's homepage, and register today.

For those that have attended the Dayton Cincinnati Code Camps  of the past, this year we've included the Columbus .NET user group as well. Because "The Central Ohio Dayton Cincinnati Code Camp" was just to much to say, and CODCCC had just too many C's. The name has been changed to "Central Ohio Day of .NET", or CODODN. Ah, just better.

But seriously, becoming part of the Day of .NET events makes it easier for coders to find us, and helps coders find similar events going on in their areas.

CentralOhioDoDNBadge Though the name may be different, it's the same great event. So come, meet new people, share ideas, socialize, and maybe learn something too.

Wednesday, February 13, 2008

Getting a list of .NET exceptions with Resharper.

Often I'm programming C#.NET and want to throw an exception but I don't know what exception to throw. I think "wouldn't it be nice if there was an easy way to get a list of the exceptions in .NET?"

I've Googled, I've dug thru the MDSN, then it hit me...

DUH! Resharper's intellisense.

A simple "throw new" gives you:

2008-02-14_1858

 

And you can use the "Navigate from here to Base" feature to get a more detailed list.

Just type "System.Exception" and hit the Resharper 2.x shortcut: Ctrl + Alt + B

Navigate_To_Base

Tuesday, February 5, 2008

Parsing a URI / URL in C# and VB.NET

I used to spend time parsing a URL string using old fashion .NET string methods. (Contains, Split, Substring, IndexOf, etc). I always thought, "There must be a better way to do this."

And there is, there is a tool in the .NET Framework to help you parse a fully qualified URI path.

System.UriBuilder

A few simple lines of code

2008-02-06_0508

Does a lot of the work for us.

2008-02-06_0507 

And this is just one of the Uri tools. I encourage you to look at the others as well.

  • System.Uri
  • System.UriComponents
  • System.UriFormat
  • System.UriHostNameType
  • System.UriIdnScope
  • System.UriKind
  • System.UriParser
  • System.UriPartial
  • System.UriTypeConverter