Wednesday, April 18, 2007

Handling Multiple Monitors

One of the things I did when I got my new laptop is to set up multiple monitors. Developers I know and respect have raved about this for years, so I figured it was time to give it a try. Needless to say, I love it. I typically have browser and explorer windows open on the second monitor and keep the primary monitor for those things I live in all day long (VFP and Outlook, mostly). I'm more productive now that I'm not digging through stacks of windows and constantly moving or resizing one window or another.

However, one of the things I discovered today is that some of my applications don't respect the second monitor. For example, I have a class called SFPersistentForm that I drop on most of my forms. It saves the form size and position when the form is closed and restores it when the form is reopened, giving the user the experience they expect when working with that form. However, I discovered that if I opened a form and moved it to the second monitor then closed it, when I reopened it, the form displayed on the primary monitor instead (this was a form with Desktop set to .T. so it can exist outside the application's window).

I quickly found out why: the persistence code was trying to prevent the situation where the form may open outside the screen boundaries, making it invisible. The following code handled that:
Thisform.Width  = min(max(Thisform.Width,  0, Thisform.MinWidth), ;
_screen.Width)
Thisform.Height = min(max(Thisform.Height, 0, Thisform.MinHeight), ;
_screen.Height)
Thisform.Left = min(max(Thisform.Left, 0), _screen.Width - 50)
Thisform.Top = min(max(Thisform.Top, 0), _screen.Height - 50)
("- 50" is used to ensure the form doesn't start at exactly the right or bottom boundaries of the monitor, making it essentially invisible.)

There are actually two problems with this code. First, the reliance on _SCREEN assumed the form exists within _SCREEN; with a top-level form or one with Desktop set to .T., that's not necessarily the case. Second, even if _SCREEN is maximized, that only fits it in the current monitor. If the form is on the other monitor, _SCREEN's dimension are irrelevant.

I initially changed the code to:
if Thisform.Desktop or Thisform.ShowWindow = 2
lnWidth = sysmetric(1)
lnHeight = sysmetric(2)
else
lnWidth = _screen.Width
lnHeight = _screen.Height
endif Thisform.Desktop ...
Thisform.Width = min(max(Thisform.Width, 0, Thisform.MinWidth), ;
lnWidth)
Thisform.Height = min(max(Thisform.Height, 0, Thisform.MinHeight), ;
lnHeight)
Thisform.Left = min(max(Thisform.Left, 0), lnWidth - 50)
Thisform.Top = min(max(Thisform.Top, 0), lnHeight - 50)
However, it turns out that SYSMETRIC() only returns values for the primary monitor. So, I changed those two statements to:
declare integer GetSystemMetrics in Win32API integer
#define SM_CXVIRTUALSCREEN 78 && Virtual Width
#define SM_CYVIRTUALSCREEN 79 && Virtual Height
lnWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN)
lnHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN)
Now the form reopens in the exact same size and position, including the monitor it was on.

Update: As I posted in a comment, this code correctly handle the situation where the form was originally placed on a second monitor but now that monitor doesn't exist. However, it didn't handle the case where the secondary monitor is on the left, so the starting X position is negative. See the code in the comment to deal with that.

Saturday, March 31, 2007

Roxio Vista Patch Available

Last month, I blogged that one of Roxio's drivers, the Sonic Solutions DLA driver, isn't compatible with Vista, causing a "this driver is blocked due to compatibility issues" alert at startup. Fortunately, a fix is now available from http://docs.roxio.com/patches/d2d3290.exe.

Wednesday, March 28, 2007

Fixing Outlook 2007 Searching

Until I got my new laptop, I'd always used Outlook Express as my email client. There wasn't any particular reason for it other than habit. However, I'm now using Outlook for email because it has much better spam filtering (and lots of other goodies as I'm discovering).

One problem though: searching didn't work. Even if I searched for a keyword I knew was in a message, it always returned no results. Apparently, this is pretty common, given all the messages on various forums about this problem. There are a variety of possible causes, but mine was caused by installing an Office 2003 component (in this case, FrontPage, which is not available with Office 2007). Fortunately, the fix was easy: repair Office 2007 as described here and then rebuild the index (not mentioned in that article but necessary nonetheless: choose Indexing Options from the Control Panel, then click Advanced and click Rebuild). Now my searches are lightning-fast, which is about a bazillion times faster than Outlook Express was.

As an aside, I purchased a copy of Microsoft Expression Web, the replacement for FrontPage, and promptly uninstalled Frontpage. So far, I like Expression Web. I'm not much of a Web page designer; I just need to maintain a couple of sites without too much fancy stuff. My favorite feature in Expression Web is master pages, which allows you to create a template for your Web site and then just add the content to each specific page.

Sunday, March 25, 2007

Southwest Fox 2007: Speakers Deadline Tomorrow

The deadline for session submissions for Southwest Fox 2007 is tomorrow, Monday, March 26, at 8 am EDT. If you're interested in speaking, click on the Call for Speakers link at http://www.swfox.net/speakers.html. Please read the entire document before submitting session proposals. Speakers and topics will be announced May 1, 2007. Send any questions to speakers@swfox.net.

Wednesday, March 21, 2007

Southwest Fox 2007: Speakers Deadline Approaching

Just a reminder that if you'd like to speak at Southwest Fox 2007, the deadline for session submissions is Monday, March 26. We're interested in both experienced speakers and those who are new but have an interesting topic.

If you're interested in speaking, click on the Call for Speakers link at http://www.swfox.net/speakers.html. Please read the entire document before submitting session proposals. Speakers and topics will be announced May 1, 2007. Send any questions to speakers@swfox.net.

Wednesday, March 14, 2007

Microsoft's Announcement

In case you missed it, Microsoft announced yesterday that VFP 9 SP 2 will be the last version of VFP and that Sedna will be released as one or more shared source projects on CodePlex.

Several others, including David Stevenson, Craig Berntson, Alex Feldstein, and John Koziol, have blogged about this already. My thoughts about this echo theirs: not surprised but both sad and happy.

Not surprised because if you carefully read the VFP roadmap, you could see that there really was no plan for a VFP 10. The announcement really was a confirmation rather than anything new (well, the part about VFP 10 anyway; the Sedna announcement really is news).

Sad because the VFP team isn't exactly a team anymore. They're mostly working on adding VFP-like features to Visual Basic, with some effort on getting VFP 9 SP 2 done. After it ships, they'll be available from time-to-time to work on bug fixes for VFP (likely only major ones, which are unlikely given how long VFP has been shipping) but there really won't be a VFP team anymore.

Happy because Sedna will now be available for free to all VFP developers, plus since it's available with source code and the same license as VFPX, we'll be able to customize and adapt its components as we see fit.

Here are my thoughts on this announcement in no particular order.

The VFP core is almost done. The only thing left to do is finish up some Vista-related issues, and that'll be in SP2. I remember Ken Levy's response at various conferences when asked what was going to be in the next release of VFP: "what features do you want?" Invariably, the answer was "I don't know". I honestly can't think of any new feature I want in VFP that must be in the core (ie. VFP9.EXE). The things I want, like new UI components (such as the Office 2007 ribbon), can be created using VFP code, GDI+ calls, or ActiveX controls without touching the core. So what could the VFP team do that would prompt developers to buy a VFP 10 in sufficient quantities to pay for the development costs? Let's not talk about "fixing the 2 GB limit" since that's not even remotely reasonable (they'd have to examine nearly every single line of code that makes up VFP and the test load would be enormous) nor is it really important: if you have that much data, use SQL Server, Oracle, or something else as the data store.

Suppose the announcement was about Microsoft Word instead of VFP. Would that mean you have to switch to a different word processor? Of course not. I'd continue to use Word until it no longer worked on some future system. After all, what new features in Word would I need added? I hardly use the full feature set now. So, if they stopped new development of Word and put it into maintenance mode, I'd be fine. It's the same thing with VFP; as long as it continues to work on any future operating system Microsoft chooses to release (and there isn't anything special in VFP that would prevent that from happening any more than there is in hundreds of thousands of other applications), I'm fine. I can continue to develop VFP applications for at least the next 10 to 15 years, at which point I'll be ready for retirement. In other words, if I choose to do so, I could use VFP for the rest of my career.

I've heard a few snide comments from other MVPs here at the MVP Summit that VFP is now dead or discontinued. That's not true at all. I can continue to purchase VFP licenses for new development staff for several more years and I can continue to receive support from Microsoft until 2015 (I've never actually contacted MS support, not one single time, but it's nice to know it's there just in case). That's not definition of dead. To me, dead means I can't buy any more licenses so no new staff could legally use it and there'd be no support available for it. I'm willing to bet that, like me, you've never or rarely contacted MS for VFP support, because the support available from the VFP community is so much better, faster, and cheaper than what you can get from MS.

The future of VFP is on CodePlex, in the VFPX and other VFP-related projects. We as a community can continue to enhance VFP through shared source projects. Just look at the extremely cool projects available there now. Add to that the entire set of components in Sedna and all the other things people can create and you'll see that there isn't much limit to what we can continue to do with VFP.

I'm not an MS apologist, I'm not naive, and I don't have my head in the sand. I realize that the product we all love has a limited shelf life. However, I've known that for years, and it didn't stop me from making buckets of money using this tool. I'll continue to use VFP while also using other technologies where it makes sense (for example, we use several C# components in Stonefield Query because those components enable us to, for example, access ACT 2007 data that we can't get at natively using VFP).

It comes down to using the right tool for the right job and making decisions that make sense for your business and your customers. VFP continues to make sense for me, so I'll continue to use it for a long time to come. I'll continue to write articles, continue to answer questions on various VFP forums, and continue to attend and speak at conferences.

Thursday, March 08, 2007

Southwest Fox 2007: Call for Speakers

Southwest Fox 2007 (October 18-21 in Mesa, AZ) is looking for speakers. The conference is focused on Visual FoxPro and sessions should fit into one of the following tracks:

  • Working with Sedna and SP2: This track will cover the new features and changes introduced in Sedna and in VFP 9 Service Pack 2.
  • Extending VFP (including VFPX, COM, etc.): The sessions in this track will cover technologies that extend VFP's capabilities, such as those in VFPX.
  • Reviewing VFP Fundamentals: This track will appeal to those newer to VFP, whether they are just moving up from earlier versions of FoxPro, or coming from other languages.
  • Integrating VFP (with SQL Server, .NET, etc.): This track will look at using VFP together with other products, including back-end servers, Automation servers, and .NET.
  • Managing the Software Business: This track will offer business advice to VFP developers, including managing clients, the software development process, and so forth.
If you're interested, click on the Call for Speakers link at http://www.swfox.net/speakers.html. Please read the entire document before submitting session proposals. All proposals are due by March 26; speakers and topics will be announced May 1, 2007. Send any questions to speakers@swfox.net.

Thursday, March 01, 2007

Announcing Southwest Fox 2007

Southwest Fox 2007

October 18-21, 2007
Arizona Golf Resort and Conference Center in Mesa, Arizona

http://swfox.net

It is our pleasure to announce the fourth annual Southwest Fox Conference, presenting the latest in Microsoft Visual FoxPro development techniques, new changes in VFP 9.0 SP2, Sedna Components, and interop with other technologies with sessions from some of the best and the brightest VFP speakers.

This highly acclaimed and popular conference is the perfect venue for VFP developers interested in learning more about VFP, further refining their software development skills, learning how to better run a consulting firm or IT department, and being a better software craftsman. To this end, there will be sessions available in the following tracks:

1) Working with Sedna and SP2:
This track will cover the new features and changes introduced in Sedna and in VFP 9 Service Pack 2.

2) Extending VFP (including VFPX, COM, etc.):
Sessions in this track will cover technologies that extend VFP's capabilities, such as those in VFPX.

3) Reviewing VFP Fundamentals:
This track will appeal to those newer to VFP, whether they are just moving up from earlier versions of FoxPro, or coming from other languages, or are new to a specific area of VFP.

4) Integrating VFP (with SQL Server, .NET, etc.):
Sessions in this track will look at using VFP together with other products, including back-end servers, Automation servers, and .NET.

5) Managing the Software Business:
This track will offer business advice to VFP developers, including managing clients, the software development process, and so forth.

The call for speakers will go out shortly and the initial speakers and their sessions will be published when registration opens on May 1st.

If you are interested in more details for the conference you can send them to info@swfox.net.

You will also notice that Southwest Fox is under new management. After three very successful years under Bob Kocher's management, Southwest Fox is now being organized by Visual FoxPro MVPs Rick Schummer, Doug Hennig and Tamar E. Granor. We look forward to continuing the great traditions of Southwest Fox, and building on some new ones too.

More details can be found at www.swfox.net.

We look forward to seeing you in Arizona in October!

Saturday, February 24, 2007

In the Land Down Under

After a really long Tuesday (up at 6 am, a one-hour afternoon flight to Calgary, a three-hour evening flight to Los Angeles, and a fourteen-hour overnight flight to Sydney), I arrived in beautiful, warm Australia Thursday morning. Craig Bailey was at the airport to pick up me and Rick Schummer, whose flight arrived an hour before mine, and take us to the hotel. After a shower and a change of clothes, the three of us took a train across the Sydney Harbor Bridge to the Central Business District (CBD), Sydney's downtown area. We went to the top of the Sydney Tower for some incredible views of the city and harbor area:



We then walked a bit around the downtown area and made our way to the Circular Quay area, home to ferries (with destinations throughout the harbor), the world-famous Sydney Opera House, and The Rocks, a wonderfully preserved section of the oldest part of Sydney (Craig is on the left and Rick on the right):



The Queen Elizabeth 2, one of the largest passenger ships in the world, was docked in the harbor, and in fact left Sydney while we dined at Doyle's, a fabulous seafood restaurant located right beside where the ship was docked, that evening:

Rick and I were both pretty jet-lagged after dinner, so we called it an early night; I was asleep by 9 pm.

Of course, I was up the next day at 5 am. I spent a few hours catching up on email, then Rick and I caught a train to Circular Quay and book a ferry to Taronga Zoo. We found a great visitor information center, probably the best one I've ever seen, in The Rocks area while waiting for the ferry. Taronga Zoo is an incredible zoo, easily as beautiful as the San Diego Zoo, but with an even better location, as I'm sure you'll agree from this picture taken from the zoo looking back to the Sydney Harbor:

Here's a picture of one of the many koalas:


Here's Rick with a very friendly wallaby (similar to a kangaroo but smaller):


After spending a few hours at the zoo, we caught the ferry back to Circular Quay, but via Watson's Bay, so we got a great view of the entire harbor, including getting caught in the middle of a sailboat race (one sailboat missed us by only a few feet!).

We then caught the train to the Olympic Park, where the 2000 Olympic Games were held. The park is used daily for a wide variety of activities, including concerts, conferences and trade shows, and athletic training. The Aquatic Center was amazing; this picture is of just part of it:


We headed back to the CBD and after a futile search through The Rocks for a Thai restaurant, had dinner at a Chinese restaurant and called it a night.

Saturday we had to get up early, which hasn't been a problem at all so far given the jet lag, and joined a tour group going to the Blue Mountains. The Blue Mountains are similar to the Grand Canyon, only lush and green (and blue, which comes from vaporized eucalyptus oil from the million of eucalyptus trees). I didn't take a lot of pictures there because I went there after OzFox 2004, but Rick did, and I'm sure he'll post some on his blog. After a hour going down the world's steepest railway, wandering in the rainforest, and back up a cable car, the bus took a long, winding, and somewhat white-knuckle road to Jenolan Caves. After a quick lunch, especially for Rick, whose food seemed to take forever to be served, we join the Lucas Cave tour. It was an amazing 90 minutes lead by a very knowledgeable and fun guide named Ian. Here are a couple of pictures:


After a long ride back to Sydney, Rick and I had some very good Greek food (after yet another fruitless search for Thai!) and headed back to our hotel.
We had three fabulous days of sightseeing, but now it's time to get to work; OzFox starts today (Sunday), so Rick and I went over our keynote this morning and tested our laptops with the projector. I also went over my sessions one last time and now it's time to meet the attendees and start the conference.

Tuesday, February 20, 2007

My New Toy -- Followup

My new system is all set up and ready to go to OzFox. It's way faster than my old system, Vista is fun and attractive, and you can't beat a 17" widescreen display. I even hooked up my 20" LCD monitor, which was the main display when my old laptop was docked, as a second monitor. I very quickly got used to having 3500 horizontal pixels to work with!

Some of the work in setting up the new system had nothing to do with the new system; it was fixing file paths. I had C: and D: partitions on my old system, with only system files on C: and everything else, including applications, on D:. The logic was that if I needed to rebuild my system, I'd reinstall the operating system on C: but all of my files on D: would be untouched. Of course, I never ended up doing that, and had to live with a relatively small C: partition which required me to clean up every year or so to eliminate out of disk space errors. I decided to stick with a single partition on the new system and put all of the non-application files from the former D: partition into one folder hierarchy so all the relative paths would stay the same. Of course, absolute paths are different, so it took me a while to go through all of my projects, locating all of the files from places like the VFP home directory and FFC folder, and fixing paths to include files in various places.

The other thing that took a while that I wasn't expecting is changing from using Outlook for calendar, Outlook Express for email, and FeedDemon for RSS feeds to using Outlook 2007 for all of that. The hardest part was getting messages out of Outlook Express and into Outlook. There may be an easier way, but I didn't find it after a couple of hours of dorking around. I ended up exporting from Outlook Express and importing into Outlook on the old system, then exporting from that Outlook and importing into Outlook on the new system. I really like Outlook 2007 and don't know why I stuck with Outlook Express for so long.

The only slight glitch so far is that Dell installs a cut-down version of Roxio for CD and DVD burning. One of the drivers that comes with Roxio, the Sonic Solutions DLA driver, isn't compatible with Vista, so at startup, a "this driver is blocked due to compatibility issues" alert comes up, followed by a Program Compatibility Assistant dialog. Clicking OK once is bad enough, but for some reason, the alert and dialog would come up seven times on system start. Even worse, if I stuck a DVD in the drive, the alert/dialog combination would come up continuously until I removed the disc. This quickly became a huge PITA.

Fortunately, Google helped me find the solution at http://forums.support.roxio.com/index.php?showtopic=17098. It does require a couple of restarts, but 10 minutes later, I'm good to go.