<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Blog@PeacockData &#187; Tutorials</title>
	<atom:link href="http://blog.peacockdata.com/category/tutorials/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.peacockdata.com</link>
	<description>It&#039;s the service AFTER the sale that counts!</description>
	<lastBuildDate>Mon, 21 Nov 2011 08:00:10 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Using the Windows Clipboard in FoxPro</title>
		<link>http://blog.peacockdata.com/2010/07/using-the-windows-clipboard-in-foxpro/</link>
		<comments>http://blog.peacockdata.com/2010/07/using-the-windows-clipboard-in-foxpro/#comments</comments>
		<pubDate>Mon, 26 Jul 2010 07:00:00 +0000</pubDate>
		<dc:creator>Peacock Data</dc:creator>
				<category><![CDATA[FoxPro]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://blog.peacockdata.com/2010/07/using-the-windows-clipboard-in-foxpro/</guid>
		<description><![CDATA[The Windows Clipboard in easily accessed in FoxPro and Visual FoxPro (VFP). There are currently two commands that directly relate to it. These are <strong>_CLIPTEXT</strong> to copy and paste text and <strong>DataToClip()</strong> to copy values from a table. Let us explore these two VFP commands further and provide some examples. . . .]]></description>
			<content:encoded><![CDATA[<p>The Windows Clipboard in easily accessed in FoxPro and Visual FoxPro (VFP). There are currently two commands that directly relate to it. These are <strong>_CLIPTEXT</strong> to copy and paste text and <strong>DataToClip()</strong> to copy values from a table. These are not highly sophisticated commands, but they are quick and straightforward and are often the simplest way to transfer data between applications.</p>
<p>Let us explore these two VFP commands further and provide some examples:</p>
<h6 class="moreSpace">_CLIPTEXT System Variable</h6>
<p>The _CLIPTEXT System Variable contains the content of the Windows Clipboard and can be engaged to write text to and read text from the Clipboard. This feature has been available since the earliest versions of FoxPro for Windows. The syntax is very simple:</p>
<pre class="codeSample"><span class="blueCode">_CLIPTEXT</span> = cExpression <span class="greenComments">&#038;&#038; writes cExpression to the Clipboard</span>

cExpression = <span class="blueCode">_CLIPTEXT</span> <span class="greenComments">&#038;&#038; stores the Clipboard content to cExpression</span></pre>
<p>One of the most common uses of _CLIPTEXT is during program development. Long SQL statements, commands and other strings generated by programs at runtime are often difficult to debug using VFP&rsquo;s standard tools. In the following code sample an SQL statement is copied to the Windows Clipboard so the developer can paste it into a wordprocessor or other application for additional analysis:</p>
<pre class="codeSample">cSQL = cFields + cSource +cFilter + cOrder + cOutput

<span class="blueCode">_CLIPTEXT</span> = cSQL

<span class="blueCode">SET STEP ON</span> <span class="greenComments">&#038;&#038; opens the Trace window and suspends the program</span></pre>
<h6 class="moreSpace">DataToClip Method</h6>
<p>DataToClip() copies a set of records to the Windows Clipboard. It is a method of the Application Object or the _VFP System Variable. The field names appear as the first line of the text copied to the Clipboard followed by a separate line for each record. This method has been available since VFP 5 and is only slightly more complicated:</p>
<p><strong>Syntax</strong></p>
<p><em>ApplicationObject</em>.DataToClip([<em>nWorkArea</em> | <em>cTableAlias</em>] [, <em>nRecords</em>] [, <em>nClipFormat</em>])</p>
<p><strong>Arguments</strong></p>
<dl class="vfpParamList">
<dt>nWorkArea</dt>
<dd>Specifies the work area number of the table for which records are copied to the Clipboard. If you omit <em>cTableAlias</em> and <em>nWorkArea</em>, records are copied to the Clipboard for the table open in the current work area.</dd>
<dt>cTableAlias</dt>
<dd>Specifies the alias of the table for which the records are copied to the Clipboard.</dd>
<dt>nRecords</dt>
<dd> Specifies the number of records copied to the Clipboard. If <em>nRecords</em> is greater than the number of remaining records in the table, all the remaining records are copied to the Clipboard. If <em>nRecords</em> and <em>nClipFormat</em> are omitted, the current record and all remaining records are copied to the Clipboard.</dd>
<dt>nClipFormat</dt>
<dd>Specifies how fields are delimited. The settings for <em>nClipFormat</em> are:</dd>
<dd>
<table>
<tr>
<th><em>nClipFormat</em></th>
<th>Description</th>
</tr>
<tr>
<td>1</td>
<td>(Default) Fields delimited with spaces</td>
</tr>
<tr>
<td>3</td>
<td>Fields delimited with tabs</td>
</tr>
</table>
</dd>
<dd>If <em>nClipFormat</em> is omitted, fields are delimited with spaces.</dd>
</dl>
<p>This following copies the current work area from the current record to the end in tab-delimited format:</p>
<pre class="codeSample"><span class="blueCode">_VFP</span>.DataToClip(,,3)</pre>
<p>This following copies the current work area from the current record to the end in space-delimited format:</p>
<pre class="codeSample"><span class="blueCode">_VFP</span>.DataToClip()</pre>
<p>There are some important limitations with the DataToClip Method. Memo field content and General fields are not copied, there is no way to apply a filter or select which fields will be copied, and bugs have been found in the method&rsquo;s implementation in VFP 5 and VFP 6. Also note executing DataToClip() does not move the record pointer.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.peacockdata.com/2010/07/using-the-windows-clipboard-in-foxpro/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Zip &amp; Unzip Files</title>
		<link>http://blog.peacockdata.com/2010/03/how-to-zip-and-unzip-files/</link>
		<comments>http://blog.peacockdata.com/2010/03/how-to-zip-and-unzip-files/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 08:00:00 +0000</pubDate>
		<dc:creator>Peacock Data</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://blog.peacockdata.com/2010/03/how-to-zip-and-unzip-files/</guid>
		<description><![CDATA[We receive and send a lot of files as part of our <a href="http://www.peacockdata.com/services/">data processing services</a>, and some of our clients are unfamiliar with how to zip and extract files. The following instructions show how to compress and uncompress a file under the Windows, Mac and Linux operating environments. Note than under most systems you can select multiple files as well as folders/directories to zip into the same archive. . . .]]></description>
			<content:encoded><![CDATA[<p>We receive and send a lot of files as part of our <a href="http://www.peacockdata.com/services/">data processing services</a>, and some of our clients are unfamiliar with how to zip and extract files. The following instructions show how to compress and uncompress a file under the Windows, Mac and Linux operating environments. Note than under most systems you can select multiple files as well as folders/directories to zip into the same archive.</p>
<p>Zipping a file creates a compressed version of the file that is usually considerably smaller than the original file. The zipped version of the file has a .zip file extension.</p>
<p>Unzipping a file reverses the zip process and extracts the file from the compressed archive.</p>
<p><em><strong>IMPORTANT:</strong> Please be cautious about opening .zip files from unknown e-mail senders because they can contain viruses. Confirm with known senders before opening a .zip file.</em></p>
<h6 class="moreSpace">WINDOWS ME, XP, SERVER 2003, VISTA, SERVER 2008 and 7</h6>
<p><strong>Compress files (zip files)</strong></p>
<ol>
<li>Locate the file you want to compress.</li>
<li>Right-click the file; then point to <strong>Send to</strong> and click <strong>Compressed (zipped) folder</strong>.
<p>    A new compressed zip file is created in the same location.</li>
</ol>
<p><strong>Uncompress files (unzip files)</strong></p>
<ol>
<li>Locate the compressed zip file you want to extract.</li>
<li>Do one of the following:
<ul>
<li>To extract a single file or folder, double-click the zip file to open it; then drag the file or folder from the archive to a new location.
<li>To extract the entire contents of the zip file, right-click the zip file; then click <strong>Extract All</strong>; then follow the instructions on the screen.
    </ul>
</li>
</ol>
<p><em>Windows 95, 98, 98SE and 2000 do not have built in zip file support, and it is necessary to utilize third-party software to create and extract zip files.</em></p>
<h6 class="moreSpace">MAC OS X (10&ndash;10.4)</h6>
<p><strong>Compress files (zip files)</strong></p>
<ol>
<li>Use <em>Finder</em> to locate the file you want to compress.</li>
<li>Control-click or right-click the file icon; then click <strong>Compress</strong> [. . .]
<p>    A new compressed zip file is created in the same location.</li>
</ol>
<p><strong>Uncompress files (unzip files)</strong></p>
<ol>
<li>Use <em>Finder</em> to locate the compressed zip file you want to extract.</li>
<li>Double-click the file icon.
<p>    The files contained in the archive will be extracted to the same location.</li>
</ol>
<h6 class="moreSpace">MAC OS X (10.5&ndash;SNOW LEOPARD)</h6>
<p><strong>Compress files (zip files)</strong></p>
<ol>
<li>Use <em>Finder</em> to locate the file you want to compress.</li>
<li>Control-click or right-click the file icon; then click <strong>Create Archive of</strong> [. . .]
<p>    A new compressed zip file is created in the same location.</li>
</ol>
<p><strong>Uncompress files (unzip files)</strong></p>
<ol>
<li>Use <em>Finder</em> to locate the compressed zip file you want to extract.</li>
<li>Double-click the file icon.
<p>    The files contained in the archive will be extracted to the same location.</li>
</ol>
<h6 class="moreSpace">LINUX</h6>
<p><strong>Compress files (zip files)</strong></p>
<ol>
<li>Open a shell prompt.</li>
<li>Enter the following: <code>zip -r filename.zip filedir</code>
<p>    A new compressed zip file is created in the selected location.</li>
</ol>
<p><strong>Uncompress files (unzip files)</strong></p>
<ol>
<li>Open a shell prompt.</li>
<li>Enter the following: <code>unzip filename.zip</code>
<p>    The files contained in the archive will be extracted to the same location as the zip file.
  </li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://blog.peacockdata.com/2010/03/how-to-zip-and-unzip-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making a Data Dictionary</title>
		<link>http://blog.peacockdata.com/2010/03/making-a-data-dictionary/</link>
		<comments>http://blog.peacockdata.com/2010/03/making-a-data-dictionary/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 08:00:00 +0000</pubDate>
		<dc:creator>Peacock Data</dc:creator>
				<category><![CDATA[Data Management]]></category>
		<category><![CDATA[Database Design]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://blog.peacockdata.com/2010/03/making-a-data-dictionary/</guid>
		<description><![CDATA[A data dictionary is a document that catalogs the organization, contents and conventions of a database or collection of databases. It lists in written form all the databases, tables, views, fields and data definitions and often information about the table layouts, the relationships between tables and other details about the database schema. . . .]]></description>
			<content:encoded><![CDATA[<p>A data dictionary is a document that catalogs the organization, contents and conventions of a database or collection of databases. It lists in written form all the databases, tables, views, fields and data definitions and often information about the table layouts, the relationships between tables and other details about the database schema.</p>
<p><img class="floatRightNoBorder" src="/wp-content/images/2010/03/making-a-data-dictionary.jpg" alt="Making a data dictionary" />It does not contain the actual data from the database system, only information necessary to manage and utilize it. It is also not an instruction manual, though a data dictionary is often included as part of an instruction manual.</p>
<p>There is no universal standard as to the level of detail in a data dictionary. What is included is dependent on the audience and the complexity of the database infrastructure. System administrators and programmers will usually have a highly detailed document, sometimes complete with visual depictions, while end users may only have the basics.</p>
<p>Below is an example of a data dictionary for a bookkeeping database with three tables. It shows the kinds of information typically included in a data dictionary, however, it is not meant to be all-inclusive. Other columns that might be provided could show if a field takes null values and the precise points where each field begins and ends. If scientific or technical information is involved, a column indicating normative ranges may be useful. The possibilities are myriad.</p>
<p>A data dictionary is an important part of database system documentation. Devoting the resources needed for a quality document will help insure fewer problems and significantly aid in productivity.</p>
<h6 class="moreSpace">EXAMPLE DATA DICTIONARY FOR A BOOKKEEPING DATABASE</h6>
<p><strong>Number of Tables:</strong> 3</p>
<p><strong>Table:</strong> name of the table. <strong>Field:</strong> name of the field. <strong>Rel:</strong> Table relationship key (if any); PK = primary key, FK = foreign key; see Foreign Key Relationships. <strong>Type:</strong> field data type. <strong>Width:</strong> field width. <strong>Dec:</strong> number of decimal points (if any). <strong>Description:</strong> data definition of the field contents.</p>
<p><strong>Foreign Key Relationships:</strong> (1) points to <em>Customers</em> table <em>Id</em> field. (2) points to <em>Sales</em> table <em>Invoice</em> field.</p>
<table class="blogTbl">
<tr>
<th>Table</th>
<th>Field</th>
<th>Rel</th>
<th>Type</th>
<th>Width</th>
<th>Dec</th>
<th>Description</th>
</tr>
<tr>
<td rowspan="4">CUSTOMERS</td>
<td>ID</td>
<td>PK</td>
<td>Character</td>
<td class="alignTextRight">10</td>
<td>&nbsp;</td>
<td>Customer ID number</td>
</tr>
<tr>
<td>NAME</td>
<td>&nbsp;</td>
<td>Character</td>
<td class="alignTextRight">25</td>
<td>&nbsp;</td>
<td>Customer name</td>
</tr>
<tr>
<td>CUST_TYPE</td>
<td>&nbsp;</td>
<td>Character</td>
<td class="alignTextRight">1</td>
<td>&nbsp;</td>
<td>
      Customer type (key):</p>
<div class="keyLst">
        A = Active<br />
        I = Inactive<br />
        P = Prospect
      </div>
</td>
</tr>
<tr>
<td>TERMS</td>
<td>&nbsp;</td>
<td>Character</td>
<td class="alignTextRight">1</td>
<td>&nbsp;</td>
<td>
      Payment terms (key):</p>
<div class="keyLst">
        N = Net Due<br />
        P = Prepaid
      </div>
</td>
</tr>
<tr>
<td rowspan="4">SALES</td>
<td>INVOICE</td>
<td>PK</td>
<td>Character</td>
<td class="alignTextRight">4</td>
<td>&nbsp;</td>
<td>Invoice number</td>
</tr>
<tr>
<td>CUST_ID</td>
<td>FK (1)</td>
<td>Character</td>
<td class="alignTextRight">10</td>
<td>&nbsp;</td>
<td>Customer ID number</td>
</tr>
<tr>
<td>SAL_DATE</td>
<td>&nbsp;</td>
<td>Date</td>
<td class="alignTextRight">8</td>
<td>&nbsp;</td>
<td>Date of sale</td>
</tr>
<tr>
<td>SAL_AMOUNT</td>
<td>&nbsp;</td>
<td>Numeric</td>
<td class="alignTextRight">10</td>
<td class="alignTextRight">2</td>
<td>Amount of sale</td>
</tr>
<tr>
<td rowspan="4">RECEIPTS</td>
<td>ID</td>
<td>PK</td>
<td>Character</td>
<td class="alignTextRight">10</td>
<td>&nbsp;</td>
<td>Unique ID number</td>
</tr>
<tr>
<td>INV_NUM</td>
<td>FK (2)</td>
<td>Character</td>
<td class="alignTextRight">4</td>
<td>&nbsp;</td>
<td>Invoice number</td>
</tr>
<tr>
<td>REC_DATE</td>
<td>&nbsp;</td>
<td>Date</td>
<td class="alignTextRight">8</td>
<td>&nbsp;</td>
<td>Date of receipt</td>
</tr>
<tr>
<td>REC_AMOUNT</td>
<td>&nbsp;</td>
<td>Numeric</td>
<td class="alignTextRight">10</td>
<td class="alignTextRight">2</td>
<td>Amount of receipt</td>
</tr>
</table>
]]></content:encoded>
			<wfw:commentRss>http://blog.peacockdata.com/2010/03/making-a-data-dictionary/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Restructuring the pdNickname Database</title>
		<link>http://blog.peacockdata.com/2010/02/restructuring-the-pdnickname-database/</link>
		<comments>http://blog.peacockdata.com/2010/02/restructuring-the-pdnickname-database/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 08:00:00 +0000</pubDate>
		<dc:creator>Peacock Data</dc:creator>
				<category><![CDATA[Names & Nicknames]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[nickname databases]]></category>
		<category><![CDATA[pdNickname]]></category>

		<guid isPermaLink="false">http://blog.peacockdata.com/2010/02/restructuring-the-pdnickname-database/</guid>
		<description><![CDATA[An alternative structure for <a href="http://www.peacockdata2.com/products/pdnickname/" rel="tag">pdNickname</a> is to have one record per name with the variations in fields next to it. This tutorial explains how to do it. . . .]]></description>
			<content:encoded><![CDATA[<p>An alternative structure for <a href="http://www.peacockdata2.com/products/pdnickname/" rel="tag">pdNickname</a> is to have one record per name with the variations in fields next to it. This tutorial explains how to do it.</p>
<p>Matching and merging names can be tricky. How do you relate William Smith with Bill Smith? The <em>pdNickname</em> database can be utilized to match names that are dissimilar because one has a given first name while another has a nickname or other variation, or vice versa.</p>
<p>Out of the box <em>pdNickname</em> is structured to allow immediate compatibility with the greatest number of database systems as well as to make it easy to become familiar with.</p>
<p>The nickname database is setup with two names per record. The first name field contains the names you are looking up, and in the second is a variation for each name&mdash;nickname, diminutive, given name, variant, etc. The same name can be listed several times in the first field, each time with a different variation. (See Figure 1.)</p>
<p><span class="figure">FIGURE 1: PDNICKNAME OUT OF THE BOX</span><br />
<img src="/wp-content/images/2010/02/restructuring-the-pdnickname-database-1.gif" alt="" /></p>
<p>If the names compared are Alexander Jones and Alex Jones, all names matching Alexander (NAME-A) are scanned until a variation is found that matches Alex (NAME-B). This works well, but there are other ways of organizing <em>pdNickname</em> that could work even better for you. In fact, we have restructured the table for utilization in our own services.</p>
<p>An alternative structure is to have one record per name and the variations in fields next to it. It is not practical to have separate fields for each variation, which can range from one to over two hundred. So what we do is have two Memo fields (also known as Long Text), one for close variations (relflag = &quot;1&quot;) and the other for more distant variations (relflag = &quot;2&quot;), with the string of variations separated by delimiters for easier matching. (See Figure 2.)</p>
<p><span class="figure">FIGURE 2: PDNICKNAME RESTRUCTURED</span><br />
<img src="/wp-content/images/2010/02/restructuring-the-pdnickname-database-2.gif" alt="" /><br />
<span class="caption">Note: when browsing a table, normally you cannot see the content of a Memo or Long Text field because the database keeps it in a separate file. For this screenshot we have made the content visible.</span></p>
<p>Structured this way, when your program finds a match for NAME-A, it then determines if NAME-B can be found in variation field one or variation field two. This can be faster because you only access one record in each search request. The code sample below is an example in Visual FoxPro that illustrates this. Of course other programs use different commands and syntax to achieve the same outcome.</p>
<pre class="codeSample"><span class="greenComments">* CODE SAMPLE</span>

<span class="greenComments">*- this Visual FoxPro function receives as parameters</span>
<span class="greenComments">*- the two first names being compared - it returns a</span>
<span class="greenComments">*- variable indicating what matches are found - this</span>
<span class="greenComments">*- function is based on the restructuring of the</span>
<span class="greenComments">*- pdNickname database described in this tutorial</span>

<span class="blueCode">FUNCTION</span> pdNickname
<span class="blueCode">LPARAMETERS</span> cNameA, cNameB
<span class="blueCode">LOCAL</span> nMatch

<span class="blueCode">IF</span> NOT <span class="blueCode">USED</span>(&quot;nicknames&quot;)
    <span class="blueCode">USE</span> nicknames <span class="blueCode">ALIAS</span> nicknames <span class="blueCode">IN</span> 0
<span class="blueCode">ENDIF</span>

cNameA = <span class="blueCode">PADR</span>(<span class="blueCode">UPPER</span>(<span class="blueCode">ALLTRIM</span>(cNameA)),25,&quot; &quot;)
cNameB = &quot;/&quot;+<span class="blueCode">UPPER</span>(<span class="blueCode">ALLTRIM</span>(cNameB))+&quot;/&quot;

nMatch = 0
<span class="blueCode">IF SEEK</span> (cNameA, &quot;nicknames&quot;, &quot;name&quot;)
    <span class="blueCode">DO CASE</span>
    <span class="blueCode">CASE OCCURS</span>(cNameB, nicknames.variations) &gt; 0
        nMatch = 1
    <span class="blueCode">CASE OCCURS</span>(cNameB, nicknames.var2) &gt; 0
        nMatch = 2
    <span class="blueCode">ENDCASE</span>
<span class="blueCode">ENDIF</span>

<span class="blueCode">RETURN</span> nMatch</pre>
<p><em>pdNickname</em>, like all our Database Products, are structured to satisfy most users from the start. But there are many ways to integrate the databases into your system. It is up to you to determine what works best for you. Do not be afraid to experiment.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.peacockdata.com/2010/02/restructuring-the-pdnickname-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

