↓ Skip to main content

Articles

DateTime Format

·2 mins
I’m always searching the internet for DateTime formats, so I’ve placed them in my Blog so I’ll also know where I can find them DateTime Format Specifiers Below lists the valid format specifiers supported by the Format method on theDateTime type (see System.IFormattable).

The Swing

·1 min
Just loved this cartoon, they always say a picture says a thousand words 

Embed Picasa slideshows into BlogEngine.net

·1 min
I was having a problem embedding a slide show from Picasa into my BlogEngine.net editor. Basically, the editor kept stripping the embed html. The trick is to edit \admin\tinyMCE.ascx file. You need to modify the extended_valid_elements entry. Apparently this is used to define valid html tags for the tinyMCE editor. Here are my additions in red:

Visual Studio, which version?

·1 min
What version of Visual Studio is the most current? Depending on what you are using and which application you are modifing the following are the latest releases of Visual Studio: Visual Studio 6 (Used for the Legacy VB/C++ apps). Latest build is 9782 and this corresponds to Visual Studio 6.0 SP6. Visual Studio 2003 Version 7.1.6030. This corresponds to VS2003 SP1 and is a MANDATORY install. If you don't have it install it now. Visual Studio 2005 Version 8.0.50727,762 (SP). This corresponds to VS2005 SP1 and is a MANDATORY install. If you don't have it install it now. It can also take over an hour to install. Visual Studio 2008 Version 9.0.21022.8 RTM. This corresponds to the RTM release so if you have VS2008 you have this build.

Bottlenecks and Monitoring

·1 min
I've come across this fab system monitoring tool, Spotlight for Windows Spotlight on Windows empowers you to quickly identify and eliminate bottlenecks in the Windows environment For a busy IT professional, it is nearly impossible to diagnose, troubleshoot, and resolve every component affecting Windows Operating System (OS) performance using manual methods. Without a clear view of I/O and system activity, you learn of performance issues only after problems erupt.

Examples of using System.Data.ParameterDirection with Sql Server

·4 mins
When working with the SqlCommand you will no doubt have to supply parameters to your command whether it be a Stored Procedure or Text command. Although not as efficient as an actual Stored Procedure there are some powerful things you can achieve using the System.Data.ParameterDirection, or rather other than just Input.

C# DateTime.MinValue is not the same as SqlDateTime.MinValue

·1 min
Working with non-nullable types in C# can be a bit of a pain. For instance when I have a date as a string and need to parse it into a DateTime what should the value be if the parse fails? I can’t use null because DateTime is not a nullable type.

How to debug stored procedures in Visual Studio .NET

·2 mins
SUMMARY This step-by-step article explains two ways that you can debug SQL Server stored procedures and the necessary configuration settings and steps for each approach. A Visual Studio .NET developer can use the Server Explorer to debug SQL Server stored procedures independently of any Visual Studio project, or the developer can step into the code of the stored procedure directly from managed code in a Visual Basic, Visual C#, or Visual J# project.

Best Windows Backup Tool

·1 min
Carbonite Well I've been using Carbonite for over 2 years now and with almost 100Gbs backed up online it can't be bad. Carbonite runs in the background all the time, so it is always backing up your data files. It's a don't worry type of backup, just install it and leave it.

GhostDoc

·1 min
GhostDoc is a free add-in for Visual Studio that automatically generates XML documentation comments for C#. Either by using existing documentation inherited from base classes or implemented interfaces, or by deducing comments from name and type of e.g. methods, properties or parameters.

Structure to Stored Procedure

·7 mins
Everywhere I go from client to client I find that when developers create Stored Procedures that just perform the task in hand, and I so often find that no exception handling, comments or transaction based handling has been put in place. So with all this in mind I set to write a structured Stored Procedure to be used as a template for future Stored Procedures that I create.

The SqlCommand Object

·10 mins
I found this article on csharp station, as a very good insight in to the SqlCommand object, enjoy: This lesson describes the SqlCommand object and how you use it to interact with a data base. Here are the objectives of this lesson:

Determine the Connection Speed of your client

·2 mins
How many times have you written the perfect application, you spend hours getting it right, only to be told it is running slow. You have performed all the Performance Tuning, and you still get the users saying it is running slowly.

10 Tips for Writing High-Performance Web Applications

·23 mins
Writing a Web application with ASP.NET is unbelievably easy. So easy, many developers don’t take the time to structure their applications for great performance. In this article, I’m going to present 10 tips for writing high-performance Web apps. I’m not limiting my comments to ASP.NET applications because they are just one subset of Web applications. This article won’t be the definitive guide for performance-tuning Web applications—an entire book could easily be devoted to that. Instead, think of this as a good place to start. Before becoming a workaholic, I used to do a lot of rock climbing. Prior to any big climb, I’d review the route in the guidebook and read the recommendations made by people who had visited the site before. But, no matter how good the guidebook, you need actual rock climbing experience before attempting a particularly challenging climb. Similarly, you can only learn how to write high-performance Web applications when you’re faced with either fixing performance problems or running a high-throughput site. My personal experience comes from having been an infrastructure Program Manager on the ASP.NET team at Microsoft, running and managing www.asp.net, and helping architect Community Server, which is the next version of several well-known ASP.NET applications (ASP.NET Forums, .Text, and nGallery combined into one platform). I’m sure that some of the tips that have helped me will help you as well. You should think about the separation of your application into logical tiers. You might have heard of the term 3-tier (or n-tier) physical architecture. These are usually prescribed architecture patterns that physically divide functionality across processes and/or hardware. As the system needs to scale, more hardware can easily be added. There is, however, a performance hit associated with process and machine hopping, thus it should be avoided. So, whenever possible, run the ASP.NET pages and their associated components together in the same application. Because of the separation of code and the boundaries between tiers, using Web services or remoting will decrease performance by 20 percent or more. The data tier is a bit of a different beast since it is usually better to have dedicated hardware for your database. However, the cost of process hopping to the database is still high, thus performance on the data tier is the first place to look when optimizing your code. Before diving in to fix performance problems in your applications, make sure you profile your applications to see exactly where the problems lie. Key performance counters (such as the one that indicates the percentage of time spent performing garbage collections) are also very useful for finding out where applications are spending the majority of their time. Yet the places where time is spent are often quite unintuitive. There are two types of performance improvements described in this article: large optimizations, such as using the ASP.NET Cache, and tiny optimizations that repeat themselves. These tiny optimizations are sometimes the most interesting. You make a small change to code that gets called thousands and thousands of times. With a big optimization, you might see overall performance take a large jump. With a small one, you might shave a few milliseconds on a given request, but when compounded across the total requests per day, it can result in an enormous improvement. Performance on the Data Tier When it comes to performance-tuning an application, there is a single litmus test you can use to prioritize work: does the code access the database? If so, how often? Note that the same test could be applied for code that uses Web services or remoting, too, but I’m not covering those in this article. If you have a database request required in a particular code path and you see other areas such as string manipulations that you want to optimize first, stop and perform your litmus test. Unless you have an egregious performance problem, your time would be better utilized trying to optimize the time spent in and connected to the database, the amount of data returned, and how often you make round-trips to and from the database. With that general information established, let’s look at ten tips that can help your application perform better. I’ll begin with the changes that can make the biggest difference. Tip 1—Return Multiple Resultsets Review your database code to see if you have request paths that go to the database more than once. Each of those round-trips decreases the number of requests per second your application can serve. By returning multiple resultsets in a single database request, you can cut the total time spent communicating with the database. You’ll be making your system more scalable, too, as you’ll cut down on the work the database server is doing managing requests. While you can return multiple resultsets using dynamic SQL, I prefer to use stored procedures. It’s arguable whether business logic should reside in a stored procedure, but I think that if logic in a stored procedure can constrain the data returned (reduce the size of the dataset, time spent on the network, and not having to filter the data in the logic tier), it’s a good thing. Using a SqlCommand instance and its ExecuteReader method to populate strongly typed business classes, you can move the resultset pointer forward by calling NextResult. Figure 1 shows a sample conversation populating several ArrayLists with typed classes. Returning only the data you need from the database will additionally decrease memory allocations on your server. Figure 1 Extracting Multiple Resultsets from a DataReader // read the first resultset reader = command.ExecuteReader(); // read the data from that resultset while (reader.Read()) { suppliers.Add(PopulateSupplierFromIDataReader( reader )); } // read the next resultset reader.NextResult(); // read the data from that second resultset while (reader.Read()) { products.Add(PopulateProductFromIDataReader( reader )); }

Server Side Viewstate

·8 mins
Background ViewState is a feature provided by ASP.Net that stores information for server controls used on a web page. The primary advantage of this feature from a developer perspective is that it keeps the values of controls on a form. If the user forgot a single required field on a form, ASP.Net can put back the other values they had entered rather than forcing the developer to repopulate them. The information is encoded into a string and placed in a hidden form field called “__VIEWSTATE” that is sent to the client with the response (you can see this by using View Source in your browser when you view a / page). ASP.Net by default also calculates a “hash” of the information and adds it to the ViewState, then on a postback it can validate that the data has not been corrupted. That is a basic description of what viewstate is and how it is implemented, this article will focus on where the viewstate information is stored.

NVARCHAR versus VARCHAR

·1 min
SQL Server provides both datatypes to store character information. For the most part the two datatypes are identical in how you would work with them within SQL Server or from an application. The difference is that nvarchar is used to store unicode data, which is used to store multilingual data in your database tables. Other languages have an extended set of character codes that need to be saved and this datatype allows for this extension. If your database will not be storing multilingual data you should use the varchar datatype instead. The reason for this is that nvarchar takes twice as much space as varchar, this is because of the need to store the extended character codes for other languages

HTML Editor

·2 mins
I’ve been doing a little research on the use of an HTML Editor for development of internal project, using ASP.NET Aloha Editor (http://www.aloha-editor.org) This HTML editor is the bees knees, take a look at the website and check it out, it fantastic