'Adda'
Saturday, February 28, 2009
Using Enterprise Library 3.1 in SharePoint site
[assembly: System.Security.AllowPartiallyTrustedCallers]
Usually the Object Builder code is not available.
Download it from CodePlex
Make sure you add the line [assembly: System.Security.AllowPartiallyTrustedCallers] to this project also.
Make sure you reference Object Builder in other Enterprise Library projects
In the web.config add requirePermission = false in the dataconfiguration section
Saturday, August 23, 2008
Packages and Subsystems
Subsystems implement Interfaces
Thereby the following characteristics are present for subsystems which are not present for packages
- Encapsulates information behind the interfaces
- Represent an independent capability with clear interfaces
- Are easily replaced
Friday, September 07, 2007
Cannot resolve collation conflict for equal to operation
Columns with the same collating sequences can be compared or joined without any additional considerations
This mainly occurs when the temporary tables have a different collation sequence than the tables in the database.
The solution is to have the tables in the database to be created without any collation sequence. This will enable the tables to take the default collation of the database
Tuesday, March 13, 2007
Mid level developer - Qs from Scott Hanselmans Computer Zen
I hope to write all the answers. Watch this space!
Describe the difference between Interface-oriented, Object-oriented and Aspect-oriented programming.
Interface Oriented programming
= Programming to an Interface.
Object oriented programming = Using the object oriented concepts such as Encapsulation,Inheritance,Polymorphism
Aspect oriented programming = <>
Describe what an Interface is and how it’s different from a Class.
Interface has no implementation.
Classes have implementation and they may implement the Interface.
Interface is a good way to design a software since it defines a contract for the classes.
What is Reflection?
Reflection provides objects that encapsulate assemblies, modules, and types.
You can use reflection to dynamically create an instance of a type, bind the type to an existing object, or get the type from an existing object.
You can then invoke the type's methods or access its fields and properties.
Example
Imagine,you are in visual studio IDE (Integrated devolopment environment) and as you type "object." you would see all the methods,properties and events associated with that object.
An other example would be an Object browser.The code attached here,loads all assemblies and displays each class,its contructors, methods, properties and events in tree view.
What is the difference between XML Web Services using ASMX and .NET Remoting using SOAP?
Are the type system represented by XmlSchema and the CLS isomorphic?
Conceptually, what is the difference between early-binding and late-binding?
Is using Assembly.Load a static reference or dynamic reference?
When would using Assembly.LoadFrom or Assembly.LoadFile be appropriate?
LoadFile method is supported only in version 1.1 of the .NET Framework
Use the LoadFile method to load and examine assemblies that have the same identity, but are located in different paths.
Do not use LoadFile to load assemblies that you want to execute. LoadFile does not load files into the LoadFrom context, and does not resolve dependencies using the load path, as the LoadFrom method does.
LoadFile is useful in this limited scenario because LoadFrom cannot be used to load assemblies that have the same identities but different paths; it will load only the first such assembly.
What is an Asssembly Qualified Name? Is it a filename? How is it different?
An assembly's name is stored in metadata and has a significant impact on the assembly's scope and use by an application.
A strong-named assembly has a fully qualified name that includes the assembly's name, culture, public key, and version number.
The runtime uses this information to locate the assembly and differentiate it from other assemblies with the same name.
For example, a strong-named assembly called myTypes could have the following fully qualified name:
"myTypes, Version=1.0.1234.0, Culture="en-US", publicKeyToken=b77a5c561934e089c
In this example, the fully qualified name indicates that the myTypes assembly has a strong name with a public key token, has the culture value for US English, and has a version number of 1.0.1234.0.
Is this valid? Assembly.Load("foo.dll");
No this should be loaded with a fully qualified assembly name
How is a strongly-named assembly different from one that isn’t strongly-named?
A strong name consists of the assembly's identity—its simple text name, version number, and culture information (if provided)—plus a public key and a digital signature
Strong names guarantee name uniqueness by relying on unique key pairs. No one can generate the same assembly name that you can, because an assembly generated with one private key has a different name than an assembly generated with another private key
It helps in avoiding DLL hell.
Can DateTimes be null?
What is the JIT? What is NGEN? What are limitations and benefits of each?
JIT comes into play during EXECUTION of the code.
Before you can run Microsoft intermediate language (MSIL), it must be converted by a .NET Framework just-in-time (JIT) compiler to native code, which is CPU-specific code that runs on the same computer architecture as the JIT compiler.
JIT compilation takes into account the fact that some code might never get called during execution. Rather than using time and memory to convert all the MSIL in a portable executable (PE) file to native code, it converts the MSIL as needed during execution and stores the resulting native code so that it is accessible for subsequent calls
NGEN
The Native Image Generator (Ngen.exe) is a tool that improves the performance of managed applications.
Ngen.exe creates native images, which are files containing compiled processor-specific machine code, and installs them into the native image cache on the local computer.
The runtime can use native images from the cache instead using the just-in-time (JIT) compiler to compile the original assembly.
http://msdn2.microsoft.com/en-us/library/6t9t5wcf(VS.80).aspx is a good link on comaprison between NGEN and JIT
How does the generational garbage collector in the .NET CLR manage object lifetime? What is non-deterministic finalization?
What is the difference between Finalize() and Dispose()?
Finalize
Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
Finalize operations have the following limitations:
The exact time when the finalizer executes during garbage collection is undefined. Resources are not guaranteed to be released at any specific time, unless calling a Close method or a Dispose method.
The finalizers of two objects are not guaranteed to run in any specific order, even if one object refers to the other. That is, if Object A has a reference to Object B and both have finalizers, Object B might have already finalized when the finalizer of Object A starts.
The thread on which the finalizer is run is unspecified.
Dispose
How is the using() pattern useful? What is IDisposable? How does it support deterministic finalization?
What does this useful command line do? tasklist /m "mscor*"
What is the difference between in-proc and out-of-proc?
What technology enables out-of-proc communication in .NET?
When you’re running a component within ASP.NET, what process is it running within on Windows XP? Windows 2000? Windows 2003?
Tuesday, February 06, 2007
Debugging Cassini and Debugging GAC dlls
"
Hello,
I am trying to debug the source code of Cassini.
I have modified 2 lines of the build.bat file in this way
csc /t:library /keyfile:Cassini.snk /r:System.dll /r:System.Web.dll /debug /out:Cassini.dll AssemblyInfo.cs ByteParser.cs ByteString.cs Connection.cs Host.cs Messages.cs Request.cs Server.cs
csc /nologo /define:DEBUG /t:winexe /r:System.dll /r:System.Drawing.dll /r:System.Windows.Forms.dll /r:Cassini.dll /win32icon:CassiniWebServer.ico /res:CassiniWebServer.ico,CassiniWebServerIcon /out:CassiniWebServer.exe CassiniWebServerMain.cs
Since the Cassini is installed in the GAC. I am unable to debug.
Therefore I removed the assembly from the GAC and modified the build.bat file accordingly.
When I try to debug the solution, I get an exception in
_host = (Host)_appManager.CreateObject(appId, typeof(Host), _virtualPath, _physicalPath, false /*failIfExists*/);
indicating that the file and assembly could not be found.
The error is gone after I remove from the GAC but I am not able to debug it.
Found the solution also.
The solution is
Thanks to Robert Bogue [MVP] blog
Have a look at the link to debug GAC dlls
http://thorprojects.com/blog/archive/2005/08/30/204.aspx
Getting the content again from the blog
"
There are sometimes when your assembly almost has to be in the GAC and when you need to debug it. This was difficult since if you registered a .NET assembly into the GAC the debugger wouldn't break on it. This is because the .PDB file information didn't get loaded since it's not in the same directory as the DLL. Here's how to work around that.
1) Install the Assembly in the GAC
2) Start-Run, %SYSTEMROOT%\Assembly\GAC
3) Navigate into the folder with name of the DLL that you want to debug
4) Navigate into the folder with the version number and public key that you want
5) Copy the .PDB file into this directory
Now you'll be able to run a debugger against code running in the GAC.
"
For me in Step3 the path was
C:\WINNT\assembly\GAC_MSIL\Cassini\2.0.60306.0__a2c3042d130f02aa
Thursday, January 18, 2007
Everyone who writes code - Answers
Answer:
A program in execution is known as a process.
A process may have a single thread.
A process may have multiple threads. Threads are spawned from a process.
===========================================================
Question:What is a Windows Service and how does its lifecycle differ from a "standard" EXE?
Answer:
The "standard EXE" exits from memory when it is closed.
The Windows Service only exits from memory when the service is stopped.
==============================================================
Question:What is the maximum amount of memory any single process on Windows can address? Is this different than the maximum virtual memory for the system? How would this affect a system design?
Answer:
========================================================
Question:What is the difference between an EXE and a DLL?
Answer:
A DLL is a dynamic link library. When a process loads a DLL, the DLL is loaded into the memory once. When another process makes a call to the same DLL, the DLL is not loaded into memory again.
A EXE is always loaded into memory. Each instance of the EXE is a process. It has its own address space.
============================================================
Question:What is strong-typing versus weak-typing? Which is preferred? Why?
Answer:
When the type of an object is known, then this strongly typed.
example,
Dim i as Integer
When the type of an object is known, then this is weakly typed.
example,
Dim obj as Object
For performance reasons, strong typing is preferred.
But in certain cases, late binding is required, therefore weak typing is necessary
=========================================================
Question:Name at least 3 component containers that ship now with the Windows Server Family.
Answer:
===============================================
Question:What is a PID? How is it useful when troubleshooting a system?
Answer:
PID is Process identification number. This would help to identify the process which causes the problem
=======================================================
Question:How many processes can listen on a single TCP/IP port?
Answer:
===================================================
Question:What is the GAC? What problem does it solve?
Answer:GAC is the Global Assembly Cache. If a number of applications use the same DLL, the DLLs can be installed in the GAC and the applications can use the same DLL. This helps in deplyment issues related with enterprise applications using the same DLL
Singleton design pattern
I have a interest in design patterns. Would be posting several useful links on design patterns . Starting off with the simplest design pattern.
http://msdn2.microsoft.com/en-us/library/ms998426.aspx is a MSDN link on the Singleton Design pattern. This is a very simple design pattern.
This article has an implementation with C#.It uses the lock keyword for mutual exclusion.
What is lock?
The lock keyword marks a statement block as a critical section by obtaining the mutual-exclusion lock for a given object, executing a statement, and then releasing the lock. This statement takes the following form:
Object thisLock = new Object();
lock (thisLock)
{
// Critical code section
}
==============================================================
http://en.wikipedia.org/wiki/Singleton_pattern is the wikipedia link on the Singleton design pattern.
Monday, January 15, 2007
SQL Server Database Publishing wizard
We can script the database objects ( tables , SPS,UDFs and others ) and also the DATA of the database. The DATA part of the scripting was particularly new.
http://www.codeplex.com/sqlhost/Wiki/View.aspx?title=Database%20Publishing%20Wizard
has the free download.
Adda is the Bengali for discussion.Bengali is a language like English.