St. Louis Day of .NET 2013

This post is long overdue, as the 2013 Day of .NET took place almost two months ago.  I set aside my notes while I waited for presenters to post their session materials online… and then I forgot about it.  So, without further ado, here are my notes from the event:

DAY 1

Session: Entity Framework in the Enterprise

Presenter: http://www.twitter.com/scottkuhl
Session Materials: https://skydrive.live.com/?cid=b11213b176cf5d39&id=B11213B176CF5D39%2148854

Getting Started with Entity Framework
     http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc (EF6 and MVC5)
     http://www.asp.net/mvc/tutorials/getting-started-with-ef-5-using-mvc-4
(EF5 and MVC4)

SQL Server Data Tools 
     Use LocalDB 
     Allows for loading of test data 
     Allows for data to be "reset" to a known state 
     Remember to check the "Target Connection String" in the DB project properties dialog

Entity Framework Power Tools v.4 (Beta)
     http://msdn.microsoft.com/en-us/data/jj593170.aspx
     Provides reverse engineering of databases into code-first classes, using the Fluent API

Unit Testing
     Entity Framework 6 has support for mocking frameworks
     Allows you to create your own test doubles
     It is recommended to test against a "real" DB for Last Mile test and performance tests

Audit Tracking
     SQL Server Change Data Capture
          Available in SQL Server 2008 and beyond (Enterprise Editions only)
          Uses change tables that mirror structure of tables being tracked
          Populates the change tables by analyzing the transaction log (not via triggers)
     If using EF natively
          Override the "SaveChanges" methods
          Loop through the contents of the "ChangeTracker" collection (saving the details along the way)

Performance Tracking
     Entity Framework 6 includes/allows logging of SQL statements and execution times
     Other useful tools include NLog and Glimpse

Session:  Introduction to MongoDB

Presenter: http://www.twitter.com/bradurani

Background
     6th most popular database in the world, just behind PostgreSQL and DB2
     There are drivers for many languages, as well as a LINQ provider.
     Data stored as BSON (binary JSON)
     Everything is case-sensitive

Benefits
     Speed – basic queries are much faster than SQL DBs
     Rich Dynamic Queries – not as limited as other NoSQL DBs
     Easy Replication and Failover
     Scalability
     Automatic Sharding

Limitations
     No transactions
     No joins
     RAM intensive
     No referential integrity
     "Eventual consistency" – periods of inconsistency usually measured in milliseconds

UIs
     MongoDB shell (command line)
     Various GUI tools

Querying
     Can query by regular expression
     Can return entire records or specific fields

Object IDs
     Object IDs (auto-generated unique IDs) contain timestamp of record creation.
     Timestamps contained in Object IDs can be retrieved.
     Can define your own IDs, which is useful for sharding

Indexing
     Can index pretty much any part (or parts) of a record, up to and including the entire record

Replication
     If the primary fails, a secondary is auto-elected as the new primary

Session:  Modern Web Diagnostics with A Glimpse into ASP.NET

Presenter: http://www.twitter.com/anthony_vdh

Background
     Installed via NuGet
     New versions are released approximately every two weeks

Functionality
     Gives insight into ASP.NET, WebForms, and others
     Gives diagnostics on networks, databases, page lifecycle, viewstate, and more
     Can trace individual users
     Can be enabled/disabled in various ways (cookies, roles, etc)
     Keeps the history of the last 50 requests, so recent requests can be examined after they occur

Platform Support
     Cross browser (last versions of browers supported) and cross platform
     Support exists for tracing NHibernate, Entity Framework, MVC, WebForms
     WebAPI support is on the way (not there now)

Session:  Parallelism in .NET

Presenter: http://www.twitter.com/mulbud
Session Materials: http://geekswithblogs.net/NewThingsILearned/archive/2013/11/21/st.-louis-day-of-.net-2013.aspx

Threads
     More threads means more memory usage and more context switching
     Developers need to find the appropriate balance between the # of threads and resource usage
     Available since .NET 1.0

ThreadPool
     Similar to database connection pooling
     Resources are managed much better
     Available since .NET 1.0

Parallel Linq (PLINQ)
     Example: from r in object.AsParallel() select r
     When using this, you must watch out for shared resources, and lock them correctly

Parallel Library
     Provides the parallel For, ForEach, and Invoke methods
     Allows processing to be stopped via the "ParellelLoopState" delegate

Tasks (TPL => Task Parallel Library)
     The most complex option to use, but also the most flexible
     Can be used "as needed"; they are not bound to the loop processing of the Parallel Library
     Allow parallel processes to be stopped
     Necessary for the use of Await/Async

Await/Async
     See the slide deck for the details of how "await" works
     Async methods must return Task
     Await can always be used on a Task, whether it is "async" or not
     When calling an async method, always await it (best practice)

Debugging Support
     When a breakpoint is hit, all running tasks stop
     Several parallel debugging windows are available under the Visual Studio "Debug" menu
          Tasks – shows all running tasks; click a task to go to the currently executing statement
          Parallel Stacks – visual display of running tasks and the call stack; click a task to see the current statement
          Parallel Watch – allows watching a variable in a particular task

Session:  A Deeper Dive Into Xamarin.Android

Presenter: http://www.twitter.com/benjamminstl or http://www.twitter.com/rendrstl
Session Materials: http://www.slideshare.net/BenjaminBishop1/deep-dive-xamarinandroid

Tools
     Xamarin Studio (native) – not free
     Xamarin Studio plug-in for Visual Studio – not free
     PhoneGap

Recommended components for easing cross-platform development:
     Xamarin.Mobile – abstracts your code for location/photos/contacts across all platforms
     Xamarin.Social – similar to the Mobile component, only for social services
     Xamarin.Auth – makes OAuth easier to use
     RestSharp
     SQLite.NET
     JSON.NET

Components for Android
     Google Play Services
     Backward compatibility component (for supporting older versions of Android)

Frameworks
     MvvmCross
     MonkeyArms

Notes about developing for Android
     Turn on Hardware Acceleration in the application manifest
     Activity (app) lifecycle events reminiscent of ASP.NET page lifecycle events (or Windows 8 app events)
     Lots of XML involved in app creation
     "Layouts" are used to create app UIs.  Reminiscent of XAML.

Experience
     Android SDK is more robust and complicated than iOS
     Not as prescriptive in UI/design
     Device fragmentation is a challenge
     Emulators are poor; use a real device for testing
     Platform is more innovative than iOS, but not as polished

DAY 2

Session:  All You Ever Wanted to Know About Hadoop

Presenter: Matt Winkler

Written in Java (runs on the JVM)

Installation Options
     Single computer
          HDInsight (Microsoft’s implementation) can be installed from Web Platform Installer
     Cluster
          Various installation packages
     Cloud
          Azure – multiple nodes running HDInsight can be easily provisioned
          Amazon Cloud Services

MapReduce is the tool for querying data with Hadoop
     White Paper: Data-Intensive Text Processing with MapReduce (http://lintool.github.io/MapReduceAlgorithms/)
     MapReduce can be thought of as the assembly language for Hadoop.

Extensions to MapReduce
     Most of these compile down to MapReduce packages

     Hive – SQL-like query language
     Pig – another query platform
     SCALDING – Scala-like query language.  The syntax is LINQ-like.
    
Other Tools
     SQOOP – used for loading traditional RDBMS data into Hadoop
     STORM – tool for complex event processing
     OOZIE – Workflow Management for Hadoop

Session:  Building A REST API With Node.js and MongoDB

Presenter: http://www.twitter.com/leebrandt
Session Materials: https://github.com/leebrandt/ReSTNodeMongo

Useful Node.js packages (similar to NuGet packages in .NET)
     Restify – adds REST capabilities
     Underscore
     Toaster – UI functionality
     Moment – date handling
     MongoDB – MongoDB client tools

WebStorm from JetBrains is a recommended Javascript editor ($49 individual developer license)

http://education.mongodb.com – offers *free* online course on MongoDB

Session:  Starting with Code-First Entity Framework

Presenter:  http://www.twitter.com/mulbud
Session materials: http://geekswithblogs.net/NewThingsILearned/archive/2013/11/21/st.-louis-day-of-.net-2013.aspx

Create a class that inherits from DbContext… within that class, define the tables to create

Create classes to represent each table

Database is created automatically the first time that it is accessed

Handing DB changes
     1) Update the code
     2) Via attributes, databases can be set to drop/create always, drop/create only when the model changes
     3) Database migrations are another option

Database Migrations
     Package Manager Console can be used to generate classes to handle migrations. 
     Alternately, create a Configuration class in a Migrations folder
     Use the Configuration class with the MigrateDatabaseToLatestVersion class in SetInititalizer method of the Database object.
     Or, if you choose not to trust the auto-migration, generate a TSQL script to perform the migration.
     TSQL scripts can be generated from the Package Manager Console

ExpressProfiler is a simple SQL profiler… find it on CodePlex.

Session:  Introduction to Knockout.js

Presenter:  http://www.twitter.com/johnvpetersen
Session Materials: https://skydrive.live.com/?cid=4b5cb012cf825f0c&id=4B5CB012CF825F0C%213211&authkey=!APKGSzHxmC91400

What is it?

     JS library for dynamic web-based UI’s
     Applies MVVM to automate data binding

Concepts

     Declarative bindings
     Dependency Tracking
     Templating
     Automatic UI Refresh
     Dependency Injection

MVVM (Model-View-ViewModel) Pattern

     Combination of the MVC/MVP patterns
     View – UI and UI Logic, talks with ViewModel and receives notifications from ViewModel
     ViewModel – Presentation Logic, talks with View (data binding and commands (bi-directional), notifications [to View]) and Model (bi-directional)
     Model – Business Logic and Data, talks with ViewModel

Data Binding

Data

     Knockout.js implements the ViewModel

var myViewModel = function() {

      var data = { productid: 1, productname: "shoe", productprice=1.99 };

          this.property = ko.observable("value");   

          this.products = ko.observableArray(data);     // "data" is an array of products

          this.handler = function(data,event) {}

          }

     ko.applyBindings(new myViewModel());

     "ko" is the global identifier for Knockout

Binding

Attributes of HTML elements are bound to the ViewModel properties (also CSS and conditional logic like "foreach" and "if")

     <input data-bind="value: property" />

     <button data-bind="click: handler"></button>

     <tbody data-bind="foreach: products">

          <tr><td><input data-bind="value: productid"></td></tr>

     </tbody>

Individual elements can be bound to more than one property (example: "text" bound to one thing, "visible" bound to another)

Session:  Real World Azure – How We Use Azure at Swank HealthCare

Presenter: Brad Tutterow

SQL in an Azure VM vs SQL Azure Database
     VM option does place your database in the cloud
          BUT
     VM option still requires you do to your own backups/restores/server maintenance
     VM option does not provide for scalability of a "true" cloud DB

     SQL Azure DB is Microsoft’s preference

DB Changes that were needed for SQL Azure Database
     Remove Cross-DB triggers
     Remove file groups in CREATE scripts
     Account for cloud-based SQL being a limited subset of full SQL
          Example: No "USE" statement, so scripts may need update
     Modify backup strategy (no traditional Backup/Restore in the cloud)

Always run two of every Web Role
     Roles are frequently recycled by Azure
     If only one Role exists, your site is down when the Role is recycled
     If two Roles exist, Azure will switch between the two as needed, and not recycle both at the same time

Deployment best practices
     Determine which application settings (web.config) need to be changed at runtime
          Move those settings to Azure settings
          Everything else can stay in the web.config
          Changing web.config in production doesn’t "stick"… Role recycle will wipe the changes
     Create deployment packages
          Role recycle will wipe updates if not deployed via a package
     Make no assumptions about what is available on the server
          You must deploy everything your app needs (all NuGet packages, etc)
          Role recycle produces fresh copy of Windows

Database updates handled via EF Code-First Database Migrations
     Question: How would updates be handled without Code-First, or with some other ORM?

Pain points
     Local Azure emulator is unreliable and inconsistent
     No effective way to do QA on-premise (means more cost for a QA environment in Azure)
     Learning curve (not too bad)
     Azure SDK versioning (keeping everything in sync… updates are quarterly)
     EF migrations and Azure SQL (scripts don’t always work in Azure; need to be edited)

Good things
     Uptime and reliability
     Buy-in from sales/operations/infrastructure
     Enforced best practices for design and deployment
     Pristine/clean production environments
     QA/Prod environments are identical
     No IIS or Windows OS management
     Easy deployments

TO-DO LIST

  • Investigate SQL Server Change Data Capture as a replacement for auditing with triggers.
  • http://virtualboxes.org/images/
  • Check out DurandalJS (mentioned in several sessions)
  • Check out Twitter Bootstrap
  • Check out LESS
  • Check out Glimpse
  • Think about what could be done with a large OCR corpus and Hadoop 
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: