Tuesday, March 31, 2009

Check Your Bank Statements!

Here's a cautionary tale about banks that happened to us recently: http://www.softwareceo.com/products_services/hp_article.aspx?arttype=TT&page=0

Monday, March 16, 2009

Encrypting VFP Tables Using Advantage Database Server

J. D. Mullin blogged about a new video he posted showing how to encrypt VFP tables using Advantage Database Server (ADS). This is the latest in a series of videos on using ADS with VFP tables.

Thursday, March 12, 2009

Southwest Fox Session Proposals Due Next Week

Just a reminder that session proposals for Southwest Fox 2009 are due on Monday, March 16. We are always looking for new speakers, so if you have some interesting ideas, submit your proposals by Monday.

Thursday, March 05, 2009

Servoy Webinar for VFP Developers

Servoy is presenting a free Webinar discussing their product for VFP developers on March 26, 2009 at 10 am PST.

VFP DDEX Provider Updated

As Craig Berntson notes, Microsoft released an updated VFP DDEX Provider yesterday. The original, part of Sedna, had an expired license key so it wouldn't work if you installed it after March 2008. The new version is also a little easier to install, as there are fewer steps. I posted the new version of VFPX on the DDEX for VFP page.

Monday, March 02, 2009

Easier URL for VFPX

Sara Ford blogged Friday that all VFPX projects are now accessible using their name as a subdomain. This makes the URL for VFPX the nice and short http://vfpx.codeplex.com.

Replacement for SYS(2014)

SYS(2014) is a great little function that helps make your applications portable. Since it returns the relative path of a file to a specific folder, you can use it on an absolute file name (such as one returned from GETFILE()) and store the relative rather than absolute path.

However, one thing that's always bugged me about SYS(2014) is that it returns the path in upper-case. If you want to display the path to the user, they'll wonder why the path is upper-cased in your program but in a different case on disk.

Fortunately, there's a simple Windows API function you can call that does the same thing as SYS(2014) but respects the case. Here's an example of how to use that function:

(UPDATE: Walt Krzystek pointed out that GetRelativePath returned a blank string if the two paths are on different drives. Also, I neglected to trim trailing spaces from the return value.)

function GetRelativePath(tcTo, tcFrom)

#define MAX_PATH 260

declare integer PathRelativePathTo in shlwapi.dll ;
string @out, string @from, integer fromattrib, ;
string @to, integer toattrib
lcPath = space(MAX_PATH)
lcFrom = iif(vartype(tcFrom) = 'C', tcFrom, ;
sys(5) + curdir()) + chr(0)
lnFromAttrib = iif(directory(lcFrom), FILE_ATTRIBUTE_DIRECTORY, ;
lcTo = iif(vartype(tcTo) = 'C', tcTo, ;
sys(5) + curdir()) + chr(0)
lnToAttrib = iif(directory(lcTo), FILE_ATTRIBUTE_DIRECTORY, ;
PathRelativePathTo(@lcPath, @lcFrom, lnFromAttrib, @lcTo, lnToAttrib)
lcPath = alltrim(strtran(lcPath, chr(0), ' '))
if empty(lcPath)
lcPath = tcTo
endif empty(lcPath)
return lcPath

Sunday, March 01, 2009

Cleaning up _MemberData

The MemberData Editor, the replacement New Property/Method dialog, and the fantastic new PEM Editor all make it easy to get VFP to display the desired case for your custom properties and methods in IntelliSense and the Properties window rather than the lame lower-case it normally uses. The secret is _MemberData, a custom property added to a form or class that contains XML providing additional information about members, such as display case, whether they appear in the Favorites tab of the Properties window, and scripts to execute when you double-click properties in the Properties window.

One of the problems with _MemberData, though, is that it's limited to 8K. If you've ever worked with XML, you know it's very wordy and it doesn't take long to blow through the 8K limit. This is especially a problem with subclasses: not only do they contain the _MemberData XML for their own custom members, they also contain the XML for all parent class members. The deeper you go in a class hierarchy, the longer the XML gets and the closer you get to the 8K limit.

However, a little known fact about _MemberData is that it's cumulative: VFP internally combines the XML from the current class and all parent classes. Even if you blank _MemberData in a subclass, your members still display in the proper case. So, one way to keep that 8K limit at bay is to strip everything but the XML for the members added in the current class from _MemberData.

That would be a tedious chore to do manually. Fortunately, a couple of new features in version 4.0 of PEM Editor (currently in development) make this a breeze. The Cleanse MemberData function in the shortcut menu does this explicitly, but PEM Editor also does this automatically when you add a new member to a class.

If you can't wait for PEM Editor 4.0, I've uploaded a small PRG that does the same thing (in fact, it's the same code as in PEM Editor 4.0) to the Technical Papers page of the Stonefield Web site. To use it, open a class or form, then DO MDCleaner.PRG. Just to be safe, please back up your form or class first.