NEWS

Monday, February 27, 2012

Flash Memory (NAND, NOR) overview


Flash memory has become a powerful and cost-effective solid-state storage technology widely
used in mobile electronics devices and other consumer applications. Two major forms of Flash
memory, NAND Flash and NOR Flash, have emerged as the dominant varieties of non-volatile
semiconductor memories utilized in portable electronics devices. NAND Flash, which was
designed with a very small cell size to enable a low cost-per-bit of stored data, has been used
primarily as a high-density data storage medium for consumer devices such as digital still
cameras and USB solid-state disk drives.  NOR Flash has typically been used for code storage
and direct execution in portable electronics devices, such as cellular phones and PDAs.

http://download.micron.com/pdf/datasheets/flash/nand/2gb_nand_m29b.pdf
http://umcs.maine.edu/~cmeadow/courses/cos335/Toshiba%20NAND_vs_NOR_Flash_Memory_Technology_Overviewt.pdf
http://media.kingston.com/pdfs/FlashMemGuide.pdf

30 Popular Free Android Games

Must Have Best Free Android Games :

1) Paradise Island : This is really fun oriented free stimulation game for the people who love sea, sun and beaches. You can build your own sunny island of your wish. The game allows you to run your own business and attract rich tourists. In this game you can create your own empire. You can build Casino’s, Hotel’s, Entertainment center’s, Restaurant’s and Disco’s to entertain tourists. You can create your own resort and manage it accordingly. The rich graphics are very beautiful and be careful since its a extremely addictive game. I bet you will love this game and its gameplay. Click here to download the App from android market : Download

2) Angry Bird Rio : This is a very popular game loved by millions of users world wide. In this game you can destroy the greedy pigs fortresses! Angry Bird Rio is a extension of its original game Angry bird. Here in this story mode, the other angry birds are caged and are shipped to Rio.They get very angry with this and want to take revenge on the pigs. You can find two friends Blu and Jewel fighting for there friends to set them free.The excellent game play will give a real film experience to the user.There are a total of 60 levels with hidden fruits and exciting gifts. You will love the game when you find the smugglers and take them out. You can download the app from android market : Download

3) Yoo Ninja! FREE : Be careful while playing this game in you android. Because this is very addictive game which never ends. This fast paced gravity game is very famous and liked by many gamers. The game must be playing by jumping up and down to avoid obstacles. Maintain constant speed and accuracy. This one touch arcade games is very simple.You can find a story mode with 34 different levels. You can also find the endless mode, where you can play for days. There are 4 different worlds and the ending of the story mode is excellent. You can download the app from android market : Download

4) Paper Toss : A very famous game before when its launched in android. This is most awaiting game by android users who wanted to have fun with a office environment. Guess so many people have played this game already in there office. I mean playing with a piece of paper and throwing it here and there to pass time. Most of us target a empty basket or a dustbin to throw a piece of paper made into a ball shaped. This game is some what similar to that kind of stuff. The game is very realistic and fun. The graphics are really awesome and you can play the game in 6 different levels. The most fun part is, you can hear all sounds which are made in a office and also co-workers shouting at you. Don’t miss this game if you really want some office fun. You can download the app from android market : Download

5) Bubble Blast 2 : Bubble blast is a game where there is a start but no end. you can play the games for ages. This game is a puzzle game in which we have to blast bubbles to trigger in a chain reaction to eliminate them. The game offers two modes. One is arcade and another is puzzle mode. There are around 3500 levels where the scores are being provided by Score loop.You can download the app from android market : Download

6) World War™ : This is a massive Multiplayer online game which is played by millions of people everyday. In this game we run with a good story mode of 2012 nuclear war which will create history and 5 countries will merge to become a massive force with superpowers in this war. You can battle with other players live. You can found millions of people playing the game online. Around 2.8millions of player will be active every time when you login.You can download the app from android market : Download

7) Slice It! ® : This award winning game is really awesome to play.This is a silver award winning pocket game. The game is a brain game which have very good levels of puzzles and once you slice it, you cant stop it. We have to slice a piece of area into same dimensions. This puzzle game is very interesting and very addictive. It has over 180 different stages and available in different language. You can download the app from android market : Download

8 ) Live Holdem Poker Pro : If you want to play poker with millions of people online, then this is the best app for you. You can join the android network to play with millions of real people like Pro’s, Semi-Pro’s, and Beginners. You can join the no : 1 Texas Hold’em community on the Android Network and play with millions from Facebook and Google android.You can get 12K free chips and 1000 Diamonds on registration + 5000 chips for free every day.Also you can use personal avatars and there is live chat included. You can enter the shootout tournament mode and have awesome challenges. You can download the app from android market : Download

9) Jewels : How can anyone miss this wonderful game ? Jewels is very simple game, but quite polished and fun match 3 puzzle game.The game is very addictive. I sit hours playing this game. You can complete with players all over the world. Global, cross-platform leader boards and many more. The graphics are really neat and clean, the game is very smooth.The game has four different modes, Normal, Timed, Quick and Infinite and also the game is available for iphone. You can download the app from android market : Download

10) Mouse Trap : This simple puzzle game is very addictive and very interesting. All you have to do is to find the way out of a mouse which is trapped. You can do it by sliding the blocks out of the mouse way and unblock each of the maze. You can unlock bonuses and gain coins as the game progresses. With the gain coins you can unlock various level packs and hidden features in the game bonus store. There are 1200 levels which require excess amount of patience, skill and logic. If you have that then take out the mouse from the maze 1200 times. You can find some challenging puzzles and bonus level which are really lot of fun.You can download the app from android market : Download

12) Alchemy : This game is very famous and loved by million of people today. The game is very simple and straight. You have four basic elements Fire, Water, Earth and Air. All you have do is to combine them and there products to get new elements around 200 and more. You can create many things like Life, Beer, Vampires and etc.There are total 370 elements. So try the game once if you really love to pass your time.You can download the app from android market : Download

13) Tank Hero : Tank hero is a well known game. This game provides a fast paced 3D action on your android. You can battle through different arenas and become a Tank Hero.There are a lot of cunning enemies in you way so take out your enemies with cannons, heat seekers, and howitzers. The OpenGL 3D graphics are really awesome and you have 80 levels with two environments. There are two modes of gameplay, one is campaign and other is survival mode. You can choose 5 types of weapons and AI tanks. You can also find Multi Touch and Trackball control schemes :) You can download the app from android market : Download

14) iMobsters™ : This Massively Mafia Multiplayer game connects you to over two millions of players. You will start you career as a small thief and will grow to a Mafia Don by bringing others into you mob. You can fight with others in the mobsters online with Multiplayer mode. Millions of mafia players are online now. Just go and give it a try. The best part is you can fight them LIVE! You can download the app from android market : Download

15) Robo Defense FREE : In this game you will experience ultimate portable defense system. The graphics are really good and you can find many good maps, achievements and upgrades in the game. You can play with 1 map and eleven different levels. The full game is also available with all maps and upgrades. I would say just give it a try. If you are impressed you can buy a Pro version.You can find the upgrade option in the game itself. Just complete the free version for a basic experience. You can download the app from android market : Download

These are the top 15 popular android games so far. Just download the apps from Android Market and have fun. I will upload 15 more popular games below. Just take a look at it.

Few Other Free Popular Android Games :

  1. Restaurant Story™
  2. Gun Bros
  3. Words With Friends Free
  4. Drag Racing
  5. Fruit Slice
  6. Chess Free
  7. Air Control Lite
  8. Bonsai Blast
  9. NinJump
  10. Mega Jump
  11. Solitaire
  12. X Construction Lite
  13. PapiJump
  14. Mahjong
  15. Labyrinth Lite

So total of 25 top class popular android games which you cant miss. And the best part is all of them are completely free of cost. Just download them and have fun with your android.

Wednesday, February 22, 2012

Wi-Fi Direct: what it is and why you should care ?


Wi-Fi Direct: everything you need to know

The world is falling out of love with cables, but the Wi-Fi we know and love isn't always the best way to connect devices.
Wouldn't it be great if you could effortlessly connect Wi-Fi devices without messing around with access points and lengthy passphrases? That's what Wi-Fi Direct promises.

Wi-Fi Direct is a proper standard

It comes via the Wi-Fi Alliance, the global industry association in charge of certifying Wi-Fi kit.

Wi-Fi Direct is Wi-Fi without the internet bit

The idea behind Wi-Fi direct is that simple tasks need simple connections. For example, you might want to print from your laptop or smartphone to a wireless printer, or to share images with someone else in the same room, or to transmit video from your phone to your TV. None of these things requires an internet connection, but they do need to connect - to the printer, or to the other person's hardware, or to the TV. With Wi-Fi Direct, that bit's easy.

Wi-Fi Direct can have the internet bit too

If you have a Wi-Fi router connected to the internet, you can connect to that too.

Wi-Fi Direct doesn't need a wireless access point

Wi-Fi Direct devices can connect to each other without having to go through an access point: they can establish ad-hoc networks as and when required, letting you see which devices are available and choose which one you want to connect to. If that sounds very like Bluetooth, that's because it is.

Wi-Fi Direct uses Wi-Fi Protected Setup

You don't want any Tom, Dick or Harriet to be able to connect to your stuff - for example, you might not want to see what the neighbours are beaming to their TV on your TV - so Wi-Fi Direct uses Wi-Fi Protected Setup [PDF] and WPA2 to prevent unauthorised connections and keep your communications private. There are two ways to establish a connection: with physical buttons - "press the button on gadget X and then the same one on gadget Y", or with PIN codes.

Wi-Fi Direct knows what's nearby

Wi-Fi Direct includes two potentially useful things: Wi-Fi Direct Device Discovery and Service Discovery. Your device doesn't just know there are devices available; if developers have enabled it, your device will know what kind of devices are nearby and what's on offer - so for example if you're trying to display an image, you'll only see devices that you can beam images to; if you want to print, you'll only see devices that are or that are connected to printers. Crucially this can happen before you connect, so you don't waste any time trying to connect so something that doesn't do what you want it to do.

Wi-Fi Direct uses the same silicon

Manufacturers don't need to add extra radios to their kit: the idea is to have Wi-Fi Direct as part of the standard Wi-Fi radio. It's backwards compatible too, so you don't need to throw out your old Wi-Fi-enabled kit.

Wi-Fi Direct is part of DLNA, and Android too

In November, the Digital Living Network Alliance (DLNA) announced that it was including Wi-Fi Direct in its interoperability guidelines, and Google has added Wi-Fi Direct support to Android 4.0 Ice Cream Sandwich (for example it's in the Samsung Galaxy Nexus's networking options). DLNA says it "expects DLNA Certified and Wi-Fi Certified Wi-Fi Direct smartphones to grow strongly through 2016." That could be an awful lot of smartphones.

Tuesday, February 21, 2012

Customize Android phone to imitate iPhone or Windows using Espier and Launcher 7


One of the best things about using an Android smartphone is you can change your phone’s appearance and behavior to mimic any of the other platforms like Windows Phone 7 or iPhone very easily.

Espier Launcher tries to do just that. If you have ever used an iPhone you would know how the launcher functions in it. The main difference is that there is no app drawer in iPhone like Android has, instead all the installed applications are spread across the home screens. The other difference is that there are no widgets.
Espirer Launcher tries to imitate the iOS launcher on your phone. Just like the launcher on iPhone, there is no app drawer here. Instead all your applications are arranged across multiple home screens and you also have a Spotlight type of search on one homescreen


Themes / Skins for Swype


Android is known for its ability to be customized. You can change every part of your phone –  the launcher, dialer, messaging app and even the status bar. This is true with the keyboard as well. If you do not like the default keyboard that cones with your phone, you can install any of the alternate ones that are available. Two of  the popular alternative keyboards for Android are SwiftKey X and Swype.


Of these SwiftKey X is the one preferred by many, because it can be themed/skinned. While Swype does not have any official themes/skins available, some developers/themers have modified the Swype APK to modify its resources and created themed Swype keyboards.

For installing any of these themes, you just need to uninstall the Swype installer & Swype from your phone and install the respective installer for the Swype theme you like. If you want to change the theme, just uninstall Swype again and install the new APK for the skin you like. XDA member djdarkknight has modded the latest Swype APK to create some awesome themes, you will definitely get a theme as per your liking. Hit the link below to find out more

Adobe Flash Player 10.2 For ARMv6 and ARMv7 Android Phones (LG Optimus P500, P690, P698, Samsung Galaxy 3, Galaxy Ace..)Adobe Flash Player 10.2 For ARMv6 and ARMv7 Android Phones

Flash player 10.2 , features more smoother experience of flash over the internet. now the new flash player supports even more android devices but still devices need to have custom roms as earlier app demanded to run it smoothly. Though you can also find the latest version of 10.3 over the internet but we don't recommend it to anybody because it is even more worse then 10.1, and we have tested all the 3 version of flash and 10.2 is the most smoothest off all


The new version of flash player comes packed in with some set of improvements like :- 
  • Better app compatibly
  • Now support more armv6 devices
  • Comes in with Hardware Acceleration
  • More smoother Experience while browsing the internet
  • YouTube now works Flawlessly
  • Richer graphics and more FPS in animations
  • A lot faster the version of flash then 10.1
  • Now support Playing small games which do not overload processors
DOWNLOAD FLASH PLAYER 


Installation Instructions:
  1. DOWNLOAD THE APP BELOW AND SAVE IT TO YOUR SD CARD
  2. NOW MAKE SURE YOU HAVE 'UNKNOWN SOURCES' ENABLED IN YOUR SETTINGS > APPLICATIONS
  3. NOW OPEN ANY FILE MANGER LIKE ASTRO AND NAVIGATE TO THE APK FILE WHEREVER YOU STORED IT
  4. JUST OPEN THE FILE AND CLICK INSTALL
  5. NOW REBOOT THE PHONES ONCE INSTALLATION COMPLETE

Thursday, February 16, 2012

What's New in the .NET Framework 4.5 Developer Preview


.NET for Metro style apps


Metro style apps are designed for specific form factors and leverage the power of the Windows operating system. A subset of the .NET Framework is available for building Metro style apps for Windows using C# or Visual Basic. This subset is called .NET APIs for Metro style apps. For more information about this subset, see .NET for Metro style apps.


The following features and improvements were added to the common language runtime and to .NET Framework classes:
  • Ability to limit how long the regular expression engine will attempt to resolve a regular expression before it times out.
  • Ability to define the culture for an application domain.
  • Console support for Unicode (UTF-16) encoding.
  • Support for versioning of cultural string ordering and comparison data.
  • Better performance when retrieving resources.
  • Zip compression improvements to reduce the size of a compressed file.
  • Ability to customize a reflection context to override default reflection behavior through the CustomReflectionContext class.

Managed Extensibility Framework (MEF)

The Managed Extensibility Framework (MEF) provides the following new features:
  • Support for generic types.
  • Convention-based programming model that enables you to create parts based on naming conventions rather than attributes.
  • Multiple scopes.

Asynchronous File Operations

In the .NET Framework 4.5 Developer Preview, new asynchronous features were added to the C# and Visual Basic languages. These features add a task-based model for performing asynchronous operations. To use this new model, use the asynchronous methods in the I/O classes.
Back to top


ASP.NET 4.5 Developer Preview includes the following new features:
  • Support for new HTML5 form types.
  • Support for model binders in Web Forms. These let you bind data controls directly to data-access methods, and automatically convert user input to and from .NET Framework data types.
  • Support for unobtrusive JavaScript in client-side validation scripts.
  • Improved handling of client script through bundling and minification for improved page performance.
  • Integrated encoding routines from the AntiXSS library (previously an external library) to protect from cross-site scripting attacks.
  • Support for WebSockets protocol.
  • Support for reading and writing HTTP requests and responses asynchronously.
  • Support for asynchronous modules and handlers.
  • Support for content distribution network (CDN) fallback in the ScriptManager control.


The .NET Framework 4.5 Developer Preview provides a new programming interface for HTTP applications. For more information, see the new System.Net.Http and System.Net.Http.Headers namespaces.
Also, the following networking improvements are included in the System.Net, System.Net.Mail, and related namespaces:
  • Improved internationalization and IPv6 support.
  • RFC-compliant URI support.
  • Support for Internationalized Domain Name (IDN) parsing.
  • Support for Email Address Internationalization (EAI).


In the .NET Framework 4.5 Developer Preview, Windows Presentation Foundation (WPF) contains changes and improvements in the following areas:
  • The new Ribbon control, which enables you to implement a ribbon user interface that hosts a Quick Access Toolbar, Application Menu, and tabs.
  • The new INotifyDataErrorInfo interface, which supports synchronous and asynchronous data validation.
  • New features for the VirtualizingPanel and Dispatcher classes.
  • Improved performance when displaying large sets of grouped data, and by accessing collections on non-UI threads.
  • Data binding to static properties, data binding to custom types that implement the ICustomTypeProvider interface, and retrieval of data binding information from a binding expression.
  • Repositioning of data as the values change (live shaping).
  • Better integration between WPF and Win32 user interface components.
  • Ability to check whether the data context for an item container is disconnected.
  • Ability to set the amount of time that should elapse between property changes and data source updates.
  • Improved support for implementing weak event patterns. Also, events can now accept markup extensions.


In the .NET Framework 4.5 Developer Preview, the following features have been added to make it simpler to write and maintain Windows Communication Foundation (WCF) applications:
  • Simplification of generated configuration files.
  • Support for contract-first development.
  • Ability to configure ASP.NET compatibility mode more easily.
  • Changes in default transport property values to reduce the likelihood that you will have to set them.
  • Updates to the XmlDictionaryReaderQuotas class to reduce the likelihood that you will have to manually configure quotas for XML dictionary readers.
  • Validation of WCF configuration files by Visual Studio as part of the build process, so you can detect configuration errors before you run your application.
  • New asynchronous streaming support.
  • New HTTPS protocol mapping to make it easier to expose an endpoint over HTTPS with Internet Information Services (IIS).
  • Ability to generate metadata in a single WSDL document by appending ?singleWSDL to the service URL.
  • Websockets support to enable true bidirectional communication over ports 80 and 443 with performance characteristics similar to the TCP transport.
  • Support for configuring services in code.
  • XML Editor tooltips.
  • ChannelFactory caching support.
  • Binary encoder compression support.


Several new features have been added to Windows Workflow Foundation (WF) in the .NET Framework 4.5 Developer Preview. These new features include:
  • Ability to create state machine workflows.
  • Enhanced Workflow Designer features such as the following:
    • Enhanced workflow search capabilities in Visual Studio, including Quick Find and Find in Files.
    • Ability to automatically create a Sequence activity when a second child activity is added to a container activity, and to include both activities in the Sequence activity.
    • Panning support, which enables the visible portion of a workflow to be changed without using the scroll bars.
    • A new Document Outline view that shows the components of a workflow in a tree-style outline view and lets you select a component in the Document Outline view.
    • Ability to add annotations to activities.
    • Ability to define and consume activity delegates by using the workflow designer.
    • Auto-connect and auto-insert for activities and transitions in state machine and flowchart workflows.
  • Storage of the view state information for a workflow in a single element in the XAML file, so you can easily locate and edit the view state information.
  • A NoPersistScope container activity to prevent child activities from persisting.
  • Support for C# expressions:
    • Workflow projects that use Visual Basic will use Visual Basic expressions, and C# workflow projects will use C# expressions.
    • C# workflow projects that were created in Visual Studio 2010 and that have Visual Basic expressions are compatible with C# workflow projects that use C# expressions.
    • /ul>
    • Versioning enhancements:
      • The new WorkflowIdentity class, which provides a mapping between a persisted workflow instance and its workflow definition.
      • Side-by-side execution of multiple workflow versions in the same host, including WorkflowServiceHost.
      • In Dynamic Update, the ability to modify the definition of a persisted workflow instance.
    • Contract-first workflow service development, which provides support for automatically generating activities to match an existing service contract.
    For more information, see What's New in Windows Workflow Foundation.

Monday, February 13, 2012

MVC interview questions

What are the 3 main components of an ASP.NET MVC application?
1. M - Model
2. V - View
3. C - Controller

In which assembly is the MVC framework defined?
System.Web.Mvc

Is it possible to combine ASP.NET webforms and ASP.MVC and develop a single web application?
Yes, it is possible to combine ASP.NET webforms and ASP.MVC and develop a single web application.

What does Model, View and Controller represent in an MVC application?
Model: Model represents the application data domain. In short the applications business logic is contained with in the model.

View: Views represent the user interface, with which the end users interact. In short the all the user interface logic is contained with in the UI.

Controller: Controller is the component that responds to user actions. Based on the user actions, the respective controller, work with the model, and selects a view to render that displays the user interface. The user input logic is contained with in the controller.

What is the greatest advantage of using asp.net mvc over asp.net webforms?
It is difficult to unit test UI with webforms, where views in mvc can be very easily unit tested.

Which approach provides better support for test driven development - ASP.NET MVC or ASP.NET Webforms?
ASP.NET MVC

What are the advantages of ASP.NET MVC?
1. Extensive support for TDD. With asp.net MVC, views can also be very easily unit tested.
2. Complex applications can be easily managed
3. Seperation of concerns. Different aspects of the application can be divided into Model, View and Controller.
4. ASP.NET MVC views are light weight, as they donot use viewstate.

Is it possible to unit test an MVC application without running the controllers in an ASP.NET process?
Yes, all the features in an asp.net MVC application are interface based and hence mocking is much easier. So, we don't have to run the controllers in an ASP.NET process for unit testing.

Is it possible to share a view across multiple controllers?
Yes, put the view into the shared folder. This will automatically make the view available across multiple controllers.

What is the role of a controller in an MVC application?
The controller responds to user interactions, with the application, by selecting the action method to execute and alse selecting the view to render.

Where are the routing rules defined in an asp.net MVC application?
In Application_Start event in Global.asax

Name a few different return types of a controller action method?
The following are just a few return types of a controller action method. In general an action method can return an instance of a any class that derives from ActionResult class.
1. ViewResult
2. JavaScriptResult
3. RedirectResult
4. ContentResult
5. JsonResult

What is the significance of NonActionAttribute?
In general, all public methods of a controller class are treated as action methods. If you want prevent this default behaviour, just decorate the public method with NonActionAttribute.

What is the significance of ASP.NET routing?
ASP.NET MVC uses ASP.NET routing, to map incoming browser requests to controller action methods. ASP.NET Routing makes use of route table. Route table is created when your web application first starts. The route table is present in the Global.asax file.

What are the 3 segments of the default route, that is present in an ASP.NET MVC application?
1st Segment - Controller Name
2nd Segment - Action Method Name
3rd Segment - Parameter that is passed to the action method

Example: http://pragimtech.com/Customer/Details/5
Controller Name = Customer
Action Method Name = Details
Parameter Id = 5

ASP.NET MVC application, makes use of settings at 2 places for routing to work correctly. What are these 2 places?
1. Web.Config File : ASP.NET routing has to be enabled here.
2. Global.asax File : The Route table is created in the application Start event handler, of the Global.asax file.

What is the adavantage of using ASP.NET routing?
In an ASP.NET web application that does not make use of routing, an incoming browser request should map to a physical file. If the file does not exist, we get page not found error.

An ASP.NET web application that does make use of routing, makes use of URLs that do not have to map to specific files in a Web site. Because the URL does not have to map to a file, you can use URLs that are descriptive of the user's action and therefore are more easily understood by users.

What are the 3 things that are needed to specify a route?
1. URL Pattern - You can include placeholders in a URL pattern so that variable data can be passed to the request handler without requiring a query string.
2. Handler - The handler can be a physical file such as an .aspx file or a controller class.
3. Name for the Route - Name is optional.

Is the following route definition a valid route definition?
{controller}{action}/{id}
No, the above definition is not a valid route definition, because there is no literal value or delimiter between the placeholders. Therefore, routing cannot determine where to separate the value for the controller placeholder from the value for the action placeholder.

What is the use of the following default route?
{resource}.axd/{*pathInfo}
This route definition, prevent requests for the Web resource files such as WebResource.axd or ScriptResource.axd from being passed to a controller.

What is the difference between adding routes, to a webforms application and to an mvc application?
To add routes to a webforms application, we use MapPageRoute() method of the RouteCollection class, where as to add routes to an MVC application we use MapRoute() method.

How do you handle variable number of segments in a route definition?
Use a route with a catch-all parameter. An example is shown below. * is referred to as catch-all parameter.
controller/{action}/{*parametervalues}

What are the 2 ways of adding constraints to a route?
1. Use regular expressions
2. Use an object that implements IRouteConstraint interface

Give 2 examples for scenarios when routing is not applied?
1. A Physical File is Found that Matches the URL Pattern - This default behaviour can be overriden by setting the RouteExistingFiles property of the RouteCollection object to true.
2. Routing Is Explicitly Disabled for a URL Pattern - Use the RouteCollection.Ignore() method to prevent routing from handling certain requests.

What is the use of action filters in an MVC application?
Action Filters allow us to add pre-action and post-action behavior to controller action methods.

If I have multiple filters impleted, what is the order in which these filters get executed?
1. Authorization filters
2. Action filters
3. Response filters
4. Exception filters

What are the different types of filters, in an asp.net mvc application?
1. Authorization filters
2. Action filters
3. Result filters
4. Exception filters

Give an example for Authorization filters in an asp.net mvc application?
1. RequireHttpsAttribute
2. AuthorizeAttribute

Which filter executes first in an asp.net mvc application?
Authorization filter


What are the levels at which filters can be applied in an asp.net mvc application?

1. Action Method
2. Controller
3. Application
[b]Is it possible to create a custom filter?[/b]
Yes

What filters are executed in the end?
Exception Filters

Is it possible to cancel filter execution?
Yes

What type of filter does OutputCacheAttribute class represents?
Result Filter

What are the 2 popular asp.net mvc view engines?
1. Razor
2. .aspx

What symbol would you use to denote, the start of a code block in razor views?
@

What symbol would you use to denote, the start of a code block in aspx views?
<%= %>

In razor syntax, what is the escape sequence character for @ symbol?
The escape sequence character for @ symbol, is another @ symbol

When using razor views, do you have to take any special steps to proctect your asp.net mvc application from cross site scripting (XSS) attacks?
No, by default content emitted using a @ block is automatically HTML encoded to protect from cross site scripting (XSS) attacks.

When using aspx view engine, to have a consistent look and feel, across all pages of the application, we can make use of asp.net master pages. What is asp.net master pages equivalent, when using razor views?
To have a consistent look and feel when using razor views, we can make use of layout pages. Layout pages, reside in the shared folder, and are named as _Layout.cshtml

What are sections?
Layout pages, can define sections, which can then be overriden by specific views making use of the layout. Defining and overriding sections is optional.

What are the file extensions for razor views?
1. .cshtml - If the programming lanugaue is C#
2. .vbhtml - If the programming lanugaue is VB

How do you specify comments using razor syntax?
Razor syntax makes use of @* to indicate the begining of a comment and *@ to indicate the end. An example is shown below.
@* This is a Comment *@

reference: http://www.dotnetobject.com/Thread-MVC-Interview-Questions-Answers

Friday, February 10, 2012

Stored procedure optimization tips

We will go over how to optimize Stored Procedure with making simple changes in the code. Please note there are many more other tips, which we will cover in future articles.

  • Include SET NOCOUNT ON statement: With every SELECT and DML statement, the SQL server returns a message that indicates the number of affected rows by that statement. This information is mostly helpful in debugging the code, but it is useless after that. By setting SET NOCOUNT ON, we can disable the feature of returning this extra information. For stored procedures that contain several statements or contain Transact-SQL loops, setting SET NOCOUNT to ON can provide a significant performance boost because network traffic is greatly reduced.
CREATE PROC dbo.ProcName
AS
SET
NOCOUNT ON;
--Procedure code here
SELECT column1 FROM dbo.TblTable1
-- Reset SET NOCOUNT to OFF
SET NOCOUNT OFF;
GO
  • Use schema name with object name: The object name is qualified if used with schema name. Schema name should be used with the stored procedure name and with all objects referenced inside the stored procedure. This help in directly finding the complied plan instead of searching the objects in other possible schema before finally deciding to use a cached plan, if available. This process of searching and deciding a schema for an object leads to COMPILE lock on stored procedure and decreases the stored procedure’s performance. Therefore, always refer the objects with qualified name in the stored procedure like
SELECT * FROM dbo.MyTable -- Preferred method
-- Instead of
SELECT * FROM MyTable -- Avoid this method
--And finally call the stored procedure with qualified name like:
EXEC dbo.MyProc -- Preferred method
--Instead of
EXEC MyProc -- Avoid this method
  • Do not use the prefix “sp_” in the stored procedure name: If a stored procedure name begins with “SP_,” then SQL server first searches in the master database and then in the current session database. Searching in the master database causes extra overhead and even a wrong result if another stored procedure with the same name is found in master database.
  • Use IF EXISTS (SELECT 1) instead of (SELECT *): To check the existence of a record in another table, we uses the IF EXISTS clause. The IF EXISTS clause returns True if any value is returned from an internal statement, either a single value “1” or all columns of a record or complete recordset. The output of the internal statement is not used. Hence, to minimize the data for processing and network transferring, we should use “1” in the SELECT clause of an internal statement, as shown below:
IF EXISTS (SELECT 1 FROM sysobjects
WHERE name = 'MyTable' AND type = 'U')
  • Use the sp_executesql stored procedure instead of the EXECUTE statement.
    The sp_executesql stored procedure supports parameters. So, using the sp_executesql stored procedure instead of the EXECUTE statement improve the re-usability of your code. The execution plan of a dynamic statement can be reused only if each and every character, including case, space, comments and parameter, is same for two statements. For example, if we execute the below batch:
DECLARE @Query VARCHAR(100)
DECLARE @Age INT
SET
@Age = 25
SET @Query = 'SELECT * FROM dbo.tblPerson WHERE Age = ' + CONVERT(VARCHAR(3),@Age)
EXEC (@Query)
If we again execute the above batch using different @Age value, then the execution plan for SELECT statement created for @Age =25 would not be reused. However, if we write the above batch as given below,
DECLARE @Query NVARCHAR(100)
SET @Query = N'SELECT * FROM dbo.tblPerson WHERE Age = @Age'
EXECUTE sp_executesql @Query, N'@Age int', @Age = 25
the compiled plan of this SELECT statement will be reused for different value of @Age parameter. The reuse of the existing complied plan will result in improved performance.
  • Try to avoid using SQL Server cursors whenever possible: Cursor uses a lot of resources for overhead processing to maintain current record position in a recordset and this decreases the performance. If we need to process records one-by-one in a loop, then we should use the WHILE clause. Wherever possible, we should replace the cursor-based approach with SET-based approach. Because the SQL Server engine is designed and optimized to perform SET-based operation very fast. Again, please note cursor is also a kind of WHILE Loop.
  • Keep the Transaction as short as possible: The length of transaction affects blocking and deadlocking. Exclusive lock is not released until the end of transaction. In higher isolation level, the shared locks are also aged with transaction. Therefore, lengthy transaction means locks for longer time and locks for longer time turns into blocking. In some cases, blocking also converts into deadlocks. So, for faster execution and less blocking, the transaction should be kept as short as possible.
  • Use TRY-Catch for error handling: Prior to SQL server 2005 version code for error handling, there was a big portion of actual code because an error check statement was written after every t-sql statement. More code always consumes more resources and time. In SQL Server 2005, a new simple way is introduced for the same purpose. The syntax is as follows:
BEGIN TRY
--Your t-sql code goes here
END TRY
BEGIN CATCH
--Your error handling code goes here
END CATCH