Tuesday, November 17, 2015

Underscore.js : JavaScript Library

Underscore.js


Introduction

Underscore is a JavaScript library which provides a whole useful library of helper functions without requiring extension of any built-in objects. Underscore provides well over 100 functions that support the common needs of a programmer in his/her daily programming life. This is a must have for all the web programmers who deal with JavaScript. 

Key helper functions

  • Collections (Helper functions for lists/collection objects)
    • each
    • map
    • reduce
    • reduceRight
    • find
    • filter
    • where
    • findWhere
    • reject
    • every
    • some
    • contains
    • invoke
    • pluck
    • max
    • min
    • sortBy
    • groupBy
    • indexBy
    • countBy
    • shuffle
    • sample
    • toArray
    • size
    • partition
  • Arrays (Helper functions for arrays)
    • first
    • initial
    • last
    • rest
    • compact
    • flatten
    • without
    • union
    • intersection
    • difference
    • uniq
    • zip
    • unzip
    • object
    • indexOf
    • lastIndexOf
    • sortedIndex
    • findIndex
    • findLastIndex
    • range
  • Functions (General helper functions)
    • bind
    • bindAll
    • partial
    • memoize
    • delay
    • defer
    • throttle
    • debounce
    • once
    • after
    • before
    • wrap
    • negate
    • compose
  • Objects (Helper functions that can be applied to objects)
    • keys
    • allKeys
    • values
    • mapObject
    • pairs
    • invert
    • create
    • functions
    • findKey
    • extend
    • extendOwn
    • pick
    • omit
    • defaults
    • clone
    • tap
    • has
    • matcher
    • property
    • propertyOf
    • isEqual
    • isMatch
    • isEmpty
    • isElement
    • isArray
    • isObject
    • isArguments
    • isFunction
    • isString
    • isNumber
    • isFinite
    • isBoolean
    • isDate
    • isRegExp
    • isNaN
    • isNull
    • isUndefined
  • Utility
    • noConflict
    • identity
    • constant
    • noop
    • times
    • random
    • mixin
    • iteratee
    • uniqueId
    • escape
    • unescape
    • result
    • now
    • template
  • Chaining
    • chain
    • value

Conclusion


By using Underscore.js, a web developer could save a lot of time. Using these helper functions in the team or in the company enhances code re-usability and code readability. To get to know more about each helper functions in detail, go to http://underscorejs.org/ 





Wednesday, November 4, 2015

Should I use user schema seperation in SQL Server

User Schema

Introduction

Prior to SQL Server 2005, a database object  is owned by a user. That user could be DBO or any valid user account. That table is now directly linked to that user– the user cannot be deleted without removing the table or changing the owner of the table. The table can only ever be owned by one user. User-schema separation, introduced in SQL Server 2005, means that the table is no longer owned by any user; it belongs to a schema. In turn, the schema is owned by a user.

A schema is separate entity within the database. It is created by using the CREATE SCHEMA statement. A schema can be owned by a user, a role, or a group. A user executing CREATE SCHEMA can be the owner of the schema or it can allocate another user as the schema owner with appropriate IMPERSONATE permissions. A schema only has one owner, but a user can own many schema. Schema ownership is transferable.

Pros

  1. Schema allows much more control of access, and levels of access for the administrator
  2. Ownership of schema and the database objects within them is transferable
  3. Objects can be moved between schema
  4. Multiple database users can share a single schema
  5. A database user can be dropped without dropping objects in a corresponding schema
  6. Schema logically separates objects in a database. 
Cons
  1. If not used wisely, (considering dependencies and commonality of objects), user schema can be quiet confusing.
  2. Schema organization must be considered during the design phase to avoid problems with the code. Changing schema design late in the fame could cause many changes in the code.
  3. For Programmers who use C# code, although, in most of the cases, user schema works like Namespaces in C#, note that the notations like HR.People schema will be converted to HR_People class in C#.