Microsoft Sync Framework

Microsoft Sync Framework is a comprehensive synchronization platform that enables collaboration and offline access for applications, services, and devices with support for any data type, any data store, any transfer protocol, and any network topology. Developers can build synchronization ecosystems that integrate any application, any data from any store using any protocol over any network. Sync Framework features technologies and tools that enable roaming, sharing, and taking data offline.

A number of providers are included by Sync Framework that support many common data sources. Although they are not required, to minimize development it is recommended that developers use these providers wherever possible. The following are the providers included:
  • Database synchronization providers: Synchronization for ADO.NET-enabled data sources
  • File synchronization provider: Synchronization for files and folders
  • Web synchronization components: Synchronization for FeedSync feeds such as RSS and ATOM feeds
Database Synchronization Providers:
The Sync Framework database synchronization providers were built to allow developers who were familiar with the concepts of ADO.NET to apply that knowledge to data synchronization through a very similar set of APIs to that of ADO.NET. The database synchronization providers offer the flexibility of a programming model like offline datasets and a richer synchronization feature set like that found in Merge replication. These providers also support synchronization over services, such as Windows Communication Foundation (WCF). Specifically, Sync Framework targets the following scenarios:

Offline Database Synchronization:
With Sync Framework you are able to build a solution where multiple remote clients connect and synchronize to a central ADO.NET database in a Hub-and-Spoke configuration. This enables occasionally connected devices to periodically connect and synchronize changes with a central ADO.NET database server. This topology is a common solution for remote workers such as sales reps or field service workers.

Collaboration Between Databases:
Sync Framework also includes Peer-to-Peer capabilities. Through a custom Peer provider, collaboration between two or more SQL Server databases can occur. Unlike a Hub-and-Spoke architecture, this provider enables a SQL Server database to communicate and exchange information with any other SQL Server database. This type of scenario is useful in group scenarios where users (such as auditors) need to update information and then collaborate those changes with other group members.

Synchronizing Files:
Sync Framework has a built-in algorithm for detecting changes that are made to the files and folders in the synchronization scope :

A change is reported when any of the following properties has changed:

  • The last modification time on a file.

  • If hashing is enabled, the value of the hash that was computed for the file.

  • The file size.

  • The file or folder name. This check is case-sensitive.

  • Any of the file attributes that are handled by the provider.

A file move or rename is reported when a file is found that has the same creation time, size, and hash value (when hashing is being used) as a previously known file, but the file has a different name or path. If more than one file is found that meets these criteria, Sync Framework acts as if the original file was deleted and new files were created.

Sync Framework treats a folder move or rename as if the old folder was deleted and the new folder was created. The files in the folder are reported as moves. Therefore, in this case, file data does not usually have to be re-sent.

ref:

Microsoft Sync Framework Overview - http://msdn.microsoft.com/en-us/sync/bb736753

Microsoft Sync Framework Beginner's Guide - http://msdn.microsoft.com/en-us/data/ff629461

Sync Framework Sample code(part of Microsoft SDK) - http://msdn.microsoft.com/en-us/library/bb902852.aspx



Introduction to Sync Framework Database Synchronization - http://msdn.microsoft.com/en-us/data/bb887608

How to Choose a Data Synchronization Technology: Offline & Collaboration - http://msdn.microsoft.com/en-us/data/cc470041

Microsoft Sync Team Tweets - http://twitter.com/syncfx

Microsoft Sync Team Blog - http://blogs.msdn.com/b/sync/

Getting Started with Microsoft Synchronization Services for ADO.NET(Developer.com) -

Take Data Offline Using Microsoft Synchronization Services for ADO.NET(CodeProject) - http://www.codeproject.com/KB/smart/takedataoffline.aspx

Detecting File Changes using Sync Framework - http://msdn.microsoft.com/en-us/library/bb902836.aspx


How to: Synchronize Files by Using Unmanaged Code(C++) - http://msdn.microsoft.com/en-us/library/cc305401.aspx

Sync Framework v4 is now Open Source, and ready to Connect any Device to SQL Server and SQL Azure - http://robtiffany.com/sync-framework/sync-framework-v4-is-now-open-source-and-ready-to-connect-any-device-to-sql-server-and-sql-azure


Microsoft Sync Framework 2.0 Software Development Kit (SDK) - http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=14159

Microsoft Sync Framework 2.1 Software Development Kit (SDK) - http://www.microsoft.com/download/en/details.aspx?id=23217

SOLID Object Oriented Design

SOLID (Single responsibility, Open-closed, Liskov substitution, Interface segregation and Dependency inversion) is a mnemonic acronym introduced by Robert C. Martin which stands for five basic patterns of object-oriented programming and design in Agile Software Development.


SOLID -


SRP - Single Responsibility Principle (A class should have one, and only one, reason to change)


OCP - Open Closed Principle (open for extension, but closed for modification)


LSP - Liskov Substitution Principle (Derived classes must be substitutable for their base classes. if S is a subtype of T, then objects of type T in a program may be replaced with objects of type S without altering any of the desirable properties of that program)


ISP - Interface Segregation Principle (Make fine grained interfaces that are client specific. clients should not be forced to implement interfaces they don't use)


DIP - Dependency Inversion Principle (Depend on abstractions, not on concretions. High-level modules should not depend on low-level modules. Both should depend on abstractions.)


ref:


http://en.wikipedia.org/wiki/Solid_(object-oriented_design)


http://butunclebob.com/ArticleS.UncleBob.PrinciplesOfOod


http://www.c2.com/cgi/wiki?PrinciplesOfObjectOrientedDesign


Non-Software Design Patterns - http://cns2.uni.edu/~wallingf/teaching/062/sessions/support/pattern-examples.pdf


Interface Segregation Principle - http://www.objectmentor.com/resources/articles/isp.pdf


Pablo's SOLID Software Development - http://cdn.cloudfiles.mosso.com/c82752/pablos_solid_ebook.pdf


Visitor Pattern - http://ootips.org/visitor-pattern.html


Houston Design Patterns (Visitor) - http://www.vincehuston.org/dp/VisitorDemosCpp


http://www.lostechies.com/blogs/chad_myers/archive/2008/03/11/ptom-the-liskov-substitution-principle.asp


VMware Virtual Machine(VM) Remote Debugging using WinDBG

Instructions to setup WinDBG to debug VM in Kernel mode(on Windows XP):

Step 1: Edit the settings of you virtual machine to use a named pipe for a COM port

Edit
Settings
COM1
Named pipe:
Add: \\.\pipe\vpcdebug

Step 2: Edit boot.ini file on the virtual machine.

Right-click on My Computer
Properties
Settings
Edit start-up file manually:

Add: /DEBUG /DEBUGPORT = COM1 /BAUDRATE=115200
I like to add a second line here instead. Copy the last line, and append it with the above line:
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /noexecute=optin /fastdetect
/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200

This will give you two different boot options, one for debugging and the other for normal use.

Step 3: Set up WinDbg for remote debugging over COM1.
This can be done through the File -> Kernel Debug menu, but I prefer to make a shortcut so I can have multiple different types of debugging environments.

Create a shortcut that points to WinDbg.exe and add the the necessary command-line arguments. Your shortcut target should look something like this:
"C:\Program Files\Debugging Tools for Windows\windbg.exe" -k com:pipe,port=\\.\pipe\vpcdebug,resets=10

This is all you need to do to set up kernel debugging. Be sure to start the VM before WinDbg so that it has a chance to create the named pipe. Also, make sure you download the correct symbols for your environment. For example:

SRV*c:\websymbols* http://msdl.microsoft.com/download/symbols

Instructions to setup WinDBG to debug VM in Kernel mode(on Vista and above):

debug kernel

/debug /debugport=com1 /baudrate=115200

for Vista

bcdedit

bcdedit /copy {current} /d "DebugBoot"

(note new guid)

bcdedit /displayorder {current} {guid}

bcdedit /debug {guid} ON


On the "debugging server" (the PC with the problem)

Start WinDBG
Type .server npipe:pipe=pipename

On the "debugging client" (the one you're sitting at)

Start WinDBG
Go to File>Connect to Remote Session
For Connection String enter npipe:server=Server, pipe=PipeName [,password=Password] where Server is the hostname/IP and PipeName is the name that the server chose. The password section is optional.

Miscellaneous:

Use “CONTROL+BREAK” command if “Debuggie is not connected” is shown …

If the VM looks like HANG/LOCKED after starting Kernel debugging then type “g” in the WinDbg commandline so that debugging starts and we get the VM unlocked J

ref:


WinDbg remote debugging and Vmware - http://silverstr.ufies.org/lotr0/windbg-vmware.html


Bitwise Operators

Bitwise OR => to "set" or "turn on" a "flag"
Bitwise AND => used to check the state(0/1) of a flag in your flags variable
Bitwise XOR => used to toggle the flag bits of a MASK in your flags variable
Bitwise NOT => used to toggle the bits
Left Shift => Multiply 2
Right Shift => Divide by 2

ref:

C# .Net Books


CLR via C# by Jeffrey Richter(3rd edition adds a lot of useful info on threading and the new parallel extensions)

Professional .NET 2.0 Framework by Joe Duffy is very similar to Richters book, so I like it for the same reasons

C# in Depth by Jon Skeet is an excellent treatment of all the stuff that the two others do not cover

Programming C# By Jesse Liberty

C# Cookbook By Jay Hilyard and Stephen Teilhet

Applied Microsoft .NET Framework Programming - Jeffrey Richter

Essential C# 4.0 by Mark Michaelis

C# 4.0 in a Nutshell. Excellent reference

Effective C# - Best Practices

More Effective C# - Best Practices

The C# Programming Language by Anders Hejlsberg

Programming .Net components by Juval Lowy

Pro ASP.NET 2.0 in C# 2005

The C# language specification (get the book for the annotations)