Level Extreme .NET Magazine April 2008 issue

Universal Thread Magazine March 2007 issue

2008
2007
2006
2005
2004
2003
2002

2006
2005
2004

2007
2006
2005
2004

2007
2006
2005
2004
2003

2007
2006
2005
2004
2003

2007
2006
2005
2004
2003

2004
2003
2002
2001
2000
1998
1997
1996
1993

2003
2002

2003
2001

2003
2002
2001

2003
2001

Visual FoxPro 2001
Visual FoxPro 2000
Visual Studio 2000

West Wind 2002
Double Impact 2001
FoxTeach 2001
Jam sessions
Technical Guidelines

Universal Thread documentation

About
Acronyms
Contact information
Troubleshooting
Time zones
Web Service
Terms & Conditions
Copyright

Manage your account for the messages area options, your subscription information, your invoicing, youir banners and your pictures Subscribe to the Universal Thread and get all the benefits related to the messages area A corporate subscription is needed for companies that have more than one developer Access the Universal Thread store to purchase your subscription, corporate subscriptions and banners The Universal Thread is covering several conferences per year. On site, reporters cover the technical aspect of the conference as well as making interviews, taking pictures and videos and other related content. Get all the reports from our coverages site. Universal Thread home page Level Extreme .NET Magazine, a newly published online magazine by Level Extreme about Microsoft .NET technology and its community Universal Thread Magazine, a magazine dedicated to the Visual FoxPro community Visual FoxPro DevCon 2003

Advisor Media presents the Visual FoxPro DevCon 2003 conference. It includes three days of technical education. Learn from the top experts. Collaborate with your colleagues from around the world. Maximize your time and travel investment and get exactly the technical training you need. Be part of the original FoxPro Developer Conference. Don't miss the Visual FoxPro Developer Conference 2003, the annual gathering of FoxPro developers from around the world. Visual FoxProDevCon is essential technical education for serious FoxPro developers. DevCon puts you face-to-face with the leading FoxPro experts, members of the Microsoft Visual FoxPro product team, and FoxPro professionals from around the world.

Date: 
Location: 

Sunday, June 15

Andrew MacNeill's Advisor JumpStart: Web Services

by Christopher Bohling

According to Andrew MacNeill, web services are very much like FoxPro functions. In fact, they can be VFP functions, as long as those functions are wrapped up in a COM object, the COM object is published to a Web site along with WSDL and WSML files, and the SOAP client (known as the WHOLEBODYWASH client in Southern California) is installed on the web service "consumer." In addition, Web Services messages are carried in XML over HTML on the Internet (which itself uses TCP/IP as its network transport mechanism.

This is not the end to what Andrew described as "acronym hell." XML files use the DOM, XML Document Model. The DOM can be used in combination with schemas internal to XML documents to find just what the document contains. According to Andrew, these properties (including collections) and methods are the keys to interpreting schemas and the XML data they define:

  • HasChildNodes
  • ChildNodes.Length
    • ChildNodes.Item(0)
    • NodeName
    • NodeType
    • NodeValue/NodeTypedValue
  • Attributes.Length
  • SelectNodes()

For Andrew, learning the ins and outs of the XML DOM is of paramount importance in becoming proficient with Web Services. He also made other important points:

  • VFP 8 is best for developing Web Services, and versions 6 and 7 can still consume those services.
  • Security is often implemented with encryption keys that are passed to the Web Service along with the other input parameters.
  • The keys would have to be passed every time, as Web Services are stateless.
  • Even if you are not able to deploy a Web Service, plain web pages can still be good sources of information.
  • The UDDI (a business-to-business integration effort using XML) and xMethods web pages offer examples of Web Service implementations, but the field as a whole.

Andrew closed on a positive note, paraphrased here: The most important thing is to learn the XML DOM.

When asked about the session, Erik Trutner of Oakland, California, said, "As a novice concerning Web Services I found Andrew’s presentation to be very informative and undoubtedly will be a great basis for my future work in Web development."

Ted Roche's Advisor JumpStart: Visual FoxPro Development

by Christopher Bohling

This reporter rushed to cover this session when it became clear that a group of other speakers had formed a baked goods terrorist group known as Al Cake-a that was intent on making Roche celebrate his birthday. After receiving his cake joyfully, Roche spent the last two minutes of his session presenting an exhaustive analysis of project management. (Parts of this story are made up.)

Rod Paddock's Advisor JumpStart: .NET for VFP Developers

by Christopher Bohling

Having established himself as a leader in the VFP realm, Rod Paddock is doing more work in .Net, including presentations. Paddock made a half-day seminar at the Essential Fox conference in Kansas City in April. (Note: my employing company sponsors that conference.) I had to miss that seminar because a client of mine had an issue that turned out to take four hours to resolve. Fortunately, I got to see Rod’s two hour presentation here at DevCon.

Those interested in .Net should also be sure to read Evan’s report on Kevin McNeish’s presentation, below.

Rod thinks that there are a lot of advantages to using .NET and the Visual Studio.NET editor. The error checking built into the VS.NET compiler is better, in part because variables are strongly typed. Debugging can go a step further than any VFP developer might try. Visual Studio can “attach” to a running a executable, even remotely, and monitor the executing code.

VS.NET contains more default controls, like the calendar control and a slider. Fewer controls need to be dug out of the depths of the Windows system.

Installation of the .NET runtime will enable a client machine for what is pretty much a copy and paste install of the DLLs created by the .NET compiler.

While FoxPro contains a mix of objects with “unaware” constructs like memory variables, in .NET everything is an object. This means that even variables contain their own properties and methods. Assuming that y is a numeric variable for which you want a character equivalent, instead of coding x = STR(y) in the VFP style, a .NET developer could use x = y.ToString. More methods could be added to the list, as well, such as a trim function. (For example, x = y.ToString.Trim. Best of all, each one of the available methods will appear in an Intellisense list.

More functions can be made available by adding a project “reference” to a solution. Many references can be retrieved from the Global Assembly Cache (GAC), but they can also be from a custom project or third party tool.

Just before break we learned that Rod is engaged to Jessica Wills. (See the picture archive for a photo of them together.)

After break, Rod demonstrated how easy it was to build Web forms with VS.NET with very little code. Controls can be dragged and dropped onto Web forms just like Windows forms. VS.NET will even debug Web forms just like Windows forms.

Though skeptical of new technology, Rod said that after using Web Services he decided, “I will never build another application again that uses data on the Internet without using a Web Service.” .NET enables Web Services by allowing methods to be tagged as “Web Methods.” These methods are exposed to the Internet.

Finally, Rod discussed ADO.NET and data sets. Those attending will get access to utilities that he routinely uses in working with data set objects.

Cathy Pountney's Advisor JumpStart: Visual FoxPro Report Writer

by Christopher Bohling

Cathy Pountney's credentials as the leading VFP report guru include a book on the subject (edited by Dave Aring, my coworker and friend), numerous published articles, a long track record of presentations, and six months working with the Fox team at Microsoft.

Cathy first reviewed the report wizard. Two of the most pertinent points were 1. the wizard can create an index without you knowing it and 2. the RptStyle table is the place to add customized styles. But, if you do create a new style, base it on an existing one. VFP expects styles to contain certain items.

After the wizard, she shifted attention to the report designer. The best news from this discussion was that VFP 8.0 includes a Reports tab on the Options form where report defaults can be set. There were several other items discussed that it might be useful to read about in Cathy's book. However, if you know the maximum number of bands a report can have, you are at least 0.03% there.

Then came the discussion of data sources, data sessions, and the data environment. Cathy pointed out that data entry systems work best with normalized data, whereas reports are easier with denormalized data. Reports lose this fight and there are inevitable questions about how to prepare data for reporting. Two tips worthy of considering are to set the AutoOpen and AutoClose properties of cursors in the data environment to false. This way a cursor can be used during development that will not need to exist under the same name at runtime. Also, the BeforeOpenTables and OpenTables methods can be used to manipulate data.

The BeforeOpenTables event can serve as the location of code to change the relative paths that the data environment adds for tables.

Cathy also discussed report objects, including controls, report variables, running reports, and distributing reports. Two points to keep in mind are to always remove printer information from the .FRX file (which is done with a menu choice in VFP 8) and that the "Release After Reports" option does not work for report variables.

She added a handy tip for selecting labels easily for editing: highlight the label and type Ctrl+E.

There was much more to this session. If you want to run VFP reports, and you have not checked out Cathy's work, it would be well worth your while.

 
Chris Bohling, Myers and Stauffer LC 
My experience with database and application development stretches back into the 1980s, when dBase II was on the bleeding edge. In addition to Visual FoxPro®, my current set of development tools includes Visual Basic® .NET, C#, Microsoft® SQL Server™, Windows Installer, and several other applications and utilities. I am a Microsoft Certified Professional in Visual FoxPro® and Visual Basic® .NET. My experience includes full lifecycle development and maintenance work, as a team member and individually, on projects for companies in the insurance, manufacturing, construction, research, non-profit, and cleaning service industries. I spend a lot of my free time reading about software development, project management, and design patterns. I live in Shawnee, Kansas with my wife Claire and my daughter Melanie.

Kevin McNeish's Advisor JumpStart: .NET Development

by Evan R. Pauley

8:00 am

It’s too early for late-night developers like myself.  My heart hasn’t starting beating yet.

Nevertheless, here I am.  I’ve had my first caffeine injection (I take my caffeine cold, so it’s Vanilla Coke instead of Starbucks), and I’m in the first "JumpStart" pre-conference session of the day, the session on .NET development being taught by Kevin McNeish of Oak Leaf Enterprises in Charlottesville, VA.  Kevin is well-known in the VFP world as the architect of the Mere Mortals development framework, and has also written an excellent book on UML modeling.  The session has about 20 attendees.

I’m not personally knowledgeable in .NET, since most of my clients currently don’t require this knowledge.  All my further comments will, therefore, contain my personal "spin" on Kevin’s comments.

Kevin has tailored his presentation, obviously, to VFP developers moving to the .NET initiative.  One of the major advantages of .NET is the single learning curve for developing both desktop and Web applications (and also for handheld or mobile devices, if necessary).  There’s also no interoperability layer, such as COM, between the different .NET languages, which eases compatibility issues between modules written in these languages.  .NET handles the creation, release and "garbage collection" of objects considerably more efficiently than VFP, which greatly reduces application "memory leaks" and applications that run slower as they get older.

Kevin also touched early on the fact (well known to everyone here) that Microsoft is strongly marketing .NET to their entire development community and has anointed .NET as "the future of software development at Microsoft".  This means that persons with both VFP and .NET skill sets are an extremely HOT property right now.  Kevin stressed that while VFP is not going away ANYTIME soon, and VFP still reigns supreme when handling large amounts of local data, the market for VFP is definitely diminishing.  This doesn’t mean VFP is completely out of the mix, however; VFP COM components can easily be called by .NET applications.

  1. the Common Language Runtime, or CLR, which is similar to the VFP runtime;
  2. the base classes, which provide the core for the application’s "plumbing";
  3. the presentation classes, which provide the visual capabilities for ASP.NET, Windows Forms and mobile devices (these are MUCH larger than VFP’s base classes, numbering about two thousand)

There are three primary .NET languages: C# (known as ‘C-sharp’), VB.NET and C++.  C# was the language used to author the .NET framework itself.  Since C# is a new language specifically designed for .NET, the C# team is focused entirely on advanced OOP and *performance*.  If you’re not already a VB programmer, Kevin believes that the migration path for VFP developers to C# will be much smoother than the other languages.  For Java developers, C# is very similar to Java – 41 of the same 43 operators, 38 of the 50 keywords (46 if you count the synonyms), and ALL the same flow of controls statements.  C# is also less verbose than the other .NET languages, and memory access is less "dangerous" since memory locations are normally accessed by reference rather than with pointers.  C# has a growing community in the VFP world, and about 25% of the C# developers are former VB developers.

VB.NET, on the other hand, is focused on RAD (think "builders").  VB.NET has more of a "pretty facade" which hides the way .NET works.  It’s more like VFP in that it is a higher-level declarative language.  VB.NET is also non-case sensitive, and has a "background compilation" scheme that catches errors earlier (which is great for small projects, but slows larger projects down considerably).  It’s best for shops with some current VB familiarity.

All the classes (also known as "types") in the .NET framework inherit from the Object class (known as "the mother of all classes").  Since two developers could easily name a class identically, "namespaces" give you a way to provide a "whole name" to your classes and allow you to categorize those classes.  For instance, the "System" namespace (provided by MS) contains the fundamental classes and base classes that define commonly used value and reference data types, events and event handlers, interfaces, and so forth.  By contrast, the "System.Data.OleDb" namespace encapsulates the OLE DB .NET data provider (which still inherits, ultimately, from the Object class mentioned above).

Because of .NET’s strong variable typing (variable types must be declared when the variable is created), and because *everything* in .NET comes from a class (and is, therefore, an object), creating a variable in .NET provides complete IntelliSense capability in the Visual Studio editor.  Entering

string test = "Hello .NET World"

and then entering

test.

provides a complete list of not only the properties of a string variable, but also the methods/functions available to that string variable.

less than 80 total lines of code, was constructed in less than 45 minutes to the delight and approval of the approximately 80 attendees.

This evening has nothing scheduled, other than the music jam session in the bar.  I think I’ll just look out over these beautiful grounds for awhile before the music starts.

Also, since .NET is strongly typed, compiling your code will produce an error if, for example, you assign a string value to an integer variable or pass an integer value to a method expecting a string (mistakes which no VFP developer has EVER made before –bg-).  This will catch a considerable number of "bugs" before the application ever runs.

.NET allows what are called "overloaded methods", or multiple methods with the same name.  A good example is the MessageBox class of .NET.  The Show() method of the class has twelve different "overloads", or ways to pass the necessary values (think of a CASE statement that accepts whatever parameters the user might pass and issues the correct call regardless).

Source code in .NET is compiled *twice* -- first to a pseudo-code level (called MSIL for Microsoft Intermediate Language) and then to machine code at run-time by the CLR.  This is different than VFP, which interprets the code at runtime.  This is important because the .NET "just in time" runtime compiler can then determine the specific CPU on which the code is running and take advantage of that processor’s special features.

Code that runs under .NET is known as "managed" code.  C++ can also create "unmanaged" code, which runs outside of .NET (VFP code would also be considered unmanaged).  "Unsafe" code is managed code which directly accesses memory using pointers and stack-based arrays.

Kevin’s presentation, which lasted almost three and a half hours with a break in the middle, was concise and communicated a large quantity of valuable information for those wishing to learn more about how .NET and VFP can coexist in the same development environment.  As always, Kevin showed a strong command of his subject matter and an easygoing, conversational style.

After the session, I met up with our other reporter, Chris Bohling, and another speaker, Ted Roche.  Most of you know Ted as the co-author of the excellent Hacker’s Guide series of books, which no VFP developer should be without.

Jim Duffy's Advisor JumpStart: SQL Server for Visual FoxPro Developers

by Evan R. Pauley

1:00 PM

On to the SQL Server for VFP Developers session and the always entertaining Jim Duffy from TakeNote Technologies in Raleigh, NC.  Jim’s sessions are always some of the most popular and best-attended at any conference, and his irrepressible personality and stage presence make his sessions a "must attend".

In a file-server environment such as VFP, large amounts of data are transmitted between the server machine and the client, and all the processing and selection of the data is performed on that client.  In a client-server environment, the only thing that is transmitted between the server and client is the request and the data fulfilling that request -- all the processing and selection of the data is performed on the server machine.

Jim advocates that ALL applications should be developed with "real" databases, such as SQL Server, Oracle, DB2 and Informix.  These databases should have integrated security, integrated scalability, integrated corruption recovery and other features missing from file-server database products such as VFP, Access, and FileMaker.

Several members of the VFP community have criticized Jim for attacking VFP as a product.  Jim addressed this directly with the attendees; he stated that he writes VFP applications every day, just without using VFP databases or tables.

Jim defined a "client-server" application as an application where the data not only resides on a single (server) machine, but is also processed on that same machine when other machines make requests for the data on the server.

Server applications are fully scalable, easier to maintain in large enterprises, allow for scheduling tasks at non-critical times, and reduce network traffic – regardless of whether the application is used by a single workstation in a single location or by thousands of simultaneous users worldwide.  Server applications also have a large selection of development tools, such as VFP, VB, Delphi, .NET, and so on.  Server applications often show increased performance, reduce network traffic, and allow for smoother data replication.

Client-server applications do have some disadvantages.  Server software is more costly; application design needs to be rethought (removing record-by-record navigation, revising forms, revising reports, etc.); and basic server administration techniques and database-specific querying dialects must be learned.  Most of these are standardized and well documented.

Jim’s presentation continued through defining various client-server terminology, such as connections, queries, result sets, stored procedures, and triggers.  He then proceeded to describe and demonstrate techniques, including advantages and disadvantages, for connecting to server data through remote views (not recommended unless data must be joined from several different data sources to an existing user interface), SQL pass-through (recommended for all queries which return data), and ADO command objects (recommended for all operations which insert, modify, or delete data).

The final hour and a half revolved around an overview of SQL Server 2000 and its various tools, followed by the explanation and construction of a basic "data object" which, when instantiated by a client, encapsulates all the necessary functionality for a single result set, including inserts and updates.  This generic data object, encompassing less than 80 total lines of code, was constructed in less than 45 minutes to the delight and approval of the approximately 80 attendees.

This evening has nothing scheduled, other than the music jam session in the bar.  I think I’ll just look out over these beautiful grounds for awhile before the music starts.

 
Evan Pauley, Positronic Technology Systems Llc 
Evan Pauley is Director of R&D for Positronic Technology Systems LLC in Knoxville, Tennessee. Since beginning his development career in 1978, he has worked with xBase products since 1982, Fox products since 1988, and VFP since its inception. He now uses VFP and SQL Server to design and develop vertical market applications.


Monday, June 16

Ken Levy's and Yair Alan Griver's Keynote Address, Report 1 of 2

by Christopher Bohling

After a continental breakfast on a rooftop, open-air terrace, the crowd of developers moved downstairs for the Keynote Address. Ken Levy and Yair Alan Griver (Yag) split responsibilities for the keynote. (Note that Evan also has a write-up on the keynote, below.)

Ken started with a long list of enhancements included in VFP 8. His list was both a reminder of the effort that Microsoft put into the product and a setup for the demo to be performed after Yag's part of the keynote.

Ken stressed that the changes made in VFP 8 were in response to user requests. Many, though not nearly all, of the changes dealt with XML. Ken stated that the FoxPro and .NET teams at Microsoft are working closely together to advance XML and Web Service interopability.

He also gave three free "tips":

(Editor's Note: Perhaps Microsoft chose the name Europa from the 30-year-old movie that featured supermodel Twiggy driving a Lotus Europa sports car.)

Yag was assigned the task of reviewing the current state of the .NET technology and community. He started his presentation with a humorous video about Microsoft public relations personnel using a focus group to attempt to find a catchy yet understandable description of .NET. The ending is too special to give away. In real life, Microsoft adopted this catch phrase about .NET: "Software for connecting information, people, systems, and devices."

Yag zipped through his material as well, which could be overwhelming to .NET newbies like me. He summarized the features of Visual Studio.NET version 2002, along with the .NET Framework version 1.0, and the additions to VS.NET 2003 and Framework 1.1.

He emphasized that the Visual Studio versions could run on the same computer together.

Ken then launched into a demo of passing data to VFP from a .NET application and passing VFP data to a .NET application. He used a Windows form and a Web form to accomplish both tasks. He also demonstrated running .NET applications in Mobile PC and Mobile phone emulators on his laptop.

Finally came the big announcement that the bonus keynote in the evening would feature previews of Europa, Whidbey, and VS tools for MS Office. To learn more about that session, read Evan Pauley's article below.

Tamar Granor's Advanced Office Automation

by Christopher Bohling

Tamor Granor, co-author of Microsoft Office Automation with VFP, used this session to discuss some of the more difficult issues facing VFP developers engaged in Office automation. She began by detailing some differences between Office servers, such as:

  • whether or not more than one instance can be open at one time.
  • the fact that Excel stays in memory after being "closed."
  • Powerpoint's need to be visible in order to expose its full functionality.
  • how the programs treat templates.
Tamar then discussed the problem of killing abandoned servers, i.e., any server for which VFP has somehow lost its object reference. Obviously, as the object reference is missing, other means need to be used to find the instance of the server. API calls are the necessary means. The API can be used to get window handles and other pointers to the instance and to close it. If your application needs a spelling checker, consider that Word and Excel both expose the Office spelling engine to external applications, and Word offers more functionality. Two methods, CheckSpelling() and GetSpellingSuggestions(), are essential to using the engine. After discussing Outlook's collections and document properties in general, Tamar introduced the concept of responding to Office events. There are two ways to do this:
  • If the VFP application will be running, create a set of methods that can be bound with the EventHandler() function.
  • If VFP will not be running, build an Office add-in with VBA code that can use ADO or a COM object to access VFP data.
Finally, Tamar recommended the use of the VBA Help files to find the behaviors that you need out of Office servers.

Andrew MacNeill's Building Better User Interfaces for Windows and the Web

by Christopher Bohling

Andrew MacNeill considers the (Microsoft-inspired) "ever-changing interface" to be a continuing attempt to make it easier to use software products. The components of the current Graphical User Interface model are Windows, Icons, Menus/Mouse, and Pop-ups. In other words, this is the WIMP interface.

But, developers might hold some misconceptions about GUIs. They are not universally deployed, they are not necessarily easier to use than text-based interfaces, and mouse-dependent input is not necessarily better than the use of the keyboard. Adding hand writing and voice recognition to GUI interfaces might help improve ease of use.

Bad Windows interfaces tend to have too many tabs, too many grids, controls that misbehave, and tool tips on everything.

Andrew offered two guidelines for building a good interface:

  • Keep it clean. Do not add items just because you can.
  • Make it obvious. Interpret error messages for the users and use interface elements that make sense.
An additional guideline for Web interfaces is "Don't make me think."

For Andrew, the ideal interface is intuitive and inductive. It is task oriented. Icons are identified with assistive text. In VFP, Andrew suggested using a browser interface with hyperlinks that point to regular components.

Keep in mind that there are key requirements that have to be met for an application to qualify for Microsoft logo certification.

Finally, Andrew had to turn his attention to testing interfaces. His first recommendation was to use children, who seem to have a deeper understanding of computing than do adults. On a more serious note, he suggested building a large laboratory facility with one-way mirrors, sophisticated video systems, and research subjects who know nothing about the system. In a pinch, a simple video camera system would work. If that is too resource-intensive, just watching new users would work. If these options do not work out, the application could just be shipped to its intended users for testing.

Toni Feltman's Using Visual FoxPro to Provide and Consume XML

by Christopher Bohling

Toni Feltman focused on four mechanisms of providing and consuming XML in VFP:

  • Text Merge/Text Manipulation
  • CursorToXML()/XMLToCursor()
  • The XMLAdaptor
  • The MSXML DOM (Document Object Model)
Text merge and manipulation are the most flexible methods of creating and reading XML. But, they are also hard-coded to specific XML sets and require the best understanding of XML.

CursorToXML() and XMLToCursor(), on the other hand, are very easy to use and not very flexible. The commands operate on a single table at a time.

The new XMLAdapter can perform multiple table conversions and hierarchical data conversions. It uses simple class-based nodes of table and field objects. It is also very flexible.

The XMLAdapter can be used in two modes: manual and automatic. The AddTableToSchema() method will automatically add tables and fields to the schema, and the XMLAdapter will instantiate the VFP base table and field classes. Table and field classes can also be built manually, by instantiating them and populating their properties. Using the manual process, specialized table and field subclasses can be substituted for the base classes.

The MSXML DOM is not VFP specific, but instead is the same XML manipulation model shared by other applications. Developers who use it will have to learn a new set of PEMs.

Among the reasons that Toni gave for using XML were to communicate with Web Services, provide more Web integration (as with hand held devices), and to manage configuration settings (instead of using the registry or .ini files).

 
Chris Bohling, Myers and Stauffer LC 
My experience with database and application development stretches back into the 1980s, when dBase II was on the bleeding edge. In addition to Visual FoxPro®, my current set of development tools includes Visual Basic® .NET, C#, Microsoft® SQL Server™, Windows Installer, and several other applications and utilities. I am a Microsoft Certified Professional in Visual FoxPro® and Visual Basic® .NET. My experience includes full lifecycle development and maintenance work, as a team member and individually, on projects for companies in the insurance, manufacturing, construction, research, non-profit, and cleaning service industries. I spend a lot of my free time reading about software development, project management, and design patterns. I live in Shawnee, Kansas with my wife Claire and my daughter Melanie.

Keynote Presentation, Report 2 of 2

by Evan R. Pauley

8:00 am

There’s a crowd of about four hundred or so in the hallway waiting for the keynote to start. Most are reviewing their conference materials or reading the newspaper. The conference also has a wireless high-speed network available (thankfully). While I don’t know the actual attendance yet, this conference seems even smaller than I had expected. Normally, by now, I’ve run into at least half a dozen former co-workers (or employers). I’ve only seen one so far.

John Hawkins, the CEO of Advisor Publications, greeted the attendees. A series of video outtakes from the VFP team’s work location preceded the arrival of Ken Levy, VFP Product Manager, and Alan Griver, Visual Studio Data Group Manager, to begin the keynote address.

Ken began by highlighting the productivity enhancements in VFP 8, including the Task Pane, the Toolbox, the Empty class, TRY/CATCH/FINALLY structured error handling, event binding, the enhanced View Designer, and others. Ken spoke more at length about the new XMLAdapter class and its capabilities for updating data over HTTP, the new CursorAdapter class, the new data features (subclassable DataEnvironments, the BindControls() form property, etc.), and the increased performance of VFP 8 regarding object creation and release (VFP 8 is about 50 times faster in this area than VFP 7).

Next, Alan discussed the increased interoperability between VFP 8 and Visual Studio .NET. The .NET design initiative is to produce software for connecting information, people, systems, and devices. Visual Studio .NET 2002 was the first version of the .NET framework, including the new C# language. The new 1.1 version of the .NET framework is now included with Windows Server 2003, and includes side-by-side execution with the first framework version, code access security and mobile controls for ASP.NET, and native Oracle support. The upgrade to VS.NET 2003 only updates the project file; no existing source files are modified. There are also a wealth of productivity enhancements and language enhancements to all of the .NET languages and related tools, far too extensive to mention here. There are also two new certifications: MCAD (MS Certified Application Developer) and an MCSD track for the .NET framework.

Ken returned to demo VFP 8 working with VS .NET 2003. His demo was too extensive to duplicate here; however, after the session, conference speaker Ted Roche informed me that he had “blogged” the entire transcript of the keynote on his site (many thanks, Ted !!! ) Please go to Ted Roche’s Blog to view this transcript.

Ken also mentioned several resources that are or will soon be available to VFP developers. An updated VFP 8 OLE DB provider will be on the MSDN site in about two weeks. The VFP Toolkit for .NET is on the GotDotNet.Com/Team/Vfp site, along with a VFP 8 case study template available for download. CoDe Magazine also has a special VFP 8 issue. Two new whitepapers, addressing the Toolbox and Task Pane of VFP 8, are also available on the MSDN site.

Advanced SQL Server Development for VFP Developers

by Evan R. Pauley

10:00 AM

Anyone who knows Jim Duffy of TakeNote Technologies in Raleigh, NC would immediately assume once would have been enough of Jim after yesterday’s pre-conference session. Obviously not (sheepish grin). Between 80 and 100 people were in attendance as Jim began his discussion of some of the more advanced SQL features available to VFP developers wishing to use SQL as their data store.

One of the first questions asked during a conversion or migration to SQL Server is “how do I get my data over to SQL?” There are three primary ways: 1) the bulk copy program, or BCP, which is a command-line utility usually run from the Windows Command window; 2) bulk insert, which provides BCP-like capability in a Transact-SQL command which can be run from the Query Analyzer (or VFP, for that matter); and 3) SQL’s Data Transformation Services (DTS), which is a programmable “data pump” complete with a wizard and stored “packages”.

BCP, while a command line utility, can utilize a “format file” which is a text file that stores the necessary parameters related to the data copy.

A DTS package (basically a batch file for DTS) is normally built using the Import/Export Wizard built into SQL Server. The package uses OLE DB or ODBC connectivity to move data, both directions, between SQL and various products including VFP, Oracle, and DB2. The package can also perform type conversions during the data moving process. When copying data into SQL, most of these conversions are implicitly performed.

The SQL Profiler’s job is to watch the server and “keep track” of what the server does. Users can log all or selected items which occur on the server and debug Transact-SQL statements/stored procedures. Users can also capture events on a production system and replay them on a test system (a VERY cool feature). Profiler can additionally be driven by one or more templates, and can save its “tracer” information for auditing purposes.

UDF’s can return values OR tables. UDF’s can call other UDF’s. UDF’s can be called recursively. UDF’s cannot, however, use built-in functions that can return different data on each call (such as NewID(), GetDate(), RAND(), and so forth); these values must instead be passed into the UDF as parameters.

Unlike VFP, SQL allows as many triggers as the user desires for a particular table. Inside each trigger, there are contained INSERT and DELETE tables that can be used during the trigger (this is extremely helpful when building an audit log from a trigger, which is where that action should take place). The user does not, however, have much control over the ORDER in which the triggers fire (except for the first one, of course).

Building a Data Access Layer with VFP 8

by Evan R. Pauley

11:30 am

Toni Feltman from F1 Technologies in Toledo, Ohio presented the next session on Building a Data Access Layer in VFP. Toni’s company produces the Visual FoxExpress development framework.

The new data classes in VFP 8 are the DataEnvironment, Cursor, CursorAdapter, and Relation classes. Where previously these were tightly coupled to forms (and, in some cases, were not available from VCX-based forms), these can now be subclassed independently from forms and used in other locations.

The Cursor class requires only a database (if you are using VFP data) and the name of a data source. The CursorAdapter class is used to connect to non-VFP data via a SELECT statement and return that data into a VFP cursor (think “remote view on steroids”). The Relation class is used for VFP relationships (think “SET RELATION TO and SET SKIP TO in their own class”).

The DataEnvironment class is a container class that is designed to hold Cursor, CursorAdapter, and Relation classes and handle the opening and closing of its contained data controls. DataEnvironment classes also can specify their own DataSource and DataSourceType properties, which are used as defaults for any contained CursorAdapter instances which have their UseDeDataSource property set true.

To user the new data classes, create a Cursor and any desired Relation objects (for VFP data) or CursorAdapter (for non-VFP data) for each desired table (for CursorAdapters, the provided builder is the best way to do this). Next, create a DataEnvironment object and populate that object with the previously created items.

There are three ways to then associate this DataEnvironment with a form. The normal methodology is to populate the DEClass and DEClassLibrary properties of the form, which at runtime adds an instance of this class to the form and names it with the name of the class. This enables drag-and-drop capabilities for the DE – however, this does not provide a handle to the DE in the form (for instance, you cannot use syntax on the order of THISFORM.DataEnvironment.MyCursor.Name).

An alternate methodology is to simply drop the DE on the form as a member, just like any other VFP control. This provides for object-oriented syntax, on the order of THISFORM.dteMyData.MyCursor.Name, but removes the ability to drag-and-drop items – and the form does not instruct the DE to auto-open any contained items (you must code this behavior yourself if desired). The most flexible way is to manually instantiate the DE in the Init() of the form. This is similar to dropping the DE on the form as a member, but allows the instantiation of DE’s that exist on another location, which might be the case for N-tier development situations.

When designing a data access layer, your goals should include a simple yet reusable class structure that will migrate to N-Tier with as little effort as possible.

Implementing MSDE-based Applications

by Evan R. Pauley

2:00 pm

After lunch, the first session on the afternoon schedule dealt with implementing MSDE-based applications. Once again, Jim Duffy of TakeNote Technologies in Raleigh, NC was the presenter. This was a fairly short session, covering the reasons why the MSDE database works EXACTLY like SQL Server – because IT IS SQL SERVER (you’re welcome, Jim -bg-).

All kidding aside, MSDE is a free SQL Server database for a developer’s smaller clients who might not need or be able to afford a full SQL Server license. It supports up to two processors, and states that it runs on Windows 95 or above (in reality, it should be run on Windows 98SE as the least common denominator). MSDE includes no development tools like Enterprise Manager or Query Analyzer, database size is limited to 2 gigabytes (there’s no limit to the number of databases, however), and is optimized for five *concurrent* queries – based on throughput, NOT on the number of physical connections to the database(s). MSDE also can not perform transactional replication.

Apart from those (fairly minor) qualifiers, MSDE *really is* SQL Server. The entire “rest of the feature set” from SQL Server is supported, including views, stored procedures, DTS packages, user-defined functions – everything. When the developer’s client needs more concurrent queries, or reaches the database limitation, they purchase the full version of SQL Server – and their entire database, code and all, attaches without further incident or difficulty. Applications written to query MSDE data function with NO CODE CHANGES, eliminating the need for separate code bases between scaled versions of the application.

MSDE is included with many Microsoft products, and may be distributed with developed applications at no charge. A complete package for installing MSDE is available from the MSDN web site.

Indexing SQL Server for Performance

by Evan R. Pauley

3:45 pm

The final session of the first afternoon concerned the indexing of SQL server to enhance performance. Chuck Urwiler of EPS Software Corp. in Houston, TX presented an intense look into the internals of SQL Server’s optimization techniques and methodology.

The primary tools for optimizing SQL performance are the SET STATISTICS IO command, the Execution Plan, and the Profiler. Lesser used, but still valuable, tools include the DBCC SHOW_STATISTICS command and the DBCC SHOWCONTIG command.

SQL Server stores information in “pages” of 8K each. These pages are requested as necessary in groups of eight pages called an “extent”. The efficient usage and manipulation of these pages in memory by SQL Server’s optimization engine control the performance of SQL queries.

The SET STATISTICS IO (that’s “io”, not “to”) command is normally used to monitor the page count, or number of pages accessed to execute a query. The “scan count” shows the number of pages touched, the “logical reads” shows the number of pages *in memory* needed by the query, and the “physical reads” shows the number of pages read from disk during the query. As physical reads increase, the more “memory starved” the server becomes and the slower queries operate.

Execution plans show, either graphically (the norm) or textually the “cost” of the query in units. These units have no meaning other than to measure against other cost unit measurements from other queries, and have no relationship to time, disk space, processor speed or any other known unit of measure. Each operation performed as part of the query is documented, along with its cost; to see the total query cost, save the output of the execution plan as a cursor with SET SHOWPLAN_ALL ON.

The DBCC SHOW_STATISTICS command views the density of index keys by showing an entire histogram of rows, and the DBCC SHOWCONTIG command shows the fragmentation of the pages across the disk. The “scan density” shows the amount of fragmentation as a percentage; the closer to 100 percent, the less fragmentation exists. The larger the number of rows in the table, the more tolerance SQL queries will have with fragmentation. To defragment a table, rebuild its clustered index with the “drop” option. Chuck recommends NOT building clustered indexes on primary key fields as a general rule.

The Profiler shows each statement of the query executed, with statistics on each statement. Statements can be grouped by a number of properties, including duration. A period of activity can be saved as a “workload”, which may be played back at a later time or used by the Index Tuning Wizard (don’t let the term “wizard” fool you, this is an *excellent* tool).

Other performance factors include the structure of query/search arguments (known as SARG’s), the existence and usefulness of indexes, the availability of statistics, and the CPU usage factor.

Covering indexes are indexes which have all of the necessary search information in the non-clustered indexes. There is no equivalent to this type of index in VFP.

Chuck then demonstrated, using almost identical queries, techniques for applying proper types of indexes to increase speed and control the types of joins which SQL performs on submitted queries. All three types of joins (nested, merge, and hash loop) have their pros and cons. Nested joins, the default, are helped by non-clustered indexes. Merge joins take advantage of “sorted” tables (those with a clustered index) and are very efficient. Hash loop joins, while efficient, require LOTS of memory.

Evening Keynote Presentation: The Future of Visual FoxPro

by Evan R. Pauley

7:15 pm

We’ve been officially “welcomed” now (the normal Sunday night “welcome session” was postponed until this evening) and most of us have migrated to the main conference room for a special “bonus session” about the future of VFP, Visual Studio .NET, and the new Visual Tools for Office.

The goals for Visual Tools for Office were to integrate the .NET development environment with the long-known object models for Office. The CLR loader will be part of Word 2003 and Excel 2003 as long as the users have CLR on their machines (Office won’t ship with the CLR). There now exists a document on MSDN detailing the plans for this technology and additional plans for Office 2003 and Visual Studio .NET interoperability.

Ken Levy demonstrated some of the new features of Visual Studio .NET 2003, including the ability to edit while in the debugging window (Ken, rather jokingly, stated this will only be available in VB.NET and not C#), and the ability to more smoothly add data sources and bind them to controls (sort of like VFP already has).

Randy Brown, the lead designer and architect of VFP, then launched a discussion of some of the proposed new features for the next version of VFP, code-named Europa (yes, it’s a moon of the planet Jupiter). The VFP team’s goals included basing enhancements on the UT wish list/customer feedback, maintaining backward compatibility, enhancing the database language and types, significantly enhancing the Report Writer (FINALLY !!!), and extending interoperability with XML, .NET and SQL Server including more designer hooks for third-party extensibility.

The proposed enhancements to the report writer include the ability to output to various additional formats, objectifying and opening the architecture, and the ability to plug in external components – all without losing the developer’s current investment in FRX report designs. Support for international fonts, English/metric measurements in the grid scale, design-time labels, protecting reports from modifications, design-time events, and two new system variables called _REPORTBUILDER and _REPORTDESIGNER are all in the design stage. At runtime, the report writer will allow object-oriented syntax, increased flexibility for chaining reports, and processing events while the report is executing.

Randy then proceeded to play several videos of Calvin Hsia, one of the lead VFP developers, as he demonstrated the new “background compilation” feature, which attempts to compile a line as it is being entered and changes the color of the line if a problem is detected. The 65K limit on array size has been removed (limited now only by available memory), as has the 65K limit on the size of a procedure inside of a PRG. SQL changes include no limit to the number of joins, subqueries, unions, tables, and arguments inside of an IN() function. Multiple subquery nesting is now also allowed, as are GROUP BY in a correlated sub-query, sub-queries in a SELECT list, ORDER BY clauses using a field name with a UNION clause, and UNION commands inside an INSERT.

Europa will also add some new data types and data functions, including Timestamp, VarChar, the CAST() function (just like SQL Server), the *very cool* ICASE() function (an “immediate CASE” that works like an “immediate IF”), and binary indexes (these can be over 30 percent smaller in size than regular indexes).

No new version of VFP would be complete without UI enhancements. Forms are now dockable, along with most IDE windows. There are new properties for “anchoring” form windows with auto-control resizing, including both absolute and relative anchoring in containers. Separate text and picture alignment, along with word wrap, is now allowed in command buttons and check boxes. Collections can now be assigned as a RowSourceType in list boxes (and, hopefully, combo boxes and grids as well), along with the ability to dynamically rotate labels. A new property of lines and shapes called PolyPoints allows creation of many different lines and shapes with fill colors and patterns. PRG’s can now be opened in the Class Browser, which is also now dockable. The Expression Builder now supports syntax coloring, and default values may now be entered in the New Properties dialog for a form or class. The new _MemberMeta property would contain XML declarations of attributes for a particular property or method in the Property Sheet (including capitalization).

As Doug Hennig, from Stonefield Systems Group in Regina, Saskatchewan, Canada, took the stage to present a VFP 8 case study on his (excellent) Stonefield Query product, Ken Levy made a point of showing the Conference Events page detailing our UT reporting coverage on the big screen for all to see !!! Ken, thanks very much for your kind words and your support of our efforts.

 
Evan Pauley, Positronic Technology Systems Llc 
Evan Pauley is Director of R&D for Positronic Technology Systems LLC in Knoxville, Tennessee. Since beginning his development career in 1978, he has worked with xBase products since 1982, Fox products since 1988, and VFP since its inception. He now uses VFP and SQL Server to design and develop vertical market applications.

Tuesday, June 17

Doug Hennig's Putting New Visual FoxPro 8 Features to Work

by Christopher Bohling

Doug Hennig presented a "meat and potatoes" session featuring examples of how to put new VFP 8 features to work in applications. He often compared the code that he used in pre-VFP 8 classes to accomplish certain tasks with his VFP 8-optimized code.

He used this technique in his example of new features in the VFP 8 Page class. Prior to VFP 8, pages in a PageFrame could not be subclassed. So, all code had to be entered at the instance level. Instead of coding every page, Doug used to add an object in the Init() method of each page. The object's code was called by its UIEnable() event, which fires when the page is activated or deactivated. The code would refresh the page and perform other tasks.

New in VFP 8, you can subclass pages. The MemberClass and MemberClassLibrary properties on the PageFrame specify the class and class library.

Doug now has created a Page class that uses runtime code for delaying the instantiation of controls on pages that are not initially active and for determining which pages in a page frame will actually be used. He added two properties to the Page class, cMemberClass and cMemberClassLibrary, to determine if dynamic instantiation should take place and using what Container class. Sometimes, he uses a Page class to dynamically instantiate certain controls and not others.

According to Doug, the default AutoSize and BackStyle values for option buttons in the OptionGroup class were a major annoyance as they had to be changed every time an OptionGroup was used. Now the OptionButton class can be subclassed, and the properties changed just once.

Originally, in VFP 3, it was difficult to highlight the entire row of a grid. Developers complained, so Microsoft "gave us a goofy looking little arrow" (the record mark). Then came the HighLight property that draws a one point "halo" around the row. In VFP 7, MicroSoft allowed developers to change the height of the line. In VFP 8, "we now have what we wanted." Instead of the "hideous mess" of code that was required to make row highlighting work, now the results are accomplished much more easily with the HighlightStyle property, as well as HighlightForeColor and HighlightBackColor properties.

Grids also have the new AutoFit() method to allow interactive or programmatic resizing of the column width to fit the data. Included among even more enhancements for grids are the AllowCellSelection property, the ability to subclass columns, and a new picture property for column headers.

Doug addressed long-running issues with the complexities of resizing containers (like forms) and the controls they contain with another new VFP 8 capability: event binding. The BindEvent() function takes four parameters: the object that will raise the event; the event, property, or method that will raise it; the object to act as the event handler; and the "delegate" (method) to respond to the event.

Event binding can be used in resizing. Every control on a form, for instance, can "bind" (ask to be notified of) a resize event in its parent (or parent.parent in the case of a control on a page). In his controls, Doug uses aEvents() to get an object reference to the event source. The difference between the new and old height and width of the source is used to make adjustments on the current object. Additionally, Doug "anchors" the controls on the form to determine how to move and/or resize them.

VFP 8 includes structured error handling in the form of the Try...Catch...Finally command. One advantage of this command is that it can be nested. If a Try...Catch command at a given level cannot handle an error, it has the ability to "Throw" an "exception object" up to a higher level Try...Catch. However, if there is not a higher level structure, you only get an "Unhandled Structured Exception" error, not information about the initial error. Doug said that this can be a problem when mixing and matching old and new style error handling. Doug's Try...Catch error handling always places the exception object in an oException property before trying to throw it. If his ON ERROR error handler detects an Unhandled Structured Exception, it checks the property for the original error.

"Collections are one the coolest new features of VFP 8." Doug created his own collection class before VFP 8, but it was mainly an "array wrapper." For instance, his collection could not support the "For Each" command.

Two parameters are required to add items to a collection: the value and the key (the name). Items in collections have their own properties and can contain other collections.

Doug likes to use collections for metadata. For instance, he likes to get information about a field using a table collection of field collections:

oTablesCollection(cTable).oFieldsCollection(cField).Length

Instead of thanking Doug for his presentation, everyone ran out and bought a copy of VFP 8.

Markus Egger's Building Tablet PC Applications with VFP

by Christopher Bohling

Markus gave a presentation with two distinct parts. The first part reviewed the concepts and hardware associated with Tablet PCs. The second part focused on using the Tablet PC's unique ability to accept "ink" input in VFP applications.

First, Markus listed some reasons to use Tablet PCs. They provide a much more natural computing experience for people who still cling to pen and paper. They are much easier to carry around than laptops. But, they will still do general purpose PC tasks. They also provide a more "social" experience. "Not that us developers care much about that," said Markus.

"Tablet-like" computing is not new, starting with the GRiDPad "12 or 13 years ago." Apple's Newton was the first device to make at least a marketing splash. The Palm Pilot was the first pen device that was successful in the market. Despite their eventual success, these devices have a lot of limitations, like poor performance and small screens.

A "true" MicroSoft Tablet PC must meet three requirements. First, their form factor is flat, though some are "convertible." The pen input capability is more important than the form factor, but relies on it.

The second set of hardware requirements includes switching screen orientation on the fly within 5 seconds, extended battery life, fast docking and undocking, and the inclusion of a digitizer. The tablet PC should be lightweight.

Finally, the digitizer must recognize the position of the pen on the display very fast and very often. Tablet PCs usually sample the screen 100-133 times per second. The digitizer must also operate at 5 times the resolution of the display, or at least 600 dpi.

Electromagnetism is used to locate the pen. It does not react to touch. It must recognize the pen within 5 millimeters of the display and recognize the orientation of the pen. The pen is actually pressure sensitive. This feature is often used to draw a thicker line.

The pen is both a mouse and a keyboard. Additionally, the pen can be used for "gesture-based" commands. Some pens even have digital erasers.

Handedness is a difficulty with a pen. Windows now comes with a default for the left hand. This means that popup menus and other items will appear in a spot that is likely to not be blocked by the user's hand, which is very close to the screen.

Offset is another difficulty. Offset is the difference in where the pen is pointing and where the user sees it pointing caused by looking through the glass. Calibration adjusts where the pen tip makes "contact."

Double-clicking and clicking-and-dragging can also be difficult.

Ink modes include Free-Form ink, Annotation ink, Inline ink, and Recognized ink (e.g., musical notes).

Windows XP Tablet PC Edition is a superset of Windows XP. It provides OS ink support and comes with some ink-based applications. There is also the Tablet PC Input Panel, which acts as an interface between writing ink and applications that require keyboard input.

According to MicroSoft, ink is a "First-Class Citizen." Windoes XP Tablet Edition can manipulate ink just like regular Windows can manipulate its text and graphics. Ink can be selected, copied, pasted, changed in text style, changed in color, etc.

According to Markus, development for Tablet PCs is best done on a Tablet PC. (Laughter.) However, applications can be written on a non-Tablet PC, and this task can be eased by the use of a digitizer pad.

The Tablet PC SDK is available and includes support for VFP. The InkEdit control can be dropped on a VFP form. It tries to recognize the ink written into it and convert it to regular text. The right-click menu has alternative spellings and allows you to keep the input as ink. Text can be extracted from it through the Text property.

The Ink Overlay Class collects ink through a form. Attaching the Ink Overlay's hWnd to a VFP form's hWnd enables the form for ink input. The form then has First-Class Citizen ink functionality.

Yet another class is the Ink Picture Control. It is mainly used to annotate images, like the x-ray Markus displayed. But, it can be used without loading the background image.

Saving ink is pretty straightforward. The ink control is an OLE control with an Ink property. The property is the handle to the actual ink. The OLE control's Save method is used to place the ink in a file.

While loading ink, disable inking on the form. Also, the CreateBinary() method needs to wrap the load in order to avoid an error.

Microsoft provides ink "recognizers" to match different languages. Some recognizers perform more specific functions, like limiting entries to a certain word list. Markus used such a function in an inventory application where the ink entries were matched to product names.

Markus's demonstrations included how to set up a specialized recognizer. He developed an inkable textbox control. The control is a standard VFP size and contains standard text until you move into it. Then a large inkable area pops up. Ink can be entered in a size that the standard textbox would not allow. After the user is inking, the textbox displays the results in a regular text format.

According to Markus, Tablet PCs will probably not revolutionize computing, but more and more "notebooks" will come with a digitizer.

 
Chris Bohling, Myers and Stauffer LC 
My experience with database and application development stretches back into the 1980s, when dBase II was on the bleeding edge. In addition to Visual FoxPro®, my current set of development tools includes Visual Basic® .NET, C#, Microsoft® SQL Server™, Windows Installer, and several other applications and utilities. I am a Microsoft Certified Professional in Visual FoxPro® and Visual Basic® .NET. My experience includes full lifecycle development and maintenance work, as a team member and individually, on projects for companies in the insurance, manufacturing, construction, research, non-profit, and cleaning service industries. I spend a lot of my free time reading about software development, project management, and design patterns. I live in Shawnee, Kansas with my wife Claire and my daughter Melanie.

VFP and .NET Working Together

by Evan R. Pauley

2:00 pm

Another .NET session – this one about VFP and .NET working together.  Cathi Gero from Prenia Software and Consulting in Redmond, WA begins her session by warning that Kevin McNeish might be heckling from his session next door (which drew immediate chuckles).

The advantages of VFP 8 when working with .NET include greatly enhanced XML support with the new XMLAdapter class, which allows multiple tables with relationships to be output into a single XML stream or document, the ability to work with XML DiffGrams (which work with only the modifications to the data rather than the entire table.  Additionally, the VFP OLE DB provider has been enhanced for ASP.NET Web forms and Web services, along with .NET Windows forms.

When using VFP 9 with ASP.NET, remote access to VFP information through HTTP is available.  Since ASP.NET scales well across Web farms and is platform-independent, your VFP applications can now support non-Windows users.  In addition, since ASP.NET auto-generates HTML based on the client type, using ASP.NET not only handles transparently different browsers and browser versions, but also opens your applications to mobile device clients such as Pocket PC and Web-enabled mobile phones.

Cathy stated that ASP.NET utilizing XML Web Services is the best solution for IIS web configuration, scales better across Web farms and multiple servers, and has a smoother interface than VFP for IIS/HTTP interfaces.

Cathy then proceeded to demonstrate the design of an N-tier medical application, using an XMLAdapter class in the VFP-written business (middle layer) object.  This was the same application which Ken Levy demonstrated in Monday morning’s keynote address, only more in depth.

Pushing the VFP 8 Report Writer to the Limit

by Evan R. Pauley

3:45 pm

On now to a somewhat tender subject with most VFP developers: the Report Writer.  Ever since VFP 6 came out, most have been begging for some improvements in VFP’s report handling capability.  Cathy Pountney from Optimal Solutions in Grandville, MI is the foremost expert on this subject, and this intensive session was chock-full of tidbits, tips and tricks which had everyone in the room reaching for note pads and pens.

Cathy first showed some of the design-time improvements, including the new Printer Environment check box which (thankfully) removes the need to manually clear the hard-wired printer information that is stored about the default printer on the developer’s captions* (where before, you were required to add a label control), and the new default values on the Reports tab in the Tools/Options dialog for saving the printer environment, using DBC field captions, and the default report font.

Cathy then moved on to the actual task of executing a report.  There are two ways to auto-maximize the Preview window; one, stuffing the keyboard with Ctrl-F10, works the first time – but, since that keystroke is a toggle, and is stored in the FOXUSER resource file, the next execution of the report will un-maximize the window.  Cathy’s smoother solution: place a ZOOM WINDOW “Report Designer” MAX statement in the Init() method of the DataEnvironment (no tables are required in the DE to do this).

You can suppress the “Printing …” dialog with the NODIALOG clause of the REPORT FORM command – but this should NOT be used in a COM object.  If you are using this clause with either the PROMPT or PREVIEW clauses, the NODIALOG must be after the PROMPT clause and before the PREVIEW clause to correctly operate.

You can determine whether the user is previewing or printing the report by checking the SYS(2040) function.  This function returns a *character value* of “0” if no report is being executed, “1” if the user is previewing, and “2” if the user is printing.

You can “chain” reports by using the NOPAGEEJECT clause (to keep the print job open) and the NORESET clause (to keep page numbers from resetting after a report).  If you are chaining reports in a SCAN loop, you must manually close the print job – to accomplish this, execute a dummy report with no output and neither of these clauses.

You can use the new _PAGETOTAL system variable to get the total number of pages for a report, which allows you to print “Page X of Y”.  This forces a “double pass” through the FRX.  The first pass is only to set the system variable; if UDF’s are being called, the developer needs to be certain that these only fire on the second pass (to accomplish this, check for _PAGETOTAL > 0 before executing the UDF).

When combining fields in a single control (ie, Address1 + Address2 + City + State), it is not necessary to check each field for emptiness or ALLTRIM() each field.  A semicolon between two fields says “add a CR if one of the fields isn’t blank”; a comma between two fields trims the fields and adds a space if one of the fields isn’t blank.

If your labels don’t stay even with your “floating” fields, add a line control with a white color between the controls you wish to keep “level” with each other.  This will force the labels to be maintained at the top of the floating field to which they reference.

 
Evan Pauley, Positronic Technology Systems Llc 
Evan Pauley is Director of R&D for Positronic Technology Systems LLC in Knoxville, Tennessee. Since beginning his development career in 1978, he has worked with xBase products since 1982, Fox products since 1988, and VFP since its inception. He now uses VFP and SQL Server to design and develop vertical market applications.

Wednesday, June 18

Beth Massi's Exchanging XML Data Between Visual Basic .NET and Visual FoxPro 8

by Christopher Bohling

Beth Massi worked on the VFP 8.0 team and has experience with distributed applications.

According to Beth, Web Services are a new way to create distributed applications. Among their advantages, Web Services work with non-Windows Internet standards like Java, they enable "smart clients," like VFP applications, in a way that plain HTML can not, and they use standard cross-platform SOAP (Simple Object Access Protocol) messaging.

Beth's session focused on building a Web Service server in VB.NET and a client in VFP. She started with a sample that ships with .NET. In the sample, a method that uses the WebMethod keyword is set up to return the string "Hello World." "WebMethod" exposes the method to public access, like VFP's OLEPublic keyword for classes.

On the client side, in the My XML Web Services pane of VFP 8's ToolBox, the Register option allows you to register a web service in VFP. You need to enter the URL of the WSDL file for the Web Service. This will generate the code that VFP needs to connect to the service.

The Toolbox also contains the WSHandler class (called the "Generic Handler" in the Toolbox). This class hooks to a new builder that allows you to register a Web Service after dropping the class on a form. It generates code to call the Web Service and allows you to specify when the activation takes place.

The Northwind Web Service VB.NET sample uses the .NET CursorAdapter class to create a nested Dataset that then can be sent as XML. The data set is sent in two nodes: an XST schema and XML data. The VFP version of the Northwind example allows you to browse the data as a cursor. By using the XMLAdapter class, VFP knows how to consume ADO.NET data sets that have multiple tables.

For VFP to create the cursor correctly, the server needs to send the schema down. In VB.NET, this is as simple as returning the method's results "As DataSet." The SOAP envelope that is automatically created contains the schema and the XML. Hierarchical data sets can be returned in the same way, as the two nodes will now contain the schema and the data for all of the Datasets included.

On the server side, in .NET, there are a series of properties and methods necessary to return data from SQL Server, using the SQLDataAdaptor. "Fill" is the command for actually retrieving data. A Relation object can be used to create nested data sets.

On the client side, VFP's XMLAdapter gives an object representation of XML Datasets. It contains table collections and field collections; it can manipulate the underlying XML; it will create multiple tables from nested Datasets; and it can send changes back to the server with Diffgrams.

To populate an XMLAdapter with XML data, use the Attach(oData, oSchema) method.

To generate a Diffgram, use the XMLAdapter to set table buffering on. Then set some properties and call the ToXML() method.

Beth demonstrated a form on which she dropped WSHandler. After the user picks a country, form code queries the Web Service. When data is available, the BindControls property is set to true. An XMLAdapter instance on the form is reused for the different data sets resulting from the query. ReleaseXML(.T.) removes the previous schema and data, though it does not close any cursors perviously opened by the XMLAdapter. After closing the old cursor, the ToCursor() method creates a new cursor, which is now the RecordSource of the grid.

The "Save" button calls on the XMLAdapter.ToXML() method to send a Diffgram to the server. This updates the SQL Server database. Setting the IsDiffgram property to true is key to turning the ToXML() action into an update. The example uses a simple VB.NET update of all fields, but finer control is available about what is updated.

Error messages in Web Services are passed by reference. The Try...Catch...Endtry structure in VFP can be used to handle the error.

Finally, Beth looked at the use of CursorAdapters to help automate the use of metadata for FoxPro labels, headers, etc. She cautioned that this should be done only if you know the schema being sent by the server.

Cathi Gero's Mobile Business Development with Mobile Internet Toolkit and ASP.NET

by Christopher Bohling

Cathi Gero, Microsoft MVP in C#/.NET, presented a large amount of information about how to create business applications that work with a wide variety of mobile devices. While some devices respect and the WAP and WML standards, others will work with HTML. Device capabilities also vary based on their form factor.

The Microsoft solution to all this variation is to provide a set of mobile controls for ASP.NET that integrate with the Visual Studio development environment. Assuming that a developer has Visual Studio and access to an IIS 5.0 or higher web server, the additional pieces necessary to get started with mobile development are the Mobile Internet Toolkit and device emulators, available from Microsoft.

One of the key concepts in mobile development is "adaptive rendering." Mobile controls and device adapters, acting at the server level, use information about each device to generate an appropriate rendering. An advanced feature is the ability to override default renderings and control the display precisely.

Creating a Mobile Web form can be as easy as adding the "Mobile" keyword. The first code example below is for a Web and the second for a Mobile Web form.

<Form runat="server">
  <asp:Label runat=“server">Hello, World
  </asp:Label>
</Form> 

<mobile:Form runat="server">
  <mobile:Label runat=“server">
    Hello, Mobile World
  </mobile:Label>
</mobile:Form> 

Also, Cathi presented two examples of ASP.NET output, the first for a WAP phone and the second for a Pockect PC.

<?xml version='1.0'?>
<!DOCTYPE wml PUBLIC '-//WAPFORUM//DTD WML 1.1//EN' 
'http://www.wapforum.org/DTD/wml_1.1.xml'> 
  <wml> 
    <card> 
      <p>Hello World</p> 
    </card>
  </wml> 

<html> 
  <body>
    <form id="ctrl1" name="ctrl1" method="post“ 
             action="example.aspx"> 
      <div>Hello World</div> 
    </form>
  </body> 
</html>

Cathi's slides listed the mobile controls and discussed their major features. The controls fall into the categories of containers, text display, list and selection, control transfer, command, image display, calendar, and validation.

Control transfer is using a control as a hyperlink to another form on the device.

A command control, the phone call control, generates hypertext to make a call. A phone emulator gives different output than a browser. This is due to a predefined alternative in the AlternateFormat property.

Cathi demonstrated that ASP.NET would automatically remove a column from an object list because the screen on the phone device was not wide enough to show it. On other hand, a Pocket PC could show it, so ASP.NET included the column in the output.

Image controls display image files and can have associated URLs. Some devices can not support these.

According to Cathi, the Calendar Control is very rich, but can be cumbersome. It renders differently on different devices.

There are six validator controls. These are the same as in Web page development.

The DeviceSpecific Control uses DeviceFilters to determine which output to send based on the device. For instance, one device might support color and another not. Filters are interpreted as sets of choices (IFs) in ASP.NET code.

The StyleSheet control allows you to set styles for different types of text. Styles are assigned with the StylePreference property.

Cathi stepped through a mobile application that she developed. The application selected a series of Datasets over the Internet as the user navigated a series of data forms that are in one ASPX page. For each form, a Dataset is created and the controls are bound to the data. The user starts by selecting the country and clicking on a command button. The command button click sends the country ID to the server, which queries cities by country. The Dataset is returned, bound to a list, and the city form is made active.

Selecting cities and clicking on the Customers button results in a similar process for selecting and showing customers. For each customer, a Dataset of orders can be retrieved.

Cathi concluded by pointing out the number of resources available to assist developers doing mobile development.

The Closing Session

by Christopher Bohling

The closing session was arranged in a question and answer format with a panel of remaining speakers providing the answers. The one major rule was No Marketing Questions. This made it easy for moderator Andrew MacNeill to toss a few questions immediately into the trash, like "When will Europa be released?"

An interesting early topic that was raised but not answered was why the VFP DevCon focused so much on .NET. Couldn't there be a "pure" VFP conference?

The first couple of serious technical queries, however, were hard for the panel to answer and so were also labeled "marketing questions."

Whether it was a marketing question or not, the audience persisted in wanting to know when and where the next Advisor DevCon would be held. Andrew tried to reassure everyone that there would be a 2004 DevCon, as one of the prizes being distributed at the session was a certificate for free regristration.

The paucity of questions from the audience kind of left the speakers a little bit dumbfounded. Tamar Granor asked, "Does this lack of questions mkean that during this conference you learned everything you need to know?" The audience responded with enthusiastic applause.

The other major activity of the session was giving away prizes to people who had done good things, like filling out evaluations and the scavenger hunt form. Prizes included items such as autographed copies of What's New in Visual FoxPro 8, The Hacker's Guide to Visual FoxPro 7, a 24-port switch (!), and free admission to the next DevCon.

The recipient of the certificate for free admission was chosen by a game where audience members had to put their hands either on their head or their "tail," and then a coin was tossed by an Advisor representative. If your hand location matched the coin result, heads or tails, you were still in the game. Otherwise, you werer out. In no time, the number of remaining players was down to about six, and the next toss determined the winner.

As that basically wrapped things up, the Advisor representative thanked everone for attending and said goodbye. This was followed by an immediate chorus of questions about the next DevCon. The representative answered that there would be a next DevCon, but the where and when were undetermined at this time.

 
Chris Bohling, Myers and Stauffer LC 
My experience with database and application development stretches back into the 1980s, when dBase II was on the bleeding edge. In addition to Visual FoxPro®, my current set of development tools includes Visual Basic® .NET, C#, Microsoft® SQL Server™, Windows Installer, and several other applications and utilities. I am a Microsoft Certified Professional in Visual FoxPro® and Visual Basic® .NET. My experience includes full lifecycle development and maintenance work, as a team member and individually, on projects for companies in the insurance, manufacturing, construction, research, non-profit, and cleaning service industries. I spend a lot of my free time reading about software development, project management, and design patterns. I live in Shawnee, Kansas with my wife Claire and my daughter Melanie.

Using Event Handling in VFP 8

by Evan R. Pauley

8:00 am

Markus Egger from EPS Software in Houston, TX presented the first session of the day on the new event handling features of VFP 8.  Marcus, among many other things, is well known as a several-time Microsoft MVP in VFP and is also the architect of the Voodoo Web Controls.

In an object-oriented methodology, an event is some occurrence that asynchronously “happens”.  The event itself is referred to as a “delegate” (think “pointer to another piece of code”).  Events can have “signatures”, or various parameters which are passed to that piece of code.  An “event handler” is, then, simply a method that reacts to an event.

All VFP controls raise events, and have their own event handler methods.  However, event handler methods are NOT the same as the events, even though they may have the same name (for example, the Click() method of a command button is not the same as the Click event; the method is the event handler).

In VFP 7 and before, you could not alter which piece of code the event used as its event handler.  VFP 8 can now attach *any* piece of code to any event with the BINDEVENT() function.  The piece of code will fire *in addition* to the previously bound event handler, and the developer, using properties of the function, has a certain amount of control as to the order in which these pieces of code fire.  The UNBINDEVENTS() function reverses the process and detaches all event binding added by the developer (the native VFP event handler is left intact).

To determine what is firing when, the AEVENTS() function returns an array information about the last event that fired.  The RAISEEVENT() method fires all the attached event handlers in the specified order.

Deploying your VFP Applications with InstallShield Express

by Evan R. Pauley

9:45 am

We’ve been learning about how to write apps; now we get to learn how to install them.  Andrew MacNeill of AKSEL Solutions in Canada has the next session, Deploying VFP 8 Applications with InstallShield Express (interestingly enough, he has subtitled his session “I already paid for one tool – I don’t want to pay for an installer too”).

If you never need to deploy an application, you don’t need to learn about an installer (smile).  But, since most of us must deploy our work to users occasionally, and since XCOPY just doesn’t seem to do the job in the Windows world anymore, the Windows Installer was born about halfway through the development process for VFP 6 (six).  Windows Installer makes use of “merge modules” which tell the installer about all the necessary files to include in the installation, and tracks the files being used to reduce the chance of deleting a shared file.  Unfortunately, the Installer interface for creating a merge module was overly complicated to use and maintain, and used the Setup Wizard (which most developers hated).

Starting with VFP 7, InstallShield Express 3.0 (ISE) replaced the Setup Wizard.   ISE 3 was a “customized for VFP” (read: ”limited”) version of the actual ISE 3 product, which was a limited version of the professional version – basically, a wizard of a wizard.  This was considered “two steps forward and one step back” by most VFP developers, especially when they discovered the limitation of not being able to run any specialized code after the setup had been completed!  Additionally, since ISE uses a scripting language (which can be somewhat arcane), using the tool required the developer to learn yet another syntax.

VFP 8 includes version 3.5 of ISE, which is a considerable improvement over the previous incarnation.  ISE’s interface allows the developer to control MOST (but not all) of the properties of the Windows Installer merge module that ISE builds.  Andrew proceeded to describe the organization of ISE, how to add features and install COM objects along with your application, how to specify which operating systems on which your application will allow itself to be installed and in what locations, what additional software shortcuts are desired, and how the target system should be configured.

Database Performance with VFP 8 and Windows XP

by Evan R. Pauley

2:00 pm

The final “content” session of the day concerned VFP 8’s performance with large databases, presented by Mac Rubel of EPS Software in Houston, TX.  Mac has a long history and excellent reputation in the VFP world performing these type of benchmark tests with VFP and its data performance.

Mac’s test machine was a 2.4 GHz processor with one 40GB and one 80GB hard drive and a 100 Base-T network card.  Mac’s benchmarking methodology attempts to minimize as much as possible the Heisenberg principle (which states that the act of observing changes the conditions of the test, and therefore alters the results).  Before each test, Mac wipes the 80GB drive and restores from another drive the exact image in the exact order.

The SYS( 3050, n ) function (everybody knows this one off the top of their head, right?)(mmm-hmmm, that’s what I thought) returns various “amount of memory available” values.  VFP slows down precipitously when the operating system “tricks” VFP into thinking that it is working with real memory, when in fact the OS has allocated “virtual memory” (read: disk space).  This doesn’t happen often, since VFP is reasonably smart about these things, and usually only occurs when several applications are running simultaneously or several large data sets are being handled at the same time.

Mac’s databases sizes for testing bump up against the 2GB file size limit imposed by VFP.  Mac demonstrated that as table size increases (and therefore the use of memory increases), VFP has enough intelligence to maintain a consistent, flat curve in its speed of indexing the table.  Surrogate keys are ALWAYS better than meaningful keys for business purposes, and integer keys will ALWAYS perform about 7% faster than BINTOC() keys, about 22% faster than character keys, and about 25% faster than numeric keys regardless of the table size.

Mac also showed that increasing CPU speed does not necessarily show a corresponding increase in execution speed.  In fact, increasing processor speed only provides a small percentage increase (usually 5 to 15 percent); increasing disk size, speed and/or throughput is better, but only slightly.  When comparing local access vs. network access to a LAN server, SQL SELECT statements are faster on the server because of the more efficient caching on the server, regardless of the speed of the network.  Indexing, however, varies based on the speed and the topology of the network (switches are faster than hubs, and so forth).  Both LAN scenarios vary widely depending upon what other network usage tasks are being performed.

Memory size causes the most variance in performance.  When indexing 1 million records, there is a large drop in speed when available memory is increased from 128MB to 256MB, but the curve is almost perfectly flat with greater memory values.  Above 512MB of memory, few if any performance benefits are achieved.

 
Evan Pauley, Positronic Technology Systems Llc 
Evan Pauley is Director of R&D for Positronic Technology Systems LLC in Knoxville, Tennessee. Since beginning his development career in 1978, he has worked with xBase products since 1982, Fox products since 1988, and VFP since its inception. He now uses VFP and SQL Server to design and develop vertical market applications.



Copyright © 1993-2008, Level Extreme Inc., All Rights Reserved
62 Rue Doucet, Petit-Rocher, New Brunswick, E8J 1L3
Telephone: 1-506-783-9007 Email: mfournier@levelextreme.com