RunAs SSMS VB Script

A seperation of power between a day-to-day user account and a special occasion adminstrator account can be beneficial for a DBA. By usig a less privledge account for daily activities can avoid costly human mistakes. A mistake will be denied due to not having the correct privledges. It is standard to use Microsoft Windows Domain Accounts for daily adhoc queries. A Standard SQL Account is usually used by custom applications to connect and perform work in the database. How does one easily switch from one windows account to another? A…

Managing Files

The most basic storage unit of any operating system is a file. Files can contain anything from textual data in this article, a bitmap image of your baby daughter, a MS Excel worksheet containing your finances or a Visual Basic program you are currently working on. Therefore it is very important to know how to manipulate files after they are created. Common actions that are performed on files are copy, rename, move and delete. Each file has properties such as creation date, last date modified, and attributes such as read…

Fixed Formatted Text Files

The invention of a fixed formatted text (flat) file layout started with IBM in the 1960’s. Data sets on the mainframe could be stored in both fixed and variable length records. A flat file is defined as having one record of data per row that is ended with a new line. Each field inside the record is represented by a fixed number of characters. While flat files can have either ASCII or EBCDIC encoding, I will be exploring the former. Another generalization of this format is to store numbers in…

Running the SMTP relay

Today, I want to talk about getting in shape to run the Microsoft Exchange, SMTP Relay. It takes years of practice to get in condition for such a grueling race. I am just kidding! However, the topic of a SMTP relay is an important one that you will come across in your career. A open mail relay allows a Visual Basic script to send mail messages from a mail box that you can name and does not have to exist on the mail server. In todays information world, it is…

Recursive Programs

I would like to chat about one of my favorite programming topics, implementing recursive algorithms. Recursion in computer science is a method where the solution to a problem depends on solutions to smaller instances of the same problem. A recursive program is a program that calls itself to work on a smaller sub problem. When the stop condition (last problem) is reached, all results are put together to reach the desired result. The tricky part is to make sure that the program does not execute in a infinite call loop….

Working with databases

Most Commercial off-the-self (COTS) systems read and write data to a relational database such as SQL Server, Oracle or DB2.  Canned reports and data interfaces included with the COTS system sometimes have limited features that do not fully meet the business requirements.  That is where you, the software developer, can come to the rescue by providing a custom work-around solution. Actions against the database can be expressed in the data definition language (DDL), data control language (DCL) or data manipulation language (DML).  I have encapsulating the logic for working with…

Excel Files

Business Users like to have data in a spreadsheet format. Since Microsoft Office is installed world-wide, it will be a common request for data in a XLS format. Let’s make believe that we have the business problem to write information about the first five presidents to an XLS format. The Cliché, there are many ways to skin a cat, does apply to technical solutions. I have abstracted the details behind reading and writing files by encapsulating the logic into two classes for your use.  These classes can be implemented in…

Calculating Primes

Today I am going to talk about calculating primes. Not the new Transformer movie in which Optimus Prime has to help the humans save the world. I am talking about prime numbers in which the number is only divisable by one and itself. The Algorithm that I am going to introduce is a brute force method for calculating prime numbers. It is great for comparing the computing power of two machines by looking at overall execution times. This routine consists in dividing n by each integer m which is greater…

Text Files

The first type of file that every programmer writes to and reads from is an ASCII text file . A text file is a kind of computer file that is structured as a sequence of lines. Each line is terminated with a special character such as a line feed (LF) in UNIX or a carriage return (CR) and line feed (LF) in MS DOS. I have abstracted the details behind reading and writing files by encapsulating the logic into two classes for your use. The write text file class has…

Application Logging

Error handling and application logging are the most import tasks associated with programming that are over looked by many developers. After a program is released to the field, how do you know if it is performing as it should? Are there issues with the language execution (1-tier), with the database (2-tier) or with the middle-ware (3-tier) ? Many times, issues are only noticed and acted upon after several complaints have been issued. Here is a short list of why you should adding logging to all programs that you create. Traps…