|
|
These blog entries are written by industry experts and leaders. We consider this content to be a good read for any software developer or web technologist.
July 2007 - Posts
-
Last week I blogged about the new HTML web designer and CSS support in VS 2008. In it I talked about the new "split-view" feature that allows you to see both the HTML source and the Design View of a page at the same-time, and easily have any changes you make in one view be updated in the other. One of the questions several people have asked me since is whether you can customize the split-view arrangement so that you can have the views arranged vertically instead of horizontally - allowing you to make maximum usage of screen real-estate on wide-screen monitors and laptops. The good news is that this feature is now enabled in Beta 2 (click on the image below to see my laptop screen in all its glory): Notice above how when I select text in source-view, the designer automatically selects the equivalent markup element in design-view. The "CSS Properties" window on the right-hand side works in both design-view and source-view, and enables me to easily see/edit all CSS properties (defined in an external style sheet) for the <img> element within my <ul> list. To enable vertical split-view orientation in VS 2008, select the tools->options menu item and go to the HTML Designer->General section. Then check the "Split views vertically" checkbox: Hope this helps, Scott 
|
-
With all the out-of-band technology releases we've had (ASP.NET AJAX, .NET 3.0), it's nice to reach a point where we can bring them all together.
As an example...
Create a new web site in Visual Studio 2008. This will have to be a website under IIS, unfortunately, for reasons I'll point out later. Once the web site is up, add a new item – a WCF service. The service contract can look like the following:
[ServiceContract(Namespace="http://OdeToCode.com/ws",
Name="ServerProcessInfo")]
public interface IServerProcessInfo
{
[OperationContract]
IEnumerable<ProcessInfo> GetRunningProcesses();
}
The data contract can look like so:
[DataContract]
public class ProcessInfo
{
[DataMember]
public string Name { get; set; }
[DataMember]
public long WorkingSet { get; set; }
}
Finally, the LINQish implementation:
public class ServerProcessInfo : IServerProcessInfo
{
public IEnumerable<ProcessInfo> GetRunningProcesses()
{
return
(
from p in Process.GetProcesses()
orderby p.WorkingSet64 descending
select new ProcessInfo
{
Name = p.ProcessName,
WorkingSet = p.WorkingSet64
}
).Take(10);
}
}
We can entirely remove any WCF <system.serviceModel> configuration from web.config. Instead of all the XML configuration goo, we just need a Factory attribute in our .svc file:
<%@ ServiceHost Language="C#" Debug="true" Service="ServerProcessInfo"
...
Factory="System.ServiceModel.Activation.WebScriptServiceHostFactory" %>
What magic does this factory give us? Well, we can add a ServiceReference via a ScriptManager (it's nice that AJAX extensions are in the toolbox by default), and write some script:
<asp:ScriptManager ID="ScriptManager1" runat="server">
<Services>
<asp:ServiceReference Path="~/ServerProcessInfo.svc" />
</Services>
</asp:ScriptManager>
<script type="text/javascript">
var ws = new odetocode.com.ws.ServerProcessInfo();
ws.GetRunningProcesses(getRunningProcessesComplete);
function getRunningProcessesComplete(result)
{
for(var i = 0; i < result.length; i++)
{
document.write(result .Name, " ", result .WorkingSet);
document.write("<br />");
}
}
Voila! Zero configuration and we have JSON on the wire!
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 Server: Microsoft-IIS/7.0 X-Powered-By: ASP.NET Date: Tue, 31 Jul 2007 03:08:10 GMT Content-Length: 662
{"d":[{"__type":"ProcessInfo:#","Name":"devenv","WorkingSet":51011584}, {"__type":"ProcessInfo:#","Name":"w3wp","WorkingSet":44748800}, {"__type":"ProcessInfo:#","Name":"Fiddler","WorkingSet":34213888}, ... }
Note: there is a problem in Beta 2 that prevents this magic from working with WebDev.exe. The error you'll see with WebDev (aka Cassini) is:
"IIS specified authentication schemes 'Ntlm, Anonymous', but the binding only supports specification of exactly one authentication scheme. Valid authentication schemes are Digest, Negotiate, NTLM, Basic, or Anonymous. Change the IIS settings so that only a single authentication scheme is used."
Unfortunately, twiddling with the NTLM checkbox for WebDev doesn't help. Thus, the current need for IIS.

|
-
In the past I've blogged about the JavaScript and AJAX improvements with VS 2008 JavaScript Intellisense and VS 2008 JavaScript debugging. Below are a few notes about some of the ASP.NET AJAX runtime features coming as part of the VS 2008 and .NET 3.5 release, as well as important notes to read if you are opening existing ASP.NET AJAX 1.0 projects in VS 2008. ASP.NET AJAX included in .NET 3.5 ASP.NET AJAX 1.0 shipped as a separate download that you could install on top of ASP.NET 2.0. Starting with the .NET Framework 3.5 release, all of these features are built-in with ASP.NET, which means you no longer have to download and install a separate ASP.NET AJAX setup when building or deploying applications. When you create a new ASP.NET application or web-site in VS 2008 that targets the .NET 3.5 framework, VS will automatically add the appropriate AJAX registrations in your web.config file and the core ASP.NET AJAX server controls will show up in your toolbox. The version of ASP.NET AJAX that ships with .NET 3.5 has a number of nice improvements to it - including support for using UpdatePanels with WebParts, support for WCF based JSON end-points, support for using the ASP.NET Profile, Role and Login Application Services using JavaScript, and a number of bug fixes and performance improvements. Understanding ASP.NET AJAX Versioning ASP.NET AJAX 1.0 and .NET 3.5 can both be installed side-by-side on the same machine. ASP.NET AJAX 1.0 is implemented in V1.0 of the System.Web.Extensions.dll assembly. The implementation of ASP.NET AJAX included with .NET 3.5 lives in V3.5 of the System.Web.Extensions.dll assembly. The V3.5 of System.Web.Extensions.dll is a fully compatible super-set of the 1.0 implementation (which means you don't need to change any code in order to use it). Each ASP.NET application on a machine can choose which version of ASP.NET AJAX they want to build and run against. This is configured via the <system.web.extensions> section in its web.config file, as well as by what System.Web.Extensions.dll assembly it is compiled against (with web-site projects these references are registered in the <assemblies> section of the web.config file, with web application projects they are referenced via the project file). You will be able to use VS 2008 to target ASP.NET AJAX 3.5 applications, as well as to use the new VS 2008 multi-targeting support to build ASP.NET 2.0 applications that use ASP.NET AJAX 1.0. I cover how to-do both in the sections below. Important Beta 2 Information A few days before we shipped Beta2 on the web, we discovered a side-by-side issue with ASP.NET AJAX. If you read my original VS 2008 and .NET 3.5 Beta Released blog post, you'll remember that I called out this post-install patch step to fix this issue: You should download and run this batch file. This takes only a few seconds to run, and fixes an issue we found earlier this week with the version policy of System.Web.Extensions.dll - which is the assembly that contains ASP.NET AJAX. If you don't run this batch file, then existing ASP.NET 2.0 projects built with ASP.NET AJAX 1.0 and VS 2005 will end up automatically picking up the new version of ASP.NET AJAX that ships in .NET 3.5 Beta2. This will work and run fine - but cause you to inadvertently introduce a .NET 3.5 dependency in the applications you build with VS 2005. Running the batch file will change the version binding policy of the new System.Web.Extensions.dll assembly and ensure that you only use the new .NET 3.5 ASP.NET AJAX version with projects that you are explicitly building for .NET 3.5. The good news is that this fixes the side-by-side issue we found, and makes it safe to develop ASP.NET AJAX with both VS 2005 and VS 2008 on the same machine. The one gotcha is that it causes VS 2008 to incorrectly detect the version of ASP.NET AJAX being used when first opening older ASP.NET 2.0 projects (specifically it can cause VS 2008 to think the project is already using .NET 3.5). This requires that you to take a few additional steps in Beta2 the first time you open existing ASP.NET AJAX 1.0 web-site projects with VS 2008 to correct this. You will not need to take these steps with the final VS 2008 release. Upgrading ASP.NET AJAX 1.0 Applications to use ASP.NET AJAX 3.5 When you use VS 2008 to open an existing ASP.NET 2.0 application that uses ASP.NET AJAX 1.0, you can optionally choose to upgrade the application to use .NET 3.5 (and the version of ASP.NET AJAX included within it). The VS Web Tools team recently published a Upgrading ASP.NET AJAX 1.0 Websites and Web Applications to .NET Framework 3.5 blog post that describes the step-by-step instructions to accomplish this using VS 2008 Beta2. The good news is that upgrading an ASP.NET AJAX 1.0 application to .NET 3.5 does not require that you change any of your code, and should take only a few minutes to complete. As part of upgrading ASP.NET AJAX 1.0 application to .NET 3.5, you'll want to update compiled ASP.NET AJAX control libraries you might be using. The ASP.NET AJAX Control Toolkit team is now publishing both ASP.NET AJAX 1.0 and .NET 3.5 versions of the AJAX Control Toolkit that you can download here:
The Upgrading ASP.NET AJAX 1.0 Websites and Web Applications to .NET Framework 3.5 blog post covers how to add this ASP.NET AJAX 3.5 version of the AJAX Control Toolkit to the VS 2008 toolbox. Using VS 2008 to Build ASP.NET AJAX 1.0 Applications (using Multi-Targeting) When you use VS 2008 to open an existing ASP.NET 2.0 application that uses ASP.NET AJAX 1.0, you can alternatively choose not to upgrade it to .NET 3.5, and instead use the new multi-targeting features of VS 2008 to build it using ASP.NET 2.0 and ASP.NET AJAX 1.0. The VS Web Tools team recently published a Using VS 2008 to Target ASP.NET AJAX 1.0 blog post that describes the step-by-step instructions to accomplish this using VS 2008 Beta2. Included in the blog post are a number of manual steps you need to take in Beta2 to populate the VS 2008 toolbox with ASP.NET AJAX 1.0 and ASP.NET AJAX Control Toolkit server controls. For the final release of VS 2008 we'll release a setup package that will automate this for you, as well as add ASP.NET AJAX 1.0 project and item templates to VS 2008 for you to use. You might be wondering - why is it interesting to target ASP.NET AJAX 1.0 applications using VS 2008 instead of just using VS 2005? The benefit is that it enables you to build ASP.NET AJAX 1.0 applications that work on your existing servers (no need to upgrade them to .NET 3.5 immediately), while still allowing you to take advantage of some of the new VS 2008 IDE features like JavaScript Intellisense, JavaScript Debugging, better WYSIWYG HTML Designer, CSS management, the improved code editor, unit testing in VS Professional, continuous integration support with TFS, and more. Summary .NET 3.5 now includes built-in support for all ASP.NET AJAX 1.0 features. I'll be doing more blog posts in the future that also describe how to take advantage of the new features it provides. You can use VS 2008 to target both existing ASP.NET applications built with ASP.NET AJAX 1.0, as well as target the new version of ASP.NET AJAX built-into .NET 3.5. The VS Web Tools team blog posts above should help walk you though the step-by-step instructions on how to-do both. Hope this helps, Scott 
|
-
I ran across this book in Borders and was instantly intrigued. I have heard of some of the recent praise for Ellis's work so the idea of reading his first book, written when he was 19, was a compelling one.
This book gives the reader a feel for a group of people in a certain place at a certain time. It doesn't have a wealth of character development, or a traditional plot, but rather immerses the reader in this environment. The environment in this case is filled with drugs, bisexual encounters, pimps, dead bodies, snuff films, and worse. You get the impression that the people in this environment don't even realize the absurdity of what they are doing, or really have any feelings at all. The protagonist is the one person who starts to realize the insanity of what is going on, as each encounter gets darker and worse. Throughout the story the protagonist is also trying to work out his relationship with his ex-girlfriend, but this part of the plot is more symbolic about the protagonist's reluctance to go back to this city and lifestyle, and less about an actual human relationship.
Overall I enjoyed the book as much as you can enjoy a book about such dark things. This book doesn't try to answer the question of whether humans do evil things because of internal evil (original sin) or because of the influences of soceity (naturalism) but rather just shows how messed up things can be and sometimes are.
-James

|
-
I've blogged in the past about some of the text editor improvements in VS 2008 that have been made for JavaScript intellisense and CSS style intellisense. Recently I was looking over the shoulder of someone writing some code, and saw them using some other new text editing features that I hadn't seen before ("wait - how did you just do that?"). Below is a non-exhaustive list of a few new code editing improvements I've learned about this week. I'm know there are many more I don't know about yet - but I thought these few were worth sharing now: Transparent Intellisense Mode One of the things I sometimes find annoying with intellisense in VS 2005 is that the intellisense drop-down obscures the code that is behind it when it pops-up: With VS 2005 I often find myself needing to escape out of intellisense in order to better see the code around where I'm working, and then go back and complete what I was doing. This sometimes ends up disturbing my train of thought and typing workflow. VS 2008 provides a nice new feature that allows you to quickly make the intellisense drop-down list semi-transparent. Just hold down the "Ctrl" key while the intellisense drop-down is visible and you'll be able to switch it into a semi-transparent mode that enables you to quickly look at the code underneath without having to escape out of intellisense: When you release the "Ctrl" key, the editor will switch back to the normal intellisense view and you can continue typing where you were in the Intellisense window. This feature works with all language (VB, C#, and JavaScript). It also works with HTML, XAML and XML based markup. VB Intellisense Filtering The VB team has made some nice improvements to intellisense that make it much easier to navigate through APIs. Intellisense completion now automatically filters the member list available as you type to help you better pinpoint the API you are looking for. For example, if in an ASP.NET code-behind page you type "R" it will show the full list of types and members available (with the selection starting in the "R" list): When you type the second character of what you are looking for (in this case "e"), VB will automatically filter to only show those types that start with "Re" and highlight the most likely option: When you type the "s" it filters the list even further: When you type "p" it filters down to just the one option available: I find this cleaner and more intuitive than the previous model that always showed everything in the drop-down. VB LINQ Intellisense I've done several posts in the past about LINQ and LINQ to SQL. Both VB and C# obviously have full support for LINQ and LINQ to SQL. I think the VB team in particular has done some nice work to provide nice intellisense hints to help guide users when writing LINQ statements in the editor. For example, assuming we have a LINQ to SQL data model like the one I built in Part 2 of my LINQ to SQL series, I could use the VB code editor to easily work with it. Notice below how VB automatically provides a tooltip that helps guide me through writing the LINQ query syntax: I can then start writing my query expression and the VB intellisense will guide me through creating it: The above expression retrieves three column values from the database and creates a new anonymous type that I can then loop over to retrieve and work on the data: Organize C# Using Statements The C# editor has added some great intellisense improvements as well. Some of the biggest obviously include language intellisense and refactoring support for the new language features (Lambdas, Extension Methods, Query Syntax, Anonymous Types, etc). Just like in our VB example above, C# supports type inference and intellisense completion of anonymous types: One of the small, but nice, new features I recently noticed in VS 2008 is support for better organizing using statements in C#. You can now select a list of using statements, right-click, and then pull up the "Organize Usings" sub-menu: You can use this to alphabetically sort your namespaces (one of my pet peeves), and optionally use the 'Remove Unused Usings" command to remove un-necessary namespace declarations from the file: When you use this command the editor will analyze what types you are using in your code file, and automatically remove those namespaces that are declared but not needed to support them. A small but handy little feature. Summary The above list of editor improvements is by no means exhaustive, but rather just a few small improvements I've played with in the last week. Post others you notice in the comments section of this post, and I'll try and do an update with more in the future. Thanks, Scott 
|
-
-
If you read through my moster of a previous post you will notice that I am a big fan of technologies that are lumped into the phrase "ALT.NET". Stuff like MonoRail, nHibernate, MbUnit, Rhino.Mocks, etc.
While reading some of the posts about ALT.NET the thought that kept crossing my mind is how long will people stick with .NET when they start to understand some of the possible solutions out there. Many of the .NET solutions above are accomplishing goals in .NET that are very hard. ORM is hard. Mocking in a statically typed language is hard. But when you really start to look outside of the area of .NET you might find Ruby on Rails. Where all of this stuff is just plain easy.
In the link above the first bullet point of being ALT.NET is:
"You’re the type of developer who uses what works while keeping an eye out for a better way."
What if Ruby on Rails is the better way? How long before the people driving the ALT.NET movement figure out that the best way to do stuff is NOT.NET and perhaps RoR? I know that I feel myself getting closer and closer to that realization. What would make an ALT.NET developer stay in the .NET realm?
1) Your job. Ok, this is a pretty good one. You work for a company that uses .NET and they aren't going to switch. This will keep a number of people who love their jobs, but most people thinking about ALT.NET won't usually let a paycheck get in their way if they see greener pastures elsewhere. This might delay the move, the next contract I took is .NET because I can bill much more doing .NET work, but in the long run it won't stop me from pursuing RoR in my off-time and at some point making the switch.
2) Your comfort. Using Ruby and RoR is weird. I will be the first to admit it hasn't been easy adapting to how different it is. I don't think I have ever been more comfortable in a language then I am in C# and .NET. Similiar to #1 though, the people looking at ALT.NET aren't all about comfort. They are willing to try something different and get uncomfortable.
3) Microsoft. Microsoft puts an incredible amount of money and effort into .NET. One of the things I noticed at the Ruby Brigade here that was missing was the endless Microsoft swag that usually shows up at most .NET user groups. Microsoft has the MVP program, they send people to conferences for free, etc. But again, if someone is looking at ALT.NET technologies they are already somewhat detaching themselves from Microsoft. I can't see this holding too many people back.
I haven't made the switch yet. My next contract, which should last at least a year, is .NET. ChiroEase, my side-project, is .NET. But I am working on a little project using RoR. Testing the waters, we shall see where it goes.
Do you consider yourself in the ALT.NET camp? Are you looking at RoR? Why or Why not?
-James

|
-
I think I have mentioned it a little bit about it in the past, but I haven't ever really blogged about it. So here goes. ChiroEase is the side-project that I have spent a decent amount of my nights and weekends on for the last year or so.
The basic idea is that ChiroEase is a smart-client application for managing a chiropractors office. Currently there are a large number of older applications available for chiropractors, many are classic windows applications, many are actually geared toward all medical professions (so they include lots of unused features), etc. There are some new good competitors out there, but I think the one angle we have is that we are really trying to make it as simple and easy to use as possible. Because it's a smart-client they don't have to worry about back-ups, they can access the data from multiple devices, access their data from home, etc.
I never thought I would be building a smart-client. I think 99% of the time a website does a better job than a smart-client, but there were a couple compelling reasons to build it this way. The main reason for this is if the office's internet connection goes down they need to be able to continue using their office. Internet connections don't go down that much anymore, but the other partners saw it as a big issue from a sales standpoint. The second reason is that the people using these tools aren't usually savvy computer users. They are used to working with a windows app and this makes the transition much easier. We have plans for putting out a web-only version after we are done with the smart-client, but it will be in addition to and not instead of the smart-cleint.
Enough about that though, the more interesting part to me (and probably you) is the architecture. Here is what I came up with.
The Server-side is fairly simple. There is a web services front-end to a business logic layer. I use strongly-typed business entities (POCOs) tied up to NHibernate. There is a little data layer for the things that can't be done through NHibernate that talks to SQL Server 2000. This works fairly well, I have MbUnit tests at the business and data layer levels. One change I would like to make is to switch to MonoRail's ActiveRecord but for the time being I am using plain old nHibernate. Another change I would like to make is to use Rhino.Mocks for testing, but right now all of my tests hit the actual database.
The client-side is a little trickier. Since the application is a smart-client it needs to be available on-line and off-line. I looked at using SQL Express, but the install and uber-fat package scared me away. I decided on SQLite as off-line storage. This was before SQL Compact was available so I didn't compare SQLite with that. I have been incredibly impressed with SQLite. I used System.Data.Sqlite in conjunction with NHibernate. One of the more interesting parts of this is that I actually use the exact same nHibernate files and data access code on the server-side and client-side, which I think it just pretty cool.
The other client-side decision I had to make was what smart-client model I wanted to go with. I could go with either a sync model where the client and server-side database would synchronize when coming on-line, or I could go with the queue model where I store messages in a queue and send them when the connection comes back on. While making this decision the Smart Client literature over at P&P was very helpful, unfortunately when I went to look at the Smart Client App Block I found it to be over engineered and overly complex. Instead I just grabbed the only code out of the block I felt I really needed (the PInvoke line to check for a connection) and wrote my own simple message based queue. Basically when I try to send a message and the connection is down I store that message in Sqlite. When the connection comes back up I send those messages. The only tricky part is dealing with any concurrency issues that might have occurred, but from a day-to-day standpoint the user shouldn't have to deal with that very often.
For the actual client-side piece I used Windows Forms (just regular not XAML) with the Developer Express library. I didn't want to deal with the crappy default controls, and Developer Express gave me a free license for being an MVP, so I went with them. Their library is comprehensive and very well done. The couple of issues I have come across have been quickly answered by their support or I have found an answer in the docs. The only thing lacking was a wizard control, and I went with ActiPro for that. It works OK, but it has some hard to troubleshoot issue where it grabs an assembly and won't let go. (very frustrating as it means you have to reboot Visual Studio). For the actual architecture of the client-side I went with the obscure Presentation Model pattern. Most people use MVC or MVP, but I have become pretty fond of the presentation model. I am writing the synchronize logic by hand, but I think in the future I might try to whip up a framework to do that for me. If you aren't familiar with it, take a moment to read up on in from Fowler. The main reason to use the presentation model is that I think it works great for testing your presentation logic and it eliminates the pointless interfaces required for MVP.
That's about it really. We are dangerously close to a beta of the product, but we hit a snag when we lost one of our main subject matter experts. My two partners on the project (a business/project manager and a chiropractor/sales guy) are busy trying to find us some new users and then we should be ready to go. My goal is to have it live and running by the end of the year, which is a little ambitious but not out of the question.
-James

|
-
I'm very pleased to announce that the Beta 2 release of VS 2008 and .NET 3.5 Beta2 is now available for download. You can download the Visual Studio 2008 product here. You can alternatively download the smaller VS 2008 Express Editions here. VS 2008 and Visual Web Developer 2008 Express can be installed side-by-side with VS 2005. .NET 3.5 Beta2 also includes a go-live license which allows you to build and deploy applications into production. Very Important: Please read my "Installation Notes" at the bottom of this blog post for a few post-installation steps you must make to ensure everything runs well. One of these steps fixes a side-by-side issue we found with ASP.NET AJAX. Quick Tour of Some of the New Features for Web Development Over the last few months I've written several blog posts that discuss some of the new improvements in this release. Below is a quick summary list of several of them that I have already published. This list is by no means exhaustive - there are a lot more things I haven't had a chance to blog about yet (stay tuned for more posts!): VS 2008 Multi-Targeting Support VS 2008 enables you to build applications that target multiple versions of the .NET Framework. You can learn more about how this works from my blog post here: VS 2008 Web Designer and CSS Support VS 2008 includes a significantly improved HTML web designer. This delivers support for split-view editing, nested master pages, and great CSS integration. Below are two articles I've written that discuss this more: ASP.NET also has a new <asp:ListView> control that I'll be blogging about in the near future. It delivers very flexible support for data UI scenarios, and allows full customization of the markup emitted. It works nicely with the new CSS support in VS 2008. ASP.NET AJAX and JavaScript Support .NET 3.5 has ASP.NET AJAX built-in (and adds new features like UpdatePanel support with WebParts, WCF support for JSON, and a number of bug fixes and performance improvements). VS 2008 also has great support for integrating JavaScript and AJAX into your applications: I will be doing a blog post in the next few days that talks more about some of the ASP.NET AJAX specific improvements, as well as how to upgrade existing ASP.NET AJAX 1.0 applications to use them. Language Improvements and LINQ The new VB and C# compilers in VS 2008 deliver significant improvements to the languages. Both add functional programming concepts that enable you to write cleaner, terser, and more expressive code. These features also enable a new programming model we call LINQ (language integrated query) that makes querying and working with data a first-class programming concept with .NET. Below are some of the articles I've written that explore these new language features using C#: Data Access Improvements with LINQ to SQL LINQ to SQL is a built-in OR/M (object relational mapper) in .NET 3.5. It enables you to model relational databases using a .NET object model. You can then query the database using LINQ, as well as update/insert/delete data from it. LINQ to SQL fully supports transactions, views, and stored procedures. It also provides an easy way to integrate business logic and validation rules into your data model. Below are some of the articles I've written that explore how to use it: I'll be adding several more articles to my series above in the weeks ahead. I think you'll find that LINQ to SQL makes it dramatically easier to build much cleaner data models, and write much cleaner data code. Lots of other improvements The list above is only a small set of the improvements coming. For client development VS 2008 includes WPF designer and project support. ClickOnce and WPF XBAPs now work with FireFox. WinForms and WPF projects can also now use the ASP.NET Application Services (Membership, Roles, Profile) for roaming user data. Office development is much richer - including support for integrating with the Office 2007 ribbon. WCF and Workflow projects and designers are included in VS 2008. Unit testing support is now much faster and included in VS Professional (and no longer just VSTS). Continuous Integration support is now built-in with TFS. AJAX web testing (unit and load) is now supported in the VS Test SKU. And there is much, much more... Important Installation Notes - PLEASE READ! There are two important things you should do immediately after installing VS 2008 and .NET 3.5 Beta2: 1) You should download and run this batch file. This takes only a few seconds to run, and fixes an issue we found earlier this week with the version policy of System.Web.Extensions.dll - which is the assembly that contains ASP.NET AJAX. If you don't run this batch file, then existing ASP.NET 2.0 projects built with ASP.NET AJAX 1.0 and VS 2005 will end up automatically picking up the new version of ASP.NET AJAX that ships in .NET 3.5 Beta2. This will work and run fine - but cause you to inadvertently introduce a .NET 3.5 dependency in the applications you build with VS 2005. Running the batch file will change the version binding policy of the new System.Web.Extensions.dll assembly and ensure that you only use the new .NET 3.5 ASP.NET AJAX version with projects that you are explicitly building for .NET 3.5. 2) If you have ever installed a previous version of "Orcas" or VS 2008 on your machine (either Beta1 or one of the CTP versions), you need to reset your VS 2008 settings after installing Beta2. If you don't do this, you'll have an odd set of settings configured (some windows will be in the wrong place), and you'll potentially see some IDE performance slowness. You can reset your settings by typing "DevEnv /resetsettings" on the command-line against the VS 2008 version of the IDE: Summary There are a lot of new improvements and enhancements that I hope you'll find really useful with VS 2008 and .NET 3.5. Stay tuned to my blog over the next few weeks as I'll be posting more about some of the new features and how to get the most out of them. Thanks, Scott 
|
-
One of the big features that web developers will quickly discover with VS 2008 is its dramatically improved HTML designer, and the rich CSS support it brings. VS 2008 now uses the same web designer that ships with Microsoft's new Expression Web product. In addition to providing lots of new functionality, you'll also find that this web designer is much faster than the VS 2005 version (which was based on a much older code base). Below is a quick tour of some of the new web designer features that you'll be able to take advantage of with both VS 2008 as well as the free Visual Web Developer 2008 Express: Split View Editing In addition to supporting both source-view and design-view, VS 2008 adds support for a new "split-view" mode when working on pages. This allows you to see both the HTML source and the Design View at the same-time, and easily have any changes you make in one view be updated in the other:
CSS Style Manager VS 2008 supports a new tool window inside the IDE called "Manage Styles". This shows all of the CSS stylesheets, and their corresponding rules, for the page you are currently editing. It can be used both when you are in design-view, as well as when you are in source view on a page:
A circle around a CSS rule in the manage styles window indicates that particular rule is in use within the current document. Using the mouse to hover over the rule allows you to quickly see the CSS rule values:
You can then either right-click on a CSS rule and select "Modify Style" to bring up a graphical CSS rules editor, or you can double click on the rule in the manage styles window to automatically open the stylesheet file and jump immediately to the CSS source definition to edit (with full intellisense):
For even more tips/tricks about how to best use the "Manage Styles" tool window please read this blog post. CSS Properties Window One of the other cool new CSS features that is also supported in both design and source view is the new CSS Properties Window:
When you select an HTML element or ASP.NET server control, the CSS property window will show you all of the CSS settings currently applied to it. You can also change any of the values using the CSS property grid. The "target rule" drop-down in the style toolbar allows you to determine under what rule the settings are applied (read this blog post to learn more about the style toolbar and target rule dropdown). If, like me, you sometimes struggle with large CSS stylesheets and find yourself shouting "why the $!#@ is it looking like that?", you'll find the "summary" view of the CSS Properties window really useful (just click the summary button at the top of the CSS properties pane). When you press this button it enables a filtering mode that shows you the full inheritance set of CSS rules for the current HTML element or ASP.NET control you are working with:
In the properties grid above you'll notice that some values are duplicated multiple times - with red arrows striking out previous values. This indicates that a parent CSS rule setting is being overridden by another CSS rule's value. You can see both the original value as well as the overridden one in the summary view at the bottom. You can click on the individual values to see where in the CSS precedence hierarchy this value was inherited from or overridden. In the example below you can see that the final color for the current element that my cursor is on is a dark brown color. If I select this final color value, the CSS properties window will draw a blue box in the applied-rules list above indicating that this setting is set in the "singlecontent h3" rule:
If I click on the lighter brown color setting that this rule overrode (and which has the red strike-thru), you can see that it originated with the page's HTML body CSS rule (notice how the body rule below is selected in the applied rules list when I select the overridden value below):
Please read this dedicated CSS Properties Window blog post to learn even more how to use the CSS property window. CSS Source View Intellisense The HTML designer supports the ability to select an element or control in design-view, and graphically select a rule from the CSS list to apply to it. You'll also find when in source mode that you now have intellisense support for specifying CSS class rules:
This is true for both HTML element (like above), as well as with ASP.NET server controls:
This CSS intellisense is supported in both regular HTML / ASP.NET pages, as well as when working with pages based on master pages and nested master pages. Nested Master Page Support Earlier this month I wrote a dedicated blog post that covered the new VS 2008 Nested Master Page Support. All of the above designer and CSS features obviously work with that as well:
Summary The above post provides a quick look at some of the new HTML designer and CSS tool support in VS 2008 (all of the above features also ship with the free Visual Web Developer 2008 Express edition). Because VS 2008 now has multi-targeting support you'll be able to use these feature immediately without having to install .NET 3.5 on your servers. You can open existing ASP.NET 2.0 projects in VS 2008, have VS 2008 continue to target .NET 2.0 as the runtime target, and begin using these features immediately. Over the next week I'll also be starting a new multi-part blog series that covers the new <asp:listview> control that ships as part of ASP.NET in .NET 3.5. One of the big benefits of the <asp:listview> is that it enables developers to have total control over the HTML output emitted in data scenarios. This works well with all of the new CSS tool features above, and enables you to more easily create great looking web sites and applications. Hope this helps, Scott 
|
-
Sahil's post on "Things
I can't live without" got me thinking about some software I use that might
not be so well known.
XaMp Studio plays XM Radio from
a desktop application. Looks like Winamp and
offers more features than the XM web interface. There is a toast notification to tell you when your favorite artist or tune is streaming. Note: don't download the "desktop" edition,
as it seems incompatible with Vista and Windows Media Player 11.
DynDNS Updater coupled with the
DynDNS service can give any computer a name – even if your ISP hands out dynamic
IP addresses. The Updater can run as a Windows service to keep addresses in synch.
FoxIt Reader is a small,
fast PDF reader.
Scott Hanselman first mentioned Foxit a couple years ago, and the feature
list has grown since that time. The only downside is that Foxit does not seem to
decrypt password protected PDF files, so no e-book reading with Foxit.
Robocopy now comes standard
in Windows Vista. It's the tool I use for large file operations,
particularly when moving bits over the network. Robocopy easily beats copying files
using Windows Explorer, after all, the "robo" is short for robust.
There is only one weakness with robocopy. Try copying an Outlook PST file when Outlook
is running:
PS> robocopy C:\Users\bitmask\appdata\Local\Microsoft\Outlook d:\temp outlook.pst
-------------------------------------------------------------------------------
ROBOCOPY :: Robust
File Copy for Windows
-------------------------------------------------------------------------------
Started : Tue Jul 24 12:33:20 2007
Source : C:\Users\bitmask\appdata\Local\Microsoft\Outlook\
Dest : d:\temp\
Files : outlook.pst
Options : /COPY:DAT /R:1000000 /W:30
------------------------------------------------------------------------------
1 C:\Users\bitmask\appdata\Local\Microsoft\Outlook\
0.0% New File
856.3 m Outlook.pst
2007/07/24 12:33:20 ERROR 33 (0x00000021) Copying File C:\Users\bitmask\appdata\Local\Microsoft\Outlook\Outlook.pst
The process cannot access the file because another
process has locked a portion of the file.
Waiting 30 seconds...
Which brings me to my "last but not least" entry:
Hobocopy.
PS> .\hobocopy C:\users\bitmask\appdata\local\microsoft\outlook\ d:\temp outlook.pst
HoboCopy (c) 2006 Wangdera Corporation. hobocopy @ wangdera.com
Starting a full copy from C:\users\bitmask\appdata\local\microsoft\outlook\ to d:\temp
Copied directory
Backup successfully completed.
Backup started at 2007-07-22 12:46:25, completed at 2007-07-22 12:47:48.
1 files (856.39 MB, 1 directories) copied, 7 files skipped
Hobocopy is Craig Andera's
tool that uses the Volume Shadow Service to copy locked files. Pure goodness. 
|
-
Ayende had a recent post with the following quote from Nicholas Piasecki:
To me, this discussion all boils down to one thing: the foreach loop. Let's say you want to display a table of sales reports, but after every tenth row, you want to print out an extra row that displays a running total of sales to that point. And you want negative numbers to appear in red, positive numbers to appear in green, and zeros to appear in black. In MonoRail, this is easy; with WebForm's declarative syntax, just shoot yourself in the face right now. Most solutions I've seen end up doing lots of manipulation in the code-behind and then slamming it into a Literal or something, which to me defeats the purpose of the code separation.
Ayende says this is the essence of why he dislikes WebForms. In the comments, someone proposed a rails solution ...
#set ($i = 0)
#set ($running_total = 0)
#foreach ($report in $reports)
#each
<tr>
<td>$report.name</td>
#if ($report.ammount > 0)
<div class="green">
#elseif ($report.ammount < 0)
<div class="red">
#else
<div class="black">
#end
$report.ammount</td>
</tr>
#set ($running_total = $running_total + $report.ammount)
#set ($i = $i + 1)
#between
#if (($i % 10 ) == 1)
<tr class="Running Total">
<td>$running_total</td>
</tr>
#end
#end
... which received praise for elegance. I'm thinking if you really want to intermingle code and markup, than open up an .aspx page and have at it:
<%@ Page Language="C#" %>
<% SalesReport report = new SomeApplicationService().GetSalesReport(); int rowCount = 0;
int runningTotal = 0;
%>
<table>
<% foreach (Salesperson p in report.SalesPeople) {
rowCount++;
runningTotal += p.TotalSales;
%>
<tr>
<td><%= p.Name %></td>
<td>
<div class="<%= p.TotalSales < 0 ? "red" : p.TotalSales > 0 ? "green" : "black" %>">
<%= p.TotalSales.ToString("c") %>
</div>
</td>
</tr>
<% if(rowCount % 10 == 0) { %>
<tr>
<td>SubTotal:</td>
<td><%= runningTotal.ToString("c") %></td>
</tr>
<% } // end if %>
<% } // end foreach %>
</table>
Why throw out the baby with the bathwater? 
|
-
RockNUG is the newest .NET user group in the vast suburbia of Washington D.C. Their next meeting is on August 8 at Montgomery College, and I'll be there to talk about ASP.NET AJAX. I have one WF book and one Pluralsight T-shirt to give away, too.
Come for the free pizza, and stay for the asynchronous fun! 
|
-
Over the last few years we've been working to make .NET and the CLR a great environment for dynamic languages. About 14 months ago we formed a dedicated group within my team that has been focused on adding richer CLR runtime support for dynamic languages, as well as delivering first class .NET implementations of popular dynamic languages. DLR Background This spring we shipped the first preview release of a new .NET library that we call the "Dynamic Language Runtime" (or DLR for short). It provides a set of features on top of the CLR designed explicitly for dynamic language scenarios. These include a shared dynamic type system, language hosting model, and support to make it possible to generate fast dynamic code. These features make it much easier to build high-quality dynamic language implementations on .NET. These implementations can access and use any of the APIs in the .NET Framework, as well as easily interoperate with code written in any other .NET language (for example: you could write a Ruby class that invokes and uses a C# class, which in turn invokes a Python class). This spring at the MIX 07 conference we announced that Microsoft will be shipping 4 dynamic language implementations of our own for .NET: - IronPython
- IronRuby (new)
- Javascript
- Dynamic VB (new)
The source code of our IronPython implementation, as well as the source code for the underlying DLR library, was published on CodePlex in April. You can download both of them today from the IronPython codeplex site. All of the source is made available under the MSPL permissive license - which provides full commercial and non-commercial modification rights. IronRuby Pre-Alpha Release Today we are making available the first public drop of our IronRuby implementation. You can learn more about how to download the source, build it, and try it out from John Lam's blog post here. Today's IronRuby drop is still a very early version, and several language features and most libraries aren't implemented yet (that is why we are calling it a "pre-alpha" release). It does, though, have much of the core language support implemented, and can also now use standard .NET types and APIs. IronRuby has been architected to take advantage of a new DLR feature we call "Dynamic Sites" - which delivers a fast adaptive call-site method caching implementation. It also uses the lightweight-code generation features of the CLR. Lightweight code generation enables dynamic language implementations to create in-memory IL that is then JIT'd into native code at runtime (without ever having to save anything to disk). This can yield much better runtime performance than interpreted code, and the lightweight codegen feature ensures that once we are finished with the JIT'd code we can optionally garbage collect it to avoid leaking. We are releasing today's drop mainly for developers interested in language implementations to start looking at the IronRuby source code, and learn how it was implemented. Developers interested in playing with an early version of Ruby for .NET can also download it and give it a spin. IronRuby Project Plans Next month we will be moving the IronRuby source code repository to be hosted on RubyForge. As part of this move we are also opening up the project to enable non-Microsoft developers to enlist in the project and contribute source code. We'll then work to implement the remaining features and fix compatibility issues found as more libraries and source are ported to run on top of it. The end result will be a compatible, fast, and flexible Ruby implementation on top of .NET that anyone can use for free. IronRuby "Hello World" Console Sample If you download and build the IronRuby source code, you are probably wondering "how do I start using it?" The easiest way to get started is to run the "rbx.exe" interactive console application that by default is built under the \bin\release directory:
This console shell provides you with the ability to write Ruby code interactively. After each line, the shell will interactively execute it. For example, we could output hello world by typing puts "Hello World":
To output this 10 times in a row, we could type the following:
To use Windows Forms functionality in IronRuby, we could type a require statement that references the System.Windows.Forms assembly, and then use the MessageBox.Show method to display a message in a modal dialog:
IronRuby "Hello World" WPF Sample One of the benefits of implementing a language on top of .NET is that it enables developers using that language to get full access to the rich framework libraries provided with the .NET Framework. For a simple example of this in action, I could create a "HelloWPF.rb" text file and type in the following Ruby code below:
The above code uses the WPF UI framework to create a Window that hosts a StackPanel layout manager that initially contains just a button. When the button is pressed, a new label control is created and added into the StackPanel (causing it to automatically be flowed in the Window). I can then run the above application using IronRuby by passing the "HelloWPF.rb" text file as an argument to rbx.exe:
When I run it I'll get a window with a WPF button (note above I added a nice DropShadowBitmapEffect to it in the code above):
And each time I press the button a new label will be added to the Window:
Not only does having the ability to use all of the .NET APIs provide a lot of power, but you'll notice in the code we wrote how it is possible to naturally integrate .NET APIs into other language syntaxes:
In the code snippet above I'm using the Ruby block language feature (similar to a Lambda expression with C# 3.0 and VB9) to implement a "Click" event handler on the WPF button. Notice how within the block the standard Ruby naming patterns can be used when accessing any .NET API. For example, instead of using the "FontSize" property on the WPF Label we are accessing it using "font_size" as the property accessor name. IronRuby automatically handles the naming conversion - enabling developers to program with a consistent naming pattern regardless of their language of choice. Summary If you are interested in trying out this first early drop of IronRuby, you can download the source and build it here. You can then download my WPF sample above and run it yourself here (note: you must have .NET 3.0 or 3.5 installed - since those deliver the WPF APIs). To learn more about WPF, I also highly recommend Adam Nathan's excellent WPF Unleashed book (read the review comments on Amazon to see why). Hope this helps, Scott 
|
-
Unit testing features will now be available in the Professional version of Visual Studio 2008.
Unit testing has been to Visual Studio what Barry Bonds has been baseball – a center of controversy. First there was the Peter Provost petition to include unit testing features in all version of VS. Then there was the highly criticized TDD guidance accompanying the feature. Next came some performance issues and pain while using the shipping version, and most recently, the TestDriven.NET hullaballoo added an emotional charge to the air.
Putting all this behind us - what's new in 2008? I've been working with the latest bits, and I can say:
- Performance has improved dramatically.
- The context-menu command "Run Tests" is new (and context sensitive).
- Keyboard shortcuts take away the pain of the VS2005 test runner (Ctrl+R, A to run all tests in a solution, Ctrl+R, T to run tests in the current context).
Moving the unit-testing features into the Pro edition is a great move by Microsoft. I hope the feature gains traction and brings awareness of unit testing into the mainstream (although I think we are already close, aren't we?).
Related Links
Guidelines for Test-Driven Development by Jeff Palermo
Rules to Better Unit Tests by Adam Cogan.

|
-
A few weeks ago I blogged about the new JavaScript Intellisense support in VS 2008. One of the other JavaScript features that I'm sure will be popular in VS 2008 is the much-improved support for JavaScript debugging. This is enabled in both the free Visual Web Developer 2008 Express edition as well as in Visual Studio, and makes using JavaScript and building AJAX applications significantly easier. Setting JavaScript breakpoints in ASP.NET pages One of the annoying things with VS 2005 is that you have to first run your ASP.NET pages before you can set JavaScript breakpoints in them in the debugger. VS 2008 makes this much better by adding new support that allows you to set client-side JavaScript breakpoints directly within your server-side .aspx and .master source files:  When you set a breakpoint in your .aspx page like above, VS 2008 will automatically map the breakpoint location to the dynamically generated client HTML that runs in the browser when the page is later executed: If you add/remove/update the breakpoint locations in the running HTML document, VS 2008 is also now smart enough to perform the reverse mapping and update the breakpoint in the original .aspx or .master source file on the server. This makes it much easier to get into a nice edit/debug/edit/debug flow as you are iterating on your applications. Best of all, you can now set both client-side JavaScript breakpoints and VB/C# server-side breakpoints at the same time (even in the same page) and use a single debugger to step through both the server-side and client-side code in a single debug session (which is extremely useful for any AJAX heavy application). Any JavaScript breakpoints you set will also now by default be saved by VS 2008 when you close the project/solution. When you open up the project again, the previous locations you set the breakpoints on will still have them enabled. Script Document Navigation within the Solution Explorer Often the JavaScript that is sent down to a browser client is dynamically generated on the server (for example: with scripts that are stored as resources within compiled server controls - like ASP.NET AJAX UpdatePanels and control extenders). In scenarios such as these, you want to be able to easily see all JavaScript URLs being loaded from a page, as well as step into the within the debugger. VS 2008 makes it much easier to-do this by integrating the running Script Document feature (that in VS 2005 was a separate tool-pane window) into the VS 2008 solution explorer view when you are debugging a web application. Specifically, when you are using VS to run and debug a page, VS 2008 will now list all of the script URLs that the page you are debugging has loaded in the browser at the top of your VS solution explorer pane: You can then double click on any of the URLs under th | |
|