Networking Visual FoxPro Database by Brute Force

There are variety of ways in networking databases in Visual FoxPro and today we will learn how to do it by brute force...Hopefully...

Preliminaries...

1. Ensure that you have a functional Local Area Network. For instance, if you want your PHONE DIRECTORY SYSTEM in StationA to be accessed in StationB, the first thing that you need to do is to start command prompt and ping StationB. Once you receive four packets response then both computers have working network connections. Additionally, make sure that both computers have file and printer sharing enabled.

2. Once network connection testing is complete and successful,you should now prepare your PHONE DIRECTORY SYSTEM for networked environment. Alter your source code and make sure that you have included the SHARED alias in your USE TABLE_NAME command. For instance, if your primary table is TFOXPHONEDIR, modify USE TFOXPHONEDIR to USE TFOXPHONEDIR SHARED. This will enable your table to be manipulated in a networked-based environment. Don't forget to save changes.

Almost there...

3. Next, create a program superlauncher for the first form of your PHONE DIRECTORY SYSTEM. To do this, press CTRL + F2 then type MODI COMM SUPERLAUNCHER in the command window. This command performs two things. It creates a Visual FoxPro program named superlauncher.prg and it displays the Visual FoxPro editor. Type the following in the FoxPro editor textarea:

DO FORM FIRSTFORMNAME

Don't forget to replace FIRSTFORMNAME with the actual firstname of your first form. For example if the filename of your first form is LOGINFORM.SCX, replace DO FORM FIRSTFORM with DO FORM LOGINFORM. CLick close to save changes.

4. Now, share the Microsoft Visual Studio Folder. This will enable your system to be available to all clients in the network, assuming that all your forms and databases are located inside the Visual Studio directory.

The finale...

5. To access your PHONE DIRECTORY SYSTEM in StationB or in any workstations in the network, browse your network places and locate your shared Microsoft Visual Studio folder. Look for your superlauncher.prg then double-click it.

6. In similar manner, double-click superlauncher.prg in StationA.You should now have phone directory systems activated in separate computers at the same time.

7. Though you are using the same form, it can perform independent actions in each workstations. To test your system, perform a record search in StationA, while one of your pals edits a record in StationB. Notice how it worked perfectly as mentioned. And that's all, a simple database networking  by brute force in VFP just for you.

Multiple Starting Values, Ending Values and Step Values in Looping Constructs for Structured Programming Languages

For starters, loop is a repetition structure that enables your program to execute the same statement(s) over and over and over and over and over again.There are several looping constructs that can be used for structured languages such as for, while,do-while,while-until and do-until. It's just so sad that most books showed us to use those statements by using only a single starting value,an ending value, and counter which made us conclude that it isn't possible to use compound loop elements.But did you know that you can use several initializations,loop conditions, and starting values in any looping constructs? You heard me right my friend. Here's how.
Syntax:

startingvalue1;
startingvalue2;
startingvaluen;
while((endingvalue1)&&(endingvalue2)&&(endingvaluen))
{
statement1;
statement2;
statementn;
stepvalue1;
stepvalue2;
stepvaluen;
}
For the sake of example I will be using while statement in PHP.

Example:
<?php
$intcount1=1;
$intcount2=10;
$intcount3=21;
while(($incount1<=10)&&($intcout2>=1)&&($intcount3<=30))
{
echo "$intnum1 $intnum2 $intnum3 
";
$intcount1++;
$intcount2--;
$intcount3++;
}
?>
The script above produces the following outputs:

1 10 21
2 9 22
3 8 23
4 7 24
5 6 25
6 5 26
7 4 27
8 3 28
9 2 29
10 1 30

You can use this as a good alternative for nested loops. Or if you wanted to hit several birds in one stone, that is, several outputs in one looping statement.