Monday, March 31, 2008

Try, Catch (and Finally)

The purpose of the try, catch, and finally blocks is to trap unexpected exceptions. A common usage is to obtain and use resources in a try block, trap exceptional circumstances in a catch block, and release the resources in the finally block. With a combination of input validation controls and keeping expected errors in mind while coding, the use of try-catch-finally can minimize the possibility of an ASP.NET application crashing.

 
Try Clause
  • The try block encloses the code being executed.
  • The exceptions may be thrown on completion of this block.
  • There is only one Try block per try-catch-finally combination.

 
Catch Clause
  • The catch blocks are optional.
  • Thess blocks catches the exceptions.
  • The catch blocks are executed only if exceptions occur.
  • The catch blocks may be defined without arguments though not recommended.
  • It is suggested to have the object argument derived from System.Exception
  • There may be more than one specific catch clause in the same try-catch statement.

 
Finally Clause
  • The finally block is optional.
  • When used, finally block is executed without fail.

Tuesday, February 5, 2008

Site Collection versus Site

There are ocassions when you ask yourself if it makes sense to create a new site collection or a new site. The question may look simple to many but a bad decision may have serious consequences. Many organisations keep only one site collection and add a lot of sites to it leaving no room for scaling. Site collections have several advantages such as distributed administration. Dave Wollerman wrote an excellent article explaining the advantages of having multiple site collections.
Site Collection Logical Architecture

Thursday, October 4, 2007

Input Validation in ASP.NET

Input validation is very important for web application because an open input field can lead to successful hack attempts, system crashes, malicious data manipulation, data corruption, and notorious Denial of Service (DoS) situation. ASP.NET has five built-in validator controls to make life easier. A validator is a control that checks one input control for a specific type of error condition and displays a description of that problem. These controls improve performance besides simplifying validations.
  • RequiredFieldValidation
  • CompareValidator
  • RangeValidator
  • RegularExpressionValidator
  • CustomValidator

Monday, October 1, 2007

What is HL7?

  • Full form of HL7: Health Level Seven
  • Accredited standards to share clinical and administrative data
  • Promoted by Health Level Seven Inc. (USA) Ann Arbor, MI (USA)
  • Freely available without licenses or license fees 
  • Copyrighted for accuracy and integrity
  • HL7 message format: human readable ASCII
  • HL7 message  -> consists of segments
  • Over 120 different segment types are available
  • Segments are separated by line feeds (\r or 0x0D)
  • A segment begins with a three letter name such as MSH
  • Segment examples: MSH (Message Header), PID (Patient Info)
  • Segment -> consists composites (or fields)
  • Composites are separated by | characters (or \F\)
  • Composites may contain other composites (sub-composites or sub-fields)
  • Sub-fields are separated by ^ characters (or \S\)
  • Sub-composites may contain other composites (sub-sub-composites or sub-sub-fields)
  • Sub-sub-fields are separated by & characters (or \T\)
  • HL7 website: http://www.hl7.org/
  • HL7 on Wikipedia: http://en.wikipedia.org/wiki/HL7
  • HL7 glossary of terms: http://www.hl7.org/ehr/documents/public/documents/Glossary%20of%20terms.pdf