<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Frank Perez's Blog - DAFUG</title>
    <link>http://www.pfsolutions-mi.com/blog/</link>
    <description>Tips, tricks, rantings, ravings, ideas, and life as a Visual FoxPro developer.</description>
    <language>en-us</language>
    <copyright>Frank Perez</copyright>
    <lastBuildDate>Fri, 11 Apr 2008 22:43:36 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.0.7226.0</generator>
    <managingEditor>frankperez@pfsolutions-mi.com</managingEditor>
    <webMaster>frankperez@pfsolutions-mi.com</webMaster>
    <item>
      <trackback:ping>http://www.pfsolutions-mi.com/blog/Trackback.aspx?guid=6fedbe29-948e-4a90-a532-c13187b03b0a</trackback:ping>
      <pingback:server>http://www.pfsolutions-mi.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.pfsolutions-mi.com/blog/PermaLink,guid,6fedbe29-948e-4a90-a532-c13187b03b0a.aspx</pingback:target>
      <dc:creator>Frank Perez</dc:creator>
      <wfw:comment>http://www.pfsolutions-mi.com/blog/CommentView,guid,6fedbe29-948e-4a90-a532-c13187b03b0a.aspx</wfw:comment>
      <wfw:commentRss>http://www.pfsolutions-mi.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=6fedbe29-948e-4a90-a532-c13187b03b0a</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Last night Mike Feltman, of F1 Technologies, did a presentation called "Collections".
He discussed the basics of collections and arrays, and very some cool utilities he
wrote for working with both.
</p>
        <p>
One of cool things I learned had to do with the FOXOBJ clause of the FOR EACH ...
ENDFOR command. For example, in the following code sample "loObject" is not a Visual
FoxPro object, but is re-casted as a COM object.
</p>
        <p>
          <code>loCollection = CREATEOBJECT("Collection")<br />
loCollection.Add(CREATEOBJECT("Custom"))<br />
FOR EACH loObject IN loCollection<br />
   &amp;&amp; loObject is a COM object, AMEMBERS() returns 0.<br />
ENDFOR</code>
        </p>
        <p>
Starting with Visual FoxPro 9, we can add the FOXOBJ clause so that loObject is a
Visual FoxPro object. This is an important distinction, because functions like AMEMBERS()
and COMOBJ() would produce unexpected results.
</p>
        <p>
          <code>loCollection = CREATEOBJECT("Collection")<br />
loCollection.Add(CREATEOBJECT("Custom"))<br />
FOR EACH loObject IN loCollection FOXOBJECT<br />
   &amp;&amp; loObject is a Visual FoxPro object, AMEMBERS() returns
18.<br />
ENDFOR</code>
        </p>
        <p>
The FOXOBJ clause was not new to me. However, what I did not know was that using the
FOXOBJ clause made the FOR EACH ... ENDFOR command almost 2x faster than the FOR ...
ENDFOR equivalent.
</p>
        <p>
          <code>* create a collection with 10,000 items<br />
loCollection = CREATEOBJECT("Collection")<br />
FOR m.lnX = 1 TO 10000<br />
   loCollection.Add(CREATEOBJECT("Custom"))<br />
ENDFOR<br /><br />
* test the performance using FOR EACH<br />
m.lnStartTime = SECONDS()<br />
FOR EACH loObject IN loCollection<br />
   * do nothing, we already have an object reference<br />
ENDFOR<br />
? "FOR EACH: " + TRANSFORM(SECONDS() - m.lnStartTime) &amp;&amp; 0.156 seconds<br /><br />
* test the performance using FOR EACH with FOXOBJ<br />
m.lnStartTime = SECONDS()<br />
FOR EACH loObject IN loCollection FOXOBJ<br />
   * do nothing, we already have an object reference<br />
ENDFOR<br />
? "FOR EACH with FOXOBJ: " + TRANSFORM(SECONDS() - m.lnStartTime) &amp;&amp; 0.016
seconds<br /><br />
* test the performance using simple FOR<br />
m.lnStartTime = SECONDS()<br />
FOR m.lnX = 1 TO loCollection.COUNT<br />
   * get an object reference to the item<br />
   loObject = loCollection.ITEM(m.lnX)<br />
ENDFOR<br />
? "FOR: " + TRANSFORM(SECONDS() - m.lnStartTime) &amp;&amp; 0.031 seconds</code>
        </p>
        <p>
Little gems like this are one of the benefits of attending local FoxPro user groups
meetings. The opportunity to learn something new, meet new people, and the comradery
are all valuable benefits. 
</p>
        <p>
If you missed this presentation, I heard that Mike will be presenting it again at
the Grand Rapids Area FoxPro User Group on May 10th, 2008.
</p>
        <p>
          <br />
Links:<br />
DAFUG <a href="http://dafug.org">http://dafug.org</a><br />
GRAFUG <a href="http://www.grafug.com">http://www.grafug.com</a><br />
F1 Technologies <a href="http://www.f1tech.com">http://www.f1tech.com</a></p>
        <img width="0" height="0" src="http://www.pfsolutions-mi.com/blog/aggbug.ashx?id=6fedbe29-948e-4a90-a532-c13187b03b0a" />
      </body>
      <title>April 2008 - DAFUG Meeting</title>
      <guid isPermaLink="false">http://www.pfsolutions-mi.com/blog/PermaLink,guid,6fedbe29-948e-4a90-a532-c13187b03b0a.aspx</guid>
      <link>http://www.pfsolutions-mi.com/blog/2008/04/11/April2008DAFUGMeeting.aspx</link>
      <pubDate>Fri, 11 Apr 2008 22:43:36 GMT</pubDate>
      <description>&lt;p&gt;
Last night Mike Feltman, of F1 Technologies, did a presentation called "Collections".
He discussed the basics of collections and arrays, and very some cool utilities he
wrote for working with both.
&lt;/p&gt;
&lt;p&gt;
One of cool things I learned had to do with the FOXOBJ clause of the FOR EACH ...
ENDFOR command. For example, in the following code sample "loObject" is not a Visual
FoxPro object, but is re-casted as a COM object.
&lt;/p&gt;
&lt;p&gt;
&lt;code&gt;loCollection = CREATEOBJECT("Collection")&lt;br&gt;
loCollection.Add(CREATEOBJECT("Custom"))&lt;br&gt;
FOR EACH loObject IN loCollection&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;amp;&amp;amp; loObject is a COM object, AMEMBERS() returns 0.&lt;br&gt;
ENDFOR&lt;/code&gt;
&lt;/p&gt;
&lt;p&gt;
Starting with Visual FoxPro 9, we can add the FOXOBJ clause so that loObject is a
Visual FoxPro object. This is an important distinction, because functions like AMEMBERS()
and COMOBJ() would produce unexpected results.
&lt;/p&gt;
&lt;p&gt;
&lt;code&gt;loCollection = CREATEOBJECT("Collection")&lt;br&gt;
loCollection.Add(CREATEOBJECT("Custom"))&lt;br&gt;
FOR EACH loObject IN loCollection FOXOBJECT&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;amp;&amp;amp; loObject is a Visual FoxPro object, AMEMBERS() returns
18.&lt;br&gt;
ENDFOR&lt;/code&gt;
&lt;/p&gt;
&lt;p&gt;
The FOXOBJ clause was not new to me. However, what I did not know was that using the
FOXOBJ clause made the FOR EACH ... ENDFOR command almost 2x faster than the FOR ...
ENDFOR equivalent.
&lt;/p&gt;
&lt;p&gt;
&lt;code&gt;* create a collection with 10,000 items&lt;br&gt;
loCollection = CREATEOBJECT("Collection")&lt;br&gt;
FOR m.lnX = 1 TO 10000&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;loCollection.Add(CREATEOBJECT("Custom"))&lt;br&gt;
ENDFOR&lt;br&gt;
&lt;br&gt;
* test the performance using FOR EACH&lt;br&gt;
m.lnStartTime = SECONDS()&lt;br&gt;
FOR EACH loObject IN loCollection&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;* do nothing, we already have an object reference&lt;br&gt;
ENDFOR&lt;br&gt;
? "FOR EACH: " + TRANSFORM(SECONDS() - m.lnStartTime) &amp;amp;&amp;amp; 0.156 seconds&lt;br&gt;
&lt;br&gt;
* test the performance using FOR EACH with FOXOBJ&lt;br&gt;
m.lnStartTime = SECONDS()&lt;br&gt;
FOR EACH loObject IN loCollection FOXOBJ&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;* do nothing, we&amp;nbsp;already have an object reference&lt;br&gt;
ENDFOR&lt;br&gt;
? "FOR EACH with FOXOBJ: " + TRANSFORM(SECONDS() - m.lnStartTime) &amp;amp;&amp;amp; 0.016
seconds&lt;br&gt;
&lt;br&gt;
* test the performance using simple FOR&lt;br&gt;
m.lnStartTime = SECONDS()&lt;br&gt;
FOR m.lnX = 1 TO loCollection.COUNT&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;* get an object reference to the item&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;loObject = loCollection.ITEM(m.lnX)&lt;br&gt;
ENDFOR&lt;br&gt;
? "FOR: " + TRANSFORM(SECONDS() - m.lnStartTime) &amp;amp;&amp;amp; 0.031 seconds&lt;/code&gt;
&lt;/p&gt;
&lt;p&gt;
Little gems like this are one of the benefits of attending local FoxPro user groups
meetings. The opportunity to learn something new, meet new people, and the comradery
are all valuable benefits. 
&lt;/p&gt;
&lt;p&gt;
If you missed this presentation, I heard that Mike will be presenting it again at
the Grand Rapids Area FoxPro User Group on May 10th, 2008.
&lt;/p&gt;
&lt;p&gt;
&lt;br&gt;
Links:&lt;br&gt;
DAFUG &lt;a href="http://dafug.org"&gt;http://dafug.org&lt;/a&gt;
&lt;br&gt;
GRAFUG &lt;a href="http://www.grafug.com"&gt;http://www.grafug.com&lt;/a&gt;
&lt;br&gt;
F1 Technologies &lt;a href="http://www.f1tech.com"&gt;http://www.f1tech.com&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.pfsolutions-mi.com/blog/aggbug.ashx?id=6fedbe29-948e-4a90-a532-c13187b03b0a" /&gt;</description>
      <comments>http://www.pfsolutions-mi.com/blog/CommentView,guid,6fedbe29-948e-4a90-a532-c13187b03b0a.aspx</comments>
      <category>DAFUG</category>
      <category>VFP</category>
    </item>
    <item>
      <trackback:ping>http://www.pfsolutions-mi.com/blog/Trackback.aspx?guid=61e2c554-d7ea-4eb7-8598-6c30537dd03f</trackback:ping>
      <pingback:server>http://www.pfsolutions-mi.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.pfsolutions-mi.com/blog/PermaLink,guid,61e2c554-d7ea-4eb7-8598-6c30537dd03f.aspx</pingback:target>
      <dc:creator>Frank Perez</dc:creator>
      <wfw:comment>http://www.pfsolutions-mi.com/blog/CommentView,guid,61e2c554-d7ea-4eb7-8598-6c30537dd03f.aspx</wfw:comment>
      <wfw:commentRss>http://www.pfsolutions-mi.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=61e2c554-d7ea-4eb7-8598-6c30537dd03f</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Last night Paul Mrozowski did a presentation called "Lucene.NET as a Document Search
Engine".  He began by explaining that <a href="http://incubator.apache.org/projects/lucene.net.html">Lucene.NET</a> is
an open source indexing and search library written in C#.  It is not a traditional
application.  Instead it is a tool developers can use to index and search documents,
such as CHM, DOC, HLP, PDF, RTF, and TXT files.  
</p>
        <p>
Paul first demonstrated how easy it is to install Lucene.NET, some of the configuration
settings, and how to set it up to run as a background service in Microsoft Windows. 
Next he showed us a COM wrapper class that he created in order to use Lucene.NET from
Visual FoxPro.
</p>
        <p>
The wrapper class could be used to index the source files and perform some pretty
complex searches.  I liked the way it could include the surrounding portions
of text with the search results.  For example, if you searched for the phrase
"fox" in "Visual FoxPro Rocks", you could include a variable amount of the original
characters found before and after the search phrase.
</p>
        <p>
In addition to indexing document files, he also demonstrated how the wrapper class
could be used to build your own index entries with meta data.  For example, you
could index the contents of a memo field and then store the table name and record
identification in the meta data.  Later, this information could be searched the
same as document file.
</p>
        <p>
Although the wrapper class did not have the complete functionality of Lucene.NET,
it did fill the most basic needs.  He mentioned the idea of either posting the
sample code to his web site or better yet making it a <a href="http://www.codeplex.com/VFPX">VFPX</a> project. 
All in all, it was a very cool presentation.
</p>
        <p>
          <br />
Links:<br />
DAFUG <a href="http://dafug.org">http://dafug.org</a><br />
Paul Mrozowski <a href="http://www.rcs-solutions.com">http://www.rcs-solutions.com</a><br /></p>
        <img width="0" height="0" src="http://www.pfsolutions-mi.com/blog/aggbug.ashx?id=61e2c554-d7ea-4eb7-8598-6c30537dd03f" />
      </body>
      <title>December 2007 - DAFUG Meeting</title>
      <guid isPermaLink="false">http://www.pfsolutions-mi.com/blog/PermaLink,guid,61e2c554-d7ea-4eb7-8598-6c30537dd03f.aspx</guid>
      <link>http://www.pfsolutions-mi.com/blog/2007/12/14/December2007DAFUGMeeting.aspx</link>
      <pubDate>Fri, 14 Dec 2007 19:06:16 GMT</pubDate>
      <description>&lt;p&gt;
Last night Paul Mrozowski did a presentation called "Lucene.NET as a Document Search
Engine".&amp;nbsp; He began by explaining that &lt;a href="http://incubator.apache.org/projects/lucene.net.html"&gt;Lucene.NET&lt;/a&gt; is
an open source indexing and search library written in C#.&amp;nbsp; It is not a traditional
application.&amp;nbsp; Instead it is a tool developers can use to index and search documents,
such as CHM, DOC, HLP, PDF, RTF, and TXT files.&amp;nbsp; 
&lt;/p&gt;
&lt;p&gt;
Paul first demonstrated how easy it is to install Lucene.NET, some of the configuration
settings, and how to set it up to run as a background service in Microsoft Windows.&amp;nbsp;
Next he showed us a COM wrapper class that he created in order to use Lucene.NET from
Visual FoxPro.
&lt;/p&gt;
&lt;p&gt;
The wrapper class could be used to index the source files and perform some pretty
complex searches.&amp;nbsp; I liked the way it could include the surrounding portions
of text with the search results.&amp;nbsp; For example, if you searched for the phrase
"fox" in "Visual FoxPro Rocks", you could include a variable amount of the original
characters found before and after the search phrase.
&lt;/p&gt;
&lt;p&gt;
In addition to indexing document files, he also demonstrated how the wrapper class
could be used to build your own index entries with meta data.&amp;nbsp; For example, you
could index the contents of a memo field and then store the table name and record
identification in the meta data.&amp;nbsp; Later, this information could be searched the
same as document file.
&lt;/p&gt;
&lt;p&gt;
Although the wrapper class did not have the complete functionality of Lucene.NET,
it did fill the most basic needs.&amp;nbsp; He mentioned the idea of either posting the
sample code to his web site or better yet making it a &lt;a href="http://www.codeplex.com/VFPX"&gt;VFPX&lt;/a&gt; project.&amp;nbsp;
All in all, it was a very cool presentation.
&lt;/p&gt;
&lt;p&gt;
&lt;br&gt;
Links:&lt;br&gt;
DAFUG &lt;a href="http://dafug.org"&gt;http://dafug.org&lt;/a&gt;
&lt;br&gt;
Paul Mrozowski &lt;a href="http://www.rcs-solutions.com"&gt;http://www.rcs-solutions.com&lt;/a&gt;
&lt;br&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.pfsolutions-mi.com/blog/aggbug.ashx?id=61e2c554-d7ea-4eb7-8598-6c30537dd03f" /&gt;</description>
      <comments>http://www.pfsolutions-mi.com/blog/CommentView,guid,61e2c554-d7ea-4eb7-8598-6c30537dd03f.aspx</comments>
      <category>VFP</category>
      <category>DAFUG</category>
      <category>.NET</category>
    </item>
  </channel>
</rss>