Friday, November 19, 2004

VJs Mega Tip Of The Day - November 19th 2004

Whidbey Days - ASP.Net 2.0 Page Life Cycle

ASP.Net 2.0 Page Life Cycle

Abstract
This article talks about the way ASP.Net 2.0 page life cycle works, it discusses the way ASP.Net page is created and displayed.

More Information
It is important for ASP.Net programmers to understand how their page is created/processed and displayed by ASP.Net framework. Sometimes many unexpected behaviors are seen in case incorrect data is accessed before or after certain page events. Below is the information on how System.Web.UI.Page methods execute. For keeping the article more users friendly and also to avoid incorrect method calls for not-recommended methods, I have discussed only those methods which I felt a user should know about.

Without further delay let us start from the html source that is written for the page. First of all the html source needs to be parsed to process the page. This is done by a method in the Page called AddParsedSubObject(). Unless you override it, this method will automatically add Literal controls to page’s control collection. This is done by first creating a control collection by calling CreateControlCollection() method.

As the child controls are parsed in the page the method AddedControl() is called which is usually triggered when a control is added to another control’s control collection. As ASP.Net pages can be viewed on various devices the method ResolveAdapter() returns the control adapter which is responsible for rendering the control on the specific device or browser requesting the ASP.Net page.

DeterminePostBackMode() is then invoked to find out what is the post back mode used for the request. If the POST method is used for postback the web form information is returned from the Context object. If the GET method is used for postback, the information from query string is returned. If the page is being requested for the first time, null is returned, many of us are used to writing code in which we check the postback property and execute specific logic, this is the method that helps the framework to get our this specific code running correctly.

More granular control on the page life cycle is available in ASP.Net 2.0. Now we have got additional events like “PreX” and “XComplete” to insert our logic before and after the usual “X” events, which we have been working with. The first such event to fire is PreInit(). This is the very beginning of page’s initialization and after the completion of this personalization information is loaded and if there is any page theme then it is initialized. I have talked more about these concepts earlier on the blog. Click Here for more information.

After the PreInit() of the page, ResolveAdapter() for individual child controls is called and then each of the control’s Init event is fired. What is interesting to note is that Init event of the child control is fired before the Init event of the page and many a times in developing complex ASP.Net applications if user plays with these events, without enough information, then unexpected behavior might resulted.

After the Init event of the control, the TrackViewState() method is triggered which will track the view state changes posted to server. It is important to know that when control’s view state data is being tracked with the state bag, page’s Init event and TrackViewState() are not yet fired. This also results into unexpected behavior in case users are writing custom controls or probably their own base page.

After the TrackViewState() of the child controls, the Init event of the page is fired. This event initializes the page and then TrackViewState() of the page is fired which tracks the changes to the page’s state bag

After the TrackViewState() for the page is called InitComplete() event is fired. This is the signal that initialization of the page and its child control is done. Though what a user should know is that ViewState for the page or the controls is not yet restored, if user tries to do anything before this data is restored the required changes in the data from the client which expected may not appear.

The view state is restored in the method LoadViewState() after whose completion ViewState data is available for a user to work on.. There is then EnsureChildControls() method which is invoked which makes sure that the page’s child controls get created.
In ASP.Net 2.0 a PreLoad() event available which would probably be the right place for user to play around with objects before the universally used load event is fired. For people who are writing base page classes and who want to perform certain tasks before standard page load event this is the right place to put their custom logic into.
After PreLoad() event, the Load() event of the page is fired. There is no need to explain what one can do with this event, isn’t it. But what should be known is that page load event is fired before the control load event unlike Init event which is fired first for the child controls and then for the page. This also many times takes custom control writers by surprise as they are expecting the control load to occur before actually the user logic on page load is executed.
So after the page Load() event, control Load() event is triggered and then the custom events like button clicks and others are fired. Many a times users want some specific functionality to be executed in their base pages, just after these postback events but also before PreRender when the pre rendering logic starts. This kind of development methodology has created issues when the derived classes call base methods before or after their custom logic when otherwise was expected. That is the place where LoadComplete() event of the page will come to use. The LoadComplete() will be called after the custom event execution for the child control is over but PreRender is not started.
After the LoadComplete() event PreRender() event of page is triggered followed by the PreRendering of each child controls. PreRender() event has always been the right place to put in the last logic before ViewState is saved. But now there is a PreRenderComplete() event which is fired after all the PreRender events of the child controls are fired, this will now be the last chance to change the data before SaveViewState() of the page is fired.
After the SaveViewState of the page; the control SaveViewState() is fired. SaveViewState() will save the changes that have happened to the data till that point and then the page will be ready to be rendered.
LoadPageStateFromPersistenceMedium() and SavePageStateToPersistenceMedium() are called before LoadViewState() and after SaveViewState() respectively. As the name indicates the ViewState is persisted so that it can be used later in the next call. I will talk in detail about how these methods work later, but as of now it is just good to know what they do.
After the SavePageStateToPersistenceMedium(), SaveStateComplete() is fired, which indicates that saving the state of the page is now complete.
After this the rendering of the page begins. First the CreateHtmlTextWriter() is fired to create the HTML text writer and then page and control Render are called. If the user wishes to change the look and feel of the way their control is rendered this is the event to do it. When the Render method completes Unload() for each child control is called and then each child control’s Dispose() is called. After disposing all the child controls, the page Unload() event is fired and then the Page’s Dispose() is called.

In case of error, the execution directly jumps to the error handling and then to unload and dispose events skipping the events in-between. This thus covers the major execution of ASP.Net page life cycle.

Below is a quick summary of the methods in their invocation order:
System.Web.UI.Page.AddParsedSubObject
System.Web.UI.Page.CreateControlCollection
System.Web.UI.Page.AddedControl
System.Web.UI.Page.ResolveAdapter
System.Web.UI.Page.DeterminePostBackMode
System.Web.UI.Page.PreInit
System.Web.UI.WebControl.ResolveAdapter
System.Web.UI.WebControl.Init
System.Web.UI.WebControl.TrackViewState
System.Web.UI.Page.Init
System.Web.UI.Page.TrackViewState
System.Web.UI.Page.InitComplete
System.Web.UI.Page.LoadPageStateFromPersistenceMedium
System.Web.UI.WebControl.LoadViewState
System.Web.UI.Page.EnsureChildControls
System.Web.UI.Page.LoadViewState
System.Web.UI.Page.PreLoad
System.Web.UI.Page.Load
System.Web.UI.WebControl.Load
System.Web.UI.WebControl.OnClick
System.Web.UI.Page.LoadComplete
System.Web.UI.Page.PreRender
System.Web.UI.WebControl.PreRender
System.Web.UI.Page.PreRenderComplete
System.Web.UI.Page.SaveViewState
System.Web.UI.WebControl.SaveViewState
System.Web.UI.Page.SaveViewState
System.Web.UI.Page.SavePageStateToPersistenceMedium
System.Web.UI.Page.SaveStateComplete
System.Web.UI.Page.CreateHtmlTextWriter
System.Web.UI.Page.Render
System.Web.UI.Page.RenderChildren
System.Web.UI.WebControl.RenderControl
System.Web.UI.Page.CreateHtmlTextWriter
System.Web.UI.WebControl.Unload
System.Web.UI.WebControl.Dispose
System.Web.UI.Page.Unload
System.Web.UI.Page.Dispose


There are many methods which I have skipped and many methods which we discussed are called multiple times on the basis of the existing conditions, I have intentionally not discussed them, though what I have tried is to make the user understand the things that happen in the background for a page to work.

So this is how a single ASP.Net page’s HTML comes on to our browser. Indeed quite a bit amount of work behind the scenes right!! I hope you will be able to unleash the potential of all these additional options available to you in Whidbey timeframe. These are some of the reasons why I am so passionate about Microsoft Technologies; they just keep getting better with every new release.

PS: The above is my understanding of the Whidbey (ASP.Net 2.0) page life cycle, if you think I have missed something or something is incorrectly mentioned then please do drop in a mail at Vishal_Joshi@MVPs.org so that I can make the necessary corrections.

PPS: Today marks the completion of second season of VJs Tip Of The Day series. I shall be back with the thrid season in new year 2005... Till then wish you best luck and a wonderful festive season...

Thursday, November 18, 2004

VJs Tip Of The Day - November 18th 2004

Whidbey Days - Sharing Types Across Web Service Proxies

I do not know how many of you have faced this problem but I have always had a complain that about not being able to share types across different web service proxies... Take this scenario... I have a business application which exposes many different web services... These web services might be sharing some common object across themselves... For example Lets say I have a Auto Insurance application... I build one web service to do Policy related jobs and the other to do Premium related jobs but then in both the condition my Automobile object goes along... Now, as my proxy generator will generate service proxy for each of the service individually so I will get two Automobile classes and if I have a single client application dealing with it I will have to either create different namespaces or do some manual editing...
Although the editing might not be much the problem is that regeneration causes those changes to go away... Also there needs to be some documentation around this problem etc... Well enough of problem statement, I think you must have got it by now... :-) Anyways, in Whidbey the problem is resolved...
The WSDL exe has a switch called /sharetypes and you can give the services for which you want to share the types and it will do it for you... The syntax will be something like...

Wsdl.exe /sharetypes http:(doubleSlash)AutoInsuranceServics/PolicyService.asmx?wsdl http:(doubleSlash)AutoInsuranceServics/PremiumService.asmx?wsdl


PS: A quick observation, I see many posts and queries on our UserGroups and Newsgroup which are so simple that typing just the first word in the google (also MSDN sometimes... Just kidding!!.. :-)) will result into sufficient information to answer the query... The point which I want to make is that it is also important to develop a good habit to try resolve to our own queries, ourselves... No one knows everything, but each one of us learn over a period of time right!!... Asking our own usergroup peers is not wrong but then at times its spoon feeding, it just makes us develop a bad habit... All I am saying is let us just try to make sure that we have exhausted all the resources at our end either time or material before we ask it out; might be trying for another 10 minutes will give us the answer we want!!...
Please do not get me wrong, do not stop asking me questions whenever you feel like, I do try answering as many as I can and I continue doing that!! (but now after the vacation.. :-))

Wednesday, November 17, 2004

VJs Tip Of The Day - November 17th 2004

Whidbey Days - Page.GetValidators method

Yesterday we talked about ValidationGroups now here is an application of the same... System.Web.UI.Page has now got GetValidators method... The signature of the method looks like below...

public ValidatorCollection GetValidators(string validationGroup)

Basically System.Web.UI.Page has got a property called "Validators"... This property was always there and it use to return back all the validators of a page... This property will ofcourse exist for Whidbey too but now this special method adds extra value...

As the signature indicates the GetValidators method will accept a string which will be validationGroup name which you have given to your validation controls and give you back a strongly typed collection of Validator Controls... If you do not pass the string name of validation group here it will return back the default validation group... This would be the same group which will be given by the Validators property...

I would recommend using this method as you would have a generic way of accessing the validators and if the group name is passed dynamically your page logic will work in both the cases...

PS: An easy way to find out how important you are to someone is to find out whether your contact number is stored in the phone book of that person... If someone does not care to store your number with them somewhere then PROBABLY he/she is not dependant on you in anyways...



Tuesday, November 16, 2004

VJs Tip Of The Day - November 16th 2004

Whidbey Days - BaseValidator.ValidationGroup property

I am not sure how many of you have thought about this but many a times there use to be scenarios when you wanted that not all the validation controls on the page behave and validate in the same set... So here is the option for you... There is a property in Whidbey BaseValidator which is called ValidationGroup...
This property takes a string value and is a easy way to group your different validation controls in a group...

As this is a property of BaseValidator it is automatically inherited in all the rest of the validation controls...

How to visualize the use of it... Say for example I have a text box and I have a range validator, required field validator, regular expression validator all associated with it... I want to group all of these validators together then I set all of their ValidationGroup property to a fixed value and then they get grouped... Easy isn't it...

PS: "Tangential Theory" - This a new word coined by me... What does a tangential theory means? Well tangential theory is a philosophical theory of special kind... It is a theory or a thought which might touch you but will probably not effect you or intersect you often... It is a theory which will give you a chance to think about and conclude whether it does interset your mind waves just at a tangent or will eventually somewhere intersect to create a larger impact... In nutshell, Tangential Theory gives you the point from which you can start analyzing... I would refer many of the PS: that come along the technical tips as tangents of the tangential theory... Enough for now right!!

Monday, November 15, 2004

VJs Tip Of The Day - November 15th 2004

Whidbey Days - Page.SetFocus method in ASP.Net

Many have struggled to do simple thing like setting up focus in ASP.Net page... Well not anymore... There is a simple method called Page.SetFocus in System.Web.UI.Page class in Whidbey...

Look at the signature of the method

public void SetFocus(Control) where the parameter is the control on which the focus needs to be set...

There is also an overload for the method available which takes string

public void SetFocus(String) where the parameter is the clientID of the control to set focus on...

There are two exceptions which this method can throw; they are ArgumentNullException in case the clientID or control to set focus on are null... The method also throws an InvalidOperationException in case the method is called after PreRender event of the page as after that the setting the focus is not possible...

Simple and Nice way isn't it... :-)

PS: November 19th will be temperory end of "Second Season" for tip of the day... I will be off for a one month long vacation and will catch up with you guys again in new year 2005 in the "Third Season"...

Wednesday, November 10, 2004

VJs Tip Of The Day - November 10th 2004

Debugging mess due to Whidbey Beta 1

My first gift from Whidbey... I had installed Whidbey alpha on my machine which had VS.Net 2002... After installing alpha my VS.Net 2002 ASP.Net applications could not be debugged... I tried all possible things but could not get it working again... Finally when I had to work on my previous apps and had no option I thought it was alpha version issue and so uninstalled alpha and started carrying on...
Now I have installed Whidbey beta 1 refresh and just to add to my worst fears again my older VS.Net web apps could not be debugged... Interestingly this time I installed Whidbey on virtual pc still the problem comes...
Just for your information if I get debugging issues with VS.Net I first do all the below possible things:

-I make myself a member of Debugger Users and VS Developers...
-I registered ASP.Net of appropriate framework version by aspnet_regiis -I (found in ...\WINDOWS\Microsoft.NET\Framework\VERSION FOLDERS (e.g v1.1.4322) -I have my ASP.Net debug property set to be true in the project properties...
-I check my web config file settings too....
- I also try to manually attach the apnet_wp.exe to debug the app...
-I check my machine.config file and see if the processModel tag is enabled... (found in ...\WINDOWS\Microsoft.NET\Framework\VERSION FOLDERS\CONFIG) -I use the world famous ASP.Net version switcher utility made by Denis (http://www.vishaljoshi.blogspot.com/2004_04_01_vishaljoshi_archive.html)...
-I do the same stuff which ASP.Net version switcher does manually also...
-I also run dotnetfx.exe once again just to be sure...

If none of the above solves my problem, I try to assume that something else is wrong... Btw, finally for the above issue I was informed by Dr Colin Brown, MVP that this is a reported bug for Whidbey and probably next version (beta 2) should solve it...

But then these are the problems which you embrace when you embrace a new technology... :-)

PS: Even after all these things... Whidbey is a cool thing to start working on ASAP... :-)

Tuesday, November 09, 2004

VJs Tip Of The Day - November 9th 2004

Xml Schema Generator Utility

.Net Framework provides a command line utility called xsd.exe which can do various Xml schema related tasks... If you provide xml file to the utility it can generate a schema for it... If you provide an assembly it can generate schema for the its types... If you provide it with a schema file (.xsd) then it will generate class code for you in the language of your choice...
It can also convert a .xdr file to a .xsd file... If you want to know more Click Here

PS: I am trying to work a little bit on Whidbey these days so I will try to post in interesting stuff on that...

PS: Today was "Father's Day" to me... It was my dad's birthday today and so I believe ideally that should be father's day to me right!!... Happy Father's day to me and little bro... Sometimes my mind denies to accept the days selected by companies like Archies and Hallmark to celebrate "Mother's Day" and "Father's Day"... I sometimes feel its a big marketing strategy but then I console myself that there is nothing wrong in making your father feel special twice right!!... Anyways, Happy Birthday Baba...

Friday, November 05, 2004

VJs Tip Of The Day - November 5th 2004

XmlDocument on WebService

This is just an observation which you can make... If there is a web method in your webservice which takes or returns a parameter of type System.Xml.XmlDocument then it gets converted into System.Xml.XmlNode on the client side (if you are using .Net on both the ends and adding web reference via wsdl.exe)...

ie if your service web method definition looks like below...
_
Public Function GetXmlDoc(ByVal Id As Integer, _
ByVal doc As XmlDocument) As XmlDocument
End Function

The proxy definition of the same method will look like below...
Public Function GetXmlDoc(ByVal Id As Integer, ByVal doc As System.Xml.XmlNode) As System.Xml.XmlNode
Dim results() As Object = Me.Invoke("GetXmlNode", New Object() {Id, doc})
Return CType(results(0),System.Xml.XmlNode)
End Function


It is an understood behavior that for WSDL you are always receiving a XmlNode if it is a document for you then you are suppose to implicitly convert the same into a XmlDocument...

I do wish that there was a special indication in WSDL which could inform the proxy generator whether a node is expected or a document is, but that is more to do with the WSDL file format right!!...

PS: Have a wonderful weekend... :-) If you are reading this mail on Monday then decide right away that you got to have a wonderful next weekend... If you were 'requested' to work over this weekend even if you had to do something for yourself at that time, then better start taking lessons on 'being affirmative'...
:-) If you have not seen the movie "Office Space" then make sure you grab it from somewhere and watch it next weekend... To an extent it helped me laugh at my own doomed situation... :-)

Thursday, November 04, 2004

VJs Tip Of The Day - November 4th 2004

Whidbey - Partial Classes

In Whidbey it would be possible to split huge class files into multiple parts... The keyword used for that is partial... The same keyword works for struct or an interface... When the assembly is compiled then all these files will be merged into one... This can be usually useful when multiple people have to work on same class or when autogeneration is used...
Due to autogeneration getting more and more popular now days the problem that exits currently is that if you modify any code in autogenerated files then again autogeneration with updates causes loss of the manual changes made... by using partial classes you can seperate the autogenerated and manually coded files...

e.g.
// This is the first file.cs
public partial class SameClass
{
public void AutoGenratedMethod()
{
}
}
// This is the second file.cs
public partial class SameClass
{
public void ManuallyCodedMethod()
{
}
}

PS: Next time you get a speeding citation do not pay it off directly... It is better to appear in the court if possible and explain your scenario, judges are usually understanding and if they do not reduce the fine they will probably reduce the points on your drivers licence... It also gives an implied message that you are concerned about your citation and so are ready to appear in the court... Many US states also provide you with an attorney to fight for you in case you have not hired one... :-)

Kathleen has added below points

Partial classes helps with code generation only in minimilast scenarios.
While it is very important there, derivation will remain the prime mechanism for customization - although not everyone has wandered down that road far enough to realize it.

Wednesday, November 03, 2004

VJs Tip Of The Day - November 3rd 2004

out parameters and proxy class in web services

There is a interesting thing to know about 'out parameters' in web services... Consider a scenario in which you have a web method which returns void but has some out parameters... When you try to create a proxy (when you add web reference to your web service), you can notice that the first out parameter is converted into return value on the proxy side...
This is important to know because if you are exposing your webservice without return value and only out parameters then you would definitely have a reason to do so and such behavior of the proxy generator might be unexpected, but that is how WSDL understands it and so you have to live with it...

For more information on the topic Click Here

PS: SharpReader is one of the most widely used RSS Aggregator... You can subscribe to many blogs via RSS after installing the same... You can download SharpReader for free at http://www.sharpreader.net/ and then click on File->Open RSS feed you can then type the RSS feed url for the blog and click subscribe... RSS feed url for all blogspot sites are similar to mine which is http://vishaljoshi.blogspot.com/atom.xml

Tuesday, November 02, 2004

VJs Tip Of The Day - November 2nd 2004

Why A HashTable Cannot be Xml Serialized

Javeed has posted the below question and it was probably a well asked question... Please read the mail below...

-----Original Message-----
From: Javeed Shaikh
Sent: Tuesday, November 02, 2004 10:17 PM
To: Vishal_Joshi@MVPs.org
Subject: Re: VJs Tip Of The Day

Hi Vishal,

I would like to know why a HashTable cannot be serialized?. Answer should be other than it is not inherited from some Interface, because this is the answer i got from many forums but no satisfactory answer.

Kind Regards

Javeed

Answer
There are many classes in .Net which cannot be xml serialized and they have their own reasons behind it... Ofcourse the default answer to a question -Why a particular class is not getting serialized? Is that it does not implement ISerializable, but it is good sometimes to reason out why did the .net class library team not implement ISerializable for them and many a times even if ISerializable is implemented why does Xml Serialization still is not truly functional for these classes... Wouldn't it be nice to have all the framework data carrying classes serializable (let's not get into this!!)... Well, here is the reason for Hashtable... The reason can be tweaked and extended to members which implement IDictionary...
For members with indexers XmlSerializer expects the index to be an integer, in case of hash-table its a key-value pair and thus not necessarily an integer... This makes the default HashTable not serializable for XmlSerializer...
Thus calling the below method will throw an error at the text marked bold...

Imports System.IO
Imports System.Xml.Serialization
Class DoSerialization...
Public Sub Serialize(ByVal hst As Hashtable)
Dim serializer As New XmlSerializer(GetType(Hashtable))
Dim writer As New StreamWriter("C:\Hastable.xml")
serializer.Serialize(writer, hst)
End Sub

The error thrown in the above code will be:
"An unhandled exception of type 'System.InvalidOperationException' occurred in system.xml.dll
Additional information: There was an error reflecting 'System.Collections.Hashtable"

and now perhaps the reason must be evident as to why there is a reflecting error...

How do you work around for this problem... Easy way would be to copy the content of the hash table into something that is serializable (e.g. array) and then on the other end again deserialize the same back into a hash table if it is that important to use a hash table... :-)

Further comments are invited...

PS: There have been rumors about MS Student Ambassadors being paid and doing favored jobs for Microsoft for personal benefits... Folks like Student Ambassadors, Community Stars, MVPs etc are volunteers who are passionate about their respective technologies and so are evangelists for the same, they do not expect anything in return... A very active student ambassador named Sriram Krishnan, who is associated with CNUGStudent and other community activities has replied on one such allegation... Me and many others in the MVP community had appreciated Sriram's mail and I requested him to allow the mail transcripts to be posted on the blog... Below are the details (read from bottom up)...

-----Original Message-----
From: Sriram Krishnan
Sent: Tuesday, November 02, 2004 1:48 AM
To: 'Vishal Joshi'
Subject: RE: request

Go ahead - its time people heard our side of the story. And thanks for the kind words - nice to know that all you guys are there to back me up :-)

Sriram

-----Original Message-----
From: Sriram Krishnan [mailto:ksriram@gmx.net]
Sent: 01 November 2004 13:17
To: 'rms@gnu.org'
Subject: Microsoft Student Ambassadors and .NET presentations

Hi,

A friend of mine forwarded me your views on Microsoft Student
Ambassadors and .NET sessions. I'm one of the Microsoft Student
Ambassadors involved in this and I wanted to reply to
clear up some of the misconceptions in the original mail. But I thought an intro on MSAs and that we do would be appropriate.
Before anything else, let me state that I have huge
respect for the GNU movement and for you personally. I do not want to enter into any argument on our differing views- but rather give you the full story as I fear you have formed a opinion without having all the facts. I admit that my views differ - but I am a technology
enthusiast and I run 2 different GNU/Linux distros at home . So by no means am I a
'M$ spy'. Microsoft roped me in as a student ambassador after seeing some of efforts to spread technology awareness. They do not pay me in any way - apart from the odd t-shirt and CD, everything we do is on our own and is not motivated by any benefit from
Microsoft. And I'm not looking for a job there either - I've already got a job in an Indian company which I plan to take up when I finish college. By the way, Microsoft is deceiving people when they say this is an open standard", since in the US they are trying to patent some
aspects of it. It could be useful to bring that up and expose it.
I'm not sure whether you've been told the entire story. We never wanted to do a session on Microsoft .NET. It would be *highly* improper for us to talk about any proprietary software in a GLUG meeting. I have no intention of doing that. What I wanted to talk about was Mono - as we felt that the Mono license was good enough for the meeting.I admire Miguel and his team and the work they are doing. However, we were told that Mono was not acceptable
as though the license is ok, it is *tainted* as Microsoft is behind the original technology. I totally understand that logic and would have been happy to let it go if that logic had been followed without any break. However, this same group had recently had a session on
Java, whose roots are definitely not free and Sun, to this date, hasn't published their source code. What I ask is - why the double standards? Isn't proprietary software unacceptable at a GLUG meeting? Why allow a demo of Java but not a demo of Mono?
We were asked to do a session on DotGNU. I personally disagree with some of the things that the DotGNU page says and Mono is the better-known of the two. When I wanted to have a debate about this on the mailing list(which ballooned into a flame war) or during the
session itself, I was told to go pound sand and not to send any more mails on the topic. The moderator wasn't even interested in listening to the views of the members as a lot of members did express an interest in Mono.I'm very disappointed that a GNU group doesn't believe in hearing other people's opinions and in rational debate.
Let me make something very clear - at no point was I talking about Microsoft or any proprietary software. I talked and intended to talk only of Mono and of its license and the Mono teams views (from their faq page). I understand that you and several others have reservations over Microsoft's ECMA standards. However Sun's Java process is not even an open standard - so why allow Java and show me the door?

From what you are saying, it sounds like they are starting phony "open source" groups. Can you find any specific statements that you can quote? We could embarrass them badly by documenting this, but we need specific quotes, specific proof.

You are very right in asking for proof. I am well-aware of the differences between open source and proprietary software. What we form are usergroups, not too different from the communities you see on Usenet , or Apple Mac fans, for example. Every month or so, we ( a bunch of .NET enthusiasts) meet at a place where one of us takes a session on some aspect of .NET. I try and encourage people not familiar with .NET to come and attend. Let me make one thing *very*
clear - we do not call ourselves an 'open' group or try to pretend to be something we're not. We want people to attend who know fully well what kind of sessions they're attending. I do not have any intention of trying to fool or misguide people by calling our groups 'open' or calling Microsoft software 'open source'. I do talk about Rotor and Microsoft's Shared Source License.
However,I know that the SSCLI is not a license that is accepted by the FSF. I do not fool people by telling them that it is an 'open source' license. In fact, during my sessions, I highlight
the part of the license where it says people cannot make any commercial
profit and other key differences between this and the GPL. We do not want people to think that Shared Source is something it is not - we want people to only use Shared Source only when they *completely* understand what the license is about. I have at no point of time
called Rotor as 'free software' - what I have said is that 'Rotor is a free download' which is meant to inform students that they don't have to pay to download it. IANAL, and I tell students that the Shared Source license and the GPL are very different and then encourage them to find out the specifics for themselves. And at no point in my sessions do I deride the GPL or any other open source license or claim that the SSCLI is better. I want to tell people what it is and that it is out there - people can make an informed choice for themselves.

There is nothing phony about us or in our love for technology. I understand that you may not agree - but please do understand that I'm not a thief or a spy trying to fool people. I've asked Joe Steeve (the moderator of the GLUG-Madurai) to attend our sessions to see for himself
what we talk about but he hasn't turned up once. However, as someone who has done
over 10-15 of these sessions, let me assure you that these sessions are usually about some intricate aspect of .NET and the only time we've spoken of GNU/Linux is when people have asked us whether .NET can be run on Linux.

2. Recruit a couple of people to pretend to be interested in joining, go to the meeting, and speak up within it to identify the lies.
I have been saying this for a long time. I try and encourage discussion and debate in our group and would love to have other points of views. However, I'm afraid they won't see any choice quotes bashing GNU/Linux or the Free software movement. What they'll see is a *lot* of technical information on Microsoft software.

4. Treat the MSA program and its representatives as liars. Don't treat them as respectable or legitimate.
I object to this - how have I lied? Our opinions differ , yes. But I do not try to fool people. And the original mail had accused me of lying - I would like to see some proof of this 'lying'. Proprietary software nutcase I may be, spy or liar, I am not.

I regret that you have been pulled into this and not been given the whole story. I do not agree with some of the things the FSF says,but I do not think that means I'm a liar or evil in some
way.I sent you this mail as I'm highly saddened that someone I admire a lot and someone whose work I use everyday(I'm an Emacs fan) has branded me without getting all the facts.
It is possible I am misguided - I am only 20 years old. But I'm not consciously trying to harm anyone or fool anyone.

Thanks,
Sriram



-------- Original Message --------
From: Richard Stallman
A MSA who was pestering me for a DotNET session at
GLUG-Madurai argued that DotNET being an Open Standard, I should not
object him promoting it in the GLUG.

When he said this, he was taking advantage of a broader
misunderstanding. The idea of GNU/Linux is to be free
software; "open standard", even if that is true, is not good
enough if the software itself is non-free.

So it looks like we need to educate all GLUGs (and
LUGs, if they will listen) to recognize and teac that people should not promote
non-free software--regardless of the details.

By the way, Microsoft is deceiving people when they say
this is an "open standard", since in the US they are trying to patent some
aspects of it. It could be useful to bring that up and
expose it.

The lesson that I learn from these people is to
outrightly reject their requests. They are not worth the trouble.

We should always refuse to give developers of non-free
software a platform to speak. However, saying that this is "not worth the
trouble" is misleading, because it is implies there is some
potential good to be achieved--if only it were easier to do.

What they are doing is bad, pure and simple. There is
no good in it.

M$ through its Micro$oft Student Ambassadors
is doing a large scale mobilisation in colleges amongst the
student community. They wrap their stuff under
labels such as "M$s Open Source venture", "Open Technology", etc..
They are forming student groups in colleges.

From what you are saying, it sounds like they are
starting phony "open source" groups. Can you find any specific statements
that you can quote? We could embarrass them badly by documenting
this, but we need specific quotes, specific proof.

If you could go to a meeting where they try to recruit
new people, and make a recording so that you can quote them exactly, that
would be useful too.

Once we have solid proof, we could use various methods
to organize against them.

1. Make handouts denouncing them as a fraud. Whenever
they have an event, a few of you can stand near the door and hand
out copies to whoever is attending. In effect, stage a quiet and simple
protest against each of their meetings, accusing them of lying.

2. Recruit a couple of people to pretend to be interested in
joining, go to the meeting, and speak up within it to identify the lies.

3. Write articles for student newspapers about the deception.

4. Treat the MSA program and its representatives as liars.
Don't treat them as respectable or legitimate.

5. Call on the university to close the program down for lying.
Even if this campaign does not succeed, it will generate public
awareness that will be useful in all ways. So renew the campaign each
year!




Monday, November 01, 2004

VJs Tip Of The Day - November 1st 2004

Serialization Constructor

For your class to be serialized by Xml Serializer it is needed that it has a default constructor... For your class, if you only have a constructor which takes some fixed arguments and does not have a constructor which takes in no arguments the serializer is not able to create an instance of your class to serialize and so it fails with an error..

An unhandled exception of type 'System.InvalidOperationException' occurred in system.xml.dll

Additional information: ApplicationName.ClassName cannot be serialized because it does not have a default public constructor.

Similarly error might also occur in case you are using Activator class's Create instance method for some type which does not have default public constructor and you are not passing the constructor parameters...

So in short if it is not harming the base functionality it is always good to have default constructor for your class...

PS: Most of the manufacturing industries have got their "Labor Unions" in place... These bodies have helped putting a check on unscrupulous and inhumane employers from illtreating their employees... Manufacturing industries have been here since ages, but IT industries have just came into being... How about starting "ILU (Information technology Labor Union)" which will be a social regulatory body that will be a registered organization with WTO and funded by all the "good IT employers"... Being registered in the organization will help employers to go up the ladder in the "Best Companies To Work For" list/awards; also not getting any complains registered against the company in ILU would help... Moreover this body will be a neutral regulatory body and thus any employee working in any IT firm can register a complain and this body will make sure that no injustice will happen to the employee... This body can help employees raise rightful voices which would be given just 'lip services' or even worst deaf ear otherwise... I am planning to write a white paper on this idea; but then I am not sure whom to forward it to... If you have any tips let me know...
BTW, just FYI my employer is treating me really very well, but then I wish everyone feels the same about their employers too... Well this is a big IP I am sharing out on the blog... So the copy rights notice goes along with... If you want to start something of this sort contact me and we will get it rolling... :-)