Thursday, 18 April 2013

display gif image in when Button click in update panel


<asp:UpdatePanel ID="upDateSelection" runat="server">
                                <ContentTemplate>
                                    <asp:UpdateProgress ID="updateProgress" runat="server">
                                        <ProgressTemplate>
                                            <div style="position: fixed; text-align: center; height: 800px; width: 80%; margin-top: 45px;
                                                margin-right: 50px; left: 20px; z-index: 9999999; background-color: white; opacity: 0.6;">
                                                <asp:Image ID="imgUpdateProgress" runat="server" ImageUrl="~/images/progress.gif"
                                                    AlternateText="Loading ..." ToolTip="Loading ..." Style="padding: 10px; position: fixed;
                                                    top: 45%; left: 50%;" />
                                            </div>
                                        </ProgressTemplate>
                                    </asp:UpdateProgress>
                                    <telerik:RadButton ID="rbDateSelection" runat="server" Text="Submit" Width="100"
                                        CssClass="rdbutton" OnClick="rbDateSelection_Click" OnClientClicked="InvalidDates">
                                    </telerik:RadButton>
                                </ContentTemplate>
                            </asp:UpdatePanel>

Display gif image in when aspx page loads


//CSS


 div#example
        {
            display: none;
        }
       
        div#loading
        {
            text-align: center;
            cursor: wait;
        }



//Javascript Code

    <script type="text/javascript">// <![CDATA[
        function preloader() {
            document.getElementById("loading").style.display = "none";
            document.getElementById("example").style.display = "block";
        } //preloader
        window.onload = preloader;
// ]]></script>




//For loading gif Image
   <div id="loading">
        <div style="position: fixed; text-align: center; height: 800px; width: 98.5%; margin-top: 45px;
            z-index: 9999999; background-color: white; opacity: 0.6;">
            <asp:Image ID="imgUpdateProgress" runat="server" ImageUrl="~/images/progress.gif"
                AlternateText="Loading ..." ToolTip="Loading ..." Style="padding: 10px; position: fixed;
                top: 45%; left: 50%;" />
        </div>
    </div>


    <div id="content" class="k-content" style="margin-top: 0px; border: 0px">//Actual html content place here
</div>

Wednesday, 27 February 2013

Error log


using System;
using System.Collections.Generic;
using System.Web;
using System.IO;
using System.Diagnostics;
using System.Text;


/// <summary>
/// Summary description for ErrorLog
/// </summary>
public class ErrorLog
{
   
    public ErrorLog()
    {
        //
        // TODO: Add constructor logic here
        //
    }
         public static bool WriteErrorLog(string strErrorFileName, string strErrorString)
    {
        /*---------------------------------------------------------------------------
        Function Name : WriteErrorLog
        Arguments  : strErrorFile, strError
        Return Type   : bool
        Description  : Write Error Log in Text File
        ---------------------------------------------------------------------------*/

        bool boolReturn = false;

        strErrorString = System.DateTime.Now.ToShortDateString() + " " + System.DateTime.Now.ToLongTimeString() + ": " + strErrorString.ToString();
        try
        {
            if (strErrorString.ToUpper().Substring(0, strErrorString.Length - 1) != "THREAD WAS BEING ABORTED")
                boolReturn = IsWriteLog(strErrorFileName, strErrorString);         //Write Error Log in Text File
        }
        catch (Exception)
        {

        }
        return boolReturn;
    }
         public static bool WriteErrorLog(string strErrorString)
         {
             /*---------------------------------------------------------------------------
             Function Name : WriteErrorLog
             Arguments  : strErrorFile, strError
             Return Type   : bool
             Description  : Write Error Log in Text File
             ---------------------------------------------------------------------------*/

             string strErrorFileName = @"~\ErrorLogs\" + (DateTime.Today.ToLongDateString());
             bool boolReturn = false;

             strErrorString = System.DateTime.Now.ToShortDateString() + " " + System.DateTime.Now.ToLongTimeString() + ": " + strErrorString.ToString();
             try
             {
                 if (strErrorString.ToUpper().Substring(0, strErrorString.Length - 1) != "THREAD WAS BEING ABORTED")
                     boolReturn = IsWriteLog(strErrorFileName, strErrorString);         //Write Error Log in Text File
             }
             catch (Exception)
             {

             }
             return boolReturn;
         }

    private static bool IsWriteLog(string strErrorFile, string strError)
    {
        /*---------------------------------------------------------------------------
        Function Name : IsWriteLog
        Arguments  : strErrorFile, strError
        Return Type   : bool
        Description  : Create Text file and write Errors.
        ---------------------------------------------------------------------------*/

        StreamWriter swErrorFile;
        FileInfo fiFileInfo;
        int intMaxLogSize;
        bool boolReturn;


        // Get maximum error log size from web.config, use default of 100K if not found.
        intMaxLogSize = 1000000;

        try
        {
            if (Directory.Exists(HttpContext.Current.Server.MapPath(@"~\ErrorLogs\")) == false)
            {
                Directory.CreateDirectory(HttpContext.Current.Server.MapPath(@"~\ErrorLogs\"));
            }
            // Set reference to passed error file.
            fiFileInfo = new FileInfo(System.Web.HttpContext.Current.Server.MapPath(strErrorFile + ".log"));

            if (fiFileInfo.Exists)
            {
                // If current error file larger than max size.
                if (fiFileInfo.Length > intMaxLogSize)
                {
                    // Copy current error log to new file appending '_old' to current name,
                    // overwrite file if already exist.
                    swErrorFile = fiFileInfo.CreateText();
                    fiFileInfo.CopyTo(swErrorFile + "_" + DateTime.Now.Date.ToShortDateString() + ".log", true);
                    // Open stream to overwrite current error log file.                      
                }
                else
                {
                    // Open stream to append to current error log file.
                    swErrorFile = fiFileInfo.AppendText();
                }
            }
            else
            {
                // Create and open stream to error log file.
                swErrorFile = fiFileInfo.AppendText();
            }

            //Write to error log and close stream
            swErrorFile.WriteLine(strError);
            swErrorFile.WriteLine();
            swErrorFile.Close();


            return boolReturn = true;
        }
        catch (Exception)
        {
            boolReturn = false;
        }
        return boolReturn;
    }



    #region Log Exception in Error Log
    public static void Log(Exception exception)
    {
        /*-----------------------------------------------------------------------------------------------
        Function Name   : Log
        Arguments    : exception
        Return Type     : void
        Description    : Logs the Exception in a log file which is generated in the name of the aspx page
        -----------------------------------------------------------------------------------------------*/
        string strFileName = DateTime.Today.ToLongDateString();
        string strErrorLogPath = (HttpContext.Current.Server.MapPath(@"~\ErrorLogs\") + (strFileName + ".log"));
        string strErrorSrcFileName = Path.GetFileNameWithoutExtension(HttpContext.Current.Request.CurrentExecutionFilePath);
        string strMethodName = new StackTrace().GetFrame(1).GetMethod().Name;
        string strUserName = HttpContext.Current.Session["LoginName"] == null ? " " : HttpContext.Current.Session["LoginName"] as string;
        string strErrorMessage;
        TextWriter twErrorFile;

        strErrorMessage = (DateTime.Now.ToString() + "\r\n"); ;
        strErrorMessage += "File Name     :" + strErrorSrcFileName + "\r\n";
        strErrorMessage += "Method Name   :" + strMethodName + "\r\n";
        strErrorMessage += "Error Text    :" + exception.Message + "\r\n";
        strErrorMessage += "Error Desc    :" + exception.StackTrace + "\r\n";
        strErrorMessage += "User Name     :" + strUserName + "\r\n";
        strErrorMessage += "-----------------------------------------------------------------------------------------------------------------------------------------------" + "\r\n";
        twErrorFile = File.AppendText(strErrorLogPath);
        twErrorFile.WriteLine(strErrorMessage);
        twErrorFile.Close();
    }
    #endregion
}

Tuesday, 19 February 2013

andriod tutorial with eclipse

Installation andriod

Features of andriod




 Features of Andriod 4.0


Features of Andriod 4.2 and techniques to develop Software .
Platform Version
API Level
VERSION_CODE
Notes
9
8
7
6
5
4
3
2
Android 1.0
1