Wednesday, March 14, 2007

MIME Extension for IIS 4.0 and 5.0

Extension
Type/sub-type
IIS 4.0
IIS 5.0
*
application/octet-stream
Yes
Yes
323
text/h323
No
Yes
acx
application/internet-property-stream
No
Yes
ai
application/postscript
Yes
Yes
aif
audio/x-aiff
Yes
Yes
aifc
audio/x-aiff
Yes
Yes
aiff
audio/x-aiff
Yes
Yes
asf
video/x-ms-asf
No
Yes
asr
video/x-ms-asf
No
Yes
asx
video/x-ms-asf
No
Yes
au
audio/basic
Yes
Yes
avi
video/x-msvideo
Yes
Yes
axs
application/olescript
No
Yes
bas
text/plain
Yes
Yes
bcpio
application/x-bcpio
Yes
Yes
bin
application/octet-stream
Yes
Yes
bmp
image/bmp
Yes
Yes
c
text/plain
Yes
Yes
cat
application/vnd.ms-pkiseccat
No
Yes
cdf
application/x-cdf
No
Yes
cer
application/x-x509-ca-cert
No
Yes
class
application/octet-stream
Yes
Yes
clp
application/x-msclip
Yes
Yes
cmx
image/x-cmx
Yes
Yes
cod
image/cis-cod
Yes
Yes
cpio
application/x-cpio
Yes
Yes
crd
application/x-mscardfile
Yes
Yes
crl
application/pkix-crl
No
Yes
crt
application/x-x509-ca-cert
No
Yes
csh
application/x-csh
Yes
Yes
css
text/css
No
Yes
dcr
application/x-director
Yes
Yes
der
application/x-x509-ca-cert
No
Yes
dir
application/x-director
Yes
Yes
dll
application/x-msdownload
No
Yes
dms
application/octet-stream
Yes
Yes
doc
application/msword
Yes
Yes
dot
application/msword
Yes
Yes
dvi
application/x-dvi
Yes
Yes
dxr
application/x-director
Yes
Yes
eps
application/postscript
Yes
Yes
etx
text/x-setext
Yes
Yes
evy
application/envoy
Yes
Yes
exe
application/octet-stream
Yes
Yes
fif
application/fractals
No
Yes
flr
x-world/x-vrml
Yes
Yes
gif
image/gif
Yes
Yes
gtar
application/x-gtar
Yes
Yes
gz
application/x-gzip
No
Yes
h
text/plain
Yes
Yes
hdf
application/x-hdf
Yes
Yes
hlp
application/winhlp
Yes
Yes
hqx
application/mac-binhex40
Yes
Yes
hta
application/hta
No
Yes
htc
text/x-component
No
Yes
htm
text/html
Yes
Yes
html
text/html
Yes
Yes
htt
text/webviewhtml
No
Yes
ico
image/x-icon
No
Yes
ief
image/ief
Yes
Yes
iii
application/x-iphone
No
Yes
ins
application/x-internet-signup
No
Yes
isp
application/x-internet-signup
No
Yes
jfif
image/pipeg
No
Yes
jpe
image/jpeg
Yes
Yes
jpeg
image/jpeg
Yes
Yes
jpg
image/jpeg
Yes
Yes
js
application/x-javascript
Yes
Yes
latex
application/x-latex
Yes
Yes
lha
application/octet-stream
Yes
Yes
lsf
video/x-la-asf
No
Yes
lsx
video/x-la-asf
No
Yes
lzh
application/octet-stream
Yes
Yes
m13
application/x-msmediaview
Yes
Yes
m14
application/x-msmediaview
Yes
Yes
m3u
audio/x-mpegurl
No
Yes
man
application/x-troff-man
Yes
Yes
mdb
application/x-msaccess
Yes
Yes
me
application/x-troff-me
Yes
Yes
mht
message/rfc822
No
Yes
mhtml
message/rfc822
No
Yes
mid
audio/mid
No
Yes
mny
application/x-msmoney
Yes
Yes
mov
video/quicktime
Yes
Yes
movie
video/x-sgi-movie
Yes
Yes
mp2
video/mpeg
Yes
Yes
mp3
audio/mpeg
No
Yes
mpa
video/mpeg
Yes
Yes
mpe
video/mpeg
Yes
Yes
mpeg
video/mpeg
Yes
Yes
mpg
video/mpeg
Yes
Yes
mpp
application/vnd.ms-project
Yes
Yes
mpv2
video/mpeg
Yes
Yes
ms
application/x-troff-ms
Yes
Yes
mvb
application/x-msmediaview
Yes
Yes
nws
message/rfc822
No
Yes
oda
application/oda
Yes
Yes
p10
application/pkcs10
No
Yes
p12
application/x-pkcs12
No
Yes
p7b
application/x-pkcs7-certificates
No
Yes
p7c
application/x-pkcs7-mime
No
Yes
p7m
application/x-pkcs7-mime
No
Yes
p7r
application/x-pkcs7-certreqresp
No
Yes
p7s
application/x-pkcs7-signature
No
Yes
pbm
image/x-portable-bitmap
Yes
Yes
pdf
application/pdf
Yes
Yes
pfx
application/x-pkcs12
No
Yes
pgm
image/x-portable-graymap
Yes
Yes
pko
application/ynd.ms-pkipko
No
Yes
pma
application/x-perfmon
Yes
Yes
pmc
application/x-perfmon
Yes
Yes
pml
application/x-perfmon
Yes
Yes
pmr
application/x-perfmon
Yes
Yes
pmw
application/x-perfmon
Yes
Yes
pnm
image/x-portable-anymap
Yes
Yes
pot,
application/vnd.ms-powerpoint
Yes
Yes
ppm
image/x-portable-pixmap
Yes
Yes
pps
application/vnd.ms-powerpoint
Yes
Yes
ppt
application/vnd.ms-powerpoint
Yes
Yes
prf
application/pics-rules
No
Yes
ps
application/postscript
Yes
Yes
pub
application/x-mspublisher
Yes
Yes
qt
video/quicktime
Yes
Yes
ra
audio/x-pn-realaudio
Yes
Yes
ram
audio/x-pn-realaudio
Yes
Yes
ras
image/x-cmu-raster
Yes
Yes
rgb
image/x-rgb
Yes
Yes
rmi
audio/mid
No
Yes
roff
application/x-troff
Yes
Yes
rtf
application/rtf
Yes
Yes
rtx
text/richtext
Yes
Yes
scd
application/x-msschedule
Yes
Yes
sct
text/scriptlet
No
Yes
setpay
application/set-payment-initiation
No
Yes
setreg
application/set-registration-initiation
No
Yes
sh
application/x-sh
Yes
Yes
shar
application/x-shar
Yes
Yes
sit
application/x-stuffit
No
Yes
snd
audio/basic
Yes
Yes
spc
application/x-pkcs7-certificates
No
Yes
spl
application/futuresplash
No
Yes
src
application/x-wais-source
Yes
Yes
sst
application/vnd.ms-pkicertstore
No
Yes
stl
application/vnd.ms-pkistl
No
Yes
stm
text/html
Yes
Yes
sv4cpio
application/x-sv4cpio
Yes
Yes
sv4crc
application/x-sv4crc
Yes
Yes
t
application/x-troff
Yes
Yes
tar
application/x-tar
Yes
Yes
tcl
application/x-tcl
Yes
Yes
tex
application/x-tex
Yes
Yes
texi
application/x-texinfo
Yes
Yes
texinfo
application/x-texinfo
Yes
Yes
tgz
application/x-compressed
No
Yes
tif
image/tiff
Yes
Yes
tiff
image/tiff
Yes
Yes
tr
application/x-troff
Yes
Yes
trm
application/x-msterminal
Yes
Yes
tsv
text/tab-separated-values
Yes
Yes
txt
text/plain
Yes
Yes
uls
text/iuls
No
Yes
ustar
application/x-ustar
Yes
Yes
vcf
text/x-vcard
No
Yes
vrml
x-world/x-vrml
Yes
Yes
wav
audio/x-wav
Yes
Yes
wcm
application/vnd.ms-works
Yes
Yes
wdb
application/vnd.ms-works
Yes
Yes
wks
application/vnd.ms-works
Yes
Yes
wmf
application/x-msmetafile
Yes
Yes
wps
application/vnd.ms-works
Yes
Yes
wri
application/x-mswrite
Yes
Yes
wrl
x-world/x-vrml
Yes
Yes
wrz
x-world/x-vrml
Yes
Yes
xaf
x-world/x-vrml
Yes
Yes
xbm
image/x-xbitmap
Yes
Yes
xla
application/vnd.ms-excel
Yes
Yes
xlc
application/vnd.ms-excel
Yes
Yes
xlm
application/vnd.ms-excel
Yes
Yes
xls
application/vnd.ms-excel
Yes
Yes
xlt
application/vnd.ms-excel
Yes
Yes
xlw
application/vnd.ms-excel
Yes
Yes
xof
x-world/x-vrml
Yes
Yes
xpm
image/x-xpixmap
Yes
Yes
xwd
image/x-xwindowdump
Yes
Yes
z
application/x-compress
No
Yes
zip
application/zip
Yes
Yes
 


Samiyappan Prabakar ,Mobile : +971 50 9042741
 
 


8:00? 8:25? 8:40? Find a flick in no time
with theYahoo! Search movie showtime shortcut.

Tuesday, March 13, 2007

When was .NET announced?
Bill Gates delivered a keynote at Forum 2000, held June 22, 2000, outlining the .NET 'vision'. The July 2000 PDC had a number of sessions on .NET technology, and delegates were given CDs containing a pre-release version of the .NET framework/SDK and Visual Studio.NET.

When was the first version of .NET released?

The final version of the 1.0 SDK and runtime was made publicly available around 6pm PST on 15-Jan-2002. At the same time, the final version of Visual Studio.NET was made available to MSDN subscribers.

What platforms does the .NET Framework run on?

The runtime supports Windows XP, Windows 2000, NT4 SP6a and Windows ME/98. Windows 95 is not supported. Some parts of the framework do not work on all platforms - for example, ASP.NET is only supported on Windows XP and Windows 2000. Windows 98/ME cannot be used for development.IIS is not supported on Windows XP Home Edition, and so cannot be used to host ASP.NET. However, the ASP.NET Web Matrix web server does run on XP Home.The Mono project is attempting to implement the .NET framework on Linux.

What is the CLR?

CLR = Common Language Runtime. The CLR is a set of standard resources that (in theory) any .NET program can take advantage of, regardless of programming language. Robert Schmidt (Microsoft) lists the following CLR resources in his MSDN PDC# article:Object-oriented programming model (inheritance, polymorphism, exception handling, garbage collection) Security model Type system All .NET base classes Many .NET framework classes Development, debugging, and profiling tools Execution and code management IL-to-native translators and optimizers What this means is that in the .NET world, different programming languages will be more equal in capability than they have ever been before, although clearly not all languages will support all CLR services.

What is the CTS?

CTS = Common Type System. This is the range of types that the .NET runtime understands, and therefore that .NET applications can use. However note that not all .NET languages will support all the types in the CTS. The CTS is a superset of the CLS.

What is the CLS?

CLS = Common Language Specification. This is a subset of the CTS which all .NET languages are expected to support. The idea is that any program which uses CLS-compliant types can interoperate with any .NET program written in any language.In theory this allows very tight interop between different .NET languages - for example allowing a C# class to inherit from a VB class.

What is IL?

IL = Intermediate Language. Also known as MSIL (Microsoft Intermediate Language) or CIL (Common Intermediate Language). All .NET source code (of any language) is compiled to IL. The IL is then converted to machine code at the point where the software is installed, or at run-time by a Just-In-Time (JIT) compiler.

What does 'managed' mean in the .NET context?

The term 'managed' is the cause of much confusion. It is used in various places within .NET, meaning slightly different things.Managed code: The .NET framework provides several core run-time services to the programs that run within it - for example exception handling and security. For these services to work, the code must provide a minimum level of information to the runtime.
Such code is called managed code. All C# and Visual Basic.NET code is managed by default. VS7 C++ code is not managed by default, but the compiler can produce managed code by specifying a command-line switch (/com+).Managed data: This is data that is allocated and de-allocated by the .NET runtime's garbage collector. C# and VB.NET data is always managed. VS7 C++ data is unmanaged by default, even when using the /com+ switch, but it can be marked as managed using the __gc keyword.Managed classes: This is usually referred to in the context of Managed Extensions (ME) for C++. When using ME C++, a class can be marked with the __gc keyword. As the name suggests, this means that the memory for instances of the class is managed by the garbage collector, but it also means more than that. The class becomes a fully paid-up member of the .NET community with the benefits and restrictions that brings. An example of a benefit is proper interop with classes written in other languages - for example, a managed C++ class can inherit from a VB class. An example of a restriction is that a managed class can only inherit from one base class.

What is reflection?

All .NET compilers produce metadata about the types defined in the modules they produce. This metadata is packaged along with the module (modules in turn are packaged together in assemblies), and can be accessed by a mechanism called reflection. The System.Reflection namespace contains classes that can be used to interrogate the types for a module/assembly. Using reflection to access .NET metadata is very similar to using ITypeLib/ITypeInfo to access type library data in COM, and it is used for similar purposes - e.g. determining data type sizes for marshaling data across context/process/machine boundaries.Reflection can also be used to dynamically invoke methods (see System.Type.InvokeMember ) , or even create types dynamically at run-time (see System.Reflection.Emit.TypeBuilder).

What is the difference between Finalize and Dispose (Garbage collection) ?
Class instances often encapsulate control over resources that are not managed by the runtime, such as window handles (HWND), database connections, and so on. Therefore, you should provide both an explicit and an implicit way to free those resources. Provide implicit control by implementing the protected Finalize Method on an object (destructor syntax in C# and the Managed Extensions for C++). The garbage collector calls this method at some point after there are no longer any valid references to the object. In some cases, you might want to provide programmers using an object with the ability to explicitly release these external resources before the garbage collector frees the object. If an external resource is scarce or expensive, better performance can be achieved if the programmer explicitly releases resources when they are no longer being used. To provide explicit control, implement the Dispose method provided by the IDisposable Interface. The consumer of the object should call this method when it is done using the object.
Dispose can be called even if other references to the object are alive. Note that even when you provide explicit control by way of Dispose, you should provide implicit cleanup using the Finalize method. Finalize provides a backup to prevent resources from
permanently leaking if the programmer fails to call Dispose.

What is Partial Assembly References?
Full Assembly reference: A full assembly reference includes the assembly's text name, version, culture, and public key token (if the assembly has a strong name). A full assembly reference is required if you reference any assembly that is part of the common
language runtime or any assembly located in the global assembly cache.

Partial Assembly reference: We can dynamically reference an assembly by providing only partial information, such as specifying only the assembly name. When you specify a partial assembly reference, the runtime looks for the assembly only in the application
directory.We can make partial references to an assembly in your code one of the following ways:-> Use a method such as System.Reflection.Assembly.Load and specify only a partial reference. The runtime checks for the assembly in the application directory.-> Use the System.Reflection.Assembly.LoadWithPartialName method and specify only a partial reference. The runtime checks for the assembly in the application directory and in the global assembly cache

Changes to which portion of version number indicates an incompatible change?

Major or minor. Changes to the major or minor portion of the version number indicate an incompatible change. Under this convention then, version 2.0.0.0 would be considered incompatible with version 1.0.0.0. Examples of an incompatible change would be a change to the types of some method parameters or the removal of a type or method altogether. Build. The Build number is typically used to distinguish between daily builds or smaller compatible releases. Revision. Changes to the revision number are typically reserved for an incremental build needed to fix a particular bug. You'll sometimes hear this referred to as the "emergency bug fix" number in that the revision is what is often changed when a fix to a specific bug is shipped to a customer.


What is side-by-side execution?

Can two application one using private assembly and other using Shared assembly be stated as a side-by-side executables?Side-by-side execution is the ability to run multiple versions of an application or component on the same computer. You can have multiple versions of the common language runtime, and multiple versions of applications and components that use a version of the runtime, on the same computer at the same time. Since versioning is only applied to shared assemblies, and not to private assemblies, two application one using private assembly and one using shared assembly cannot be stated as side-by-side
executables.

Why string are called Immutable data Type?

The memory representation of string is an Array of Characters, So on re-assigning the new array of Char is formed & the start address is changed. Thus keeping the Old string in Memory for Garbage Collector to be disposed.

What does assert() method do?

In debug compilation, assert takes in a Boolean condition as a parameter, and shows the error dialog if the condition is false. The program proceeds without any interruption if the condition is true.

What's the difference between the Debug class and Trace class?

Documentation looks the same. Use Debug class for debug builds, use Trace class for both debug and release builds.

Why are there five tracing levels in System.Diagnostics.TraceSwitcher?

The tracing dumps can be quite verbose. For applications that are constantly running you run the risk of overloading the machine and the hard drive. Five levels range from None to Verbose, allowing you to fine-tune the tracing activities.

Where is the output of TextWriterTraceListener redirected?

To the Console or a text file depending on the parameter passed to the constructor.

How do assemblies find each other?

By searching directory paths. There are several factors which can affect the path (such as the AppDomain host, and application configuration files), but for private assemblies the search path is normally the application's directory and its sub-directories. For shared assemblies, the search path is normally same as the private assembly path plus the shared assembly cache.

How does assembly versioning work?

Each assembly has a version number called the compatibility version. Also each reference to an assembly (from another assembly) includes both the name and version of the referenced assembly.The version number has four numeric parts (e.g. 5.5.2.33). Assemblies with either of the first two parts different are normally viewed as incompatible. If the first two parts are the same, but the third is different, the assemblies are deemed as 'maybe compatible'. If only the fourth part is different, the assemblies are deemed compatible. However, this is just the default guideline - it is the version policy that decides to what extent these rules are enforced. The version policy can be specified via the application configuration file.

What is garbage collection?

Garbage collection is a system whereby a run-time component takes responsibility for managing the lifetime of objects and the heap memory that they occupy. This concept is not new to .NET - Java and many other languages/runtimes have used garbage collection for some time.

Why doesn't the .NET runtime offer deterministic destruction?

Because of the garbage collection algorithm. The .NET garbage collector works by periodically running through a list of all the objects that are currently being referenced by an application. All the objects that it doesn't find during this search are ready to be destroyed and the memory reclaimed. The implication of this algorithm is that the runtime doesn't get notified immediately when the final reference on an object goes away - it only finds out during the next sweep of the heap.Futhermore, this type of algorithm works best by performing the garbage collection sweep as rarely as possible. Normally heap exhaustion is the trigger for a collection sweep.

Is the lack of deterministic destruction in .NET a problem?

It's certainly an issue that affects component design. If you have objects that maintain expensive or scarce resources (e.g. database locks), you need to provide some way for the client to tell the object to release the resource when it is done. Microsoft recommend that you provide a method called Dispose() for this purpose. However, this causes problems for distributed objects - in a distributed system who calls the Dispose() method? Some form of reference-counting or ownership-management mechanism is needed to handle distributed objects - unfortunately the runtime offers no help with this.

What is serialization?

Serialization is the process of converting an object into a stream of bytes. Deserialization is the opposite process of creating an object from a stream of bytes. Serialization / Deserialization is mostly used to transport objects (e.g. during remoting), or to persist
objects (e.g. to a file or database).

Does the .NET Framework have in-built support for serialization?

There are two separate mechanisms provided by the .NET class library - XmlSerializer and SoapFormatter/BinaryFormatter. Microsoft uses XmlSerializer for Web Services, and uses SoapFormatter/BinaryFormatter for remoting. Both are available for use in your own code.

Can I customise the serialization process?

Yes. XmlSerializer supports a range of attributes that can be used to configure serialization for a particular class. For example, a field or property can be marked with the [XmlIgnore] attribute to exclude it from serialization. Another example is the [XmlElement]
attribute, which can be used to specify the XML element name to be used for a particular property or field.Serialization via SoapFormatter/BinaryFormatter can also be controlled to some extent by attributes. For example, the [NonSerialized] attribute is the equivalent of XmlSerializer's [XmlIgnore] attribute. Ultimate control of the serialization process can be acheived by implementing the the ISerializable interface on the class whose instances are to be serialized.

Why is XmlSerializer so slow?

There is a once-per-process-per-type overhead with XmlSerializer. So the first time you serialize or deserialize an object of a given type in an application, there is a significant delay. This normally doesn't matter, but it may mean, for example, that XmlSerializer is a poor choice for loading configuration settings during startup of a GUI application.

Why do I get errors when I try to serialize a Hashtable?

XmlSerializer will refuse to serialize instances of any class that implements IDictionary, e.g. Hashtable. SoapFormatter and BinaryFormatter do not have this restriction.

What are attributes?

There are at least two types of .NET attribute. The first type I will refer to as a metadata attribute - it allows some data to be attached to a class or method. This data becomes part of the metadata for the class, and (like other class metadata) can be accessed via reflection. The other type of attribute is a context attribute. Context attributes use a similar syntax to metadata attributes but they are fundamentally different. Context attributes provide an interception mechanism whereby instance activation and method calls can be
pre- and/or post-processed.

How does CAS work?

The CAS security policy revolves around two key concepts - code groups and permissions. Each .NET assembly is a member of a particular code group, and each code group is granted the permissions specified in a named permission set.For example, using the default security policy, a control downloaded from a web site belongs to the 'Zone - Internet' code group, which adheres to the permissions defined by the 'Internet' named permission set. (Naturally the 'Internet' named permission set represents a very restrictive range of permissions.)

Who defines the CAS code groups?

Microsoft defines some default ones, but you can modify these and even create your own. To see the code groups defined on your system, run 'caspol -lg' from the command-line. On my system it looks like this:Level = Machine
Code Groups:
1. All code: Nothing

1.1. Zone - MyComputer: FullTrust
1.1.1. Honor SkipVerification requests: SkipVerification
1.2. Zone - Intranet: LocalIntranet
1.3. Zone - Internet: Internet
1.4. Zone - Untrusted: Nothing
1.5. Zone - Trusted: Internet
1.6. StrongName - Note the hierarchy of code groups - the top of the hierarchy is the most general ('All code'), which is then sub-divided into several groups, each of which in turn can be sub-divided. Also note that (somewhat counter-intuitively) a sub-group can be associated with a more permissive permission set than its parent.

How do I define my own code group?

Use caspol. For example, suppose you trust code from www.mydomain.com and you want it have full access to your system, but you want to keep the default restrictions for all other internet sites. To achieve this, you would add a new code group as a sub-group of the
'Zone - Internet' group, like this: caspol -ag 1.3 -site
www.mydomain.com FullTrust Now if you run caspol -lg you will see that the new group has been added as group 1.3.1:

1.3. Zone - Internet: Internet


Note that the numeric label (1.3.1) is just a caspol invention to make the code groups easy to manipulate from the command-line. The underlying runtime never sees it.

How do I change the permission set for a code group?

Use caspol. If you are the machine administrator, you can operate at the 'machine' level - which means not only that the changes you make become the default for the machine, but also that users cannot change the permissions to be more permissive. If you are a normal (non-admin) user you can still modify the permissions, but only to make them more restrictive. For example, to allow intranet code to do what it likes you might do this: caspol -cg 1.2 FullTrustNote that because this is more permissive than the default policy (on a standard system), you should only do this at the machine level - doing it at the user level will have no effect.

I can't be bothered with all this CAS stuff. Can I turn it off?

Yes, as long as you are an administrator. Just run: caspol -s off

Can I look at the IL for an assembly?

Yes. MS supply a tool called Ildasm which can be used to view the metadata and IL for an assembly.

Can source code be reverse-engineered from IL?

Yes, it is often relatively straightforward to regenerate high-level source (e.g. C#) from IL.

How can I stop my code being reverse-engineered from IL?

There is currently no simple way to stop code being reverse-engineered from IL. In future it is likely that IL obfuscation tools will become available, either from MS or from third parties. These tools work by 'optimising' the IL in such a way that reverse-engineering becomes much more difficult.Of course if you are writing web services then reverse-engineering is not a problem as clients do not have access to your IL.

Is there built-in support for tracing/logging?

Yes, in the System.Diagnostics namespace. There are two main classes that deal with tracing - Debug and Trace. They both work in a similar way - the difference is that tracing from the Debug class only works in builds that have the DEBUG symbol defined, whereas tracing from the Trace class only works in builds that have the TRACE symbol defined. Typically this means that you should use System.Diagnostics.Trace.WriteLine for tracing that you want to work in debug and release builds, and System.Diagnostics.Debug.WriteLine for tracing that you want to work only in debug builds.

Can I redirect tracing to a file?

Yes. The Debug and Trace classes both have a Listeners property, which is a collection of sinks that receive the tracing that you send via Debug.WriteLine and Trace.WriteLine respectively. By default the Listeners collection contains a single sink, which is an instance of the DefaultTraceListener class. This sends output to the Win32 OutputDebugString() function and also the System.Diagnostics.Debugger.Log() method. This is useful when debugging, but if you're trying to trace a problem at a customer site, redirecting the output to a file is more appropriate. Fortunately, the TextWriterTraceListener class is provided for this purpose.

What are the contents of assembly?

In general, a static assembly can consist of four elements: The assembly manifest, which contains assembly metadata. Type metadata. Microsoft intermediate language (MSIL) code that implements the types. A set of resources.

What is GC (Garbage Collection) and how it worksOne of the good features of the CLR is Garbage Collection, which runs in the background collecting unused object references, freeing us from having to ensure we always destroy them. In reality the time difference between you releasing the object instance and it being garbage collected is likely to be very small, since the GC is always running.
[The process of transitively tracing through all pointers to actively used objects in order to locate all objects that can be referenced, and then arranging to reuse any heap memory that was not found during this trace. The common language runtime garbage collector also compacts the memory that is in use to reduce the working space needed for the heap.]

Heap:
A portion of memory reserved for a program to use for the temporary storage of data structures whose existence or size cannot be determined until the program is running.

Differnce between Managed code and unmanaged code ?
Managed Code:
Code that runs under a "contract of cooperation" with the common language runtime. Managed code must supply the metadata necessary for the runtime to provide services such as memory management, cross-language integration, code access security, and
automatic lifetime control of objects. All code based on Microsoft intermediate language (MSIL) executes as managed code.

Un-Managed Code:
Code that is created without regard for the conventions and requirements of the common language runtime. Unmanaged code executes in the common language runtime environment with minimal services (for example, no garbage collection, limited debugging, and so on).

What is MSIL, IL, CTS and, CLR ?

MSIL: (Microsoft intermediate language)When compiling to managed code, the compiler translates your source code into Microsoft intermediate language (MSIL), which is a CPU-independent set of instructions that can be efficiently converted to native code. MSIL includes instructions for loading, storing, initializing, and calling methods on objects, as well as instructions for arithmetic and logical operations, control flow, direct memory access, exception handling, and other operations. Before code can be executed, MSIL must be converted to CPU-specific code, usually by a just-in-time (JIT) compiler. Because the common language runtime supplies one or more JIT compilers for each computer architecture it supports, the same set of MSIL can be JIT-compiled and executed on any supported architecture.When a compiler produces MSIL, it also produces metadata. Metadata describes the types in your code, including the definition of each type, the signatures of each type's members, the members that your code references, and other data that the runtime uses at
execution time. The MSIL and metadata are contained in a portable executable (PE) file that is based on and extends the published Microsoft PE and Common Object File Format (COFF) used historically for executable content. This file format, which accommodates

MSIL or native code as well as metadata, enables the operating system to recognize common language runtime images. The presence of metadata in the file along with the MSIL enables your code to describe itself, which means that there is no need for type libraries or Interface Definition Language (IDL). The runtime locates and extracts the metadata from the file as needed during
execution.


IL: (Intermediate Language)A language used as the output of a number of compilers and as the input to a just-in-time (JIT) compiler. The common language runtime includes a JIT compiler for converting MSIL to native code.

CTS: (Common Type System)The specification that determines how the common language runtime defines, uses, and manages types

CLR: (Common Language Runtime)The engine at the core of managed code execution. The runtime supplies managed code with services such as cross-language
integration, code access security, object lifetime management, and debugging and profiling support.

What is Reference type and value type ?
Reference Type:Reference types are allocated on the managed CLR heap, just like object types.A data type that is stored as a reference to the value's location. The value of a reference type is the location of the sequence of bits that represent the type's data. Reference types can be self-describing types, pointer types, or interface types

Value Type:Value types are allocated on the stack just like primitive types in VBScript, VB6 and C/C++. Value types are not instantiated using new go out of scope when the function they are defined within returns.Value types in the CLR are defined as types that derive from system.valueType.

A data type that fully describes a value by specifying the sequence of bits that constitutes the value's representation. Type information for a value type instance is not stored with the instance at run time, but it is available in metadata. Value type instances can be treated as objects using boxing.

What is Boxing and unboxing ?
Boxing:The conversion of a value type instance to an object, which implies that the instance will carry full type information at run time and will be allocated in the heap. The Microsoft intermediate language (MSIL) instruction set's box instruction converts a value type to an object by making a copy of the value type and embedding it in a newly allocated object.

Un-Boxing:The conversion of an object instance to a value type.

What is JIT and how is works ?
An acronym for "just-in-time," a phrase that describes an action that is taken only when it becomes necessary, such as just-in-time compilation or just-in-time object activation

What is portable executable (PE) ?
The file format used for executable programs and for files to be linked together to form executable programs

What is strong name?
A name that consists of an assembly's identity—its simple text name, version number, and culture information (if provided)—strengthened by a public key and a digital signature generated over the assembly. Because the assembly manifest contains file hashes for all the files that constitute the assembly implementation, it is sufficient to generate the digital signature over just the one file in the assembly that contains the assembly manifest. Assemblies with the same strong name are expected to be identical

What is global assembly cache?
A machine-wide code cache that stores assemblies specifically installed to be shared by many applications on the computer. Applications deployed in the global assembly cache must have a strong name.

What is difference between constants, readonly and, static ?
Constants: The value can’t be changed
Read-only: The value will be initialized only once from the constructor of the class.Static: Value can be initialized once.

What is difference between shared and public?
An assembly that can be referenced by more than one application. An assembly must be explicitly built to be shared by giving it a cryptographically strong name.

What is namespace used for loading assemblies at run time and name the methods?
System.Reflection

What are the types of authentication in .net?
We have three types of authentication: 1. Form authentication 2. Windows authentication3. PassportThis has to be declared in web.config file.

What is the difference between a Struct and a Class ?
The struct type is suitable for representing lightweight objects such as Point, Rectangle, and Color. Although it is possible to represent a point as a class, a struct is more efficient in some scenarios. For example, if you declare an array of 1000 Point objects,you will allocate additional memory for referencing each object. In this case, the struct is less expensive.When you create a struct object using the new operator, it gets created and the appropriate constructor is called. Unlike classes, structs can be instantiated without using the new operator. If you do not use new, the fields will remain unassigned and the object cannot be used until all of the fields are initialized. It is an error to declare a default (parameterless) constructor for a struct. A default constructor is always provided to initialize the struct members to their default values.It is an error to initialize an instance field in a struct.There is no inheritance for structs as there is for classes. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Structs, however, inherit from the base class Object. A struct can implement interfaces, and it does that exactly as classes do.A struct is a value type, while a class is a reference type.

How big is the datatype int in .NET?
32 bits.

How big is the char?
16 bits (Unicode).

How do you initiate a string without escaping each backslash?
Put an @ sign in front of the double-quoted string.

What's the access level of the visibility type internal?
Current application.

Explain encapsulation ?
The implementation is hidden, the interface is exposed.

What data type should you use if you want an 8-bit value that's signed?
sbyte.



Monday, March 12, 2007

1 What distributed process frameworks outside .NET do you know?
Distributed Computing Environment/Remote Procedure Calls (DEC/RPC), Microsoft Distributed Component Object Model (DCOM), Common Object Request Broker Architecture (CORBA), and Java Remote Method Invocation (RMI).

2 .What are possible implementations of distributed applications in .NET?
.NET Remoting and ASP.NET Web Services. If we talk about the Framework Class Library, noteworthy classes are in System.Runtime.Remoting and System.Web.Services.

3 When would you use .NET Remoting and when Web services?
Use remoting for more efficient exchange of information when you control both ends of the application. Use Web services for open-protocol-based information exchange when you are just a client or a server with the other end belonging to someone else.

4 What's a proxy of the server object in .NET Remoting?
It's a fake copy of the server object that resides on the client side and behaves as if it was the server. It handles the communication between real server object and the client object. This process is also known as marshaling.

5 What are remotable objects in .NET Remoting?
Remotable objects are the objects that can be marshaled across the application domains. You can marshal by value, where a deep copy of the object is created and then passed to the receiver. You can also marshal by reference, where just a reference to an existing object is passed.

6 What are channels in .NET Remoting?
Channels represent the objects that transfer the other serialized objects from one application domain to another and from one computer to another, as well as one process to another on the same box. A channel must exist before an object can be transferred.

7 What security measures exist for .NET Remoting in System.Runtime.Remoting?
None. Security should be taken care of at the application level. Cryptography and other security techniques can be applied at application or server level.

8 What is a formatter?
A formatter is an object that is responsible for encoding and serializing data into messages on one end, and deserializing and decoding messages into data on the other end.

9 Choosing between HTTP and TCP for protocols and Binary and SOAP for formatters, what are the trade-offs?
Binary over TCP is the most effiecient, SOAP over HTTP is the most interoperable.

10 What's SingleCall activation mode used for?
If the server object is instantiated for responding to just one single request, the request should be made in SingleCall mode.

11 What's Singleton activation mode?
A single object is instantiated regardless of the number of clients accessing it. Lifetime of this object is determined by lifetime lease.

12 How do you define the lease of the object?
By implementing ILease interface when writing the class code.

13 Can you configure a .NET Remoting object via XML file?
Yes, via machine.config and application level .config file (or web.config in ASP.NET). Application-level XML settings take precedence over machine.config.

14 How can you automatically generate interface for the remotable object in .NET with Microsoft tools?
Use the Soapsuds tool.

15 What are CAO's i.e. Client Activated Objects ?

Client-activated objects are objects whose lifetimes are controlled by the calling application domain, just as they would be if the object were local to the client. With client activation, a round trip to the server occurs when the client tries to create an instance of the server object, and the client proxy is created using an object reference (ObjRef) obtained on return from the creation of the remote object on the server. Each time a client creates an instance of a client-activated type, that instance will service only that particular reference in that particular client until its lease expires and its memory is recycled. If a calling application domain creates two new instances of the remote type, each of the client references will invoke only the particular instance in the server application domain from which the reference was returned.
In COM, clients hold an object in memory by holding a reference to it. When the last client releases its last reference, the object can delete itself. Client activation provides the same client control over the server object's lifetime, but without the complexity of maintaining references or the constant pinging to confirm the continued existence of the server or client. Instead, client-activated objects use lifetime leases to determine how long they should continue to exist. When a client creates a remote object, it can specify a default length of time that the object should exist. If the remote object reaches its default lifetime limit, it contacts the client to ask whether it should continue to exist, and if so, for how much longer. If the client is not currently available, a default time is also specified for how long the server object should wait while trying to contact the client before marking itself for garbage collection. The client might even request an indefinite default lifetime, effectively preventing the remote object from ever being recycled until the server application domain is torn down. The difference between this and a server-activated indefinite lifetime is that an indefinite server-activated object will serve all client requests for that type, whereas the client-activated instances serve only the client and the reference that was responsible for their creation. For more information, see Lifetime Leases.
To create an instance of a client-activated type, clients either configure their application programmatically (or using a configuration file) and call new (New in Visual Basic), or they pass the remote object's configuration in a call to Activator.CreateInstance. The following code example shows such a call, assuming a TcpChannel has been registered to listen on port 8080.

16 How many processes can listen on a single TCP/IP port?

One.

17 What technology enables out-of-proc communication in .NET?

Most usually Remoting;.NET remoting enables client applications to use objects in other processes on the same computer or on any other computer available on its network.While you could implement an out-of-proc component in any number of other ways, someone using the term almost always means Remoting.

18 How can objects in two diff. App Doimains communicate with each other?.

Net framework provides various ways to communicate with objects in different app domains.First is XML Web Service on internet, its good method because it is built using HTTP protocol and SOAP formatting. If the performance is the main concern then go for second option which is .Net remoting because it gives you the option of using binary encoding and the default TcpChannel, which offers the best interprocess communication performance

19 What is the difference between .Net Remoting and Web Services?
Although we can develop an application using both technologies, each of them has its distinct advantages. Yes you can look at them in terms of performance but you need to consider your need first. There are many other factors such authentications, authorizing in process that need to be considered.
1 What are different transaction options available for services components ?
There are 5 transactions types that can be used with COM+. Whenever an object is registered with COM+ it has to abide either to these 5 transaction types.
Disabled: - There is no transaction. COM+ does not provide transaction support for this component.
Not Supported: - Component does not support transactions. Hence even if the calling component in the hierarchy is transaction enabled this component will not participate in the transaction.
Supported: - Components with transaction type supported will be a part of the transaction if the calling component has an active transaction.If the calling component is not transaction enabled this component will not start a new transaction.
Required: - Components with this attribute require a transaction i.e. either the calling should have a transaction in place else this component will start a new transaction.
Required New: - Components enabled with this transaction type always require a new transaction. Components with required new transaction type instantiate a new transaction for themselves every time.


2 Can we use com Components in .net?.How ?.can we use .net components in vb?.Explain how ?
COM components have different internal architecture from .NET components hence they are not innately compatible. However .NET framework supports invocation of unmanaged code from managed code (and vice-versa) through COM/.NET interoperability. .NET application communicates with a COM component through a managed wrapper of the component called Runtime Callable Wrapper (RCW); it acts as managed proxy to the unmanaged COM component. When a method call is made to COM object, it goes onto RCW and not the object itself. RCW manages the lifetime management of the COM component. Implementation Steps -
Create Runtime Callable Wrapper out of COM component. Reference the metadata assembly Dll in the project and use its methods & properties RCW can be created using Type Library Importer utility or through VS.NET. Using VS.NET, add reference through COM tab to select the desired DLL. VS.NET automatically generates metadata assembly putting the classes provided by that component into a namespace with the same name as COM dll (XYZRCW.dll)
.NET components can be invoked by unmanaged code through COM Callable Wrapper (CCW) in COM/.NET interop. The unmanaged code will talk to this proxy, which translates call to managed environment. We can use COM components in .NET through COM/.NET interoperability. When managed code calls an unmanaged component, behind the scene, .NET creates proxy called COM Callable wrapper (CCW), which accepts commands from a COM client, and forwards it to .NET component. There are two prerequisites to creating .NET component, to be used in unmanaged code:

1. .NET class should be implement its functionality through interface. First define interface in code, then have the class to imlpement it. This way, it prevents breaking of COM client, if/when .NET component changes.
2.Secondly, .NET class, which is to be visible to COM clients must be declared public. The tools that create the CCW only define types basedon public classes. The same rule applies to methods, properties, and events that will be used by COM clients.
Implementation
Steps -

1. Generate type library of .NET component, using TLBExporter utility. A type library is the COM equivalent of the metadata contained withina .NET assembly. Type libraries are generally contained in files with the extension .tlb. A type library contains the necessary information to allow a COM client to determine which classes are located in a particular server, as well as the methods, properties, and events supported by those classes.
2. Secondly, use Assembly Registration tool (regasm) to create the type library and register it.
3. Lastly install .NET assembly in GAC, so it is available as shared assembly.

3 What is Runtime Callable wrapper?.when it will created?.
The common language runtime exposes COM objects through a proxy called the runtime callable wrapper (RCW). Although the RCW appears to be an ordinary object to .NET clients, its primary function is to marshal calls between a .NET client and a COM object. This wrapper turns the COM interfaces exposed by the COM component into .NET-compatible interfaces. For oleautomation (attribute indicates that an interface is compatible with Automation) interfaces, the RCW can be generated automatically from a type library. For non-oleautomation interfaces, it may be necessary to develop a custom RCW which manually maps the types exposed by the COM interface to .NET-compatible types.

4 What is Com Callable wrapper?when it will created?
.NET components are accessed from COM via a COM Callable Wrapper (CCW). This is similar to a RCW, but works in the opposite direction. Again, if the wrapper cannot be automatically generated by the .NET development tools, or if the automatic behaviour is not desirable, a custom CCW can be developed. Also, for COM to 'see' the .NET component, the .NET component must be registered in the registry.CCWs also manage the object identity and object lifetime of the managed objects they wrap.

5 What is a primary interop ?
A primary interop assembly is a collection of types that are deployed, versioned, and configured as a single unit. However, unlike other managed assemblies, an interop assembly contains type definitions (not implementation) of types that have already been defined in COM. These type definitions allow managed applications to bind to the COM types at compile time and provide information to the common language runtimeabout how the types should be marshaled at run time.

6 What are tlbimp and tlbexp tools used for ?
The Type Library Exporter generates a type library that describes the types defined in a common language runtime assembly. The Type Library Importer converts the type definitions found within a COM type library into equivalent definitions in a common language runtime assembly. The output of Tlbimp.exe is a binary file (an assembly) that contains runtime metadata for the types defined within the original type library.

7 What benefit do you get from using a Primary Interop Assembly (PIA)?
PIAs are important because they provide unique type identity. The PIA distinguishes the official type definitions from counterfeit definitions provided by other interop assemblies. Having a single type identity ensures type compatibility between applications that share the types defined in the PIA. Because the PIA is signed by its publisher and labeled with the PrimaryInteropAssembly attribute, it can be differentiated from other interop assemblies that define the same types.

Saturday, March 10, 2007

Introduction Object-Oriented Programming (OOP) is a software development paradigm that suggests developers to split a program in building blocks known as objects. The OOP paradigm allows developers to define the object’s data, functions, and its relationship with other objects.

Microsoft created the .NET Framework using OOP, and knowing this concepts has helped me to understand the .NET Framework and to design and develop better software components. The purpose of this article is to describe the basic OOP concepts using real world scenarios and to provide some code samples that demonstrate how to work with OOP and .NET.

ClassThe most common definition states that a class is a template for an object. Suppose that someone builds a paper pattern for a shirt. All the shirts done with the same paper pattern will be identical (same design, size, etc.). In this sample, the paper pattern is the class and the shirt is the object. To build the same exact shirt over and over, you need the paper pattern as a template. Another great example is house plans and blueprints. The plans and blueprints define the number of rooms, the size of the kitchen, the number of floors, and more. In this real world sample, the house plans and blueprints are the class and the house is the object. In OOP you program a class as a template for a specific object or groups ob objects that will always have the same features.

Class members A class has different members, and developers in Microsoft suggest to program them in the following order:
· Namespace: The namespace is a keyword that defines a distinctive name or last name for the class. A namespace categorizes and organizes the library (assembly) where the class belongs and avoids collisions with classes that share the same name.
· Class declaration: Line of code where the class name and type are defined.
· Fields: Set of variables declared in a class block.
· Constants: Set of constants declared in a class block.
· Constructors: A method or group of methods that contains code to initialize the class.
· Properties: The set of descriptive data of an object.
· Events: Program responses that get fired after a user or application action.
· Methods: Set of functions of the class.
· Destructor: A method that is called when the class is destroyed. In managed code, the Garbage Collector is in charge of destroying objects; however, in some cases developers need to take extra actions when objects are being released, such as freeing handles or deallocating unmanaged objects. In .NET, there is no concept of deterministic destructors. The Garbage Collector will call the Finalize() method at a non-deterministic time while reclaiming memory for the application.
Access keywords
Access keywords define the access to class members from the same class and from other classes. The most common access keywords are:

Public: Allows access to the class member from any other class.
Private: Allows access to the class member only in the same class.
Protected: Allows access to the class member only within the same class and from inherited classes.
Internal: Allows access to the class member only in the same assembly.
Protected internal: Allows access to the class member only within the same class, from inherited classes, and other classes in the same assembly.
Static: Indicates that the member can be called without first instantiating the class.

The Windows Management Instrumentation(WML) Query Language

objSWbemServices.InstancesOf("Win32_Service")
objSWbemServices.ExecQuery("SELECT * FROM Win32_Service")
objSWbemServices.ExecQuery("SELECT Name FROM Win32_Service")
objSWbemServices.ExecQuery("SELECT StartMode FROM Win32_Service")
objSWbemServices.ExecQuery _("SELECT StartMode FROM Win32_Service WHERE State=Running")
objSWbemServices.ExecQuery _("SELECT StartMode, State FROM Win32_Service WHERE State=Running")
objSWbemServices.ExecQuery _("SELECT * FROM Win32_Service WHERE Name=WinMgmt")
objSWbemServices.Get("Win32_Service.Name=WinMgmt")



WML Keywords

AND
ASSOCIATORS OF
CLASS
FROM
GROUP Clause
HAVING
IS
ISA
KEYSONLY
LIKE
NOT
NULL
OR
REFERENCES OF
SELECT
TRUE
WHERE
WITHIN
FALSE

WML Operators

= Equal to
< Less than
> Greater than
<= Less than or equal to
>= Greater than or equal to
!= or <> Not equal to

Friday, March 09, 2007

1. What is Crystal Report?
Ans: Crystal report is a report generation tool. Generally have interface with VB6. Crystal report basically generates dynamic data. You can format the data in whichever way you feel like.


2. Can we use Crystal report as a stand-alone application?
Ans: Generally we use
Crystal Reports with VB6. However we can make crystal report stand-alone application also. But for that limitation is for viewing the report user should have crystal reports installed on his/her PC.

3. How do we connect to the
database?
Ans: There are two ways of creating the report: -
Use crystal report built in query.
Use the tool ‘ Crystal SQL Designer’ provided by crystal report.
When you create report using crystal report built in query then it asks for the
data source name that you have created. When you run the report, then for the first time it will ask for the user id and password. After that it will store the same. When you create ‘.qry’ using ‘Crystal SQL’ Designer then at that time it will ask for the user id and password. When you run the report for the first time instead of asking for the user id and password it will ask for the ‘.qry’ file location. You can change the query location also. For that open the report, select ‘Set Location’ option in Database menu item, and set the location.

4. How do we format field?
Ans: For formatting any field just right click on it and you will get many options like ‘Format Field.’ ‘Browse field data’ etc. Click on ‘Format Field.’ You can align data, suppress, make it multiline, change the font size, style, and type, make it
hyperlink etc. If it is an amount field then you can display currency symbol also. Right click on the field select ‘Format Field’.

5. Can we give parameters to the report?
Ans: We can very well give parameters to the report. For creating parameters select ‘Parameter Field’ in Insert menu item. ‘Create Parameter Field’ dialog box will popped up, it will ask for the name of parameter, prompting text and datatype. Now when you run the report it will prompt for these parameters.

6.Can we create our own formulas in reports?
Ans: We can create our own formulas in reports. Select ‘Formula Field’ in Insert menu item. Write the formula in ‘Formula Editor’. Here you will get ‘Field Tree’, ‘Function Tree’, and ‘Operator Tree’, which will display the report fields, functions that are supported by crystal reports (like CDATE () etc.), operators (arithmetic, strings etc.) respectively.

7. Can we create report using more than one database?
Ans: We can create report using more than one database like Oracle, Access. Create data source name for both the databases. Select tables from them and create the report. Only restriction is if you use two databases then you cannot see the SQL generated by crystal reports.

8. Can we
export data of reports into other format like in world doc etc?
Ans: Generated data can be exported to word doc, or in
rich text format. Just click on ‘Export’ icon in the menu. Export dialog box will be popped up. It will ask for the ‘Format’ like comma-separated value (csv) etc and the ‘Destination’ like disk, application etc. After that it will ask for the file name and save the data. Only restriction is formatting of data will be lost, but crystal report will try to maintain as much formatting as it can.

9. Can we use our own SQL for creating a report?
Ans: We can also make our own query using ‘Crystal SQL Designer’ tool provided by SQL. Here you can insert your SQL statement as such. It will save this file as ‘.qry’ . And when you create a report instead of using ‘Database’ button use ‘Crystal SQL Statement’ button.

10. Can we edit SQL made by Crystal reports?
Ans: We cannot edit the SQL made by crystal reports. However we can view the SQL. For that select ‘Show SQL Query’ in Database menu item. Limitation is if you are using only one database. If you use two databases then you can’t even view the SQL prepared by crystal report.

11. Are there any limitations in crystal reports?
Ans: There are certain limitations in crystal reports. They are: -
If database is having field whose length is more than 255 characters, then you cannot make formula using that field. While exporting data formatting is lost. When you browse data just by right clicking on the field then it displays that is there in the database not the data selected by the query.

12. Can we suppress printing in crystal reports if 0 records are fetched?
Ans: Yes, we can suppress printing if no records are fetched. Select ‘Report Options’ in File menu item. ‘Report Options’ dialog box will pop up. In that there is one option ‘ Suppress printing if no records’ Check this option. If no records are found then nothing will be printed on the report.

13. What are the sections that we have in Crystal reports?
Ans: Report has got standard sections like ‘Page Header’, ‘Page Footer’, ‘Report Header’, ‘Report Footer’, and ‘Details’. However you can add other sections also. Select ‘Sections’ in the Insert menu item. You can insert group sections also. If you don’t want to show any section just right click on that section and suppress that.

14. Can we add any database field once we have chosen ‘Close’ button?
Ans: Yes, we can add any database field afterwards also. Select ‘Database Field’ in Insert menu item. If you are using crystal report built in query then it will display the tables that you have selected. And you can select whichever field you want to display on the report. But if you are using ‘.qry’ file then it will display Query and you can select only those field, which are there in the query.

15. Does Crystal Report support all the functions that we have in Oracle?
Ans: No, Crystal report does not support all the functions. Like Decode function is there in SQL but not there is crystal report. You need to convert that in crystal report format (in if and else etc.).
However if you use ‘.qry’ files then it take the SQL as such. There is no need of changing any syntax.

16. Can we use stored procedure for creating the report?
Ans: Yes, we can use stored procedure.

17. Is there any feature like summing total in crystal report?
Ans: Crystal reports provide features like grand total, sub-total, running total etc. You can select any of these features in Insert menu item. You can sum up records on the basis of each record or on change of group using ‘Running Total ‘ option in Insert menu item.

18. I am using two tables one is of access database and other is of oracle database, I am getting an error saying that ‘SQL odbc error’ what should I do?
Ans: If you are getting such an error then click the icon for ‘Report Expert’. It will give a warning saying that formatting will be lost. Ignore this you will get ‘Standard Report Expert’ dialog box. Reverse the links of access database table and it will work.

Wednesday, March 07, 2007

1 What base class do all Web Forms inherit from?
System.Windows.Forms.Form

2 What is the difference between Debug.Write and Trace.Write?

When should each be used? The Debug.Write call won't be compiled when the DEBUGsymbol is not defined (when doing a release build). Trace.Write calls will be compiled. Debug.Write is for information you want only in debug builds, Trace.Write is for when you want it in release build as well.

3 Difference between Anchor and Dock Properties?
Dock Property->Gets or sets which edge of the parent container a control is docked to. A control can be docked to one edge of its parent container or can be docked to all edges and fill the parent container. For example, if you set this property to DockStyle.Left, the left edge of thecontrol will be docked to the left edge of its parent control. Additionally, the docked edge of the control is resized to match that of its containercontrol.Anchor Property->Gets or sets which edges of the control are anchored to the edges of its container. A control can be anchored to one or more edges of its parent container. Anchoring a control to its parent ensures that the anchored edges remain in the same position relative to the edges of the parent container when the parent container is resized.


4 Can you write a class without specifying namespace?
Which namespace does it belong to by default??Yes, you can, then the class belongs to global namespace which has no name. For commercial products, naturally, you wouldn't want global namespace.

You are designing a GUI application with a windows and several widgets on it. The user then resizes the app window and sees a lot of grey space, while the widgets stay in place. What's the problem?

One should use anchoring for correct resizing. Otherwise the default property of a widget on a form is top-left, so it stays at the same location when resized.

5 How can you save the desired properties of Windows Forms application?

.config files in .NET are supported through the API to allow storing and retrieving information. They are nothing more than simple XML files, sort of like what .ini files were before for Win32 apps.

6 So how do you retrieve the customized properties of a .NET application from XML .config file?

Initialize an instance of AppSettingsReader class. Call the GetValue method of AppSettingsReader class, passing in the name of the property and the type expected. Assign the result to the appropriate variable.

7 Can you automate this process?

In Visual Studio yes, use Dynamic Properties for automatic .config creation, storage and retrieval.

My progress bar freezes up and dialog window shows blank, when an intensive background process takes over. Yes, you should've multi-threaded your GUI, with taskbar and main form being one thread, and the background process being the other.

8 What's the safest way to deploy a Windows Forms app?

Web deployment: the user always downloads the latest version of the code, the program runs within security sandbox, properly written app will not require additional security privileges.

9 Why is it not a good idea to insert code into InitializeComponent method when working with Visual Studio?

The designer will likely through it away, most of the code inside InitializeComponent is auto-generated.

10 What's the difference between WindowsDefaultLocation and WindowsDefaultBounds?WindowsDefaultLocation tells the form to start up at a location selected by OS, but with internally specified size. WindowsDefaultBounds delegates both size and starting position choices to the OS.

11 What's the difference between Move and LocationChanged?

Resize and SizeChanged? Both methods do the same, Move and Resize are the names adopted from VB to ease migration to C#.

12 How would you create a non-rectangular window, let's say an ellipse?

Create a rectangular form, set the TransparencyKey property to the same value as BackColor, which will effectively make the background of the form transparent. Then set the FormBorderStyle to FormBorderStyle.None, which will remove the contour and contents of the form.

13 How do you create a separator in the Menu Designer?

A hyphen '-' would do it. Also, an ampersand '&\' would underline the next letter.

14 How's anchoring different from docking?

Anchoring treats the component as having the absolute size and adjusts its location relative to the parent form. Docking treats the component location as absolute and disregards the component size. So if a status bar must always be at the bottom no matter what, use docking. If a button should be on the top right, but change its position with the form being resized, use anchoring.

15 How do you trigger the Paint event in System.Drawing?

Invalidate the current form, the OS will take care of repainting. The Update method forces the repaint.

16 With these events, why wouldn't Microsoft combine Invalidate and Paint, so that you wouldn't have to tell it to repaint, and then to force it to repaint?

Painting is the slowest thing the OS does, so usually telling it to repaint, but not forcing it allows for the process to take place in the background.

17 How can you assign an RGB color to a System.Drawing.Color object?

Call the static method FromArgb of this class and pass it the RGB values.

18 What class does Icon derive from?

Isn't it just a Bitmap with a wrapper name around it? No, Icon lives in System.Drawing namespace. It's not a Bitmap by default, and is treated separately by .NET. However, you can use ToBitmap method to get a valid Bitmap object from a valid Icon object.

19 Before in my VB app I would just load the icons from DLL. How can I load the icons provided by .NET dynamically?

By using System.Drawing.SystemIcons class, for example System.Drawing.SystemIcons.Warning produces an Icon with a warning sign in it.

20 When displaying fonts, what's the difference between pixels, points and ems?

A pixel is the lowest-resolution dot the computer monitor supports. Its size depends on user's settings and monitor size. A point is always 1/72 of an inch. An em is the number of pixels that it takes to display the letter M.