Labels

Sunday, July 29, 2007

Object.Finalize


Below are the facts on Finalize() method.

 

·          Destructors are the C# mechanism for performing cleanup operations. Destructors provide appropriate safeguards, such as automatically calling the base type's destructor.

·          In C# code, Object.Finalize cannot be called explicitly or overridden. All you can do is implement a destructor. And note, when the C# compiler compiles a destructor, it implicitly translates the destructor code to the equivalent of a Finalize() method that ensures the Finalize() method of the parent class is executed.

·          This method is automatically called after an object becomes inaccessible, unless the object has been exempted from finalization by a call to SuppressFinalize.

·          Finalize is automatically called only once on a given instance, unless the object is re-registered using a mechanism such as ReRegisterForFinalize and GC.SuppressFinalize has not been subsequently called.

  • Every implementation of Finalize in a derived type must call its base type's implementation of Finalize.

 

  • A type must implement Finalize when it uses unmanaged resources such as file handles or database connections that must be released when the managed object that uses them is reclaimed.

 

 

·          Finalize operations have the following limitations:

·          The exact time when the finalizer executes during garbage collection is undefined.

·          The finalizers of two objects are not guaranteed to run in any specific order, even if one object refers to the other. That is, if Object A has a reference to Object B and both have finalizers, Object B might have already finalized when the finalizer of Object A starts.

·          The thread on which the finalizer is run is unspecified.

·          Resources are not guaranteed to be released at any specific time, unless calling a Close method or a Dispose method.

 

·          The Finalize method might not run to completion or might not run at all in the following exceptional circumstances:

o         Another finalizer blocks indefinitely (goes into an infinite loop, tries to obtain a lock it can never obtain and so on). Because the runtime attempts to run finalizers to completion, other finalizers might not be called if a finalizer blocks indefinitely.

o         The process terminates without giving the runtime a chance to clean up. In this case, the runtime's first notification of process termination is a DLL_PROCESS_DETACH notification.

 

 

Regards

Arun.



Once upon a time there was 1 GB storage in your inbox. Click here for happy ending.



Get the freedom to save as many mails as you wish. Click here to know how.

Thursday, July 12, 2007

Asynchronous Events

We know about Asynchronous Delegates.

 

e.g

 

delegate string DownloadString (string uri);

DownloadString download1 = new DownloadString(Print);

IAsyncResult cookie1 = download1.BeginInvoke (uri1, null, null);

string s1 = download1.EndInvoke (cookie1);

 

 

public string Print(string url)

{

          Return “”;

}

 

 

Similar to Asynchronous Delegates, there are Asynchronous Events.

This is called the "event-based asynchronous pattern" and is distinguished by a method whose name ends with "Async", and a corresponding event whose name ends in "Completed".

 

So for above example – There would be DownloadStringAsync method. To use it, you first handle the "Completed" event (e.g. DownloadStringCompleted) and then call the "Async" method (e.g. DownloadStringAsync).

 

When the method finishes, it calls your event handler.

 

The event-based pattern also offers events for progress reporting and cancellation, designed to be friendly with Windows applications that update forms and controls. If you need these features in a type that doesn't support the event-based asynchronous model (or doesn't support it correctly!) you don't have to take on the burden of implementing the pattern yourself, however (and you wouldn't want to!) All of this can be achieved more simply with the BackgroundWorker helper class.

 

Friday, July 6, 2007

Prevent Enter Key

function noenter(e){

     var keycode = null;

     keycode = e==null ? event.keyCode : e.which;

     /*OR

     if (e == null) { // ie

     keycode = event.keyCode;

     } else { // mozilla

     keycode = e.which;

     }*/

     return (13 == keycode);

}

 

 

function CheckEnterKey()

{          

                        if (event.keyCode == 13)

                        {                                                                      

                                    window.event.returnValue = null;

                        }                                  

}

 

 

Thanks & Regards,

Arun Manglick

SMTS || Microsoft Technology Practice || Bridgestone - Tyre Link || Persistent Systems || 3023-6258

 

DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.

Thursday, July 5, 2007

GOOGLE ROCKS AGAIN... GMail drive...

Chk it out.. Things you need to have:

1) Gmail account


2) Gmail Drive software Process:


i) Download Gmail Drive from (takes seconds to download)


http://www.softpedia.com/progDownload/GMail-Drive-shell-extension-Download-15944.html

ii) Install the software.


iii) After installing, a drive named Gmail drive will be created in My Computer (just like C: D.
)

iv) Double click on this drive, login to Gmail acct. You will get a space of 2.61 GB.


v) Whatever content you copy to this drive will be sent to your mail acct directly to which you have logged in. The copy is pretty fast

Priniting using CSS

<head runat="server">

            <link rel="stylesheet" href="css/screen.css" type="text/css" media="screen"/>

            <link rel="stylesheet" href="css/print.css" type="text/css" media="print"/>

            <link href="css/ButtonRollover.css" rel="stylesheet" type="text/css" />

            <link href="css/Miscellaneous.css" rel="stylesheet" type="text/css" />

</head>

 

Thanks & Regards,

Arun Manglick

SMTS || Microsoft Technology Practice || Bridgestone - Tyre Link || Persistent Systems || 3023-6258

 

DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.

Memory - Tyrelink Drops

Tyrelink Drops

----------------------

Expected Dates:

-------------

05 Feb - Phase 1

28 Feb- Phase 2

-----------------------

 

Actual

-----------

5 Mar - Phase 1

10Apr - Phase 2

20Apr - Phase 2.1 -  Bug Fixing

15May - Phase 2.2 - Enhancement + GUI Uniform

28May- Phase 2.3 - After Bug Fixes

01Jun - Wekly Drop1

08Jun - Wekly Drop2

15Jun - Weekly Drop 3

so on .. Till 06 July

 

Arati Visit to Brussels : 29 May - 06 July 07

Objective Settings : 07Jun 07

 

 

Thanks & Regards,

Arun Manglick

SMTS || Microsoft Technology Practice || Bridgestone - Tyre Link || Persistent Systems || 3023-6258

 

DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.

Info Card:

Windows CardSpace, formerly codenamed “InfoCard”,  is a piece of client software, that enables users to provide their digital identity to online services in a simple, secure and trusted way.

It is what is known as an identity selector:  when a user - or subject - needs to authenticate to a website or a web service, CardSpace pops up a special security-hardened UI with a set of “cards”  for the user to choose from. Each card has some identity data associated with it - though this is not actually stored in the card - and has been given to the user by an identity provider such as their bank, employer or government. In fact, the user can also act as an identity provider - this is essentially what we do every time we register at a website. The CardSpace UI enables users to create Personal cards and associate a limited set of identity data. When the user chooses a card, a request in the form of a web service call goes to the relevant provider, and a signed and encrypted security token is returned containing the required information (e.g. credit limit, employer’s name and address, or perhaps a social security number). The user, in control of the flow of information at all times, then decides whether to release this information to the requesting online service. If the user approves then the token is sent on to this relying party where the token is processed and the user is authenticated.

 

CardSpace is an implementation of an identity selector on Microsoft Windows. Other operating systems will see their own identity selector implementations.

 

The architecture upon which CardSpace has been built - consisting of subjects, identity providers and relying parties - is called “The Identity Metasystem”.

 

 This isn’t just a Microsoft initiative, but rather it is the shared vision of many across the industry as to how we can solve some of the fundamental identity challenges on the Internet today. The initial vision for the Identity Metasystem was developed by Microsoft’s Identity Architect, Kim Cameron, and has been broadly adopted and championed by thought-leaders such as Doc Searls and Lawrence Lessig. To learn more about the metasystem and the guiding principles behind it (“The Laws of Identity”), refer to the whitepapers on MSDN and Kim’s blog, www.identityblog.com.

 

 

Thanks & Regards,

Arun Manglick

SMTS || Microsoft Technology Practice || Bridgestone - Tyre Link || Persistent Systems || 3023-6258

 

DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.

Globalization and Localization

Globalization and Localization

-------------------------------------------

Globalization is the process of designing your application so that it is possible later to have it translated and support multiple cultures. So, here you might not even actually make any translations but are making the application ready for it. Once you have globalized your application and now want to translate it into a specific culture, the translation process is called localization.

 

To globalize your application, the most important change to be done is that instead of hard-coding things such as display strings, move them to resource files. You then can set the control properties by reading the resource files. When you want to localize your application, have the resources translated to the languages you want to support. This will be covered in detail in this article.

 

The Difference Between Culture and Language

----------------------------------------------------------

Culture consists of language plus the country/region. Culture is usually denoted by a combination of a two-letter lowercase code (called culture code) denoting the language and a two-letter uppercase code (called sub-culture code) denoting the country or region. For example, "de-DE" for German in Germany and "de-AT" for German in Austria (even though the language is the same, they are different cultures!).

 

    Note: A neutral culture is a culture that is associated with a language but not with a country/region, for example, "de" for German.

 

Culture affects not only things like which language a particular string is shown but also things like the date format used, the decimal separator, currency symbol, and so on.

 

Culture and UICulture

-------------------------------

In ASP.NET, you can set to two culture values: the Culture and UICulture properties.

The Culture value determines things such as date, number, currency formatting, and so on. For example, it is the Culture setting that decides whether the date is in the dmy format or mdy format and what names to use for the month and for numeric values what the decimal separator is.

The UICulture value determines which resources are loaded for the page. So, it controls things like which translated text to show. In most cases, you will set Culture and UICulture to the same culture.

 

Culture is set at the thread level by setting the CurrentCulture and CurrentUICulture properties of the thread. You either can set it directly or ASP.NET will set it for you.

 

Setting in Three Ways:

------------------------------

 

1. Set it declaratively: In the web.config file or in the @Page directive in the page, you can specify the culture as shown:

 

web.config: <globalization uiCulture="es-MX" culture="en-US" />

@Page Directive: <%@ Page  UICulture="es-MX" Culture="es-MX" %>

 

2. From the client browser's language setting:

 

3. Set it programmatically: In most cases, you will need to give an explicit way on your Web site for the user to select their language of choice. In such cases, you need to set the culture programmatically. Set these in the InitializeCulture method for the page.

 

Thread.CurrentThread.CurrentCulture =

   CultureInfo.CreateSpecificCulture(selectedLanguage);

Thread.CurrentThread.CurrentUICulture =

   new CultureInfo(selectedLanguage);

 

 

 

Thanks & Regards,

Arun Manglick

SMTS || Microsoft Technology Practice || Bridgestone - Tyre Link || Persistent Systems || 3023-6258

 

DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.

How Serialization & De-Serialization works in General :

-------------------------------------------------------------------

I tell you how the customization of the serialization and deserialization works in general. At first, you need to implement the ISerializable interface. This interface contains a single method, named GetObjectData, which is responsible for storing object fields during the serialization process. To do this, you just need to populate a passed SerializationInfo object.

 

The deserialization process works exactly the other way round. When an object is being deserialized, the previously filled SerializationInfo object is passed to the constructor of your class in which you are responsible for restoring the original object fields.

 

 

Thanks & Regards,

Arun Manglick

SMTS || Microsoft Technology Practice || Bridgestone - Tyre Link || Persistent Systems || 3023-6258

 

DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.

Parameters

 

    Protected Sub btnAddEnTry_Click(ByVal sender As Object, ByVal e As EventArgs)

        srcGuestBook.InsertParameters("Name").DefaultValue = txtName.Text

        srcGuestBook.InsertParameters("Comments").DefaultValue = txtComments.Text

        srcGuestBook.Insert()

    End Sub

 

 Protected Sub srcGuestBook_Inserting(ByVal sender As Object, ByVal e As

 SqlDataSourceCommandEventArgs)

        e.Command.Parameters.Add(New SqlParameter("@Name", User.Identity.Name))

    End Sub

 

 

 

 Protected  Sub srcGuestbook_Inserting(ByVal sender As Object, ByVal e As

 ObjectDataSourceMethodEventArgs)

        e.InputParameters.Add("IPAddress", Request.UserHostAddress)

    End Sub

 

 

Thanks & Regards,

Arun Manglick

SMTS || Microsoft Technology Practice || Bridgestone - Tyre Link || Persistent Systems || 3023-6258

 

DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.

Vraious Modes in HTML

-----------------------------

 

"Legacy" mode (non-XHTML markup )

Transitional mode (XHTML Transitional)

 Strict mode (XHTML Strict). 

 

Note:

ASP.NET 1.0 and 1.1 didn't emit XHTML compliant markup from many of its server controls.  ASP.NET 2.0 changed this and by default emits XHTML compliant markup from all controls.

 

 

Thanks & Regards,

Arun Manglick

SMTS || Microsoft Technology Practice || Bridgestone - Tyre Link || Persistent Systems || 3023-6258

 

DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.

Problem Solving for SSL:

------------------------------

- To run a page on https, we need to explicitly request the page uisng https.

- To force a page/folder to execute in secure mode do as:

            - Right Click either WebSite/Folder/PAge

            - Directory Securoty Tab

            - Secure Communications

  Once done, IIS won't display the page if its is been requested without https.

 

- Programmatically, we can determine it as:

            If Request.IsSecureConnection Then

                        ----

            else

                        -----

            End if

 

 

Thanks & Regards,

Arun Manglick

SMTS || Microsoft Technology Practice || Bridgestone - Tyre Link || Persistent Systems || 3023-6258

 

DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.

Small Issues & Solutions possibly

 

Other Issues

------------------------

 

  1. If we add reference to the system dll [Shared DLLs  e.g System.Window..Forms. Oracle.daTaAccess etc ] in our Web -Proejct, then it does below.
    1. Makes an entry into Web.config, but
    2. Do not copy the referred DLL into bin. That is, these system dlls are still referred from GAC.

 

  1. But When we do this operation in Class Library projects then it does below:
    1. Adds those DLLs into an virtual folder [named as ‘Reference’] as it has no Web.config.
      1. Here the ‘localcopy’ is set to ‘false’, i.e It refers them from the shared location [GAC].
    2. Do not add them in the bin folder.

 

  1. If we add reference to other DLLs, which are not placed in GAC [ Hence not considered as shared DLLs] [ Like Crystal DLL or AJAX control Tool kit DLLs], then it does two things :

 

    1. Makes an entry in  web.config and
    2. Also  makes a local copy in the bin folder as well.

 

  1. But When we do this operation in Class Library projects, then it behaves same as when we refer shared DLLs. i.e

 

    1. Adds those DLLs into an virtual folder [named as ‘Reference’] as it has no Web.config.
      1. Here the ‘localcopy’ is set to ‘true,
    2. Also adds them in the bin folder.

 

 

Note: In case of Non-Shared DLLs, they are either kept locally in the Web-Application’s bin folder [In Web Project] or placed in virtual folder [named as ‘Reference’] with ‘localcopy’ is set to ‘true’. So now even if ur computer has upgraded the new version of dlls, it won't affect ur application unless u remove the reference and re-refer it.

 

 

  1. [Noticed in Tyrelink] :: We need to give write access to the folders if our web application is writing ito it. e.g Logfiles folder in Tyrelink.

 

  1. If ur Web- Solution has Class-Library project [BL] and Web Application then we are required to add the reference of the BL only once. After that as an when we compile the BL, the reference in Web is automatically refreshed. [Read in .Net 2.0 Book].

 

  1. ‘this’ in JS denotes page, rather than object that raised the event.

 

  1. Note:

If u need a hidden button or hidden text box then instead of getting into the visibility properties of the controls, better solution is keep them in div as : <div style="display:none"> ........</div>

 

 

Thanks & Regards,

Arun Manglick

SMTS || Microsoft Technology Practice - Bridgestone - Tyre Link || Persistent Systems

 

DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.

Issues find while working with ATLAS & Mozilla-IE

Issues find while working with ATLAS & Mozilla-IE.

----------------------------------------------------------------

 

  1. Dropdown attached with JS call, and embedded in update panel does not fire Selection Change Event.

 

  1. Button.click thru JS will call server side event in IE but not in Mozilla. Hence if the buuton is not placed within updatePanel will result in postback incase of IE and not in Mozilla.

 

  1. Session access in TreeView node change event results in Sys.Webforms.PageRequestErrorParseErrorException.  It happens only for the first time and only when Treeview is placed within updatePanel. Again this is IE specific issue.

 

  1. Error lablel,  placed within UpdatePanel , behaves eratically when a button placed within UpdatePanel is clicked. Eratic behavoiur is it displays the error label when server side event of button is clicked. Reason is, the button click does not executs the client side: body-onload().

 

  1. asp:Validatior control does not behave properly when placed within UpdatePanel. Fix is give by Lokesh as a seperate DLL.

 

 

Thanks & Regards,

Arun Manglick

SMTS || Microsoft Technology Practice || Bridgestone - Tyre Link || Persistent Systems || 3023-6258

 

DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.

Problem- Dropdown requires a hidden click if it has a JS validation attahced

Note : Below problem is both in AJAX & Non-AJAX

 

Let say you have a drop down. You have a JS attached with it.

 

// ------------------------------------------------------------------------------------------------------------------------

<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true" CausesValidation="True" onchange="return Validate();" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">

            <asp:ListItem>aa</asp:ListItem>

            <asp:ListItem>bb</asp:ListItem>

            <asp:ListItem>cc</asp:ListItem>

        </asp:DropDownList>

       

 <asp:Button ID="Button1" runat="server" Text="" OnClick="Button1_Click" Visible="True" />  // Will be hidden button

// ------------------------------------------------------------------------------------------------------------------------

 

// ------------------------------------------------------------------------------------------------------------------------

<script  type="text/javascript">

 

              function Validate()

    {

 

       num = 6;  // Here, could be any compelx logic.

       if(num > 5)

            return true; 

     else

        return false;

    }

 

</script>

// ------------------------------------------------------------------------------------------------------------------------

 

 

What is wrong:

 

            When you change some selection in dropdown, then JavaScript fires and returns ‘ true’. Now though it returns ‘true’ the Server side event does not fires.

            Hence you need to change the script as below.

 

              function Validate()

    {

      num = 6;  // Here, could be any compelx logic.

       if(num > 5)

            {

         // return true;  // Comment it.

 

        var hiddenButton=document.getElementById('<%= Button1.ClientID %>');

        hiddenButton.click();

}

     else

        return false;

    }

 

</script>

 

Solution Required:

 

            Need some good Solution. Please help.

 

 

Thanks & Regards,

Arun Manglick

SMTS || Microsoft Technology Practice || Bridgestone - Tyre Link || Persistent Systems || 3023-6258

 

DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.