Friday, August 27, 2004
Pre-defined Visual Studio Command Aliases
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsintro7/html/vxgrfpredefinedcommandlinealiases.asp
With Best Regards
Mitesh Mehta
Monday, August 23, 2004
Reading Text file with XML DOM object
XML DOM has no limitations on the kind of file it can open, what is important is that the content be XML. In your case, for this document to be a valid XML Document, the root node is missing. So, you would have a two step process for processing this doc as XML DOM.
1. Using XML Dom, create the root node and read the TXT file into a filestream
2. Concat the TXT file to the root node created above.
Now coming to the caveats of DOM.
Remember, DOM creates a tree in mem. This tree is so huge that its nearly 10 times the size of the original doc, once in memory.
Secondly, DOM is slower any day to actual raw file processing i.e. using streams. FSO is a different story. For that the VBScript engine has to be loaded, and then the file loaded (Unless of course you are referring to a VBScript here :) )
My suggestion would be, load the file into the FSO as you are doing now, and use the RegularExpression object (available in both, .NET as well as VBScript 5.0 onwards) to select the text between the
With Best Regards,
Mitesh V. Mehta
Email : miteshvmehta@gmail.com
http://cc.1asphost.com/miteshvmehta/
Thursday, August 19, 2004
Transaction
We talked about Transactions in .Net a few days back... We learnt that how
they can be automatic or manual...Now ,we will talk about Automatic
Transactions this whole week... Hopefully it will be interesting and
useful...
Automatic Transaction manages transaction boundaries for you... But again it
manages the boundaries on the basis of what you suggest it to do (you do
that by attributes which we will talk in a couple of days... ) The
transaction flows from one object to other as instructed... Within its
scope, it includes, the objects that are suppose to participate in
transactions and leaves out the objects that are not suppose to
participate...
Note: Nested transactions are not possible in Automatic model...
---------xxxxxx--------------------
Transaction Attribute for your class
We discussed that for our class to participate in transactions we need to do
certain things... Now we will talk about what those certain things have to
be...
One of the things that you need to do is to apply Transaction attribute to
your class... You would apply it just before your class declaration... It
would look something like:
[Transaction(TransactionOption.Supported)]
Now if you are familiar with COM+ transactions then TransactionOption has
values which are very similar to COM+ transaction options...
The TransactionOption values can be Disabled, NotSupported, Supported,
Required, RequiresNew... Out of these Required is the default...
With Best Regards
Mitesh Mehta
eMAIL : miteshvmehta@gmail.com
http://cc.1asphost.com/miteshvmehta
Wednesday, August 11, 2004
Changing Reference to different version of external assembly
Changing Reference to different version of external assembly
Consider a scenario when your application is referencing version 1.0.1.1 of
"SomeAssembly" in GAC... Now you realize that there are some major bugs in
that assembly and you want your assembly to reference the new version of the
assembly (say 1.0.2.0) and you do not want to go ahead and recompile your
code for that... What would you do... Well here is the answer... You would
go and change the configuration file with similar updates to the ones I am
writing below...
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asmv1">
<publisherPolicy apply="no"/>
<dependantAssembly>
<assemblyIdentity name="SomeAssembly"
publicKeyToken="whatever" />
<publisherPolicy apply="no"/>
<bindingRedirect oldVersion="1.0.1.1"
newVersion="1.0.2.0" />
</dependantAssembly>
</assemblyBinding>
</runtime>
</configuration>
Regards,Mitesh v. Mehta
Snippet Compiler
Snippet Compiler
Snippet Compiler Here are its
features:
- Compiles and runs single or multiple C#, VB.NET
and ASP.NET snippets.
- Optionally builds WinForm EXEs, console
EXEs or DLLs.
- The user can store a library of
templates.
- Displays compile errors and warning, including
wave lines in editor with error/warning tooltips.
- IntelliSense for static members and method
signatures, as well as constructor signatures.
- Imports VS.NET projects.
- Conveniently sits in the notification
area waiting to be useful.
- Exports snippets to HTML/RTF.
Regards,Mitesh v. Mehta
Common Type System - Value Types vs Reference Types
Common Type System - Value Types vs Reference Types
Value Types and Reference Types are two basic types of CTS... Value Types
are allocated on the stack and Reference Types are allocated on Managed
heap... How this thing work is that the value of the "Value Types" is
allocated on the stack where as in case of "Reference Types" the value i.e.
the object itself resides in the heap but there is a pointer to the object
in the memory...
Considering this differences value types are faster but consume the process
memory.... Managed type don't consume this process memory but then they
become slower... When value types are copied then the whole object is copied
on the heap, when reference types are copied then only the reference is
copied... Inshort, there are pros and cons to both and sometimes you have an
option to choose one of them in your development sometimes you don't
have....
Value types are usually native data types like int, float, string, char,
enums etc... Reference types mostly include classes and some other user
defined types...Regards,Mitesh v. Mehta
.NET Supporting Languages List...
.NET Supporting Languages List...
Ensuring a single instance of your .Net application
Ensuring a single instance of your .Net application
[STAThread]
static void Main()
{
bool ok;
m = new System.Threading.Mutex(true, "YourNameHere", out ok);
if (! ok)
{
MessageBox.Show("Another instance is already running.");
return;
}
Application.Run(new Form1());
GC.KeepAlive(m);
}Regards,Mitesh Mehtahttp://cc.1asphost.com/miteshvmehta/
Know about Data Protection API (DPAPI)
Know about Data Protection API (DPAPI)
What is the Data Protection API? The DPAPI is used to hide secrets like
connection strings and user credentials that are typically stored in a
config file. Instead of storing the plain text, you can use DPAPI to encrypt
and decrypt the secrets at a machine or user specific level.
Read and learn more at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsecure/html/windataprotection-dpapi.aspRegards,Mitesh v. Mehta
Network Ports Used by Key Microsoft Server Products.
Network Ports Used by Key Microsoft Server Products.
I found this nice link from http://www.only4gurus.com/ which also gives one .pdf files containing the list of Network Ports Used by Key Microsoft Server Products and their explaination.Thanks and Regards,Mitesh V. Mehta
KnowledgeBase: Remoting at a Glance.
KnowledgeBase: Remoting at a Glance.
Remoting at a Glance.
An
end-to-end picture of remoting is as follows. The host application is
loaded and registers a channel and port on which to listen for incoming
calls. The configuration file, if any, is read and an object’s remoting
information is loaded—the host application can now map a URI to the
physical assembly and instantiate the object when required. The client
application also registers the same channel and then attempts to create
a new instance of the remote class. The remoting system handles the
request for a new instance by providing a proxy object in place of the
actual object on the server. The actual object is either created
immediately for CAOs or on the first method call for Singleton/Singlecall objects—the
remoting framework takes care of this for you automatically. When the
client calls a method on the proxy object, the information is sent
across the channel to the remote object. The remoting system will then
pass back the results of the method across the channel in the same
manner- C# .NET - Web Developers Guide
Regards,Mitesh v. Mehta