February 2007 - Posts

Found this project http://www.codeplex.com/Terminals which is tabbed remote desktop client.  It makes logging into several servers at once and switching between them very easy.

Windows Services are similar to UNIX daemons. They are applications that start when Windows boots and continue running until Windows shuts down. A Windows Service might be used to implement a timer that continually polls a source looking for new data. When new data is found an import process might be kicked off. .NET has made developing Windows Services much easier than past methods. As mentioned above a Windows Service is an application and as such requires installation. In the remainder of this post I would like to propose an alternative to developing a Windows Services for cases when an ASP.NET Application has already been developed. Including code within the Global.ASAX of an ASP.NET application to replace the task a Windows Service would perform eliminates the need to deploy two separate applications. In a large corporate environment keeping deployments as simple as possible is generally a good idea. The following code demonstrates how a delegate based server side timer can be implemented within the Global.asax of an ASP.NET application.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
using System;
using System.Collections.Specialized;
using System.Threading;
using System.Web;
using AIS.Configuration;

namespace AIS.Reporting
{
public partial class Global : HttpApplication
{
#region Private Members
private ReportingService reportingService;
private int minutes = 1;
private static Timer reportTimer;
private int seconds = -1;
private bool enableReportProcessing;
#endregion

#region Methods: Timer

/// <summary>
/// Creates the timer and sets the callback if it is enabled
/// </summary>
public void InitializeTimer()
{
NameValueCollection appSettings = DynamicConfigurationManager.AppSettings;
enableReportProcessing = bool.Parse(appSettings["ReportTimerEnabled"]);
seconds = int.Parse(appSettings["ReportTimerSecondsInterval"]);
AutoResetEvent autoEvent = new AutoResetEvent(false);

if (reportTimer == null && enableReportProcessing)
{
reportTimer = new Timer(new TimerCallback(reportTimer_Callback), autoEvent, Interval, Interval);
}

}

/// <summary>
/// Internal call back which is responsible for firing IJob.Execute()
/// </summary>
/// <param name="state"></param>
private void reportTimer_Callback(object state)
{
ProcessReport();
}

        public void ProcessReport()
{
if (reportingService == null)
{
reportingService = new ReportingService();
}
reportingService.ProcessReport();
}



#endregion

        protected int Interval
{
get
{
if (seconds > 0)
return seconds * 1000;
return Minutes * 60000;
}
}

#region Public Properities

public int Minutes
{
get { return minutes; }
set { minutes = value; }
}

public bool EnableReportProcessing
{
get { return enableReportProcessing; }
set { enableReportProcessing = value; }
}

        public bool IsRunningProcessReport
{
get { return isRunningProcessReport; }
set { isRunningProcessReport = value; }
}

#endregion

void Application_Start(object sender, EventArgs e)
{
InitializeTimer();
}

}
}

Microsoft has a nifty command line utility known as Log Parser which can parse many common log file formats such as IIS, SMTP, and FTP logs.  I found this http://www.codeplex.com/visuallogparser project on Code Plex which is a Smart Client front end to the Log Parser.  Visual Log Parser is a great way to query event logs, IIS Logs, etc.

On Feb 10, 2007 I presented at the 3rd Annual South Florida Code Camp on "Hacking Report Viewer".  I didn't present to a large group but we had great conversation.  http://drowningintechnicaldebt.com/blogs/dennisbottjer/archive/2006/10/16/Hacking-Report-Viewer-Redistributable.aspx - This link is to my previous blog post detailing how to hack the report viewer control.  The Power Point 2007 slides from my presentation are available for download at http://drowningintechnicaldebt.com/files/folders/dennis/entry191.aspx