Resource File Generator Tool
Resource file generator tool is used to convert resource file in the form of .txt or .resx files to common language runtime binary .resources files... These files can be compiled into satellite assemblies..
This utility can do conversions in other directions too and uses following classes to do the conversions
ResourceReader Class
ResourceWriter Class
ResXResourceReader Class
ResXResourceWriter Class
The exe name for the tool is ResGen.exe... If you search MSDN with the keyword you will find ample information...
PS: I was wondering when would people start using MSDN to search MSDN and not Google... I am trying to develop this good habit... :-)
Wednesday, September 15, 2004
Tuesday, September 14, 2004
VJs Tip Of The Day - September 14th 2004
Quick MultiThreading
This is some real quick good info for specific scenarios... If you are writing some workflow logic of yours and in-between you realize that you want to perform some tasks which would be time consuming but actually are also apart from your actual business logic and so you would not want your business logic to waste on performance by waiting for those tasks to complete... Some of the examples of such tasks would be printing, cleaning back-end, doing logging or tracing functionality etc...
Well this is when the System.Threading.ThreadPool class comes real handy... There is a static method called QueueUserWorkItem... You can call this method with the method that you want to execute Asynchronously... The Threadpool will use the first available thread to process your request... Now your main business logic does not need to wait for this function to finish...
Now this function can as well give a call back but then it depends upon your requirements...
Read more about it on MSDN... Click Here...
PS: This tip is a result of my discussions with Matt, a colleague of mine... We often discuss interesting technical stuff in our "Leisure At Work" (LAW can never be illegal right!!)
Note: Caution on multithreading... You should know that if different threads are gonna use the same resource then multithreading might cause performance hits as well... Thanks Kathleen for reminding...
This is some real quick good info for specific scenarios... If you are writing some workflow logic of yours and in-between you realize that you want to perform some tasks which would be time consuming but actually are also apart from your actual business logic and so you would not want your business logic to waste on performance by waiting for those tasks to complete... Some of the examples of such tasks would be printing, cleaning back-end, doing logging or tracing functionality etc...
Well this is when the System.Threading.ThreadPool class comes real handy... There is a static method called QueueUserWorkItem... You can call this method with the method that you want to execute Asynchronously... The Threadpool will use the first available thread to process your request... Now your main business logic does not need to wait for this function to finish...
Now this function can as well give a call back but then it depends upon your requirements...
Read more about it on MSDN... Click Here...
PS: This tip is a result of my discussions with Matt, a colleague of mine... We often discuss interesting technical stuff in our "Leisure At Work" (LAW can never be illegal right!!)
Note: Caution on multithreading... You should know that if different threads are gonna use the same resource then multithreading might cause performance hits as well... Thanks Kathleen for reminding...
Monday, September 13, 2004
VJs Tip Of The Day - September 13th 2004
ToolTip in Windows
Well if you have been doing Web development for a long time in .Net now, if you switch to windows it would pretty much possible for you to search for the standard ToolTip property for all the controls and guess what you won't find it... :-) Windows UI is much more richer than web and so the windows controls try to leverage that... For this reason there is a special ToolTip control which is provided to you in the windows environment which you can associate with any of your controls...
Now what are some of its advantages the code below will tell you:
ToolTip vjsTip = new ToolTip();
vjsTip .InitialDelay = 1500;
vjsTip .ReshowDelay = 1000;
vjsTip .SetToolTip(this.txtZipCode, "You need to provide a zip code only if you are in US or Canada");
Similarly you also have GetToolTip() method... Well so go ahead and try explore more on the ToolTip control...
PS: Hope you all are doing fine!!...How did it feel when a forcible mail did not drop into your mailbox for so many days??... Good!!..Bad!!...Well, after giving you a small break, I am back again to bug you, make you take your pill daily... But if you do not like the pills then drop me a mail I will try that they don't reach you... Otherwise, the second season has begun... :-)
Well if you have been doing Web development for a long time in .Net now, if you switch to windows it would pretty much possible for you to search for the standard ToolTip property for all the controls and guess what you won't find it... :-) Windows UI is much more richer than web and so the windows controls try to leverage that... For this reason there is a special ToolTip control which is provided to you in the windows environment which you can associate with any of your controls...
Now what are some of its advantages the code below will tell you:
ToolTip vjsTip = new ToolTip();
vjsTip .InitialDelay = 1500;
vjsTip .ReshowDelay = 1000;
vjsTip .SetToolTip(this.txtZipCode, "You need to provide a zip code only if you are in US or Canada");
Similarly you also have GetToolTip() method... Well so go ahead and try explore more on the ToolTip control...
PS: Hope you all are doing fine!!...How did it feel when a forcible mail did not drop into your mailbox for so many days??... Good!!..Bad!!...Well, after giving you a small break, I am back again to bug you, make you take your pill daily... But if you do not like the pills then drop me a mail I will try that they don't reach you... Otherwise, the second season has begun... :-)
Monday, September 06, 2004
Very Limited Access To Internet
Hi All,
I have very limited access to internet as of now and I will be getting a new connection set up at my home only by Sept 11th 2004... I have my entire mailing list as well all my work on my laptop/CDs... Only after my internet connection is up I would be able to update any further posts or send tips...
Please bear with me till then...
best wishes,
Vishal Joshi
If You Think YOU CAN... You Can...
I have very limited access to internet as of now and I will be getting a new connection set up at my home only by Sept 11th 2004... I have my entire mailing list as well all my work on my laptop/CDs... Only after my internet connection is up I would be able to update any further posts or send tips...
Please bear with me till then...
best wishes,
Vishal Joshi
If You Think YOU CAN... You Can...
Tuesday, August 31, 2004
VJs Tip Of The Day - August 31st 2004
COM Callable Wrapper(CCW) - In simple terms -CCW is the special wrapper created over your .Net classes so that they appear as COM objects to other COM components... If your .Net application needs to be called by other COM components you need to make sure that CCW is created over your .Net classes...
Runtime Callable Wrapper (RCW) - In simple terms - RCW is a special wrapper created over COM components so that they appear as .Net components to other .Net components... If your .Net components call other COM components then you need to make sure that RCW is created over the COM components that your application calls...
PS: I will be shifting to Milwaukee, WI tomorrow... Till I get my new home set up, I might not be having any access to internet so probably would not be able to send in Tips for a while... I apologize in advance for the same and will try to get back to grove ASAP...
Runtime Callable Wrapper (RCW) - In simple terms - RCW is a special wrapper created over COM components so that they appear as .Net components to other .Net components... If your .Net components call other COM components then you need to make sure that RCW is created over the COM components that your application calls...
PS: I will be shifting to Milwaukee, WI tomorrow... Till I get my new home set up, I might not be having any access to internet so probably would not be able to send in Tips for a while... I apologize in advance for the same and will try to get back to grove ASAP...
Monday, August 30, 2004
VJs Tip Of The Day - August 30th 2004
Maintaining State Across ASP.Net Pages - Continued 4
Due to the weekend you might have lost touch... In that case do browse through the previous tips on the blog site... The current mail is in continuation of previous tips...
There is a possibility of InvalidCastException, which may come in case of using properties with Server.Transfer... If you think for a while you can very easily conclude the possible causes...
1.) SecondPage is called from a page other than the FirstPage
2.) SecondPage is directly loaded
3.) SecondPage is called from any other page using response.redirect
In such a scenario do make sure that you catch this exception and ignore it...
PS: You know blogspot has provided search facility for the blogs... So now if you want to search some specific tip in my blog you can use that search facility and you will get the tip right over there... :-)
Due to the weekend you might have lost touch... In that case do browse through the previous tips on the blog site... The current mail is in continuation of previous tips...
There is a possibility of InvalidCastException, which may come in case of using properties with Server.Transfer... If you think for a while you can very easily conclude the possible causes...
1.) SecondPage is called from a page other than the FirstPage
2.) SecondPage is directly loaded
3.) SecondPage is called from any other page using response.redirect
In such a scenario do make sure that you catch this exception and ignore it...
PS: You know blogspot has provided search facility for the blogs... So now if you want to search some specific tip in my blog you can use that search facility and you will get the tip right over there... :-)
Friday, August 27, 2004
VJs Tip Of The Day - August 27th 2004
Maintaining State Across ASP.Net Pages - Continued 3
Yesterday we discussed on NOT having second parameter to be true in Server.Transer() method while transferring data of first page to next page using properties... Visit the previous tips to follow up...
Now the answer to "WHY" not true... Well, I was trying that out yesterday and I got an exception message:
"The View State is invalid for this page and might be corrupted"...
On exploring more I discovered that: It is that "EnableViewStateMac"* property of the page(which we discussed few days back)is set to true by default... If this property is true ASP.Net makes a check to find out if the viewstate was modified or not when the page was posted from the client... Now as in case of Server.Transfer's second parameter being true what happens is that all the form variables (including viewstate) of the first page is preserved and sent to second page... Here due to EnableViewStateMac being true a check is made by ASP.Net but now as you are no more in first page so it is but obvious that this check will fail... And as in case of properties option without setting second parameter of Server.Transfer as true also the values are transferred so you can as well pass it to be false...
As such you can also make "EnableViewStateMac" as false but that would not be a good idea from security perspective...
*MAC stands for Message Authentication Check
PS: You know Sudhakar Sadasivuni, a fellow MVP has helped to get all our MVP blogs at one place at the site http://www.mvpblog.com... I bet you will find loads of information here so do visit it when you find time...
Yesterday we discussed on NOT having second parameter to be true in Server.Transer() method while transferring data of first page to next page using properties... Visit the previous tips to follow up...
Now the answer to "WHY" not true... Well, I was trying that out yesterday and I got an exception message:
"The View State is invalid for this page and might be corrupted"...
On exploring more I discovered that: It is that "EnableViewStateMac"* property of the page(which we discussed few days back)is set to true by default... If this property is true ASP.Net makes a check to find out if the viewstate was modified or not when the page was posted from the client... Now as in case of Server.Transfer's second parameter being true what happens is that all the form variables (including viewstate) of the first page is preserved and sent to second page... Here due to EnableViewStateMac being true a check is made by ASP.Net but now as you are no more in first page so it is but obvious that this check will fail... And as in case of properties option without setting second parameter of Server.Transfer as true also the values are transferred so you can as well pass it to be false...
As such you can also make "EnableViewStateMac" as false but that would not be a good idea from security perspective...
*MAC stands for Message Authentication Check
PS: You know Sudhakar Sadasivuni, a fellow MVP has helped to get all our MVP blogs at one place at the site http://www.mvpblog.com... I bet you will find loads of information here so do visit it when you find time...
Thursday, August 26, 2004
VJs Tip Of The Day - August 26th 2004
Maintaining State Across ASP.Net Pages - Continued 2
Hi Folks,
I apologize for abruptly stopping the tips... I was not having any access to internet for the last few days... I am shifting to Milwaukee, Wisconsin to join in as a .Net System Architect in an MNC... I will remain busy during this transition but will ensure that I do not display this abrupt behavior again... The tips of Aug 23rd, 24th and 25th are up there on my blog site(Click Here) The current tip is in continuation of the previous tips so please do visit the site and catch up before you move ahead...
4.) Using Properties with Server.Transfer: Make your first page in such a way that you expose the required values in next page as properties in the first page... Then use Server.Transfer to go to the next page(keep the second parameter as false here, WHY SO WE WILL TALK TOMORROW)... Now in the next page using context handler you can get all the properties of the first page...
I am not writing the first page code as it is just simply adding values into properties and calling Server.Transfer and I believe you all know how to do that...
CODE SNIPPET
NextPage Code:
if(Context.Handler != null)
{
string strInternalVariableOfNextPage;
FirstPage objFirstPage = new FirstPage();
objFirstPage = (FirstPage)Context.Handler;
//Note that SomeValue is a public property of First Page
strInternalVariableOfNextPage = objFirstPage.SomeValue;
}
PS: I like receiving mails that blast me on not sending the tips... This keeps me motivated so thanks to all those who wrote in those mails...
Hi Folks,
I apologize for abruptly stopping the tips... I was not having any access to internet for the last few days... I am shifting to Milwaukee, Wisconsin to join in as a .Net System Architect in an MNC... I will remain busy during this transition but will ensure that I do not display this abrupt behavior again... The tips of Aug 23rd, 24th and 25th are up there on my blog site(Click Here) The current tip is in continuation of the previous tips so please do visit the site and catch up before you move ahead...
4.) Using Properties with Server.Transfer: Make your first page in such a way that you expose the required values in next page as properties in the first page... Then use Server.Transfer to go to the next page(keep the second parameter as false here, WHY SO WE WILL TALK TOMORROW)... Now in the next page using context handler you can get all the properties of the first page...
I am not writing the first page code as it is just simply adding values into properties and calling Server.Transfer and I believe you all know how to do that...
CODE SNIPPET
NextPage Code:
if(Context.Handler != null)
{
string strInternalVariableOfNextPage;
FirstPage objFirstPage = new FirstPage();
objFirstPage = (FirstPage)Context.Handler;
//Note that SomeValue is a public property of First Page
strInternalVariableOfNextPage = objFirstPage.SomeValue;
}
PS: I like receiving mails that blast me on not sending the tips... This keeps me motivated so thanks to all those who wrote in those mails...
Wednesday, August 25, 2004
VJs Tip Of The Day - August 25th 2004
Maintaining State Across ASP.Net Pages - Continued 1
3.) Using HttpContext/RequestParams with Server.Transfer: We discussed adding to session yesterday, similarly you can add to HttpContext as well and this eliminates the cleaning code required in the next page like the way it is required in Session... There are other advantages too...
If you use Server.Transfer then all your control values are automatically transferred to the next page you do not have to add anything to the context explicitly here rather just access the values in the coming page... The code example will show this more clearly...
If you have certain values other than the above mentioned then you have to do certain special operations to explicitly add them in the first page and retrieve them in the second...
CODE SNIPPET
FirstPage Code:
//These are the special values being added to context
//we will retrieve them in the next page
context.Items.Add("specialVariableName", "specialVariableValue");
//We set the second parameter of Server.Transfer to True this will help
//sending certain values automatically
Server.Transfer("NextPage.aspx", True);
NextPage Code:
string strValueOfFirstPageTextBox;
string strSpeciallyAddedValue;
//Use Request.Params to get values of the standard variables
//which get automatically transferred
strValueOfFirstPageTextBox = Request.Params.Get("firstPageTextBox")
//Use HttpContext to get the values specially added
strSpeciallyAddedValue = context.Items("specialVariableName")
3.) Using HttpContext/RequestParams with Server.Transfer: We discussed adding to session yesterday, similarly you can add to HttpContext as well and this eliminates the cleaning code required in the next page like the way it is required in Session... There are other advantages too...
If you use Server.Transfer then all your control values are automatically transferred to the next page you do not have to add anything to the context explicitly here rather just access the values in the coming page... The code example will show this more clearly...
If you have certain values other than the above mentioned then you have to do certain special operations to explicitly add them in the first page and retrieve them in the second...
CODE SNIPPET
FirstPage Code:
//These are the special values being added to context
//we will retrieve them in the next page
context.Items.Add("specialVariableName", "specialVariableValue");
//We set the second parameter of Server.Transfer to True this will help
//sending certain values automatically
Server.Transfer("NextPage.aspx", True);
NextPage Code:
string strValueOfFirstPageTextBox;
string strSpeciallyAddedValue;
//Use Request.Params to get values of the standard variables
//which get automatically transferred
strValueOfFirstPageTextBox = Request.Params.Get("firstPageTextBox")
//Use HttpContext to get the values specially added
strSpeciallyAddedValue = context.Items("specialVariableName")
Tuesday, August 24, 2004
VJs Tip Of The Day - August 24th 2004
Maintaining State Across ASP.Net Pages
We will talk about two standard methods of maintaining state across ASP.Net pages today... The more sophisticated methods will be discussed from tomorrow onwards...
1) Using QueryString : You can pass values of one page to another page using Query strings... This is an old ASP custom but for security reason not always recomended in ASP.Net
2) Using Session : You can also pass values of one page to another by storing them in session... Use of session is pretty simple and we have discussed that earlier as well (Click Here)... But do understand the fact that Session variables are to store user specific information which is unique to each user and not each page... Also do note that if you forget to clean the session variables in the next page you might land up increasing the session size like anything effecting performance of your application...
We will talk about two standard methods of maintaining state across ASP.Net pages today... The more sophisticated methods will be discussed from tomorrow onwards...
1) Using QueryString : You can pass values of one page to another page using Query strings... This is an old ASP custom but for security reason not always recomended in ASP.Net
2) Using Session : You can also pass values of one page to another by storing them in session... Use of session is pretty simple and we have discussed that earlier as well (Click Here)... But do understand the fact that Session variables are to store user specific information which is unique to each user and not each page... Also do note that if you forget to clean the session variables in the next page you might land up increasing the session size like anything effecting performance of your application...
Monday, August 23, 2004
VJs Tip Of The Day - August 23rd 2004
Steps to Enable Automatic Transactions in .Net
We have discussed all these steps earlier but now we will club them together to see how you go about doing it....
1. Add TransactionAttribute to your class
2. Derieve your class from ServicedComponents class
3. Give strong name to your assembly
4. Register your class for COM+ services using Regsvcs.exe
We have discussed all these steps earlier but now we will club them together to see how you go about doing it....
1. Add TransactionAttribute to your class
2. Derieve your class from ServicedComponents class
3. Give strong name to your assembly
4. Register your class for COM+ services using Regsvcs.exe
Friday, August 20, 2004
VJs Tip Of The Day - August 20th 2004
Transactions in .Net - Using Services of COM+
To use the services of COM+ and transactions you need to register the assembly that contains you class (transactional) with the COM+... You can do so manually by using .Net Services Installation Tool (Regsvcs.exe)... Well if your client is managed client then you do not need to do this registeration as CLR will do it for you but if you know that at sometime your clients can be unmanaged then it is always useful to register your assembly manually...
To use the services of COM+ and transactions you need to register the assembly that contains you class (transactional) with the COM+... You can do so manually by using .Net Services Installation Tool (Regsvcs.exe)... Well if your client is managed client then you do not need to do this registeration as CLR will do it for you but if you know that at sometime your clients can be unmanaged then it is always useful to register your assembly manually...
Thursday, August 19, 2004
VJs Tip Of The Day - August 19th 2004
TransactionOption
We are getting into the details of TransactionOption today...
1. TransactionOption.Disabled implies that automatic transactions cannot control the object... Still if you want this object to support transaction then it can be done by manual transactions...
2. TransactionOption.NotSupported implies that object context will always be created without transaction for this object no matter whether a transaction is already existing...
3. TransactionOption.Supported implies that if transaction exists the object will run under it, if it does not exist it will run without transaction...
4. TransactionOption.Required implies that if transaction exists the object will run under it, if it does not exist a new transaction will be created...
5. TransactionOption.RequiresNew implies that the a new trasaction is started for every request...
PS: Trivandrum User Group in India launches its own site... First bold move by any User Group in India and I bet it is for good... visit
http://www.t-mug.org/membersite.aspx to see for yourself...
We are getting into the details of TransactionOption today...
1. TransactionOption.Disabled implies that automatic transactions cannot control the object... Still if you want this object to support transaction then it can be done by manual transactions...
2. TransactionOption.NotSupported implies that object context will always be created without transaction for this object no matter whether a transaction is already existing...
3. TransactionOption.Supported implies that if transaction exists the object will run under it, if it does not exist it will run without transaction...
4. TransactionOption.Required implies that if transaction exists the object will run under it, if it does not exist a new transaction will be created...
5. TransactionOption.RequiresNew implies that the a new trasaction is started for every request...
PS: Trivandrum User Group in India launches its own site... First bold move by any User Group in India and I bet it is for good... visit
http://www.t-mug.org/membersite.aspx to see for yourself...
Wednesday, August 18, 2004
VJs Tip Of The Day - August 18th 2004
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...
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...
Tuesday, August 17, 2004
VJs Tip Of The Day - August 17th 2004
Transactions in .Net
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...
PS: I sent a document to my team for review... Two days later a friend/collegue wrote to me that I had sent the wrong document... Till now no reviewer other than her has got back (out of 6-7 in the list)... I was wondering about the chances of reviewers not opening the review attachments which someone sends and also chances of them getting mad if the document was never sent, interstingly both the chances are equally bright... :-)
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...
PS: I sent a document to my team for review... Two days later a friend/collegue wrote to me that I had sent the wrong document... Till now no reviewer other than her has got back (out of 6-7 in the list)... I was wondering about the chances of reviewers not opening the review attachments which someone sends and also chances of them getting mad if the document was never sent, interstingly both the chances are equally bright... :-)
Monday, August 16, 2004
VJs Tip Of The Day - August 16th 2004
Design Days: Caching and Performance
Usually we assume that Caching is done to improve performance, well it is true but at the same time it may deteriorate the performance as well... It many a times depends on the Cache Hit Ratio... And you should definitely consider your Cache Hit Ratio [CHR] before considering your caching strategy...
To make it more clear consider a scenario in which you cache the state list of a country... Now if user has to select one of the available states then there are bright chances that your cache hit is a success.... It might be a good idea to cache the list instead of retrieving it from the data source all the time...
Now consider that you cache product list for a store like Walmart... You might have millions of product in the database and it is very unlikely that the product selection will lie in the correct category and type... There are more likely chances of miss than of hit, but you will lose time in searching the cache, so here is when you should consider hitting the data source instead of caching...
Now there are options other than caching and there might be other factors governing the decisions, this is just a design suggestion...
PS: 15th August was India's Independence Day... Please accept my belated wishes for a Happy Independence Day... Jai Hind... (Hail India!!)
Usually we assume that Caching is done to improve performance, well it is true but at the same time it may deteriorate the performance as well... It many a times depends on the Cache Hit Ratio... And you should definitely consider your Cache Hit Ratio [CHR] before considering your caching strategy...
To make it more clear consider a scenario in which you cache the state list of a country... Now if user has to select one of the available states then there are bright chances that your cache hit is a success.... It might be a good idea to cache the list instead of retrieving it from the data source all the time...
Now consider that you cache product list for a store like Walmart... You might have millions of product in the database and it is very unlikely that the product selection will lie in the correct category and type... There are more likely chances of miss than of hit, but you will lose time in searching the cache, so here is when you should consider hitting the data source instead of caching...
Now there are options other than caching and there might be other factors governing the decisions, this is just a design suggestion...
PS: 15th August was India's Independence Day... Please accept my belated wishes for a Happy Independence Day... Jai Hind... (Hail India!!)
Friday, August 13, 2004
VJs Tip Of The Day - August 13th 2004
If you want to use the services provided by COM+ in your .Net then you write Serviced Components...
To write serviced components you will have to include the namespace of System.EnterpriseServices... You will also have to inherit you class from ServicedComponent
PS: For My Records(FMR) - I am travelling to Omaha, NE to celebrate my friends Birthday...
To write serviced components you will have to include the namespace of System.EnterpriseServices... You will also have to inherit you class from ServicedComponent
PS: For My Records(FMR) - I am travelling to Omaha, NE to celebrate my friends Birthday...
Wednesday, August 11, 2004
VJs Tip Of The Day - August 12th 2004
ViewState Encryption- Considerations
Well to add to yesterday's tip, there are few more tips, rather considerations to come on the way related to viewstate encryption...
If you are using SSL for your webpages then you would want to reconsider whether you need this encryption of ViewState seperately or not as your whole data will be encrypted anyways...
The other point is webfarm scenario... When deploying your webapp to Webfarm without sticky sessions if AutoGenerate option is on (which is by default) then there are chances that your each request will go to different machine and ViewState decryption will fail there... You will have to do synchronization activities in this scenario...
Note: Sticky session is a scenario in which, once the first request in a session is served by a particular server all the consecutive requests for that session will be directed to the same server...
PS: I was wondering that if someone reads one useful article from MSDN daily, (note: JUST ONE useful article) how many days would it take for him/her to become "Most Knowledgeable Person" around there... Think about this, I smile when I come up with a number out of my hat... :-)
Well to add to yesterday's tip, there are few more tips, rather considerations to come on the way related to viewstate encryption...
If you are using SSL for your webpages then you would want to reconsider whether you need this encryption of ViewState seperately or not as your whole data will be encrypted anyways...
The other point is webfarm scenario... When deploying your webapp to Webfarm without sticky sessions if AutoGenerate option is on (which is by default) then there are chances that your each request will go to different machine and ViewState decryption will fail there... You will have to do synchronization activities in this scenario...
Note: Sticky session is a scenario in which, once the first request in a session is served by a particular server all the consecutive requests for that session will be directed to the same server...
PS: I was wondering that if someone reads one useful article from MSDN daily, (note: JUST ONE useful article) how many days would it take for him/her to become "Most Knowledgeable Person" around there... Think about this, I smile when I come up with a number out of my hat... :-)
Tuesday, August 10, 2004
VJs Tip Of The Day - August 11th 2004
Encrypting View State
Few days back we talked about ViewState being Base64 Encoded and that it moves back and forth from client to server... Now if you wish to encrypt the ViewState for security reasons then below is the way to achieve the same...
You have to change your web.config file... In the system.web section of the web.config file you need to add the below tags
<pages enableViewStateMAC="true"/>
<machineKey validation="3DES"/>
PS: Note that here validation="3DES" causes the encryption... enableViewStateMAC causes the check that ViewState is not actually tampered...
Few days back we talked about ViewState being Base64 Encoded and that it moves back and forth from client to server... Now if you wish to encrypt the ViewState for security reasons then below is the way to achieve the same...
You have to change your web.config file... In the system.web section of the web.config file you need to add the below tags
<pages enableViewStateMAC="true"/>
<machineKey validation="3DES"/>
PS: Note that here validation="3DES" causes the encryption... enableViewStateMAC causes the check that ViewState is not actually tampered...
VJs Tip Of The Day - August 10th 2004
Processing Transactions in .Net
.Net components do support transactions, the only thing is that you have to do some extra work to achieve the same... .Net framework supports two kind of transactions models
1.) Manual Transactions
2.) Automatic Transactions
Manual Tranactions is used in case of ADO.Net, message queuing etc... Automatic Transactions are available for ASP.Net, Web Services, .Net Components etc... .Net classes can also use the services of COM+ but they need to be registered with COM+ for doing so... We will talk more about Transactions in .Net in time to come...
PS: Is it a good idea to send in some code snippets in Tips?? If so do let me know, I do not want the tips to be cumbersome to read...
.Net components do support transactions, the only thing is that you have to do some extra work to achieve the same... .Net framework supports two kind of transactions models
1.) Manual Transactions
2.) Automatic Transactions
Manual Tranactions is used in case of ADO.Net, message queuing etc... Automatic Transactions are available for ASP.Net, Web Services, .Net Components etc... .Net classes can also use the services of COM+ but they need to be registered with COM+ for doing so... We will talk more about Transactions in .Net in time to come...
PS: Is it a good idea to send in some code snippets in Tips?? If so do let me know, I do not want the tips to be cumbersome to read...
Monday, August 09, 2004
VJs Tip Of The Day - August 9th 2004
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 publickeytoken="whatever" name="SomeAssembly">
<publisherpolicy apply="no">
<bindingredirect newversion="1.0.2.0" oldversion="1.0.1.1">
</dependantassembly>
</assemblybinding>
</runtime>
</configuration>
PS: You can achieve the same with different methods as well this is just one of them
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 publickeytoken="whatever" name="SomeAssembly">
<publisherpolicy apply="no">
<bindingredirect newversion="1.0.2.0" oldversion="1.0.1.1">
</dependantassembly>
</assemblybinding>
</runtime>
</configuration>
PS: You can achieve the same with different methods as well this is just one of them
Friday, August 06, 2004
VJs Tip Of The Day - August 6th 2004
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 works 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....
"Reference types don't consume this process memory but then they become slower... When value types are copied then the value is copied as a whole on the stack, when reference types are copied then only the references are copied on the stack..., when to use Reference Types as compared to Value Types and visa-versa is based on various other factors also so do take time to decide when to use what..."
Value types are usually native data types like int, float, char, enums etc... Reference types mostly include string, classes and some other user defined types...
PS: I wrote Value types to be allocated on heap in my second paragraph only Kathleen was able to find that out... You guys do write back when you see such gross errors... Thanks Kathleen...
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 works 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....
"Reference types don't consume this process memory but then they become slower... When value types are copied then the value is copied as a whole on the stack, when reference types are copied then only the references are copied on the stack..., when to use Reference Types as compared to Value Types and visa-versa is based on various other factors also so do take time to decide when to use what..."
Value types are usually native data types like int, float, char, enums etc... Reference types mostly include string, classes and some other user defined types...
PS: I wrote Value types to be allocated on heap in my second paragraph only Kathleen was able to find that out... You guys do write back when you see such gross errors... Thanks Kathleen...
Thursday, August 05, 2004
VJs Tip Of The Day - August 5th 2004
Design Days: View State Performance Tips
In controls like listbox controls, items added to the list are carried between client and server via view state... When the list of items become considerably large it starts hitting the performance and increasing the traffic between client and server... To avoid this set the EnableViewState property of the control to be false... By this unnecessary data will not move back and forth to the server... Though, do note that by doing so your selected items will no longer remain selected after postback and you will have to write special code to achieve this functionality...
The same problems are also faced in controls like Datagrid so do ensure that you use View State judiciously and give enough thoughts while designing your application...
To see the view state of a page right click on displayed page and 'view source', here you will see a long line of junk characters for __VIEWSTATE property... This is the encrypted view state of your controls... Well, that makes me add one more point the performance... All the viewstate data that passes to and comes back from server goes through the cycles of encryption and decryption which in itself is also a costly affair hitting performance...
Note: Ben Miller from Microsoft corrected my silly mistake here... view state is Base64 encoded when it moves back and forth from client to server.... It is not encrypted... Thanks for the correction Ben... Btw, Ben Miller is also ASP.Net MVP Lead of North America... !!
PS: Did you read my suggestion to Microsoft long time back... You will like it... Click Here
In controls like listbox controls, items added to the list are carried between client and server via view state... When the list of items become considerably large it starts hitting the performance and increasing the traffic between client and server... To avoid this set the EnableViewState property of the control to be false... By this unnecessary data will not move back and forth to the server... Though, do note that by doing so your selected items will no longer remain selected after postback and you will have to write special code to achieve this functionality...
The same problems are also faced in controls like Datagrid so do ensure that you use View State judiciously and give enough thoughts while designing your application...
To see the view state of a page right click on displayed page and 'view source', here you will see a long line of junk characters for __VIEWSTATE property... This is the encrypted view state of your controls... Well, that makes me add one more point the performance... All the viewstate data that passes to and comes back from server goes through the cycles of encryption and decryption which in itself is also a costly affair hitting performance...
Note: Ben Miller from Microsoft corrected my silly mistake here... view state is Base64 encoded when it moves back and forth from client to server.... It is not encrypted... Thanks for the correction Ben... Btw, Ben Miller is also ASP.Net MVP Lead of North America... !!
PS: Did you read my suggestion to Microsoft long time back... You will like it... Click Here
Wednesday, August 04, 2004
VJs Tip Of The Day - August 4th 2004
Assemblies Details Introduction
•Assembly has a four part name that uniquely identifies it – Name, Version, Culture & develope
•Version – Major.Minor.Build.Revision
•Culture – Satellite Assemblies contain culture info attribute that indicates the spoken language and country-code
•Public Keys – Used to uniquely identify the developer of a component and provide protection from getting tampered by external sources
using System.Reflection;
[assembly: AssemblyVersion(“1.2.3.4”)]
[assembly: AssemblyCulture(“en-US”)]
[assembly: AssemblyKeyFile(“mykey.snk”)]
PS: Naveeth Krishnan from Trivandrum .Net User Group has suggested me to start writing more about Assemblies so this is the beginning... We will deviate once in a while so that none of us get bored but still we will touch more about Assemblies now...
PPS: Did you read my suggestion to Microsoft long time back... You will like it.. Click Here
•Assembly has a four part name that uniquely identifies it – Name, Version, Culture & develope
•Version – Major.Minor.Build.Revision
•Culture – Satellite Assemblies contain culture info attribute that indicates the spoken language and country-code
•Public Keys – Used to uniquely identify the developer of a component and provide protection from getting tampered by external sources
using System.Reflection;
[assembly: AssemblyVersion(“1.2.3.4”)]
[assembly: AssemblyCulture(“en-US”)]
[assembly: AssemblyKeyFile(“mykey.snk”)]
PS: Naveeth Krishnan from Trivandrum .Net User Group has suggested me to start writing more about Assemblies so this is the beginning... We will deviate once in a while so that none of us get bored but still we will touch more about Assemblies now...
PPS: Did you read my suggestion to Microsoft long time back... You will like it.. Click Here
Tuesday, August 03, 2004
VJs Tip Of The Day - August 3rd 2004
Design Days - Data Access Ways
This is just a small little thought, which I thought, can be shared... When we try to access data from a table in DataSet many a times we have to use the name of the columns... We have multiple Datagrids bound to each table and many other controls of your page also access data from these tables... Now, just in case your column name changes in the table you would want to have minimum impact on the stuff that you have to change...
As a solution to this you can have DataDefinition class... This class can just return back the name of the columns as properties, you can define these light weight classes if you have less number of tables to be accessed... In any case if you do not follow this approach then it is always advisable to have constants declared at a common location and store your column names in there....
You can later use either these constants or light weight classes to get the column names...
PS: Do note that by introducing such things you can make your design more maintainable but sometimes loose on performance... Take decisions on the basis of what is ideal for your situation... Don't sue a poor fella like me for suggesting, you anyways won't get much... :-)
Kathleen Dollard, Microsoft MVP adds the below:
Use enums. Much faster and far more maintainable....
This is just a small little thought, which I thought, can be shared... When we try to access data from a table in DataSet many a times we have to use the name of the columns... We have multiple Datagrids bound to each table and many other controls of your page also access data from these tables... Now, just in case your column name changes in the table you would want to have minimum impact on the stuff that you have to change...
As a solution to this you can have DataDefinition class... This class can just return back the name of the columns as properties, you can define these light weight classes if you have less number of tables to be accessed... In any case if you do not follow this approach then it is always advisable to have constants declared at a common location and store your column names in there....
You can later use either these constants or light weight classes to get the column names...
PS: Do note that by introducing such things you can make your design more maintainable but sometimes loose on performance... Take decisions on the basis of what is ideal for your situation... Don't sue a poor fella like me for suggesting, you anyways won't get much... :-)
Kathleen Dollard, Microsoft MVP adds the below:
Use enums. Much faster and far more maintainable....
Monday, August 02, 2004
VJs Tip Of The Day - August 2nd 2004
A design consideration to access Web.Config
If you are going to access Web.config file for various configuration settings of yours e.g. ConnectionString.... Then sometimes it would be a good idea to develop a class specially to access configuration settings, something like a ConfigManager... what this class can inturn do is to access Web.Config file in its constructor to retrieve your configuration settings and fill up private variables and in turn expose them as properties...
The advantage of having this approach is that if you decide to change your source for these settings then you do not have to go to every page and change the way you access the settings you just change your class... Other than this there can be potential situations in which you might decide to encrypt some values in your web.config file later... This security enhancement would otherwise cause all your pages accessing this information change... During such situations it would be ideal to have a class like this...
To add icing to the cake you can make required member variables static so that the class's instance need not be created everytime... Also do try to make sure that every call to your property should not need to query web.config file to access values or else they may degrade performance...
PS: This is a design tip, it may not be perfect design for all situations these are just some of my generic thoughts, if you have anything to dispute please feel free to drop me an email
Binu from Trivendrum User Group has added the below thoughts...
There is one more advantage to this. if you want to deploy the application in different environments (developer sand box/ integration/ QA / production) it would be easy to have this App.Config . The possibility of using different encryption keys / SQL server in different environments is pretty high in real scenario and with the number of builds we deploy before pushing to production corroborates this.
-- Binu
If you are going to access Web.config file for various configuration settings of yours e.g. ConnectionString.... Then sometimes it would be a good idea to develop a class specially to access configuration settings, something like a ConfigManager... what this class can inturn do is to access Web.Config file in its constructor to retrieve your configuration settings and fill up private variables and in turn expose them as properties...
The advantage of having this approach is that if you decide to change your source for these settings then you do not have to go to every page and change the way you access the settings you just change your class... Other than this there can be potential situations in which you might decide to encrypt some values in your web.config file later... This security enhancement would otherwise cause all your pages accessing this information change... During such situations it would be ideal to have a class like this...
To add icing to the cake you can make required member variables static so that the class's instance need not be created everytime... Also do try to make sure that every call to your property should not need to query web.config file to access values or else they may degrade performance...
PS: This is a design tip, it may not be perfect design for all situations these are just some of my generic thoughts, if you have anything to dispute please feel free to drop me an email
Binu from Trivendrum User Group has added the below thoughts...
There is one more advantage to this. if you want to deploy the application in different environments (developer sand box/ integration/ QA / production) it would be easy to have this App.Config . The possibility of using different encryption keys / SQL server in different environments is pretty high in real scenario and with the number of builds we deploy before pushing to production corroborates this.
-- Binu
Friday, July 30, 2004
VJs Tip Of The Day - July 30th 2004
Global Asssembly Cache (GAC) & CLR
When your assembly is ready to go to GAC (implies you need to do some steps like strong name generation etc, before it can... :-) ) you can use Gacutil.exe provided by .Net Framework SDK to install your assembly into GAC...
Alternatively you can just drag and drop an assembly in "WINNT\ASSEMBLY" folder in your windows explorer; The CLR does run the Gacutil in the back-ground and so your assembly gets intstalled in the GAC...
PS: The weekend has nearly started so pardon this silly tip... Remember our mass movement: "No working on weekends... Do what you enjoy!!"... Btw, If you find me in office on weekends don't feel I am breaching the contract rather assume that: I enjoy work... :-)
When your assembly is ready to go to GAC (implies you need to do some steps like strong name generation etc, before it can... :-) ) you can use Gacutil.exe provided by .Net Framework SDK to install your assembly into GAC...
Alternatively you can just drag and drop an assembly in "WINNT\ASSEMBLY" folder in your windows explorer; The CLR does run the Gacutil in the back-ground and so your assembly gets intstalled in the GAC...
PS: The weekend has nearly started so pardon this silly tip... Remember our mass movement: "No working on weekends... Do what you enjoy!!"... Btw, If you find me in office on weekends don't feel I am breaching the contract rather assume that: I enjoy work... :-)
Thursday, July 29, 2004
VJs Tip Of The Day - July 29th 2004
Fragment Caching
Fragment caching is a technique to cache only partial part of the page... This technique is used to improve performance of your page, but it needs to be decided at design time...
You can achieve Fragment caching by developing a part of your web page as User Control... User Control can then cache itself independant of the page... User Controls provides many more benefits other than Fragment Caching so while going for User Controls there are other factors to be considered...
Fragment caching is a technique to cache only partial part of the page... This technique is used to improve performance of your page, but it needs to be decided at design time...
You can achieve Fragment caching by developing a part of your web page as User Control... User Control can then cache itself independant of the page... User Controls provides many more benefits other than Fragment Caching so while going for User Controls there are other factors to be considered...
Wednesday, July 28, 2004
VJs Tip Of The Day - July 28th 2004
ASP.Net Server Controls Categories
ASP.Net Server Control can be broadly classified into 4 categories...
ASP.Net Server Control can be broadly classified into 4 categories...
- Intrinsic Controls -These controls correspond to their HTML counterpart... eg Textbox control, Button control
- Data-Centric Controls - These controls are used for data display, binding, modification purposes... They bind to various data sources... eg. DataGrid control
- RichControls - Usually do not have HTML counterparts... These are usually composite controls which in themselves contain other controls... eg. Calendar control
- Validation Controls - As the name suggest they are used for validation purposes and can validate many type of user inputs.... eg. RegularExpressionValidator
Tuesday, July 27, 2004
VJs Tip Of The Day - July 27th 2004
SQL Server Session State Does It Again
Well did you wonder yesterday, that if your session data was stored in permanent tables on SQL server and there would be "n" number of sessions running for your application all the time how much data would get collected in the SQL Server???
So, there has to be a mechanism to clean this data every once in a while right!!... And ofcourse there is... When SQL Server support for session gets installed a job to delete the expired session is also installed, this job runs every minute and is called ASPState_Job_DeleteExpiredSessions...; It requires SQLServerAgent service to be running in order to work...
PS: To visit earlier tips click on the right side "Archives" menu of the blog site...
Well did you wonder yesterday, that if your session data was stored in permanent tables on SQL server and there would be "n" number of sessions running for your application all the time how much data would get collected in the SQL Server???
So, there has to be a mechanism to clean this data every once in a while right!!... And ofcourse there is... When SQL Server support for session gets installed a job to delete the expired session is also installed, this job runs every minute and is called ASPState_Job_DeleteExpiredSessions...; It requires SQLServerAgent service to be running in order to work...
PS: To visit earlier tips click on the right side "Archives" menu of the blog site...
Monday, July 26, 2004
VJs Tip Of The Day - July 26th 2004
Again Session State
Well this time we will get into little details... ASP.Net provides two pair of SQL scripts to create/delete the SQLServer Session DB... The first pair of script creates TempDB where ASP.Net session state is stored, but as the name specifies this DB will loose its value if SQL server is re-started...the script are named InstallSqlState.sql and UninstallSqlState.sql...
If you wish to keep your session data even more secure, you would do so by running the other pair of scripts... These scripts create permanent tables on SQL Server... These scripts are called InstallPersistSqlState.sql and UninstallPersistSqlState.sql...
All the above mentioned scripts are located in the same folder as the session state NT service...
Well this time we will get into little details... ASP.Net provides two pair of SQL scripts to create/delete the SQLServer Session DB... The first pair of script creates TempDB where ASP.Net session state is stored, but as the name specifies this DB will loose its value if SQL server is re-started...the script are named InstallSqlState.sql and UninstallSqlState.sql...
If you wish to keep your session data even more secure, you would do so by running the other pair of scripts... These scripts create permanent tables on SQL Server... These scripts are called InstallPersistSqlState.sql and UninstallPersistSqlState.sql...
All the above mentioned scripts are located in the same folder as the session state NT service...
Sunday, July 25, 2004
Friday, July 23, 2004
VJs Tip Of The Day - July 23rd 2004
mode="SQLServer" for sessionState
When you choose your sessionState to be SQLServer, ASP.Net uses the default DB and initial catalogs for storing your session information into SQLServer... That is the reason you are not allowed to pass tokens such as Database and Initial Catalog in the connection string... Finally your entry in the web.config file will look like
<configuration>
<system.web>
<sessionState
mode="SQLServer"
sqlConnectionString="server=127.0.0.1;uid=<user id>pwd<password>" />
</system.web>
</configuration>
user id and password can be replaced by integrated security settings...
When you choose your sessionState to be SQLServer, ASP.Net uses the default DB and initial catalogs for storing your session information into SQLServer... That is the reason you are not allowed to pass tokens such as Database and Initial Catalog in the connection string... Finally your entry in the web.config file will look like
<configuration>
<system.web>
<sessionState
mode="SQLServer"
sqlConnectionString="server=127.0.0.1;uid=<user id>pwd<password>" />
</system.web>
</configuration>
user id and password can be replaced by integrated security settings...
Thursday, July 22, 2004
VJs Tip Of The Day - July 22nd 2004
Session State in ASP.Net
ASP.Net supports three different providers for Session State... They are:
InProc - Session values are kept live in the memory of ASP.Net worker process
StateServer - Session values are serialized to store in the memory of a seperate proces i.e. aspnet_state.exe
SQLServer - Session values are stored on SQL Server...
You can read more about operational information and performance of session variables at
http://vishaljoshi.blogspot.com/2003_10_01_vishaljoshi_archive.html
ASP.Net supports three different providers for Session State... They are:
InProc - Session values are kept live in the memory of ASP.Net worker process
StateServer - Session values are serialized to store in the memory of a seperate proces i.e. aspnet_state.exe
SQLServer - Session values are stored on SQL Server...
You can read more about operational information and performance of session variables at
http://vishaljoshi.blogspot.com/2003_10_01_vishaljoshi_archive.html
Wednesday, July 21, 2004
VJs Tip Of The Day - July 21th 2004
Performance with static variables as compared to Application variables
Sometimes if you want to share a value of a type across pages then it is sensible to use static variables instead of Application variable... The advantages from performance perspective by taking this approach are:
Storing and reading a value can be many times faster with static variables as they do not require to lookup into application variables collection when you refer to them...
You also do not need to cast from object to a specific type, as you need to do with Application variables, but you need to make sure that you declare the static variable of same type as the object that needs to be stored... By this you can also avoid the overhead casting, boxing and unboxing...
Sometimes if you want to share a value of a type across pages then it is sensible to use static variables instead of Application variable... The advantages from performance perspective by taking this approach are:
Storing and reading a value can be many times faster with static variables as they do not require to lookup into application variables collection when you refer to them...
You also do not need to cast from object to a specific type, as you need to do with Application variables, but you need to make sure that you declare the static variable of same type as the object that needs to be stored... By this you can also avoid the overhead casting, boxing and unboxing...
Monday, July 19, 2004
VJs Tip Of The Day - July 20th 2004
HttpResponse.RemoveOutputCacheItem
It is possible to forcibly remove a page from output cache... You can do so by a static method called HttpResponse.RemoveOutputCacheItem("Page path")...
If you are running on a web farm environment then you would have to call this method on each server as cache is not shared across servers...
It is possible to forcibly remove a page from output cache... You can do so by a static method called HttpResponse.RemoveOutputCacheItem("Page path")...
If you are running on a web farm environment then you would have to call this method on each server as cache is not shared across servers...
VJs Tip Of The Day - July 19th 2004
DataReader Object
ADO.Net objects are broadly divided into two sections:
Connected Objects
Disconnected Objects
The DataReader is one of the connected objects of ADO.Net... It helps you examine the rows that are fetched by your query, one at a time... It discards every row after you have gone through it and so it is extreamly fast...
It also contains read-only data, so no updates are allowed using DataReader objects...
ADO.Net objects are broadly divided into two sections:
Connected Objects
Disconnected Objects
The DataReader is one of the connected objects of ADO.Net... It helps you examine the rows that are fetched by your query, one at a time... It discards every row after you have gone through it and so it is extreamly fast...
It also contains read-only data, so no updates are allowed using DataReader objects...
Friday, July 16, 2004
VJs Tip Of The Day - July 16th 2004
Const vs readonly in C#
const (Constants) are variables whose values are set at compile time, either by the programmer or by the compiler... It cannot be modified there after, so if you need a field whose value is known at compile time and should not be changed anytime later then you should declare that field as const... Intersting note is that const fields are statis by default and so you do not need to instantiate a class to access them...
readonly (Read Only) are variables whose values are set at run time, but only once... The value of such variables are set in the constructors and cannot be modified there on... These variables are useful when you want the value of the variable to be fixed but fixed to a value which is known only at run time...
Now if you need a static variable whose value is known only at runtime then make it static readonly... :-)
Sudhir from TCS wanted to add the tip above below is his note:
Hi Vishal a little addition in yr Tip What is the difference between CONST and READONLY? Both are meant for constant values. A const field can only be initialized at the declaration of the field. A readonly field can be initialized either at the declaration or in a constructor. Therefore, readonly fields can have different values depending on the constructor used. readonly int b; public X() { b=1; } public X(string s) { b=5; } public X(string s, int i) { b=i; } Also, while a const field is a compile-time constant, the readonly field can be used for runtime constants
const (Constants) are variables whose values are set at compile time, either by the programmer or by the compiler... It cannot be modified there after, so if you need a field whose value is known at compile time and should not be changed anytime later then you should declare that field as const... Intersting note is that const fields are statis by default and so you do not need to instantiate a class to access them...
readonly (Read Only) are variables whose values are set at run time, but only once... The value of such variables are set in the constructors and cannot be modified there on... These variables are useful when you want the value of the variable to be fixed but fixed to a value which is known only at run time...
Now if you need a static variable whose value is known only at runtime then make it static readonly... :-)
Sudhir from TCS wanted to add the tip above below is his note:
Hi Vishal a little addition in yr Tip What is the difference between CONST and READONLY? Both are meant for constant values. A const field can only be initialized at the declaration of the field. A readonly field can be initialized either at the declaration or in a constructor. Therefore, readonly fields can have different values depending on the constructor used. readonly int b; public X() { b=1; } public X(string s) { b=5; } public X(string s, int i) { b=i; } Also, while a const field is a compile-time constant, the readonly field can be used for runtime constants
Thursday, July 15, 2004
VJs Tip Of The Day - July 15th 2004
MemberwiseClone Method Contd...
Well I got a couple of posts yesterday that if MemberwiseClone method does Shallow Copy, is there anything like Deep Copy... Well these are just terms, if you want the copy of the object also to have copy of all the object it references then we can say that its Deep Copy and to achieve Deep Copy we must implement ICloneable interface in our objects and do manual cloning... :-)
Well I got a couple of posts yesterday that if MemberwiseClone method does Shallow Copy, is there anything like Deep Copy... Well these are just terms, if you want the copy of the object also to have copy of all the object it references then we can say that its Deep Copy and to achieve Deep Copy we must implement ICloneable interface in our objects and do manual cloning... :-)
Wednesday, July 14, 2004
VJs Tip Of The Day - July 14th 2004
MemberwiseClone Method
MemberwiseClone Method is a protected method of the object class which all the types in .Net inherit (everthing inherits from Object!!)... This method returns an object and basically does a Shallow Copy of the object, i.e. copy of the object does not contain the copy of the objects it refrences....
MemberwiseClone Method is a protected method of the object class which all the types in .Net inherit (everthing inherits from Object!!)... This method returns an object and basically does a Shallow Copy of the object, i.e. copy of the object does not contain the copy of the objects it refrences....
Tuesday, July 13, 2004
VJs Tip Of The Day - July 13th 2004
Lazy Initialization
Lazy Initialization is an optimizing technique whereby some of a class's members are not initalized until they are needed...
This is in particular useful when you have class that contains members that are not used often and whose initalization might consume a lot of resources... Some examples would be accessing File System or network objects or databases...
Well you would be doing this already, now you know the technical term for it... :-)
Lazy Initialization is an optimizing technique whereby some of a class's members are not initalized until they are needed...
This is in particular useful when you have class that contains members that are not used often and whose initalization might consume a lot of resources... Some examples would be accessing File System or network objects or databases...
Well you would be doing this already, now you know the technical term for it... :-)
Monday, July 12, 2004
VJs Tip Of The Day - July 12th 2004
Code Pitching and EconoJITer
EconoJITer is one the three kindof JIT compilers available in .Net... It discards compiled code out of the memory to release some space when system is running on low memory...
EconoJIT compilation is the option which should be chosen when there is scarcity of memory like in case of small handheld devices like Pocket PC, PDA etc...
The process of releasing memory by discarding the already compiled code (from MSIL) is called as Code Pitching
EconoJITer is one the three kindof JIT compilers available in .Net... It discards compiled code out of the memory to release some space when system is running on low memory...
EconoJIT compilation is the option which should be chosen when there is scarcity of memory like in case of small handheld devices like Pocket PC, PDA etc...
The process of releasing memory by discarding the already compiled code (from MSIL) is called as Code Pitching
Friday, July 09, 2004
VJs Tip Of The Day - July 9th 2004
HelpProvider Class
HelpProvider Class in Windows form has a method SetHelpString()... This method will associate a string that you provide with the control specified... This help will be shown when the user presses F1 while the control has focus...
Example
Private objhelpProvider As System.Windows.Forms.HelpProvider
Me.objhelpProvider.SetHelpString(Me.txtZipCode, "Just enter the first 5 digits for Zip code, this applies to US only...")
Me.objhelpProvider.SetShowHelp(Me.txtZipCode, True)
HelpProvider Class in Windows form has a method SetHelpString()... This method will associate a string that you provide with the control specified... This help will be shown when the user presses F1 while the control has focus...
Example
Private objhelpProvider As System.Windows.Forms.HelpProvider
Me.objhelpProvider.SetHelpString(Me.txtZipCode, "Just enter the first 5 digits for Zip code, this applies to US only...")
Me.objhelpProvider.SetShowHelp(Me.txtZipCode, True)
Thursday, July 08, 2004
VJs Tip Of The Day - July 8th 2004
Application Domains Basics
Inter process communication is always painful... The memory pointer in one process many a times does not make a lot of sense in the other process... To tackle this problem and many others Application Domains are introduced in .Net... There can be more than one Application Domain running under the same process... Application Domain provides nearly equivalent level of isolation as would a separate process and at the same time saves the hits of cross-process communications... By having high isolation you can prevent failure of one application to affect other application...
Note: There is lot more to application domains and its a very interesting topic, do give it some time of yours it will be worthwhile..
Inter process communication is always painful... The memory pointer in one process many a times does not make a lot of sense in the other process... To tackle this problem and many others Application Domains are introduced in .Net... There can be more than one Application Domain running under the same process... Application Domain provides nearly equivalent level of isolation as would a separate process and at the same time saves the hits of cross-process communications... By having high isolation you can prevent failure of one application to affect other application...
Note: There is lot more to application domains and its a very interesting topic, do give it some time of yours it will be worthwhile..
Wednesday, July 07, 2004
VJs Tip Of The Day - July 7th 2004
DataGrid.ItemDataBound Event
The ItemDataBound event is raised after an item is data bound to the DataGrid control... This event provides you with the last opportunity to access the data item before it is displayed on the client. After this event is raised, the data item is nulled or no longer available...
You would land up using this event if you are making changes to the display of your data grid... Read more about the event and sample code in MSDN...
The ItemDataBound event is raised after an item is data bound to the DataGrid control... This event provides you with the last opportunity to access the data item before it is displayed on the client. After this event is raised, the data item is nulled or no longer available...
You would land up using this event if you are making changes to the display of your data grid... Read more about the event and sample code in MSDN...
Tuesday, July 06, 2004
VJs Tip Of The Day - July 6th 2004
To utilize the Add/Remove Programs feature in Control Panel, you must add a key to
the Registry under
HKEY_LOCAL_MACHINES\Software\Microsoft\Windows\CurrentVersion\Uninstall\UniqueName
where UniqueName will be any Unique name that you can use for your program identification
Note: Goto Start->Run = "Regedit" and browse to the location to see for yourself...
the Registry under
HKEY_LOCAL_MACHINES\Software\Microsoft\Windows\CurrentVersion\Uninstall\UniqueName
where UniqueName will be any Unique name that you can use for your program identification
Note: Goto Start->Run = "Regedit" and browse to the location to see for yourself...
Friday, July 02, 2004
VJs Tip Of The Day - July 2nd 2004
<pages> tag in web.config
<pages> element is located at the below defined position in web.config
<configuration>
<system.web>
<pages>
It contains a attribute called enableSessionState which specifies whether session state is enabled or not.
It can take following three values:
true - Indicates that session state is enabled.
false - Indicates that session state is not enabled.
ReadOnly - Specifies that an application can read but cannot modify session state variables.
<pages> element is located at the below defined position in web.config
<configuration>
<system.web>
<pages>
It contains a attribute called enableSessionState which specifies whether session state is enabled or not.
It can take following three values:
true - Indicates that session state is enabled.
false - Indicates that session state is not enabled.
ReadOnly - Specifies that an application can read but cannot modify session state variables.
Thursday, July 01, 2004
VJs Tip Of The Day - July 1st 2004
Split Functions in .Net
There are multiple Split functions available in .NET...
U can use System.String.Split if you need to split a string based on a collection
of specific characters. Each individual character is its own delimiter. Here there are chances of getting white spaces when you would not expect them to come...
Use System.Text.RegularExpressions.RegEx.Split to split based on some specific formats... You can use this in case the earlier one does not work for you...
At the end if you remember the good old days you can reference the Microsoft.VisualBasic assembly in your program and can use the Strings.Split function to split a string based on a word... The favorite way of VB6 programmer... :-)
There are multiple Split functions available in .NET...
U can use System.String.Split if you need to split a string based on a collection
of specific characters. Each individual character is its own delimiter. Here there are chances of getting white spaces when you would not expect them to come...
Use System.Text.RegularExpressions.RegEx.Split to split based on some specific formats... You can use this in case the earlier one does not work for you...
At the end if you remember the good old days you can reference the Microsoft.VisualBasic assembly in your program and can use the Strings.Split function to split a string based on a word... The favorite way of VB6 programmer... :-)
Just for my records -MCP ASP.Net
Today I used the free coupon, which all MVPs got last year to appear MCP exam... Microsoft wanted their MVPs to be certified... So I fulfilled their wish...
Became MCP in ASP.Net... :-)
PS: Wonder what's the use of the certifications, when such things never ever effect my pay package...
Became MCP in ASP.Net... :-)
PS: Wonder what's the use of the certifications, when such things never ever effect my pay package...
Wednesday, June 30, 2004
VJs Tip Of The Day - June 30th 2004
Installer for Globalization
If you have different versions of your web application built for different languages and you have seperate resource files for each language when you need to deploy your application according to the language settings of the server then in that case make an Installer that has Custom Action to install only location-specific files...
If you have different versions of your web application built for different languages and you have seperate resource files for each language when you need to deploy your application according to the language settings of the server then in that case make an Installer that has Custom Action to install only location-specific files...
Tuesday, June 29, 2004
VJs Tip Of The Day - June 29th 2004
allowOverride Attribute
If you have a common server where you are going to host your website and you do not want anyone to override your configuration settings after the site is deployed then within your web.config file, use <location> tag and set allowOverride attribute to false....
If you have a common server where you are going to host your website and you do not want anyone to override your configuration settings after the site is deployed then within your web.config file, use <location> tag and set allowOverride attribute to false....
Monday, June 28, 2004
VJs Tip Of The Day - June 28th 2004
Virtual/Abstract members of a class
Virtual or Abstract members of a class cannot be private... Well just think, if you make them private why would you make them virtual or abstract anyways...:-)
PS: This tip is suffering from "Case of Monday" syndrome... :-)
Virtual or Abstract members of a class cannot be private... Well just think, if you make them private why would you make them virtual or abstract anyways...:-)
PS: This tip is suffering from "Case of Monday" syndrome... :-)
Friday, June 25, 2004
VJs Tip Of The Day - June 25th 2004
Interface vs Abstract classes
For Abstract class one method of the class must have an abstract method that means, it may have concrete methods...
Various access modifiers such as abstract, protected, internal, public, virtual, overrides etc are not useful in case of Interface but they are in case of Abstract classes
Class implementing Interface has to implement all the methods of the Interface, this is not required in case of Abstract classes
Interfacescannot have constructors and destructors like the way Abstract classes can...
Interface cannot contain a static method whereas an Abstract class can have...
There are few more points which I can recollect but I think that this is enough for a tip... If anyone needs more info do write back to me... :-)
* pure virtual method is a method which has just definition but not implementation...
PS: Many of us work on weekends, I don't think (current thought!!) that its a good practice doing that, atleast if you are being guaged on the basis of your willingness to work on weekends then its surely very bad... I am trying to start a movememt to abolish this social evil of working on weekends, so no tips on weekends...:-)
BONUS TIP: Spend time with your family this weekend... :-)
For Abstract class one method of the class must have an abstract method that means, it may have concrete methods...
Various access modifiers such as abstract, protected, internal, public, virtual, overrides etc are not useful in case of Interface but they are in case of Abstract classes
Class implementing Interface has to implement all the methods of the Interface, this is not required in case of Abstract classes
Interfacescannot have constructors and destructors like the way Abstract classes can...
Interface cannot contain a static method whereas an Abstract class can have...
There are few more points which I can recollect but I think that this is enough for a tip... If anyone needs more info do write back to me... :-)
* pure virtual method is a method which has just definition but not implementation...
PS: Many of us work on weekends, I don't think (current thought!!) that its a good practice doing that, atleast if you are being guaged on the basis of your willingness to work on weekends then its surely very bad... I am trying to start a movememt to abolish this social evil of working on weekends, so no tips on weekends...:-)
BONUS TIP: Spend time with your family this weekend... :-)
Thursday, June 24, 2004
VJs Tip Of The Day - June 24th 2004
Call to Static Methods
You cannot call static method of a class using the object of the class*... You would have to call it using the Class name itself..
eg.You cannot call base class's static method using base.StaticMethod(); that shall result into an error...
the way you do it is:
//Class having Static Method
public class MyClass
{
public static string StaticMethod()
{
return "Vishal_Joshi@MVPs.org";
}
}
//Class using Static Method
public class ClientClass
{
public string GetHelpLineEmailId()
{
return MyClass.StaticMethod();
}
}
* This is applicable only to C# in case of VB.Net you can access static methods even using the object of the class... (This is what happens to a C# fan.... Thanks to Jacob Cynamon, MS and Kathleen Dollard, MVP for reminding... )
You cannot call static method of a class using the object of the class*... You would have to call it using the Class name itself..
eg.You cannot call base class's static method using base.StaticMethod(); that shall result into an error...
the way you do it is:
//Class having Static Method
public class MyClass
{
public static string StaticMethod()
{
return "Vishal_Joshi@MVPs.org";
}
}
//Class using Static Method
public class ClientClass
{
public string GetHelpLineEmailId()
{
return MyClass.StaticMethod();
}
}
* This is applicable only to C# in case of VB.Net you can access static methods even using the object of the class... (This is what happens to a C# fan.... Thanks to Jacob Cynamon, MS and Kathleen Dollard, MVP for reminding... )
Wednesday, June 23, 2004
VJs Tip Of The Day - June 23rd 2004
Static Members of a class
A static member of a class can be accessed without creating an instance of the class... Everyone knows this right!! so what next...??
A static member cannot be marked as abstract or virtual, trying to do so will result into an error...
Inside a static member you cannot call any non-static member, trying to do so will also result in an error...
A static member of a class can be accessed without creating an instance of the class... Everyone knows this right!! so what next...??
A static member cannot be marked as abstract or virtual, trying to do so will result into an error...
Inside a static member you cannot call any non-static member, trying to do so will also result in an error...
Tuesday, June 22, 2004
VJs Tip Of The Day - June 22nd 2004
@Page directive
@Page directive of ASP.Net Page in visual studio accepts only fully qualified name for "Inherits" attribute whereas giving just the required cs file name for "Codebehind" attribute is good enough...
eg < %@ Page language="c#" Codebehind="UnExpectedError.aspx.cs" AutoEventWireup="false" Inherits="SubtleEye.Administration.UnExpectedError" % >
@Page directive of ASP.Net Page in visual studio accepts only fully qualified name for "Inherits" attribute whereas giving just the required cs file name for "Codebehind" attribute is good enough...
eg < %@ Page language="c#" Codebehind="UnExpectedError.aspx.cs" AutoEventWireup="false" Inherits="SubtleEye.Administration.UnExpectedError" % >
Monday, June 21, 2004
VJs Tip Of The Day - June 21st 2004
Redirecting to Default Error Html in case of Error
You might have many errors handled in your application but still there would be few of them always left out, so what's the solution??... Well here it is... Go and do the setting in the web.config file of your web application...
< customErrors defaultRedirect="UrProblemUnknownError.htm" mode="RemoteOnly" >
< error statusCode="404" redirect = "MyProblemServerNotFound.htm"/>
< /customErrors >
Now interesting fact is in conjunction to our previous tip on "SmartNavigation"... In case of pages for which you allow SmartNavigation the defaultRedirect does not work and Microsoft has confirmed it to be a bug... At the same time there is a work around...
Change your page directive a little bit when you use "SmartNavigation" as follows
< %@Page Language="C#" smartNavigation="True" ErrorPage="UrProblemUnknownError.htm" %>
The ErrorPage here will help you in that scenario... Don't ask me why so, You should not ask embarrassing questions... :-)
PS: I celebrate Mother's day today as it's my mom's birthday today... Happy Mother's Day!!
You might have many errors handled in your application but still there would be few of them always left out, so what's the solution??... Well here it is... Go and do the setting in the web.config file of your web application...
< customErrors defaultRedirect="UrProblemUnknownError.htm" mode="RemoteOnly" >
< error statusCode="404" redirect = "MyProblemServerNotFound.htm"/>
< /customErrors >
Now interesting fact is in conjunction to our previous tip on "SmartNavigation"... In case of pages for which you allow SmartNavigation the defaultRedirect does not work and Microsoft has confirmed it to be a bug... At the same time there is a work around...
Change your page directive a little bit when you use "SmartNavigation" as follows
< %@Page Language="C#" smartNavigation="True" ErrorPage="UrProblemUnknownError.htm" %>
The ErrorPage here will help you in that scenario... Don't ask me why so, You should not ask embarrassing questions... :-)
PS: I celebrate Mother's day today as it's my mom's birthday today... Happy Mother's Day!!
Thursday, June 17, 2004
VJs Tip Of The Day - June 17th 2004
Smart Navigation
"SmartNavigation" is a boolean property which can be set in the page's code behind or in the @page directive... This property is really helpful in case you want to enhance user experience... Set this property to true and you will get following advantages in navigation if your browser is IE 5.5 and above...
1.) Maintaining the scroll bar position (useful in long length pages)
2.) Set focus to the same control on which it was before navigation (useful in pages with lots of controls)
3.) saving last page state in the browser history (useful when a page does not changes considerably across frequent postbacks... eg chaning control values on change of dates in calendar control)
4.) The flash effect caused during navigation (useful when your page is pretty heavy to load)
"SmartNavigation" is a boolean property which can be set in the page's code behind or in the @page directive... This property is really helpful in case you want to enhance user experience... Set this property to true and you will get following advantages in navigation if your browser is IE 5.5 and above...
1.) Maintaining the scroll bar position (useful in long length pages)
2.) Set focus to the same control on which it was before navigation (useful in pages with lots of controls)
3.) saving last page state in the browser history (useful when a page does not changes considerably across frequent postbacks... eg chaning control values on change of dates in calendar control)
4.) The flash effect caused during navigation (useful when your page is pretty heavy to load)
Wednesday, June 16, 2004
VJs Tip Of The Day - June 16th 2004
Our Simple Response.Redirect method
Whenever Response.Redirect line is executed the browser gets a HTTP staus code of 302 from the server indicating it to GET/POST again to the new URL provided... This means that the page does one more round trip to the server with different URL... Most of the browser use GET request to comply with HTTP standards and if they use POST then they would have to prompt the user for permission... In anycase there is a performance hit of posting twice... Most of the cases it is not visible to the user...
If you are very high on performance then use Server.Transfer instead... Also note that your form variables are not available in the next page in case of Response.Redirect; in case of Server.Transfer the data submitted by the user is preserved...
Well I think this is long enough for a tip, so rest of the info I will include in a small article...
Whenever Response.Redirect line is executed the browser gets a HTTP staus code of 302 from the server indicating it to GET/POST again to the new URL provided... This means that the page does one more round trip to the server with different URL... Most of the browser use GET request to comply with HTTP standards and if they use POST then they would have to prompt the user for permission... In anycase there is a performance hit of posting twice... Most of the cases it is not visible to the user...
If you are very high on performance then use Server.Transfer instead... Also note that your form variables are not available in the next page in case of Response.Redirect; in case of Server.Transfer the data submitted by the user is preserved...
Well I think this is long enough for a tip, so rest of the info I will include in a small article...
Tuesday, June 15, 2004
VJs Tip Of The Day - June 15th 2004
AlternateText Property
"AlternateText" property in the Image control is for narrator to read when a disabled person is trying to access the page via Narrator... Remember this when you are trying to develop an application for disabled people as well...
"AlternateText" property in the Image control is for narrator to read when a disabled person is trying to access the page via Narrator... Remember this when you are trying to develop an application for disabled people as well...
Thursday, May 27, 2004
Difference between Application Variables and Session Variables
-----Original Message-----
From: Vishal Joshi
Sent: Thursday, May 27, 2004 1:54 PM
To: Rakesh Ambudkar
Subject: RE: What does this mean
I presume that there are 2 types of variables in the discussion below:
Session
Application
Application variables are the variables which remain common for the whole application… Their value can be used across the whole application… And they die only when the application stops or probably when they are killed forcibily… The ideal example for these kindof variables are site counter… We can find out how many people accessed a particular site since the time it went live via application variables and incrementing the same on ever session start..
Session variables are variables which remain common for the whole application but for one particular user. They also can be used across the whole application… But they die when a particular user session ends or probably when they are killed forcibily… The ideal example for this kindof variable are user id… You might want to show "Welcome Vishal" on every page of your site till vishal logs off… So in session start you set a variable to "Welcome Vishal" and kill it on session end…
All these methods like session start, session end, application start, application end are found in global.asax and that’s the reason global.asax is one for the whole ASP.Net application…
I hope this provides you with the info that you needed…
Warm regards,
Vishal Joshi
Ph#: +1-309-763-2242.
If You Think YOU CAN.. You Can...
-----Original Message-----
From: Rakesh Ambudkar
Sent: Thursday, May 27, 2004 12:57 PM
To: Vishal Joshi
Subject: What does this mean
If you use objects with Application scope ,you should be aware that ASP.NET process request concurrently and the applicationobject can be accessed by multiple threads. Therefore following is dagerous and may not produce the desired result ,if the page is repeatedly requested by different clients at the same time.
Thanks
____________________________
Rakesh Ambudkar
From: Vishal Joshi
Sent: Thursday, May 27, 2004 1:54 PM
To: Rakesh Ambudkar
Subject: RE: What does this mean
I presume that there are 2 types of variables in the discussion below:
Session
Application
Application variables are the variables which remain common for the whole application… Their value can be used across the whole application… And they die only when the application stops or probably when they are killed forcibily… The ideal example for these kindof variables are site counter… We can find out how many people accessed a particular site since the time it went live via application variables and incrementing the same on ever session start..
Session variables are variables which remain common for the whole application but for one particular user. They also can be used across the whole application… But they die when a particular user session ends or probably when they are killed forcibily… The ideal example for this kindof variable are user id… You might want to show "Welcome Vishal" on every page of your site till vishal logs off… So in session start you set a variable to "Welcome Vishal" and kill it on session end…
All these methods like session start, session end, application start, application end are found in global.asax and that’s the reason global.asax is one for the whole ASP.Net application…
I hope this provides you with the info that you needed…
Warm regards,
Vishal Joshi
Ph#: +1-309-763-2242.
If You Think YOU CAN.. You Can...
-----Original Message-----
From: Rakesh Ambudkar
Sent: Thursday, May 27, 2004 12:57 PM
To: Vishal Joshi
Subject: What does this mean
If you use objects with Application scope ,you should be aware that ASP.NET process request concurrently and the applicationobject can be accessed by multiple threads. Therefore following is dagerous and may not produce the desired result ,if the page is repeatedly requested by different clients at the same time.
Thanks
____________________________
Rakesh Ambudkar
Friday, April 30, 2004
Ever Thought of Triggering an IMS Transaction from MSMQ Message in VB
Well wondering how I am writing anything else than .Net... Btw, I also work on Asynchrounous Architecture a lot nowdays and thats another area which I have started liking other than .Net...
To tell you the truth we have figured out a way of triggering IMS Transaction by sending a MSMQ Message from VB6, if this gets you interested, drop me an email at Vishal_Joshi@MVPs.org and I shall write to you back about it... Meanwhile I am intending to compile a nice KB article on that...
To tell you the truth we have figured out a way of triggering IMS Transaction by sending a MSMQ Message from VB6, if this gets you interested, drop me an email at Vishal_Joshi@MVPs.org and I shall write to you back about it... Meanwhile I am intending to compile a nice KB article on that...
Wednesday, April 28, 2004
10 THINGS "YOU SHOULD KNOW" WHEN UPGRADING TO VS.Net 2003 & .NET FRAMEWORK V1.1
The answer to the below question might be something which would probably hit the bull's eye.. :-)
What promts me to write a column on this topic ?
A friend of mine has a big web application built in Visual Studio .Net 2002... Needless to say after a long a difficult process they finish their round of testing and launch their application to production... Now the enterprise decides to upgrade their software and get Visual Studio .Net 2003, which as appearing everywhere is better in all the perspective than VS.Net 2002... Well, accepted but now here we have a healthy running project, relatively large one, already in production we do not want to fiddle around with it... But the service team of this application get their new machines with VS.Net 2003 installed and here is where the problem starts... And here are the considerations that I would like to put forward for folks who are in similar situations...
10 THINGS "YOU SHOULD KNOW" WHEN UPGRADING TO VS.Net 2003 & .NET FRAMEWORK V1.1
1.) You should know that Visual Studio .Net 2002 targets .Net Framework Version 1.0
2.) You should know that Visual Studio .Net 2003 targets .Net Framework Version 1.1... Framework Version 1.1 has lots of enhancements over 1.0 so definitely the change is for good...
3.) You should know that if you open an application created in VS.Net 2002 in VS.Net 2003, it will prompt for the conversion or if application is recompiled in VS.Net 2003 it will start targetting .Net Framework 1.1...
4.) You should know that if you do not recompile application will continue targetting .Net Framework 1.0, but then if you are servicing the application made in VS.Net 2002, you expect it to change in some way right!!... And if you change it to recompile, :-) refer point 3.)
5.)You should know that sometimes its big deal about targetting .Net Framework Version 1.1 for applications which were built in 1.0... well, its a big deal sometimes coz there are changes in the latest Framework version as compared to earlier... Many of the method signatures are obselete now and just to catch your attention few of them are listed below...
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemDataCommonDbDataAdapterClassICloneableCloneTopic.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemDataOleDbOleDbPermissionClassctorTopic1.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemDataSqlClientSqlClientPermissionClassctorTopic1.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWebUIObjectConverterClassctorTopic.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatacommondataadapterclasscloneinternalstopic.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemnetipaddressclassaddresstopic.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWebUIObjectConverterClassConvertValueTopic.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemDataOdbcOdbcPermissionClassctorTopic1.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWebServicesProtocolsSoapHeaderAttributeClassRequiredTopic.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemxmlxslxsltransformclassloadtopic7.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemxmlxslxsltransformclasstransformtopic1.asp
Now what about the applications which have been using the stuff that's obselete now... Think whether you want to use the latest version and upgrade your code or use old version and live as you are living...
6.) You should know that if you use VS.Net 2003 to open your project once and save it, it cannot be reopened in VS.Net 2002... Well ofcourse no one should expect back-ward compatibility, but you should be aware of certain things before hand right!!
7.) You should also know that both the .Net Framework versions can run side by side and you can configure which application targets which Framework version... If you think I should write a column on that configuration and way to do it then drop me a mail at Vishal_Joshi@MVPs.org
8.) You should also know that both Visual Studio .Net 2002 and Visual Studio .Net 2003 can exist side by side on the same machine as well... Even Whidbey can still co-exist with those two... But mind you don't try it... I tried doing all those things and some supernatural powers made all my applications stop working, finally I did what a frustrated developer does, i.e. uninstall everything and install only VS.Net 2002 with .Net Framework 1.0... Well this is just Vishal Joshi, I did everything possible and nothing worked out, you may try might be you do it right!!
9.) You should know that if .Net Framework V1.1 is installed on your machine ASP.Net and Web Services will automatically target .Net Framework V1.1 unless otherwise configured... A gentleman called Denis Bauer developed a utility called ASP.Net Version switcher, which is available free for download... This utility is really useful at times to switch the Framework version your ASP.Net application is targetting and if you need to get it Click Here... Well you can do this configuration manually as well but aren't we moving towards automation :-)
10.) You should know that rest of the applications made in any Version will run with the version they were made to target, unless they are configured otherwise... As mentioned earlier applications built to taget V1.1 will not work on V1.0 (disclaimer: unless otherwise designed & configured)
Feel free to write in your comments to me at Vishal_Joshi@MVPs.org... I am ready to make the title "More than 10 Things you should know when upgrading to VS.Net 2003 and .Net Framework V1.1"
Should I copyright this??? Just kidding!!
What promts me to write a column on this topic ?
A friend of mine has a big web application built in Visual Studio .Net 2002... Needless to say after a long a difficult process they finish their round of testing and launch their application to production... Now the enterprise decides to upgrade their software and get Visual Studio .Net 2003, which as appearing everywhere is better in all the perspective than VS.Net 2002... Well, accepted but now here we have a healthy running project, relatively large one, already in production we do not want to fiddle around with it... But the service team of this application get their new machines with VS.Net 2003 installed and here is where the problem starts... And here are the considerations that I would like to put forward for folks who are in similar situations...
10 THINGS "YOU SHOULD KNOW" WHEN UPGRADING TO VS.Net 2003 & .NET FRAMEWORK V1.1
1.) You should know that Visual Studio .Net 2002 targets .Net Framework Version 1.0
2.) You should know that Visual Studio .Net 2003 targets .Net Framework Version 1.1... Framework Version 1.1 has lots of enhancements over 1.0 so definitely the change is for good...
3.) You should know that if you open an application created in VS.Net 2002 in VS.Net 2003, it will prompt for the conversion or if application is recompiled in VS.Net 2003 it will start targetting .Net Framework 1.1...
4.) You should know that if you do not recompile application will continue targetting .Net Framework 1.0, but then if you are servicing the application made in VS.Net 2002, you expect it to change in some way right!!... And if you change it to recompile, :-) refer point 3.)
5.)You should know that sometimes its big deal about targetting .Net Framework Version 1.1 for applications which were built in 1.0... well, its a big deal sometimes coz there are changes in the latest Framework version as compared to earlier... Many of the method signatures are obselete now and just to catch your attention few of them are listed below...
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemDataCommonDbDataAdapterClassICloneableCloneTopic.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemDataOleDbOleDbPermissionClassctorTopic1.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemDataSqlClientSqlClientPermissionClassctorTopic1.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWebUIObjectConverterClassctorTopic.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatacommondataadapterclasscloneinternalstopic.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemnetipaddressclassaddresstopic.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWebUIObjectConverterClassConvertValueTopic.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemDataOdbcOdbcPermissionClassctorTopic1.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWebServicesProtocolsSoapHeaderAttributeClassRequiredTopic.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemxmlxslxsltransformclassloadtopic7.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemxmlxslxsltransformclasstransformtopic1.asp
Now what about the applications which have been using the stuff that's obselete now... Think whether you want to use the latest version and upgrade your code or use old version and live as you are living...
6.) You should know that if you use VS.Net 2003 to open your project once and save it, it cannot be reopened in VS.Net 2002... Well ofcourse no one should expect back-ward compatibility, but you should be aware of certain things before hand right!!
7.) You should also know that both the .Net Framework versions can run side by side and you can configure which application targets which Framework version... If you think I should write a column on that configuration and way to do it then drop me a mail at Vishal_Joshi@MVPs.org
8.) You should also know that both Visual Studio .Net 2002 and Visual Studio .Net 2003 can exist side by side on the same machine as well... Even Whidbey can still co-exist with those two... But mind you don't try it... I tried doing all those things and some supernatural powers made all my applications stop working, finally I did what a frustrated developer does, i.e. uninstall everything and install only VS.Net 2002 with .Net Framework 1.0... Well this is just Vishal Joshi, I did everything possible and nothing worked out, you may try might be you do it right!!
9.) You should know that if .Net Framework V1.1 is installed on your machine ASP.Net and Web Services will automatically target .Net Framework V1.1 unless otherwise configured... A gentleman called Denis Bauer developed a utility called ASP.Net Version switcher, which is available free for download... This utility is really useful at times to switch the Framework version your ASP.Net application is targetting and if you need to get it Click Here... Well you can do this configuration manually as well but aren't we moving towards automation :-)
10.) You should know that rest of the applications made in any Version will run with the version they were made to target, unless they are configured otherwise... As mentioned earlier applications built to taget V1.1 will not work on V1.0 (disclaimer: unless otherwise designed & configured)
Feel free to write in your comments to me at Vishal_Joshi@MVPs.org... I am ready to make the title "More than 10 Things you should know when upgrading to VS.Net 2003 and .Net Framework V1.1"
Should I copyright this??? Just kidding!!
Wednesday, April 14, 2004
Creating COM Callable Wrapper (CCW)
Query on using .Net components in VB6
-----Original Message-----
From: Anup Ganji
Sent: Wednesday, April 14, 2004 10:05 AM
To: Vishal Joshi
Subject: Help Required!!
Hi Vishal!
I request for a small help from you, for which I would be talking some time of your's.
A friend of mine is facing a problem in accessing a dot net (C#) coded component in VB6.0, I heard that if could come up with a wrapper around the dot net coded component you can access it from lower versions.
Waiting for more inputs from you.
Thanks,
Anup
A Quick Solution
-----Original Message-----
From: Vishal Joshi
Sent: Wednesday, April 14, 2004 10:33 AM
To: Anup Ganji
Subject: RE: Help Required!!
Hi Anup,
It is very true that by making minor changes to C# component it can be made visible to com components… There are certain attributes and steps that we need to follow for this…. These attribute informs the CLR to generate CCW(Com Callable Wrapper) which creates the Interface by which VB6 components can call C# components…
Its been long time since I wrote such component but the basic steps should be as follows…
In you C# component use using System.Runtime.InteropServices;
Now we need to create a interface with the same name as your .Net class only with "_" in the beginning… Precisely speaking in this interface you will write only those methods which have to be exposed out of your .Net component
Eg
using System.Runtime.InteropServices;
using System;
namespace SameAsClassesNamespace
{
[Guid("use GUIDGen.exe to create GUID for urself")]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface _MyNetComponent
{
//ur method signatures will come here
}
}
Remember the attribute InterfaceType is important here as it tells which kindof ComInterface is required…
Now in your class following are the modifications to be made…
using System.Runtime.InteropServices;
using System;
namespace SameAsClassesNamespace
{
[Guid("use GUIDGen.exe to create GUID for urself")]
[ClassInterface(ClassInterfaceType.None)]
[ProgId("SameAsClassesNamespace.MyNetComponent")]
public class MyNetComponent : _MyNetComponent
{
//ur method definition will come here
}
}
Now go to project properties --> Configuration Properties and set last two properties (Register for Com Interop & Create Debug information) to true… Well this can be done manually but no big reason to go about doing it… {Find out more about Regasm.exe, sn.exe, gacutil.exe if you are interested in doing it manually, but better don't…}
Now as you compile your component should be visible to COM… And ofcourse you know the ProgId above to use your component...
Enjoy!!
Warm regards,
Vishal Joshi
Ph#: +1-309-763-2242.
If You Think YOU CAN.. You Can...
-----Original Message-----
From: Anup Ganji
Sent: Wednesday, April 14, 2004 10:05 AM
To: Vishal Joshi
Subject: Help Required!!
Hi Vishal!
I request for a small help from you, for which I would be talking some time of your's.
A friend of mine is facing a problem in accessing a dot net (C#) coded component in VB6.0, I heard that if could come up with a wrapper around the dot net coded component you can access it from lower versions.
Waiting for more inputs from you.
Thanks,
Anup
A Quick Solution
-----Original Message-----
From: Vishal Joshi
Sent: Wednesday, April 14, 2004 10:33 AM
To: Anup Ganji
Subject: RE: Help Required!!
Hi Anup,
It is very true that by making minor changes to C# component it can be made visible to com components… There are certain attributes and steps that we need to follow for this…. These attribute informs the CLR to generate CCW(Com Callable Wrapper) which creates the Interface by which VB6 components can call C# components…
Its been long time since I wrote such component but the basic steps should be as follows…
In you C# component use using System.Runtime.InteropServices;
Now we need to create a interface with the same name as your .Net class only with "_" in the beginning… Precisely speaking in this interface you will write only those methods which have to be exposed out of your .Net component
Eg
using System.Runtime.InteropServices;
using System;
namespace SameAsClassesNamespace
{
[Guid("use GUIDGen.exe to create GUID for urself")]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface _MyNetComponent
{
//ur method signatures will come here
}
}
Remember the attribute InterfaceType is important here as it tells which kindof ComInterface is required…
Now in your class following are the modifications to be made…
using System.Runtime.InteropServices;
using System;
namespace SameAsClassesNamespace
{
[Guid("use GUIDGen.exe to create GUID for urself")]
[ClassInterface(ClassInterfaceType.None)]
[ProgId("SameAsClassesNamespace.MyNetComponent")]
public class MyNetComponent : _MyNetComponent
{
//ur method definition will come here
}
}
Now go to project properties --> Configuration Properties and set last two properties (Register for Com Interop & Create Debug information) to true… Well this can be done manually but no big reason to go about doing it… {Find out more about Regasm.exe, sn.exe, gacutil.exe if you are interested in doing it manually, but better don't…}
Now as you compile your component should be visible to COM… And ofcourse you know the ProgId above to use your component...
Enjoy!!
Warm regards,
Vishal Joshi
Ph#: +1-309-763-2242.
If You Think YOU CAN.. You Can...
Thursday, April 08, 2004
A Quick Tip on long length URLs
You must have faced problems about line wraps when you send a really long URL... Well, might be many of you know this but just FYI...
When a URL is pretty long and you need to send it in an email or paste in in a word doc, all you need to do is to put a start the url with "<" and end with ">"... Everything included within these operators will be considered as a single URL...
When a URL is pretty long and you need to send it in an email or paste in in a word doc, all you need to do is to put a start the url with "<" and end with ">"... Everything included within these operators will be considered as a single URL...
Monday, April 05, 2004
MVP Global Summit 2004 - A Melting Pot
MVP Global summit going on from 3rd April 2004 to 7th April 2004 is truely a melting pot of different thoughts and same passion - Microsoft Technologies...
Just in two days I have met people from more than 20 different countries and all of them were such amazing guys/gals...
I am just coming after attending a session by Don Box and Chris Anderson, and there are no words to express how you feel listing technology from the guys who make it...
I am overwhelmed thats all I can say... More on MVP Global Summit to come...
Just in two days I have met people from more than 20 different countries and all of them were such amazing guys/gals...
I am just coming after attending a session by Don Box and Chris Anderson, and there are no words to express how you feel listing technology from the guys who make it...
I am overwhelmed thats all I can say... More on MVP Global Summit to come...
Wednesday, March 31, 2004
My New Suggestions to Microsoft:
After listning to my clients complains and people who talk to me about Microsoft Technologies, I felt I can suggest some punch lines to Microsoft... I will take royalties if MS starts using them :-)
"With Microsoft: You are always Obselete"
and
"Learning is a Life Long Process: If you don't believe, here's our NEXT UPDATED VERSION"
Well, I am really passionate about Microsoft Technologies and I understand that the changes are for good, but our clients demand stability and their primary aim is buisness not upgrading to latest technologies always... Being a MVP I feel its important to let MS know about this serious concern that comes up to us everytime...
"With Microsoft: You are always Obselete"
and
"Learning is a Life Long Process: If you don't believe, here's our NEXT UPDATED VERSION"
Well, I am really passionate about Microsoft Technologies and I understand that the changes are for good, but our clients demand stability and their primary aim is buisness not upgrading to latest technologies always... Being a MVP I feel its important to let MS know about this serious concern that comes up to us everytime...
Secure you SQL Server
This is a note is for SQL Server Administrators... Read further to see if your SQL Server is vulnerable...
As you must be aware that by default SQL server opens port 1433 to the internet when services are installed... And ofcourse the celebrated "sa" account with all rights and no password is world famous... :-) The SPIDA worm took advantage of these two things and made TCP/IP hits on various IP addresses on the internet... Ofcourse, it was bound to find one or another IP who had its 1433 port open and SQL Server "sa" account having password blank... That was it, a silly mistake and what all can happen is to our imagination... Though some of the things worth noting are that the worm deletes certain fields and tries similar other IPs... There can be no end to this...
Also it changes the password to 4 characters, which are ofcourse sent to the hacker and adds guest account into the adminstrator group... You can now imagine what else can happen to your system...
As you must be aware that by default SQL server opens port 1433 to the internet when services are installed... And ofcourse the celebrated "sa" account with all rights and no password is world famous... :-) The SPIDA worm took advantage of these two things and made TCP/IP hits on various IP addresses on the internet... Ofcourse, it was bound to find one or another IP who had its 1433 port open and SQL Server "sa" account having password blank... That was it, a silly mistake and what all can happen is to our imagination... Though some of the things worth noting are that the worm deletes certain fields and tries similar other IPs... There can be no end to this...
Also it changes the password to 4 characters, which are ofcourse sent to the hacker and adds guest account into the adminstrator group... You can now imagine what else can happen to your system...
Wednesday, March 24, 2004
Bloomington, IL gets a MSDN Event
Blooomington, IL which is the headquarter of State Farm Insurance (one of the largest insurance companies of US), head quarters of Country Insurance, houses Illinois State University (ISU), Illinois Wesleyan University - finally gets due importance and has a MSDN event...
The event is being conducted at a local hotel (Radisson) and is scheduled to run from 1 pm to 5 pm on March 24th 2004... The topic of the discussion will be "Security Briefings"... You can register for the event @ http://www.microsoft.com/seminar/events/inperson/default.mspx ... I am hopeful that more such events would be conducted in the future...
I shall be trying that .Net Bloomington User Group (.Net- BUG) gets involved in the activities and gets support from Microsoft for conducting similar events in the future...
The event is being conducted at a local hotel (Radisson) and is scheduled to run from 1 pm to 5 pm on March 24th 2004... The topic of the discussion will be "Security Briefings"... You can register for the event @ http://www.microsoft.com/seminar/events/inperson/default.mspx ... I am hopeful that more such events would be conducted in the future...
I shall be trying that .Net Bloomington User Group (.Net- BUG) gets involved in the activities and gets support from Microsoft for conducting similar events in the future...
Saturday, February 21, 2004
Adding your Assembly in GAC + Making it VS.Net Visible
I just wanted to update you all about some useful information:
You can assume these to be my quick and dirty notes... I am gonna now explain you the process of having a .Net assembly put in GAC and then making it GAC visible...
1.) To put your assembly into GAC you need to have it strong named.... So first step is to go and create a key using the strong name exe of Visual Studio tools.... Go to Visual studio tools and open the command prompt.... Next step is type "sn -k
2.) By doing this you will get a key file on your machine... You now need to bind it with your assembly... Note that the key file in normal scenario will have a "lock" as icon...
3.) Go to assemblyinfo file of your class library (or whatever :-)) and give the path of your this key file in AsemblyKeyFile ibute eg. [assembly: AssemblyKeyFile("C:\\delete\\ClassLibrary1\\bin\\Debug\\somekeyfile.snk")]... Remember ideally you should give a relative path here...
4.) Now again go to VS commond prompt and run gacutil... GacUtil is present in "root directory\Windows\Microsoft .Net\Framework\ the version that you work on" folder... Give the complete path while you run Gacutil... use the switch as "/i"... Now run the Gacutil and your assembly will get entered in the GAC....
5.) Alternatively a simple solution is copying your strong named dll directly in Windows\Assembly, but I feel acedamically you should know about Gacutil too...
6.) Now even after doing all this and having your assembly in GAC you shall not be able to see it when you try to open add referenes... For that there is another trick... See the point is Add Reference is a IDE specific stuff and so you need to alter those setting... for that reason you need to create certain keys in the Registry
7.)To display your assembly in the Add Reference dialog box, you can add a registry key, such as the following, which points to the location of the assembly
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\.NETFramework\AssemblyFolders\Debug]@="C:\\MyProjects\\ClassLibrary1\\Bin\\Debug\\" where Debug is nothing but the name of the folder in which the assemblies resides. You will not file any enteries here in case you have never tempered this area... so create this whole structure in the registry... You can create these registry entries under the HKEY_LOCAL_MACHINE root key also. This will change the setting for all of the users on the system. If you create this registry entry under HKEY_CURRENT_USER, this entry will affect the setting for only the current user. Inshort if you want anyone logging the machine is able to see your assembly in the Add References section make the key under HLM or else make it under HCU... When you then next time restart VS.Net you shall be able to find your assembly....
I shall polish this scribbled notes sometimes, but currently it gives sufficient info right!!
So Enjoy!!
You can assume these to be my quick and dirty notes... I am gonna now explain you the process of having a .Net assembly put in GAC and then making it GAC visible...
1.) To put your assembly into GAC you need to have it strong named.... So first step is to go and create a key using the strong name exe of Visual Studio tools.... Go to Visual studio tools and open the command prompt.... Next step is type "sn -k
2.) By doing this you will get a key file on your machine... You now need to bind it with your assembly... Note that the key file in normal scenario will have a "lock" as icon...
3.) Go to assemblyinfo file of your class library (or whatever :-)) and give the path of your this key file in AsemblyKeyFile ibute eg. [assembly: AssemblyKeyFile("C:\\delete\\ClassLibrary1\\bin\\Debug\\somekeyfile.snk")]... Remember ideally you should give a relative path here...
4.) Now again go to VS commond prompt and run gacutil... GacUtil is present in "root directory\Windows\Microsoft .Net\Framework\ the version that you work on" folder... Give the complete path while you run Gacutil... use the switch as "/i
5.) Alternatively a simple solution is copying your strong named dll directly in Windows\Assembly, but I feel acedamically you should know about Gacutil too...
6.) Now even after doing all this and having your assembly in GAC you shall not be able to see it when you try to open add referenes... For that there is another trick... See the point is Add Reference is a IDE specific stuff and so you need to alter those setting... for that reason you need to create certain keys in the Registry
7.)To display your assembly in the Add Reference dialog box, you can add a registry key, such as the following, which points to the location of the assembly
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\.NETFramework\AssemblyFolders\Debug]@="C:\\MyProjects\\ClassLibrary1\\Bin\\Debug\\" where Debug is nothing but the name of the folder in which the assemblies resides. You will not file any enteries here in case you have never tempered this area... so create this whole structure in the registry... You can create these registry entries under the HKEY_LOCAL_MACHINE root key also. This will change the setting for all of the users on the system. If you create this registry entry under HKEY_CURRENT_USER, this entry will affect the setting for only the current user. Inshort if you want anyone logging the machine is able to see your assembly in the Add References section make the key under HLM or else make it under HCU... When you then next time restart VS.Net you shall be able to find your assembly....
I shall polish this scribbled notes sometimes, but currently it gives sufficient info right!!
So Enjoy!!
Monday, January 26, 2004
MVP Regional Summit, Chicago
On 17th January 2004 there was a MVP Regional Summit in Chicago... Around 30+ MVPs from across US had come down for this event which happened in 'W' Central Chicago Hotel, Chicago...
MVP Summits have recently started occurring in US and the main agenda of the same was interaction between Microsoft Team, which is dedicated to community and Microsoft MVPs who too are closely associated with community...
Lots of the stuff that happened in the summit is covered under Non-Disclosure Agreement (NDA) of Microsoft with MVPs so I shall not be able to write much but still I shall jot down some salient points of the summit which are outside the perview of NDA...
Well!! quite a few celebrated people had come down from Microsoft for the summit, to name a few of them would be Sean O'Driscoll, Director, MVP & Community; Ricardo Wanger, Regional Manager USA; Mike Hernandez, VSTO Team; Emily Freet, Program Manager, Academic Communities; Ben Miller, MVP Lead ASP.Net; Jacob Cynamon, Developer Community; Vinny Pasceri, Longhorn Team; Martin Holladay, ADS Team; Brad Rhodes, Yuknon Team; Mike Sampson, Office MVP Lead; Brian Boston, Windows Client MVP Lead
John Buscher, Windows Server MVP Lead & also "The Host" of the Summit; And Susan Leiter, MVP Program Event Coordinator... (Thanks Brain for filing up the list... !!)
The major technical sessions which happened were:
1.) Session on Automated Deployment Services (ADS) by Martin Holladay
2.) Session on Windows Roadmap & Longhorn by Vinny Pasceri
3.) Session on Visual Studio Tools for Office by Mike Hernandez
4.) Session on Data Story for Whidbey by Brad Rhodes
A believe me all the above sessions were very useful... I could not relate to ADS a lot as its not my area but I am sure that those who were related must have found it pretty useful... About the next three sessions, I had heard about longhorn and Yukon a lot earlier in TechEds and other Microsoft Events in India but here it was much free environment, you see the best analogy would be a college class and a personal tution :-)
But the VSTO part was the most catchy to me... I nearly feel in love with that product and would love to work in something like that, to enhance it to its best and make it a favorite product of many... I surely suggest you to read about it wherever possible... I would had filled up the whole blog with info about it but ususal MS stuff THE NDA... :-) Anyways, sometime soon when it will be worth mentioning I definitely shall...
Now about the best times of the meet... The fun part... We had a nice lunch discussion with Sean & Ricardo, where we talked about the MVP Program, the way it is and the way it should be etc... It was really nice to learn that Sean and Ricardo were actually in a very receptive mode... When it comes to technology I can relate what will fall into NDA and what will not, in such informal discussions its nearly impossible to predict so I better not tell more... India MVPs if you want to know more do drop in a mail and I shall write specially to you, but in short it was a nice long close to 2+ hours session...
We also had a nice social evening where all of us could get together and have some good time... Wish I could upload pictures on my blog...
I also met with Jacob Cynamon from Developer Community... got really pally with him, hope we shall work closely in the time to come and do something useful... Got an oppoutunity to talk again with Ben, who always reminds me of Deepak, my India MVP Lead.. Both Deepak and Ben are full of energy and enthusiam... Thats what comprises of a MVP lead perhaps... I also got to spend some time with Emilly and discuss about my ideas of community model, hope so that such a wonderful discussion will ultimately yeild into something, I need to do some homework here... And ya one good progress was talk with Andrew Flick the Student Ambassador to Microsoft from Bradly University, Peoria, IL... I believe Andrew can join hands to work for growth of .Net Community & groups like .Net-BUG
Last but not the least was drink and dine which I had together with Vinny, Ricardo, Mike, Dian & Greg Chapman (Great MVPs)... That time will be one of the most cherished time for me to remember... I learn that all those Techhie guys out there are actually musicians and above all very nice human beings...
Moral of the story: Regional Summit was amazing, fun & learn experience and I shall look forward to more of those types in the future...
-Vishal Joshi
MVP Summits have recently started occurring in US and the main agenda of the same was interaction between Microsoft Team, which is dedicated to community and Microsoft MVPs who too are closely associated with community...
Lots of the stuff that happened in the summit is covered under Non-Disclosure Agreement (NDA) of Microsoft with MVPs so I shall not be able to write much but still I shall jot down some salient points of the summit which are outside the perview of NDA...
Well!! quite a few celebrated people had come down from Microsoft for the summit, to name a few of them would be Sean O'Driscoll, Director, MVP & Community; Ricardo Wanger, Regional Manager USA; Mike Hernandez, VSTO Team; Emily Freet, Program Manager, Academic Communities; Ben Miller, MVP Lead ASP.Net; Jacob Cynamon, Developer Community; Vinny Pasceri, Longhorn Team; Martin Holladay, ADS Team; Brad Rhodes, Yuknon Team; Mike Sampson, Office MVP Lead; Brian Boston, Windows Client MVP Lead
John Buscher, Windows Server MVP Lead & also "The Host" of the Summit; And Susan Leiter, MVP Program Event Coordinator... (Thanks Brain for filing up the list... !!)
The major technical sessions which happened were:
1.) Session on Automated Deployment Services (ADS) by Martin Holladay
2.) Session on Windows Roadmap & Longhorn by Vinny Pasceri
3.) Session on Visual Studio Tools for Office by Mike Hernandez
4.) Session on Data Story for Whidbey by Brad Rhodes
A believe me all the above sessions were very useful... I could not relate to ADS a lot as its not my area but I am sure that those who were related must have found it pretty useful... About the next three sessions, I had heard about longhorn and Yukon a lot earlier in TechEds and other Microsoft Events in India but here it was much free environment, you see the best analogy would be a college class and a personal tution :-)
But the VSTO part was the most catchy to me... I nearly feel in love with that product and would love to work in something like that, to enhance it to its best and make it a favorite product of many... I surely suggest you to read about it wherever possible... I would had filled up the whole blog with info about it but ususal MS stuff THE NDA... :-) Anyways, sometime soon when it will be worth mentioning I definitely shall...
Now about the best times of the meet... The fun part... We had a nice lunch discussion with Sean & Ricardo, where we talked about the MVP Program, the way it is and the way it should be etc... It was really nice to learn that Sean and Ricardo were actually in a very receptive mode... When it comes to technology I can relate what will fall into NDA and what will not, in such informal discussions its nearly impossible to predict so I better not tell more... India MVPs if you want to know more do drop in a mail and I shall write specially to you, but in short it was a nice long close to 2+ hours session...
We also had a nice social evening where all of us could get together and have some good time... Wish I could upload pictures on my blog...
I also met with Jacob Cynamon from Developer Community... got really pally with him, hope we shall work closely in the time to come and do something useful... Got an oppoutunity to talk again with Ben, who always reminds me of Deepak, my India MVP Lead.. Both Deepak and Ben are full of energy and enthusiam... Thats what comprises of a MVP lead perhaps... I also got to spend some time with Emilly and discuss about my ideas of community model, hope so that such a wonderful discussion will ultimately yeild into something, I need to do some homework here... And ya one good progress was talk with Andrew Flick the Student Ambassador to Microsoft from Bradly University, Peoria, IL... I believe Andrew can join hands to work for growth of .Net Community & groups like .Net-BUG
Last but not the least was drink and dine which I had together with Vinny, Ricardo, Mike, Dian & Greg Chapman (Great MVPs)... That time will be one of the most cherished time for me to remember... I learn that all those Techhie guys out there are actually musicians and above all very nice human beings...
Moral of the story: Regional Summit was amazing, fun & learn experience and I shall look forward to more of those types in the future...
-Vishal Joshi
Friday, November 07, 2003
New Features In Whidbey
This article contains pointers to the new features in Whidbey that you can research on...
Many must have thought that what further developments can be done on VS.Net, it nearly has everything that you needed... But after reading about the features below I am sure you will feel that well with them things will be even easier...
My Favorites
1. Master Pages: - Read the article in the blog below to read more about them
2. Themes & Skins: You can read about this too in the post below
3. Posting across pages: Well, this is one feature which is really going to solve many of your problems With Whidbey you can post a page to pages other than itself Imagine you have a button on click of which you want to post the current pages information to x.aspx and other button on whose click you want to post the current pages information to y.aspx, all you need to do is to set PostTargetUrl property of the button to respective pages All your state information and control data will go to the next page. Alternatively, one can be a normal submit button to self and other can be a redirection button. Kind of making the stateless stuff to a little state full?? Nice isn't it!!
4. Pre-Compiled Website: Now you have a utility tool called precompiler.axd, what this will do for you is that it shall compile the pages for you at hosting time itself. It shall also give you the compile time errors to you. Now when your page will be hit for the first time by the user he will not feel like he is waiting for ages for it come up to the screen Someone like me who has faced this problem earlier can understand the advantages of this stuff And above this you can have compilation disabled after that, any changes to the page after it is locked will throw an exception
5. Default-Focus Controls: I had written some silly kind of code on every .aspx page of mine by which on the load of the page the default textbox gets in focus. I did feel if there should have been a way by which I could do so, say by a property of the page and something like that comes in Whidbey. Interestingly, you also have default button so that if someone just wants to hit enter on your page you know where he will go
6. Client Side Scripting: Also talking about button, didnt you ever feel that your button should do something on client and then post back to the server to implement some server side functionality Whidbey has come up with a simple way to do that too Buttons will now have OnClientClick attribute and there you can have the stuff you want
7. Method Extractors: Many a times you keep writing a method and by the time you finish it you realize that it should had been more modular Now you start worrying about the pain of creating helper functions and test them again All you need to do now is simply extract your method by selecting some piece of code Whidbey will take care of even the return parameters Easy right!!
8. Web Parts: You can now have some parts of your webpage seen conditionally and some part not You could do this earlier but you had to code for it. Here you can select the location of different web parts (Web Zones will be their container) and also when to show what Guys writing large user input applications must be feeling relaxed right!!
9. Device Independent Development: MMIT is now built in within and there will be something called as Adaptive Rendering that shall happen. According to the device the markup language will change and your page will be comfortably visible on any page.
Many must have thought that what further developments can be done on VS.Net, it nearly has everything that you needed... But after reading about the features below I am sure you will feel that well with them things will be even easier...
My Favorites
1. Master Pages: - Read the article in the blog below to read more about them
2. Themes & Skins: You can read about this too in the post below
3. Posting across pages: Well, this is one feature which is really going to solve many of your problems With Whidbey you can post a page to pages other than itself Imagine you have a button on click of which you want to post the current pages information to x.aspx and other button on whose click you want to post the current pages information to y.aspx, all you need to do is to set PostTargetUrl property of the button to respective pages All your state information and control data will go to the next page. Alternatively, one can be a normal submit button to self and other can be a redirection button. Kind of making the stateless stuff to a little state full?? Nice isn't it!!
4. Pre-Compiled Website: Now you have a utility tool called precompiler.axd, what this will do for you is that it shall compile the pages for you at hosting time itself. It shall also give you the compile time errors to you. Now when your page will be hit for the first time by the user he will not feel like he is waiting for ages for it come up to the screen Someone like me who has faced this problem earlier can understand the advantages of this stuff And above this you can have compilation disabled after that, any changes to the page after it is locked will throw an exception
5. Default-Focus Controls: I had written some silly kind of code on every .aspx page of mine by which on the load of the page the default textbox gets in focus. I did feel if there should have been a way by which I could do so, say by a property of the page and something like that comes in Whidbey. Interestingly, you also have default button so that if someone just wants to hit enter on your page you know where he will go
6. Client Side Scripting: Also talking about button, didnt you ever feel that your button should do something on client and then post back to the server to implement some server side functionality Whidbey has come up with a simple way to do that too Buttons will now have OnClientClick attribute and there you can have the stuff you want
7. Method Extractors: Many a times you keep writing a method and by the time you finish it you realize that it should had been more modular Now you start worrying about the pain of creating helper functions and test them again All you need to do now is simply extract your method by selecting some piece of code Whidbey will take care of even the return parameters Easy right!!
8. Web Parts: You can now have some parts of your webpage seen conditionally and some part not You could do this earlier but you had to code for it. Here you can select the location of different web parts (Web Zones will be their container) and also when to show what Guys writing large user input applications must be feeling relaxed right!!
9. Device Independent Development: MMIT is now built in within and there will be something called as Adaptive Rendering that shall happen. According to the device the markup language will change and your page will be comfortably visible on any page.
Message to fellow MVPs on Launch of CNUG-DAM
Following is the message that I sent to fellow MVPs regarding CNUG-DAM some days before its launch...
"I would like to send this mail as an Invite to all of you to join our new initiative called "CNUG-DAM".
Core Idea behind this Initiative - As you all know the fact that there is a lot of focus by various Groups, Communities, Organizations & Training Centers on developing technical skills of people, may it be .Net or anything else. We rarely focus on specialized training for Senior Members of the Industry who have to handle stuff beyond coding also and many a times it is assumed that such skills of a person will be enhanced only through experience...
As a contradiction, we thought that focusing on areas which include Estimation Techniques, Design & Design Patterns, Architecture, Project Management, Quality standards etc and having expert Software leads of various organizations coming together and creating fusion of their thoughts under a common umbrella would be a very novel and appreciated idea. We thought that this would definitely give an opportunity to these leaders to learn from each others experiences and expertise. We had quite some work & preparations going on in CNUG in this direction.
Today CNUG, which we started as group of handful of members, is a force of '1450' members. We thought that this is the right time to also give focus on -"’D’esign", "’A’rchitecture" & project "’M’anagement" areas in .Net and with that idea we started a new chapter of CNUG (Code named 'DAM')... I am personally very positive that this chapter will create a mega platform for Managers, Leaders & Software Experts (Designers/Architects) of our industry to exchange ideas and will become a model example for many others to do something in this direction... Just in 2-3 days of the launch announcement we have '55' members from various companies already registered into CNUG-DAM to share their ideas and extend their support...
Inputs from all of you is surely going to help us in moving further so please pass on your comments & suggestions back… If possible also do try to attend our first meet on 2nd November at 11 AM at Satyam Computers, Chennai.. The opening presentation will be on "Design Patterns & their Role in .Net World"…. The presentation will be given by CNUG’s favorite speaker Anand M (Microsoft MVP .Net)… Interested folks can register at http://groups.msn.com/CNUG-DAM for Online discussions & on the Meeting registration page on the site for Offline meets... Forth coming presentations and discussions will be on 'Best Estimation Techniques', 'Six Sigma Certifications' and others similar topics which need attention….
Looking forward to your participation, contribution, comments & suggestions…
warm regards,
Vishal Joshi
A. Convener –CNUG | Microsoft MVP .Net
If You Think YOU CAN… You Can…
Visit:
http://VishalJoshi.BlogSpot.com
http://groups.msn.com/ChennaiNetUserGroup
"I would like to send this mail as an Invite to all of you to join our new initiative called "CNUG-DAM".
Core Idea behind this Initiative - As you all know the fact that there is a lot of focus by various Groups, Communities, Organizations & Training Centers on developing technical skills of people, may it be .Net or anything else. We rarely focus on specialized training for Senior Members of the Industry who have to handle stuff beyond coding also and many a times it is assumed that such skills of a person will be enhanced only through experience...
As a contradiction, we thought that focusing on areas which include Estimation Techniques, Design & Design Patterns, Architecture, Project Management, Quality standards etc and having expert Software leads of various organizations coming together and creating fusion of their thoughts under a common umbrella would be a very novel and appreciated idea. We thought that this would definitely give an opportunity to these leaders to learn from each others experiences and expertise. We had quite some work & preparations going on in CNUG in this direction.
Today CNUG, which we started as group of handful of members, is a force of '1450' members. We thought that this is the right time to also give focus on -"’D’esign", "’A’rchitecture" & project "’M’anagement" areas in .Net and with that idea we started a new chapter of CNUG (Code named 'DAM')... I am personally very positive that this chapter will create a mega platform for Managers, Leaders & Software Experts (Designers/Architects) of our industry to exchange ideas and will become a model example for many others to do something in this direction... Just in 2-3 days of the launch announcement we have '55' members from various companies already registered into CNUG-DAM to share their ideas and extend their support...
Inputs from all of you is surely going to help us in moving further so please pass on your comments & suggestions back… If possible also do try to attend our first meet on 2nd November at 11 AM at Satyam Computers, Chennai.. The opening presentation will be on "Design Patterns & their Role in .Net World"…. The presentation will be given by CNUG’s favorite speaker Anand M (Microsoft MVP .Net)… Interested folks can register at http://groups.msn.com/CNUG-DAM for Online discussions & on the Meeting registration page on the site for Offline meets... Forth coming presentations and discussions will be on 'Best Estimation Techniques', 'Six Sigma Certifications' and others similar topics which need attention….
Looking forward to your participation, contribution, comments & suggestions…
warm regards,
Vishal Joshi
A. Convener –CNUG | Microsoft MVP .Net
If You Think YOU CAN… You Can…
Visit:
http://VishalJoshi.BlogSpot.com
http://groups.msn.com/ChennaiNetUserGroup
Tuesday, October 14, 2003
Session Variables - Operational Information and Performance
MSDN Article By Vishal Joshi
Article Posted: October 21, 2003
It is many a times said that you should use minimum session variables in your web application and use of session variables actually affects the performance adversely. Did you ever try to analyze why is it so? In this article I have explained (in not so detail but have given required operational information) about the Session Variables, their use and their affect on web application performance.
Recollect your writing this simple code int intUserId = Convert.ToInt32(Session[“UserId”]);
Do you know what all does ASP.NET runtime actually does behind the scene? Well in fact to handle this there are lots of considerations taken into account and there is a lot of background processing happening.
To explain this in brief let me re-iterate over the fact that ASP.Net provides 3 different kinds of session storage facilities namely “InProc”, “StateServer” and “SQLServer”. So you can have your session data stored at any of these three different locations.
1. In Process – This is the default option by which the session values are kept alive as objects in Windows Server, by ASP.Net worker process.
2. State Server (Out of Process) – aspnet_state.exe runs as a separate process on the same box or on another machine. In this case the session values are serialized and stored in the memory of this separate process.
3. SQL Server – As the name suggests in this case the session values are stored in the SQL Server table. Again in this case the SQL server can be on the same box as well can be a dedicated DB server.
You can specify the state provider in the web.config file of your application in the section
cookieless="false" timeout="20” />
The mode in the above case can have four different values representing different locations of storage discussed above.
Off – Indicating application wide session state is not enabled. If your application is not going to use any session information remember to set the mode to “Off”. (Note: If you have not set the mode to “Off” and you have a Session_OnStart handler in your application session is saved even though it is empty, which can adversely affect the performance, so do not have Session_OnStart handler unless it is required for your application.)
InProc – This is the default option
StateServer – If you set this as mode then providing stateConnectionString parameter is important. (Note: 127.0.0.1 indicate local host, you may provide any server name, and 42424 is the default port number, providing it is mandatory. Also note that state service, process named - aspnet_state.exe, is installed but is stopped by default, so you may need to start that on the server before use.)
SQLServer – If you set this as mode then providing sqlConnectionString parameter is important (Note: ASP.Net uses default Databases and Initial Catalog so providing such arguments in the connection string is not allowed)
The cookieless parameter indicates whether session without cookies should be used to identify the client sessions or not. The default value is false indicating that cookies should be used to identify client sessions. (Note: This is one of the major differentiating features provided by ASP.NET Session State over classic ASP. In a single line cookieless sessions use mangled URL concept for browsers to identify the session state.)
The timeout parameter indicates the time in minutes after which, an idle user session should be abandoned. (Tip: You may want to take care of this parameter sometimes - like if you are building a catalog or gallery you may not want a user to get time-out notices in a short while but in case of banking application you may want to reduce the limit.)
Now, we understand that ASP.NET can store our session variables at different locations according to our choice, let us now understand roughly what it does behind the scene to get or set our session variables. Take a hypothetical scenario in which you have made no changes to the above settings and a single web page (in consideration) of the web application has got multiple frames. Each frame is reading or writing information into the Session. To add up to the trouble let us assume that only one particular Session Variable is being accessed and modified by all the frames. This scenario is possible right!! ASP.NET runtime needs to handle all such scenarios. To handle this ASP.NET runtime implements LOCK. There are two different types of locks namely - Reader Lock and Writer Lock. If a reader lock is set then concurrent read-only requests will be entertained but write requests will be held back and given last priority. But if a writer lock is set then all the remaining read-only or write requests have to wait. Thus it might so happen that till your one frame finishes the other frames might not even get start their processing. You can see how performance will be affected in this case. Thus ASP.NET implements queuing of requests to session and tries to handle it in an optimized way but we also need to be judicious in requests to the session too!!
Among the available three ways of maintaining session state it is quite evident that InProc mode is the most efficient. Researches have indicated that the use of OutProc (StateServer) mode effects performance up to 15% whereas SQL Server effects up to 25%. The figures indicated by these studies are for basic types and for user defined types they may even go higher. The reasons behind these hits are the serialization and de-serialization that occurs while moving the objects to the session state and then retrieving them. This overhead is clearly saved in InProc mode as the objects are saved in memory and there is no need to go through the serialization/de-serialization processes. The hit that is present in the InProc mode thus is mainly due to the memory consumption by addition of session variables. By judiciously adding objects to sessions thus can help in case of InProc mode.
So now if you ask why we at all need the other two modes when they are so performance expensive then the answer is because of the reliability. The data persisted in SQL Server or in OutProc mode is much safer as it is not hit by failures in IIS or ASP.NET or even by process recycling. Though if SQL Server or aspnet_state.exe is stopped or failed then there are potential chances of the loss of data (in case it is not handled properly!!) but when data is critical then these modes need to be used. So if we rate these modes according to performance then the ranks would be
1. InProc
2. StateServer
3. SQLServer
But if we rate the same from reliability perspective then the ranks would be
1. SQLServer
2. StateServer
3. InProc
Though you can note the ease that the way your application would read/write the data will remain the same as Session[“key”] = value;
Thus again, as usual you have to do the correct trade-off and decide what is good for your application no one can really give a statement on this. But at the first place remember that if you can do away without Session Variables then you should never go ahead and use them.
Now, as we understand the performance implications related to session state usage let us be conscious programmers and understand how we can control sessionState to increase performance of our individual pages. @page directive of ASP.NET page has a property called “EnableSessionState”. If your page is not accessing any session related information you can set this variable to “false”. If your page is going to only read from session then ensure that you set this value to “ReadOnly” and if you are going to do read write operations to session then set it to “true”.
At the end we will conclude by saying that Session Variables are designed for the convenience of us designers/developers but we should be careful enough to use them and should be conscious enough to know how much performance we are trading off by the way we use them.
Vishal Joshi
Microsoft MVP
Friday, October 03, 2003
This came in DotNetNuts.com and was brought to attention by Deepak Kumar Vasudevan, a fellow MVP... Thanks Deepak for the same...
The Ten Commandments of .NET
1. Thou shall learn XML, now! If .NET is an angel from Microsoft then its wings are woven with XML, and you need to understand the basics of XML before you can fly with .NET. XML is used for configuration files, SOAP,Serialization, and it's tightly integrated with ADO.NET. You can get away without knowing XML, but you won't get far.
2. Thou shall become an object-oriented programmer! To understand .NET and build successful applications you must understand OOP. VB programmers now have new object-oriented capabilities, but may not know how or when to use them. You should understand interfaces and abstract classes (there's a difference between the two in .NET), implementation inheritance, function overriding, and shared members. If your not familiar with OOP at all, start learning ASAP. If your established with OOP as it applies to VB6 then dig deeper into OOP methodology, it will certainly make .NET more enjoyable.
3. Thou shall concentrate on the .Net framework, not the language being used. No matter what .NET language you use, your still using the same framework, so it's very important to focus on the framework, not a particular language. Keep in mind that most of the functions you'll use while programming are from the framework, so using a new language is easy, simply adjust to the syntax. Plus, having C#, C++, VB, Perl, Pascal, COBOL, Fortran, and Eiffel on your resume is more impressive than having just one.
4. Thou shall not go it alone. Get involved in the .NET community. This is the best way to dive into .NET. Message boards are a great resource because you can read problems and questions posted by beginners, and examine the solutions they received. After all, it's better to learn from others mistakes than to learn by repeating them. DotNetNut.com is a great place to start. You'll find message boards, original articles, constantly updated FAQ, and an enormous amount of links to other great resources. We 'll help you spend more time learning and less time digging for answers.
5. Thou shall adapt to new development environment. For VB programmers the VS.NET IDE is a big change, and it's going to take some effort to adjust. Not only is there much better support for debugging than in VB6, but there is also the ability to record and playback macros. Get intimate with the IDE, missing out on great new features is shameful.
6. Thou shall abandon DCOM and use remoting. DCOM was a big step in Microsoft distributed computing, but it's time has passed. Remoting is the .NET model for distributed computing. It's more flexable, featuring plugable channels and protocols, and it generally out performs DCOM (Though note:Remoting outperforms DCOM is in intra-appdomains where as between processes and across network Remoting is slower by 250%..Thanks Sanjay Vyas for his inputs). Administration is done easily through application configuration files which elevate the headache of DCOM administration. Althought it takes a little more coding than DCOM the benefits are well worth it.
7. Thou shall not use VS.NETs code generators without understanding the code they generate. VS.NET has some great code generators that can save you time, but only use them if you understand the code they generate. Create a sample application, use the code generators, and be come very familiar with the results. It's impossible to support code ou don't understand.
8. Thou shall use structure error handling in VB. VB developers have a choice, either learn how to use structured error handling, or use the old On Error method. Using structured error handling brings flexibility and maintainability to VB and is one of the best new features. There are two reasons On Error should be left behind. One is because Try Catch Finally will be used in all .NET languages, On Error is VB specific. Two, because structured error handling is much more powerful, giving you the ability to nest Try Catch statements and layer exceptions.
9. Thou shall avoid using COM+ for single phase transactions. COM+ is great for two phase commits because of the DTC, but there is extra overhead for database locks due to the nature of the transaction. It's a waste of database resources to indiscriminately use COM+ when a less intensive lock can be used. Transactions through the Data namespaces are lighter and should be used for single phase transactions. It is possible to get the same automatic transaction enrollment available in COM+ by using the SinglePhaseTransactionContext component available for download (complete with source files) at DotNetNut.
10. Thou shall not underestimate the complexity of .NET. Is .NET going to make development easier? Yes, but (there's always a but) the .NET framework is so vast, and there are so many new concepts involved that NET will be difficult at first. If your new to the .NET runtime, than you may not know what value types and boxed types are, how the garbage collector works, or what application domains are. All these concepts are new to microsoft developers and important, to ignore them is sinful.
The Ten Commandments of .NET
1. Thou shall learn XML, now! If .NET is an angel from Microsoft then its wings are woven with XML, and you need to understand the basics of XML before you can fly with .NET. XML is used for configuration files, SOAP,Serialization, and it's tightly integrated with ADO.NET. You can get away without knowing XML, but you won't get far.
2. Thou shall become an object-oriented programmer! To understand .NET and build successful applications you must understand OOP. VB programmers now have new object-oriented capabilities, but may not know how or when to use them. You should understand interfaces and abstract classes (there's a difference between the two in .NET), implementation inheritance, function overriding, and shared members. If your not familiar with OOP at all, start learning ASAP. If your established with OOP as it applies to VB6 then dig deeper into OOP methodology, it will certainly make .NET more enjoyable.
3. Thou shall concentrate on the .Net framework, not the language being used. No matter what .NET language you use, your still using the same framework, so it's very important to focus on the framework, not a particular language. Keep in mind that most of the functions you'll use while programming are from the framework, so using a new language is easy, simply adjust to the syntax. Plus, having C#, C++, VB, Perl, Pascal, COBOL, Fortran, and Eiffel on your resume is more impressive than having just one.
4. Thou shall not go it alone. Get involved in the .NET community. This is the best way to dive into .NET. Message boards are a great resource because you can read problems and questions posted by beginners, and examine the solutions they received. After all, it's better to learn from others mistakes than to learn by repeating them. DotNetNut.com is a great place to start. You'll find message boards, original articles, constantly updated FAQ, and an enormous amount of links to other great resources. We 'll help you spend more time learning and less time digging for answers.
5. Thou shall adapt to new development environment. For VB programmers the VS.NET IDE is a big change, and it's going to take some effort to adjust. Not only is there much better support for debugging than in VB6, but there is also the ability to record and playback macros. Get intimate with the IDE, missing out on great new features is shameful.
6. Thou shall abandon DCOM and use remoting. DCOM was a big step in Microsoft distributed computing, but it's time has passed. Remoting is the .NET model for distributed computing. It's more flexable, featuring plugable channels and protocols, and it generally out performs DCOM (Though note:Remoting outperforms DCOM is in intra-appdomains where as between processes and across network Remoting is slower by 250%..Thanks Sanjay Vyas for his inputs). Administration is done easily through application configuration files which elevate the headache of DCOM administration. Althought it takes a little more coding than DCOM the benefits are well worth it.
7. Thou shall not use VS.NETs code generators without understanding the code they generate. VS.NET has some great code generators that can save you time, but only use them if you understand the code they generate. Create a sample application, use the code generators, and be come very familiar with the results. It's impossible to support code ou don't understand.
8. Thou shall use structure error handling in VB. VB developers have a choice, either learn how to use structured error handling, or use the old On Error method. Using structured error handling brings flexibility and maintainability to VB and is one of the best new features. There are two reasons On Error should be left behind. One is because Try Catch Finally will be used in all .NET languages, On Error is VB specific. Two, because structured error handling is much more powerful, giving you the ability to nest Try Catch statements and layer exceptions.
9. Thou shall avoid using COM+ for single phase transactions. COM+ is great for two phase commits because of the DTC, but there is extra overhead for database locks due to the nature of the transaction. It's a waste of database resources to indiscriminately use COM+ when a less intensive lock can be used. Transactions through the Data namespaces are lighter and should be used for single phase transactions. It is possible to get the same automatic transaction enrollment available in COM+ by using the SinglePhaseTransactionContext component available for download (complete with source files) at DotNetNut.
10. Thou shall not underestimate the complexity of .NET. Is .NET going to make development easier? Yes, but (there's always a but) the .NET framework is so vast, and there are so many new concepts involved that NET will be difficult at first. If your new to the .NET runtime, than you may not know what value types and boxed types are, how the garbage collector works, or what application domains are. All these concepts are new to microsoft developers and important, to ignore them is sinful.
Monday, September 29, 2003
Microsoft's Visual Studio .Net 2003 (Code name "WHIDBEY") offers few of the coolest and most awaited features...
Did anyone of you while developing web applications faced following situation -
"You are developing a website for a certain client... There are certain standard controls, images and layouts that are going to be repeated across various pages. You have to make the allignment of all the images and those repeated control everytime. Some developers of your group do it differently and you spend quite some time in formatting so that everyone's pages look in similar lines... If yes then read ahead...
Also that sometimes some controls refuse to get a particular font in particular size displayed on them.. You try to do all kindof settings at design time but still at runtime your one control looks like an odd man out....Your overall asthetic appeal of your site is spoilt..."
Now there is an answer to these situations in the new release of VS.Net "Whidbey"... Now you have got MASTER PAGES... These pages will work somewhat similar to "Slide Master" in Microsoft Powerpoint. You can make a Master page for your project and make all the rest of the pages to inherit from this Master Page. The VISUAL INHERITANCE which was not possible earlier in web pages comes alive with Master Pages. You can place your standard banners, Log out links, Help links, Tool bars, Footers for pages etc etc in your Master page and there would be all the rest of your pages inheriting from Master Page have the same controls, same images at the same places. Your development time is reduced drastically, there will be consistency in all your pages giving asthetic appeal to your pages without efforts.
The other situation discussed earlier is solved by SKINS and THEMES.... Analogy here is your windows desktop themes... There will be inbuilt skins and themes available in "Whidbey" which when you simply apply to your web applications they will get an enhanced looks... Well to define these... SKIN can be said as the set of properties and templates that can used to set the size, font, color etc of various controls. When you include some set of skins or stylesheets to change the overall look of a website... then that becomes a THEME... You can even pack themes & skins and apply them to other websites by just transferring them...
Could it get further easier so early???....
- Vishal Joshi
Microsoft MVP .Net
Did anyone of you while developing web applications faced following situation -
"You are developing a website for a certain client... There are certain standard controls, images and layouts that are going to be repeated across various pages. You have to make the allignment of all the images and those repeated control everytime. Some developers of your group do it differently and you spend quite some time in formatting so that everyone's pages look in similar lines... If yes then read ahead...
Also that sometimes some controls refuse to get a particular font in particular size displayed on them.. You try to do all kindof settings at design time but still at runtime your one control looks like an odd man out....Your overall asthetic appeal of your site is spoilt..."
Now there is an answer to these situations in the new release of VS.Net "Whidbey"... Now you have got MASTER PAGES... These pages will work somewhat similar to "Slide Master" in Microsoft Powerpoint. You can make a Master page for your project and make all the rest of the pages to inherit from this Master Page. The VISUAL INHERITANCE which was not possible earlier in web pages comes alive with Master Pages. You can place your standard banners, Log out links, Help links, Tool bars, Footers for pages etc etc in your Master page and there would be all the rest of your pages inheriting from Master Page have the same controls, same images at the same places. Your development time is reduced drastically, there will be consistency in all your pages giving asthetic appeal to your pages without efforts.
The other situation discussed earlier is solved by SKINS and THEMES.... Analogy here is your windows desktop themes... There will be inbuilt skins and themes available in "Whidbey" which when you simply apply to your web applications they will get an enhanced looks... Well to define these... SKIN can be said as the set of properties and templates that can used to set the size, font, color etc of various controls. When you include some set of skins or stylesheets to change the overall look of a website... then that becomes a THEME... You can even pack themes & skins and apply them to other websites by just transferring them...
Could it get further easier so early???....
- Vishal Joshi
Microsoft MVP .Net
Subscribe to:
Posts (Atom)