Monday, April 29, 2013

Published 12:33 AM by with 0 comment

Abstract

Abstract

The abstract modifier can be used with classes, methods, properties, indexers, and events.
Use the abstract modifier in a class declaration to indicate that a class is intended only to be a base class of other classes.
Abstract classes have the following features:
  • An abstract class cannot be instantiated.
  • An abstract class may contain abstract methods and accessors.
  • It is not possible to modify an abstract class with the sealed modifier, which means that the class cannot be inherited.
  • A non-abstract class derived from an abstract class must include actual implementations of all inherited abstract methods and accessors.
Use the abstract modifier in a method or property declaration to indicate that the method or property does not contain implementation.
Abstract methods have the following features:
  • An abstract method is implicitly a virtual method.
  • Abstract method declarations are only permitted in abstract classes.
  • Because an abstract method declaration provides no actual implementation, there is no method body; the method declaration simply ends with a semicolon and there are no braces ({ }) following the signature. For example:
·         The implementation is provided by an overriding method, which is a member of a non-abstract class.
  •  It is an error to use the static or virtual modifiers in an abstract method declaration.

public abstract void MyMethod();
An abstract class must provide implementation for all interface members.
An abstract class that implements an interface might map the interface methods onto abstract methods. For example:
interface I
{
    void M();
}
abstract class C : I
{
    public abstract void M();
}

Example

In this example, the class MyDerivedC is derived from an abstract class MyBaseC. The abstract class contains an abstract method, MyMethod(), and two abstract properties, GetX() and GetY().
// abstract_keyword.cs
// Abstract Classes
using System;
abstract class MyBaseC   // Abstract class
{
   protected int x = 100;
   protected int y = 150;
   public abstract void MyMethod();   // Abstract method

   public abstract int GetX   // Abstract property
   {
      get;
   }

   public abstract int GetY   // Abstract property
   {
      get;
   }
}

class MyDerivedC: MyBaseC
{
   public override void MyMethod()
   {
      x++;
      y++;  
   }  

   public override int GetX   // overriding property
   {
      get
      {
         return x+10;
      }
   }

   public override int GetY   // overriding property
   {
      get
      {
         return y+10;
      }
   }

   public static void Main()
   {
      MyDerivedC mC = new MyDerivedC();
      mC.MyMethod();
      Console.WriteLine("x = {0}, y = {1}", mC.GetX, mC.GetY);   
   }
}

Output

x = 111, y = 161

In the preceding example, if you attempt to instantiate the abstract class by using a statement like this:

MyBaseC mC1 = new MyBaseC();   // Error
 
you will get the following error message:

Cannot create an instance of the abstract class 'MyBaseC'.




Read More
    email this       edit

Sunday, April 28, 2013

Published 11:01 PM by with 0 comment

Singleton - [Creational Patterns]


Singleton Definition

Ensure a class has only one instance and provide a global point of access to it.

This structural code demonstrates the Singleton pattern which assures only a single instance (the singleton) of the class can be created.

namespace Singleton
{
    class Program
    {
        static void Main(string[] args)
        {
            Singleton s1 = Singleton.Instance();
            Singleton s2 = Singleton.Instance();
            if (s1 == s2)
            {
                Console.WriteLine("Indenticle Instances");
            }
            Console.ReadKey();
        }
    }
}

Singleton Class
namespace Singleton
{
    class Singleton
    {
        public static Singleton _instance;

        protected Singleton()
        {
        }

        public static Singleton Instance()
        {
            if (_instance == null)
            {
                _instance = new Singleton();
            }
            return _instance;
        }
    }
}

Read More
    email this       edit

Thursday, April 18, 2013

Published 2:46 AM by with 0 comment

Handler "PageHandlerFactory-Integrated" has a bad module "ManagedPipelineHandler" in its module list

Handler "PageHandlerFactory-Integrated" has a bad module "ManagedPipelineHandler" in its module list

To solve the issue try to repair the .net framework 4 and then run the command
%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i
Read More

    email this       edit

Tuesday, April 9, 2013

Published 12:09 AM by with 0 comment

How to edit email address for sharepoint 2010 user

A user's Email Address is stored within a profile property. By default a user isn't allowed to change his or her own e-mail address. The email address (Work e-mail) and whether or not user's can change their own can be specified in the settings of the User Profile Service Application.
  1. (As an administrator) open Central Admin
  2. Under "Application Management"  click "Manage Service Applications"
  3. Locate and click the link "User Profile Service Application". If this one is not there you haven't created a User Profile Service Application yet.
  4. Under "People"  there are two relevant links here. The first is "Manage User Properties", the second is "Manage User Profiles"
  5. Under "Manage User Properties" you can specify the settings for the Work e-mail property (i.e. whether or not the user is allowed to edit his or her own e-mail address).
  6. Under "Manage User Profiles" you can locate a user's profile and edit the e-mail address from there
By default it could take up to one hour to "see" the new e-mail address througout all web applications bound to the user profile service application. A timer job is taking care of this and you could kick this one of to run manually once by going to "Check Job Status" screen in Central Admin (_admin/Timer.aspx). Here locate the job definition with the title "User Profile Service Application - User Profile to SharePoint Full Synchronization", open the "Edit Timer Job Page" by clicking on the Job's name and then click the "Run Now" button.

1


2


3


4


5

Read More
    email this       edit

Friday, December 28, 2012

Published 8:37 AM by with 0 comment

JavaScript Try Catch

Try Catch (Exception)

try
{
}
 catch(err)
{
}
 finally
{
} 
QRCode









Try Catch (Exception)



Javascript Error Handling
Try Catch

Example

try
{
    //lines of codes
}
catch(err)
{
    //err.description
    //err.message
    //err.name
    //err.number
    //err.stack
}
finally
{
    //success or failure , code executes here
}

Throw


Example

function ThrowHelper()
{
    var err = new Error(123,"Error in helper");
    throw err;
}

//elsewhere in code
try
{
    ThrowHelper();
}
catch(ex)
{
    var msg = ex.number +" :"+ex.message;
    //log msg
}

-
Read More
    email this       edit
Published 7:02 AM by with 1 comment

JavaScript Array Functions

Javascript Array Functions (Array)


var fruit = ["apple","orange","banana"];
log(fruit.sort());//apple,banana,orange
fruit.push("pear");
log(fruit.sort());//apple,banana,orange,pear

var vegitables = ["carrot","broccoli","cauliflovd"];
var all = fruit.concat(vegitables);
log(all);//apple,orange,banana,carrot,broccoli,cauliflovd
 
QRCode

Javascript Array Functions (Array)


Javascript Array functions
push,pop,concat,map,filter,some,every,forEach,reduce,sort,splice,slice,join,reverse
Array is a Stack data sructure (first in first out)

Example

var fruit = ["apple","orange","banana"];
log(fruit.sort());//apple,banana,orange

fruit.push("pear");
log(fruit.sort());//apple,banana,orange,pear

var vegitables = ["carrot","broccoli","cauliflovd"];
var all = fruit.concat(vegitables);
log(all);//apple,orange,banana,carrot,broccoli,cauliflovd

var firt = fruit.slice(0,1);
log(first);//apple

var result = fruit.splice(1,2,"melon","grape");
log(result);//start in 1 no of 2 remove and add "melon","grape"
//out put is orange,banana
//splice is immutable function in javascript

fruit.splice(1,2,"melon","grape");
log(fruit);
//apple,melon,grape

fruit = fruit.map(function(i){return i.toUpperCase()});
log(fruit);
//APPLE,MELON,GRAPE

fruit = fruit.map(function(i){return {fruitname:i}});
log(fruit);
//[object Object],[object Object],[object Object]

fruit = fruit.filter(function(){
    return i[0]==="a";
});
log(fruit);
//apple

fruit = fruit.every(function(){
    return i[0]==="a";
});
log(fruit);
//false //if every items start with "a"


fruit = fruit.every(function(){
    return i.length>0;
});
log(fruit);
//true //if every items has more than 0 length

fruit = fruit.some(function(){
    return i.length>0;
});
log(fruit);
//true //if some items has more than 0 length

fruit.forEach(function(){
    log(i);
});
Read More
    email this       edit
Published 4:46 AM by with 0 comment

Javascript Function

Javascript Function

Javascript function definitions,
There are few different methods to define a function in javascript

Example
function Samsple1()
{
 log('Hello Aruna');
}...
 
QRCode




Javascript Function

 
Javascript function definitions
There are few different methods to define a function in javascript

Example

function Samsple1()
{
    log('Hello Aruna');
}


Example

var fun = function Samsple2()
{
    log('Hello Aruna');
};


Example

var ops = {
    Add:function AddNumbers(n1,n2)
    {
        return n1+n2;
    }
};

var x = ops.Add(3,5); //x =8
var y = ops.AddNumbers(3,5); //
not valid

Encapsulation-in-JavaScript

 

Example

var x = 2000;
var fun = function Encas()
{
    var y = 12;
    return y;
};

var total = x+y; //
Invalid use of y

var total = x+Encas()//total is 2012

Functions in Functions


Example

function OuterFunction(n)
{
    function InnerFunction()
    {
        return n*n;
    }
    return InnerFunction();
}
var x = OuterFunction(10);// x = 100
//InnerFunction can not call direcly

Immediate Functions


Example

(
function() {...}()
)
;

or

(
function() {...}
)
();

Module Pattern

  Extended immediate function

Example

var fun = (function(){
    var m=2000,c=0,d=10,y=2;
    return {
        GetHiddenYear:function()
        {
            return m+c+d+y;
        }
    }
}());

var x = fun.GetHiddenYear(); //x==2012;

Passing function as a parameter


Example

function Add(n1,n2)
{
    return n1+n2;
}

function calc(n1,n2,processForCalc)
{
    return processForCalc(n1,n2);
}

function executeMath()
{
    log(calc(4,4,Add));//output 8
}


 
Read More
    email this       edit
Published 3:13 AM by with 0 comment

-ms-grid-columns property (Internet Explorer)

-ms-grid-columns property (Internet Explorer)

Gets or sets one or more values that specify the width of each grid column within the object.

This property is read/write.
Syntax

-ms-grid-columns: [ auto | width | min-content | max-content | minmax(min, max) ] + | none
Property values

One or more column widths, separated by spaces...

QRCode





 

-ms-grid-columns property (Internet Explorer)

Gets or sets one or more values that specify the width of each grid column within the object.
This property is read/write.

Syntax

-ms-grid-columns: [ auto | width | min-content | max-content | minmax(min, max) ] + | none

Property values

One or more column widths, separated by spaces.
auto
The width of a column is computed based on the widest child element in that column. This keyword is equivalent to minmax(min-content, max-content).
width
The width of each column specified as one of the following values:
  • A length consisting of an integer number, followed by an absolute units designator ("cm", "mm", "in", "pt", or "pc") or a relative units designator ("em", "ex", or "px").
  • A percentage of the object width.
  • A proportion of the remaining horizontal space (that is, the object width, less the combined widths of other tracks), consisting of an integer number followed by a fractional designator ("fr"). For example, if "200px 1fr 2fr" is specified, the first column is allocated 200 pixels, and the second and third columns are allocated 1/3 and 2/3 of the remaining width, respectively.
min-content
The minimum width of any child elements is used as the width of the column.
max-content
The maximum width of any child elements is used as the width of the column.
minmax(min, max)
The width of the row is between min and max, as available space allows. The min and max parameters can be any other value of the -ms-grid-columns property, except for auto.
none
Initial value. The object has no specified columns. Implicit, auto-sized columns will still be created based on the grid position(s) of the child element(s).

CSS information

Applies Tonon-replaced block elements
Mediavisual paged
Inheritedno
Initial Valueauto

Standards information


Remarks

This property also supports a repeating syntax. If there are a large number of columns that are the same or exhibit a recurring pattern, a repeat syntax can be applied to define the columns in a more compact form. The repeated values are enclosed by parentheses, and are followed by an integer within brackets (for instance, [4]) that indicates how many times to repeat the values in parentheses. See Examples for a demonstration.
When space is allocated to a column, priority is given to those columns that have their width specified as a length or as a percentage. Any remaining space is then allocated to those columns that have their width specified as a proportion.
Each distance value defines a column that can be referred to by a number that corresponds to its position in the list. The first distance value specified defines a column 1, the second 2, and so on.
Child elements are clipped if they are too large to fit in the allocated space.

Examples

The following two examples illustrate the repeating -ms-grid-columns syntax. They are equivalent. There is a single row, and a pattern of four repeated columns: a 250px column followed by a 10px gutter.
<style type="text/css">
  #grid {
    display: -ms-grid;
    -ms-grid-columns: 10px 250px 10px 250px 10px 250px 10px 250px 10px;
    -ms-grid-rows: 1fr;
  } 

  /* Equivalent definition. */
  #grid {
    display: -ms-grid;
    -ms-grid-columns: 10px (250px 10px)[4];
    -ms-grid-rows: 1fr;
  }
</style>

Refferenced from http://msdn.microsoft.com »

Read More
    email this       edit