BusinessRx Community

Dedicated to the advancement of software, technology and the people who devote their lives to it.

Welcome to BusinessRx Community Sign in | Join | Help
in Search

BusinessRx Reading List

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.

June 2008 - Posts

  • Random Grammar/Style Question

    When writing my Security Tutorials for www.asp.net, I often wrote sentences like the following: “To log in to the site, ...” Although sometimes I'd write it, “To log into the site, ...” and other times I'd use, “To login to the site...”

    I can't say with certainty whether any one of these three are grammatically correct or if any are grammatically incorrect. My guess is that in the sentence above, “To login to the site...” is incorrect because, according to Dictionary.com, log in is a verb, while login is a noun. In other words, you would only use the word login in a sentence like, “Your login is comprised of a username, password, and PIN.“ That leads me to believe that the correct form is, “To log in to the site,“ but I'm sure someone out there can make a case for “To log into...“

    In any case, I should have picked a particular approach and used it throughout, rather than varying the styles throughout the tutorial series. If it's any consolation, I assure you that the variance was done on a purely subconscious level.

    All that being said, what do you prefer?

    • To log in to the site...
    • To log into the site...
    • To login to the site...

    The more I read it and think about it, I believe the latter one to be grammatically incorrect.

    Another thing I noticed is that when I read them there is a very subtle pronounciation difference among the three sentences, although I don't know how clearly that difference translates into the spoken word. When pronouncing login I run the “g” and “in” together, like I'm speaking 1.5 syllables instead of two. Log in to are pronounced as three distinct words with a briefest of pauses between each, whereas log into is pronounced as two distinct words: “log” and “into,” with no pause between “in” and “to” (again, almost as if blurring the two words together into 1.5 syllables).

  • The Economics Behind Writing Subsequent Editions (for Computer Trade Books)

    The economics behind the college text book must be interesting. I've not written any textbooks, so my comments here are based more on assumption than knowledge, but what I but what always intrigued me - whilst a college student, at least - was how authors would release different versions of books and how teachers would require students to buy the most recent version (or whatever version the class was using). I can understand updated versions for cutting edge fields, like biosciences and computer-related topics, but has the knowledge or instruction of introductory level Calculus changed any since Newton and Leibniz's time? And if not, then why does a book like Calculus and Analytic Geometry - a highschool level Calculus book - have nine editions? What has changed so significantly since the eighth edition to warrant a ninth?

    As a student, I was always envious of those authors who wrote a new edition. I figured it must be easy money.

    1. Correct a few typos from the previous edition,
    2. Replace some of the sample problems,
    3. Have professors (or school board administrators) require that all students use the most recent version, and
    4. PROFIT!

    Sure, writing the first version might take an inordinate amount of time and energy and effort, thereby rendering the profit per unit time to be less than ideal, but once you got past writing the initial version, each subsequent version had an incredible ROI. Not only that, but with textbooks selling in the $50-$150 range (compared to the $9.95 you pay for the mass market Stephen King novel), those professors must be raking in the dough.

    (As an aside, I'd be interested in any insight from authors or publishers or agents who have experience in this niche market. What are the royalties like for professors? Are they in the 10-15% range, like for computer trade authors, or are they higher (or lower)? How many copies does a successful textbook sell? I imagine that writing textbooks is like any other profession - you have a very small handful of extremely successful people - e.g., the authors whose book becomes the de facto standard for teaching a common subject across many universities or high schools and who can profit handsomely from future editions - but the vast majority of textbook authors could have earned more had they worked at a restaurant for those hours they spent their time writing, editing, and reviewing their book. In other words, I assume it's very similar to the field for writing computer trade books, except in computer trade book land, an 'extremely successful' author likely could make more money working a regular 9-5 job in industry than she could writing books full time.)

    Despite having authored seven books on ASP and ASP.NET, I haven't really had much opportunity to work on 'second editions.' The challenge with computer technologies is that they change so radically so quickly that the 'second edition' is really about a brand new technology with many new and exciting features that require virtually rewriting the previous edition in its entirety. For example, my first two books were on ASP, my third on ASP.NET. ASP and ASP.NET are two very different technologies, and are different in very fundamental and important ways. I don't think I've seen a single book with a consistent title gracefully move from ASP to ASP.NET.

    But what about ASP.NET? We've had five versions of the .NET Framework - 1.0, 1.1, 2.0, 3.0, and 3.5 - but only three of them had enough difference between them and previous versions to warrant a new edition (namely, version 1.0/1.1 to 2.0 and 2.0 to 3.5). And the changes from 1.x to 2.0 were profound enough that new editions between these versions required many new chapters. Granted, the move from 2.0 to 3.5 was less radical and offered an excellent opportunity for established ASP.NET authors to release a new edition with much less energy and effort than is needed to start a book anew or was required when transitioning from 1.x to 2.0. (I'll have more thoughts on this in a future blog post, when I write about my latest book, Teach Yourself ASP.NET 3.5 in 24 Hours.)

    The point of it all is that, at least in the ASP.NET world, writing subsequent editions is not something that is as easy to do as you might imagine. Yes, it's easier than writing a book from scratch, as you already have an outline down and can reuse certain content, but it's not as easy as (I imagine) authors in other fields have it when producing a new edition. This is something to keep in mind if you're deciding whether to start writing computer trade books. If your plan is to write an initial book at an economic loss, but to make up that loss with future editions, chances are you'll need to reevaluate your plan. As I said in my first blog entry on the economics of writing computer trade books, “If your dream is to become a rich man, don't write computer trade books.” :-)

  • Not NotNorthwind

    Scott Hanselman, one of my favorite bloggers, has expressed his deep disdain for Northwind.

    I'm just sick of Northwind. Sick to death of the Northwind Database. You know, this is the Products, Categories, Suppliers, yada yada yada sample database that you've been seeing in Microsoft demos since the beginning of time. (FYI, the beginning of time was about 1997. ;) ) ... When I'm showing some technology that is talking to a Database or to POCO (Plain Ol' CLR Objects) I still need good sample data to pull from. Thus, the Northwind Virus continues. And I hate it with the heat of a thousand suns.

    Sure, there are other Microsoft endorsed sample databases (most notably, AdventureWorks), but Northwind, despite its age and limitations, is still the de facto database for articles, demos, and talks involving Microsoft technologies.

    What's wrong with Northwind? Scott focuses on his emotional distate and doesn't really provide any logical or rational reasons as to why he hates Northwind so passionately. Northwind certainly has its shortcomings - it's at times overly simple (very small amounts of data in each table, for example). The main two shortcomings that get under my skin are:

    • It is, literally, very dated. The date/time values in the database are from the mid-1990s, for instance. Which is a little odd and discomforting when demoing an application that allows users to filter orders by their date, and having to enter sample dates within the year 1996.
    • The images stored in the Categories table are stored as grainy, low-quality 16-color BMP images that includes an OLE header that must be stripped out. I detail these pains in Displaying Binary Data in the Data Web Controls. The short of it is that the category images are ugly and use a poor image file format for the web with antequated image quality settings. 

    Scott proposes that the community band together and develop a new sample database:

    I suspect, though, that if we (the community) took a few weeks, did some Skype conference calls, assigned some tasks, brainstormed and did it, we could come up with NotNorthwind. The Lazy Web, the Web of Clay Shirkey, .NET Flash Mobs included, could create a sample database, (we can argue about whether to start in the middle or in the db in the first meeting) as well as some good examples of things like NHibernate, LINQ to SQL or Whatever.

    I don't know if this makes the most sense or if it's the best use of time and energy and effort. As Steve Smith points out, the reason Northwind 'works' is because virtually anyone who has attended a Microsoft talk knows what Northwind is already. There's no need to spend 5-10 minutes explaining the data model of some new, community-created database. Steve explains:

    The first stated requirement for NotNorthWind is this:

    • Complex enough to be called Real World but simple enough that someone could "get it" in 5-10 minutes

    That alone is enough for me, as a presenter, to suggest that perhaps this is not a good idea. In the course of such presentations, which usually have 75 minutes or so allocated to them and very little tolerance for going over, I don't have an extra 5-10 minutes per presentation to stop everything and explain what the heck I'm using as my data for this thing. ... Enter NorthWind, the HTTP standard of databases, understood by virtually all Microsoft developers without need for preamble.  It just works.  With the words, "I'm using Northwind for my database." I now have the complete understanding of 95% of the people in the room - we're all on the same page - and I can continue with the actual point of the presentation or demo, which is not, has not, and probably will never be, "why this database isn't Northwind."

    But that isn't Northwinds only selling point. Other benefits include:

    • It has few enough tables to not overwhelm a person new to the data model, yet enough that interesting and real-world examples can still be drawn from it.
    • It has stored procedures and views. Granted, there are only a handful of sprocs and views, and neither are very interesting, but at least there are some sprocs and views, so that demos can use these features, if needed.
    • It has Unicode characters (in the Products.ProductName column).
    • It has examples of storing binary data directly in the database in the form of the category images, albeit the images leave a lot to be desired.
    • There are foreign key constraints in place.
    • It models a common business scenario that everyone can wrap their heads around: products, categories, suppliers, employees, customers, orders, and order details.
    • And, perhaps most importantly, it is a Microsoft-approved database. In short, Microsoft has the license to use the product names, supplier names, and employee names in Northwind in their literature and technical papers. When reviewing some sort of database viewer for my Toolbox column in MSDN Magazine, I cannot show a screen shot of the tool displaying any old database. Rather, I have to use one of the Microsoft-approved databases: AdventureWorks or Northwind.

    I'll be honest, I like Northwind. I don't love it, but I don't hate it, and I certainly don't hate it with the heat of a thousand suns. :-) I used Northwind extensively in my Working with Data tutorials, and I use it in LUG talks and in the classroom. I've used it so often I have many of the values memorized. For example, I can recite from memory the categories in order of CategoryID - Beverages, Condiments, Confections, Dairy, Grains, Meat, Produce, Seafood. I know that Chai Tea is the first product, and Chang the second. I know the big boss man is Andrew Fuller. You could say I have a sort of affinity for this database, its products, categories, employees, and customers. Yes, it is far from perfect and could use some updating with regards to the date/time values and the category pictures, but those warts aside, it does a good job at what it was designed to do.

  • Two New Master Page Tutorials Published

    As I noted in an earlier blog post, in May the first of my Master Pages tutorials were published on www.asp.net. Two new master page tutorials were put online today:

    • URLs in Master Pages [VB | C#] - one challenge with master pages is that the master page and linked resources - image files, hyperlinks, stylesheet files, and so on - may exist in different folders, thereby breaking relative URLs. This tutorial includes tips on how to declaratively and programmatically overcome this challenge.
    • Control ID Naming in Content Pages [VB | C#] - both master pages and ContentPlaceHolder controls introduce a new naming container, which adds additional text to the rendered HTML elements' ids. This introduces challenges when referencing the controls through client-side script. It also complicates programmatically referencing the controls in the server-side code-behind class. Read this tutorial for workarounds and remedies to these issues.

    There will be a total of 10 tutorials. The next batch looks at interaction between content and master pages.

    Like my past tutorials, these tutorials are all available in C# and VB versions, include a complete working source code download, and are available to download as PDF, as well.

    Enjoy! - http://asp.net/learn/master-pages/

     

  • June Lounge Update

    June was another great month for The Lounge. We picked up Developer Express, Kinetic Jump, NDepend as advertisers. Another great set of new advertisers.

    I am happy to announce the first addition to the .NET room in a couple of months:

    It's rare I find a site that I think would fit into this room, the bar is set very high with the excellent sites that are currently in the room, but Matt Berseth's blog is such an excellent resource that I am thrilled to have him on-board.

    I also added a number of new sites to the Small Publishers .NET room:


    DimeCasts.NET is a new site focused on short screen casts that cover a specific topic. I have been very impressed with how quickly this site has been growing.


    Keith Elder is an excellent blogger and if you might know him as the new co-host of Deep Fried Bytes.


    Almost all of my Lounge sites are blog sites so Dot Net Perls is a little bit of a change since it is more of an article focused site, but the content is consistently good so I felt it fit in perfectly..

    If you have a blog that you think would be a good fit for The Lounge or would like to advertise in one of our rooms please drop me an email.

    I have some big changes coming for The Lounge and look forward to continue growing this network.

    -James

  • What Do You Use to Read / Consume Blogs, News Sites, and Other RSS Feeds?

    When I first started blogging and reading others' blogs, I tried out two stand-alone desktop applications for keeping up to date with my favorite bloggers and other news sites:

    While both RssBandit and FeedDemon have slick UIs and are easy to use, I haven't used either for several years. My main gripe was not with the programs, per se, but the model itself: I didn't like having a separate program for reading blog entries. For starters, it wedded my blog subscriptions to a single computer. Second, it meant yet another program I'd have to launch at startup and yet another icon cluttering up my task tray. Back in October 2005 I wrote a blog entry lamenting stand-along blog readers: The Future of Third-Party Offline Aggregators? Are RssBandit and its Kin Dead Weight?

    There are a number of popular offline aggregators available.  By 'offline' I mean that these aggregators can be used while not connected to the Internet. ... The future of aggregators, in my opinion, are those that are either online ... or are part of the experience of existing 'everyman' applications (i.e., email or web browsing) and, preferrably, are preinstalled with the software.  The online aggregators seem to make a lot more sense, having a number of advantages of their offline kin:

    • Not bound to a particular computer -  I can be at home, at the office, or on vacation - my subscriptions travel with me.
    • Can utilize the 'social network' - services like Findory make it easy for me to get recommended news and blog items based on my clickthroughs.  Services like del.icio.us allow me to share my online habits/sites/subscriptions with others with like interests.  I can see what the most popular feeds are, or explore the subscriptions of those whose interests match mine.
    • Easier to 'install' and 'uninstall' - want to install My Yahoo! on your computer?  Fire up the ol' browser and enter http://my.yahoo.com - couldn't be easier.  And uninstalling's as easy as not visiting the site again.
    • No resource consumption - doesn't matter if I subscribe to one feed or a hundred - the disk space and bandwidth consumed on my computer stay constant when using an online service.

    Another advantage of online blog readers (or any online application, for that matter) is uniquitous upgrades. When Microsoft releases a new version of Office, it is applied only to those peoples' computers who buy the upgrade and install it. When Microsoft releases a new version of Hotmail, however, the update is applied to all users instantaneously. This leads to more rapid application updates, features, and bug fixes.

    Since my blog post in 2005, we have seen better integration of RSS feed support in the 'everyman' applications. Both IE and Firefox have RSS subscription capabilities (albeit rather primitive support), as does Outlook 2007. And virtually every online portal website has the ability for users to subscribe to RSS feeds. Third-party offline blog readers are always going to be at the far end of the long tail, especially with the commodity-like status of RSS aggregators these days. I don't think third-party offline readers will every necessarily die off, but they will be used only by a select and small crowd of experienced computer enthusiasts who prefer them over more mainstream or online options for some very specific reasons. And, for most people, those benefits, whatever they may be, are not strong enough to outweight the cost of downloading the application, installing it, setting it up, and learning how to use it.

    I'm curious - what do you use to consume blogs and other RSS feeds? Do you use a stand-alone program, or something that's integrated with Outlook? Do you use an online service?

    These days, I use Google Reader to subscribe to and keep up to date with the myriad of blogs, news sites, sport sites, and online comics I follow. Google Reader gives me one spot - accessible anywhere in the world - where I can catch up on and manage my RSS subscriptions. Google Reader also has the early stages of social networking baked in. You can share particular blog items and see your friends' shared items. And Google Reader can offer recommendations on feeds you may like based on what feeds people with similar interests have subscribed to.

  • Conference Schedule

    I held off on hitting any conferences the first part of this year, my wife was pregnant and now we have a beautiful little girl to take care of. I am starting to think about what I will hit the rest of the year though, here is my tentative schedule:

    August 2nd - BarCampRDU
    August 9th - CodeStock (hopefully going to speak at this one)
    August 15-17th erubycon (not sure about this one yet, it would be fun to see my columbus buddies)
    October 5-7th Alt.NET Open Space (hopefully it doesn't move and conflict with RubyConf)
    November RubyConf - don't remember the dates and the site isn't updated yet, but I look forward to hitting RubyConf again this year.

    Any others I should check out?

    -James

  • Silverlight 2 Beta2 Released

    Silverlight 2 Beta2 was released today.  You can download both Silverlight 2 Beta2 and the Visual Studio and Expression Blend tools support to target it here.

    Beta2 adds a lot of new features (more details below), but is still a 4.6 MB download that takes less than 10 seconds to install on a machine.  It does not require the .NET Framework or any other software to be installed for it to work, and all features work cross-browser on both Mac and Windows machines.  These features will also be supported on Linux via the Moonlight 2 release.

    Silverlight 2 Beta2 supports a go-live license that allows you to start using and deploying Silverlight 2 for commercial applications. There will be some API changes between Beta2 and the final release, so you should expect that applications you write with Beta2 will need to make some updates when the final release comes out.  But we think that these changes will be straight-forward and relatively easy, and that you can begin planning and starting commercial projects now.

    You can build Silverlight Beta2 applications using the VS 2008 Tools for Silverlight and Expression Blend 2.5 June Preview downloads.  You can download both of them here.  The VS 2008 Tools for Silverlight download works with both VS 2008 and the recent VS 2008 SP1 beta release. 

    UI and Control Improvements

    Silverlight 2 Beta2 includes a bunch of work in the UI and Control space:

    More Built-in Controls

    In Beta 1 only a few controls were included with the core Silverlight setup.  Most common controls (including Button, ListBox, Slider, etc) were shipped within separate assemblies that you had to bundle with your applications (which increased the app download size).  Beta 2 now installs 30+ of the most common controls as part of the core Silverlight 2 download.  This means that you can now build Silverlight 2 applications that use core controls that are as small as 3kb in size - making Silverlight application downloads small and startup time fast.

    In addition to the core controls included with the base Silverlight 2 setup, we are also this week shipping additional higher-level controls that are implemented in separate assemblies that you can then reference and include with your applications.  This includes controls like DataGrid (more details on its new Beta2 features below), Calendar (now with multi-day selection and blackout date support in Beta2), and a TabPanel control (new in Beta2).

    We ultimately expect to ship over a 100 controls for Silverlight.

    Control Template Editing Support

    One of the most powerful features of the WPF and Silverlight programming model is the ability to completely customize the look and feel of controls.  This allows developers and designers to sculpt the UI of controls in both subtle and dramatic ways, and enables a tremendous amount of flexibility.  I covered these concepts a little in my previous Silverlight Control Templating blog post here.

    This week's Expression Blend 2.5 June Preview now adds designer support for editing control templates - which makes it easy for you to quickly change the look of any control without having to drop-down to XAML source to-do it. 

    To see control template editing in action, just drag/drop two Slider controls onto the Expression Blend design surface:

    We might decide that the slider head in the default Slider control template is too large and wide for our application.  To use control template editing to change it, we can right-click on one of the sliders in the designer and select the "Edit Control Parts" context menu item.  We can choose to create a new empty control template for our slider (and start from scratch), or alternatively edit a copy of the built-in control template (and start from that and tweak it):

    After we choose to edit a copy of the existing control template, Blend will prompt us to create and name a re-usable style resource that we'll define our control template within.  We can name it and then choose to store the style at either the application level (within App.xaml) or within our current page/user-control:

    When we click "ok" we'll find ourselves in template editing mode for our Slider control.  We can change, tweak, or add/remove any of the underlying elements within the Slider control's template.  Notice below how in template editing mode we can see and select any of the underlying elements that make up the slider's control template (these are circled in red below in the "Objects" window). 

    To make our slider head narrower, we can select the "HorizontalThumb" element within the control template and adjust its width (either graphically or via the property grid): 

    We can then use the breadcrumb navigation bar at the top of the designer to navigate back to our page and see the control template changes applied:

    Notice that right now only one of our slider controls is using the new Style resource with the control template we defined. 

    To apply the same style resource to the other slider control as well, we can select it, right-click, and then use the "Apply Resource" context menu to apply our "ScottSlider" style to it as well:

    Once we do this both our sliders reference the same style:

    Changes we make to the "ScottSlider" style going forward will automatically apply to both controls.

    Note that all controls shipped with Silverlight 2 support control templates and will support the above editing experience in Expression Blend.

    Visual State Manager (VSM) Support

    Control templates in Silverlight and WPF support customizing both the "look" of a control, as well as the "feel" of a control.  By "feel" I mean changing its interactive responsiveness.  For example: how it reacts when pushed, when it gets focus, loses focus, is in a pushed state, is in a disabled state, has something inside it selected, etc.  Often you want animations to execute when the user interacts with a control like this.

    One of the new things we are introducing with Silverlight 2 Beta2 is a "Visual State Manager" (VSM) feature that makes it much easier to build interactive control templates.  VSM introduces two basic concepts that you can take advantage of within control templates: "Visual States" and "State Transitions".  For example, a control like Button defines multiple visual states for itself - "Normal", "MouseOver", "Pressed", "Disabled", "Focused", "Unfocused".   When in template editing mode in Blend, designers now have the ability to easily edit what the button looks like in each particular state, as well as setup transition rules to control how long it should take to animate when moving from one state to another.  At runtime Silverlight will then dynamically run the appropriate animation Storyboards to smoothly move the control from one state to another.

    What is nice about this model is that designers do not need to write code, do not need to manually create animation storyboards, and do not need to understand the object model of controls in order to be productive.  This makes the learning curve for creating interactive control templates really easy, and means that existing graphic designers can very easily work on Silverlight projects.  Later this year we will also be adding Visual State Manager (VSM) support to WPF as well, which will let you use the same approach with Windows applications as well as share control templates between WPF and Silverlight projects.

    To see an example of this in action, let's add a Button control onto our design surface:

    We can then right click on the button and edit its control template. Instead of starting with the existing default control template (like we did with the slider example above), let's create an empty control template and start from scratch:

    Blend will prompt us for the name of the Style resource we want to create.  We'll name it "ScottButton" and click ok.  This will then put the designer in control editing mode for the Button, and start with an empty control template:

    One of the things to notice above is the new "States" window inside Blend.  This will show us all of the available "Visual States" that the Button control exposes.  Above the "Base" state is currently selected - which allows us to define the common visual tree of our Button control template. 

    We can then add some vector elements into our base state that defines the look of a custom button like below.  We could use the built-in vector drawing tool support provided by Blend to author these graphics, or alternatively use Expression Design or Adobe Illustrator to build the vector art and then import it into Blend.  Below we are adding 4 "Path" elements into our control template - one a rounded background (named "background"), one a drop shadow (named "shadow"), one a 40% opacity "shine" that adds a glow near the top, and one that defines the default inner content (in this case a picture of a house):

    Note: we could have alternatively imported an image, but using vector elements will give us the flexibility to scale/stretch/transform the button later and retain a crisp look and feel at any resolution or scale (particularly useful with Silverlight mobile scenarios - where screen resolutions might be different or smaller).  It will also allow us to easily animate/change any vector element within the artwork.

    Once we've finished designing our base state above, we can press F5 to run our application in the browser:

    As you can see above - our Button control now has a nicer look.  Despite its new look, the button still raises the same focus, click and hover events just like before - so a developer using the button does not need to change any code when working with a button that uses our new control template.

    One downside with our new button control template, though, is that it isn't interactive.  This means that I don't get any visual feedback if the button gains/looses focus, or if a mouse hovers over it.  I also don't get a nice depress/bounce-back animation when I click it.

    To add interactivity to our button, we'll return back to Blend and work with our Button's control template again.  Previously we added vector graphic elements to the "Base" state of our Button control.  This allowed us to define the default visual look of all visual states of our Button.  We can now go back and customize individual Button visual states further.

    For example, to implement a mouse-over behavior for our Button, we can select the "MouseOver" state in the "States" window, and then tweak the look of the button when it is in that state.  Below I've selected the "shine" vector element inside our control template and adjusted its Opacity property in the property grid to have it be more visible when in the MouseOver state.  Notice how Blend automatically highlighted the "Shine" element with a red dot and then listed the Opacity property below it in our objects window.  This makes it easy to quickly track all changes that we've made between the "Base" state and the "MouseOver" state in our control template:

    We can then select the "Pressed" state in the "States" window, and customize what a button looks like when it is pressed.  We'll change two things from the "base" state.  The first change is to make the "shine" element visible (like the MouseOver state). The second change will be to slightly offset the contents of the button control - while keeping the shadow element stationary.  This will give the button a nice "depressed" look and contrast nicely with its base visual:

    We can implement the offset change to the background, content and shine elements by selecting them in the designer, and then apply an offset render transform to them in the property browser:

    And now when we run our application again in the browser, we'll find that our Button now has interactive visual feedback when it is being used.  Below is the "normal" look of our Button:

    Hovering the mouse over the Button will then cause it to glow like below:

    Clicking the button will then cause it to depress and hide the shadow (it will then bounce back once the mouse button is released):

    Note that we did not have to write any code or XAML to change our Button's look and feel - the new Visual State Manager feature automatically handled moving between visual states for us. 

    By default Silverlight dynamically constructs and runs a transition Storyboard for you as you move from visual state to visual state (providing a smooth animation between the two states).  You do not need to write any code in order to make this happen (note: you do still have the ability to drop down and add a custom Storyboard transition if you want to, but for most cases you can probably use the automatic Storyboard transition).

    One feature you can take advantage of with Silverlight's automatic transition feature is to customize the time duration it takes for a visual state transition to occur.  You can do this by clicking the arrow to the right of a visual state and setup a rule that controls how long it should take the transition animation to run when moving from one particular state to another.

    For example, we could indicate that we want it to take .2 seconds to transition from the "Normal" to "MouseOver" visual state by adding the rule below:

    We can then configure this rule to take .2 seconds to transition between Normal->MouseOver like so:

    We can then click on the "MouseOver" state and setup a rule that causes the transition from MouseOver->Normal to take .4 seconds:

    Now when we re-run our application we'll have slower animation transitions for MouseOver scenarios, which adds a slightly smoother and more polished feel to our application.  We did not have to write a single line of code to enable this.  All controls shipped with Silverlight 2 will have built-in support for Control Template and Visual State Manager customization like above.

    To learn more about the new Visual State Manager and Control Template Editing features, please check out the tutorials here and here, and the videos on it here, here, and here.

    TextBox

    Beta2 includes some significant improvements to the built-in TextBox editing control.  Text scrolling with text-wrap, multi-line text selection, document navigation keys, and copy/paste from the clipboard are now supported.

    Beta2 also now includes IME Level 3 input support (including candidate window selection) for non-western character sets:

    Input Support

    Beta2 adds additional keyboard support in FullScreen mode (arrow, tab, enter, home, end, pageup/pagedown, space).  Note: full key input support isn't allowed to avoid password spoofing scenarios.

    Beta2 also adds new APIs to support inking and stylus input support.

    UI Automation and Accessibility

    Beta2 adds UI Automation Framework support into Silverlight.  UI Automation (or UIA) enables screen readers and other assistive tools to identify and interact with the components that make up your Silverlight 2 application.

    Beta2 uses the UIA framework and adds UIA based behaviors to an initial set of Silverlight controls.  By the final release of Silverlight 2 all controls will have UIA based behaviors built-in.  We will also add support for high-contrast scenarios.  These features will enable you to build accessible, section 508 compliant, applications.  This UIA support will also enable automated UI testing of applications.

    Animation and Graphic System

    Beta2 adds support for animating custom dependency properties.  Object animation support (animating structs) is also now supported.  Beta2 also supports the ability to create Storyboards in code that can animate parts of the render tree without having to be added to it (allowing you to embed animations entirely in code).  Per frame animation callback support will be added in the final release.

    Beta2 includes a new Visual Tree Helper static class that provides advanced visual tree inspection APIs.  It provides features such as the ability to enumerate children of an element and getting the ancestor/parent of a given reference element.  These APIs work against any UIElement you pass to it.

    DeepZoom

    Beta2 now supports an XML based manifest file for DeepZoom collections.  Beta2 also adds extensible MultiScaleTileSource support for DeepZoom (which allows developers to hook up existing image pyramids that don’t conform with the Deep Zoom format to the high performance rendering of Deep Zoom).

    WPF Compatibility

    Silverlight Beta2 includes a lot of fixes/changes to improve API compatibility between Silverlight and WPF (note: the final Silverlight release will contain some additional compatibility work as well).  We are also adding some new APIs we are introducing in Silverlight 2 to WPF in .NET 3.5 SP1 this summer.

    This work, combined with the VSM support we are adding to WPF later this year, will enable good code re-use across browser and desktop applications.

    Media Improvements

    Silverlight 2 Beta2 includes some significant Media related feature work:

    Adaptive Streaming

    Beta2 adds support for "adaptive streaming" - which enables you to encode media at multiple bit-rates and then have a Silverlight application dynamically switch between them depending on the network and CPU conditions.

    This enables much richer end-user media experiences - since it makes it possible for content providers to provide both lower-end and higher-end bit rate versions of a video, and then have Silverlight choose the optimal one to use based on an end-user's machine hardware and network capacity.  If while watching the video the machine or network conditions change, Silverlight can automatically switch to a more appropriate bit-rate without any buffering or interruption glitch.

    Silverlight's support for adaptive streaming is extensible - which enables anyone to plug-in their own logic to control where the media content comes from, and what bit-rate should be used.  This means that any CDN or media delivery provider can easily integrate their systems with Silverlight and deliver super high quality video delivery.

    Content Protection

    Beta2 includes DRM content protection, and supports Windows DRM and PlayReady DRM.  Both work cross browser and cross platform.

    Server Side Playlists

    Beta2 adds support for server side playlists (previous releases only supported client-side playlists). 

    Networking Improvements

    Silverlight 2 Beta2 includes a bunch of work in the networking space:

    Cross Domain Sockets

    Beta2 now enables cross domain networking support using both HTTP and Sockets (meaning your application can call sites other than the one the application was downloaded from).

    Silverlight will check for the existence of an XML policy file on target servers that indicates whether cross domain network access is allowed.  Silverlight supports a new XML policy file format that we've developed, as well as Flash policy files (which means existing sites open to Flash can be called from Silverlight without any additional work).

    Background Thread Networking

    Beta2 now allows Silverlight applications to initiate network requests on background threads, as well as process/handle network responses on background threads.  This enables a bunch of powerful scenarios, and allows you to avoid blocking the browser's UI thread while doing both HTTP and Socket network communication.

    Duplex Communication (Server Push)

    Beta2 enables support for setting up duplex communication channels with a WCF service on a server.  This enables a clean programming model that allows servers to "push" messages to Silverlight clients without the developer having to manually poll servers for changes.  This programming model is very useful in a variety of scenarios, including instant messenger/chat applications, and monitoring/update applications like stock tickers and trader applications.

    Web Services

    Beta2 enables significantly improved interop with SOAP based web-services.  Web service proxy class end-point URLs can now be configured without recompiling applications.  Visual Studio also now has a new "Silverlight-enabled WCF Service" project item template that you can add to ASP.NET web projects to publish services to clients.

    REST and ADO.NET Data Services

    Silverlight includes support for working with REST based web-services. 

    Beta2 adds support for calling and consuming ADO.NET Data Services (formerly code-named: "Astoria").  ADO.NET Data Services will ship as part of .NET 3.5 SP1 and makes it easy to publish data end-points within an ASP.NET web project that are consumable from any client using REST URIs.  Silverlight Beta2 now includes ADO.NET Data Service client support that allows you to easily call these services (and optionally use LINQ expressions within Silverlight to express remote REST queries to them).

    JSON

    Silverlight supports calling JSON-based services on the web. 

    Beta2 now includes LINQ to JSON support that enables you to easily query, filter, and map JSON results to .NET objects within a Silverlight application.  This makes it easy to call and work with existing AJAX end-points and services published on the web. 

    Data Improvements

    Silverlight 2 Beta2 includes a bunch of work in the data space:

    DataGrid

    Beta2 adds a number of new features to the DataGrid control. These include:

    • Auto-sizing support for columns and rows
    • Column sorting (with both single column and multi-column sort support) 
    • Column re-ordering support by end-users (allowing them to drag/drop columns to re-arrange the order)
    • Frozen column support (allowing you to prevent a particular column from being customized)
    • Performance and bug fixes

    DataBinding

    Beta2 adds more core data-binding features and better validation support.  These include:

    • Per-binding Validation and BindingValidationError event handler support on controls (allowing you to handle input validation with TwoWay bindings)
    • Support for binding expressions on attached properties
    • Richer binding value conversion support (including value conversion fallback support)

    Isolated Storage

    Silverlight enables applications to store data locally on a client (via a feature we call "Isolated Storage").  Applications can prompt users to grant them size permissions for this storage (for example: a user might grant an email program 50MB of local storage). 

    Beta2 increases the default local storage space provided to Silverlight applications to 1MB in size.  Beta2 also now provides better end-user support for managing per-site storage permissions, as well as the ability to easily revoke/delete an application's local storage.  Management UI to control this can now be brought up by an end-user by right-clicking on a Silverlight application and choosing the "Silverlight Configuration" menu option.

    Understanding Compatibility with Silverlight 1.0 and Silverlight 2 Beta 1

    Silverlight 2 Beta2 is compatible with applications that target Silverlight 1.0.

    Silverlight 2 Beta2 will not run applications that target Silverlight 2 Beta1, since we've made a number of API changes between the two betas for the new features being added in Silverlight 2.  Browsers that have Silverlight 2 Beta1 installed which visit a site that hosts a Silverlight Beta2 application will be prompted to upgrade to the newer beta of Silverlight.  Once they do this they won't be able to run Beta1 applications without uninstalling Beta2.  This means that if you have published a running sample on the web built with Beta1 you will probably want to update it to Beta2 soon. 

    We have published a document that details the changes between Beta1 and Beta2 here that can help with this.  I also recommend reading Shawn Wildermuth's What Changed in Silverlight 2 Beta2 and Upgrading your Silverlight 2 Projects to Beta2 posts for more details on some of the changes between Beta1 and Beta2.

    Summary

    To learn more about Silverlight 2 and download the Beta2 release, please visit the http://www.silverlight.net and http://expression.microsoft.com web-sites.  We'll be posting articles, tutorials, videos and more on both sites in the days and weeks ahead.  I'll also be posting some tutorials of my own here on my blog as well. 

    If you haven't already read them I'd also recommend checking out my previous First Look at Silverlight 2 and First Look at Expression Blend with Silverlight 2 blog posts that I wrote a few months ago when Beta1 shipped, since they provide a good overview of the Silverlight programming model and how to target it using both Visual Studio 2008 and Expression Blend.

    Hope this helps,

    Scott

  • ASP.NET MVC Support with Visual Web Developer 2008 Express

    Last week I blogged about the ASP.NET MVC Preview 3 release.  One important thing I forgot to mention about this release is that you can now use it with both Visual Studio 2008 as well as the free Visual Web Developer 2008 Express edition. 

    The SP1 release of Visual Web Developer 2008 Express adds support for both class library projects as well as web application projects (previously only web site projects could be used with it).  This new support is useful in itself, as well as in enabling both ASP.NET MVC and Silverlight project support with VWD Express.  If you install the Visual Web Developer Express SP1 Beta you can start using ASP.NET MVC Preview 3 with it immediately.

    Important: ASP.NET MVC Preview 3 does not require SP1 to be installed if you are using Visual Studio 2008.  ASP.NET MVC Preview 3 will work with both VS 2008 and VS 2008 SP1 just fine. 

    You can learn more about the new VWD Express support for ASP.NET MVC from the VS Web Tools team blog here.  This post also includes a free web download that provides ASP.NET MVC Test project support for NUnit-based unit tests.  You can use these NUnit project templates with both Visual Studio 2008 as well as with Visual Web Developer Express 2008.

    Hope this helps,

    Scott

  • June's Toolbox Column Online

    My Toolbox column in the June 2008 issue of MSDN Magazine is avaiable online. The June issue examines:

    • Browser Compatibility Testing Tools - testing the myriad of browser versions, operating systems, color depth/screen resolution combinations, and existence of plugins like Flash make thorough browser testing a difficult process. It's especially difficult for smaller developer shops to maintain the IT infrastructure to test against all of these permutations. Fortunately, there are a couple of online services that assist in this endeavor. This review looks at two: BrowserShots (a free service) and BrowserCam (a pay-per-month service).
    • Typemock Isolator - one common challenge in writing unit tests is modeling external dependencies like databases, configuration file, and remote services. It can be difficult and/or time consuming to setup the external dependency for a test, configure its state, and then return the external dependency to its original state after the test. Rather than working directly with such dependencies, one option is to use mocks, which are local, in-memory objects that 'play the part' of the external dependency. You might hear a mock object say, 'No, I'm not a database, but I play one in unit tests.' Typemock Isolator is a tool for creating and using mock objects within your unit tests.
    • Blogs of Note - The Old New Thing. In his blog, Microsoftie Raymond Chen pulls back the curtain and explains some of the reasons why Windows and other Microsoft software and tools are the way they are. From why you have to click the Start button to shut down your computer, to why the registry is called a 'hive,' Raymond's blog is a fun, witty journey through the private history of Microsoft software.
    • The Bookshelf - Pro ASP.NET 3.5 in C# 2008 by Matthew MacDonald and Mario Szpuszta. Here is an excerpt from the book review:
    Since the .NET Framework 2.0, subsequent versions have added new features while keeping the core functionality in place. This poses a dilemma for authors writing books on post-2.0 versions of the .NET Framework: do you focus on just the new features or do you create a book that covers the new features plus the stuff that's been around since version 2.0? At nearly 1,500 pages, it's eminently clear that Matthew MacDonald and Mario Szpuszta, coauthors of Pro ASP.NET 3.5 in C# 2008 (Apress, 2007), chose the latter. The book's 33 chapters cover it all, from creating the simplest Web Forms to using cutting- edge features like AJAX and Silverlight™.

    Enjoy! - http://msdn.microsoft.com/en-us/magazine/cc546581.aspx

    As always, if you have any suggestions for products or books to review for the Toolbox column, please send them into toolsmm@microsoft.com.

Powered by Community Server, by Telligent Systems
'