Archive for December 2010

Regular Expression Web/Desktop tool for newbies!

December 31, 2010

An intuitive tool for learning, writing, and testing Regular Expressions.  Helped me great in learning RegExp! 🙂

Web version:

http://www.gskinner.com/RegExr/

Key features include:
* real time results: shows results as you type

* code hinting: roll over your expression to see info on specific elements

* detailed results: roll over a match to see details & view group info below

* built in regex guide: double click entries to insert them into your expression

* online & desktop: regexr.com or download the desktop version for Mac, Windows, or Linux

* save your expressions: My Saved expressions are saved locally

* search Community expressions and add your own

Desktop version:

http://gskinner.com/RegExr/desktop/

Online JSON and YAML Parser

December 31, 2010

Fantastic online tools, you can try and learn. Dirt your hands right away! 🙂

1. Online JSON Parser

http://json.parser.online.fr/

Allows you to paste in a JSON string and have it validated. It will immediately allow you to see pesky subtle errors in your JSON syntax. Just edit your JSON string right there in the box and it will auto update the preview below live so you can immediately see the effects your changes have on the outcome.

2. Online YAML Parser

YAML: YAML Ain’t Markup Language (http://yaml.org/)
What It Is: YAML is a human friendly data serialization  standard for all programming languages

http://yaml-online-parser.appspot.com/ (YAML to JSON/Python/Canonical YAML)

Hope you would enjoy great! 🙂

Javascript: Unobtrusive, Closure and “this” keyword

December 30, 2010

I found the below urls in understanding better about Unobtrusive, Closure and “this” keyword. Hope it would help you too! 🙂 Enjoy reading…!

What is an Unobtrusive?
• http://www.456bereastreet.com/archive/200711/the_rules_of_unobtrusive_javascript/
• http://icant.co.uk/articles/seven-rules-of-unobtrusive-javascript/

What is Closure?
• http://www.crockford.com/javascript/private.html
• http://blog.morrisjohns.com/javascript_closures_for_dummies.html

Scope of “this” keyword:
http://seanmonstar.com/post/707068021/4-ways-functions-mess-with-this

Useful VS.NET extensions & other tools

December 15, 2010

Below are some extensions & tools i use in my development. Hope this would help great!

VS.NET Extensions:

  • StyleCopFixer – Fixes (not 100%) some of SyleCop’s suggestions as Re-Sharper does
  • Vingy – Searches content for the selected word in net from the popular websites
  • PrettyJs – formatting Js
  • JavaScript parser – VS.NETs navigate to View=>Other windows=>JavaScript parser
  • Spellchecker
  • ADO.NET C# POCO Entity Generator
  • Productivity Power Tool
  • Entity Visualizer

Tools

  • AnkhSVN – Version control tool can integrated with VS.NET
  • AnjLab.com – SQL profiler
  • SQL Enlight – Both in SSMS and VS.NET (Shareware)

ASP.NET Custom Validator Client side & Server Side validation not firing!

December 14, 2010

Your CustomValidator will only fire when the TextBox isn’t empty.

If the input control is empty, no validation functions are called and validation succeeds. Use a RequiredFieldValidator control to require the user to enter data in the input control.

A thread from Stackoverflow:

http://stackoverflow.com/questions/701029/asp-net-custom-validator-client-side-server-side-validation-not-firing

Telerik RadGrid Export to excel cell/column formating

December 10, 2010

In one of my development with Telerik RadGrid, i experienced the following 2 issues:

1). The file you are trying to open, ‘Filename.xls’, is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening this file. Do you want to open the file now?

2). Format (Number)  column values/ styling cell or row

Find below the Url from Telerik, you can get some more number of tips over there:

http://www.telerik.com/help/aspnet-ajax/grid-html-export.html

Announcing Silverlight 5

December 5, 2010

Check it out ScottGu’s blog!

http://weblogs.asp.net/scottgu/archive/2010/12/02/announcing-silverlight-5.aspx

Some interesting questions and thoughts about Future of Silverlight 5 and HTML 5 – what now?

Here you go….http://www.uxpassion.com/2010/10/future-of-silverlight-5-and-html-5/

SQL Enlight – Analyze and validate T-SQL

December 4, 2010

SQL Enlight is a tool for SQL Server that can automate and facilitate the T-SQL code and database schema analysis. The tool works in a way similar to the .NET focused tools like FxCop and StyleCop. It provides design-time code, database schema and query plan analysis

Just check out the below Url

http://www.sqlservercurry.com/2010/10/analyze-and-validate-t-sql-code-using.html

ASP.NET MVC – Exception Handling – Un Handled exception

December 4, 2010

In one of our new development, client team decided to start with ASP.NET MVC. As I knew only the plain MVC, I started exploring ASP.NET MVC little better. Over there, I tend to check about exception handling.  And found great about the in-built error handling using attribute [HandleError] at Class (Controller) level or Methods (Action) level.

1). In-Built way:

  1. MVC’s In-built attribute [HandleError] at Class(Controller) level or Methodd (Action) level
  2. We need <customErrors mode=”On” /> in web.config, so that by default, webserver will take us to view “/Shared/Eorror.aspx”
  3. Easily configurable
  4. No need of try…catch
  5. No logging is here

One quick reference:

http://weblogs.asp.net/scottgu/archive/2008/07/14/asp-net-mvc-preview-4-release-part-1.aspx

2). With Logging:

  1. We can create a custom attribute like [LogError] by inheriting and implementing ActionFilterAttribute, IActionFilter respectively
  2. We can decorate with both the attributes [HandleError] and [LogError]
  3. Can be logged in any of the stores like TXT/Xml/SQLServer or etc. We have to have our own classes to do this

One quick reference: http://www.singingeels.com/Articles/Logging_with_ASPNET_MVC_Action_Filters.aspx

In the continuation, I came across one open source project called ELMAH. It’s really awesome!

3). Open Source – ELMAH (Error Logging Modules and Handlers) way:

  1. Provides the capability logging in several available persistence stores like SQLServer, Xml , Memory and etc
  2. Provides a page handler (Ex: elmah.axd)  to view the all errors in HTML form
  3. No need to add any attributes to Controller or Method.  Having a ControllerFactory, we can inject them through Application_Start() from Global.asax.cs
  4. No [HandleError] attribute, ELMAH takes care

The things need to do are:

  • Need to add ELMAH.DLL
  • Add some configuration stuffs in Web.config
  • One dummy ActionResult to redirect to Error page, which can be configured in

Urls for quick reference:

  1. http://www.hanselman.com/blog/ELMAHErrorLoggingModulesAndHandlersForASPNETAndMVCToo.aspx
  2. http://dotnetdarren.wordpress.com/2010/07/27/logging-on-mvc-part-1/ – Download the sample here
  3. http://dotnetslackers.com/articles/aspnet/ErrorLoggingModulesAndHandlers.aspx
  4. http://www.codecapers.com/post/Error-Handling-in-MVC-with-ELMAH.aspx#tb

Here are the benefits I see are:

  1. No need of try…catch block, throwing and re-throwing
  2. Provides different stores
  3. Page to view all the errors (Report) and export into different form
  4. Notification by email can be configured and too many