It is presented by the most excellent Dan Wahlin, and is really comprehensive. Details of the course outline can be found here.
Free 1-Month Subscription to the Course
Pluralsight is offering a special promotion that allows you to get a free 1-month subscription to watch the above course as many time as you want at no cost. There is no obligation to buy anything at the end of the offer and you don’t need to supply a credit card in order to take part in it.
To get access to the course you simply follow @pluralsight on Twitter and then visit this page and enter your Twitter name using the form on it. Pluralsight will then send you a private twitter message containing the access code that you can use to subscribe to the course. Once you are subscribed to the course you have one month to watch the course (and you can watch it as many times as you want during the month).
Pluralsight is running the promotion through April 27th – so sign-up now to get access. Once you are signed up you then have a month to watch the course.
Hope this helps,
Scott
P.S. And if you are new to Twitter you can also optionally follow me: @scottgu
I'm excited to share news about a great new cloud capability we are announcing today - Windows Azure Media Services.
Windows Azure Media Services
Windows Azure Media Services is a cloud-based PaaS solution that enables you to efficiently build and deliver media solutions to customers. It offers a bunch of ready-to-use services that enable the fast ingestion, encoding, format-conversion, storage, content protection, and streaming (both live and on-demand) of video. It also integrates and exposes services provided by industry leading partners – enabling an incredibly deep media stack of functionality that you can leverage.
You can use Windows Azure Media Services to deliver solutions to any device or client - including HTML5, Silverlight, Flash, Windows 8, iPads, iPhones, Android, Xbox, and Windows Phone devices. Windows Azure Media Services supports a wide variety of streaming formats - including Smooth Streaming, HTTP Live Streaming (HLS), and Flash Media Streaming.
One of the unique aspects of Windows Azure Media Services is that all of its features are exposed using a consistent HTTP REST API. This is true both for the media services we've built, as well as the partner delivered media services that are enabled through it. This makes it incredibly easy to automate media workflows and integrate the combined set of services within your applications and media solutions. Like the rest of Windows Azure, you only pay for what you use with Windows Azure Media Services – making it a very cost effective way to deliver great solutions.
Windows Azure Media Services uses the same award-winning media backend that has been used to power some of the largest live sporting events ever broadcast on the web - including the 2010 Winter Olympics, 2010 FIFA World Cup, 2011 Wimbledon Championships, and 2012 NFL SuperBowl. Using Windows Azure Media Services you'll now be able to quickly standup and automate media cloud solutions of your own that are capable of delivering amazing solutions to an equal sized audience.
Learn More
We are introducing Windows Azure Media Services at the 2012 National Association of Broadcasters (NAB) Show this week, and attendees can stop by the Microsoft booth there to meet the team and see live demonstrations of it in action.
You can also visit windowsazure.com/media to learn more about the specific features it supports, and visit the windowsazure.com media dev center to learn more about how to develop against it. You can sign-up to try out the preview of Windows Azure Media Services by sending email to mediaservices@microsoft.com (along with details of the scenario you'd like to use it for).
We are really excited about the capabilities Windows Azure Media Services provides, and are looking forward to watching the solutions that will soon be built on it.
Thanks,
Scott
P.S. In addition to blogging, I am also now using Twitter for quick updates and to share links. Follow me at: twitter.com/scottgu
Here is the latest in my link-listing blog series:
ASP.NET
Easily overlooked features in VS 11 Express for Web: Good post by Scott Hanselman that highlights a bunch of easily overlooked improvements that are coming to VS 11 (and specifically the free express editions) for web development: unit testing, browser chooser/launcher, IIS Express, CSS Color Picker, Image Preview in Solution Explorer and more.
Get Started with ASP.NET 4.5 Web Forms: Good 5-part tutorial that walks-through building an application using ASP.NET Web Forms and highlights some of the nice improvements coming with ASP.NET 4.5.
Introduction to the ASP.NET Web API: Great tutorial by Stephen Walher that covers how to use the new ASP.NET Web API support built-into ASP.NET 4.5 and ASP.NET MVC 4.
Async Mashups using ASP.NET Web API: Nice post by Henrik on how you can use the new async language support coming with .NET 4.5 to easily and efficiently make asynchronous network requests that do not block threads within ASP.NET.
Fixing these jQuery: A Guide to Debugging: Great presentation by Adam Sontag on debugging with JavaScript and jQuery. Some really good tips, tricks and gotchas that can save a lot of time.
Overview of the WebApiContrib project: Nice post by Pedro Reys on the new open source WebApiContrib project that has been started to deliver cool extensions and libraries for use with ASP.NET Web API.
Entity Framework
Entity Framework 5 Performance Improvements and Performance Considerations for EF5: Good articles that describes some of the big performance wins coming with EF5 (which will ship with both .NET 4.5 and ASP.NET MVC 4). Automatic compilation of LINQ queries will yield some significant performance wins (up to 600% faster).
ASP.NET MVC 4 and EF Database Migrations: Good post by David Hayden that covers the new database migrations support within EF 4.3 which allows you to easily update your database schema during development - without losing any of the data within it.
Visual Studio
What's New in Visual Studio 11 Unit Testing: Nice post by Peter Provost (from the VS team) that talks about some of the great improvements coming to VS11 for unit testing - including built-in VS tooling support for a broad set of unit test frameworks (including NUnit, XUnit, Jasmine, QUnit and more)
April 16th Update: You can listen to an audio version of the talk I did online here.
This coming Monday (April 16th) I’m doing another online LIDNUG session. The talk will be from 10am to 11:30am (Pacific Time). I do these talks a few times a year and they tend to be pretty fun. Attendees can ask any questions they want to me, and listen to me answer them live via LiveMeeting. We usually end up having some really good discussions on a wide variety of topics. Any topic or question is fair game.
You can learn more and register to attend the online event for free here. I’ll update this post with a download link to a recorded audio version of the talk after the event is over.
Hope to get a chance to chat with some of you there!
Scott
P.S. In addition to blogging, I am also now using Twitter for quick updates and to share links. Follow me at: twitter.com/scottgu
Microsoft has made the source code of ASP.NET MVC available under an open source license since the first V1 release. We’ve also integrated a number of great open source technologies into the product, and now ship jQuery, jQuery UI, jQuery Mobile, jQuery Validation, Modernizr.js, NuGet, Knockout.js and JSON.NET as part of it.
I’m very excited to announce today that we will also release the source code for ASP.NET Web API and ASP.NET Web Pages (aka Razor) under an open source license (Apache 2.0), and that we will increase the development transparency of all three projects by hosting their code repositories on CodePlex (using the new Git support announced last week). Doing so will enable a more open development model where everyone in the community will be able to engage and provide feedback on code checkins, bug-fixes, new feature development, and build and test the products on a daily basis using the most up-to-date version of the source code and tests.
We will also for the first time allow developers outside of Microsoft to submit patches and code contributions that the Microsoft development team will review for potential inclusion in the products. We announced a similar open development approach with the Windows Azure SDK last December, and have found it to be a great way to build an even tighter feedback loop with developers – and ultimately deliver even better products as a result.
Very importantly - ASP.NET MVC, Web API and Razor will continue to be fully supported Microsoft products that ship both standalone as well as part of Visual Studio (the same as they do today). They will also continue to be staffed by the same Microsoft developers that build them today (in fact, we have more Microsoft developers working on the ASP.NET team now than ever before). Our goal with today’s announcement is to increase the feedback loop on the products even more, and allow us to deliver even better products. We are really excited about the improvements this will bring.
Learn More
You can now browse, sync and build the source tree of ASP.NET MVC, Web API, and Razor on the http://aspnetwebstack.codeplex.com web-site.
The Git repository on the site is the live RC milestone development tree that the team has been working on the last several weeks, and the tree contains both the runtime sources + tests, and is buildable and testable by anyone. Because the binaries produced are bin-deployable, this allows you to compile your own builds and try product updates out as soon as they are checked-in.
You can also now contribute directly to the development of the products by reviewing and sending feedback on code checkins, submitting bugs and helping us verify fixes as they are checked in, suggesting and giving feedback on new features as they are implemented, as well as by submitting code fixes or code contributions of your own. Note that all code submissions will be rigorously reviewed and tested by the ASP.NET MVC Team, and only those that meet an extremely high bar for both quality and design/roadmap appropriateness will be merged into the source.
Summary
All of us on the team are really excited about today’s announcement – it has been something we’ve been working toward for many years. The tighter feedback loop is going to enable us to build even better products, and take ASP.NET to the next level in terms of innovation and customer focus.
Thanks,
Scott
P.S.In addition to blogging, I use Twitter to-do quick posts and share links. My Twitter handle is: @scottgu
Earlier this week I blogged about the release of the ASP.NET MVC 4 Beta. ASP.NET MVC 4 is a significant update that brings with it a bunch of great new features and capabilities. One of the improvements I’m most excited about is the support it brings for creating “Web APIs”. Today’s blog post is the first of several I’m going to do that talk about this new functionality.
Web APIs
The last few years have seen the rise of Web APIs - services exposed over plain HTTP rather than through a more formal service contract (like SOAP or WS*). Exposing services this way can make it easier to integrate functionality with a broad variety of device and client platforms, as well as create richer HTML experiences using JavaScript from within the browser. Most large sites on the web now expose Web APIs (some examples: Facebook, Twitter, LinkedIn, Netflix, etc), and the usage of them is going to accelerate even more in the years ahead as connected devices proliferate and users demand richer user experiences.
Our new ASP.NET Web API support enables you to easily create powerful Web APIs that can be accessed from a broad range of clients (ranging from browsers using JavaScript, to native apps on any mobile/client platform). It provides the following support:
Modern HTTP programming model: Directly access and manipulate HTTP requests and responses in your Web APIs using a clean, strongly typed HTTP object model. In addition to supporting this HTTP programming model on the server, we also support the same programming model on the client with the new HttpClient API that can be used to call Web APIs from any .NET application.
Content negotiation: Web API has built-in support for content negotiation – which enables the client and server to work together to determine the right format for data being returned from an API. We provide default support for JSON, XML and Form URL-encoded formats, and you can extend this support by adding your own formatters, or even replace the default content negotiation strategy with one of your own.
Query composition: Web API enables you to easily support querying via the OData URL conventions. When you return a type of IQueryable<T> from your Web API, the framework will automatically provide OData query support over it – making it easy to implement paging and sorting.
Model binding and validation: Model binders provide an easy way to extract data from various parts of an HTTP request and convert those message parts into .NET objects which can be used by Web API actions. Web API supports the same model binding and validation infrastructure that ASP.NET MVC supports today.
Routes: Web APIs support the full set of routing capabilities supported within ASP.NET MVC and ASP.NET today, including route parameters and constraints. Web API also provides smart conventions by default, enabling you to easily create classes that implement Web APIs without having to apply attributes to your classes or methods. Web API configuration is accomplished solely through code – leaving your config files clean.
Filters: Web APIs enables you to easily use and create filters (for example: [authorization]) that enable you to encapsulate and apply cross-cutting behavior.
Improved testability: Rather than setting HTTP details in static context objects, Web API actions can now work with instances of HttpRequestMessage and HttpResponseMessage – two new HTTP objects that (among other things) make testing much easier. As an example, you can unit test your Web APIs without having to use a Mocking framework.
IoC Support: Web API supports the service locator pattern implemented by ASP.NET MVC, which enables you to resolve dependencies for many different facilities. You can easily integrate this with an IoC container or dependency injection framework to enable clean resolution of dependencies.
Flexible Hosting: Web APIs can be hosted within any type of ASP.NET application (including both ASP.NET MVC and ASP.NET Web Forms based applications). We’ve also designed the Web API support so that you can also optionally host/expose them within your own process if you don’t want to use ASP.NET/IIS to do so. This gives you maximum flexibility in how and where you use it.
Learning More
Visit www.asp.net/web-api to find tutorials on how to use ASP.NET Web API. You can also watch me talk about and demo ASP.NET Web API in the video of my ASP.NET MVC 4 Talk (I cover it 36 minutes into the talk).
In my next blog post I’ll walk-through how to create a new Web API, the basics of how it works, and how you can programmatically invoke it from a client.
Hope this helps,
Scott
P.S.In addition to blogging, I use Twitter to-do quick posts and share links. My Twitter handle is: @scottgu
A few days ago we released the ASP.NET MVC 4 Beta. This is a significant release that brings with it a bunch of great new features and capabilities.
The ASP.NET MVC 4 Beta release works with VS 2010 and .NET 4.0, and is side-by-side compatible with prior releases of ASP.NET MVC (meaning you can safely install it and not worry about it impacting your existing apps built with earlier releases). It supports a “go-live” license that allows you to build and deploy production apps with it. Click here to download and install it today.
The ASP.NET MVC 4 Beta will also be built-into the upcoming VS11 / .NET 4.5 beta that is coming out shortly. This week’s beta doesn’t work with the previous VS11 developer preview that shipped last September – if you are using the VS11 Developer Preview (or have it installed) you’ll want to wait until the VS 11 beta is released before trying out the new ASP.NET MVC 4 Beta functionality.
ASP.NET MVC 4 Features
The ASP.NET MVC 4 Beta includes a bunch of great new features and capabilities. Some of the highlights include:
Bundling and Minification – ASP.NET MVC 4 includes the new bundling and minification support we are also adding to ASP.NET 4.5. These features enable you to build web applications that load faster and feel more responsive to users, by minimizing the number and size of HTTP requests that your pages make. Included with the MVC 4 beta are new “cache busting” helper methods that enable easy proxy caching of bundled files (with automatic invalidation if you change the cached CSS or JavaScript). You can learn more about bundling and minification from my previous blog post about it.
Database Migrations – ASP.NET MVC 4 includes the new Entity Framework 4.3 release, which includes a bunch of great new features. One of the most eagerly anticipated features it provides is database migration support. This enables you to easily evolve your database schema using a code focused migration approach – and do so while preserving the data within your database. I’ll blog more about this in the future - you can also see a walkthrough of database migrations in this tutorial.
Web API – ASP.NET MVC 4 includes some fantastic new support for creating “Web APIs”. This enables you to easily create HTTP services and APIs that can be programmatically called from a broad range of clients (ranging from browsers using JavaScript, to native apps on any mobile/client platform). The new Web API support also provides an ideal platform for building RESTful services. I’ll be blogging much more about this support soon – it is really cool, and opens up a bunch of new opportunities. There are several tutorials, samples and screencasts covering ASP.NET Web API on the ASP.NET site to help you get started.
Mobile Web – ASP.NET MVC 4 includes new support for building mobile web applications and mobile web sites, and makes it much easier to build experiences that are optimized for phone and tablet experiences. It includes jQuery Mobile, and includes new support for customizing which view templates are used depending upon what type of device is accessing the app. See the ASP.NET MVC 4 tutorial series.
Razor Enhancements – ASP.NET MVC 4 includes V2 of our Razor View engine. Razor V2 includes a bunch of juicy enhancements that enable you to make your view templates even cleaner and more concise – including better support for resolving URL references and selectively rendering HTML attributes.
Async Support and WebSockets – You’ll be able to take advantage of some additional language and runtime capabilities when using ASP.NET MVC 4 with .NET 4.5 and VS 11. Async support is one of the big ones, and the ASP.NET MVC runtime support for this combined with the new C#/VB async language enhancements (which are super elegant and clean) is going to enable you to write incredibly scalable applications. You will also be able to take advantage of the new WebSocket support built-into .NET 4.5 to build applications with even richer browser/server communication.
I’ll be blogging a lot more about the above features in the weeks and months ahead. This is going to be an exciting release. There is a lot there that will both make you more productive (Bundling/Minification, Database Migrations, Razor V2) as well as enable you to build even richer web applications and experiences (Web API, Mobile Web, WebSockets).
Learning More About ASP.NET MVC 4
I gave a tech-talk about the new ASP.NET MVC 4 Beta at the Belgium and Dutch TechReady events last week. It provides a good overview that you can use to quickly come up to speed on the release.
You can also download my slides (feel free to re-use them however you want).
Summary
I’m really excited about the upcoming ASP.NET releases we have coming out this year. ASP.NET 4.5 and ASP.NET MVC 4 are going to deliver a ton of new capabilities and enhancements, and the tooling updates we have coming with VS 11 and WebMatrix make the developer experience awesome.
I’ll be blogging a lot more about them in the weeks and months ahead.
Hope this helps,
Scott
P.S.In addition to blogging, I use Twitter to-do quick posts and share links. My Twitter handle is: @scottgu
I’ll be presenting at the upcoming Belgium and Dutch TechDays next month. I’ll be doing three tech talks at each of the events:
Overview of Windows Azure
A look at ASP.NET MVC 4
ScottGu Unplugged
I’m particularly excited about the “A look at ASP.NET MVC 4” talk as it will be the first time I’ve presented on it (and it is shaping up to a really great release – more blog posts on that soon).
This is the second in a series of posts I’m doing on Windows Azure – which is Microsoft’s Cloud Computing Platform.
In today’s post I’m going to cover how to sign-up and get started with Windows Azure using a no-obligation 3 month free trial offer. This free trial costs nothing and doesn’t obligate you to buy anything at the end of it. It provides an easy way to try out and get started with Windows Azure.
Windows Azure Website
The http://www.windowsazure.com web-site provides everything you need to get started with Windows Azure – including overview content, developer tutorials and documentation, account management, and more:
On the www.windowsazure.com home page, as well as in the top-right hand corner of every page of the site, is a “free trial” link. Clicking it will take you to a sign-up page that enables you to quickly register a new account and get started with Windows Azure:
The free trial provides everything you need to get started with Windows Azure.
Three Month Free Trial Offer
We recently refreshed our Windows Azure free trial offer to make sign-up easier, ensure it is always risk/obligation free, and enable more services with it. You can click the “Sign up now” button above to register and have an active Windows Azure subscription ready to use in under 2 minutes.
What the Free Trial Provides
The free trial offer allows you to build and run applications on Windows Azure at no cost (and with no obligation to buy or pay anything at the end of the three month free trial). It includes a number of compute, database and storage services that you can use to build your applications. Some of the resources include:
I’ll cover more about what “750 small compute hours per month” means in a future post – but essentially it means that you have enough hours to continually run an application you build in a virtual server – dedicated and isolated just to you – on Windows Azure each month (there are 744 hours in a 31 day month: 24 hours x 31 days = 744).
The trial also includes a 1GB SQL Azure Database that you can store data within. SQL Azure Databases run on dedicated servers we manage and cluster (for high availability and scale-out). This means you don’t need to worry about installing, managing, or running your own database servers (which makes life easier). The trial also includes 20GB of high availability storage that you can use to store blobs, queues and non-relational tables.
What is Required to Sign-up for a Trial
When you click the “Sign up Now” button on the free-trial page you’ll walk-through a sign-up wizard that will ask you to provide three things:
The Windows LiveID account you want to use to use to sign-in and manage your account
A mobile phone number where we can send (via SMS) a verification code for you to enter
A credit card
We use the last two items for proof of identity. The credit card is not billed and during the free trial you’ll have a spending limit set to $0.
Free and No Risk
Spending limits are a new feature we added to Windows Azure last month, and ensure that you never have to worry about accidentally going over the resources included in a free offer and being charged. If you end up building an application that exhausts the monthly amounts included in the free trial before the month ends, and you have a spending limit set to $0, then we will by default disable the application for the remainder of the month (leaving your data in read-only mode) until the next month starts. This ensures you are never billed anything during the free trial.
You can optionally turn off the spending limit feature if you want to go beyond what the free trial provides (and pay for the incremental resources on top of what is provided in the trial) – but by default the spending limit is on (and set to $0) when you sign-up for a free trial to ensure that you never inadvertently get charged anything. This provides a no-risk way to evaluate Windows Azure. You can learn more about the spending limit feature here.
Tracking Usage
You can easily track what resources you’ve used on Windows Azure by clicking the “Account” tab of the www.windowsazure.com web-site. This is another new feature we added to Windows Azure last month, and it allows customers (both free trial and paid) to easily see what resources they’ve used and how much it is costing them. You can download the usage data as either a CSV data file (which you can open in Excel or other tools), or visualize the usage data within the browser:
You can also use the account tab to easily change payment methods (both to setup a new credit card or to switch to invoice-based billing), create new subscriptions, as well as optionally cancel subscriptions.
What if you don’t want to use Windows Azure at the end of the trial?
There is no obligation to use Windows Azure (nor buy anything) at the end of the three month free trial. So if at the end of it you aren’t ready to buy anything (or just want to hold off a few more months) there is no obligation to pay anything. At any point during the free trial you can also click the “account” tab of the www.windowsazure.com website and explicitly cancel your subscription.
Summary
The above post covers how to quickly sign-up for a subscription with Windows Azure. Its easy to do – and takes less than 2 minutes to complete. Once you are signed up you can build and deploy high-scale cloud applications. In future posts we’ll look at the steps to do this, and some of the cool features and options that Windows Azure enables for you.
Hope this helps,
Scott
P.S.In addition to blogging, I use Twitter to-do quick posts and share links. My Twitter handle is: @scottgu
As some of you might know, I’ve spent much of my time the last 6 months working on Windows Azure – which is Microsoft’s Cloud Computing Platform (I also continue to run the teams that build ASP.NET, core pieces of .NET and VS, and a bunch of other products too).
I’m pretty excited about where we are going with Windows Azure – it is going to enable a number of great new scenarios for developers. Over the next few months I’m going to be blogging a lot more about it – and I’ll cover both what it provides as well as how you can easily take advantage of it as developers.
Learn Windows Azure Talk
Before the holidays we held a special “Learn Windows Azure” event. A recording of the keynote I gave is now available to watch online. It provides a 90 minute end-to-end look at Windows Azure, covers what it is and how it works, and walks-through a bunch of demos + code on how you can program against it. You can now watch my talk online and download the slides and samples.
Over the new few weeks and months I’ll be blogging more, and will go deeper into Windows Azure and discus both what you can do with it, as well as how to easily get started.
Hope this helps,
Scott
P.S.In addition to blogging, I use Twitter to-do quick posts and share links. My Twitter handle is: @scottgu
This coming Monday (Jan 16th) I’m doing another online LIDNUG session. The talk will be from 10am to 11:30am (Pacific Time). I do these talks a few times a year and they tend to be pretty fun. Attendees can ask any questions they want to me, and listen to me answer them live via LiveMeeting. We usually end up having some really good discussions on a wide variety of topics. Any topic is fair game: technical, strategy, community, college basketball, etc.
You can learn more and register to attend the online event for free here. I’ll update this post with a download link to a recorded audio version of the talk after the event is over.
Hope to get a chance to chat with some of you there!
Scott
P.S. In addition to blogging, I am also now using Twitter for quick updates and to share links. Follow me at: twitter.com/scottgu
Dec 29th Update: the security update (MS11-100) has now shipped and is available to install via Windows Update, the Windows Server Update Service and as a download from the Microsoft Download Center.
The security update we are releasing resolves a publicly disclosed Denial of Service issue present in all versions of ASP.NET. We’re currently unaware of any attacks on ASP.NET customers using this exploit, but we strongly encourage customers to deploy the update as soon as possible.
We are releasing the security update via Windows Update and the Windows Server Update Service. You can also manually download and install it via the Microsoft Download Center. We will release the update on Thursday, December 29th at approximately 10am Pacific Time (US and Canada). We are announcing it ahead of time to ensure that administrators know that the security update is coming, and are prepared to apply it once it is available.
More about the Security Vulnerability
On Dec 28th 2011, details were published at a security conference describing a new method to exploit hash-table data-structures used in web frameworks. Attacks targeting this type of vulnerability are generically known as “hash collision attacks”.
Hash collision attacks attempt to populate a hash-table within a server app with large numbers of items whose keys resolve to the same hash code. These key collisions can significantly slow down operations on the hash-table, and with enough elements can cause a server to spend minutes (or even hours) processing them. This can block a web server from processing requests from other users, and cause a denial of service (meaning the web site becomes unresponsive or slow).
Attacks such as these are not specific to any particular language or operating system. Presenters at the security conference discussed how to cause them using standard HTTP form posts against several different web frameworks (including ASP.NET). Because these attacks on web frameworks can create Denial of Service issues with relatively few HTTP requests, there is a high likelihood of attacks happening using this approach. We strongly encourage customers to deploy the update as soon as possible.
The security update we are releasing on Thursday, December 29th updates ASP.NET so that attackers can no longer perform these attacks. The security update does not require any code or application changes.
Learn More
You can learn more about this security vulnerability from the Microsoft Security Advisory (2659883) we have already released. We will release the security update on Windows Update, the Windows Server Update Service and the Microsoft Download Center on Thursday Dec 29th at approximately 10:00am Pacific Time (US and Canada).
Dec 29th Update: the security update (MS11-100) has now shipped and is available to install via Windows Update, the Windows Server Update Service and as a download from the Microsoft Download Center.
If you have questions about the vulnerability or have any issues applying the update, you can post questions in the Security Vulnerability forum on the www.asp.net web-site.
For all the latest information, you can also follow the MSRC team on Twitter at @MSFTSecResponse.
As some of you might know, I’ve spent much of my time the last 6 months working on Windows Azure – which is Microsoft’s Cloud Computing Platform (I also continue to work on ASP.NET, .NET, VS and a bunch of other products).
Next Tuesday, Dec 13th we’ll be holding a special Learn Windows Azure training event for developers. It will provide a great way to learn Windows Azure and what it provides. You can attend the event either by watching it streamed LIVE online, or by attending in person (on the Microsoft Redmond Campus). Both options are completely free.
Learn Window Azure Event
During the Learn Windows Azure event attendees will learn how to start building great cloud based applications using Windows Azure.
I’ll be kicking off the day with a 90 minute keynote that will provide an overview of Windows Azure, during which I’ll explain the concepts behind it and the core features and benefits it provides. I’ll also walkthrough how to build applications for it using .NET, Visual Studio and the Windows Azure SDK (with lots of demos of it in action).
We’ll then spend the rest of the day drilling into more depth on Cloud Data and Storage, how to use the Visual Studio Windows Azure Tools, how to Build Scalable Cloud Applications, and close off with an Q&A panel with myself, Dave Campbell and Mark Russinovich.
Register Now for Free
The free Learn Windows Azure event will start at 9am (PST) on Dec 13th. You’ll be able to watch the entire event live on Channel9 or attend it in person. Both options are completely free.
Register now to watch online or attend the event in person for FREE
I hope to get a chance to chat with you about Windows Azure there!
Scott
P.S.In addition to blogging, I use Twitter to-do quick posts and share links. My Twitter handle is: @scottgu
The next release of .NET and Visual Studio include a ton of great new features and capabilities. With ASP.NET 4.5 you'll see a bunch of really nice runtime and tooling improvements with both Web Forms and MVC - as well as in the core ASP.NET base foundation that both are built upon.
Today’s post covers some of the improvements we are adding to the next release of Visual Studio to make working with CSS and CSS3 even better with ASP.NET projects.
CSS Color Picker
In previous versions of Visual Studio, the intellisense engine within the CSS editor provided a hard-coded dropdown list of named color values. The new release of Visual Studio replaces this with a full featured color picker that makes it easy to choose from colors already used elsewhere within the stylesheet – as well as to create new custom color styles.
When you are in the CSS editor and edit a color value for a CSS property, a new color picker will now automatically appear. It by default displays a list of previously used colors within the stylesheet – as well as a sample palette of default colors to use. You can select a color from this list using either the mouse or keyboard:
You can select the “+” icon to expand the list into a full-fledged color picker for more granular color selection. It lets you control the alpha channel by automatically converting any color into a CSS3 RGBA value when moving the opacity slider. It also includes a “color selector” function that allows you to use an eye-dropper to select a color from any other web-site you have loaded in a browser or from other apps you have running on your system:
Great Video:Watch this 60 second video to see the color picker in action. It shows using other colors in the same stylesheet, creating a new color, using the CSS3 opacity capabilities, as well as the eye-dropper to capture the color from another application/site.
Cross Browser and CSS3 Snippets
Writing stylesheets can sometimes feel a bit repetitive when it comes to working with all of the vendor specific versions of the same CSS3 properties. You often have to write the same property values for each of the browsers - which in some cases requires writing 5 identical values. It’s tedious but necessary work to support all browser versions.
The next version of Visual Studio includes support for CSS snippets that auto-generate all of the vendor specific properties. That means no more tedious searching and typing to get your CSS3 properties working cross-browser.
CSS snippets work just like code-snippets from other editors within Visual Studio today. For example, to invoke the snippet for the CSS3 transition property, simply type “transition” or select it from intellisense within a CSS stylesheet:
Then hit the TAB key and Visual Studio will execute the CSS transition snippet and generate the code to support all browser prefixes. It will also allow you to change the value only once and then automatically propagate it to all the other values properties:
Great Video: Watch this 60 second video to see CSS snippets in action. It demonstrates how snippets can help with both vendor prefixes, as well as to support scenarios like media queries to support multiple screen sizes, and cross browser font-face embedding.
Hierarchical CSS Indentation
A trend we’ve seen when looking at real-world stylesheets is that web developers are often using indentation to create and maintain parent/child relationships between the individual CSS rules. This creates a tree-like hierarchy that makes it easier to see the relationships between the rules and where they logically belong in the document:
In previous version of Visual Studio it was cumbersome to maintain these hierarchies manually, and if you did the CSS formatter would remove the extra indentation. That meant you had to take care of formatting the entire stylesheet manually.
In the next release of Visual Studio we are adding built-in support for both creating CSS hierarchies as well as maintaining them when either the selection or the entire document is formatted. This makes it really easy to review the structure of a stylesheet and the sometimes complex relationships of the cascading order of the rules within it.
The brand new CSS editor in Visual Studio also understands and supports common CSS hacks, and we brought this knowledge into the hierarchical indentation mechanism to maintain the cascading position of a rule even if it is prefixed with a hack as illustrated in the screenshot below.
Great Video:Watch this 60 second video to see CSS Hierarchical Indentation in action. It shows creating hirarchical CSS rules, as well as how they’ll work even when using CSS hacks.
Summary
The new release of ASP.NET and Visual Studio will make it easier to take full advantage of CSS within ASP.NET applications.
This post covered some of the CSS editor improvements we are making in Visual Studio to support this. My last post covered some of the JavaScript and CSS bundling and minification runtime work. In future posts I’ll also talk about some of the ASP.NET web form control and ASP.NET MVC helper improvements we are making to better use CSS as well.
Hope this helps,
Scott
P.S.In addition to blogging, I use Twitter to-do quick posts and share links. My Twitter handle is: @scottgu
The next release of .NET and Visual Studio include a ton of great new features and capabilities. With ASP.NET 4.5 you'll see a bunch of really nice improvements with both Web Forms and MVC - as well as in the core ASP.NET base foundation that both are built upon.
Today’s post covers some of the work we are doing to add built-in support for bundling and minification into ASP.NET - which makes it easy to improve the performance of applications. This feature can be used by all ASP.NET applications, including both ASP.NET MVC and ASP.NET Web Forms solutions.
Basics of Bundling and Minification
As more and more people use mobile devices to surf the web, it is becoming increasingly important that the websites and apps we build perform well with them. We’ve all tried loading sites on our smartphones – only to eventually give up in frustration as it loads slowly over a slow cellular network. If your site/app loads slowly like that, you are likely losing potential customers because of bad performance. Even with powerful desktop machines, the load time of your site and perceived performance can make an enormous customer perception.
Most websites today are made up of multiple JavaScript and CSS files to separate the concerns and keep the code base tight. While this is a good practice from a coding point of view, it often has some unfortunate consequences for the overall performance of the website. Multiple JavaScript and CSS files require multiple HTTP requests from a browser – which in turn can slow down the performance load time.
Simple Example
Below I’ve opened a local website in IE9 and recorded the network traffic using IE’s built-in F12 developer tools. As shown below, the website consists of 5 CSS and 4 JavaScript files which the browser has to download. Each file is currently requested separately by the browser and returned by the server, and the process can take a significant amount of time proportional to the number of files in question.
Bundling
ASP.NET is adding a feature that makes it easy to “bundle” or “combine” multiple CSS and JavaScript files into fewer HTTP requests. This causes the browser to request a lot fewer files and in turn reduces the time it takes to fetch them. Below is an updated version of the above sample that takes advantage of this new bundling functionality (making only one request for the JavaScript and one request for the CSS):
The browser now has to send fewer requests to the server. The content of the individual files have been bundled/combined into the same response, but the content of the files remains the same - so the overall file size is exactly the same as before the bundling. But notice how even on a local dev machine (where the network latency between the browser and server is minimal), the act of bundling the CSS and JavaScript files together still manages to reduce the overall page load time by almost 20%. Over a slow network the performance improvement would be even better.
Minification
The next release of ASP.NET is also adding a new feature that makes it easy to reduce or “minify” the download size of the content as well. This is a process that removes whitespace, comments and other unneeded characters from both CSS and JavaScript. The result is smaller files, which will download and load in a browser faster. The graph below shows the performance gain we are seeing when both bundling and minification are used together:
Even on my local dev box (where the network latency is minimal), we now have a 40% performance improvement from where we originally started. On slow networks (and especially with international customers), the gains would be even more significant.
Using Bundling and Minification inside ASP.NET
The upcoming release of ASP.NET makes it really easy to take advantage of bundling and minification within projects and see performance gains like in the scenario above. The way it does this allows you to avoid having to run custom tools as part of your build process – instead ASP.NET has added runtime support to perform the bundling/minification for you dynamically (caching the results to make sure perf is great). This enables a really clean development experience and makes it super easy to start to take advantage of these new features.
Let’s assume that we have a simple project that has 4 JavaScript files and 6 CSS files:
Bundling and Minifying the .css files
Let’s say you wanted to reference all of the stylesheets in the “Styles” folder above on a page. Today you’d have to add multiple CSS references to get all of them – which would translate into 6 separate HTTP requests:
The new bundling/minification feature now allows you to instead bundle and minify all of the .css files in the Styles folder – simply by sending a URL request to the folder (in this case “styles”) with an appended “/css” path after it. For example:
This will cause ASP.NET to scan the directory, bundle and minify the .css files within it, and send back a single HTTP response with all of the CSS content to the browser.
You don’t need to run any tools or pre-processor to get this behavior. This enables you to cleanly separate your CSS into separate logical .css files and maintain a very clean development experience – while not taking a performance hit at runtime for doing so. The Visual Studio designer will also honor the new bundling/minification logic as well – so you’ll still get a WYSWIYG designer experience inside VS as well.
Bundling and Minifying the JavaScript files
Like the CSS approach above, if we wanted to bundle and minify all of our JavaScript into a single response we could send a URL request to the folder (in this case “scripts”) with an appended “/js” path after it:
This will cause ASP.NET to scan the directory, bundle and minify the .js files within it, and send back a single HTTP response with all of the JavaScript content to the browser. Again – no custom tools or builds steps were required in order to get this behavior. And it works with all browsers.
Ordering of Files within a Bundle
By default, when files are bundled by ASP.NET they are sorted alphabetically first, just like they are shown in Solution Explorer. Then they are automatically shifted around so that known libraries and their custom extensions such as jQuery, MooTools and Dojo are loaded before anything else. So the default order for the merged bundling of the Scripts folder as shown above will be:
Jquery-1.6.2.js
Jquery-ui.js
Jquery.tools.js
a.js
By default, CSS files are also sorted alphabetically and then shifted around so that reset.css and normalize.css (if they are there) will go before any other file. So the default sorting of the bundling of the Styles folder as shown above will be:
reset.css
content.css
forms.css
globals.css
menu.css
styles.css
The sorting is fully customizable, though, and can easily be changed to accommodate most use cases and any common naming pattern you prefer. The goal with the out of the box experience, though, is to have smart defaults that you can just use and be successful with.
Any number of directories/sub-directories supported
In the example above we just had a single “Scripts” and “Styles” folder for our application. This works for some application types (e.g. single page applications). Often, though, you’ll want to have multiple CSS/JS bundles within your application – for example: a “common” bundle that has core JS and CSS files that all pages use, and then page specific or section specific files that are not used globally.
You can use the bundling/minification support across any number of directories or sub-directories in your project – this makes it easy to structure your code so as to maximize the bunding/minification benefits. Each directory by default can be accessed as a separate URL addressable bundle.
Bundling/Minification Extensibility
ASP.NET’s bundling and minification support is built with extensibility in mind and every part of the process can be extended or replaced.
Custom Rules
In addition to enabling the out of the box - directory-based - bundling approach, ASP.NET also supports the ability to register custom bundles using a new programmatic API we are exposing.
The below code demonstrates how you can register a “customscript” bundle using code within an application’s Global.asax class. The API allows you to add/remove/filter files that go into the bundle on a very granular level:
The above custom bundle can then be referenced anywhere within the application using the below <script> reference:
Custom Processing
You can also override the default CSS and JavaScript bundles to support your own custom processing of the bundled files (for example: custom minification rules, support for Saas, LESS or Coffeescript syntax, etc).
In the example below we are indicating that we want to replace the built-in minification transforms with a custom MyJsTransform and MyCssTransform class. They both subclass the CSS and JavaScript minifier respectively and can add extra functionality:
The end result of this extensibility is that you can plug-into the bundling/minification logic at a deep level and do some pretty cool things with it.
2 Minute Video of Bundling and Minification in Action
Mads Kristensen has a great 90 second video that shows off using the new Bundling and Minification feature. You can watch the 90 second video here.
Summary
The new bundling and minification support within the next release of ASP.NET will make it easier to build fast web applications. It is really easy to use, and doesn’t require major changes to your existing dev workflow. It is also supports a rich extensibility API that enables you to customize it however you want.
You can easily take advantage of this new support within ASP.NET MVC, ASP.NET Web Forms and ASP.NET Web Pages based applications.
Hope this helps,
Scott
P.S.In addition to blogging, I use Twitter to-do quick posts and share links. My Twitter handle is: @scottgu
Yes, I know we all have our feelings for VSS, but I've been using this little trick (for the lack of a better word) for several years now, and I thought it's about time for me to post it here in case is beneficial to anybody else. At the very first line on many of my programs you will find a region similar to the following:
#region Version Header
///<remarks>
/// $Workfile: MyLogger.cs $
/// Description: This class implements a logging mechanism by wrapping the ABC Library.
/// Author: José Luis Manners Docs: José Luis Manners
This is basically a header I use to document every .cs file. There's not worst feeling in the world than having to modify somebody else's code (or perhaps and old code of yours) and not even knowing what it's suppose to do or how its purpose has changed overtime. What's interesting about this header is that it takes advantage of the keyword expansion capabilities of VSS, so things like file name, modification date, version, etc., are automatically updated in the code by VSS every time you do a check-in. The keywords are those enclosed in '$', btw.
To make your life easier and avoid copy and pasting each time you create a new cs file, you can create a wizard template that has this header embedded in it, and when you create a new class the header will be automatically included with the code generated by VS.NET (you can find lots of information online on how to do modify VS.NET templates). In my case, everytime I create a new C# file I run a macro I wrote that prompts me for the description and takes care of filling in the non-VSS sections, including putting the system date in the "Created:" session, and generates the entire header.
There is a VSS keyword which I'm not showing and that is "$History: $". With this keyword you can have VSS keep a log of all the changes directly in your code, so information like version, remarks, name of person that checked-in that version, dates, etc., are stamped in your code. This is basically the information you can see from within VSS when you select "Show History" on a file and click on "History Details". Althought having all this historical information directly in the source code is a little overwhelming to some people (none the last redundant), it could also be very beneficial to others - you take your pick.
HINT: You can put the history log on a separate region in your code, that way it's "out of your way".
For more information on VSS keyword expansion features and the entire list of available keywords see the following link:
Thank you everyone for coming to my talk this past weekend at the Jacksonville Code Camp held in beautiful (and always under construction) Jacksonville, Florida. For those of you who asked, you can get the code I used during my demos from the following link:
Also, you can get more information regarding the temperature monitor and the serial/ethernet device server I used on my demos from the manufacturers links below:
Someone posted a message in one of the many newsgroups I frequently visit. He needed to find out at runtime how many Windows forms exist in a project. Here's the message and my solution to his problem in case anybody else finds it useful:
"Saludos
Estoy haciendo un proyecto WinForm y requiero saber cómo puedo ver las formas que están dentro del proyecto
Claro , con el explorador en modo diseño, solo que requiero verlas en en tiempo de corrida. No se si conoces en Access el objeto forms collection que te muestra las características de las formas de la currentdb, de manera que yo pudiera recorrer con una instruccion for each... todas y cada una de las formas y abrir una en particular. En Visual .net yo puedo instanciar una forma, pero lo hago sabiendo su nombre : no puedo por ejemplo decir for each frm in forms if frm.name='XXXX' frm.show exit for endif next ya que no existe el objeto forms que me muestre las formas del proyecto.
gracias"
We can easily obtain this information at runtime using Reflection. All we have to do is call the GetExecutingAssembly method to obtain an Assembly object that points to the assembly we're executing (our current project), we then call GetTypes on that assembly object to get a list of all the types defined inside of it. The rest is just looping through the list and check which type(s) match what we're looking for, in this case we're looking for Windows forms:
Somebody posted a message in the C# newsgroup asking for a way to populate a ListBox with the name of the months in Spanish. He basically had created an enum and wanted to fill up the ListBox from that enum. The enum looks like this:
publicenum Meses:int
{
Enero=1,
Febrero = 2,
Marzo = 3,
Abril = 4,
Mayo = 5,
Junio = 6,
Julio = 7,
Agosto = 8,
Septiembre = 9,
Octubre = 10,
Noviembre = 11,
Diciembre = 12
}
At first, one of the most simple ways that comes to mind is to do something similar to this:
ListBox listBox1 = new ListBox();
listBox1.Items.Add(Meses.Enero);
listBox1.Items.Add(Meses.Febrero);
listBox1.Items.Add(Meses.Marzo);
listBox1.Items.Add(Meses.Abril);
listBox1.Items.Add(Meses.Mayo);
listBox1.Items.Add(Meses.Junio);
listBox1.Items.Add(Meses.Julio);
listBox1.Items.Add(Meses.Agosto);
listBox1.Items.Add(Meses.Septiembre);
listBox1.Items.Add(Meses.Octubre);
listBox1.Items.Add(Meses.Noviembre);
listBox1.Items.Add(Meses.Diciembre);
This solution works fine, it does what's needed. But what happens if you want to have a localized version of your application in another language? It would look strange to have a ListBox with a label that says "Please select a month: " and the months inside the ListBox shown in Spanish, don't you think?. Besides, the values are kind of hard-coded in a sense, and personally, I've never been a fan of hard-coding anything.
Here comes CultureInfo to the rescue
Like with many other things in software development, there is always more than one way to produce the same results, and this is no exception. Believe or not, the 13 lines of code from the previous example could be easily reduced to only 3 (yes, you heard me right!!). All you really need to do is use a CultureInfo object and its DateTimeFormat property so you can get an array of strings with the name of the months already translated into the language of the culture you want. We then just add the array to the Items collection of the ListBox using the AddRange method:
// Get the CultureInfo from the Dominican Republic
If you want to develop (or continue "sharpening") your C# programming skills. I'd recommend you frequently check the Centro de Desarrollo Microsoft Visual C# (for Spanish speakers) or the Visual C# Developer Center (for English speakers). These two great C# resources contain courses, articles, technical presentations, and some other goodies which you can access directly from the respective site.
Or better yet, if you speak both languages... well you get the idea.
Recently I had a need to create a Form with a disabled close button. Believe or not, this simple task cannot done be achieved by simply configuring a property at design time, because no such design-time property exists. One alternative is to set the ControlBox property to "false", but in reality this removes the three buttons (minimize, maximize, and close) altogether.
After a little "googling" I found some examples but they were all using P/Invoke and/or were written in VB. But then I remembered that during my good old days of Win32/C++/MFC programming I used to change the visual style of a window class by setting up values from the constants in the include file winuser.h. In that file there was a constant named CS_NOCLOSE which was used to disable the close button in the window. That's cool, but... how can I use that stuff now?
Well, reading the beloved MSDN documentation (I really mean that) it turns out that the Form class has a property named CreateParams which allows you to set parameters that define the appearance of the form before it gets created. So the only thing that needs to be done is to override this property in my Form and add the value for CS_NOCLOSE that we want. Something similar to this:
protectedoverride CreateParams CreateParams
{
get
{
constint CS_NOCLOSE = 0x200;
CreateParams cp = new CreateParams();
cp = base.CreateParams;
cp.ClassStyle = cp.ClassStyle | CS_NOCLOSE;
return cp;
}
}
voilá, it works!! BTW, if you like to know where the include file is, it should be under “C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include”, or something close to that depending on your installation of the Framework. Here's a snapshot of how it looks like if your curious:
Like with the Datagrid Jerárquico (Hierarchical Datagrid) sample application, for long time I've been receiving emails from people asking me to send them an example on how to use log4net. So, I've figured is about time to put something together and keep it centralized so everybody can get it instead keep sending it via email. You can get this little app from the "Attachments" link.
"I am documenting my code with the XML tags included in .NET for this, but my comments inside these tags do not show"
Well, the first thing you need to do is to configure the project in VS.NET so that it generates XML documentation. This can be done in the property window under the "Build" tag, put the name of the XML file you want to generate under "XML Dcomentation File". Now complie your project and a file with the XML comments will be created.
Now take this file and process it with NDoc. This tool allows you to generate MSDN-like documentation of your code. This type of documentation will show the code included within the <example> and <code> tags.
Dave Fetterman of the Microsoft's .NET Base Class Library (BCL) Team just published this paper on using some of the new culture-agnostic methods of the String class in favor of using CultureInfo.InvariantCulture when writing localized applications.
Last week we had David McNamee from developerLabs, Inc. talking about some of the new features that will ship with C# 2.0. Although this is a well known subject among .NET ranks, what made his an interesting presentation was the practical and straight-forward way on which David treated topics like: generics, anonymous methods, partial classes, etc., and if you add to that his enthusiasm for .NET, then you have a great presentation in my opinion.
Another thing I liked was the way code was presented. Unlike other speakers that already have some pre-written code and all they do is add a few lines here and there, David wrote all the code from scratch. I think this technique gives the audience a better sense of knowing where everything is or coming from, while makes them more participant as the code progresses.
Good job David and hope to see you at CodeCamp this coming weekend !!
I've received a few emails from people inquiring about the sample code that demostrates how to create a hierarchical datagrid. You can download the code from the "Attachments" link below. Let me know if there are any questions and/or suggestions.
Cuando en C# necesitas llamar funciones de Win32 API que reciben cadenas de caracteres, debes ponerle cuidado al tipo de acceso que la función receptora le da al argumento como también al tipo de dato de .NET que le vas a enviar a dicha función.
Las funciones que usan cadenas de caracteres como argumentos de entra (in) pueden ser llamadas desde .NET con simplemente pasarle un objeto System.String. La traducción de System.String a LPTSTR es hecha por el compilador automáticamente mediante un mecanismo que se llama "marshaling". De esta manera la función puede acceder el argumento con el tipo de dato correcto. Pero a pesar de que el compilador hace la traducción, hay un factor adicional que hay que considerar cuando el argumento es utilizado como argumento de salida (out).
Cuando un argumento es de salida quiere decir que el argumento va a ser modificado internamente por la función receptora. Recuerda que los objetos System.String son inmutables, o sea, no se pueden cambiar y si le cambias el valor, un nuevo objeto será creado. Por lo tanto si envías el argumento como System.String cuando la función lo modifique y lo recibas nuevamente ya no va a ser el mismo objeto que originalmente enviaste. La manera de solucionar esto es pasarle a la función un objeto StringBuilder en lugar de System.String. El compilador hará la conversión de un objeto StringBuilder a un LPTSTR y cuando la función lo modifique y regrese todavía será el mismo objeto StringBuilder que enviaste.
Pongamos este conocimiento en práctica con algo de código. Vamos a llamar la función GetComputerName del Win32 API. Esta función tiene el siguiente prototipo:
BOOLGetComputerName(
LPTSTRlpBuffer,
LPDWORDlpnSize
);
Entonces en C# la declaramos con el siguiente prototipo:
Cuando llamas GetComputerName la función te devuelve el nombre de tu computadora en el objeto buffer que le pasaste. Ahora bien, si cambias el prototipo para que reciba un String y llamas la función pasándole un objeto String, notarás que tu objeto no contiene el valor esperado.