June 8, 2011

Some useful SQL Queries on Date functions

TO Calculate first day of month
select DATEADD(mm, DATEDIFF(mm,0,getdate()), 0)

First Day of Year
select DATEADD(yy, DATEDIFF(yy,0,getdate()), 0)

First Day of the Quarter
select DATEADD(qq, DATEDIFF(qq,0,getdate()), 0)

Last day of Prior month
select dateadd(ms,-3,DATEADD(mm, DATEDIFF(mm,0,getdate() ), 0))

Last Day of Prior Year
select dateadd(ms,-3,DATEADD(yy, DATEDIFF(yy,0,getdate() ), 0))

Last day of current month
select dateadd(ms,-3,DATEADD(mm, DATEDIFF(m,0,getdate() )+1, 0))

Last Day of Current Year
select dateadd(ms,-3,DATEADD(yy, DATEDIFF(yy,0,getdate() )+1, 0))

January 10, 2011

Web Application Performance Best Practices

Some of the thumb rules to flare better perfomance in web applications

§Appropriate usage of Caching
§Minimize HTTP Requests
§Minification
§Removed unwanted HTML / JS / CSS
§Remove White Spaces
§Place CSS at Top of the page
§Move JS reference to the bottom of the page
§Reduce Image Size
§Cache Static content (Images / CSS / JS)
§Enable HTTP Compression
§Remove Duplicate Scripts

•Use a Content Delivery Network
•Add an Expires or a Cache-Control Header
•Avoid CSS Expressions
•Make JavaScript and CSS External
•Remove Duplicate Scripts
•Don’t scale images in HTML
•Flush the Buffer Early
•Reduce the Number of DOM Elements
•Minimize the Number of iframes
•No 404s
•Minimize DOM Access
•Optimize CSS Sprites
•Keep Components under 25K

Analysis Services 101

Here is intro course to BI Analytics...

1. Facts(Measures) is a summable numeric value
2. Only events tracking in Fact table known as fasctless fact tables, in that case add column with value 1 to track them.
3. Grain is the lowest possible level of information in fact, make it as lowest as possible. Atomic level.
4. Facts are verb in Business process where as Dimesnions are nouns.
5. Dimension shared across more than 1 business process is known as Conformed Dimension
6. Surrogate keys (Meaningless , non-natural, artificial, ) is int value associayrf with each rown in dimesnion
7. Dimensions with Changeable attribute is called Slowly Changing Dimesnions (SCDs)
Type 1 SCDs overwrite old value
Type 2 SCDs have new row for every new change
Type 3 SCDs provide option of columns (not commonly followed and not scalable)
8. Data Dimension classic example for role Playing Dimension... better to have surrogate keys in year-month0date format since 20050221(would help for partitioning)
9.Dimension that doesn't have attributes are known as Degenerated Dimensions (e.g TransactionID)
10.Discourage Snowflake schema, Analysis 2000 has little inclination towards it but not 2005
11. Bridge table required when we have many-many dimensions, called Intermediate Fact Tables in Analysis Services 2005
12. Fact Table types, Periodic Snapshot, transaction and accumulating snapshot

DB Normalization in simple

This is one of the most frequently used question..lot times we know the thing have difficulty in expressing it...thot would write a simple post for it...

First Normal Form (1NF)
  • Eliminate duplicative columns from the same table.
  • Create separate tables for each group of related data and identify each row with a unique column or set of columns (the primary key).

Second Normal Form (2NF)

  • Meet all the requirements of the first normal form.
  • Remove subsets of data that apply to multiple rows of a table and place them in separate tables. Create relationships between these new tables and their predecessors through the use of foreign keys.

Third Normal Form (3NF)

  • Meet all the requirements of the second normal form.
  • Remove columns that are not dependent upon the primary key.

Fourth Normal Form (4NF)

  • Meet all the requirements of the third normal form.
  • A relation is in 4NF if it has no multi-valued dependencies.

Review your Architecture

Last week I bumped in to a book "Enterprise Application Arch 2ed". I read abot reviewing S/W arch by some proven methodlogies..thot would blog for starters.. good read...

Scenario-based evaluations are a powerful method for reviewing an architecture design. In a scenario-based evaluation, the focus is on the scenarios that are most important from the business perspective, and which have the greatest impact on the architecture. Consider using one of the following common review methodologies:

Software Architecture Analysis Method (SAAM). SAAM was originally designed for assessing modifiability, but later was extended for reviewing architecture with respect to quality attributes such as modifiability, portability, extensibility, integratability, and functional coverage.

Architecture Tradeoff Analysis Method (ATAM). ATAM is a refined and improved version of SAAM that helps you review architectural decisions with respect to the quality attributes requirements, and how well they satisfy particular quality goals.

Active Design Review (ADR). ADR is best suited for incomplete or in-progress architectures. The main difference is that the review is more focused on a set of issues or individual sections of the architecture at a time, rather than performing a general review.

Active Reviews of Intermediate Designs (ARID). ARID combines the ADR aspect of reviewing in-progress architecture with a focus on a set of issues, and the ATAM and SAAM approach of scenario-based review focused on quality attributes.

Cost Benefit Analysis Method (CBAM). This CBAM focuses on analyzing the costs, benefits, and schedule implications of architectural decisions.

Architecture Level Modifiability Analysis (ALMA). ALMA evaluates the modifiability of architecture for business information systems (BIS).

Family Architecture Assessment Method (FAAM). FAAM evaluates information system family architectures for interoperability and extensibility.

Refer this URL
http://enggtech.wordpress.com/2010/05/13/software-architecture-qaw-add-atam-cbam-arid-and-sdlc/