Thursday, April 30, 2009

Today has been long. I've been trying to figure out why on earth my Remote Debugger wouldn't run. I had the Remote Debugging Monitor set up correctly on both machines, but I kept getting an error message about DCOM:

"Unable to start debugging on the web server. The Visual Studio Remote Debugger on the target computer cannot connect back to this computer. A firewall may be preventing communication via DCOM to the local computer."

Come to find out, not only could VS Remote Debugger not access my local computer, I couldn't even ping myself from the server.

I spent most of the day playing with firewall and IPSec policies, until I stumbled on THIS forum post.

Come to find out, Windows Live OneCare has its own firewall configuration settings. Once you track this down, John Robbins provides all of the basic exceptions needed in the firewall:

Microsoft Visual Studio Remote Debugger - UDP 137

Microsoft Visual Studio Remote Debugger - UDP 138

Microsoft Visual Studio Remote Debugger - TCP 139

Microsoft Visual Studio Remote Debugger - TCP 445

Finally, you may need to set a DCOM exception as listed HERE:

Microsoft Visual Studio Remote Debugger - DCOM - TCP 135

Once all of this is done, you should be good to go for internal pingage and Remote Debugging.

Tuesday, April 21, 2009

So I wrote my first Linq to Entity Framework query today. Took a little bit of research to really understand what was happening, but here goes my explanation:

using (DataBase db = new DataBase()) // Relatively obvious... This sets up the data connection.
{
//var letters = db.Receipt_View; // A custom MSSQL View based on some tables with key info

// Next we set up an IQueryable object
// Note that you COULD do this with a 'var' object, but since I'm still learning I wanted to do it the 'hard way'
IQueryable rpQueryable = from e in db.Receipt_View
where e.OrderID == orderID
select e;

// Move the selected records into a List for processing
List rpvi_Receipt_Views = rpQueryable.ToList();

// Pass them to the necessary methods to do their job
CreateAddressBlock(rpvi_Receipt_Views[0]);
CreateGreeting();
HotelBlock();
}


Give it a shot. I'll never go back to ADO Legacy... Entity Framework all the way!!!

Sunday, April 19, 2009

So I decided today that I would knock out two birds with one stone:

  1. Get started using Test Driven Development so that I can learn how to use it in an upcoming project
  2. Start earning "street cred" by solving the Euler Project puzzles.
I've been putting off TDD due to fear, consternation, and general trepidation related to trying something new. After all, the old way was working, right? Plus, how to choose between nUnit, mbUnit, MSTest, etc. In the end, it came down to just looking at the framework documentation. mbUnit had an easy way to compare the values inside a list, and that made sense to me.

I went over to http://www.gallio.org/ and downloaded the installation package, and off I went. I thought about using TestDriven.Net, but decided to start off simple and work my way up.

My first project on Euler was simple. All I had to do was find the sum of the multiples of 3 & 5 below 1000.

At the risk of giving away the plot, I have included my code below:

public int GetSum()
{
List NaturalNumbers = new List();
for (double d = 1; d < 1000; d++)
{
if (d % 3 == 0 || d % 5 == 0)
{
NaturalNumbers.Add(d);
}
}
return Convert.ToInt32(NaturalNumbers.Sum());
}


Honestly, if that's a huge plot spoiler, you need to be doing something a little differently...

I am proud to say I did this completely Test Driven. I started with a failing test (i.e. Assert.AreEqual(0,1)) and slowly it morphed into a passing test. Along the way, I found the Assert.AreElementsEqual(List1, List2) to be invaluable.

Impressions thus far?
  • mbUnit is startlingly easy to use. The support for List (not provided in MSTest) was without a doubt a REQUIREMENT for the project I was doing.
  • TDD in general is nowhere near as scary as I first thought
  • The speed for compiling and running tests in VS 2008 was a little dissappointing. Considering that most of my tests were simple arithmetic, I would have liked to see some snappier performance from the test framework. When I ran the finished product it completed in under 1 second. The test run was closer to 30 seconds.
I will continue to discuss my experiences, perhaps even provide a few tutorial examples, since there seems to be a dearth of them currently (one of my biggest reasons for being nervous about the whole thing).

Friday, April 17, 2009

Yesterday was the April meeting for North Houston .Net User's Group.
Tony Champion introduced us to the benefits of developing Rich Internet Applications in Silverlight 3.

While I haven't done any SL3 applications in the past myself, his demos showed a remarkably robust data-driven form application that he wrote using Entity Framework and Silverlight, and it only took about 45 minutes.

I'm looking forward to playing with it some myself, but the limitations on Search Engine Optimization will probably keep me from rolling it out in a production environment for a while.

In other news, I hear that Houston Tech Fest will be on the schedule soon. Awesome!

Tuesday, April 14, 2009

Tonight is the April meeting for Alt.Net Houston.
We will be meeting at Star City Pizza down on 59 and Shephard.
Be there at 6PM!

Saturday, April 11, 2009

Mohammed Azam, from High On Coding, recorded the following podcast during the Houston Alt.Net Open Spaces Conference, April 3-5.

Podcast: Houston ALT.NET Open Spaces Why Blog and Open Source?

Friday, April 10, 2009

Software quality refers to a number of standards, from functionality (does it perform as expected) to performance (does it perform as QUICKLY as expected). When considering quality from the development perspective, the question "Does it work" is only the tip of the iceberg. For instance, in writing a base "Hello World" application, there are a number of ways to build, parse, and display a string to a monitor. However, if the code is difficult to read, difficult to repeat, or requires excessive configuration on the client computer, then even though it "works", it is not high quality. Examples of low-quality, working code abound, especially on http://thedailywtf.com/.

I have been researching Test Driven Development over the past few months, and I am finding that one a major predictor of final quality is continuous testing and refactoring as a project is in development. The theory behind test driven development (as defined at http://www.agiledata.org/essays/tdd.html) is that when you write a test before you begin coding, you will code only enough to pass the test.

The test-first methodology prevents the developer from adding code just because "I might need this feature later." According to the Extreme Programming wiki (http://c2.com/cgi/wiki?YouArentGonnaNeedIt), "You Aren't Going To Need It!"

In my own software, I have ignored these principles in the past to my own detriment. NDA's prevent me from going into specifics, but I have had to redesign whole sections of code because the original vision changed for a function by the time I was truly ready to implement it. Had I simply stubbed out the method, I could have come back later without impacting other classes and methods.

Further Reading:

http://c2.com/cgi/wiki?YouArentGonnaNeedIt

http://thedailywtf.com/

http://www.agiledata.org/essays/tdd.html

http://www.ibm.com/developerworks/java/library/j-eaed2/index.html

http://msdn.microsoft.com/en-us/magazine/cc163982.aspx

While using MS Expression Web, I received an error stating "This element is not allowed to be self closing in the current schema. Remove the closing slash."

I had never seen that error before, and went hunting for the root cause.

Enter this nifty post that explains WHY self-closing elements could be bad:
http://stackoverflow.com/questions/348736/xhtml-is-writing-self-closing-tags-for-elements-not-traditionally-empty-bad-pra/348818#348818

Monday, April 6, 2009

Interesting post from CodeThinked: Top Ten C# Keywords to avoid

I will have to mull this one over. I suspect I use the "out" keyword more often than I ought to. I think I agree, however, with the multiple comments reminding the reader that these are keywords to "avoid", not drop out of the language entirely. In Justin's words:

"Sure there are times when you need it, but as with almost anything, you better be able to explain to me exactly why you need it"
What do you think?

Sunday, April 5, 2009

Need to change all the table schemas at one time? In my case, the default schema in the early run through DB design was the username (i.e. username.tablename)

Obviously, this has caused problems down the road.

Here's a fairly simple fix that will work in SQL Server 2005 or SQL Server 2008:
exec sp_MSforeachtable "ALTER SCHEMA newTableSchema TRANSFER ? PRINT '? modified' "

Hope it helps!

Thursday, April 2, 2009

Installing FrontPage Server Extensions (FPSE) for Windows 2008 and IIS 7

Installing the FPSE under IIS 7 can be tricky, in fact I spent most of the morning trying to wrestle it down. Hopefully, this article can shed some light.

Finding FrontPage Server Extensions

This is the easy part. When Microsoft discontinued support for FrontPage extensions, Ready-to-Run software picked it up and is continuing to make it available here: http://www.rtr.com/fpse/

Installing FPSE

Again, this part is easy. Download the extensions, and run the program. May require a reboot.

Configuring your system

Here's the fun part. Configuring IIS 7 for FrontPage extenstions is a multi-step process:

  1. Extend the virtual server
    1. Go to Start à Administrative Tools à Microsoft SharePoint Administrator
    2. Enter your user name and password
    3. Under the "Virtual Servers" click the "Extend" link for the server you wish to extend
  2. Enable Windows Authentication in IIS 7
    1. Go to Start à Administrative Tools à IIS 7
    2. On the left pane, select your site
    3. In the middle pane, double click "Authentication"
    4. In the middle pane, right click on "Basic Authentication" and select "Enable" from the context menu
    5. In the middle pane, right click on "Windows Authentication" and select "Enable" from the context menu
  3. You should be able to open the site administration from Start à Administrative Tools à Microsoft SharePoint Administrator at this time.

Geez, it doesn't sound so complicated now that I look back at it. Hope this helps someone!!!