BPSoftware.com
Home   Utilities   Purchase   FAQ   Support   Contact        
Shareware Utilities
 APrintDirect
 AIconExtract
 AFile Attribute Manager
Freeware Utilities
 AddrMon
 AFileSync
 ASysIcon
 B&P Table Utilities
 BPACLer
 BPSNMPMon
 BPSNMPUtil
 CharCount
 Delphi® Components
 MacAddr
Miscellaneous
 BPSoftware Blog
 Purchase Shareware
 Support

 


Sunday, July 27, 2008
Edit those XML files

Wow! It has been a while since my last post. It doesn’t feel like it has been that long. Things have been both hectic and busy (to say the least). I am going to try and make it a point to post more often (again).


Over the past few months I have had the need to maintain a number of different XML files. Along with storing application settings and configurations, XML files are also great for database data transfer. XML files are simple and easy to use and they are even easier if you have the right tools. One such tool, that I use frequently is XML Notepad 2007. XML Notepad 2007 is a simple application that allows for the editing of XML documents. It has a drag and drop interface that is fairly intuitive. If you find yourself managing XML files add this free application to your tool library.

Labels: , , ,

posted by Brad Prendergast at 4:14:00 PM (1 comments)
Links to this post
Permalink
Friday, September 01, 2006
Virtualization is cool

I have posted a few times on virtualization software. It is really a great way to perform application and configuration testing. Microsoft Virtual Server 2005 R2 is available for free (at this point) also.

Labels: , ,

posted by Brad Prendergast at 6:44:00 AM (3 comments)
Links to this post
Permalink
Monday, August 28, 2006
Live Writer Test

Well, I figured I'd give it a shot. After reading about it a bit I decided to see how Windows Live Writer worked for publishing this blog. This is my first (and only so far) post and the look and feel is pretty 'simple'. Let see how it does with pictures:

That seems pretty painless, how about some code:

procedure TForm1.acAboutExecute(Sender: TObject);
var
frmAbout: TAboutBox;
begin
frmAbout:= TAboutBox.Create(nil);
try
frmAbout.Image1.Picture.Graphic:= Application.Icon;
frmAbout.ProductName.Caption:= StrAppName;
frmAbout.Copyright.Caption:= Format (frmAbout.Copyright.Caption, [StrCopyright]);
frmAbout.Position:= poOwnerFormCenter;
frmAbout.ShowModal;
finally
FreeAndNil(frmAbout);
end;
end;

Now, we'll publish this and see how it looks.

Labels: , ,

posted by Brad Prendergast at 8:00:00 PM (1 comments)
Links to this post
Permalink
Thursday, July 13, 2006
Virtual PC Is Now Free!

I have been touting Virtual PC for some time. Microsoft is now offering Virtual PC for free. VMWare Server is also available for free (along with some other products). Virtualization makes a lot of things so much easier and also eliminates the need for all those computers lying around.

Labels: , ,

posted by Brad Prendergast at 9:14:00 PM (1 comments)
Links to this post
Permalink
Saturday, May 27, 2006
Custom Word Fields

The use of Field information in Microsoft® Word allows for easier maintenance of your documents. Using fields, you can include references to document property information within your document. This avoids the need to update changing property information that is referenced within a document (title, author, etc...). Using fields with templates makes format standardization a bit more exciting. Besides the standard fields, you can also reference your custom document properties. Personally, I often reference custom document revision information.


To reference custom properties in your document you first need to set them up. In my case, I use MAJ_REV and MIN_REV, both of these are of type Number. In your Word document move the cursor to the location where you would like to insert your custom property and press CTRL+F9. This will insert a Word field denoted by brackets (note that you cannot type these in yourself, you must press CTRL+F9 to indicate it is a field). Between the brackets type DOCPROPERTY followed by the property name you would like to reference. While the cursor is still on the field, press F9 to update it and there you go….

Labels: , , ,

posted by Brad Prendergast at 8:09:00 AM (0 comments)
Links to this post
Permalink
Thursday, May 18, 2006
Event Log (Part 1)

A few months back I made a couple of posts (Part 1, Part 2) regarding Microsoft’s LogParser. Since that time I have been getting my fair share of use from it. Recently, I had the need to analyze the Event Logs on a number of machines. There is the EventLog Snap-In for MMC; however this really doesn’t allow you to do more than basic viewing or broad filtering of events. (One thing I will give it is that it allows for the connection to the event logs on remote machines. Admittedly, I do have a saved console with about 5 or so machines that I browse through the logs of often.) Once again this Free Gem came to my rescue. One of the input sources of LogParser is the EventLog (EVT) Input Format. With LogParser you can select EventLog data (using a SQL like syntax) from a local or remote EventLog and output it to one of LogParser’s output format.

The EVT fields available for selection are EventLog, RecordNumber, TimeGenerated, TimeWritten, EventID, EventType, EventTypeName, EventCategory, EventCategoryName, SourceName, Strings, ComputerName, SID, Message and Data.

With these fields a number of data extractions can be put together rather quickly. Here are a couple of basic ones (The charts are the actual charts created by LogParser):

logparser -o:DATAGRID "SELECT EventTypeName, EventCategoryName, TimeGenerated, SourceName, ComputerName FROM Application"

logparser -O:CHART -chartType:Column3D -chartTitle:"Count of Events" -values:ON -legend:OFF "SELECT TOP 20 SourceName, COUNT(SourceName) AS Count_Events INTO Events.gif FROM Application GROUP BY SourceName ORDER BY SourceName"

logparser -o:DATAGRID "SELECT EventTypeName, EventCategoryName, TimeGenerated, SourceName, ComputerName FROM \\COMPUTERNAME\Security"

logparser -o:DATAGRID "SELECT EventType, EventTypeName, EventCategoryName, Count(EventTypeName) AS Entries FROM Security GROUP BY EventType,EventTypeName,EventCategoryName"

logparser -o:CHART -chartType:Pie3D -chartTitle:"Event Categories" -values:ON -legend:ON "SELECT EventCategoryName, Count(EventTypeName) AS Entries INTO EVENT.GIF FROM Security GROUP BY EventCategoryName"


I have found the LogParser help file quite useful. There are plenty of examples, of which one explains how to do percentages.

I have also created an app using the EventLog Class that allows me to work with logs. This was my maiden voyage with this class and hopefully I’ll post on my experience shortly. I also hope to tighten it up for a more ‘universal use’ and post it for download.

Labels: , ,

posted by Brad Prendergast at 7:55:00 PM (0 comments)
Links to this post
Permalink
Friday, April 14, 2006
In time for Easter

I've always liked those corny 'Easter Eggs'. In fine fashion some posts just can't go unreferenced. Take bring them back home! for example.

Labels: , ,

posted by Brad Prendergast at 7:26:00 AM (0 comments)
Links to this post
Permalink
Tuesday, April 04, 2006
Managing my Newsgroups

I’ve been participating in newsgroups for many years. Newsgroups are a great way for members of a community to share and discuss information. Part of my daily ritual includes the reading/posting new messages on groups that I monitor. I used to use the Outlook Express newsreader to manage the newsgroups that I subscribe to.

One of the major issues that I had with monitoring newsgroups was that depending on where I am and what I am doing I could be checking these newsgroups from one of four separate computers. Using Outlook Express, any post that was created after the last time I had checked the newsgroups on a particular computer showed up as a new message, regardless if they were read by me on another computer. This nuisance created the need to find a newsreader that would allow me to check newsgroups from separate computers without causing read messages to show up as new if I had already read them regardless of which computer was used. After poking around I decided to give Colin Wilson’s XanaNews a shot (I currently use XanaNews and I am extremely pleased with it and I would recommend it as a newsreader). A number of things drew me to this program one of the major things is that it was written with Delphi®.

XanaNews doesn’t have any ‘written’ or ‘published’ instructions for using it on a removable storage device; however after some poking I did find all of the settings are stored in the HKEY_CURRENT_USER\Software\Woozle registry key. One of the options available in the registry and XanaNews configuration is the “Messagebase Directory”. The Messagebase Directory is where the XanaNews message files are stored. I had mentioned before that I use my 1 GB SanDisk to store all my portable files. After some experimentation I found that if I set up XanaNews with all of my preferred settings on a computer that I could export the HKEY_CURRENT_USER\Software\Woozle registry key and import it into another computer and have all the same settings. The only thing that needs to be adjusted is the location of the message base directory, depending on which drive the USB Flash Drive is assigned. This allows me to manage newsgroup messages (both on and offline) from many computers without duplicating efforts. In the XanaNews directory on my flash drive I have the message base directory program executable and my exported registry file (that I update as needed).

The only thing on my XanaNews wish-list is the option to allow for user settings to be stored to a disk file (ini) or the registry (I know it is open source). Other than that it is an excellent feature rich program and if you haven’t tried it, give it a shot.

Labels: , ,

posted by Brad Prendergast at 7:01:00 AM (4 comments)
Links to this post
Permalink
Sunday, March 26, 2006
Rock Paper Scissors

Rock-Paper-Scissors-Shoot...

This game is an adaptation of the popular Rock Paper Scissors game. Rock Paper Scissors is a popular game that is typically played between two people. It is a game that can be played pretty much anywhere and is fun for all ages. This page allows you to play against a computer.

Rock Paper Scissors has three basic rules:

  1. Each players substitute the three elements of Rock, Paper and Scissors with hand signals.
  2. The hand signals are delivered simultaneously by each player (Typically one player will say ‘Rock Paper Scissors Shoot’ and both players will display their hand signal when as ‘Shoot’ is said)
  3. The Outcome of play is determined by the following:
    Rock beats Scissors
    Scissors beats Paper
    Paper beats Rock

To play, simply click your button choice. As you make your selection the computer will also choose. Let's see how well you do.

ready to play? Click Here

Labels: , ,

posted by Brad Prendergast at 9:35:00 AM (0 comments)
Links to this post
Permalink
Wednesday, March 15, 2006
Rightly So

Writely was picked up by Google. I had taken a look at it before, and well, I think we’ll be seeing a lot more of this in the future. ‘Bill Webb’ hits it pretty well.

Labels: , ,

posted by Brad Prendergast at 7:47:00 PM (0 comments)
Links to this post
Permalink
Saturday, February 18, 2006
Please Pick Me!

With this weekend’s Powerball Jackpot reaching $365 Million, who isn’t tempted to purchase a ticket or two. Let’s limit that question to those that are both geographically and physically capable of purchasing a ticket. I have never been a big lottery participant. When I do venture out to get a ticket, the troublesome task of picking the ‘winning’ numbers makes me sweat. I am a logical guy, and I try to come up with some sort of ‘logical’ reasoning behind my selection, which requires a lot of work. So, needless to say I always opt for the ‘quick pick’ route. That’s right, let the computer pick the numbers for me. Having a little extra time, after reading Marco’s book (for a second time) and having spent an abundant amount of time in Visual Studio in the past few weeks, I decided to whip something up with my favorite IDE. The results: a ‘Random Number Picker’ (notice the logo). Click here for the results.

This random number picker (I am not looking for any debates on the randomness of the numbers) allows you to enter the number of numbers you would like returned as well as the upper and lower bounds of the numbers returned. If you want more of a ‘most popular’ number, each number’s percentage and number of times listed is also displayed.

There are a couple additions I want to make over the next day or so, like an option to allow duplicate numbers or not – (hey, some lotteries allow it) and formatting for my browser of choice - FireFox (it looks fine in IE). After that I will post the source up.

If anyone else has any suggestions pass them along…..

Oh, and use of the random number generator for lotteries or any other ‘thing’ does not guarantee or increase your chances of winning anything. It is intended to be just one other way for me to pick numbers….

‘Random Number Picker’

Labels: , ,

posted by Brad Prendergast at 5:29:00 PM (0 comments)
Links to this post
Permalink
Friday, January 13, 2006
Syncing

A while back I posted about synchronizing files between folders and computers. It seems Microsoft® has another free synchronization tool available. SyncToy for Windows® XP is briefcase on steroids.

While I am on the topic of software applications, most people have a number of username and passwords for various accounts. KeePass is a great open source password manager.

Labels: , ,

posted by Brad Prendergast at 7:21:00 AM (0 comments)
Links to this post
Permalink
Thursday, January 12, 2006
Piecing it all together (Part 3)

Part 2

Step 3 – The Add-In

One nice thing I like about Microsoft® Office® is the ability to write code behind the application. This allows for the creation of complex macros and coding in VBA. You can write [virtually] anything that you can with Visual Basic®, with one big differences being the inability to make stand alone applications.
The next step takes us into Microsoft® Excel®. Once it is running open up the Visual Basic® Editor (Alt+F11) and Insert a Module.

The easiest way for an end user to call our DLL is via a menu item. Seeing how we are creating an Add-in, our menu item should be created when loaded and removed when unloaded. For this we use the Auto_Open and Auto_Close procedures. I also like to put version information in my menus. We also need to declare our DLL function so that our VBA ‘application’ knows it exists.
[Here comes the VB part]

Option Explicit

Const strVersion As String = "Rev 1.00A"

Declare Function DoEmpty Lib "emptydll" (ByVal thestring As String, _
ByVal base As Single, ByVal newbase As Single, ByRef ooutsingle As Single) As Boolean

Sub Auto_Open()
Dim MyMenu As Menu

Set MyMenu = MenuBars(xlWorksheet).Menus.Add("BPStuff", 10)
MyMenu.MenuItems.Add "CallIt", "CallMyEmptyDll"
MyMenu.MenuItems.Add "---"
MyMenu.MenuItems.Add strVersion
End Sub

Sub Auto_Close()
MenuBars(xlWorksheet).Menus("BPStuff").Delete
End Sub


Sub CallMyEmptyDll()

Dim sometext As String * 30
Dim returnsingle As Single
Dim theresult As Boolean

sometext = ActiveCell.Value
While ((sometext <> Empty) And Not (IsEmpty(ActiveCell)))
theresult = DoEmpty(sometext, 400, 450.56, returnsingle)
If theresult Then
Selection.Offset(0, 1).Select
ActiveCell.Value = returnsingle
Selection.Offset(1, -1).Select
sometext = ActiveCell.Value
End If
Wend
End Sub


This simple example looks at the current cell and checks for a value and then ‘performs a calculation’ and places the result in the adjacent cell. To allow for an undetermined number of items this procedure goes through a list and stops when it finds a blank cell or value. The only thing left is to save the application as an Excel® Add-in (*.xla) and place it in the Add-in directory (or any other directory). From within Excel® select Tools --> Add-ins and activate your newly saved add-in. Once active it will load each time.

Well, I think we’re all done with our project. At this point you should be able to select a cell and call our function from a menu.

Labels: , , ,

posted by Brad Prendergast at 7:19:00 AM (0 comments)
Links to this post
Permalink
Wednesday, January 11, 2006
Piecing it all together (Part 2)

Part 1

Step 2 – The DLL

In the last piece I discussed the overall objective of this project as well as covered the classes used within the DLL that is ultimately going to be called from within an Excel® Add-in. The next thing step is to create the DLL that is going to be used. This was greatly simplified by having classes that were called, basically allowing just the ‘wrapping’ of the calling code. We are only accepting ‘string’ values in, if we were returning then this would be slightly different.

library emptydll;

uses
SysUtils,
ActiveX,
EmptyUnit,
Classes;

{$R *.res}
function DoEmpty(intext: pchar; inbase:single; innewbase: single; var outsingle: single):boolean;stdcall;
var
emptyitem: TEmptyItem;
emptycalc: TEmptyCalc;
begin
CoInitialize(nil);
emptycalc:= TEmptyCalc.Create(nil);
emptyitem:= TEmptyItem.Create(nil);
try
try

emptyitem.SomeText:= intext;
emptycalc.SomeBase:= inbase;
emptycalc.SomeNewBase:= innewbase;
emptycalc.GetCalc(emptyitem);
outsingle:= emptyitem.SomeSingle;
Result:= True;
except
Result:= False;
end;
finally

emptyitem.Free;
emptycalc.Free;
CoUninitialize;
end;
end;

exports DoEmpty;
begin
end.


To ensure that this DLL is ‘functional’ I created a test application with Delphi®.

type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
end;

function DoEmpty(intext: pchar; inbase:single; innewbase: single;
var outsingle: single):boolean;stdcall;external 'emptydll.dll';

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
mysingle: Single;
mytext: PChar;
begin
mytext:= 'TheText';
DoEmpty(mytext,400,450.56,mysingle);
Edit1.Text:= FloatToStr(mysingle);
end;

end.

Now that we have a DLL that works as intended the next thing we need to do is move to Excel® and create the Add-In. Before moving to the next step copy the emptydll.dll to the default (typically c:\windows\system32) system directory. There is an order for searching but for ease of use we’ll go with this.

Labels: , , ,

posted by Brad Prendergast at 7:54:00 AM (0 comments)
Links to this post
Permalink
Tuesday, January 10, 2006
Piecing it all together (Part 1)

Just as important as it is to speak more than one language (or at least conversant), I feel it is equally important to know [exposure] more than one programming language. In a world pwned by M$ one can not get buy without having a little Visual Basic® as part their ‘language set’. I think a lot of programming comes down to understanding logic, concepts and ‘how things work’, once those are understood coming up with the syntax tends to be easier (that and a little RTFM).
Ok here is the scenario – I have a Delphi® application that does a significant number of queries and lengthy complex calculations on a SQL Server database based upon user input. The results are displayed to an on screen grid. This all works wonderful, well it did, until I needed to change the input from user entered to a column of data in an Excel® spreadsheet that writes back the calculation in predefined columns.
There are a number of ways this can be accomplished, the route I chose this time was to create an Excel® Add-in (Personal Macro Workbooks work too, however I prefer Add-ins for their deployment ease) that calls the Delphi® DLL from a menu item. Fortunately, I had created classes with public methods and properties to pass information back and forth to my main application, sort of a pseudo back and front end within my own application. I tend to do things this way because it simplifies things a bit in the event branch off needs (such as what I needed to do). In an attempt to keep things brief (I have a short attention span and can only handle a few pages at a time myself) I will break this up into multiple sections. All the code has been greatly simplified [and stripped down] from my original source (for a number of reasons), so it may not make too much functional sense but we’re working on concept here. I used BDS 2006 Update 1 and Excel® 2003 SP2 for this project.

Step 1 – The Classes

unit EmptyUnit;

interface

uses
SysUtils, Classes;

type
TEmptyItem = class(TComponent)
strict private
FSomeSingle: Single;
FSomeText: string;
public
property
SomeSingle: Single read FSomeSingle write FSomeSingle;
property SomeText: string read FSomeText write FSomeText;
constructor Create(AOwner: TComponent); override;
end;

TEmptyCalc = class(Tcomponent)
private
FADOConnectionString: String;
FSomeBase: Single;
FSomeNewBase: Single;
FSomeSingle: Single;
FSomeText: string;
public
constructor Create(AOwner: TComponent); override;
procedure GetCalc(var emptyitem: TEmptyItem);
published
property ADOConnectionString: string read FADOConnectionString write FADOConnectionString;
property SomeBase: Single read FSomeBase write FSomeBase;
property SomeNewBase: Single read FSomeNewBase write FSomeNewBase;
property SomeSingle: Single read FSomeSingle write FSomeSingle;
property SomeText: string read FSomeText write FSomeText;
end;

implementation

{ TEmptyItem }

constructor TEmptyItem.Create(AOwner: TComponent);
begin
inherited;

FSomeSingle:= 0;
end;

{ TEmptyCalc }

constructor TEmptyCalc.Create(AOwner: TComponent);
begin
inherited;
FADOConnectionString:= '';
FSomeBase:= 0;
FSomeNewBase:= 0;
FSomeSingle:= 0;
FSomeText:= '';
end;

procedure TEmptyCalc.GetCalc(var emptyitem: TEmptyItem);
begin
SomeText:= emptyitem.SomeText;
SomeSingle:= 2.34; // This is filled from a query or whatever
emptyitem.SomeSingle:= (SomeNewBase - SomeBase) * SomeSingle;
end;

end.

Part 2 will cover The DLL

Labels: , , ,

posted by Brad Prendergast at 6:07:00 AM (1 comments)
Links to this post
Permalink
Tuesday, January 03, 2006
FTP Batch

File Transfer Protcol (FTP) is a quick way to transfer files between two computers. There are many FTP software programs, both the pay and free varieties, available. Windows® also includes a command line FTP program (ftp.exe).
In this GUI world many shutter at the thought of a command line application, however this one does have its advantages. For starters it is already included in the OS and doesn’t need to be installed. I attempt to not over complicate things and keep them clean and uncluttered. IMHO, the main advantage is the ability to process a text file that contains FTP commands. The parameter option to specify the text file to process is -s (to see the other parameter options at the command prompt type FTP -?).

This feature is advantageous because you can set up FTP batch files that perform various transfer actions without the need to click a number of buttons or type a number of commands. Login information can be included in the text file allowing access to those FTP locations that require user authentication. I have a number of batch files that I frequently use to transfer data. I have also set some up with the Windows® task scheduler for unattended processing.

A batch file could look something like this:
ftp -s:somefile.txt

In the somefile.txt file:
open 192.168.100.1
username
password

cd images
lcd images
send *.gif


The text file commands are passed a line at a time for processing. As displayed in the above example a username and password can also be passed, as those are typically the first two prompts after an FTP server connection is opened. The text file can contain any of the valid FTP commands (type ? at the ftp> prompt for a list of valid commands). I tend to be brief in my postings but hopefully you can see the value in the ability to do this. If you have any additional input I’d love to hear it.

Labels: , , , , ,

posted by Brad Prendergast at 6:32:00 PM (1 comments)
Links to this post
Permalink
Friday, December 09, 2005
Where’s my briefcase? (Part 2)

In Part 1 I discussed how you can use a ‘Briefcase’ to synchronize files with a storage device. If you are running Windows® XP Professional you have another option for synchronizing your files. This feature is appropriately named ‘Offline Files’. Offline files are primarily geared towards network file synchronization with you local storage. This is ideal for laptop users who travel and need to work as if they were in the office.

I have used both Briefcase and Offline Files extensively and overall, I prefer the briefcase method. One huge benefit of offline files is that this can be set for automatic synchronization. Sort of ‘set it and forget it’ type thingamajig. One additional thing to note about offline files is that this can be managed via Group Policy so a network administrator may disallow their use or preset the options.

I had intended on writing the steps for enabling offline files but I found a nice link that perfectly describes the process; making it a whole lot easier for me. Click HERE for the steps.

Labels: , ,

posted by Brad Prendergast at 10:12:00 PM (0 comments)
Links to this post
Permalink
Tuesday, December 06, 2005
Where’s my briefcase? (Part I)

In this hectic world of ours one may find themselves frequently traveling from place to place. With computers an integral part of every day life, how do you work with your files while you’re away from your main workstation? Do you simply copy and replace them when you return? What if you need to do this often? What if there are many files edited, added and/or deleted?

Fortunately there are two quick ways to accomplish this sort of thing built right into Microsoft® Windows®. You have a choice of a Briefcase or using Offline files. Both of these options allow you to synchronize your files with copies on another storage device. You can edit either version and synchronize them bringing the contents in sync. This is also a nice method of a sort of quasi-backup of your beloved files. The USB flash drives are perfect for offline storage. They are compact and capable of holding large amounts of data. I personally use Briefcase with my 1GB SanDisk Cruzer mini.

The creation of a Briefcase is fairly simple. Open up Windows® Explorer and browse to the location where you would like to store you briefcase (this is where your synchronized copy will be kept, not the original location). After browsing to the desired location select File --> New --> Briefcase from the menu items. A new briefcase object will appear on your device. Rename the newly created briefcase to something meaningful or appropriate. .Next find the files/folders that you would like to keep synchronized. Select those objects and copy them. Browse to your newly create briefcase and copy these files/folders inside. Tada! This is pretty much all that is necessary to set up your files for synchronization.

Once you have a briefcase set up you can take your storage device with you and work on your files while you are away. When you return to your main workstation you simply need to synchronize your files. To synchronize your files open up your briefcase and select Briefcase --> Update All from the main menu. A dialog will appear showing you the changes that are about to take place. You can keep the results as is, or change the direction of synchronization or even skip synchronization changes.

At first glance, to some, this may seem complicated. However, once you start using briefcases (yes, you can have multiple on one device for different locations, I use many. I even have one to synchronize my bookmarks on all the different computers that I use.) you’ll quickly become comfortable with them. They’re a great way to ensure you can access your files while you are away from you main workstation. It is also a nice way to keep a backup of those must have files.

Labels: , ,

posted by Brad Prendergast at 8:21:00 AM (0 comments)
Links to this post
Permalink
Saturday, November 26, 2005
Ode to Backup

Backing up your files is probably one of the most important things you could do. There is nothing worse than the feeling of loosing everything once your computer is on the fritz (I have received dozens of frantic phone calls asking how to, or if I can restore files). There are many commercial, shareware and freeware backup programs that are capable of accomplishing appropriate backups.

XCOPY has been included in the Microsoft® OS family since the DOS days. This little command prompt program copies file and folder information based upon the selection of a number of parameter options. This utility is lightweight and consists of a simple executable file. This is actually what I use for incremental backups of my personal system.

Open a command prompt and type xcopy /?. This displays a list of the xcopy.exe parameter options and their meaning. From the command prompt you can easily type in your xcopy command with the necessary parameters and you’ll be on your way. Personally I have a small batch file called backup.bat. This eliminates a lot of typing and the need to remember the options. This batch file is simple but extremely effective in giving me copies of the files I need. It consists of one line:

xcopy *.* c:\wutemp /S /C /I /M /F /R /H /K /Y /EXCLUDE:exclude.txt

My backup.bat file is located in the root of my profile directory, for this example we’ll say C:\Documents and Settings\BP. If you follow the parameters you’ll notice that I copy all the changed (archive bit set) files to C:\wutemp. This batch file will process the current folder and with the appropriate parameter set (/S) all subfolders as well. Once the backup batch is complete I them manually copy the files to DVD. If you are running a ‘full’ backup you would remove the /M parameter option.
I am fairly structured and organized when it comes to my files. I try to get everything that I need somewhere within the tree of my profile directory. Most applications these days store personal information in the Application Data of your profile directory or allow you to specify a ‘storage’ location. A lot of applications also store temporary or unimportant (unimportant in the sense of need to restore files in the event of a need to recover files) files in your profile directory as well. This is where the /EXCLUDE parameter comes into play. After all, it is really wasteful both time and space wise to back up all those temporary files.
My exclude.txt file looks something like this:

\DOCUME~1\BP\Templates
\DOCUME~1\BP\Start Menu
\DOCUME~1\BP\Recent
\DOCUME~1\BP\SENDTO
\DOCUME~1\BP\PrintHood
\DOCUME~1\BP\NetHood
\DOCUME~1\BP\Windows
\DOCUME~1\BP\Cookies
\DOCUME~1\BP\MY DOCUMENTS\MY MUSIC
\DOCUME~1\BP\LOCAL SETTINGS\TEMPORARY INTERNET FILES
\DOCUME~1\BP\LOCAL SETTINGS\TEMP
\DOCUME~1\BP\LOCAL SETTINGS\HISTORY

This is just an example on how I use XCOPY to back up my important files on my personal computer. In my opinion this is fast, lightweight and effective when it comes to storing those must have files. I hope this gives you some ideas on how you could possibly implement a simple backup solution.

Labels: , , , ,

posted by Brad Prendergast at 5:53:00 AM (0 comments)
Links to this post
Permalink
Saturday, November 19, 2005
Free Gems Do Exist (Part 2)

As time progresses I am becoming far more comfortable and impressed with Microsoft’s Log Parser. For one thing, I am awed at how it processes so fast. I processed 404 logs (over 4.6GB) in seconds, not minutes or hours as I had first thought. The command line syntax is also quite powerful. This tool allows you to precisely and quickly analyze data without a lot of overhead.

I had mentioned in the first post that another bonus is the COM interface. All the power of this command-line tool can be wrapped in a nice GUI interface, which is exactly what I had done. After reading about the interfaces in the accompanying help file I imported the Type Library for Log Parser into Delphi® (I have Delphi® 5 and Delphi® 2005 installed on my development machine and I worked with Log Parser in both versions) and installed the new components. One thing to note is that the TLogQueryClass is the only class that seemed to work properly after importing the library. Each of the Input and Output format components kept on reporting invalid log formats when I passed them to the TLogQueryClass method. I tried numerous ways to get them working. This was/is more of a nuisance more than anything else. The help file clearly lists (I have also included them in this source) the classes which can easily be created as variants.

To get started with a simple example of how to use the Log Parser interfaces I started a new application and placed a TFileEdit, TStaticText, TListBox and three (3) TButtons on the TForm. Rather than go into a verbose explanation I figured I’d just post some sample code and let the code explain what is going on. Here is a wonderful byproduct of living in the 21st century; there is no guarantee or warranty, expressed or implied, concerning the applicability of code and techniques included in this example. This example code is supplied AS IS. If you wish to use this code or technique, it is your responsibility to test and certify the code in your project.

Button1 (caption:= ‘Output’) shows how to use an InputContextClass and OutputContextClass.
Button2 (caption:= ‘LogParser Version’) shows how to retrieve the version information from TLogQueryClass.
Button3 (caption:= ’Record’) shows how to retrieve the information into a RecordSetClass from an InputContextClass and iterate through each of the records. In this example I add each entry to a list box.


uses
ComObj;

{
Input Formats:
ADS : MSUtil.LogQuery.ADSInputFormat
BIN : MSUtil.LogQuery.IISBINInputFormat
CSV : MSUtil.LogQuery.CSVInputFormat
ETW : MSUtil.LogQuery.ETWInputFormat
EVT : MSUtil.LogQuery.EventLogInputFormat
FS : MSUtil.LogQuery.FileSystemInputFormat
HTTPERR : MSUtil.LogQuery.HttpErrorInputFormat
IIS : MSUtil.LogQuery.IISIISInputFormat
IISODBC : MSUtil.LogQuery.IISODBCInputFormat
IISW3C : MSUtil.LogQuery.IISW3CInputFormat
NCSA : MSUtil.LogQuery.IISNCSAInputFormat
NETMON : MSUtil.LogQuery.NetMonInputFormat
REG : MSUtil.LogQuery.RegistryInputFormat
TEXTLINE : MSUtil.LogQuery.TextLineInputFormat
TEXTWORD : MSUtil.LogQuery.TextWordInputFormat
TSV : MSUtil.LogQuery.TSVInputFormat
URLSCAN : MSUtil.LogQuery.URLScanLogInputFormat
W3C : MSUtil.LogQuery.W3CInputFormat
XML : MSUtil.LogQuery.XMLInputFormat

Output Formats:
CHART : MSUtil.LogQuery.ChartOutputFormat
CSV : MSUtil.LogQuery.CSVOutputFormat
DATAGRID : MSUtil.LogQuery.DataGridOutputFormat
IIS : MSUtil.LogQuery.IISOutputFormat
NAT : MSUtil.LogQuery.NativeOutputFormat
SQL : MSUtil.LogQuery.SQLOutputFormat
SYSLOG : MSUtil.LogQuery.SYSLOGOutputFormat
TPL : MSUtil.LogQuery.TemplateOutputFormat
TSV : MSUtil.LogQuery.TSVOutputFormat
W3C : MSUtil.LogQuery.W3COutputFormat
XML : MSUtil.LogQuery.XMLOutputFormat
}

procedure TForm1.Button1Click(Sender: TObject);
var
szQuery: WideString;
pObjectInput,
pObjectOutput: variant;

begin
szQuery:= Format('SELECT c-ip FROM %s GROUP BY c-ip',[FileEdit1.Text]);

pObjectInput:= CreateOleObject('MSUtil.LogQuery.W3CInputFormat');
pObjectOutput:= CreateOleObject('MSUtil.LogQuery.DataGridOutPutFormat');

LogQueryClass1.ExecuteBatch(szQuery,pObjectInput,pObjectOutput);

pObjectInput:= Unassigned;
pObjectOutput:= Unassigned;
end;


procedure TForm1.Button2Click(Sender: TObject);
begin
StaticText1.Caption:= Format('LogParser Version %d.%d',[LogQueryClass1.versionMaj,LogQueryClass1.versionMin]);
end;

procedure TForm1.Button3Click(Sender: TObject);
var
szQuery: WideString;
pObjectInput,
LogRecordSet,
oRecord: variant;

begin
szQuery:= Format('SELECT c-ip FROM %s GROUP BY c-ip',[FileEdit1.Text]);

pObjectInput:= CreateOleObject('MSUtil.LogQuery.W3CInputFormat');

LogRecordSet:= LogQueryClass1.Execute(szQuery,pObjectInput);

while not LogRecordSet.atEnd do
begin
oRecord:= LogRecordSet.GetRecord;
ListBox1.Items.Add(oRecord.GetValue(0));
{ ListBox1.Items.Add(oRecord.ToNativeString(',')); }
{ The ToNativeString method retrieves the entire record with each value separated by the specified delimiter. }

LogRecordSet.MoveNext;
end;

pObjectInput:= Unassigned;
oRecord:= Unassigned;
LogRecordSet:= Unassigned;
end;


If anyone else does anything with this interface I welcome the posting of examples. This is it for now, time to go off and expand upon the BPACLer application.

Labels: , , , , ,

posted by Brad Prendergast at 8:17:00 AM (1 comments)
Links to this post
Permalink
Thursday, November 17, 2005
Free Gems Do Exist (Part 1)

This is another post that I write with much enthusiasm and excitement. Recently, I was in search of a versatile log analyzer. In the past, I have used AWSTATS for analysis if IIS logs. In this instance, my needs involved the analysis of ISA log files. AWSTATS is an excellent open-source Web and E-Mail log analyzer (that I highly recommend, and often do), but it just didn’t give me what I was looking for when it came to ISA logs.

My journey through the Internet, via Google, in search of an ISA log analyzer ensued. I read through many feature lists and articles, viewed a number of screenshots, for various programs that were capable of processing ISA logs. Then it happened. I stumbled across one of the most flexible, free forming analyzers I had come across. This program also has the feature of being absolutely FREE. The program I am talking about is Microsoft’s Log Parser. Yes, Microsoft does have those hidden GEMS that are free.

At first glance, this command-line utility does appear overwhelming and complicated. Once I dug into its functionality and discovered its wide range of use, the only overwhelming feeling I had was excitement. This command-line utility can extract information from many common log ‘file’ types. Log Parser also includes a variety of output options (NAT, DATAGRID and CHART are my favorite). The data that is outputted is determined through a SQL like syntax, which is very powerful and FAST. I was able to process inquiries across large (individual) log files, in a directory, in a matter of seconds (600K records in multiple files took under 5 seconds to process). This program handles such a range of log ‘file’ types that I find myself using it constantly throughout the day.

A couple basic examples of Log Parser’s use are:







Log Parser is also accessible via COM interface. Once I came across this information in the help file my excitement level raised to a new high. The power of this command-line utility can be easily ‘wrapped’ in a GUI interface.
I am a Delphi fanatic, as many know, and love to incorporate it into everything. After reading up on the Log Parser classes I quickly imported the Type Library and threw together a sample application. Unfortunately, this is long enough as it is and the sample Delphi code will have to wait for Part 2 of this posting…

In the meantime I highly recommend downloading Microsoft’s Log Parser and becoming familiar with it. Once you do I am sure you will use it often.

Labels: , ,

posted by Brad Prendergast at 8:29:00 PM (0 comments)
Links to this post
Permalink
Friday, November 11, 2005
Delphi™ Components and Freeware Updates

I often reflect back on a business trip I had made to Mexico. I was ‘fortunate’ enough to not be in a so called ‘tourist area’, but the actual inner-sanctum of the country. One evening on the way to a local dining delight I asked our host if we could drive around and see authentic scenery and culture. By US standards, most people had nothing. There were cinder block houses with open window and doorways. I even thought I saw a few cardboard box expansions. One thing that I did notice was a sense of family and content. Most seemed happy with just that and their few material possessions. Most of the residents I had come across were very relaxed and happy to enjoy their family and health. There was a definite lack of pressure and 'rat' race to constantly get ahead (and obtain more). The older one gets, the faster the perception of time moves along. Seasons come and go in the blink of an eye, without most evening noticing. Which is culturally correct the appreciation of what you have or the constant pursuit and wanting of more?
-=-=-=-

Today’s updates include two Delphi™ Components and one of the Freeware utilities listed on this website.

TDBDateTimePicker has been updated to correct an issue that would cause the value to not be updated when you scrolled through a recordset. The correct value was stored; it was just the value not being displayed unless you were in a state of dsEdit.

TDBSpinEdit has also been updated. This update includes a change to the display (not stored) value on a new record. Also corrected was an issue that forced the need to click the up or down button twice to move the value. This is because the first would put the State to dsEdit and the second changed the value. This is all done on once click now.

BPACLer is the Freeware utility that has been updated. A number of minor enhancements and adjustments were made. The most notable enhancement is the ability to print the ACL information. A Check Version option has also been added to the Help menu. This allows you to check if you have the most current version of the software without the need to constantly check this website. This version checking does not send any information. It simply queries (GET) a web document containing product version information and compares it to your version. It is basically the equivalent of browsing and reading a web page. I am pleased with the feedback I have received regarding this utility.

If you have any comments or suggestions regarding this, or anything listed on this website please let me know.

Labels: , , ,

posted by Brad Prendergast at 12:48:00 PM (0 comments)
Links to this post
Permalink
Saturday, November 05, 2005
Shareware: APrintDirect version 5.1.2.7 available

An update to the popular shareware application APrintDirect is now available for download. APrintDirect is a feature rich 32-bit utility that allows you to easily print or save a customizable listing of the files contained in any folder (directory) on your computer. A number of enhancements and internal adjustments have been included in this latest release (see the history section of the help file). Notable enhancements include:

The addition of a parameter option was intended to allow for APrintDirect to be used as a SendTo option from Windows® Explorer (for information on setting up a SendTo shortcut visit My Send To).
APrintDirect now makes it easier to ensure that you’re using the current version through a Check Version option from the Help Menu.
A sortable file Owner column has been added to the list of available output columns.
Total file, size and folder count option has been added back to the listing.

Existing users should take advantage of the latest APrintDirect enhancements by upgrading to the latest version. If you have not yet tried APrintDirect download it today and try a fully functional version free for 30 days.

As always if you have any questions, comments or suggestions about APrintDirect please let me know. User feedback is vital to the continued development of quality software.

Labels: , ,

posted by Brad Prendergast at 9:57:00 PM (0 comments)
Links to this post
Permalink
Tuesday, November 01, 2005
Conditional Format

Spreadsheets are a great tool for analyzing, manipulating and 'testing' data. Over the years there have been significant advances in spreadsheets that allow for a lot more functionality. Based upon my interactions, I feel comfortable in saying that most people are unaware of and/or greatly underutilize many of the functions and features found in most popular spreadsheet applications.

I often find myself importing thousands of records from databases into a Microsoft Excel spreadsheet for some random ‘quick and dirty’ analysis or output. Once in Excel the possibilities are almost limitless when it comes to the representation of this data, whether it’s via pivot table, charts or just a plain old on the fly filtered list.

When viewing thousands of records it is more often palatable and easier on the eyes with some sort of visual record cues. For example, let’s say we’re looking at a list of customer invoice records, which are sorted by customer. Ata quick glance, by default, all the rows generally look the same. Without intense scrutiny the data sort of, blends all together. What about some sort of visual separation by customer? Excel does have Grouping and AutoFormat, however sometimes the grouping can be overkill. All those '+' and '-' can become overwhelming. Don’t get me wrong grouping is great for adding fast subtotals. The AutoFormat is nice for shading; however it shades on alternating records. What if you wanted to shade groups of records? One answer.. Conditional Formatting.

Conditional Formatting allows you to specify cell properties based upon certain value or formula information. After playing with it a bit, one can see that it is really quite useful. For my scenario:


  1. Sort your list
  2. Insert what I call tend to call a 'Helper Column'. This column is typically hidden, and used to indicate when there is a change in a specific value, i.e. Customer. I prefer to put this column as the first or last column in the data set. For this example we will use column A.

  3. Type the following formula in the first data row. We’ll start on row 2 because row 1 is our 'header': '=MOD(OFFSET($A2,-1,0)+ OR($B2<>OFFSET($B2,-1,0),0),2)'. Basically what this formula is saying is alternate 1 or 0 in this cell A2, based upon B2 being different than B1. (The $ before a cell RC value indicates that value is constant (will not change) when it is copied to another cell.)

  4. Copy (or use Fill Down; Ctrl + D) the formula down the entire length of the data set. There are a number of shortcuts that make this easier (Mental note: discuss some quick keyboard navigation another time).

  5. Select the entire data set including the 'Helper Column', making sure you have the upper rightmost column active, A2 in this example.

  6. Select Conditional Formatting… from the Format menu item.

  7. Change condition 1 to ‘Formula is’ and enter ‘=$A2=1’. We’re only going to apply the format if the cell value is 1. The 'Helper Column' should be alternating 0 and 1 on a change in Customer.

  8. Click the Format button

  9. Select the Pattern Tab

  10. Choose which color to fill the cell with when the condition is met

  11. Click Ok to close the Format dialog

  12. Click Ok to close the Conditional Format dialog.



Your spreadsheet should now be shaded by Customer.
This is just a simple sample of using the Conditional Formatting feature of Micrsoft Excel. There are a number of other properties that can be set based upon value or calculated formula that greatly enhances the representation of a data set in Excel.

Labels: , , ,

posted by Brad Prendergast at 6:51:00 PM (1 comments)
Links to this post
Permalink
Sunday, October 30, 2005
Delphi™ Components: TFileEdit Updated

A minor adjustment has been made to TFileEdit. The latest version of this component may be downloaded from here. TFileEdit is a descendant of TEdit which contains a button that, when clicked, calls an open file dialog that fills the TEdit control with the selected file name and path information. TFileEdit also has ButtonClick Event in order to perform your own action when the button is clicked.

Labels: , , ,

posted by Brad Prendergast at 8:52:00 AM (0 comments)
Links to this post
Permalink
Thursday, October 27, 2005
My Own Virtual World

I actually intended on writing a small paragraph on Microsoft Excel’s conditional formatting that hopefully I’ll get to at some other time. The reason for the shift is due to today being one of the more exciting days I’ve had in a while. I’m not sure how many others can appreciate why, but here goes:: I received the much anticipated copy of Microsoft Virtual PC 2004.

I tried explaining my outwardly expressive excitement to a relative and their direct response, ‘You’re a nerd!’ I am not certain how I should have taken that, but being a bit defensive; I went ahead and denied it profusely. Should I have a bit of resentment towards that comment?

Immediately following my repudiation, I continue along like I was a kid in a candy store. For those that aren’t fully aware of what this program does, it basically, allows you to run many virtual machines simultaneously on one desktop. Not only are these acting as separate machines, but they’re in there own (separate) space and have their own (separate) operating systems and applications installed. Note: It doesn’t come with anything other than the Virtual PC software so you’ll need to make sure you have your own legitimate copies of the operating systems that you intend to install. This would also hold true for any of the applications you install on the Virtual PC as well. I’d read the licensing carefully. I am a firm believer that an author’s license agreement should be honored.

Another thing [with this software] that caused my great excitement is that each Virtual PC is contained within one individual file on the host machine. Tell me that this isn’t sweet. Just think of all the potential things this could mean. You can easily backup the file and have ‘virtually’ a complete system backup. Each file is virtually its own machine, so you could set up the host bare bones and use one of the virtual machines as your main system. In the event of a host failure you could quickly get the Virtual Machine running of a different host. Provided you have the proper backup of course. This results in a quasi-disaster recovery plan. This also allows for a nice avenue to go in and test some tweaks and setting changes here and there and then simply replace a file to get you back to square one. There is an undo disk option that I haven’t played with that claims allow for reverting back to a previous state.

The added bonus is application testing with different operating systems. The testing of applications at various levels of patching and service packs on these systems before rollout is simplified 10,000 fold. Did I mention each Virtual Machine is in one file? Think of how quickly you can replace a tragically altered Virtual Machine. Gone are the days of separate machine(s) for pre-deployment testing. A robust production machine can quickly test a wide range of scenarios with far less space and equipment minimizing down time.

Each machine is customizable to the extent of memory and system resources. From my experience thus far it has access to most all of the host system’s hardware resources. You can even specify which NIC a Virtual Machine will use (if you have more than one or if at all).

If it is any indication of my level of excitement is that I dug into the treasure archive and set up a Virtual Machine with my old MS-DOS 6.22 disks. I haven’t touched a floppy in years, but figured it’d be a nice ‘to have around’ setup. I even found some DOS 6.0 and Windows 3.1 disks. Those will get setup as well. Why install them? Who knows, but they all will reside in their own files. The file sizes don’t seem to be bulky at all, in fact it seems to be the opposite it is not a 1:1 relationship. I did also go through the motions wiith Windows 98SE, Windows XP Home and Windows 2000 Pro Virtual Machine and they all initially seem to work well.

Next up at bat is Fedora with Open Office…… a nice slow transition……

Labels: , ,

posted by Brad Prendergast at 10:19:00 PM (0 comments)
Links to this post
Permalink
Tuesday, October 25, 2005
What’s the count anyway?

There are so many documents and pieces of information that someone deals with on a given day. I actually did stop to think about it, and I was amazed at the amount of information that I pass through on daily basis. Fortunately, >95% of my interactions consist of electronic information.
For some strange statistical reason, I recently wanted to know the number of characters that were contained within a set of text files. These files were basic text documents, that could be viewed with any text-editor. I guess, that was the easy part. Getting the count, well, I couldn’t picture anything better than spending an afternoon with