Telerik RadSchedular Tips and Tricks

Author posted by Jitendra on Posted on under category Categories ASP.NET and tagged as Tags with Leave a comment on Telerik RadSchedular Tips and Tricks

Change the style of the Today Cell in Month View and Bind Extra Column / Add Argument in RadSchedular

Change the style of the Today Cell in Month View

Lots of time, we are in need in telerik control that todays date should be highlighted. There is no need in case of Day View and in Week View.  But in month view, most of the times we confused between any event and todays date. So below is few CSS hacks which can be used in Telerik Controls.

div.RadScheduler_#skinName# .rsMonthView
background-color: #CCFF00;
color: #000;
border: 1px solid #000;


div.RadScheduler_Office2007 .rsMonthView .rsTodayCell
background-color: #FFEFB8;
color: #000;
border: 2px solid #EE9311;

Bind Extra Column / Add Argument in RadSchedular

Add Custom Column as follow on page load event

RadSchedulerEvent.CustomAttributeNames = new string[] { "OwnerId" };

Note: OwnerId column name must be available in DataTable

Get Value of custom Column on AppointmentCreated Event

String ownerId = e.Appointment.Attributes["OwnerId"];

Opening RadWindow from another RadWindow – Telerik Control

Author posted by Jitendra on Posted on under category Categories ASP.NET and tagged as Tags with Leave a comment on Opening RadWindow from another RadWindow – Telerik Control

Opening RadWindow from another RadWindow:

Telerik Control in ASP.NET
Telerik Control in ASP.NET

Sometime it may require opening the radwindow from another radwindow. But believe me; it will not be easy.Problems I faced were:

  • New window opened behind the parent radwindow.
  • New window open in area of parent window only. So we cannot resize the window as per required.
    To overcome all these properties:

Create a java script function which will open the RadWindow in parent page. We will call this function from Radwindow to open new Radwindow so that new window should have complete screen as a width and height.

function OpenParentWnd()
var oWnd = $find("<%=Parent.ClientID %>");//Parent is radwindow ID name;

In current RadWindow, call the above function like this:

function CreateWindowInParent()
//One way to open a window from parent page
var oBrowserWnd = GetRadWindow().BrowserWindow;

Java Destructor – finalize()

Author posted by Jitendra on Posted on under category Categories JAVA and tagged as Tags with 2 Comments on Java Destructor – finalize()

Concept of destructor in JAVA. finalize() method.

Java Destructor finalize()
Java Destructor finalize()

The aim of destructor in any OOPs language is:

  1. Free up the memory (c++ suffer from memory allocation / deallocation)
  2. Clean up any other resources (like closing of open file stream)

Java take cares of all and hence there is no destructor in Java. (With the help of Garbage collection)
but still if you want to perform some additional tasks, then you can use the finalize() method of java.

But, we can’t rely on finalize() as it depends on GC. Sometimes, GC may never be invoked during the lifetime of the program. A good idea is to implement a method, say cleanUp() which does, any special processing required, ofcourse, other than freeing up memory. The programmer should call this method at the approppriate place in the program. That is the only way to make sure your program works correctly.

Example code of finalize in java:

class Thing {

	public static int number_of_things = 0;
	public String what;

	public Thing (String what) {
	        this.what = what;

	protected void finalize ()  {

public class TestDestructor {
	public static void main(String[] args)
		Thing obj = new Thing("Test App");


Drop Stored Procedure if exist in SQL Server

Author posted by Jitendra on Posted on under category Categories SQL, SQL Server and tagged as Tags , with Leave a comment on Drop Stored Procedure if exist in SQL Server

How to drop the stored procedure in SQL Server if exist

Its very frequent that we need to check whether particular store procedure exist in database or not?

If stored procedure exist then delete the stored procedure, otherwise we have to toggle between Create Procedure and Alter Procedure.

Below is the SQL to delete the stored procedure if exist.

IF EXISTS (SELECT * FROM sysobjects WHERE id = object_id(N'[dbo].[SPNAME]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)




Search for Table in SQL Server

Author posted by Jitendra on Posted on under category Categories SQL, SQL Server and tagged as Tags , with Leave a comment on Search for Table in SQL Server

In organization, where huge number of tables present in database. its very hard to search the particular table.

Here few SQL queries to search the table name by pattern.

Search For Table whose name starts with A


Clustered Index speeds up performance of the query ran on that table. Clustered Index are usually Primary Key but not necessarily. I frequently run following query to verify that all the developers are creating all the tables with Clustered Index.

List of Non clustered Tables in SQL Server 2005
List of Non clustered Tables in SQL Server 2005

Source code for “Display All Objects” in SAP ABAP

Author posted by Santosh Karemore on Posted on under category Categories SAP and tagged as Tags , with Leave a comment on Source code for “Display All Objects” in SAP ABAP
We can find the source code for some of the Display All objects from transaction code SE38, using Utilities –> Environment Analysis.
We an also look at the object hierarchy by clicking on “Display Object List” , while looking at the source code. There are various tables that cross-reference components. These can be found by tracing a where-used, for example. If we want to reproduce these in our own SAP ABAP code, we have to spend a lot of time in debug, finding out exactly when the standard SAP code is called, and how it is called.


Simple Tips and Tricks of CCMS of SAP


  • In CCMS infrastructure , if the system identifies a problem, it should execute an auto reaction, such as informing the responsible person.
  • Completed messages alerts are no longer stored in the monitoring segment, but rather in a database table (ALALERTDB). This table should be regularly cleaned up (report RSALDBRG). The completed messages can still be displayed using the Alert History.
  • From a security point of view, it is recommended that you also define a second RFC connection between the systems, with which the analysis methods can be started in the remote system from the central monitoring system. If a problem occurs, you can therefore branch directly from the central monitor to the remote system to analyze the situation in more detail.
  • SAP recommends that, for your regular work, you create your own monitors that display precisely the cross-system or local data that you require for your work. The sets and monitors delivered by SAP cannot be changed.
  • Threshold values must be stored locally in every system. However, instead of maintaining the same threshold values in every system, SAP recommends that you maintain the values in the central monitoring system and then distribute them to the monitored SAP systems using the transport system.
  • The delivered SAP monitors should always be used only as templates. The copied monitors are then adjusted to the customer’s requirements.
  • Transfer as little data as possible by RFC
  • Before you create your own monitor, you should clarify the purpose of the monitor. The monitor should display as little data as possible in as clear a way as possible.
  • The prerequisite for transporting the threshold values to other SAP systems is that you have stored them in properties variants.
  • In the RFC connection that is used for the start of the analysis method, do not enter a user, but rather check the field Current User.
  • As a global guide value, SAP recommends 10-20 monitoring attributes for each monitored instance in the central monitor.
  • Note the naming convention that your monitor set should not begin with SAP.

Background and foreground thread in c#

Author posted by Jitendra on Posted on under category Categories c# and tagged as Tags with 1 Comment on Background and foreground thread in c#

Example of Threading in C#. Includes Foreground and Background Threading.

  • Foreground threads have the ability to prevent the current application from terminating. The CLR will not shut down an application (which is to say, unload the hosting AppDomain) until all foreground threads have ended.
  • Background threads (sometimes called daemon threads) are viewed by the CLR as expendable paths of execution that can be ignored at any point in time (even if they are currently laboring over some unit of work). Thus, if all foreground threads have terminated, any and all background threads are automatically killed when the application domain unloads.
  • It is important to note that foreground and background threads are not synonymous with primary and worker threads. By default, every thread you create via the Thread.Start() method is automatically a foreground thread. Again, this means that the AppDomain will not unload until all threads of execution have completed their units of work. In most cases, this is exactly the behavior you require.


    Thread Foreground Background
    Threading in CSharp
    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Threading;
    namespace TestThread
    class Program
    static void Main(string[] args)
    Program obj = new Program();
    //Create object of parameterized thread, so that you can pass parameter to any thread
    ParameterizedThreadStart pst = new ParameterizedThreadStart(obj.function1);
    //Bydefault threads are Foreground Thread
    Thread t1 = new Thread(pst);
    //Set Thread Name
    t1.Name = "Thread1";
    //Passs Parameter to thread
    //Create object of ThreadStart, it does not have any parameter
    ThreadStart ts = new ThreadStart(obj.function2);
    Thread t2 = new Thread(ts);
    t2.Name = "Thread2";
    //Make it Background Thread
    t2.IsBackground = true;
    //Run the thread
    public void function1(object val)
    for (int i = 0; i < 5; i++)
    Console.WriteLine("This is parameterized function1 by {0} and Value passed is {1} ", Thread.CurrentThread.Name, val);
    public void function2()
    for (int i = 0; i < 5; i++)
    Console.WriteLine("This is function2 by : " + Thread.CurrentThread.Name);
    public void printInfo()
    System.Text.StringBuilder sb = new StringBuilder();
    sb.Append("            read Demo by ShivaSoft                     n");

    Add FeedBurner in Blog and Enable Subscribe by email

    Author posted by Jitendra on Posted on under category Categories Tech Tips and tagged as Tags , , with Leave a comment on Add FeedBurner in Blog and Enable Subscribe by email

    Explains that how to use Google Feedburner for RSS in Blog and how to enable the Email Subscription

    To add the Feedburner in you blog, follow below steps:

    Get the RSS Feed path of your blog and go to :

    then enter the path in Textbox displayed:

    Add Blog URL for RSS in FeedBurner

    After that follow the onscreen steps.

    And that all, you have done it.

    Add option to add by Email

    As shown in below image:

    Enable Subscribe by email in Feedburner

    GO to Publicize and select Email subscription,

    it will provide you one code, copy and paste that in you blog and the component is ready to use.

    Output will look like:

    Subscribe By Email Feedburner

    Tracing ASP.NET Website

    Author posted by Jitendra on Posted on under category Categories ASP.NET and tagged as Tags , , with 1 Comment on Tracing ASP.NET Website

    Demonstrates that how to Trace ASP.NET web applications

    In ASP.NET there two types of Tracing

    • Application Level
    • Page Level

    Page level Tracing takes the precedence over the Application Level tracing.

    Lets start with creating new website.

    In web.config add following entries to enable Application level tracing below System.web element.



    pageOutput=”true” – add the tracing information at the bottom of the ASPX page.

    localOnly=”false” – tracing will be available to any web page.

    requestLimit=”10″ – How many request should be saved on the server.

    mostRecent=”true” – whether or not display the recent tracing information if the request reach at the limit.

    After adding above tag in web.config, the output of ASP.NET page will look like:

    ASP.NET Tracing Output

    Here you can see much of informations displayed like SessionId, Request Status, Controls available on that page,  All the events of the page with start and end time etc and thus you can figure out the performance of your web application.

    No Trace for a particular Page

    Create a web page and in aspx file and at header write the tag Trace=”false”

    Create few controls like link button and view the page in browser. You will see that the page is displayed with no tracing information, although its turned ON in web.config but page level tracing has the precedence over application level tracing.

    Writing Custom Trace Information

    Now on the click event of Link buttons write the custom trace information.

    protected void lblwriteMessage_Click(object sender, EventArgs e)
    	Trace.Write("Custome Message", "Write Link Button clicked");
    protected void lblwarnMessage_Click(object sender, EventArgs e)
    	Trace.Warn("Custome Message", "Warn Link Button clicked");

    when you will click on the WriteLink button, below output will be seen.

    ASP.NET Trace
    ASP.NET Trace

    and when you will click on warn button, the message will be displayed in Red color. so it is suggested to display the the important trace message as a warn.

    ASP.NET Trace
    ASP.NET Trace

    Page.Trace Vs System.Diagnostics.Trace

    Create a new class file and write a static function which will write the Trace Message. You will notice that Trace object is not available by default like ASPX page instead you will need to import the package “System.Diagnostics”.

    So, there is lot difference in System.Diagnostic.Trace and Page.Trace.

    Trace from Diagnostics display the trace information in output window of Visual studio whereas the Trace from page displays the Trace information in ASPX Page.

    Integrate System.Diagnostics with ASPX Page (Routing all Trace information to web page)

    We will need to add the listener in web.config file to route all the tracing information to the single web page.

    To integrate the System.Diagnostics Trace with ASPX page, write below line of code in web.config.

           <add name="WebPageTraceListener"
                type="System.Web.WebPageTraceListener, System.Web, Version=2.0.3600.0, Culture=neutral,

    The output will look like below image:
    ASP.NET Tracing Application Level
    trace.axd file

    This file contains all the information about the tracing of the application.

    To view the trace information just write the file name and you will get page which will look like below snap.

    path structure : http://<servername>/webapp/trace.axd

    Application Trace in ASP.NET
    Application Trace in ASP.NET

    Creating Custom Trace Listeners

    Database trace listener

    .NET has provided us the flexibility of writing our own Trace Listeners in the form of the TraceListener class. Every Trace Listener is inherited from this class; therefore, in order to implement your own Trace Listener, you must inherit your Trace Listener class from this class.

    TraceListener class has many virtual and abstract methods; at the very least, each inheritor of this class must implement the Write and WriteLine methods; other important methods are Fail, Close, and Flush. Inheritors are not supposed to implement these methods but it is a good idea to implement these methods. Descriptions of these methods are given in the beginning of the article.

    Method Name Result
    Fail Outputs the specified text with the Call Stack.
    Write Outputs the specified text.
    WriteLine Outputs the specified text and a carriage return.
    Flush Flushes the output buffer to the target media.
    Close Closes the output stream in order to not receive the tracing/debugging output.

    Write and WriteLine methods are overloaded; following is a list of all the overloaded version of the Write method:

    • public override void Write(string message)
    • public override void Write(object o)
    • public override void Write(string message, string category)
    • public override void Write(object o, string category)

    For this article, I have created a Trace Listener, DatabaseTraceListener, which actually stores trace and debug messages into a database.

    add below code in Web.config which stores the connection string information.

    <pre><add key="ConnectionString" value="Data Source=.SQLExpress;Integrated Security=True;User Instance=True;
    AttachDBFilename=|DataDirectory|TraceDB.mdf" /></pre>
    <pre><add key="MaximumRequests" value="2" /></pre>

    The structure of Table is:

  • TraceDateTime column stores the date and time of the trace message
  • TraceCategory column stores the actual category of the trace message
  • TraceDescription column stores the trace message
  • StackTrace column contains the stack trace
  • DetailedErrorDescription column contains the detailed error message which will be passed in second parameter of the Fail method.
  • create below stored procedure in SQLExpress

    Stored Procedure ASP.NET Tracing
    Now create a class named “DatabaseTraceListener” which inherit the abstract class “TraceListener”. You can check the code snippets in Source code of this article.

    if you want to implement your own Trace Listener, simply derive your listener class from TraceListener class, implement at least the Write and WriteLine methods and you are done.
    In our Example, Flush and Close methods simply save all the cached messages into the database.

    Saving Trace information in File

    We can also save the trace information in log files.

    To save the trace information in File, simply add the following entry in web.config

    <add name="myListener"
    initializeData="TextWriterOutput.log" />