Skip to main content

Posts

Showing posts from 2009

Email Alerts are not received...

In one of application, Email alerts are sent using SQL sp_send_dbmail stored procedure. Email alerts were working properly, but suddenly noticed email alerts are not received.

To troubleshoot the issue, first I checked the msdb.dbo.sysmail_event_log table using the below query.

SELECT log_id, event_type, log_date, description, process_id, mailitem_id, account_id, last_mod_date, last_mod_user
FROM
msdb.dbo.sysmail_event_log 
ORDER BY
log_date DESC

If there is any error, you should see records with the event_type value as error.
In my case there are records with event_type value as error, and the description value for those records is same as below

The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 3 (2018-02-01T10:41:27). Exception Message: Cannot send mails to mail server. (The SMTP server requires a secure connection or the client was not authenticated. The server response was: Authentication required).  )

As per the error descript…

MS SQL Function to Convert the Julian Date to the SQL Date Format

Below I put the query for a SQL Function which converts the Julian
date in int data type to SQL Date format.
IF EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'dbo.Convert_Julian') AND TYPE IN (N'FN', N'IF', N'TF',
N'FS', N'FT'))DROP FUNCTION dbo.Convert_Julian GOCREATE FUNCTION dbo.Convert_Julian(@idate INT)
Returns DATE
WITH EXECUTE AS CALLER ASBEGIN
DECLARE @oDate DATE, @year VARCHAR(10),@intYear INT,@sdate
VARCHAR(10),@noOfDays VARCHAR(10),@intNoOfDays INT,@month INT,@day
INT,@sMonth VARCHAR(10),@sDay VARCHAR(10),@sMonthc VARCHAR(10),@sDayc
VARCHAR(10)SELECT @sdate=CONVERT(VARCHAR(50),@idate) IF (@idate=0) SET @oDate = CAST(0 AS DATETIME) ELSE BEGIN
SET @year=SUBSTRING(@sdate,1,4)
SET @noOfDays=SUBSTRING(@sdate,5,3)
SELECT @intYear=CONVERT(INT,@year)
SELECT @intNoOfDays=CONVERT(INT,@noOfDays)

IF (@intNoOfDays<=31)
BEGIN
SELECT @month=1

IF(@intNoOfDays=31)
SELECT @day=31

ELSE
SELECT @day=@intNoOfDays
END

IF(@intNoOfD…

Creating a Connection to DB2 in SQL Server Integration Project

In this post, IBM DB2 UDB for iSeries IBMDA400 OLE DB provider is used to create the connection.
To create a connection in SQL Server Integration Project, Right click on the Connection Managers area and select New OLE DB Connection... as shown in the below figure.



Then select the Provider in the top of Connection Manager as the Native OLE DB\ IBM DB2 UDB for iSeries IBMDA400 OLE DB Provider as shown in the below figure.



Then Click on the Data Links... button to provide more details and you will get a screen like a below one.



Then provide the Server Name or IP Address of the Server for the Data Source and provide the required credentials.
After that to provide the required DB2 library click on the All tab and double click on Catalog Library List.
Then you will get a screen as shown below.



Enter the DB2 Library for the Property Value and click OK.

Then you can test the created connection by clicking Test Connection button and if you provided those details correctly you will get a message as sho…

Changing the appearance of Doughnut Chart in SQL Server 2008 Reports

When you add a Doughnut chart to a SQL Report, it initially looks like as shown below.












You can change the appearance of the chart and make it more attractive by changing the chart properties.
Some of the attractive doughnut chart are shown below.



Figure 1




Figure 2

To change the doughnut chart as shown in Figure 1, go to the chart series properties window.
Then expand the CustomAttributes and set the PieDrawingStyle to Concave as shown in below figure.



To change it as to shown in Figure 2, just change the PieDrawingStyle to SoftEdge.
By doing that we can make our doughnut chart more attractive.

Easy way to Customize MOSS 2007 Master Pages using SharePoint Designer 2007

Using SharePoint Designer 2007, you can easily customize your SharePoint Master pages. If you want to create a new master page you can easily do it. To do that first copy the default.master page and rename it to whatever name you want (Master page can be found at "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\12\TEMPLATE\GLOBAL").
Then go to the your SharePoint site and go to Site Settings. Click Master Pages under Galleries category and upload the renamed master page to the Master pages.

Then open the SharePoint Designer 2007 and click on the Open Site in the File menu.
Then copy the url of the your SharePoint site and open it in SharePoint Designer 2007. You can see the master pages of the site in the catalogs folder. Double click on the renamed master page to edit in SharePoint Designer.

Then you can customize that page according to your requirments. If you want to remove some parts in the master page, the best thing is comment those code instead of del…

Avoiding ASP.Net Browser Refresh Problem

Lets assume you delete an item in a gridview and you will get a confirmation message box to decide whether delete that item or not. After completing that task, refresh the page. Sometimes you will get the previous confirmation message box.
Same thing can happen when you insert particular record for a button click event. When you refresh the page that same record will be inserted again.

Below link contains a sample code to avoid it
http://csharpdotnetfreak.blogspot.com/2008/12/detect-browser-refresh-to-avoid-events.html
Code:

using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls;
namespace WebApplication1 { public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e)
{ if (!IsPostBack) { Session["CheckRefresh"] = Server.UrlDecode(System.DateTime.Now.ToString()); } }
protect…

Adding Multivalued Parameter as a Filter for a SQL Server Report

To add a multivalue report parameter as filter for a SQL Report click Filters in Chart properties and add the Report Parameter as shown in the given figure.
The only difference is you have to choose the operator as "In". It set the the selected value to an array and filter the report

Problem with Publishing PerformancePoint Dashboard to SharePoint site

If you get and error message in SharePoint site after publishing PerformancePoint Dashboard to SharePoint site that might occur due to the problems with configuring PerformancePoint monitoring server.
When you configuring the PerformancePoint monitoring server, you should provide the URL of the SharePoint site which you use to display the PerformancePoint Dashboards. Then the configuration process will modify the web.config file of the relevant SharePoint Site

Problems occur while creating new Web Application in MOSS 2007

When you try to create a new application using SharePoint Central Administration, sometimes "Reset Internet Information Services" may be disabled. It might be due to the "Windows SharePoint Services Administration" service is not started. After starting that service the mentioned service should be enabled.Also after insalling and configuring MOSS 2007, when you try to create a new web application using SharePoint Central Administration by clicking OK button in the new web application page nothing will happen. To overcome that issue, you have to add the SharePoint Central Administration site to the Local Intranet using the Internet Explorer.

Adding Horizontal Gauges for SQL Server 2008 Reports

First add a matrix to the reportThen delete the row group and add rows as requiredAfter that open the column group property box and add the below expression to the "Group On" under general tab =RowNumber(Nothing)

Then add the values to the data row cellsAfter that add a list to the designFor the List get the Row Groups property window and add the below expression =Ceiling(RowNumber(Nothing)/3)

Then change the "Nothing" in the column group properties to the Name of the Row group of the ListThen drag the matrix inside to the ListThat's all. You will get the 3 Gauges for each row.

Install Windows XP to a Windows Vista installed Laptop

If you are trying to install Windows XP to a Laptop where Windows vista is already installed, you will get a blue screen at the Windows Startup in XP installation process. This is happened due to the SATA hard disk.
To overcome this problem you have to change the BIOS settings. First go to the "Advanced" tab in BIOS Settings and you can find the "SATA Controller Mode" at the bottom.
Change the SATA Controller Mode from "AHCI" to "Compatibility". Then Save the Changes.
After that you can install Windows XP.
Good Luck...

Scoring and Ranking in Lucene.Net

Scoring feature is used to prioritize and sort the search results by considering their relevance to the search query. For the scoring formula several facts are used. Below the formula which is used to calculate the score value is shown.
Score for term t in document d = ∑ tf (t in d).idf(t).boost(t.field in d).lengthNorm(t.field in d)Below table is listed how those functions are calculated and the description of those functions.
FunctionDescriptiontf (t in d) = sqrt(freq)Term frequency factor for the term (t) in the document (d).
This factor result to have high score value for a document
where more frequent a term occurred.idf(t) = log(numDocs/(docFreq+1)) + 1Inverse document frequency of the term.
Common terms are less important than uncommon ones.
This factor gives high value to a term which occurs only in few
documents and low value to a term which occurs in most
documentsboost(t.field in d)Field boost, as set during indexing. Boosting is used to give high priority for a term or …

Did You Mean Feature for a Search Application

This article describes how the suggesting word feature is used for a Searching application which uses Lucene.Net for indexing and searching.
Suggesting word feature is mainly useful when a user input some misspelled words and to suggest the correct word to the user.

To implement the Did You Mean feature by suggesting words, n-gram method is used. n-gram method divides the given misspelled word into sub words by considering the length of the word.
The idea behind with the n-gram method for suggesting word feature is that the misspelling occurs due to mainly one or two letters. Therefore it will only affects few n-grams. Therefore we can recognize the correct word by taking the word which share high proportion of n-grams with the misspelled word.

n-grams are created considering the length of the word.
If the word length greater than five, two grams are created having the length of three and four.
If the word length is five, then the length of the grams are two and three.
If the word length is…

Integrate SQL Server Reports with MS CRM

To integrate SQL Server Reports with MS CRM, select "Reports" under MS CRM "Workplace" as shown below.















Then click on "New" to add a new report as shown in below figure.















After that click on "Browse" button which is shown in below figure, and select the report to be added. Enter the details of the report like Name, Description,etc.
















Finally click the Save button to save the report. After that the added report is displayed under Reports in MS CRM Workplace.

Unable to edit my information using “My Settings” link in the SharePoint Site

We can find two links at the top of the SharePoint site as "My Settings" and "My Site". But I was unable to edit my information using "My Settings" link. Also when I clicked on "My Site" link it displayed an error message saying that cannot create a site because site is already created. Other users also had those two problems

I was able to solve those two problems by changing the "My Site Settings" from SharePoint 3.0 Central Administration. User Name in "My Site Settings" was changed to the Domain Users as shown in the below figure.















By changing User Name to Domain Users, it allows every user in the domain to create and maintain for him or her and maintaining his or her own profile. My Site Settings is appearing in the created Shared Service page

Creating a Sample Custom Web Part for SharePoint

We have to create custom web parts for SharePoint sites according to our requirements. Because web parts required for a site may not available in the Web Part Gallery of the SharePoint.
I created a simple web part which displays who the current user is logged in to SharePoint. To create and use it in SharePoint site below steps were used.

• Created a Class Library project in Microsoft Visual Studio 2005
• Then the below code is added to get the current user and show it

public class SimpleWebPart : WebPart
{
private string displayText = "Hello World!";

[WebBrowsable(true), Personalizable(true)]
public string DisplayText
{
get { return displayText; }
set { displayText = value; }
}

protected override void Render(System.Web.UI.HtmlTextWriter writer)
{
writer.Write(displayText);
}
}

• Assembly.cs file in the class library project was modified by adding below code
[assembly: AllowPartiallyTrustedCallers()]


• Then gave a strong name to the assembly by selecting project properties and then selected “Si…

Lucene.Net Logical Index Structure

In the index file data are kept as Documents. Each document contains several fields that consist of name and value pairs. Therefore index file have several documents stored and each document contains several fields.
Fields are used to keep information in different ways in the indexed file. There are four types of field types.They are listed in the below table with the description of the field type.Field TypeDescriptionKeywordConstructs a string value field that is not tokenized, but is indexed and stored. Therefore it is useful for non-text fields and for fields which we want to keep information as it is. Therefore name of the video file is keep in a this type of fieldTextConstructs a string value field that is tokenized, indexed and stored. Information in this type of field will return with hits. These types of fields are useful to keep content in a video frame.UnIndexedConstructs a string value field that is not tokenized nor indexed, but is stored in the indexUnSto…