Showing posts from January, 2010

Accepting PayPal Payments on your Website

How to Accept Paypal Payments on Your Website Introduction Recently I helped out in creating a simple website for an upcoming re-union. The reunion consists of several events - one of which is semi-formal gathering. This gathering requires reservations of a local ball room and as such the website needs to do more than just inform the guests. It must also provide a way to accept payments and book them directly. Since PayPal is a popular type of online payment and can also collect all the necessary information, it is ideal for this type of transaction. PayPal provides the capability to link your website directly to the PayPal allowing your patrons to purchase whatever product you setup through PayPal. This eleminitates the need for you to do any real programming or worse hiring some expensive web developement. Since I accomplished this small feat I've had many requests on how to do this, so I have decided to print the instructions and share them with the world. Those instructions are l…

Using Windows API from C#

Recently a function in our application stopped working for some reason. We were using the WMI with the .Net Framework 3.5 in C# to determine the amount of freespace on a floppy diskette. For some reason after we upgraded from .Net framework 1.1 and from XP SP2 to XP SP3 the function stopped working. We tried searching alternatives and determining the cause to no avail. Our project lead suggested we attemp to use the Windows API directly instead.

If that were to fail then there would not be much else to do. To our surprise accessing the Windows API worked. Below is the sample code. This is only a sample of how you can still leverage the API directly to work around issues from time to time.

//This is the WindowsApi.cs file
using System;
using System.Runtime.InteropServices;
namespace MAT.Common.Utils
public class WindowsApi
public static extern bool GetDiskFreeSpace(
[MarshalAs(UnmanagedType.LPStr)]string lpRootPathNa…

Tips for resolving a bug

In a perfect world there would be little need for debugging. Unit tests would be in place for all existing code and whenever a spot was missed a test would simply be added to cover the whole. In the real world or at least the world that I work in there is much legacy code. There also other things that affect system functionality such as system complexity - our app is close to two million lines of code, familiarity with the system, developer experience.

These things require the developers to follow a structure format when resolving new bugs. Here are some tips that I came up with and passed down to my team.

The steps don’t have to be done in the exact order but they should be done prior to sending the ticket up for code review.

1. Duplicate the error
If you can’t duplicate the error don’t move beyond this step. At this point do whatever you have to do see the error for yourself in your box. Do not even think about fixing code that will work in theory. I have been bitten by t…