This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

Wednesday, June 5, 2013

Example on Windows Service



Hi Friends,in this post i would like to explain windows service for displaying message box for every 3 seconds.

Step 1:

* Open windows service project with projectName WinService1
* Goto ToolBox-->General-->Right Click-->Select choose items-->Select Timer(Systems.Timers)
* Project-->AddReference-->System.Windows.Forms(Message Box is a part of above reference).
* Place a Timer(System.Timers) with interval-3000 & enabled-false.

Code:

{//timer1_Elapsed event.
System.Windows.Forms.MessageBox.Show("This message from Windows Service.");
}

Code for OnStart() event
{
timer1.Enabled=true;
}

Code for OnStop() event
{
timer1.Enabled=false;
}





Step 2:

* Open service1.cs[design]
Right Click
Add installer(Select).
Then 2 controls will be added to the form.
1)ServiceProcessInstaller-->Choose properties-->Account=LocalSystem.
2)ServiceInstaller-->Properties-->ServiceName=MessageBoxDisplay

* Build the project(Build-->Select Build solution)

Note:
* WinService1.exe is created under:
D:\WinService1\bin\debug folder with a service name called as "MessageBoxDisplay"

Step 3:

* open .Net Command prompt.
Start-->Programs-->MSVisualStudio2005-->VSTools-->.Net Command Prompt.
>installutil -i D:\WinService1\bin\debug\WinService1.exe (press enter)
>....
>....
>....
>transaction install has completed.

Step 4:

* Open service(Start-->run-->services.msc)
* MessageBoxDisplay-->RightClick-->Properties-->Logon-->Check "interact with desktop" checkBox-->OK
(Only service contains MessageBox otherwise above step is not required).
* MessageBoxDisplay-->rightClick-->Start.

Then service will be started & MessageBox with message(This message from Windows Service.) will be displayed for every 3 seconds.


Thank You...

Displaying Festival Names on Calendar control in ASP.Net

Hi Friends,In this article i would like to explain how to display Festival Names on Calender control in ASP.Net.

* For this i took 1 Calendar control on to the page.

* I created a table with name(Holidays) in SQL Server 2005 & fields are HolidayName,HolidayDate.

* Please find the below table once :


* Then find the code for Calender_DayRender event : 
Source Code : 

Default.aspx.cs :

    using System;
    using System.Configuration;
    using System.Data;
    using System.Linq;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Xml.Linq;
    using System.Data.SqlClient;
    public partial class _Default : System.Web.UI.Page
    {
    SqlConnection con;
    protected void Page_Load(object sender, EventArgs e)
    {
     con = new SqlConnection(ConfigurationManager.ConnectionStrings["DotnetGuruConnectionString"].ConnectionString);
    }
    protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
    {
     CalendarDay day = (CalendarDay)e.Day;
     SqlCommand cmd = new SqlCommand("select HolidayName,HolidayDate from Holidays", con);
     con.Open();
     SqlDataReader dr = cmd.ExecuteReader();

     while (dr.Read())
     {
         if (day.Date.ToString() == dr["HolidayDate"].ToString())
         {
             TableCell cell = (TableCell)e.Cell;
             string s1 = dr["HolidayName"].ToString();
             if (s1 != null)
             {
                 cell.BackColor = System.Drawing.Color.LightGray;
                 cell.Controls.Add(new LiteralControl("
    " + s1));
             }

         }

     }
     con.Close();
    }
    }

Design View : 

Default.aspx :

using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
SqlConnection con;
protected void Page_Load(object sender, EventArgs e)
{
 con = new SqlConnection(ConfigurationManager.ConnectionStrings["DotnetGuruConnectionString"].ConnectionString);
}
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
 CalendarDay day = (CalendarDay)e.Day;
 SqlCommand cmd = new SqlCommand("select HolidayName,HolidayDate from Holidays", con);
 con.Open();
 SqlDataReader dr = cmd.ExecuteReader();

 while (dr.Read())
 {
     if (day.Date.ToString() == dr["HolidayDate"].ToString())
     {
         TableCell cell = (TableCell)e.Cell;
         string s1 = dr["HolidayName"].ToString();
         if (s1 != null)
         {
             cell.BackColor = System.Drawing.Color.LightGray;
             cell.Controls.Add(new LiteralControl("
" + s1));
         }

     }

 }
 con.Close();
}
}


    * Then finally Build(F6) your application & run the application by pressing(F5) button.

    * Your out put will looks like as below : 
    Thank You...

    Fix for “Internet explorer has closed this webpage to help protect your computer”

    Many users face issue running Oracle forms on Microsoft Internet Explorer 8 (IE8) which causes the page to redirect to following url
    res://ieframe.dll/acr_depnx_error.htm#<domain>,http://<server>:<port>/forms/frmservlet?config=<config>
    It displays following error.
    Internet explorer has closed this webpage to help protect your computer
    A malfunctioning or malicious add-on has caused Internet Explorer to close this webpage.
    Solution:
    Goto Internet Explorer -> Tools -> Internet Options -> Advanced -> Scroll down to Security -> Uncheck “Enable memory protection to help mitigate online attacks*”
    Close all browser windows and restart the browser. The issue should have been fixed :-)
    Edit: Alternatively you can use either of following 2 alternate solutions.
    Alternate 2:
    Open registry using start->Run->regedit->ok
    Go to HKEY_LOCAL_MACHINESOFTWAREMicrosoftInternet ExplorerMain
    On the right hand side you will see a DWORD key called DEPOff. IF this is set to value 0, just change it to 1 and close registry editor.
    Restart Internet Explorer and check if the problem has been fixed or not.
    Alternate 3:
    Right click on My Computer->Properties (or start->Run->sysdm.cpl->ok)
    Click on “Advanced” Tab. Click on “Settings” button next to Performance.
    Click on last tab “Data Execution Prevention
    Select Second option and then select “Internet Explorer” from the bottom pan.
    (If “Internet Explorer” is not already present there then just click on “Add” and then select “c:Program FilesInternet Exploreriexplore.exe”)
    Click OK and restart internet explorer. The problem should have been fixed.

    Narayana Murthy - a profile



    Narayana Murthy has been listed among the 12 greatest entrepreneurs of our time along with Apple's late chief Steve Jobs, Microsoft founder Bill Gates and Facebook CEO Mark Zuckerberg by Fortune magazine. He has been described as Father of Indian IT sector by Time magazine due to his contribution in outsourcing revolution in India.

    surrounded by computers in Bangalore.


    Narayana Murthy, Chairman and CEO of Infosys Technologies Ltd
    queues up in his office cafeteria during lunch time in Bangalore.


    Japanese PM Yoshiro Mori is welcomed by N.R Narayana Murthy.

    Chairman of Microsoft Corporation Bill Gates shakes hands with
    N. R. Narayana Murthy


    Russian President Vladimir Putin shakes hands with N R Narayana Murthy.



    PM Manmohan Singh (R) is accompanied by Narayana Murthy.

    Vaclav Klaus (C), President of the Czech Republic, plays billiards

    with wife Livia Klausova (L) and Narayana Murthy.



    Narayana Murthy, Chairman and CEO of Infosys Technologies Ltd