My Thoughts & Views

Archive for the ‘Programming’ Category

Interfaces
–contain only abstract methods
–interface can’t be inherited from a class
–using interfaces we can achieve multiple inheritance
–doesn’t allow accessibility modifiers (Public/Private/Internal)
–can’t contain fields, constructors
–is must implementable & its scope is upto any level of its inheritence chain.

Abstract Class
–contain both abstract methods as well as concrete methods
–can extend another class and implement multiple interfaces
–we can’t achieve multiple inheritance
–allows accessibility modifiers
–can contain fields, constructors
–class Abstract class is must inheritable & its scope is upto derived class

Most of the web developers will know about Fiddler.

Using Fiddler u can log the HTTP traffic between your application & Webservice, here Fiddler acts as a proxy in between your application & the Webservice.

To Use with ASP.NET set the following into your web.config, it will start logging all the HTTP Traffic.

<system.net>
<defaultProxy>
<proxy proxyaddress=”http://localhost:8888&#8243; />
</defaultProxy>
</system.net>

Advantages of Self-Hosting:

  • Is easy to use: With only a few lines of code you have your service running.
  • Is flexible: You can easily control the lifetime of your services through the Open() and Close() methods of ServiceHost.
  • Is easy to debug: Debugging WCF services that are hosted in a self-hosted environment provides a familiar way of debugging, without having to attach to separate applications that activate your service.
  • Is easy to deploy: In general, deploying simple Windows applications is as easy as xcopy. You don’t need any complex deployment scenarios on server farms, and the like, to deploy a simple Windows application that serves as a WCF ServiceHost.
  • Supports all bindings and transports: Self-hosting doesn’t limit you to out-of-the-box bindings and transports whatsoever. On Windows XP and Windows Server 2003, IIS limits you to HTTP only.

 

Disadvantages of Self-Hosting:

  • Limited availability: The service is reachable only when the application is running.
  • Limited features: Self-hosted applications have limited support for high availability, easy manageability, robustness, recoverability, versioning, and deployment scenarios. These scenarios have become a standard in last few years. Such features are provided by the WAS (Windows Activation Service) which is a part of IIS7 (delivered with Vista and Win2008). This hosting mechanism allows you to host the service by using of protocols like MSMQ, HTTP and TCP. 

The DateTime class is not very exact and only can measure in milliseconds. When doing performance measuring on an application you most certainly need to be able to measure with smaller time units than that. High-resolution timers are supported in the Win32 API so following code wraps it up in a simple class:

public class PerformanceTimer
{
[DllImport(“Kernel32.dll”)]
public static extern void QueryPerformanceCounter(ref long ticks);

long startTime = 0;
long stopTime = 0;

public void Start()
{
QueryPerformanceCounter(ref startTime);
}

public void Stop()
{
QueryPerformanceCounter(ref stopTime);
}

public long Time
{
get
{
return stopTime – startTime;
}
}
}

I’m sure the code is easy to understand. Here is the sample code to show how to use it.

PerformanceTimer perfoTimer = new PerformanceTimer();
perfTimer.Start();

// Do something

perfTimer.Stop();
System.Diagnostics.Trace.WriteLine(perfoTimer.Time);

Here is the commonly used Cryptographic Algorithms. Please follow the links to see the details of each Cryptographic Algorithms.

Block Ciphers

3-Way
Blowfish
CAST
CMEA
DES
Triple-DES
DEAL
FEAL
GOST
IDEA
LOKI
Lucifer
MacGuffin
MARS
MISTY
MMB
NewDES
RC2
RC5
RC6
REDOC
Rijndael
Safer
Serpent
SQUARE
Skipjack
Tiny Encryption Algorithm
Twofish

Stream Ciphers
ORYX
RC4
SEAL

Hash Algorithms
MD2
MD4
MD5
RIPEMD
SHA1
Snefru
Tiger

This is second in series of Interview Questions for .NET Application developer position.

C#

* Does C# supports multiple inheritence?
* What is a delegate?
* What are setallite assemblies?
* Differences between Namespace, Class, Assembly?
* What is the difference between managed and unmanaged code?
* What is serialization?
* What’s a bubbled event?
* What is garbage collection? How dot net handles the garbage collection?
* Can we force garbage collector to run ?
* What is concept of Boxing and Unboxing ? Do we have the same problem in c# 2.0? if no how it is resolved? What are generics?
* What happens in memory when you Box and Unbox a value-type?
* What are the ways to deploy an assembly?
* What is the difference between the value type and reference type? Do we have value type in dot net?
* What different types of JIT compliler do we have?
* What’s a multicast delegate?

C# 2.0

* What are the partial classes? Where we can use them?
* Any idea of LINQ project?
* What are generics?

C# Distributed Application

* What different option do we have for creating distributed applications in dot net?
* What is a thread? What is multithreading?
* What is deadlock? How we can elimate the risk?
* This data structure is “Thread Safe” what does that mean?
* What are locks and why we need them? When working with shared data in threading how do you implement synchronization ?
* What are sockets? What is the difference between TCP and UDP sockets?
* Any idea of Windows Communication Foundation?
* What is the difference between a thread and a process? Can a process have multiple threads?
* How we can communicate betweem two processes?
* What is the procedure of communicating between two threads?
* What’s Thread.Join() in threading ?
* What are the different states of a thread?