------------------------------------------------------------------------------ ------------------------------------------------------------------------------ NNNNNNNNNNNN NNNNNNNNNNNN NNNNNNN NNNNNN NNNNNNN NNNNNN NNNNNNNNNNNNNN NNNNNNNNNNNNNN NNNNNNNN NNNNNN NNNNNNNN NNNNNN NNNNNN NNNNN NNNNNNNNNN NNNNNNNNN NNNNNN NNNNNNNNN NNNNNN NNNNNN NNNNN NNNNNNNN NNNNNNNNN NNNNNNN NNNNNNNNNN NNNNNN NNNNNNNNNNNN NNNNNN NNNNNNNNNNNNNNNNN NNNNNNNNNNNNNNNNN NNNNNN NNNNNN NNNNNNN NNNNNN NNNNNNNNNN NNNNNN NNNNNNNNNN NNNNNN NNNNNN NNNNNNNN NNNNNN NNNNNNNN NNNNNN NNNNNNNN NNNNNNNNNNNNNN NNNNNNNNNNNNN NNNNNN NNNNNNN NNNNNN NNNNNNN NNNNNNNNNNNNN NNNNNNNNNNN NNNNNN NNNNNN NNNNNN NNNNNN ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Boston Computer News Network February, 1994 A Service of the Boston Computer Society, USA Vol.1, No.1 Sponsered by the Foxpro SIG Foxpro Version ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ 0. Introduction -------------------------------------------------------------------------- ReplyTo: David Rose [73164,2633] (508)538-8064 (Assoc. Editor) ReplyTo: Arnold Bilansky [71533,1031] (617)522-3700 x374 (Assoc. Editor) Welcome to the first edition of the Foxpro Edition of BCNN! With over 2000 of you being placed on the distribution list, we are thrilled to see your interest in this newsletter. For those of you who have never received a newsletter like this before, there are 460 or so lines of text. (Those of you using an earlier version of Tapcis may want to consider upgrading to version 5.4 or later.) Future editions will contain somewhat more material, but we will try to keep to about 600 lines of text. 1. March 9th User Group Meeting: "Object Oriented Techniques in FoxPro." ----------------------------------------------------------------------- ReplyTo: Arnold Bilansky [71533,1031] (617)522-3700 x374 Meeting: March 9, 1994, 7:00 p.m. ** Place: Microsoft Office, 9 Hillside Avenue, Waltham, MA USA. Y. Alan Griver on "Object Oriented Techniques in FoxPro." 2. FoxPro Training Session with Y. Alan Griver. ----------------------------------------------------------------------- ReplyTo: Arnold Bilansky [71533,1031] (617) 522-3700 x374 Meeting: March 10, 1994, 9:30 p.m. to 4:30p.m. ** Place: Microsoft Office, 9 Hillside Avenue, Waltham, MA USA. Y. Alan Griver presents a lecture style training class on the methodologies presented in the new "FoxPro Codebook 2.5." Topics include: Detailed coverage of the issues, standards, and techniques involved in creating large applications. Find out how to improve communications with clients and team members. Learn to program multi- user, event-driven applications, using object-oriented techniques. Learn to create reusable code. Price is $65 for BCS members paying by March 5. All others $85. 3. Call for Participation: Fox History Lesson. ----------------------------------------------------------------------- ReplyTo: Arnold Bilansky [71533,1031] (617)522-3700 x374 BCS FoxPro SIG On Jan. 25 Steve Murch posted a message from Dr. Fulton announcing that he was going to taking a few months off to spend with his family. Also that he would be departing from the database arena, to begin working on the Information Superhighway. We wish him fulfillment in this new venture. I am preparing a tribute to Dr. Dave to run in an upcoming BCS PC Report user group magazine. Part of that article will contain a history of Fox. I am including here a time-line here based upon information provided by Janet Walker. I would appreciate any personal anecdotes you readers can provide on Dave or Fox Software, to be shared shared in future editions of BCNN/FoxPro. 1. FoxBASE was first developed to run a set of manufacturing apps written in dbase II by a company Dave owned called Dacor. Ashton- Tate charged too much to redistribute apps in dBase II. 2. When the manufacturing apps failed in the market place, the decision was made to market FoxBASE as an add on to dBase to speed users applications and give them an inexpensive distribution method. 3. Dave Fulton and Bill Ferguson wrote the original product. It was released in December 1984. 4. Dave sold his interest in Dacor (to his ex-wife) to devote his attention full-time to FoxBASE. Fox had 6 employees at the time. Dave's future wife Amy was one of them. 5. FoxBASE became the first mutli-user xbase product on the market when Fox shipped a UNIX version in late 1985. 6. FoxBASE+ was released in 1986. Ashton-Tate invites Fox Software to their dBase developers' conference where FoxBASE+ was shown as a dBase add-on. (Fox Software was never invited back to another Ashton-Tate Event.) 7. FoxBASE+ ran dBase III plus APPs perfectly and very, very fast. In the years 1986-1988 many dBase developers switched to FoxBASE+ because of the performance, the stability, the features and the inexpensive distribution options. 9. FoxBASE+/Mac ships in the spring of 1988. 10. Ashton-Tate sues Fox Software in the Fall of 1988 after dBase IV ships and bombs. 11. FoxPro 1.0 ships in Fall 1989 forever changing the face of xbase. 12. FoxPro 2.0 ships in the Summer of 1992 to rave reviews thanks in large part to the introduction of Rushmore but also because of the power tools, performance, SQL support. 13. Fox merges with Microsoft in Spring of 1992. 14. FoxPro for Windows ships in January 1993. 15. FoxPro for Mac ships in December 1993. 4. Four Excellent Macros During Development. ----------------------------------------------------------------------- ReplyTo: Whil Hentzen, 70651,2270 Milwaukee WI USA Hentzenwerke (414)332-9876 I wanted to share four macros I use just about every day. ALT-F2 gets ?{SPACEBAR}sys(5)+sys(2003){ENTER}. ALT-F2 shows me the default drive and directory, as long as I'm in the Command Window at the time. I switch between directories A LOT, so this is handy. ALT-F3 gets {F10}wd{CTRL+END}{F10}wd. This grabs Debug, clears all the entries, and then brings it up again. Many people know about the CTRL- END trick, but the problem is that it shuts the window down. This macro provides the benefit without the attendant problem. ALT-W and ALT-V are companion macros used with the Screen Builder. Once on an object, {ENTER}ve{TAB}{TAB} and {ENTER}we{TAB}{TAB} open up the Snippet editing window, change the type to Expression, and then position the cursor in the editing window. Since I put all my code in functions that are called via expressions, these two save a lot of repetitive mouse clicking. Don't forget to save these macros as defaults, and if you direct your temp files somewhere goofy, make sure that you put the DEFAULT.FKY file back into the FoxPro directory. I'd be interested in hearing what other short tools like this you have in your toolbox. 5. Display AM/PM just like Fox's CLOCK. ----------------------------------------------------------------------- ReplyTo: Ted Roche, CIS: 76400,2503 Contoocook, NH Computer Resource Consulting (603) 746-4017 Don't you hate it? Sometimes, someone, a co-worker, friend, or relative will come along and complain that Fox can't do this, or doesn't do that, or they can't make it do the other. . . and you just can't resist exclaiming 'Challenge Me!' and insisting that, not only can you do it, but you can do it in only 4 lines of code (or maybe three...) So started Sniplets, a collection of short routines, applets and code fragments which provide absolutely no redeeming value to society whatsoever, but are a fun diversion, and keep nerds off the streets. Send your favorite Sniplets to your local user group newsletter editor and you, too, can achieve fame and glory. Today's challenge: My buddy Ron griped to me that he can't get FoxPro to display the time in the same format as it is displayed the clock. Here it is, using one line of code: * AMPM.PRG - return the time in the format Fox displays the clock RETURN IIF(TIME()<"12", TIME()+" am", ; IIF(TIME()="12", "12", STR(VAL(TIME())%12,2)) + ; RIGHT(TIME(),6)+" pm") 6. CONTINUE REVERSE Simulation. ----------------------------------------------------------------------- ReplyTo: Arnold Bilansky [71533,1031] (617)522-3700 x374 Our FP SIG runs a monthly User to User hands on meeting in addition to regular monthly meetings. I demonstrated this tip several months ago at one of those meetings and want to share it with you. It would be great To have REVERSE clause for the CONTINUE command after a LOCATE is performed. If an index is active, we can roll our own though. * PROCEDURE rvrsloct * * Reverse locate for inclusion in a locate screen. * It presumes that the "Reverse" button is grayed out * until the initial forward locate is first performed. PRIVATE lnCurrec,lcOldscend,lcFlipord STORE RECNO() TO lnCurrec STORE IIF(AT("DESCENDING",SET("ORDER"))=0,; "ASCENDING","DESCENDING") TO lcOldscend STORE IIF(AT("DESCENDING",SET("ORDER"))=0,; "DESCENDING","ASCENDING") TO lcFlipord SET ORDER TO SYS(22) &lcFlipord && SYS(22) = tag name. WAIT WINDOW "Searching..." NOWAIT CONTINUE IF EOF() GO lnCurrec WAIT WINDOW "No additional match found" NOWAIT ELSE WAIT WINDOW "Additional match found" NOWAIT ENDIF SHOW GETS SET ORDER TO SYS(22) &lcOldscend RETURN As we were going to "press" we noticed parallel tip by Walter J. Grogan in February's FoxTalk. Please read that article for additional insight into the use of DESCENDING clauses. 7. A Must-Have for High Speed Modems: 16550 UART and You. ----------------------------------------------------------------------- ReplyTo: Chris Pels [73777,3562] Like many of you, I continue to upgrade my modem to reduce the time it takes to send files and messages. I have always recovered the cost of a faster modem by decreasing my phone charges. When I moved my Clipper development to Windows a while back I got in the habit of doing everything from within Windows. As you may have noticed, communications withn Windows is at least an order of magnitude slower than from DOS. Several months ago a forum I monitor on CompuServe had a thread about 16550 UART chips on serial communications boards. The 16550 UART serves to buffer data through the serial port much like a disk cache. The result is dramatically improved communications throughput, especially in Windows. I have experienced increased throughput of about 40% in Windows! The best news is I bought the Boca I/0AT55 from PC Connection with 2 serial (16550) ports and a bi-directional parallel port for $50. If you do any amount of modem work this is an item you should not be without. 8. Reporting by Rank. ----------------------------------------------------------------------- ReplyTo: David Rose [73164,2633] (508)538-8064 Suppose that a survey is done of a company's favorite snack foods in order to fill up a snack machine. We need to generate a ranked listing of the favorites. Something like this: Rank Snack Votes for ---- ----------------- ------ 1 Chocolate Bars 12 2 Cookies 10 2 Potato Chips 10 4 Mints 9 ... Notice that Cookies and Potato Chips, each with the same number of votes, are ranked equally, while Mints, less than either is ranked 4th, because in comparison with all other items of more votes, it is 4th on the list. (If, in addition, Mints had 10 votes, then it too would be ranked 2nd, while the next item on the list, jelly babies, would rank 5th.) This problem was recently described at a gathering of BCS Foxpro members, and two solutions were presented. The following is a different solution. We define a function RANK(), which is used to implement the preceding report as follows. Don't worry about the extra stuff, it will make sense once the function is described internally. ... PRIVATE lnRank, lnRankValue, lnRankCount lnRank = 0 lnRankValue = 9999999999 lnRankCount = 1 USE survey ORDER TAG value DESCENDING REPORT FORM result FOR rank(survey.value, @lnRank, @lnRankValue, ; @lnRankCount) That is all there is to it! Here is the definition of function RANK: FUNCTION Rank PARAMETERS tnValue, tnRank, tnRkValue, tnRkCount IF tnValue < tnRkValue tnRkValue = tnValue tnRank = tnRank + tnRkCount tnRkCount = 1 ELSE tnRkCount = tnRkCount + 1 ENDIF RETURN tnRank The report form displays the rank by using the value of the memory variable lnRank, not by calling the function RANK() again. This is important, for RANK keeps track of the ranking, but doesn't know one record from another. If rank() is called twice on the same record, then it will think that there are two records with the same value and increment lnRankCount by one, throwing future ranked values off. For the same reason, you cannot use this function in a SQL Select statement, and be sure to turn Rushmore off if you choose to use it like this: SCAN FOR Rank(Value,@Rank,@RankValue,@RankCount) NOOPTIMIZE ... ENDSCAN The ranking function presented here is an interesting and simple example of a state machine applied to the records of a database. In this example, the state is held by the record number of the data base (implicitly) and by the last three parameters of the rank function (which must be passed by reference). In conventional programming, a state machine model is used to perform complex transformations, an example being program language compilers. It is yet another tool, developed by computer science, that can be applied to solving business problems by Foxpro programmers. 9. Counting Groups in Reports. ----------------------------------------------------------------------- ReplyTo: Arnold Bilansky [71533,1031] (617)522-3700 x374 In the FP banded report writer you can break your data into groups. To keep track of how many instances in a group, use the following technique: Define a report variable - onTotgroup with Value to store: onTotgroup; Initial value: 0; Calculate: Nothing. I use an initial "o" for report variables to visually aid deciphering of report elements. It also helps drill down to those variables in the report variable list box when placing report expressions. Then, in the group footer band, place the following field expression: grptally(@onTotgroup). The function grptally is simply: * PROCEDURE grptally PARAMETERS tnCounter STORE tnCounter+1 TO tnCounter RETURN "" At the end of the report onTotgroup can be placed as a field representing the number of groups encountered. 10. TimeTrakker Logs Time & Billing in FoxPro DBFs. ---------------------------------------------------------------------- ReplyTo: Bill Budney [70431,3706] Boston, MA BBA Technologies Download: CompuServe, FOXFORUM, Lib 15, File TTRAK.ZIP. Vendor: Rick Strahl I've been using Rick Strahl's terrific TimeTrakker and wanted to let others know about it. It does the important part of TimeSlips at a fraction of the cost *and* it's all in FoxPro, so you can modify it to do whatever you want. TimeTrakker records a log of your time spent on various projects, stores them in a DBF, and creates reports suitable for billing. DOS and Windows. Source code is a bargain at $30. 11. Book Review: Thumbs Down: "Developing FoxPro for Windows Applications". ----------------------------------------------------------------------- ReplyTo: Arnold Bilansky [71533,1031] (617)522-3700 x374 I love to recommend useful FP publications to folks and sometimes wonder if they expect me to recommend anything that comes down the pike. Well, in the case of "Developing FoxPro for Windows Applications" by Tony Lima, I say save your money. Tony Lima is wedded to the dBase flavor of xBase, including a fair amount of recycled dBase code. Page after page of advice I would avoid: o He recommends using the power tools for rough drafts and modifying the generated code. (Ouch!) o He incorrectly states that in order for a push button to be referred to by the character label that you have to modify the generated code. o His variable naming conventions wastefully use 3 characters to do what [Flash] does in two. The second character is V for a single variable or A for array. The third letter is the data type or Y for an array (huh?). o There's a fair amount of near regurgitation of the reference manual. o He recommends using the SECONDS() function rather than the SYS(2) function, demonstrating that he is unaware of the bug in that function. o His own time calculation function is far from bullet-proof. o The treatment of event-driven programming is atrocious. It really boils down to a suggestion to read the manual. (Aargh!) o The coverage of SQL is next to nil. He does not seem to recognize the usefulness of SQL in conjunction with reports. o BTW Tony, it's MSGraph, FoxGraph was a different product. In short pass over this one to stay with Goley's "Creating FoxPro Applications", Slater & Arnott's "Using FoxPro 2.5 for Windows", Griver's "FoxPro Codebook 2.5", and Hawkins' "FoxPro 2.5 Programmer's Reference". Stay tuned to Addison-Wesley, however. They have a new trade computer books editor who has contracted projects by some of our favorite FP personalities. 12. BCNN Statement of Ownership, Copyright, and Responsibility. ---------------------------------------------------------------------- The BCNN Newsletter is sponsored by the Foxpro User Group of the Boston Computer Society. BCNN is dedicated to keeping professional database developers (both consultants and corporate employees) informed about educational events, meetings, job openings, world events, notable articles, technical tips, new and 'must have' products, etc. As an electronic network BCNN is also a hub where developers can address world class issues with fellow developers around the world. Recipients agree to respond via Email to periodic polls of their directions, opinions, and needs. For those who do not have User Groups in their areas, BCNN is a vehicle for individuals to volunteer and contribute to something larger than themselves. Over 5,400 persons world-wide participate with CA-Clipper and Microsoft Access. Over 2000 persons have already requested the Foxpro Version. The newsletter is distributed monthly by electronic mail via CompuServe, Internet, FidoNet, and other electronic gateways. It is free of charge to individual developers. Modest fees are charged to corporations for job placement and third-party announcements. Opinions expressed are solely expressed by the Foxpro User Group or the author found in the ReplyTo of the article. The Boston Computer Society, even in cases where 'Xbase Language Group' is abbreviated to 'BCS', is not responsible for the content of this publication. No warranties are made by the authors, editors, the Foxpro User Group or BCNN regarding the accuracy or applicability of the information provided in this newsletter, nor are the above named parties responsible for direct or incidental damages due to your use of this information. All materials are copyrighted by the BCS, unless otherwise indicated, and free for any user group to redistribute on their own BBS on the condition that a by-line referencing the BCS is included. Associate Editors: ---------------------------------------------------------------------- David Rose, Days (508)538-8064, Eves (617)935-6843. CIS:73164,2263 Internet:73164.2263@CompuServe.Com Arnold Bilansky Days (617)522-3700 x374 CIS:71533,1031 Internet:71533.1031@CompuServe.Com Submissions. ---------------------------------------------------------------------- Send submissions to 73164,2263 with the subject "BCNN Foxpro Submission". Format your submissions similar to this letter. Distribution and Subscription Services. ---------------------------------------------------------------------- Les Squires, Director, Xbase Language Group. bcnn@World.Std.Com 73020,3435 Add Subscribers: @BCNN@FoxYes to bcnn@World.Std.Com. Delete Subscribers: @BCNN@FoxNo to bcnn@World.Std.Com. Back Issues: (to be announced...) Boston Computer Society, Inc. 101 First Avenue Suite 2 Waltham, MA 02154 617-290-5700 General Number 617-290-5700 Ext. 432 for up-to-date meeting information. BCNN Email Services donated by Word Jenny Inc. LSquires@World.Std.Com (c) 1994 Boston Computer Society, Inc.