====================================== FoxPro Developers Network of San Diego ====================================== FoxDev TipsLetter #00-04 March 30, 2000 Website: Editor: ---------------------------------------------------------------------- CONTENTS: * Calendar * Tech Tips: Setup Weirdness Resolved Mike Copeland & Matt Galloway Dependency Walker ToolTips on Folders Dan Covill DateTime in Queries Dan Covill FoxBot Code Library Where Do I Find...? * Other Stuff: Changes at FoxPro Advisor Barbara Peisch You Assume Too Much Dan Covill Interview with Alan Cooper San Jose Mercury Mommy, I'm Scared Consulting Solutions Group * Administrivia ====================================================================== CALENDAR: We alternate meetings between Escondido and Sorrento Mesa. All meetings are at 7:00 pm. April 5 - Sorrento Mesa ----------------------- Eric Lendvai will be showing us a tool he uses to export VCX classes to code. Eric has found that PRG based classes run significantly faster than VCX based classes. Of course, designing visual classes in a PRG is difficult. With this tool, you can have the best of both worlds. May 3 - Escondido ----------------- Kristyne McDaniel will be showing us how to implement configurable toolbars. June 7 - Sorrento Mesa ---------------------- Tim Daly will be showing us "more SQL Server stuff, and using the VFP upsizing wizard, along with ADO, and ASP.", and probably some OLE automation. 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. ====================================================================== TIPS ====================================================================== SETUP WEIRDNESS RESOLVED by Mike Copeland and Matt Galloway The Visual Foxpro 6.0 Setup wizard has some undocumented behavior that you should be aware of. While this behavior is not wrong, if you aren't aware of it, you might get tripped up. -Problem- After running SETUP on an end-user PC, you may notice that some files were not copied from your Setup discs to their hard drive. Specifically, this pertains to the EXE, DLL, and FLL file types. -Why- Windows-style internal version numbers are not stored in 16-bit program files, including program files generated by Visual Foxpro 3 and any executables that are compatible with Windows 3.1. On the other hand, when 32-bit application files that adhere to the Windows standard are compiled, they always have internal space created for version numbers. The Setup application that Visual Foxpro 6 creates, (via TOOLS / WIZARD / SETUP in Visual Foxpro), checks for these internal version numbers when your end user runs Setup from your installation disk(s). While not documented anywhere we could find, it seems that the version numbers for both existing and to-be-installed files are collected during Setup. These version numbers are matched according to file names, compared, and the highest version number wins; that file is either retained or copied to the destination disk. Note that the file date and time stamp and the file size do not seem to be considered. If the file does not exist, the new file will always be installed. If a 32-bit file does not have a version number, it appears that Visual Foxpro considers it as having a version value equivalent to 0 and compares values accordingly. -Fix- Since there is no way to instruct Setup to delete or ignore a file you intend that Setup should replace, the only solution is to always increment your application's version number to a higher value. Failure to do this will cause SETUP to skip overwriting the old file that already exists on your end-user's hard drive with the new one you sent them on disk (and that you probably intended to have serve as an update.) You'll notice that the version number, entered from within Visual Foxpro via the PROJECT / BUILD / VERSION menu options, is numeric only. This non-alpha restriction for the version number reinforces the above understanding of the way Setup works. -Other Observations- This also means that your end user will have to manually delete a corrupted EXE, DLL, or FLL file before running Setup. A corrupted file might still have enough information in the header to provide a version number, but not execute properly. And, while the Reinstall feature is promising, we have found that Setup's -Reinstall/Remove- functionality is sometimes hit-or-miss. Sometimes when you run Setup (and the application is already installed), it may or may not offer the Reinstall option. Something as simple as hitting escape during the Reinstall routine will cause the Reinstall option to not be offered the next time you run Setup. I'm sure there is a perfectly good explanation for this behavior, but it is hard to explain to end users. Sending update discs containing your Visual Foxpro 6 application is still the easiest and least expensive way to distribute your programs. But, making sure you use, and increment, the version number of your application is more than just a good idea, it's required...or you may not get what you expect. Mike Copeland is an independent FoxPro developer (Genesis Group Software) in Bartlesville, Oklahoma. His Fox credentials go back to being Technical Editor for Y. A. Griver's "The FoxPro Code Book", which preceded the Codebook framework. Matt Galloway is Directory of Technology at ODEN Insurance Services, Inc. They are in Tulsa, Oklahoma, and market FoxPro applications to the insurance industry. ---------------------------------------------------------------------- DEPENDENCY WALKER by Dan Covill Found this gem in one of the newsletters I get. <> Dependency Walker v2.0b5 [409k] W9x/NT FREE http://www.dependencywalker.com/ http://www.dependencywalker.com/depends20beta5_x86.zip "Dependency Walker is a free Microsoft utility that scans any 32-bit or 64-bit Windows module (exe, dll, ocx, sys, etc.) and builds a hierarchical tree diagram of all dependent modules. For each module found, it lists all the functions that are exported by that module, and which of those functions are actually being called by other modules. Another view displays the minimum set of required files, along with detailed information about each file including a full path to the file, base address, version numbers, machine type, debug information, and more." [It's a 420k download. YOU NEED THIS PROGRAM!! DC] ---------------------------------------------------------------------- TOOLTIPS FOR FOLDERS by Dan Covill I remember that a few months ago we were discussing the problems of keeping track of what's in all those directories on the hard drive, and I said "What I'd like to see is ToolTips on the Folders." If the folder name is IBX31, you could hold the mouse over it and see that it was "Ibex Corp's software for 31-bit mouse reversers" or something like that. Well guess what, you can do it! The following technique works in Windows 98 and Windows 2000; it doesn't work on NT 4.0 or Win 95. The first thing you have to do is create a "desktop.ini" file, in the directory itself. Using any text editor (NOT a Word processor), enter the following: [.ShellClassInfo] ConfirmFileOp=0 InfoTip=This is the tooltip I want displayed The other thing you have to do is make the directory itself a System file, so the desktop.ini will be examined. You can use Explorer ("properties") to see whether it's a system file, but you can't set it from there. Open a command window (Start | Programs | DOS), and enter the command: attrib +s "C:\program files\IBX32" (or whatever) ** You have to use quotes if there is a space in the pathname. Exit back to Windows, Explore, and hover your mouse over the folder. Voila! (It works in either the regular or Explore view, but not in the Explore's treeview frame.) Side effects: The ConfirmFileOp=0 entry allows you to delete the folder without worrying about the System attribute. Another setting you can add to Desktop.ini: IconFile=ThisFolder.ico IconIndex=0 This will use your ThisFolder icon instead of the Windows default. If you "customize" the folder with the Customizing wizard, it will build a desktop.ini. You can just add your InfoTip to it. Reference: Microsoft Knowledge Base, "Shell Basics" ---------------------------------------------------------------------- DATETIME IN QUERIES by Dan Covill DateTime variables, introduced with VFP, provide a more complete "timestamp" facility, but add some complications to queries and other comparisons. Oracle databases in particular use DateTime variables almost exclusively. Problem: how do you select a date or date range when the variable is a DateTime instead of a simple date? For most queries you're selecting on date and don't care about the time, but you can't ignore it because it affects your comparisons. For example, if: Record 1: DayTime = {02/25/00 08:30:00 am} Record 2: DayTime = {02/25/00 05:00:00 pm} then SELECT * WHERE DayTime = {02/25/00} returns nothing, because the default comparison is to midnight. ** How Microsoft decided midnight was 12 am is beyond me! In other words: {02/25/00} in datetime is {02/25/00 12:00:00 am} so the comparison fails because the times are not equal. And watch out for SELECT * WHERE Daytime BETWEEN {02/25/00} AND {02/26/00} which will pick up extra records if there are any for the 26th with a time stamp of midnight! The only good solution is to generate specific datetime variables for the comparisons. There are several conversion functions: CTOT() converts the string to datetime TTOC() returns the string equivalent DTOT() returns the date plus midnight TTOD() returns the date only Again, watch out! ctot('02/25/00') gives 12:00:00 am (midnight) but ctot('02/25/00 12') gives 12:00:00 pm (noon) Recommendations: 1. Get rid of the am/pm garbage so you don't have to remember which is noon and which is midnight. SET HOURS TO 24 and then: CTOT('02/25/00') gives 02/25/00 00:00:00 CTOT('02/25/00 12') gives 02/25/00 12:00:00 which is a lot easier to keep straight. 2. Use date or time arithmetic to get the exact range you want. {02/25/00} is BETWEEN {02/25/00 00:00:00} AND {02/25/00 23:59:59} dtot(date()+1)-1 is {02/25/00 23:59:59} (Note that datetime arithmetic is in seconds, not days. i.e., {02/25/00} + 1 is {02/26/00}, but DDTOT({02/25/00}) + 1 is {02/25/00 00:00:01} Assume you need to query DayTime on the date range D1 to D2, here's the code to use: SET HOURS TO 24 T1 = DTOT(D1) && D1 at 00:00:00 T2 = DTOT(D2 + 1) - 1 && D2 at 23:59:59 SELECT * FROM ... WHERE DayTime BETWEEN T1 AND T2 The "set hours to 24" won't change the operation, but it will make it easier to interpret any diagnostics you get. In fact, I recommend you set HOURS to 24 by default, then change it to 12 ONLY when necessary for display or reporting purposes. ---------------------------------------------------------------------- FOXBOT CODE LIBRARY Michael Oke [From the ProFox forum, by permission] I have set up a web page for sharing snippets, code and whatever. To see the listing of available files: For the moment, this will be a fairly simple listing of submissions and links to the same. To make a submission send an e-mail to: Attach your code as an attachment (zip preferred) and include a file named: DESCRIPT.TXT (case does not matter). this file will be striped out of the zip and used in the file listing for people to find what they are looking for. Please place the version (of FoxPro) that your submission applies to in the subject of the mail. When you make a submission you will receive a reply from the FoxBot telling you that your email has been received and will be posted to the web site. Once the file is available to all, an email will be generated by the system to the list telling them of the new addition and where it can be found. I hope that this small contribution will help all of us who develop on this platform to exchange the bits of code that has made our lives easier. Please don't hesitate to let me know if you have an idea to make this work better/faster/easier. Michael Oke, II Oke Industries michaelo@okeindustries.com Our business is bound by our committment. [Michael has kindly offered access to the library to all FoxPro developers, not just those on the ProFox forum. DC] ---------------------------------------------------------------------- WHERE CAN I FIND...? A (semi) permanent list of places to look for technical help when you get blind-sided by the latest urgent requirement. We don't give specific URLs for MSDN articles because (a) they're too long and (b) they change too often! MSDN ON LINE: There's a ton of stuff here, look at the Magazines tab, and read some of the regular columns. MSDN Library Look in Technical Articles | Visual Studio | Visual FoxPro Three-Tier Apps: MSDN Library: Building Three-Tier Client/Server Applications with Visual FoxPro MTS: Microsoft Transaction Server MSDN Library: Microsoft Transaction Server for Visual FoxPro Developers ODBC: MSDN Library: Using Visual FoxPro to Access Remote Data VS Installer: MSDN Library: a. "Using Visual Studio Installer for VFP 6.0 Applications" b. "VFP 6.0 and VS Installer Tutorial" Windows General XML - What's New in XML for Microsoft Windows 2000 [Contributions solicited. DC] ====================================================================== OTHER STUFF ====================================================================== CHANGES AT FOXPRO ADVISOR submitted by Barbara Peisch From: Tamar E. Granor Subj: FoxPro Advisor and me To: My friends and colleagues I want to let you know about a big change at FoxPro Advisor. For some time, the other Advisor publications have been operating on a model in which the Managing Editor holds the reins and there is no single outside Editor. Instead, several Technical Editors help the Managing Editor shape the technical content of the magazine. Now it's FoxPro Advisor's turn to make this change. Beginning immediately, Liz Olsen, the Managing Editor, will be in charge of the magazine and my role will change from Editor to Technical Editor. I think this change will be good for the magazine. I've enjoyed editing FoxPro Advisor all these years and have gained many valuable skills. Now I'm looking forward to having more time for development work and other opportunities. Tamar ---------------------------------------------------------------------- YOU ASSUME TOO MUCH by Dan Covill The foreword to a Microsoft article I didn't read: "The article assumes that you are familiar with ADO, OLE DB, COM, C++, and XML." [Sure, and pigs can fly, too! DC] ---------------------------------------------------------------------- TECHNOLOGY NEED NOT BE IMPENETRABLE Interview with Alan Cooper From the San Jose Mercury, 2/13/00 Computers and the Internet promise to invade every aspect of daily life -- which is fine if you know how to use them. But a lot of people don't. Alan Cooper, president of Cooper Interaction Design in Palo Alto, makes the consumer experience his business. A software designer and developer who has done consulting work for such companies as Microsoft, IBM and Sun Microsystems, he's the author of "The Inmates are Running the Asylum: Why High-Tech Products Drive Us Crazy and How to Restore the Sanity." Cooper met recently with Mercury News Staff Writer Jon Fortt. Following is an edited transcript of the conversation. Q Why is today's software so tough for many people to use? A Number one, it's tough to use because it's tough to use. A lot of people think that it's tough to use because they're dumb. Or it's tough to use because they're not computer-literate enough. Or, "Well, my kids, they know how to work computers. But not me, I'm just an old fuddy-duddy.' And that's just wrong-think. They're hard to use because people who don't care about you or me, or customers out there, are making hard-to-use Web sites and software services. The number one reason why they're making it hard to use is, they're not paying much attention as they create it. Q Really. Well, how is it built, then? A It's sort of like, we sit down and we figure out what would be a good building to create, and then we plan what it will look like, and then we build according to plan. The way we build most software -- and Web sites are software -- is we take our existing technology, our existing tools, and we use these as strong determiners of what will be, and then we go in, and we just sort of write code until we get something that kinda sorta does the job. And then afterward we go back and we say, "Are there any parts of this that are really, excessively painful? Maybe we can put some padding around them." But as an industry, we really don't think about what it is we're doing before we do it. We tend to jump in and do it. Q In your new book, you address software design as a safety issue. Can you explain what software has to do with safety? A My wife just bought a new car. It's a beautiful car, a Mercedes-Benz, and the car is a joy to drive. All that mechanical, industrial-age stuff about it has really been perfected by those German engineers. Then it has this console in the middle, and it's not one of those sophisticated, high-tech consoles. This one has a radio and a climate control system, and it's very unsafe. Because they did not do the kind of goal-directed design that we would do. Instead they have a whole series of buttons that are all the same shape, all the same size, all adjacent to each other. They're all black with a dark gray background, and they all have dark gray legends in 8-point type. And when you're driving along, the button that changes the radio station is right next to the button that turns the radio off. They're hard to distinguish. The problem is what the automobile designers call head-down time. There's a lot of head-down time in this beautiful car, to set the temperature right. And if you want to make the speakers in the back louder than the speakers in the front, you have to go through a hierarchical drill-down menu of buttons. It is absolutely not safe to do that when the car is moving. People do it now with cell phones. There are bumper stickers that say ``Hang up and drive.'' The safety issue is here, now, because computers are everywhere in our lives, and what's happening is they're really hard to use. Q You're known as "The Father of Visual Basic," which is essentially a set of tools developers use to create software applications. It's been 10 years since you handed Microsoft the backbone of the Visual Basic product. How do you think it has turned out? A You have to understand that I never worked for Microsoft. I was an outside guy, and I invented a product and sold it to Microsoft, and it was a visual programming language for end-users. There were reasonably computer-savvy end-users, circa 1988, compared to end-users of today. But I saw it very much as a thing for consumers, for people who wanted to get productive work done, not for people who wanted to build tools for other people to get productive work done. So I would say the big difference happened 12 years ago when I first sold it to Microsoft. They decided that the needs of humans were subordinate to the needs of programmers -- which tells you a lot about Microsoft, and tells you a lot about me. I was very frustrated about their decision. I wasn't happy with it. I came to peace with it because Visual Basic has done really well, and was a big success. A lot of people think, and Microsoft is happy to let them think, that all great things are invented by Microsoft. In fact, very, very little has been invented by Microsoft. What Microsoft is really good at is endlessly iterating and revving -- incrementally improving things that already exist -- and those things that already exist are generally acquired from the outside. Microsoft is famous, they're almost paradigmatic, for being the company that ships new products that are a commercial success, but generally not a critical success. So, for example, Microsoft Windows, when it was first shipped in 1986, was so bad that it was the laughingstock of the industry. And it took it five major releases to be considered not a joke. And most of their software is like that. ------------- "I don't know about you, but I get about 100 e-mails a day. And I cannot manage them. If I leave town like I did for the last three days to go to Palm Springs to this conference, basically I'm about 200 e-mails down, and it's going to take me days to dig out. I can't tell the difference between important e-mail and spam. I found a piece of e-mail the other day from a guy who sent me something that's really important about three months ago, and it fell through the cracks. I can't figure out how to manage my world, and I run my business on e-mail. So for the amount of time and effort, and the dependence we have on electronic mail, it's amazing to me the lack of innovation that goes into it. We have a lot of ideas on how to fix it. The problem is, of course, you don't dip your toe into the e-mail world, because you've got the 500-pound gorilla sitting there. I mean, I think it's a world where you can compete, but you don't do it with a start-up's budget." ---------------------------------------------------------------------- MOMMY, I'M SCARED Poor little Sarah. She's so confused! We're working to make it a simpler world by removing from the market companies that offer conflicting products that can confuse and befuddle unsuspecting children like Sarah. ... Someday, if we all work together, our children can look forward to using only Microsoft products on their computers. We can build them a wonderful Windows world. A better, safer world, where everything works the same. [from a poster by Chris Condon - www.dumbentia.com] ---------------------------------------------------------------------- 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 858-272-2448 Board of Directors: Eric Lendvai - President 760-734-4929 Art Bergquist - Vice Pres 760-740-0428 Claude Nikula - Secretary 619-615-6318 Barbara Peisch - Treasurer 760-729-9607 Dan Covill - Director 858-272-2448 Thad V'Soske - Director 619-544-9900 ----------------------------------------------------------------------