Tuesday, April 15, 2008

Ever since I decided to post the Beyond Compare add-on utility, VFP2Text, it was always my intention to also release the source code. The reason I waited was to allow some time for any bug reports or major enhancement ideas. I figured initially it would be easier for me to handle them.

Well, it's been over a month since I first blogged about the add-on and so far no problems reported and the enhancement requests have been about minor changes. So, in keeping with my original plan, I have posted the source code for the utility on my web site here.

In return, I ask that you please share with me any cool enhancements or bugs you find. Thanks.

posted on Tuesday, April 15, 2008 11:03:32 AM UTC  #    Comments [0]
 Friday, April 11, 2008

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.

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.

loCollection = CREATEOBJECT("Collection")
loCollection.Add(CREATEOBJECT("Custom"))
FOR EACH loObject IN loCollection
   && loObject is a COM object, AMEMBERS() returns 0.
ENDFOR

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.

loCollection = CREATEOBJECT("Collection")
loCollection.Add(CREATEOBJECT("Custom"))
FOR EACH loObject IN loCollection FOXOBJECT
   && loObject is a Visual FoxPro object, AMEMBERS() returns 18.
ENDFOR

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.

* create a collection with 10,000 items
loCollection = CREATEOBJECT("Collection")
FOR m.lnX = 1 TO 10000
   loCollection.Add(CREATEOBJECT("Custom"))
ENDFOR

* test the performance using FOR EACH
m.lnStartTime = SECONDS()
FOR EACH loObject IN loCollection
   * do nothing, we already have an object reference
ENDFOR
? "FOR EACH: " + TRANSFORM(SECONDS() - m.lnStartTime) && 0.156 seconds

* test the performance using FOR EACH with FOXOBJ
m.lnStartTime = SECONDS()
FOR EACH loObject IN loCollection FOXOBJ
   * do nothing, we already have an object reference
ENDFOR
? "FOR EACH with FOXOBJ: " + TRANSFORM(SECONDS() - m.lnStartTime) && 0.016 seconds

* test the performance using simple FOR
m.lnStartTime = SECONDS()
FOR m.lnX = 1 TO loCollection.COUNT
   * get an object reference to the item
   loObject = loCollection.ITEM(m.lnX)
ENDFOR
? "FOR: " + TRANSFORM(SECONDS() - m.lnStartTime) && 0.031 seconds

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.

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.


Links:
DAFUG http://dafug.org
GRAFUG http://www.grafug.com
F1 Technologies http://www.f1tech.com

posted on Friday, April 11, 2008 10:43:36 PM UTC  #    Comments [0]
 Wednesday, April 09, 2008

I downloaded my first issue of FoxRockX and I have to say that I like it. The format reminds me of the old FoxTalk issues. There is a good amount of content; twenty-four pages with out any advertisements. And of course, source code was included.

Out of the five articles in this issue, Doug Hennig's "Deep Dive: A Generic Import Utility" is my favorite. This article is part one of a two-part series that will demonstrate how to add a generic import utility to your application. In this issue he discusses the overall design and engine code. The next issue will be about the user interface.

Articles like this are a major reason why I subscribe to technical publications. Maybe I don't have a need for this today. But, I know that there is a good chance I will someday. And when that time comes I will more than likely use this article and sample code as inspiration for designing and writing my own.


Links:
FoxRockX http://www.foxrockx.com
Subscription in America & Asia http://www.hentzenwerke.com
Subscriptions in Europe http://shop.dfpug.com

posted on Wednesday, April 09, 2008 10:27:24 PM UTC  #    Comments [0]
 Tuesday, April 08, 2008

Last year we let our subscription to FoxTalk lapse for several reasons. For starters, there was the marketing tactics of Eli Journals. Then there was the matter where the archive issues, published before Eli Journals took over, were no longer available on the web site. But most of all, I felt that the content was not what it used to be.

So when I heard that Rainer Becker was starting a new on-line magazine called FoxRockX, I was like "hey that's cool". Then I heard that one of my favorite columns, the KitBox, would be coming back along with the always entertaining Marcia Atkins and Andy Kramek...and I thought "that's awesome". But when I found that a FoxRockX subscription included on-line access to the complete archives of FoxTalk issues...I was sold.

It is going to be so cool to have the old FoxTalk issues available in a searchable format. I don't know how many times I've been able to get a head start on a problem by taking advantage of something in one of those articles. Plus, I can't wait to see the new stuff.


Links:
FoxRockX http://www.foxrockx.com
Subscription in America & Asia http://www.hentzenwerke.com
Subscriptions in Europe http://shop.dfpug.com

posted on Tuesday, April 08, 2008 10:21:43 PM UTC  #    Comments [0]
 Monday, April 07, 2008

When I started this blog, it was never my intention to allow so much time between posts. My goal was to try and blog at least once per month. Well, things have not quite worked out the way I envisioned. I always seem to find my self starting to write something, never feeling 100% happy with it, and then abandoning it all together.

I guess blogging is something that does not come easy to me, at least not yet. I think the only way to beat this problem is to just accept whatever comes out and post it. If it sucks, well at least I tried. So without further delay, here are some things that I've been meaning to post.

posted on Monday, April 07, 2008 10:10:36 PM UTC  #    Comments [0]