====================================== FoxPro Developers Network of San Diego ====================================== FoxDev TipsLetter #99-7 July 5, 1999 Website: Editor: ---------------------------------------------------------------------- CONTENTS: * Calendar * What happened to issue 6? * Eric Does Builders Dan Covill * Tech Tips: Service Pack 3 Rick Bean VFPCOM.dll Jim Slater Backup Done Badly George Sexton * Other Stuff: Installing W2K - Victory! Dan Covill W2000 first impressions Dan Covill Consulting Solutions Group * Administrivia ====================================================================== CALENDAR: We are now alternating meetings between Escondido and Sorrento Mesa. All meetings are at 7:00 pm. July 7 Sorrento Mesa Barbara Peisch will report on what happened at DEVCON August 4 Escondido John Little of Microsoft will give an overview of SQL 7. Sept 1 Sorrento Mesa Claude Nikula will demonstrate managing SQL Server 7.0 from VFP. Escondido meetings are at Bergelectric, 2222 Meyers Avenue. Take the Nordahl exit from Highway 78 (west of I-15). Head South. Right on Meyers Ave, first right past Mission. It's a one-story building on the right (there's no sign). Sorrento Mesa meetings are in the PS Business Center, 6450 Lusk Blvd. From the Lusk Blvd driveway, go straight back to the furthest corner of the rear bldg and park. The conference room is upstairs over the Fitness Center. ---------------------------------------------------------------------- WHAT HAPPENED TO ISSUE 6? You may have noticed that the last issue was 99-5, while this one is 99-7. What happened to 6? Well, I've been numbering them as the month I published them, which led me to put out Issue 5 on May 32nd. This one would have been June 35th, which no longer qualifies as an extraordinary circumstance. So, like the 11 calendar days in 1782, Issue 6 just got skipped. Dan Covill ---------------------------------------------------------------------- ERIC DOES BUILDERS review by Dan Covill At our June meeting Eric Lendvai presented his implementation of VFP "Builders", which are really just programs that run at design time to help with the dogwork of filling in all the PEMs the way you want them. Eric found out that (a) the builders that come with VFP don't do what he wants [not a surprise! DC], and (b) you don't have to "register" builders in the standard VFP mechanism in order to use them. He solved the first problem by writing his own, one for (almost) every class he regularly uses. Eric's approach greatly reduced the number of classes he maintains, because the builder takes care of generating most of the variations he needs. For example, if he uses three basic variations on a query form, instead of creating three sub-classes in his library he puts the choices on his builder's screen instead. When he checks the one he wants, the builder does the job. His class library is smaller and more work gets done at design time, so his apps are smaller and run faster. Eric considers registering builders as a complication to be avoided if possible. He found that all you really need is to be able to execute a VFP program at design time with the objects selected. He did this by implementing a shortcut thru the F4 key. Pressing F4 runs a program that (a) figures out what objects (on the designer screen) are selected and (b) runs the appropriate builder. If it's a single object, the builder for that class runs. If there are multiple objects, then he can choose between special purpose "builders" that do things like adjusting size, alignment, and spacing. I found this presentation really encouraging. I like simplicity, which is in critically short supply in current Microsoft tools. Eric has created a very pragmatic tool to do what needs done without buying in to all the claptrap. I'm still waiting for him to put a sample on the website (You don't want me to have to do it all from scratch, do you, Eric?). ====================================================================== TIPS ====================================================================== VISUAL STUDIO SERVICE PACK 3 by Rick Bean, Mid Michigan Fox User Developer Group from "Fox Footnotes", Rocky Mtn Fox User Group Microsoft has just released visual studio SP #3. The good news is that this time there are actually fixes to VFP 6.0. The better news is that they've actually separated out the VFP patches from the other VS products (well, actually VfP shares with Visual InterDev and Visual J++, but that's better than with Visual Basic!). The bad news (?) is that the patch comes in seven pieces and totals over 68 Mb - you'd better have a fast I-Net connection, [a lot of] patience, or plan on waiting for the CD. You can start by going to and following the links to first read about all that was fixed and then on to the download area. From the Microsoft web page: "Visual Studio 6.0 Service Pack 3 (SP3) provides the latest updates to Microsoft Visual Studio 6.0 development system and its component products. Service Pack 3 is recommended for all Visual Studio 6.0 tool users, and is currently available for customers to order on CD or download. What Products does Visual Studio 6.0 Service Pack 3 cover? Service Pack 3 includes all of the fixes in Service Packs 1 and 2 and fixes for the following Visual Studio applications: Visual Studio 6.0 Visual Basic 6.0 Visual C++ 6.0 Visual FoxPro 6.0 Visual InterDev 6.0 Visual J++ 6.0 Visual SourceSafe 6.0 In addition, this service pack includes updated or upgraded versions of: Microsoft Data Access Objects Microsoft HTML Help Microsoft Data Access Components (MDAC) Microsoft Scripting Microsoft OLE Automation ---------------------------------------------------------------------- VFPCOM.DLL RELEASED By Jim Slater, VP Rocky Mountain FoxPro Users Group from "Fox Footnotes" A new enhancement to VFP 6.0, VFPCOM.DLL, is now available for download on the VFP Web site at: This COM server extends VFP's functionality in two areas. First is the ability to convert VFP cursors to ADO recordsets (the .CursorToRS() method), and ADO recordsets to VFP cursors (the .RSToCursor() method). Microsoft has stated that the future of data access in MS products is ADO and OLEDB (at least until they invent some new acronyms!). VFP developers new to ADO should feel at home in no time, since ADO techniques for accessing and updating data parallel those available natively within VFP. AS we all know, however, no other language matches VFP's ability to manipulate data. VFPCOM.DLL allows us to create cursors using the full power of VFP, then convert them to ADO recordsets in a flash with a single method call. Ken Levy provided a VFP-to-ADO conversion utility several months ago at his web site . This new component packages his ideas into a Microsoft-supplied component that runs at the C++ speed of a dll. In addition to ADO conversion, VFPCOM.DLL provides us with an event-binding capability previously unavailable in VFP. When designing a COM server, the programmer may wish to alert the host application when a certain event has occurred. For example, ADO supports the following methods to notify the host that data has been received or changed: FetchProgress, FetchComplete, WillChangeRecord, RecordChangeComplete, WillChangeField, FieldChangeComplete. If the COM server made calls to specific methodis in the host to alert it to these events, it could not be used with host applications that did not include these methods. For example, VFP does not have a RecordChangeComplete() function or method, so an attempt by a COM server to [call this function] would generate an error. Without knowing in advance whether a host includes a given method, how can a COM server be designed to notify its host when something happens? The solution is to include a "Raise Events" capability in the COM server. This allows the component to send out a signal saying in effect, "If you are interested, the following just happened; if you're not, don't bother." Unlike a direct method call, raising an event not supported by the host application will not generate an error. While VFP does not allow us to raise events, other languages such as VB and VC++ do. Until now, VFP also was unable to respond to events raised by COM servers. VFPCOM.DLL solves this by introducing a new BindEvents() method. This allows us to create a VFP class with method names identical to one or more of the COM server's event names, then "bind" an object based on that class to a COM server. If the COM server raises an event that corresponds to a method in the VFP host object, the VFP host object's method is called. For example, you could design a class with .RecordChangeComplete() and .FieldChangeComplete() methods, instantiate it, and bind it to an ADO recordset. Your object would then be alerted by ADO whenever a field or record in the recordset is changed. VFPCOM.DLL comes with a very limited help file. [Note: As far as I can tell, VFPCOM is NOT included in SP3. DC] ---------------------------------------------------------------------- DATA BACKUP PRACTICES or Backup Your Data Before "He's dead Jim" happens to you. By George Sexton, Rocky Mountain Fox User Group It seems like I hear about data loss disasters either first-hand or second-hand almost every month. While everyone pays lip service to the idea of backing up their data, I have found that very few companies really do it well. Here are just a few of the cases I have seen lately. Case #1: A small hospital in Nebraska suffered a Novell server crash. When the server crashed, their FoxPro DBF files were corrupted. When they attempted to do a restore, the backup software truncated their existing data files. The data tapes were sent to a data recovery house which informed them that the tapes were blank. What had happened was the hospital had replaced their old tape drive unit and software with a newer one. Unfortunately, no one had ever tested doing a restore with the new unit. Fortunately for the hospital, they still had the old tape drive unit and backup tapes. As a result of this failure, this hospital lost 6 weeks worth of data from their system. The cost in terms of labor was probably in the tens of thousands of dollars to re-enter the data. Lessons Learned 1) Before doing anything, back up the data that you have left onto at least 2 media before trying to repair or restore the data. Preferably, zip the data up on to another hard drive. 2) Periodically test doing a restore. If possible, test a complete restore of the data. 3) Keep old backup units, software and tapes around for a while. Don't just throw them out the minute they are replaced. Case #2 A computer manufacturer called in a panic. Whenever they tried to access their FoxPro application they got the infamous File xxxxx.dbf is not a FoxPro DBF message. My initial thought was to run a header repair utility and fix the file. However, when I looked at the file it showed a length of 0 bytes. The customer had been having trouble with a RAID array on the server and it looked like it had been the culprit. At this point the customer wasn't worried. He thought we could restore the data from tape. When I looked at the tapes, I found that the application data had not been backed up because the files had been held open by the application. One of the users, not knowing any differently had always left the application running on his desktop. When the backup program ran, the files could not be backed up. The customer was also using an extremely poor tape rotation system. Essentially, he only had two weeks of data. Fortunately for that customer, someone had made a copy of the data 6 weeks earlier and stored it on a zip drive. Lessons Learned 1) Review your backup logs and make sure your data is really getting backed up. If possible automate the log scanning process and have the results sent via email to the administrator. 2) If your backup software doesn't support backing up open files, you may want to investigate software that can. 3) Use a good tape rotation method. Saving a few hundred dollars on tape purchases isn't worth the risk of losing data. The rotation I recommend is this: Week # 1 Monday Differential Backup to Daily Tape – Set 1 Tuesday Differential Backup to Daily Tape – Set 1 Wednesday Differential Backup to Daily Tape – Set 1 Thursday Differential Backup to Daily Tape – Set 1 Friday Complete Backup to Weekly Tape Week # 2 Monday Differential Backup to Daily Tape – Set 2 Tuesday Differential Backup to Daily Tape – Set 2 Wednesday Differential Backup to Daily Tape – Set 2 Thursday Differential Backup to Daily Tape – Set 2 Friday Weekly Tape Week # 3 Monday-Thursday Differential Backup Overwrite Daily Set 1 Friday Weekly Tape Week # 4 Monday-Thursday Differential Backup Overwrite Daily set 2 Friday Weekly Tape You should have at least 5 Weekly tapes in the rotation. Once you have 5 weekly tapes, overwrite the oldest weekly tape on the next weekly backup. The last weekly tape of each month should be saved for at least one year. You might want to just save the last weekly backup of each month forever. Using this rotation method the total # of tapes required for one year is 25 tapes. Once started, this rotation only requires purchasing one additional backup tape per month. Case # 3 A customer called and said that their RAID array had gone down, crashing their SQL database. Fortunately for the customer, the system went down 10 minutes after the last backup had ran. If the array had crashed 6 hours after backup, the results could have been much worse. Lessons Learned 1) Don't believe that redundancy features in hardware will protect you from data loss. As often as not, data loss is caused by a failure in the application software or Network Operating System. In this case, their redundancy hardware just plain failed. 2) If you are doing disk dumps of a SQL database, make sure that you get those dumps on tape as fast as possible. Alternatively, do your disk dumps to a separate physical drive. 3) If your SQL database supports transaction logs, make sure those transaction logs are stored on a different physical device. Case # 4 This is one I heard from Jim Slater of the RMFUG. The story goes that a customer's Novell server crashed and the hard drive was unreadable. When they went to restore from their backup tape they found that the tapes were all blank. The tape drive unit was on a workstation that was used by someone who came in early each day. When she arrived for work each day, the backup software displayed a fatal error message. Since it wasn't her responsibility and she had no training on performing backups she clicked on the cancel button and went on with her day. The drive was sent to a data recovery house and the data was recovered at the cost of several thousand dollars. Lessons Learned 1) The person responsible for performing backup has to be responsible for checking that it works correctly. 2) When all else fails, data recovery companies can often retrieve lost data. Reading these case studies, I find that in every instance the customer thought they were adequately safeguarding their data. In most of these cases, data loss could have been prevented by simply checking the backup logs and performing a test restore. In the case of the SQL database, data loss could have been prevented by following the manufacturer's recommendation of using transaction logs stored on a different physical device. Epilog: Data loss happens every day. The statistics are pretty numbing. In most cases, a company suffering complete data loss will go out of business in 90 days. As an IT professional it is your responsibility to help safeguard this data and prevent it's loss. If you are a corporate developer, and not personally responsible for backup of your network you might want to think about making your own private backup of the data on a regular basis. You never know when it might come in handy. If you are a consultant, you should work with your customers to make sure their backup system is working correctly. I know from personal experience that telling someone their data is irretrievably lost isn't much fun. It's a much more pleasant experience to tell the customer that everything is going to be OK. If you want to be able to do that you need to take steps now so that you aren't the one saying "He's dead Jim". George Sexton is owner of MHSoftware and a Microsoft MVP. He can be reached at: . ====================================================================== OTHER STUFF ====================================================================== INSTALLING W2000 - VICTORY AT SEA! Last month I chronicled my first attempt at installing Windows 2000 Beta 3 over NT 4.0, which ended four hours later in a BSOD (Blue Screen Of Death) when Setup tried to detect the serial mouse! By Thursday I had recovered enough (psychic) strength to take another stab at it. Saturday, June 5: 8:50pm My plan is to put NT 4.0 back, remove the Logitech mouse drivers, and then try W2000 again. Running in Windows 95, put in my NT 4.0 CD, select "Repair Damaged Installation", insert the Emergency Repair Disk (from 1997, but what the hell) and let it run. Reboot. The boot selection shows NT 4.0, Windows 95, and W2000, then loops. Endlessly. Display choices, wait 3 seconds, blank screen, display choices, ..... 9:00 Remove the BOOT.INI (possibly corrupt?), and do it all again. New BOOT.INI shows only NT 4.0 (Win 95 has disappeared), but it still loops. Try it again, starting from the NT Setup floppies. It loops. Time to quit and sleep on it. ------------ Friday, 10am Try "Repairing" without the ERD. It says "Can't find an NT 4.0 to fix." Now there's some cheery news. Use the ERD, restoring the hardware registry only (I'm still trying keep my installed applications). Reboot. Crashes with an error message I01_INITIALIZATION_FAILED, that refers me to the W2000 documentation! And I can't boot into Win 95 any more because it has disappeared from the boot table. 10:15 Try again, restoring all the registries. Same failure, same message. The poltergeist of W2000 is still in there, somewhere, laughing at my efforts to exorcise it. 10:45 Patch BOOT.INI, putting Win 95 back in by hand (I had kept the original one, so I had something to copy). Now Win 95 will boot, and my system is back up. But the clock is now 5 hours fast! ??? Try NT 4.0 Repair one more time, now that we have a good BOOT.INI. I01_INITIALIZATION_ERROR. Starting to look like reformat time. Since I can't get NT 4.0 back, I think I'll try W2000 again (a clean install this time). If I'm going to reformat anyway, what do I have to lose? 11:45 Copying... 11:51 Restart. Loading files.... 11:54 Pick a partition. Copying.... 12:04 Reboot. Pretty screen. Please wait... 12:12 Setup Wizard. Wait while Setup detects your yada yada yada.... 12:30 Customize for Locale. A new window! We're past the hang! Set time, Install Networking, Registering components... 13:03 Reboot... 13:10 Ta-Daa!! VICTORY! IT'S UP! IGNORAMUS VINCIT OMNIA! 14:00 Horror! Return from lunch/bathroom break to find the screen black. Not even a BSOD, just plain black. What on earth has happened? Hit a couple of keys, and after about 3 or 4 seconds the desktop reappears. It's just a black screen saver. Actually, it's W2000 PNP detecting that my monitor is energy-compliant and turning it off after 20 minutes. But I damned near had myself a heart attack. Well, it's up. It's recognizably Windows, but really QUITE a bit different from NT, even after you turn off the stupid Internet windows. But I'll write about that later. I don't have any applications, of course, but it does boot pretty quickly. Shutdown took only 10 seconds. Power-on boot took 2:05 to the full desktop, including network connections, which I thought pretty good. And it only takes up 594 megabytes! So what do we learn from this exercise? (Notice how my mood changes; on Tuesday it was a catastrophe, now that I've got it to boot twice it's an "exercise".) First, that upgrading an existing installation is a lot more complex and problematic than doing a clean install. Second, that like everything else Microsoft, if you use their defaults things go pretty well; if you try to do anything else you're on your own. And when it doesn't work there's no clue as to why not. Also, if you're installing it on a dual-boot machine, the clean install is the only option that let's you pick where to put it. I had no input whatsoever as to which operating system it set out to upgrade. It did pick the one I wanted, but entirely by luck. More later. Right now I've got to install some of my stuff and start turning off a few dozen "features" I don't want. ---------------------------------------------------------------------- WHAT'S NEW IN WINDOWS 2000? Dan Covill June 7, 1999: I've only had W2000 running for a day now, but I want to capture some first impressions before I begin to get used to things, and in particular before I change a lot of the default settings (which I am definitely going to do). It's BIG!!. The WINNT\SYSTEM32 directory alone has 1507 files for 235 Mb! The WINNT total is 594Mb. And I don't have any applications installed yet. It definitely looks different, even after you reset the stupid Internet-style windows. Almost everything is a little different from 4.0 and isn't quite where you expected to find it. The NotePad default font is weird. Lucida Console Bold!! The digits are noticeably taller than the letters. My DOS boxes with full screen selected come up in 53-line mode. Haven't figured out how to fix that yet. Let's look around a little... THE DESKTOP: ------------ Microsoft continues to innovate - the recycle bin is now oval. Default icons are: My Documents (ugh!) My Computer My Network Places (double ugh!) Recycle Bin Internet Explorer (IE5, by the way) Outlook Express Connect to the Internet Interesting. If you click on an .htm file, IE5 comes up to display it, but when you try to run IE5 itself it demands that you run the Internet Connection Wizard first. Since this machine isn't on the Internet yet, I added a "Microsoft Crap" folder to my Start Menu, then moved Internet Explorer, Outlook Express, and Windows Update into it. They're out of my hair now. THE START MENU -------------- Lots fancier, with many more properties. You can add toolbars and diddle with the tray. The first thing on the Start Menu, above Programs, is called "Windows Update". If you click it it demands that you run the Internet Connection Wizard. "Programs" is now arranged as follows: Programs +- Accessories | +- Accessibility | | (including a pretty neat magnifier feature) | +- Communications | | Hyper Term | | Internet Connection Wizard | | Phone Dialer | +- Entertainment | | Media player, sound, etc. | +- Games | | FreeCell, Minesweeper, Pinball, & Solitaire | +- System Tools | | Backup | | Character Map | | Disk Cleanup | | Disk Defragmenter * | | Getting Started | | Scheduled Tasks | +- Address book, calculator, etc. * | +- Command Prompt * | +- Synchronize | +- Windows Explorer +- Startup (empty) +- (your applications) * Getting Started is the same (rather nice) tutorial that appears when you boot, but why they buried it down in the system tools is beyond me. You'll need it to figure out how the options and toolbars work. * The Command Prompt (DOS prompt) is now under Accessories, and the icon is a black box with a C:\ prompt in it. * Synchronize replaces the old Briefcase, and is designed to keep exported directories up to date. Could be useful, we'll see. DIRECTORY STRUCTURE: -------------------- There's been a lot of shuffling here. 1. The Control Panel now lives directly under My Computer, but is still accessed thru 'Settings' on the Start menu. 2. The Start Menu is no longer under WINNT\Profiles, but under a root node directory called 'Documents and Settings'. There are a minimum of three entries; one for All Users, one for you yourself, and one for Default User. The one for you used to be called 'Administrator', now it has the name you entered during setup. The structure looks like this: \Documents and Settings (in the root directory) \All Users \Desktop \Dan Covill \Desktop \Default User I think the Default User is just a template for creating new individual entries. What actually appears on the Start Menu is a combination of the entries in All Users and Dan Covill. If it's anything like my experience with NT 4.0, there is no telling where any given application will choose to put its entry. 3. The 'Network Neighborhood' is gone (small loss) but is replaced by the even uglier 'My Network Places'. This in turn has something called 'Computers Near Me', which appears to be the members of your workgroup. Somebody with oatmeal for brains has been naming this stuff. They should stop him before he hurts himself. Miscellany: ----------- Sub-folders now open in the same window by default. Good. There are a LOT more View options, including customizable toolbars on practically everything. Haven't figured them out yet, but they look interesting. Shortcuts have tooltips, which you can set. Neat! Making an Emergency Repair Disk (ERD) is an option on the Backup program, not a separate program. It's very easy, tho. There is something called a "Trouble Shooter", which is better than before but still assumes you're an idiot. Login is automatic by default (i.e., you don't have to type your password (or press Enter) every time). Dan Covill ---------------------------------------------------------------------- SOLUTIONS CONSULTING GROUP Solutions Consulting Group, at 6540 Lusk Blvd, is the host for our Sorrento Mesa meetings. But who are they, and what do they do? "Since its inception in 1993, Solutions Consulting Group has grown to more than 40 employees with over 65 active clients throughout Southern California. We are a Microsoft Certified Solution Provider Partner and a member of the Oracle Business Alliance Program." They do: Corporate Application Development Data Warehousing Network Services They work in FoxPro, VFP, VB, Access, SQL, and Oracle. They are looking for more employees and they do use contractors as well; contact Armando Andrade at if you're interested. For More Information... --------------------------Administrivia------------------------------- This newsletter is a service to members of the FoxPro Developers Network of San Diego (FPDN). The editor (Dan Covill) is solely responsible for the content, Barbara Peisch does the distribution. E-mail the editor YOUR tips, comments, complaints, and rebuttals. Editor: Dan Covill 619-272-2448 Board of Directors: Eric Lendvai - President 760-439-6617 Art Bergquist - Vice Pres 760-740-0428 Claude Nikula - Secretary 619-615-6318 Barbara Peisch - Treasurer 760-729-9607 Randy Barber - Director 619-670-7542 Steve Settimi - Director 619-262-5883 ----------------------------------------------------------------------