Microsoft Most Valuable Professional

Chris Pietschmann

An MVP From Wisconsin

Proposed DotNetKicks Redesign!

The current skin of DotNetKicks just isn't quite there. It doesn't look as cool as it could. And I'm sure it's just because the time hasn't been spent to make it look good. So, I thought I'd put together a mockup design that is based off the current design, but with some improvements. I like it, but the test is if any of you like it too. Let me know what you think.

Current DotNetKicks:

Original DotNetKicks Skin

Proposed Redsign for DotNetKicks:

Download:
View Larger Image
Paint.NET .PDN File

By the way, the font I used is Trebuchet MS, its the same font that BlogEngine.NET uses.

If the decision gets made to change to this skin, I'll volunteer some time to help implement it. Let me know.

Update 2007/9/29: Thanks for all the feedback, here and on DNK! I didn't really think my design would get implemented; I pretty much did it to maybe inspire those with more graphic skills to come up with something better than the current design.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Categories: General
Posted by crpietschmann on Friday, September 28, 2007 8:51 PM
Permalink | Comments (6) | Post RSSRSS comment feed


Top posts of all time as of 2007/9/27

Here's a list of my top blog posts of all time. I really would rather the MSN WebMessenger and Homestarrunner ones weren't in the list, but sometimes you just strike a chord of what regular people (non-programmers) search for.

Top 10 posts of all time by total number of page views:

69,629 - MSN WebMessenger
65,769 - ASP.NET 2.0: URL Mapping with RegEx Support
26,319 - Homestarruner.com - pretty cool toons
23,197 - I now have my key for Vista Ultimate
18,614 - WinXP SP2 limites max. number of TCP connections/second
15,136 - URL Mapping for ASP.NET 1.1
12,939 - JavaScript Loop through all elements in a form
12,895 - ASP.NET 2.0: Place JavaScript inside the Page.Header
12,839 - C# .NET: Convert System.Drawing.Color to HTML color

Top 10 posts of all time by total number of Comments:

28 - ASP.NET 2.0: URL Mapping with RegEx Support
21 - Homestarruner.com - pretty cool toons
14 - ASP.NET 2.0: Use VB.NET and C# within the App_Code folder
13 - Windows Vista Device Drivers for Belkin F5D7000 Wireless Network Card
11 - ASP.NET: Extend BoundField Control - Add MultiLine Support
11 - ASP.NET 2.0: How to get a specific ConnectionString from the Web.Config by name
11 - ASP.NET 2.0: Client Callbacks inside a User Control
10 - Vista Experience Update: Windows Vista x64 runs 32-bt Internet Explorer by Default
10 - Configure Visual Studio 2005 for "Classic" ASP syntax highlighting and intellisense
9 - ASP.NET Forums is gone and Community Server's not free

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Categories: General
Posted by crpietschmann on Thursday, September 27, 2007 1:43 PM
Permalink | Comments (0) | Post RSSRSS comment feed


Patterns: Fluent Interface - make your code easier to read

I never heard of the Fluent Interface pattern until I saw Randy Patterson's blog post titled "How to design a Fluent Interface". When I first saw the title of the post I thought he was talking about design a user interface, but upon further inspection I found out that using the Fluent Interface pattern in your code will make it easier to read.

Randy posts an example of how to use the Fluent Interface pattern, but I thought I would also write up a short example. My example below shows how to implement a small class to generate Sql scripts using the Fluent Interface pattern.

Example Usage:

SQLQuery sql = new SQLQuery();
sql.Select(
"Id").Select("FirstName").Select("LastName").From("Person").Where("Id = 1").Where("FirstName = 'Chris'").OrderBy("LastName").OrderBy("FirstName");

/// Get the string representation of our Sql query
string strSqlString = sql.ToString();

Console.WriteLine(strSqlString);

Code for the SQLQuery class:

public class SQLQuery
{
private ArrayList _SelectItems = new ArrayList();
private ArrayList _WhereItems = new ArrayList();
private ArrayList _OrderByItems = new ArrayList();
private string _FromTable = null;

public SQLQuery Select(string select)
{
_SelectItems.Add(select);
return this;
}

public SQLQuery From(string from)
{
_FromTable = from;
return this;
}

public SQLQuery Where(string where)
{
_WhereItems.Add(where);
return this;
}

public SQLQuery OrderBy(string orderby)
{
_OrderByItems.Add(orderby);
return this;
}

public override string ToString()
{
StringBuilder sb = new StringBuilder();

sb.Append(
"SELECT ");
for(int i = 0; i < _SelectItems.Count; i++)
sb.Append(_SelectItems[i] + ((i == _SelectItems.Count - 1) ?
" " : ", "));

sb.Append(
"FROM ");
sb.Append(_FromTable);

sb.Append(
" WHERE ");
for(int i = 0; i < _WhereItems.Count; i++)
sb.Append(_WhereItems[i] + ((i == _WhereItems.Count - 1) ?
" " : " AND "));

sb.Append(
"ORDER BY ");
for(int i = 0; i < _OrderByItems.Count; i++)
sb.Append(_OrderByItems[i] + ((i == _OrderByItems.Count - 1) ?
" " : ", "));

return sb.ToString();
}
}

Conclusion

As you can see the Fluent Interface pattern is rather simple to implement and it can really make your code easier to read. 

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Categories: General
Posted by crpietschmann on Thursday, September 27, 2007 12:32 PM
Permalink | Comments (3) | Post RSSRSS comment feed


Links - 2007-09-26

Here's a ton of links to articles and stuff that I've come across. Included are some links that I marked as favorite within IE and just haven't seemed to go back to, 'till today. It's probably link overload, but hopefully you find some of it usefull.

ASP.NET

A Boilerplate HttpHandler - Scott Hanselman
Dynamically resize uploaded images & save in PNG format - Anil Radhakrishna
Making sense of ASP.NET Paths - Rick Strahl
Rendering ASP.NET Controls Out of Place - Dave Reed
Make Your ASP.NET Application Extendible - Mads Kristensen
ASP.NET Caching Basics - Peter A Bromberg
File Upload with ASP.NET - Konstantin Vasserman
Tip/Trick: Url Rewriting with ASP.NET - Scott Guthrie
Work with If-Modified-Since and Last-Modified in ASP.NET 
Microsoft ASP.NET 2.0 Member/Role Management with IIS, Part 2: Implementation 
Building Wiki Web Sites with ASP.NET and SQL Server

AJAX

IScriptControl Tutorial - Adding Client Capabilities to a Web Server Control by Using ASP.NET AJAX Extensions
ASP.NET AJAX RC and ScriptControls - Paul Glavich
Google Ajax Search API - Put Google Search on Your Own Web Site

.NET

Using SingleTagSectionHandler Instead of appSettings - Michal Talaga
Resize Image in C# - Peter Provost
How To: Reading and Writing Text Files - Joe Mayo
Save a Stream to a File - James Crowley
100% .NET component for rendering PDF documents

Vista

Gadget Development Overview
HOW TO make a Windows Vista Auxiliary Display - Phillip Torrone
Building a Windows Vista Email Gadget using the .NET Framework

Business

WorldWideWeb WarGames: 8 Ways a Competitor Can Sabotage Your Site
2007 Wisconsin Entrepreneur Toolkit

Link Blogs

Interesting Finds: September 26, 2007 - Jason Haley

SQL Server

Optimizing Conditional WHERE Clauses: Avoiding ORs and CASE Expressions - Jeff Smith
SQL Server 2000 Data Types - MSDN

Other Stuff

My Nerdian Archetype - Gerry Heidenreich

Tools

PayPal IPN Script Testing Environment - Use this when the PayPal Sandbox IPN is down like it was the last couple days
ImgBurn - a lightweight CD /DVD / HD DVD / Blu-ray burning application
Multi Meter Dual Core v1.20 Windows Vista Sidebar Gadget
- Shows your Processor load (for dual core machines) and Memory usage using meter bars. I've actually been using this since about March '07.

Games

Play SimCity Classic Online!

Device Drivers

Realtek AC'97 Audio Drivers for Vista 32-bit and 64-bit

Blogs

Infinities Loop - ASP.NET and .NET From a New Perspective

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Categories: General
Posted by crpietschmann on Wednesday, September 26, 2007 10:44 PM
Permalink | Comments (0) | Post RSSRSS comment feed

JavaScript: Add Search Engine Keyword Highlight Support to your site with ease

When looking at the source code for the BlogEngine.NET project, I noticed that they are implementing some javascript to highlight search engine keywords. What happens is when a user searches (using Google, Yahoo, MSN, etc.) and then clicks through to your site, this javascript then highlights any words on the page that match the keywords they are search for. This isn't critical functionality to add to a site, but it sure helps in making your site much more user friendly by allowing them to more easily find what they are searching for.

The script they implemented in BlogEngine.NET is called se-hilite. The current version has support for all the major search engines and browsers, and this script is pretty mature having been around since June 2004. It is also fairly easy to implement, all you have to do is add a CSS class named hilite to your CSS file, and then add a javascript include to the se-hilite.js file to your page.

My blog is implemented with ASP.NET 2.0, so to include the se-hilite.js file in my entire site I just added the following line to the load event of my master page:

ScriptManager.RegisterClientScriptInclude(this.Page, this.GetType(), "se_hilite", VirtualPathUtility.ToAbsolute("~/js/se_hilite.js"));

I just implemented this on my blog, so I hope all you who come here from the search engines enjoy!

Currently rated 1.0 by 1 people

  • Currently 1/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Categories: General
Posted by crpietschmann on Monday, September 24, 2007 2:01 PM
Permalink | Comments (0) | Post RSSRSS comment feed

ASP.NET Forums is gone and Community Server's not free

What happened to the download links for ASP.NET Forums on the www.asp.net website? As soon as Community Server 1.0 came out the links disapearred. I didn't really think of it at the time, but now that I want to set up a Forum I would like the old ASP.NET Forums.

Why not Community Server?

Well, the reason I don't want to use Community Server is because the licenses keep getting more restrictive with the release of each new version. I just looked at the CommunityServer.org website and it doesn't even look like there is a free version anymore. The cheapest version is the Personal Edition and it costs $99!

What am I to do?

Well, I've actually decided to code my own forums, and the real reason I was looking for the old ASP.NET Forums code was to use it as a reference. All I could find is actually the Mono ASP.NET Forums; which was actually started by using the ASP.NET Forums as it's base. I'm going to use the Mono ASP.NET Forums as a reference and take some pointers from the BlogEngine.NET project (the provider based data access), along with taking into account any tips that I've learned over the years of working with ASP.NET 1.x/2.0.

Also, if anyone has the old ASP.NET Forums 1.0 or 1.1 code sitting on a backup disc somewhere, could you please let me know? I'll put it up here so others can get it.

Well, just in case you're wondering, I'm thinking about making the code for the forums that I build available, but no promises.

Updated 9/24/2007: Apparently, I wasn't completely accurate in assuming that the Express Edition of Community Server is no more. It is still available, but the page explaining its terms and license isn't linked on the "Get it Now" page along with all the others. You can find it here: http://get.communityserver.org/Express.aspx

This still doesn't alleviate my concern that the good old ASP.NET Forums has dissapeared. But, it has been pointed out in the comments that the old ASP.NET Forums 1.0 has been put up here: http://rapidshare.com/files/57303689/aspnetforum.rar.html

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Categories: General
Posted by crpietschmann on Friday, September 21, 2007 11:50 AM
Permalink | Comments (13) | Post RSSRSS comment feed

Parallel FX Library: Optimize your code for Multi-Core machines

I was reading the October 2007 edition of MSDN Magazine and came across an article titled "Parallel Performance: Optimize Managed Code For Multi-Core Machines." At first I thought that this was just another article explaining how to use the ThreadPool in .NET to improve the performance of you app, but they are actually talking about the new Parallel FX Library that is about to reach its first CTP.

What is this Parallel FX Library?

Simple... It's a .NET library that is designed to make is much easier to optimize .NET applications to utilize multiple processor cores automatically if they are available. If you run on a single core system, it'll just run on one core. But, if you run on an 8 core system, it'll utilize all 8 cores to get things done.

How does it work?

There are a few different things explained in the article that you can do, but the one that sticks out the most too me is Parallel.For. The reason I find it so interesting is because of its simplicity to use.

Take a normal For loop in C#:

for (int i = 0; i < 100; i++) {
   a[i] = a[i] * a[i];
}

Now the optimized version using Parallel FX:

Parallel.For(0, 100, delagate(int i) {
   a[i] = a[i] * a[i];
});

Now isn't that simple to do? The Parallel.For does all the optimizations for you to spawn off multiple threads (one per cpu core) to do parallelize the work and get it done as fast as possible. Remember, when running on a single core system, the Parallel.For wont give you any performance boost, but when you run on a 2 or more core system the benefit just scales with the number of cores.

Could I inadvertently decrease performance?

Yes, you must keep in mind what tasks can be run in parallel or you could render some of your optimizations meaningless.

Look at the following nested Parallel.For:

Parallel.For(0, 100, deleagate(int a) {
   Parallel.For(0, 100, delegate(int b) {
      result[a, b] = 0;
      for (int c = 0; c < 100; c++) {
         result[a,b] += a1[a,c] * a2[b,c];
      }
   });
});

Even though the above code will still run, you are making the nested Parallel.For meaningless since it cannot be correctly multi-threaded since the machine probably doesn't have enough cores to run every iteration of this matrix in parallel. Another reason that the nested iterations wont multi-thread properly is because they are very dependant on the outer Parallel.For to run. There is also the hit on memory (however very small) that you incur by uing Delegates

What are the requirements?

It requires the .NET Framework 3.5 or higher. I don't know when it's to be released, the first CTP isn't even yet available. The article did state that it's expected in Fall '07.

How do I find out more?

Well, you can read the article in the October 2007 edition of MSDN Magazine (I would have posted a link to it here, but I could find the link since it's not October yet.) Otherwise, good luck searching for information. The reason I decided to post about it is actually because I tried searching on google and the only information I could find was the hard copy of MSDN Magazine sitting in front of me.

I really encourage anyone interested in reading more about the Parallel FX Library to go read the MSDN article, since I've only summarized a small part of it (it's actually 7 pages long.)

Updated 9/17/2007 - The article has since becom available online, so I've put the link within the article where appropriate. http://msdn.microsoft.com/msdnmag/issues/07/10/Futures/default.aspx

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Categories: General
Posted by crpietschmann on Wednesday, September 12, 2007 11:43 AM
Permalink | Comments (1) | Post RSSRSS comment feed

Weekly Links - 2007-09-07

C# - Generics
C# Generics, Part 2/4: Constraints, Members, Operators - Patrick Smacchia

C# Multi-Type Generic Constraints - Adam Esterline

C# 2.0 Constraints on Generic Types - Dan Vallejo

ASP.NET 2.0
Creating a Custom ASP.NET Profile Provider - Shawn Wildermuth

Misc.
25 steps for building a Micro-ISV - Leon Bambrick

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Categories: General
Posted by crpietschmann on Friday, September 07, 2007 6:18 PM
Permalink | Comments (0) | Post RSSRSS comment feed

About the author

I'm Chris Pietschmann, go to the About Me page to learn more about me.

Search

Sponsors

Web.Maps.VE - ASP.NET AJAX Virtual Earth Mapping Server Control

Recent comments

Disclaimer


This work is licensed under a Creative Commons Attribution 3.0 United States License, unless explicitly stated otherwise within the posted content.
© Copyright 2004 - 2008 Chris Pietschmann