Wednesday, August 4, 2010

Team building games

1. fit for you card


- FFY
- its an employee feedback method
- what makes you satisfied work with your organization
- helps to improve relationships with your manager/peer/team lead

 2. cross LAVA river & stay safe


- rule1: work together
- rule2: use potoons(paper plates) to cross river.
- rule3: At any point of time human contact should be there on potoons
- rule4: potoons disappear without human contact, so work together
- Good luck and have fun!




potoons - call it as magic plates


3. Musical chair 

- strom came and took away


1. everyone whoz wearing company badge
2. everyone who is smart
3. everyone has black hair
4. everyone has black shoe


- If team size is 25, arrange 24 chairs, one person would be the instructor
- You should look for a chair in your right hand side,
- do not sit on the adjacent chair/same chair
- Enjoy!


Note: This is the best game can be played after a heavy lunch as this requires physical invlovement.



References:

Team Building Activities, Initiative Games, & Problem Solving Exercises:
http://wilderdom.com/games/InitiativeGames.html

Tuesday, May 18, 2010

ClickOnce

Advantage of using ClickOnce

1. windows installer deployment requires administrator privileges where is normal user can do installation using ClickOnce
2. ClickOnce allow to set automatic application updates
3. There will not be any version conflicts using ClickOnce



Requirement: Need to deploy a console based application to all the machines in the network. And whenever there is any functionality addition to application it should update in already installed the applications in the network.














Solution: Use ClickOnce feature provided by Microsoft along with visual studio 2005.

People were not preferred to develop any winforms/console applications before introduction of ClickOnce feature. This is because deployment & maintenance was an overhead.

ClickOnce helps you to deploy your WPF, winforms or console application in any machines in the network or any standalone machines. There are 3 ways in which we can achieve this.

  1. Publish using http
  2. Copy to shared folder in server.
  3. Write to CD/DVD
Here are the steps for Publish using http.

Make your changes in the application and set assembly version in assemblyInfo.cs file




You could also check assembly version at Project-Properties-Publish tab- Modify publish version



Use publish option under build menu for publishing the changes using http




 
Click on Next





Click on Finish, Brower opens up with the publish details. Choose Install button to install the software










Now big question: Say I am a user in the network and I have already installed the application. So whenever a new patch is updated or new functionality is added, I want those changes to reflect in my application automatically.


ClickOnce give an option to configure this. It is called as Update Strategy. This can be achieved in 3 ways:

  1. After starting up the application
  2. Before starting up the application
  3. making the updates required

I am going with before starting up the application. This option can be set using Project-Properties-Publish tab-Click on Update button.






Say I have updated my application or I did some code change, I am going to publish it in to the website





Repeat the publish steps.





You get the updates when you click on Ok



 
How it works: I guess it is based on publisher-Subscriber policy.

.net difference between throw and throw ex

  • stack information is truncated if we are using throw ex
  • where as stack information gets preserved in throw

throw ex - throw
throw  - rethrow


class Program
    {
        static void Main(string[] args)
        {
            A aa = new A();
            aa.Method1();
        
            Console.Read();
        }
    }

    class A
    {
        public void Method1()
        {
            try
            {
                B bb = new B();
                bb.Method2();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
        }
    }

    class B
    {
        public void Method2()
        {
            try
            {
                C cc = new C();
                cc.Method3();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }

    class C
    {
        public void Method3()
        {
            try
            {
                throw new InvalidOperationException();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            
        }
    }
 


throw
at CatchSample.C.Method3() in C:\temp\oops\oops\CatchSample\Program.cs:line 60
at CatchSample.B.Method2() in C:\temp\oops\oops\CatchSample\Program.cs:line 45
at CatchSample.A.Method1() in C:\temp\oops\oops\CatchSample\Program.cs:line 25

throw ex
at CatchSample.B.Method2() in C:\temp\oops\oops\CatchSample\Program.cs:line 45
at CatchSample.A.Method1() in C:\temp\oops\oops\CatchSample\Program.cs:line 25

NoteStackTrace information is lost in case of throw ex


Reference:

http://aspadvice.com/blogs/joteke/archive/2004/04/15/2277.aspx

http://geekswithblogs.net/sdorman/archive/2007/08/20/Difference-between-quotthrowquot-and-quotthrow-exquot-in-.NET.aspx

Monday, May 17, 2010

Accessing COM object from .net

  • .NET COM interop allows to use existing COM object in .net without modifying original component
  • First step is to import relevant COM types using COM interop utility.
  • Tlbimp.exe is the utility to import COM types to managed application.
  •  

Reference: http://msdn.microsoft.com/en-us/library/aa645736%28VS.71%29.aspx

Saturday, May 15, 2010

Difference between singleton and static classes

  • Singleton can be used with parameters to methods, but you cannot use static class as parameters.
  • Singleton can be used with interfaces
  • static class mainly use to hold gloabl data of application

Reference: http://dotnetperls.com/singleton-static

Saturday, May 1, 2010

Security in ASP.NET

Following are the steps in which security can be enforced in ASP.NET

  1. Authentication
  2. Authorization
  3. Privacy or Confidentiality
  4. Data integrity
  5. Non-Repudation

Authentication is the process of validating the user credentials.
Authorization is the process of checking the access of the authenticated user for a resource.
Privacy is the process of ensuring the passed message over wire is not dropped
Data integrity is the process of ensuring the data is not hampered or modified while passing through the wire.
Non-repudiation ensures that the author of the message/data cannot disavow responsibility.


Authorization is the process of checking access of an identity. .NET allows 2 ways to authorize access to the resource.

  1. FileAuthorization
  2. URLAuthorization
FileAuthorization check access in access control list (ACL) of the ASP.NET page for the identity. ACL will have the access details for the users, and authorization happens by looking at ACL.

URLAuthentication allow or deny access to user or role based on the entry in the configuration file. Authorization section in the configuration file allow to add access detail for the user.


  
  
  
  




Reference:

http://www.c-sharpcorner.com/UploadFile/gsparamasivam/CryptEncryption11282005061028AM/CryptEncryption.aspx

Wednesday, April 28, 2010

Caching in ASP.NET

If you want to improve performance of your ASP.NET application, then caching is the obvious choice.

Retrieving data/resources outside application takes more processing steps, more time and consumption of many resources in the server. ie, request will have to go to the server and server may have to contact a sql server for details.

consider if the data/resource readily available in the browser. This saves time, and eliminates many processing steps and result is high performance.

this technique of temporarily storing page output/ application data in client/server is called as caching

Caching can be implemented in 3 different ways:

  1. output caching
  2. fragment caching
  3. data caching

output caching - entire asp.net page can be cached. So that page don't have to re-create everytime and this results in fast loading of web page

fragment caching - part of asp.net page is cached and this part is loaded fast. @ OutputCache directive can be used for caching

data caching - caching application data improves the performance. Cache object allows to add any object to the cache. It is stored as key value pair.

Reference:

http://authors.aspalliance.com/aspxtreme/webapps/aspcachingfeatures.aspx