CSV Parser

For some of my work, I work on data importers and other different tasks which require dealing with CSV and tab delimited files which can often be very challenging to parse. I was sick of rolling my own csv/tab delimted parser, so I went ahead and found one that worked very well on CodeProject simply called CsvReader.

CsvReader works very similar to the StreamReader which is a firehose cursor (only going forward) and is capable of parsing very quickly (30+ MB/s). CsvReader can also be databound if there’s a need by using IDataReader. Using CsvReader is fairly simple and doesn’t really require much more than adding a few references to your project and simple array handling.

Hope this helps, it sure made things simpler for me.

COMP 306: Course Review

COMP 306 is a class about C++ and definitely required some previous experience programming in C, C# or some other object oriented language or variant of C. I finished the class a few months ago and have been very busy at work implemnting business intelligence and creating data quality checks and balanaces. (Only makes sense since I work for a knowledge based company!)

Thinking in C++, 2nd Edition by Bruce Eckel is the primary resource for the class. Thinking in C++ is a fantastic book, but I really feel that it suffers quite a bit by not including the answers to the questions in the book and requiring you to purchase a digital book if you want the answer key to the book.  The handbook for the course is pretty well written and covered most of what I felt was important related to C++ and object oriented programming: the last few chapters of the book could have used some additional explanation though.

The exam is based off of the four individual assignments and is pretty fair: my only complaint regarding the exam is that sometimes programming on paper can be challenging. I did very well in the course, not really a surprise considering I programmed for about five years before taking the class. Over all, I can say I would take the class again and found that it wasn’t too difficult and that the marking was pretty fair and that Richard Huntrods was definitely very available and helpful in both email and the class forums.

Sending Emails from C#.NET

Often, I work on software that needs to have the most minimal downtime possible. For example, I wrote a large chunk of server code that needs to handle CRM data for a small but completely distributed sales team. One of the methods, I use to try and reduce the downtime is to have the software email me whenever an exception is thrown or when some sort of event occurs.

Emails are incredibly easy to send from .NET especially your typical plaintext email. We will be making use of the System.Net.Mail namespace along with an smtp server you should already have setup or you could use a free one like Gmail.

A number of Canadian Internet Service Providers (ISPs) require you use their local SMTP Server (by blocking port 25), you should contact them if you think this will be an issue. Please note that some ISPs like Bell Sympatico do this to avoid being blacklisted for spam.

using System;
using System.Windows.Forms;
using System.Net.Mail;

namespace BRCline1
{
public partial class frmEmailer : Form
{
private const string SMTPServer = “Your_SMTP_Address_Or_IP_Goes_Here”;
private const string FromAddress = “The_Sender_Address_Goes_here”;
private const string FromAddressPassword = “The_Sender_Password_Goes_here”;
private const int SMTPPort = 25; //Could also be another port

public Form1()
{
InitializeComponent();
}

private void btnSend_Click(object sender, EventArgs e)
{
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient(SMTPServer);

mail.From = new MailAddress(FromAddress);
mail.To.Add(“address@fakedomain.com”);
mail.Subject = “Your_Subject_Goes_Here”;

//Change this boolean to true, and you could send a simple html email
mail.IsBodyHtml = false;

mail.Body = “This is my first auto email”;

SmtpServer.Port = SMTPPort;
SmtpServer.Credentials = new System.Net.NetworkCredential(FromAddress, FromAddressPassword);

SmtpServer.Send(mail);
}
}
}

Please note that you should always have some sort of exception handling for any operation that depends on a network connection or another system from responding.

Slider by webdesign