Tuesday, August 31, 2010

DEV305 Parallelize Your Microsoft .NET Framework-Based Applications with Parallel Extensions

Speaker: Ivan Towlson

Tech.Ed Online

Take advantage or newer processor architecture.

.NET Framework 4 has inbuilt functionality for using this new functionality.

Like LINQ, but faster.

Querying a large dataset.

Traditional approach requires large number of considerations for treading.



ParExtSamples

Works for anu IEnumerable
- Optimizations for other tyoes(T[], IList)

Writing a PLINQ query
- .AsParallel()
- ParallelEnumerable (Does the actual work)

Partitioning
- Operators are replicated across partitions for (ideally) complete isolation

Operator Fusion
- Avoids excessive merging and partitioning steps

Partitioning Algorithms
- Chunk - potential for a lot of locking when doing small tasks
  Progressively hands out more work out to each thread to separate both small and large jobs.
- Range - For IList equally divide work among threads
- Stripe - For IList
  Elements handed out round-robin to each other
  Less wasted effort in the case of exception
- Hash - For IEnumerable
  Elements assined to partition based on hash code.
- Custom - Partitioner

Merging
- Pipelined: Each result becomes available as they are completed.
- Stop-and-go: For OrderBy, ToArray, ToList, etc...
  Higher latency and more memory usage.
- Inverted: no merging needed
  ForAll extension method - no buffering required.

Parallelism Blockers
- Ordering not guaranteed (consider OrderBy)
- Exceptions (Stop other threads?) - System.AggregateException
- Thread affinity - Web form controls
- Operations with < 1.0 speedup - Overhead can make the entire operation slower.
- Side effects and mutability are serious issues
  Avoid shared state, side effects  

Task Parallel Library (TPL)
- Parallel.For(o, N, i => { work(i);});
- Parallel.ForEach

Regions
- Parallel.Invoke();

Task Concepts
- FromAync

Coordination Data Structures
- Thread-safe scalable collections
- Task and data management
- Synchronisation types
    SpinLock and SpinWait for very quick waiting periods.

DEV202 Pimp My App

Speaker: Shane Morris @shanemo

- lack of whitespace causes clutter - very flat
- colour balance across the page drawing the eye to one location.
- promote symmetry.
- where is the logical starting point in the page. Queues.
- What do we want people to see and in what order?
- Uppercase is harder to read due to outline versus mixed case text.
- What is lower down on the page?
- Avoid spilt navigation

1. Graphics come last, not first.
2. Set goals
- User, business, usability, experience.
3. "You are not your user
4. test early and often
5. Go with the flow 
Start with navigation and flow of the tasks


Layout steps
1. Map out the workflow
- What would a first time user do.
2. List your content
- Widgets
- quince.infragistics.com Pattern Library
3. Layout the elements in order
- left-right, top-bottom.
4. Check natural grouings
- Keep releated concepts together.

Presentation
1. Remove every unnecessary element.
2. Minimise Variation
- Err on the side of consistency.
3. Colours 
"Red and green should not be seen without a colour in between."
"Angry fruit salad."
Rate 1 to 5 for visual design skills and use that many colours.
Neutral background colours are safest. (white, grey, black, navy blue,)

Pull colours from a suitable photo.

kuler.adobe.com
colourlovers.com

About 10% of males have some form of colour blindness. Vischeck.com

How many diffent type faces shoul I use?

3. Line stuff up.
- Beware unintended relationships

4. Space and Size things evenly

5. Indicate Grouping
- Group boxes
- Similirity
- Proximity
- Alignment
- Empty Space

 Visual Hierarchy

6. Adjust Visual weight
Hot colours,
Size,
Contrast
Irregular Shapes
Misalignment
3D
Animation.

DEV208 Getting Started with Workflow in .NET 4

Speakers: Stefan Sewell, Peter Goodman

What is a workflow?
- Visual sequence of connected steps. (Flowchart or state machine)
- Declarative (what we want, not how to achieve it) - SQL, HTML
- Runtime schedules execution of the steps.
- activities linked together with data that flows though and is executed by the runtume.

Why would I use a workflow?
- Business processes that can naturally map to a workflow
- Very good at handling async work. Runtime to handle the scheduling.
- Long running logical processes that are episodic in nature. Persist/Restore. Human based workflow in minutes/hours/days.
- intuitive customisation model as part of your solution. Visual DSL.

How do I create a workflow?
-  Use the System.Activities namespace rather than the older System.Activities namespace.
public InArgument Question {get; set;}
InArgument ties the properties to the runtime instance of the workflow.

"That would be an ecumenical matter."

Can write unit tests for Workflow activities.

Workflow Basics

Further reading
Total Noobs' 
SOA206


How do I execute a workflow?

Workflow Service

A WCF service whose implementation is a workflow.

Service logic easily modelled as a workflow.

COS304 Azure Storage Deep Dive

Speaker: Chris Auld

Scalable - You will run out of money before disk.

Exposed

15 cents per gigabyte to store.

RESTful Web Services
- Use Azure or local apps.

Asian data centres are more expensive for data.
.
Can CDN Enable Account

Account is secured with a 512 bit shared secret key.
500 TB per account.

Storage in the Development Fabric
 - good for developing offline.
 - costs minimal (cents) if developing with less than 1 GB of data a month.

Storage Security

- HTTPS - Digitally sign requests for privileged operations.

Azure Storage Abstractions

Blobs - Could be used to serve static content. 60 MB/s output speed. Account Container - Grouping of blobs. Limited throughput per container. Blob - Identified by name Pages / Blocks - two types of blob. Blob is always accessed by name. Special $root container. - Allows for definition of clientaccesspolicy.xml http://[account].blob.core.windows.net/[containter]/[blobname] Can use prefix/delimiter and special blob naming to simulate directory structure. Pagination - returns continuation token (MarkerValue) to continue beyond page. Use Affinity group to keep computing and storage together and avoid paying for extra network traffic. Block Blob - used for streaming an entire file. ETags - versioning support over HTML Block blobs - can be uploaded in parallel via blocks and then recombined in Windows Azure Storage. Makes retry more efficient. Page Blob - targeted at random read/write workloads. Fixed 512 bytes Shared Access Signatures - E.g. Grant read access to a certain blob for a period of time and then pass to client as a URL. Revoke by timeout or via a container level policy that can be deleted. Ad Hoc Signatures. Policy Based Signature - container level policy allows revoking. Drives - Wrap the blob storage and allow NTFS volumes Tables - Queues -

Content Delivery Network (CDN)

Public blobs can be served via the Windows Azure CDN URL.
Could map custom domain to the CDN.

INO301 Code Different

Speaker: Ivan Towlson

C# and Visual Basic reconsidered
- Imperative
- Textual
- No extensibility mechanisms
- Minimal abstraction over the underlying machine

The assembly languages of the CLR

F#
- A functional-object hybrid
- Included in Visual Studio 2010
- A CLR language

You can call C# or Visual Basic components from F#
You can call F# components from C# or Visual Basic

F# Features With C#/VB Equivalents

First class functions
Similar to .NET delegates 

Lambdas and closures
Similar to C# lambdas Type inference

Similar to C# var, but used much more extensively
You rarely have to write explicit type annotations in F#

Comprehensions
Similar to LINQ

Quotations
Similar to expression trees

F# Idioms

Emphasis on functions rather than records

Rich data type support: options, tuples, discriminated unions
Pattern matching

Immutable by default

Helps with asynchronous and parallel programming
“Expressions that have values” instead of “statements that perform actions”

F# Interactive REPL
Try out your code as you go (tip: Alt+Enter!)

F# Features

Asynchronous workflows and agents

Example: parallel or cloud computing interop Starcraft

Computation expressions

Customising how a sequence of expressions is executed

Parser generator

Example: simple macro or expression languages

Units of measure

Example: scientific or financial computation

WEB302 Bringing the Web to Life with jQuery

Speaker: Jeremy Boyd

Visual Studio Intellisense support.
Works well with MVC and the existing MS Ajax libraries

Helps avoid cross browser issues.

Microsoft and Google CDN versions

Requires good HTML structure for selectors.

doc.jquery.com

xval for doing validation between client and server.

1. Expanders
- Expanding and collapsing divs.
$("selector").hide();
$("selector").fadeIn();
$("selector").slideToggle();

Select sets using CSS3 selectors.

2. Buttons
- $("#go").click(function() { $("form").submit(); return false; } );

3. Highlighting Errored Form Elements
- .css('prop'. 'val');
.addClass('foo');

$(":input").removeClass("errored");

4. Consuming server side JSON data
Autocomplete textbox.
$.post(url, payload, callback);
$.ajax({ type: 'POST', ...});

FlexBox

JsonResult

5. jQueryui
http://jqueryui.com
UI library of widgets, animation

.accordion()

6. 3rd Party Plugins

7. LightBox
FancyBox

Easing - function over time for animation.

8. Writing your own plugins
- plugin authoring

.html()
.live() - for anything that matches the selector now or in the future apply this selector.

9. Copying a cool technique you have seen


Monday, August 30, 2010

DEV304 Increase Productivity and Reduce Costs with Visual Studio Lab Management

Speaker: Anthony Borton

Tech.Ed Online

Automate virtual machine provisioning
Checkpoint as needed
Test and debug multiple environments
Requires
* Team Foundation Server 2010
* Microsoft Test Manager 2010

Includes - Microsoft Test Manager 2010

A Logical Configuration
Active Directory, SCVMM, VM Library (Template library), Hyper-V Host, TFS & Lab Management, Build Server, Developer Machines, Tester Machines.