Posts

Repository Pattern

Repository   commonly refers to a storage location, often for safety or preservation. Objectives of using repository Use the Repository pattern to achieve one or more of the following objectives: You want to maximize the amount of code that can be tested with automation and to isolate the data layer to support unit testing. You access the data source from many locations and want to apply centrally managed, consistent access rules and logic. You want to implement and centralize a caching strategy for the data source. You want to improve the code's maintainability and readability by separating business logic from data or service access logic. You want to use business entities that are strongly typed so that you can identify problems at compile time instead of at run time. You want to associate a behavior with the related data. For example, you want to calculate fields or enforce complex relationships or business rules

Show active file in solution explorer VS 2010/ VS 2012

Visual Studio has a setting that does this automatically. Tools – Options – Projects and Solutions – Track Active Item in Solution Explorer Just select it and you’re all set!

UML Part I

UML Intro UML stands for Unified Modeling Language. UML is a graphical language for visualizing, specifying, constructing & documenting the artifacts of a software system. It is a standard language for designing and documenting a system in an object oriented manner. UML provides blue print for Business process, System functioning, programming language statements, Database schema & reusable components. UML is used in all phases of software development from Requirement Specification to Acceptance Test and from Designing a solution to Deploying/ Packaging. Modeling has been around for years not only in software field but also in other fields like Civil, Mechanical, etc. we get a model ready & approved before starting the production. Modeling makes complex system to break up into simple and discrete pieces that be individually understood. If we ask ourselves have we been doing/ following modeling, most of us would say NO. But all of us do mode

Section 508 guidelines

Section 508 Guidelines (a) A text equivalent for every non-text element shall be provided (e.g., via "alt", "longdesc", or in element content). If we properly separate our three layers, we remove most of the situations in which we would have to provide text equivalents. Markup should only include img tags when the image is actually part of the content of the page (i.e. Flickr or Boston.com's The Big Picture ). The lesson: Logos, navigation, buttons and other content elements are not proper uses of img tags. When non-text content is necessary, use title and alt attributes. (b) Equivalent alternatives for any multimedia presentation shall be synchronized with the presentation. That fancy Java slideshow applet that adds ripple effects to the slides probably isn't necessary. Simplify your life and make basic HTML pages styled with CSS instead. The lesson: If you do need multimedia capabilities, use technologies that have acce

15 Steps for Web Accessibility

  Steps to make your website accessible   1. Make sure all images, graphs, and other non-text items have a text equivalent. 2.  Provide synchronized captions for all video, as well as captions or a transcript of audio content. 3.  Do not use color as the only way to convey information. 4.  You can use style sheets for layout, but the page must still make sense without them. 5.  When using images as links, for example a drop down menu, make sure each link (as well as the overall image) has alt text describing the destination.  Avoid using server-side image maps.  If you do use server-side image maps, be sure to provide separate identical text links to access the same content. 6.  Label column and row headers in a data table.  Try to avoid using tables for layout purposes, but if you do then do not label headers. 7.  Make sure all cells in the table are associated with the appropriate headers. When the table is set-up correctly, screen readers can navigate through data t

Safe SQL Literals

Handle SQL injection Manage the input data from UI  to be safe  for SQL execution has been problem in many sites which has caused lot of damage to different sites called as SQL injection. Hackers are always there looking into your website to find loop holes. Still people don't take care to handle these small issues which cause financial loss, as well as companies loose their clients. I am laying out a sample code which would help you to handle inputs for SQL injection. There are different samples available and the below is the one which I see to be most safest. public string SafeSqlLiteral(string strValue)     {         strValue = strValue.Replace("'", "''"); // Most important one! This line alone can prevent most injection attacks         strValue = strValue.Replace("--", "").Replace("[", "[[]").Replace("%", "[%]").Replace(" OR ", "").Replace(" or

Encrypting & Decrypting web.config

Encrypting & Decrypting  web.config We can encrypt each section of the web.config using the encryption provided by aspnet_regiis.exe. <!-- Encrypt Connection String --> C:\WebPortal>aspnet_regiis.exe -pef connectionStrings c:\WebPortal-prov "RsaProtectedConfigurationProvider" Encrypting configuration section... Succeeded! Here the -pe switch specifies the configuration section "connectionStrings" to encrypt. C:\WebPortal>aspnet_regiis.exe -pdf connectionStrings c:\WebPortal Decrypting configuration section... Succeeded! Here the -pef switch specifies the configuration section to encrypt and allows you to supply the physical directory path for your configuration file. <!-- Encrypt AppSettings --> C:\WebPortal>aspnet_regiis.exe -pef appSettings c:\WebPortal-prov "RsaProtectedConfigurationProvider" Encrypting configuration section... Succeeded! Here the -prov switch specifies the provider name. C:\WebPor