Initialising log4net logging for Asp.Net web app

Some snippet below:

protected void Application_Start(object sender, EventArgs e)
{
XmlConfigurator.Configure();

log4net.Repository.ILoggerRepository repo = LogManager.GetRepository();
foreach (log4net.Appender.IAppender appender in repo.GetAppenders())
{
if (appender.Name.CompareTo(“RollingFileAppender”) == 0 && appender is log4net.Appender.RollingFileAppender)
{
var appndr = appender as log4net.Appender.RollingFileAppender;
string logPath = “MyApplication.log”;
appndr.File = logPath;
appndr.ActivateOptions();
}
}

logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

var configSource = new XmlConfigurationSource(ActiveRecordConfigStream);

Assembly assy = typeof([ParentAssembly]).Assembly;
ActiveRecordStarter.Initialize(configSource, assy.GetTypes());

logger.Info(“My Application Starting…”);
}

Using SQL Server CROSS APPLY to read XML segment

Here is an interesting code snippet:

declare @XML xml
set @XML =’


select ExpressionAlias.student_name,
ExpressionAlias.subject_name,
ExpressionAlias.score
From @XML.nodes(‘./students/student’) Student (rowset)
Cross Apply
Student.rowset.nodes(‘./subjects/subject’) Subject (rowset)
Cross Apply (
Select Student.rowset.value(‘@name’,’NVARCHAR(20)’),
Subject.rowset.value(‘@name’,’NVARCHAR(20)’),
Subject.rowset.value(‘@score’,’INTEGER’)
) ExpressionAlias (student_name, subject_name,score)
Order By
ExpressionAlias.student_name ASC,
ExpressionAlias.score DESC;

What the heck is SYLK File?

According to Microsoft:
A SYLK file is a text file that begins with “ID” or “ID_xxxx”, where xxxx is a text string. The first record of a SYLK file is the ID_Number record. When Excel identifies this text at the beginning of a text file, it interprets the file as a SYLK file. Excel tries to convert the file from the SYLK format, but cannot do so because there are no valid SYLK codes after the “ID” characters. Because Excel cannot convert the file, you receive the error message.

I got the error message:
‘SYLK: File format is not valid’
when trying to open a CSV file.

Apparently this is a known issue in Microsoft products.

Read more on KB323626

"Cannot insert the value NULL into column ”, table ”; column does not allow nulls. INSERT fails."

One useful system stored procedure is sp_helpdb. This stored procedure returns information about all of your databases on your server such as the size, owner, when it was created and the database settings. One issue that you may run into is that the stored procedure does not provide data, but an error occurs instead. The error that you receive is “Cannot insert the value NULL into column ”, table ”; column does not allow nulls. INSERT fails.”

Useful tips to fix this here