SQL Compression

  • Compress only large tables.
  • Row compression are better than Page compression for the tables which has high DML operation.
  • When you have multiple indexes on a table, try to compress the rarely used indexes.
  • You can compress only the partitioned data.

Difference between SQL and SQL Azure

  1. Tables must have clustered index
  2. User will not have access to System Views and System Tables
  3. Database mirroring and Failover are not supported as it is supported by Azure platform itself
  4. At this point SSAS, SSRS, and Service Broker are not supported.
  5. There is no support for CLR integrated SQL Statements.
  6. Database backup & Restore are not possible.  You can use SSIS, SQL Azure migration wizard to do this.

For more details refer MSDN page

Visual Studio 2008 Service Pack 1 Remote Debugger

If you installed custom Visual Studio setup, You may be missing the debugger. Or if you want to debug in a box where the complete Visual Studio is not installed you need to install VS remote debugger. You can install from Microsoft Download Center

Microsoft Application Architecture Guide

Microsoft Patterns and practices group released a guideline book for solution architects. The PDF version of it can be downloaded from here.

The following is my notes from the first few chapters of the book.

.Net Application Architecture

  • Why: Balance between User, System & Business
  • Goal
    • System Structure, Realize use cases & scenario, Meets Functional & Quality
    • Landscape: User Empowerment, Market Maturity, Flexible design, Future trends
  • Principles
    • Measure Risks, Priority, Assumptions, Fallback
    • Key Architecture Principles
      • Build to change instead of building to last
      • Model to analyze and reduce risk
      • Use models and visualizations
      • Identify key engineering decisions
    • Key design Principles
      • Separation of concerns
      • Single Responsibility principle
      • Principle of Least Knowledge
      • Don’t repeat yourself
      • Minimize upfront design
      • Design Practices
        • Keep design patterns consistent within each layer
        • Do not duplicate functionality within app
        • Prefer composition to inheritance
        • Establish a coding style and naming convention for dev
        • Maintain system quality using automated QA techniques during development.
        • Consider the operation of your application.
      • Application Layers
        • Separate the areas of concern.
        • Be explicit about how layers communicate with each other.
        • Use abstraction to implement loose coupling between layers.
        • Do not mix different types of components in the same logical layer.
        • Keep the data format consistent within a layer or component.
      • Components, Modules, and Functions
        • A component or an object should not rely on internal details of other components or objects.
        • Do not overload the functionality of a component.
        • Understand how components will communicate with each other.
        • Keep crosscutting code abstracted from the application business logic as far as possible.
        • Define a clear contract for components.
      • Key Design Considerations
        • Application Type: Mobile, Rich client, RIA, Service, Web, Cloud, OBA, SharePoint LOB
        • Deployment Strategy
        • Appropriate Technologies
        • Quality Attributes
        • Crosscutting Concerns: Logging, Authentication & Authorization, Exception, Communication, Caching, Instrumentation
  • Architectural Patterns and Styles
    • Types
      • Client/Server
      • Component-Based Architecture
      • Domain Driven Design
      • Layered Architecture
      • Message Bus
      • N-Tier / 3-Tier
      • Object-Oriented
      • Service-Oriented
      • Architecture (SOA)
    • Client / Server
      • Type
        • Client-Queue-Client systems.
        • Peer-to-Peer (P2P) applications.
        • Application servers.
      • Benefit: Secure, Centralized data access, Ease of maintenance
    • Component based
      • Benefit: Reusable, Replaceable, Not context specific, Extensible, Encapsulated, Independent
    • Domain Driven
    • Layered
      • Abstraction
      • Encapsulation
      • Clearly defined functional layers
      • High cohesion
      • Reusable
      • Loose coupling
    • Message Bus
      • Enterprise Service Bus (ESB)
      • Internet Service Bus (ISB)
    • N-Tier: Maintainability, Scalability, Flexibility & Availability
  • Technique for Architecture & Design
    • Steps
      • Identify Architecture Objectives
      • Key Scenarios
      • Application Overview
      • Key Issues
      • Candidate Solutions
    • Objectives
      • Identify your architecture goals at the start.
      • Identify who will consume your architecture.
      • Identify your constraints.
  • Design Steps
    • Choose Your Layering Strategy:
      • Not too few or Not too many
      • Physical or Logical layer (Tier / Layer)
      • Performance considerations
    • Determine the Layers You Require
      • Traditional: presentation, services, business, and data access
    • Decide How to Distribute Layers and Components
      • Based on App type (Web, RIA, Workflow)
    • Determine If You Need to Collapse Layers
    • Determine Rules for Interaction between Layers
      • Top-down interaction
      • Strict interaction
      • Loose interaction
    • Identify Cross Cutting Concerns
    • Define the Interfaces between Layers
      • Abstract interface
      • Common design type
      • Dependency inversion
      • Message-based
    • Choose Your Deployment Strategy
    • Choose Communication Protocols

Presentation Layer

  • Major divisions
    • User Interface component
    • Presentation Logic component
  • Consideration
    • App Type, UI Technology, Relevant Pattern, Separation of concern, Consider human Interface guidelines, adhere user driven design principles.
  • Specific issues:
    • Caching: Where, How and What
    • Communication: Asynch, Chatty
    • Composition: Avoid dependency
    • Exception: Differentiate System and Business
    • Navigation: Toolbar, Menu, Wizards. Avoid duplicate event handlers
    • UX: Simple & clear
    • User Interface: Consider MVP, Consider different size & resolutions, accessibility,
    • Validation: Reject malicious input
  • Design Patterns
    • Caching: Cache Dependency, Page Cache
    • Composition and Layout: Composite View, Presentation Model, Template View, Transform View, Two-Step View.
    • Exception: Exception Shielding
    • Navigation: Application Controller, Front Controller, Page Controller and Command
    • UX: Asynch callback, Chain of responsibility

Business Layer Guidelines

  • Typical parts
    • Application façade
    • Business Logic Components: Workflow & Entity
  • Design Considerations
    • Decide if you need a separate business layer.
    • Identify the responsibilities and consumers of your business layer.
    • Do not mix different types of components in your business layer.
    • Reduce round trips when accessing a remote business layer. (DTO)
    • Avoid tight coupling between layers.
  • Design Issues
    • Authentication:
      • Avoid in it if it done in same boundary in UI / Service
      • Consider single sign-on, consider same user access data from diff apps.
      • Make sure original caller’s access control list (ACL)
    • Authorization
      • Role-based
      • Avoid impersonation and delegation
      • Don’t mix authorization and business logic
      • Should be pervasive
      • Make sure performance is not hit
    • Cache
      • Consider for static data
      • Avoid sensitive data
      • Study implecations
    • Logging
      • Apache Logging Services "log4Net" or Jarosław
      • Kowalski’s "NLog,"
  • Design Steps
    • Create a high level design for your business layer.
    • Design your business components.
    • Design your business entity components.
    • Design your workflow components.
  • Patterns
    • Business Components: Application Façade, Chain of Responsibility. Command.
    • Business Entities: Domain Model, Entity Translator, Table Module
    • Workflows: Data-Driven Workflow, Human Workflow, Sequential Workflow, State-Driven Workflow

Data Layer

  • Major Parts
    • Data Access Components
    • Service Agents
  • Design considerations
    • Choose an appropriate data access technology.
    • Use abstraction to implement a loosely coupled interface to the data access
    • Encapsulate data access functionality within the data access layer.
    • Decide how to map application entities to data source structures.
    • Consider consolidating data structures.
    • Decide how you will manage connections.
    • Determine how you will handle data exceptions.
    • Consider security risks.
    • Reduce round trips.
    • Consider performance and scalability objectives.
  • Issues
    • Batching: Reduce round trip
    • Binary Large Objects (BLOBs): Consider storage, search and retrieval
    • Connections: Open as late and close as soon, transactions in single connection, connection pooling, avoid stored DSN, consider retry logics
    • Data Format: XML, DataSet for CRUD and DTO serializations
    • Exception Management: have a strategy, Propagation, Use retry, cleanup resource, consider logging and notification strategy
    • Object Relational Mapping: Consider O/RM tools, consider Repository pattern, consider lazy loading
    • Queries: User parameterized Queries, Consider Query Object pattern, For dynamic query avoid mixing generation and business logic
    • Stored Procedures
    • Stored Procedures vs. Dynamic SQL
    • Transactions: Keep it short, have correct Isolation, use System.Transactions, consider Multiple Active Result Set (MARS)
    • Validation
    • XML

OLEDB Data Access – Error

Recently I land up in a simple error in the below code. The application just showed "OleDbException: No value given for one or more required parameters." Any guess what is the issue here? I do have Excel file at the right place. I have all the three columns.

using System;
using System.Data;
using System.Data.OleDb;

namespace ExcelData
{
class
Program
{
static
void Main(string[] args)
{
OleDbConnection excelconn = new
OleDbConnection();


//string exclConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=d:\abc.xls;Extended Properties=’Excel 12.0;HDR=YES’";

string exclConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\abc.xls;Extended Properties=’Excel 8.0;HDR=YES’";

excelconn.ConnectionString = exclConnectionString;
excelconn.Open();


OleDbCommand cmd = new
OleDbCommand(@"SELECT CustomerGroupCode, CustomerGroupDesc, CustomerGroupParent FROM [CustomerGroupHierarchy$]", excelconn);
OleDbDataAdapter cmdadapter = new
OleDbDataAdapter(cmd);


DataTable workingTable = new
DataTable();

cmdadapter.Fill(workingTable);
cmdadapter = null;
}
}
}

 

Ok… The issue is in Excel one of the column name has one extra space at the beginning. If you have space at end of the column name, the code works without any issue. But if the column has prefixed with space, OLEDB shows irrelevant error message "No value given for one or more required parameters".

Web Developer

Recently read a Web developer’s interview experience.  It was great to see the depth of knowledge people have on technologies like JavaScript & CSS.

  1. JavaScript
    1. Prototype chain, String handling, Array Structure
    2. JSON vs XML
    3. Inheritance model
    4. Type coercions,
    5. Memory management,
    6. Garbage collections,
    7. Closures,
    8. Progressive enhancements,
    9. Graceful degradation,
    10. Data types in JavaScript
    11. Memory leak
    12. Javascript Gotchas
    13. Hoisting
  2. AJAX
  3. CSS
    1. Positioning & Floating
    2. Cross browser issues
    3. Common CSS bugs
    4. Hacks
    5. Filters
    6. Layout issues in DHTML
    7. Web Accessibility
  4. Web Technologies
    1. Complete cycle of HTTP request including DNS lookup
    2. Response codes including redirection code
    3. Cookies
    4. Session
    5. Security Issues & Attacks on web for AJAX
    6. TCP Protocol
    7. Request life cycle
  5. Data Structure
    1. Matrix
    2. Array
    3. Hash-map
    4. co-ordinate systems
    5. Rotational Planes
    6. Angle Transformation
    7. Trigonometry

Inspired post

Windows Services – Credentials

Network Service

Local Service

Local System

Predefined local account

Not recognized by the security subsystem

Not supported for LookupAccountName function

No Password associated with this account

Minimum privileges on the local computer

Extensive privileges on the local computer

Acts as the computer on the network

Presents anonymous credentials on the network

Acts as the computer on the network

Its token includes the NT AUTHORITY\SYSTEM and BUILTIN\Administrators SIDs;

.\LocalSystem

LocalSystem

ComputerName\LocalSystem

Security subsystem localizes this account name

NT AUTHORITY\NetworkService

NT AUTHORITY\LocalService

user SID is created from the SECURITY_LOCAL_SYSTEM_RID

not associated with any logged-on user account

MSDN

MSDN

MSDN

SCM – Service Control Manager

What is good Software?

There is no fixed definition for good software.  In a simple fact if it solves the business problem and helps business that it will be near to good software.  This may holds good for a custom application which created for specific set of users.

But when it comes to product it may target wide range of audience and may cover wide business purpose.  That’s where measuring good software becomes a difficult job.   The following list gives fare idea on the same.

  1. Scalability
  2. Extensibility
  3. Flexibility
  4. Reliability
  5. Operability
  6. Audit ability
  7. Affordability

XNA

XNA is Microsoft XBox game development framework.  XNA can be used to create games for PC, Zune, Windows Mobile.  You can use .Net languages for the development.  It provides a complete gaming infrastructure.  The sample templates available with full functioning games as well.

Quick Start: http://creators.xna.com/en-US/quickstart_main

.Net client profile

From .Net 4.0 we have two set of .Net Framework

  • .Net Framework client profile
  • .Net Framework Full

.Net Framework client profile is subset of full .Net framework.  This is to reduce the size of framework for client applications.

For more details refer MSDN, Blog