Custom Search

24 May 2008

Writing a more meaningful program

A simple spelling corrector

In this tutorial, we will build a more extensive program that performs very very simple spelling correction on a text file. It illustrates a number of important features of Delphi, and some of the power of the Delphi Run Time Library.

Our program asks the user to load a text file by pressing a 'Load file' button on the main program form. When the user has selected a file from the file selection dialog that appears, the contents are displayed in a TMemo box on the form, and a ghosted button - 'Correct' - is then enabled. The file line count is shown.

Pressing 'Correct' will correct mis-spellings of the word 'the' (something the author is often guilty of). Stats about the changes will be shown. When done, the 'Save file' button is enabled, allowing the file to be saved.

More than one file can be loaded in a session, and none have to be saved (no warnings are given when saving or when failing to save).

Designing the form

It is important when writing programs (applications) to design for ease of use by the user, and not ease of use for you, the coder. This is actually a very difficult thing to do, but it will vastly improve the acceptance of your program. The traditional, and still sensible approach is to design the external appearance and actions of your program, and then work down to code from there. Fortunately, Delphi, like other object oriented programs makes the transition easy.



In the screen shot above, our form is shown built with 1 Memo box (TMemo), 4 labels (TLabel), and 3 buttons (TButton). The Memo box will be used to show the file text. The red arrows show where under the Standard graphical item tab to select these 'widgets' (a term used to describe a graphical control item). You click on the widget you want, and then drag its size on the form. The final label is shown with the drag corners.


Notice that each widget has a name shown on it. For the Memo box, this is the initial contents that will be shown (our code will reset this to blank). For the labels and buttons, these are called the 'captions'.

The first thing we will do is to change the button captions. Click on Button1, and you will see its attributes in the Object Inspector window. Change the caption from 'Button1' to 'Load file'. Likewise change the Button2 caption to 'Save file' and Button3 to 'Correct'.

As well as changing captions, we will change the names from the default values Delphi used to something more useful. Memo1 becomes MemoBox. And the buttons are now named LoadButton, SaveButton and CorrectButton. The labels can stay as they are

Our form is now designed!

Linking code to the form

Object oriented programming revolves around objects and how they interact together. We have form, memo box, label and button objects. If we double click on any of them, Delphi will create code for the clicked widget. When you run the program, clicking the widget will run the code. As simple as that (except that you can do a whole lot more - see the Events tab of the Object Inspector. When you have added an action, a link to your code will appear there).

Acting upon form creation

So we will first double click on an empty part of the form. This will create the following code in your program unit, and position your cursor within it:

procedure TForm1.FormCreate(Sender: TObject);
begin

end;


This code, as its name implies, will be executed when your form is created (do not worry in this tutorial about the Sender parameter). This is very useful. It is effectively the start of your application. More importantly, it is the earliest part of your application when you can access the widgets on the form. We need this access because we will be working with them - initialising them, as in the code here:


procedure TForm1.FormCreate(Sender: TObject);
begin
// Set the title of the form - our application title
Form1.Caption := 'Very simple spell corrector';

// Disable all except the load file button
SaveButton.Enabled := false;
CorrectButton.Enabled := false;

// Clear the file display box
MemoBox.Clear;

// Enable scroll bars for this memo box - this allows us to scroll up
// and down and left and right to see all the text
MemoBox.ScrollBars := ssBoth;

// do not allow the user to directly type into the displayed file text
MemoBox.ReadOnly := true;

// Set the font of the memo box to a mono-spaced one to ease reading
MemoBox.Font.Name := 'Courier New';

// Set all of the labels to blank
Label1.Caption := '';
Label2.Caption := '';
Label3.Caption := '';
Label4.Caption := '';

// Create the open dialog object - used by the GetTextFile routine
openDialog := TOpenDialog.Create(self);

// Ask for only files that exist
openDialog.Options := [ofFileMustExist];

// Ask only for text files
openDialog.Filter := 'Text files*.txt';

// Create the string list object that holds the file contents
fileData := TStringList.Create;
end;


For now, do not worry about the openDialog statements. They'll be covered below.

The last thing we have done is to create a string list (click on it in the code above to learn more). fileData refers to a TStringList variable we have defined earlier (before the implementation section of the unit):

var
// Global definitions in our unit
Form1: TForm1;
fileName : String;
fileData : TStringList;
openDialog : TOpenDialog;


A string list is literally that - an object variable that can hold a variable number of strings. We will be using this to hold the contents of our text file. Before we can do that, we must create (instantiate) a TStringList object. This creation process allocates storage for the object and initialises it internally. It is defined as global so that all of the widget action code can work with it. Be careful with global data - you should keep it to a minimum.

So when our program now starts, the form is cleared of extraneous labelling, and other bits and pieces are set in place, such as scroll bars for the memo box (note that you can do this at the form design stage - take a look at the properties for the memo box).

Acting upon 'Load file' button clicking

Double click the 'Load file' button and more code will be inserted into your unit:
procedure TForm1.LoadButtonClick(Sender: TObject);
begin

end;

We want to load up a user selected file. So we need to let the user select using a file selection dialog:






procedure TForm1.LoadButtonClick(Sender: TObject);
begin
// Display the file selection dialog
if openDialog.Execute then // Did the user select a file?
begin
...




Now we can see that we have used the openDialog defined in the global variable section, and as initialised in the form creation routine. Let's look again at that initialisation:







// Create the open dialog object - used by the GetTextFile routine
openDialog := TOpenDialog.Create(self);

// Ask for only files that exist
openDialog.Options := [ofFileMustExist];

// Ask only for text files
openDialog.Filter := 'Text files*.txt';





The file selection (open) dialog object must first be created. It can then be used as many times as we wish. We then configure the dialog to display only existing text files. Click on the TOpenDialog keyword above to learn more.

Returning to the LoadButton code, we now load the file specified by the user:









if openDialog.Execute then // Did the user select a file?
begin
// Save the file name
fileName := openDialog.FileName;

// Now that we have a file loaded, enable the text correction button
CorrectButton.Enabled := true;

// Load the file into our string list
fileData.LoadFromFile(fileName);
end;





We save the name of the file (which includes its full path) so that we can save to it later. We enable the correct text button, and then do the elegant bit - load the file into a string list (the one we defined earlier) using just one statement! We can now access any line of the file by index number!




Finally we do the following:






// Display the file in the file display box
MemoBox.Text := fileData.Text;

// Clear the changed lines information
Label1.Caption := '';
Label2.Caption := '';
Label3.Caption := '';

// Display the number of lines in the file
Label4.Caption := fileName+' has '+IntToStr(fileData.Count)+
' lines of text';





we display this complete file in another very elegant statement - fileData.Text converts the string list into one big string which is then written to the memo box for display.




We clear the labels except the fourth. Here we use another feature of the TStringList class - the Count property. It gives the count of lines in the loaded file.




Acting upon the 'Correct' button clicking


Before we look at the Correct Button code, let us look at a new data type, an enumerated type, introduced in this unit:









type
TheMisSpelled = (TEH, ETH, EHT); // Enumeration of 'the' miss-spellings





This defines the 3 mis-spellings of the word 'the' that our code will correct in loaded files. See the Sets and enumerations tutorial for more on enumerations. Here we limit our spell corrector to a tiny range of correction values, as enumerated here. These values, TEH, ETH and EHT are simply placeholders. We use strings to do the checking and corrections.




Double click on the 'Correct' button, and enter the following code:






procedure TForm1.CorrectButtonClick(Sender: TObject);
var
text : String;
line : Integer;
changeCounts : array[TEH..EHT] of Integer;

begin
// Set the changed line counts
changeCounts[TEH] := 0;
changeCounts[ETH] := 0;
changeCounts[EHT] := 0;

// Process each line of the file one at a time
for line := 0 to fileData.Count-1 do
begin
// Store the current line in a single variable
text := fileData[line];

// Change the 3 chosen basic ways of mis-spelling 'the'
if ChangeText(text, TEH) then Inc(changeCounts[TEH]);
if ChangeText(text, ETH) then Inc(changeCounts[ETH]);
if ChangeText(text, EHT) then Inc(changeCounts[EHT]);

// And store this padded string back into the string list
fileData[line] := text;
end;

// And redisplay the file
MemoBox.Text := fileData.Text;

// Display the changed line totals
if changeCounts[TEH] = 1
then Label1.Caption := 'Teh/teh changed on 1 line'
else Label1.Caption := 'Teh/teh changed on '+
IntToStr(changeCounts[TEH])+' lines';

if changeCounts[ETH] = 1
then Label2.Caption := 'eth changed on 1 line'
else Label2.Caption := 'eth changed on '+
IntToStr(changeCounts[ETH])+' lines';

if changeCounts[EHT] = 1
then Label3.Caption := 'eht changed on 1 line'
else Label3.Caption := 'eht changed on '+
IntToStr(changeCounts[EHT])+' lines';

// Finally, indicate that the file is now eligible for saving
SaveButton.Enabled := true;

// And that no more corrections are necessary
CorrectButton.Enabled := false;
end;





As we make changes, we keep count of the changed lines in the changeCounts array. Notice that it has bounds defined by the enumeration type we defined. We call a new routine ChangeText to do the changes on every string in the string list (the for loop indexes the string list from the first string (index 0) to the last (one less than the number of strings)). We increment counts if the called routine says that it made changes (it returns a Boolean value). Here is that routine:









function TForm1.ChangeText(var Text: String; theType: TheMisSpelled): Boolean;
var
changed : Boolean;
begin
// Indicate no changes yet
changed := false;

// First see if the string contains the desired string
case theType of
TEH :
if AnsiContainsStr(Text, 'teh') or AnsiContainsStr(Text, 'Teh') then
begin
Text := AnsiReplaceStr(Text, 'teh', 'the'); // Starts lower case
Text := AnsiReplaceStr(Text, 'Teh', 'The'); // Starts upper case
changed := true;
end;
ETH :
if AnsiContainsStr(Text, 'eth') then
begin
Text := AnsiReplaceStr(Text, 'eth', 'the'); // Lower case only
changed := true;
end;
EHT :
if AnsiContainsStr(Text, 'eht') then
begin
Text := AnsiReplaceStr(Text, 'eht', 'the'); // Lower case only
changed := true;
end;
end;

// Return the changed status
Result := changed;
end;





Click on any blue keywords to learn more. The routine is called 3 times per line - each time it is passed one of the mis-spelling enumeration types. The Case statement routes to the right code to perform according to the type. We set the returned value - Result - to true if we have changed the line. Notice that the Ansi commands are case sensitive.




Returning to the LoadButton code above, the last things we do are to redisplay the changed string list in the memo box and display changed line stats. We also disable the CorrectButton and enable the SaveButton.




Phew!




Acting on the 'Save file' button clicking


Finally, double clicking the save button allows us to write code to save the now changed file:









procedure TForm1.SaveButtonClick(Sender: TObject);
begin
// Simply save the contents of the file string list
if fileName <> '' then
fileData.SaveToFile(fileName);

// And disable the file save button
SaveButton.Enabled := false;
end;





This is a lot simpler - if we have a valid file name (this is a double check that we have something to save), then we use the string list SaveToFile method. Easy! Then we disable the save button.





Putting it all together


Below is the full code, along with a sample before and after text file contents :









// Full Unit code.
// -----------------------------------------------------------

unit Unit1;

interface

uses
SysUtils, StrUtils,
Forms, Dialogs, Classes, Controls, StdCtrls;

type
TheMisSpelled = (TEH, ETH, EHT); // Enumeration of 'the' mis-spellings
TForm1 = class(TForm)
// Visual objects inserted by Delphi
LoadButton : TButton;
SaveButton : TButton;
CorrectButton : TButton;
MemoBox : TMemo;
Label1 : TLabel;
Label2 : TLabel;
Label3 : TLabel;
Label4 : TLabel;

// Methods added by Delphi
procedure LoadButtonClick(Sender: TObject);
procedure SaveButtonClick(Sender: TObject);
procedure CorrectButtonClick(Sender: TObject);

private
// Method added by the author
function ChangeText(var Text : String; theType : TheMisSpelled) : Boolean;

published
// Constructor added by Delphi
procedure FormCreate(Sender: TObject);
end;

var
// Global definitions in our unit
Form1: TForm1;
fileName : String;
fileData : TStringList;
openDialog : TOpenDialog;

implementation
{$R *.dfm} // Include form definitions


// Procedure called when the main program Form is created
procedure TForm1.FormCreate(Sender: TObject);
begin
// Set the title of the form - our application title
Form1.Caption := 'Very simple spell corrector';

// Disable all except the load file button
SaveButton.Enabled := false;
CorrectButton.Enabled := false;

// Clear the file display box
MemoBox.Clear;

// Enable scroll bars for this memo box
MemoBox.ScrollBars := ssBoth;

// do not allow the user to directly type into the displayed file text
MemoBox.ReadOnly := true;

// Set the font of the memo box to a mono-spaced one to ease reading
MemoBox.Font.Name := 'Courier New';

// Set all of the labels to blank
Label1.Caption := '';
Label2.Caption := '';
Label3.Caption := '';
Label4.Caption := '';

// Create the open dialog object - used by the GetTextFile routine
openDialog := TOpenDialog.Create(self);

// Ask for only files that exist
openDialog.Options := [ofFileMustExist];

// Ask only for text files
openDialog.Filter := 'Text files*.txt';

// Create the string list object that holds the file contents
fileData := TStringList.Create;
end;


// Procedure called when the file load button is pressed
procedure TForm1.LoadButtonClick(Sender: TObject);
begin
// Display the file selection dialog
if openDialog.Execute then // Did the user select a file?
begin
// Save the file name
fileName := openDialog.FileName;

// Now that we have a file loaded, enable the text correction button
CorrectButton.Enabled := true;

// Load the file into our string list
fileData.LoadFromFile(fileName);
end;

// And display the file in the file display box
MemoBox.Text := fileData.Text;

// Clear the changed lines information
Label1.Caption := '';
Label2.Caption := '';
Label3.Caption := '';

// Display the number of lines in the file
Label4.Caption := fileName+' has '+IntToStr(fileData.Count)+' lines of text';
end;


// Procedure called when the file save button is pressed
procedure TForm1.SaveButtonClick(Sender: TObject);
begin
// Simply save the contents of the file string list
if fileName <> '' then
fileData.SaveToFile(fileName);

// And disable the file save button
SaveButton.Enabled := false;
end;


// Procedure called when the correct text button is pressed
procedure TForm1.CorrectButtonClick(Sender: TObject);
var
text : String;
line : Integer;
changeCounts : array[TEH..EHT] of Integer;
begin
// Set the changed line counts
changeCounts[TEH] := 0;
changeCounts[ETH] := 0;
changeCounts[EHT] := 0;

// Process each line of the file one at a time
for line := 0 to fileData.Count-1 do
begin
// Store the current line in a single variable
text := fileData[line];

// Change the 3 chosen basic ways of mis-spelling 'the'
if ChangeText(text, TEH) then Inc(changeCounts[TEH]);
if ChangeText(text, ETH) then Inc(changeCounts[ETH]);
if ChangeText(text, EHT) then Inc(changeCounts[EHT]);

// And store this padded string back into the string list
fileData[line] := text;
end;

// And redisplay the file
MemoBox.Text := fileData.Text;

// Display the changed line totals
if changeCounts[TEH] = 1
then Label1.Caption := 'Teh/teh changed on 1 line'
else Label1.Caption := 'Teh/teh changed on '+
IntToStr(changeCounts[TEH])+' lines';

if changeCounts[ETH] = 1
then Label2.Caption := 'eth changed on 1 line'
else Label2.Caption := 'eth changed on '+
IntToStr(changeCounts[ETH])+' lines';

if changeCounts[EHT] = 1
then Label3.Caption := 'eht changed on 1 line'
else Label3.Caption := 'eht changed on '+
IntToStr(changeCounts[EHT])+' lines';

// Finally, indicate that the file is now eligible for saving
SaveButton.Enabled := true;

// And that no more corrections are necessary
CorrectButton.Enabled := false;
end;


// Function to change a type of 'the' mis-spelling in a string
// Returns true if the string was changed
function TForm1.ChangeText(var Text: String; theType: TheMisSpelled): Boolean;
var
changed : Boolean;
begin
// Indicate no changes yet
changed := false;

// First see if the string contains the desired string
case theType of
TEH :
if AnsiContainsStr(Text, 'teh') or AnsiContainsStr(Text, 'Teh') then
begin
Text := AnsiReplaceStr(Text, 'teh', 'the'); // Starts lower case
Text := AnsiReplaceStr(Text, 'Teh', 'The'); // Starts upper case
changed := true;
end;
ETH :
if AnsiContainsStr(Text, 'eth') then
begin
Text := AnsiReplaceStr(Text, 'eth', 'the'); // Lower case only
changed := true;
end;
EHT :
if AnsiContainsStr(Text, 'eht') then
begin
Text := AnsiReplaceStr(Text, 'eht', 'the'); // Lower case only
changed := true;
end;
end;

// Return the changed status
Result := changed;
end;

end.





The displayed file before correction







Teh cat sat on eth mat
The cat did not sit on eth mat or teh floor

Teh teh teh eth eth eht eht
Final line of 5.





The displayed file after correction


The cat sat on the mat
The cat did not sit on the mat or the floor

The the the the the the the
Final line of 5.





The displayed statistics




Teh/teh changed on 5 lines
eth changed on 4 lines
eht changed on 2 lines
The file has 5 lines

Writing your first Delphi program

Different types of application
Delphi allows you to create GUI (Graphical User Interface) or Console (text-only) applications (programs) along with many other types. We will concern ourselves here with the common, modern, GUI application.

Delphi does a lot of work for us - the programmer simply uses the mouse to click, drag, size and position graphical parts to build each screen of the application.

Each part (or element) can be passive (displaying text or graphics), or active (responding to a user mouse or keyboard action).

This is best illustrated with a very simple program.

Creating a simple 'Hello World' program
When you first run Delphi, it will prepare on screen a new graphical application. This comprises a number of windows, including the menu bar, a code editor, and the first screen (form) of our program. Do not worry about the editor window at the moment.

The form should look something like this :









We have shown the form reduced in size for convenience here, but you will find it larger on your computer. It is a blank form, onto which we can add various controls and information. The menu window has a row of graphical items that you can add to the form. They are in tabbed groups : Standard, Additional, Win32 and so on.

We will select the simplest from the Standard collection. Click on the A image to select a Label. This A will then show as selected:






Having selected a graphical element, we then mark out on the form where we want to place the element. This is done by clicking and dragging. This gives us our first form element:












Changing graphical element properties
Notice that the graphical element contains the text Label1 as well as resize corners. The text is called the Caption, and will appear when we run the application. This Caption is called a Property of the button. The label has many other properties such as height and width, but for now, we are only concerned with the caption.

Let us blank out the caption. We do this in the window called the Object Inspector (available under the View menu item if not already present):













Adding an active screen element














If we now return to the Standard graphical element collection, and select a button, shown as a very small button with OK on it, we can add this to the form as well:

We now have a label and a button on the form. But the button will do nothing when pressed until we tell Delphi what we want it to do.

So we must set an action, called an Event, for the button. The main event for a button is a Click. This can be activated simply by double clicking the button on the form.

This will automatically add an event called OnClick for the button, and add a related event handler in the program code:




This 'skeleton' code will not do anything as it stands. We must add some code. Code that we add will run when the button is clicked. So let us change the label caption when the button is pressed.
As we type, Delphi helps us with a list of possible options for the item we are working on. In our instance, we are setting a Label caption:



Here you see that Delphi has listed all appropriate actions that start with ca. If we press Enter, Delphi will complete the currently selected item in the list. We assign a text value 'Hello World' to the caption property. Note that we terminate this line of code with a ; - all Delphi code statements end with this indicator. It allows us to write a command spread across multiple lines - telling Delphi when we have finished the command.



And we have now finished our very simple action - we will set the label to 'Hello World' when the button is pressed.

Running our first program
To run the program, we can click on the Green triangle (like a Video play button), or press F9. When the program runs it looks like this:



When we click on the button, we get:



and our program has set the Label text as we requested.

Note that the program is still running. We can click as many times as we like with the same outcome. Only when we close the program by clicking on the top right X will it terminate.

Looking at the code that Delphi generated
Whilst we have only typed one line of code, Delphi has typed many for us. Let us first look at the main program code. Notice that we have added comments (in green, starting with the // comment identifier). These are ignored by the Delphi compiler, but help the coder understand the code. You can click on any word marked in blue to see reference information for that word:

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;

type
TForm1 = class(TForm)
Label1: TLabel; // The label we have added
Button1: TButton; // The button we have added
procedure Button1Click(Sender: TObject);

private
{ private declarations }

public
{ public declarations }

end;

var
Form1: TForm1;

implementation

{$R *.dfm}

// The button action we have added

procedure TForm1.Button1Click(Sender: TObject);
begin Label1.Caption := 'Hello World'; // Label changed when button pressed
end;
end.

This code is called a Unit and is a Delphi module - one chunk of code. If you save this code, it will save in a file called Unit1.pas - a Pascal file.

The unit comprises two main parts - the interface section, which tells what the unit does. And an implementation section that holds the code that implements the interface. Click on the unit keyword in the code to learn more.

Learning more ...
If you want to learn more, then try the following:

1.Right click on the form, and select the View as text item from the drop down list. This will show the form, label and button properties.

2.View the main program file by selecting menu item Project/View source. This will show the code that Delphi generated to kick start your program. It includes a reference to Unit1.pas and your form, and starts your program running.

Mp3 Downloads

MP3 Music Downloads - Buy MP3 Music Online - Digital Music Downloads
MP3 Music Downloads - MP3.com offers links to legal digital music downloads from a wide variety of services. Buy MP3 music online from your favorite artists ...www.mp3.com/ - 90k -

Portable MP3 Players - MP3 Player Reviews - Best MP3 Players
Portable MP3 Players - MP3.com offers MP3 player reviews of the best MP3 players available.www.mp3.com/hardware.php - 48k -

Download MP3 Free Download Lagu Indonesia ...
Petunjuk mendownload MP3 lagu-lagu Indonesia terbaru.downloadlaguindonesia.net/ - 12k -

Free Music Code Indo FS Song codes Download Embed Player Mp3 ...
Streaming online mp3 musik indonesia,Musik kode fs untuk media box musik friendster, widget MP3 Player, music box myspace, Dengar musik multiply.com, hi5, ...www.musik-live.net/ - 50k

MP3 - Wikipedia, the free encyclopedia
MPEG-1 Audio Layer 3, more commonly referred to as MP3, is a digital audio encoding format using a form of lossy data compression. ...en.wikipedia.org/wiki/MP3 - 92k -

MP3 Arena: Free Mp3 Downloads & Songs
download free mp3. free music. free music sites. free full albums ... Madonna Feat. Justin Ti.. - 4 Minutes [Album Version] mp3, 209232 ...www.mp3fusion.net/ - 36k -

Mp3 Music Download - MusicMp3.RU
Mp3 Music Download. MusicMp3.RU - cheap mp3 music archive.musicmp3.ru/ - 35k -

Free Download Mp3, lagu gratis, Black Box - Fall Into My Love ...
Stafa band indie band malang, Free Download mp3, download lagu gratis, download mp3 gratis,Black Box - Fall Into My Love (Remix), Paula Abdul & Randy ...stafaband.info/download-lagu-mp3-gratis.html - 77k

islam-download-free-gratis-indonesia mp3 video buku software
download software islamic program islamic ebook islamic islami islam free gratis buku e-book artikel quran sunnah hadits wallpaper audio video.islam-download.net/ - 24k -

detikinet: MP3 Bervirus Menyebar di Ratusan Ribu Komputer
Menurut vendor anti virus ternama McAfee, serangan masif program jahat dengan jalan memalsukan file musik MP3 dan juga video jenis MPEG baru saja ...www.detikinet.com/index.php/detik.read/tahun/2008/bulan/05/tgl/07/time/130551/idnews/935380/idkanal/323 - 19k

2 Killer eBook Marketing Tactics

2 Killer eBook Marketing Tactics

1) SELLING CREATES TRAFFIC

You probably know that by including your ad in a free ebook, then allowing others to give it away is a great way to spread your ad all over the internet. That worked good in the old days because hardly anyone knew about it, but now there are free ebooks almost everywhere. Because of this your free ebook ad has to be extremely persuasive and you must present it so people perceive it as valuable. I have a solution for this free ebook problem.

Write an entire ad for the ebook, as if you’re selling it, and actually set up an ordering option for your free ebook. You just give your prospects the option of getting it at no cost if they refer three of their friends, family members or associates to your web site. Another option would be to ask them to place your banner ad on their home page.
It’s very persuasive because they’ll get a product you’re selling for free, what a bargain! You could always sell it for an extra high price to increase it’s perceived value. So you’ll either make a huge profit or get a link on their home page.

2) CONCENTRATE ON THE TOP

Create an ebook full of tips relating to the theme of your web site. Type keywords into search engines that your web site would fall under. Contact the top twenty related web sites and ask them if they would like a tip ebook they can give away with their own ad place inside it. Just include your own ad inside it.

The web sites that agree to the deal will give you a lot of traffic. You can either put your promotional ad inside the ebook or have them link to your web page to give it away. Of course, on that particular web page would be your product ad. It’s a win/win situation.

About the Author

Larry Dotson Over 40,000 Free Business eBooks & More when you visit: http://www.ldpublishing.com As a bonus, Bob Osgoodby publishes the free weekly "Your Business" Newsletter - visit his web site to subscribe and place a FREE Ad! http://adv-marketing.com/business

"7 Secrets to Explode your eBook Sales!" Part 2

"7 Secrets to Explode your eBook Sales!" Part 2

Secret #2: Creating your Marketing Timeline for Success!

Aho!

You can increase your sales and free time by creatingyour own marketing timeline.
Marketing timelines are essential for all Internet businesses. They providenot only organization but a truly well defined goalsheet as well.

To understand your timeline is to understand your business. Can you really know where you are goingif you don't have a goal? I think not! Can youreally tell how well you are doing if you are notlogging your results? I think not again! Canyou really tell what your profit margin is at this moment and will be next month at this timewithout tracking your sales, goals and future plans?

Well I think you know my answer by now.

There is tons of internet marketing "How To" infiramtion online. However have you noticed veryfew people teach you how to organize your information?Well, now you will know.

My marketing timelines include: goals present andfuture, Action plans for today and tomorrow as wellas next month, and last but definitely not least you have a sales tracker as well.

Ok. Now take out a sheet of paper, and for computerlovers, open up your word processing program.

Let's begin with our goal sheet.

On top of the page in BIG letters type: Goal Sheet - Short Term

Now grab another piece of paper, or another page, and on the top of that one in BIG letters type: Goals - Long Term

Next page write in BIG letters: Action Steps - Short term And another page in BIG letters: Action Steps - Long termOne last page in BIG letters write: SALES

Now you have the foundation you need to begin reallyunderstanding your ebusiness as it grows and matures.

Grab a file folder, or on the computer, make a file folder that says: "Marketing Timeline." This folder will hold all your files.

Page one: Short term Goals: Make 3 columns.
Column 1: Date
Column 2: Goal
Column 3: Date completed Goal

Page two: Goals - Long Term: Make 3 columns.
Column 1: Date
Column 2: Goal Column
3: Date Completed Goal.

Page 3: Action Plans short term: Make 3 columns.
Column 1: Date.
Column 2: Action Steps.
Column 3: Date Completed Action Steps.

Page 4: Action Plans - Long term: Make 3 columns.
Column 1: Date.
Column 2: Action Steps.
Column 3: Date Completed Action Step.

Page 5: Sales tracking - Make 3 columns:
Column 1: date
Column 2: Sales
Column 3: Continuing Total.

I can hear a lot of you out there groaning, "there must be a way to automate this!" and yesthere is! However, I want you to do it manuallywhen you first start your ebusiness. I have found thatthis will not only show you how you are doing and whereyou are and what has to be done to get to where youwant to go. It also helps to seat all the informationin your unconscious brain. Walla! Automating the Brain!

Really, I am serious. By doing this manually you willlearn a lot more in the beginning and not have to learnit as you go along. For those of you that can't wait to automate, I have included links to a lot of automated services and software in my eBook: "eBook Marketing Secrets Revealed."

Have a great week!

Blessings Bluedolphin Crow
Copyright 2004 Bluedolphin Crow - All Rights Reserved.

"7 Secrets to Explode your eBook Sales!" Part 1

"7 Secrets to Explode your eBook Sales!" Part 1

Secret #1: How to write an incredible eBook!

I shouldn't be telling you this:

One of the biggest problems that most eBook writers andsellers face is generating eBook sales. It seems likethe Internet is full of "ideas" - however, these"ideas" don't seem to be producing results. Three reasons come to mind:

Reason # 1: eBooks are not marketed effectively.

Reason # 2: eBook sales pages either do not exist, orthey do not capture the buyers interest.

Reason # 3: The eBook is not written and/or organizedwell.

So many of us hear about the big boom in eBook sales.
Most of us have read articles and/or eBooks teachingus that we should have our own product out there tobe successful.
Well all of that is true. However, where the "ideas"fall short of producing results is in all threereasons listed above.
That is the reason I am writing this 7 part articleseries for you. In it you will learn how to correctall three reasons above and much more!Look at what you'll be learning:

Secret #1: How to write an incredible eBook!

Secret #2: Creating your marketing timeline for longterm success!

Secret #3: How to create an avalanche of sales withfreeware/shareware sites!

Secret #4: Creating passionate articles will explodeyour sales!

Secret #5: How to build steady sales for years tocome with eBook Directories!

Secret #6: Creating momentum and identity throughBook Sellers!

Secret #7: How to create a mountain of sales usingmultiple Royalty Publishers!Ok, now there is no time like the present.

So letsbegin:

Secret #1: How to write an incredible eBook!Why is it essential to you're marketing successto write an incredible eBook?

Gone are the days of taking marketing informationand regurgitating it in a different manner. Thenpublishing it as an eBook and moving on.
Today people on the web want information. However they are looking for NEW information. New ways of doing things. Not the same old, same old, wrapped in a new cover.

So, with this in mind how do you write an incredible eBook you might be wondering?
Let me first assure you it is not as difficultas you might first suspect.

First, lets set into place the basic foundationsteps for your eBook.

Answer the questions in the following steps.

Step 1: What is the main focus of your eBook.In other words, what do you want the readerto take away after reading your eBook?

Step 2: What kind of research do you need to do?

Step 3: What is the order you have to divide yourinformation into?Now, as you answer the above questions openly andhonestly you will build the foundation of your eBook upon which you can build a successfulmarketing blueprint.Great! Now it is time for you to begin the basicplan for your eBook.

Step 4: Write a mission statement of why you arewriting this eBook.

Step 5: Write out what makes your eBook differentfrom all the rest. For example do you have exclusiveinformation, an original format, and/or an exclusiveoffer?Great! Now you're on a roll. Let's begin the finalphase of planning your eBook.

Step 6: Using all the information above and yourresearch, write out a table of contents.

Step 7: Now rewrite the table of contents into hotselling sentences.

For example: instead of Chapter 1: How to increase your eBook sales. Use: 7 Secrets to explode your eBook sales!

Step 8: Write your eBook introduction.

Step 9: Write the forward to your eBook.

Step 10: Write out the closing statement to your eBook.

Step 11: Create a plan of action to finish writing youreBook. Take at least one plan of action step a day!

Step 12: Reread your eBook and correct grammar, punctuation and typographical errors. Try to have atleast one