You are currently browsing the archives for the Code and Solutions category.

Securing your online backup archives

May 12th, 2010

Bookmark and Share
One of the concerns of many people who consider performing online backups is the matter of security. You are uploading sensitive stuff to a foreign site. Can anyone from within read this stuff? And what if the site is hacked and white collar thieves living in some foreign country get hold of the data? What would happen?

One solution is to protect each and every document using a password. Many programs have such a capability built in.  For many one, two or three person organisations this solution could work; the people would password protect every file using a phrase that is shared amongst colleagues. As the number of employees increase, guaranteeing that everyone is obeying the rules makes this solution one that is too problematic. Besides certain file types cannot be password protected.

The script I am sharing is one that addresses this problem. It makes use of the commercial product WinRar to archive an entire directory (including subdirectories) into a RAR file. The RAR file name is user definable and is placed in a folder under C:\RSB. The RAR archive is password protected using a password passed to the script. The script is called rsb.cmd.

Custom Search

Read more »

Backing up, Restoring and Tweaking Sage Pastel Evolution

April 5th, 2010

Sage Pastel Evolution-001 Sage Pastel Evolution is an Accounting / Stock / Point of Sale program for medium to large sized companies. The program can support a large number of concurrent users and an unlimited number of companies. It uses Microsoft SQL Server as its underlying database. Small setups (up to 10 users) can use Microsoft SQL Server Express with larger shops necessitating the use of the standard edition of SQL Server.

In order to backup Sage Pastel Evolution one needs to backup the Microsoft SQL Server database as well as the appropriate registry entries. In this article I will not discuss how to backup Microsoft SQL Server Express or Standard edition—email me on chribonn@gmail.com if you are interested in a write-up on how to backup these products.

The Windows Registry

A word of warning about handling the registry: unlike many programs, the registry program does not have an undo or an undelete option and changes go into effect immediately. If you delete a file by mistake you can pull it out of limbo by visiting the Recycle Bin. If you screw up a document, pressing undo will take you back one action at a time until you reach the stage before the oops or, if necessary, you can abandon all changes done during that session simply by not saving the updated document. None of this exists in the registry so be cautious.  Read more »

Custom Search

How to restore your Microsoft Office 2007 Outlook in its entirety (Windows XP, Windows Vista and Windows 7)

February 21st, 2010

In my entry titled “How to backup your Microsoft Office 2007 Outlook in its entirety (Windows XP, Windows Vista and Windows 7)” I described how to backup the Microsoft Outlook 2007 data file together with that part of the Windows registry that stores within it the email accounts from where Outlook retrieves emails or via which emails are sent out. Today I discuss how to use that backed up information to either recover a failed computer or to transfer the settings from one computer to another. The former may happen if the hard disk fails or as a result of a malware attack while the latter would apply if you are upgrading your computer or operating system.

RestoreOffice2007-1On your freshly formatted computer you need to install Microsoft Outlook. Accept all the defaults. After the installer completes, run Microsoft Outlook for the first time. You will be asked a number of questions. Enter anything that will allow you to proceed to the end of this process. Do not enter valid email account details because Outlook will attempt to download mail after you complete the process and since this is not the database you will be using, you do not want any messages to end up here (this can be fixed but why create a problem that will need fixing).

 

Read more »

How to backup your Microsoft Office 2007 Outlook in its entirety

January 27th, 2010

Many people use Microsoft Outlook to download mail from their POP3 or IMAP server. While some may only link their Outlook to one particular email, many today have multiple email accounts all pouring into the same data file. Backing up Microsoft Outlook consists essentially of backing up two different components; the pst file that stores messages (or in the case of IMAP a cached version of the server) together with the registry entry that stores all the different email accounts that are being processed by Outlook.

Backing up the data file

The folk who decided on the default location of the Outlook data file chose a location that is difficult to figure out.  Also when installing Outlook (or when running it for the first time) there is no way to specify a different folder.

Read more »

Rsync on Windows Platform

November 12th, 2009

Setup files

Addendum

Rsync – A Top-View Introduction (Flash Animations)

October 27th, 2009

The following are a couple of flash animations to demonstrate how online backups function. I’ll add more animations to cover different scenarios soon.

RSync: The first time a file is transfered

RSync: What happens when the source file changes.

Rsync – A Top-View Introduction

October 17th, 2009

Even with today’s ultra fast fibre optic data lines, the tangible throughput people actually get when transferring files is still functionally limited. This is compounded further by the fact that the majority of uses have low upload speeds compared to higher download speeds. For example a typical home internet connection would promise 4Mbit download while only 256Kbit would be allocated for upload. To make matters worse, today files are many times larger than their ancestors.  If your hair has greyed (or fallen off) in sufficient quantities, you probably recall a time when a 1.2MB floppy disk would hold all your documents as well as the word processing program itself with space to spare. This thousand word document is over 6 times larger than that floppy disk!

In this environment, when one discusses online backups, the critical issue is to try to limit as much as possible the amount of data that has to be uploaded from the person’s computer (the source) to that person’s archive vault (the destination).   Many people would consider online backups only if the lengthy wait periods are few and far between.

On a regularly backed up system, the state of the source compared to the destination can be as follows:

  • New file on source that does not exist on the destination – the file must be copied over to the archive vault;
  • File on source that no longer exists on the destination – the file must be removed from the archive vault;
  • File on source and destination are identical – no need to do anything;
  • File on source is different from that on destination.

On a system that is regularly backed up, one would normally find few files that are new or that have been deleted. The majority of files would either have not changed or would have been altered.  As I will demonstrate shortly, the Rsync algorithm for transferring data from source to destination is greatly suited for situations in which a file has been adjusted.  There are two ways a system can handle altered files, resending the adjusted files in its entirety or simply transferring the changed pieces. The Rsync algorithm does the latter.

The Rsync algorithm was developed by Andrew Tridgell and Paul Mackerras. Taking a data backup using the Rsync method results in ultra fast and efficient backups. Imagine a database, worksheet or word processing document in which the author only changed one record, cell or paragraph.  Take your PIM database; on a daily basis you receive new emails, delete junk and old mail, setup appointments and have the system remove expired ones.  Rsync backups will transmit a few megabytes of changes rather than let you wait until all modified files (that probably run into gigabytes) are uploaded.

The Rsync algorithm

Rsync – A Top-View Introduction1

The file on the archive server (the destination file that needs to be updated) is split into a number of blocks of equal size (the last block could be an exception). For each block a signature is generated.

Rsync – A Top-View Introduction2

The signature consists of a quick-to-compute 32 bit checksum (I’ll explain the rolling capability later on) as well as a 128 bit checksum. In Rsync, the MD5 (Message digest) algorithm is now being utilised.

The block number as well as the associated signatures for each block is transmitted to the source computer. The source computer takes the 32 bit low computational checksum of each block and generates a simple 16 bit hash value.

Simplistically speaking, the source end will transmit to the destination how to reconstruct the file using either literal data transmitted from the source to the destination or by telling the destination to utilise a block already present at its end.

 Rsync – A Top-View Introduction3

At the source, a block of identical size as those computed at the destination is analysed and the low overhead 32 bit checksum is generated. Its 16 bit hash is compared to those computed from the destination 32 bit checksums. If no match is found than the code that deals with a nonexistent block kicks in.

If the hashes match, the 128 bit checksum is computed on the source block and this is compared to the 128 bit blocks received from the destination that have the same hashing function (there may be more than one) as the source. If no match is found, the code that deals with a nonexistent block kicks in.

If a destination block is matched, the source sends an instruction to the destination to copy the block having a particular index to the new output file. The position at the source is advanced forward the length of the block and the process loops.

The logic behind the nonexistent block is as follows:

  1. It transmits the character at the beginning of the block to the destination to append to the file that is being reconstructed;
  2. Advances the block by one character and repeats the process.

 Rsync – A Top-View Introduction4

Point 2 explains where the rolling 32 bit algorithm comes into play. By having a rolling 32 bit algorithm, the computational overhead necessary to calculate the new CRC is minimised further since all that is necessary would be to subtract the value of the byte of the previous start of block and add the value of the byte at the new (shifted) end of block. The alternative would have to sum up the range again and this consumes more computing cycles.

The performance increase between a copy-all backup and one using Rsync can be more than 110 times. All data transmitted by Rsync is actually compressed and is encrypted using SSL. For online backups the Rsync method is the best way to guarantee that backups are fast, secure, and non-intrusive and actually get done.

In a future article I’ll give some practical examples to explain how Rsync deals with different file situations, namely adding new data at various positions within a file, deleting data from different positions within a file and altering data. For more in depth information on Rsync, you might want to visit the Rsync home page at http://Rsync.samba.org/ as well as spend a couple of evenings reading through Andrew Tridgell’s paper Efficient Algorithms for Sorting and Synchronization.