Thursday, November 4, 2010

Code Correctness and Smart Tools for .Net developers

Code Correctness and Smart Tools for .Net developers - Dino Esposito

    Testability is the capability of a system to be tested (especially in an automated way)  Created a Design-for-Testability. Three things that define testability: Visibility, Control, Simplicity.  .Net 4 instantiates Code Contracts to try and meet this,  And some tool to help check Rewriter, and Static Checker.  Rewriter, rewrites your code, adding checks into it.  Three basic types of code contracts are: PreConditions, Postconditions, Invariants.  Contracts must be specified in the body of methods.  Can have different code contract per build type. Contracts are plain code, playing a declarative role, like attribute, but more expressive.
    These Contract codes asserts are disabled in release builds. Use Requires method to check for PreConditions.  Contract.Requires statements are run in order listed, and must be run before any other code is run.  Use Contract.ContractFailed method to customize messages.  Use Ensures or EnsuresOnThrow Method for post condition checks. Use Invariants method to check invariants, these must all be defined for a class in one place. Will use the contractInvariantMethod attribute on any method you want to check for invariants.
    These seem like they could add a bit more code writing to implement,  and should be researched more before we would think about implementing it.

.Net 4.0 New Features in the Language and Framework

.Net 4.0 New Features in the Language and Framework - Kathleen Dollard
Kathleen@mvps.org

       It is backwards compatible, but must specifically target 4.0 libraries for all projects.
       There has been about 300 deprecated classes.
       These include old security, dropped oracle support (must get providers from oracle to connect to it)  Improved garbage collection.
       Code Contracts are new, the need the diagnostics.contracts imported.  A Way to protect your quality of code. (was mentioned briefly)
       Can  label code for Security - Transparent, Critical, Security Safe Critical.  By default old code was SecuritySafeCritcal, almost all code can be Transparent.
       Optional and named parameters can now be nullable
       No line continuation characters needed
       Don’t need to add get/set when doing properties unless you need to do something non standard
       Lambda expressions can contain multiple lines, and return voids (by calling subs)
       There are new data types bigInterger(7.8 e56), Complex, Tuple (has  multiple values (3-7)) , SortedSets, Lazy<T> encapsulate type that can be created later), Task (takes some thing to do)(will be used by async calls in .net 5.00)   
       File system enumerations, gets files and directories as you need them
       Flag attribute is used bitwise enumerations. Added HasFlag to check flag values.

Using Silverlight Animations to Improve User Experience in LOB Applications

Joel Neubeck (joel@neubeck.net)

Visual State Manager and Visual States are the key points to understand.  Microsoft toolkit (Transitioning Content Content).   Example he is showing is creating a control template in his Styles.xaml.

Using easing for your movements.  Edit the existing design template.  In Sl4, there are some provided behaviors such as the fluidmovement behavior.  Use the powereasing function.  Use the state manager to change the beforeloaded state. 

Create our own states, or skin another control’s states (such as a checkbox’s checked or unchecked state) to triger our custom defined states.

Textboxes highlight on focus.Go to the expression gallery to find some examples.  This example shows using a custom tooltip to highlight the borders. 

Question I have is how much should I be concerned about upward compatibility of my customizations? 

Silverlight Data Integration Options and Usage Scenarios

Dan Wahlin http://www.TheWahinGroup.com (@danwahlin)

He makes use of the Silverlight Enabled – WCF service).  Simpler.  Class decorations are no longer required.  Deprecated. 

Simpler version of fiddler.  Trick to get fiddler to recognize localhost is to append a period (http://localhost.).  Will throw an issue if you don’t have a client access policy file.

WCF binary inspector – a plugin for fiddler adds a WCF tab, allows you to decode your binary encoded message.

Another option for faster performance is to use TCP ports (faster, but limited ports).

WCF Duplex Service – Have server push data to your client app. 

Demo of sending video 10 fps via WCF and using TCP bindings.  Not as fasy using HTTP bindings.

Discussed with him after session to confirm that nothing has improved with WCF 4.0 and SL 4 in terms of solving the issue of duplicating classes if you share classes across services.  IE, we are doing the correct approach when we share class libraries between WCF and SL apps.  He couldn’t believe that Proliance was still using WSE, FWIW.

Write your own Xaml Framework

Write your own Xaml Framework - Billy Hollis
www.billyhollis.com

Visual and Logical Trees
Logical tree is the tree you see with elements composed inside other elements.  Visual tree contains everything that effects rendering.  SilverLight has Visualtreehelp, WPF has logicalTree helper too.  He has written a findResouce extension, that can be used to programmatically have code search for resource.

Dependency Properties
Properties elements are usually dependency properties, thes properties depend on factors.  Get/set methods will cll get value/set value in what is called a dependency property store.  Example of these data context, fonts.  These are based on looking up the tree. Have optional callbacks that can be used for validation. Can create them from snippets.

Control template tricks
Can dependency propertis which can be bound to others objestsnproperties.  Can build wrappers for objects to give various objects the same new property

Attached properties
These are type of dependency properties. AttachedPropertytBrowsableForType attribute makes attached property settable in designer. Create in code by using RegisterAttached instead of register. Your setters/Getter properties need to be shared.  When setting up set PrpertyMetaData in default types the same. (error many folks miss) Spellcheck is an attached property for textbox

Behaviors
Give Items behaviors that they normally don’t have.  Mostly useful when it is an extension on that a control, like adding masks to textbox

Pre-Session Talk with Sl Designer

I walked in on the end of David Kelley’s discussion on getting designers and developers to work together.  (LDS302).  I had a chance to talk to him about how to bridge the gap for our folks with Mario in getting better  graphics from them.  He showed how Illustrator (Adobe – Apple Product) is how we want to have Mario work in and how Expression Blend can easily import and translate the images.  Since they are both vector based graphics products.  Maybe if someone reads this by COB Friday, they could ask him if he is familiar with Illustrator.

SilverLight Develpers Guide to Entity Framework

SilverLight Develpers  Guide to Entity Framework - Ward Bell
Askward@ideablade.com

Used to Shape data to our object oriented development needs.  The “database backend” for our SilverLight business apps.  No direct road gtom EF to SL.  EDM is Entity Data Model.  Edmx isxml version of entity model.  Use T4 templates to bring data forward.  Connection string needs to be same as app.config for model (in web.config). Deals with complex types (select multiple fields from model and say generate complex type).  Cant Name type same name as field in type.  Supports Inheritance, but be wary of using it can be a performance killer,(table per type and table per content) Table per hierarchy is ok. Need to make a partial class to call inherited classes.

He was a much better speaker than his last talk I was at

Programming SQl Server R2 Reporting Services

Integrating reporting services into your applications

Paul Litwin

Slides from www.deeptrainging.com/litwin

SSRS has a number of APIs. 

Changes in R2:

  • Report Manager revamped
  • Support for Geospatial data
  • Shared data sets
  • New VS2010 Report / Viewer controls
  • New ReportService2010 web service endpoint
  • More data visualizations

URL Access – same as we have used, but there are options to render in other formats such as PDF.  So, no need to launch report viewer.  rs:Format=PDF  You can also pass in the page orientation and Margins.

Security – still requires local domain access.  External users could get access if you write an anonymous extranet web app which runs under someone with RS access.

Report Viewer Controls – Remote (server) Reports and Local Reports.  Not sure I understand the need for a local report unless your intention is to keep all your reports local to your solution.  They are less powerful as well.

Wednesday, November 3, 2010

Some Pics from Vegas





Build N-Tier SilverLight Data Applications Easily with WCF RIA Services

Build N-Tier SilverLight Data Applications Easily with WCF RIA Services -  Brian Noyles
@briannoyes
Brian.noyles@idesign.net
http://briannoyles.net

    RIA Services are roughly defined as a data pipeline that Focus on N-tier Apps that are focused on LOB apps.  They are used for rapid development, designed better for smaller projects . It will Help Generate Data classes, Validation Rules, Proxy code for client side and Insert, Delete, Update services.  One drawback is lack of  help on rIA services on web. Brian is doing a 10 part series of documentation.
    SP1 is coming out soon, supportss Shared entities across domain services, deals with complex types better, localization, and better binding support cfor entity sets.
    This looks like it could have promise, although he did describe some limitations and would like to look into it further.

Creating Report Subscriptions in MS SQL Server 2008 Reporting Services

Paul Litwin – Paul@deeptraining.com twitter.com/plitwin

In SSRS 2008 R2, right mouse click on a report to set up a subscription.  Any user who has rights to view a report can create a subscription.He advised you to migrate reporting server before migrating database server.

Maintain using the MySubscriptions page. 

Data-driven subscription.  Can do generation of distributions this way.  Delivery method you will be using (Windows File Share, Email, etc) will determine the type of query you need to run with your Data Driven Subscription.  File share DD subscription requires information to get to file share (UNC, user name, pw, etc).  Mail DD subscriptions require the fields that you might expect.

In SSRS R2, there is a new Cached Refresh Plan option to cache reports which take a long time to run.

Using SSRS Web Service to create report subscriptions.

Taking Advantage of VS Architecture Tools

Kathleen Dollard kathleen@mvps.org

Start with UMLdiagram. Sterotypes can add additional levels of categorization.  Once you have a model, you can generate code.  Simplest was is to add a new text template.  The code generation tool will not generate multiple files.  The purpose of T4 is to take any meta data and transform it into any artifact.  T4 is a transformation engine.  I left a little early, as the content was not what I was expecting and it was not applicable to our environment.  I

Securing SilverLight apps:what you don’t know can hurt you

Securing SilverLight apps:what you don’t know can hurt you -  Ward Bell
AskWard@ideablade.com

Encrypt, Authentize, Authorize, Audit, Validate
Secure The server -- Assume all clients are bad
SSL always And everywhere - Use SSL to download Xaps
Avoid Custom Authentication-Suggested using ASP Authentication/ASP Security(based on having external users)
Use a web Page - HttpContext.Current.User
For OOB - Roll your own login page
You could also use RIA services for authhenication and authorization - See article by B Noyles
If not in ssl can see user/password from page in fiddler when using asp form.

To check authorization on server in Ria services add annotaions that require authorization [RequiresRole(“Manager”)]
You would need to create a custom user in SL and  get from RIA service
SilverLight Spy will let you open any xap file and read it
Use user password ask key for encryption for offline authentication.
Don’t make your client talk to multiple domains (except for images/Media)(can show but not examine)
Confirm host page, check where Xap came from.

This class was really focused on having external users accessing you SL app, and half pushing their product devforce.

Supplemental on SQL Server 2008 R2

After lunch today I picked the brain of the guy running the SQL 2008 R2 booth about the migration. Good news is that the data files, objects, compatibility level, etc is 100% backwards compatible. And when opening or deploying SSRS report rdl files for the first time under the R2 tools, they will be automatically converted. He recommended giving SQL writer 3.0 a look and for us to take advantage of the new component based functionality. Which enables drag and drop functionality to allow pre-developed components aka galleries to be reused.
The one thing he cautioned me on is the continued use of linked servers. He stated that in the not so distant future there will be an announcement on the depreciation of linked servers.
Published with Blogger-droid v1.6.4

Design Concepts for Developers

Billy Hollis (http://www.billyhollis.com)

Some of the design concepts of today are based on the medical concepts of human nature.  Pretty != Good Design.  The Aesthetic Usability Effect.  Pretty does have value though.  Anthromorophatizing is another way to put it.  Picks on the fact that the AT&T Web Site is the worst web site in the world.  The Savannah effect (not enough white space).  Need to make screens not cramped.  Using whitespace to space things out which are not related.

Should use better design to get away from grids / rectangles.  it’s tough to impress this on the bean counters.  He recommends using right justified labels to allow for more whitespace.  Another example is how his sticky notes app has random angles of rotation so the notes do not line up.

The 80 / 20 rule.  80% of the data provides the most value.  Migrate the other 20% to other places they can get to rather than clutter up your screen.  Progressive disclosure (give users the data they need at the time they need it).  His example shows a tooltip as a whole popup panel.  Kind of cool. 

Principal of layers need to be applied now that we have the tools to do them.  Proper use of animation is to project natural flow.

Confirmation principal.  Be careful to only use it when totally necessary.  Confirmations become rote when it is asked for all the time.

Fonts – read 25 classic fonts.  Spoongraphics.co.uk   Adding complexity to your UI causes user productivity issues because of the additional amount of time required to make a decision.  nextver.com

Using InfoPath 2010 and SharePoint designer to manage SharePoint list forms

Using InfoPath 2010 and SharePoint designer to manage SharePoint list forms - ASIF REHMANI
SharePoint-videos.com
@asifrehmani
Asif@sharepointelearning.com

SharePoint Designer is used for modifying SharePoint lists forms. Need InfoPath license to use this,
InfoPath giver Visual layout, form logic, and data connection. (can do id SharePoint designer, but easier and simpler in InfoPath)
Create Library Forms - need SharePoint foundation
Modify Workflow forms - need SharePoint server standard
Create SharePoint list forms - needs SharePoint server enterprise
Add InfoPath form web parts that can be put on any page.
MS invested in InfoPath  vs. SharePoint Designer so reccomends using InfoPath to work on SharePoint Forms
Can set styles on SharePoint parts in InfoPath, cant do in SharePoint Designer.  This is done by creating rules for styling.  Can copy rules to other controls. Can link the rules to other controls on the form if desired.
Rules are Different based on type of control.
Publishing is easy, under file there is a quick publish button, it remembers where the form came from so knows where to put it. Updates all various ways you can see form.  If you want to edit individual forms you need to pick view in InfoPath.  Tags these new forms with ifs on the end.
Can tell it to show or not show the view in InfoPath. (so views will not show up in list of views
Can make connections from other web parts to  populate InfoPath WebPart

Expression Blend is Not Only for Designers

Joel Neubeck (joel@neubeck.net)

Why?  Decrease the amount of effort involved with designing your UI.  Another plus is randomized data and design only data sources.

Example is from a Silverlight Navigation Application.  open a view in Expression Blend, the Data Tab, New Sample Data.  Use it to generate data to bind your view to.  Drag your collection onto a design surface and wow, it generate the ListBox.  Uses EB to design the layout of the ListBox.  Changes the ItemTemplate of the StackPanel in the Grid.

Verbose XAML which duplicates default properties makes your XAML parsing slower. 

Uses Blend to change his listboxes into a ListBoxDragDropTarget.  Uses EB to copy the item template for his list box.  Wants to modify the visual states.  Changes selected state to have a color of yellow.

Addition states added with SL4.  Uses Assets to modify the behaviors of a rectangle.  Demo of the fluid movement behavior. 

Tard tried to quit early.  Realized that he had 30 mins left. 

Creates a new state which move a textblock off the form, and ties the interaction of his grid .

Shows how to use WrapPanel and his generated data to remove horizontal scrollbars.

From 0 to Stylin’ in 60 mins. Adding style to silver light 4 apps

From 0 to Stylin in 60 mins. Adding style to silver light 4 apps - Evan Hutnick
Evan.hutnick@telerik.com
@EvanHutnik
http://blogs.telerik.com/evanhutnik

Understanding Styling
Resources are reusable style ,data templates, control templates, colors, brushes ect.  These are defined control.resources, user control.resources, app.xaml, or resource dictionaries(in worst to best place order).  Used BasedOn to inherit from other styles, normally a good idea to keep things similar.  Implicit styles come in to play when no styles are assigned to object

Why expresion blend
Resource Window lets you see colors and resources that are available in your solution in 1 central place.
The object and timeline window is  used to create and play storyboards (for animation typically) with no code interaction. 

Putting Blend to Work
He suggests using the search window to find the properties you are looking for.  Sometimes Blend is buggy tho, and you wont be able tio run the app from blend.  Sometimes the best option is to run in VS.  In apps.xaml can add resources under <resources dictionary> section.   Just a warning, BasedOn  does not show up in search window, will have to find in xaml.  Styles in app.xaml override same named styles in resource dictionaries. 

Wrap Up
Styling makes large apps consistency easier through reuse. Expression blend makes designing storyboards, modifying styles, and extracting templated much easier.

MVC for ASP .Net for Web Forms Programmers

Paul Litwin www.deeptraining.com/litwin – download slides

MVC 101 – Model (Classes and Business Rules) / View – UI / Controller (workflow) .  Why?  - Too much of the application in the Code Behind – Don’t have to use ASP .Net viewer (Spark, Razor, etc) in MVC

URI routes are stored in global.asax.  (Demo – get slide deck).

No escaping the casinos.

I guess I am used to Atlantic City where you can take a break from a casino and go to a mom and pop diner or sub shop or get a slice of pizza. Or ride the bumper cars or something. In Las Vegas, it is wall to wall casinos. Can't even walk to McDONALD'S' and get a morning breakfast.
Published with Blogger-droid v1.6.4

Tuesday, November 2, 2010

Profiling and Performance Tips for Silverlight

Profiling and Performance Tips for Silverlight –Tim Huer

Timhuer@microsoft.com

    There are 2 types of threads: UI Threads, and Non-UI Threads. Use dispatcher object to help manage threads.
    For media ther are three good rules to follow:Encode at the minimum you need,Encode at desired size,Blending with Media is expensive.(don’t use opacity over media items)
    The two tools that MS provides for profiling Xperf, and Visual Studio.    Xperf is a command line tool, that is not accessible from VS, not a complete tool for silverlight profiling.  VS tool is recommend, as it will probably get the information we desire.  For VS, you need to setup environment to sample from commandline.  Need to Add registry to turn off tab processing to test….will need to turn back on..  There are series of command line exe’s that need to run to get profiling. Create a .vsp file that can be opened in VS2010. There is a profiling wizard coming ouit that should help streamline the process.
    Some Cheap Diagnosing: Enableframeworkcounter,EnableRedrawRegions, and EnableCacheVisualization.  These are only for debugging, do not leave turned on.
    Not found does not only mean not found.  Highly Recoomend fiddler.
    If looking for memory leaks he suggested objectTrack.cs  class, found in sliver light community area.
    Avoid opacity Animations.
    If using transparent use Hexcode instead of Transparent (they arent sure why that is faster, but it is))
    SilverlightSPy is a good tool to analyze you silver light app, but its not free.

Enhancing SharePoint with Silverlight - Paul Stubbs pstubbs@microsoft.com

 

Supported out of the box in SP 2010.  Add document, browse to *.xap file into a document library.  Right click, get shortcut to clipboard.  Insert Silverlight Host container web part and paste in *.xap.  Best way though is through a WSP.  Start VS, new project, empty SharePoint project.  Deploy as sandbox solution.  Add a Silverlight project to solution.  No host needed.   Add new item to SP project, add a module.  Delete the sample.txt.  We want a reference to the *.xap package.  Click on Module1 and in the properties panel add the reference in the collection there.  Missed the exact details on how to work that magic. 

Coming soon (couple of weeks – before Thanksgiving he says) is another extension to automatically add a Silverlight Web Part. 

Introducing IIS Developer Express

Introducing IIS Developer Express – Damien Edwards
Damien.edwards@microsoft.com

Intro IIS Express
    IIS Express is self contained version of IIS 7.5, that is optimized for developers, that will hopefully replace VS IIS.  This will be include in future VS update, or can download web matrix. (it does not support non-http transports)  Currently there is no 64 bit version.

Visual Studio Integration
    From Comand prompt run iisexpress.exe.  Use appcmd.exe to look at and modify config files.  Once installed can set as default development web server.  Solution explorer will show web link if using IIS express to instead of IIS. 
Advanced Scenarios
    Will setup the IIS Express web, when downloaded from TFS, if user doesn’t have IIS, also allows remote access to these temp IIS sites (blogs.iis.net/vaiydyg)(to see how to do remote access)

After listen to this talk, I’m not sure we will use this, as it seems that is designed more for people who are not admins on their machines, and do not have acess to IIS, or would rather not use IIS.

Developing Business Intelligence Solutions with SharePoint 2010

Developer Tools – VS 2010 Web Part Designer

Excel Services – turning into a data provider – better data visualization, interactive PivotTables.  Looks like we could do FarPoint natively.

PerformancePoint Services – designed to talk to SS Analysis Services (talking to SS Analysis Services Cubes).  Give context to your bad scorecard value.

Available in the template called the Business Intelligence Center (this will enable all of the features.

Web Deployment Made Awesome: If you’re using XCopy, You’re doing It Wrong

The title of this application brings to mind when Clay asked me to research using XCopy to keep our webs in sync. Winking smile

Sayed Ibrahim Hashimi sedodream.com (Author of two books I have).  Horrible presenter and speaker.

  • Web.config Transforms in VS 2010 (Transform your web.config during web publish).  Could do this instead of our MSBuild Tasks for replacing connection strings at build time.
  • Publishing with the VS 2010
  • Deployment Offline by creating a deployment package
  • <demo goes boom>  Real disaster of a presentation.

Crash course in Sharepoint 2010 Development

Crash course in Sharepoint 2010 Development - Chris Johnson
ChJohn@microsoft.com
@loungeFlyZ

Agenda
Why SharePoint?
The biggest reasons seem to be Document process, LOB integration, and Web sites
Getting Started

Environments

On the choice between native or Virtualized, he recommend Virtualized, because you can use snapshots, VM farms, can create one on a per project basis.
Made it so can devope on Windows7/Vista Sp1...must be 64 bit operating system. Tho there a few prerquite steps that would need to be run 1st
Released last week, automated developer workstation builds using power scripts for windows 7
(1hr-4hr install)

Tools
VS2010 - Builsd wsp packages you can place on another machine and run
SharePoint Designer is considered the no code tool for SharePoint. Has way to save wsp, which then can be imported in VS2010. This makes prototyping easier using designer
Can also use Visio 2010 to model workflows that cn be imported into SharePoint designer

Solutions
The top 5 things people use sharepoint are data model,User interface/web parts, events, LOB, workflow
Have asdded Rest APIs, and Client Object model(,net, JavaScript, silver light) to allow you to access data in sharepoint (tho it does not allow you to do admin stuff)
Supports Ribbons, and silverlight. It uses silverlight for multiple thing.

Deployment
Using F5 to bukld and autodeploy webparts to sandboxed sharepoint sites

Taking SL 4 Applications Beyond the Browser

John Papa (http://johnpapa.netJoPapa@Microsoft.com

Not many applicable sessions at this time, so Steve and I both attend.

Sandboxed (not elevated)

  • Just enable Out of Browser – No OS features can be accessed (can auto update app, host web content). Toast features, check on network status (connected, etc.)

Running in Elevated Trust

  • Automation (COM) integration, EG, File Access, Send email, Custom Window Chrome, XAP signing.  Best practice is visually signing your xap.  Push out via network with SLLauncher.exe.  Demo with EBay Simple Lister.

Mountain Dew

About the last 10 minutes of ScottGu’s keynote I really decided I needed some.  TMI, I know.

KeyNote

Keynote - Scott Gutrie Better Code

He started with talking about new New Products (VS2010,.net,SL4) Next he resonded to PDC cooments by giving a message from SilverLight -“Reports of my death are greatly exaggerated“.
The talk then was broken up into themes. These themes were:
Eliminate Friction
IIS Express, SQL CE
Open Source and Community
Jquery, NuGet, Razor
(elmah - record errors)
Sustainable Architecture
SL MVVM with Ria Services, Unit Tests Frameworks, TFS
Devices
WP7,XNA
Cloud
Azure

Keynote by Scott Guthrie.

Silverlight comments. The reports of my death are greatly exaggerated.
Published with Blogger-droid v1.6.4

Too huge

..or, help I am captured. The thing that is annoying about this casino is how huge it is. They make it a lot of effort to leave the campus. They want you to feel too tired to leave. Puts AC casinos to shame.
Published with Blogger-droid v1.6.4

Monday, November 1, 2010

Haven’t left Philadelphia yet, and I know already that there will be a buzz at DevConnections

Well, it seems that Mary-Jo Foley http://twitter.com/#!/maryjofoley) at last week’s PDC noticed a strange lack of content on Silverlight outside of discussions on Windows 7 Phone. She confronted Bob Muglia (Microsoft President in charge of the company’s server and tools business) and got him to admit that Microsoft’s strategy with Silverlight has shifted.

Microsoft is bowing to pressure to fully engage HTML 5, but has not come out and said anything about Silverlight being a dead platform, but he has said that the pace of focus has slowed.

I intend to get some dirt from @TimHeuer at the conference. His blog posts have denied a “shift as it is being reported”.