Steve Holstad's "the bright lights"

"Just because your voice reaches halfway around the world doesn't mean you are wiser than when it reached only to the end of the bar." - Edward R. Murrow
in

January 2006 - Posts

IE 7 XMLHttp supported
I just read a blog post from Sunava Dutta, a PM on MSFTs IE team:
 
IE 7 will support a scriptable version of XMLHttp, which will allow AJAX functionality even if users/companies have disabled ActiveX.  I'm all for any developments from IE that begin to bridge the gap towards browser compatibility...although we're a long way off.
 
I'd like to hear if anyone sees a realistic migration toward this, or do you think most will stick with IE dependent MSXML?
 
 
 
Sunava's example of how to support both XMLHttp objects and legacy activeX browsers (not earth shattering, but I thought I'd throw it up here for anyone who hasn't done this)

if (window.XMLHttpRequest){

          // If IE7, Mozilla, Safari, etc: Use native object
          var xmlHttp = new XMLHttpRequest()

}
else
{
if (window.ActiveXObject){

          // ...otherwise, use the ActiveX control for IE5.x and IE6
          var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
          }

}

Cheaters vs. Repeaters

I've always been interested in discussions involving how to best transfer knowledge to younger generations of students, and today I saw this post on TechDirt, and I think its one of the more interesting blog debates I've read in awhile.

The WSJ posted this article regarding whether or not middle school students should be allowed access to online resources during exams, and how this affects the learning process.

I know when I was in school, up until and even including high school I was required to basically memorize and regurgitate information...helping me understand structured topics but often failing to prepare me for the real world. College took a much better swipe at this, but in reality the problems thrown at us, regardless how subjective, really boiled down to applying certain strategies that had been laid out during basic classroom texts and lectures. How many times in a project have you said to yourself, "Man, I didn't learn anything in school that prepared me for this"? But I'd bet you solved the problem anyway, because you've learned how to learn.

I completely understand anyone arguing what I'm calling the 'parental' view, meaning that schools should provide a basic set of facts and lessons for children to learn, thereby gradually enhancing their ability to problem solve on their own, and to sort out valuable information from a wealth of biased, unorganized or incorrect data (ex: the web)

The other side of this argument is that if people are faced with problems in everday life that don't always have binary answers, why not expose them to this method of problem solving as early as possible? I know that in my work, if I'm stumped by something I'm asking my colleagues, searching MSDN, Books Online, Google, etc.. Does it benefit me, my company, or my client in proving that I didn't memorize enough C# last year, and now I'm stuck? Of course not.

Personally, I'm all for giving students access to as much information as possible. Write the tests to be harder, more subjective, and require a more rounded understanding of a topic in order to answer intelligently. Kids are going to have more and more access to this information, so let's embrace it and apply it towards their education instead of attempting to limit access. They'll find it anyway.

asp.net 2.0 starter kits and design templates

Once you've gotten used to the basics of asp.net 2.0, I'd recommend checking out the latest templates available from Microsoft: Design Templates

Microsoft offers 4 starter kits and 5 XHTML templates, all of which help to provide examples of how to write accessible, compliant web sites utilizing the best of asp.net 2.0 controls, such as the tree view, grid view, site map path, etc. I've installed almost all of these kits on my laptop, and had working example sites up within minutes. The kits utilize SQL Express 2005, making setup a snap. All this was fine and good, but who wants to build a new site with new technology, only to find you are boxed into a dev environment? After my dog grew bored of it, I knew I had to publish this to the web.

I've used discountASP.com as my web host for the last three years, and they are always among the best at adapting young technologies. I signed up for a shared SQL 2005 account, and installed my site to a virtual directory there. ....Notice the shameless plug for my Calvin account...true "Calvinism" <g>

The 'Personal' starter kit uses the new Profile feature, which stores user preferences in a personalization database table. When the user returns, the preferred theme & page are defaulted, making everyone feel right at home. This is just too great of a feature to disable, so it was time to hook up to SQL 2005. I'll be writing about how I accomplished this in the coming days... if you're struggling with switching from SQL Express 2005 to a full, shared SQL 2005 on a web host, don't despair.

Check out these design examples, I guarantee you'll be inspired by one of them to create something sweet. I can't wait to find some time to begin creating my own themes. I like leaves, coffee and soap as much as the next guy, but dang. :-)

Here's my initial site, with the default themes & layout. I'll update the content soon.

ASP.NET 2.0 Web Parts Portal - Part 1 - The Basics
Portal sites are created to provide the ultimate in flexibility and personalization. Whether for a company intranet or a public website, this type of site allows administrators or users to quickly customize what and where content is displayed by adding, removing, and drag-and-drop relocating web parts. For this blog series, I'll be creating a portal website using .NET web parts, and I'll walk you through the steps required to create your own web parts enabled site.

PART 1: Set up the basics

Create a new ASP.NET web project. I'll place mine at C:\Inetpub\wwwroot\ThePortal. Most web part pages are held together using basic HTML tables. I'll add a 2 x 4 table via the Layout --> Insert Table. Viewing source, I'll remove the bottom right cell and add a rowspan=2 property to the top right cell. The right hand cell will contain the controls our visitors will use to customize their web page.

Adding the big guy: All web part pages must have exactly one WebPartManager control. This control will oversee all web part activity, including managing all web zones and the connections between these zones. Keep in mind that if you are using Master Pages and are planning on using web parts in various content pages, you'll want to place the WebPartManager in the Master page, and reference it as needed from the content pages.

After you've added the WebPartManager, you can start to drop WebPartZone controls into each table cell. Leave the right cell blank for now. WebPartZones define independent sections of a web part portal; any content inside of a WebPartZone will apply the same styles and move as one around the page.

For each WebPartZone, select the formatting drop down menu at the top right of each control, and select Auto Format. Choose your favorite style to apply to each zone. Choose different styles for some of the zones, as we'll use this a way to understand what happens when content moves from one zone to the next.

Drop some of your favorite controls into the WebPartZones. Use panels and placeholder controls to group multiple controls together. .NET adds a GenericWebPart wrapper control around each web server control, allowing them to share some behavior and attributes of WebPart Controls. One example of this is the Title attribute, which you'll want to set for each of the controls you've added, such as:

<asp:Panel id=Panel1 title=Newsletter" ...
Don't worry if Visual Studio complains that a panel doesn't support a Title attribute, the GenericWebPart will when the page is run.

When you compile and run your project, you can see how your controls are rendered as sections of the portal. Notice how applying separate styles to each zone has changed the appearance of the controls. We'll work on adding more useful controls, and cleaning up the portal in the upcoming segments. Make sure you play with minimizing and restoring some of the zones when you view the page. We'll enhance the personalization features & add a web part catalog in the next segment.

Minimize some of the controls, then leave the page.  When you return, your settings will be preserved.  Your local setttings are saved in the ASPNETDB database inside the AppCode folder, inside the aspnet_PersonalizationPerUser table.  Notice that if you close one of the parts, it completely disappears from the page.  You can delete your user's rows from this table to reset any changes you've made to the page.  We'll make this much easier to do from the page itself in the coming days.

I apologize if this seciton was over-simplified; I wanted to make sure everyone had a basic understanding of how to set up a web part project. I'll delve much deeper in the coming days...we'll explore adding/removing web parts at run time, rearranging the portal, saving user settings, web user controls, custom controls, master-child web part connections and more.