Debugging tips for SharePoint. Debugging on SharePoint is much the same as debugging any other ASP.Net application...you can use the same techniques. Here are some of my tips for diagnosing & solving your problems... Debugging starts with your first line of code As you start writing some code you need to bear in mind that at some point you will need to debug it. This may mean attaching a debugger (easy) or looking at a crash dump (hard). This means debugging should always be at the back of your mind when writing any code...ask yourself "when this is live how am I going to find out what has gone wrong? " In practice this means making full use of the features of .Net ... Use Trace.Write & Debug.Write This is the first thing I would recommend.
Using the Trace statements can really help when you cannot attach a debugger (on a live server) to give you more information of what has gone wrong. Use try...catch...finally protected override void Render(HtmlTextWriter writer) try catch (Exception ex) Trace.Write(ex); Don't try to guess. Debug your shell scripts with bashdb. By Ben Martin on November 24, 2008 (6:00:00 PM) To see if your standard bash executable has bashdb support, execute the command shown below; if you are not taken to a bashdb prompt then you'll have to install bashdb yourself. $ bash --debugger -c "set|grep -i dbg" ... bashdb<0> The Ubuntu Intrepid repository contains a package for bashdb, but there is no special bashdb package in the openSUSE 11 or Fedora 9 repositories.
I built from source using version 4.0-0.1 of bashdb on a 64-bit Fedora 9 machine, using the normal . /configure; make; sudo make install commands. You can start the Bash Debugger using the bash --debugger foo.sh syntax or the bashdb foo.sh command. The syntax for many of the commands in bashdb mimics that of gdb, the GNU debugger. The print command forces you to prefix shell variables with the dollar sign ($foo). Both bashdb and your script run inside the same bash shell. In the below example I use a watchpoint to see if and where the result variable changes. Implementing Error Handling with Stored Procedures. An SQL text by Erland Sommarskog, SQL Server MVP.
Last revision 2009-11-29. This is one of two articles about error handling in SQL 2000. This article gives you recommendations for how you should implement error handling when you write stored procedures, including when you call them from ADO. The other article, Error Handling in SQL Server – a Background, gives a deeper description of the idiosyncrasies with error handling in SQL Server and ADO. That article is in some sense part one in the series. Note: this article is aimed at SQL 2000 and earlier versions of SQL Server. Table of Contents: Introduction The Presumptions A General Example Checking Calls to Stored Procedures The Philosophy of Error Handling General Requirements Why Do We Check for Errors? Introduction Error handling in stored procedures is a very tedious task, because T-SQL offers no exception mechanism, or any On Error Goto.
To save space, I am focusing on stored procedures that run as part of an application. Reading and Writing Files in SQL Server using T-SQL. T-SQL stored procedures for reading and writing files can be hugely useful on those occasions where SQL Server’s standard techniques aren’t up to the task.
Phil Factor’s FileSystem Object (FSO)-based stored procedures may well help you out in a tight corner. For more techniques, see The TSQL of Text Files. SQL Server has never been short of ways to read from and write to files and it is always better to use the standard techniques provided by SQL Server where possible. However, most of them are really designed for reading and writing tabular data and aren't always trouble-free when used with large strings or relatively unstructured data. For reading tabular data from a file, whether character-delimited or binary, there is nothing that replaces the hoary old Bulk Copy Program (BCP), which underlies more esoteric methods such as Bulk Insert. Thankfully, when armed with OLE Automation and the FileSystem Object (FSO), all sorts of things are possible. Reading lines from a file OLE Automation.
How to debug a Shell Script under Linux or UNIX. Raju asks: How can I Debug a shell scripts?
This is most common question asked by new admins or UNIX user. Shell scripting debugging can be boring job (read as not easy). There are various ways to debug a shell script. -x option to debug a shell script. T-SQL Debugging Using Visual Studio .NET. ARGH! - SQL Debugging in the IDE. T-SQL Debugging on VS2005/SQL2005 - MSDN Forums.