Tuesday, March 04, 2008

FoxRockx

The first issue of FoxRockx, a new bimonthly magazine published by MVP Rainer Becker, is almost ready for release. The first issue has an introduction to VFPX by Rick Schummer, a Kitbox article from Andy Kramek and Marcia Akins, a how to-article from Tamar Granor, and part one of a two-part article presenting generic import classes by me.

If you're a current FoxTalk subscriber, the remainder of your subscription will automatically be honored as a FoxRockx subscription, as Rainer has taken over FoxTalk from Eli Journals. Something is also being done for Advisor Guide to Visual FoxPro subscribers, although I don't have details. For everyone else, subscriptions are inexpensive: $99 US/99 euros for online-only or $138 US/128 euros for online and printed copy. Subscriptions in North America will be available from Hentzenwerke Publishing.

The Web site isn't quite ready yet but they're working on it.

In addition to the magazine, another benefit is online access to past issues, including source code, of FoxTalk. As far as I'm concerned, that's worth the subscription price alone!

Please support this new magazine by subscribing as soon as subscriptions are available. This is the only magazine devoted exclusively to VFP, and like VFP conferences, this falls into a "use or lose it" category.

Saturday, March 01, 2008

Another Update for My Namespace

While working on a chapter on the My namespace for an upcoming book on VFP 9 Service Pack 2 and Sedna (more details in a future post), I came across and fixed a couple of bugs:

  • The My Registration Editor form had a typo in the tooltip for one of the edit boxes and the wrong tooltip for another. Also, it didn't find an existing record in the My table for a non-My class, so it acted like the class was being registered for the first time.
  • The MyFoxCode class, the main IntelliSense class for My, would locate and use deleted records in the My table rather than the current ones.

I've posted an updated version on the Technical Papers page of one of my Web sites, www.stonefield.com.

Monday, February 25, 2008

ReportListener Article Available

I wrote a two-part series of articles in FoxTalk in April and May 2005 that discussed a ReportListener which stores the position each object was rendered at in a cursor. That ReportListener collaborates with a custom preview window to provide a "live" preview surface. This gives cool abilities to the preview window, including hyperlinking and support for finding and highlighting text.

The first article was republished on MSDN (http://msdn2.microsoft.com/en-us/library/ms947692.aspx) but the second wasn't (or is now missing). So, I've posted both articles and the source code at http://www.stonefield.com/techpap.html.

Second Vista Article Online

I completely forgot to mention this earlier: part 2 of my Advisor series on VFP and Vista is available online at http://my.advisor.com/doc/19195. In this article, I go over opportunities to take advantage of new Vista features, including user interface improvements, Windows Desktop Search, RSS feeds, and XML Paper Specification.

Update: Since Advisor is closing online access to their articles, I have put a copy of my “Developing VFP Applications for Windows Vista” white paper, the source material for this article, on the Technical Papers page of Stonefield’s web site.

Vista SP1 Fixes a Problem

A weird issue cropped up on my system a couple of weeks ago. Because of when it occurred, I'm pretty sure it was caused by a patch installed by Windows Update. The problem: opening Windows Explorer or an Open File dialog took about 30 seconds. The problem was worse when I was connected to our LAN and a little better when undocked. It didn't matter whether it was for a local drive or network drive; it still took an annoying amount of time to see the window or dialog.

I did some research on this and tried turning off the sharing violation notification delay as noted at http://support.microsoft.com/kb/889588. Even more weird, that fixed the problem for a couple of hours, but then it went back to the horrible delay.

Finally, I decided to install Vista SP1 (available next month via Windows Update but available now for MSDN subscribers) and see if that helped. Installation was easy: create a system restore point just in case, start the process, go for lunch, done when I got back. And I'm happy to report that the problem has gone away: Windows Explorer comes up very quickly for both local and network drives now.

Tuesday, February 12, 2008

DevCon RIP?

As I suspected when there were only 35 attendees at last year's conference, it looks there won't be a VFP DevCon this year. The Advisor Summit in April features .Net, Visual Studio, ASP.Net, SQL Server, and Access, but no VFP.

DevCon has been irrelevant for several years, as other conferences (including Southwest Fox) long ago surpassed it for quality and cost. So its loss, while slightly lamented strictly from a historical point-of-view, will hardly be noticed.

Wednesday, January 30, 2008

Checking out Windows Live Writer

I've been using the Blogger editor for the past couple of years (except for a while when I used Qumana) and while it's improved a lot from when I started using it, I thought I'd check out Windows Live Writer after Rick Strahl mentioned he likes it.

I like the preview features, both Web Layout, which shows just the article you're entering in the theme of your blog and is fully editable, and Web Preview, which shows what the post will look like in your blog but isn't editable.

Live Writer has lots of cool features. For example, it's really easy to insert a map or aerial view. Here's the world-wide HQ of Stonefield Software (the building is somewhat shaded by the tall apartment building just to the south):

Map image

You can also easily insert pictures, links, tags, tables, and videos. Plug-ins make it even easier to use; available at http://wlwplugins.com/ are plug-ins such as SnagIt Screen Capture Plugin for Windows Live Writer and WebSnapr URL Preview Image.

It has the usual formatting capabilities, spell checking, and lots of other features. So far, so good.

Some Interesting Posts

Here are some blog entries I've found particularly useful or interesting of late:

Reinventing the Clipboard: discusses why the Windows clipboard needs to be rethought and even better, links to a cool tool (Clipx) that provides a multi-entry clipboard.

TIP: Compressing Virtual PC images: Craig's tips are always great and this one saves lots of disk space.

Why Your Business Must Be on the First Page of Google: yes, it's marketing, but since we're all involved in marketing one way or another, you might as well figure out how to do it better. Mike's blog has lots of useful tips and I found this article really interesting.

Evolve Your User Interface To Educate Your Users: the Smashing Magazine blog is mostly web-oriented but is almost always interesting. However, the ideas in this post are also applicable to making desktop apps easier to use.

Friday, January 11, 2008

Don't Save if Minimized

We've had a few people report an unusual problem: when they launch Stonefield Query, rather than displaying a login dialog, it looks like it's hung, but pressing Esc makes it close. It turns out that under some circumstances, the login dialog appears behind the application but has focus. As a result, it waits for the user to login and since it's a modal dialog, it looks like the application has hung. Pressing Esc cancels the dialog and closes the app. If you type the user name and password (blindly, of course, since you can't see the dialog) and press Enter, it succeeds.

We couldn't reproduce this ourselves and setting the login form's AlwaysOnTop to .T. didn't help for those people who did encounter it.

Then someone today reported the following situation: they minimize Stonefield Query then log off from Windows. (Minimizing, right-clicking on its Task Bar item, and choosing Close also caused the problem.) The next time they launch Stonefield Query, it starts minimized. They restore it and boom, the application is "hung" but pressing Esc closes it. Bingo -- we have a reproducible scenario.

In digging into this, I found the following code executes when the application shuts down:
with This.oRegistry
.SetKey(lcKey, 'WindowState', _screen.WindowState)
.SetKey(lcKey, 'Height', _screen.Height)
.SetKey(lcKey, 'Left', _screen.Left)
.SetKey(lcKey, 'Top', _screen.Top)
.SetKey(lcKey, 'Width', _screen.Width)
endwith
This code stores the current size, position, and window state of _SCREEN so the next time they launch Stonefield Query, it can restore those settings. And that's the start of the problem: when the application is minimized, _SCREEN.Top and Left are set to -32000. The login dialog then opens and since it has Desktop set to .T. so it looks nice in Windows Vista, it doesn't live inside _SCREEN but centers itself inside the current location of _SCREEN. That makes it really far offscreen. Then the user restores the application, which puts _SCREEN back where it was, but since the login dialog doesn't live in _SCREEN, it doesn't move. So, while it has focus and the user can type in it, they can't see the dialog.

The solution was easy: don't call the above code if _SCREEN.WindowState is 1-Minimized. That way, _SCREEN will be restored to the size and position it was the last time it was closed while actually visible.

Wednesday, January 02, 2008

Here's an Obscure One

I spent a couple of hours this afternoon tracking down and resolving a very obscure bug. See anything wrong with the following SQL statement?
select ;
CONTACT1.COMPANY, ;
CONTACT1.KEY4, ;
CONTACT2.UJRCONSULT ;
from CONTACT2 ;
right outer join CONTACT1 ;
on CONTACT2.ACCOUNTNO=CONTACT1.ACCOUNTNO ;
where CONTACT1.KEY4 like '%JDM%' or ;
CONTACT2.UJRCONSULT like '%JDM%'
Neither did I, yet this gives a "Function argument value, type, or count is invalid" error. Long story short, it turns out this is the set of conditions that make this fail:
  • An OUTER JOIN
  • A filter condition on the "other" table (e.g. the left table for a RIGHT OUTER JOIN); in this case, it's the second condition that causes the error
  • The field in the filter is a Varchar
  • One or more records have a null value in that field
  • The filter uses the LIKE operator

Changing any one of these makes the error go away. In my case, I changed the filter condition to:

nvl(CONTACT2.UJRCONSULT, '') like '%JDM%'
and that fixed the problem.