Friday, October 28, 2011

20 Best Practices for Speeding up Your Website


ShareThis

1.    Make fewer HTTP requests
•    Use CSS Image Sprites & Image Maps
•    Combine multiple script/css files into one
•    Use inline embedded images in the HTML

2.    Use a CDN
3.    Add an Expires or a Cache-Control Header
4.    Gzip components
5.    Put stylesheets at the top & scripts at the bottom
6.    Make JavaScript and CSS external
7.    Reduce DNS lookups
8.    Minify JavaScript, CSS and HTML
9.    Avoid Redirects
10.    Make Ajax cacheable
11.    Remove duplicate scripts
12.    Configure ETags
13.    Use GET for AJAX Requests
14.    Post-load Components
15.    Preload Components
16.    Reduce the Number of DOM Elements and events
17.    Split Components Across Domains
18.    Minimize the Number of iframes
19.    Optimize Images
20.    Keep Components under 25K

Spectrum of Modern Web Applications


ShareThis

I am more fascinated these days with the new approaches developers are discovering to author modern web aps. Java Script and JQuery is the center of the attraction in all the approaches. Sharing here, the summary of what I read in the documentation of a Microsoft initiative called Project Silk  to author modern web aps..

Spectrum of Web Applications

There is a spectrum of web applications being built today that can be grouped into four application types. These types of web applications are categorized by their full-page reload behavior and the amount of client-side interactivity they provide. Each application type provides a richer experience than the one listed before it.

  • Static sites. These consist of static HTML pages, CSS, and images. They are static in that as each page is navigated to, the browser performs a full-page reload and there is no interaction with portions of the page. In addition, the page does not change no matter who requests it or when.
  • Server rendered. In this model, the server dynamically assembles the pages from one or more source files and can incorporate data from another source during the rendering. The client-side script in these applications might perform some data validation, simple hover effects, or Ajax calls. As each page is navigated to, the browser performs a full-page reload. ASP.NET applications that don't make heavy use of client-side JavaScript are examples of server-rendered web applications.
  • Hybrid design. This model is similar to the server-rendered web application, except that it relies heavily on client-side JavaScript to deliver an engaging experience. This type of application has islands of interactivity within the site that do not require full-page reloads to change the UI as well as some pages that do require a full-page reload. Mileage Stats is an example of a hybrid design.
  • Single-page interface. In this model, a full-page load happens only once. From that point on, all page changes and data loading is performed without a full-page reload. Hotmail, Office Live, and Twitter are examples of single-page-interface web applications.

Characteristics of Modern Web Applications

While there are many types of modern web applications, addressing many different needs, they all have some characteristics in common.

  • They are standards-focused. To have the broadest reach across multiple platforms and devices, applications attempt to implement the current and evolving standards and adopt future standards once ratified.
  • They are interactive. Modern web applications keep the user engaged by providing constant feedback on their actions. This feedback can come in the form of messages, animations to hide or show elements, mouse-over effects, drag and drop feedback, the automatic refreshing of screen data, animation of various elements, or the implementation of fade-in or fade-out effects. Interactive applications leverage the fast JavaScript engines in modern browsers to perform their client-side tasks.
  • They limit full-page reloads. Modern web applications seek to limit the number of full-page reloads. Reloads are much slower than a localized Ajax call to update a portion of the UI. Full-page reloads also limit the ability to animate state or page changes. By not performing a full-page reload, users can be kept in context, providing a fluid experience as they navigate from one task to another.
  • They are asynchronous. Modern web applications use Ajax to dynamically load data, page fragments, or other assets instead of performing a full-page reload to acquire data or HTML content. Because the loading of data is asynchronous, the UI is able to stay responsive and keep the user informed while the data request is being fulfilled. This asynchronous on-demand loading also reduces application response time because requests can be tuned to return only the data and other content that needs to change.
  • They manage data. When applicable, modern web applications provide client-side data caching and prefetching to boost client-side performance. This enables the UI to immediately respond to user input gestures because it does not have to make a call to the server for data. Data caching also serves to minimize the impact on server resources, increasing application scalability because fewer calls to the server are required.

Tuesday, October 18, 2011

Top 10 New Features in SQL Server Denali


ShareThis

I will be writing on SQL Server 12 or Code name Denali in the coming few posts.

The next release of Microsoft SQL Server 12 or code-named Denali, is the buzz now a days. Microsoft has just released Denali CTP3, and the final release is expected by the end of the year. Denali continues SQL Server's efforts into the enterprise with a number of important features. Here are the top 10 most significant new features in the SQL Server Denali release.

10. SQL Server Developer Tools—One of the most obvious improvements in SQL Server Denali is the new development environment, SQL Server Developer Tools, coded-named Juneau. Juneau uses the Windows Presentation Foundation (WPF)–based Visual Studio 2010 shell, and it unifies development for Business Intelligence Development Studio (BIDS) and Visual Studio. One goal for Juneau is to make the development environment consistent for both SQL Azure and the on-premises version of SQL Server.

9. Contained databases—Contained databases make it easy to move databases between different instances of SQL Server. With Denali, login credentials are included with contained databases. Users don't need logins for the SQL Server instance because all authentications are handled by the contained database. Contained databases have no configuration dependencies on the instance of SQL Server that they're hosted on and can be moved between on-premises SQL Server instances and SQL Azure.

8. Project "Crescent"—The new data visualization tool, code-named Project "Crescent," is Closely integrated with SharePoint 2010 and Silverlight. Microsoft has called the Crescent feature "PowerPoint for your data." Crescent makes it easy for users to create great-looking data pages and dashboards by using data models that are built using PowerPivot or from tabular data from SQL Server Analysis Services.

7. Data Quality Services—Valid data is critical for making effective business intelligence (BI) decisions. Data Quality Services lets you set up a knowledge base that defines your metadata rules. You can then run Data Quality Services projects to apply those rules to data stored in a SQL Server data source. The Data Quality Services projects cleanse the data and allow viewing of good, invalid, and corrected rows.

6. User-defined server roles—An important security-related feature in Denali is the addition of user-defined severs roles. Earlier releases had fixed server roles that were predefined by Microsoft. These roles covered most situations, but they weren't as flexible or granular as some organizations wanted. The new user-defined server roles give organizations more control and customization ability over SQL Server's server roles.

5. Change data capture (CDC) for Oracle—
CDC lets you keep large tables in sync by initially moving a snapshot to a target server, then moving just the captured changes between the databases. With the SQL Server 2008 release, CDC was limited to SQL Server, but many organizations also have other database platforms they want to use CDC with. A big improvement in the Denali release is the addition of CDC for Oracle.

4. T-SQL enhancements—Two of the most important T-SQL enhancements in Denali are the addition of the Sequence object and the window functions. Unlike the similar Identity column, Sequence lets you tie unique row identifiers across multiple tables. The new window functions apply to sets of rows using the new OVER clause. You can read more about window functions in "Window Functions (OVER Clause)—Help Make a Difference."

3. Columnar store index—The columnar store index or, as it is sometimes called, the column-based query accelerator, uses the same high performance/high compression technology that Microsoft uses in PowerPivot, and it brings that technology into the database engine. Indexed data is stored according to the data of each column rather than by the rows, and only necessary columns are returned as query results for columnar indexes. Microsoft states this technology can provide up to 100 times improvement in query performance in some cases.

2. Support for Windows Server Core—The ability to run SQL Server on Windows Server Core has been missing from previous releases of SQL Server. Server Core is designed for infrastructure applications such as SQL Server that provide back-end services but don't really need a GUI on the same server. Denali's support for Server Core enables leaner and more efficient SQL Server installations and at the same time reduces potential attack vectors and the need for patching.

1. AlwaysOn—Without a doubt, the most important new feature in SQL Server Denali is the new SQL Server AlwaysOn feature. AlwaysOn is essentially the next evolution of database mirroring. AlwaysOn supports up to four replicas, the data in the replicas can be queried, and backups can be performed from the replicas. Although it's still early, AlwaysOn seems more complicated to set up than database mirroring because it requires Windows Failover Clustering, but the advantages appear to make it well worth the extra effort.

Sunday, October 9, 2011

Log Shipping vs. Mirroring vs. Snapshot vs. Replication in Databases


ShareThis

Recently, I have been taking more interests and started learning in Databases. I will keep sharing my deep dive learning outcomes in my blog. Keep following..

Log Shipping

Log Shipping is an old technique available since SQL SERVER 2000. Here the transactional log (ldf) is transferred periodically to the standby server. If the active server goes down, the stand by server can be brought up by restoring all shipped logs.

Usage Scenario: You can cope up with a longer down tim

 

e. You have limited investments in terms of shared storage, switches, etc.

Log shipping is based on SQL Server Agent jobs that periodically take log backups of the primary database, copy the backup files to one or more secondary server instances, and restore the backups into the secondary database(s). 

Log shipping supports an unlimited number of secondaries for each primary database.

Database mirroring is preferable to log shipping in most cases, although log shipping does have the following advantages:

1. it provides backup files as part of the process
2. multiple secondaries are supported
3. it is possible to introduce a fixed delay when applying logs to allow the secondary to be used for recovering from user error

Database Mirroring

Database mirroring is functionality in the SQL Server engine that reads from the transaction log and copies transactions from the principal server instance to the mirror server instance.

Database mirroring can operate synchronously or asynchronously

If configured to operate synchronously, the transaction on the principal will not be committed until it is hardened to disk on the mirror.

Database mirroring also supports automatic failover if the principal database becomes unavailable.

The mirror database is always offline in a recovering state, but you can create snapshots of the mirror database to provide read access for reporting

which was introduced with 2005 edition, works on top of Log Shipping. Main difference is the uptime for the standby server is quite less in mirroring. Standby server automatically becomes active in this case (through help of a broker server which is called as Witness in SQL SERVER parlance), without having to restore logs (actually logs are continuously merged in this scenario – no wonder it’s called Mirror clip_image001 ).

Snapshot

Snapshot is a static read only picture of database at a given point of time. Snapshot is implemented by copying a Page (8KB for SQL SERVER) at a time. For e.g. assume you have a table in your DB, & you want to take a snapshot of it. You specify the physical coordinates for storing snapshot & when ever original table changes the affected rows are pushed first to the the snapshot & then changes happen to the DB.

Usage Scenario: You have a separate DB for report generation, and want to ensure that latest data for that is available. You can periodically take snapshot of your transactional database.

Replication

Replication is used mainly when data centers are distributed geographically. It is used to replicate data from local servers to the main server in the central data center. Important thing to note here is, there are no standby servers. The publisher & subscriber both are active.

Usage Scenario: A typical scenario involves syncing local / regional lookup servers for better performance with the main server in data center periodically, or sync with a remote site for disaster recovery.

Failover Clustering

Failover Clustering  is a high availability option only (unlike others above which can be used for disaster recovery as well) used with clustering technology provided by hardware + OS. Here the data / databases don’t belong to either of servers, and in fact reside on shared external storage like SAN. Advantages of a SAN storage is large efficient hot pluggable disk storage. You might see DR options like Mirroring used quite frequently with failover clustering. Here’s a good article on adding geo redundancy to a failover cluster setup.

Few links for further Reference

http://blogs.msdn.com/b/mikewat/archive/2007/07/28/database-mirroring-and-log-shipping-which-is-better.aspx

http://stackoverflow.com/questions/525637/what-are-the-scenarios-for-using-mirroring-log-shipping-replication-and-cluster

http://sqldbpool.com/2010/02/15/database-mirroring-vs-log-shipping/

http://msdn.microsoft.com/en-us/library/ms187016.aspx

http://social.msdn.microsoft.com/Forums/en-US/sqldatabasemirroring/thread/ee05954e-0934-4305-8936-b9226e231d06/

 

Wednesday, May 25, 2011

How to handle missing Images in HTML


ShareThis

Try this simple code. Handle OnError event of Image-

<img src="http://www.satya-weblog.com/image.png" height="100px" width="100px" onerror="this.src = '/image/item-no-image.png'" />

Or-

<img src="http://www.satya-weblog.com/image.png" height="100px" width="100px" onerror="handleMissingImg(this);" />

  1. function handleMissingImg(ele) 
  2. { 
  3.      ele.src = '/image/item-no-image.png'; 
  4. } 

Or, you can also use this-

  1. function IsImageOk(img) { 
  2.  // During the onload event, IE correctly identifies any images that 
  3.  // weren't downloaded as not complete. Others should too. Gecko-based 
  4.  // browsers act like NS4 in that they report this incorrectly. 
  5.     if (!img.complete) { 
  6.         return false; 
  7.     } 
  8.  
  9.  // However, they do have two very useful properties: naturalWidth and 
  10.  // naturalHeight. These give the true size of the image. If it failed 
  11.  // to load, either of these should be zero. 
  12.    if (typeof img.naturalWidth != "undefined" && img.naturalWidth == 0) { 
  13.        return false; 
  14.    } 
  15.     // No other way of checking: assume it's ok. 
  16.     return true; 
  17. }

Thursday, January 13, 2011

Windows Phone 7 development my thoughts..


ShareThis

I was anticipating Windows Phone 7 development to be promising for me.

But, after investigating the whole range of missing features in Windows Phone 7 and its API, I have to rethink again for it.

clip_image001Can you imagine you can’t access the Phone book programmatically in windows phone7!

… These feature limitations certainly minimizes the usability of the expensive phone hardware on which Windows phone 7 runs.

This also limits the possibilities for a developer to author creative and featured mobile apps.

List of missing features in Windows Phone 7:

· The only dev platforms supported to author Apps for Win Phone 7 are- Silverlight and XNA. No support for Dot net Compact Frame work or native / unmanaged code

· The Silverlight App you right runs in a sandboxed environment and limits the a lot of functionalities

· Cut, copy, and paste is missing

· No support for peer to peer gaming

· The Calendar app no longer has a 'Weekly' view

· The list of past phone calls is now a single list, and cannot be separated into inbound, outbound or missed calls

· Full multitasking for apps is not available

· Does not support for Adobe Flash and NOT even supports the Silverlight in the browser

· Windows Phone 7 supports upgradable storage via an SD Card; however the SD card memory will be merged with the phone's internal storage,

And changing the SD card will make the phone reset to factory settings L huh  CRAZY…

· Windows Phone 7 does not support connecting to Wi-Fi (wireless) access points which are hidden or have a static IP address

· Video-calling

· VoIP calling

· USB mass-storage (no USB drive mode)

· Universal email inbox

· Universal search

· Turn-by-turn navigation

· A system-wide file manager

· Bluetooth file transfers

· USSD messages

· Custom ringtones

· Windows Phone 7 devices only support syncing with Exchange ActiveSync over the network. There is no support for syncing with Exchange ActiveSync using a cable or cradle

· In the enterprise, Windows Phone 7 does not support Office documents with security permissions

· IPsec security on-device encryption

· Strong passwords

· Internet sockets

· While the older Windows Mobile phones supported the full range of Microsoft Exchange Server policies, Windows Phone 7 only supports a small subset of Exchange features. So this kills a whole set of possibilities for creating enterprise E-mail apps

· No replacement of the default apps – while Opera will be allowed, it could not be the default browser

· No 3rd party shells

· Marketplace is the only way to install apps, except for developers, beta versions and enterprise

· No internet tethering support

And did you know that the minimum hardware requirements for Windows phone 7 are-

· Minimum 1 GHz ARM better processor (And that’s the highest processor speed available in smart phone segment ) clip_image002

· DirectX9 rendering-capable GPU

· Minimum 256 MB of RAM with at least 8 GB of Flash memory

So, it’s high on resource requirements making phones to be much costly.

clip_image004

But there are some good news also-

· Few of the missing features have been confirmed to arrive in the near-future

· I wish release of at-least programmatic access to phone’s contact list soon…

What do you think ? Put your thought ahead!

Friday, December 24, 2010

What is Tombstoning


ShareThis

In Phone Operating Systems like Windows Phone 7..

The procedure in which the operating system terminates an application’s process when the user navigates away from the application. The operating system maintains state information about the application. If the user navigates back to the application, the operating system restarts the application process and passes the state data back to the application.

os7

Wednesday, December 22, 2010

Collection of “How do I ?” MSDN Videos–(Produced by us) on Windows Phone 7, Sharepoint 2010, Silverlight4, Cloud Services, Visual Studio 2010, SQL Server RC2, Windows 7


ShareThis

Windows Phone 7

1. How Do I: Implement Tombstoning in Windows Phone 7 Applications?

2. How Do I: Migrate an Android Application to a Windows Phone 7 Application?

3. How Do I: Use Page Turn Animation in a Windows Phone 7 Application?

4. How Do I: Use MVVM in a Windows Phone 7 Application?

5. How Do I: Use Touch Manipulation in a Windows Phone 7 Application?

6. How Do I: Make Windows Phone 7 Applications Support Orientation Changes?

7. How Do I: Implement Tilt Effects in a Windows Phone 7 Application?

8. How Do I: Migrate an iPhone Application to a Windows Phone 7 Application?

9. How Do I: Use XNA for Game State Management in a Windows Phone 7 Application?

10. How Do I: Use XNA for Gestures and Collision Detection in a Windows Phone 7 Application?

11. How Do I: Save Images to the Pictures Hub and Retrieve them back from the Hub in a Windows Phone 7 Application?

12. How Do I: Use Push Notifications for Tile Customization in a Windows Phone 7 Application?

13. How Do I: Use Push Notifications in a Windows Phone 7 Application?

Windows 7

1. How Do I: Use a Progress Bar on Icon in a Windows 7 Application?

2. How Do I: Create an Overlay Icon in a Windows 7 Application?

3. How Do I: Create a Custom Thumbnail for a Windows 7 Application?

4. How Do I: Create a JumpList for Common Tasks in a Windows 7 Application?

5. How Do I: Use Multitouch in a Windows 7 Application?

6. How Do I: Create an Internet Explorer 9 Pinned Site in Windows 7?

7. How Do I: Create Custom Thumbnails and Previews for a Windows 7 Application?

8. How Do I: Use Microsoft Speech API in a Silverlight Out-of-Browser Application?

SharePoint 2010

1. How Do I: Use Client Object Model from a Silverlight Application in SharePoint?

2. How Do I: Build a SharePoint Workflow Using Visual Studio 2010?

3. How Do I: Create a Reusable Workflow Using Visual Studio 2010 and SharePoint Designer 2010?

4. How Do I: Use REST Services to Access and Update Data in a SharePoint List?

5. How Do I: Use Business Data Connectivity Model in SharePoint by Using Visual Studio 2010?

Visual Studio 2010

1. How do I: Use IntelliTrace in Visual Studio 2010?

2. How Do I: Perform Exploratory Test in Visual Studio 2010?

3. How Do I: Use Build in Visual Studio 2010?

4. How Do I: Use Query Folders for Organizing Queries in Team Foundation Server 2010?

5. How Do I: Split a Team Project Collection in Team Foundation Server 2010?

6. How Do I: Use Traceability in Visual Studio 2010?

7. How Do I: Enable Symbol and Source Server Support in Team Foundation Server Build 2010?

Cloud Services

1. How Do I: Work with Spatial Data in SQL Azure?

2. How Do I: Work with Windows Azure Marketplace DataMarket?

SQL Server 2008 R2

Wednesday, December 15, 2010

Smartphone overview and comparision


ShareThis

 

A smartphone is a phone that runs a recognizable OS on which the user can install applications.

Some facts:

  • In 2009, about 175 million smartphones were sold worldwide. The market is expected to grow by 90% this year.
  • Android is moving into the mid-range market with devices such as the Vodafone 845that have cheaper, less powerful hardware.
  • Now that Microsoft has released Windows Phone 7, Windows Mobile will disappear.
  • MeeGo was not available at the time of this writing. It is likely to hit the market in the first quarter of 2011.
Smartphone market overview
MARKET SHARE OSS CONSUMERS
High-end 20% iOS
Android
webOS
MeeGo
Windows Phone 7
BlackBerry OS6
Within the high-end group, users care about web surfing and applications above anything else, and they’re willing to pay for these features.
Business 35% BlackBerry
Symbian
Windows Mobile
Windows Phone 7
The business group includes phones that companies buy for their employees. The IT department decides which OS can access the company network so that users can retrieve e-mail and browse secure intranets.
Mid-range 45% Android
Symbian
BlackBerry
bada
Windows Mobile
Within the mid-range category, users are interested in music, a good camera, and/or easy texting (which requires a hardware keyboard)—all in an affordable device.
Global browser stats for November, 2010
SHARE BROWSER NOTES
22% Opera StatCounter lumps Opera Mini and Opera Mobile together. My personal estimate, based on discussion with Opera, is that about 90% of this number is Mini.
22% Safari StatCounter splits up iOS into iPhone, iPod Touch, and iPad. It includes iPad stats with the Safari desktop—not in the mobile statistics. Therefore, this figure excludes the iPad.
19% BlackBerry This encompasses mostly the OS5 and older models, which run a browser with a homegrown rendering engine. From OS6 on, BlackBerry uses a WebKit-based browser, and that will make our job a lot easier.
17% Nokia Nokia’s WebKit-based browser comes in various flavors, some of which are better than others. Unfortunately StatCounter does not differentiate between each flavor.
11% Android The Android market is pretty fragmented when it comes to browsers. There are some subtle differences between browsers on HTC and Sony Ericsson devices. Expect problems to arise from these inconsistencies.
4% NetFront NetFront runs mostly on older phones from Asian vendors, notably Sony Ericsson. This figure includes the Sony PlayStation Portable as well as other gaming devices.
1% UCWeb The most popular browser in China. It offers little functionality.
1% Samsung StatCounter lumps all Samsung browsers together, from old NetFront-based phones to the new WebKit-based bada.

 

The best mobile browsers

  1. Safari for iOS—the best mobile browser overall,
  2. Android WebKit,
  3. Dolfin for Samsung bada—by far the fastest mobile browser, and
  4. BlackBerry WebKit, the new default browser for OS6 and higher. (Currently only available on the BlackBerry Torch.)

How to secure your password- tips and tricks!


ShareThis

Here are few trick tips and tricks that will help you to secure your password:

passwordHOW TO SET SECURE PASSWORDS

For a password to be secure, it needs to be difficult to guess, as long as possible and consist of a combination of letters, numbers and characters. It also needs to be unique for each service that you use. The trouble is that the longer and more difficult to crack a password becomes, the harder it becomes to remember, which is why many people use the same password everywhere. The good news is, there are a few strategies that you can use to set secure and unique, yet memorable, passwords:

  1. Use a password manager. This is probably the easiest and most secure option, and so it’s the one I recommend. There are several excellent tools available, such asLastPass, 1Password and KeePass, that can generate and store extremely tough to crack unique passwords for every service you use. Because the tool manages the passwords for you, you don’t need to worry about forgetting a tricky long password.
  2. Use a password hashing tool. A password hashing tool will take your password, combine it with a parameter (perhaps based on the site’s name or domain) and combine the two using a hashing function to create a very tough to crack password. As the tool deals with the hashing for you, you only need to remember the master password. There are several free password hashers available as browser add-ons.
  3. Use a rule-based password strategy. Gina Trapani posted a great rule-based password strategy on Lifehacker back in 2006 (if only all the Lifehacker readers had actually heeded her advice!). The idea is that you take a base password and combine it with the name of the service the you’re creating the password for using a set of rules. For example, my password for WebWorkerDaily might be %shjk80aily% (an easily memorable master password of shjk80, plus the final four letters from the service name, surrounded by % characters for extra security). Applying the same rules, my password for Amazon would then be %shjk80azon%. You can also reverse or reorder the letters from the service name, or interweave  them with the letters from your master password, for even greater security.